{
  "openapi": "3.1.0",
  "info": {
    "title": "Dee API",
    "description": "",
    "license": {
      "name": ""
    },
    "version": "0.1.0"
  },
  "paths": {
    "/agent/login/approve": {
      "post": {
        "tags": [
          "agent::login"
        ],
        "operationId": "approve_agent_login",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentLoginApproveRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "description": "The browser decision was recorded."
          }
        }
      }
    },
    "/agent/login/poll": {
      "post": {
        "tags": [
          "agent::login"
        ],
        "operationId": "poll_agent_login",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentLoginPollRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentLoginPollResponse"
                }
              }
            }
          }
        }
      }
    },
    "/agent/login/start": {
      "post": {
        "tags": [
          "agent::login"
        ],
        "operationId": "start_agent_login",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentLoginStartRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentLoginStartResponse"
                }
              }
            }
          }
        }
      }
    },
    "/agent/logout": {
      "post": {
        "tags": [
          "identity"
        ],
        "operationId": "logout_agent_connection",
        "responses": {
          "204": {
            "description": "The connection credential was revoked."
          }
        }
      }
    },
    "/api/access/operations/{operation_id}": {
      "get": {
        "tags": [
          "access"
        ],
        "operationId": "get_access_operation",
        "parameters": [
          {
            "name": "operation_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Only this actor's original committed fact, independent of current document access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccessReceipt"
                }
              }
            }
          },
          "400": {
            "description": "Invalid 22-character Base62 ID",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "No result for this actor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Read unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/account/login-identities": {
      "get": {
        "tags": [
          "identity"
        ],
        "operationId": "login_identities",
        "parameters": [
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "All sign-in methods belonging to this browser account; provider subjects are never exposed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LoginIdentitiesResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or expected account header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "A browser session is required; Agent credentials are not accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Identity storage unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/account/login-identities/google": {
      "post": {
        "tags": [
          "identity"
        ],
        "operationId": "link_google",
        "parameters": [
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GoogleLoginRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Start explicit Google linking, bound to this browser session and account. Callback preserves the session and returns to the validated target.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GoogleLoginResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or return target",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "A browser session is required; Agent credentials are not accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "Invalid application origin",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "The initiating session changed AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Identity storage or provider unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/account/login-identities/{id}": {
      "delete": {
        "tags": [
          "identity"
        ],
        "operationId": "unlink_login_identity",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Sign-in method owned by the current account",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Sign-in method removed. Existing browser and Agent sessions remain active."
          },
          "400": {
            "description": "Invalid request or expected account header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "A browser session is required; Agent credentials are not accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "Invalid application origin",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Sign-in method is unavailable to this account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "The last sign-in method cannot be removed, or the session changed AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Identity storage unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/accounts/resolve": {
      "post": {
        "tags": [
          "identity"
        ],
        "operationId": "resolve_account",
        "parameters": [
          {
            "name": "Origin",
            "in": "header",
            "description": "Required and equal to APP_ORIGIN when using a Cookie session",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "Cookie",
            "in": "header",
            "description": "Current Dee browser session, or use an approved Agent Bearer credential",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResolveAccountRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "One active, verified account already registered in Dee v0.1",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResolvedAccountResponse"
                }
              }
            }
          },
          "400": {
            "description": "A complete email address is required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current identity is required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "Invalid origin",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "No available registered v0.1 account matches",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "No unique account can be confirmed AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Identity lookup unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        },
        "x-dee-read-only": true
      }
    },
    "/api/agent-documents": {
      "post": {
        "tags": [
          "agent_documents"
        ],
        "operationId": "create_agent_document",
        "parameters": [
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAgentDocumentRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Agent main document and configuration committed at the explicit location; Pages are created as needed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentDocumentReceipt"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input or parent location",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "Space administrator required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Origin or parent unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "Original operation input conflict AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Result unconfirmed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/agent-documents/operations/{operation_id}": {
      "get": {
        "tags": [
          "agent_documents"
        ],
        "operationId": "get_agent_document_operation",
        "parameters": [
          {
            "name": "operation_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Only this actor's original minimal initialization or related-document receipt",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentDocumentOperationReceipt"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or expected account header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "No result for this actor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Read unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/agent-documents/{id}": {
      "get": {
        "tags": [
          "agent_documents"
        ],
        "operationId": "get_agent_document",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current readable Agent document associations and management qualification",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentDocumentDetail"
                }
              }
            }
          },
          "400": {
            "description": "Invalid identity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Agent document unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "Agent document in trash",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Read unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/agent-documents/{id}/documents": {
      "post": {
        "tags": [
          "agent_documents"
        ],
        "operationId": "create_agent_related_document",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateRelatedDocumentRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "New ordinary document and association committed together; purpose also fills the empty Configuration binding group atomically, retaining initial document markers",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RelatedDocumentReceipt"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input or missing expected_revision with purpose",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "Management qualification required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Agent document unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "Original operation input conflict, configuration revision conflict, or built-in already bound AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "Agent document in trash",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Result unconfirmed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/agent/connections": {
      "get": {
        "tags": [
          "agent::connections"
        ],
        "operationId": "agent_connections",
        "parameters": [
          {
            "name": "page_index",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "order_by",
            "in": "query",
            "description": "Comma-separated id, authorized_at or last_used_at with .asc/.desc; default authorized_at.desc,id.asc",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current account's safe Agent connection metadata; browser session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentConnectionsResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid page or ordering",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current browser session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Identity storage unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "agent::connections"
        ],
        "operationId": "revoke_agent_connections",
        "parameters": [
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RevokeConnectionsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "description": "Reviewed Agent generation revoked, including legacy clients. Retries preserve newer grants and browser sessions."
          },
          "400": {
            "description": "Invalid generation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current browser session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "Connection generation unavailable; reload the list AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Revocation was not confirmed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/agent/connections/{id}": {
      "delete": {
        "tags": [
          "agent::connections"
        ],
        "operationId": "revoke_agent_connection",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Owned client revoked; already-revoked owned connections are idempotent"
          },
          "400": {
            "description": "Invalid request or expected account header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current browser session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Client unavailable to this account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Revocation was not confirmed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/agents/me": {
      "get": {
        "tags": [
          "agents"
        ],
        "operationId": "get_agent_me",
        "parameters": [
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "X-Dee-Expected-Agent-Id",
            "in": "header",
            "description": "Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentMe"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or expected account header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/agents/me/changes": {
      "get": {
        "tags": [
          "changes"
        ],
        "operationId": "get_agent_changes",
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "max_events",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          },
          {
            "name": "wait_ms",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "include_activities",
            "in": "query",
            "description": "Include typed activities using a separately bound cursor; default false",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "X-Dee-Expected-Agent-Id",
            "in": "header",
            "description": "Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChangeFeed"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or expected account header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/agents/me/disclosure-check": {
      "post": {
        "tags": [
          "agent_collaboration"
        ],
        "operationId": "check_agent_disclosure",
        "parameters": [
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "X-Dee-Expected-Agent-Id",
            "in": "header",
            "description": "Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DisclosureCheckRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Current reader-set relation, not output or write approval",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DisclosureCheckResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or expected account header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/agents/me/documents": {
      "get": {
        "tags": [
          "agents"
        ],
        "operationId": "list_agent_documents",
        "parameters": [
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "X-Dee-Expected-Agent-Id",
            "in": "header",
            "description": "Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Paged_DocumentSummary"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or expected account header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/agents/operations/{operation_id}": {
      "get": {
        "tags": [
          "agent_collaboration"
        ],
        "operationId": "get_agent_protocol_operation",
        "parameters": [
          {
            "name": "operation_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "X-Dee-Expected-Agent-Id",
            "in": "header",
            "description": "Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Original actor's minimal receipt",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolOperationResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or expected account header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/agents/{agent_id}": {
      "get": {
        "tags": [
          "agents"
        ],
        "operationId": "get_agent_configuration",
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "X-Dee-Expected-Agent-Id",
            "in": "header",
            "description": "Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Configuration"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or expected account header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "agents"
        ],
        "operationId": "save_agent_configuration",
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentConfigurationRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentConfigurationReceipt"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or expected account header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/agents/{agent_id}/connections": {
      "get": {
        "tags": [
          "agents"
        ],
        "operationId": "list_agent_service_connections",
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Paged_ServiceConnection"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or expected account header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/agents/{agent_id}/connections/{connection_id}": {
      "delete": {
        "tags": [
          "agents"
        ],
        "operationId": "revoke_agent_service_connection",
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "connection_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": ""
          },
          "400": {
            "description": "Invalid request or expected account header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/attention/following": {
      "get": {
        "tags": [
          "attention"
        ],
        "operationId": "list_followed_threads",
        "parameters": [
          {
            "name": "page_index",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "description": "Default 50, maximum 100; zero returns authorized counts",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "order_by",
            "in": "query",
            "description": "updated_at,id; default updated_at.desc,id.asc",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Currently readable followed Threads; no read or follow mutation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Paged_StateResponse"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/attention/notifications": {
      "get": {
        "tags": [
          "attention"
        ],
        "operationId": "list_notifications",
        "parameters": [
          {
            "name": "unread",
            "in": "query",
            "description": "Active unread filters exclude deleted sources",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "page_index",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "description": "Default 50, maximum 100; zero returns authorized counts",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "order_by",
            "in": "query",
            "description": "updated_at,created_at,id; default updated_at.desc,id.asc",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Receiver-only notifications under current document access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Paged_NotificationResponse"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/attention/notifications/{id}": {
      "get": {
        "tags": [
          "attention"
        ],
        "operationId": "get_notification",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current receiver-owned source metadata or deletion placeholder",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationResponse"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "Document is in the trash under current access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/attention/notifications/{id}/read": {
      "put": {
        "tags": [
          "attention"
        ],
        "operationId": "read_notification",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NotificationReadRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Explicit notification acknowledgement under its observed revision",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AttentionReceipt"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "Document is in the trash under current access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/attention/operations/{id}": {
      "get": {
        "tags": [
          "attention"
        ],
        "operationId": "get_attention_operation",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Actor-only original minimal result; no current content access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AttentionReceipt"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/attention/summary": {
      "get": {
        "tags": [
          "attention"
        ],
        "operationId": "attention_summary",
        "parameters": [
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Receiver-only counts after current access filtering",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SummaryResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or expected account header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/auth/config": {
      "get": {
        "tags": [
          "identity"
        ],
        "operationId": "login_config",
        "parameters": [
          {
            "name": "return_to",
            "in": "query",
            "description": "Same-origin relative return target",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Configured sign-in providers, default provider and validated navigation target; enabled is true when any provider is available. Grants no document access.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LoginConfigResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid return target",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/auth/google": {
      "post": {
        "tags": [
          "identity"
        ],
        "operationId": "google_login",
        "parameters": [
          {
            "name": "Origin",
            "in": "header",
            "description": "Must equal APP_ORIGIN",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GoogleLoginRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Start one browser-bound Google login. Navigate the browser to authorization_url.",
            "headers": {
              "Set-Cookie": {
                "schema": {
                  "type": "string"
                },
                "description": "Short-lived host-only dee_google_login, HttpOnly, SameSite=Lax; Secure under HTTPS"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GoogleLoginResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON or navigation target",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "Origin is not the configured application",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "422": {
            "description": "JSON fields do not match the login request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Identity storage or Google configuration is unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/auth/google/callback": {
      "get": {
        "tags": [
          "identity"
        ],
        "operationId": "google_callback",
        "parameters": [
          {
            "name": "code",
            "in": "query",
            "description": "Single-use Google authorization code",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "state",
            "in": "query",
            "description": "State from the browser-bound login",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "error",
            "in": "query",
            "description": "Google authorization failure",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "303": {
            "description": "Sign-in establishes a Dee HttpOnly session and returns to the validated application path. Explicit linking requires the initiating browser session, preserves its cookie, and returns with login_identity=linked or login_identity_error=conflict|session_changed|google_link_failed. Failed sign-in returns to /sign-in with a fixed error code. Only matched browser binding retains the original target; unmatched callbacks use /app.",
            "headers": {
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "APP_ORIGIN plus a validated return target, or /sign-in?error=google_login_failed"
              },
              "Set-Cookie": {
                "schema": {
                  "type": "string"
                },
                "description": "New Dee session only for sign-in; linking preserves it. Always clears the one-time Google login cookie."
              }
            }
          }
        }
      }
    },
    "/api/communication/operations/{operation_id}": {
      "get": {
        "tags": [
          "communication"
        ],
        "operationId": "get_communication_operation",
        "parameters": [
          {
            "name": "operation_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "X-Dee-Expected-Agent-Id",
            "in": "header",
            "description": "Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Actor-only minimal original receipt; no current content or access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Receipt"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or expected account header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "No result for this actor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Read unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents": {
      "get": {
        "tags": [
          "documents"
        ],
        "operationId": "list_documents",
        "parameters": [
          {
            "name": "scope",
            "in": "query",
            "description": "mine (default), collaborating, space, accessible",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "space_id",
            "in": "query",
            "description": "Required only with space scope",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "title",
            "in": "query",
            "description": "Literal case-insensitive title substring",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "view",
            "in": "query",
            "description": "updated (default), viewed or favorites; intersects scope",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "extension",
            "in": "query",
            "description": "Exact explicit stored type, including unknown types. Nonempty lowercase identifier; omitted preserves all types, md differs from null.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page_index",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "description": "0 to 100; default 50",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "order_by",
            "in": "query",
            "description": "Comma-separated updated_at,created_at,title,readers_30d,last_viewed_at,favorited_at,pinned_at,id with asc/desc; mine/space updated views default to pinned_at.desc,updated_at.desc,id.asc; other defaults use the view timestamp descending,id.asc",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current authorized summaries and counts from one snapshot",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Paged_DocumentSummary"
                }
              }
            }
          },
          "400": {
            "description": "Invalid filter or pagination",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Space unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Read unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "documents"
        ],
        "operationId": "create_document",
        "parameters": [
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "X-Dee-Expected-Agent-Id",
            "in": "header",
            "description": "Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateDocumentRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Committed creation and first immutable snapshot",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentReceipt"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "Invalid Origin",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Origin unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "Operation conflict AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Result unconfirmed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/changes": {
      "get": {
        "tags": [
          "changes"
        ],
        "operationId": "personal_document_changes",
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "max_events",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          },
          {
            "name": "wait_ms",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "include_activities",
            "in": "query",
            "description": "Include typed activities using a separately bound cursor; default false",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "This account's personal document and tree changes",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChangeFeed"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "Explicit resync required AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Discovery unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/lifecycle/operations/{operation_id}": {
      "get": {
        "tags": [
          "lifecycle"
        ],
        "operationId": "get_document_lifecycle_operation",
        "parameters": [
          {
            "name": "operation_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Only the actor's original lifecycle result, no current permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LifecycleReceipt"
                }
              }
            }
          },
          "400": {
            "description": "Invalid 22-character Base62 ID",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "No lifecycle result for this actor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Read unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/operations/{operation_id}": {
      "get": {
        "tags": [
          "documents"
        ],
        "operationId": "get_document_operation",
        "parameters": [
          {
            "name": "operation_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "X-Dee-Expected-Agent-Id",
            "in": "header",
            "description": "Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Only the actor's original result, without private content or current access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentReceipt"
                }
              }
            }
          },
          "400": {
            "description": "Invalid 22-character Base62 ID",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "No result for this actor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Read unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/page-operations/{operation_id}": {
      "get": {
        "tags": [
          "pages"
        ],
        "operationId": "get_page_operation",
        "parameters": [
          {
            "name": "operation_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PageReceipt"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or expected account header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/pin-operations/{operation_id}": {
      "get": {
        "tags": [
          "document_pins"
        ],
        "operationId": "get_document_pin_operation",
        "parameters": [
          {
            "name": "operation_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "This actor's minimal original pin result; grants no current document access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PinReceipt"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/trash": {
      "get": {
        "tags": [
          "lifecycle"
        ],
        "operationId": "list_document_trash",
        "parameters": [
          {
            "name": "scope",
            "in": "query",
            "description": "all (default), mine, collaborating, space",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "space_id",
            "in": "query",
            "description": "Only space scope; current membership required",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "title",
            "in": "query",
            "description": "Literal case-insensitive title substring",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page_index",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "description": "0 to 100; default 50",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "order_by",
            "in": "query",
            "description": "Comma-separated trashed_at,updated_at,title,id asc/desc; default trashed_at.desc,id.asc",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current administrator metadata and filtered counts, without contents or tokens",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Paged_TrashSummary"
                }
              }
            }
          },
          "400": {
            "description": "Invalid filter or pagination",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Space unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Read unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/tree": {
      "get": {
        "tags": [
          "document_tree"
        ],
        "operationId": "get_personal_document_tree",
        "parameters": [
          {
            "name": "page_index",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "description": "0 to 100; default 50",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "order_by",
            "in": "query",
            "description": "position,title,id; default position.asc,id.asc",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "This account's active document nodes and structure version",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PersonalDocumentTree"
                }
              }
            }
          },
          "400": {
            "description": "Invalid pagination",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current identity required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Read unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/tree-operations/{operation_id}": {
      "get": {
        "tags": [
          "document_tree"
        ],
        "operationId": "get_document_tree_operation",
        "parameters": [
          {
            "name": "operation_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Only this actor's original minimal placement receipt",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TreeMoveReceipt"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or expected account header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current identity required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "No result for this actor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Read unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{document_id}/agent-plans": {
      "post": {
        "tags": [
          "agent_collaboration"
        ],
        "operationId": "submit_agent_plan",
        "parameters": [
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "X-Dee-Expected-Agent-Id",
            "in": "header",
            "description": "Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlanRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Immutable plan and protected discussion record",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlanReceipt"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or expected account header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{document_id}/agent-plans/{plan_id}": {
      "get": {
        "tags": [
          "agent_collaboration"
        ],
        "operationId": "get_agent_plan",
        "parameters": [
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "plan_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "X-Dee-Expected-Agent-Id",
            "in": "header",
            "description": "Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current authorized plan and execution facts",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlanRead"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or expected account header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{document_id}/agent-plans/{plan_id}/decisions": {
      "post": {
        "tags": [
          "agent_collaboration"
        ],
        "operationId": "decide_agent_plan",
        "parameters": [
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "plan_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DecisionRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Browser-human decision",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DecisionReceipt"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or expected account header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{document_id}/agents": {
      "get": {
        "tags": [
          "agents"
        ],
        "operationId": "list_document_agents",
        "parameters": [
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "X-Dee-Expected-Agent-Id",
            "in": "header",
            "description": "Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Paged_MentionCandidate"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or expected account header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{document_id}/collaborators/agents/{agent_id}": {
      "put": {
        "tags": [
          "agents"
        ],
        "operationId": "set_agent_document_grant",
        "parameters": [
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentGrantRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentGrantReceipt"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or expected account header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "agents"
        ],
        "operationId": "remove_agent_document_grant",
        "parameters": [
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RemoveAgentGrantRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentGrantReceipt"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or expected account header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{document_id}/pages": {
      "get": {
        "tags": [
          "pages"
        ],
        "operationId": "list_document_pages",
        "parameters": [
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "state",
            "in": "query",
            "description": "active (default) or deleted; deleted requires edit permission",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page_index",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "description": "0 to 100; default 50",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "order_by",
            "in": "query",
            "description": "created_at,title,updated_at,id; default created_at.asc,id.asc",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Paged_PageSummary"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or expected account header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "pages"
        ],
        "operationId": "create_document_page",
        "parameters": [
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePageRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PageReceipt"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{document_id}/pages/by-key": {
      "get": {
        "tags": [
          "pages"
        ],
        "operationId": "find_document_page_by_key",
        "parameters": [
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "key",
            "in": "query",
            "description": "Exact current key within this Document",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PageResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or expected account header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{document_id}/pages/{page_id}": {
      "get": {
        "tags": [
          "pages"
        ],
        "operationId": "get_document_page",
        "parameters": [
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "page_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PageResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or expected account header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "pages"
        ],
        "operationId": "save_document_page",
        "parameters": [
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "page_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SavePageRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PageReceipt"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{document_id}/pages/{page_id}/key": {
      "post": {
        "tags": [
          "pages"
        ],
        "operationId": "set_document_page_key",
        "parameters": [
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "page_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PageKeyRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PageReceipt"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{document_id}/pages/{page_id}/restore": {
      "post": {
        "tags": [
          "pages"
        ],
        "operationId": "restore_document_page",
        "parameters": [
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "page_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PageLifecycleRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PageReceipt"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{document_id}/pages/{page_id}/revisions": {
      "get": {
        "tags": [
          "pages"
        ],
        "operationId": "list_page_revisions",
        "parameters": [
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "page_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "page_index",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "order_by",
            "in": "query",
            "description": "created_at,id; default created_at.desc,id.desc",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PageHistoryResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or expected account header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{document_id}/pages/{page_id}/revisions/{revision_id}": {
      "get": {
        "tags": [
          "pages"
        ],
        "operationId": "get_page_revision",
        "parameters": [
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "page_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "revision_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PageRevisionResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or expected account header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{document_id}/pages/{page_id}/trash": {
      "post": {
        "tags": [
          "pages"
        ],
        "operationId": "trash_document_page",
        "parameters": [
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "page_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PageLifecycleRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PageReceipt"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{document_id}/threads/{root}/agent-control": {
      "get": {
        "tags": [
          "agent_collaboration"
        ],
        "operationId": "get_agent_control",
        "parameters": [
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "root",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "X-Dee-Expected-Agent-Id",
            "in": "header",
            "description": "Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current work control; active does not mean running",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Control"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or expected account header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "agent_collaboration"
        ],
        "operationId": "set_agent_control",
        "parameters": [
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "root",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ControlRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Human stop/restart recorded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ControlWriteResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or expected account header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{document_id}/threads/{root}/agent-feedback/{agent_id}": {
      "get": {
        "tags": [
          "agent_collaboration"
        ],
        "operationId": "get_agent_feedback",
        "parameters": [
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "root",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "X-Dee-Expected-Agent-Id",
            "in": "header",
            "description": "Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Latest received report and current control",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FeedbackRead"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or expected account header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "agent_collaboration"
        ],
        "operationId": "report_agent_feedback",
        "parameters": [
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "root",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "X-Dee-Expected-Agent-Id",
            "in": "header",
            "description": "Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FeedbackRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "New protected factual report",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FeedbackReceipt"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or expected account header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{id}": {
      "get": {
        "tags": [
          "documents"
        ],
        "operationId": "get_document",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "X-Dee-Expected-Agent-Id",
            "in": "header",
            "description": "Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current authorized Markdown, metadata, safe HTML and TOC",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid 22-character Base62 ID",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Document unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "Document is in the trash under current access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Read unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "documents"
        ],
        "operationId": "save_document",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "X-Dee-Expected-Agent-Id",
            "in": "header",
            "description": "Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveDocumentRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Committed title and body snapshot, or unchanged original version",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentReceipt"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient role or Origin",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Document unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "Revision or operation conflict AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "Document is in the trash under current access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Result unconfirmed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{id}/access": {
      "get": {
        "tags": [
          "access"
        ],
        "operationId": "get_document_access",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current actor's effective document role and independent sources",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentAccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid 22-character Base62 ID",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Document unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "Document is in the trash under current access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Read unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{id}/attachments": {
      "get": {
        "tags": [
          "attachments"
        ],
        "operationId": "list_document_attachments",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "scope",
            "in": "query",
            "description": "body (default), main, or thread; thread includes root and replies",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "revision_id",
            "in": "query",
            "description": "Only body; omission selects the current Revision",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "thread_id",
            "in": "query",
            "description": "Required root message identity only with scope=thread",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "page_index",
            "in": "query",
            "description": "Zero-based safe integer, default 0",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "description": "0..100, default 50; zero returns count only",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "order_by",
            "in": "query",
            "description": "source_created_at/source_id/resource_id with .asc/.desc; unique source/resource ties are appended",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Selected attachment references and object-level sources under current document access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AttachmentList"
                }
              }
            }
          },
          "400": {
            "description": "Invalid target, scope, selectors or pagination",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current identity required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Document or selected source unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "Document is in trash under current access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Read unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{id}/attention": {
      "get": {
        "tags": [
          "attention"
        ],
        "operationId": "main_attention",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Main reading state and current authorized unread counts; no mutation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StateResponse"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "Document is in the trash under current access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{id}/attention/read": {
      "post": {
        "tags": [
          "attention"
        ],
        "operationId": "mark_main_read",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReadRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Explicit monotone main message read position; independent of notification acknowledgement",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AttentionReceipt"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "Document is in the trash under current access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{id}/backlinks": {
      "get": {
        "tags": [
          "document_links"
        ],
        "operationId": "list_document_backlinks",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "page_index",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "description": "0 to 100; default 50",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "order_by",
            "in": "query",
            "description": "title,updated_at,id asc/desc; default updated_at.desc,id.asc",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current visible incoming document relationships",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentLinkPage"
                }
              }
            }
          },
          "400": {
            "description": "Invalid ID or pagination",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current identity required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Anchor unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "Anchor is in trash",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Read unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{id}/changes": {
      "get": {
        "tags": [
          "changes"
        ],
        "operationId": "document_changes",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "Absent: bootstrap boundary before current reads; reuse for replay/resume",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "max_events",
            "in": "query",
            "description": "Default 100, 1 to 200",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          },
          {
            "name": "wait_ms",
            "in": "query",
            "description": "Default 0, at most 25000; no database connection held during waits",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "include_activities",
            "in": "query",
            "description": "Include typed activities using a separately bound cursor; default false",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ordered committed identities under current access, or bootstrap boundary",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChangeFeed"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Scope unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "Invalid cursor; explicit reset boundary and current reads required AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "Document is in the trash under current access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Resume original cursor after recovery",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{id}/collaborators": {
      "get": {
        "tags": [
          "access"
        ],
        "operationId": "list_document_collaborators",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "page_index",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "description": "0..100, default 50; 0 returns count only",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "order_by",
            "in": "query",
            "description": "Comma separated joined_at/role/account_id.asc|desc; default joined_at.asc,account_id.asc",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Direct collaborators and their effective sources, document administrator only",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Paged_CollaboratorResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid 22-character Base62 ID or paging",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "Administrator permission required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Document unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "Document is in the trash under current access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Read unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{id}/collaborators/{account_id}": {
      "put": {
        "tags": [
          "access"
        ],
        "operationId": "set_document_collaborator",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "account_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetCollaboratorRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Committed direct grant creation or replacement; inherited sources remain",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccessReceipt"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "Administrator permission or valid origin required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Document or registered account unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "Access revision, operation or last administrator conflict AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Result not confirmed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "access"
        ],
        "operationId": "remove_document_collaborator",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "account_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RemoveCollaboratorRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Committed direct grant removal; inherited sources remain",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccessReceipt"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "Administrator permission or valid origin required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Document unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "Access revision, operation or last administrator conflict AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Result not confirmed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{id}/entries": {
      "get": {
        "tags": [
          "entries"
        ],
        "operationId": "list_entries",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "thread_id",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "read_boundary_entry_id",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "description": "all (default), messages or activities",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/EntryKind"
            }
          },
          {
            "name": "event_type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "changed_field",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page_index",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "order_by",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "X-Dee-Expected-Agent-Id",
            "in": "header",
            "description": "Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EntryPageResponse"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{id}/entries/{entry_id}": {
      "get": {
        "tags": [
          "entries"
        ],
        "operationId": "get_entry",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "entry_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "X-Dee-Expected-Agent-Id",
            "in": "header",
            "description": "Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EntryResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or expected account header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{id}/entries/{entry_id}/context": {
      "get": {
        "tags": [
          "entries"
        ],
        "operationId": "get_entry_context",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "entry_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "after",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "X-Dee-Expected-Agent-Id",
            "in": "header",
            "description": "Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EntryContextResponse"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{id}/entries/{entry_id}/thread": {
      "get": {
        "tags": [
          "entries"
        ],
        "operationId": "get_entry_thread",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "entry_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "X-Dee-Expected-Agent-Id",
            "in": "header",
            "description": "Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EntryThreadResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or expected account header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{id}/favorite": {
      "get": {
        "tags": [
          "attention"
        ],
        "operationId": "get_document_favorite",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The current account's document favorite; no reading side effects",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FavoriteResponse"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "attention"
        ],
        "operationId": "set_document_favorite",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FavoriteRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Original account-only favorite result; explicit set, without CAS or discussion effects",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AttentionReceipt"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{id}/join": {
      "post": {
        "tags": [
          "access"
        ],
        "operationId": "join_document",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JoinDocumentRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Committed join or existing-access result; existing access is never upgraded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccessReceipt"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "Valid origin required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Document unavailable or joining closed for an unauthorized actor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "Operation conflict AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "Document is in the trash under current access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Result not confirmed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{id}/lifecycle": {
      "get": {
        "tags": [
          "lifecycle"
        ],
        "operationId": "get_document_lifecycle",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current administrator metadata and comparison token without common content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LifecycleResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid 22-character Base62 ID",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "Current administrator required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Document unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Read unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{id}/links": {
      "get": {
        "tags": [
          "document_links"
        ],
        "operationId": "list_document_links",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "page_index",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "description": "0 to 100; default 50",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "order_by",
            "in": "query",
            "description": "title,updated_at,id asc/desc; default updated_at.desc,id.asc",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current visible outgoing document relationships",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentLinkPage"
                }
              }
            }
          },
          "400": {
            "description": "Invalid ID or pagination",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current identity required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Anchor unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "Anchor is in trash",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Read unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{id}/messages": {
      "get": {
        "tags": [
          "communication"
        ],
        "operationId": "list_messages",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "thread_id",
            "in": "query",
            "description": "Absent: main messages. Present: replies in this Thread",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "read_boundary_message_id",
            "in": "query",
            "description": "Reuse the returned main/Thread boundary to preserve page membership during new messages",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "page_index",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "description": "Default 50, maximum 100; zero returns counts only",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "order_by",
            "in": "query",
            "description": "created_at or id with asc/desc; default created_at.asc,id.asc",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "X-Dee-Expected-Agent-Id",
            "in": "header",
            "description": "Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Messages and current authorized counts from one snapshot",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessagePageResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid query",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Document or Thread unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "New entry shape requires the common entry read_url AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "Document is in the trash under current access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Read unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "communication"
        ],
        "operationId": "send_message",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "X-Dee-Expected-Agent-Id",
            "in": "header",
            "description": "Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Committed message and original minimal receipt",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Receipt"
                }
              }
            }
          },
          "400": {
            "description": "Invalid content or source selection",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "Edit role or Origin required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Document, reply or source unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "Operation or source conflict AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "Document is in the trash under current access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Unconfirmed result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{id}/messages/{message_id}": {
      "get": {
        "tags": [
          "communication"
        ],
        "operationId": "get_message",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "message_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "X-Dee-Expected-Agent-Id",
            "in": "header",
            "description": "Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Currently authorized message or deletion placeholder",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessageResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or expected account header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Unavailable target",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "New entry shape requires the common entry read_url AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "Document is in the trash under current access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Read unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "communication"
        ],
        "operationId": "edit_message",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "message_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "X-Dee-Expected-Agent-Id",
            "in": "header",
            "description": "Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EditRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Committed edit or unchanged original snapshot",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Receipt"
                }
              }
            }
          },
          "400": {
            "description": "Invalid content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "Current author edit role required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Unavailable target or source",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "Version, deleted, source or operation conflict AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "Document is in the trash under current access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Unconfirmed result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "communication"
        ],
        "operationId": "delete_message",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "message_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "X-Dee-Expected-Agent-Id",
            "in": "header",
            "description": "Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeleteRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Committed deletion or existing tombstone",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Receipt"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "Current author or administrator role required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Target unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "Version or operation conflict AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "Document is in the trash under current access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Unconfirmed result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{id}/messages/{message_id}/context": {
      "get": {
        "tags": [
          "communication"
        ],
        "operationId": "get_message_context",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "message_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "before",
            "in": "query",
            "description": "Default 10, maximum 50",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "after",
            "in": "query",
            "description": "Default 10, maximum 50",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "X-Dee-Expected-Agent-Id",
            "in": "header",
            "description": "Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Stable-ID context in the message's actual main/Thread range",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContextResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid context range",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Target unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "New entry shape requires the common entry read_url AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "Document is in the trash under current access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Read unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{id}/metadata": {
      "get": {
        "tags": [
          "documents"
        ],
        "operationId": "get_document_metadata",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Authorized metadata without body or rendered content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentSummary"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or expected account header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{id}/move": {
      "post": {
        "tags": [
          "document_tree"
        ],
        "operationId": "move_document",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MoveDocumentRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Committed placement or original exact retry receipt",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TreeMoveReceipt"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parent or cycle",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current identity required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Origin authority or document unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "Structure or operation conflict AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "Document in trash",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Result unconfirmed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{id}/pin": {
      "get": {
        "tags": [
          "document_pins"
        ],
        "operationId": "get_document_pin",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Origin-owned pin state and current permission, without reading side effects",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PinResponse"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "document_pins"
        ],
        "operationId": "set_document_pin",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PinRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Original explicit pin result; personal holder or Space administrator required for a new operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PinReceipt"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{id}/restore": {
      "post": {
        "tags": [
          "lifecycle"
        ],
        "operationId": "restore_document",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LifecycleRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Same Document restored; link joining closed in the same transaction",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LifecycleReceipt"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "Current administrator or Origin required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Document unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "Review current impact or original intent conflict AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Result unconfirmed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{id}/revisions": {
      "get": {
        "tags": [
          "document_history"
        ],
        "operationId": "list_document_revisions",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "page_index",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "description": "0 to 100; default 50",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "order_by",
            "in": "query",
            "description": "Comma-separated created_at,id asc/desc; default created_at.desc,id.asc",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current authorized revision metadata and current identity from one snapshot",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RevisionHistoryResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid pagination or ID",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current identity required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Document unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "Document is in trash",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Read unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{id}/revisions/diff": {
      "get": {
        "tags": [
          "document_history"
        ],
        "operationId": "diff_document_revisions",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "from_revision_id",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "to_revision_id",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Complete immutable comparison or an explicit work/output budget result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RevisionDiffResponse"
                }
              }
            }
          },
          "400": {
            "description": "Both exact Revision IDs are required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current identity required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Document or Revision unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "Document is in trash",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Read or execution capacity unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{id}/revisions/{revision_id}": {
      "get": {
        "tags": [
          "documents"
        ],
        "operationId": "get_document_revision",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "revision_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "X-Dee-Expected-Agent-Id",
            "in": "header",
            "description": "Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Immutable snapshot under current document permission",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RevisionResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid 22-character Base62 ID",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Document or version unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "Document is in the trash under current access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Read unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{id}/sharing": {
      "get": {
        "tags": [
          "access"
        ],
        "operationId": "get_document_sharing",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current link rule and access revision, document administrator only",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SharingResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid 22-character Base62 ID",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "Administrator permission required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Document unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "Document is in the trash under current access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Read unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "access"
        ],
        "operationId": "set_document_sharing",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetSharingRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Committed link rule for future joins; existing grants remain",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccessReceipt"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "Administrator permission or valid origin required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Document unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "Access revision or operation conflict AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Result not confirmed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{id}/source": {
      "get": {
        "tags": [
          "document_source"
        ],
        "operationId": "get_document_source",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "revision_id",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "view",
            "in": "query",
            "description": "markdown (default) or outline",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "start",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "end",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "max_bytes",
            "in": "query",
            "description": "Markdown bytes, 4 to 131072; default 32768",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "page_index",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "description": "Outline only, 0 to 100; default 50",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "order_by",
            "in": "query",
            "description": "Outline only: position.asc",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Selected immutable source without HTML",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourceResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid source view, range or pagination",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current identity required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Document or Revision unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "Document is in trash",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Read unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{id}/threads/{thread_id}": {
      "get": {
        "tags": [
          "communication"
        ],
        "operationId": "get_thread",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "thread_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "X-Dee-Expected-Agent-Id",
            "in": "header",
            "description": "Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Root, retained reply count and most recent reply time",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ThreadResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or expected account header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Target unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "New entry shape requires the common entry read_url AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "Document is in the trash under current access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Read unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{id}/threads/{thread_id}/attention": {
      "get": {
        "tags": [
          "attention"
        ],
        "operationId": "thread_attention",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "thread_id",
            "in": "path",
            "description": "A main message's stable root identity, including before its first reply",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Thread preferences and independent reply read state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StateResponse"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "Document is in the trash under current access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "attention"
        ],
        "operationId": "set_thread_preferences",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "thread_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PreferencesRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Original preference result; zero baseline for default state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AttentionReceipt"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "Document is in the trash under current access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{id}/threads/{thread_id}/attention/read": {
      "post": {
        "tags": [
          "attention"
        ],
        "operationId": "mark_thread_read",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "thread_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReadRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Explicit monotone reply read position; main root has a separate reading scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AttentionReceipt"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "Document is in the trash under current access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{id}/trash": {
      "post": {
        "tags": [
          "lifecycle"
        ],
        "operationId": "trash_document",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LifecycleRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Committed lifecycle result, or original minimal result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LifecycleReceipt"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "Current administrator or Origin required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Document unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "Management facts or original intent changed AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Result unconfirmed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{id}/view": {
      "put": {
        "tags": [
          "documents"
        ],
        "operationId": "record_document_view",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Explicit actual opening retained for the current account; does not mark discussion messages read",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentViewResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid document ID",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current account required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "Invalid Origin",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Document unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "Document is in the trash",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Opening could not be confirmed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/favorites": {
      "get": {
        "tags": [
          "attention"
        ],
        "operationId": "list_favorite_documents",
        "parameters": [
          {
            "name": "space_id",
            "in": "query",
            "description": "Optional current member Space; omission aggregates all readable sources",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "title",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page_index",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "order_by",
            "in": "query",
            "description": "Same document ordering fields; default favorited_at.desc,id.asc",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Paged_DocumentSummary"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/resources/uploads": {
      "post": {
        "tags": [
          "resources"
        ],
        "operationId": "upload_resource",
        "parameters": [
          {
            "name": "operation_id",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "filename",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "document_id",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "create_operation_id",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "Raw file bytes, 1 byte to 20 MiB. Use a concrete Content-Type, default application/octet-stream when omitted or empty. PNG/JPEG/GIF/WebP retain matching raster-signature checks; other file types download as attachments.",
          "content": {
            "*/*": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            },
            "application/octet-stream": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            },
            "image/gif": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            },
            "image/jpeg": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            },
            "image/png": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            },
            "image/webp": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Confirmed private upload; content is not yet published",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UploadReceipt"
                }
              }
            }
          },
          "400": {
            "description": "Invalid scope, MIME or raster signature",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "Current edit permission or Origin required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Document unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "Changed upload intent AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "Document is in the trash under current access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "413": {
            "description": "File exceeds 20 MiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Upload pending or unconfirmed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/resources/uploads/{operation_id}": {
      "get": {
        "tags": [
          "resources"
        ],
        "operationId": "get_upload_operation",
        "parameters": [
          {
            "name": "operation_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Actor-only reservation or confirmed result; no current access grant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UploadReceipt"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or expected account header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "No reservation for this actor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Read unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/resources/{id}": {
      "get": {
        "tags": [
          "resources"
        ],
        "operationId": "get_resource",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current authorized resource metadata",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResourceMetadata"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or expected account header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Resource unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "Document is in the trash under current access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Read unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/resources/{id}/content": {
      "get": {
        "tags": [
          "resources"
        ],
        "operationId": "get_resource_content",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Verified private original bytes; PNG/JPEG/GIF/WebP inline, every other MIME type as an attachment with a UTF-8 filename",
            "content": {
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/jpeg": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/gif": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/webp": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "*/*": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or expected account header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Resource unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "Document is in the trash under current access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Original unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/search": {
      "post": {
        "tags": [
          "search"
        ],
        "operationId": "search_content",
        "parameters": [
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "X-Dee-Expected-Agent-Id",
            "in": "header",
            "description": "Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SearchRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Exact scoped content results and count from one authorized snapshot; read-only and no-store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Paged_SearchResult"
                }
              }
            }
          },
          "400": {
            "description": "Invalid literal terms, scope, ID, kind, JSON or Pos",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session or Agent credential required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Explicit document or member Space unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "Explicit authorized document is in the trash",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Search storage or execution budget unavailable; no partial results",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        },
        "x-dee-read-only": true
      }
    },
    "/api/session": {
      "get": {
        "tags": [
          "identity"
        ],
        "operationId": "current",
        "parameters": [
          {
            "name": "Cookie",
            "in": "header",
            "description": "Current Dee v0.1 session cookie",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Login-synchronized account and currently valid Dee session; no document grant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CurrentSessionResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or expected account header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "No valid current session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Current identity cannot be verified",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "identity"
        ],
        "operationId": "logout",
        "parameters": [
          {
            "name": "Origin",
            "in": "header",
            "description": "Must equal APP_ORIGIN",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Cookie",
            "in": "header",
            "description": "Local session to revoke, if present",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/LogoutRequest"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Cookie-derived Dee session is durably revoked. Conditional requests confirm only a matching original SID, including an already-revoked row, and leave browser cookies unchanged to preserve newer logins. Unconditional requests also succeed for absent credentials.",
            "headers": {
              "Set-Cookie": {
                "schema": {
                  "type": "string"
                },
                "description": "Only an unconditional request clears the Dee v0.1 cookie"
              }
            }
          },
          "400": {
            "description": "Invalid logout condition",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "Invalid request origin",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "Conditional Cookie is absent, unknown, or identifies a different SID. Original logout is unconfirmed; no session is revoked or cookie cleared.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Local revocation could not be confirmed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/spaces": {
      "get": {
        "tags": [
          "spaces"
        ],
        "operationId": "list",
        "parameters": [
          {
            "name": "page_index",
            "in": "query",
            "description": "Zero-based safe integer, default 0",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "description": "0..100, default 50; 0 returns count only",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "order_by",
            "in": "query",
            "description": "Comma separated name/updated_at/id.asc|desc; default updated_at.desc,id.asc",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current membership-filtered Space page and count",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Paged_SpaceResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid paging",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Read unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "spaces"
        ],
        "operationId": "create",
        "parameters": [
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Committed actor-scoped Space creation result; exact retries return it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReceiptResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "Invalid origin",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "Operation ID conflict AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Operation not confirmed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/spaces/operations/{operation_id}": {
      "get": {
        "tags": [
          "spaces"
        ],
        "operationId": "operation",
        "parameters": [
          {
            "name": "operation_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Only the original actor's retained write fact; not current Space access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReceiptResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or expected account header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "No result for this actor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Read unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/spaces/{id}": {
      "get": {
        "tags": [
          "spaces"
        ],
        "operationId": "get",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current Space facts and role, members only",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SpaceResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or expected account header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "No current membership or nonexistent Space",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Read unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "spaces"
        ],
        "operationId": "update",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Committed metadata replacement result, administrator only",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReceiptResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient role or invalid origin",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Space unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "Revision or operation conflict AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Result not confirmed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/spaces/{id}/changes": {
      "get": {
        "tags": [
          "changes"
        ],
        "operationId": "space_changes",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "Absent: bootstrap boundary before current reads; scoped to current member",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "max_events",
            "in": "query",
            "description": "Default 100, 1 to 200",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          },
          {
            "name": "wait_ms",
            "in": "query",
            "description": "Default 0, at most 25000",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "include_activities",
            "in": "query",
            "description": "Include typed activities using a separately bound cursor; default false",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Space and its document changes under current membership",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChangeFeed"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Scope unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "Explicit resync required AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Discovery unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/spaces/{id}/leave": {
      "post": {
        "tags": [
          "spaces"
        ],
        "operationId": "leave",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RevisionRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Committed removal of this account's membership only; exact retry retains result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReceiptResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "Invalid origin",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Space unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "Last administrator or revision/operation conflict AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Result not confirmed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/spaces/{id}/members": {
      "get": {
        "tags": [
          "spaces"
        ],
        "operationId": "members",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "page_index",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "description": "0..100, default 50",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "order_by",
            "in": "query",
            "description": "Comma separated joined_at/role/account_id.asc|desc; default joined_at.asc,account_id.asc",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Member page, available only to Space members; minimum registered profiles",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Paged_MemberResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid paging",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Space unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Read unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "spaces"
        ],
        "operationId": "add_member",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddMemberRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Committed member addition, default editor, administrator only",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReceiptResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient role or invalid origin",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Space or registered account unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "Already member or revision/operation conflict AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Result not confirmed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/spaces/{id}/members/{account_id}": {
      "put": {
        "tags": [
          "spaces"
        ],
        "operationId": "set_role",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "account_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetRoleRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Committed member role result, administrator only",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReceiptResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient role or origin",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Space or member unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "Last administrator or revision/operation conflict AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Result not confirmed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "spaces"
        ],
        "operationId": "remove_member",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "account_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RevisionRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Committed member removal, does not change document holding or direct grants",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReceiptResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current session required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient role or origin",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Space or member unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "Last administrator or revision/operation conflict AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Result not confirmed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/spaces/{id}/tree": {
      "get": {
        "tags": [
          "document_tree"
        ],
        "operationId": "get_space_document_tree",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "page_index",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "description": "0 to 100; default 50",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "order_by",
            "in": "query",
            "description": "position,title,id; default position.asc,id.asc",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Active document nodes and structure version in one Space-member snapshot",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SpaceDocumentTree"
                }
              }
            }
          },
          "400": {
            "description": "Invalid pagination",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "Current identity required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Space membership unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Read unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/tasks": {
      "post": {
        "tags": [
          "tasks"
        ],
        "operationId": "create_task",
        "parameters": [
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateTaskRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Task source, first versions, creation activity and assignment notification committed together",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskReceipt"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/tasks/operations/{operation_id}": {
      "get": {
        "tags": [
          "tasks"
        ],
        "operationId": "get_task_operation",
        "parameters": [
          {
            "name": "operation_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Only the authenticated human actor's original minimal Task receipt; does not grant current target access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskReceipt"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or expected account header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/tasks/query": {
      "post": {
        "tags": [
          "task_collections"
        ],
        "operationId": "query_tasks",
        "parameters": [
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskCollectionRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Current authorized Task summaries, count and five-state totals from one bounded read snapshot; no business mutation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskCollection"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "Cookie POST requires the configured Origin",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "Space membership unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "Source projection, condition evidence or read budget unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        },
        "x-dee-read-only": true
      }
    },
    "/api/tasks/{id}": {
      "get": {
        "tags": [
          "tasks"
        ],
        "operationId": "get_task",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "X-Dee-Expected-Agent-Id",
            "in": "header",
            "description": "Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current authorized source, Task fields, three condition identities and newest activity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskDetail"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/tasks/{id}/activities": {
      "get": {
        "tags": [
          "tasks"
        ],
        "operationId": "list_task_activities",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "page_index",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "order_by",
            "in": "query",
            "description": "created_at or id, comma-separated asc/desc; default created_at.desc,id.asc",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "X-Dee-Expected-Agent-Id",
            "in": "header",
            "description": "Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One currently authorized Task's activity in an authorized count/page snapshot; each handoff note is bounded to 8192 UTF-8 bytes",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Paged_TaskActivity"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/tasks/{id}/claim": {
      "post": {
        "tags": [
          "tasks"
        ],
        "operationId": "claim_task",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ClaimTaskRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskReceipt"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/tasks/{id}/description": {
      "put": {
        "tags": [
          "tasks"
        ],
        "operationId": "save_task_description",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskDescriptionRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Title and complete free description merged with the latest entire frontmatter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskReceipt"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/tasks/{id}/fields": {
      "patch": {
        "tags": [
          "tasks"
        ],
        "operationId": "update_task_fields",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskFieldsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskReceipt"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/tasks/{id}/handoff": {
      "post": {
        "tags": [
          "tasks"
        ],
        "operationId": "handoff_task",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HandoffTaskRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Explicit assignee and optional status take effect immediately; a note is published only with a real fields change",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskReceipt"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/tasks/{id}/restore-description": {
      "post": {
        "tags": [
          "tasks"
        ],
        "operationId": "restore_task_description",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RestoreTaskDescriptionRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Selected historical title and description restored while preserving the latest entire frontmatter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskReceipt"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/api/tasks/{id}/restore-source": {
      "post": {
        "tags": [
          "tasks"
        ],
        "operationId": "restore_task_source",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Id"
            }
          },
          {
            "name": "X-Dee-Expected-Account-Id",
            "in": "header",
            "description": "Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.",
            "required": false,
            "schema": {
              "type": "string",
              "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
              "pattern": "^[A-Za-z0-9]{22}$"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RestoreTaskSourceRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Explicit complete historical source restored under the reviewed full Revision CAS and current assignment qualification",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskReceipt"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "409": {
            "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "410": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/health": {
      "get": {
        "tags": [],
        "operationId": "health",
        "responses": {
          "200": {
            "description": "The HTTP process is alive; no dependency check.",
            "headers": {
              "x-request-id": {
                "schema": {
                  "type": "string"
                },
                "description": "Server-generated request correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthResponse"
                }
              }
            }
          }
        }
      }
    },
    "/ready": {
      "get": {
        "tags": [],
        "operationId": "ready",
        "responses": {
          "200": {
            "description": "PostgreSQL and storage are available, recovery opening control is verified, and document links initialization is complete.",
            "headers": {
              "x-request-id": {
                "schema": {
                  "type": "string"
                },
                "description": "Server-generated request correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReadyResponse"
                }
              }
            }
          },
          "503": {
            "description": "A dependency or recovery opening control is unavailable. data.dependencies lists safe component statuses.",
            "headers": {
              "x-request-id": {
                "schema": {
                  "type": "string"
                },
                "description": "Server-generated request correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/version": {
      "get": {
        "tags": [],
        "operationId": "version",
        "responses": {
          "200": {
            "description": "Version and build commit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VersionResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AccessReceipt": {
        "type": "object",
        "required": [
          "operation_id",
          "document_id",
          "revision",
          "effect"
        ],
        "properties": {
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "effect": {
            "type": "string"
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          },
          "revision": {
            "type": "integer",
            "format": "int64"
          },
          "role": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/AccessRole"
              }
            ]
          },
          "target_account_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "target_agent_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          }
        }
      },
      "AccessRole": {
        "type": "string",
        "enum": [
          "viewer",
          "editor",
          "administrator"
        ]
      },
      "AccessSourceResponse": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "role",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "agent_scope"
                ]
              },
              "role": {
                "$ref": "#/components/schemas/AccessRole"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "account_id",
              "kind"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/Id"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "personal_holding"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "space_id",
              "role",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "space_membership"
                ]
              },
              "role": {
                "$ref": "#/components/schemas/AccessRole"
              },
              "space_id": {
                "$ref": "#/components/schemas/Id"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "role",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "direct_grant"
                ]
              },
              "role": {
                "$ref": "#/components/schemas/AccessRole"
              }
            }
          }
        ]
      },
      "AccountResponse": {
        "type": "object",
        "required": [
          "id"
        ],
        "properties": {
          "avatar_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "display_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "$ref": "#/components/schemas/Id"
          }
        }
      },
      "ActivityData": {
        "type": "object",
        "description": "A versioned business payload. Unknown types retain their original structure.",
        "required": [
          "event_type",
          "detail_version",
          "fields",
          "details"
        ],
        "properties": {
          "detail_version": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "details": {},
          "event_type": {
            "type": "string"
          },
          "fields": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "legacy_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "source_operation_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "source_operation_owner": {
            "type": [
              "string",
              "null"
            ]
          },
          "source_revision_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          }
        }
      },
      "ActivityResponse": {
        "type": "object",
        "required": [
          "id",
          "document_id",
          "author",
          "created_at",
          "version",
          "activity",
          "quote_text",
          "source_status",
          "entry_url"
        ],
        "properties": {
          "activity": {
            "$ref": "#/components/schemas/ActivityData"
          },
          "author": {
            "$ref": "#/components/schemas/AuthorResponse"
          },
          "created_at": {
            "type": "integer",
            "format": "int64"
          },
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "entry_url": {
            "type": "string"
          },
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "quote_text": {
            "type": "string"
          },
          "source_status": {
            "type": "string"
          },
          "source_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "thread": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ThreadSummary"
              }
            ]
          },
          "version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "ActorId": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "account_id",
              "kind"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/Id"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "user"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "agent_id",
              "kind"
            ],
            "properties": {
              "agent_id": {
                "$ref": "#/components/schemas/Id"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "agent"
                ]
              }
            }
          }
        ]
      },
      "AddMemberRequest": {
        "type": "object",
        "required": [
          "operation_id",
          "expected_revision",
          "account_id"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/Id"
          },
          "expected_revision": {
            "type": "integer",
            "format": "int64"
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          },
          "role": {
            "$ref": "#/components/schemas/MemberRole"
          }
        },
        "additionalProperties": false
      },
      "AgentBuiltinPurpose": {
        "type": "string",
        "enum": [
          "definition",
          "memory"
        ]
      },
      "AgentConfigurationReceipt": {
        "type": "object",
        "required": [
          "operation_id",
          "agent_id",
          "revision"
        ],
        "properties": {
          "agent_id": {
            "$ref": "#/components/schemas/Id"
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "AgentConfigurationRequest": {
        "type": "object",
        "required": [
          "operation_id",
          "expected_revision",
          "response_mode",
          "scope_role",
          "definition_document_ids",
          "memory_document_ids"
        ],
        "properties": {
          "definition_document_ids": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Id"
            }
          },
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "memory_document_ids": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Id"
            }
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          },
          "response_mode": {
            "$ref": "#/components/schemas/ResponseMode"
          },
          "scope_role": {
            "$ref": "#/components/schemas/AgentRole"
          }
        },
        "additionalProperties": false
      },
      "AgentConnectionResponse": {
        "type": "object",
        "required": [
          "id",
          "client_name",
          "authorized_at",
          "expires_at",
          "status"
        ],
        "properties": {
          "authorized_at": {
            "type": "integer",
            "format": "int64"
          },
          "client_name": {
            "type": "string"
          },
          "expires_at": {
            "type": "integer",
            "format": "int64"
          },
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "last_used_at": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "revoked_at": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "status": {
            "$ref": "#/components/schemas/ConnectionStatus"
          }
        }
      },
      "AgentConnectionsResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Paged_AgentConnectionResponse"
          },
          {
            "type": "object",
            "required": [
              "generation"
            ],
            "properties": {
              "generation": {
                "type": "string",
                "description": "Opaque decimal generation used to safely retry revoke-all without affecting newer grants."
              }
            }
          }
        ]
      },
      "AgentContext": {
        "type": "object",
        "required": [
          "document_id",
          "root_message_id",
          "control_revision",
          "authorization"
        ],
        "properties": {
          "authorization": {
            "$ref": "#/components/schemas/Authorization"
          },
          "control_revision": {
            "type": "string"
          },
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "root_message_id": {
            "$ref": "#/components/schemas/Id"
          }
        },
        "additionalProperties": false
      },
      "AgentDocumentDetail": {
        "type": "object",
        "required": [
          "document_id",
          "can_manage",
          "related_documents"
        ],
        "properties": {
          "can_manage": {
            "type": "boolean"
          },
          "definition_document_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id",
                "description": "The immutable initial Definition document. Current bindings are in Agent Configuration."
              }
            ]
          },
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "memory_document_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id",
                "description": "The immutable initial Memory document. Current bindings are in Agent Configuration."
              }
            ]
          },
          "related_documents": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AgentRelatedDocument"
            },
            "description": "Only active related documents this viewer can currently read; links do not grant access."
          }
        }
      },
      "AgentDocumentOperationReceipt": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/AgentDocumentReceipt"
          },
          {
            "$ref": "#/components/schemas/RelatedDocumentReceipt"
          }
        ]
      },
      "AgentDocumentReceipt": {
        "type": "object",
        "required": [
          "operation_id",
          "document_id"
        ],
        "properties": {
          "definition_document_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "memory_document_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          }
        }
      },
      "AgentGrantReceipt": {
        "type": "object",
        "required": [
          "operation_id",
          "document_id",
          "revision",
          "effect",
          "target_agent_id"
        ],
        "properties": {
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "effect": {
            "type": "string"
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          },
          "revision": {
            "type": "integer",
            "format": "int64"
          },
          "role": {
            "type": [
              "string",
              "null"
            ]
          },
          "target_account_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "target_agent_id": {
            "$ref": "#/components/schemas/Id"
          }
        }
      },
      "AgentGrantRequest": {
        "type": "object",
        "required": [
          "operation_id",
          "expected_revision",
          "role"
        ],
        "properties": {
          "expected_revision": {
            "type": "integer",
            "format": "int64"
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          },
          "role": {
            "$ref": "#/components/schemas/AgentRole"
          }
        },
        "additionalProperties": false
      },
      "AgentLoginActor": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "agent_id",
              "kind"
            ],
            "properties": {
              "agent_id": {
                "$ref": "#/components/schemas/Id"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "agent"
                ]
              }
            }
          }
        ]
      },
      "AgentLoginApproveRequest": {
        "type": "object",
        "required": [
          "request",
          "approve"
        ],
        "properties": {
          "approve": {
            "type": "boolean"
          },
          "request": {
            "$ref": "#/components/schemas/Id"
          }
        },
        "additionalProperties": false
      },
      "AgentLoginPollRequest": {
        "type": "object",
        "required": [
          "id",
          "device_secret"
        ],
        "properties": {
          "device_secret": {
            "type": "string"
          },
          "id": {
            "$ref": "#/components/schemas/Id"
          }
        },
        "additionalProperties": false
      },
      "AgentLoginPollResponse": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/ServiceLoginPollResponse"
          },
          {
            "$ref": "#/components/schemas/HumanLoginPollResponse"
          }
        ]
      },
      "AgentLoginStartRequest": {
        "type": "object",
        "required": [
          "device_secret",
          "credential_sha256",
          "client_name"
        ],
        "properties": {
          "client_name": {
            "type": "string"
          },
          "credential_sha256": {
            "type": "string"
          },
          "device_secret": {
            "type": "string"
          },
          "subject": {
            "$ref": "#/components/schemas/LoginSubject"
          }
        },
        "additionalProperties": false
      },
      "AgentLoginStartResponse": {
        "type": "object",
        "required": [
          "id",
          "client_name",
          "expires_at",
          "verification_code",
          "verification_url"
        ],
        "properties": {
          "client_name": {
            "type": "string"
          },
          "expires_at": {
            "type": "integer",
            "format": "int64"
          },
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "verification_code": {
            "type": "string"
          },
          "verification_url": {
            "type": "string"
          }
        }
      },
      "AgentMe": {
        "type": "object",
        "required": [
          "protocol",
          "actor",
          "connection_id",
          "configuration"
        ],
        "properties": {
          "actor": {
            "$ref": "#/components/schemas/ActorId"
          },
          "configuration": {
            "$ref": "#/components/schemas/Configuration"
          },
          "connection_id": {
            "$ref": "#/components/schemas/Id"
          },
          "protocol": {
            "type": "string"
          }
        }
      },
      "AgentRecord": {
        "type": "object",
        "required": [
          "kind",
          "read_url"
        ],
        "properties": {
          "kind": {
            "type": "string"
          },
          "read_url": {
            "type": "string"
          }
        }
      },
      "AgentRelatedDocument": {
        "type": "object",
        "required": [
          "document_id",
          "title",
          "document_url"
        ],
        "properties": {
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "document_url": {
            "type": "string"
          },
          "title": {
            "type": "string"
          }
        }
      },
      "AgentRole": {
        "type": "string",
        "enum": [
          "viewer",
          "editor",
          "administrator"
        ]
      },
      "AgentScope": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "owner_account_id",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "personal"
                ]
              },
              "owner_account_id": {
                "$ref": "#/components/schemas/Id"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "space_id",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "space"
                ]
              },
              "space_id": {
                "$ref": "#/components/schemas/Id"
              }
            }
          }
        ]
      },
      "AttachmentList": {
        "type": "object",
        "required": [
          "document_id",
          "scope",
          "revision_id",
          "thread_id",
          "references"
        ],
        "properties": {
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "references": {
            "$ref": "#/components/schemas/Paged_AttachmentReference"
          },
          "revision_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "scope": {
            "$ref": "#/components/schemas/AttachmentScope"
          },
          "thread_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          }
        }
      },
      "AttachmentReference": {
        "type": "object",
        "required": [
          "resource",
          "source"
        ],
        "properties": {
          "resource": {
            "$ref": "#/components/schemas/ResourceMetadata"
          },
          "source": {
            "$ref": "#/components/schemas/AttachmentSource"
          }
        }
      },
      "AttachmentScope": {
        "type": "string",
        "enum": [
          "body",
          "main",
          "thread"
        ]
      },
      "AttachmentSource": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "revision_id",
              "created_at",
              "source_url",
              "kind"
            ],
            "properties": {
              "created_at": {
                "type": "integer",
                "format": "int64"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "revision"
                ]
              },
              "revision_id": {
                "$ref": "#/components/schemas/Id"
              },
              "source_url": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "message_id",
              "message_version",
              "thread_id",
              "created_at",
              "source_url",
              "kind"
            ],
            "properties": {
              "created_at": {
                "type": "integer",
                "format": "int64"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "message"
                ]
              },
              "message_id": {
                "$ref": "#/components/schemas/Id"
              },
              "message_version": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "source_url": {
                "type": "string"
              },
              "thread_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/Id"
                  }
                ]
              }
            }
          }
        ]
      },
      "AttentionReceipt": {
        "type": "object",
        "description": "Past personal-operation confirmation, without content or current access authority.",
        "required": [
          "operation_id",
          "document_id",
          "revision",
          "effect"
        ],
        "properties": {
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "effect": {
            "type": "string"
          },
          "notification_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "thread_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          }
        }
      },
      "AuthorResponse": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "agent_id",
              "kind"
            ],
            "properties": {
              "agent_id": {
                "$ref": "#/components/schemas/Id"
              },
              "avatar_url": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "display_name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "kind": {
                "type": "string",
                "enum": [
                  "agent"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "account_id",
              "kind"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/Id"
              },
              "avatar_url": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "display_name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "kind": {
                "type": "string",
                "enum": [
                  "user"
                ]
              }
            }
          }
        ]
      },
      "Authorization": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "plan_id",
              "decision_id",
              "change_id",
              "qualification_id",
              "kind"
            ],
            "properties": {
              "change_id": {
                "$ref": "#/components/schemas/Id"
              },
              "decision_id": {
                "$ref": "#/components/schemas/Id"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "plan"
                ]
              },
              "plan_id": {
                "$ref": "#/components/schemas/Id"
              },
              "qualification_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/Id"
                  }
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "memory"
                ]
              }
            }
          }
        ]
      },
      "Change": {
        "type": "object",
        "required": [
          "id",
          "position",
          "kind",
          "effect",
          "object_id",
          "read_url"
        ],
        "properties": {
          "document_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "effect": {
            "type": "string"
          },
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "kind": {
            "$ref": "#/components/schemas/ChangeKind"
          },
          "object_id": {
            "$ref": "#/components/schemas/Id"
          },
          "position": {
            "type": "string",
            "description": "Decimal commit position, kept lossless in every client language."
          },
          "read_url": {
            "type": "string"
          },
          "revision": {
            "type": [
              "string",
              "null"
            ]
          },
          "revision_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "structure_version": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "thread_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "version": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "ChangeFeed": {
        "type": "object",
        "required": [
          "mode",
          "events",
          "cursor",
          "has_more"
        ],
        "properties": {
          "cursor": {
            "type": "string"
          },
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Change"
            }
          },
          "has_more": {
            "type": "boolean"
          },
          "mode": {
            "$ref": "#/components/schemas/FeedMode"
          }
        }
      },
      "ChangeKind": {
        "type": "string",
        "enum": [
          "document",
          "document_tree",
          "message",
          "activity",
          "access",
          "space",
          "agent_configuration",
          "agent_plan",
          "agent_decision",
          "agent_control",
          "agent_feedback"
        ]
      },
      "ClaimTaskRequest": {
        "type": "object",
        "required": [
          "operation_id",
          "expected_task_fields_version"
        ],
        "properties": {
          "expected_task_fields_version": {
            "$ref": "#/components/schemas/Id"
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          }
        },
        "additionalProperties": false
      },
      "CollaboratorResponse": {
        "type": "object",
        "required": [
          "role",
          "joined_at",
          "effective_role",
          "sources"
        ],
        "properties": {
          "account_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "avatar_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "display_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "effective_role": {
            "$ref": "#/components/schemas/AccessRole"
          },
          "joined_at": {
            "type": "integer",
            "format": "int64"
          },
          "role": {
            "$ref": "#/components/schemas/AccessRole"
          },
          "sources": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AccessSourceResponse"
            }
          },
          "subject": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ActorId"
              }
            ]
          }
        }
      },
      "Configuration": {
        "type": "object",
        "required": [
          "agent_id",
          "scope",
          "revision",
          "response_mode",
          "scope_role",
          "definition_document_ids",
          "memory_document_ids"
        ],
        "properties": {
          "agent_id": {
            "$ref": "#/components/schemas/Id"
          },
          "definition_document_ids": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Id"
            }
          },
          "memory_document_ids": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Id"
            }
          },
          "response_mode": {
            "$ref": "#/components/schemas/ResponseMode"
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "scope": {
            "$ref": "#/components/schemas/AgentScope"
          },
          "scope_role": {
            "$ref": "#/components/schemas/AgentRole"
          }
        }
      },
      "ConnectionStatus": {
        "type": "string",
        "enum": [
          "active",
          "expired",
          "revoked"
        ]
      },
      "ContextResponse": {
        "type": "object",
        "required": [
          "message",
          "before",
          "after"
        ],
        "properties": {
          "after": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MessageResponse"
            }
          },
          "before": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MessageResponse"
            }
          },
          "message": {
            "$ref": "#/components/schemas/MessageResponse"
          },
          "thread_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          }
        }
      },
      "Control": {
        "type": "object",
        "required": [
          "document_id",
          "root_message_id",
          "revision",
          "state",
          "last_action"
        ],
        "properties": {
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "last_action": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ControlAction"
              }
            ]
          },
          "revision": {
            "type": "string"
          },
          "root_message_id": {
            "$ref": "#/components/schemas/Id"
          },
          "state": {
            "$ref": "#/components/schemas/ControlState"
          }
        }
      },
      "ControlAction": {
        "type": "object",
        "required": [
          "action",
          "actor",
          "created_at",
          "message_id",
          "message_url"
        ],
        "properties": {
          "action": {
            "$ref": "#/components/schemas/WorkAction"
          },
          "actor": {
            "$ref": "#/components/schemas/ActorId"
          },
          "created_at": {
            "type": "integer",
            "format": "int64"
          },
          "message_id": {
            "$ref": "#/components/schemas/Id"
          },
          "message_url": {
            "type": "string"
          }
        }
      },
      "ControlRequest": {
        "type": "object",
        "required": [
          "operation_id",
          "expected_revision",
          "action"
        ],
        "properties": {
          "action": {
            "$ref": "#/components/schemas/WorkAction"
          },
          "expected_revision": {
            "type": "string"
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          }
        },
        "additionalProperties": false
      },
      "ControlState": {
        "type": "string",
        "enum": [
          "active",
          "stopped"
        ]
      },
      "ControlWriteResponse": {
        "type": "object",
        "required": [
          "operation_id",
          "control",
          "message_url"
        ],
        "properties": {
          "control": {
            "$ref": "#/components/schemas/Control"
          },
          "message_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          }
        }
      },
      "CreateAgentDocumentRequest": {
        "type": "object",
        "required": [
          "operation_id",
          "origin",
          "title"
        ],
        "properties": {
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          },
          "origin": {
            "$ref": "#/components/schemas/CreateOrigin"
          },
          "parent_document_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id",
                "description": "Optional active parent in the same personal account or Space. Omission or null creates at root."
              }
            ]
          },
          "title": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "CreateDocumentRequest": {
        "type": "object",
        "required": [
          "operation_id",
          "title",
          "markdown"
        ],
        "properties": {
          "agent_context": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/AgentContext"
              }
            ]
          },
          "extension": {
            "type": [
              "string",
              "null"
            ]
          },
          "markdown": {
            "type": "string"
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          },
          "origin": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/CreateOrigin"
              }
            ]
          },
          "parent_document_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "title": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "CreateOrigin": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "personal"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "space_id",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "space"
                ]
              },
              "space_id": {
                "$ref": "#/components/schemas/Id"
              }
            }
          }
        ]
      },
      "CreatePageRequest": {
        "type": "object",
        "required": [
          "operation_id",
          "title",
          "markdown"
        ],
        "properties": {
          "history_policy": {
            "$ref": "#/components/schemas/HistoryPolicy"
          },
          "key": {
            "type": [
              "string",
              "null"
            ]
          },
          "markdown": {
            "type": "string"
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          },
          "title": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "CreateRelatedDocumentRequest": {
        "type": "object",
        "required": [
          "operation_id",
          "title"
        ],
        "properties": {
          "expected_revision": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Required with purpose. Compared against the Agent configuration revision.",
            "minimum": 0
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          },
          "purpose": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/AgentBuiltinPurpose",
                "description": "Create and bind this built-in only when its current binding group is empty."
              }
            ]
          },
          "title": {
            "type": "string",
            "description": "Generic related-document title. With purpose, the fixed Agent Definition or Memory title is used."
          }
        },
        "additionalProperties": false
      },
      "CreateRequest": {
        "type": "object",
        "required": [
          "operation_id",
          "name"
        ],
        "properties": {
          "description": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          }
        },
        "additionalProperties": false
      },
      "CreateTaskRequest": {
        "type": "object",
        "required": [
          "operation_id",
          "title"
        ],
        "properties": {
          "assignee_account_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id",
                "description": "Omitted: personal holder or unassigned in a Space. Explicit null: unassigned."
              }
            ]
          },
          "description": {
            "type": "string"
          },
          "due_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          },
          "origin": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/CreateOrigin"
              }
            ]
          },
          "parent_document_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "status": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/TaskStatus"
              }
            ]
          },
          "title": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "CreatedDocument": {
        "type": "object",
        "required": [
          "change_id",
          "document_id",
          "revision_id"
        ],
        "properties": {
          "change_id": {
            "$ref": "#/components/schemas/Id"
          },
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "revision_id": {
            "$ref": "#/components/schemas/Id"
          }
        }
      },
      "CurrentSessionResponse": {
        "type": "object",
        "required": [
          "account",
          "session"
        ],
        "properties": {
          "account": {
            "$ref": "#/components/schemas/AccountResponse"
          },
          "session": {
            "$ref": "#/components/schemas/SessionResponse"
          }
        }
      },
      "Decision": {
        "type": "object",
        "required": [
          "decision_id",
          "actor",
          "action",
          "created_at",
          "control_revision"
        ],
        "properties": {
          "action": {
            "$ref": "#/components/schemas/DecisionAction"
          },
          "actor": {
            "$ref": "#/components/schemas/ActorId"
          },
          "control_revision": {
            "type": "string"
          },
          "created_at": {
            "type": "integer",
            "format": "int64"
          },
          "decision_id": {
            "$ref": "#/components/schemas/Id"
          }
        }
      },
      "DecisionAction": {
        "type": "string",
        "enum": [
          "approve",
          "reject"
        ]
      },
      "DecisionReceipt": {
        "type": "object",
        "required": [
          "operation_id",
          "decision_id",
          "message_url"
        ],
        "properties": {
          "decision_id": {
            "$ref": "#/components/schemas/Id"
          },
          "message_url": {
            "type": "string"
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          }
        }
      },
      "DecisionRequest": {
        "type": "object",
        "required": [
          "operation_id",
          "expected_control_revision",
          "expected_decision_id",
          "action"
        ],
        "properties": {
          "action": {
            "$ref": "#/components/schemas/DecisionAction"
          },
          "expected_control_revision": {
            "type": "string"
          },
          "expected_decision_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          }
        },
        "additionalProperties": false
      },
      "DeleteRequest": {
        "type": "object",
        "required": [
          "operation_id",
          "expected_version"
        ],
        "properties": {
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          }
        },
        "additionalProperties": false
      },
      "DisclosureCheckRequest": {
        "type": "object",
        "required": [
          "source_document_ids",
          "target"
        ],
        "properties": {
          "source_document_ids": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Id"
            }
          },
          "target": {
            "$ref": "#/components/schemas/Target"
          }
        },
        "additionalProperties": false
      },
      "DisclosureCheckResponse": {
        "type": "object",
        "required": [
          "allowed",
          "checked_at",
          "results"
        ],
        "properties": {
          "allowed": {
            "type": "boolean"
          },
          "checked_at": {
            "type": "integer",
            "format": "int64"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DisclosureResult"
            }
          }
        }
      },
      "DisclosureResult": {
        "type": "object",
        "required": [
          "source_document_id",
          "allowed"
        ],
        "properties": {
          "allowed": {
            "type": "boolean"
          },
          "source_document_id": {
            "$ref": "#/components/schemas/Id"
          }
        }
      },
      "DocumentAccessResponse": {
        "type": "object",
        "required": [
          "document_id",
          "role",
          "sources"
        ],
        "properties": {
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "role": {
            "$ref": "#/components/schemas/AccessRole"
          },
          "sources": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AccessSourceResponse"
            }
          }
        }
      },
      "DocumentLinkPage": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Paged_DocumentLinkSummary"
          },
          {
            "type": "object",
            "required": [
              "document_id",
              "anchor_revision_id"
            ],
            "properties": {
              "anchor_revision_id": {
                "$ref": "#/components/schemas/Id"
              },
              "document_id": {
                "$ref": "#/components/schemas/Id"
              }
            }
          }
        ]
      },
      "DocumentLinkSummary": {
        "type": "object",
        "required": [
          "id",
          "title",
          "current_revision_id",
          "document_url",
          "updated_at",
          "link_types"
        ],
        "properties": {
          "current_revision_id": {
            "$ref": "#/components/schemas/Id"
          },
          "document_url": {
            "type": "string"
          },
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "link_types": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LinkType"
            }
          },
          "title": {
            "type": "string"
          },
          "updated_at": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "DocumentReceipt": {
        "type": "object",
        "required": [
          "operation_id",
          "document_id",
          "revision_id",
          "effect",
          "snapshot_hash"
        ],
        "properties": {
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "effect": {
            "type": "string"
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          },
          "revision_id": {
            "$ref": "#/components/schemas/Id"
          },
          "snapshot_hash": {
            "type": "string",
            "description": "SHA-256 of UTF-8 compact JSON [title,markdown], lowercase hexadecimal."
          }
        }
      },
      "DocumentResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/DocumentSummary"
          },
          {
            "type": "object",
            "required": [
              "markdown",
              "rendered"
            ],
            "properties": {
              "markdown": {
                "type": "string"
              },
              "rendered": {
                "$ref": "#/components/schemas/RenderedMarkdown"
              }
            }
          }
        ]
      },
      "DocumentSummary": {
        "type": "object",
        "required": [
          "id",
          "origin",
          "created_by",
          "current_revision_id",
          "title",
          "created_at",
          "updated_at",
          "can_pin",
          "readers_30d",
          "my_role",
          "document_url",
          "revision_url"
        ],
        "properties": {
          "agent_document": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Present only for ordinary documents with an Agent-purpose association record."
          },
          "can_pin": {
            "type": "boolean",
            "description": "Current personal holder or Space administrator; direct grants do not confer pin authority."
          },
          "created_at": {
            "type": "integer",
            "format": "int64"
          },
          "created_by": {
            "$ref": "#/components/schemas/ActorId"
          },
          "current_revision_id": {
            "$ref": "#/components/schemas/Id"
          },
          "document_url": {
            "type": "string"
          },
          "extension": {
            "type": [
              "string",
              "null"
            ],
            "description": "Explicit immutable document type. Null uses Markdown."
          },
          "favorited_at": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "This account's current favorite timestamp, in Unix epoch milliseconds."
          },
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "last_viewed_at": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "This account's last explicitly recorded opening, in Unix epoch milliseconds."
          },
          "my_role": {
            "type": "string",
            "description": "Maximum current role. Creator provenance is not an authorization source."
          },
          "origin": {
            "$ref": "#/components/schemas/OriginResponse"
          },
          "pinned_at": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Origin-owned pin time: personal holding or shared Space, in Unix epoch milliseconds."
          },
          "readers_30d": {
            "type": "integer",
            "format": "int64",
            "description": "Distinct accounts that explicitly recorded an opening during the past 30 days.",
            "minimum": 0
          },
          "response_mode": {
            "type": [
              "string",
              "null"
            ],
            "description": "Agent response mode projected with the collection; ordinary documents omit it."
          },
          "revision_url": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "updated_at": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "DocumentTreeNode": {
        "type": "object",
        "required": [
          "id",
          "title",
          "position",
          "document_url",
          "current_revision_id"
        ],
        "properties": {
          "current_revision_id": {
            "$ref": "#/components/schemas/Id"
          },
          "document_url": {
            "type": "string"
          },
          "extension": {
            "type": [
              "string",
              "null"
            ],
            "description": "Explicit stored type; null uses ordinary Markdown, unknown names remain intact."
          },
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "parent_document_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "position": {
            "type": "integer",
            "format": "int64"
          },
          "title": {
            "type": "string"
          }
        }
      },
      "DocumentViewResponse": {
        "type": "object",
        "required": [
          "document_id",
          "viewed_at"
        ],
        "properties": {
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "viewed_at": {
            "type": "integer",
            "format": "int64",
            "description": "Unix epoch milliseconds of the retained opening for this account."
          }
        }
      },
      "EditRequest": {
        "type": "object",
        "required": [
          "operation_id",
          "expected_version",
          "parts"
        ],
        "properties": {
          "agent_mentions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Id"
            }
          },
          "expected_version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "mentions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Id"
            }
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          },
          "parts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InputPart"
            }
          }
        },
        "additionalProperties": false
      },
      "EntryContextResponse": {
        "type": "object",
        "required": [
          "entry",
          "before",
          "after"
        ],
        "properties": {
          "after": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EntryResponse"
            }
          },
          "before": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EntryResponse"
            }
          },
          "entry": {
            "$ref": "#/components/schemas/EntryResponse"
          },
          "thread_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          }
        }
      },
      "EntryKind": {
        "type": "string",
        "enum": [
          "all",
          "messages",
          "activities"
        ]
      },
      "EntryPageResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Paged_EntryResponse"
          },
          {
            "type": "object",
            "properties": {
              "read_boundary_entry_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/Id"
                  }
                ]
              }
            }
          }
        ]
      },
      "EntryResponse": {
        "oneOf": [
          {
            "allOf": [
              {
                "$ref": "#/components/schemas/MessageResponse"
              },
              {
                "type": "object",
                "required": [
                  "kind"
                ],
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "message"
                    ]
                  }
                }
              }
            ]
          },
          {
            "allOf": [
              {
                "$ref": "#/components/schemas/ActivityResponse"
              },
              {
                "type": "object",
                "required": [
                  "kind"
                ],
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "activity"
                    ]
                  }
                }
              }
            ]
          }
        ]
      },
      "EntryThreadResponse": {
        "type": "object",
        "required": [
          "id",
          "document_id",
          "root",
          "reply_count"
        ],
        "properties": {
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "last_reply_at": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "reply_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "root": {
            "$ref": "#/components/schemas/EntryResponse"
          }
        }
      },
      "ErrorBody": {
        "type": "object",
        "required": [
          "name",
          "message"
        ],
        "properties": {
          "data": {},
          "message": {
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        }
      },
      "Excerpt": {
        "type": "object",
        "required": [
          "text",
          "field"
        ],
        "properties": {
          "field": {
            "type": "string"
          },
          "part_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "source_range": {
            "$ref": "#/components/schemas/Selection"
          },
          "text": {
            "type": "string"
          }
        }
      },
      "Execution": {
        "type": "object",
        "required": [
          "allowed",
          "blockers",
          "checked_at"
        ],
        "properties": {
          "allowed": {
            "type": "boolean"
          },
          "blockers": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "checked_at": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "FavoriteRequest": {
        "type": "object",
        "required": [
          "operation_id",
          "favorited"
        ],
        "properties": {
          "favorited": {
            "type": "boolean"
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          }
        },
        "additionalProperties": false
      },
      "FavoriteResponse": {
        "type": "object",
        "required": [
          "document_id",
          "favorited"
        ],
        "properties": {
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "favorited": {
            "type": "boolean"
          },
          "favorited_at": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          }
        }
      },
      "FeedMode": {
        "type": "string",
        "enum": [
          "bootstrap",
          "changes"
        ]
      },
      "Feedback": {
        "type": "object",
        "required": [
          "document_id",
          "root_message_id",
          "actor",
          "revision",
          "control_revision",
          "state",
          "markdown",
          "updated_at",
          "message_url"
        ],
        "properties": {
          "actor": {
            "$ref": "#/components/schemas/ActorId"
          },
          "control_revision": {
            "type": "string"
          },
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "markdown": {
            "type": "string"
          },
          "message_url": {
            "type": "string"
          },
          "revision": {
            "type": "string"
          },
          "root_message_id": {
            "$ref": "#/components/schemas/Id"
          },
          "state": {
            "$ref": "#/components/schemas/FeedbackState"
          },
          "updated_at": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "FeedbackRead": {
        "type": "object",
        "required": [
          "control",
          "feedback"
        ],
        "properties": {
          "control": {
            "$ref": "#/components/schemas/Control"
          },
          "feedback": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Feedback"
              }
            ]
          }
        }
      },
      "FeedbackReceipt": {
        "type": "object",
        "required": [
          "operation_id",
          "document_id",
          "root_message_id",
          "agent_id",
          "revision",
          "message_url"
        ],
        "properties": {
          "agent_id": {
            "$ref": "#/components/schemas/Id"
          },
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "message_url": {
            "type": "string"
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          },
          "revision": {
            "type": "string"
          },
          "root_message_id": {
            "$ref": "#/components/schemas/Id"
          }
        }
      },
      "FeedbackRequest": {
        "type": "object",
        "required": [
          "operation_id",
          "expected_revision",
          "control_revision",
          "state",
          "markdown"
        ],
        "properties": {
          "control_revision": {
            "type": "string"
          },
          "expected_revision": {
            "type": "string"
          },
          "markdown": {
            "type": "string"
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          },
          "state": {
            "$ref": "#/components/schemas/FeedbackState"
          }
        },
        "additionalProperties": false
      },
      "FeedbackState": {
        "type": "string",
        "enum": [
          "processing",
          "waiting",
          "completed",
          "stopped",
          "failed"
        ]
      },
      "GoogleLoginRequest": {
        "type": "object",
        "properties": {
          "return_to": {
            "type": [
              "string",
              "null"
            ],
            "description": "Same-origin relative destination, including a query and fragment if present."
          }
        },
        "additionalProperties": false
      },
      "GoogleLoginResponse": {
        "type": "object",
        "required": [
          "authorization_url"
        ],
        "properties": {
          "authorization_url": {
            "type": "string",
            "description": "Google authorization URL with a one-time state, nonce, and PKCE challenge."
          }
        }
      },
      "HandoffTaskRequest": {
        "type": "object",
        "required": [
          "operation_id",
          "expected_task_fields_version",
          "assignee_account_id"
        ],
        "properties": {
          "assignee_account_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "expected_task_fields_version": {
            "$ref": "#/components/schemas/Id"
          },
          "note": {
            "type": [
              "string",
              "null"
            ],
            "description": "Optional handoff explanation, at most 8192 UTF-8 bytes. Published only with a real field change."
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          },
          "status": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/TaskStatus"
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "Heading": {
        "type": "object",
        "required": [
          "id",
          "level",
          "text"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "level": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "text": {
            "type": "string"
          }
        }
      },
      "HealthResponse": {
        "type": "object",
        "required": [
          "status"
        ],
        "properties": {
          "status": {
            "type": "string"
          }
        }
      },
      "HistoryLimits": {
        "type": "object",
        "required": [
          "max_versions",
          "max_bytes"
        ],
        "properties": {
          "max_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "max_versions": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "HistoryPolicy": {
        "type": "string",
        "enum": [
          "standard",
          "limited"
        ]
      },
      "HumanLoginPollResponse": {
        "type": "object",
        "required": [
          "status"
        ],
        "properties": {
          "account_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "expires_at": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "session_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "status": {
            "$ref": "#/components/schemas/LoginStatus"
          }
        }
      },
      "Id": {
        "type": "string",
        "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
        "pattern": "^[A-Za-z0-9]{22}$"
      },
      "IncompleteReason": {
        "type": "string",
        "enum": [
          "work_budget",
          "output_budget"
        ]
      },
      "InputPart": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "id",
              "markdown",
              "kind"
            ],
            "properties": {
              "id": {
                "$ref": "#/components/schemas/Id"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "markdown"
                ]
              },
              "markdown": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "id",
              "resource_id",
              "alt",
              "kind"
            ],
            "properties": {
              "alt": {
                "type": "string"
              },
              "id": {
                "$ref": "#/components/schemas/Id"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "image"
                ]
              },
              "resource_id": {
                "$ref": "#/components/schemas/Id"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "id",
              "source",
              "kind"
            ],
            "properties": {
              "id": {
                "$ref": "#/components/schemas/Id"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "quote"
                ]
              },
              "source": {
                "$ref": "#/components/schemas/Source"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "id",
              "revision_id",
              "kind"
            ],
            "properties": {
              "id": {
                "$ref": "#/components/schemas/Id"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "revision_link"
                ]
              },
              "revision_id": {
                "$ref": "#/components/schemas/Id"
              }
            }
          }
        ],
        "description": "Submitted content. Quote snapshots are supplied only after the workflow verifies their source."
      },
      "JoinDocumentRequest": {
        "type": "object",
        "required": [
          "operation_id"
        ],
        "properties": {
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          }
        },
        "additionalProperties": false
      },
      "Kind": {
        "type": "string",
        "enum": [
          "document",
          "page",
          "message"
        ]
      },
      "LifecycleReceipt": {
        "type": "object",
        "required": [
          "operation_id",
          "document_id",
          "lifecycle_revision",
          "effect"
        ],
        "properties": {
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "effect": {
            "type": "string"
          },
          "lifecycle_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          }
        }
      },
      "LifecycleRequest": {
        "type": "object",
        "required": [
          "operation_id",
          "expected_management_token"
        ],
        "properties": {
          "expected_management_token": {
            "type": "string"
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          }
        },
        "additionalProperties": false
      },
      "LifecycleResponse": {
        "type": "object",
        "required": [
          "document_id",
          "origin",
          "title",
          "current_revision_id",
          "lifecycle_revision",
          "state",
          "sharing",
          "my_access",
          "management_token",
          "collaborators_url",
          "document_url"
        ],
        "properties": {
          "collaborators_url": {
            "type": "string"
          },
          "current_revision_id": {
            "$ref": "#/components/schemas/Id"
          },
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "document_url": {
            "type": "string"
          },
          "lifecycle_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "management_token": {
            "type": "string"
          },
          "my_access": {
            "$ref": "#/components/schemas/DocumentAccessResponse"
          },
          "origin": {
            "$ref": "#/components/schemas/OriginResponse"
          },
          "sharing": {
            "$ref": "#/components/schemas/SharingResponse"
          },
          "state": {
            "$ref": "#/components/schemas/LifecycleState"
          },
          "title": {
            "type": "string"
          },
          "trashed_at": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "trashed_by": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          }
        }
      },
      "LifecycleState": {
        "type": "string",
        "enum": [
          "active",
          "trashed"
        ]
      },
      "LinkType": {
        "type": "string",
        "enum": [
          "current",
          "revision"
        ]
      },
      "LoginConfigResponse": {
        "type": "object",
        "required": [
          "provider",
          "enabled",
          "providers",
          "return_to"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "provider": {
            "type": "string",
            "description": "Default sign-in provider. Only configured providers can be used."
          },
          "providers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LoginProviderResponse"
            }
          },
          "return_to": {
            "type": "string"
          }
        }
      },
      "LoginIdentitiesResponse": {
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LoginIdentityResponse"
            }
          }
        }
      },
      "LoginIdentityResponse": {
        "type": "object",
        "required": [
          "id",
          "provider",
          "created_at"
        ],
        "properties": {
          "avatar_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "integer",
            "format": "int64"
          },
          "display_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "provider": {
            "type": "string"
          }
        }
      },
      "LoginProviderResponse": {
        "type": "object",
        "required": [
          "id",
          "enabled"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "id": {
            "type": "string"
          }
        }
      },
      "LoginStatus": {
        "type": "string",
        "enum": [
          "pending",
          "denied",
          "approved"
        ]
      },
      "LoginSubject": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "user"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "agent_id",
              "kind"
            ],
            "properties": {
              "agent_id": {
                "$ref": "#/components/schemas/Id"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "agent"
                ]
              }
            }
          }
        ]
      },
      "LogoutRequest": {
        "type": "object",
        "properties": {
          "expected_session_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id",
                "description": "Original public Dee session ID. Cookie alone selects the session to revoke."
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "MaintenanceProvenance": {
        "type": "object",
        "required": [
          "kind",
          "recovery_id",
          "previous_revision_id",
          "performed_at"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "description": "Internal recovery transformation, independent of the retained source author."
          },
          "performed_at": {
            "type": "integer",
            "format": "int64"
          },
          "previous_revision_id": {
            "$ref": "#/components/schemas/Id"
          },
          "recovery_id": {
            "$ref": "#/components/schemas/Id"
          }
        }
      },
      "MemberResponse": {
        "type": "object",
        "required": [
          "account_id",
          "role",
          "joined_at"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/Id"
          },
          "avatar_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "display_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "joined_at": {
            "type": "integer",
            "format": "int64"
          },
          "role": {
            "type": "string",
            "description": "editor or administrator."
          }
        }
      },
      "MemberRole": {
        "type": "string",
        "enum": [
          "editor",
          "administrator"
        ]
      },
      "MentionCandidate": {
        "type": "object",
        "required": [
          "agent_id",
          "name",
          "response_mode"
        ],
        "properties": {
          "agent_id": {
            "$ref": "#/components/schemas/Id"
          },
          "name": {
            "type": "string"
          },
          "response_mode": {
            "$ref": "#/components/schemas/ResponseMode"
          }
        }
      },
      "MessagePageResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Paged_MessageResponse"
          },
          {
            "type": "object",
            "properties": {
              "read_boundary_message_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/Id",
                    "description": "Reuse this main/Thread message identity to freeze membership on subsequent pages."
                  }
                ]
              }
            }
          }
        ]
      },
      "MessageResponse": {
        "type": "object",
        "required": [
          "id",
          "document_id",
          "author",
          "parts",
          "mentions",
          "agent_mentions",
          "version",
          "edited",
          "deleted",
          "created_at",
          "updated_at",
          "message_url"
        ],
        "properties": {
          "agent_mentions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Id"
            }
          },
          "agent_record": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/AgentRecord"
              }
            ]
          },
          "author": {
            "$ref": "#/components/schemas/AuthorResponse"
          },
          "created_at": {
            "type": "integer",
            "format": "int64"
          },
          "deleted": {
            "type": "boolean"
          },
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "edited": {
            "type": "boolean"
          },
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "mentions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Id"
            }
          },
          "message_url": {
            "type": "string"
          },
          "parts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PartResponse"
            }
          },
          "thread": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ThreadSummary"
              }
            ]
          },
          "thread_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "thread_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "updated_at": {
            "type": "integer",
            "format": "int64"
          },
          "version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "MoveDocumentRequest": {
        "type": "object",
        "required": [
          "operation_id",
          "expected_structure_version"
        ],
        "properties": {
          "expected_structure_version": {
            "$ref": "#/components/schemas/Id"
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          },
          "parent_document_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "NotificationReadRequest": {
        "type": "object",
        "required": [
          "operation_id",
          "expected_revision"
        ],
        "properties": {
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          }
        },
        "additionalProperties": false
      },
      "NotificationResponse": {
        "type": "object",
        "required": [
          "id",
          "document_id",
          "reasons",
          "read",
          "revision",
          "deleted",
          "created_at",
          "updated_at",
          "read_url",
          "message_url"
        ],
        "properties": {
          "created_at": {
            "type": "integer",
            "format": "int64"
          },
          "deleted": {
            "type": "boolean"
          },
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "message_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "message_url": {
            "type": "string"
          },
          "read": {
            "type": "boolean"
          },
          "read_url": {
            "type": "string"
          },
          "reasons": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Reason"
            }
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "task_activity_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "thread_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "updated_at": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "OriginResponse": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "account_id",
              "kind"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/Id"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "personal"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "space_id",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "space"
                ]
              },
              "space_id": {
                "$ref": "#/components/schemas/Id"
              }
            }
          }
        ]
      },
      "OutlineItem": {
        "type": "object",
        "required": [
          "position",
          "id",
          "level",
          "text",
          "text_truncated",
          "range"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "level": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "position": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "range": {
            "$ref": "#/components/schemas/Selection"
          },
          "text": {
            "type": "string"
          },
          "text_truncated": {
            "type": "boolean"
          }
        }
      },
      "PageContent": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PageSummary"
          },
          {
            "type": "object",
            "required": [
              "markdown"
            ],
            "properties": {
              "markdown": {
                "type": "string"
              }
            }
          }
        ]
      },
      "PageHistoryResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Paged_PageRevisionSummary"
          },
          {
            "type": "object",
            "required": [
              "current_revision_id",
              "history_policy"
            ],
            "properties": {
              "current_revision_id": {
                "$ref": "#/components/schemas/Id"
              },
              "history_limits": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/HistoryLimits"
                  }
                ]
              },
              "history_policy": {
                "$ref": "#/components/schemas/HistoryPolicy"
              }
            }
          }
        ]
      },
      "PageKeyRequest": {
        "type": "object",
        "required": [
          "operation_id",
          "expected_metadata_revision"
        ],
        "properties": {
          "expected_metadata_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "key": {
            "type": [
              "string",
              "null"
            ]
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          }
        },
        "additionalProperties": false
      },
      "PageLifecycleRequest": {
        "type": "object",
        "required": [
          "operation_id",
          "expected_metadata_revision"
        ],
        "properties": {
          "expected_metadata_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "key": {
            "type": [
              "string",
              "null"
            ],
            "description": "Restore may supply a replacement key; omitted/null retains the original key."
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          }
        },
        "additionalProperties": false
      },
      "PageReceipt": {
        "type": "object",
        "required": [
          "operation_id",
          "document_id",
          "page_id",
          "revision_id",
          "metadata_revision",
          "effect",
          "snapshot_hash"
        ],
        "properties": {
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "effect": {
            "type": "string"
          },
          "metadata_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          },
          "page_id": {
            "$ref": "#/components/schemas/Id"
          },
          "revision_id": {
            "$ref": "#/components/schemas/Id"
          },
          "snapshot_hash": {
            "type": "string"
          }
        }
      },
      "PageResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PageContent"
          },
          {
            "type": "object",
            "required": [
              "rendered"
            ],
            "properties": {
              "rendered": {
                "$ref": "#/components/schemas/RenderedMarkdown"
              }
            }
          }
        ]
      },
      "PageRevisionContent": {
        "type": "object",
        "required": [
          "id",
          "document_id",
          "page_id",
          "title",
          "markdown",
          "snapshot_hash",
          "created_by",
          "created_at",
          "document_url",
          "page_url",
          "revision_url"
        ],
        "properties": {
          "created_at": {
            "type": "integer",
            "format": "int64"
          },
          "created_by": {
            "$ref": "#/components/schemas/ActorId"
          },
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "document_url": {
            "type": "string"
          },
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "markdown": {
            "type": "string"
          },
          "page_id": {
            "$ref": "#/components/schemas/Id"
          },
          "page_url": {
            "type": "string"
          },
          "revision_url": {
            "type": "string"
          },
          "snapshot_hash": {
            "type": "string"
          },
          "title": {
            "type": "string"
          }
        }
      },
      "PageRevisionResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PageRevisionContent"
          },
          {
            "type": "object",
            "required": [
              "rendered"
            ],
            "properties": {
              "rendered": {
                "$ref": "#/components/schemas/RenderedMarkdown"
              }
            }
          }
        ]
      },
      "PageRevisionSummary": {
        "type": "object",
        "required": [
          "id",
          "title",
          "snapshot_hash",
          "created_by",
          "created_at",
          "revision_url"
        ],
        "properties": {
          "created_at": {
            "type": "integer",
            "format": "int64"
          },
          "created_by": {
            "$ref": "#/components/schemas/ActorId"
          },
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "revision_url": {
            "type": "string"
          },
          "snapshot_hash": {
            "type": "string"
          },
          "title": {
            "type": "string"
          }
        }
      },
      "PageSummary": {
        "type": "object",
        "required": [
          "id",
          "document_id",
          "title",
          "current_revision_id",
          "metadata_revision",
          "created_at",
          "updated_at",
          "my_role",
          "history_policy",
          "document_url",
          "page_url",
          "revision_url"
        ],
        "properties": {
          "created_at": {
            "type": "integer",
            "format": "int64"
          },
          "current_revision_id": {
            "$ref": "#/components/schemas/Id"
          },
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "document_url": {
            "type": "string"
          },
          "history_limits": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/HistoryLimits"
              }
            ]
          },
          "history_policy": {
            "$ref": "#/components/schemas/HistoryPolicy"
          },
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "key": {
            "type": [
              "string",
              "null"
            ]
          },
          "metadata_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "my_role": {
            "type": "string"
          },
          "page_url": {
            "type": "string"
          },
          "revision_url": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "trashed_at": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "updated_at": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "Paged_AgentConnectionResponse": {
        "type": "object",
        "required": [
          "items",
          "page_index",
          "page_size",
          "total_pages",
          "total_items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "client_name",
                "authorized_at",
                "expires_at",
                "status"
              ],
              "properties": {
                "authorized_at": {
                  "type": "integer",
                  "format": "int64"
                },
                "client_name": {
                  "type": "string"
                },
                "expires_at": {
                  "type": "integer",
                  "format": "int64"
                },
                "id": {
                  "$ref": "#/components/schemas/Id"
                },
                "last_used_at": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "format": "int64"
                },
                "revoked_at": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "format": "int64"
                },
                "status": {
                  "$ref": "#/components/schemas/ConnectionStatus"
                }
              }
            }
          },
          "page_index": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "page_size": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_items": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_pages": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "Paged_AttachmentReference": {
        "type": "object",
        "required": [
          "items",
          "page_index",
          "page_size",
          "total_pages",
          "total_items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "resource",
                "source"
              ],
              "properties": {
                "resource": {
                  "$ref": "#/components/schemas/ResourceMetadata"
                },
                "source": {
                  "$ref": "#/components/schemas/AttachmentSource"
                }
              }
            }
          },
          "page_index": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "page_size": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_items": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_pages": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "Paged_CollaboratorResponse": {
        "type": "object",
        "required": [
          "items",
          "page_index",
          "page_size",
          "total_pages",
          "total_items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "role",
                "joined_at",
                "effective_role",
                "sources"
              ],
              "properties": {
                "account_id": {
                  "oneOf": [
                    {
                      "type": "null"
                    },
                    {
                      "$ref": "#/components/schemas/Id"
                    }
                  ]
                },
                "avatar_url": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "display_name": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "effective_role": {
                  "$ref": "#/components/schemas/AccessRole"
                },
                "joined_at": {
                  "type": "integer",
                  "format": "int64"
                },
                "role": {
                  "$ref": "#/components/schemas/AccessRole"
                },
                "sources": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AccessSourceResponse"
                  }
                },
                "subject": {
                  "oneOf": [
                    {
                      "type": "null"
                    },
                    {
                      "$ref": "#/components/schemas/ActorId"
                    }
                  ]
                }
              }
            }
          },
          "page_index": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "page_size": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_items": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_pages": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "Paged_DocumentLinkSummary": {
        "type": "object",
        "required": [
          "items",
          "page_index",
          "page_size",
          "total_pages",
          "total_items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "title",
                "current_revision_id",
                "document_url",
                "updated_at",
                "link_types"
              ],
              "properties": {
                "current_revision_id": {
                  "$ref": "#/components/schemas/Id"
                },
                "document_url": {
                  "type": "string"
                },
                "id": {
                  "$ref": "#/components/schemas/Id"
                },
                "link_types": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/LinkType"
                  }
                },
                "title": {
                  "type": "string"
                },
                "updated_at": {
                  "type": "integer",
                  "format": "int64",
                  "minimum": 0
                }
              }
            }
          },
          "page_index": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "page_size": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_items": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_pages": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "Paged_DocumentSummary": {
        "type": "object",
        "required": [
          "items",
          "page_index",
          "page_size",
          "total_pages",
          "total_items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "origin",
                "created_by",
                "current_revision_id",
                "title",
                "created_at",
                "updated_at",
                "can_pin",
                "readers_30d",
                "my_role",
                "document_url",
                "revision_url"
              ],
              "properties": {
                "agent_document": {
                  "type": [
                    "boolean",
                    "null"
                  ],
                  "description": "Present only for ordinary documents with an Agent-purpose association record."
                },
                "can_pin": {
                  "type": "boolean",
                  "description": "Current personal holder or Space administrator; direct grants do not confer pin authority."
                },
                "created_at": {
                  "type": "integer",
                  "format": "int64"
                },
                "created_by": {
                  "$ref": "#/components/schemas/ActorId"
                },
                "current_revision_id": {
                  "$ref": "#/components/schemas/Id"
                },
                "document_url": {
                  "type": "string"
                },
                "extension": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Explicit immutable document type. Null uses Markdown."
                },
                "favorited_at": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "format": "int64",
                  "description": "This account's current favorite timestamp, in Unix epoch milliseconds."
                },
                "id": {
                  "$ref": "#/components/schemas/Id"
                },
                "last_viewed_at": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "format": "int64",
                  "description": "This account's last explicitly recorded opening, in Unix epoch milliseconds."
                },
                "my_role": {
                  "type": "string",
                  "description": "Maximum current role. Creator provenance is not an authorization source."
                },
                "origin": {
                  "$ref": "#/components/schemas/OriginResponse"
                },
                "pinned_at": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "format": "int64",
                  "description": "Origin-owned pin time: personal holding or shared Space, in Unix epoch milliseconds."
                },
                "readers_30d": {
                  "type": "integer",
                  "format": "int64",
                  "description": "Distinct accounts that explicitly recorded an opening during the past 30 days.",
                  "minimum": 0
                },
                "response_mode": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Agent response mode projected with the collection; ordinary documents omit it."
                },
                "revision_url": {
                  "type": "string"
                },
                "title": {
                  "type": "string"
                },
                "updated_at": {
                  "type": "integer",
                  "format": "int64"
                }
              }
            }
          },
          "page_index": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "page_size": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_items": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_pages": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "Paged_DocumentTreeNode": {
        "type": "object",
        "required": [
          "items",
          "page_index",
          "page_size",
          "total_pages",
          "total_items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "title",
                "position",
                "document_url",
                "current_revision_id"
              ],
              "properties": {
                "current_revision_id": {
                  "$ref": "#/components/schemas/Id"
                },
                "document_url": {
                  "type": "string"
                },
                "extension": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Explicit stored type; null uses ordinary Markdown, unknown names remain intact."
                },
                "id": {
                  "$ref": "#/components/schemas/Id"
                },
                "parent_document_id": {
                  "oneOf": [
                    {
                      "type": "null"
                    },
                    {
                      "$ref": "#/components/schemas/Id"
                    }
                  ]
                },
                "position": {
                  "type": "integer",
                  "format": "int64"
                },
                "title": {
                  "type": "string"
                }
              }
            }
          },
          "page_index": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "page_size": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_items": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_pages": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "Paged_EntryResponse": {
        "type": "object",
        "required": [
          "items",
          "page_index",
          "page_size",
          "total_pages",
          "total_items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/MessageResponse"
                    },
                    {
                      "type": "object",
                      "required": [
                        "kind"
                      ],
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "message"
                          ]
                        }
                      }
                    }
                  ]
                },
                {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ActivityResponse"
                    },
                    {
                      "type": "object",
                      "required": [
                        "kind"
                      ],
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "activity"
                          ]
                        }
                      }
                    }
                  ]
                }
              ]
            }
          },
          "page_index": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "page_size": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_items": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_pages": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "Paged_MemberResponse": {
        "type": "object",
        "required": [
          "items",
          "page_index",
          "page_size",
          "total_pages",
          "total_items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "account_id",
                "role",
                "joined_at"
              ],
              "properties": {
                "account_id": {
                  "$ref": "#/components/schemas/Id"
                },
                "avatar_url": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "display_name": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "joined_at": {
                  "type": "integer",
                  "format": "int64"
                },
                "role": {
                  "type": "string",
                  "description": "editor or administrator."
                }
              }
            }
          },
          "page_index": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "page_size": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_items": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_pages": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "Paged_MentionCandidate": {
        "type": "object",
        "required": [
          "items",
          "page_index",
          "page_size",
          "total_pages",
          "total_items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "agent_id",
                "name",
                "response_mode"
              ],
              "properties": {
                "agent_id": {
                  "$ref": "#/components/schemas/Id"
                },
                "name": {
                  "type": "string"
                },
                "response_mode": {
                  "$ref": "#/components/schemas/ResponseMode"
                }
              }
            }
          },
          "page_index": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "page_size": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_items": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_pages": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "Paged_MessageResponse": {
        "type": "object",
        "required": [
          "items",
          "page_index",
          "page_size",
          "total_pages",
          "total_items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "document_id",
                "author",
                "parts",
                "mentions",
                "agent_mentions",
                "version",
                "edited",
                "deleted",
                "created_at",
                "updated_at",
                "message_url"
              ],
              "properties": {
                "agent_mentions": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Id"
                  }
                },
                "agent_record": {
                  "oneOf": [
                    {
                      "type": "null"
                    },
                    {
                      "$ref": "#/components/schemas/AgentRecord"
                    }
                  ]
                },
                "author": {
                  "$ref": "#/components/schemas/AuthorResponse"
                },
                "created_at": {
                  "type": "integer",
                  "format": "int64"
                },
                "deleted": {
                  "type": "boolean"
                },
                "document_id": {
                  "$ref": "#/components/schemas/Id"
                },
                "edited": {
                  "type": "boolean"
                },
                "id": {
                  "$ref": "#/components/schemas/Id"
                },
                "mentions": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Id"
                  }
                },
                "message_url": {
                  "type": "string"
                },
                "parts": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PartResponse"
                  }
                },
                "thread": {
                  "oneOf": [
                    {
                      "type": "null"
                    },
                    {
                      "$ref": "#/components/schemas/ThreadSummary"
                    }
                  ]
                },
                "thread_id": {
                  "oneOf": [
                    {
                      "type": "null"
                    },
                    {
                      "$ref": "#/components/schemas/Id"
                    }
                  ]
                },
                "thread_url": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "updated_at": {
                  "type": "integer",
                  "format": "int64"
                },
                "version": {
                  "type": "integer",
                  "format": "int64",
                  "minimum": 0
                }
              }
            }
          },
          "page_index": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "page_size": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_items": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_pages": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "Paged_NotificationResponse": {
        "type": "object",
        "required": [
          "items",
          "page_index",
          "page_size",
          "total_pages",
          "total_items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "document_id",
                "reasons",
                "read",
                "revision",
                "deleted",
                "created_at",
                "updated_at",
                "read_url",
                "message_url"
              ],
              "properties": {
                "created_at": {
                  "type": "integer",
                  "format": "int64"
                },
                "deleted": {
                  "type": "boolean"
                },
                "document_id": {
                  "$ref": "#/components/schemas/Id"
                },
                "id": {
                  "$ref": "#/components/schemas/Id"
                },
                "message_id": {
                  "oneOf": [
                    {
                      "type": "null"
                    },
                    {
                      "$ref": "#/components/schemas/Id"
                    }
                  ]
                },
                "message_url": {
                  "type": "string"
                },
                "read": {
                  "type": "boolean"
                },
                "read_url": {
                  "type": "string"
                },
                "reasons": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Reason"
                  }
                },
                "revision": {
                  "type": "integer",
                  "format": "int64",
                  "minimum": 0
                },
                "task_activity_id": {
                  "oneOf": [
                    {
                      "type": "null"
                    },
                    {
                      "$ref": "#/components/schemas/Id"
                    }
                  ]
                },
                "thread_id": {
                  "oneOf": [
                    {
                      "type": "null"
                    },
                    {
                      "$ref": "#/components/schemas/Id"
                    }
                  ]
                },
                "updated_at": {
                  "type": "integer",
                  "format": "int64"
                }
              }
            }
          },
          "page_index": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "page_size": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_items": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_pages": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "Paged_OutlineItem": {
        "type": "object",
        "required": [
          "items",
          "page_index",
          "page_size",
          "total_pages",
          "total_items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "position",
                "id",
                "level",
                "text",
                "text_truncated",
                "range"
              ],
              "properties": {
                "id": {
                  "type": "string"
                },
                "level": {
                  "type": "integer",
                  "format": "int32",
                  "minimum": 0
                },
                "position": {
                  "type": "integer",
                  "format": "int64",
                  "minimum": 0
                },
                "range": {
                  "$ref": "#/components/schemas/Selection"
                },
                "text": {
                  "type": "string"
                },
                "text_truncated": {
                  "type": "boolean"
                }
              }
            }
          },
          "page_index": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "page_size": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_items": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_pages": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "Paged_PageRevisionSummary": {
        "type": "object",
        "required": [
          "items",
          "page_index",
          "page_size",
          "total_pages",
          "total_items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "title",
                "snapshot_hash",
                "created_by",
                "created_at",
                "revision_url"
              ],
              "properties": {
                "created_at": {
                  "type": "integer",
                  "format": "int64"
                },
                "created_by": {
                  "$ref": "#/components/schemas/ActorId"
                },
                "id": {
                  "$ref": "#/components/schemas/Id"
                },
                "revision_url": {
                  "type": "string"
                },
                "snapshot_hash": {
                  "type": "string"
                },
                "title": {
                  "type": "string"
                }
              }
            }
          },
          "page_index": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "page_size": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_items": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_pages": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "Paged_PageSummary": {
        "type": "object",
        "required": [
          "items",
          "page_index",
          "page_size",
          "total_pages",
          "total_items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "document_id",
                "title",
                "current_revision_id",
                "metadata_revision",
                "created_at",
                "updated_at",
                "my_role",
                "history_policy",
                "document_url",
                "page_url",
                "revision_url"
              ],
              "properties": {
                "created_at": {
                  "type": "integer",
                  "format": "int64"
                },
                "current_revision_id": {
                  "$ref": "#/components/schemas/Id"
                },
                "document_id": {
                  "$ref": "#/components/schemas/Id"
                },
                "document_url": {
                  "type": "string"
                },
                "history_limits": {
                  "oneOf": [
                    {
                      "type": "null"
                    },
                    {
                      "$ref": "#/components/schemas/HistoryLimits"
                    }
                  ]
                },
                "history_policy": {
                  "$ref": "#/components/schemas/HistoryPolicy"
                },
                "id": {
                  "$ref": "#/components/schemas/Id"
                },
                "key": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "metadata_revision": {
                  "type": "integer",
                  "format": "int64",
                  "minimum": 0
                },
                "my_role": {
                  "type": "string"
                },
                "page_url": {
                  "type": "string"
                },
                "revision_url": {
                  "type": "string"
                },
                "title": {
                  "type": "string"
                },
                "trashed_at": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "format": "int64"
                },
                "updated_at": {
                  "type": "integer",
                  "format": "int64"
                }
              }
            }
          },
          "page_index": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "page_size": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_items": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_pages": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "Paged_RevisionSummary": {
        "type": "object",
        "required": [
          "items",
          "page_index",
          "page_size",
          "total_pages",
          "total_items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "title",
                "snapshot_hash",
                "created_by",
                "created_at",
                "revision_url"
              ],
              "properties": {
                "created_at": {
                  "type": "integer",
                  "format": "int64"
                },
                "created_by": {
                  "$ref": "#/components/schemas/ActorId"
                },
                "id": {
                  "$ref": "#/components/schemas/Id"
                },
                "maintenance": {
                  "oneOf": [
                    {
                      "type": "null"
                    },
                    {
                      "$ref": "#/components/schemas/MaintenanceProvenance"
                    }
                  ]
                },
                "revision_url": {
                  "type": "string"
                },
                "snapshot_hash": {
                  "type": "string"
                },
                "title": {
                  "type": "string"
                }
              }
            }
          },
          "page_index": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "page_size": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_items": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_pages": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "Paged_SearchResult": {
        "type": "object",
        "required": [
          "items",
          "page_index",
          "page_size",
          "total_pages",
          "total_items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ResultBase"
                    },
                    {
                      "type": "object",
                      "required": [
                        "revision_id",
                        "revision_url"
                      ],
                      "properties": {
                        "revision_id": {
                          "$ref": "#/components/schemas/Id"
                        },
                        "revision_url": {
                          "type": "string"
                        }
                      }
                    },
                    {
                      "type": "object",
                      "required": [
                        "kind"
                      ],
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "document"
                          ]
                        }
                      }
                    }
                  ]
                },
                {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ResultBase"
                    },
                    {
                      "type": "object",
                      "required": [
                        "page_id",
                        "revision_id",
                        "page_url",
                        "revision_url"
                      ],
                      "properties": {
                        "page_id": {
                          "$ref": "#/components/schemas/Id"
                        },
                        "page_url": {
                          "type": "string"
                        },
                        "revision_id": {
                          "$ref": "#/components/schemas/Id"
                        },
                        "revision_url": {
                          "type": "string"
                        }
                      }
                    },
                    {
                      "type": "object",
                      "required": [
                        "kind"
                      ],
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "page"
                          ]
                        }
                      }
                    }
                  ]
                },
                {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ResultBase"
                    },
                    {
                      "type": "object",
                      "required": [
                        "message_version",
                        "message_url"
                      ],
                      "properties": {
                        "message_url": {
                          "type": "string"
                        },
                        "message_version": {
                          "type": "integer",
                          "format": "int64",
                          "minimum": 0
                        },
                        "thread_id": {
                          "oneOf": [
                            {
                              "type": "null"
                            },
                            {
                              "$ref": "#/components/schemas/Id"
                            }
                          ]
                        }
                      }
                    },
                    {
                      "type": "object",
                      "required": [
                        "kind"
                      ],
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "message"
                          ]
                        }
                      }
                    }
                  ]
                }
              ]
            }
          },
          "page_index": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "page_size": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_items": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_pages": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "Paged_ServiceConnection": {
        "type": "object",
        "required": [
          "items",
          "page_index",
          "page_size",
          "total_pages",
          "total_items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "client_name",
                "authorized_by",
                "authorized_at",
                "last_used_at",
                "expires_at",
                "status"
              ],
              "properties": {
                "authorized_at": {
                  "type": "integer",
                  "format": "int64"
                },
                "authorized_by": {
                  "$ref": "#/components/schemas/Id"
                },
                "client_name": {
                  "type": "string"
                },
                "expires_at": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "format": "int64"
                },
                "id": {
                  "$ref": "#/components/schemas/Id"
                },
                "last_used_at": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "format": "int64"
                },
                "status": {
                  "type": "string"
                }
              }
            }
          },
          "page_index": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "page_size": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_items": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_pages": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "Paged_SpaceResponse": {
        "type": "object",
        "required": [
          "items",
          "page_index",
          "page_size",
          "total_pages",
          "total_items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "name",
                "description",
                "created_by",
                "revision",
                "created_at",
                "updated_at",
                "my_role"
              ],
              "properties": {
                "created_at": {
                  "type": "integer",
                  "format": "int64"
                },
                "created_by": {
                  "$ref": "#/components/schemas/Id"
                },
                "description": {
                  "type": "string"
                },
                "id": {
                  "$ref": "#/components/schemas/Id"
                },
                "my_role": {
                  "type": "string",
                  "description": "editor or administrator; current member role in this Space only."
                },
                "name": {
                  "type": "string"
                },
                "overview_document_id": {
                  "oneOf": [
                    {
                      "type": "null"
                    },
                    {
                      "$ref": "#/components/schemas/Id",
                      "description": "A stable document identity; the reference is retained while the document is trashed."
                    }
                  ]
                },
                "overview_document_url": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "revision": {
                  "type": "integer",
                  "format": "int64"
                },
                "updated_at": {
                  "type": "integer",
                  "format": "int64"
                }
              }
            }
          },
          "page_index": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "page_size": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_items": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_pages": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "Paged_StateResponse": {
        "type": "object",
        "required": [
          "items",
          "page_index",
          "page_size",
          "total_pages",
          "total_items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "document_id",
                "following",
                "muted",
                "revision",
                "unread_messages",
                "unread_mentions"
              ],
              "properties": {
                "document_id": {
                  "$ref": "#/components/schemas/Id"
                },
                "following": {
                  "type": "boolean"
                },
                "last_message_id": {
                  "oneOf": [
                    {
                      "type": "null"
                    },
                    {
                      "$ref": "#/components/schemas/Id"
                    }
                  ]
                },
                "muted": {
                  "type": "boolean"
                },
                "read_message_id": {
                  "oneOf": [
                    {
                      "type": "null"
                    },
                    {
                      "$ref": "#/components/schemas/Id"
                    }
                  ]
                },
                "revision": {
                  "type": "integer",
                  "format": "int64",
                  "minimum": 0
                },
                "thread_id": {
                  "oneOf": [
                    {
                      "type": "null"
                    },
                    {
                      "$ref": "#/components/schemas/Id"
                    }
                  ]
                },
                "unread_mentions": {
                  "type": "integer",
                  "format": "int64",
                  "minimum": 0
                },
                "unread_messages": {
                  "type": "integer",
                  "format": "int64",
                  "minimum": 0
                }
              }
            }
          },
          "page_index": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "page_size": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_items": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_pages": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "Paged_TaskActivity": {
        "type": "object",
        "required": [
          "items",
          "page_index",
          "page_size",
          "total_pages",
          "total_items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "document_id",
                "revision_id",
                "kind",
                "actor_id",
                "actor_kind",
                "new_fields",
                "created_at"
              ],
              "properties": {
                "actor_id": {
                  "$ref": "#/components/schemas/Id"
                },
                "actor_kind": {
                  "$ref": "#/components/schemas/TaskActorKind"
                },
                "created_at": {
                  "type": "integer",
                  "format": "int64"
                },
                "document_id": {
                  "$ref": "#/components/schemas/Id"
                },
                "id": {
                  "$ref": "#/components/schemas/Id"
                },
                "kind": {
                  "$ref": "#/components/schemas/TaskActivityKind"
                },
                "new_fields": {
                  "$ref": "#/components/schemas/TaskFields"
                },
                "note": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "old_fields": {
                  "oneOf": [
                    {
                      "type": "null"
                    },
                    {
                      "$ref": "#/components/schemas/TaskFields"
                    }
                  ]
                },
                "revision_id": {
                  "$ref": "#/components/schemas/Id"
                }
              }
            }
          },
          "page_index": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "page_size": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_items": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_pages": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "Paged_TaskSummary": {
        "type": "object",
        "required": [
          "items",
          "page_index",
          "page_size",
          "total_pages",
          "total_items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/TaskFields"
                },
                {
                  "type": "object",
                  "required": [
                    "id",
                    "origin",
                    "title",
                    "current_revision_id",
                    "task_fields_version",
                    "description_version",
                    "created_at",
                    "updated_at",
                    "document_url",
                    "revision_url"
                  ],
                  "properties": {
                    "created_at": {
                      "type": "integer",
                      "format": "int64"
                    },
                    "current_revision_id": {
                      "$ref": "#/components/schemas/Id"
                    },
                    "description_version": {
                      "$ref": "#/components/schemas/Id"
                    },
                    "document_url": {
                      "type": "string"
                    },
                    "id": {
                      "$ref": "#/components/schemas/Id"
                    },
                    "origin": {
                      "$ref": "#/components/schemas/OriginResponse"
                    },
                    "revision_url": {
                      "type": "string"
                    },
                    "task_fields_version": {
                      "$ref": "#/components/schemas/Id"
                    },
                    "title": {
                      "type": "string"
                    },
                    "updated_at": {
                      "type": "integer",
                      "format": "int64"
                    }
                  }
                }
              ]
            }
          },
          "page_index": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "page_size": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_items": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_pages": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "Paged_TrashSummary": {
        "type": "object",
        "required": [
          "items",
          "page_index",
          "page_size",
          "total_pages",
          "total_items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "document_id",
                "origin",
                "title",
                "current_revision_id",
                "lifecycle_revision",
                "state",
                "trashed_at",
                "trashed_by",
                "created_at",
                "updated_at",
                "management_url",
                "document_url"
              ],
              "properties": {
                "created_at": {
                  "type": "integer",
                  "format": "int64"
                },
                "current_revision_id": {
                  "$ref": "#/components/schemas/Id"
                },
                "document_id": {
                  "$ref": "#/components/schemas/Id"
                },
                "document_url": {
                  "type": "string"
                },
                "lifecycle_revision": {
                  "type": "integer",
                  "format": "int64",
                  "minimum": 0
                },
                "management_url": {
                  "type": "string"
                },
                "origin": {
                  "$ref": "#/components/schemas/OriginResponse"
                },
                "state": {
                  "$ref": "#/components/schemas/LifecycleState"
                },
                "title": {
                  "type": "string"
                },
                "trashed_at": {
                  "type": "integer",
                  "format": "int64"
                },
                "trashed_by": {
                  "$ref": "#/components/schemas/Id"
                },
                "updated_at": {
                  "type": "integer",
                  "format": "int64"
                }
              }
            }
          },
          "page_index": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "page_size": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_items": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_pages": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "Part": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "id",
              "markdown",
              "kind"
            ],
            "properties": {
              "id": {
                "$ref": "#/components/schemas/Id"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "markdown"
                ]
              },
              "markdown": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "id",
              "resource_id",
              "alt",
              "kind"
            ],
            "properties": {
              "alt": {
                "type": "string"
              },
              "id": {
                "$ref": "#/components/schemas/Id"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "image"
                ]
              },
              "resource_id": {
                "$ref": "#/components/schemas/Id"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "id",
              "source",
              "snapshot",
              "kind"
            ],
            "properties": {
              "id": {
                "$ref": "#/components/schemas/Id"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "quote"
                ]
              },
              "snapshot": {
                "type": "string"
              },
              "source": {
                "$ref": "#/components/schemas/Source"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "id",
              "revision_id",
              "kind"
            ],
            "properties": {
              "id": {
                "$ref": "#/components/schemas/Id"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "revision_link"
                ]
              },
              "revision_id": {
                "$ref": "#/components/schemas/Id"
              }
            }
          }
        ],
        "description": "Persisted ordered content. The quote snapshot is the verified Markdown at publication time."
      },
      "PartResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Part"
          },
          {
            "type": "object",
            "properties": {
              "source_status": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "source_url": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        ]
      },
      "PersonalDocumentTree": {
        "type": "object",
        "required": [
          "account_id",
          "structure_version",
          "documents"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/Id"
          },
          "documents": {
            "$ref": "#/components/schemas/Paged_DocumentTreeNode"
          },
          "structure_version": {
            "$ref": "#/components/schemas/Id"
          }
        }
      },
      "PinReceipt": {
        "type": "object",
        "description": "A minimal original result; it does not grant current document access.",
        "required": [
          "operation_id",
          "document_id",
          "pinned",
          "pin_revision",
          "effect"
        ],
        "properties": {
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "effect": {
            "type": "string"
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          },
          "pin_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "pinned": {
            "type": "boolean"
          },
          "pinned_at": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          }
        },
        "additionalProperties": false
      },
      "PinRequest": {
        "type": "object",
        "required": [
          "operation_id",
          "pinned"
        ],
        "properties": {
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          },
          "pinned": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "PinResponse": {
        "type": "object",
        "required": [
          "document_id",
          "pinned",
          "can_pin"
        ],
        "properties": {
          "can_pin": {
            "type": "boolean"
          },
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "pinned": {
            "type": "boolean"
          },
          "pinned_at": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          }
        }
      },
      "PlanChange": {
        "type": "object",
        "required": [
          "id",
          "target",
          "action",
          "description"
        ],
        "properties": {
          "action": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "target": {
            "$ref": "#/components/schemas/Target"
          }
        },
        "additionalProperties": false
      },
      "PlanRead": {
        "type": "object",
        "required": [
          "plan_id",
          "document_id",
          "root_message_id",
          "snapshot",
          "superseded_by_plan_id",
          "current_decision",
          "current_qualification",
          "created_documents",
          "control",
          "execution"
        ],
        "properties": {
          "control": {
            "$ref": "#/components/schemas/Control"
          },
          "created_documents": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreatedDocument"
            }
          },
          "current_decision": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Decision"
              }
            ]
          },
          "current_qualification": {
            "description": "External qualification submission is reserved for a later implementation."
          },
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "execution": {
            "$ref": "#/components/schemas/Execution"
          },
          "plan_id": {
            "$ref": "#/components/schemas/Id"
          },
          "root_message_id": {
            "$ref": "#/components/schemas/Id"
          },
          "snapshot": {
            "$ref": "#/components/schemas/PlanSnapshot"
          },
          "superseded_by_plan_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          }
        }
      },
      "PlanReceipt": {
        "type": "object",
        "required": [
          "operation_id",
          "plan_id",
          "message_url"
        ],
        "properties": {
          "message_url": {
            "type": "string"
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          },
          "plan_id": {
            "$ref": "#/components/schemas/Id"
          }
        }
      },
      "PlanRequest": {
        "type": "object",
        "required": [
          "operation_id",
          "root_message_id",
          "expected_control_revision",
          "markdown",
          "executor_agent_ids",
          "changes",
          "replaces_plan_id"
        ],
        "properties": {
          "changes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlanChange"
            }
          },
          "executor_agent_ids": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Id"
            }
          },
          "expected_control_revision": {
            "type": "string"
          },
          "markdown": {
            "type": "string"
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          },
          "replaces_plan_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "root_message_id": {
            "$ref": "#/components/schemas/Id"
          }
        },
        "additionalProperties": false
      },
      "PlanSnapshot": {
        "type": "object",
        "required": [
          "author",
          "created_at",
          "markdown",
          "executor_agent_ids",
          "changes",
          "replaces_plan_id"
        ],
        "properties": {
          "author": {
            "$ref": "#/components/schemas/ActorId"
          },
          "changes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlanChange"
            }
          },
          "created_at": {
            "type": "integer",
            "format": "int64"
          },
          "executor_agent_ids": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Id"
            }
          },
          "markdown": {
            "type": "string"
          },
          "replaces_plan_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          }
        }
      },
      "PreferencesRequest": {
        "type": "object",
        "required": [
          "operation_id",
          "expected_revision"
        ],
        "properties": {
          "expected_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "following": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "muted": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          }
        },
        "additionalProperties": false
      },
      "ProtocolControlReceipt": {
        "type": "object",
        "required": [
          "operation_id",
          "document_id",
          "root_message_id",
          "revision",
          "state",
          "message_url"
        ],
        "properties": {
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "message_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          },
          "revision": {
            "type": "string"
          },
          "root_message_id": {
            "$ref": "#/components/schemas/Id"
          },
          "state": {
            "$ref": "#/components/schemas/ControlState"
          }
        }
      },
      "ProtocolOperation": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "receipt",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "plan"
                ]
              },
              "receipt": {
                "$ref": "#/components/schemas/PlanReceipt"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "receipt",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "decision"
                ]
              },
              "receipt": {
                "$ref": "#/components/schemas/DecisionReceipt"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "receipt",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "control"
                ]
              },
              "receipt": {
                "$ref": "#/components/schemas/ProtocolControlReceipt"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "receipt",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "feedback"
                ]
              },
              "receipt": {
                "$ref": "#/components/schemas/FeedbackReceipt"
              }
            }
          }
        ]
      },
      "ProtocolOperationResponse": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "receipt",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "configuration"
                ]
              },
              "receipt": {
                "$ref": "#/components/schemas/AgentConfigurationReceipt"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "receipt",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "plan"
                ]
              },
              "receipt": {
                "$ref": "#/components/schemas/PlanReceipt"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "receipt",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "decision"
                ]
              },
              "receipt": {
                "$ref": "#/components/schemas/DecisionReceipt"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "receipt",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "control"
                ]
              },
              "receipt": {
                "$ref": "#/components/schemas/ProtocolControlReceipt"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "receipt",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "feedback"
                ]
              },
              "receipt": {
                "$ref": "#/components/schemas/FeedbackReceipt"
              }
            }
          }
        ]
      },
      "ReadRequest": {
        "type": "object",
        "required": [
          "operation_id",
          "message_id"
        ],
        "properties": {
          "message_id": {
            "$ref": "#/components/schemas/Id"
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          }
        },
        "additionalProperties": false
      },
      "ReadyResponse": {
        "type": "object",
        "required": [
          "status"
        ],
        "properties": {
          "status": {
            "type": "string"
          }
        }
      },
      "Reason": {
        "type": "string",
        "enum": [
          "mentioned",
          "thread_reply",
          "task_assignment"
        ]
      },
      "Receipt": {
        "type": "object",
        "description": "Minimal original result; it grants no permission to retrieve current message content.",
        "required": [
          "operation_id",
          "document_id",
          "message_id",
          "version",
          "effect",
          "snapshot_hash"
        ],
        "properties": {
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "effect": {
            "type": "string"
          },
          "message_id": {
            "$ref": "#/components/schemas/Id"
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          },
          "snapshot_hash": {
            "type": "string"
          },
          "thread_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "ReceiptResponse": {
        "type": "object",
        "required": [
          "operation_id",
          "space_id",
          "revision",
          "effect"
        ],
        "properties": {
          "effect": {
            "type": "string"
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          },
          "revision": {
            "type": "integer",
            "format": "int64"
          },
          "role": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/MemberRole"
              }
            ]
          },
          "space_id": {
            "$ref": "#/components/schemas/Id"
          },
          "target_account_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          }
        }
      },
      "RelatedDocumentReceipt": {
        "type": "object",
        "required": [
          "operation_id",
          "document_id",
          "related_document_id"
        ],
        "properties": {
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          },
          "related_document_id": {
            "$ref": "#/components/schemas/Id"
          }
        }
      },
      "RemoveAgentGrantRequest": {
        "type": "object",
        "required": [
          "operation_id",
          "expected_revision"
        ],
        "properties": {
          "expected_revision": {
            "type": "integer",
            "format": "int64"
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          }
        },
        "additionalProperties": false
      },
      "RemoveCollaboratorRequest": {
        "type": "object",
        "required": [
          "operation_id",
          "expected_revision"
        ],
        "properties": {
          "expected_revision": {
            "type": "integer",
            "format": "int64"
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          }
        },
        "additionalProperties": false
      },
      "RenderedMarkdown": {
        "type": "object",
        "required": [
          "html",
          "toc"
        ],
        "properties": {
          "html": {
            "type": "string"
          },
          "toc": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Heading"
            }
          }
        }
      },
      "ResolveAccountRequest": {
        "type": "object",
        "required": [
          "email"
        ],
        "properties": {
          "email": {
            "type": "string",
            "description": "A complete verified email address, never a display-name or prefix search."
          }
        },
        "additionalProperties": false
      },
      "ResolvedAccountResponse": {
        "type": "object",
        "required": [
          "id",
          "matched_email"
        ],
        "properties": {
          "avatar_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "display_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "matched_email": {
            "type": "string",
            "description": "Echoes the requested email instead of exposing other email addresses."
          }
        }
      },
      "ResourceMetadata": {
        "type": "object",
        "required": [
          "resource_id",
          "filename",
          "state",
          "sha256",
          "byte_size",
          "content_type",
          "content_url"
        ],
        "properties": {
          "byte_size": {
            "type": "integer",
            "format": "int64"
          },
          "content_type": {
            "type": "string"
          },
          "content_url": {
            "type": "string"
          },
          "document_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "filename": {
            "type": "string"
          },
          "resource_id": {
            "$ref": "#/components/schemas/Id"
          },
          "sha256": {
            "type": "string"
          },
          "state": {
            "type": "string"
          }
        }
      },
      "ResponseMode": {
        "type": "string",
        "enum": [
          "mention",
          "automatic"
        ]
      },
      "RestoreTaskDescriptionRequest": {
        "type": "object",
        "required": [
          "operation_id",
          "source_revision_id",
          "expected_description_version"
        ],
        "properties": {
          "expected_description_version": {
            "$ref": "#/components/schemas/Id"
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          },
          "source_revision_id": {
            "$ref": "#/components/schemas/Id"
          }
        },
        "additionalProperties": false
      },
      "RestoreTaskSourceRequest": {
        "type": "object",
        "required": [
          "operation_id",
          "source_revision_id",
          "expected_revision_id"
        ],
        "properties": {
          "expected_revision_id": {
            "$ref": "#/components/schemas/Id"
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          },
          "source_revision_id": {
            "$ref": "#/components/schemas/Id"
          }
        },
        "additionalProperties": false
      },
      "ResultBase": {
        "type": "object",
        "required": [
          "id",
          "document_id",
          "title",
          "created_at",
          "updated_at",
          "document_url",
          "excerpt"
        ],
        "properties": {
          "created_at": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "document_url": {
            "type": "string"
          },
          "excerpt": {
            "$ref": "#/components/schemas/Excerpt"
          },
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "title": {
            "type": "string"
          },
          "updated_at": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "RevisionContent": {
        "type": "object",
        "required": [
          "id",
          "document_id",
          "title",
          "markdown",
          "snapshot_hash",
          "created_by",
          "created_at",
          "document_url",
          "revision_url"
        ],
        "properties": {
          "created_at": {
            "type": "integer",
            "format": "int64"
          },
          "created_by": {
            "$ref": "#/components/schemas/ActorId"
          },
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "document_url": {
            "type": "string"
          },
          "extension": {
            "type": [
              "string",
              "null"
            ],
            "description": "Explicit immutable document type. Null uses Markdown."
          },
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "maintenance": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/MaintenanceProvenance"
              }
            ]
          },
          "markdown": {
            "type": "string"
          },
          "revision_url": {
            "type": "string"
          },
          "snapshot_hash": {
            "type": "string"
          },
          "title": {
            "type": "string"
          }
        }
      },
      "RevisionDiffResponse": {
        "type": "object",
        "required": [
          "document_id",
          "from_revision_id",
          "to_revision_id",
          "title_before",
          "title_after",
          "has_changes",
          "complete",
          "incomplete_reason",
          "markdown_diff"
        ],
        "properties": {
          "complete": {
            "type": "boolean"
          },
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "from_revision_id": {
            "$ref": "#/components/schemas/Id"
          },
          "has_changes": {
            "type": "boolean"
          },
          "incomplete_reason": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/IncompleteReason"
              }
            ]
          },
          "markdown_diff": {
            "type": [
              "string",
              "null"
            ]
          },
          "title_after": {
            "type": "string"
          },
          "title_before": {
            "type": "string"
          },
          "to_revision_id": {
            "$ref": "#/components/schemas/Id"
          }
        }
      },
      "RevisionHistoryResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Paged_RevisionSummary"
          },
          {
            "type": "object",
            "required": [
              "current_revision_id"
            ],
            "properties": {
              "current_revision_id": {
                "$ref": "#/components/schemas/Id"
              }
            }
          }
        ]
      },
      "RevisionRequest": {
        "type": "object",
        "required": [
          "operation_id",
          "expected_revision"
        ],
        "properties": {
          "expected_revision": {
            "type": "integer",
            "format": "int64"
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          }
        },
        "additionalProperties": false
      },
      "RevisionResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/RevisionContent"
          },
          {
            "type": "object",
            "required": [
              "rendered"
            ],
            "properties": {
              "rendered": {
                "$ref": "#/components/schemas/RenderedMarkdown"
              }
            }
          }
        ]
      },
      "RevisionSummary": {
        "type": "object",
        "required": [
          "id",
          "title",
          "snapshot_hash",
          "created_by",
          "created_at",
          "revision_url"
        ],
        "properties": {
          "created_at": {
            "type": "integer",
            "format": "int64"
          },
          "created_by": {
            "$ref": "#/components/schemas/ActorId"
          },
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "maintenance": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/MaintenanceProvenance"
              }
            ]
          },
          "revision_url": {
            "type": "string"
          },
          "snapshot_hash": {
            "type": "string"
          },
          "title": {
            "type": "string"
          }
        }
      },
      "RevokeConnectionsRequest": {
        "type": "object",
        "required": [
          "expected_generation"
        ],
        "properties": {
          "expected_generation": {
            "type": "string",
            "description": "Use the generation returned by the reviewed connection list."
          }
        },
        "additionalProperties": false
      },
      "SaveDocumentRequest": {
        "type": "object",
        "required": [
          "operation_id",
          "expected_revision_id",
          "title",
          "markdown"
        ],
        "properties": {
          "agent_context": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/AgentContext"
              }
            ]
          },
          "expected_revision_id": {
            "$ref": "#/components/schemas/Id"
          },
          "markdown": {
            "type": "string"
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          },
          "title": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "SavePageRequest": {
        "type": "object",
        "required": [
          "operation_id",
          "expected_revision_id",
          "title",
          "markdown"
        ],
        "properties": {
          "expected_revision_id": {
            "$ref": "#/components/schemas/Id"
          },
          "markdown": {
            "type": "string"
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          },
          "title": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "Scope": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "owner_account_id",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "personal"
                ]
              },
              "owner_account_id": {
                "$ref": "#/components/schemas/Id"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "space_id",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "space"
                ]
              },
              "space_id": {
                "$ref": "#/components/schemas/Id"
              }
            }
          }
        ]
      },
      "SearchRequest": {
        "type": "object",
        "required": [
          "terms"
        ],
        "properties": {
          "document_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id",
                "description": "Required for document scope; otherwise intersects the selected mine or Space scope."
              }
            ]
          },
          "kinds": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Kind"
            },
            "maxItems": 3,
            "minItems": 1
          },
          "order_by": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "page_index": {
            "type": "integer",
            "format": "int64",
            "default": 0,
            "maximum": 9007199254740991,
            "minimum": 0
          },
          "page_size": {
            "type": "integer",
            "format": "int64",
            "default": 50,
            "maximum": 100,
            "minimum": 0
          },
          "scope": {
            "$ref": "#/components/schemas/SearchScope",
            "description": "Omitted: infer space from non-null `space_id`, otherwise mine. Document requires `document_id` and no `space_id`. Explicit null is invalid."
          },
          "space_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "terms": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "AND of 1-16 literal strings. Each 1-256 UTF-8 bytes, total at most 2048 bytes; no NUL.",
            "maxItems": 16,
            "minItems": 1
          }
        },
        "additionalProperties": false
      },
      "SearchResult": {
        "oneOf": [
          {
            "allOf": [
              {
                "$ref": "#/components/schemas/ResultBase"
              },
              {
                "type": "object",
                "required": [
                  "revision_id",
                  "revision_url"
                ],
                "properties": {
                  "revision_id": {
                    "$ref": "#/components/schemas/Id"
                  },
                  "revision_url": {
                    "type": "string"
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "kind"
                ],
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "document"
                    ]
                  }
                }
              }
            ]
          },
          {
            "allOf": [
              {
                "$ref": "#/components/schemas/ResultBase"
              },
              {
                "type": "object",
                "required": [
                  "page_id",
                  "revision_id",
                  "page_url",
                  "revision_url"
                ],
                "properties": {
                  "page_id": {
                    "$ref": "#/components/schemas/Id"
                  },
                  "page_url": {
                    "type": "string"
                  },
                  "revision_id": {
                    "$ref": "#/components/schemas/Id"
                  },
                  "revision_url": {
                    "type": "string"
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "kind"
                ],
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "page"
                    ]
                  }
                }
              }
            ]
          },
          {
            "allOf": [
              {
                "$ref": "#/components/schemas/ResultBase"
              },
              {
                "type": "object",
                "required": [
                  "message_version",
                  "message_url"
                ],
                "properties": {
                  "message_url": {
                    "type": "string"
                  },
                  "message_version": {
                    "type": "integer",
                    "format": "int64",
                    "minimum": 0
                  },
                  "thread_id": {
                    "oneOf": [
                      {
                        "type": "null"
                      },
                      {
                        "$ref": "#/components/schemas/Id"
                      }
                    ]
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "kind"
                ],
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "message"
                    ]
                  }
                }
              }
            ]
          }
        ]
      },
      "SearchScope": {
        "type": "string",
        "enum": [
          "mine",
          "space",
          "document"
        ]
      },
      "Selection": {
        "type": "object",
        "description": "A half-open UTF-8 byte range in the source Markdown, checked against source bytes by workflows.",
        "required": [
          "start",
          "end"
        ],
        "properties": {
          "end": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "start": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        },
        "additionalProperties": false
      },
      "SendRequest": {
        "type": "object",
        "required": [
          "operation_id",
          "parts"
        ],
        "properties": {
          "agent_mentions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Id"
            }
          },
          "mentions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Id"
            }
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          },
          "parts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InputPart"
            }
          },
          "reply_to": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "ServiceConnection": {
        "type": "object",
        "required": [
          "id",
          "client_name",
          "authorized_by",
          "authorized_at",
          "last_used_at",
          "expires_at",
          "status"
        ],
        "properties": {
          "authorized_at": {
            "type": "integer",
            "format": "int64"
          },
          "authorized_by": {
            "$ref": "#/components/schemas/Id"
          },
          "client_name": {
            "type": "string"
          },
          "expires_at": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "last_used_at": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "status": {
            "type": "string"
          }
        }
      },
      "ServiceLoginPollResponse": {
        "type": "object",
        "required": [
          "status",
          "actor",
          "connection_id",
          "expires_at"
        ],
        "properties": {
          "actor": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/AgentLoginActor"
              }
            ]
          },
          "connection_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "expires_at": {
            "default": null
          },
          "status": {
            "$ref": "#/components/schemas/LoginStatus"
          }
        }
      },
      "SessionResponse": {
        "type": "object",
        "required": [
          "id",
          "expires_at"
        ],
        "properties": {
          "expires_at": {
            "type": "integer",
            "format": "int64",
            "description": "Epoch seconds of the persisted Dee session expiry, established at login."
          },
          "id": {
            "$ref": "#/components/schemas/Id"
          }
        }
      },
      "SetCollaboratorRequest": {
        "type": "object",
        "required": [
          "operation_id",
          "expected_revision",
          "role"
        ],
        "properties": {
          "expected_revision": {
            "type": "integer",
            "format": "int64"
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          },
          "role": {
            "$ref": "#/components/schemas/AccessRole"
          }
        },
        "additionalProperties": false
      },
      "SetRoleRequest": {
        "type": "object",
        "required": [
          "operation_id",
          "expected_revision",
          "role"
        ],
        "properties": {
          "expected_revision": {
            "type": "integer",
            "format": "int64"
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          },
          "role": {
            "$ref": "#/components/schemas/MemberRole"
          }
        },
        "additionalProperties": false
      },
      "SetSharingRequest": {
        "type": "object",
        "required": [
          "operation_id",
          "expected_revision",
          "enabled",
          "role"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "expected_revision": {
            "type": "integer",
            "format": "int64"
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          },
          "role": {
            "$ref": "#/components/schemas/AccessRole"
          }
        },
        "additionalProperties": false
      },
      "SharingResponse": {
        "type": "object",
        "required": [
          "document_id",
          "revision",
          "link_enabled"
        ],
        "properties": {
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "link_enabled": {
            "type": "boolean"
          },
          "link_role": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/AccessRole"
              }
            ]
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "description": "Access revision, independent of the main-body Revision; zero before the first access write."
          }
        }
      },
      "Source": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "entry_id",
              "kind"
            ],
            "properties": {
              "entry_id": {
                "$ref": "#/components/schemas/Id"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "activity"
                ]
              },
              "range": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/Selection"
                  }
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "revision_id",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "revision"
                ]
              },
              "range": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/Selection"
                  }
                ]
              },
              "revision_id": {
                "$ref": "#/components/schemas/Id"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "page_id",
              "revision_id",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "page_revision"
                ]
              },
              "page_id": {
                "$ref": "#/components/schemas/Id"
              },
              "range": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/Selection"
                  }
                ]
              },
              "revision_id": {
                "$ref": "#/components/schemas/Id"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "message_id",
              "expected_version",
              "kind"
            ],
            "properties": {
              "expected_version": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "kind": {
                "type": "string",
                "enum": [
                  "message"
                ]
              },
              "message_id": {
                "$ref": "#/components/schemas/Id"
              },
              "part_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/Id"
                  }
                ]
              },
              "range": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/Selection"
                  }
                ]
              }
            }
          }
        ],
        "description": "Source identity remains separate from a quote's retained text and the receiving Thread."
      },
      "SourceBase": {
        "type": "object",
        "required": [
          "document_id",
          "revision_id",
          "title",
          "total_bytes",
          "document_url",
          "revision_url"
        ],
        "properties": {
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "document_url": {
            "type": "string"
          },
          "revision_id": {
            "$ref": "#/components/schemas/Id"
          },
          "revision_url": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "total_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "SourceResponse": {
        "oneOf": [
          {
            "allOf": [
              {
                "$ref": "#/components/schemas/SourceBase"
              },
              {
                "type": "object",
                "required": [
                  "markdown",
                  "range"
                ],
                "properties": {
                  "markdown": {
                    "type": "string"
                  },
                  "next_range": {
                    "oneOf": [
                      {
                        "type": "null"
                      },
                      {
                        "$ref": "#/components/schemas/Selection"
                      }
                    ]
                  },
                  "range": {
                    "$ref": "#/components/schemas/Selection"
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "view"
                ],
                "properties": {
                  "view": {
                    "type": "string",
                    "enum": [
                      "markdown"
                    ]
                  }
                }
              }
            ]
          },
          {
            "allOf": [
              {
                "$ref": "#/components/schemas/SourceBase"
              },
              {
                "$ref": "#/components/schemas/Paged_OutlineItem"
              },
              {
                "type": "object",
                "properties": {
                  "preamble_range": {
                    "oneOf": [
                      {
                        "type": "null"
                      },
                      {
                        "$ref": "#/components/schemas/Selection"
                      }
                    ]
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "view"
                ],
                "properties": {
                  "view": {
                    "type": "string",
                    "enum": [
                      "outline"
                    ]
                  }
                }
              }
            ]
          }
        ]
      },
      "SpaceDocumentTree": {
        "type": "object",
        "required": [
          "space_id",
          "structure_version",
          "documents"
        ],
        "properties": {
          "documents": {
            "$ref": "#/components/schemas/Paged_DocumentTreeNode"
          },
          "space_id": {
            "$ref": "#/components/schemas/Id"
          },
          "structure_version": {
            "$ref": "#/components/schemas/Id"
          }
        }
      },
      "SpaceResponse": {
        "type": "object",
        "required": [
          "id",
          "name",
          "description",
          "created_by",
          "revision",
          "created_at",
          "updated_at",
          "my_role"
        ],
        "properties": {
          "created_at": {
            "type": "integer",
            "format": "int64"
          },
          "created_by": {
            "$ref": "#/components/schemas/Id"
          },
          "description": {
            "type": "string"
          },
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "my_role": {
            "type": "string",
            "description": "editor or administrator; current member role in this Space only."
          },
          "name": {
            "type": "string"
          },
          "overview_document_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id",
                "description": "A stable document identity; the reference is retained while the document is trashed."
              }
            ]
          },
          "overview_document_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "revision": {
            "type": "integer",
            "format": "int64"
          },
          "updated_at": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "StateResponse": {
        "type": "object",
        "required": [
          "document_id",
          "following",
          "muted",
          "revision",
          "unread_messages",
          "unread_mentions"
        ],
        "properties": {
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "following": {
            "type": "boolean"
          },
          "last_message_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "muted": {
            "type": "boolean"
          },
          "read_message_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "thread_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "unread_mentions": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unread_messages": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "SummaryResponse": {
        "type": "object",
        "required": [
          "unread_notifications",
          "unread_messages",
          "unread_mentions",
          "followed_threads"
        ],
        "properties": {
          "followed_threads": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unread_mentions": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unread_messages": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unread_notifications": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "Target": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "document_id",
              "kind"
            ],
            "properties": {
              "document_id": {
                "$ref": "#/components/schemas/Id"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "dee_document"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "origin",
              "parent_document_id",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "dee_document_create"
                ]
              },
              "origin": {
                "$ref": "#/components/schemas/Scope"
              },
              "parent_document_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/Id"
                  }
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "system",
              "resource",
              "display_name",
              "kind"
            ],
            "properties": {
              "display_name": {
                "type": "string"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "external"
                ]
              },
              "resource": {
                "type": "string"
              },
              "system": {
                "type": "string"
              }
            }
          }
        ]
      },
      "TaskActivity": {
        "type": "object",
        "required": [
          "id",
          "document_id",
          "revision_id",
          "kind",
          "actor_id",
          "actor_kind",
          "new_fields",
          "created_at"
        ],
        "properties": {
          "actor_id": {
            "$ref": "#/components/schemas/Id"
          },
          "actor_kind": {
            "$ref": "#/components/schemas/TaskActorKind"
          },
          "created_at": {
            "type": "integer",
            "format": "int64"
          },
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "kind": {
            "$ref": "#/components/schemas/TaskActivityKind"
          },
          "new_fields": {
            "$ref": "#/components/schemas/TaskFields"
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "old_fields": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/TaskFields"
              }
            ]
          },
          "revision_id": {
            "$ref": "#/components/schemas/Id"
          }
        }
      },
      "TaskActivityKind": {
        "type": "string",
        "enum": [
          "created",
          "fields_changed"
        ]
      },
      "TaskActorKind": {
        "type": "string",
        "enum": [
          "user",
          "agent"
        ]
      },
      "TaskCollection": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Paged_TaskSummary"
          },
          {
            "type": "object",
            "required": [
              "status_counts"
            ],
            "properties": {
              "status_counts": {
                "$ref": "#/components/schemas/TaskStatusCounts"
              }
            }
          }
        ]
      },
      "TaskCollectionRequest": {
        "type": "object",
        "properties": {
          "assignee_account_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "due_date_from": {
            "type": [
              "string",
              "null"
            ],
            "description": "Inclusive positive-year YYYY-MM-DD lower bound, using Task's calendar rules."
          },
          "due_date_to": {
            "type": [
              "string",
              "null"
            ],
            "description": "Inclusive positive-year YYYY-MM-DD upper bound; must not precede `due_date_from`."
          },
          "order_by": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "field.asc/desc items. Default `updated_at.desc,id.asc`; nullable dates always sort last."
          },
          "page_index": {
            "type": "integer",
            "format": "int64",
            "default": 0,
            "maximum": 9007199254740991,
            "minimum": 0
          },
          "page_size": {
            "type": "integer",
            "format": "int64",
            "default": 50,
            "maximum": 100,
            "minimum": 0
          },
          "scope": {
            "$ref": "#/components/schemas/TaskCollectionScope",
            "description": "Personal holding by default; `assigned_to_me` spans all current human read sources."
          },
          "space_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id",
                "description": "Required only for space scope, whose current membership is checked independently."
              }
            ]
          },
          "statuses": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TaskStatus"
            },
            "description": "Omitted: unfinished for `assigned_to_me`, all five states otherwise. Explicit null/[] is invalid.",
            "minItems": 1
          },
          "terms": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Literal AND over title and free description. Default [] browses the collection.",
            "maxItems": 16
          },
          "unassigned": {
            "type": "boolean",
            "description": "Match unassigned Tasks; mutually exclusive with a non-null `assignee_account_id`."
          },
          "without_due_date": {
            "type": "boolean",
            "description": "Match no date; mutually exclusive with either date bound."
          }
        },
        "additionalProperties": false
      },
      "TaskCollectionScope": {
        "type": "string",
        "enum": [
          "personal",
          "space",
          "assigned_to_me"
        ]
      },
      "TaskDescriptionRequest": {
        "type": "object",
        "required": [
          "operation_id",
          "expected_description_version",
          "title",
          "description"
        ],
        "properties": {
          "description": {
            "type": "string"
          },
          "expected_description_version": {
            "$ref": "#/components/schemas/Id"
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          },
          "title": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "TaskDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/TaskFields"
          },
          {
            "type": "object",
            "required": [
              "document_id",
              "title",
              "markdown",
              "description",
              "document_revision_id",
              "task_fields_version",
              "description_version",
              "assignee_can_edit",
              "activities",
              "activities_truncated"
            ],
            "properties": {
              "activities": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/TaskActivity"
                },
                "description": "At most fifty newest committed activities, ordered by `created_at` descending and ID ascending."
              },
              "activities_truncated": {
                "type": "boolean"
              },
              "assignee_can_edit": {
                "type": "boolean",
                "description": "False when unassigned or the retained assignee no longer holds effective edit permission."
              },
              "description": {
                "type": "string"
              },
              "description_version": {
                "$ref": "#/components/schemas/Id"
              },
              "document_id": {
                "$ref": "#/components/schemas/Id"
              },
              "document_revision_id": {
                "$ref": "#/components/schemas/Id"
              },
              "markdown": {
                "type": "string"
              },
              "task_fields_version": {
                "$ref": "#/components/schemas/Id"
              },
              "title": {
                "type": "string"
              }
            }
          }
        ]
      },
      "TaskFields": {
        "type": "object",
        "required": [
          "status"
        ],
        "properties": {
          "assignee_account_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "due_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "$ref": "#/components/schemas/TaskStatus"
          }
        },
        "additionalProperties": false
      },
      "TaskFieldsRequest": {
        "type": "object",
        "required": [
          "operation_id",
          "expected_task_fields_version"
        ],
        "properties": {
          "assignee_account_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "due_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "expected_task_fields_version": {
            "$ref": "#/components/schemas/Id"
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          },
          "status": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/TaskStatus"
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "TaskReceipt": {
        "type": "object",
        "required": [
          "operation_id",
          "document_id",
          "revision_id",
          "snapshot_hash",
          "effect",
          "task_fields_version",
          "description_version",
          "note_published"
        ],
        "properties": {
          "activity_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "description_version": {
            "$ref": "#/components/schemas/Id"
          },
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "effect": {
            "type": "string"
          },
          "note_published": {
            "type": "boolean"
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          },
          "revision_id": {
            "$ref": "#/components/schemas/Id"
          },
          "snapshot_hash": {
            "type": "string"
          },
          "task_fields_version": {
            "$ref": "#/components/schemas/Id"
          }
        }
      },
      "TaskStatus": {
        "type": "string",
        "enum": [
          "todo",
          "progress",
          "review",
          "done",
          "cancelled"
        ]
      },
      "TaskStatusCounts": {
        "type": "object",
        "required": [
          "todo",
          "progress",
          "review",
          "done",
          "cancelled"
        ],
        "properties": {
          "cancelled": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "done": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "progress": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "review": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "todo": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "TaskSummary": {
        "allOf": [
          {
            "$ref": "#/components/schemas/TaskFields"
          },
          {
            "type": "object",
            "required": [
              "id",
              "origin",
              "title",
              "current_revision_id",
              "task_fields_version",
              "description_version",
              "created_at",
              "updated_at",
              "document_url",
              "revision_url"
            ],
            "properties": {
              "created_at": {
                "type": "integer",
                "format": "int64"
              },
              "current_revision_id": {
                "$ref": "#/components/schemas/Id"
              },
              "description_version": {
                "$ref": "#/components/schemas/Id"
              },
              "document_url": {
                "type": "string"
              },
              "id": {
                "$ref": "#/components/schemas/Id"
              },
              "origin": {
                "$ref": "#/components/schemas/OriginResponse"
              },
              "revision_url": {
                "type": "string"
              },
              "task_fields_version": {
                "$ref": "#/components/schemas/Id"
              },
              "title": {
                "type": "string"
              },
              "updated_at": {
                "type": "integer",
                "format": "int64"
              }
            }
          }
        ]
      },
      "ThreadResponse": {
        "type": "object",
        "required": [
          "id",
          "document_id",
          "root",
          "reply_count"
        ],
        "properties": {
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "last_reply_at": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "reply_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "root": {
            "$ref": "#/components/schemas/MessageResponse"
          }
        }
      },
      "ThreadSummary": {
        "type": "object",
        "required": [
          "id",
          "reply_count"
        ],
        "properties": {
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "last_reply_at": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "reply_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "TrashSummary": {
        "type": "object",
        "required": [
          "document_id",
          "origin",
          "title",
          "current_revision_id",
          "lifecycle_revision",
          "state",
          "trashed_at",
          "trashed_by",
          "created_at",
          "updated_at",
          "management_url",
          "document_url"
        ],
        "properties": {
          "created_at": {
            "type": "integer",
            "format": "int64"
          },
          "current_revision_id": {
            "$ref": "#/components/schemas/Id"
          },
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "document_url": {
            "type": "string"
          },
          "lifecycle_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "management_url": {
            "type": "string"
          },
          "origin": {
            "$ref": "#/components/schemas/OriginResponse"
          },
          "state": {
            "$ref": "#/components/schemas/LifecycleState"
          },
          "title": {
            "type": "string"
          },
          "trashed_at": {
            "type": "integer",
            "format": "int64"
          },
          "trashed_by": {
            "$ref": "#/components/schemas/Id"
          },
          "updated_at": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "TreeMoveReceipt": {
        "type": "object",
        "required": [
          "operation_id",
          "document_id",
          "position",
          "structure_version",
          "effect"
        ],
        "properties": {
          "account_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "effect": {
            "type": "string"
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          },
          "parent_document_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "position": {
            "type": "integer",
            "format": "int64"
          },
          "space_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "structure_version": {
            "$ref": "#/components/schemas/Id"
          }
        }
      },
      "UpdateRequest": {
        "type": "object",
        "required": [
          "operation_id",
          "expected_revision",
          "name",
          "description"
        ],
        "properties": {
          "description": {
            "type": "string"
          },
          "expected_revision": {
            "type": "integer",
            "format": "int64"
          },
          "name": {
            "type": "string"
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          },
          "overview_document_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id",
                "description": "Omit to preserve the current overview, send null to clear, or a document ID to replace it."
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "UploadReceipt": {
        "type": "object",
        "required": [
          "operation_id",
          "resource_id",
          "state",
          "sha256",
          "byte_size",
          "content_type",
          "content_url"
        ],
        "properties": {
          "byte_size": {
            "type": "integer",
            "format": "int64"
          },
          "content_type": {
            "type": "string"
          },
          "content_url": {
            "type": "string"
          },
          "operation_id": {
            "$ref": "#/components/schemas/Id"
          },
          "resource_id": {
            "$ref": "#/components/schemas/Id"
          },
          "sha256": {
            "type": "string"
          },
          "state": {
            "type": "string"
          }
        }
      },
      "VersionResponse": {
        "type": "object",
        "required": [
          "version",
          "git_sha"
        ],
        "properties": {
          "git_sha": {
            "type": "string"
          },
          "version": {
            "type": "string"
          }
        }
      },
      "WorkAction": {
        "type": "string",
        "enum": [
          "stop",
          "restart"
        ]
      }
    }
  }
}
