{
 "openapi": "3.1.0",
 "info": {
  "title": "reverser.space account API",
  "version": "1.3.0",
  "description": "The organization-scoped application API. Published memberAccess selects role_based grants or Engagement read_only company-wide saved reads. Engagement members can create products and upload firmware without starting processing; all other company mutations, raw downloads, and execution require platform authority. Dedicated gateways fix company scope from deployment configuration and reject conflicting company or resource parameters. Platform owners/admins enter each tenant through an audited handoff. Central registration stores deployment metadata; tenant bootstrap creates local accounts. Public/delegated credentials retain their scope ceilings. Actor attribution is independent of company storage placement. Work requires current resource permission and an available execution backend. Runtime safety bounds apply. Publishing read_only revokes member execution approvals and durably cancels their work. Saved report exports and personal profile/password/display preferences remain available. Paths are subject to deployment mode: platform registry and management routes run on the administration origin; member and resource operations run on the tenant origin. Servers are relative to the deployment serving this document."
 },
 "externalDocs": {
  "description": "Guide with worked examples",
  "url": "/agent-api.html"
 },
 "servers": [
  {
   "url": "/"
  }
 ],
 "security": [
  {
   "bearerAuth": []
  }
 ],
 "paths": {
  "/api/account/compute": {
   "get": {
    "operationId": "getAccountCompute",
    "summary": "Get the current account's analysis and debugger VM states",
    "responses": {
     "200": {
      "description": "Current account compute state",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AccountComputeStatus"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/error"
     }
    }
   }
  },
  "/api/account/compute/{scope}": {
   "delete": {
    "operationId": "deleteAccountCompute",
    "summary": "Immediately delete account-owned compute VMs",
    "description": "Accepts durable deletion without checkpointing or graceful shutdown. Deleting analysis also deletes its dependent debugger VM. Poll GET /api/account/compute until the targets are off. Cleanup survives gateway restarts. After deletion completes, a later compute request creates a fresh VM generation.",
    "parameters": [
     {
      "name": "scope",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "enum": [
        "analysis",
        "debug",
        "all"
       ]
      }
     }
    ],
    "responses": {
     "202": {
      "description": "Deletion accepted; targets remain deleting until physical removal and runtime cleanup finish",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AccountComputeStatus"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/error"
     }
    }
   }
  },
  "/api/auth/login": {
   "post": {
    "operationId": "login",
    "summary": "Sign in; the returned token authenticates every other call",
    "security": [],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/LoginRequest"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/LoginResponse"
        }
       }
      }
     },
     "401": {
      "description": "Bad username or password",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/error"
     }
    }
   }
  },
  "/api/auth/logout": {
   "post": {
    "operationId": "logout",
    "summary": "Revoke the current token",
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Status"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/auth/me": {
   "get": {
    "operationId": "me",
    "summary": "The signed-in account",
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/PublicUser"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/sessions": {
   "get": {
    "operationId": "sessions",
    "summary": "Sessions this account can see, with its role on each",
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/SessionInfo"
         }
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    },
    "parameters": [
     {
      "in": "query",
      "name": "projectId",
      "schema": {
       "type": "string"
      }
     },
     {
      "in": "query",
      "name": "shared",
      "schema": {
       "type": "boolean"
      },
      "description": "Only directly shared sessions whose private home project is not accessible."
     },
     {
      "name": "organizationId",
      "in": "query",
      "schema": {
       "type": "string"
      },
      "description": "Optional company scope. Dedicated tenant deployments reject a value conflicting with their configured company; access remains policy-filtered."
     }
    ]
   }
  },
  "/api/capacity": {
   "get": {
    "operationId": "capacity",
    "summary": "Current gateway capacity",
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/GatewayCapacity"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/ingestion/limits": {
   "get": {
    "operationId": "getIngestionLimits",
    "summary": "Get exact resumable-ingestion limits and supported transports",
    "responses": {
     "200": {
      "description": "Ingestion limits",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": true
        }
       }
      }
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     },
     "default": {
      "$ref": "#/components/responses/error"
     }
    }
   }
  },
  "/api/ingestion/uploads": {
   "post": {
    "operationId": "beginIngestionUpload",
    "summary": "Declare a durable resumable binary or PDB upload",
    "description": "Completing an upload creates or updates a pending workspace; it does not start analysis.",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "purpose",
         "idempotency_key",
         "files",
         "project_id"
        ],
        "properties": {
         "purpose": {
          "type": "string",
          "enum": [
           "binary",
           "symbols"
          ]
         },
         "project_id": {
          "type": "string",
          "description": "Explicit destination product ID."
         },
         "session_id": {
          "type": "string"
         },
         "idempotency_key": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
         },
         "files": {
          "type": "object",
          "additionalProperties": true
         },
         "options": {
          "type": "object"
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Durable upload state",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": true
        }
       }
      }
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     },
     "default": {
      "$ref": "#/components/responses/error"
     }
    }
   }
  },
  "/api/ingestion/uploads/{upload_id}": {
   "parameters": [
    {
     "in": "path",
     "name": "upload_id",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "get": {
    "operationId": "getIngestionUpload",
    "summary": "Get durable upload status and committed offsets",
    "responses": {
     "200": {
      "description": "Durable upload state",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": true
        }
       }
      }
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     },
     "default": {
      "$ref": "#/components/responses/error"
     }
    }
   },
   "delete": {
    "operationId": "cancelIngestionUpload",
    "summary": "Cancel a non-finalizing upload and remove partial bytes",
    "responses": {
     "200": {
      "description": "Cancelled upload state",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": true
        }
       }
      }
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     },
     "default": {
      "$ref": "#/components/responses/error"
     }
    }
   }
  },
  "/api/ingestion/uploads/{upload_id}/files/{file}": {
   "put": {
    "operationId": "appendIngestionChunk",
    "summary": "Append one raw chunk at the committed offset",
    "parameters": [
     {
      "in": "path",
      "name": "upload_id",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "in": "path",
      "name": "file",
      "required": true,
      "schema": {
       "type": "string",
       "enum": [
        "binary",
        "pdb"
       ]
      }
     },
     {
      "in": "query",
      "name": "offset",
      "required": true,
      "schema": {
       "type": "integer",
       "minimum": 0
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/octet-stream": {
       "schema": {
        "type": "string",
        "format": "binary"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Upload state with committed offset",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": true
        }
       }
      }
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     },
     "default": {
      "$ref": "#/components/responses/error"
     }
    }
   }
  },
  "/api/ingestion/uploads/{upload_id}/complete": {
   "post": {
    "operationId": "completeIngestionUpload",
    "summary": "Verify and commit uploaded bytes",
    "parameters": [
     {
      "in": "path",
      "name": "upload_id",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Completed upload receipt. Firmware results include the saved artifact and, for authorized automatic processing, analysis or analysis_error. Retries resume the same allocated session or firmware analysis.",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": true
        }
       }
      }
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     },
     "default": {
      "$ref": "#/components/responses/error"
     }
    },
    "description": "Verifies uploaded bytes and size and completes the declared upload purpose. Binary uploads create an independent pending session without searching or starting analysis. Search separately with POST /api/sessions/matches. There is no match or choice response. Firmware uploads by users allowed to start work automatically create the existing inspection, catalog, available SBOM, and vulnerability pipeline. Engagement member uploads remain save-only. AI mapping, research, and extracted binary analysis remain manual. An analysis_error does not undo saved firmware; the scheduler retries creation under the original approval."
   }
  },
  "/api/upload": {
   "post": {
    "operationId": "upload",
    "summary": "Upload a private binary with immutable uploader attribution and an initial grant",
    "description": "Creates an independent pending session. Search separately with POST /api/sessions/matches if reuse is desired. Analysis starts only through its explicit analysis action. Supply Idempotency-Key to resume the same creation request after a lost response; without a key each request is independent.",
    "requestBody": {
     "required": true,
     "content": {
      "multipart/form-data": {
       "schema": {
        "type": "object",
        "properties": {
         "file": {
          "type": "string",
          "format": "binary"
         },
         "projectId": {
          "type": "string",
          "description": "Explicit destination product ID."
         },
         "pdb": {
          "type": "string",
          "format": "binary",
          "description": "Optional PDB"
         }
        },
        "required": [
         "file",
         "projectId"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/SessionInfo"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/badRequest"
     },
     "409": {
      "description": "Idempotency key conflicts with the declared content or request state.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "413": {
      "description": "Larger than the gateway's per-file limit",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    },
    "parameters": [
     {
      "in": "header",
      "name": "Idempotency-Key",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "Stable creation request key. Changed content with the same key is rejected."
     }
    ]
   }
  },
  "/api/agents": {
   "get": {
    "operationId": "agents",
    "summary": "Hosted agents with account-specific funding availability and default selection",
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/PublicAgent"
         }
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/agent-key": {
   "get": {
    "operationId": "getAgentKey",
    "summary": "Whether this account has stored agent API keys (never the keys themselves)",
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/KeyStatus"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   },
   "post": {
    "operationId": "setAgentKey",
    "summary": "Store and verify a provider API key for this account's agent runs",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/SetKeyRequest"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/KeyStatus"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/badRequest"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    },
    "description": "Platform administration only. Stored personal credentials do not fund managed execution."
   },
   "delete": {
    "operationId": "deleteAgentKey",
    "summary": "Forget this account's stored key",
    "parameters": [
     {
      "name": "provider",
      "in": "query",
      "description": "Which provider's key to forget",
      "schema": {
       "type": "string",
       "enum": [
        "gemini",
        "openai",
        "openrouter",
        "zai"
       ]
      }
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/KeyStatus"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    },
    "description": "Platform administration only. Stored personal credentials do not fund managed execution."
   }
  },
  "/api/autorun": {
   "get": {
    "operationId": "getAutorun",
    "summary": "This account's auto-run preference for new uploads",
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AutorunSetting"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   },
   "post": {
    "operationId": "setAutorun",
    "summary": "Run an agent automatically on each of this account's uploads",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/AutorunSetting"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AutorunSetting"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/badRequest"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/open": {
   "post": {
    "operationId": "openSession",
    "summary": "Start opening the session once and report where it got to",
    "description": "Kicks an idle session into reopening and returns at once; poll GET /api/sessions until status is 'ready'. 409 when the binary has not been analysed yet (call analyze) or the last open failed.",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/SessionInfo"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "409": {
      "description": "Not analysed yet, or the last open failed",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     },
     "402": {
      "description": "Organization access is required"
     }
    }
   }
  },
  "/api/s/{sid}/ready": {
   "get": {
    "operationId": "openSessionLegacy",
    "summary": "Legacy alias for POST /api/s/{sid}/open",
    "description": "Kicks an idle session into reopening and returns at once; poll until status is 'ready'. 409 when the binary has not been analysed yet (call analyze) or the last open failed.",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/SessionInfo"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "409": {
      "description": "Not analysed yet, or the last open failed",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/analyze": {
   "post": {
    "operationId": "analyze",
    "summary": "Start the one-time analysis of a pending binary (editor)",
    "description": "Idempotent: a session already analysing, ready or idle reports its state instead of erroring. A binary rejected as unsupported may also be retried with raw interpretation settings. Minutes of work for a large binary; poll GET /api/sessions for the analyzing to ready transition. Set unattended:true to checkpoint and release compute without starting an interactive worker. Poll the returned computeOperationId for completion or cancellation. Existing active sessions are left running; this option does not evict them. Saved-project retries reject incompatible explicit settings. Bulk run scheduling is separate.",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "requestBody": {
     "required": false,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/AnalyzeRequest"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/SessionInfo"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/badRequest"
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     },
     "402": {
      "description": "Organization access is required"
     }
    }
   }
  },
  "/api/s/{sid}/symbols": {
   "post": {
    "operationId": "stageSymbols",
    "summary": "Attach a PDB to a not-yet-analysed session (editor)",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "multipart/form-data": {
       "schema": {
        "type": "object",
        "properties": {
         "file": {
          "type": "string",
          "format": "binary"
         }
        },
        "required": [
         "file"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/StageSymbolsResult"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/badRequest"
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     },
     "409": {
      "description": "Analysis was already requested or session setup is busy."
     }
    },
    "description": "Pending sessions only. A malformed optional PDB returns 200 with staged:false and symbols.status:skipped plus a warning; binary analysis may continue. Transport/storage failures remain errors. Queued or running setup changes return 409."
   },
   "delete": {
    "operationId": "unstageSymbols",
    "summary": "Take back a staged PDB before analysis bakes it in (editor)",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Status"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "409": {
      "description": "Already analysed; the symbols can't be detached",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   },
   "get": {
    "operationId": "symbols",
    "summary": "Every symbol with address, binding and type",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/Symbol"
         }
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/download": {
   "get": {
    "operationId": "download",
    "summary": "The original uploaded binary",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "The binary itself",
      "content": {
       "application/octet-stream": {
        "schema": {
         "type": "string",
         "format": "binary"
        }
       }
      }
     },
     "403": {
      "description": "Downloads are disabled on this gateway",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/artifacts": {
   "get": {
    "operationId": "listArtifacts",
    "summary": "List immutable analysis artifacts in a workspace",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "Workspace artifacts, ordered oldest first",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/Artifact"
         }
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/artifacts/{aid}": {
   "get": {
    "operationId": "getArtifact",
    "summary": "Get immutable artifact metadata and provenance",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     },
     {
      "$ref": "#/components/parameters/aid"
     }
    ],
    "responses": {
     "200": {
      "description": "Artifact metadata",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Artifact"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/artifacts/{aid}/download": {
   "get": {
    "operationId": "downloadArtifact",
    "summary": "Download an immutable analysis artifact",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     },
     {
      "$ref": "#/components/parameters/aid"
     }
    ],
    "responses": {
     "200": {
      "description": "Artifact bytes",
      "content": {
       "application/octet-stream": {
        "schema": {
         "type": "string",
         "format": "binary"
        }
       }
      }
     },
     "403": {
      "description": "Downloads are disabled on this gateway",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}": {
   "delete": {
    "operationId": "deleteSession",
    "summary": "Immediately and permanently delete an owned session",
    "description": "Accepts durable permanent deletion and immediately hides the session and rejects new activity. Background cleanup interrupts active work and deletes session storage without checkpointing or Trash recovery, resuming after gateway restarts. Account VMs, published writeups and their frozen snapshots remain.",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "202": {
      "description": "Deletion accepted",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Status"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "409": {
      "description": "Deletion could not be recorded; retry the request",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/share": {
   "get": {
    "operationId": "getShare",
    "summary": "The session's share token, if any (editor)",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ShareResponse"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   },
   "post": {
    "operationId": "createShare",
    "summary": "Organization admin publishes an explicit selection of saved content with current resource editor access",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ShareResponse"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/PublicScopeRequest"
       }
      }
     }
    }
   },
   "delete": {
    "operationId": "revokeShare",
    "summary": "Revoke the share token (organization admin)",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Status"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   },
   "patch": {
    "operationId": "updateBinaryPublicScope",
    "summary": "Organization admin publishes an explicit selection of saved content with current resource editor access",
    "parameters": [
     {
      "name": "sid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/PublicScopeRequest"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Unchanged token with a revised explicit saved selection",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/SharingLink"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/error"
     }
    }
   }
  },
  "/api/s/{sid}/access": {
   "get": {
    "operationId": "listAccess",
    "summary": "Effective direct and inherited grants (company administrator)",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/SharingPerson"
         }
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   },
   "post": {
    "operationId": "grantAccess",
    "summary": "Grant an account a role on this session (organization admin)",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/GrantAccessRequest"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AccessEntry"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/badRequest"
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/access/{uid}": {
   "delete": {
    "operationId": "revokeAccess",
    "summary": "Revoke a direct grant (company administrator); inherited access remains",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     },
     {
      "name": "uid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      },
      "description": "Account id from the access list"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Status"
        }
       }
      }
     },
     "403": {
      "description": "Company administrators manage direct grants; storage ownership grants no authority",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/layout": {
   "get": {
    "operationId": "getLayout",
    "summary": "The shared saved panel layout",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Layout"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   },
   "put": {
    "operationId": "setLayout",
    "summary": "Save the dock layout (organization admin with resource editor access)",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/Layout"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Status"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/agents": {
   "get": {
    "operationId": "listAgentCreds",
    "summary": "Agents currently authorized on this session",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/AgentCred"
         }
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     },
     "402": {
      "description": "Organization access is required"
     }
    }
   },
   "post": {
    "operationId": "inviteAgent",
    "summary": "Invite an agent to work this session and start its run",
    "description": "The agent acts at the lower of its configured ceiling and your own role here; it can never outrank you.",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/InviteAgentRequest"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AgentCred"
        }
       }
      }
     },
     "400": {
      "description": "No funding key for the agent's provider",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "503": {
      "description": "All agent run slots are busy",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     },
     "402": {
      "description": "Organization access is required"
     }
    }
   }
  },
  "/api/s/{sid}/agents/{id}": {
   "delete": {
    "operationId": "revokeAgent",
    "summary": "Revoke an agent's authorization",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     },
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      },
      "description": "Credential id from the agents list"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Status"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/chat": {
   "get": {
    "operationId": "getChat",
    "summary": "The session's shared chat, humans and agents alike",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/ChatMessage"
         }
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     },
     "402": {
      "description": "Organization access is required"
     }
    }
   },
   "post": {
    "operationId": "sendChat",
    "summary": "Send a message to an agent; its reply lands in the chat",
    "description": "Starts an interactive run under your own authority; the agent can read the session, and write to it when your role allows. Watch the chat (or the WebSocket) for the reply.",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/SendChatRequest"
       }
      }
     }
    },
    "responses": {
     "202": {
      "description": "The run was started; the reply arrives in the chat",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/StartedRun"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/badRequest"
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "503": {
      "description": "All agent run slots are busy",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     },
     "402": {
      "description": "Organization access is required"
     }
    }
   },
   "delete": {
    "operationId": "clearChat",
    "summary": "Wipe the shared chat history (editor)",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Status"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     },
     "402": {
      "description": "Organization access is required"
     }
    }
   }
  },
  "/api/s/{sid}/runs": {
   "get": {
    "operationId": "listRuns",
    "summary": "Agent runs in flight on this session",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/ActiveRun"
         }
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/runs/{id}": {
   "delete": {
    "operationId": "stopRun",
    "summary": "Stop a run: your own, or anyone's as editor",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     },
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      },
      "description": "Run id from the runs list"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Status"
        }
       }
      }
     },
     "403": {
      "description": "Not your run, and you are not an editor",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/agent-runs": {
   "get": {
    "operationId": "listAgentRunHistory",
    "summary": "Durable agent run history for this session",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "Newest-first durable runs",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/AgentRun"
         }
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/agent-runs/{rid}": {
   "get": {
    "operationId": "getAgentRun",
    "summary": "Durable run provenance, bounded steps, and feedback",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     },
     {
      "name": "rid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Run detail",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/agent-runs/{rid}/feedback": {
   "put": {
    "operationId": "setAgentRunFeedback",
    "summary": "Set the current account's positive, negative, or correction feedback for a run",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     },
     {
      "name": "rid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "required": [
         "verdict"
        ],
        "properties": {
         "verdict": {
          "type": "string",
          "enum": [
           "positive",
           "negative",
           "correction"
          ]
         },
         "reason": {
          "type": "string",
          "maxLength": 2048
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Current feedback stored idempotently",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/runs/{rid}/undo": {
   "post": {
    "operationId": "undoAgentRun",
    "summary": "Undo one agent run if its changes still form the top undo block",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     },
     {
      "name": "rid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      },
      "description": "Agent run id from the final chat response"
     }
    ],
    "responses": {
     "200": {
      "description": "The run's contiguous program changes were reverted",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "409": {
      "description": "A later edit exists or the run's changes are not contiguous",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/agent-peers": {
   "get": {
    "operationId": "agentPeers",
    "summary": "Where each agent that has run here was last seen",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/AgentPeer"
         }
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/info": {
   "get": {
    "operationId": "info",
    "summary": "File format, architecture, entry point and hardening flags",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Info"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/overview": {
   "get": {
    "operationId": "overview",
    "summary": "Summary counts: functions, strings, symbols, imports, xrefs, calls",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Overview"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/triage": {
   "get": {
    "operationId": "triage",
    "summary": "Read the saved Jev function ranking or its progress",
    "description": "Reads the shared saved ranking without provider calls. While status is ranking, items are provisional scores of evaluated functions only; remaining functions may rank higher. Generate or resume through authenticated POST /triage/jev; no static fallback.",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     },
     {
      "name": "limit",
      "in": "query",
      "description": "How many ranked functions to return (default 100)",
      "schema": {
       "type": "integer",
       "minimum": 1,
       "maximum": 500,
       "default": 100
      }
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Triage"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/hashes": {
   "get": {
    "operationId": "hashes",
    "summary": "File hashes and whole-file entropy",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Hashes"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/entropy": {
   "get": {
    "operationId": "entropy",
    "summary": "Shannon entropy per bucket across initialised memory, labelled by section",
    "description": "High and flat reads as compressed or encrypted; low and spiky as text or padding. Buckets never straddle sections, so the answer can hold a few more samples than asked for.",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     },
     {
      "name": "buckets",
      "in": "query",
      "description": "Target resolution (default 256)",
      "schema": {
       "type": "integer",
       "minimum": 16,
       "maximum": 2048,
       "default": 256
      }
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/EntropyBucket"
         }
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/sections": {
   "get": {
    "operationId": "sections",
    "summary": "Sections with addresses, sizes and permissions",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/Section"
         }
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/certificates": {
   "get": {
    "operationId": "certificates",
    "summary": "Code-signing certificates where the format carries them",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": true
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/versioninfo": {
   "get": {
    "operationId": "versioninfo",
    "summary": "Imported library version requirements",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "description": "Format-specific; a list of libraries with their version tags on ELF",
         "type": [
          "array",
          "object"
         ],
         "items": {
          "type": "object",
          "additionalProperties": true
         },
         "additionalProperties": true
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/libraries": {
   "get": {
    "operationId": "libraries",
    "summary": "Shared libraries the binary links against",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "type": "string"
         }
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/functions": {
   "get": {
    "operationId": "functions",
    "summary": "Every function with name, address, size and complexity",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/Function"
         }
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/disasm": {
   "get": {
    "operationId": "disasm",
    "summary": "Disassembly of the function at an address",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     },
     {
      "$ref": "#/components/parameters/addr"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Disasm"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/badRequest"
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/decompile": {
   "get": {
    "operationId": "decompile",
    "summary": "Decompiled C for the function at an address",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     },
     {
      "$ref": "#/components/parameters/addr"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Decompile"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/badRequest"
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/vars": {
   "get": {
    "operationId": "vars",
    "summary": "The function's variables and arguments with types and storage",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     },
     {
      "$ref": "#/components/parameters/addr"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Vars"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/badRequest"
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/graph": {
   "get": {
    "operationId": "graph",
    "summary": "Basic-block control-flow graph of the function at an address",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     },
     {
      "$ref": "#/components/parameters/addr"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/Graph"
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/badRequest"
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/xrefs": {
   "get": {
    "operationId": "xrefs",
    "summary": "Cross-references to an address: who reads, writes, calls or jumps here",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     },
     {
      "$ref": "#/components/parameters/addr"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/Xref"
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/badRequest"
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/calltree": {
   "get": {
    "operationId": "calltree",
    "summary": "Callers and callees of the function at an address",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     },
     {
      "$ref": "#/components/parameters/addr"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/CallTree"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/badRequest"
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/callgraph": {
   "get": {
    "operationId": "callgraph",
    "summary": "The whole-program call graph: every function with its callees by name",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/CallGraphNode"
         }
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     }
    }
   }
  },
  "/api/s/{sid}/instruction": {
   "get": {
    "operationId": "instruction",
    "summary": "One instruction decoded: operands, control flow, p-code",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     },
     {
      "$ref": "#/components/parameters/addr"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Instruction"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/badRequest"
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/resolveaddr": {
   "get": {
    "operationId": "resolveaddr",
    "summary": "The function containing an address",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     },
     {
      "$ref": "#/components/parameters/addr"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ResolveAddr"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/badRequest"
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/signature": {
   "get": {
    "operationId": "signature",
    "summary": "The function's C prototype and calling convention",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     },
     {
      "$ref": "#/components/parameters/addr"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Signature"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/badRequest"
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   },
   "post": {
    "operationId": "setSignature",
    "summary": "Apply an edited C prototype to a function (editor)",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": true,
         "description": "The read-back state after the change; a 200 means the model really holds it"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/badRequest"
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/SignatureRequest"
       }
      }
     }
    }
   }
  },
  "/api/s/{sid}/strings": {
   "get": {
    "operationId": "strings",
    "summary": "Strings with addresses and sections",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     },
     {
      "name": "scope",
      "in": "query",
      "description": "Pass 'all' to additionally sweep undefined memory for string-shaped runs; noisier, but finds strings compilers park in .text",
      "schema": {
       "type": "string",
       "enum": [
        "all"
       ]
      }
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/StringItem"
         }
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/hex": {
   "get": {
    "operationId": "hex",
    "summary": "Raw bytes at an address, as an array of byte values",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     },
     {
      "$ref": "#/components/parameters/addr"
     },
     {
      "name": "len",
      "in": "query",
      "description": "How many bytes (default 256)",
      "schema": {
       "type": "integer",
       "minimum": 1,
       "maximum": 4096,
       "default": 256
      }
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "type": "integer",
          "minimum": 0,
          "maximum": 255
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/badRequest"
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/imports": {
   "get": {
    "operationId": "imports",
    "summary": "Imported functions with their thunk addresses",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/Import"
         }
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/exports": {
   "get": {
    "operationId": "exports",
    "summary": "Exported symbols",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/Symbol"
         }
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/types": {
   "get": {
    "operationId": "types",
    "summary": "Data types known to the program",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Types"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/type": {
   "get": {
    "operationId": "type",
    "summary": "One type's definition: members for a composite, values for an enum",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     },
     {
      "name": "name",
      "in": "query",
      "required": true,
      "description": "Type name or category path, e.g. \"sockaddr_in\"",
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/TypeDetail"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/type/uses": {
   "get": {
    "operationId": "typeUses",
    "summary": "How many data, variables and types would revert to undefined if this type were deleted",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     },
     {
      "name": "name",
      "in": "query",
      "required": true,
      "description": "Type name or category path, e.g. \"sockaddr_in\"",
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/TypeUses"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/parsetypes": {
   "post": {
    "operationId": "parseTypes",
    "summary": "Define types from C declarations: structs, unions, enums, typedefs (editor)",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": true,
         "description": "The read-back state after the change; a 200 means the model really holds it"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/badRequest"
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     },
     "409": {
      "description": "A type of that name already exists; pass replace to overwrite",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/ParseTypesRequest"
       }
      }
     }
    }
   }
  },
  "/api/s/{sid}/deletetype": {
   "post": {
    "operationId": "deleteType",
    "summary": "Remove a type; every use of it reverts to undefined (editor)",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": true,
         "description": "The read-back state after the change; a 200 means the model really holds it"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/badRequest"
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/DeleteTypeRequest"
       }
      }
     }
    }
   }
  },
  "/api/s/{sid}/search": {
   "get": {
    "operationId": "search",
    "summary": "Search strings, symbols and bytes across the program",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     },
     {
      "name": "query",
      "in": "query",
      "description": "What to search for. Literal text by default; hex bytes like 'deadbeef' with mode=hex; a Java regular expression with mode=regex",
      "schema": {
       "type": "string"
      },
      "required": true
     },
     {
      "name": "mode",
      "in": "query",
      "description": "How to interpret the query. Anything else falls back to a literal text search",
      "schema": {
       "type": "string",
       "enum": [
        "hex",
        "regex"
       ]
      }
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/SearchHit"
         }
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/comments": {
   "get": {
    "operationId": "comments",
    "summary": "Analyst comments with author and address",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/Comment"
         }
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/labels": {
   "get": {
    "operationId": "labels",
    "summary": "User and analysis labels at an address",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     },
     {
      "$ref": "#/components/parameters/addr"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/Label"
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/badRequest"
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/bookmarks": {
   "get": {
    "operationId": "bookmarks",
    "summary": "Bookmarked addresses with notes",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/Bookmark"
         }
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/notes": {
   "get": {
    "operationId": "notes",
    "summary": "The analysts' shared write-up of this binary",
    "description": "Markdown, maintained by the people and agents working the session. Usually the best first read: it says what the binary is and where the interesting parts are.",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Notes"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   },
   "post": {
    "operationId": "setNotes",
    "summary": "Replace the shared session notes (editor)",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Notes"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/badRequest"
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     },
     "409": {
      "description": "Notes changed after the supplied revision; read the latest notes and resolve the conflict."
     }
    },
    "description": "Read first, merge your changes, then send the revision from that read. A stale revision returns 409 without changing notes. Omitting revision preserves legacy unconditional saves.",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/SetNotesRequest"
       }
      }
     }
    }
   }
  },
  "/api/s/{sid}/findings": {
   "get": {
    "operationId": "listFindings",
    "summary": "The structured findings background agent runs recorded, oldest first, superseded ones marked",
    "parameters": [
     {
      "name": "sid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      },
      "description": "The session id."
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/Finding"
         }
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/error"
     }
    }
   }
  },
  "/api/s/{sid}/undostate": {
   "get": {
    "operationId": "undostate",
    "summary": "What undo would revert next, and the program's history stack",
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "properties": {
          "canUndo": {
           "type": "boolean"
          },
          "canRedo": {
           "type": "boolean"
          },
          "undoName": {
           "type": "string",
           "description": "The next change undo would revert, named with who made it"
          },
          "redoName": {
           "type": "string"
          },
          "undoStack": {
           "type": "array",
           "items": {
            "type": "string"
           },
           "description": "Newest first"
          },
          "redoStack": {
           "type": "array",
           "items": {
            "type": "string"
           }
          }
         }
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/error"
     }
    },
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ]
   }
  },
  "/api/s/{sid}/undo": {
   "post": {
    "operationId": "undo",
    "summary": "Revert the program's most recent change",
    "responses": {
     "200": {
      "description": "Applied",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "properties": {
          "reverted": {
           "type": "string",
           "description": "The transaction that was undone or redone"
          },
          "by": {
           "type": "string"
          }
         }
        }
       }
      }
     },
     "409": {
      "description": "Nothing to undo or redo",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/error"
     }
    },
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ]
   }
  },
  "/api/s/{sid}/redo": {
   "post": {
    "operationId": "redo",
    "summary": "Reapply the change undo last reverted",
    "responses": {
     "200": {
      "description": "Applied",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "properties": {
          "reverted": {
           "type": "string",
           "description": "The transaction that was undone or redone"
          },
          "by": {
           "type": "string"
          }
         }
        }
       }
      }
     },
     "409": {
      "description": "Nothing to undo or redo",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/error"
     }
    },
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ]
   }
  },
  "/api/s/{sid}/activity": {
   "get": {
    "operationId": "activity",
    "summary": "Recent session activity: renames, comments, notes edits",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/ActivityEvent"
         }
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/rename": {
   "post": {
    "operationId": "rename",
    "summary": "Rename the function at an address (editor)",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": true,
         "description": "The read-back state after the change; a 200 means the model really holds it"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/badRequest"
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    },
    "description": "The worker applies it in a transaction and reads it back before answering, so a 200 means the model really holds the new name.",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/RenameRequest"
       }
      }
     }
    }
   }
  },
  "/api/s/{sid}/renamevar": {
   "post": {
    "operationId": "renameVar",
    "summary": "Rename a local or parameter (editor)",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": true,
         "description": "The read-back state after the change; a 200 means the model really holds it"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/badRequest"
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/RenameVarRequest"
       }
      }
     }
    }
   }
  },
  "/api/s/{sid}/retypevar": {
   "post": {
    "operationId": "retypeVar",
    "summary": "Change a variable's type (editor)",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": true,
         "description": "The read-back state after the change; a 200 means the model really holds it"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/badRequest"
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/RetypeVarRequest"
       }
      }
     }
    }
   }
  },
  "/api/s/{sid}/comment": {
   "post": {
    "operationId": "setComment",
    "summary": "Set the comment at an address (editor)",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": true,
         "description": "The read-back state after the change; a 200 means the model really holds it"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/badRequest"
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/CommentRequest"
       }
      }
     }
    }
   },
   "delete": {
    "operationId": "deleteComment",
    "summary": "Delete the comment at an address (editor)",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     },
     {
      "$ref": "#/components/parameters/addr"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": true,
         "description": "The read-back state after the change; a 200 means the model really holds it"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/badRequest"
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/label": {
   "post": {
    "operationId": "setLabel",
    "summary": "Name an address, or clear it with an empty name (editor)",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": true,
         "description": "The read-back state after the change; a 200 means the model really holds it"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/badRequest"
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/LabelRequest"
       }
      }
     }
    }
   }
  },
  "/api/s/{sid}/data": {
   "post": {
    "operationId": "setData",
    "summary": "Define the bytes at an address as a type, or clear with an empty type (editor)",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": true,
         "description": "The read-back state after the change; a 200 means the model really holds it"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/badRequest"
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/DataRequest"
       }
      }
     }
    }
   }
  },
  "/api/s/{sid}/bookmark": {
   "post": {
    "operationId": "setBookmark",
    "summary": "Bookmark an address, or remove it with an empty comment (editor)",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": true,
         "description": "The read-back state after the change; a 200 means the model really holds it"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/badRequest"
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/BookmarkRequest"
       }
      }
     }
    }
   }
  },
  "/api/oauth/client": {
   "get": {
    "operationId": "oauthClientInfo",
    "summary": "Name of a registered OAuth client, for the consent screen",
    "parameters": [
     {
      "name": "client_id",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Client display name",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "name": {
           "type": "string"
          }
         },
         "required": [
          "name"
         ]
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/oauth/approve": {
   "post": {
    "operationId": "oauthApprove",
    "summary": "Approve or deny an OAuth authorization request",
    "description": "Validates the client, redirect_uri, optional MCP resource indicator and mcp scope; mints a single-use authorization code; and returns the redirect URL the browser should follow. Set deny to redirect with error=access_denied instead.",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "client_id": {
          "type": "string"
         },
         "redirect_uri": {
          "type": "string"
         },
         "state": {
          "type": "string"
         },
         "code_challenge": {
          "type": "string"
         },
         "code_challenge_method": {
          "type": "string",
          "enum": [
           "S256"
          ]
         },
         "response_type": {
          "type": "string",
          "enum": [
           "code"
          ]
         },
         "resource": {
          "type": "string",
          "format": "uri",
          "description": "Optional MCP resource URL; when present it is bound to the authorization code and token exchange."
         },
         "scope": {
          "type": "string",
          "enum": [
           "mcp"
          ]
         },
         "deny": {
          "type": "boolean"
         }
        },
        "required": [
         "client_id",
         "redirect_uri"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Redirect URL carrying the code, or an error parameter",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "redirect": {
           "type": "string"
          }
         },
         "required": [
          "redirect"
         ]
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/oauth/connections": {
   "get": {
    "operationId": "oauthConnections",
    "summary": "OAuth clients holding a live token for this account",
    "responses": {
     "200": {
      "description": "Connected clients",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "type": "object",
          "properties": {
           "clientId": {
            "type": "string"
           },
           "name": {
            "type": "string"
           },
           "connectedAt": {
            "type": "integer"
           },
           "lastUsedAt": {
            "type": "integer"
           }
          },
          "required": [
           "clientId",
           "name",
           "connectedAt",
           "lastUsedAt"
          ]
         }
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/oauth/connections/{cid}": {
   "delete": {
    "operationId": "oauthRevokeConnection",
    "summary": "Revoke every token one OAuth client holds for this account",
    "parameters": [
     {
      "name": "cid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Status"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/defineddata": {
   "get": {
    "operationId": "definedData",
    "summary": "Typed globals with their values and xref counts",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/DefinedDataItem"
         }
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/setenum": {
   "post": {
    "operationId": "setEnum",
    "summary": "Rewrite an enum's members and storage width",
    "description": "Enums do not go through /parsetypes: C cannot express an enum's storage width, so the whole definition is posted here. The enum is rebuilt at the requested width and swapped in, keeping its category and repointing every use.",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "name": {
          "type": "string",
          "description": "Name of an existing enum."
         },
         "width": {
          "type": "integer",
          "enum": [
           1,
           2,
           4,
           8
          ],
          "description": "Storage width in bytes."
         },
         "members": {
          "type": "array",
          "maxItems": 512,
          "items": {
           "type": "object",
           "properties": {
            "name": {
             "type": "string"
            },
            "value": {
             "type": "integer"
            }
           },
           "required": [
            "name",
            "value"
           ],
           "additionalProperties": false
          }
         }
        },
        "required": [
         "name",
         "width",
         "members"
        ],
        "additionalProperties": false
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "The saved enum",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/TypeDetail"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/findings/{fid}/evidence/{eid}": {
   "get": {
    "operationId": "resolveFindingEvidence",
    "summary": "Resolve one finding's evidence against exact supporting state",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     },
     {
      "name": "fid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "eid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/EvidenceResolution"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/findings/{fid}/reviews": {
   "post": {
    "operationId": "reviewFinding",
    "summary": "Accept, reject, correct, or request verification for a finding (editor)",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     },
     {
      "name": "fid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/FindingReviewRequest"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/FindingReview"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/badRequest"
     },
     "409": {
      "description": "An accepted finding has no resolvable evidence",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/finding-feedback/export": {
   "get": {
    "operationId": "exportFindingFeedback",
    "summary": "Explicitly export reviewed findings for an authorized evaluation workflow (organization admin with resource editor access)",
    "description": "Includes customer-authored claims, evidence observations, attribution, run linkage, and append-only reviews. Nothing is exported automatically.",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/FindingFeedbackExport"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/s/{sid}/missions": {
   "get": {
    "operationId": "listAgentMissions",
    "summary": "Durable missions for this workspace",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/AgentMission"
         }
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     },
     "402": {
      "description": "Organization access is required"
     }
    }
   },
   "post": {
    "operationId": "createAgentMission",
    "summary": "Create a draft mission (editor)",
    "description": "Creates durable mission intent only. Queueing and execution are separate operations.",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/AgentMissionRequest"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AgentMission"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/badRequest"
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     },
     "402": {
      "description": "Organization access is required"
     }
    }
   }
  },
  "/api/s/{sid}/missions/{mid}": {
   "get": {
    "operationId": "getAgentMission",
    "summary": "One mission and its ordered task plan",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     },
     {
      "name": "mid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AgentMissionDetail"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     },
     "402": {
      "description": "Organization access is required"
     }
    }
   },
   "put": {
    "operationId": "updateAgentMission",
    "summary": "Replace a draft mission's intent and budgets (editor)",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     },
     {
      "name": "mid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/AgentMissionRequest"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AgentMission"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/badRequest"
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "409": {
      "description": "Mission is no longer a draft",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     },
     "402": {
      "description": "Organization access is required"
     }
    }
   }
  },
  "/api/s/{sid}/missions/{mid}/plan": {
   "put": {
    "operationId": "replaceAgentMissionPlan",
    "summary": "Atomically replace a draft mission's ordered plan (editor)",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     },
     {
      "name": "mid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/AgentMissionPlanRequest"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AgentMissionDetail"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/badRequest"
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "409": {
      "description": "Mission is no longer a draft",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     },
     "402": {
      "description": "Organization access is required"
     }
    }
   }
  },
  "/api/s/{sid}/missions/{mid}/queue": {
   "post": {
    "operationId": "queueAgentMission",
    "summary": "Queue a durable mission (editor)",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     },
     {
      "name": "mid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AgentMission"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "409": {
      "description": "Invalid mission state transition",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     },
     "402": {
      "description": "Organization access is required"
     }
    }
   }
  },
  "/api/s/{sid}/missions/{mid}/pause": {
   "post": {
    "operationId": "pauseAgentMission",
    "summary": "Pause a durable mission (editor)",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     },
     {
      "name": "mid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AgentMission"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "409": {
      "description": "Invalid mission state transition",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     },
     "402": {
      "description": "Organization access is required"
     }
    }
   }
  },
  "/api/s/{sid}/missions/{mid}/resume": {
   "post": {
    "operationId": "resumeAgentMission",
    "summary": "Resume a durable mission (editor)",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     },
     {
      "name": "mid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AgentMission"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "409": {
      "description": "Invalid mission state transition",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     },
     "402": {
      "description": "Organization access is required"
     }
    }
   }
  },
  "/api/s/{sid}/missions/{mid}/retry": {
   "post": {
    "operationId": "retryAgentMission",
    "summary": "Retry a durable mission (editor)",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     },
     {
      "name": "mid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AgentMission"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "409": {
      "description": "Invalid mission state transition",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     },
     "402": {
      "description": "Organization access is required"
     }
    }
   }
  },
  "/api/s/{sid}/missions/{mid}/cancel": {
   "post": {
    "operationId": "cancelAgentMission",
    "summary": "Cancel a durable mission (editor)",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     },
     {
      "name": "mid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AgentMission"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "409": {
      "description": "Invalid mission state transition",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     },
     "402": {
      "description": "Organization access is required"
     }
    }
   }
  },
  "/api/s/{sid}/missions/{mid}/tasks/{tid}/approve": {
   "post": {
    "operationId": "approveAgentMissionTask",
    "summary": "Approve a waiting mission checkpoint and requeue the mission (editor)",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     },
     {
      "name": "mid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "tid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AgentMissionDetail"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "409": {
      "description": "Checkpoint is no longer waiting",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     },
     "402": {
      "description": "Organization access is required"
     }
    }
   }
  },
  "/api/s/{sid}/missions/{mid}/generate-plan": {
   "post": {
    "operationId": "generateAgentMissionPlan",
    "summary": "Generate and validate a bounded draft plan with the mission's agent (editor)",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     },
     {
      "name": "mid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AgentMissionDetail"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "409": {
      "description": "Mission is no longer a draft",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "502": {
      "description": "Planner provider failed or returned an invalid plan",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     },
     "402": {
      "description": "Organization access is required"
     }
    }
   }
  },
  "/api/s/{sid}/missions/{mid}/guidance": {
   "post": {
    "operationId": "addAgentMissionGuidance",
    "summary": "Append a human constraint for the next mission task boundary (editor)",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     },
     {
      "name": "mid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/AgentMissionGuidanceRequest"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AgentMissionGuidance"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/badRequest"
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "409": {
      "description": "Mission is not active",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     },
     "402": {
      "description": "Organization access is required"
     }
    }
   }
  },
  "/api/agent-skills": {
   "get": {
    "operationId": "agentSkills",
    "summary": "Versioned specialist workflows available to in-process agents",
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/PublicAgentSkill"
         }
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/investigations/{iid}/runs/{rid}/control": {
   "parameters": [
    {
     "name": "iid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    },
    {
     "name": "rid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "post": {
    "operationId": "controlInvestigationRun",
    "summary": "Start, pause, resume, cancel, or retry investigation tasks",
    "description": "Start queues analysis, followed by individual AI missions and/or a read-only cross-file coordinator according to the saved mode. Combined mode waits for the individual missions before correlation. Pause blocks new task and child-mission dispatch; running stages finish. Cancel stops owned work and detaches shared analysis. Retry selected failed/interrupted/blocked/canceled tasks under the current editor approval with new attempts and remaining aggregate budget. Completed runs and unresolved unknown usage cannot be retried. Prior usage and results are retained.",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "action"
        ],
        "properties": {
         "action": {
          "type": "string",
          "enum": [
           "start",
           "pause",
           "resume",
           "cancel",
           "retry"
          ]
         },
         "taskIds": {
          "type": "array",
          "maxItems": 500,
          "items": {
           "type": "string"
          },
          "description": "Required only for retry; select analysis or investigate tasks in failed, interrupted, blocked, or queued state."
         }
        }
       }
      }
     }
    },
    "responses": {
     "204": {
      "description": "Successful response"
     },
     "401": {
      "description": "Authentication required"
     },
     "404": {
      "description": "Investigation or run not found for this account"
     },
     "409": {
      "description": "Invalid state or unavailable source access"
     },
     "400": {
      "description": "Invalid action or request"
     }
    }
   }
  },
  "/api/investigations/{iid}/runs/{rid}/attempts": {
   "parameters": [
    {
     "name": "iid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    },
    {
     "name": "rid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "get": {
    "operationId": "listInvestigationAttempts",
    "summary": "Read persisted attempt history, newest first",
    "parameters": [
     {
      "name": "limit",
      "in": "query",
      "schema": {
       "type": "integer",
       "default": 50,
       "maximum": 100
      }
     },
     {
      "name": "offset",
      "in": "query",
      "schema": {
       "type": "integer",
       "default": 0,
       "minimum": 0
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful response",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/InvestigationAttempt"
         }
        }
       }
      }
     },
     "401": {
      "description": "Authentication required"
     },
     "404": {
      "description": "Investigation or run not found for this account"
     },
     "409": {
      "description": "Invalid state or unavailable source access"
     }
    }
   }
  },
  "/api/investigations/{iid}/runs/{rid}/progress": {
   "parameters": [
    {
     "name": "iid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    },
    {
     "name": "rid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "get": {
    "operationId": "getInvestigationProgress",
    "summary": "Read bounded run and stage counts without opening workers",
    "responses": {
     "200": {
      "description": "Successful response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/InvestigationProgress"
        }
       }
      }
     },
     "401": {
      "description": "Authentication required"
     },
     "404": {
      "description": "Investigation or run not found for this account"
     },
     "409": {
      "description": "Invalid state or unavailable source access"
     }
    }
   }
  },
  "/api/investigations/{iid}/runs/{rid}/events": {
   "parameters": [
    {
     "name": "iid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    },
    {
     "name": "rid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "get": {
    "operationId": "streamInvestigationProgress",
    "summary": "Stream coalesced progress snapshots",
    "description": "SSE progress events contain InvestigationProgress JSON. Full initial snapshot, changes at most every two seconds, heartbeat comments when unchanged. Reconnect to recover current state. Frozen source permissions are rechecked on every refresh; revocation closes the stream. Authentication is the same bearer token or browser session as other endpoints.",
    "responses": {
     "200": {
      "description": "Progress stream; closes when finished or authorization is lost",
      "content": {
       "text/event-stream": {
        "schema": {
         "type": "string"
        }
       }
      }
     },
     "401": {
      "description": "Authentication required"
     },
     "404": {
      "description": "Investigation or run not found for this account"
     },
     "409": {
      "description": "Invalid state or unavailable source access"
     }
    }
   }
  },
  "/api/investigations/{iid}/runs/{rid}/results": {
   "parameters": [
    {
     "name": "iid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    },
    {
     "name": "rid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "get": {
    "operationId": "listInvestigationResults",
    "summary": "Read per-file AI results and attempt allocations",
    "description": "Newest attempts first, including incomplete and failed attempts. Requires current read access to every frozen source. Mission and agent-run IDs link to workspace history and task-scoped findings. Null usage is unknown, never zero. No worker is opened.",
    "parameters": [
     {
      "name": "limit",
      "in": "query",
      "schema": {
       "type": "integer",
       "default": 50,
       "maximum": 100
      }
     },
     {
      "name": "offset",
      "in": "query",
      "schema": {
       "type": "integer",
       "default": 0,
       "minimum": 0
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Per-file mission results",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/InvestigationMissionResult"
         }
        }
       }
      }
     },
     "401": {
      "description": "Authentication required"
     },
     "404": {
      "description": "Run not found for this account"
     },
     "409": {
      "description": "Source access unavailable"
     }
    }
   }
  },
  "/api/investigations": {
   "post": {
    "operationId": "createInvestigation",
    "summary": "Create a private investigation",
    "description": "Creates metadata only. Does not upload files or start compute. String limits are enforced in UTF-8 bytes.",
    "responses": {
     "200": {
      "description": "Resource or idempotent replay",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Investigation"
        }
       }
      }
     },
     "401": {
      "description": "Authentication required"
     },
     "404": {
      "description": "Investigation or run not found for this account"
     },
     "409": {
      "description": "Stale revision, changed idempotent request, or unavailable source access"
     },
     "400": {
      "description": "Invalid input, missing idempotency key, unknown fields, or invalid JSON"
     },
     "413": {
      "description": "Request body exceeds 256 KiB"
     },
     "201": {
      "description": "Created; Location identifies the resource",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Investigation"
        }
       }
      }
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/NewInvestigation"
       }
      }
     }
    },
    "parameters": [
     {
      "name": "Idempotency-Key",
      "in": "header",
      "required": true,
      "description": "1\u2013128 visible ASCII characters. Same key and normalized input replays the existing resource; changed input returns 409. Scoped to the account for collection creation and to the investigation for run creation.",
      "schema": {
       "type": "string",
       "minLength": 1,
       "maxLength": 128,
       "pattern": "^[!-~]+$"
      }
     }
    ]
   },
   "get": {
    "operationId": "listInvestigations",
    "summary": "List owned and invited projects, including the persistent default designation",
    "description": "Authorized organization collections ordered by creation time and ID descending.",
    "responses": {
     "200": {
      "description": "Resource or idempotent replay",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/Investigation"
         }
        }
       }
      }
     },
     "401": {
      "description": "Authentication required"
     },
     "404": {
      "description": "Investigation or run not found for this account"
     },
     "409": {
      "description": "Stale revision, changed idempotent request, or unavailable source access"
     }
    },
    "parameters": [
     {
      "name": "limit",
      "in": "query",
      "schema": {
       "type": "integer",
       "minimum": 1,
       "maximum": 100,
       "default": 50
      }
     },
     {
      "name": "offset",
      "in": "query",
      "schema": {
       "type": "integer",
       "minimum": 0,
       "default": 0
      }
     },
     {
      "name": "organizationId",
      "in": "query",
      "schema": {
       "type": "string"
      },
      "description": "Optional company scope. Dedicated tenant deployments reject a value conflicting with their configured company; access remains policy-filtered."
     }
    ]
   }
  },
  "/api/investigations/{iid}": {
   "get": {
    "operationId": "getInvestigation",
    "summary": "Read an investigation and its current members",
    "description": "Unavailable sources retain an opaque member ID with available=false; workspace IDs and names are omitted.",
    "responses": {
     "200": {
      "description": "Resource or idempotent replay",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/InvestigationDetail"
        }
       }
      }
     },
     "401": {
      "description": "Authentication required"
     },
     "404": {
      "description": "Investigation or run not found for this account"
     },
     "409": {
      "description": "Stale revision, changed idempotent request, or unavailable source access"
     }
    }
   },
   "parameters": [
    {
     "name": "iid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "patch": {
    "summary": "Rename project (effective editor); the default designation and storage paths stay unchanged",
    "parameters": [
     {
      "in": "path",
      "name": "iid",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Success",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "403": {
      "description": "Insufficient role"
     },
     "404": {
      "description": "Not accessible"
     },
     "409": {
      "description": "Revision conflict or active workspace work"
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "name": {
          "type": "string"
         },
         "description": {
          "type": "string"
         },
         "revision": {
          "type": "integer",
          "minimum": 1
         }
        },
        "required": [
         "name",
         "revision"
        ],
        "additionalProperties": false
       }
      }
     }
    }
   }
  },
  "/api/investigations/{iid}/members": {
   "put": {
    "operationId": "replaceInvestigationMembers",
    "summary": "Replace investigation membership atomically",
    "description": "Replace references using the current revision. Requires project editor access and independent viewer access to each source. An empty list removes references; home sessions remain. Frozen runs are unchanged. No 500-source project limit; each analysis selects at most 500.",
    "responses": {
     "200": {
      "description": "Resource or idempotent replay",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/InvestigationDetail"
        }
       }
      }
     },
     "401": {
      "description": "Authentication required"
     },
     "404": {
      "description": "Investigation or run not found for this account"
     },
     "409": {
      "description": "Stale revision, changed idempotent request, or unavailable source access"
     },
     "400": {
      "description": "Invalid input, missing idempotency key, unknown fields, or invalid JSON"
     },
     "413": {
      "description": "Request body exceeds 256 KiB"
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/InvestigationMembersRequest"
       }
      }
     }
    }
   },
   "parameters": [
    {
     "name": "iid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ]
  },
  "/api/investigations/{iid}/runs": {
   "post": {
    "operationId": "createInvestigationRun",
    "summary": "Save a draft investigation run and dependency plan",
    "description": "Freeze the current membership, objective, optional per-workspace objective overrides, agent, mutation policy, and aggregate AI budgets. Individual mode needs one member; correlation modes need two. Checks current editor access to all sources. Creation produces a draft; explicit start begins execution. Agent availability and funding are rechecked when dispatching AI work.",
    "responses": {
     "200": {
      "description": "Resource or idempotent replay",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/InvestigationRunDetail"
        }
       }
      }
     },
     "401": {
      "description": "Authentication required"
     },
     "404": {
      "description": "Investigation or run not found for this account"
     },
     "409": {
      "description": "Stale revision, changed idempotent request, or unavailable source access"
     },
     "400": {
      "description": "Invalid input, missing idempotency key, unknown fields, or invalid JSON"
     },
     "413": {
      "description": "Request body exceeds 256 KiB"
     },
     "201": {
      "description": "Created; Location identifies the resource",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/InvestigationRunDetail"
        }
       }
      }
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/InvestigationRunRequest"
       }
      }
     }
    },
    "parameters": [
     {
      "name": "Idempotency-Key",
      "in": "header",
      "required": true,
      "description": "1\u2013128 visible ASCII characters. Same key and normalized input replays the existing resource; changed input returns 409. Scoped to the account for collection creation and to the investigation for run creation.",
      "schema": {
       "type": "string",
       "minLength": 1,
       "maxLength": 128,
       "pattern": "^[!-~]+$"
      }
     }
    ]
   },
   "get": {
    "operationId": "listInvestigationRuns",
    "summary": "List visible saved investigation runs",
    "description": "Runs with any inaccessible source in their frozen membership are omitted before pagination.",
    "responses": {
     "200": {
      "description": "Resource or idempotent replay",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/InvestigationRun"
         }
        }
       }
      }
     },
     "401": {
      "description": "Authentication required"
     },
     "404": {
      "description": "Investigation or run not found for this account"
     },
     "409": {
      "description": "Stale revision, changed idempotent request, or unavailable source access"
     }
    },
    "parameters": [
     {
      "name": "limit",
      "in": "query",
      "schema": {
       "type": "integer",
       "minimum": 1,
       "maximum": 100,
       "default": 50
      }
     },
     {
      "name": "offset",
      "in": "query",
      "schema": {
       "type": "integer",
       "minimum": 0,
       "default": 0
      }
     }
    ]
   },
   "parameters": [
    {
     "name": "iid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ]
  },
  "/api/investigations/{iid}/runs/{rid}": {
   "get": {
    "operationId": "getInvestigationRun",
    "summary": "Read a saved run and its task dependencies",
    "description": "Requires current read access to every source in the frozen membership, including sources removed from the current collection. Unavailable sources return 409.",
    "responses": {
     "200": {
      "description": "Resource or idempotent replay",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/InvestigationRunDetail"
        }
       }
      }
     },
     "401": {
      "description": "Authentication required"
     },
     "404": {
      "description": "Investigation or run not found for this account"
     },
     "409": {
      "description": "Stale revision, changed idempotent request, or unavailable source access"
     }
    }
   },
   "parameters": [
    {
     "name": "iid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    },
    {
     "name": "rid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ]
  },
  "/api/investigations/{iid}/uploads": {
   "parameters": [
    {
     "name": "iid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "get": {
    "operationId": "listInvestigationUploads",
    "summary": "Read the saved upload manifest",
    "responses": {
     "200": {
      "description": "Saved upload entries",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/InvestigationUpload"
         }
        }
       }
      }
     },
     "400": {
      "description": "Invalid declaration or files"
     },
     "401": {
      "description": "Authentication required"
     },
     "404": {
      "description": "Investigation or upload not found"
     },
     "409": {
      "description": "Conflicting file identity, settings, permissions"
     },
     "413": {
      "description": "Upload or manifest too large"
     },
     "503": {
      "description": "Storage temporarily unavailable"
     }
    }
   },
   "post": {
    "operationId": "declareInvestigationUploads",
    "summary": "Append files to an investigation upload manifest",
    "description": "Declare 1\u2013500 binaries per batch. Projects may hold more than 500. Editor uploads use the project storage placement; uploader identity is recorded. Stable file keys replay matching declarations.",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "files"
        ],
        "properties": {
         "files": {
          "type": "array",
          "minItems": 1,
          "maxItems": 500,
          "items": {
           "$ref": "#/components/schemas/InvestigationUploadSpec"
          }
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Saved upload entries",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/InvestigationUpload"
         }
        }
       }
      }
     },
     "400": {
      "description": "Invalid declaration or files"
     },
     "401": {
      "description": "Authentication required"
     },
     "404": {
      "description": "Investigation or upload not found"
     },
     "409": {
      "description": "Conflicting file identity, settings, permissions"
     },
     "413": {
      "description": "Upload or manifest too large"
     },
     "503": {
      "description": "Storage temporarily unavailable"
     }
    }
   }
  },
  "/api/investigations/{iid}/uploads/{uid}": {
   "parameters": [
    {
     "name": "iid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    },
    {
     "name": "uid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "put": {
    "operationId": "uploadInvestigationFile",
    "summary": "Upload or retry one declared binary and its optional PDB",
    "description": "Multipart names and sizes must match the declaration. File bytes and symbols are bound to the saved entry before workspace creation; changed bytes return 409. Uploads reuse the account upload service and suppress autorun. Successful entries remain saved when other files fail. Each declaration allocates an independent session, even for identical bytes and settings. Retries use the saved allocation and preserve current session settings. A retry transfers the entire file; partial-byte resumption is not supported.",
    "requestBody": {
     "required": true,
     "content": {
      "multipart/form-data": {
       "schema": {
        "type": "object",
        "required": [
         "file"
        ],
        "properties": {
         "file": {
          "type": "string",
          "format": "binary"
         },
         "pdb": {
          "type": "string",
          "format": "binary"
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Durable upload receipt and membership association",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/InvestigationUpload"
        }
       }
      }
     },
     "400": {
      "description": "Invalid declaration or files"
     },
     "401": {
      "description": "Authentication required"
     },
     "404": {
      "description": "Investigation or upload not found"
     },
     "409": {
      "description": "Conflicting file identity, settings, permissions"
     },
     "413": {
      "description": "Upload or manifest too large"
     },
     "503": {
      "description": "Storage temporarily unavailable"
     }
    }
   }
  },
  "/api/investigations/{iid}/runs/{rid}/correlations": {
   "parameters": [
    {
     "name": "iid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    },
    {
     "name": "rid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "get": {
    "operationId": "listInvestigationCorrelations",
    "summary": "Read cross-file coordinator reports and usage",
    "description": "Newest coordinator attempts first, including failed and incomplete attempts. Requires current collection read access and read access to every frozen source. Coverage is derived from captured observations. Relationship assessments are model conclusions, not independent verification. Null usage is unknown. No worker is opened.",
    "parameters": [
     {
      "name": "limit",
      "in": "query",
      "schema": {
       "type": "integer",
       "default": 10,
       "maximum": 100
      }
     },
     {
      "name": "offset",
      "in": "query",
      "schema": {
       "type": "integer",
       "default": 0,
       "minimum": 0
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Coordinator reports and allocations",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/InvestigationCorrelationResult"
         }
        }
       }
      }
     },
     "401": {
      "description": "Authentication required"
     },
     "404": {
      "description": "Run not found for this account"
     },
     "409": {
      "description": "Source access unavailable"
     }
    }
   }
  },
  "/api/investigations/{iid}/runs/{rid}/observations/{oid}": {
   "parameters": [
    {
     "name": "iid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    },
    {
     "name": "rid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    },
    {
     "name": "oid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "get": {
    "operationId": "getInvestigationObservation",
    "summary": "Resolve a captured correlation observation",
    "description": "Returns the exact captured source result with its revision and digest, plus current revision and staleness. Requires current collection read access and read access to every frozen source. Only observations belonging to this run are resolved. No worker is opened.",
    "responses": {
     "200": {
      "description": "Captured evidence and source revision status",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/InvestigationObservationResponse"
        }
       }
      }
     },
     "401": {
      "description": "Authentication required"
     },
     "404": {
      "description": "Run or observation not found for this account"
     },
     "409": {
      "description": "Source access unavailable"
     }
    }
   }
  },
  "/api/projects/{iid}/runs/{rid}/control": {
   "parameters": [
    {
     "name": "iid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    },
    {
     "name": "rid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "post": {
    "operationId": "project_controlInvestigationRun",
    "summary": "Start, pause, resume, cancel, or retry investigation tasks",
    "description": "Start queues analysis, followed by individual AI missions and/or a read-only cross-file coordinator according to the saved mode. Combined mode waits for the individual missions before correlation. Pause blocks new task and child-mission dispatch; running stages finish. Cancel stops owned work and detaches shared analysis. Retry selected failed/interrupted/blocked/canceled tasks under the current editor approval with new attempts and remaining aggregate budget. Completed runs and unresolved unknown usage cannot be retried. Prior usage and results are retained. Active members with effective viewer/editor grants can read. Editing requires effective editor access; aggregate reports require independent access to every frozen source. Home sessions cannot be removed by editing references.",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "action"
        ],
        "properties": {
         "action": {
          "type": "string",
          "enum": [
           "start",
           "pause",
           "resume",
           "cancel",
           "retry"
          ]
         },
         "taskIds": {
          "type": "array",
          "maxItems": 500,
          "items": {
           "type": "string"
          },
          "description": "Required only for retry; select analysis or investigate tasks in failed, interrupted, blocked, or queued state."
         }
        }
       }
      }
     }
    },
    "responses": {
     "204": {
      "description": "Successful response"
     },
     "401": {
      "description": "Authentication required"
     },
     "404": {
      "description": "Investigation or run not found for this account"
     },
     "409": {
      "description": "Invalid state or unavailable source access"
     },
     "400": {
      "description": "Invalid action or request"
     }
    }
   }
  },
  "/api/projects/{iid}/runs/{rid}/attempts": {
   "parameters": [
    {
     "name": "iid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    },
    {
     "name": "rid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "get": {
    "operationId": "project_listInvestigationAttempts",
    "summary": "Read persisted attempt history, newest first",
    "parameters": [
     {
      "name": "limit",
      "in": "query",
      "schema": {
       "type": "integer",
       "default": 50,
       "maximum": 100
      }
     },
     {
      "name": "offset",
      "in": "query",
      "schema": {
       "type": "integer",
       "default": 0,
       "minimum": 0
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Successful response",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/InvestigationAttempt"
         }
        }
       }
      }
     },
     "401": {
      "description": "Authentication required"
     },
     "404": {
      "description": "Investigation or run not found for this account"
     },
     "409": {
      "description": "Invalid state or unavailable source access"
     }
    },
    "description": " Active members with effective viewer/editor grants can read. Editing requires effective editor access; aggregate reports require independent access to every frozen source. Home sessions cannot be removed by editing references."
   }
  },
  "/api/projects/{iid}/runs/{rid}/progress": {
   "parameters": [
    {
     "name": "iid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    },
    {
     "name": "rid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "get": {
    "operationId": "project_getInvestigationProgress",
    "summary": "Read bounded run and stage counts without opening workers",
    "responses": {
     "200": {
      "description": "Successful response",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/InvestigationProgress"
        }
       }
      }
     },
     "401": {
      "description": "Authentication required"
     },
     "404": {
      "description": "Investigation or run not found for this account"
     },
     "409": {
      "description": "Invalid state or unavailable source access"
     }
    },
    "description": " Active members with effective viewer/editor grants can read. Editing requires effective editor access; aggregate reports require independent access to every frozen source. Home sessions cannot be removed by editing references."
   }
  },
  "/api/projects/{iid}/runs/{rid}/events": {
   "parameters": [
    {
     "name": "iid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    },
    {
     "name": "rid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "get": {
    "operationId": "project_streamInvestigationProgress",
    "summary": "Stream coalesced progress snapshots",
    "description": "SSE progress events contain InvestigationProgress JSON. Full initial snapshot, changes at most every two seconds, heartbeat comments when unchanged. Reconnect to recover current state. Frozen source permissions are rechecked on every refresh; revocation closes the stream. Authentication is the same bearer token or browser session as other endpoints. Active members with effective viewer/editor grants can read. Editing requires effective editor access; aggregate reports require independent access to every frozen source. Home sessions cannot be removed by editing references.",
    "responses": {
     "200": {
      "description": "Progress stream; closes when finished or authorization is lost",
      "content": {
       "text/event-stream": {
        "schema": {
         "type": "string"
        }
       }
      }
     },
     "401": {
      "description": "Authentication required"
     },
     "404": {
      "description": "Investigation or run not found for this account"
     },
     "409": {
      "description": "Invalid state or unavailable source access"
     }
    }
   }
  },
  "/api/projects/{iid}/runs/{rid}/results": {
   "parameters": [
    {
     "name": "iid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    },
    {
     "name": "rid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "get": {
    "operationId": "project_listInvestigationResults",
    "summary": "Read per-file AI results and attempt allocations",
    "description": "Newest attempts first, including incomplete and failed attempts. Requires current read access to every frozen source. Mission and agent-run IDs link to workspace history and task-scoped findings. Null usage is unknown, never zero. No worker is opened. Active members with effective viewer/editor grants can read. Editing requires effective editor access; aggregate reports require independent access to every frozen source. Home sessions cannot be removed by editing references.",
    "parameters": [
     {
      "name": "limit",
      "in": "query",
      "schema": {
       "type": "integer",
       "default": 50,
       "maximum": 100
      }
     },
     {
      "name": "offset",
      "in": "query",
      "schema": {
       "type": "integer",
       "default": 0,
       "minimum": 0
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Per-file mission results",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/InvestigationMissionResult"
         }
        }
       }
      }
     },
     "401": {
      "description": "Authentication required"
     },
     "404": {
      "description": "Run not found for this account"
     },
     "409": {
      "description": "Source access unavailable"
     }
    }
   }
  },
  "/api/projects": {
   "post": {
    "operationId": "project_createInvestigation",
    "summary": "Create a private investigation",
    "description": "Creates metadata only. Does not upload files or start compute. String limits are enforced in UTF-8 bytes. Active members with effective viewer/editor grants can read. Editing requires effective editor access; aggregate reports require independent access to every frozen source. Home sessions cannot be removed by editing references.",
    "responses": {
     "200": {
      "description": "Resource or idempotent replay",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Investigation"
        }
       }
      }
     },
     "401": {
      "description": "Authentication required"
     },
     "404": {
      "description": "Investigation or run not found for this account"
     },
     "409": {
      "description": "Stale revision, changed idempotent request, or unavailable source access"
     },
     "400": {
      "description": "Invalid input, missing idempotency key, unknown fields, or invalid JSON"
     },
     "413": {
      "description": "Request body exceeds 256 KiB"
     },
     "201": {
      "description": "Created; Location identifies the resource",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Investigation"
        }
       }
      }
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/NewInvestigation"
       }
      }
     }
    },
    "parameters": [
     {
      "name": "Idempotency-Key",
      "in": "header",
      "required": true,
      "description": "1\u2013128 visible ASCII characters. Same key and normalized input replays the existing resource; changed input returns 409. Scoped to the account for collection creation and to the investigation for run creation.",
      "schema": {
       "type": "string",
       "minLength": 1,
       "maxLength": 128,
       "pattern": "^[!-~]+$"
      }
     }
    ]
   },
   "get": {
    "operationId": "project_listInvestigations",
    "summary": "List owned and invited projects, including the persistent default designation",
    "description": "Authorized organization collections ordered by creation time and ID descending. Active members with effective viewer/editor grants can read. Editing requires effective editor access; aggregate reports require independent access to every frozen source. Home sessions cannot be removed by editing references.",
    "responses": {
     "200": {
      "description": "Resource or idempotent replay",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/Investigation"
         }
        }
       }
      }
     },
     "401": {
      "description": "Authentication required"
     },
     "404": {
      "description": "Investigation or run not found for this account"
     },
     "409": {
      "description": "Stale revision, changed idempotent request, or unavailable source access"
     }
    },
    "parameters": [
     {
      "name": "limit",
      "in": "query",
      "schema": {
       "type": "integer",
       "minimum": 1,
       "maximum": 100,
       "default": 50
      }
     },
     {
      "name": "offset",
      "in": "query",
      "schema": {
       "type": "integer",
       "minimum": 0,
       "default": 0
      }
     },
     {
      "name": "organizationId",
      "in": "query",
      "schema": {
       "type": "string"
      },
      "description": "Optional company scope. Dedicated tenant deployments reject a value conflicting with their configured company; access remains policy-filtered."
     }
    ]
   }
  },
  "/api/projects/{iid}": {
   "get": {
    "operationId": "project_getInvestigation",
    "summary": "Read an investigation and its current members",
    "description": "Unavailable sources retain an opaque member ID with available=false; workspace IDs and names are omitted. Active members with effective viewer/editor grants can read. Editing requires effective editor access; aggregate reports require independent access to every frozen source. Home sessions cannot be removed by editing references.",
    "responses": {
     "200": {
      "description": "Resource or idempotent replay",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/InvestigationDetail"
        }
       }
      }
     },
     "401": {
      "description": "Authentication required"
     },
     "404": {
      "description": "Investigation or run not found for this account"
     },
     "409": {
      "description": "Stale revision, changed idempotent request, or unavailable source access"
     }
    }
   },
   "parameters": [
    {
     "name": "iid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "patch": {
    "summary": "Rename project (effective editor); the default designation and storage paths stay unchanged",
    "parameters": [
     {
      "in": "path",
      "name": "iid",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Success",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "403": {
      "description": "Insufficient role"
     },
     "404": {
      "description": "Not accessible"
     },
     "409": {
      "description": "Revision conflict or active workspace work"
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "name": {
          "type": "string"
         },
         "description": {
          "type": "string"
         },
         "revision": {
          "type": "integer",
          "minimum": 1
         }
        },
        "required": [
         "name",
         "revision"
        ],
        "additionalProperties": false
       }
      }
     }
    }
   }
  },
  "/api/projects/{iid}/members": {
   "put": {
    "operationId": "project_replaceInvestigationMembers",
    "summary": "Replace investigation membership atomically",
    "description": "Replace references using the current revision. Requires project editor access and independent viewer access to each source. An empty list removes references; home sessions remain. Frozen runs are unchanged. No 500-source project limit; each analysis selects at most 500.",
    "responses": {
     "200": {
      "description": "Resource or idempotent replay",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/InvestigationDetail"
        }
       }
      }
     },
     "401": {
      "description": "Authentication required"
     },
     "404": {
      "description": "Investigation or run not found for this account"
     },
     "409": {
      "description": "Stale revision, changed idempotent request, or unavailable source access"
     },
     "400": {
      "description": "Invalid input, missing idempotency key, unknown fields, or invalid JSON"
     },
     "413": {
      "description": "Request body exceeds 256 KiB"
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/InvestigationMembersRequest"
       }
      }
     }
    }
   },
   "parameters": [
    {
     "name": "iid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ]
  },
  "/api/projects/{iid}/runs": {
   "post": {
    "operationId": "project_createInvestigationRun",
    "summary": "Save a draft investigation run and dependency plan",
    "description": "Freeze the current membership, objective, optional per-workspace objective overrides, agent, mutation policy, and aggregate AI budgets. Individual mode needs one member; correlation modes need two. Checks current editor access to all sources. Creation produces a draft; explicit start begins execution. Agent availability and funding are rechecked when dispatching AI work. Active members with effective viewer/editor grants can read. Editing requires effective editor access; aggregate reports require independent access to every frozen source. Home sessions cannot be removed by editing references.",
    "responses": {
     "200": {
      "description": "Resource or idempotent replay",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/InvestigationRunDetail"
        }
       }
      }
     },
     "401": {
      "description": "Authentication required"
     },
     "404": {
      "description": "Investigation or run not found for this account"
     },
     "409": {
      "description": "Stale revision, changed idempotent request, or unavailable source access"
     },
     "400": {
      "description": "Invalid input, missing idempotency key, unknown fields, or invalid JSON"
     },
     "413": {
      "description": "Request body exceeds 256 KiB"
     },
     "201": {
      "description": "Created; Location identifies the resource",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/InvestigationRunDetail"
        }
       }
      }
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/InvestigationRunRequest"
       }
      }
     }
    },
    "parameters": [
     {
      "name": "Idempotency-Key",
      "in": "header",
      "required": true,
      "description": "1\u2013128 visible ASCII characters. Same key and normalized input replays the existing resource; changed input returns 409. Scoped to the account for collection creation and to the investigation for run creation.",
      "schema": {
       "type": "string",
       "minLength": 1,
       "maxLength": 128,
       "pattern": "^[!-~]+$"
      }
     }
    ]
   },
   "get": {
    "operationId": "project_listInvestigationRuns",
    "summary": "List visible saved investigation runs",
    "description": "Runs with any inaccessible source in their frozen membership are omitted before pagination. Active members with effective viewer/editor grants can read. Editing requires effective editor access; aggregate reports require independent access to every frozen source. Home sessions cannot be removed by editing references.",
    "responses": {
     "200": {
      "description": "Resource or idempotent replay",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/InvestigationRun"
         }
        }
       }
      }
     },
     "401": {
      "description": "Authentication required"
     },
     "404": {
      "description": "Investigation or run not found for this account"
     },
     "409": {
      "description": "Stale revision, changed idempotent request, or unavailable source access"
     }
    },
    "parameters": [
     {
      "name": "limit",
      "in": "query",
      "schema": {
       "type": "integer",
       "minimum": 1,
       "maximum": 100,
       "default": 50
      }
     },
     {
      "name": "offset",
      "in": "query",
      "schema": {
       "type": "integer",
       "minimum": 0,
       "default": 0
      }
     }
    ]
   },
   "parameters": [
    {
     "name": "iid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ]
  },
  "/api/projects/{iid}/runs/{rid}": {
   "get": {
    "operationId": "project_getInvestigationRun",
    "summary": "Read a saved run and its task dependencies",
    "description": "Requires current read access to every source in the frozen membership, including sources removed from the current collection. Unavailable sources return 409. Active members with effective viewer/editor grants can read. Editing requires effective editor access; aggregate reports require independent access to every frozen source. Home sessions cannot be removed by editing references.",
    "responses": {
     "200": {
      "description": "Resource or idempotent replay",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/InvestigationRunDetail"
        }
       }
      }
     },
     "401": {
      "description": "Authentication required"
     },
     "404": {
      "description": "Investigation or run not found for this account"
     },
     "409": {
      "description": "Stale revision, changed idempotent request, or unavailable source access"
     }
    }
   },
   "parameters": [
    {
     "name": "iid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    },
    {
     "name": "rid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ]
  },
  "/api/projects/{iid}/uploads": {
   "parameters": [
    {
     "name": "iid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "get": {
    "operationId": "project_listInvestigationUploads",
    "summary": "Read the saved upload manifest",
    "responses": {
     "200": {
      "description": "Saved upload entries",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/InvestigationUpload"
         }
        }
       }
      }
     },
     "400": {
      "description": "Invalid declaration or files"
     },
     "401": {
      "description": "Authentication required"
     },
     "404": {
      "description": "Investigation or upload not found"
     },
     "409": {
      "description": "Conflicting file identity, settings, permissions"
     },
     "413": {
      "description": "Upload or manifest too large"
     },
     "503": {
      "description": "Storage temporarily unavailable"
     }
    },
    "description": " Active members with effective viewer/editor grants can read. Editing requires effective editor access; aggregate reports require independent access to every frozen source. Home sessions cannot be removed by editing references."
   },
   "post": {
    "operationId": "project_declareInvestigationUploads",
    "summary": "Append files to an investigation upload manifest",
    "description": "Declare 1\u2013500 binaries per batch. Projects may hold more than 500. Editor uploads use the project storage placement; uploader identity is recorded. Stable file keys replay matching declarations.",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "files"
        ],
        "properties": {
         "files": {
          "type": "array",
          "minItems": 1,
          "maxItems": 500,
          "items": {
           "$ref": "#/components/schemas/InvestigationUploadSpec"
          }
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Saved upload entries",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/InvestigationUpload"
         }
        }
       }
      }
     },
     "400": {
      "description": "Invalid declaration or files"
     },
     "401": {
      "description": "Authentication required"
     },
     "404": {
      "description": "Investigation or upload not found"
     },
     "409": {
      "description": "Conflicting file identity, settings, permissions"
     },
     "413": {
      "description": "Upload or manifest too large"
     },
     "503": {
      "description": "Storage temporarily unavailable"
     }
    }
   }
  },
  "/api/projects/{iid}/uploads/{uid}": {
   "parameters": [
    {
     "name": "iid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    },
    {
     "name": "uid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "put": {
    "operationId": "project_uploadInvestigationFile",
    "summary": "Upload or retry one declared binary and its optional PDB",
    "description": "Multipart names and sizes must match the declaration. File bytes and symbols are bound to the saved entry before workspace creation; changed bytes return 409. Uploads reuse the account upload service and suppress autorun. Successful entries remain saved when other files fail. Each declaration allocates an independent session, even for identical bytes and settings. Retries use the saved allocation and preserve current session settings. A retry transfers the entire file; partial-byte resumption is not supported. Active members with effective viewer/editor grants can read. Editing requires effective editor access; aggregate reports require independent access to every frozen source. Home sessions cannot be removed by editing references.",
    "requestBody": {
     "required": true,
     "content": {
      "multipart/form-data": {
       "schema": {
        "type": "object",
        "required": [
         "file"
        ],
        "properties": {
         "file": {
          "type": "string",
          "format": "binary"
         },
         "pdb": {
          "type": "string",
          "format": "binary"
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Durable upload receipt and membership association",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/InvestigationUpload"
        }
       }
      }
     },
     "400": {
      "description": "Invalid declaration or files"
     },
     "401": {
      "description": "Authentication required"
     },
     "404": {
      "description": "Investigation or upload not found"
     },
     "409": {
      "description": "Conflicting file identity, settings, permissions"
     },
     "413": {
      "description": "Upload or manifest too large"
     },
     "503": {
      "description": "Storage temporarily unavailable"
     }
    }
   }
  },
  "/api/projects/{iid}/runs/{rid}/correlations": {
   "parameters": [
    {
     "name": "iid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    },
    {
     "name": "rid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "get": {
    "operationId": "project_listInvestigationCorrelations",
    "summary": "Read cross-file coordinator reports and usage",
    "description": "Newest coordinator attempts first, including failed and incomplete attempts. Requires current collection read access and read access to every frozen source. Coverage is derived from captured observations. Relationship assessments are model conclusions, not independent verification. Null usage is unknown. No worker is opened. Active members with effective viewer/editor grants can read. Editing requires effective editor access; aggregate reports require independent access to every frozen source. Home sessions cannot be removed by editing references.",
    "parameters": [
     {
      "name": "limit",
      "in": "query",
      "schema": {
       "type": "integer",
       "default": 10,
       "maximum": 100
      }
     },
     {
      "name": "offset",
      "in": "query",
      "schema": {
       "type": "integer",
       "default": 0,
       "minimum": 0
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Coordinator reports and allocations",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/InvestigationCorrelationResult"
         }
        }
       }
      }
     },
     "401": {
      "description": "Authentication required"
     },
     "404": {
      "description": "Run not found for this account"
     },
     "409": {
      "description": "Source access unavailable"
     }
    }
   }
  },
  "/api/projects/{iid}/runs/{rid}/observations/{oid}": {
   "parameters": [
    {
     "name": "iid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    },
    {
     "name": "rid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    },
    {
     "name": "oid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "get": {
    "operationId": "project_getInvestigationObservation",
    "summary": "Resolve a captured correlation observation",
    "description": "Returns the exact captured source result with its revision and digest, plus current revision and staleness. Requires current collection read access and read access to every frozen source. Only observations belonging to this run are resolved. No worker is opened. Active members with effective viewer/editor grants can read. Editing requires effective editor access; aggregate reports require independent access to every frozen source. Home sessions cannot be removed by editing references.",
    "responses": {
     "200": {
      "description": "Captured evidence and source revision status",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/InvestigationObservationResponse"
        }
       }
      }
     },
     "401": {
      "description": "Authentication required"
     },
     "404": {
      "description": "Run or observation not found for this account"
     },
     "409": {
      "description": "Source access unavailable"
     }
    }
   }
  },
  "/api/projects/{iid}/references": {
   "put": {
    "operationId": "project_replaceInvestigationMembers",
    "summary": "Replace investigation membership atomically",
    "description": "Replace references using the current revision. Requires project editor access and independent viewer access to each source. An empty list removes references; home sessions remain. Frozen runs are unchanged. No 500-source project limit; each analysis selects at most 500.",
    "responses": {
     "200": {
      "description": "Resource or idempotent replay",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/InvestigationDetail"
        }
       }
      }
     },
     "401": {
      "description": "Authentication required"
     },
     "404": {
      "description": "Investigation or run not found for this account"
     },
     "409": {
      "description": "Stale revision, changed idempotent request, or unavailable source access"
     },
     "400": {
      "description": "Invalid input, missing idempotency key, unknown fields, or invalid JSON"
     },
     "413": {
      "description": "Request body exceeds 256 KiB"
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/InvestigationMembersRequest"
       }
      }
     }
    }
   },
   "parameters": [
    {
     "name": "iid",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ]
  },
  "/api/projects/{iid}/access": {
   "get": {
    "summary": "List effective product grants",
    "parameters": [
     {
      "in": "path",
      "name": "iid",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Success",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "403": {
      "description": "Insufficient role"
     },
     "404": {
      "description": "Not accessible"
     },
     "409": {
      "description": "Revision conflict or active workspace work"
     }
    },
    "description": "Requires company administration and applicable content grants. Home moves require edit access at both homes and preserve physical storage ownership. Public sharing never includes unselected sources or reports."
   },
   "post": {
    "summary": "Grant product access to an active company member",
    "parameters": [
     {
      "in": "path",
      "name": "iid",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Success",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "403": {
      "description": "Insufficient role"
     },
     "404": {
      "description": "Not accessible"
     },
     "409": {
      "description": "Revision conflict or active workspace work"
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "username": {
          "type": "string"
         },
         "role": {
          "type": "string",
          "enum": [
           "viewer",
           "editor"
          ]
         }
        },
        "required": [
         "username",
         "role"
        ],
        "additionalProperties": false
       }
      }
     }
    },
    "description": "Requires company administration and applicable content grants. Home moves require edit access at both homes and preserve physical storage ownership. Public sharing never includes unselected sources or reports."
   }
  },
  "/api/projects/{iid}/access/{uid}": {
   "delete": {
    "summary": "Revoke a direct product grant",
    "parameters": [
     {
      "in": "path",
      "name": "iid",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "in": "path",
      "name": "uid",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Success",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "403": {
      "description": "Insufficient role"
     },
     "404": {
      "description": "Not accessible"
     },
     "409": {
      "description": "Revision conflict or active workspace work"
     }
    },
    "description": "Requires company administration and applicable content grants. Home moves require edit access at both homes and preserve physical storage ownership. Public sharing never includes unselected sources or reports."
   }
  },
  "/api/projects/{iid}/share": {
   "get": {
    "summary": "Read public selection metadata",
    "parameters": [
     {
      "in": "path",
      "name": "iid",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Success",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "403": {
      "description": "Insufficient role"
     },
     "404": {
      "description": "Not accessible"
     },
     "409": {
      "description": "Revision conflict or active workspace work"
     }
    },
    "description": "Requires company administration and applicable content grants. Home moves require edit access at both homes and preserve physical storage ownership. Public sharing never includes unselected sources or reports."
   },
   "post": {
    "summary": "Organization admin publishes an explicit selection of saved content with current resource editor access",
    "parameters": [
     {
      "in": "path",
      "name": "iid",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Success",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "403": {
      "description": "Insufficient role"
     },
     "404": {
      "description": "Not accessible"
     },
     "409": {
      "description": "Revision conflict or active workspace work"
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/PublicScopeRequest"
       }
      }
     }
    }
   },
   "delete": {
    "summary": "Revoke the public selection",
    "parameters": [
     {
      "in": "path",
      "name": "iid",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Success",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "403": {
      "description": "Insufficient role"
     },
     "404": {
      "description": "Not accessible"
     },
     "409": {
      "description": "Revision conflict or active workspace work"
     }
    },
    "description": "Requires company administration and applicable content grants. Home moves require edit access at both homes and preserve physical storage ownership. Public sharing never includes unselected sources or reports."
   },
   "patch": {
    "operationId": "updateProjectPublicScope",
    "summary": "Organization admin publishes an explicit selection of saved content with current resource editor access",
    "parameters": [
     {
      "name": "iid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/PublicScopeRequest"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Unchanged token with a revised explicit saved selection",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/SharingLink"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/error"
     }
    }
   }
  },
  "/api/s/{sid}/move": {
   "post": {
    "summary": "Move a session home under current company-admin approval",
    "parameters": [
     {
      "in": "path",
      "name": "sid",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "202": {
      "description": "Accepted",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "403": {
      "description": "Insufficient role"
     },
     "404": {
      "description": "Not accessible"
     },
     "409": {
      "description": "Revision conflict or active workspace work"
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "projectId": {
          "type": "string"
         }
        },
        "required": [
         "projectId"
        ],
        "additionalProperties": false
       }
      }
     }
    },
    "description": "Requires company administration and applicable content grants. Home moves require edit access at both homes and preserve physical storage ownership. Public sharing never includes unselected sources or reports."
   }
  },
  "/api/project-moves/{mid}": {
   "get": {
    "summary": "List effective product grants",
    "parameters": [
     {
      "in": "path",
      "name": "mid",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Success",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "403": {
      "description": "Insufficient role"
     },
     "404": {
      "description": "Not accessible"
     },
     "409": {
      "description": "Revision conflict or active workspace work"
     }
    },
    "description": "Requires company administration and applicable content grants. Home moves require edit access at both homes and preserve physical storage ownership. Public sharing never includes unselected sources or reports."
   }
  },
  "/api/s/{sid}/sharing": {
   "get": {
    "operationId": "getBinarySharing",
    "summary": "Effective people, access sources, public links, and sharing authority (member)",
    "parameters": [
     {
      "name": "sid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Effective sharing state",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/SharingState"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/error"
     }
    }
   }
  },
  "/api/projects/{iid}/sharing": {
   "get": {
    "operationId": "getProjectSharing",
    "summary": "Effective people, access sources, public links, and sharing authority (member)",
    "parameters": [
     {
      "name": "iid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Effective sharing state",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/SharingState"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/error"
     }
    }
   }
  },
  "/api/s/{sid}/triage/jev": {
   "post": {
    "operationId": "jevTriage",
    "summary": "Advance the shared Jev function ranking by one batch (viewer)",
    "description": "Evaluates every function in batches of eight, using bounded metadata and up to 2048 bytes sampled across decompiled code per function. Jev scores inspection value against low, medium and high levels; confidence is separate. Uses the account's OpenRouter key or pooled funding. Pass key and evaluated from GET /triage or the preceding response. Stale cursors return current progress without a provider call. Incomplete rankings expose provisional items. No static shortlist or fallback.",
    "parameters": [
     {
      "$ref": "#/components/parameters/sid"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "limit": {
          "type": "integer",
          "minimum": 1,
          "maximum": 500,
          "default": 100,
          "description": "How many completed ranking rows to return"
         },
         "key": {
          "type": "string",
          "description": "Ranking cache key from the preceding response"
         },
         "evaluated": {
          "type": "integer",
          "minimum": 0,
          "default": 0,
          "description": "Evaluated cursor from the preceding response"
         }
        },
        "additionalProperties": false
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "JSON result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Triage"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/badRequest"
     },
     "404": {
      "$ref": "#/components/responses/notFound"
     },
     "502": {
      "description": "OpenRouter or Jev failed or returned an invalid decision",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/error"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     },
     "402": {
      "description": "Organization access is required"
     }
    }
   }
  },
  "/api/organizations": {
   "get": {
    "operationId": "get_api_organizations",
    "summary": "List platform deployment registrations or tenant-local company metadata",
    "parameters": [],
    "responses": {
     "200": {
      "description": "Authorized company administration result",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "anyOf": [
           {
            "$ref": "#/components/schemas/TenantDeployment"
           },
           {
            "$ref": "#/components/schemas/CompanyOrganization"
           }
          ]
         }
        }
       }
      }
     },
     "403": {
      "description": "Administration denied"
     },
     "409": {
      "description": "Revision changed"
     },
     "503": {
      "description": "Administration storage unavailable"
     }
    },
    "description": "Platform mode requires a platform administrator and returns TenantDeployment records. Tenant mode returns permitted local CompanyOrganization records. Registry IDs identify deployments and are not tenant-local membership IDs."
   },
   "post": {
    "operationId": "post_api_organizations",
    "summary": "Register a company deployment in platform mode",
    "parameters": [],
    "responses": {
     "201": {
      "description": "Authorized company administration result"
     },
     "403": {
      "description": "Administration denied"
     },
     "409": {
      "description": "Revision changed"
     },
     "503": {
      "description": "Administration storage unavailable"
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "required": [
         "name",
         "adminUsername",
         "contactEmail",
         "code"
        ],
        "properties": {
         "name": {
          "type": "string",
          "maxLength": 200
         },
         "adminUsername": {
          "type": "string"
         },
         "contactEmail": {
          "type": "string",
          "format": "email"
         },
         "code": {
          "type": "string",
          "minLength": 3,
          "maxLength": 63,
          "pattern": "^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$",
          "description": "Unique permanent company code. New tenant registrations reserve admin, api, app, www, and platform."
         }
        }
       }
      }
     }
    },
    "description": "Stores deployment and initial administrator metadata only. Operators provision infrastructure and initialize the tenant-local pending administrator. Tenant mode does not register this POST route. The retained shared-development mode still uses its existing local provisioning handler."
   }
  },
  "/api/organizations/{oid}/members": {
   "get": {
    "operationId": "get_api_organizations_oid_members",
    "summary": "List company members for authorized administration",
    "parameters": [
     {
      "name": "oid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Authorized company administration result"
     },
     "403": {
      "description": "Administration denied"
     },
     "409": {
      "description": "Revision changed"
     },
     "503": {
      "description": "Administration storage unavailable"
     }
    }
   }
  },
  "/api/organizations/{oid}/members/{uid}": {
   "patch": {
    "operationId": "patch_api_organizations_oid_members_uid",
    "summary": "Change one membership role or enabled state using its current revision",
    "parameters": [
     {
      "name": "oid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "uid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Authorized company administration result"
     },
     "403": {
      "description": "Administration denied"
     },
     "409": {
      "description": "Revision changed"
     },
     "503": {
      "description": "Administration storage unavailable"
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "required": [
         "revision"
        ],
        "properties": {
         "revision": {
          "type": "integer",
          "minimum": 1
         },
         "role": {
          "type": "string",
          "enum": [
           "admin",
           "editor",
           "viewer"
          ]
         },
         "enabled": {
          "type": "boolean"
         }
        },
        "oneOf": [
         {
          "required": [
           "role"
          ],
          "not": {
           "required": [
            "enabled"
           ]
          }
         },
         {
          "required": [
           "enabled"
          ],
          "not": {
           "required": [
            "role"
           ]
          }
         }
        ]
       }
      }
     }
    }
   }
  },
  "/api/organizations/{oid}/resources": {
   "get": {
    "operationId": "get_api_organizations_oid_resources",
    "summary": "Organization admin lists resource IDs for grant recovery; no private content",
    "parameters": [
     {
      "name": "oid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Authorized company administration result"
     },
     "403": {
      "description": "Administration denied"
     },
     "409": {
      "description": "Revision changed"
     },
     "503": {
      "description": "Administration storage unavailable"
     }
    }
   }
  },
  "/api/sessions/matches": {
   "post": {
    "operationId": "findMatchingSessions",
    "summary": "Find accessible same-binary sessions without creating or opening a worker",
    "description": "Read-only SHA-256 and size lookup in the destination project organization. Results include only accessible active private sessions. A supplied hash is a search hint, not proof of uploaded content or permission to reuse it. Uploads and firmware links verify their own content and permissions. Search is optional; creation never searches automatically.",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "sha256",
         "size_bytes",
         "project_id"
        ],
        "properties": {
         "project_id": {
          "type": "string",
          "description": "Explicit destination product ID."
         },
         "sha256": {
          "type": "string",
          "pattern": "^[a-fA-F0-9]{64}$"
         },
         "size_bytes": {
          "type": "integer",
          "minimum": 0
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Accessible matching sessions; no durable state changed.",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/SessionInfo"
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/badRequest"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     },
     "default": {
      "$ref": "#/components/responses/error"
     }
    }
   }
  },
  "/api/projects/{iid}/releases/{release}/conversation": {
   "get": {
    "operationId": "getReleaseConversation",
    "summary": "Read shared release messages",
    "description": "Requires release read access and read access to every accumulated private source. Returns up to 50 messages oldest first, defaulting to the latest page. Nothing is returned if any source is unavailable. Responses are no-store.",
    "parameters": [
     {
      "name": "iid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "release",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "before",
      "in": "query",
      "schema": {
       "type": "integer",
       "minimum": 0
      },
      "description": "Exclusive sequence cursor; zero returns the latest page"
     }
    ],
    "responses": {
     "200": {
      "description": "Saved conversation page",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ReleaseConversation"
        }
       }
      }
     },
     "400": {
      "description": "Invalid message or cursor",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Conversation unavailable; release or any bound source is inaccessible",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   },
   "post": {
    "operationId": "postReleaseMessage",
    "summary": "Post a saved release message (editor)",
    "description": "Does not call a model, open a worker, approve a plan, or start analysis. Binds explicit release occurrence links and all sessions in the optional plan to the whole conversation. Request identity is scoped to release and author. Identical retries return the original message after a fresh all-source access check; concurrent edits require refresh and explicit retry.",
    "parameters": [
     {
      "name": "iid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "release",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "Idempotency-Key",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string",
       "minLength": 1,
       "maxLength": 128
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/NewReleaseMessage"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Identical retry",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ReleaseMessage"
        }
       }
      }
     },
     "201": {
      "description": "Message saved",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ReleaseMessage"
        }
       }
      }
     },
     "400": {
      "description": "Invalid message or cursor",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Conversation unavailable; release or any bound source is inaccessible",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "409": {
      "description": "Conversation revision or idempotency conflict",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/projects/{iid}/releases/{release}/conversation/turns": {
   "post": {
    "operationId": "askReleaseAgent",
    "summary": "Request an admitted release AI reply (editor)",
    "description": "Idempotent, revision-checked turn using the existing investigation scheduler. One unfinished turn per release. Binds at most 100 accessible imported candidates before any output. Uses at most 20 saved messages, the attached plan and bounded saved results. A prior approved plan, including a start receipt, supplies the shared budget. Suggestions never save or approve plans. Cancel through the returned run's control endpoint. Production admission remains unavailable until bounded monetary reservations are integrated.",
    "parameters": [
     {
      "name": "iid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "release",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "Idempotency-Key",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/NewConversationTurn"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Retry receipt",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/InvestigationRunDetail"
        }
       }
      }
     },
     "202": {
      "description": "Queued AI turn",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/InvestigationRunDetail"
        }
       }
      }
     },
     "400": {
      "description": "Invalid message or cursor",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Conversation unavailable; release or any bound source is inaccessible",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "409": {
      "description": "Stale revision, conflicting request or active turn"
     },
     "503": {
      "description": "Execution admission unavailable"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/projects/{iid}/releases/{release}/conversation/events": {
   "get": {
    "operationId": "watchReleaseConversation",
    "summary": "Stream authorized saved conversation snapshots",
    "parameters": [
     {
      "name": "iid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "release",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "description": "SSE conversation events contain ReleaseConversation snapshots. Access is rechecked each second. An unavailable event has only an empty object and terminates the stream. Reconnect reads the latest durable snapshot; no provider call is replayed.",
    "responses": {
     "200": {
      "description": "No-store SSE stream",
      "content": {
       "text/event-stream": {
        "schema": {
         "type": "string"
        }
       }
      }
     },
     "400": {
      "description": "Invalid message or cursor",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Conversation unavailable; release or any bound source is inaccessible",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/projects/{iid}/jobs": {
   "get": {
    "operationId": "listProjectJobs",
    "summary": "List accessible grouped project jobs",
    "description": "Applies complete source access, release and text filters before counts and pagination. Firmware stage runs appear only inside their parent analysis. Binary preparation, checks, missions and correlation remain grouped under their run. Conversation runs use whole-transcript source access.",
    "parameters": [
     {
      "name": "iid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "release",
      "in": "query",
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "status",
      "in": "query",
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "q",
      "in": "query",
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "limit",
      "in": "query",
      "schema": {
       "type": "integer",
       "minimum": 0
      }
     },
     {
      "name": "offset",
      "in": "query",
      "schema": {
       "type": "integer",
       "minimum": 0
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Filtered jobs, up to 100 per page",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ProjectJobPage"
        }
       }
      }
     },
     "404": {
      "description": "Project unavailable"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/projects/{iid}/runs/{rid}/evidence": {
   "get": {
    "operationId": "listRunEvidence",
    "summary": "Latest 100 settled attempt/report references for an accessible saved release plan",
    "parameters": [
     {
      "name": "iid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "rid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Latest 100 settled attempt/report references for an accessible saved release plan",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/AnalysisEvidenceReference"
         }
        }
       }
      }
     },
     "404": {
      "description": "Run or a bound source is unavailable"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/projects/{iid}/runs/{rid}/program-outcomes": {
   "get": {
    "operationId": "listProgramOutcomes",
    "summary": "Saved installed-check outcomes, including coverage and immutable artifact envelopes",
    "parameters": [
     {
      "name": "iid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "rid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Saved installed-check outcomes, including coverage and immutable artifact envelopes",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "type": "object"
         }
        }
       }
      }
     },
     "404": {
      "description": "Run or a bound source is unavailable"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/projects/{iid}/runs/{rid}/program-artifacts/{aid}": {
   "get": {
    "operationId": "downloadProgramReport",
    "summary": "Download an exact saved check report",
    "description": "Uses saved artifact storage without opening a worker. Rechecks complete run scope and verifies artifact digest before delivery.",
    "parameters": [
     {
      "name": "iid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "rid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "aid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Verified JSON report attachment",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "404": {
      "description": "Artifact, run or bound source unavailable"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/projects/{project_id}/releases/{release_id}/evidence": {
   "get": {
    "operationId": "getReleaseEvidence",
    "summary": "Read release requirements and saved evidence references",
    "parameters": [
     {
      "name": "project_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "release_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "template_id",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Authorized saved evidence and human review history",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ReleaseEvidenceView"
        }
       }
      }
     },
     "404": {
      "description": "Release or any historical private evidence source is unavailable"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   },
   "post": {
    "operationId": "updateReleaseEvidence",
    "summary": "Prepare, submit or review release evidence (editor)",
    "description": "Resolves selected run/attempt/report identities server-side. Binds all frozen sources before saving; historical bindings survive reference removal. No analysis outcome automatically accepts a requirement. Explicit submit and reviewer accept are distinct transitions. Changed session revision or saved generation makes previously accepted evidence stale. Read and export authorization covers the entire historical evidence scope.",
    "parameters": [
     {
      "name": "project_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "release_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "Idempotency-Key",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/ReleaseEvidenceUpdate"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Authorized saved evidence and human review history",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ReleaseEvidenceView"
        }
       }
      }
     },
     "404": {
      "description": "Release or any historical private evidence source is unavailable"
     },
     "409": {
      "description": "Revision, scope or transition conflict"
     },
     "401": {
      "$ref": "#/components/responses/unauthorized"
     }
    }
   }
  },
  "/api/onboarding": {
   "get": {
    "summary": "Read the current account onboarding step",
    "parameters": [],
    "responses": {
     "200": {
      "description": "Result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/OnboardingStatus"
        }
       }
      }
     },
     "400": {
      "description": "Invalid or incomplete input"
     },
     "403": {
      "description": "Access denied"
     },
     "409": {
      "description": "Revision conflict"
     },
     "503": {
      "description": "Service unavailable"
     }
    }
   }
  },
  "/api/organizations/{oid}/provisions": {
   "get": {
    "summary": "Read company provisioning draft and published review",
    "parameters": [
     {
      "name": "oid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/CompanyProvisions"
        }
       }
      }
     },
     "400": {
      "description": "Invalid or incomplete input"
     },
     "403": {
      "description": "Access denied"
     },
     "409": {
      "description": "Revision conflict"
     },
     "503": {
      "description": "Service unavailable"
     }
    }
   },
   "put": {
    "summary": "Save an incomplete provisioning draft with revision checking",
    "parameters": [
     {
      "name": "oid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/CompanyProvisions"
        }
       }
      }
     },
     "400": {
      "description": "Invalid or incomplete input"
     },
     "403": {
      "description": "Access denied"
     },
     "409": {
      "description": "Revision conflict"
     },
     "503": {
      "description": "Service unavailable"
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "required": [
         "revision"
        ],
        "properties": {
         "revision": {
          "type": "integer",
          "minimum": 1
         },
         "draft": {
          "$ref": "#/components/schemas/ProvisionConfig"
         }
        }
       }
      }
     }
    }
   }
  },
  "/api/organizations/{oid}/provisions/publish": {
   "post": {
    "summary": "Review and publish complete company provisions",
    "parameters": [
     {
      "name": "oid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/CompanyProvisions"
        }
       }
      }
     },
     "400": {
      "description": "Invalid or incomplete input"
     },
     "403": {
      "description": "Access denied"
     },
     "409": {
      "description": "Revision conflict"
     },
     "503": {
      "description": "Service unavailable"
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "required": [
         "revision"
        ],
        "properties": {
         "revision": {
          "type": "integer",
          "minimum": 1
         },
         "draft": {
          "$ref": "#/components/schemas/ProvisionConfig"
         }
        }
       }
      }
     }
    }
   }
  },
  "/api/organizations/{oid}/invitation": {
   "post": {
    "summary": "Send or replace the initial admin invitation after provision review",
    "parameters": [
     {
      "name": "oid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Result"
     },
     "400": {
      "description": "Invalid or incomplete input"
     },
     "403": {
      "description": "Access denied"
     },
     "409": {
      "description": "Revision conflict"
     },
     "503": {
      "description": "Service unavailable"
     }
    }
   }
  },
  "/api/admin/invites/{code}/resend": {
   "post": {
    "summary": "Replace an unused invitation and retry email delivery",
    "parameters": [
     {
      "name": "code",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Result"
     },
     "400": {
      "description": "Invalid or incomplete input"
     },
     "403": {
      "description": "Access denied"
     },
     "409": {
      "description": "Revision conflict"
     },
     "503": {
      "description": "Service unavailable"
     }
    }
   }
  },
  "/api/admin/model-catalog": {
   "get": {
    "summary": "Read the platform model catalog for company provisioning",
    "parameters": [],
    "responses": {
     "200": {
      "description": "Result"
     },
     "400": {
      "description": "Invalid or incomplete input"
     },
     "403": {
      "description": "Access denied"
     },
     "409": {
      "description": "Revision conflict"
     },
     "503": {
      "description": "Service unavailable"
     }
    }
   }
  },
  "/api/companies/{code}": {
   "get": {
    "operationId": "lookupCompany",
    "summary": "Exact active company code lookup. Returns only code and name; no search or directory.",
    "parameters": [
     {
      "name": "code",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "minLength": 3,
       "maxLength": 63,
       "pattern": "^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$",
       "description": "Unique permanent company code. New tenant registrations reserve admin, api, app, www, and platform."
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Success",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/CompanyIdentity"
        }
       }
      }
     },
     "403": {
      "description": "Destination is not authorized"
     },
     "404": {
      "description": "Company, invitation, or resource is unavailable"
     }
    },
    "security": []
   }
  },
  "/api/invites/company": {
   "get": {
    "operationId": "invitationCompany",
    "summary": "Resolve the company identified by a valid unused invitation, including a pending company.",
    "parameters": [
     {
      "name": "invitation",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Success",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/CompanyIdentity"
        }
       }
      }
     },
     "403": {
      "description": "Destination is not authorized"
     },
     "404": {
      "description": "Company, invitation, or resource is unavailable"
     }
    },
    "security": []
   }
  },
  "/api/workspace-context": {
   "get": {
    "operationId": "workspaceContext",
    "summary": "Resolve the configured tenant and current resource capabilities. Company members require activation; platform administrators use the audited handoff. Supplied resources are authorized first and conflicting company parameters are rejected.",
    "parameters": [
     {
      "name": "company",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "product",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "release",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "session",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Success",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/WorkspaceContext"
        }
       }
      }
     },
     "403": {
      "description": "Destination is not authorized"
     },
     "404": {
      "description": "Company, invitation, or resource is unavailable"
     }
    }
   }
  },
  "/api/admin/entry": {
   "get": {
    "operationId": "platformEntry",
    "summary": "Check the current platform role without changing actor identity.",
    "parameters": [],
    "responses": {
     "200": {
      "description": "Success",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/PublicUser"
        }
       }
      }
     },
     "403": {
      "description": "Destination is not authorized"
     },
     "404": {
      "description": "Company, invitation, or resource is unavailable"
     }
    }
   }
  },
  "/api/invites/redeem": {
   "post": {
    "operationId": "redeemInvitation",
    "summary": "Accept an invitation and issue a user session. Optional entry context must match the invitation company.",
    "security": [],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "username": {
          "type": "string"
         },
         "code": {
          "type": "string"
         },
         "password": {
          "type": "string"
         },
         "company": {
          "type": "string",
          "minLength": 3,
          "maxLength": 63,
          "pattern": "^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$",
          "description": "Unique permanent company code. New tenant registrations reserve admin, api, app, www, and platform."
         },
         "administration": {
          "type": "boolean",
          "description": "Requires a live platform owner/admin role; cannot be combined with company."
         }
        },
        "required": [
         "username",
         "code",
         "password"
        ],
        "additionalProperties": false
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Accepted invitation",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/LoginResponse"
        }
       }
      }
     },
     "400": {
      "description": "Invalid or expired invitation"
     },
     "403": {
      "description": "Conflicting entry destination"
     }
    }
   }
  },
  "/api/auth/oauth/{provider}/start": {
   "get": {
    "operationId": "startSocialLogin",
    "summary": "Start configured Google/GitHub sign-in on the canonical deployment origin. Optional company context must match the tenant. Invitation and membership checks apply before issuing the local session; platform administrator handoff is separate.",
    "security": [],
    "parameters": [
     {
      "name": "provider",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "enum": [
        "google",
        "github"
       ]
      }
     },
     {
      "name": "return_to",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "company",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "minLength": 3,
       "maxLength": 63,
       "pattern": "^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$",
       "description": "Unique permanent company code. New tenant registrations reserve admin, api, app, www, and platform."
      }
     },
     {
      "name": "administration",
      "in": "query",
      "required": false,
      "schema": {
       "type": "boolean"
      }
     }
    ],
    "responses": {
     "302": {
      "description": "Redirect to the configured identity provider"
     },
     "404": {
      "description": "Provider unavailable"
     }
    }
   }
  },
  "/api/organizations/{oid}": {
   "patch": {
    "operationId": "renameCompany",
    "summary": "Change a permitted company display name without changing its permanent sign-in code.",
    "parameters": [
     {
      "name": "oid",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "name",
         "revision"
        ],
        "properties": {
         "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
         },
         "revision": {
          "type": "integer",
          "minimum": 1
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Renamed"
     },
     "400": {
      "description": "Invalid name or immutable field"
     },
     "403": {
      "description": "Company administration denied"
     },
     "409": {
      "description": "Revision changed"
     }
    }
   }
  }
 },
 "components": {
  "securitySchemes": {
   "bearerAuth": {
    "type": "http",
    "scheme": "bearer",
    "description": "Token from POST /api/auth/login"
   }
  },
  "parameters": {
   "sid": {
    "name": "sid",
    "in": "path",
    "required": true,
    "description": "Session id, from GET /api/sessions or the upload response",
    "schema": {
     "type": "string"
    }
   },
   "aid": {
    "name": "aid",
    "in": "path",
    "required": true,
    "description": "Immutable artifact id",
    "schema": {
     "type": "string",
     "pattern": "^art_[0-9a-f]{32}$"
    }
   },
   "addr": {
    "name": "addr",
    "in": "query",
    "required": true,
    "description": "Address as a 0x-prefixed hex string, e.g. 0x401000. Function endpoints accept any address inside the function.",
    "schema": {
     "type": "string",
     "pattern": "^(0x)?[0-9a-fA-F]+$"
    }
   }
  },
  "responses": {
   "badRequest": {
    "description": "Malformed parameter or body (bad address, out-of-range number)",
    "content": {
     "application/json": {
      "schema": {
       "$ref": "#/components/schemas/Error"
      }
     }
    }
   },
   "notFound": {
    "description": "Nothing there: unknown session or token, or nothing at that address",
    "content": {
     "application/json": {
      "schema": {
       "$ref": "#/components/schemas/Error"
      }
     }
    }
   },
   "error": {
    "description": "Any other failure. The error sentence is always present; analysis-engine failures also include a stable code, stage, hint, retryability, and diagnostic reference.",
    "content": {
     "application/json": {
      "schema": {
       "$ref": "#/components/schemas/Error"
      }
     }
    }
   },
   "unauthorized": {
    "description": "No token, or a revoked one; sign in again",
    "content": {
     "application/json": {
      "schema": {
       "$ref": "#/components/schemas/Error"
      }
     }
    }
   }
  },
  "schemas": {
   "AccountComputeStatus": {
    "type": "object",
    "properties": {
     "analysis": {
      "$ref": "#/components/schemas/AccountComputeResource"
     },
     "debug": {
      "$ref": "#/components/schemas/AccountComputeResource"
     }
    },
    "required": [
     "analysis",
     "debug"
    ],
    "additionalProperties": false
   },
   "AccountComputeResource": {
    "type": "object",
    "properties": {
     "state": {
      "type": "string",
      "enum": [
       "off",
       "provisioning",
       "ready",
       "deleting",
       "failed"
      ]
     }
    },
    "required": [
     "state"
    ],
    "additionalProperties": false
   },
   "Artifact": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string"
     },
     "workspaceId": {
      "type": "string"
     },
     "name": {
      "type": "string"
     },
     "mediaType": {
      "type": "string"
     },
     "digest": {
      "type": "string",
      "description": "SHA-256 content digest"
     },
     "size": {
      "type": "integer",
      "format": "int64"
     },
     "createdAt": {
      "type": "integer",
      "format": "int64",
      "description": "Unix epoch milliseconds"
     },
     "provenance": {
      "type": "object",
      "properties": {
       "kind": {
        "type": "string",
        "enum": [
         "binary-range",
         "analysis-script"
        ]
       },
       "offset": {
        "type": "integer",
        "format": "int64"
       },
       "length": {
        "type": "integer",
        "format": "int64"
       },
       "inputArtifactIds": {
        "type": "array",
        "items": {
         "type": "string"
        }
       },
       "runId": {
        "type": "string"
       },
       "taskId": {
        "type": "string"
       },
       "agent": {
        "type": "string"
       },
       "principalId": {
        "type": "string"
       }
      },
      "additionalProperties": false,
      "required": [
       "kind"
      ]
     }
    },
    "additionalProperties": false,
    "required": [
     "id",
     "workspaceId",
     "name",
     "mediaType",
     "digest",
     "size",
     "createdAt",
     "provenance"
    ]
   },
   "Error": {
    "type": "object",
    "properties": {
     "error": {
      "type": "string",
      "description": "What went wrong, as a sentence"
     },
     "errorCode": {
      "type": "string",
      "description": "Stable machine-readable failure code, when the analysis engine classified the failure"
     },
     "errorStage": {
      "type": "string",
      "description": "Analysis-engine stage that failed"
     },
     "errorHint": {
      "type": "string",
      "description": "Suggested next action"
     },
     "errorRetryable": {
      "type": "boolean",
      "description": "Whether retrying without changing the request may succeed"
     },
     "errorDiagnosticId": {
      "type": "string",
      "description": "Reference that operators can match to private diagnostic logs"
     }
    },
    "additionalProperties": false,
    "required": [
     "error"
    ]
   },
   "Info": {
    "type": "object",
    "properties": {
     "core": {
      "type": "object",
      "properties": {
       "file": {
        "type": "string",
        "description": "Display name"
       },
       "format": {
        "type": "string",
        "description": "Container format, e.g. ELF or PE"
       },
       "humansz": {
        "type": "string",
        "description": "Human-readable size"
       },
       "size": {
        "type": "integer",
        "description": "Size in bytes"
       }
      },
      "additionalProperties": true
     },
     "bin": {
      "type": "object",
      "properties": {
       "arch": {
        "type": "string"
       },
       "bits": {
        "type": "integer"
       },
       "endian": {
        "type": "string",
        "enum": [
         "little",
         "big"
        ]
       },
       "baddr": {
        "type": "integer",
        "description": "Image base address"
       },
       "bintype": {
        "type": "string"
       },
       "compiler": {
        "type": "string"
       },
       "language": {
        "type": "string",
        "description": "Ghidra language id, e.g. x86:LE:64:default"
       },
       "canary": {
        "type": "boolean"
       },
       "nx": {
        "type": "boolean"
       },
       "pic": {
        "type": "boolean"
       },
       "relocs": {
        "type": "boolean"
       },
       "relro": {
        "type": "string"
       },
       "static": {
        "type": "boolean"
       },
       "stripped": {
        "type": "boolean"
       }
      },
      "additionalProperties": true
     }
    },
    "additionalProperties": false,
    "required": [
     "core",
     "bin"
    ]
   },
   "Overview": {
    "type": "object",
    "properties": {
     "functions": {
      "type": "integer"
     },
     "xrefs": {
      "type": "integer"
     },
     "calls": {
      "type": "integer"
     },
     "strings": {
      "type": "integer"
     },
     "symbols": {
      "type": "integer"
     },
     "imports": {
      "type": "integer"
     }
    },
    "additionalProperties": false
   },
   "Triage": {
    "type": "object",
    "properties": {
     "items": {
      "type": "array",
      "items": {
       "type": "object",
       "properties": {
        "addr": {
         "type": "string",
         "description": "Function entry point as a 0x-prefixed hex string (unlike list endpoints, which return decimal offsets)"
        },
        "name": {
         "type": "string"
        },
        "size": {
         "type": "integer",
         "description": "Function size in bytes"
        },
        "score": {
         "type": "integer",
         "minimum": 0,
         "maximum": 100,
         "description": "Inspection value normalized from the 0-2 rubric to 0-100, not a probability"
        },
        "reasons": {
         "type": "array",
         "items": {
          "type": "string"
         },
         "description": "Jev-selected behavior label, not generated reasoning or a verified finding"
        },
        "jevScore": {
         "type": "number",
         "minimum": 0,
         "maximum": 2,
         "description": "Native rubric score: 0 low, 1 medium, 2 high inspection value"
        },
        "jevConfidence": {
         "type": "number",
         "minimum": 0,
         "maximum": 1,
         "description": "Model certainty, not inspection value or a guarantee of correctness"
        }
       },
       "additionalProperties": false
      }
     },
     "ranked": {
      "type": "integer",
      "description": "Evaluated functions before the response limit, provisional until ready"
     },
     "total": {
      "type": "integer",
      "description": "How many functions exist"
     },
     "evaluated": {
      "type": "integer",
      "description": "Functions evaluated so far"
     },
     "model": {
      "type": "string",
      "description": "Latest served snapshot, or configured model before the first batch"
     },
     "models": {
      "type": "array",
      "items": {
       "type": "string"
      },
      "description": "All model snapshots served across batches"
     },
     "key": {
      "type": "string",
      "description": "Ranking cache key; pass back when advancing a batch"
     },
     "status": {
      "type": "string",
      "enum": [
       "unavailable",
       "ranking",
       "ready"
      ]
     },
     "message": {
      "type": "string",
      "description": "Explanation when ranking is unavailable or incomplete"
     }
    },
    "additionalProperties": false,
    "required": [
     "items",
     "ranked",
     "total",
     "evaluated",
     "key",
     "status"
    ]
   },
   "Hashes": {
    "type": "object",
    "properties": {
     "md5": {
      "type": "string"
     },
     "sha1": {
      "type": "string"
     },
     "sha256": {
      "type": "string"
     },
     "crc32": {
      "type": "string"
     },
     "entropy": {
      "type": "string",
      "description": "Whole-file Shannon entropy, 0-8 bits per byte"
     }
    },
    "additionalProperties": false
   },
   "EntropyBucket": {
    "type": "object",
    "properties": {
     "addr": {
      "type": "integer",
      "description": "Address as a decimal byte offset in the program's address space. Render as hex for display; pass back to addr parameters as a 0x-prefixed hex string."
     },
     "size": {
      "type": "integer",
      "description": "Bytes sampled in this bucket"
     },
     "section": {
      "type": "string",
      "description": "Memory block the bucket lies in; buckets never straddle blocks"
     },
     "entropy": {
      "type": "number",
      "description": "Shannon entropy of the bucket, 0-8 bits per byte"
     }
    },
    "additionalProperties": false
   },
   "Section": {
    "type": "object",
    "properties": {
     "name": {
      "type": "string"
     },
     "size": {
      "type": "integer",
      "description": "File size"
     },
     "vsize": {
      "type": "integer",
      "description": "Size in memory"
     },
     "type": {
      "type": "string"
     },
     "perm": {
      "type": "string",
      "description": "Permissions as rwx string, e.g. 'r-x'"
     },
     "flags": {
      "type": "integer"
     },
     "vaddr": {
      "type": "integer",
      "description": "Address as a decimal byte offset in the program's address space. Render as hex for display; pass back to addr parameters as a 0x-prefixed hex string."
     },
     "paddr": {
      "type": "integer",
      "description": "File offset"
     },
     "loaded": {
      "type": "boolean"
     }
    },
    "additionalProperties": false
   },
   "Function": {
    "type": "object",
    "properties": {
     "addr": {
      "type": "integer",
      "description": "Address as a decimal byte offset in the program's address space. Render as hex for display; pass back to addr parameters as a 0x-prefixed hex string."
     },
     "name": {
      "type": "string"
     },
     "size": {
      "type": "integer",
      "description": "Bytes in the function body"
     },
     "end": {
      "type": "integer",
      "description": "Last address, decimal"
     },
     "nbbs": {
      "type": "integer",
      "description": "Basic block count"
     },
     "cc": {
      "type": "integer",
      "description": "Cyclomatic complexity"
     },
     "ninstrs": {
      "type": "integer",
      "description": "Instruction count"
     },
     "indegree": {
      "type": "integer",
      "description": "How many functions call this one"
     }
    },
    "additionalProperties": false
   },
   "Op": {
    "type": "object",
    "properties": {
     "addr": {
      "type": "integer",
      "description": "Address as a decimal byte offset in the program's address space. Render as hex for display; pass back to addr parameters as a 0x-prefixed hex string."
     },
     "bytes": {
      "type": "string",
      "description": "Instruction bytes as lowercase hex"
     },
     "disasm": {
      "type": "string"
     },
     "opcode": {
      "type": "string"
     }
    },
    "additionalProperties": false
   },
   "Disasm": {
    "type": "object",
    "properties": {
     "addr": {
      "type": "integer",
      "description": "Address as a decimal byte offset in the program's address space. Render as hex for display; pass back to addr parameters as a 0x-prefixed hex string."
     },
     "name": {
      "type": "string",
      "description": "Containing function"
     },
     "size": {
      "type": "integer"
     },
     "ops": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Op"
      }
     }
    },
    "additionalProperties": false
   },
   "Decompile": {
    "type": "object",
    "properties": {
     "lines": {
      "type": "array",
      "items": {
       "type": "object",
       "properties": {
        "str": {
         "type": "string",
         "description": "One line of C"
        },
        "offset": {
         "type": "integer",
         "description": "Address the line maps to, decimal; absent on lines with no location"
        }
       },
       "additionalProperties": false,
       "required": [
        "str"
       ]
      }
     },
     "annotatedVars": {
      "type": "array",
      "items": {
       "type": "string"
      },
      "description": "Variable and symbol names appearing in the listing"
     }
    },
    "additionalProperties": false,
    "required": [
     "lines"
    ]
   },
   "Vars": {
    "type": "object",
    "properties": {
     "reg": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Var"
      },
      "description": "Register-backed variables"
     },
     "sp": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Var"
      },
      "description": "Stack variables"
     },
     "bp": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Var"
      },
      "description": "Frame-base variables"
     }
    },
    "additionalProperties": false
   },
   "Var": {
    "type": "object",
    "properties": {
     "name": {
      "type": "string"
     },
     "type": {
      "type": "string"
     },
     "kind": {
      "type": "string",
      "enum": [
       "arg",
       "var"
      ]
     },
     "ref": {
      "type": "string",
      "description": "Storage location, e.g. 'RDI:8' or a stack offset"
     }
    },
    "additionalProperties": false
   },
   "Graph": {
    "type": "object",
    "properties": {
     "name": {
      "type": "string",
      "description": "Function name"
     },
     "addr": {
      "type": "integer",
      "description": "Address as a decimal byte offset in the program's address space. Render as hex for display; pass back to addr parameters as a 0x-prefixed hex string."
     },
     "blocks": {
      "type": "array",
      "items": {
       "type": "object",
       "properties": {
        "addr": {
         "type": "integer",
         "description": "Address as a decimal byte offset in the program's address space. Render as hex for display; pass back to addr parameters as a 0x-prefixed hex string."
        },
        "size": {
         "type": "integer",
         "description": "Addresses spanned"
        },
        "jump": {
         "type": "integer",
         "description": "Branch-taken successor, decimal; absent when none"
        },
        "fail": {
         "type": "integer",
         "description": "Fall-through successor, decimal; absent when none"
        },
        "ops": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/Op"
         }
        }
       },
       "additionalProperties": false,
       "required": [
        "addr",
        "size",
        "ops"
       ]
      }
     }
    },
    "additionalProperties": false
   },
   "Xref": {
    "type": "object",
    "properties": {
     "from": {
      "type": "integer",
      "description": "Referencing address, decimal"
     },
     "type": {
      "type": "string",
      "description": "Reference type, e.g. CALL, READ, WRITE, JUMP"
     },
     "opcode": {
      "type": "string",
      "description": "Disassembly at the referencing address"
     },
     "fcn_name": {
      "type": "string",
      "description": "Function containing the reference, when any"
     },
     "realname": {
      "type": "string"
     }
    },
    "additionalProperties": false
   },
   "CallTree": {
    "type": "object",
    "properties": {
     "incoming": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/NamedAddr"
      },
      "description": "Functions that call this one"
     },
     "outgoing": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/NamedAddr"
      },
      "description": "Functions this one calls"
     }
    },
    "additionalProperties": false
   },
   "CallGraphNode": {
    "type": "object",
    "properties": {
     "addr": {
      "type": "integer",
      "description": "Entry point, decimal"
     },
     "name": {
      "type": "string"
     },
     "callees": {
      "type": "array",
      "items": {
       "type": "string"
      },
      "description": "Functions this one calls, by name; empty for leaves"
     }
    },
    "additionalProperties": false
   },
   "NamedAddr": {
    "type": "object",
    "properties": {
     "addr": {
      "type": "integer",
      "description": "Address as a decimal byte offset in the program's address space. Render as hex for display; pass back to addr parameters as a 0x-prefixed hex string."
     },
     "name": {
      "type": "string"
     }
    },
    "additionalProperties": false
   },
   "Instruction": {
    "type": "object",
    "properties": {
     "addr": {
      "type": "integer",
      "description": "Address as a decimal byte offset in the program's address space. Render as hex for display; pass back to addr parameters as a 0x-prefixed hex string."
     },
     "mnemonic": {
      "type": "string"
     },
     "text": {
      "type": "string"
     },
     "length": {
      "type": "integer"
     },
     "flow": {
      "type": "string",
      "description": "Control-flow class, e.g. FALL_THROUGH, UNCONDITIONAL_CALL"
     },
     "bytes": {
      "type": "string",
      "description": "Encoding as lowercase hex"
     },
     "operands": {
      "type": "array",
      "items": {
       "type": "object",
       "properties": {
        "text": {
         "type": "string"
        },
        "type": {
         "type": "string"
        },
        "refers": {
         "type": "integer",
         "description": "Address the operand refers to, decimal; absent when none"
        }
       },
       "additionalProperties": false,
       "required": [
        "text",
        "type"
       ]
      }
     },
     "pcode": {
      "type": "array",
      "items": {
       "type": "string"
      },
      "description": "The instruction's p-code ops, one string each"
     }
    },
    "additionalProperties": false
   },
   "ResolveAddr": {
    "type": "object",
    "properties": {
     "addr": {
      "type": "integer",
      "description": "Address as a decimal byte offset in the program's address space. Render as hex for display; pass back to addr parameters as a 0x-prefixed hex string."
     },
     "name": {
      "type": "string",
      "description": "Containing function"
     },
     "size": {
      "type": "integer"
     },
     "end": {
      "type": "integer"
     }
    },
    "additionalProperties": false
   },
   "Signature": {
    "type": "object",
    "properties": {
     "addr": {
      "type": "integer",
      "description": "Address as a decimal byte offset in the program's address space. Render as hex for display; pass back to addr parameters as a 0x-prefixed hex string."
     },
     "name": {
      "type": "string"
     },
     "signature": {
      "type": "string",
      "description": "Full C prototype"
     },
     "callingConvention": {
      "type": "string"
     },
     "callingConventions": {
      "type": "array",
      "items": {
       "type": "string"
      },
      "description": "Conventions this program accepts"
     }
    },
    "additionalProperties": false
   },
   "StringItem": {
    "type": "object",
    "properties": {
     "vaddr": {
      "type": "integer",
      "description": "Address as a decimal byte offset in the program's address space. Render as hex for display; pass back to addr parameters as a 0x-prefixed hex string."
     },
     "paddr": {
      "type": "integer",
      "description": "File offset"
     },
     "size": {
      "type": "integer",
      "description": "Bytes including terminator"
     },
     "length": {
      "type": "integer",
      "description": "Characters"
     },
     "section": {
      "type": "string"
     },
     "type": {
      "type": "string",
      "description": "E.g. TerminatedCString, unicode"
     },
     "string": {
      "type": "string",
      "description": "The text itself"
     }
    },
    "additionalProperties": false
   },
   "Symbol": {
    "type": "object",
    "properties": {
     "name": {
      "type": "string"
     },
     "flagname": {
      "type": "string"
     },
     "realname": {
      "type": "string"
     },
     "ordinal": {
      "type": "integer"
     },
     "bind": {
      "type": "string"
     },
     "type": {
      "type": "string"
     },
     "size": {
      "type": "integer"
     },
     "vaddr": {
      "type": "integer",
      "description": "Address as a decimal byte offset in the program's address space. Render as hex for display; pass back to addr parameters as a 0x-prefixed hex string."
     },
     "paddr": {
      "type": "integer"
     },
     "is_imported": {
      "type": "boolean"
     }
    },
    "additionalProperties": false
   },
   "Import": {
    "type": "object",
    "properties": {
     "ordinal": {
      "type": "integer"
     },
     "bind": {
      "type": "string"
     },
     "type": {
      "type": "string"
     },
     "name": {
      "type": "string"
     },
     "plt": {
      "type": "integer",
      "description": "Thunk address, decimal"
     }
    },
    "additionalProperties": false
   },
   "Types": {
    "type": "object",
    "properties": {
     "types": {
      "type": "array",
      "items": {
       "type": "object",
       "properties": {
        "type": {
         "type": "string",
         "description": "Type name"
        },
        "size": {
         "type": "integer",
         "description": "Bytes"
        },
        "format": {
         "type": "string",
         "description": "Category path in Ghidra's type manager"
        },
        "kind": {
         "type": "string",
         "description": "struct, union, enum, typedef, funcdef, pointer, array or builtin"
        }
       },
       "additionalProperties": false
      }
     }
    },
    "additionalProperties": false
   },
   "SearchHit": {
    "type": "object",
    "properties": {
     "addr": {
      "type": "integer",
      "description": "Address as a decimal byte offset in the program's address space. Render as hex for display; pass back to addr parameters as a 0x-prefixed hex string."
     },
     "type": {
      "type": "string",
      "description": "What matched: string, bytes, or similar"
     },
     "data": {
      "type": "string",
      "description": "The matching text or bytes"
     }
    },
    "additionalProperties": false
   },
   "Comment": {
    "type": "object",
    "properties": {
     "offset": {
      "type": "integer",
      "description": "Address, decimal"
     },
     "name": {
      "type": "string",
      "description": "The comment text"
     },
     "author": {
      "type": "string",
      "description": "Username that wrote it"
     },
     "at": {
      "type": "integer",
      "description": "Unix epoch milliseconds"
     }
    },
    "additionalProperties": false
   },
   "Label": {
    "type": "object",
    "properties": {
     "addr": {
      "type": "integer",
      "description": "Address as a decimal byte offset in the program's address space. Render as hex for display; pass back to addr parameters as a 0x-prefixed hex string."
     },
     "name": {
      "type": "string"
     },
     "user": {
      "type": "boolean",
      "description": "True when a person named it rather than analysis"
     }
    },
    "additionalProperties": false
   },
   "Bookmark": {
    "type": "object",
    "properties": {
     "addr": {
      "type": "integer",
      "description": "Address as a decimal byte offset in the program's address space. Render as hex for display; pass back to addr parameters as a 0x-prefixed hex string."
     },
     "category": {
      "type": "string"
     },
     "comment": {
      "type": "string"
     }
    },
    "additionalProperties": false
   },
   "ChatMessage": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string"
     },
     "role": {
      "type": "string",
      "enum": [
       "user",
       "agent",
       "step"
      ]
     },
     "author": {
      "type": "string"
     },
     "text": {
      "type": "string",
      "description": "Markdown"
     },
     "at": {
      "type": "integer",
      "description": "Unix epoch milliseconds"
     },
     "runId": {
      "type": "string"
     },
     "context": {
      "$ref": "#/components/schemas/ChatContext"
     },
     "changeSummary": {
      "type": "object",
      "properties": {
       "count": {
        "type": "integer"
       },
       "canUndo": {
        "type": "boolean"
       },
       "changes": {
        "type": "array",
        "items": {
         "type": "object",
         "properties": {
          "type": {
           "type": "string"
          },
          "addr": {
           "type": "string"
          }
         },
         "additionalProperties": false
        }
       }
      },
      "additionalProperties": false
     }
    },
    "additionalProperties": false
   },
   "ChatContext": {
    "type": "object",
    "description": "Workspace coordinates and names only; selected code and byte content are never persisted.",
    "properties": {
     "functionAddr": {
      "type": "string"
     },
     "functionName": {
      "type": "string"
     },
     "cursorAddr": {
      "type": "string"
     },
     "pane": {
      "type": "string"
     },
     "revision": {
      "type": "string"
     },
     "selection": {
      "type": "object",
      "properties": {
       "anchorAddr": {
        "type": "string"
       },
       "headAddr": {
        "type": "string"
       },
       "from": {
        "type": "integer"
       },
       "to": {
        "type": "integer"
       },
       "revision": {
        "type": "string"
       }
      },
      "additionalProperties": false
     }
    },
    "additionalProperties": false
   },
   "Notes": {
    "type": "object",
    "properties": {
     "text": {
      "type": "string",
      "description": "The shared session notes, markdown"
     },
     "revision": {
      "type": "string",
      "description": "Content revision to send with a conditional notes save"
     }
    },
    "additionalProperties": false,
    "required": [
     "text",
     "revision"
    ]
   },
   "ActivityEvent": {
    "type": "object",
    "properties": {
     "type": {
      "type": "string",
      "description": "Event name, e.g. functionRenamed, commentsChanged, notesChanged"
     },
     "userId": {
      "type": "string",
      "description": "Who did it"
     },
     "addr": {
      "type": "string",
      "description": "Affected address when the event has one, 0x-prefixed hex"
     },
     "command": {
      "type": "string"
     },
     "timestamp": {
      "type": "integer",
      "description": "Unix epoch milliseconds"
     },
     "runId": {
      "type": "string",
      "description": "Agent run that made this change"
     }
    },
    "additionalProperties": true
   },
   "Layout": {
    "description": "The shared saved dock layout, or null when none was saved. An opaque frontend structure; not useful outside the workspace.",
    "type": [
     "object",
     "null"
    ],
    "additionalProperties": true
   },
   "PublicUser": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string"
     },
     "username": {
      "type": "string"
     },
     "role": {
      "type": "string",
      "description": "Account role on the gateway"
     },
     "organizationId": {
      "type": "string"
     },
     "organizationRole": {
      "type": "string",
      "enum": [
       "admin",
       "editor",
       "viewer"
      ]
     },
     "memberState": {
      "type": "string",
      "enum": [
       "pending",
       "active",
       "disabled"
      ]
     },
     "memberRevision": {
      "type": "integer"
     },
     "memberAccess": {
      "type": "string",
      "enum": [
       "role_based",
       "read_only"
      ]
     },
     "canCreateProducts": {
      "type": "boolean"
     },
     "canManageCompany": {
      "type": "boolean"
     }
    },
    "additionalProperties": false,
    "required": [
     "id",
     "username",
     "role"
    ]
   },
   "LoginRequest": {
    "type": "object",
    "properties": {
     "username": {
      "type": "string"
     },
     "password": {
      "type": "string"
     },
     "company": {
      "type": "string",
      "minLength": 3,
      "maxLength": 63,
      "pattern": "^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$",
      "description": "Unique permanent company code. New tenant registrations reserve admin, api, app, www, and platform."
     },
     "administration": {
      "type": "boolean",
      "description": "Requires a live platform owner/admin role; cannot be combined with company."
     }
    },
    "additionalProperties": false,
    "required": [
     "username",
     "password"
    ]
   },
   "LoginResponse": {
    "type": "object",
    "properties": {
     "token": {
      "type": "string",
      "description": "Bearer token for every authenticated call"
     },
     "user": {
      "$ref": "#/components/schemas/PublicUser"
     },
     "company": {
      "type": "string",
      "description": "Company selected by an accepted invitation, when present."
     }
    },
    "additionalProperties": false,
    "required": [
     "token",
     "user"
    ]
   },
   "SessionInfo": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string",
      "description": "Session id, the {sid} in every session route"
     },
     "name": {
      "type": "string",
      "description": "The binary's display name"
     },
     "status": {
      "type": "string",
      "enum": [
       "pending",
       "queued",
       "analyzing",
       "ready",
       "error",
       "moving"
      ]
     },
     "error": {
      "type": "string",
      "description": "Why the session is errored, when it is"
     },
     "errorCode": {
      "type": "string",
      "description": "Stable machine-readable Ghidra failure code"
     },
     "errorStage": {
      "type": "string",
      "description": "Ghidra stage that failed"
     },
     "errorHint": {
      "type": "string",
      "description": "Suggested next action"
     },
     "errorRetryable": {
      "type": "boolean",
      "description": "Whether retrying without changing the binary may succeed"
     },
     "errorDiagnosticId": {
      "type": "string",
      "description": "Reference for matching the failure to private logs"
     },
     "yourRole": {
      "type": "string",
      "enum": [
       "editor",
       "viewer"
      ],
      "description": "Session role"
     },
     "ownerUserId": {
      "type": "string",
      "description": "Immutable catalog owner account id"
     },
     "storageVersion": {
      "type": "integer",
      "description": "Workspace storage layout version"
     },
     "hasSymbols": {
      "type": "boolean",
      "description": "Whether an optional PDB is staged or confirmed applied; inspect symbols.status for actual coverage."
     },
     "defaultBackend": {
      "type": "string",
      "description": "Decompiler backend chosen at analysis time, when one was"
     },
     "resident": {
      "type": "boolean",
      "description": "Whether a worker is held right now; false means opening waits for a slot"
     },
     "queueReason": {
      "type": "string",
      "enum": [
       "analysis",
       "capacity"
      ],
      "description": "Which queue a queued session is in"
     },
     "openError": {
      "type": "string",
      "description": "Why the last open gave up, for a reason that will pass"
     },
     "projectId": {
      "type": "string",
      "description": "Omitted without project access"
     },
     "projectName": {
      "type": "string"
     },
     "uploaderUserId": {
      "type": "string"
     },
     "capabilities": {
      "$ref": "#/components/schemas/ResourceCapabilities"
     },
     "symbols": {
      "$ref": "#/components/schemas/SymbolCoverage"
     }
    },
    "additionalProperties": false,
    "required": [
     "id",
     "name",
     "status"
    ]
   },
   "GatewayCapacity": {
    "type": "object",
    "properties": {
     "executionTier": {
      "type": "string",
      "enum": [
       "shared",
       "dedicated",
       "local"
      ],
      "description": "Execution placement for this account"
     },
     "resident": {
      "type": "integer",
      "description": "Open analysis sessions using the shared or global compute pool"
     },
     "maxResident": {
      "type": "integer",
      "description": "Shared or global open-session capacity; not a stored-binary limit"
     },
     "analyzing": {
      "type": "integer",
      "description": "First-time binary analyses currently running"
     },
     "analysisSlots": {
      "type": "integer",
      "description": "Shared or global first-time analysis concurrency"
     }
    },
    "additionalProperties": false
   },
   "Status": {
    "type": "object",
    "properties": {
     "status": {
      "type": "string"
     }
    },
    "additionalProperties": false,
    "required": [
     "status"
    ]
   },
   "ShareResponse": {
    "type": "object",
    "properties": {
     "token": {
      "type": "string",
      "description": "The share token; empty means not shared. The link is /v/{token} on the tenant origin"
     }
    },
    "additionalProperties": false,
    "required": [
     "token"
    ]
   },
   "AccessEntry": {
    "type": "object",
    "properties": {
     "userId": {
      "type": "string"
     },
     "username": {
      "type": "string"
     },
     "role": {
      "type": "string",
      "enum": [
       "viewer",
       "editor"
      ],
      "description": "Session role"
     }
    },
    "additionalProperties": false
   },
   "GrantAccessRequest": {
    "type": "object",
    "properties": {
     "username": {
      "type": "string",
      "description": "Account to grant"
     },
     "role": {
      "type": "string",
      "enum": [
       "viewer",
       "editor"
      ],
      "description": "Resource grant within active organization membership"
     }
    },
    "additionalProperties": false,
    "required": [
     "username",
     "role"
    ]
   },
   "StageSymbolsResult": {
    "type": "object",
    "properties": {
     "staged": {
      "type": "boolean"
     },
     "appliedOnAnalysis": {
      "type": "boolean",
      "description": "The PDB is eligible for the pending analysis. This does not confirm application; inspect the completed session coverage."
     },
     "symbols": {
      "$ref": "#/components/schemas/SymbolCoverage"
     }
    },
    "additionalProperties": false
   },
   "AnalyzeRequest": {
    "type": "object",
    "properties": {
     "unattended": {
      "type": "boolean",
      "default": false,
      "description": "Analyze and save a durable project without starting a resident worker. Successful completion is ready with resident:false. Omitted interpretation preserves saved upload settings in this mode. This is an execution option; omit it from investigation upload declarations."
     },
     "backend": {
      "type": "string",
      "description": "Decompiler backend the workspace should open with; absent leaves the default"
     },
     "interpretation": {
      "$ref": "#/components/schemas/BinaryInterpretation"
     }
    },
    "additionalProperties": false
   },
   "BinaryInterpretation": {
    "type": "object",
    "description": "How Ghidra imports the upload. Auto selects a loader from the file; raw supplies metadata for a headerless image.",
    "properties": {
     "mode": {
      "type": "string",
      "enum": [
       "auto",
       "raw"
      ]
     },
     "processor": {
      "type": "string",
      "description": "Ghidra language ID required for raw mode, for example ARM:LE:32:v7"
     },
     "compiler": {
      "type": "string",
      "description": "Optional Ghidra compiler spec ID"
     },
     "baseAddress": {
      "type": "string",
      "description": "Hexadecimal raw image base address; defaults to zero"
     },
     "fileOffset": {
      "type": "integer",
      "minimum": 0
     },
     "fileLength": {
      "type": "integer",
      "minimum": 1
     },
     "blockName": {
      "type": "string",
      "description": "Optional memory block name; empty lets Ghidra generate one"
     },
     "applyLabels": {
      "type": "boolean",
      "default": true,
      "description": "Apply processor-defined labels"
     },
     "anchorLabels": {
      "type": "boolean",
      "default": true,
      "description": "Anchor processor-defined labels"
     }
    },
    "additionalProperties": false
   },
   "PublicAgent": {
    "type": "object",
    "properties": {
     "name": {
      "type": "string"
     },
     "provider": {
      "type": "string",
      "enum": [
       "gemini",
       "openai",
       "openrouter",
       "zai"
      ]
     },
     "model": {
      "type": "string"
     },
     "roleCeiling": {
      "type": "string",
      "enum": [
       "viewer",
       "editor"
      ],
      "description": "Session role"
     },
     "funding": {
      "type": "string",
      "enum": [
       "verified",
       "gateway-funded",
       "key-unverified",
       "key-failed",
       "key-required"
      ],
      "description": "Credential-free account-specific hosted-run availability"
     },
     "runnable": {
      "type": "boolean"
     },
     "default": {
      "type": "boolean",
      "description": "Shared default used by Chat, REST missions, and account MCP"
     }
    },
    "additionalProperties": false
   },
   "InviteAgentRequest": {
    "type": "object",
    "properties": {
     "agent": {
      "type": "string",
      "description": "Agent name from GET /api/agents"
     },
     "task": {
      "type": "string",
      "description": "What to work on; optional"
     }
    },
    "additionalProperties": false,
    "required": [
     "agent"
    ]
   },
   "AgentCred": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string"
     },
     "agent": {
      "type": "string"
     },
     "grantedBy": {
      "type": "string",
      "description": "Username"
     },
     "role": {
      "type": "string",
      "enum": [
       "viewer",
       "editor"
      ],
      "description": "Session role"
     },
     "expiresAt": {
      "type": "integer",
      "description": "Unix epoch milliseconds"
     }
    },
    "additionalProperties": false
   },
   "ActiveRun": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string"
     },
     "sessionId": {
      "type": "string"
     },
     "agent": {
      "type": "string"
     },
     "startedBy": {
      "type": "string",
      "description": "Account id whose authority the run acts under"
     },
     "startedByName": {
      "type": "string",
      "description": "Username of startedBy"
     },
     "startedAt": {
      "type": "integer",
      "description": "Unix epoch milliseconds"
     }
    },
    "additionalProperties": false
   },
   "AgentRun": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string"
     },
     "workspaceId": {
      "type": "string"
     },
     "userId": {
      "type": "string"
     },
     "agent": {
      "type": "string"
     },
     "trigger": {
      "type": "string",
      "enum": [
       "interactive",
       "invited",
       "upload",
       "mission",
       "evaluation",
       "verification"
      ]
     },
     "objective": {
      "type": "string",
      "maxLength": 8192
     },
     "provider": {
      "type": "string"
     },
     "model": {
      "type": "string"
     },
     "effort": {
      "type": "string"
     },
     "promptDigest": {
      "type": "string"
     },
     "agentConfigDigest": {
      "type": "string"
     },
     "toolsetDigest": {
      "type": "string"
     },
     "activeSkills": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/AgentSkillRef"
      }
     },
     "workspaceRevision": {
      "type": "integer"
     },
     "state": {
      "type": "string",
      "enum": [
       "queued",
       "running",
       "finished"
      ]
     },
     "outcome": {
      "type": "string",
      "enum": [
       "completed",
       "refused",
       "capped",
       "quota",
       "stopped",
       "failed",
       "interrupted",
       "rejected"
      ]
     },
     "failureCode": {
      "type": "string"
     },
     "queuedAt": {
      "type": "integer"
     },
     "startedAt": {
      "type": "integer"
     },
     "finishedAt": {
      "type": "integer"
     },
     "queueMs": {
      "type": "integer"
     },
     "inputTokens": {
      "type": "integer"
     },
     "outputTokens": {
      "type": "integer"
     },
     "estimatedCostMicrousd": {
      "type": "integer"
     },
     "toolCalls": {
      "type": "integer"
     },
     "retryCount": {
      "type": "integer"
     },
     "resultSummary": {
      "type": "string",
      "maxLength": 8192
     }
    },
    "additionalProperties": false,
    "required": [
     "id",
     "workspaceId",
     "userId",
     "agent",
     "trigger",
     "provider",
     "model",
     "activeSkills",
     "state",
     "queuedAt",
     "toolCalls",
     "retryCount"
    ],
    "description": "Durable, privacy-bounded agent execution record. Prompt and tool output bytes are represented only by digests."
   },
   "StartedRun": {
    "type": "object",
    "properties": {
     "status": {
      "type": "string",
      "enum": [
       "started"
      ]
     },
     "runId": {
      "type": "string"
     }
    },
    "additionalProperties": false,
    "required": [
     "status",
     "runId"
    ]
   },
   "SendChatRequest": {
    "type": "object",
    "properties": {
     "agent": {
      "type": "string",
      "description": "Which agent to address, from GET /api/agents"
     },
     "modelAgent": {
      "type": "string",
      "description": "Optional name from GET /api/agents with the same provider as the addressed agent, whose model, routing and generation settings to use for this turn. Other providers are rejected. The addressed agent keeps its persona and memory. Omit to use its default model."
     },
     "skill": {
      "type": "string",
      "default": "auto",
      "description": "Skill name from GET /api/agent-skills, or auto"
     },
     "text": {
      "type": "string",
      "description": "The message; markdown"
     }
    },
    "additionalProperties": false,
    "required": [
     "agent",
     "text"
    ]
   },
   "AgentPeer": {
    "type": "object",
    "properties": {
     "kind": {
      "type": "string"
     },
     "userId": {
      "type": "string"
     },
     "name": {
      "type": "string",
      "description": "Agent name"
     },
     "addr": {
      "type": "integer",
      "description": "Where it was last seen, decimal"
     },
     "pane": {
      "type": "string",
      "description": "Which panel it was in"
     },
     "agent": {
      "type": "boolean"
     },
     "idle": {
      "type": "boolean"
     }
    },
    "additionalProperties": true
   },
   "KeyStatus": {
    "type": "object",
    "properties": {
     "enabled": {
      "type": "boolean",
      "description": "Whether this gateway can store keys at all (a KEK is configured)"
     },
     "providers": {
      "type": "array",
      "items": {
       "type": "object",
       "properties": {
        "provider": {
         "type": "string",
         "enum": [
          "gemini",
          "openai",
          "openrouter",
          "zai"
         ]
        },
        "hasKey": {
         "type": "boolean",
         "description": "Whether this account stored a key"
        },
        "validationStatus": {
         "type": "string",
         "enum": [
          "verified",
          "unverified",
          "failed"
         ],
         "description": "Result of the most recent write-only provider credential check"
        },
        "validatedAt": {
         "type": "integer",
         "format": "int64",
         "description": "Unix milliseconds when validation was attempted"
        },
        "validationError": {
         "type": "string",
         "description": "Content-free validation failure category suitable for display"
        },
        "pooled": {
         "type": "boolean",
         "description": "Whether runs are operator-funded when this account stores no key"
        }
       },
       "additionalProperties": false
      }
     }
    },
    "additionalProperties": false
   },
   "SetKeyRequest": {
    "type": "object",
    "properties": {
     "provider": {
      "type": "string",
      "enum": [
       "gemini",
       "openai",
       "openrouter",
       "zai"
      ]
     },
     "key": {
      "type": "string",
      "description": "The provider API key; stored encrypted, never read back"
     }
    },
    "additionalProperties": false,
    "required": [
     "provider",
     "key"
    ]
   },
   "AutorunSetting": {
    "type": "object",
    "properties": {
     "enabled": {
      "type": "boolean"
     },
     "agent": {
      "type": "string",
      "description": "Which agent runs on each of this account's uploads"
     },
     "role": {
      "type": "string",
      "enum": [
       "viewer",
       "editor"
      ],
      "description": "Session role"
     }
    },
    "additionalProperties": false
   },
   "RenameRequest": {
    "type": "object",
    "properties": {
     "addr": {
      "type": "string",
      "description": "0x-prefixed hex"
     },
     "name": {
      "type": "string",
      "description": "New function name"
     }
    },
    "additionalProperties": false,
    "required": [
     "addr",
     "name"
    ]
   },
   "RenameVarRequest": {
    "type": "object",
    "properties": {
     "addr": {
      "type": "string",
      "description": "0x-prefixed hex, inside the function"
     },
     "oldName": {
      "type": "string"
     },
     "newName": {
      "type": "string"
     }
    },
    "additionalProperties": false,
    "required": [
     "addr",
     "oldName",
     "newName"
    ]
   },
   "RetypeVarRequest": {
    "type": "object",
    "properties": {
     "addr": {
      "type": "string",
      "description": "0x-prefixed hex, inside the function"
     },
     "name": {
      "type": "string",
      "description": "Variable name"
     },
     "type": {
      "type": "string",
      "description": "C type, e.g. 'char *'"
     }
    },
    "additionalProperties": false,
    "required": [
     "addr",
     "name",
     "type"
    ]
   },
   "CommentRequest": {
    "type": "object",
    "properties": {
     "addr": {
      "type": "string",
      "description": "0x-prefixed hex"
     },
     "text": {
      "type": "string",
      "description": "Empty deletes nothing; use DELETE /comment for that"
     }
    },
    "additionalProperties": false,
    "required": [
     "addr",
     "text"
    ]
   },
   "LabelRequest": {
    "type": "object",
    "properties": {
     "addr": {
      "type": "string",
      "description": "0x-prefixed hex"
     },
     "name": {
      "type": "string",
      "description": "Empty clears the label"
     }
    },
    "additionalProperties": false,
    "required": [
     "addr",
     "name"
    ]
   },
   "DataRequest": {
    "type": "object",
    "properties": {
     "addr": {
      "type": "string",
      "description": "0x-prefixed hex"
     },
     "type": {
      "type": "string",
      "description": "Type to define the bytes as; empty clears the definition"
     }
    },
    "additionalProperties": false,
    "required": [
     "addr",
     "type"
    ]
   },
   "BookmarkRequest": {
    "type": "object",
    "properties": {
     "addr": {
      "type": "string",
      "description": "0x-prefixed hex"
     },
     "category": {
      "type": "string"
     },
     "comment": {
      "type": "string",
      "description": "Empty removes the bookmark"
     }
    },
    "additionalProperties": false,
    "required": [
     "addr",
     "comment"
    ]
   },
   "SignatureRequest": {
    "type": "object",
    "properties": {
     "addr": {
      "type": "string",
      "description": "0x-prefixed hex"
     },
     "signature": {
      "type": "string",
      "description": "Full C prototype"
     },
     "callingConvention": {
      "type": "string"
     }
    },
    "additionalProperties": false,
    "required": [
     "addr",
     "signature"
    ]
   },
   "SetNotesRequest": {
    "type": "object",
    "properties": {
     "text": {
      "type": "string",
      "description": "The whole notes text; this replaces, not appends"
     },
     "revision": {
      "type": "string",
      "description": "Expected content revision from GET notes; recommended for every save"
     }
    },
    "additionalProperties": false,
    "required": [
     "text"
    ]
   },
   "TypeDetail": {
    "type": "object",
    "properties": {
     "name": {
      "type": "string",
      "description": "Category path of the type"
     },
     "kind": {
      "type": "string",
      "description": "struct, union, enum, typedef, funcdef, pointer, array or builtin"
     },
     "size": {
      "type": "integer",
      "description": "Bytes"
     },
     "base": {
      "type": "string",
      "description": "Underlying type; typedefs only"
     },
     "members": {
      "type": "array",
      "description": "Fields for a struct or union, values for an enum",
      "items": {
       "type": "object",
       "properties": {
        "offset": {
         "type": "integer",
         "description": "Byte offset; composites only"
        },
        "name": {
         "type": "string",
         "description": "Field or constant name"
        },
        "type": {
         "type": "string",
         "description": "Field type; composites only"
        },
        "size": {
         "type": "integer",
         "description": "Field size; composites only"
        },
        "comment": {
         "type": "string",
         "description": "Field comment; composites only"
        },
        "value": {
         "type": "integer",
         "description": "Constant value; enums only"
        }
       }
      }
     }
    }
   },
   "ParseTypesRequest": {
    "type": "object",
    "properties": {
     "source": {
      "type": "string",
      "description": "C declarations: structs, unions, enums, typedefs"
     },
     "replace": {
      "type": "boolean",
      "description": "Overwrite types that already exist; without it a clash is a 409"
     }
    },
    "additionalProperties": false,
    "required": [
     "source"
    ]
   },
   "DeleteTypeRequest": {
    "type": "object",
    "properties": {
     "name": {
      "type": "string",
      "description": "Type to remove; its uses revert to undefined"
     }
    },
    "additionalProperties": false,
    "required": [
     "name"
    ]
   },
   "TypeUses": {
    "type": "object",
    "description": "What deleting this type would revert to undefined",
    "properties": {
     "name": {
      "type": "string",
      "description": "Category path of the type"
     },
     "data": {
      "type": "integer",
      "description": "Defined data using it"
     },
     "variables": {
      "type": "integer",
      "description": "Function variables typed as it"
     },
     "types": {
      "type": "integer",
      "description": "Other types built from it"
     },
     "total": {
      "type": "integer",
      "description": "Sum of the three"
     }
    }
   },
   "Finding": {
    "type": "object",
    "description": "One structured claim a background agent run recorded. Append-only: a corrected finding is superseded by a newer one, never edited.",
    "properties": {
     "id": {
      "type": "string"
     },
     "agent": {
      "type": "string"
     },
     "userId": {
      "type": "string"
     },
     "claim": {
      "type": "string"
     },
     "addr": {
      "type": "string"
     },
     "confidence": {
      "type": "string",
      "enum": [
       "low",
       "medium",
       "high"
      ]
     },
     "createdAt": {
      "type": "integer"
     },
     "supersedes": {
      "type": "string"
     },
     "supersededBy": {
      "type": "string"
     },
     "principalId": {
      "type": "string"
     },
     "runId": {
      "type": "string"
     },
     "taskId": {
      "type": "string"
     },
     "workspaceRevision": {
      "type": "integer"
     },
     "evidence": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/EvidenceRef"
      }
     },
     "state": {
      "type": "string",
      "enum": [
       "proposed",
       "verified",
       "rejected",
       "superseded"
      ]
     },
     "reviews": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/FindingReview"
      }
     },
     "latestVerdict": {
      "type": "string"
     }
    },
    "required": [
     "id",
     "claim",
     "createdAt",
     "state"
    ]
   },
   "DefinedDataItem": {
    "type": "object",
    "description": "One typed global defined in the program.",
    "properties": {
     "vaddr": {
      "type": "integer",
      "description": "Virtual address (decimal); render as hex."
     },
     "paddr": {
      "type": "integer",
      "description": "File offset (decimal), or -1 if not in the file image."
     },
     "size": {
      "type": "integer",
      "description": "Size in bytes."
     },
     "type": {
      "type": "string",
      "description": "Data type display name."
     },
     "name": {
      "type": "string",
      "description": "Primary symbol/label at the address, or '' if none."
     },
     "section": {
      "type": "string",
      "description": "Containing memory block, or ''."
     },
     "value": {
      "type": "string",
      "description": "Rendered value, truncated to 256 chars."
     },
     "xrefs": {
      "type": "integer",
      "description": "Count of references into this address."
     }
    },
    "required": [
     "vaddr",
     "paddr",
     "size",
     "type",
     "name",
     "section",
     "value",
     "xrefs"
    ],
    "additionalProperties": false
   },
   "EvidenceRef": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string"
     },
     "kind": {
      "type": "string",
      "enum": [
       "decompile",
       "disassembly",
       "bytes",
       "string",
       "xref",
       "import",
       "runtime-memory",
       "register",
       "stack",
       "trace",
       "artifact",
       "note"
      ]
     },
     "workspaceId": {
      "type": "string"
     },
     "addr": {
      "type": "string"
     },
     "endAddr": {
      "type": "string"
     },
     "function": {
      "type": "string"
     },
     "workspaceRevision": {
      "type": "integer"
     },
     "debugRunId": {
      "type": "string"
     },
     "snapshot": {
      "type": "integer"
     },
     "artifactId": {
      "type": "string"
     },
     "digest": {
      "type": "string"
     },
     "observation": {
      "type": "string"
     }
    },
    "additionalProperties": false,
    "required": [
     "id",
     "kind",
     "workspaceId",
     "workspaceRevision",
     "observation"
    ]
   },
   "EvidenceResolution": {
    "type": "object",
    "properties": {
     "evidence": {
      "$ref": "#/components/schemas/EvidenceRef"
     },
     "available": {
      "type": "boolean"
     },
     "reason": {
      "type": "string",
      "description": "Why exact supporting state is no longer available"
     },
     "data": {
      "type": "object",
      "properties": {},
      "additionalProperties": true,
      "description": "Recorded runtime snapshot payload when runtime evidence resolves"
     }
    },
    "additionalProperties": false,
    "required": [
     "evidence",
     "available"
    ]
   },
   "FindingReviewRequest": {
    "type": "object",
    "properties": {
     "verdict": {
      "type": "string",
      "enum": [
       "accepted",
       "rejected",
       "corrected",
       "verification_requested"
      ]
     },
     "reason": {
      "type": "string"
     },
     "correction": {
      "type": "string"
     }
    },
    "additionalProperties": false,
    "required": [
     "verdict"
    ]
   },
   "FindingReview": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string"
     },
     "findingId": {
      "type": "string"
     },
     "userId": {
      "type": "string"
     },
     "username": {
      "type": "string"
     },
     "verdict": {
      "type": "string"
     },
     "reason": {
      "type": "string"
     },
     "correction": {
      "type": "string"
     },
     "createdAt": {
      "type": "integer"
     }
    },
    "additionalProperties": false,
    "required": [
     "id",
     "findingId",
     "userId",
     "verdict",
     "createdAt"
    ]
   },
   "FindingFeedbackExport": {
    "type": "object",
    "properties": {
     "schemaVersion": {
      "type": "integer"
     },
     "workspaceId": {
      "type": "string"
     },
     "exportedAt": {
      "type": "integer"
     },
     "findings": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Finding"
      }
     }
    },
    "additionalProperties": false,
    "required": [
     "schemaVersion",
     "workspaceId",
     "exportedAt",
     "findings"
    ]
   },
   "AgentMission": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string"
     },
     "workspaceId": {
      "type": "string"
     },
     "creatorId": {
      "type": "string"
     },
     "agent": {
      "type": "string"
     },
     "objective": {
      "type": "string",
      "maxLength": 8192
     },
     "acceptanceCriteria": {
      "type": "string",
      "maxLength": 8192
     },
     "state": {
      "type": "string",
      "enum": [
       "draft",
       "queued",
       "running",
       "waiting_for_user",
       "paused",
       "completed",
       "failed",
       "canceled",
       "interrupted"
      ]
     },
     "mutationPolicy": {
      "type": "string",
      "enum": [
       "read_only",
       "propose",
       "allow"
      ]
     },
     "toolBudget": {
      "type": "integer",
      "minimum": 1,
      "maximum": 1000
     },
     "tokenBudget": {
      "type": "integer",
      "minimum": 1,
      "maximum": 10000000
     },
     "timeBudgetMs": {
      "type": "integer",
      "minimum": 1,
      "maximum": 86400000
     },
     "createdAt": {
      "type": "integer"
     },
     "updatedAt": {
      "type": "integer"
     },
     "startedAt": {
      "type": "integer"
     },
     "finishedAt": {
      "type": "integer"
     },
     "queuePosition": {
      "type": "integer",
      "minimum": 1
     },
     "queueReason": {
      "type": "string"
     }
    },
    "additionalProperties": false,
    "required": [
     "id",
     "workspaceId",
     "creatorId",
     "agent",
     "objective",
     "acceptanceCriteria",
     "state",
     "mutationPolicy",
     "toolBudget",
     "tokenBudget",
     "timeBudgetMs",
     "createdAt",
     "updatedAt"
    ]
   },
   "AgentMissionTask": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string"
     },
     "missionId": {
      "type": "string"
     },
     "ordinal": {
      "type": "integer",
      "minimum": 1
     },
     "title": {
      "type": "string",
      "maxLength": 256
     },
     "rationale": {
      "type": "string",
      "maxLength": 2048
     },
     "state": {
      "type": "string",
      "enum": [
       "pending",
       "queued",
       "running",
       "waiting_for_user",
       "completed",
       "failed",
       "canceled",
       "interrupted"
      ]
     },
     "assignedSkill": {
      "type": "string",
      "maxLength": 128
     },
     "runId": {
      "type": "string"
     },
     "evidenceCount": {
      "type": "integer",
      "minimum": 0
     },
     "blockedReason": {
      "type": "string",
      "maxLength": 2048
     },
     "checkpointKind": {
      "type": "string",
      "enum": [
       "none",
       "permission",
       "risky_debug_mutation",
       "publish_or_export",
       "raw_binary_interpretation"
      ]
     },
     "createdAt": {
      "type": "integer"
     },
     "updatedAt": {
      "type": "integer"
     }
    },
    "additionalProperties": false,
    "required": [
     "id",
     "missionId",
     "ordinal",
     "title",
     "state",
     "evidenceCount",
     "checkpointKind",
     "createdAt",
     "updatedAt"
    ]
   },
   "AgentMissionDetail": {
    "type": "object",
    "properties": {
     "mission": {
      "$ref": "#/components/schemas/AgentMission"
     },
     "tasks": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/AgentMissionTask"
      }
     },
     "usage": {
      "type": "object",
      "properties": {
       "toolCalls": {
        "type": "integer"
       },
       "inputTokens": {
        "type": "integer"
       },
       "outputTokens": {
        "type": "integer"
       },
       "attempts": {
        "type": "integer"
       },
       "reportedRuns": {
        "type": "integer"
       }
      },
      "additionalProperties": false,
      "required": [
       "toolCalls",
       "inputTokens",
       "outputTokens",
       "attempts",
       "reportedRuns"
      ]
     },
     "guidance": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/AgentMissionGuidance"
      }
     },
     "plannerRunId": {
      "type": "string"
     }
    },
    "additionalProperties": false,
    "required": [
     "mission",
     "tasks",
     "usage",
     "guidance"
    ]
   },
   "AgentMissionRequest": {
    "type": "object",
    "properties": {
     "agent": {
      "type": "string"
     },
     "objective": {
      "type": "string",
      "maxLength": 8192
     },
     "acceptanceCriteria": {
      "type": "string",
      "maxLength": 8192
     },
     "mutationPolicy": {
      "type": "string",
      "enum": [
       "read_only",
       "propose",
       "allow"
      ]
     },
     "toolBudget": {
      "type": "integer",
      "minimum": 1,
      "maximum": 1000
     },
     "tokenBudget": {
      "type": "integer",
      "minimum": 1,
      "maximum": 10000000
     },
     "timeBudgetMs": {
      "type": "integer",
      "minimum": 1,
      "maximum": 86400000
     }
    },
    "additionalProperties": false,
    "required": [
     "objective",
     "acceptanceCriteria"
    ]
   },
   "AgentMissionPlanRequest": {
    "type": "object",
    "properties": {
     "tasks": {
      "type": "array",
      "items": {
       "type": "object",
       "properties": {
        "title": {
         "type": "string",
         "maxLength": 256
        },
        "rationale": {
         "type": "string",
         "maxLength": 2048
        },
        "assignedSkill": {
         "type": "string",
         "maxLength": 128
        },
        "checkpointKind": {
         "type": "string",
         "enum": [
          "none",
          "permission",
          "risky_debug_mutation",
          "publish_or_export",
          "raw_binary_interpretation"
         ]
        }
       },
       "additionalProperties": false,
       "required": [
        "title"
       ]
      }
     }
    },
    "additionalProperties": false,
    "required": [
     "tasks"
    ]
   },
   "AgentMissionGuidance": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string"
     },
     "missionId": {
      "type": "string"
     },
     "userId": {
      "type": "string"
     },
     "text": {
      "type": "string",
      "maxLength": 2048
     },
     "createdAt": {
      "type": "integer"
     }
    },
    "additionalProperties": false,
    "required": [
     "id",
     "missionId",
     "userId",
     "text",
     "createdAt"
    ]
   },
   "AgentMissionGuidanceRequest": {
    "type": "object",
    "properties": {
     "text": {
      "type": "string",
      "maxLength": 2048
     }
    },
    "additionalProperties": false,
    "required": [
     "text"
    ]
   },
   "AgentSkillRef": {
    "type": "object",
    "properties": {
     "name": {
      "type": "string"
     },
     "version": {
      "type": "string"
     }
    },
    "additionalProperties": false,
    "required": [
     "name",
     "version"
    ]
   },
   "PublicAgentSkill": {
    "type": "object",
    "properties": {
     "name": {
      "type": "string"
     },
     "version": {
      "type": "string"
     },
     "description": {
      "type": "string"
     },
     "toolGroups": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "mutationPolicy": {
      "type": "string",
      "enum": [
       "read_only",
       "propose",
       "allow"
      ]
     },
     "requiredIsolationCapabilities": {
      "type": "array",
      "items": {
       "type": "string"
      }
     }
    },
    "additionalProperties": false,
    "required": [
     "name",
     "version",
     "description",
     "toolGroups",
     "mutationPolicy"
    ]
   },
   "Investigation": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string"
     },
     "name": {
      "type": "string",
      "maxLength": 200
     },
     "description": {
      "type": "string",
      "maxLength": 4096
     },
     "revision": {
      "type": "integer",
      "minimum": 1
     },
     "memberCount": {
      "type": "integer",
      "minimum": 0
     },
     "createdAt": {
      "type": "integer",
      "minimum": 0
     },
     "updatedAt": {
      "type": "integer",
      "minimum": 0
     },
     "ownerId": {
      "type": "string"
     },
     "yourRole": {
      "type": "string",
      "enum": [
       "editor",
       "viewer"
      ]
     },
     "isDefault": {
      "type": "boolean"
     },
     "organizationId": {
      "type": "string"
     },
     "organizationRole": {
      "type": "string",
      "enum": [
       "admin",
       "editor",
       "viewer"
      ]
     },
     "createdBy": {
      "type": "string",
      "description": "Immutable original actor attribution"
     },
     "capabilities": {
      "$ref": "#/components/schemas/ResourceCapabilities"
     }
    },
    "required": [
     "id",
     "name",
     "description",
     "revision",
     "memberCount",
     "createdAt",
     "updatedAt"
    ]
   },
   "NewInvestigation": {
    "type": "object",
    "properties": {
     "name": {
      "type": "string",
      "maxLength": 200,
      "minLength": 1
     },
     "description": {
      "type": "string",
      "maxLength": 4096
     },
     "organizationId": {
      "type": "string",
      "description": "Required for platform-admin creation; defaults to the active member company for other users."
     }
    },
    "required": [
     "name"
    ],
    "additionalProperties": false
   },
   "InvestigationMember": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string"
     },
     "workspaceId": {
      "type": "string"
     },
     "name": {
      "type": "string"
     },
     "available": {
      "type": "boolean"
     },
     "home": {
      "type": "boolean",
      "description": "True for a home session; false for an independent-access reference."
     }
    },
    "required": [
     "id",
     "available"
    ]
   },
   "InvestigationDetail": {
    "type": "object",
    "properties": {
     "investigation": {
      "$ref": "#/components/schemas/Investigation"
     },
     "members": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/InvestigationMember"
      }
     }
    },
    "required": [
     "investigation",
     "members"
    ]
   },
   "InvestigationMembersRequest": {
    "type": "object",
    "properties": {
     "revision": {
      "type": "integer",
      "minimum": 1
     },
     "workspaceIds": {
      "type": "array",
      "items": {
       "type": "string"
      },
      "uniqueItems": true
     }
    },
    "required": [
     "revision",
     "workspaceIds"
    ],
    "additionalProperties": false
   },
   "InvestigationRunRequest": {
    "type": "object",
    "properties": {
     "revision": {
      "type": "integer",
      "minimum": 1
     },
     "mode": {
      "type": "string",
      "enum": [
       "individual",
       "correlate",
       "combined"
      ]
     },
     "objective": {
      "type": "string",
      "maxLength": 8192,
      "minLength": 1
     },
     "agent": {
      "type": "string",
      "maxLength": 128,
      "minLength": 1
     },
     "mutationPolicy": {
      "type": "string",
      "enum": [
       "read_only",
       "propose",
       "allow"
      ],
      "default": "propose"
     },
     "toolBudget": {
      "type": "integer",
      "minimum": 0,
      "maximum": 10000,
      "default": 600,
      "description": "Aggregate AI budget across files and retries. Omitted/zero selects the default. Mission shares are reserved before dispatch and reconciled after completion; unknown usage consumes its reservation. Time is cumulative mission milliseconds. Token admission estimates requests conservatively and records actual provider overages."
     },
     "tokenBudget": {
      "type": "integer",
      "minimum": 0,
      "maximum": 100000000,
      "default": 2000000,
      "description": "Aggregate AI budget across files and retries. Omitted/zero selects the default. Mission shares are reserved before dispatch and reconciled after completion; unknown usage consumes its reservation. Time is cumulative mission milliseconds. Token admission estimates requests conservatively and records actual provider overages."
     },
     "timeBudgetMs": {
      "type": "integer",
      "minimum": 0,
      "maximum": 86400000,
      "default": 7200000,
      "description": "Aggregate AI budget across files and retries. Omitted/zero selects the default. Mission shares are reserved before dispatch and reconciled after completion; unknown usage consumes its reservation. Time is cumulative mission milliseconds. Token admission estimates requests conservatively and records actual provider overages."
     },
     "objectives": {
      "type": "object",
      "maxProperties": 500,
      "additionalProperties": {
       "type": "string",
       "minLength": 1,
       "maxLength": 8192
      },
      "description": "Optional objective overrides keyed by member workspace ID. Replaces the shared objective for that file; frozen with membership. Included in run detail; list responses omit the overrides."
     },
     "workspaceIds": {
      "type": "array",
      "minItems": 1,
      "maxItems": 500,
      "uniqueItems": true,
      "items": {
       "type": "string"
      },
      "description": "Explicit selection of current sources. Required for projects larger than 500."
     }
    },
    "required": [
     "revision",
     "mode",
     "objective",
     "agent"
    ],
    "additionalProperties": false
   },
   "InvestigationRun": {
    "type": "object",
    "properties": {
     "revision": {
      "type": "integer",
      "minimum": 1
     },
     "mode": {
      "type": "string",
      "enum": [
       "individual",
       "correlate",
       "combined",
       "program",
       "firmware",
       "conversation"
      ]
     },
     "objective": {
      "type": "string",
      "maxLength": 8192,
      "minLength": 1
     },
     "agent": {
      "type": "string",
      "maxLength": 128,
      "minLength": 1
     },
     "mutationPolicy": {
      "type": "string",
      "enum": [
       "read_only",
       "propose",
       "allow"
      ],
      "default": "propose"
     },
     "toolBudget": {
      "type": "integer",
      "minimum": 0,
      "maximum": 10000,
      "default": 600,
      "description": "Aggregate AI budget across files and retries. Omitted/zero selects the default. Mission shares are reserved before dispatch and reconciled after completion; unknown usage consumes its reservation. Time is cumulative mission milliseconds. Token admission estimates requests conservatively and records actual provider overages."
     },
     "tokenBudget": {
      "type": "integer",
      "minimum": 0,
      "maximum": 100000000,
      "default": 2000000,
      "description": "Aggregate AI budget across files and retries. Omitted/zero selects the default. Mission shares are reserved before dispatch and reconciled after completion; unknown usage consumes its reservation. Time is cumulative mission milliseconds. Token admission estimates requests conservatively and records actual provider overages."
     },
     "timeBudgetMs": {
      "type": "integer",
      "minimum": 0,
      "maximum": 86400000,
      "default": 7200000,
      "description": "Aggregate AI budget across files and retries. Omitted/zero selects the default. Mission shares are reserved before dispatch and reconciled after completion; unknown usage consumes its reservation. Time is cumulative mission milliseconds. Token admission estimates requests conservatively and records actual provider overages."
     },
     "id": {
      "type": "string"
     },
     "investigationId": {
      "type": "string"
     },
     "state": {
      "type": "string",
      "enum": [
       "draft",
       "queued",
       "running",
       "paused",
       "canceling",
       "interrupted",
       "finished"
      ]
     },
     "outcome": {
      "type": "string",
      "enum": [
       "completed",
       "completed_with_errors",
       "failed",
       "canceled"
      ]
     },
     "createdAt": {
      "type": "integer",
      "minimum": 0
     },
     "updatedAt": {
      "type": "integer",
      "minimum": 0
     },
     "objectives": {
      "type": "object",
      "maxProperties": 500,
      "additionalProperties": {
       "type": "string",
       "minLength": 1,
       "maxLength": 8192
      },
      "description": "Optional objective overrides keyed by member workspace ID. Replaces the shared objective for that file; frozen with membership. Included in run detail; list responses omit the overrides."
     },
     "workspaceIds": {
      "type": "array",
      "maxItems": 500,
      "items": {
       "type": "string"
      },
      "description": "Explicit source selection. Required when the project exceeds 500 sources."
     },
     "createdBy": {
      "type": "string"
     },
     "executionUserId": {
      "type": "string",
      "description": "Fixed to the first starter; this account funds retries and restarts."
     }
    },
    "required": [
     "revision",
     "mode",
     "objective",
     "agent",
     "mutationPolicy",
     "toolBudget",
     "tokenBudget",
     "timeBudgetMs",
     "id",
     "investigationId",
     "state",
     "createdAt",
     "updatedAt"
    ]
   },
   "InvestigationRunItem": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string"
     },
     "workspaceId": {
      "type": "string"
     },
     "ordinal": {
      "type": "integer",
      "minimum": 0
     },
     "objective": {
      "type": "string",
      "description": "Optional per-file objective override."
     }
    },
    "required": [
     "id",
     "workspaceId",
     "ordinal"
    ]
   },
   "InvestigationAttempt": {
    "type": "object",
    "properties": {
     "sequence": {
      "type": "integer"
     },
     "id": {
      "type": "string"
     },
     "taskId": {
      "type": "string"
     },
     "state": {
      "type": "string",
      "enum": [
       "claimed",
       "running",
       "completed",
       "failed",
       "interrupted",
       "canceled"
      ]
     },
     "operationId": {
      "type": "string"
     },
     "ownsOperation": {
      "type": "boolean"
     },
     "reason": {
      "type": "string"
     },
     "createdAt": {
      "type": "integer"
     },
     "updatedAt": {
      "type": "integer"
     }
    },
    "required": [
     "sequence",
     "id",
     "taskId",
     "state",
     "ownsOperation",
     "createdAt",
     "updatedAt"
    ]
   },
   "InvestigationProgress": {
    "type": "object",
    "properties": {
     "state": {
      "type": "string"
     },
     "outcome": {
      "type": "string"
     },
     "updatedAt": {
      "type": "integer"
     },
     "counts": {
      "type": "object",
      "additionalProperties": {
       "type": "integer"
      }
     },
     "stages": {
      "type": "object",
      "additionalProperties": {
       "type": "object",
       "additionalProperties": {
        "type": "integer"
       }
      }
     },
     "reasons": {
      "type": "object",
      "additionalProperties": {
       "type": "integer"
      }
     },
     "budget": {
      "$ref": "#/components/schemas/InvestigationBudget"
     }
    },
    "required": [
     "state",
     "updatedAt",
     "counts",
     "stages",
     "reasons"
    ]
   },
   "InvestigationBudgetAmounts": {
    "type": "object",
    "properties": {
     "tools": {
      "type": "integer",
      "minimum": 0
     },
     "tokens": {
      "type": "integer",
      "minimum": 0
     },
     "timeMs": {
      "type": "integer",
      "minimum": 0
     }
    },
    "required": [
     "tools",
     "tokens",
     "timeMs"
    ]
   },
   "InvestigationBudget": {
    "type": "object",
    "properties": {
     "limit": {
      "$ref": "#/components/schemas/InvestigationBudgetAmounts"
     },
     "reserved": {
      "$ref": "#/components/schemas/InvestigationBudgetAmounts"
     },
     "charged": {
      "$ref": "#/components/schemas/InvestigationBudgetAmounts"
     },
     "available": {
      "$ref": "#/components/schemas/InvestigationBudgetAmounts"
     },
     "unknownMissions": {
      "type": "integer",
      "minimum": 0,
      "description": "Number of individual or coordinator AI attempts with unknown token usage; reserved tokens remain charged."
     }
    },
    "required": [
     "limit",
     "reserved",
     "charged",
     "available",
     "unknownMissions"
    ]
   },
   "InvestigationMissionResult": {
    "type": "object",
    "properties": {
     "taskId": {
      "type": "string"
     },
     "attemptId": {
      "type": "string"
     },
     "workspaceId": {
      "type": "string"
     },
     "missionId": {
      "type": "string"
     },
     "agentRunId": {
      "type": "string"
     },
     "state": {
      "type": "string"
     },
     "reason": {
      "type": "string"
     },
     "summary": {
      "type": "string"
     },
     "reserved": {
      "$ref": "#/components/schemas/InvestigationBudgetAmounts"
     },
     "toolCalls": {
      "type": [
       "integer",
       "null"
      ],
      "minimum": 0
     },
     "inputTokens": {
      "type": [
       "integer",
       "null"
      ],
      "minimum": 0
     },
     "outputTokens": {
      "type": [
       "integer",
       "null"
      ],
      "minimum": 0
     },
     "elapsedMs": {
      "type": [
       "integer",
       "null"
      ],
      "minimum": 0
     },
     "settledAt": {
      "type": "integer",
      "minimum": 0
     }
    },
    "required": [
     "taskId",
     "attemptId",
     "workspaceId",
     "missionId",
     "state",
     "summary",
     "reserved",
     "toolCalls",
     "inputTokens",
     "outputTokens",
     "elapsedMs",
     "settledAt"
    ]
   },
   "InvestigationTask": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string"
     },
     "itemId": {
      "type": "string"
     },
     "kind": {
      "type": "string",
      "enum": [
       "analysis",
       "capture",
       "program",
       "firmware",
       "investigate",
       "correlate",
       "conversation"
      ]
     },
     "state": {
      "type": "string",
      "enum": [
       "pending",
       "queued",
       "running",
       "blocked",
       "completed",
       "failed",
       "canceled",
       "interrupted"
      ]
     },
     "ordinal": {
      "type": "integer",
      "minimum": 0
     },
     "dependsOn": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "reason": {
      "type": "string"
     },
     "resultId": {
      "type": "string",
      "description": "Durable result reference: workspace ID for analysis, mission ID for individual AI."
     },
     "nextAttemptAt": {
      "type": "integer"
     }
    },
    "required": [
     "id",
     "kind",
     "state",
     "ordinal",
     "dependsOn"
    ]
   },
   "InvestigationRunDetail": {
    "type": "object",
    "properties": {
     "run": {
      "$ref": "#/components/schemas/InvestigationRun"
     },
     "items": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/InvestigationRunItem"
      }
     },
     "tasks": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/InvestigationTask"
      }
     },
     "budget": {
      "$ref": "#/components/schemas/InvestigationBudget"
     }
    },
    "required": [
     "run",
     "items",
     "tasks"
    ]
   },
   "InvestigationUploadSpec": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
     "key": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128,
      "description": "Stable per-file key scoped to this investigation. Replays require identical declarations."
     },
     "name": {
      "type": "string",
      "maxLength": 255
     },
     "size": {
      "type": "integer",
      "minimum": 0
     },
     "symbolsName": {
      "type": "string",
      "maxLength": 255
     },
     "symbolsSize": {
      "type": "integer",
      "minimum": 0
     },
     "options": {
      "$ref": "#/components/schemas/AnalyzeRequest"
     }
    },
    "required": [
     "key",
     "name",
     "size"
    ]
   },
   "InvestigationUpload": {
    "type": "object",
    "properties": {
     "key": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128,
      "description": "Stable per-file key scoped to this investigation. Replays require identical declarations."
     },
     "name": {
      "type": "string",
      "maxLength": 255
     },
     "size": {
      "type": "integer",
      "minimum": 0
     },
     "symbolsName": {
      "type": "string",
      "maxLength": 255
     },
     "symbolsSize": {
      "type": "integer",
      "minimum": 0
     },
     "options": {
      "$ref": "#/components/schemas/AnalyzeRequest"
     },
     "id": {
      "type": "string"
     },
     "state": {
      "type": "string",
      "enum": [
       "pending",
       "failed",
       "uploaded",
       "unavailable"
      ]
     },
     "workspaceId": {
      "type": "string",
      "description": "Omitted if the workspace is unavailable."
     },
     "reused": {
      "type": "boolean"
     },
     "error": {
      "type": "string"
     },
     "symbols": {
      "$ref": "#/components/schemas/SymbolCoverage"
     }
    },
    "required": [
     "id",
     "key",
     "name",
     "size",
     "options",
     "state",
     "reused"
    ]
   },
   "InvestigationCorrelationRelationship": {
    "type": "object",
    "properties": {
     "claim": {
      "type": "string"
     },
     "assessment": {
      "type": "string",
      "enum": [
       "candidate",
       "supported"
      ]
     },
     "evidenceIds": {
      "type": "array",
      "items": {
       "type": "string"
      },
      "minItems": 2,
      "maxItems": 16
     }
    },
    "required": [
     "claim",
     "assessment",
     "evidenceIds"
    ]
   },
   "InvestigationCorrelationReport": {
    "type": "object",
    "properties": {
     "summary": {
      "type": "string"
     },
     "relationships": {
      "type": [
       "array",
       "null"
      ],
      "items": {
       "$ref": "#/components/schemas/InvestigationCorrelationRelationship"
      },
      "maxItems": 32
     },
     "limitations": {
      "type": [
       "array",
       "null"
      ],
      "items": {
       "type": "string"
      },
      "maxItems": 32
     }
    },
    "required": [
     "summary"
    ]
   },
   "InvestigationCorrelationResult": {
    "type": "object",
    "properties": {
     "attemptId": {
      "type": "string"
     },
     "state": {
      "type": "string"
     },
     "reason": {
      "type": "string"
     },
     "provider": {
      "type": "string"
     },
     "model": {
      "type": "string"
     },
     "reserved": {
      "$ref": "#/components/schemas/InvestigationBudgetAmounts"
     },
     "toolCalls": {
      "type": [
       "integer",
       "null"
      ],
      "minimum": 0
     },
     "inputTokens": {
      "type": [
       "integer",
       "null"
      ],
      "minimum": 0
     },
     "outputTokens": {
      "type": [
       "integer",
       "null"
      ],
      "minimum": 0
     },
     "elapsedMs": {
      "type": [
       "integer",
       "null"
      ],
      "minimum": 0
     },
     "settledAt": {
      "type": "integer",
      "minimum": 0
     },
     "report": {
      "$ref": "#/components/schemas/InvestigationCorrelationReport"
     },
     "inspectedWorkspaces": {
      "type": "array",
      "items": {
       "type": "string"
      }
     }
    },
    "required": [
     "attemptId",
     "state",
     "provider",
     "model",
     "reserved",
     "toolCalls",
     "inputTokens",
     "outputTokens",
     "elapsedMs",
     "settledAt",
     "inspectedWorkspaces"
    ]
   },
   "InvestigationObservation": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string"
     },
     "attemptId": {
      "type": "string"
     },
     "workspaceId": {
      "type": "string"
     },
     "workspaceRevision": {
      "type": "integer",
      "minimum": 0
     },
     "tool": {
      "type": "string"
     },
     "arguments": {},
     "result": {},
     "digest": {
      "type": "string"
     },
     "createdAt": {
      "type": "integer",
      "minimum": 0
     }
    },
    "required": [
     "id",
     "attemptId",
     "workspaceId",
     "workspaceRevision",
     "tool",
     "arguments",
     "result",
     "digest",
     "createdAt"
    ]
   },
   "InvestigationObservationResponse": {
    "type": "object",
    "properties": {
     "observation": {
      "$ref": "#/components/schemas/InvestigationObservation"
     },
     "currentRevision": {
      "type": [
       "integer",
       "null"
      ],
      "minimum": 0
     },
     "stale": {
      "type": "boolean"
     }
    },
    "required": [
     "observation",
     "currentRevision",
     "stale"
    ]
   },
   "SharingPerson": {
    "type": "object",
    "properties": {
     "userId": {
      "type": "string"
     },
     "username": {
      "type": "string"
     },
     "role": {
      "type": "string",
      "enum": [
       "viewer",
       "editor"
      ]
     },
     "directRole": {
      "type": "string",
      "enum": [
       "viewer",
       "editor"
      ]
     },
     "projectRole": {
      "type": "string",
      "enum": [
       "viewer",
       "editor"
      ]
     }
    },
    "required": [
     "userId",
     "username",
     "role"
    ]
   },
   "SharingLink": {
    "type": "object",
    "properties": {
     "token": {
      "type": "string"
     },
     "downloads": {
      "type": "boolean"
     }
    },
    "required": [
     "token",
     "downloads"
    ]
   },
   "SharingState": {
    "type": "object",
    "properties": {
     "people": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/SharingPerson"
      }
     },
     "canManage": {
      "type": "boolean"
     },
     "link": {
      "$ref": "#/components/schemas/SharingLink"
     },
     "project": {
      "type": "object",
      "properties": {
       "id": {
        "type": "string"
       },
       "name": {
        "type": "string"
       }
      },
      "required": [
       "name"
      ]
     },
     "inheritedLink": {
      "$ref": "#/components/schemas/SharingLink"
     }
    },
    "required": [
     "people",
     "canManage",
     "link"
    ]
   },
   "ShareDownloadsRequest": {
    "type": "object",
    "properties": {
     "downloads": {
      "type": "boolean"
     }
    },
    "required": [
     "downloads"
    ],
    "additionalProperties": false
   },
   "DeleteSessionRequest": {
    "type": "object",
    "properties": {
     "confirm": {
      "type": "string",
      "description": "The binary's display name, typed back to confirm"
     }
    },
    "additionalProperties": false,
    "required": [
     "confirm"
    ]
   },
   "ResourceCapabilities": {
    "type": "object",
    "properties": {
     "canRead": {
      "type": "boolean"
     },
     "canEdit": {
      "type": "boolean"
     },
     "canManageAccess": {
      "type": "boolean"
     },
     "canDelete": {
      "type": "boolean"
     },
     "canRestore": {
      "type": "boolean"
     },
     "canSharePublicly": {
      "type": "boolean"
     },
     "canRevokePublicAccess": {
      "type": "boolean"
     },
     "canDownload": {
      "type": "boolean"
     },
     "canStartWork": {
      "type": "boolean"
     },
     "canUploadFirmware": {
      "type": "boolean",
      "description": "Can save firmware inputs without starting analysis."
     }
    }
   },
   "PublicScopeRequest": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "revision",
     "sources"
    ],
    "properties": {
     "revision": {
      "type": "integer",
      "minimum": 0
     },
     "sources": {
      "type": "array",
      "maxItems": 200,
      "uniqueItems": true,
      "items": {
       "type": "string"
      }
     },
     "reports": {
      "type": "array",
      "maxItems": 200,
      "uniqueItems": true,
      "items": {
       "type": "string"
      }
     }
    }
   },
   "SymbolCoverage": {
    "type": "object",
    "properties": {
     "status": {
      "type": "string",
      "enum": [
       "none",
       "staged",
       "applied",
       "skipped",
       "unknown"
      ]
     },
     "name": {
      "type": "string"
     },
     "sizeBytes": {
      "type": "integer"
     },
     "uploadedAt": {
      "type": "integer"
     },
     "uploadedBy": {
      "type": "string"
     },
     "appliedAt": {
      "type": "integer",
      "description": "Engine result timestamp; present only when PDB application is confirmed."
     },
     "warning": {
      "type": "string",
      "description": "Missing, rejected, or unverified optional PDB coverage. Native binary symbols may still be available."
     }
    },
    "required": [
     "status"
    ],
    "additionalProperties": false
   },
   "ReleaseConversationSource": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string"
     },
     "workspaceId": {
      "type": "string"
     },
     "inventoryId": {
      "type": "string"
     },
     "binaryId": {
      "type": "string"
     },
     "path": {
      "type": "string"
     }
    },
    "additionalProperties": false,
    "required": [
     "id",
     "workspaceId",
     "inventoryId",
     "binaryId",
     "path"
    ]
   },
   "ReleaseMessage": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string"
     },
     "sequence": {
      "type": "integer",
      "minimum": 1
     },
     "author": {
      "type": "string"
     },
     "text": {
      "type": "string"
     },
     "at": {
      "type": "integer"
     },
     "sources": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/ReleaseConversationSource"
      }
     },
     "planId": {
      "type": "string"
     },
     "role": {
      "type": "string",
      "enum": [
       "user",
       "agent",
       "receipt"
      ]
     },
     "runId": {
      "type": "string"
     },
     "proposal": {
      "$ref": "#/components/schemas/ConversationProposal"
     }
    },
    "additionalProperties": false,
    "required": [
     "id",
     "sequence",
     "author",
     "text",
     "at",
     "sources"
    ]
   },
   "ReleaseConversation": {
    "type": "object",
    "properties": {
     "revision": {
      "type": "integer",
      "minimum": 0
     },
     "messages": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/ReleaseMessage"
      }
     },
     "hasEarlier": {
      "type": "boolean"
     },
     "turn": {
      "$ref": "#/components/schemas/ConversationTurn"
     }
    },
    "additionalProperties": false,
    "required": [
     "revision",
     "messages",
     "hasEarlier"
    ]
   },
   "NewReleaseMessage": {
    "type": "object",
    "properties": {
     "revision": {
      "type": "integer",
      "minimum": 0,
      "description": "Last observed conversation revision"
     },
     "text": {
      "type": "string",
      "minLength": 1,
      "maxLength": 8192,
      "description": "Nonempty UTF-8 text, at most 8192 bytes"
     },
     "sourceIds": {
      "type": "array",
      "items": {
       "type": "string"
      },
      "maxItems": 500,
      "uniqueItems": true
     },
     "planId": {
      "type": "string",
      "maxLength": 128,
      "description": "Optional immutable release analysis plan"
     }
    },
    "additionalProperties": false,
    "required": [
     "revision",
     "text"
    ]
   },
   "ConversationProposal": {
    "type": "object",
    "properties": {
     "objective": {
      "type": "string"
     },
     "sourceIds": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "checks": {
      "type": "array",
      "items": {
       "type": "object",
       "properties": {
        "id": {
         "type": "string"
        },
        "version": {
         "type": "string"
        }
       },
       "additionalProperties": false,
       "required": [
        "id",
        "version"
       ]
      }
     },
     "mode": {
      "type": "string",
      "enum": [
       "individual",
       "combined"
      ]
     },
     "mutationPolicy": {
      "type": "string",
      "enum": [
       "read_only",
       "propose",
       "allow"
      ]
     },
     "toolBudget": {
      "type": "integer"
     },
     "tokenBudget": {
      "type": "integer"
     },
     "timeBudgetMs": {
      "type": "integer"
     }
    },
    "additionalProperties": false
   },
   "ConversationTurn": {
    "type": "object",
    "properties": {
     "runId": {
      "type": "string"
     },
     "state": {
      "type": "string"
     },
     "outcome": {
      "type": "string"
     },
     "reason": {
      "type": "string"
     },
     "agent": {
      "type": "string"
     },
     "delta": {
      "type": "string"
     }
    },
    "additionalProperties": false
   },
   "NewConversationTurn": {
    "type": "object",
    "properties": {
     "revision": {
      "type": "integer",
      "minimum": 0,
      "description": "Last observed conversation revision"
     },
     "text": {
      "type": "string",
      "minLength": 1,
      "maxLength": 8192,
      "description": "Nonempty UTF-8 text, at most 8192 bytes"
     },
     "sourceIds": {
      "type": "array",
      "items": {
       "type": "string"
      },
      "maxItems": 500,
      "uniqueItems": true
     },
     "planId": {
      "type": "string",
      "maxLength": 128,
      "description": "Optional immutable release analysis plan"
     },
     "agent": {
      "type": "string"
     },
     "tokenBudget": {
      "type": "integer",
      "minimum": 8192,
      "maximum": 100000000
     },
     "timeBudgetMs": {
      "type": "integer",
      "minimum": 1000,
      "maximum": 600000
     }
    },
    "additionalProperties": false,
    "required": [
     "revision",
     "text",
     "agent",
     "tokenBudget",
     "timeBudgetMs"
    ]
   },
   "ProjectJob": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string"
     },
     "kind": {
      "type": "string",
      "enum": [
       "run",
       "analysis"
      ]
     },
     "release_id": {
      "type": "string"
     },
     "title": {
      "type": "string"
     },
     "status": {
      "type": "string",
      "enum": [
       "running",
       "pending",
       "completed",
       "failed",
       "canceled"
      ]
     },
     "updated_at": {
      "type": "integer"
     }
    },
    "additionalProperties": false
   },
   "ProjectJobPage": {
    "type": "object",
    "properties": {
     "items": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/ProjectJob"
      }
     },
     "total": {
      "type": "integer"
     },
     "filtered_total": {
      "type": "integer"
     },
     "offset": {
      "type": "integer"
     },
     "limit": {
      "type": "integer"
     },
     "counts": {
      "type": "object",
      "additionalProperties": {
       "type": "integer"
      }
     }
    },
    "additionalProperties": false
   },
   "AnalysisEvidenceSelection": {
    "type": "object",
    "properties": {
     "run_id": {
      "type": "string"
     },
     "attempt_id": {
      "type": "string"
     },
     "artifact_id": {
      "type": "string"
     }
    },
    "additionalProperties": false,
    "required": [
     "run_id",
     "attempt_id"
    ]
   },
   "AnalysisEvidenceReference": {
    "type": "object",
    "properties": {
     "run_id": {
      "type": "string"
     },
     "attempt_id": {
      "type": "string"
     },
     "artifact_id": {
      "type": "string"
     },
     "kind": {
      "type": "string"
     },
     "state": {
      "type": "string"
     },
     "workspace_id": {
      "type": "string"
     },
     "mission_id": {
      "type": "string"
     },
     "agent_run_id": {
      "type": "string"
     },
     "artifact": {
      "type": "object",
      "description": "Immutable analysis artifact envelope including capture revision, generation, digest and coverage"
     },
     "sources": {
      "type": "array",
      "items": {
       "type": "object",
       "description": "Exact frozen release occurrence"
      }
     }
    },
    "additionalProperties": false
   },
   "ReleaseEvidenceUpdate": {
    "type": "object",
    "properties": {
     "template_id": {
      "type": "string"
     },
     "requirement_id": {
      "type": "string"
     },
     "action": {
      "type": "string",
      "enum": [
       "prepare",
       "submit",
       "accept",
       "reject"
      ]
     },
     "owner_id": {
      "type": "string"
     },
     "due_at": {
      "type": "integer"
     },
     "applicability": {
      "type": "string",
      "enum": [
       "applicable",
       "not_applicable"
      ]
     },
     "rationale": {
      "type": "string",
      "maxLength": 4096
     },
     "artifact_ids": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "analysis_refs": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/AnalysisEvidenceSelection"
      },
      "maxItems": 64
     },
     "expected_revision": {
      "type": "integer",
      "minimum": 0
     },
     "expected_scope_revision": {
      "type": "string"
     }
    },
    "additionalProperties": false,
    "required": [
     "template_id",
     "requirement_id",
     "action",
     "expected_revision"
    ]
   },
   "ReleaseEvidenceRecord": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string"
     },
     "project_id": {
      "type": "string"
     },
     "release_id": {
      "type": "string"
     },
     "template_id": {
      "type": "string"
     },
     "requirement_id": {
      "type": "string"
     },
     "owner_id": {
      "type": "string"
     },
     "due_at": {
      "type": "integer"
     },
     "applicability": {
      "type": "string"
     },
     "status": {
      "type": "string"
     },
     "recorded_status": {
      "type": "string"
     },
     "rationale": {
      "type": "string"
     },
     "artifact_ids": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "analysis_refs": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/AnalysisEvidenceReference"
      }
     },
     "revision": {
      "type": "integer"
     },
     "updated_by": {
      "type": "string"
     },
     "updated_at": {
      "type": "integer"
     },
     "accepted_scope_revision": {
      "type": "string"
     }
    },
    "additionalProperties": false
   },
   "ReleaseEvidenceView": {
    "type": "object",
    "properties": {
     "as_of": {
      "type": "integer"
     },
     "scope_revision": {
      "type": "string"
     },
     "evidence_revision": {
      "type": "string"
     },
     "revision_ids": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "template": {
      "type": "object"
     },
     "records": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/ReleaseEvidenceRecord"
      }
     },
     "events": {
      "type": "array",
      "items": {
       "type": "object"
      }
     },
     "exports": {
      "type": "array",
      "items": {
       "type": "object"
      }
     },
     "readiness": {
      "type": "object"
     },
     "interpretation": {
      "type": "string"
     }
    },
    "additionalProperties": false
   },
   "OnboardingStatus": {
    "type": "object",
    "required": [
     "nextStep"
    ],
    "properties": {
     "nextStep": {
      "type": "string",
      "enum": [
       "platform",
       "accept-invitation",
       "create-product",
       "await-product-access",
       "workspace"
      ]
     },
     "productId": {
      "type": "string"
     }
    }
   },
   "ProvisionConfig": {
    "type": "object",
    "properties": {
     "memberAccess": {
      "type": "string",
      "enum": [
       "",
       "role_based",
       "read_only"
      ],
      "description": "Empty only for incomplete drafts. Required as role_based or read_only when publishing. read_only grants company-wide saved reads plus product creation and firmware intake only. Draft changes do not affect access."
     }
    },
    "required": [
     "memberAccess"
    ]
   },
   "CompanyProvisions": {
    "type": "object",
    "properties": {
     "revision": {
      "type": "integer",
      "minimum": 1
     },
     "draft": {
      "$ref": "#/components/schemas/ProvisionConfig"
     },
     "published": {
      "$ref": "#/components/schemas/ProvisionConfig",
      "nullable": true
     },
     "reviewed": {
      "type": "boolean"
     }
    }
   },
   "CompanyOrganization": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
     "id": {
      "type": "string"
     },
     "name": {
      "type": "string"
     },
     "state": {
      "type": "string",
      "enum": [
       "provisioning",
       "active"
      ]
     },
     "revision": {
      "type": "integer",
      "minimum": 1
     },
     "provisionsReviewed": {
      "type": "boolean"
     },
     "memberAccess": {
      "type": "string",
      "enum": [
       "role_based",
       "read_only"
      ],
      "description": "Published access policy. Saved plan names do not determine permissions."
     },
     "code": {
      "type": "string",
      "minLength": 3,
      "maxLength": 63,
      "pattern": "^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$",
      "description": "Unique permanent company code. New tenant registrations reserve admin, api, app, www, and platform."
     }
    },
    "required": [
     "id",
     "name",
     "state",
     "revision",
     "provisionsReviewed",
     "code"
    ]
   },
   "CompanyIdentity": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
     "code": {
      "type": "string",
      "minLength": 3,
      "maxLength": 63,
      "pattern": "^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$",
      "description": "Unique permanent company code. New tenant registrations reserve admin, api, app, www, and platform."
     },
     "name": {
      "type": "string"
     }
    },
    "required": [
     "code",
     "name"
    ]
   },
   "WorkspaceContext": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
     "id": {
      "type": "string"
     },
     "code": {
      "type": "string",
      "minLength": 3,
      "maxLength": 63,
      "pattern": "^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$",
      "description": "Unique permanent company code. New tenant registrations reserve admin, api, app, www, and platform."
     },
     "name": {
      "type": "string"
     },
     "memberAccess": {
      "type": "string",
      "enum": [
       "role_based",
       "read_only"
      ]
     },
     "canCreateProducts": {
      "type": "boolean"
     },
     "canManageCompany": {
      "type": "boolean"
     }
    },
    "required": [
     "id",
     "code",
     "name",
     "memberAccess",
     "canCreateProducts",
     "canManageCompany"
    ]
   },
   "TenantDeployment": {
    "type": "object",
    "description": "Central deployment registration. Membership and resources remain in the tenant database. Verification records the installed configuration revision.",
    "required": [
     "id",
     "companyId",
     "code",
     "name",
     "origin",
     "adminUsername",
     "contactEmail",
     "state",
     "revision",
     "verifiedRevision"
    ],
    "properties": {
     "id": {
      "type": "string"
     },
     "companyId": {
      "type": "string"
     },
     "code": {
      "type": "string"
     },
     "name": {
      "type": "string"
     },
     "origin": {
      "type": "string",
      "format": "uri"
     },
     "adminUsername": {
      "type": "string"
     },
     "contactEmail": {
      "type": "string",
      "format": "email"
     },
     "state": {
      "type": "string",
      "enum": [
       "draft",
       "provisioning",
       "awaiting_activation",
       "active",
       "failed"
      ]
     },
     "revision": {
      "type": "integer",
      "minimum": 1
     },
     "verifiedRevision": {
      "type": "integer",
      "minimum": 0
     }
    }
   }
  }
 }
}
