{"openapi":"3.1.0","info":{"title":"Kernel","version":"0.1.0"},"paths":{"/health/live":{"get":{"tags":["health"],"summary":"Live","description":"The process event loop is alive; no dependencies are checked.","operationId":"live_health_live_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"type":"string"},"type":"object","title":"Response Live Health Live Get"}}}}}}},"/health/ready":{"get":{"tags":["health"],"summary":"Ready","description":"Database reachable and migrated to the revision this build expects.","operationId":"ready_health_ready_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/auth/register":{"post":{"tags":["auth"],"summary":"Register","description":"Create an account and sign it in.","operationId":"register","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterIn"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthenticatedRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/login":{"post":{"tags":["auth"],"summary":"Login","description":"Sign in with email and password; every login starts a new session.","operationId":"login","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthenticatedRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/logout":{"post":{"tags":["auth"],"summary":"Logout","description":"Revoke the current session and clear its cookie.","operationId":"logout","responses":{"204":{"description":"Successful Response"}}}},"/api/v1/auth/sessions":{"get":{"tags":["auth"],"summary":"List Sessions","description":"The user's active sessions, newest first; the current one is flagged.","operationId":"list_sessions","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/WebSessionRead"},"type":"array","title":"Response List Sessions"}}}}}}},"/api/v1/auth/sessions/{session_id}":{"delete":{"tags":["auth"],"summary":"Revoke Session","description":"Revoke one of the user's own sessions (any other id is not found).","operationId":"revoke_session","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Session Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/sessions/revoke-all":{"post":{"tags":["auth"],"summary":"Revoke Other Sessions","description":"Revoke every session of the user except the current one.","operationId":"revoke_other_sessions","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RevokedRead"}}}}}}},"/api/v1/auth/whoami":{"get":{"tags":["auth"],"summary":"Whoami","description":"What this request's credential is: its kind, and the rows it speaks for.\n\nAny authenticated caller, no scope: the answer is the credential's own shape, not a\nrow of the tenant. A session token learns its ``session_id`` and ``work_id`` here,\nwhich is the only way it can, since every organization and project route refuses it\n(``api.deps._token_actor``); a personal token learns its scopes and confinement; a\nbrowser session learns it is one. ``/me`` stays the person's view (memberships), which\na session token has none of.","operationId":"whoami","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrincipalRead"}}}}}}},"/api/v1/me":{"get":{"tags":["auth"],"summary":"Me","description":"The signed-in user and their organization memberships.","operationId":"me","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MeRead"}}}}}}},"/api/v1/me/password":{"post":{"tags":["auth"],"summary":"Change Password","description":"Change the signed-in person's own password, proving the current one.\n\nA browser session, not a token: this route takes ``CurrentSessionDep``, so an API token\n-- which is issued by someone already signed in and can be revoked -- can never trade\nitself for a password. Self-service, so no permission beyond being signed in, and\nCSRF-checked like every other unsafe route.\n\nA wrong current password is refused exactly as a failed login is: ``401\nauth.invalid_credentials`` with the same message, for the same single argon2\nverification (``UserService.change_password``). On success every other session of the\nperson is signed out and this caller is issued a fresh one -- its cookie is set on the\nresponse and the new session's CSRF token comes back, as login's does, because the old\none died with the old session.","operationId":"change_password","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChangePasswordIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthenticatedRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/organizations":{"get":{"tags":["organizations"],"summary":"List Organizations","description":"The organizations the caller belongs to.\n\nA browser session lists them all. A personal API token lists only the organization it\nwas issued in: a token scoped to one tenant must not disclose the others its owner\nbelongs to, and a CLI needs exactly the one it is pointed at.","operationId":"list_organizations","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageOut_OrganizationRead_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["organizations"],"summary":"Create Organization","description":"Create an organization; the creator becomes its owner.","operationId":"create_organization","parameters":[{"name":"idempotency-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string","minLength":1,"maxLength":128},{"type":"null"}],"title":"Idempotency-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationCreateIn"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/organizations/by-slug/{slug}":{"get":{"tags":["organizations"],"summary":"Get Organization By Slug","description":"One organization by its slug (``acme``, matched exactly), the name a person types.\n\nDeclared before ``/{organization_id}`` so a slug is this route, not a malformed id. The\nid paths are unchanged; this is the by-slug twin, so a CLI resolves ``kernel org use\nacme`` in one request rather than listing and matching client-side.","operationId":"get_organization_by_slug","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string","title":"Slug"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/organizations/{organization_id}":{"get":{"tags":["organizations"],"summary":"Get Organization","description":"One organization the user is a member of.","operationId":"get_organization","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["organizations"],"summary":"Update Organization","description":"Change the name or settings (admins and owners).","operationId":"update_organization","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationUpdateIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/organizations/{organization_id}/members":{"get":{"tags":["organizations"],"summary":"List Members","description":"The organization's members with their roles.","operationId":"list_members","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageOut_MembershipRead_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/organizations/{organization_id}/members/{user_id}":{"patch":{"tags":["organizations"],"summary":"Change Member Role","description":"Set a member's role (admins below owner; only owners grant or revoke ownership).","operationId":"change_member_role","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}},{"name":"user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"User Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemberRoleIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MembershipRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["organizations"],"summary":"Remove Member","description":"Remove a member, or leave the organization; the last owner cannot go.","operationId":"remove_member","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}},{"name":"user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"User Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/organizations/{organization_id}/invitations":{"post":{"tags":["organizations"],"summary":"Create Invitation","description":"Invite an email address (admins and owners); the token is returned only here.","operationId":"create_invitation","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}},{"name":"idempotency-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string","minLength":1,"maxLength":128},{"type":"null"}],"title":"Idempotency-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvitationCreateIn"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvitationCreated"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["organizations"],"summary":"List Invitations","description":"Pending invitations (admins and owners).","operationId":"list_invitations","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageOut_InvitationRead_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/invitations/{token}/accept":{"post":{"tags":["invitations"],"summary":"Accept Invitation","description":"Join the inviting organization as the signed-in user, who must be the invitee.","operationId":"accept_invitation","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}},{"name":"idempotency-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string","minLength":1,"maxLength":128},{"type":"null"}],"title":"Idempotency-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MembershipRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/organizations/{organization_id}/projects":{"get":{"tags":["projects"],"summary":"List Projects","description":"The organization's projects, newest first; archived ones only when asked.","operationId":"list_projects","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}},{"name":"include_archived","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Include Archived"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageOut_ProjectRead_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["projects"],"summary":"Create Project","description":"Create a project (members and above); its key namespaces the work keys.","operationId":"create_project","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}},{"name":"idempotency-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string","minLength":1,"maxLength":128},{"type":"null"}],"title":"Idempotency-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/organizations/{organization_id}/projects/by-key/{key}":{"get":{"tags":["projects"],"summary":"Get Project By Key","description":"One project by its key (``AUTH``, matched exactly) inside the organization.\n\nThe by-key twin of ``get_work_by_key``: the API already decided a human-typed key is\naddressable for work items, and this closes the same door for projects, so a CLI\nresolves ``AUTH`` in one request rather than paging the project list to match it.","operationId":"get_project_by_key","parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string","title":"Key"}},{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/projects/{project_id}":{"get":{"tags":["projects"],"summary":"Get Project","description":"One project of an organization the user belongs to.","operationId":"get_project","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["projects"],"summary":"Update Project","description":"Change the name or description (members and above); an archived project is closed.","operationId":"update_project","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/projects/{project_id}/archive":{"post":{"tags":["projects"],"summary":"Archive Project","description":"Archive the project (admins and owners): no new work or sessions; idempotent.","operationId":"archive_project","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/projects/{project_id}/work":{"get":{"tags":["work"],"summary":"List Work","description":"The project's work, newest first, narrowed by the filters given.\n\n``state`` and ``label`` combine with ``AND`` and both are applied in the query, so\npaging under a filter walks only the matching rows.","operationId":"list_work","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}},{"name":"state","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/WorkState"},{"type":"null"}],"title":"State"}},{"name":"label","in":"query","required":false,"schema":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}],"description":"Keep only work carrying this label (exact match, one label per query).","title":"Label"},"description":"Keep only work carrying this label (exact match, one label per query)."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageOut_WorkRead_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["work"],"summary":"Create Work","description":"Create a work item in ``backlog`` (members and above); an archived project is closed.","operationId":"create_work","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}},{"name":"idempotency-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string","minLength":1,"maxLength":128},{"type":"null"}],"title":"Idempotency-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkDetailRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/projects/{project_id}/work/by-key/{key}":{"get":{"tags":["work"],"summary":"Get Work By Key","description":"One work item by its key (``AUTH-12``, matched exactly) inside the project.","operationId":"get_work_by_key","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}},{"name":"key","in":"path","required":true,"schema":{"type":"string","title":"Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkDetailRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/work/{work_id}":{"get":{"tags":["work"],"summary":"Get Work","description":"One work item in full.","operationId":"get_work","parameters":[{"name":"work_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Work Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkDetailRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["work"],"summary":"Update Work","description":"Change the fields sent (members and above); ``null`` clears the owner or parent.\n\nCompleted or cancelled work is closed to updates: reopen it first.","operationId":"update_work","parameters":[{"name":"work_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Work Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkDetailRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/work/{work_id}/transition":{"post":{"tags":["work"],"summary":"Transition Work","description":"Apply one of ``API_TRANSITION_COMMANDS`` (members and above).\n\nA command the state machine refuses answers 409 ``state.illegal_transition`` naming\nthe commands that would succeed; any other command is refused with 422 before the\nservice runs. ``reopen`` needs ``work.reopen`` like the ``/reopen`` route.","operationId":"transition_work","parameters":[{"name":"work_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Work Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkTransitionIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkDetailRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/work/{work_id}/reopen":{"post":{"tags":["work"],"summary":"Reopen Work","description":"Return completed or cancelled work to ``ready`` (members and above).","operationId":"reopen_work","parameters":[{"name":"work_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Work Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkDetailRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/work/{work_id}/allowed-commands":{"get":{"tags":["work"],"summary":"Allowed Work Commands","description":"The commands the transition and reopen routes would accept right now.","operationId":"allowed_work_commands","parameters":[{"name":"work_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Work Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AllowedCommandsRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/work/{work_id}/runtime-recommendation":{"get":{"tags":["work"],"summary":"Work Runtime Recommendation","description":"The scheduler's runtime recommendation for this work item (viewers and above).\n\nAdvisory: it names the runtime the deterministic scheduler would pick for the work's task\ntype under the org's policy, one arguable sentence of why, and the full candidate list --\neach with its score or the hard filter it failed, so the UI can show *why not*. It starts\nnothing and approves nothing. ``machine_id`` narrows the candidates to a machine's runtimes.","operationId":"work_runtime_recommendation","parameters":[{"name":"work_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Work Id"}},{"name":"machine_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Machine Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuntimeRecommendationRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/organizations/{organization_id}/work":{"get":{"tags":["work"],"summary":"List Organization Work","description":"Every work item of the organization, newest first, narrowed by the filters given.","operationId":"list_organization_work","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}},{"name":"state","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/WorkState"},{"type":"null"}],"title":"State"}},{"name":"owner_user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Owner User Id"}},{"name":"project_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Project Id"}},{"name":"label","in":"query","required":false,"schema":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}],"description":"Keep only work carrying this label (exact match, one label per query).","title":"Label"},"description":"Keep only work carrying this label (exact match, one label per query)."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageOut_WorkRead_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/work/{work_id}/dependencies":{"post":{"tags":["dependencies"],"summary":"Add Dependency","description":"Link this work item to another (members and above).\n\nThe two items must belong to the same project (a different project is 422, a different\norganization is 404). A ``blocks``/``blocked_by`` link that would create a cycle is 409\n``work.graph_cycle``; an identical link already present is 409 ``resource.conflict``. The\nfocal work must be open.","operationId":"add_dependency","parameters":[{"name":"work_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Work Id"}},{"name":"idempotency-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string","minLength":1,"maxLength":128},{"type":"null"}],"title":"Idempotency-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DependencyAdd"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DependencyRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["dependencies"],"summary":"List Dependencies","description":"Every dependency touching this work item, oldest first, seen from its side.","operationId":"list_dependencies","parameters":[{"name":"work_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Work Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/DependencyRead"},"title":"Response List Dependencies"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/work/{work_id}/dependencies/{dependency_id}":{"delete":{"tags":["dependencies"],"summary":"Remove Dependency","description":"Remove one dependency of this work item (members and above); a link that names\nanother work item, or none, is 404. Allowed whatever state the work is in.","operationId":"remove_dependency","parameters":[{"name":"work_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Work Id"}},{"name":"dependency_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Dependency Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/work/{work_id}/graph":{"get":{"tags":["graph"],"summary":"Get Work Graph","description":"The graph centred on one work item: its relatives and the records hanging off it.","operationId":"get_work_graph","parameters":[{"name":"work_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Work Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GraphRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/projects/{project_id}/graph":{"get":{"tags":["graph"],"summary":"Get Project Graph","description":"The graph of a whole project: every work item and the records hanging off each.","operationId":"get_project_graph","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GraphRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/projects/{project_id}/work-templates":{"get":{"tags":["work-templates"],"summary":"List Work Templates","description":"The project's work templates, newest first.","operationId":"list_work_templates","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageOut_WorkTemplateRead_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["work-templates"],"summary":"Create Work Template","description":"Define a work template for the project (members and above).","operationId":"create_work_template","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}},{"name":"idempotency-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string","minLength":1,"maxLength":128},{"type":"null"}],"title":"Idempotency-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkTemplateCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkTemplateRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/projects/{project_id}/work-templates/{template_id}":{"get":{"tags":["work-templates"],"summary":"Get Work Template","description":"One template of the project.","operationId":"get_work_template","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}},{"name":"template_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Template Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkTemplateRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["work-templates"],"summary":"Update Work Template","description":"Rename or re-define a template (members and above).","operationId":"update_work_template","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}},{"name":"template_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Template Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkTemplateUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkTemplateRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["work-templates"],"summary":"Delete Work Template","description":"Delete a template (members and above); work created from it is untouched.","operationId":"delete_work_template","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}},{"name":"template_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Template Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/work/{work_id}/artifacts":{"post":{"tags":["artifacts"],"summary":"Create Artifact","description":"Attach the next version of ``title`` to the work item.\n\nJSON records an artifact held elsewhere; ``multipart/form-data`` with a ``file`` part\nuploads the bytes. Either way the version is assigned per ``(work, title)`` under the\nwork lock, so two agents writing the same report never collide.","operationId":"create_artifact","parameters":[{"name":"work_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Work Id"}},{"name":"idempotency-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string","minLength":1,"maxLength":128},{"type":"null"}],"title":"Idempotency-Key"}}],"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ArtifactRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["artifacts"],"summary":"List Work Artifacts","description":"Every version of every artifact of the work item, newest first.","operationId":"list_work_artifacts","parameters":[{"name":"work_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Work Id"}},{"name":"type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Type"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageOut_ArtifactRead_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/work/{work_id}/artifacts/latest":{"get":{"tags":["artifacts"],"summary":"Latest Artifact","description":"The highest version of ``title`` on the work item.","operationId":"latest_artifact","parameters":[{"name":"work_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Work Id"}},{"name":"title","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":300,"title":"Title"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ArtifactRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/artifacts/{artifact_id}":{"get":{"tags":["artifacts"],"summary":"Get Artifact","description":"One artifact version in full.","operationId":"get_artifact","parameters":[{"name":"artifact_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Artifact Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ArtifactRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/artifacts/{artifact_id}/content":{"get":{"tags":["artifacts"],"summary":"Download Artifact","description":"The artifact's bytes, as an attachment and nothing else.\n\nAn artifact recorded by ``external_uri`` has no bytes here and says so (409) rather\nthan redirecting: following a URI a client stored would make Kernel fetch whatever an\nagent decided to point it at.","operationId":"download_artifact","parameters":[{"name":"artifact_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Artifact Id"}}],"responses":{"200":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/organizations/{organization_id}/artifact-types":{"get":{"tags":["artifact-types"],"summary":"List Artifact Types","description":"The organization's registered artifact types, newest first.","operationId":"list_artifact_types","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageOut_ArtifactTypeRead_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["artifact-types"],"summary":"Create Artifact Type","description":"Register an artifact type for the organization (admins and owners).","operationId":"create_artifact_type","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}},{"name":"idempotency-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string","minLength":1,"maxLength":128},{"type":"null"}],"title":"Idempotency-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ArtifactTypeCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ArtifactTypeRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/organizations/{organization_id}/artifact-types/{type_id}":{"get":{"tags":["artifact-types"],"summary":"Get Artifact Type","description":"One registered artifact type.","operationId":"get_artifact_type","parameters":[{"name":"type_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Type Id"}},{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ArtifactTypeRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["artifact-types"],"summary":"Update Artifact Type","description":"Rename, re-key or re-schema an artifact type (admins and owners).","operationId":"update_artifact_type","parameters":[{"name":"type_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Type Id"}},{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ArtifactTypeUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ArtifactTypeRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["artifact-types"],"summary":"Delete Artifact Type","description":"Delete an artifact type (admins and owners); existing artifacts are untouched.","operationId":"delete_artifact_type","parameters":[{"name":"type_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Type Id"}},{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/work/{work_id}/sessions":{"post":{"tags":["sessions"],"summary":"Register Session","description":"Register a session against a work item.\n\n``external: true`` registers a session an orchestrator is already running: it starts\n``running``, moves the Work to ``running`` with it, and the response carries the\nsession token to report with. Otherwise the session is ``pending``; naming a\n``machine_id`` queues a ``start_session`` command for that machine's daemon, which\nreceives the session token with it.","operationId":"register_session","parameters":[{"name":"work_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Work Id"}},{"name":"idempotency-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string","minLength":1,"maxLength":128},{"type":"null"}],"title":"Idempotency-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionRegistered"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["sessions"],"summary":"List Work Sessions","description":"The work item's sessions, newest first.","operationId":"list_work_sessions","parameters":[{"name":"work_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Work Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageOut_SessionRead_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/organizations/{organization_id}/sessions":{"get":{"tags":["sessions"],"summary":"List Organization Sessions","description":"Every session of the organization, newest first, narrowed by the filters given.","operationId":"list_organization_sessions","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/SessionStatus"},{"type":"null"}],"title":"Status"}},{"name":"work_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Work Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageOut_SessionRead_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/sessions/{session_id}":{"get":{"tags":["sessions"],"summary":"Get Session","description":"One session in full.","operationId":"get_session","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Session Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/sessions/{session_id}/activity":{"get":{"tags":["sessions"],"summary":"Get Session Activity","description":"What this run is doing now and whether it is advancing (DF-025).\n\nThe observability read an orchestrator or manager polls: the session's current step (the\ntype of its newest runtime activity event), how long ago that was, and a liveness verdict —\n``active`` while it is advancing, ``stalled`` once it is alive but has emitted no new\nactivity for longer than ``session_stall_after_seconds`` (the forty-minute case), ``stale``\nonce it is no longer even heartbeating. Derived from the event cadence, not the heartbeat,\nso a session heartbeating without progress reads ``stalled`` here rather than ``running``.\nSame read scope as ``GET /sessions/{id}``: a caller who cannot see the session, or is in\nanother tenant, gets the same 404, and the step is a type only — never transcript content —\nso it is returned under any privacy mode. ``metrics`` carries the run's live cost/tokens.","operationId":"get_session_activity","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Session Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionActivityRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/sessions/{session_id}/wait":{"get":{"tags":["sessions"],"summary":"Wait For Session","description":"Long-poll until the session reaches a terminal state, then answer it.\n\nReturns ``200`` with the session exactly as ``GET /sessions/{id}`` renders it as soon as\nthe session is ``completed``, ``failed``, ``exhausted`` or ``cancelled`` — at once when it\nis already terminal. Otherwise the request parks on Kernel's event broadcaster (the same\n``LISTEN``/``NOTIFY`` fan-out the SSE stream reads) and returns the moment the terminal\nevent for *this* session arrives, without polling. ``?wait=`` bounds the server-side wait\nin seconds (clamped to ``MAX_WAIT_SECONDS``, the same shape as the command poll's); when it\npasses with the session still active the answer is ``408`` ``session.wait_timeout``, which\na client re-issues the long poll on. The wait holds no database connection and no\nconcurrency slot: the request's session is committed and given back before the park begins\n(see ``SessionWaitResponse``). Same read scope as ``GET /sessions/{id}`` — a caller who\ncannot read the session cannot wait on it.","operationId":"wait_for_session","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Session Id"}},{"name":"wait","in":"query","required":false,"schema":{"type":"number","minimum":0,"default":25.0,"title":"Wait"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/sessions/{session_id}/events":{"get":{"tags":["sessions"],"summary":"List Session Events","description":"One session's recorded events, newest first, keyset-paginated by ``events.sequence``.\n\nThe readable half of run observability: everything a session reported — its normalized\nruntime events and its lifecycle transitions — read back through the same\n``EventQueryService`` and keyset pagination the work and organization feeds use, filtered\nto this session. Same read scope as ``GET /sessions/{id}``: a caller who cannot see the\nsession, or is in another tenant, gets the same 404, and a project-confined token sees\nonly what its projects allow.","operationId":"list_session_events","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Session Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageOut_EventRead_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["sessions"],"summary":"Record Session Events","description":"Append a batch of normalized events; recording also counts as a heartbeat.\n\nAn event carrying a ``source_seq`` Kernel already stored is counted as a duplicate\nrather than refused, which is what makes a daemon's offline queue safe to replay after\na reconnect: the same batch may be posted any number of times.","operationId":"record_session_events","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Session Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionEventBatch"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventBatchResult"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/sessions/{session_id}/events/tail":{"get":{"tags":["sessions"],"summary":"Tail Session Events","description":"Long-poll a session's events forward from ``after``: what ``kernel session watch`` tails.\n\nReturns the events after ``?after=`` (oldest first) as soon as there are any, or — when the\nsession is already terminal — at once even with none, so a watch knows to stop. Otherwise\nthe request parks on Kernel's event broadcaster (the same ``LISTEN``/``NOTIFY`` fan-out the\nSSE stream and the wait endpoint read) and returns the moment an event for *this* session\narrives, without polling; ``?wait=`` bounds the park (clamped to ``MAX_WAIT_SECONDS``) and a\ndeadline that passes with nothing new answers an empty page the watch reissues on. The park\nholds no database connection and no concurrency slot (see ``SessionEventsTailResponse``).\nSame read scope as ``GET /sessions/{id}`` — a caller who cannot read the session cannot tail\nit.","operationId":"tail_session_events","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Session Id"}},{"name":"after","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","minimum":0},{"type":"null"}],"title":"After"}},{"name":"wait","in":"query","required":false,"schema":{"type":"number","minimum":0,"default":25.0,"title":"Wait"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionEventTail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/sessions/{session_id}/workspace":{"post":{"tags":["sessions"],"summary":"Report Session Workspace","description":"Report which files the session touched: paths and line counts, never contents.\n\nThe daemon is the only thing that can see a workspace, and it runs under ``sync_mode:\nmetadata_only`` by default — a path with two line counts is metadata, a diff hunk is\nnot. So the body takes a path, an ``insertions`` and a ``deletions`` per entry and\n**refuses anything else** (``WorkspaceFileReport``), a path must be relative to the\nworkspace root with no ``..`` in it, and a report carries at most\n``MAX_WORKSPACE_FILES`` entries.\n\n``actor_for_session`` is what keeps this to the session's own machine: it is\n``machine_bound``, so a device token that does not belong to the machine the session\nruns on gets 404, and a session token reaches only its own session.\n\nNo ``Idempotency-Key``, because it needs none: a report replaces the session's previous\none, so a daemon retrying after a timeout writes the same rows and no second event.","operationId":"report_session_workspace","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Session Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceReport"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionWorkspaceRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/sessions/{session_id}/heartbeat":{"post":{"tags":["sessions"],"summary":"Session Heartbeat","description":"Report that the session is still alive. Writes no event.","operationId":"session_heartbeat","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Session Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/sessions/{session_id}/start":{"post":{"tags":["sessions"],"summary":"Start Session","description":"A managed session's daemon reports that its runtime is running.\n\nA managed session is created ``pending`` and its daemon takes a ``start_session``\ncommand; without this route the row would stay ``pending`` for its whole life, its\n``started_at`` would never be set, and ``complete`` would answer 409 because the session\nmachine allows completion only from ``starting`` or ``running``.","operationId":"start_session","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Session Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionStart"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/sessions/{session_id}/complete":{"post":{"tags":["sessions"],"summary":"Complete Session","description":"End the session successfully, merging in its final metrics. The Work is left as it is.","operationId":"complete_session","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Session Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionComplete"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/sessions/{session_id}/fail":{"post":{"tags":["sessions"],"summary":"Fail Session","description":"End the session in failure; a ``session_failed`` blocker blocks the Work.","operationId":"fail_session","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Session Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionFail"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/sessions/{session_id}/exhaust":{"post":{"tags":["sessions"],"summary":"Exhaust Session","description":"End the session because it ran out of its turn budget (DF-020). Unlike ``fail`` this\ndoes not block the Work: it raises a non-blocking advisory blocker for review instead.","operationId":"exhaust_session","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Session Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionExhaust"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/sessions/{session_id}/cancel":{"post":{"tags":["sessions"],"summary":"Cancel Session","description":"Cancel the session; a managed one also gets a ``cancel_session`` command queued.\n\nThe row is cancelled whether or not a daemon ever picks that command up.","operationId":"cancel_session","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Session Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/sessions/{session_id}/instruction":{"post":{"tags":["sessions"],"summary":"Instruct Session","description":"Send a message to a running managed session, queued for its machine's daemon.\n\nAnswers 409 ``capability.unsupported`` when the session's runtime does not claim\n``send_instruction``: the message would go nowhere, and the caller has to know that.","operationId":"instruct_session","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Session Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionInstruction"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MachineCommandRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/work/{work_id}/decisions":{"post":{"tags":["decisions"],"summary":"Record Decision","description":"Record a decision (members and above), optionally superseding an earlier one.\n\n``supersedes_decision_id`` must name a decision of the same work item that nothing has\nsuperseded yet: a second successor answers 409 ``resource.conflict``, so two agents\nracing to replace the same decision cannot both win. Each entry of ``evidence`` needs\nan ``artifact_id`` of this organization or an ``external_uri``; the artifact reference\nis to a *version*, so the evidence keeps pointing at what was actually seen even after\na newer version of that artifact is uploaded.","operationId":"record_decision","parameters":[{"name":"work_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Work Id"}},{"name":"idempotency-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string","minLength":1,"maxLength":128},{"type":"null"}],"title":"Idempotency-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecisionRecord"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecisionRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["decisions"],"summary":"List Decisions","description":"The work item's decisions, newest first; the whole history unless narrowed.","operationId":"list_decisions","parameters":[{"name":"work_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Work Id"}},{"name":"include_superseded","in":"query","required":false,"schema":{"type":"boolean","default":true,"title":"Include Superseded"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageOut_DecisionRead_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/decisions/{decision_id}":{"get":{"tags":["decisions"],"summary":"Get Decision","description":"One decision in full.","operationId":"get_decision","parameters":[{"name":"decision_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Decision Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecisionRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/decisions/{decision_id}/evidence":{"get":{"tags":["decisions"],"summary":"List Decision Evidence","description":"The evidence behind one decision, oldest first. Not paginated: it is bounded by the\ndecision that was recorded, and a client reading a decision wants all of it.","operationId":"list_decision_evidence","parameters":[{"name":"decision_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Decision Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/DecisionEvidenceRead"},"title":"Response List Decision Evidence"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/work/{work_id}/blockers":{"post":{"tags":["blockers"],"summary":"Report Blocker","description":"Report a blocker (members and above); high and critical severities block the Work.\n\n``owner_user_id`` names the member who owns it; a blocker with no owner is the queue\nnobody has picked up, which is what the Needs You inbox surfaces at high severity.","operationId":"report_blocker","parameters":[{"name":"work_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Work Id"}},{"name":"idempotency-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string","minLength":1,"maxLength":128},{"type":"null"}],"title":"Idempotency-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BlockerReport"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BlockerRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["blockers"],"summary":"List Open Blockers","description":"The work item's open blockers, newest first.","operationId":"list_open_blockers","parameters":[{"name":"work_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Work Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageOut_BlockerRead_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/blockers/{blocker_id}":{"get":{"tags":["blockers"],"summary":"Get Blocker","description":"One blocker in full, open or resolved.","operationId":"get_blocker","parameters":[{"name":"blocker_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Blocker Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BlockerRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/blockers/{blocker_id}/assign":{"post":{"tags":["blockers"],"summary":"Assign Blocker","description":"Hand the blocker to an active member of the organization.\n\nAssigning the member who already owns it changes nothing and writes no event, so the\nroute is naturally repeatable; a resolved blocker is refused (409 ``resource.closed``).","operationId":"assign_blocker","parameters":[{"name":"blocker_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Blocker Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BlockerAssign"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BlockerRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/blockers/{blocker_id}/resolve":{"post":{"tags":["blockers"],"summary":"Resolve Blocker","description":"Resolve the blocker with a written resolution (members and above).\n\nResolving the last open *blocking* blocker of blocked Work unblocks it; resolving a low\nor medium one never does, because it was not what blocked the Work in the first place.","operationId":"resolve_blocker","parameters":[{"name":"blocker_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Blocker Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BlockerResolve"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BlockerRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/work/{work_id}/approvals":{"post":{"tags":["approvals"],"summary":"Request Approval","description":"Ask a human to decide, parking running or review Work in ``waiting_human``.\n\n``required_user_id`` reserves the decision for one member; ``required_role`` sets a\nminimum role instead (member when neither is given -- viewers never decide). Naming a\nviewer as the required user is refused, because it would create an approval nobody may\nanswer. ``expires_at`` must be in the future. Terminal Work is closed to approvals: a\nquestion about work that is already finished has nothing to gate.","operationId":"request_approval","parameters":[{"name":"work_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Work Id"}},{"name":"idempotency-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string","minLength":1,"maxLength":128},{"type":"null"}],"title":"Idempotency-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApprovalRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApprovalRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["approvals"],"summary":"List Work Approvals","description":"The work item's pending approvals, newest first. Decided ones are read by id.","operationId":"list_work_approvals","parameters":[{"name":"work_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Work Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageOut_ApprovalRead_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/organizations/{organization_id}/approvals":{"get":{"tags":["approvals"],"summary":"List Organization Approvals","description":"Every pending approval of the organization, newest first.\n\nEverything anybody is being asked, not only what *this* caller may answer; the Needs You\ninbox is the narrowed view (``GET /organizations/{id}/needs-you``).","operationId":"list_organization_approvals","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageOut_ApprovalRead_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/approvals/{approval_id}":{"get":{"tags":["approvals"],"summary":"Get Approval","description":"One approval in full. ``state`` is what an agent waiting on the answer reads.","operationId":"get_approval","parameters":[{"name":"approval_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Approval Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApprovalRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/approvals/{approval_id}/approve":{"post":{"tags":["approvals"],"summary":"Approve Approval","description":"Say yes, as the required user or a member holding the required role.\n\nOnly a person decides: an agent or daemon actor is refused whatever its scopes say, and\nan API token needs ``admin:*``. An approval past its ``expires_at`` answers 409\n``resource.conflict`` and is not decided -- a deadline that has passed is not a yes.","operationId":"approve_approval","parameters":[{"name":"approval_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Approval Id"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/ApprovalDecision"},{"type":"null"}],"title":"Data"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApprovalRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/approvals/{approval_id}/reject":{"post":{"tags":["approvals"],"summary":"Reject Approval","description":"Say no, with the reason why (the same authorization as approving).\n\n``note`` is **required** here and optional on ``approve``, and the asymmetry is\ndeliberate: an approval that says nothing still says the thing was allowed, by this\nperson, at this time, while a rejection that says nothing tells the agent only that it\nis refused -- not what would make the request acceptable, so its next attempt is a\nguess. The rule lives in ``ApprovalRejection``, not in this route, so every caller of\nthe service holds it too.\n\nThe note travels on the ``approval.rejected`` event, which is how the session that asked\nlearns the answer and why. The approval is ``rejected`` from here on: no later call\nturns it into permission (see the module docstring).","operationId":"reject_approval","parameters":[{"name":"approval_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Approval Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApprovalRejection"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApprovalRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/approvals/{approval_id}/auto-decide":{"post":{"tags":["approvals"],"summary":"Auto Decide Approval","description":"A manager principal deciding an approval automatically under a delegated policy (DF-024).\n\nThis is the agent-native peer of ``approve``/``reject``, and the *only* path by which a\nnon-person closes an approval. Every rail is the service's (see\n``ApprovalService.auto_decide``): least-privilege scope, manager-principal-only,\nno-self-approval, tenant isolation, decide-once, and -- above all -- **bounded**. If an\nactive delegation names this approval's ``action`` the manager decides it and an immutable\nevent is written in its name; otherwise the approval is left ``pending`` for the human\nqueue and the response says ``escalated``. A human may revoke the delegation at any time,\nand the very next call escalates instead. Self-approval and a cross-tenant reach are\nrefused (403/404), never quietly escalated.","operationId":"auto_decide_approval","parameters":[{"name":"approval_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Approval Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutoDecideIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutoDecisionRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/approvals/{approval_id}/cancel":{"post":{"tags":["approvals"],"summary":"Cancel Approval","description":"Withdraw the question: the requester, any member, or the system.\n\nCancelling is not deciding. It closes the approval as ``cancelled`` and lets the Work\nresume, and it grants nothing: the action that was asked about was never approved.","operationId":"cancel_approval","parameters":[{"name":"approval_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Approval Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApprovalRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/organizations/{organization_id}/approval-delegations":{"post":{"tags":["approval-delegations"],"summary":"Grant Approval Delegation","description":"Grant one manager principal the bounded right to auto-decide a class of approvals.\n\n``token_id`` must name an org-scoped service token that already holds\n``approvals:delegate``; ``allowed_actions`` is the class of approval actions it may\nauto-decide. At most one active delegation exists per principal -- a duplicate is refused\nwith 409, revoke the old one first. Granting is a person's act.","operationId":"grant_approval_delegation","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DelegationGrant"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApprovalDelegationRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["approval-delegations"],"summary":"List Approval Delegations","description":"The organization's delegations, newest first (a manager sees only its own).","operationId":"list_approval_delegations","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageOut_ApprovalDelegationRead_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/approval-delegations/{delegation_id}":{"get":{"tags":["approval-delegations"],"summary":"Get Approval Delegation","description":"One delegation. ``revoked_at`` set means it is lifted and authorises nothing.","operationId":"get_approval_delegation","parameters":[{"name":"delegation_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Delegation Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApprovalDelegationRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/approval-delegations/{delegation_id}/revoke":{"post":{"tags":["approval-delegations"],"summary":"Revoke Approval Delegation","description":"Lift a delegation. Takes effect on the manager's next call; revoking twice is a no-op.\n\nThis is the human-override rail: a person can end the delegation at any moment, and the\nmanager's next auto-decision escalates to the human queue instead of deciding.","operationId":"revoke_approval_delegation","parameters":[{"name":"delegation_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Delegation Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApprovalDelegationRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/work/{work_id}/outcomes":{"post":{"tags":["outcomes"],"summary":"Record Outcome","description":"Record an outcome (members and above).\n\n``acceptance_results`` is one entry per criterion with ``passed`` and an optional note;\n``status`` is the caller's own summary of them and is not derived, so a run that passed\nevery criterion may still be recorded ``partial`` when the person recording it knows\nsomething the criteria do not say.","operationId":"record_outcome","parameters":[{"name":"work_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Work Id"}},{"name":"idempotency-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string","minLength":1,"maxLength":128},{"type":"null"}],"title":"Idempotency-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OutcomeRecord"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OutcomeRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["outcomes"],"summary":"List Outcomes","description":"Every outcome recorded for the work item, newest first.","operationId":"list_outcomes","parameters":[{"name":"work_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Work Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageOut_OutcomeRead_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/work/{work_id}/outcomes/latest":{"get":{"tags":["outcomes"],"summary":"Latest Outcome","description":"The newest outcome, or 404 when nothing has been recorded yet.\n\n404 rather than a null body: \"no outcome\" and \"an outcome that is null\" are different\nfacts, and a client that branches on the body would treat the second as the first.","operationId":"latest_outcome","parameters":[{"name":"work_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Work Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OutcomeRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/work/{work_id}/context":{"get":{"tags":["context"],"summary":"Get Work Context","description":"The work item's bounded context: what it is, what was decided, what exists, what is\nopen, the pending approvals and the last five handoffs, with ``truncated`` counters.\n\nRaw event and transcript history is never here -- read ``/work/{id}/events`` for that.\nA member (or a work-scoped agent token) reading their own work item; the same tenant\nand project rules as every other work route.","operationId":"get_work_context","parameters":[{"name":"work_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Work Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkContextV1"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/organizations/{organization_id}/needs-you":{"get":{"tags":["needs-you"],"summary":"Needs You","description":"What is waiting on the caller in this organization, newest first in each section.\n\nEvery section needs its own read permission, and all four are demanded up front rather\nthan section by section: an inbox that silently dropped the section a caller may not\nread would show a smaller number than the one the navigation badge promised, and the\nperson would never learn why. A viewer holds all four (they are ``viewer`` actions), so\nthe strictness costs nobody who can see the page.","operationId":"needs_you","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":20,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NeedsYouRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/organizations/{organization_id}/notifications":{"get":{"tags":["notifications"],"summary":"List Notifications","description":"The caller's notifications, unread first and newest-first within, keyset-paginated.\n\n``unread_only=true`` narrows to the unread ones (the bell menu's default). A person only\never sees their own; a project-confined token additionally sees only notifications about\nwork in its projects.","operationId":"list_notifications","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}},{"name":"unread_only","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Unread Only"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageOut_NotificationRead_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/organizations/{organization_id}/notifications/unread-count":{"get":{"tags":["notifications"],"summary":"Count Unread Notifications","description":"How many of the caller's notifications are unread: the top-bar badge's number.","operationId":"count_unread_notifications","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationUnreadCount"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/organizations/{organization_id}/notifications/read-all":{"post":{"tags":["notifications"],"summary":"Read All Notifications","description":"Mark every unread notification of the caller read; the unread count is then zero.","operationId":"read_all_notifications","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationUnreadCount"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/organizations/{organization_id}/notification-preferences":{"get":{"tags":["notifications"],"summary":"Get Notification Preferences","description":"The caller's channel preference (in-app / email) for every kind, defaults filled in.","operationId":"get_notification_preferences","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationPreferencesRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["notifications"],"summary":"Update Notification Preferences","description":"Change the caller's channel preferences for the named kinds; returns the full matrix.\n\nOnly the kinds named in the body change; a kind left out keeps whatever it had (or its\ndefault). The delivery job honours these: a kind muted in-app writes no in-app row, and\na kind not enabled for email sends no email.","operationId":"update_notification_preferences","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationPreferencesUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationPreferencesRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/notifications/{notification_id}/read":{"post":{"tags":["notifications"],"summary":"Read Notification","description":"Mark one of the caller's notifications read (idempotent); another person's is 404.","operationId":"read_notification","parameters":[{"name":"notification_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Notification Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/machines/enroll":{"post":{"tags":["machines"],"summary":"Enroll Machine","description":"Redeem an enrolment secret (``Authorization: Bearer <secret>``) and get a device token.\n\nThe device token is in this response and nowhere else. A secret that was already\nredeemed answers 409, one that is too old answers 410, and anything unknown answers\n401 ``auth.invalid_enrollment_token`` without saying which of the three it was.","operationId":"enroll_machine","parameters":[{"name":"idempotency-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string","minLength":1,"maxLength":128},{"type":"null"}],"title":"Idempotency-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MachineEnroll"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MachineEnrolled"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/machines/{machine_id}/commands":{"get":{"tags":["machines"],"summary":"Poll Machine Commands","description":"Long-poll for this machine's queued commands, oldest first.\n\nReturns as soon as there is something to do, and an empty list once ``wait`` seconds\nhave passed — the daemon's cue to poll again. Everything returned is marked delivered,\nso a command is handed out once and then waits for its ack.\n\nThe one route that takes no ``DbDep``. A yield dependency holds the request's session,\nand therefore a pooled connection and an open transaction, until the route returns; on\na route that returns in twenty-five seconds that is one connection per parked daemon\nand a pool exhausted at around thirty machines. So the caller is resolved in a session\nof its own, which is closed before the wait begins, and each look afterwards opens\nanother (``services.machine_service.poll_commands``). Being a GET, it needs no CSRF\ndependency either, which is the other thing that would have pulled the session in.","operationId":"poll_machine_commands","parameters":[{"name":"machine_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Machine Id"}},{"name":"wait","in":"query","required":false,"schema":{"type":"number","maximum":60,"minimum":0,"default":25.0,"title":"Wait"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MachineCommandsRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/organizations/{organization_id}/machines/enrollment-tokens":{"post":{"tags":["machines"],"summary":"Create Enrollment Token","description":"Reserve a machine and mint its one-time enrolment secret (admins).\n\nThe secret is in this response and nowhere else. It expires after\n``enrollment_token_ttl_hours`` and can be redeemed exactly once.","operationId":"create_enrollment_token","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}},{"name":"idempotency-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string","minLength":1,"maxLength":128},{"type":"null"}],"title":"Idempotency-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnrollmentTokenCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MachineEnrolled"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/organizations/{organization_id}/machines":{"get":{"tags":["machines"],"summary":"List Machines","description":"Every machine of the organization, newest first, with its derived liveness.\n\n``?name=`` narrows to the machine that enrolled under exactly that name, so a client\nresolving ``--machine laptop`` asks for the one row rather than paging the fleet to\nmatch it client-side.","operationId":"list_machines","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}},{"name":"name","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageOut_MachineRead_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/machines/{machine_id}":{"get":{"tags":["machines"],"summary":"Get Machine","description":"One machine, with the doctor reports of its last heartbeat.","operationId":"get_machine","parameters":[{"name":"machine_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Machine Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MachineRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/machines/{machine_id}/heartbeat":{"post":{"tags":["machines"],"summary":"Machine Heartbeat","description":"Report liveness and this round's doctor results. Writes no event.\n\nOmitting ``runtimes`` keeps the stored reports; sending ``[]`` clears them.","operationId":"machine_heartbeat","parameters":[{"name":"machine_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Machine Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MachineHeartbeat"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MachineRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/machines/{machine_id}/revoke":{"post":{"tags":["machines"],"summary":"Revoke Machine","description":"Retire a machine and revoke its device tokens (admins); revoking twice is fine.\n\nThe daemon's very next request is refused, mid-replay included.","operationId":"revoke_machine","parameters":[{"name":"machine_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Machine Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MachineRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/machines/{machine_id}/commands/{command_id}/ack":{"post":{"tags":["machines"],"summary":"Ack Machine Command","description":"Report what became of a delivered command. Acknowledging twice changes nothing.","operationId":"ack_machine_command","parameters":[{"name":"machine_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Machine Id"}},{"name":"command_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Command Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommandAck"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MachineCommandRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/organizations/{organization_id}/runtimes":{"get":{"tags":["runtimes"],"summary":"List Runtimes","description":"Every runtime this organization may use, built-ins first, each with the machines\nreporting it and what their last ``doctor()`` found.\n\nThe registry is a fixed, small set, so the whole of it comes back in one page and\n``next_cursor`` is always null.","operationId":"list_runtimes","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageOut_RuntimeRead_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["runtimes"],"summary":"Create Runtime","description":"Define a runtime for this organization (admins).\n\nOnly the adapter types an organization may define are accepted — ``fake``, ``external``\nand ``generic_cli`` — and anything else is refused with 422. A ``generic_cli`` definition's\n``configuration`` is validated when the row is written (the executable, argv template and\nenv allowlist), so a configuration the adapter could not run is a 422 here rather than a\nfailure at launch. A key that a built-in or another of your runtimes already uses is\nrefused with 409.","operationId":"create_runtime","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}},{"name":"idempotency-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string","minLength":1,"maxLength":128},{"type":"null"}],"title":"Idempotency-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuntimeDefinitionCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuntimeRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/organizations/{organization_id}/runtimes/{runtime_id}":{"patch":{"tags":["runtimes"],"summary":"Update Runtime","description":"Change one of your own runtimes: enable or disable it, rename it, reconfigure it.\n\nBuilt-in definitions are shared by every organization and answer 409 here.","operationId":"update_runtime","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}},{"name":"runtime_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Runtime Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuntimeDefinitionUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuntimeRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/organizations/{organization_id}/runtimes/{runtime_id}/doctor":{"get":{"tags":["runtimes"],"summary":"Runtime Doctor","description":"What each of your machines last reported about this runtime, machine name first.\n\nEmpty when no machine has reported it: the definition exists, but nothing here can run\nit (a machine that never enrolled, or one whose ``doctor()`` did not find the runtime).","operationId":"runtime_doctor","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}},{"name":"runtime_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Runtime Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuntimeDoctorRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/organizations/{organization_id}/runtimes/{runtime_id}/test":{"post":{"tags":["runtimes"],"summary":"Test Runtime","description":"Run this runtime's ``doctor()`` on one machine now, on demand (admins).\n\nThe heartbeat only doctors the runtimes this build ships, so this is how an organization\nchecks its own runtime against a machine: it queues a ``run_doctor`` command carrying the\ndefinition's stored configuration and answers ``202`` with the test run, still ``queued``.\nThe machine picks it up on its next poll; poll ``GET …/test/{command_id}`` for the result.","operationId":"test_runtime","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}},{"name":"runtime_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Runtime Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuntimeTestTrigger"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuntimeTestRunRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/organizations/{organization_id}/runtimes/{runtime_id}/test/{command_id}":{"get":{"tags":["runtimes"],"summary":"Runtime Test Run","description":"One on-demand test run: ``queued``/``delivered`` while the machine works it, then the\n``doctor()`` report once it is ``acked`` (or the reason it failed).","operationId":"runtime_test_run","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}},{"name":"runtime_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Runtime Id"}},{"name":"command_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Command Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuntimeTestRunRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/organizations/{organization_id}/saved-filters":{"get":{"tags":["saved-filters"],"summary":"List Saved Filters","description":"The caller's own filters and every shared one in the organization, newest first.","operationId":"list_saved_filters","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageOut_SavedFilterRead_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["saved-filters"],"summary":"Create Saved Filter","description":"Create a filter owned by the caller (members and above).","operationId":"create_saved_filter","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}},{"name":"idempotency-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string","minLength":1,"maxLength":128},{"type":"null"}],"title":"Idempotency-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SavedFilterCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SavedFilterRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/organizations/{organization_id}/saved-filters/{filter_id}":{"get":{"tags":["saved-filters"],"summary":"Get Saved Filter","description":"One filter the caller may see; a private filter of another member is 404.","operationId":"get_saved_filter","parameters":[{"name":"filter_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Filter Id"}},{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SavedFilterRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["saved-filters"],"summary":"Update Saved Filter","description":"Rename, re-define or share/unshare a filter (owner only).","operationId":"update_saved_filter","parameters":[{"name":"filter_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Filter Id"}},{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SavedFilterUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SavedFilterRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["saved-filters"],"summary":"Delete Saved Filter","description":"Delete a filter: the owner always, an admin for a shared one.","operationId":"delete_saved_filter","parameters":[{"name":"filter_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Filter Id"}},{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/organizations/{organization_id}/search":{"get":{"tags":["search"],"summary":"Search Organization","description":"Ranked hits for ``q`` across the caller's visible content in this organization.","operationId":"search_organization","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}},{"name":"q","in":"query","required":false,"schema":{"type":"string","maxLength":256,"default":"","title":"Q"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":50,"minimum":1,"default":20,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchResultsRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/organizations/{organization_id}/analytics/runtimes":{"get":{"tags":["analytics"],"summary":"Analytics Runtimes","description":"Runtime performance per runtime + task type over the range (members and above).","operationId":"analytics_runtimes","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}},{"name":"task_type","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/TaskType"},{"type":"null"}],"title":"Task Type"}},{"name":"from","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"From"}},{"name":"to","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"To"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuntimeAnalyticsRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/organizations/{organization_id}/analytics/work":{"get":{"tags":["analytics"],"summary":"Analytics Work","description":"Work throughput per task type + project over the range (members and above).","operationId":"analytics_work","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}},{"name":"task_type","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/TaskType"},{"type":"null"}],"title":"Task Type"}},{"name":"project_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Project Id"}},{"name":"from","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"From"}},{"name":"to","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"To"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkAnalyticsRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/organizations/{organization_id}/tokens":{"post":{"tags":["tokens"],"summary":"Create Token","description":"Mint a token; the secret is in this response and nowhere else.\n\n``for_user`` (the default) binds it to the caller and keeps it inside their role;\n``for_user: false`` asks for an org-wide service token, which needs ``token.manage_org``.","operationId":"create_token","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}},{"name":"idempotency-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string","minLength":1,"maxLength":128},{"type":"null"}],"title":"Idempotency-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiTokenCreated"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["tokens"],"summary":"List Tokens","description":"Your own tokens; every token of the organization for admins and owners.","operationId":"list_tokens","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageOut_ApiTokenRead_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/tokens/self":{"get":{"tags":["tokens"],"summary":"Token Self","description":"The token this request authenticated with, without its hash: a whoami for a credential.\n\nAn agent, daemon or service token reads its own row — its name, scopes, project\nrestriction and when it was last used — so a client can *show* what it holds rather than\ninfer it by listing and taking the single visible row. No scope is asked for: a\ncredential may always introspect itself, and the row carries no secret (the hash is\nnever in ``ApiTokenRead``).\n\nDeclared before ``/{token_id}`` so ``self`` is this route and not a malformed token id.\nA cookie session holds no API token and is answered 404 rather than an empty body: the\nanswer names what is missing (no token authenticated this request), and the account and\nsession routes are where a person's own credential lives.","operationId":"token_self","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiTokenRead"}}}}}}},"/api/v1/tokens/{token_id}":{"get":{"tags":["tokens"],"summary":"Get Token","description":"One token of yours (or any of the organization's, for admins and owners).","operationId":"get_token","parameters":[{"name":"token_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Token Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiTokenRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["tokens"],"summary":"Revoke Token","description":"Revoke a token: it stops working on the very next request. Revoking twice is fine.","operationId":"revoke_token","parameters":[{"name":"token_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Token Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/organizations/{organization_id}/webhooks":{"post":{"tags":["webhooks"],"summary":"Create Webhook","description":"Create a webhook; the signing secret is in this response and nowhere else.","operationId":"create_webhook","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}},{"name":"idempotency-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string","minLength":1,"maxLength":128},{"type":"null"}],"title":"Idempotency-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookCreated"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["webhooks"],"summary":"List Webhooks","description":"Every webhook of the organization.","operationId":"list_webhooks","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageOut_WebhookRead_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/webhooks/{webhook_id}":{"get":{"tags":["webhooks"],"summary":"Get Webhook","description":"One webhook.","operationId":"get_webhook","parameters":[{"name":"webhook_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Webhook Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["webhooks"],"summary":"Update Webhook","description":"Change a webhook's URL, subscribed events, description or ``enabled`` flag.","operationId":"update_webhook","parameters":[{"name":"webhook_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Webhook Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["webhooks"],"summary":"Delete Webhook","description":"Delete a webhook and its delivery log.","operationId":"delete_webhook","parameters":[{"name":"webhook_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Webhook Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/webhooks/{webhook_id}/test":{"post":{"tags":["webhooks"],"summary":"Test Webhook","description":"Queue a synthetic ping to the webhook so its receiver can be verified end to end.","operationId":"test_webhook","parameters":[{"name":"webhook_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Webhook Id"}}],"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookDeliveryQueued"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/webhooks/{webhook_id}/deliveries":{"get":{"tags":["webhooks"],"summary":"List Webhook Deliveries","description":"The delivery attempts recorded for one webhook, newest first.","operationId":"list_webhook_deliveries","parameters":[{"name":"webhook_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Webhook Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageOut_WebhookDeliveryRead_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/webhooks/{webhook_id}/deliveries/{delivery_id}/replay":{"post":{"tags":["webhooks"],"summary":"Replay Webhook Delivery","description":"Re-deliver a past delivery's event, signed afresh at the current time.","operationId":"replay_webhook_delivery","parameters":[{"name":"webhook_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Webhook Id"}},{"name":"delivery_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Delivery Id"}}],"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookDeliveryQueued"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/organizations/{organization_id}/events":{"get":{"tags":["events"],"summary":"List Organization Events","description":"The organization's activity, newest first; administrative events are in the audit feed.","operationId":"list_organization_events","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}},{"name":"work_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Work Id"}},{"name":"project_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Project Id"}},{"name":"session_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Session Id"}},{"name":"event_type","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/EventType"}},{"type":"null"}],"title":"Event Type"}},{"name":"actor_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Actor Id"}},{"name":"since","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Since"}},{"name":"until","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Until"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageOut_EventRead_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/organizations/{organization_id}/events/stream":{"get":{"tags":["events"],"summary":"Stream Organization Events","description":"The organization's activity as Server-Sent Events: a hint per event, live.\n\nEvery frame carries the same event name, ``kernel.event`` -- listen for that one name\nand read what happened from the payload, rather than subscribing per event type, so a\nclient keeps working when a new type ships. ``id:`` is the event's ``sequence``, and\n``data:`` is a JSON object::\n\n    {\"event_id\": \"...\", \"sequence\": 1234, \"event_type\": \"work.state_changed\",\n     \"organization_id\": \"...\", \"project_id\": \"...\" | null, \"work_id\": \"...\" | null,\n     \"session_id\": \"...\" | null, \"work_key\": \"AUTH-12\"}\n\n``work_key`` is present only when the event names a work item. The event's own payload\nis never sent: a frame says *what changed*, and the client reads the change back from\nthis API (``GET /organizations/{id}/events`` and the resource routes), so a hint that\nis lost, repeated or coalesced costs a request and never correctness.\n\nOne synthetic frame exists: ``{\"type\": \"refresh\"}``, with no ``id``, which means \"you\nmissed more than this stream can replay -- refetch everything you show\".\n\nA comment line (``: ...``) goes out on connect and every 15 seconds afterwards; it is a\nheartbeat, not an event, and clients ignore it.\n\nReconnecting clients send the last id they saw as ``Last-Event-ID`` (the browser does\nthis on its own) or as ``?last_event_id=``, and the stream replays up to 500 stored\nevents after it, oldest first, before going live. Like every ``work.read`` feed this\ncarries **activity** events only; member, token, machine and organization events stay\nin the audit feed. The sequence is global and events are delivered when their\ntransaction commits, so gaps between the ids one stream sees are expected and arrival\norder is not sequence order. A connection ends by itself after\n``KERNEL_STREAM_MAX_SECONDS`` (15 minutes by default) so that access is re-checked;\nreconnect with the last id and nothing is missed.","operationId":"stream_organization_events","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}}],"responses":{"200":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/organizations/{organization_id}/audit":{"get":{"tags":["events"],"summary":"List Audit Events","description":"Every event of the organization, members, tokens and machines included (admins).","operationId":"list_audit_events","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}},{"name":"work_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Work Id"}},{"name":"project_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Project Id"}},{"name":"session_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Session Id"}},{"name":"event_type","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/EventType"}},{"type":"null"}],"title":"Event Type"}},{"name":"actor_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Actor Id"}},{"name":"since","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Since"}},{"name":"until","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Until"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageOut_EventRead_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/organizations/{organization_id}/audit.csv":{"get":{"tags":["events"],"summary":"Export Audit Csv","description":"The audit feed as a CSV attachment: a header row, then one row per event.\n\nThe filters are checked before anything is sent (a project of another organization is\na 404, not a broken download). The export then claims one of the\n``KERNEL_AUDIT_CSV_MAX_CONCURRENCY`` slots, or answers 429 rather than queueing, and\nstreams until ``KERNEL_AUDIT_CSV_MAX_ROWS`` rows. It always ends with a marker line, so\na reader can tell a complete export from a truncated or severed one.","operationId":"export_audit_csv","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}},{"name":"work_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Work Id"}},{"name":"project_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Project Id"}},{"name":"session_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Session Id"}},{"name":"event_type","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/EventType"}},{"type":"null"}],"title":"Event Type"}},{"name":"actor_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Actor Id"}},{"name":"since","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Since"}},{"name":"until","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Until"}}],"responses":{"200":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/projects/{project_id}/events":{"get":{"tags":["events"],"summary":"List Project Events","description":"Everything that happened in one project, newest first.","operationId":"list_project_events","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}},{"name":"work_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Work Id"}},{"name":"session_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Session Id"}},{"name":"event_type","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/EventType"}},{"type":"null"}],"title":"Event Type"}},{"name":"actor_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Actor Id"}},{"name":"since","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Since"}},{"name":"until","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Until"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageOut_EventRead_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/work/{work_id}/events":{"get":{"tags":["events"],"summary":"List Work Events","description":"The history of one work item, newest first.","operationId":"list_work_events","parameters":[{"name":"work_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Work Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}},{"name":"session_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Session Id"}},{"name":"event_type","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/EventType"}},{"type":"null"}],"title":"Event Type"}},{"name":"actor_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Actor Id"}},{"name":"since","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Since"}},{"name":"until","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Until"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageOut_EventRead_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/work/{work_id}/handoffs":{"post":{"tags":["handoffs"],"summary":"Request Handoff","description":"Ask for a handoff (members and above): a destination runtime and a purpose.\n\n``from_session_id`` names the session handing off, and has to be one of this work\nitem's; it is what the compiler reads the source runtime, the provider session id and\nthe workspace from. It is optional because a handoff can be asked for before any\nsession ran, and then the package simply records no source.\n\nRequesting moves nothing: the Work is still whatever it was, and stays that way until\nsomebody accepts.","operationId":"request_handoff","parameters":[{"name":"work_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Work Id"}},{"name":"idempotency-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string","minLength":1,"maxLength":128},{"type":"null"}],"title":"Idempotency-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HandoffRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HandoffRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["handoffs"],"summary":"List Handoffs","description":"The work item's handoffs, newest first, without their packages.\n\nTerminal work still lists them: closing a work item closes nothing about its record.","operationId":"list_handoffs","parameters":[{"name":"work_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Work Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageOut_HandoffRead_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/handoffs/{handoff_id}":{"get":{"tags":["handoffs"],"summary":"Get Handoff","description":"One handoff with its compiled package: the page a person reads before accepting.\n\n``package`` is ``{}`` until the handoff has been compiled once.","operationId":"get_handoff","parameters":[{"name":"handoff_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Handoff Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HandoffPackageRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/handoffs/{handoff_id}/compile":{"post":{"tags":["handoffs"],"summary":"Compile Handoff","description":"Compile the work item's state into the package (members and above).\n\n``objective`` is what the destination session is being asked to do; the purpose and the\nsource session come off the handoff row, and the changed files come off that session's\nworkspace report -- so what goes into the package is a function of the work item and\nnothing else, which is what makes ``package_hash`` comparable between two people.\n\nCompiling again is allowed and is how a stale or rejected package is refreshed. The\nversion moves only if the document does: recompiling unchanged work answers 200 with\nthe version and hash it already had.","operationId":"compile_handoff","parameters":[{"name":"handoff_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Handoff Id"}},{"name":"idempotency-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string","minLength":1,"maxLength":128},{"type":"null"}],"title":"Idempotency-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HandoffCompileIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HandoffPackageRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/handoffs/{handoff_id}/accept":{"post":{"tags":["handoffs"],"summary":"Accept Handoff","description":"Take the package (members and above): ``to_session_id`` becomes the continuation.\n\nThe session must belong to the same work item, must still be active and must not be the\none handing off. Accepting writes ``session.handoff_id`` -- the lineage link, and the\nonly thing that makes the receiving session a continuation of this Work rather than a\nsecond unrelated run against it. A handoff is accepted once; a repeat is 409, or a\nreplay of the first answer when the caller sent an ``Idempotency-Key``.","operationId":"accept_handoff","parameters":[{"name":"handoff_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Handoff Id"}},{"name":"idempotency-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string","minLength":1,"maxLength":128},{"type":"null"}],"title":"Idempotency-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HandoffAccept"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HandoffRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/handoffs/{handoff_id}/reject":{"post":{"tags":["handoffs"],"summary":"Reject Handoff","description":"Turn the package down with a typed reason (members and above).\n\n``reason`` is one of ``missing_context``, ``wrong_runtime``, ``superseded``, ``other``\n-- typed so the Needs You inbox can group them and so a rejection is answerable without\nreading prose; ``note`` is the prose. The Work is untouched: a rejection is a statement\nabout the package, not about the work item.\n\nIt is not the end. The requester amends the work and compiles again, which offers the\nsame handoff at a new version and keeps this reason on the record (FLOW-005).","operationId":"reject_handoff","parameters":[{"name":"handoff_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Handoff Id"}},{"name":"idempotency-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string","minLength":1,"maxLength":128},{"type":"null"}],"title":"Idempotency-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HandoffReject"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HandoffRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/handoffs/{handoff_id}/complete":{"post":{"tags":["handoffs"],"summary":"Complete Handoff","description":"Close an accepted handoff: the destination session has done what it took on.\n\nThe lineage link stays on the session afterwards -- it is history, not a lease.","operationId":"complete_handoff","parameters":[{"name":"handoff_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Handoff Id"}},{"name":"idempotency-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string","minLength":1,"maxLength":128},{"type":"null"}],"title":"Idempotency-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HandoffRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/organizations/{organization_id}/export":{"get":{"tags":["data-portability"],"summary":"Export Organization","description":"The whole organization as a deterministic tar archive (owner, unconfined).\n\nA ``manifest.json`` names the version, the row counts and a SHA-256 per file, and one\nJSONL follows per collection. Two exports of unchanged data are byte-identical apart from\nthe manifest's ``generated_at``, and no password hash, token hash, webhook secret or\nsession cookie appears anywhere in it. Served as an attachment.","operationId":"export_organization","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}}],"responses":{"200":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/organizations/{organization_id}/members/{user_id}/export":{"get":{"tags":["data-portability"],"summary":"Export Member","description":"A member's own data as a portable document (the member themselves, or an owner).\n\nTheir profile, the work they created or own, the decisions they made, the approvals they\ndecided and the events they are the actor of. Generated before any anonymisation, so a\nperson always has their data before it goes. Refused for a project-confined token.","operationId":"export_member","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}},{"name":"user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Export Member"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/organizations/{organization_id}/members/{user_id}/anonymise":{"post":{"tags":["data-portability"],"summary":"Anonymise Member","description":"Anonymise a member: reassign their records to the tombstone and erase the account.\n\nThe work, decisions and history they leave behind are kept and reattributed to the\n``deleted user`` tombstone; the account, sessions, personal tokens and email are deleted.\nAllowed to the member themselves or an owner; refused for a project-confined token, for the\nlast owner, and for a person who belongs to another organization.","operationId":"anonymise_member","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}},{"name":"user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Anonymise Member"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/projects/{project_id}/work-export":{"get":{"tags":["data-portability"],"summary":"Export Project Work","description":"A project's work and the graph between them, as a portable JSON document.\n\nEvery item is addressed by an ``export_id`` and carries its parent and dependency links by\nthat id, so the document can be imported into another project with ids remapped. Ordered\nby key for a stable result.","operationId":"export_project_work","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Export Project Work"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/projects/{project_id}/work-import":{"post":{"tags":["data-portability"],"summary":"Import Project Work","description":"Import a work document into this project with fresh ids; refuse a cycle first.\n\nEach item is minted a new key and id, its parent and dependency links rewritten to the new\nids, and its origin recorded under ``custom_fields.imported_from``. Nothing is overwritten,\nand a document whose parent/``blocks`` graph would form a cycle is refused before any row\nis written. The response is the id remap.","operationId":"import_project_work","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkExportDocument"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkImportResult"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"AcceptanceResult":{"properties":{"criterion":{"type":"string","maxLength":500,"minLength":1,"title":"Criterion"},"passed":{"type":"boolean","title":"Passed"},"note":{"type":"string","title":"Note","default":""}},"type":"object","required":["criterion","passed"],"title":"AcceptanceResult"},"ActorKind":{"type":"string","enum":["user","agent","daemon","system"],"title":"ActorKind"},"AllowedCommandsRead":{"properties":{"commands":{"items":{"$ref":"#/components/schemas/WorkCommand"},"type":"array","title":"Commands"}},"type":"object","required":["commands"],"title":"AllowedCommandsRead"},"ApiTokenCreated":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"organization_id":{"type":"string","format":"uuid","title":"Organization Id"},"user_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"User Id"},"session_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Session Id"},"machine_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Machine Id"},"created_by_user_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Created By User Id"},"name":{"type":"string","title":"Name"},"token_prefix":{"type":"string","title":"Token Prefix"},"scopes":{"items":{"type":"string"},"type":"array","title":"Scopes"},"project_ids":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Project Ids"},"expires_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expires At"},"last_used_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Used At"},"revoked_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Revoked At"},"created_at":{"type":"string","title":"Created At"},"token":{"type":"string","title":"Token"}},"type":"object","required":["id","organization_id","user_id","session_id","machine_id","created_by_user_id","name","token_prefix","scopes","project_ids","expires_at","last_used_at","revoked_at","created_at","token"],"title":"ApiTokenCreated","description":"The create response: the only time the plaintext token is shown."},"ApiTokenRead":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"organization_id":{"type":"string","format":"uuid","title":"Organization Id"},"user_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"User Id"},"session_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Session Id"},"machine_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Machine Id"},"created_by_user_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Created By User Id"},"name":{"type":"string","title":"Name"},"token_prefix":{"type":"string","title":"Token Prefix"},"scopes":{"items":{"type":"string"},"type":"array","title":"Scopes"},"project_ids":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Project Ids"},"expires_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expires At"},"last_used_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Used At"},"revoked_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Revoked At"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","organization_id","user_id","session_id","machine_id","created_by_user_id","name","token_prefix","scopes","project_ids","expires_at","last_used_at","revoked_at","created_at"],"title":"ApiTokenRead","description":"A token as every route but ``create`` shows it: the prefix, never the hash."},"ApprovalDecision":{"properties":{"note":{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}],"title":"Note"}},"type":"object","title":"ApprovalDecision","description":"What an approval carries: a note, which an approval may leave unsaid."},"ApprovalDelegationRead":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"organization_id":{"type":"string","format":"uuid","title":"Organization Id"},"token_id":{"type":"string","format":"uuid","title":"Token Id"},"allowed_actions":{"items":{"type":"string"},"type":"array","title":"Allowed Actions"},"note":{"type":"string","title":"Note"},"created_by_user_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Created By User Id"},"revoked_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Revoked At"},"revoked_by_user_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Revoked By User Id"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","organization_id","token_id","allowed_actions","note","created_by_user_id","revoked_at","revoked_by_user_id","created_at","updated_at"],"title":"ApprovalDelegationRead","description":"One delegated-approval policy: which manager principal may auto-decide which actions.\n\n``revoked_at`` set means the delegation is lifted and authorises nothing; the decision\npath only ever honours a row with it ``None``."},"ApprovalEntry":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"action":{"type":"string","title":"Action"},"reason":{"type":"string","title":"Reason","default":""},"state":{"$ref":"#/components/schemas/ApprovalState"},"required_role":{"anyOf":[{"$ref":"#/components/schemas/Role"},{"type":"null"}]},"required_user_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Required User Id"},"expires_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expires At"},"requested_at":{"type":"string","title":"Requested At"}},"additionalProperties":false,"type":"object","required":["id","action","state","requested_at"],"title":"ApprovalEntry","description":"One pending approval the work is waiting on: what was asked and who may answer."},"ApprovalRead":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"organization_id":{"type":"string","format":"uuid","title":"Organization Id"},"work_id":{"type":"string","format":"uuid","title":"Work Id"},"session_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Session Id"},"action":{"type":"string","title":"Action"},"reason":{"type":"string","title":"Reason"},"state":{"$ref":"#/components/schemas/ApprovalState"},"requested_by_kind":{"$ref":"#/components/schemas/ActorKind"},"requested_by_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Requested By Id"},"required_role":{"anyOf":[{"$ref":"#/components/schemas/Role"},{"type":"null"}]},"required_user_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Required User Id"},"decided_by_user_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Decided By User Id"},"decided_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Decided At"},"decision_note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Decision Note"},"expires_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expires At"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","organization_id","work_id","session_id","action","reason","state","requested_by_kind","requested_by_id","required_role","required_user_id","decided_by_user_id","decided_at","decision_note","expires_at","created_at","updated_at"],"title":"ApprovalRead","description":"One approval. ``state`` is the contract: only ``pending`` is still answerable.\n\nA client reads the decision from ``state`` and nothing else. ``decided_at`` and\n``decided_by_user_id`` are set by cancel and expire too, so neither says a person\napproved anything, and a rejected approval is as decided as an approved one."},"ApprovalRejection":{"properties":{"note":{"type":"string","maxLength":4000,"minLength":1,"title":"Note"}},"type":"object","required":["note"],"title":"ApprovalRejection","description":"A rejection's reason, which is required. The asymmetry with ``ApprovalDecision`` is\nthe point, not an oversight.\n\nAn approval that says nothing still carries its whole meaning: the thing was allowed,\nby this person, at this time. A rejection that says nothing carries none of it -- the\nagent learns it is refused, cannot learn what would make it acceptable, and its next\nattempt is a guess. FLOW-007 is \"reject with reason\", and the flow is unimplementable\nwithout one.\n\nIt lives here rather than on the route so the service and the API hold one rule: a rule\nthe route enforced alone would be absent from every other caller, which is the\ndivergence this codebase keeps paying for."},"ApprovalRequest":{"properties":{"action":{"type":"string","maxLength":120,"minLength":1,"title":"Action"},"reason":{"type":"string","title":"Reason","default":""},"session_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Session Id"},"required_role":{"anyOf":[{"$ref":"#/components/schemas/Role"},{"type":"null"}]},"required_user_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Required User Id"},"expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Expires At"}},"type":"object","required":["action"],"title":"ApprovalRequest"},"ApprovalState":{"type":"string","enum":["pending","approved","rejected","cancelled","expired"],"title":"ApprovalState"},"ArtifactEntry":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"type":{"type":"string","title":"Type"},"title":{"type":"string","title":"Title"},"version":{"type":"integer","title":"Version"},"uri_or_download":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Uri Or Download"},"sha256":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sha256"}},"additionalProperties":false,"type":"object","required":["id","type","title","version"],"title":"ArtifactEntry","description":"One artifact version. ``uri_or_download`` is where the bytes are: the URI an agent\nrecorded, or Kernel's own download route, or ``None`` when there is neither."},"ArtifactRead":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"organization_id":{"type":"string","format":"uuid","title":"Organization Id"},"work_id":{"type":"string","format":"uuid","title":"Work Id"},"session_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Session Id"},"type":{"type":"string","title":"Type"},"title":{"type":"string","title":"Title"},"version":{"type":"integer","title":"Version"},"storage_backend":{"$ref":"#/components/schemas/StorageBackend"},"external_uri":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Uri"},"content_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Content Type"},"size_bytes":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Size Bytes"},"sha256":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sha256"},"filename":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Filename"},"metadata":{"additionalProperties":true,"type":"object","title":"Metadata"},"created_by_kind":{"$ref":"#/components/schemas/ActorKind"},"created_by_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Created By Id"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","organization_id","work_id","session_id","type","title","version","storage_backend","external_uri","content_type","size_bytes","sha256","created_by_kind","created_by_id","created_at","updated_at"],"title":"ArtifactRead","description":"One artifact version. ``storage_key`` is deliberately absent: where Kernel keeps the\nbytes is Kernel's business, and the content is fetched by artifact id."},"ArtifactTypeCreate":{"properties":{"key":{"type":"string","maxLength":64,"minLength":1,"title":"Key"},"name":{"type":"string","title":"Name","default":""},"metadata_schema":{"items":{"$ref":"#/components/schemas/CustomFieldDef"},"type":"array","maxItems":50,"title":"Metadata Schema"}},"type":"object","required":["key"],"title":"ArtifactTypeCreate"},"ArtifactTypeRead":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"organization_id":{"type":"string","format":"uuid","title":"Organization Id"},"key":{"type":"string","title":"Key"},"name":{"type":"string","title":"Name"},"metadata_schema":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Metadata Schema"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","organization_id","key","name","created_at","updated_at"],"title":"ArtifactTypeRead","description":"One registered artifact type and its optional metadata schema."},"ArtifactTypeUpdate":{"properties":{"key":{"anyOf":[{"type":"string","maxLength":64,"minLength":1},{"type":"null"}],"title":"Key"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"metadata_schema":{"anyOf":[{"items":{"$ref":"#/components/schemas/CustomFieldDef"},"type":"array","maxItems":50},{"type":"null"}],"title":"Metadata Schema"}},"type":"object","title":"ArtifactTypeUpdate","description":"Every field is optional: a field left unset is unchanged; none may be null.\n\nA present ``metadata_schema`` replaces the whole schema (an empty list clears it), which\nis distinct from omitting it."},"AuthenticatedRead":{"properties":{"user":{"$ref":"#/components/schemas/UserRead"},"csrf_token":{"type":"string","title":"Csrf Token"}},"type":"object","required":["user","csrf_token"],"title":"AuthenticatedRead","description":"What register and login answer: the user and the CSRF token of the new session."},"AutoDecideIn":{"properties":{"decision":{"type":"string","enum":["approve","reject"],"title":"Decision","default":"approve"},"note":{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}],"title":"Note"}},"type":"object","title":"AutoDecideIn","description":"``POST /approvals/{id}/auto-decide``: a manager principal's delegated decision.\n\n``decision`` is ``approve`` or ``reject``; a rejection needs a ``note`` (the reason that\nmakes a \"no\" actionable, exactly as a human rejection does)."},"AutoDecisionRead":{"properties":{"decided":{"type":"boolean","title":"Decided"},"escalated":{"type":"boolean","title":"Escalated"},"reason":{"type":"string","title":"Reason"},"delegation_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Delegation Id"},"approval":{"$ref":"#/components/schemas/ApprovalRead"}},"type":"object","required":["decided","escalated","reason","delegation_id","approval"],"title":"AutoDecisionRead","description":"The typed outcome of a delegated decision: decided, or escalated to the human queue.\n\nMachine-first: a manager reads ``decided`` / ``escalated`` and never has to parse prose.\n``decided`` means the approval was closed (and an event attributed to this manager was\nwritten); ``escalated`` means the policy did not cover it and it is still pending for a\nperson. ``reason`` explains an escalation; ``delegation_id`` names the policy acted under."},"BlockerAssign":{"properties":{"owner_user_id":{"type":"string","format":"uuid","title":"Owner User Id"}},"type":"object","required":["owner_user_id"],"title":"BlockerAssign","description":"``POST /blockers/{id}/assign``: the member the blocker is handed to.\n\n``BlockerService.assign`` takes the owner as a plain argument rather than a model (a\nsingle field), so the body shape is the API's to declare -- like ``WorkTransitionIn``."},"BlockerEntry":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"severity":{"$ref":"#/components/schemas/BlockerSeverity"},"title":{"type":"string","title":"Title"},"status":{"$ref":"#/components/schemas/BlockerStatus"}},"additionalProperties":false,"type":"object","required":["id","severity","title","status"],"title":"BlockerEntry"},"BlockerKind":{"type":"string","enum":["manual","session_failed","session_exhausted","session_recorded_nothing","session_stalled"],"title":"BlockerKind"},"BlockerRead":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"organization_id":{"type":"string","format":"uuid","title":"Organization Id"},"work_id":{"type":"string","format":"uuid","title":"Work Id"},"session_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Session Id"},"severity":{"$ref":"#/components/schemas/BlockerSeverity"},"title":{"type":"string","title":"Title"},"description":{"type":"string","title":"Description"},"kind":{"$ref":"#/components/schemas/BlockerKind"},"owner_user_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Owner User Id"},"owner_kind":{"anyOf":[{"$ref":"#/components/schemas/ActorKind"},{"type":"null"}]},"status":{"$ref":"#/components/schemas/BlockerStatus"},"resolved_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Resolved At"},"resolution":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Resolution"},"resolved_by_kind":{"anyOf":[{"$ref":"#/components/schemas/ActorKind"},{"type":"null"}]},"resolved_by_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Resolved By Id"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","organization_id","work_id","session_id","severity","title","description","kind","owner_user_id","owner_kind","status","resolved_at","resolution","resolved_by_kind","resolved_by_id","created_at","updated_at"],"title":"BlockerRead","description":"One blocker, open or resolved, with who owns it and how it was closed."},"BlockerReport":{"properties":{"severity":{"$ref":"#/components/schemas/BlockerSeverity"},"title":{"type":"string","maxLength":300,"minLength":1,"title":"Title"},"description":{"type":"string","title":"Description","default":""},"session_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Session Id"},"owner_user_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Owner User Id"},"kind":{"$ref":"#/components/schemas/BlockerKind","default":"manual"}},"type":"object","required":["severity","title"],"title":"BlockerReport","description":"Input shape is validated here, as ``WorkCreate`` does: pydantic raises on bad input."},"BlockerResolve":{"properties":{"resolution":{"type":"string","maxLength":4000,"minLength":1,"title":"Resolution"}},"type":"object","required":["resolution"],"title":"BlockerResolve"},"BlockerSeverity":{"type":"string","enum":["low","medium","high","critical"],"title":"BlockerSeverity"},"BlockerStatus":{"type":"string","enum":["open","resolved"],"title":"BlockerStatus"},"ChangePasswordIn":{"properties":{"current_password":{"type":"string","maxLength":1024,"title":"Current Password"},"new_password":{"type":"string","maxLength":1024,"title":"New Password"}},"type":"object","required":["current_password","new_password"],"title":"ChangePasswordIn","description":"What ``POST /api/v1/me/password`` takes: the current password and the new one.\n\nStrength is the service's to judge (the rule ``register`` applies), so nothing here\nconstrains the new password beyond the length any password field is capped at."},"ChannelPreference":{"properties":{"in_app":{"type":"boolean","title":"In App","default":true},"email":{"type":"boolean","title":"Email","default":false}},"type":"object","title":"ChannelPreference","description":"Whether one kind is delivered in-app and/or by email."},"CommandAck":{"properties":{"ok":{"type":"boolean","title":"Ok"},"error":{"anyOf":[{"type":"string","maxLength":4000,"minLength":1},{"type":"null"}],"title":"Error"},"result":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Result"}},"type":"object","required":["ok"],"title":"CommandAck","description":"``POST /machines/{id}/commands/{command_id}/ack``: what became of one command.\n\n``result`` is the document a command produces beyond success or failure — a ``run_doctor``\ncommand's ``doctor()`` report. It is ignored for the transport-only kinds, whose outcome\nis session events rather than a value on the command, and validated against the kind's own\nshape by ``ack_command`` before it is stored."},"ContextTruncation":{"properties":{"decisions_omitted":{"type":"integer","title":"Decisions Omitted","default":0},"artifacts_omitted":{"type":"integer","title":"Artifacts Omitted","default":0}},"additionalProperties":false,"type":"object","title":"ContextTruncation","description":"What the decision and artifact bounds dropped. Part of the object, so a reader can\ntell a bounded context from a complete one."},"CustomFieldDef":{"properties":{"name":{"type":"string","maxLength":64,"minLength":1,"pattern":"^[a-zA-Z][a-zA-Z0-9_]*$","title":"Name"},"type":{"$ref":"#/components/schemas/CustomFieldType"},"required":{"type":"boolean","title":"Required","default":false},"options":{"items":{"type":"string"},"type":"array","maxItems":100,"title":"Options"}},"additionalProperties":false,"type":"object","required":["name","type"],"title":"CustomFieldDef","description":"One typed field of a schema; unknown keys are refused (422)."},"CustomFieldType":{"type":"string","enum":["string","number","bool","enum","date"],"title":"CustomFieldType","description":"The small, fixed set of field types a schema may use."},"DecisionEntry":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"statement":{"type":"string","title":"Statement"},"rationale":{"type":"string","title":"Rationale","default":""},"recorded_at":{"type":"string","title":"Recorded At"},"evidence":{"items":{"$ref":"#/components/schemas/EvidenceRef"},"type":"array","title":"Evidence"}},"additionalProperties":false,"type":"object","required":["id","statement","recorded_at"],"title":"DecisionEntry"},"DecisionEvidenceRead":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"organization_id":{"type":"string","format":"uuid","title":"Organization Id"},"decision_id":{"type":"string","format":"uuid","title":"Decision Id"},"artifact_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Artifact Id"},"external_uri":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Uri"},"note":{"type":"string","title":"Note"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","organization_id","decision_id","artifact_id","external_uri","note","created_at"],"title":"DecisionEvidenceRead","description":"One piece of evidence behind a decision: an artifact, an external link, or both."},"DecisionRead":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"organization_id":{"type":"string","format":"uuid","title":"Organization Id"},"work_id":{"type":"string","format":"uuid","title":"Work Id"},"session_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Session Id"},"statement":{"type":"string","title":"Statement"},"rationale":{"type":"string","title":"Rationale"},"supersedes_decision_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Supersedes Decision Id"},"created_by_kind":{"$ref":"#/components/schemas/ActorKind"},"created_by_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Created By Id"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","organization_id","work_id","session_id","statement","rationale","supersedes_decision_id","created_by_kind","created_by_id","created_at","updated_at"],"title":"DecisionRead","description":"One decision as recorded; decisions are never edited, only superseded."},"DecisionRecord":{"properties":{"statement":{"type":"string","maxLength":4000,"minLength":1,"title":"Statement"},"rationale":{"type":"string","title":"Rationale","default":""},"session_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Session Id"},"supersedes_decision_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Supersedes Decision Id"},"evidence":{"items":{"$ref":"#/components/schemas/Evidence"},"type":"array","title":"Evidence"}},"type":"object","required":["statement"],"title":"DecisionRecord"},"DelegationGrant":{"properties":{"token_id":{"type":"string","format":"uuid","title":"Token Id"},"allowed_actions":{"items":{"type":"string"},"type":"array","maxItems":50,"minItems":1,"title":"Allowed Actions"},"note":{"type":"string","maxLength":2000,"title":"Note","default":""}},"type":"object","required":["token_id","allowed_actions"],"title":"DelegationGrant","description":"``POST /organizations/{id}/approval-delegations``: empower one manager principal."},"DependencyAdd":{"properties":{"relation":{"$ref":"#/components/schemas/DependencyType"},"work_id":{"type":"string","format":"uuid","title":"Work Id"}},"type":"object","required":["relation","work_id"],"title":"DependencyAdd","description":"``POST /work/{id}/dependencies``: how the work item in the path relates to another."},"DependencyRead":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"relation":{"$ref":"#/components/schemas/DependencyType"},"work_id":{"type":"string","format":"uuid","title":"Work Id"},"source_work_id":{"type":"string","format":"uuid","title":"Source Work Id"},"target_work_id":{"type":"string","format":"uuid","title":"Target Work Id"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","relation","work_id","source_work_id","target_work_id","created_at"],"title":"DependencyRead","description":"One dependency as the work item in the path sees it.\n\n``relation`` is that item's point of view -- ``blocks``, ``blocked_by`` or\n``related_to`` -- while ``source_work_id``/``target_work_id`` are the stored direction,\nso a client can tell \"A blocks B\" from \"A is blocked_by B\" without knowing which side the\nsingle row was written from. ``work_id`` is always the *other* item."},"DependencyType":{"type":"string","enum":["blocks","blocked_by","related_to"],"title":"DependencyType"},"EnrollmentTokenCreate":{"properties":{"name_hint":{"type":"string","maxLength":200,"minLength":1,"title":"Name Hint","default":"new machine"}},"type":"object","title":"EnrollmentTokenCreate","description":"``POST /organizations/{id}/machines/enrollment-tokens``.\n\n``name_hint`` is what the machine is called until it enrols and names itself."},"EventBatchResult":{"properties":{"accepted":{"type":"integer","title":"Accepted","default":0},"duplicates":{"type":"integer","title":"Duplicates","default":0}},"type":"object","title":"EventBatchResult","description":"How a batch landed: how many events are new, and how many were already there.\n\n``duplicates`` is not an error — it is the answer a client replaying a buffered queue\nafter a reconnect needs, and the reason the replay is safe to repeat."},"EventLinkRead":{"properties":{"label":{"type":"string","title":"Label"},"href":{"type":"string","title":"Href"}},"type":"object","required":["label","href"],"title":"EventLinkRead","description":"Where an event points: the work item and the project it happened in."},"EventRead":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"sequence":{"type":"integer","title":"Sequence"},"organization_id":{"type":"string","format":"uuid","title":"Organization Id"},"project_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Project Id"},"work_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Work Id"},"session_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Session Id"},"event_type":{"$ref":"#/components/schemas/EventType"},"actor_kind":{"$ref":"#/components/schemas/ActorKind"},"actor_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Actor Id"},"correlation_id":{"type":"string","title":"Correlation Id"},"causation_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Causation Id"},"source_seq":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Source Seq"},"payload":{"additionalProperties":true,"type":"object","title":"Payload"},"created_at":{"type":"string","title":"Created At"},"rendered":{"$ref":"#/components/schemas/RenderedEventRead"}},"type":"object","required":["id","sequence","organization_id","project_id","work_id","session_id","event_type","actor_kind","actor_id","correlation_id","causation_id","source_seq","payload","created_at","rendered"],"title":"EventRead","description":"One event with its sentence; ``rendered`` is computed, so ``build`` assembles it."},"EventType":{"type":"string","enum":["work.created","work.updated","work.state_changed","work.reopened","work.archived","work.dependency_added","work.dependency_removed","session.created","session.started","session.heartbeat","session.event","session.workspace_reported","session.completed","session.failed","session.exhausted","session.cancelled","session.recorded_nothing","session.stalled","artifact.created","decision.recorded","decision.superseded","blocker.reported","blocker.assigned","blocker.resolved","approval.requested","approval.approved","approval.rejected","approval.cancelled","approval.expired","approval.delegation_granted","approval.delegation_revoked","handoff.requested","handoff.compiled","handoff.accepted","handoff.rejected","handoff.completed","handoff.cancelled","outcome.recorded","organization.created","organization.updated","project.created","project.updated","project.archived","member.invited","member.joined","member.role_changed","member.removed","token.created","token.revoked","machine.enrolled","machine.revoked","runtime.updated","webhook.created","webhook.updated","webhook.deleted","webhook.disabled","retention.swept","user.exported","user.anonymised","unknown"],"title":"EventType"},"Evidence":{"properties":{"artifact_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Artifact Id"},"external_uri":{"anyOf":[{"type":"string","maxLength":2048},{"type":"null"}],"title":"External Uri"},"note":{"type":"string","title":"Note","default":""}},"type":"object","title":"Evidence"},"EvidenceRef":{"properties":{"artifact_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Artifact Id"},"uri":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Uri"},"note":{"type":"string","title":"Note","default":""}},"additionalProperties":false,"type":"object","title":"EvidenceRef","description":"One piece of evidence behind a decision: a Kernel artifact, a URI, or a bare note."},"ExclusionReason":{"type":"string","enum":["disabled","capability_mismatch","policy_forbidden","insufficient_sample","below_success_floor","missing_metric"],"title":"ExclusionReason","description":"Why a candidate failed a hard filter and could not be scored.\n\nRecorded on the excluded candidate so a UI can say *why not* next to each runtime.\n``below_success_floor`` covers a rate under the floor and a runtime with no rate at all\nunder a cost/speed mode (either way it cannot be shown to clear the floor);\n``missing_metric`` is a runtime that lacks the number the chosen mode ranks by."},"FilterDefinition":{"properties":{"state":{"anyOf":[{"$ref":"#/components/schemas/WorkState"},{"type":"null"}]},"priority":{"anyOf":[{"$ref":"#/components/schemas/Priority"},{"type":"null"}]},"task_type":{"anyOf":[{"$ref":"#/components/schemas/TaskType"},{"type":"null"}]},"owner":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Owner"},"label":{"anyOf":[{"type":"string","maxLength":100,"minLength":1},{"type":"null"}],"title":"Label"}},"additionalProperties":false,"type":"object","title":"FilterDefinition","description":"The dimensions a board/list filter may carry; unknown keys are refused (422).\n\nEvery field is optional, and an omitted one is simply not part of the stored document\n(``as_document`` drops the ``None``s). The enum fields validate the vocabulary, ``owner``\nis a member's id, and ``label`` is one of a work item's free-text labels -- so a stored\nfilter is always a set of parameters the pages can apply without a second check."},"GraphEdgeKind":{"type":"string","enum":["dependency","parent","session-chain","evidence","handoff-lineage"],"title":"GraphEdgeKind","description":"The kinds of relationship a work graph draws as an edge.\n\n``dependency`` and ``parent`` join work items; ``session_chain`` attaches a work item's\nsessions (and a continuation to the session it followed); ``evidence`` attaches the\ndurable records a work item or session produced (artifacts, decisions) and links a\ndecision to the artifacts it cites; ``handoff_lineage`` threads a handoff between the\nsessions it moves work between."},"GraphEdgeRead":{"properties":{"source":{"type":"string","title":"Source"},"target":{"type":"string","title":"Target"},"kind":{"$ref":"#/components/schemas/GraphEdgeKind"},"relation":{"anyOf":[{"$ref":"#/components/schemas/DependencyType"},{"type":"null"}]}},"type":"object","required":["source","target","kind"],"title":"GraphEdgeRead","description":"One directed edge; ``relation`` is present only on ``dependency`` edges."},"GraphNodeKind":{"type":"string","enum":["work","session","artifact","decision","handoff"],"title":"GraphNodeKind","description":"The kinds of object a work graph draws as a node."},"GraphNodeRead":{"properties":{"id":{"type":"string","title":"Id"},"kind":{"$ref":"#/components/schemas/GraphNodeKind"},"ref_id":{"type":"string","format":"uuid","title":"Ref Id"},"label":{"type":"string","title":"Label"},"layer":{"type":"integer","title":"Layer"},"order":{"type":"integer","title":"Order"},"x":{"type":"number","title":"X"},"y":{"type":"number","title":"Y"},"data":{"additionalProperties":true,"type":"object","title":"Data"}},"type":"object","required":["id","kind","ref_id","label","layer","order","x","y","data"],"title":"GraphNodeRead","description":"One node of a work graph, already placed by the layered layout.\n\n``id`` is ``\"<kind>:<uuid>\"`` and is what the edges reference; ``ref_id`` is the bare id\nof the row it stands for. ``layer``/``order`` and ``x``/``y`` come from the deterministic\nlayout so an SVG can be drawn without re-computing positions."},"GraphRead":{"properties":{"scope":{"type":"string","enum":["work","project"],"title":"Scope"},"root_id":{"type":"string","format":"uuid","title":"Root Id"},"nodes":{"items":{"$ref":"#/components/schemas/GraphNodeRead"},"type":"array","title":"Nodes"},"edges":{"items":{"$ref":"#/components/schemas/GraphEdgeRead"},"type":"array","title":"Edges"},"truncated":{"$ref":"#/components/schemas/GraphTruncation"}},"type":"object","required":["scope","root_id","nodes","edges","truncated"],"title":"GraphRead","description":"A work graph: the objects around a work item (or across a project) as nodes and edges.\n\n``scope`` says which read produced it and ``root_id`` names the work item or project it\ncentres on. Node kinds are ``work``/``session``/``artifact``/``decision``/``handoff`` and\nedge kinds are ``dependency``/``parent``/``session-chain``/``evidence``/``handoff-lineage``.\n``truncated`` is non-zero only when the graph was capped."},"GraphTruncation":{"properties":{"nodes":{"type":"integer","title":"Nodes"},"edges":{"type":"integer","title":"Edges"}},"type":"object","required":["nodes","edges"],"title":"GraphTruncation","description":"How many nodes and edges were dropped because the graph hit its cap (0 when whole)."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"HandoffAccept":{"properties":{"to_session_id":{"type":"string","format":"uuid","title":"To Session Id"}},"type":"object","required":["to_session_id"],"title":"HandoffAccept"},"HandoffCompileIn":{"properties":{"objective":{"type":"string","maxLength":500,"minLength":1,"title":"Objective"}},"type":"object","required":["objective"],"title":"HandoffCompileIn","description":"``POST /handoffs/{id}/compile``: the one thing the caller supplies.\n\nEverything else the compiler needs it reads off the row and the work item -- the\npurpose, the source session, and through that session the workspace the daemon\nreported. The API deliberately does **not** take ``relevant_files`` or\n``source_session_id`` (both are fields of ``HandoffCompileRequest``, which is the\nservice's input and not this one): a package whose contents depended on what the\ncaller chose to send would have a hash that meant nothing, since two callers compiling\nthe same work would get two different answers to \"this is the package I reviewed\"."},"HandoffEntry":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"purpose":{"type":"string","title":"Purpose"},"state":{"$ref":"#/components/schemas/HandoffState"},"target_runtime_id":{"type":"string","format":"uuid","title":"Target Runtime Id"},"package_version":{"type":"integer","title":"Package Version"},"package_hash":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Package Hash"},"from_session_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"From Session Id"},"to_session_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"To Session Id"},"reject_reason":{"anyOf":[{"$ref":"#/components/schemas/HandoffRejectReason"},{"type":"null"}]}},"additionalProperties":false,"type":"object","required":["id","purpose","state","target_runtime_id","package_version"],"title":"HandoffEntry","description":"One handoff of this work item's lineage, newest first."},"HandoffPackageRead":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"organization_id":{"type":"string","format":"uuid","title":"Organization Id"},"work_id":{"type":"string","format":"uuid","title":"Work Id"},"from_session_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"From Session Id"},"to_session_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"To Session Id"},"target_runtime_id":{"type":"string","format":"uuid","title":"Target Runtime Id"},"purpose":{"type":"string","title":"Purpose"},"state":{"$ref":"#/components/schemas/HandoffState"},"package_version":{"type":"integer","title":"Package Version"},"package_hash":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Package Hash"},"reject_reason":{"anyOf":[{"$ref":"#/components/schemas/HandoffRejectReason"},{"type":"null"}]},"reject_note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reject Note"},"requested_by_kind":{"$ref":"#/components/schemas/ActorKind"},"requested_by_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Requested By Id"},"accepted_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Accepted At"},"completed_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Completed At"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"},"package":{"additionalProperties":true,"type":"object","title":"Package"}},"type":"object","required":["id","organization_id","work_id","from_session_id","to_session_id","target_runtime_id","purpose","state","package_version","package_hash","reject_reason","reject_note","requested_by_kind","requested_by_id","accepted_at","completed_at","created_at","updated_at","package"],"title":"HandoffPackageRead","description":"The handoff *with* its compiled package: what a person inspects before accepting.\n\n``package`` is ``HandoffPackageV1.as_document()`` verbatim -- JSON-native throughout,\nso a reader can recompute ``domain.handoff_package.package_hash`` over it and compare\nwith ``package_hash`` -- and ``{}`` for a handoff nobody has compiled yet."},"HandoffRead":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"organization_id":{"type":"string","format":"uuid","title":"Organization Id"},"work_id":{"type":"string","format":"uuid","title":"Work Id"},"from_session_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"From Session Id"},"to_session_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"To Session Id"},"target_runtime_id":{"type":"string","format":"uuid","title":"Target Runtime Id"},"purpose":{"type":"string","title":"Purpose"},"state":{"$ref":"#/components/schemas/HandoffState"},"package_version":{"type":"integer","title":"Package Version"},"package_hash":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Package Hash"},"reject_reason":{"anyOf":[{"$ref":"#/components/schemas/HandoffRejectReason"},{"type":"null"}]},"reject_note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reject Note"},"requested_by_kind":{"$ref":"#/components/schemas/ActorKind"},"requested_by_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Requested By Id"},"accepted_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Accepted At"},"completed_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Completed At"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","organization_id","work_id","from_session_id","to_session_id","target_runtime_id","purpose","state","package_version","package_hash","reject_reason","reject_note","requested_by_kind","requested_by_id","accepted_at","completed_at","created_at","updated_at"],"title":"HandoffRead","description":"One handoff as the lifecycle routes show it -- the row, without the package.\n\n``RejectedHandoffRead`` is the same row minus the two timestamps, and it stays separate\non purpose: the Needs You inbox's shape is a contract of its own and must not move\nbecause a lifecycle route wanted another field.\n\nA ``reject_reason`` on a handoff that is no longer ``rejected`` is not a contradiction:\nrecompiling a rejected handoff offers it again without erasing why it was turned down\n(``HandoffService.mark_compiled``), so ``state: compiled`` with a reason reads as\n\"refused once, amended, offered again\" -- which is FLOW-005."},"HandoffReject":{"properties":{"reason":{"$ref":"#/components/schemas/HandoffRejectReason"},"note":{"type":"string","maxLength":4000,"title":"Note","default":""}},"type":"object","required":["reason"],"title":"HandoffReject"},"HandoffRejectReason":{"type":"string","enum":["missing_context","wrong_runtime","superseded","other"],"title":"HandoffRejectReason"},"HandoffRequest":{"properties":{"target_runtime_id":{"type":"string","format":"uuid","title":"Target Runtime Id"},"purpose":{"type":"string","maxLength":64,"minLength":1,"title":"Purpose"},"from_session_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"From Session Id"}},"type":"object","required":["target_runtime_id","purpose"],"title":"HandoffRequest"},"HandoffState":{"type":"string","enum":["requested","compiled","accepted","rejected","completed","cancelled"],"title":"HandoffState"},"ImportedWork":{"properties":{"source_export_id":{"type":"string","title":"Source Export Id"},"source_key":{"type":"string","title":"Source Key"},"new_id":{"type":"string","format":"uuid","title":"New Id"},"new_key":{"type":"string","title":"New Key"}},"type":"object","required":["source_export_id","source_key","new_id","new_key"],"title":"ImportedWork","description":"What one imported item became: its source ids and the new ones it was minted."},"InvitationCreateIn":{"properties":{"email":{"type":"string","maxLength":320,"title":"Email"},"role":{"$ref":"#/components/schemas/Role"}},"type":"object","required":["email","role"],"title":"InvitationCreateIn"},"InvitationCreated":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"organization_id":{"type":"string","format":"uuid","title":"Organization Id"},"email":{"type":"string","title":"Email"},"role":{"$ref":"#/components/schemas/Role"},"invited_by_user_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Invited By User Id"},"expires_at":{"type":"string","title":"Expires At"},"accepted_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Accepted At"},"created_at":{"type":"string","title":"Created At"},"token":{"type":"string","title":"Token"}},"type":"object","required":["id","organization_id","email","role","invited_by_user_id","expires_at","accepted_at","created_at","token"],"title":"InvitationCreated","description":"The create response: the only time the plaintext token is shown."},"InvitationRead":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"organization_id":{"type":"string","format":"uuid","title":"Organization Id"},"email":{"type":"string","title":"Email"},"role":{"$ref":"#/components/schemas/Role"},"invited_by_user_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Invited By User Id"},"expires_at":{"type":"string","title":"Expires At"},"accepted_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Accepted At"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","organization_id","email","role","invited_by_user_id","expires_at","accepted_at","created_at"],"title":"InvitationRead"},"LoginIn":{"properties":{"email":{"type":"string","maxLength":320,"title":"Email"},"password":{"type":"string","maxLength":1024,"title":"Password"}},"type":"object","required":["email","password"],"title":"LoginIn"},"MachineCommandKind":{"type":"string","enum":["start_session","cancel_session","send_instruction","run_doctor"],"title":"MachineCommandKind","description":"What the server asks a daemon to do; the payload's shape follows the kind."},"MachineCommandRead":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"organization_id":{"type":"string","format":"uuid","title":"Organization Id"},"machine_id":{"type":"string","format":"uuid","title":"Machine Id"},"session_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Session Id"},"kind":{"$ref":"#/components/schemas/MachineCommandKind"},"payload":{"additionalProperties":true,"type":"object","title":"Payload"},"state":{"$ref":"#/components/schemas/MachineCommandState"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"result":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Result"},"created_at":{"type":"string","title":"Created At"},"delivered_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Delivered At"},"acked_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Acked At"}},"type":"object","required":["id","organization_id","machine_id","session_id","kind","payload","state","error","result","created_at","delivered_at","acked_at"],"title":"MachineCommandRead","description":"One queued instruction for a daemon."},"MachineCommandState":{"type":"string","enum":["queued","delivered","acked","failed"],"title":"MachineCommandState","description":"queued -> delivered (handed to a poll) -> acked | failed (the daemon reported back)."},"MachineCommandsRead":{"properties":{"items":{"items":{"$ref":"#/components/schemas/MachineCommandRead"},"type":"array","title":"Items"}},"type":"object","required":["items"],"title":"MachineCommandsRead","description":"What a long poll answers: the commands it took, oldest first (possibly none)."},"MachineEnroll":{"properties":{"name":{"type":"string","maxLength":200,"minLength":1,"title":"Name"},"platform":{"type":"string","maxLength":64,"minLength":1,"title":"Platform"},"daemon_version":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Daemon Version"},"runtimes":{"items":{"$ref":"#/components/schemas/RuntimeDoctorReport"},"type":"array","maxItems":50,"title":"Runtimes"}},"type":"object","required":["name","platform"],"title":"MachineEnroll","description":"``POST /machines/enroll``: what the daemon says about the host it runs on."},"MachineEnrolled":{"properties":{"machine":{"$ref":"#/components/schemas/MachineRead"},"token":{"type":"string","title":"Token"}},"type":"object","required":["machine","token"],"title":"MachineEnrolled","description":"The answer to an enrolment: the machine, and its device token shown once."},"MachineHeartbeat":{"properties":{"daemon_version":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Daemon Version"},"runtimes":{"anyOf":[{"items":{"$ref":"#/components/schemas/RuntimeDoctorReport"},"type":"array","maxItems":50},{"type":"null"}],"title":"Runtimes"},"max_concurrent_sessions":{"anyOf":[{"type":"integer","maximum":64.0,"minimum":1.0},{"type":"null"}],"title":"Max Concurrent Sessions"}},"type":"object","title":"MachineHeartbeat","description":"``POST /machines/{id}/heartbeat``: liveness, and what ``doctor()`` found this round.\n\n``runtimes`` omitted (``None``) keeps the stored reports; an empty list clears them,\nwhich is how a daemon says it found nothing at all.\n\n``max_concurrent_sessions`` is the daemon's own configured session limit, reported so the\nserver's ``machines.max_concurrent_sessions`` mirrors what the host actually enforces\n(DF-022). Omitted (``None``, an older daemon) keeps the stored value; a number updates it,\nclamped to ``[MIN, MAX]`` so a misconfigured host cannot store a nonsensical capacity."},"MachineRead":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"organization_id":{"type":"string","format":"uuid","title":"Organization Id"},"name":{"type":"string","title":"Name"},"platform":{"type":"string","title":"Platform"},"daemon_version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Daemon Version"},"status":{"$ref":"#/components/schemas/MachineStatus"},"online":{"type":"boolean","title":"Online"},"last_seen_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Seen At"},"revoked_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Revoked At"},"runtimes":{"items":{"$ref":"#/components/schemas/RuntimeDoctorReport"},"type":"array","title":"Runtimes"},"max_concurrent_sessions":{"type":"integer","title":"Max Concurrent Sessions"},"running_sessions":{"type":"integer","title":"Running Sessions"},"queued_sessions":{"type":"integer","title":"Queued Sessions"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","organization_id","name","platform","daemon_version","status","online","last_seen_at","revoked_at","runtimes","max_concurrent_sessions","running_sessions","queued_sessions","created_at","updated_at"],"title":"MachineRead","description":"A machine, with the liveness the server derives rather than stores."},"MachineRuntimeReportRead":{"properties":{"machine_id":{"type":"string","format":"uuid","title":"Machine Id"},"machine_name":{"type":"string","title":"Machine Name"},"online":{"type":"boolean","title":"Online"},"last_seen_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Seen At"},"report":{"$ref":"#/components/schemas/RuntimeDoctorReport"}},"type":"object","required":["machine_id","machine_name","online","last_seen_at","report"],"title":"MachineRuntimeReportRead","description":"One machine's latest doctor report for one runtime."},"MachineStatus":{"type":"string","enum":["pending","online","revoked"],"title":"MachineStatus","description":"A machine's lifecycle. ``online`` is the *enrolled* state, not liveness: whether a\nmachine is reachable is derived from ``last_seen_at`` (``MachineService.is_online``)."},"MeRead":{"properties":{"user":{"$ref":"#/components/schemas/UserRead"},"memberships":{"items":{"$ref":"#/components/schemas/MembershipWithOrganizationRead"},"type":"array","title":"Memberships"}},"type":"object","required":["user","memberships"],"title":"MeRead"},"MemberRoleIn":{"properties":{"role":{"$ref":"#/components/schemas/Role"}},"type":"object","required":["role"],"title":"MemberRoleIn"},"MembershipRead":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"organization_id":{"type":"string","format":"uuid","title":"Organization Id"},"user_id":{"type":"string","format":"uuid","title":"User Id"},"role":{"$ref":"#/components/schemas/Role"},"status":{"$ref":"#/components/schemas/MembershipStatus"},"created_at":{"type":"string","title":"Created At"},"user":{"$ref":"#/components/schemas/UserRead"}},"type":"object","required":["id","organization_id","user_id","role","status","created_at","user"],"title":"MembershipRead"},"MembershipStatus":{"type":"string","enum":["active","suspended"],"title":"MembershipStatus"},"MembershipWithOrganizationRead":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"organization_id":{"type":"string","format":"uuid","title":"Organization Id"},"user_id":{"type":"string","format":"uuid","title":"User Id"},"role":{"$ref":"#/components/schemas/Role"},"status":{"$ref":"#/components/schemas/MembershipStatus"},"created_at":{"type":"string","title":"Created At"},"user":{"$ref":"#/components/schemas/UserRead"},"organization":{"$ref":"#/components/schemas/OrganizationRead"}},"type":"object","required":["id","organization_id","user_id","role","status","created_at","user","organization"],"title":"MembershipWithOrganizationRead"},"NeedsYouCounts":{"properties":{"approvals":{"type":"integer","title":"Approvals"},"blockers":{"type":"integer","title":"Blockers"},"failed_sessions":{"type":"integer","title":"Failed Sessions"},"rejected_handoffs":{"type":"integer","title":"Rejected Handoffs"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["approvals","blockers","failed_sessions","rejected_handoffs","total"],"title":"NeedsYouCounts","description":"How many rows each section *has*, which is not how many this response carries.\n\nThe badge in the navigation shows ``total``; the sections themselves are capped by\n``?limit=``, so a count larger than the list it labels is correct and expected."},"NeedsYouRead":{"properties":{"approvals":{"items":{"$ref":"#/components/schemas/ApprovalRead"},"type":"array","title":"Approvals"},"blockers":{"items":{"$ref":"#/components/schemas/BlockerRead"},"type":"array","title":"Blockers"},"failed_sessions":{"items":{"$ref":"#/components/schemas/SessionRead"},"type":"array","title":"Failed Sessions"},"rejected_handoffs":{"items":{"$ref":"#/components/schemas/RejectedHandoffRead"},"type":"array","title":"Rejected Handoffs"},"counts":{"$ref":"#/components/schemas/NeedsYouCounts"}},"type":"object","required":["approvals","blockers","failed_sessions","rejected_handoffs","counts"],"title":"NeedsYouRead","description":"The unified inbox: the four things that stop being anybody's job if nobody looks."},"NotificationKind":{"type":"string","enum":["approval_requested","approval_decided","blocker_reported","blocker_resolved","session_completed","session_failed"],"title":"NotificationKind","description":"The kinds of in-app / email notification Kernel raises for a person (M17, KBK-10).\n\nEach maps from the material :class:`EventType` that triggers it: an approval decided\n(approved or rejected) is one kind, ``approval_decided``, because the recipient cares\nthat a decision landed, not which way (that is in the notification body). The value set\nis the vocabulary the per-user preference matrix keys on, so it is fixed here and\nasserted in ``tests/unit/domain/test_enums.py``."},"NotificationPreferenceRead":{"properties":{"kind":{"$ref":"#/components/schemas/NotificationKind"},"in_app":{"type":"boolean","title":"In App"},"email":{"type":"boolean","title":"Email"}},"type":"object","required":["kind","in_app","email"],"title":"NotificationPreferenceRead","description":"One kind's channel preference for the caller."},"NotificationPreferencesRead":{"properties":{"preferences":{"items":{"$ref":"#/components/schemas/NotificationPreferenceRead"},"type":"array","title":"Preferences"}},"type":"object","required":["preferences"],"title":"NotificationPreferencesRead","description":"The caller's channel preference for every kind, defaults filled in."},"NotificationPreferencesUpdate":{"properties":{"preferences":{"additionalProperties":{"$ref":"#/components/schemas/ChannelPreference"},"propertyNames":{"$ref":"#/components/schemas/NotificationKind"},"type":"object","title":"Preferences","default":{}}},"type":"object","title":"NotificationPreferencesUpdate","description":"A partial update of the preference matrix: only the named kinds change.\n\nAn empty map changes nothing (and is accepted), so a form that posts no toggles is a\nno-op rather than an error."},"NotificationRead":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"organization_id":{"type":"string","format":"uuid","title":"Organization Id"},"project_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Project Id"},"user_id":{"type":"string","format":"uuid","title":"User Id"},"kind":{"$ref":"#/components/schemas/NotificationKind"},"title":{"type":"string","title":"Title"},"body":{"type":"string","title":"Body"},"work_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Work Id"},"session_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Session Id"},"read_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Read At"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","organization_id","project_id","user_id","kind","title","body","work_id","session_id","read_at","created_at","updated_at"],"title":"NotificationRead","description":"One in-app notification: what it is about, where it links, and whether it is read."},"NotificationUnreadCount":{"properties":{"unread":{"type":"integer","title":"Unread"}},"type":"object","required":["unread"],"title":"NotificationUnreadCount","description":"The badge's number: how many of the caller's notifications are unread."},"OrganizationCreateIn":{"properties":{"name":{"type":"string","maxLength":200,"minLength":1,"title":"Name"},"slug":{"anyOf":[{"type":"string","pattern":"^[a-z0-9](?:[a-z0-9-]{1,62}[a-z0-9])?$"},{"type":"null"}],"title":"Slug"}},"type":"object","required":["name"],"title":"OrganizationCreateIn"},"OrganizationRead":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"slug":{"type":"string","title":"Slug"},"name":{"type":"string","title":"Name"},"settings":{"additionalProperties":true,"type":"object","title":"Settings"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","slug","name","settings","created_at","updated_at"],"title":"OrganizationRead"},"OrganizationUpdateIn":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":200,"minLength":1},{"type":"null"}],"title":"Name"},"settings":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Settings"}},"type":"object","title":"OrganizationUpdateIn","description":"Every field is optional: a field left unset is unchanged; neither may be null."},"OutcomeRead":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"organization_id":{"type":"string","format":"uuid","title":"Organization Id"},"work_id":{"type":"string","format":"uuid","title":"Work Id"},"status":{"$ref":"#/components/schemas/OutcomeStatus"},"summary":{"type":"string","title":"Summary"},"acceptance_results":{"items":{"$ref":"#/components/schemas/AcceptanceResult"},"type":"array","title":"Acceptance Results"},"metrics":{"additionalProperties":true,"type":"object","title":"Metrics"},"decided_by_kind":{"$ref":"#/components/schemas/ActorKind"},"decided_by_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Decided By Id"},"decided_at":{"type":"string","title":"Decided At"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","organization_id","work_id","status","summary","acceptance_results","metrics","decided_by_kind","decided_by_id","decided_at","created_at","updated_at"],"title":"OutcomeRead","description":"One recorded result of a work item against its acceptance criteria."},"OutcomeRecord":{"properties":{"status":{"$ref":"#/components/schemas/OutcomeStatus"},"summary":{"type":"string","title":"Summary","default":""},"acceptance_results":{"items":{"$ref":"#/components/schemas/AcceptanceResult"},"type":"array","title":"Acceptance Results"},"metrics":{"additionalProperties":true,"type":"object","title":"Metrics"},"session_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Session Id"}},"type":"object","required":["status"],"title":"OutcomeRecord"},"OutcomeStatus":{"type":"string","enum":["success","partial","failure","cancelled"],"title":"OutcomeStatus"},"PageOut_ApiTokenRead_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/ApiTokenRead"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["items"],"title":"PageOut[ApiTokenRead]"},"PageOut_ApprovalDelegationRead_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/ApprovalDelegationRead"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["items"],"title":"PageOut[ApprovalDelegationRead]"},"PageOut_ApprovalRead_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/ApprovalRead"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["items"],"title":"PageOut[ApprovalRead]"},"PageOut_ArtifactRead_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/ArtifactRead"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["items"],"title":"PageOut[ArtifactRead]"},"PageOut_ArtifactTypeRead_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/ArtifactTypeRead"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["items"],"title":"PageOut[ArtifactTypeRead]"},"PageOut_BlockerRead_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/BlockerRead"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["items"],"title":"PageOut[BlockerRead]"},"PageOut_DecisionRead_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/DecisionRead"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["items"],"title":"PageOut[DecisionRead]"},"PageOut_EventRead_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/EventRead"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["items"],"title":"PageOut[EventRead]"},"PageOut_HandoffRead_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/HandoffRead"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["items"],"title":"PageOut[HandoffRead]"},"PageOut_InvitationRead_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/InvitationRead"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["items"],"title":"PageOut[InvitationRead]"},"PageOut_MachineRead_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/MachineRead"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["items"],"title":"PageOut[MachineRead]"},"PageOut_MembershipRead_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/MembershipRead"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["items"],"title":"PageOut[MembershipRead]"},"PageOut_NotificationRead_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/NotificationRead"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["items"],"title":"PageOut[NotificationRead]"},"PageOut_OrganizationRead_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/OrganizationRead"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["items"],"title":"PageOut[OrganizationRead]"},"PageOut_OutcomeRead_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/OutcomeRead"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["items"],"title":"PageOut[OutcomeRead]"},"PageOut_ProjectRead_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/ProjectRead"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["items"],"title":"PageOut[ProjectRead]"},"PageOut_RuntimeRead_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/RuntimeRead"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["items"],"title":"PageOut[RuntimeRead]"},"PageOut_SavedFilterRead_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/SavedFilterRead"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["items"],"title":"PageOut[SavedFilterRead]"},"PageOut_SessionRead_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/SessionRead"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["items"],"title":"PageOut[SessionRead]"},"PageOut_WebhookDeliveryRead_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/WebhookDeliveryRead"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["items"],"title":"PageOut[WebhookDeliveryRead]"},"PageOut_WebhookRead_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/WebhookRead"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["items"],"title":"PageOut[WebhookRead]"},"PageOut_WorkRead_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/WorkRead"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["items"],"title":"PageOut[WorkRead]"},"PageOut_WorkTemplateRead_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/WorkTemplateRead"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["items"],"title":"PageOut[WorkTemplateRead]"},"PrincipalRead":{"properties":{"credential":{"type":"string","enum":["cookie","token"],"title":"Credential"},"kind":{"type":"string","enum":["user","service","session","device"],"title":"Kind"},"organization_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Organization Id"},"user_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"User Id"},"token_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Token Id"},"session_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Session Id"},"work_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Work Id"},"machine_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Machine Id"},"scopes":{"items":{"type":"string"},"type":"array","title":"Scopes"},"project_ids":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Project Ids"}},"type":"object","required":["credential","kind","organization_id","user_id","token_id","session_id","work_id","machine_id","scopes","project_ids"],"title":"PrincipalRead","description":"What the credential behind a request is, told to the holder of that credential.\n\nA session token reaches its own session and its own work item and nothing else -- not\nthe organization, not the project, so not the ``by-key`` lookup a key needs. This is\nhow such a caller learns *which* session and work item it is, from the credential it\nalready holds, without being handed the ids beside the token. It discloses nothing the\nholder could not already infer by trying: a token's kind, scopes and confinement are\nwhat the tokens page shows its owner, and a cookie session is a signed-in user."},"Priority":{"type":"string","enum":["low","normal","high","urgent"],"title":"Priority"},"PrivacyMode":{"type":"string","enum":["metadata_only","artifacts_selected","full_session_history"],"title":"PrivacyMode","description":"How much of what a session produced Kernel is allowed to keep, from least to most.\n\nThe three levels of ``spec/10_implementation/12_security_privacy.md``, ordered by how\nmuch leaves the machine. ``metadata_only`` keeps a session's shape, cost and outcome and\nnothing of its conversation or the source it touched; ``artifacts_selected`` additionally\nkeeps the artifacts a session deliberately produced, but still not its running transcript;\n``full_session_history`` keeps the transcript too. The order is the whole point -- an\norganization sets a *ceiling* and a project may sit at or below it, never above\n(``kernelos.domain.privacy``). The ranking is written once, in ``PRIVACY_ORDER``, so that\n\"stricter\" and \"min\" are one definition rather than scattered comparisons."},"ProjectCreate":{"properties":{"key":{"type":"string","pattern":"^[A-Z][A-Z0-9]{1,15}$","title":"Key"},"name":{"type":"string","maxLength":200,"minLength":1,"title":"Name"},"description":{"type":"string","title":"Description","default":""}},"type":"object","required":["key","name"],"title":"ProjectCreate"},"ProjectRead":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"organization_id":{"type":"string","format":"uuid","title":"Organization Id"},"key":{"type":"string","title":"Key"},"name":{"type":"string","title":"Name"},"description":{"type":"string","title":"Description"},"custom_field_schema":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Custom Field Schema"},"privacy_mode":{"anyOf":[{"$ref":"#/components/schemas/PrivacyMode"},{"type":"null"}]},"archived_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Archived At"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","organization_id","key","name","description","archived_at","created_at","updated_at"],"title":"ProjectRead"},"ProjectUpdate":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":200,"minLength":1},{"type":"null"}],"title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"custom_field_schema":{"anyOf":[{"items":{"$ref":"#/components/schemas/CustomFieldDef"},"type":"array","maxItems":50},{"type":"null"}],"title":"Custom Field Schema"},"privacy_mode":{"anyOf":[{"$ref":"#/components/schemas/PrivacyMode"},{"type":"null"}]}},"type":"object","title":"ProjectUpdate","description":"Every field is optional: a field left unset is unchanged.\n\nA present ``custom_field_schema`` replaces the whole schema (an empty list clears it and\nreturns the project's custom fields to free-form), which is distinct from omitting it.\n\n``privacy_mode`` is the one field that may be set to ``null`` on purpose: ``null`` clears\nthe project's own mode so it inherits the organization's ceiling again, which is a\ndifferent act from omitting the field (unchanged). A non-null value must be at or below\nthe organization's ceiling, refused ``validation.failed`` otherwise (``update``)."},"RecommendationReason":{"type":"string","enum":["scored","default_fallback","manual","no_candidates"],"title":"RecommendationReason","description":"Why a :class:`Recommendation` chose what it chose.\n\n``scored`` -- a candidate won on merit; ``manual`` -- the mode makes no automatic pick;\n``default_fallback`` -- nothing qualified, so the configured default was used;\n``no_candidates`` -- nothing qualified and there was no usable default."},"RegisterIn":{"properties":{"email":{"type":"string","maxLength":320,"title":"Email"},"display_name":{"type":"string","maxLength":200,"minLength":1,"title":"Display Name"},"password":{"type":"string","maxLength":1024,"title":"Password"}},"type":"object","required":["email","display_name","password"],"title":"RegisterIn"},"RejectedHandoffRead":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"organization_id":{"type":"string","format":"uuid","title":"Organization Id"},"work_id":{"type":"string","format":"uuid","title":"Work Id"},"from_session_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"From Session Id"},"to_session_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"To Session Id"},"target_runtime_id":{"type":"string","format":"uuid","title":"Target Runtime Id"},"purpose":{"type":"string","title":"Purpose"},"state":{"$ref":"#/components/schemas/HandoffState"},"package_version":{"type":"integer","title":"Package Version"},"package_hash":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Package Hash"},"reject_reason":{"anyOf":[{"$ref":"#/components/schemas/HandoffRejectReason"},{"type":"null"}]},"reject_note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reject Note"},"requested_by_kind":{"$ref":"#/components/schemas/ActorKind"},"requested_by_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Requested By Id"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","organization_id","work_id","from_session_id","to_session_id","target_runtime_id","purpose","state","package_version","package_hash","reject_reason","reject_note","requested_by_kind","requested_by_id","created_at","updated_at"],"title":"RejectedHandoffRead","description":"A rejected handoff as the inbox shows it: why it was turned down, not what was in it.\n\n``package`` is deliberately absent. The inbox row exists to say \"this needs amending\",\nand the package is an arbitrarily large document that belongs to the handoff API rather\nthan to a list of four sections."},"RenderedEventRead":{"properties":{"summary":{"type":"string","title":"Summary"},"actor_label":{"type":"string","title":"Actor Label"},"links":{"items":{"$ref":"#/components/schemas/EventLinkRead"},"type":"array","title":"Links"}},"type":"object","required":["summary","actor_label","links"],"title":"RenderedEventRead","description":"The event as a reader sees it (``events.render``); plain text, never markup."},"RevokedRead":{"properties":{"revoked":{"type":"integer","title":"Revoked"}},"type":"object","required":["revoked"],"title":"RevokedRead"},"Role":{"type":"string","enum":["owner","admin","member","viewer"],"title":"Role"},"RuntimeAdapterType":{"type":"string","enum":["codex","claude","gemini","generic_cli","external","fake"],"title":"RuntimeAdapterType"},"RuntimeAnalyticsRead":{"properties":{"from_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"From Date"},"to_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"To Date"},"min_sample":{"type":"integer","title":"Min Sample"},"runtimes":{"items":{"$ref":"#/components/schemas/RuntimeMetricSliceRead"},"type":"array","title":"Runtimes"}},"type":"object","required":["min_sample","runtimes"],"title":"RuntimeAnalyticsRead","description":"Runtime analytics: the resolved range, the sample threshold, and one row per bucket.\n\n``from_date``/``to_date`` echo the half-open ``[from, to)`` filter (either may be\n``null`` for an open bound); ``min_sample`` is the threshold below which a slice's rate\nis withheld, published so a reader knows why a rate is ``null``."},"RuntimeCapabilities":{"properties":{"start":{"type":"boolean","title":"Start","default":false},"resume":{"type":"boolean","title":"Resume","default":false},"cancel":{"type":"boolean","title":"Cancel","default":false},"stream_events":{"type":"boolean","title":"Stream Events","default":false},"send_instruction":{"type":"boolean","title":"Send Instruction","default":false},"provider_session_ids":{"type":"boolean","title":"Provider Session Ids","default":false},"mcp_client":{"type":"boolean","title":"Mcp Client","default":false},"cost_metrics":{"type":"boolean","title":"Cost Metrics","default":false},"artifact_events":{"type":"boolean","title":"Artifact Events","default":false},"approval_relay":{"type":"boolean","title":"Approval Relay","default":false}},"type":"object","title":"RuntimeCapabilities","description":"The nine capability flags of one adapter (see the module docstring)."},"RuntimeDefinitionCreate":{"properties":{"key":{"type":"string","maxLength":64,"minLength":1,"pattern":"^[a-z][a-z0-9_]*$","title":"Key"},"display_name":{"type":"string","maxLength":200,"minLength":1,"title":"Display Name"},"adapter_type":{"$ref":"#/components/schemas/RuntimeAdapterType"},"configuration":{"additionalProperties":true,"type":"object","title":"Configuration"},"capabilities":{"anyOf":[{"$ref":"#/components/schemas/RuntimeCapabilities"},{"type":"null"}]},"enabled":{"type":"boolean","title":"Enabled","default":true}},"type":"object","required":["key","display_name","adapter_type"],"title":"RuntimeDefinitionCreate","description":"``POST /organizations/{id}/runtimes``: an organization's own runtime definition."},"RuntimeDefinitionUpdate":{"properties":{"display_name":{"anyOf":[{"type":"string","maxLength":200,"minLength":1},{"type":"null"}],"title":"Display Name"},"configuration":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Configuration"},"capabilities":{"anyOf":[{"$ref":"#/components/schemas/RuntimeCapabilities"},{"type":"null"}]},"enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Enabled"}},"type":"object","title":"RuntimeDefinitionUpdate","description":"``PATCH …/runtimes/{id}``: only the fields sent are changed."},"RuntimeDoctorRead":{"properties":{"runtime_id":{"type":"string","format":"uuid","title":"Runtime Id"},"key":{"type":"string","title":"Key"},"items":{"items":{"$ref":"#/components/schemas/MachineRuntimeReportRead"},"type":"array","title":"Items"}},"type":"object","required":["runtime_id","key","items"],"title":"RuntimeDoctorRead","description":"``GET …/runtimes/{id}/doctor``: what every machine last said about this runtime."},"RuntimeDoctorReport":{"properties":{"key":{"type":"string","maxLength":64,"minLength":1,"title":"Key"},"installed":{"type":"boolean","title":"Installed","default":false},"authenticated":{"type":"boolean","title":"Authenticated","default":false},"version":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Version"},"path":{"anyOf":[{"type":"string","maxLength":4096},{"type":"null"}],"title":"Path"},"capabilities":{"$ref":"#/components/schemas/RuntimeCapabilities"},"problems":{"items":{"type":"string","maxLength":500},"type":"array","maxItems":20,"title":"Problems"}},"type":"object","required":["key"],"title":"RuntimeDoctorReport","description":"One runtime as a machine's ``doctor()`` found it."},"RuntimeMetricSliceRead":{"properties":{"runtime_definition_id":{"type":"string","format":"uuid","title":"Runtime Definition Id"},"task_type":{"$ref":"#/components/schemas/TaskType"},"session_count":{"type":"integer","title":"Session Count"},"success_count":{"type":"integer","title":"Success Count"},"failure_count":{"type":"integer","title":"Failure Count"},"partial_count":{"type":"integer","title":"Partial Count"},"outcome_sample":{"type":"integer","title":"Outcome Sample"},"success_rate":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Success Rate"},"sample_too_small":{"type":"boolean","title":"Sample Too Small"},"handoff_count":{"type":"integer","title":"Handoff Count"},"intervention_count":{"type":"integer","title":"Intervention Count"},"handoff_rate":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Handoff Rate"},"intervention_rate":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Intervention Rate"},"cost_p50_typical":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Cost P50 Typical"},"duration_p50_typical_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Duration P50 Typical Seconds"}},"type":"object","required":["runtime_definition_id","task_type","session_count","success_count","failure_count","partial_count","outcome_sample","success_rate","sample_too_small","handoff_count","intervention_count","handoff_rate","intervention_rate","cost_p50_typical","duration_p50_typical_seconds"],"title":"RuntimeMetricSliceRead","description":"One runtime + task-type row of the runtime analytics, summed over the range.\n\n``success_rate`` is ``success_count / outcome_sample`` (the outcome sample being\n``success + failure + partial``), ``null`` when ``sample_too_small`` -- fewer than\n``min_sample`` recorded outcomes, too few to recommend on. ``handoff_rate`` and\n``intervention_rate`` are taken over ``session_count`` and are ``null`` the same way when\nit is below the threshold. ``cost_p50_typical`` and ``duration_p50_typical_seconds`` are\nthe median of the non-null daily medians -- a representative middle day, not the range's\ntrue percentile (which the daily rows cannot reconstruct); ``null`` when nothing sampled."},"RuntimeRead":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"organization_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Organization Id"},"key":{"type":"string","title":"Key"},"display_name":{"type":"string","title":"Display Name"},"adapter_type":{"$ref":"#/components/schemas/RuntimeAdapterType"},"configuration":{"additionalProperties":true,"type":"object","title":"Configuration"},"capabilities":{"$ref":"#/components/schemas/RuntimeCapabilities"},"enabled":{"type":"boolean","title":"Enabled"},"builtin":{"type":"boolean","title":"Builtin"},"machines":{"items":{"$ref":"#/components/schemas/MachineRuntimeReportRead"},"type":"array","title":"Machines"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","organization_id","key","display_name","adapter_type","configuration","capabilities","enabled","builtin","machines","created_at","updated_at"],"title":"RuntimeRead","description":"A runtime definition and the machines that report having it."},"RuntimeRecommendationCandidateRead":{"properties":{"runtime_id":{"type":"string","format":"uuid","title":"Runtime Id"},"runtime_name":{"type":"string","title":"Runtime Name"},"enabled":{"type":"boolean","title":"Enabled"},"capability_ok":{"type":"boolean","title":"Capability Ok"},"policy_forbidden":{"type":"boolean","title":"Policy Forbidden"},"sample_size":{"type":"integer","title":"Sample Size"},"success_rate":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Success Rate"},"cost_typical":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Cost Typical"},"duration_typical_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Duration Typical Seconds"},"score":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Score"},"excluded":{"type":"boolean","title":"Excluded"},"exclusion_reason":{"anyOf":[{"$ref":"#/components/schemas/ExclusionReason"},{"type":"null"}]}},"type":"object","required":["runtime_id","runtime_name","enabled","capability_ok","policy_forbidden","sample_size","success_rate","cost_typical","duration_typical_seconds","score","excluded","exclusion_reason"],"title":"RuntimeRecommendationCandidateRead","description":"One runtime in a recommendation, with its score or the hard filter it failed.\n\nA copy of the scored :class:`~kernelos.domain.scheduler.Candidate`: the inputs the\nscheduler saw (``enabled``, ``capability_ok``, ``policy_forbidden`` and the aggregate\nmetrics) and its verdict. A survivor carries a ``score`` in ``[0, 1]`` and\n``excluded: false``; a candidate that failed a hard filter carries ``excluded: true`` and\nthe ``exclusion_reason`` that says which one, so the UI can show *why not* beside it."},"RuntimeRecommendationRead":{"properties":{"work_id":{"type":"string","format":"uuid","title":"Work Id"},"task_type":{"$ref":"#/components/schemas/TaskType"},"reason":{"$ref":"#/components/schemas/RecommendationReason"},"explanation":{"type":"string","title":"Explanation"},"chosen_runtime_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Chosen Runtime Id"},"candidates":{"items":{"$ref":"#/components/schemas/RuntimeRecommendationCandidateRead"},"type":"array","title":"Candidates"}},"type":"object","required":["work_id","task_type","reason","explanation","chosen_runtime_id","candidates"],"title":"RuntimeRecommendationRead","description":"The scheduler's answer for one work item: what to run, why, and the full ranking.\n\n``chosen_runtime_id`` is the recommended runtime (``null`` when nothing qualified or the\nmode makes no automatic pick); ``reason`` says whether it won on merit\n(``scored``), was the configured fallback (``default_fallback``), was left to a person\n(``manual``), or nothing qualified (``no_candidates``). ``explanation`` is the one\narguable sentence built from the chosen runtime's real numbers. ``candidates`` is every\nruntime the org may use, best first then the excluded ones, each carrying its score or\nexclusion reason -- advisory only, it starts nothing and approves nothing."},"RuntimeTestRunRead":{"properties":{"command_id":{"type":"string","format":"uuid","title":"Command Id"},"runtime_id":{"type":"string","format":"uuid","title":"Runtime Id"},"machine_id":{"type":"string","format":"uuid","title":"Machine Id"},"state":{"$ref":"#/components/schemas/MachineCommandState"},"report":{"anyOf":[{"$ref":"#/components/schemas/RuntimeDoctorReport"},{"type":"null"}]},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"created_at":{"type":"string","title":"Created At"},"delivered_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Delivered At"},"acked_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Acked At"}},"type":"object","required":["command_id","runtime_id","machine_id","state","report","error","created_at","delivered_at","acked_at"],"title":"RuntimeTestRunRead","description":"``POST …/runtimes/{id}/test`` and ``GET …/runtimes/{id}/test/{command_id}``: one\non-demand ``doctor()`` run, from the queued handle to the report the daemon reports back.\n\nA test run *is* a ``machine_commands`` row (``run_doctor``): ``state`` walks\n``queued → delivered → acked | failed`` exactly as the daemon works it, which is the\npending-then-result the page shows. ``report`` is filled only once the run is ``acked``;\na ``failed`` run carries its ``error`` and no report."},"RuntimeTestTrigger":{"properties":{"machine_id":{"type":"string","format":"uuid","title":"Machine Id"}},"type":"object","required":["machine_id"],"title":"RuntimeTestTrigger","description":"``POST …/runtimes/{id}/test``: which machine to run this runtime's ``doctor()`` on."},"SavedFilterCreate":{"properties":{"name":{"type":"string","maxLength":120,"minLength":1,"title":"Name"},"definition":{"$ref":"#/components/schemas/FilterDefinition"},"shared":{"type":"boolean","title":"Shared","default":false}},"type":"object","required":["name"],"title":"SavedFilterCreate"},"SavedFilterRead":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"organization_id":{"type":"string","format":"uuid","title":"Organization Id"},"owner_user_id":{"type":"string","format":"uuid","title":"Owner User Id"},"name":{"type":"string","title":"Name"},"definition":{"additionalProperties":true,"type":"object","title":"Definition"},"shared":{"type":"boolean","title":"Shared"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","organization_id","owner_user_id","name","definition","shared","created_at","updated_at"],"title":"SavedFilterRead","description":"One saved board/list filter as the API shows it.\n\n``definition`` is the stored document verbatim (only the dimensions that were set);\n``shared`` says whether every member sees it or only its owner. ``owner_user_id`` lets a\nreader tell their own filters from the shared ones another member owns."},"SavedFilterUpdate":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":120,"minLength":1},{"type":"null"}],"title":"Name"},"definition":{"anyOf":[{"$ref":"#/components/schemas/FilterDefinition"},{"type":"null"}]},"shared":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Shared"}},"type":"object","title":"SavedFilterUpdate","description":"A partial update: rename, replace the definition, share/unshare, in any combination.\n\nA field left unset (``None``) is not touched; a present ``definition`` replaces the whole\ndocument (an empty one clears every dimension), which is distinct from omitting it."},"SchedulingMode":{"type":"string","enum":["manual","best_success","lowest_cost","fastest","weighted"],"title":"SchedulingMode"},"SearchKind":{"type":"string","enum":["work","decision","blocker","artifact","session","runtime","machine"],"title":"SearchKind","description":"The resource a hit names; the UI groups by it and the URL is built from it."},"SearchResultRead":{"properties":{"type":{"$ref":"#/components/schemas/SearchKind"},"id":{"type":"string","format":"uuid","title":"Id"},"key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Key"},"title":{"type":"string","title":"Title"},"snippet":{"type":"string","title":"Snippet"},"url":{"type":"string","title":"Url"}},"type":"object","required":["type","id","key","title","snippet","url"],"title":"SearchResultRead","description":"One search hit: what it is, how to name it, why it matched, and where to open it.\n\n``key`` is the human key of the work item the hit belongs to (its own, for a work hit),\nthe handle a person recognises; ``url`` is the page the hit opens to, already confined\nto the caller's organization so it never points anywhere they could not otherwise reach."},"SearchResultsRead":{"properties":{"query":{"type":"string","title":"Query"},"results":{"items":{"$ref":"#/components/schemas/SearchResultRead"},"type":"array","title":"Results"}},"type":"object","required":["query","results"],"title":"SearchResultsRead","description":"The query echoed back with its ranked results (best first, already confined)."},"SessionActivityRead":{"properties":{"session_id":{"type":"string","format":"uuid","title":"Session Id"},"status":{"$ref":"#/components/schemas/SessionStatus"},"liveness":{"anyOf":[{"$ref":"#/components/schemas/SessionLiveness"},{"type":"null"}]},"current_step":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Current Step"},"last_activity_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Activity At"},"last_activity_age_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Last Activity Age Seconds"},"stalled":{"type":"boolean","title":"Stalled"},"stale":{"type":"boolean","title":"Stale"},"metrics":{"additionalProperties":true,"type":"object","title":"Metrics"}},"type":"object","required":["session_id","status","liveness","current_step","last_activity_at","last_activity_age_seconds","stalled","stale","metrics"],"title":"SessionActivityRead","description":"What a run is doing now and whether it is advancing — the derived observability view.\n\nBuilt rather than validated from a row, like ``SessionRead``: none of ``liveness``,\n``current_step`` or ``last_activity_age_seconds`` is a column; each is derived per request\nfrom the session's runtime-event cadence (``domain.observability.derive_activity``), so a\nmanager/orchestrator polling this endpoint reads the same active/stalled verdict the fleet\nview shows. Content-safe: ``current_step`` is the step *type* (``tool_call``, ``pytest``),\nnever transcript text, so it is returned under any privacy mode."},"SessionComplete":{"properties":{"metrics":{"additionalProperties":true,"type":"object","title":"Metrics"}},"type":"object","title":"SessionComplete"},"SessionCreate":{"properties":{"runtime_definition_id":{"type":"string","format":"uuid","title":"Runtime Definition Id"},"purpose":{"type":"string","maxLength":64,"minLength":1,"title":"Purpose","default":"implementation"},"machine_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Machine Id"},"agent_identity_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Agent Identity Id"},"external":{"type":"boolean","title":"External","default":false},"handoff_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Handoff Id"},"parent_session_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Parent Session Id"},"workspace":{"anyOf":[{"type":"string","maxLength":4096},{"type":"null"}],"title":"Workspace"},"provider_session_id":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Provider Session Id"}},"type":"object","required":["runtime_definition_id"],"title":"SessionCreate"},"SessionEventBatch":{"properties":{"events":{"items":{"$ref":"#/components/schemas/SessionEventRecord"},"type":"array","maxItems":500,"minItems":1,"title":"Events"}},"type":"object","required":["events"],"title":"SessionEventBatch","description":"``POST /sessions/{id}/events``: what a daemon or an orchestrator flushes at once."},"SessionEventRecord":{"properties":{"type":{"type":"string","maxLength":64,"minLength":1,"title":"Type"},"payload":{"additionalProperties":true,"type":"object","title":"Payload"},"source_seq":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Source Seq"},"occurred_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Occurred At"}},"type":"object","required":["type"],"title":"SessionEventRecord","description":"One normalized event a session reports. Serialised as ``type`` on the wire, which is\nwhat an adapter's ``NormalizedEvent`` calls it; ``event_type`` also works, so the\nservices can be called by name."},"SessionEventTail":{"properties":{"events":{"items":{"$ref":"#/components/schemas/EventRead"},"type":"array","title":"Events"},"cursor":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Cursor"},"session_status":{"$ref":"#/components/schemas/SessionStatus"},"terminal":{"type":"boolean","title":"Terminal"}},"type":"object","required":["events","cursor","session_status","terminal"],"title":"SessionEventTail","description":"One bounded page of a live session watch (``GET /sessions/{id}/events/tail``).\n\nThe read-forward counterpart to the newest-first feed: ``events`` are this session's\nevents after the request's ``after`` cursor, **oldest first**, so a watch prints them in\nthe order they happened. ``cursor`` is the sequence to send as ``after`` next time (the\nlast event's, or the request's own when the page is empty). ``session_status`` and\n``terminal`` are the session's state at read time, so a watch knows when to stop: once\n``terminal`` is true no more events will ever arrive, and the watch drains what is left\nand ends."},"SessionExhaust":{"properties":{"reason":{"type":"string","maxLength":4000,"minLength":1,"title":"Reason"}},"type":"object","required":["reason"],"title":"SessionExhaust","description":"``POST /sessions/{id}/exhaust``: the session ran out of its turn budget (DF-020).\n\n``reason`` is the runtime's account of the budget it hit — for Claude Code that is the\n``error_max_turns`` terminal reason. Shaped like ``SessionFail`` because the daemon always\nsupplies one; unlike ``SessionFail`` it does not block the work item."},"SessionFail":{"properties":{"reason":{"type":"string","maxLength":4000,"minLength":1,"title":"Reason"}},"type":"object","required":["reason"],"title":"SessionFail"},"SessionInstruction":{"properties":{"message":{"type":"string","maxLength":10000,"minLength":1,"title":"Message"}},"type":"object","required":["message"],"title":"SessionInstruction","description":"``POST /sessions/{id}/instruction``: something to tell a running agent."},"SessionLiveness":{"type":"string","enum":["active","stalled","stale"],"title":"SessionLiveness","description":"Whether a running session is advancing, derived from its runtime-event cadence (DF-025).\n\nA heartbeat proves the agent is *alive*, never that it is *advancing*; liveness is read off\nthe events the run emits, not off the heartbeat. Only meaningful for a running session — a\nterminal or pending one has no liveness (``None``)."},"SessionRead":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"organization_id":{"type":"string","format":"uuid","title":"Organization Id"},"work_id":{"type":"string","format":"uuid","title":"Work Id"},"runtime_definition_id":{"type":"string","format":"uuid","title":"Runtime Definition Id"},"recommended_runtime_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Recommended Runtime Id"},"recommendation_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Recommendation Reason"},"machine_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Machine Id"},"agent_identity_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Agent Identity Id"},"parent_session_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Parent Session Id"},"handoff_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Handoff Id"},"provider_session_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Provider Session Id"},"purpose":{"type":"string","title":"Purpose"},"status":{"$ref":"#/components/schemas/SessionStatus"},"work_state":{"$ref":"#/components/schemas/WorkState"},"workspace":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace"},"metrics":{"additionalProperties":true,"type":"object","title":"Metrics"},"failure_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Failure Reason"},"started_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Started At"},"ended_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ended At"},"last_heartbeat_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Heartbeat At"},"stale":{"type":"boolean","title":"Stale"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","organization_id","work_id","runtime_definition_id","recommended_runtime_id","recommendation_reason","machine_id","agent_identity_id","parent_session_id","handoff_id","provider_session_id","purpose","status","work_state","workspace","metrics","failure_reason","started_at","ended_at","last_heartbeat_at","stale","created_at","updated_at"],"title":"SessionRead","description":"One runtime session as every session route shows it, plus what the server infers.\n\nBuilt by ``build`` rather than validated from the row, because ``stale`` is not a\ncolumn: it is ``SessionService.is_stale`` applied at request time, the way a machine's\n``online`` is."},"SessionRegistered":{"properties":{"session":{"$ref":"#/components/schemas/SessionRead"},"token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Token"},"command_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Command Id"}},"type":"object","required":["session"],"title":"SessionRegistered","description":"The answer to registering a session.\n\n``token`` is the session's own API token and appears in this response and nowhere\nelse; it is null for a managed session, whose token travels to the daemon inside the\n``start_session`` command instead.\n\n``command_id`` is the ``start_session`` command that registration queued for the\nmachine's daemon, so a caller can say which command was queued and poll for its ack; it\nis null for an external session (already running, nothing queued) and for a managed\nsession with no machine (one the caller will ``start`` itself)."},"SessionStart":{"properties":{"provider_session_id":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Provider Session Id"}},"type":"object","title":"SessionStart","description":"``POST /sessions/{id}/start``: the daemon reports its runtime is up.\n\n``provider_session_id`` is optional because not every runtime announces one, and it is\nrecorded rather than trusted — see ``SessionService.start``."},"SessionStatus":{"type":"string","enum":["pending","starting","running","completed","failed","exhausted","cancelled"],"title":"SessionStatus"},"SessionWorkspaceRead":{"properties":{"session_id":{"type":"string","format":"uuid","title":"Session Id"},"files":{"items":{"$ref":"#/components/schemas/WorkspaceFileRead"},"type":"array","title":"Files"}},"type":"object","required":["session_id","files"],"title":"SessionWorkspaceRead","description":"What a session's daemon said it touched, by path.\n\nEchoed back after a report so a daemon can see what Kernel now holds — which is what\nmakes the retry visible as a no-op rather than as a second write."},"StorageBackend":{"type":"string","enum":["local","s3"],"title":"StorageBackend"},"TaskType":{"type":"string","enum":["implementation","bugfix","refactor","test","review","security_review","migration","research","documentation","other"],"title":"TaskType"},"TokenCreate":{"properties":{"name":{"type":"string","maxLength":200,"minLength":1,"title":"Name"},"scopes":{"items":{"type":"string"},"type":"array","maxItems":24,"minItems":1,"title":"Scopes"},"project_ids":{"items":{"type":"string","format":"uuid"},"type":"array","maxItems":100,"title":"Project Ids"},"expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Expires At"},"for_user":{"type":"boolean","title":"For User","default":true}},"type":"object","required":["name","scopes"],"title":"TokenCreate","description":"``POST /organizations/{id}/tokens``.\n\n``project_ids`` narrows the token to those projects (empty: every project of the\norganization). ``for_user`` false asks for an org-wide service token instead of a\npersonal one."},"UserRead":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"email":{"type":"string","title":"Email"},"display_name":{"type":"string","title":"Display Name"},"is_active":{"type":"boolean","title":"Is Active"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","email","display_name","is_active","created_at"],"title":"UserRead"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"WebSessionRead":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"created_at":{"type":"string","title":"Created At"},"last_seen_at":{"type":"string","title":"Last Seen At"},"expires_at":{"type":"string","title":"Expires At"},"user_agent":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Agent"},"ip":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ip"},"current":{"type":"boolean","title":"Current","default":false}},"type":"object","required":["id","created_at","last_seen_at","expires_at","user_agent","ip"],"title":"WebSessionRead"},"WebhookCreate":{"properties":{"url":{"type":"string","maxLength":2000,"minLength":1,"title":"Url"},"event_types":{"items":{"type":"string"},"type":"array","maxItems":100,"minItems":1,"title":"Event Types"},"description":{"type":"string","maxLength":500,"title":"Description","default":""},"enabled":{"type":"boolean","title":"Enabled","default":true}},"type":"object","required":["url","event_types"],"title":"WebhookCreate","description":"``POST /organizations/{id}/webhooks``: a target and the events it wants."},"WebhookCreated":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"organization_id":{"type":"string","format":"uuid","title":"Organization Id"},"url":{"type":"string","title":"Url"},"event_types":{"items":{"type":"string"},"type":"array","title":"Event Types"},"enabled":{"type":"boolean","title":"Enabled"},"description":{"type":"string","title":"Description"},"consecutive_failures":{"type":"integer","title":"Consecutive Failures"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"},"secret":{"type":"string","title":"Secret"}},"type":"object","required":["id","organization_id","url","event_types","enabled","description","consecutive_failures","created_at","updated_at","secret"],"title":"WebhookCreated","description":"The create response: the only time the signing secret is shown."},"WebhookDeliveryQueued":{"properties":{"job_id":{"type":"string","format":"uuid","title":"Job Id"},"webhook_id":{"type":"string","format":"uuid","title":"Webhook Id"},"event_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Event Id"},"status":{"type":"string","title":"Status","default":"queued"}},"type":"object","required":["job_id","webhook_id","event_id"],"title":"WebhookDeliveryQueued","description":"The answer to a test or a replay: the delivery has been queued for the worker."},"WebhookDeliveryRead":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"webhook_id":{"type":"string","format":"uuid","title":"Webhook Id"},"event_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Event Id"},"attempt":{"type":"integer","title":"Attempt"},"status":{"type":"string","title":"Status"},"response_status":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Response Status"},"response_body_excerpt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Response Body Excerpt"},"duration_ms":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Duration Ms"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"delivered_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Delivered At"},"next_attempt_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Attempt At"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","webhook_id","event_id","attempt","status","response_status","response_body_excerpt","duration_ms","error","delivered_at","next_attempt_at","created_at"],"title":"WebhookDeliveryRead","description":"One delivery attempt: its status, timing, the response code and the body it kept."},"WebhookRead":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"organization_id":{"type":"string","format":"uuid","title":"Organization Id"},"url":{"type":"string","title":"Url"},"event_types":{"items":{"type":"string"},"type":"array","title":"Event Types"},"enabled":{"type":"boolean","title":"Enabled"},"description":{"type":"string","title":"Description"},"consecutive_failures":{"type":"integer","title":"Consecutive Failures"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","organization_id","url","event_types","enabled","description","consecutive_failures","created_at","updated_at"],"title":"WebhookRead","description":"A webhook as every route but ``create`` shows it: the secret is never here."},"WebhookUpdate":{"properties":{"url":{"anyOf":[{"type":"string","maxLength":2000,"minLength":1},{"type":"null"}],"title":"Url"},"event_types":{"anyOf":[{"items":{"type":"string"},"type":"array","maxItems":100,"minItems":1},{"type":"null"}],"title":"Event Types"},"description":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Description"},"enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Enabled"}},"type":"object","title":"WebhookUpdate","description":"``PATCH /webhooks/{id}``: only the fields sent are changed; none may be null."},"WorkAnalyticsRead":{"properties":{"from_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"From Date"},"to_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"To Date"},"min_sample":{"type":"integer","title":"Min Sample"},"work":{"items":{"$ref":"#/components/schemas/WorkMetricSliceRead"},"type":"array","title":"Work"}},"type":"object","required":["min_sample","work"],"title":"WorkAnalyticsRead","description":"Work analytics: the resolved range, the sample threshold, and one row per bucket."},"WorkCommand":{"type":"string","enum":["make_ready","send_back","start","request_human","human_decided","block","unblock","submit_review","rework","complete","cancel","reopen","session_failed"],"title":"WorkCommand"},"WorkContextV1":{"properties":{"kernel_context_version":{"type":"integer","title":"Kernel Context Version","default":1},"work":{"$ref":"#/components/schemas/WorkRef"},"constraints":{"items":{"type":"string"},"type":"array","title":"Constraints"},"acceptance_criteria":{"items":{"type":"string"},"type":"array","title":"Acceptance Criteria"},"decisions":{"items":{"$ref":"#/components/schemas/DecisionEntry"},"type":"array","title":"Decisions"},"artifacts":{"items":{"$ref":"#/components/schemas/ArtifactEntry"},"type":"array","title":"Artifacts"},"blockers":{"items":{"$ref":"#/components/schemas/BlockerEntry"},"type":"array","title":"Blockers"},"approvals":{"items":{"$ref":"#/components/schemas/ApprovalEntry"},"type":"array","title":"Approvals"},"recent_handoffs":{"items":{"$ref":"#/components/schemas/HandoffEntry"},"type":"array","title":"Recent Handoffs"},"truncated":{"$ref":"#/components/schemas/ContextTruncation"}},"additionalProperties":false,"type":"object","required":["work"],"title":"WorkContextV1","description":"The bounded context of one work item: what it is, what was decided, what exists, what\nis open, and what is being waited on -- everything an agent needs to pick the work up,\nand nothing of the transcript."},"WorkCreate":{"properties":{"title":{"type":"string","maxLength":300,"minLength":1,"title":"Title"},"goal":{"type":"string","title":"Goal","default":""},"priority":{"$ref":"#/components/schemas/Priority","default":"normal"},"task_type":{"$ref":"#/components/schemas/TaskType","default":"other"},"constraints":{"items":{"type":"string"},"type":"array","title":"Constraints"},"acceptance_criteria":{"items":{"type":"string"},"type":"array","title":"Acceptance Criteria"},"labels":{"items":{"type":"string"},"type":"array","title":"Labels"},"custom_fields":{"additionalProperties":true,"type":"object","title":"Custom Fields"},"owner_user_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Owner User Id"},"parent_work_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Parent Work Id"},"template_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Template Id"}},"type":"object","required":["title"],"title":"WorkCreate"},"WorkDetailRead":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"organization_id":{"type":"string","format":"uuid","title":"Organization Id"},"project_id":{"type":"string","format":"uuid","title":"Project Id"},"key":{"type":"string","title":"Key"},"title":{"type":"string","title":"Title"},"state":{"$ref":"#/components/schemas/WorkState"},"priority":{"$ref":"#/components/schemas/Priority"},"task_type":{"$ref":"#/components/schemas/TaskType"},"labels":{"items":{"type":"string"},"type":"array","title":"Labels"},"owner_user_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Owner User Id"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"},"completed_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Completed At"},"goal":{"type":"string","title":"Goal"},"constraints":{"items":{"type":"string"},"type":"array","title":"Constraints"},"acceptance_criteria":{"items":{"type":"string"},"type":"array","title":"Acceptance Criteria"},"custom_fields":{"additionalProperties":true,"type":"object","title":"Custom Fields"},"parent_work_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Parent Work Id"},"scheduling_mode":{"$ref":"#/components/schemas/SchedulingMode"},"selected_runtime_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Selected Runtime Id"},"created_by_kind":{"$ref":"#/components/schemas/ActorKind"},"created_by_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Created By Id"},"archived_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Archived At"},"allowed_commands":{"items":{"$ref":"#/components/schemas/WorkCommand"},"type":"array","title":"Allowed Commands"},"summary":{"$ref":"#/components/schemas/WorkSummaryRead"}},"type":"object","required":["id","organization_id","project_id","key","title","state","priority","task_type","labels","owner_user_id","created_at","updated_at","completed_at","goal","constraints","acceptance_criteria","custom_fields","parent_work_id","scheduling_mode","selected_runtime_id","created_by_kind","created_by_id","archived_at","allowed_commands","summary"],"title":"WorkDetailRead","description":"One work item in full, with the commands the API accepts right now and its counters.\n\nBuilt by ``build`` because the last two fields are not columns: lists never compute\nthem (one query per row), detail routes always do."},"WorkExportDependency":{"properties":{"source_export_id":{"type":"string","title":"Source Export Id"},"target_export_id":{"type":"string","title":"Target Export Id"},"relation":{"$ref":"#/components/schemas/DependencyType"}},"type":"object","required":["source_export_id","target_export_id","relation"],"title":"WorkExportDependency","description":"One directed dependency between two export ids, in its stored form."},"WorkExportDocument":{"properties":{"kernel_work_export_version":{"type":"integer","title":"Kernel Work Export Version","default":1},"work":{"items":{"$ref":"#/components/schemas/WorkExportItem"},"type":"array","title":"Work"},"dependencies":{"items":{"$ref":"#/components/schemas/WorkExportDependency"},"type":"array","title":"Dependencies"}},"type":"object","title":"WorkExportDocument","description":"The portable document ``export_project`` produces and ``import_into_project`` reads."},"WorkExportItem":{"properties":{"export_id":{"type":"string","title":"Export Id"},"key":{"type":"string","title":"Key"},"title":{"type":"string","maxLength":300,"minLength":1,"title":"Title"},"goal":{"type":"string","title":"Goal","default":""},"priority":{"$ref":"#/components/schemas/Priority","default":"normal"},"task_type":{"$ref":"#/components/schemas/TaskType","default":"other"},"state":{"$ref":"#/components/schemas/WorkState","default":"backlog"},"constraints":{"items":{"type":"string"},"type":"array","title":"Constraints"},"acceptance_criteria":{"items":{"type":"string"},"type":"array","title":"Acceptance Criteria"},"labels":{"items":{"type":"string"},"type":"array","title":"Labels"},"custom_fields":{"additionalProperties":true,"type":"object","title":"Custom Fields"},"parent_export_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Parent Export Id"}},"type":"object","required":["export_id","key","title"],"title":"WorkExportItem","description":"One work item in an export document, addressed by its export id."},"WorkImportResult":{"properties":{"project_id":{"type":"string","format":"uuid","title":"Project Id"},"project_key":{"type":"string","title":"Project Key"},"work":{"items":{"$ref":"#/components/schemas/ImportedWork"},"type":"array","title":"Work"},"dependency_count":{"type":"integer","title":"Dependency Count"}},"type":"object","required":["project_id","project_key","work","dependency_count"],"title":"WorkImportResult","description":"The outcome of an import: the id remap and how much was created."},"WorkMetricSliceRead":{"properties":{"task_type":{"$ref":"#/components/schemas/TaskType"},"project_id":{"type":"string","format":"uuid","title":"Project Id"},"completed_count":{"type":"integer","title":"Completed Count"},"success_count":{"type":"integer","title":"Success Count"},"partial_count":{"type":"integer","title":"Partial Count"},"failure_count":{"type":"integer","title":"Failure Count"},"cancelled_count":{"type":"integer","title":"Cancelled Count"},"session_count":{"type":"integer","title":"Session Count"},"outcome_sample":{"type":"integer","title":"Outcome Sample"},"success_rate":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Success Rate"},"sample_too_small":{"type":"boolean","title":"Sample Too Small"},"duration_p50_typical_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Duration P50 Typical Seconds"}},"type":"object","required":["task_type","project_id","completed_count","success_count","partial_count","failure_count","cancelled_count","session_count","outcome_sample","success_rate","sample_too_small","duration_p50_typical_seconds"],"title":"WorkMetricSliceRead","description":"One task-type + project row of the work analytics, summed over the range.\n\n``success_rate`` is ``success_count / outcome_sample`` where the outcome sample is\n``success + partial + failure`` (equals ``completed_count``); cancelled work is not in\nthe denominator. It is ``null`` when ``sample_too_small``. ``duration_p50_typical_seconds``\nis the median of the non-null daily medians (see ``RuntimeMetricSliceRead``)."},"WorkRead":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"organization_id":{"type":"string","format":"uuid","title":"Organization Id"},"project_id":{"type":"string","format":"uuid","title":"Project Id"},"key":{"type":"string","title":"Key"},"title":{"type":"string","title":"Title"},"state":{"$ref":"#/components/schemas/WorkState"},"priority":{"$ref":"#/components/schemas/Priority"},"task_type":{"$ref":"#/components/schemas/TaskType"},"labels":{"items":{"type":"string"},"type":"array","title":"Labels"},"owner_user_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Owner User Id"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"},"completed_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Completed At"}},"type":"object","required":["id","organization_id","project_id","key","title","state","priority","task_type","labels","owner_user_id","created_at","updated_at","completed_at"],"title":"WorkRead","description":"A list row: what a board card or a table line shows."},"WorkRef":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"key":{"type":"string","title":"Key"},"title":{"type":"string","title":"Title"},"goal":{"type":"string","title":"Goal"},"task_type":{"$ref":"#/components/schemas/TaskType"},"priority":{"$ref":"#/components/schemas/Priority"},"state":{"$ref":"#/components/schemas/WorkState"}},"additionalProperties":false,"type":"object","required":["id","key","title","goal","task_type","priority","state"],"title":"WorkRef","description":"Which work item this is, in the terms the destination runtime needs to name it."},"WorkState":{"type":"string","enum":["backlog","ready","running","waiting_human","blocked","review","completed","cancelled"],"title":"WorkState"},"WorkSummaryRead":{"properties":{"open_blockers":{"type":"integer","title":"Open Blockers"},"open_blocking_blockers":{"type":"integer","title":"Open Blocking Blockers"},"pending_approvals":{"type":"integer","title":"Pending Approvals"},"active_session_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Active Session Id"},"session_count":{"type":"integer","title":"Session Count"},"artifact_count":{"type":"integer","title":"Artifact Count"},"decision_count":{"type":"integer","title":"Decision Count"},"latest_outcome_status":{"anyOf":[{"$ref":"#/components/schemas/OutcomeStatus"},{"type":"null"}]}},"type":"object","required":["open_blockers","open_blocking_blockers","pending_approvals","active_session_id","session_count","artifact_count","decision_count","latest_outcome_status"],"title":"WorkSummaryRead","description":"``WorkService.summary`` as the detail page shows it."},"WorkTemplateCreate":{"properties":{"name":{"type":"string","maxLength":120,"minLength":1,"title":"Name"},"goal":{"type":"string","title":"Goal","default":""},"task_type":{"$ref":"#/components/schemas/TaskType","default":"other"},"constraints":{"items":{"type":"string"},"type":"array","title":"Constraints"},"acceptance_criteria":{"items":{"type":"string"},"type":"array","title":"Acceptance Criteria"},"labels":{"items":{"type":"string"},"type":"array","title":"Labels"}},"type":"object","required":["name"],"title":"WorkTemplateCreate"},"WorkTemplateRead":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"organization_id":{"type":"string","format":"uuid","title":"Organization Id"},"project_id":{"type":"string","format":"uuid","title":"Project Id"},"name":{"type":"string","title":"Name"},"goal":{"type":"string","title":"Goal"},"task_type":{"$ref":"#/components/schemas/TaskType"},"constraints":{"items":{"type":"string"},"type":"array","title":"Constraints"},"acceptance_criteria":{"items":{"type":"string"},"type":"array","title":"Acceptance Criteria"},"labels":{"items":{"type":"string"},"type":"array","title":"Labels"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","organization_id","project_id","name","goal","task_type","constraints","acceptance_criteria","labels","created_at","updated_at"],"title":"WorkTemplateRead","description":"One work template: the defaults a new work item starts from."},"WorkTemplateUpdate":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":120,"minLength":1},{"type":"null"}],"title":"Name"},"goal":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Goal"},"task_type":{"anyOf":[{"$ref":"#/components/schemas/TaskType"},{"type":"null"}]},"constraints":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Constraints"},"acceptance_criteria":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Acceptance Criteria"},"labels":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Labels"}},"type":"object","title":"WorkTemplateUpdate","description":"Every field is optional: a field left unset is unchanged; none may be null."},"WorkTransitionIn":{"properties":{"command":{"$ref":"#/components/schemas/WorkCommand"},"reason":{"anyOf":[{"type":"string","maxLength":4000,"minLength":1},{"type":"null"}],"title":"Reason"}},"type":"object","required":["command"],"title":"WorkTransitionIn","description":"``POST /work/{id}/transition``: a command and why (``session_id`` is not a client's)."},"WorkUpdate":{"properties":{"title":{"anyOf":[{"type":"string","maxLength":300,"minLength":1},{"type":"null"}],"title":"Title"},"goal":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Goal"},"priority":{"anyOf":[{"$ref":"#/components/schemas/Priority"},{"type":"null"}]},"task_type":{"anyOf":[{"$ref":"#/components/schemas/TaskType"},{"type":"null"}]},"constraints":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Constraints"},"acceptance_criteria":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Acceptance Criteria"},"labels":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Labels"},"custom_fields":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Custom Fields"},"owner_user_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Owner User Id"},"parent_work_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Parent Work Id"}},"type":"object","title":"WorkUpdate","description":"Every field is optional: a field left unset is unchanged.\n\nAn explicit ``None`` clears ``owner_user_id`` or ``parent_work_id`` and is rejected\nwith ``ValidationFailed`` for every other field, which cannot be null."},"WorkspaceFileRead":{"properties":{"path":{"type":"string","title":"Path"},"insertions":{"type":"integer","title":"Insertions"},"deletions":{"type":"integer","title":"Deletions"}},"type":"object","required":["path","insertions","deletions"],"title":"WorkspaceFileRead","description":"One reported file: its path inside the workspace, and how much of it changed.\n\nThe same three values the report carries, because they are the only three that exist —\nthe row has no column a content field could be read out of."},"WorkspaceFileReport":{"properties":{"path":{"type":"string","maxLength":1024,"minLength":1,"title":"Path"},"insertions":{"type":"integer","maximum":1000000.0,"minimum":0.0,"title":"Insertions"},"deletions":{"type":"integer","maximum":1000000.0,"minimum":0.0,"title":"Deletions"}},"additionalProperties":false,"type":"object","required":["path","insertions","deletions"],"title":"WorkspaceFileReport","description":"One file a session touched: where it is, and how much of it changed.\n\n**The field set is the privacy rule.** A daemon runs under ``sync_mode:\nmetadata_only`` by default, and a path with two line counts is metadata while a diff\nhunk is not — so this model is what makes the second impossible rather than merely\nunusual. ``extra=\"forbid\"``, and not by taste: a schema that silently drops what it\ndoes not understand is one a future client can be built against, and that client would\nbelieve Kernel was storing what it sent."},"WorkspaceReport":{"properties":{"files":{"items":{"$ref":"#/components/schemas/WorkspaceFileReport"},"type":"array","maxItems":500,"title":"Files"}},"additionalProperties":false,"type":"object","title":"WorkspaceReport","description":"``POST /sessions/{id}/workspace``: every file the session touched, and nothing else.\n\nAn empty list is a report, not a missing one: it says the session changed nothing, and\nit clears whatever an earlier report of the same session left."}}}}