/**
 * This file was auto-generated by openapi-typescript.
 * Do not make direct changes to the file.
 */

export interface paths {
  '/{apiVersion}/context/knowledge-bases': {
    parameters: {
      query?: never
      header?: never
      path?: never
      cookie?: never
    }
    /**
     * List knowledge bases
     * @description Returns the organization's knowledge bases visible to the caller, cursor-paginated.
     */
    get: operations['listKnowledgeBases']
    put?: never
    /**
     * Create a knowledge base
     * @description Creates a knowledge base bound to a Sanity dataset, where its content documents will be stored.
     */
    post: operations['createKnowledgeBase']
    delete?: never
    options?: never
    head?: never
    patch?: never
    trace?: never
  }
  '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}': {
    parameters: {
      query?: never
      header?: never
      path?: never
      cookie?: never
    }
    /**
     * Get a knowledge base
     * @description Returns the knowledge base object: metadata and state. Resolves from the id alone, the public id (`kb...`) or the uuid; access is decided against the knowledge base's own organization, and an id the caller cannot read returns 404. For the built content, use the outline or entries endpoints.
     */
    get: operations['getKnowledgeBase']
    put?: never
    post?: never
    /**
     * Delete a knowledge base
     * @description Removes the knowledge base and everything it owns: sources, imports, and revisions. Content documents in the bound dataset are deleted best-effort, and stored source files are reclaimed by a separate cleanup.
     */
    delete: operations['deleteKnowledgeBase']
    options?: never
    head?: never
    /**
     * Update a knowledge base
     * @description Edits the name and description, or the recurring refresh controls (`refreshEnabled`, `refreshFrequency`). Refresh fields return 422 for knowledge bases with no web or dataset source. Disabling pauses the schedule; manual refresh still works.
     */
    patch: operations['updateKnowledgeBase']
    trace?: never
  }
  '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/build': {
    parameters: {
      query?: never
      header?: never
      path?: never
      cookie?: never
    }
    get?: never
    put?: never
    /**
     * Trigger a knowledge base build
     * @description Queues a build over the current corpus and returns a job id right away. If a build is already running, you get that job instead of a second one.
     */
    post: operations['buildKnowledgeBase']
    delete?: never
    options?: never
    head?: never
    patch?: never
    trace?: never
  }
  '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/build/cancel': {
    parameters: {
      query?: never
      header?: never
      path?: never
      cookie?: never
    }
    get?: never
    put?: never
    /**
     * Cancel an in-progress build
     * @description Cancels the running build and resets the knowledge base so it can be rebuilt.
     */
    post: operations['cancelKnowledgeBaseBuild']
    delete?: never
    options?: never
    head?: never
    patch?: never
    trace?: never
  }
  '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/entries/{entryPath}/rebuild': {
    parameters: {
      query?: never
      header?: never
      path?: never
      cookie?: never
    }
    get?: never
    put?: never
    /**
     * Rebuild an entry from its sources
     * @description Queues a re-write of the entry at this path from its cited sources and the active instructions, and returns a job id right away. The response also names the other entries citing any of the same sources: a source-tied rule affects every page citing that source, so those may change too.
     */
    post: operations['rebuildEntry']
    delete?: never
    options?: never
    head?: never
    patch?: never
    trace?: never
  }
  '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/imports': {
    parameters: {
      query?: never
      header?: never
      path?: never
      cookie?: never
    }
    /**
     * List imports
     * @description Everything added to this knowledge base, one row per import: a file upload, web crawl, dataset bind, or inline text. Cursor-paginated. The sources each import produced live under `/sources`.
     */
    get: operations['listImports']
    put?: never
    /**
     * Create an import (text, crawl, or dataset)
     * @description Adds content, discriminated on `type`: `text` for inline content, `crawl` for a website, `dataset` for a GROQ-filtered Sanity dataset. Each variant queues processing and returns a job id to poll. For files, use `POST .../imports/uploads` instead. Re-adding an existing crawl url returns 409 `webSourceRootConflict`; exceeding the crawl root limit returns 409 `webSourceRootLimitExceeded`. Supports the `Idempotency-Key` header.
     */
    post: operations['createImport']
    delete?: never
    options?: never
    head?: never
    patch?: never
    trace?: never
  }
  '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/imports/uploads': {
    parameters: {
      query?: never
      header?: never
      path?: never
      cookie?: never
    }
    get?: never
    put?: never
    /**
     * Start a file-upload import
     * @description Creates a file-upload import and returns a single-use signed upload URL. PUT the file bytes to it, then call `POST .../imports/uploads/{importId}/complete` to start ingestion. The bytes never pass through this API. Supports the `Idempotency-Key` header.
     */
    post: operations['startUpload']
    delete?: never
    options?: never
    head?: never
    patch?: never
    trace?: never
  }
  '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/imports/uploads/{importId}/complete': {
    parameters: {
      query?: never
      header?: never
      path?: never
      cookie?: never
    }
    get?: never
    put?: never
    /**
     * Complete a file-upload import
     * @description Call after the file bytes are uploaded to the signed URL. Starts processing and returns a job id to poll.
     */
    post: operations['completeUpload']
    delete?: never
    options?: never
    head?: never
    patch?: never
    trace?: never
  }
  '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/imports/{importId}': {
    parameters: {
      query?: never
      header?: never
      path?: never
      cookie?: never
    }
    /**
     * Get a single import
     * @description Returns one import with its kind and processing status.
     */
    get: operations['getImport']
    put?: never
    post?: never
    /**
     * Delete an import
     * @description Removes the import and every source it produced, and cancels its ingest if one is still running. Use it to discard something added by mistake.
     */
    delete: operations['deleteImport']
    options?: never
    head?: never
    patch?: never
    trace?: never
  }
  '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/imports/{importId}/download': {
    parameters: {
      query?: never
      header?: never
      path?: never
      cookie?: never
    }
    /**
     * Get a download URL for an import
     * @description Mints a short-lived signed URL serving the import's original bytes as an attachment. Use it before `expiresAt`; the bytes never pass through this API. Only file and text imports carry original bytes; crawls and dataset binds return 409 `importInvalidState`.
     */
    get: operations['downloadImport']
    put?: never
    post?: never
    delete?: never
    options?: never
    head?: never
    patch?: never
    trace?: never
  }
  '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/instructions': {
    parameters: {
      query?: never
      header?: never
      path?: never
      cookie?: never
    }
    get?: never
    put?: never
    /**
     * Author a human instruction
     * @description Creates a standing rule that every future build honors. Tie it to one or more sources with `scopeSourceIds`, or leave it null to apply knowledge-base-wide. Pass `rebuildPaths` to immediately rebuild those entries under the new rule; the response carries the rebuild job id, or null when the rebuild could not start (the rule is saved either way). Pass `verified` after a completed synchronous contradiction check to skip the background one; if the requested rebuild fails to start, the background check runs anyway so the contradicting pages get filed as issues.
     */
    post: operations['createInstruction']
    delete?: never
    options?: never
    head?: never
    patch?: never
    trace?: never
  }
  '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/instructions/{instructionId}': {
    parameters: {
      query?: never
      header?: never
      path?: never
      cookie?: never
    }
    get?: never
    put?: never
    post?: never
    /**
     * Delete an instruction
     * @description Deletes the rule. Builds stop honoring it from the next run.
     */
    delete: operations['deleteInstruction']
    options?: never
    head?: never
    /**
     * Edit an instruction
     * @description Edits the statement or scope. The change applies from the next build. Any edit re-affirms the rule: an archived rule returns to active, re-anchored to the sources' current content.
     */
    patch: operations['updateInstruction']
    trace?: never
  }
  '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/issues/apply': {
    parameters: {
      query?: never
      header?: never
      path?: never
      cookie?: never
    }
    get?: never
    put?: never
    /**
     * Apply accepted issues to a Context
     * @description Queues a job that applies accepted issues, rewrites the affected entries, and commits a new revision. Returns a job id. Issue ids that no longer exist are skipped.
     */
    post: operations['applyIssues']
    delete?: never
    options?: never
    head?: never
    patch?: never
    trace?: never
  }
  '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/issues/{issueId}/dismiss': {
    parameters: {
      query?: never
      header?: never
      path?: never
      cookie?: never
    }
    get?: never
    put?: never
    /**
     * Dismiss an issue
     * @description Marks the issue rejected. Idempotent: dismissing an issue that already left the queue returns it as-is. 422 `issueDocumentInvalid` when the document was hand-edited into an unverifiable shape; 409 `issueTransitionConflict` on a concurrent edit, safe to retry.
     */
    post: operations['dismissIssue']
    delete?: never
    options?: never
    head?: never
    patch?: never
    trace?: never
  }
  '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/issues/{issueId}/reopen': {
    parameters: {
      query?: never
      header?: never
      path?: never
      cookie?: never
    }
    get?: never
    put?: never
    /**
     * Reopen an accepted conflict
     * @description Returns an accepted conflict to triage, clearing its resolution and deleting the instruction it minted. Idempotent for issues that are not accepted conflicts.
     */
    post: operations['reopenIssue']
    delete?: never
    options?: never
    head?: never
    patch?: never
    trace?: never
  }
  '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/issues/{issueId}/resolve': {
    parameters: {
      query?: never
      header?: never
      path?: never
      cookie?: never
    }
    get?: never
    put?: never
    /**
     * Resolve a conflict issue
     * @description Settles a conflict with one of two choices: `keep_existing` or `accept_new` (rewrites the entry; the returned `jobId` tracks it). Only conflict issues are resolvable, and a dismissed issue must be reopened first. The decision becomes a standing instruction for every future build; `resolvedBy` records who decided.
     */
    post: operations['resolveIssue']
    delete?: never
    options?: never
    head?: never
    patch?: never
    trace?: never
  }
  '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/jobs/{jobId}': {
    parameters: {
      query?: never
      header?: never
      path?: never
      cookie?: never
    }
    /**
     * Get a job by id
     * @description Returns the status of a job, such as a build or an import. Job ids come from the endpoint that queued the work.
     */
    get: operations['getJob']
    put?: never
    post?: never
    delete?: never
    options?: never
    head?: never
    patch?: never
    trace?: never
  }
  '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/refresh': {
    parameters: {
      query?: never
      header?: never
      path?: never
      cookie?: never
    }
    get?: never
    put?: never
    /**
     * Trigger an incremental refresh
     * @description Queues a refresh: recrawls each web source, diffs the corpus against the last build, and files change issues. Returns a job id, with `started: false` when a refresh was already in flight. Supports the `Idempotency-Key` header.
     */
    post: operations['refreshKnowledgeBase']
    delete?: never
    options?: never
    head?: never
    patch?: never
    trace?: never
  }
  '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/sources': {
    parameters: {
      query?: never
      header?: never
      path?: never
      cookie?: never
    }
    /**
     * List sources
     * @description The distilled units builds cite: the pages, files, and documents your imports expanded into. Read-only; add content via `/imports`. Cursor-paginated, filter by `status`.
     */
    get: operations['listSources']
    put?: never
    post?: never
    delete?: never
    options?: never
    head?: never
    patch?: never
    trace?: never
  }
  '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/sources/{sourceId}': {
    parameters: {
      query?: never
      header?: never
      path?: never
      cookie?: never
    }
    /**
     * Get a single source
     * @description Returns one source with its metadata and processing status.
     */
    get: operations['getSource']
    put?: never
    post?: never
    /**
     * Delete a source
     * @description Removes the source immediately. Entries are not modified here — citations to it are cleaned up by the next build or check for changes, where entries left without sources become removal proposals. Human-edited entries are never modified.
     */
    delete: operations['deleteSource']
    options?: never
    head?: never
    patch?: never
    trace?: never
  }
  '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/sources/{sourceId}/content': {
    parameters: {
      query?: never
      header?: never
      path?: never
      cookie?: never
    }
    /**
     * Read a source's distilled content
     * @description The distilled markdown builds cite, the same text the pipeline itself reads. Use it to verify an issue's claims against the sources its `citedSourceIds` name. Optional `startLine` and `endLine` (1-indexed, inclusive) fetch just a span. JSON by default; `?format=markdown` returns the raw text. 409 `sourceNotDistilled` until distillation has produced content.
     */
    get: operations['getSourceContent']
    put?: never
    post?: never
    delete?: never
    options?: never
    head?: never
    patch?: never
    trace?: never
  }
  '/{apiVersion}/context/organizations/{organizationId}/conversations/{threadId}': {
    parameters: {
      query?: never
      header?: never
      path?: never
      cookie?: never
    }
    get?: never
    /**
     * Record a conversation
     * @description Upserts the conversation telemetry for one thread. `threadId` identifies the conversation within your organization — reuse means the same conversation. Messages replace the stored transcript wholesale; `metadata` and model fields only overwrite when present. Last write per thread wins — retries are safe.
     */
    put: operations['saveConversation']
    post?: never
    delete?: never
    options?: never
    head?: never
    /**
     * Record a classification verdict
     * @description Records the classification your own model produced for one thread: exactly one of `coreMetrics` (a verdict — the server stamps `classifiedAt` and clears any recorded failure) or `classificationError` (why classification failed; an earlier verdict stays untouched). No revision guard — like the ingest upsert the writer is an automated classifier, so last write wins and a re-classification simply overwrites.
     */
    patch: operations['classifyConversation']
    trace?: never
  }
}
export type webhooks = Record<string, never>
export interface components {
  schemas: {
    /** @description A `sanity.context.conversation` document, one agent conversation transcript with its classification, stored in the organization store. Not returned by any endpoint raw; published so GROQ reads can be typed. Write through the conversation ingest and classify endpoints, never with a raw client. */
    ConversationDoc: {
      _id: string
      _rev: string
      /** Format: date-time */
      _createdAt: string
      /** Format: date-time */
      _updatedAt: string
      /** @enum {string} */
      _type: 'sanity.context.conversation'
      /** @enum {number} */
      schemaVersion: 1
      organizationId: string
      threadId: string
      /** @description ConversationMetadata */
      metadata: {
        [key: string]: string | string[]
      } | null
      /** Format: date-time */
      startedAt: string
      /** Format: date-time */
      messagesUpdatedAt: string
      messages: {
        /** @enum {string} */
        role: 'user' | 'assistant' | 'system' | 'tool'
        /** @default null */
        content: string | null
        /** @default null */
        toolName: string | null
        /**
         * @default null
         * @enum {string|null}
         */
        toolType: 'call' | 'result' | null
      }[]
      modelProvider: string | null
      modelId: string | null
      /** @description ConversationTokenUsage */
      tokenUsage: {
        inputTokens?: number
        outputTokens?: number
        totalTokens?: number
      } | null
      /** @description ConversationCoreMetrics */
      coreMetrics: {
        successScore?: number
        /** @enum {string} */
        sentiment?: 'positive' | 'neutral' | 'negative'
        contentGaps?: string[]
      } | null
      /** Format: date-time */
      classifiedAt: string | null
      classificationError: string | null
    }
    /** @description A `sanity.context.entry` document, one outline node stored in the bound dataset. Not returned by any endpoint; published so GROQ reads against the dataset can be typed. The entries endpoints serve the validated wire view. */
    EntryDoc: {
      _id: string
      _rev: string
      /** Format: date-time */
      _createdAt: string
      /** Format: date-time */
      _updatedAt: string
      knowledgeBaseId: string
      /** @enum {string} */
      _type: 'sanity.context.entry'
      schemaVersion: number
      revisionId: string
      path: string
      title: string
      tldr?: {
        scope: string
        excludes: string
        neighbors?: string[]
        /** @enum {string} */
        centrality: 'core' | 'standard' | 'peripheral'
      }
      body?: string
      topicHeadings?: string[]
      citations?: {
        sourceId: string
        supports?: string
        spans?: {
          sourceLineStart: number
          sourceLineEnd: number
          quote: string
        }[]
        claim?: {
          exact: string
          prefix?: string
          suffix?: string
        }
        /** @enum {string} */
        groundingState?: 'drifted'
        _key: string
        /** @enum {string} */
        _type: 'sanity.context.citation'
        filename: string
        mime?: string
        excerpt?: string
      }[]
      /** @enum {string} */
      status: 'virtual' | 'outlined' | 'filled' | 'stale' | 'generation_failed'
      generatedAt: string
    }
    /** @description A `sanity.context.instruction` document, a standing decision steering every build, stored in the bound dataset. Not returned by any endpoint; published so GROQ reads against the dataset can be typed. Write through the instructions endpoints, never with a raw client. */
    InstructionDoc:
      | {
          _id: string
          _rev: string
          /** Format: date-time */
          _createdAt: string
          /** Format: date-time */
          _updatedAt: string
          knowledgeBaseId: string
          /** @enum {string} */
          _type: 'sanity.context.instruction'
          /** @enum {number} */
          schemaVersion: 1
          statement: string
          scopeSources:
            | {
                _key: string
                sourceId: string
                contentHash: string
              }[]
            | null
          /** @enum {string} */
          status: 'active' | 'archived'
          archivedAt: string | null
          archivedReason: string | null
          /** @enum {string} */
          origin: 'conflict'
          sourceIssueId: string
        }
      | {
          _id: string
          _rev: string
          /** Format: date-time */
          _createdAt: string
          /** Format: date-time */
          _updatedAt: string
          knowledgeBaseId: string
          /** @enum {string} */
          _type: 'sanity.context.instruction'
          /** @enum {number} */
          schemaVersion: 1
          statement: string
          scopeSources:
            | {
                _key: string
                sourceId: string
                contentHash: string
              }[]
            | null
          /** @enum {string} */
          status: 'active' | 'archived'
          archivedAt: string | null
          archivedReason: string | null
          /** @enum {string} */
          origin: 'human'
          /** @enum {string|null} */
          sourceIssueId: null
        }
    /** @description A `sanity.context.issue` document, a build finding awaiting triage, stored in the bound dataset. Not returned by any endpoint; published so GROQ reads and trigger filters can be typed. Status transitions flow through the issues endpoints, which own the state machine. One invariant the schema cannot express: only a `conflict` issue ever carries a non-null `resolution`. */
    IssueDoc:
      | {
          _id: string
          _rev: string
          /** Format: date-time */
          _createdAt: string
          /** Format: date-time */
          _updatedAt: string
          knowledgeBaseId: string
          /** @enum {string} */
          _type: 'sanity.context.issue'
          /** @enum {number} */
          schemaVersion: 1
          /** @description IssueContent */
          content: {
            /** @enum {string} */
            kind:
              | 'conflict'
              | 'gap'
              | 'update_required'
              | 'add_entry'
              | 'remove_entry'
              | 'split_entry'
              | 'merge_entry'
            /** @enum {string} */
            severity: 'critical' | 'suggestion'
            scopePath: string
            issue: string
            suggestedFix: string
            citedSourceIds?: string[]
            claimKey?: string
            involvedScopes?: string[]
            currentClaim?: string
            alternativeClaim?: string
            /** @enum {string} */
            currentAuthority?: 'primary' | 'secondary' | 'community'
            /** @enum {string} */
            alternativeAuthority?: 'primary' | 'secondary' | 'community'
            /** @enum {string} */
            suggestedResolution?: 'keep_existing' | 'accept_new'
          }
          fingerprint: string
          revisionId: string | null
          /** @enum {string} */
          status: 'open'
          /** @enum {string|null} */
          resolution: null
          /** @enum {string|null} */
          resolvedAt: null
          /** @enum {string|null} */
          resolvedBy: null
        }
      | {
          _id: string
          _rev: string
          /** Format: date-time */
          _createdAt: string
          /** Format: date-time */
          _updatedAt: string
          knowledgeBaseId: string
          /** @enum {string} */
          _type: 'sanity.context.issue'
          /** @enum {number} */
          schemaVersion: 1
          /** @description IssueContent */
          content: {
            /** @enum {string} */
            kind:
              | 'conflict'
              | 'gap'
              | 'update_required'
              | 'add_entry'
              | 'remove_entry'
              | 'split_entry'
              | 'merge_entry'
            /** @enum {string} */
            severity: 'critical' | 'suggestion'
            scopePath: string
            issue: string
            suggestedFix: string
            citedSourceIds?: string[]
            claimKey?: string
            involvedScopes?: string[]
            currentClaim?: string
            alternativeClaim?: string
            /** @enum {string} */
            currentAuthority?: 'primary' | 'secondary' | 'community'
            /** @enum {string} */
            alternativeAuthority?: 'primary' | 'secondary' | 'community'
            /** @enum {string} */
            suggestedResolution?: 'keep_existing' | 'accept_new'
          }
          fingerprint: string
          revisionId: string | null
          /** @enum {string} */
          status: 'accepted'
          /** Format: date-time */
          resolvedAt: string
          resolvedBy: {
            id: string
            /** @enum {string} */
            kind: 'user' | 'robot'
          } | null
          /** @enum {string|null} */
          resolution: 'keep_existing' | 'accept_new' | null
        }
      | {
          _id: string
          _rev: string
          /** Format: date-time */
          _createdAt: string
          /** Format: date-time */
          _updatedAt: string
          knowledgeBaseId: string
          /** @enum {string} */
          _type: 'sanity.context.issue'
          /** @enum {number} */
          schemaVersion: 1
          /** @description IssueContent */
          content: {
            /** @enum {string} */
            kind:
              | 'conflict'
              | 'gap'
              | 'update_required'
              | 'add_entry'
              | 'remove_entry'
              | 'split_entry'
              | 'merge_entry'
            /** @enum {string} */
            severity: 'critical' | 'suggestion'
            scopePath: string
            issue: string
            suggestedFix: string
            citedSourceIds?: string[]
            claimKey?: string
            involvedScopes?: string[]
            currentClaim?: string
            alternativeClaim?: string
            /** @enum {string} */
            currentAuthority?: 'primary' | 'secondary' | 'community'
            /** @enum {string} */
            alternativeAuthority?: 'primary' | 'secondary' | 'community'
            /** @enum {string} */
            suggestedResolution?: 'keep_existing' | 'accept_new'
          }
          fingerprint: string
          revisionId: string | null
          /** @enum {string} */
          status: 'rejected'
          /** Format: date-time */
          resolvedAt: string
          resolvedBy: {
            id: string
            /** @enum {string} */
            kind: 'user' | 'robot'
          } | null
          /** @enum {string|null} */
          resolution: null
        }
    /** @description A `sanity.context.mcp` document, an org-owned MCP endpoint configuration stored in the organization store. Not returned by any endpoint raw; published so GROQ reads and trigger filters can be typed. Write through the mcp endpoints, never with a raw client. The mcp endpoints serve the validated wire view. */
    McpDoc: {
      _id: string
      _rev: string
      /** Format: date-time */
      _createdAt: string
      /** Format: date-time */
      _updatedAt: string
      /** @enum {string} */
      _type: 'sanity.context.mcp'
      /** @enum {number} */
      schemaVersion: 1
      organizationId: string
      publicId: string
      title: string
      name: string
      sources: (
        | {
            /** @enum {string} */
            type: 'knowledge-base'
            id: string
          }
        | {
            /** @enum {string} */
            type: 'dataset'
            id: string
          }
      )[]
      instructions: string | null
      groqFilter: string | null
    }
  }
  responses: never
  parameters: never
  requestBodies: never
  headers: never
  pathItems: never
}
export type $defs = Record<string, never>
export interface operations {
  listKnowledgeBases: {
    parameters: {
      query: {
        cursor?: string
        limit?: number
        organizationId: string
      }
      header?: never
      path: {
        apiVersion: string
      }
      cookie?: never
    }
    requestBody?: never
    responses: {
      /** @description Default Response */
      200: {
        headers: {
          [name: string]: unknown
        }
        content: {
          'application/json': {
            data: {
              /** Format: uuid */
              id: string
              publicId: string
              organizationId: string
              title: string
              description: string
              /** @enum {string} */
              state: 'created' | 'building' | 'ready' | 'review' | 'stale' | 'paused'
              activeJobId: string | null
              isBuilding: boolean
              buildStageState: {
                jobId: string
                stages: {
                  /** @enum {string} */
                  id:
                    | 'tldr'
                    | 'map'
                    | 'triage'
                    | 'plan'
                    | 'organize'
                    | 'arrange'
                    | 'write'
                    | 'review'
                    | 'polish'
                  /** @enum {string} */
                  status: 'pending' | 'running' | 'done' | 'failed'
                  units?: {
                    /** @enum {string} */
                    unit: 'sources' | 'groups' | 'entries' | 'rounds'
                    done: number
                    total?: number
                  }
                }[]
              } | null
              /** Format: date-time */
              lastCheckedAt: string | null
              /** Format: date-time */
              lastChangedAt: string | null
              hasPendingChanges: boolean
              pendingChanges: {
                added: number
                changed: number
                removed: number
              } | null
              pipelineOutdated: boolean
              rebuildRecommended: {
                reason: string
                /** Format: date-time */
                at: string
              } | null
              hasWebSource: boolean
              hasDatasetSource: boolean
              sourceUsage: {
                used: number
                limit: number
              } | null
              refreshEnabled: boolean
              /** @enum {string} */
              refreshFrequency: 'weekly' | 'monthly'
              /** Format: date-time */
              refreshNextRunAt: string | null
              refreshInFlight: boolean
              openIssueCount: number
              instructionCount: number
              /** Format: date-time */
              createdAt: string
              /** Format: date-time */
              updatedAt: string
            }[]
            nextCursor: string | null
          }
        }
      }
    }
  }
  createKnowledgeBase: {
    parameters: {
      query?: never
      header?: never
      path: {
        apiVersion: string
      }
      cookie?: never
    }
    requestBody: {
      content: {
        'application/json': {
          organizationId: string
          title: string
          description: string
        }
      }
    }
    responses: {
      /** @description KnowledgeBase */
      201: {
        headers: {
          [name: string]: unknown
        }
        content: {
          'application/json': {
            /** Format: uuid */
            id: string
            publicId: string
            organizationId: string
            title: string
            description: string
            /** @enum {string} */
            state: 'created' | 'building' | 'ready' | 'review' | 'stale' | 'paused'
            activeJobId: string | null
            isBuilding: boolean
            buildStageState: {
              jobId: string
              stages: {
                /** @enum {string} */
                id:
                  | 'tldr'
                  | 'map'
                  | 'triage'
                  | 'plan'
                  | 'organize'
                  | 'arrange'
                  | 'write'
                  | 'review'
                  | 'polish'
                /** @enum {string} */
                status: 'pending' | 'running' | 'done' | 'failed'
                units?: {
                  /** @enum {string} */
                  unit: 'sources' | 'groups' | 'entries' | 'rounds'
                  done: number
                  total?: number
                }
              }[]
            } | null
            /** Format: date-time */
            lastCheckedAt: string | null
            /** Format: date-time */
            lastChangedAt: string | null
            hasPendingChanges: boolean
            pendingChanges: {
              added: number
              changed: number
              removed: number
            } | null
            pipelineOutdated: boolean
            rebuildRecommended: {
              reason: string
              /** Format: date-time */
              at: string
            } | null
            hasWebSource: boolean
            hasDatasetSource: boolean
            sourceUsage: {
              used: number
              limit: number
            } | null
            refreshEnabled: boolean
            /** @enum {string} */
            refreshFrequency: 'weekly' | 'monthly'
            /** Format: date-time */
            refreshNextRunAt: string | null
            refreshInFlight: boolean
            openIssueCount: number
            instructionCount: number
            /** Format: date-time */
            createdAt: string
            /** Format: date-time */
            updatedAt: string
          }
        }
      }
    }
  }
  getKnowledgeBase: {
    parameters: {
      query?: never
      header?: never
      path: {
        knowledgeBaseId: string
      }
      cookie?: never
    }
    requestBody?: never
    responses: {
      /** @description KnowledgeBase */
      200: {
        headers: {
          [name: string]: unknown
        }
        content: {
          'application/json': {
            /** Format: uuid */
            id: string
            publicId: string
            organizationId: string
            title: string
            description: string
            /** @enum {string} */
            state: 'created' | 'building' | 'ready' | 'review' | 'stale' | 'paused'
            activeJobId: string | null
            isBuilding: boolean
            buildStageState: {
              jobId: string
              stages: {
                /** @enum {string} */
                id:
                  | 'tldr'
                  | 'map'
                  | 'triage'
                  | 'plan'
                  | 'organize'
                  | 'arrange'
                  | 'write'
                  | 'review'
                  | 'polish'
                /** @enum {string} */
                status: 'pending' | 'running' | 'done' | 'failed'
                units?: {
                  /** @enum {string} */
                  unit: 'sources' | 'groups' | 'entries' | 'rounds'
                  done: number
                  total?: number
                }
              }[]
            } | null
            /** Format: date-time */
            lastCheckedAt: string | null
            /** Format: date-time */
            lastChangedAt: string | null
            hasPendingChanges: boolean
            pendingChanges: {
              added: number
              changed: number
              removed: number
            } | null
            pipelineOutdated: boolean
            rebuildRecommended: {
              reason: string
              /** Format: date-time */
              at: string
            } | null
            hasWebSource: boolean
            hasDatasetSource: boolean
            sourceUsage: {
              used: number
              limit: number
            } | null
            refreshEnabled: boolean
            /** @enum {string} */
            refreshFrequency: 'weekly' | 'monthly'
            /** Format: date-time */
            refreshNextRunAt: string | null
            refreshInFlight: boolean
            openIssueCount: number
            instructionCount: number
            /** Format: date-time */
            createdAt: string
            /** Format: date-time */
            updatedAt: string
          }
        }
      }
    }
  }
  deleteKnowledgeBase: {
    parameters: {
      query?: never
      header?: never
      path: {
        knowledgeBaseId: string
      }
      cookie?: never
    }
    requestBody?: never
    responses: {
      /** @description Default Response */
      204: {
        headers: {
          [name: string]: unknown
        }
        content: {
          'application/json': null
        }
      }
    }
  }
  updateKnowledgeBase: {
    parameters: {
      query?: never
      header?: never
      path: {
        knowledgeBaseId: string
      }
      cookie?: never
    }
    requestBody: {
      content: {
        'application/json': {
          title?: string
          description?: string
          refreshEnabled?: boolean
          /** @enum {string} */
          refreshFrequency?: 'weekly' | 'monthly'
        }
      }
    }
    responses: {
      /** @description KnowledgeBase */
      200: {
        headers: {
          [name: string]: unknown
        }
        content: {
          'application/json': {
            /** Format: uuid */
            id: string
            publicId: string
            organizationId: string
            title: string
            description: string
            /** @enum {string} */
            state: 'created' | 'building' | 'ready' | 'review' | 'stale' | 'paused'
            activeJobId: string | null
            isBuilding: boolean
            buildStageState: {
              jobId: string
              stages: {
                /** @enum {string} */
                id:
                  | 'tldr'
                  | 'map'
                  | 'triage'
                  | 'plan'
                  | 'organize'
                  | 'arrange'
                  | 'write'
                  | 'review'
                  | 'polish'
                /** @enum {string} */
                status: 'pending' | 'running' | 'done' | 'failed'
                units?: {
                  /** @enum {string} */
                  unit: 'sources' | 'groups' | 'entries' | 'rounds'
                  done: number
                  total?: number
                }
              }[]
            } | null
            /** Format: date-time */
            lastCheckedAt: string | null
            /** Format: date-time */
            lastChangedAt: string | null
            hasPendingChanges: boolean
            pendingChanges: {
              added: number
              changed: number
              removed: number
            } | null
            pipelineOutdated: boolean
            rebuildRecommended: {
              reason: string
              /** Format: date-time */
              at: string
            } | null
            hasWebSource: boolean
            hasDatasetSource: boolean
            sourceUsage: {
              used: number
              limit: number
            } | null
            refreshEnabled: boolean
            /** @enum {string} */
            refreshFrequency: 'weekly' | 'monthly'
            /** Format: date-time */
            refreshNextRunAt: string | null
            refreshInFlight: boolean
            openIssueCount: number
            instructionCount: number
            /** Format: date-time */
            createdAt: string
            /** Format: date-time */
            updatedAt: string
          }
        }
      }
    }
  }
  buildKnowledgeBase: {
    parameters: {
      query?: never
      header?: never
      path: {
        knowledgeBaseId: string
      }
      cookie?: never
    }
    requestBody?: never
    responses: {
      /** @description JobAccepted */
      202: {
        headers: {
          [name: string]: unknown
        }
        content: {
          'application/json': {
            jobId: string
          }
        }
      }
    }
  }
  cancelKnowledgeBaseBuild: {
    parameters: {
      query?: never
      header?: never
      path: {
        knowledgeBaseId: string
      }
      cookie?: never
    }
    requestBody?: never
    responses: {
      /** @description Default Response */
      200: {
        headers: {
          [name: string]: unknown
        }
        content: {
          'application/json': {
            cancelled: boolean
          }
        }
      }
    }
  }
  rebuildEntry: {
    parameters: {
      query?: never
      header?: never
      path: {
        knowledgeBaseId: string
        entryPath: string
      }
      cookie?: never
    }
    requestBody?: never
    responses: {
      /** @description RebuildEntryResponse */
      202: {
        headers: {
          [name: string]: unknown
        }
        content: {
          'application/json': {
            jobId: string
            affectedEntries: {
              id: string
              path: string
              title: string
            }[]
          }
        }
      }
    }
  }
  listImports: {
    parameters: {
      query?: {
        cursor?: string
        limit?: number
      }
      header?: never
      path: {
        knowledgeBaseId: string
      }
      cookie?: never
    }
    requestBody?: never
    responses: {
      /** @description Default Response */
      200: {
        headers: {
          [name: string]: unknown
        }
        content: {
          'application/json': {
            data: {
              /** Format: uuid */
              id: string
              /** Format: uuid */
              knowledgeBaseId: string
              name: string | null
              sizeBytes: number | null
              /** @enum {string} */
              status: 'uploading' | 'processing' | 'complete' | 'failed'
              /** @enum {string} */
              sourceKind: 'web' | 'file' | 'dataset'
              /** Format: date-time */
              lastCheckedAt: string | null
              sourceCount: number
              totalDistillableCount: number
              distilledCount: number
              unsupportedCount: number
              statusDetail: string | null
              error: string | null
              /** @description CrawlOptions */
              crawlOptions: {
                includePaths?: string[]
                excludePaths?: string[]
                maxDepth?: number
                sitemapOnly?: boolean
                ignoreQueryParameters?: boolean
                pageLimit?: number
              } | null
              /** @description DatasetSourceBinding */
              datasetSource: {
                sanityProjectId: string
                sanityDatasetId: string
                query: string
              } | null
              /** @description Actor */
              createdBy: {
                id: string | null
                displayName: string | null
              } | null
              /** Format: date-time */
              createdAt: string
              /** Format: date-time */
              completedAt: string | null
            }[]
            nextCursor: string | null
          }
        }
      }
    }
  }
  createImport: {
    parameters: {
      query?: never
      header?: never
      path: {
        knowledgeBaseId: string
      }
      cookie?: never
    }
    /** @description CreateImportInput */
    requestBody: {
      content: {
        'application/json':
          | {
              /** @enum {string} */
              type: 'text'
              title: string
              content: string
              /**
               * @default text/markdown
               * @enum {string}
               */
              contentType?: 'text/markdown' | 'text/plain'
            }
          | {
              /** Format: uri */
              url: string
              /** @description CrawlOptions */
              options?: {
                includePaths?: string[]
                excludePaths?: string[]
                maxDepth?: number
                sitemapOnly?: boolean
                ignoreQueryParameters?: boolean
                pageLimit?: number
              }
              /** @enum {string} */
              type: 'crawl'
            }
          | {
              sanityProjectId: string
              sanityDatasetId: string
              query: string
              /** @enum {string} */
              type: 'dataset'
            }
      }
    }
    responses: {
      /** @description JobAccepted */
      202: {
        headers: {
          [name: string]: unknown
        }
        content: {
          'application/json': {
            jobId: string
          }
        }
      }
    }
  }
  startUpload: {
    parameters: {
      query?: never
      header?: never
      path: {
        knowledgeBaseId: string
      }
      cookie?: never
    }
    requestBody: {
      content: {
        'application/json': {
          filename: string
          contentType?: string
        }
      }
    }
    responses: {
      /** @description Default Response */
      201: {
        headers: {
          [name: string]: unknown
        }
        content: {
          'application/json': {
            /** Format: uuid */
            importId: string
            /** Format: uri */
            uploadUrl: string
          }
        }
      }
    }
  }
  completeUpload: {
    parameters: {
      query?: never
      header?: never
      path: {
        knowledgeBaseId: string
        importId: string
      }
      cookie?: never
    }
    requestBody?: never
    responses: {
      /** @description JobAccepted */
      202: {
        headers: {
          [name: string]: unknown
        }
        content: {
          'application/json': {
            jobId: string
          }
        }
      }
    }
  }
  getImport: {
    parameters: {
      query?: never
      header?: never
      path: {
        knowledgeBaseId: string
        importId: string
      }
      cookie?: never
    }
    requestBody?: never
    responses: {
      /** @description Import */
      200: {
        headers: {
          [name: string]: unknown
        }
        content: {
          'application/json': {
            /** Format: uuid */
            id: string
            /** Format: uuid */
            knowledgeBaseId: string
            name: string | null
            sizeBytes: number | null
            /** @enum {string} */
            status: 'uploading' | 'processing' | 'complete' | 'failed'
            /** @enum {string} */
            sourceKind: 'web' | 'file' | 'dataset'
            /** Format: date-time */
            lastCheckedAt: string | null
            sourceCount: number
            totalDistillableCount: number
            distilledCount: number
            unsupportedCount: number
            statusDetail: string | null
            error: string | null
            /** @description CrawlOptions */
            crawlOptions: {
              includePaths?: string[]
              excludePaths?: string[]
              maxDepth?: number
              sitemapOnly?: boolean
              ignoreQueryParameters?: boolean
              pageLimit?: number
            } | null
            /** @description DatasetSourceBinding */
            datasetSource: {
              sanityProjectId: string
              sanityDatasetId: string
              query: string
            } | null
            /** @description Actor */
            createdBy: {
              id: string | null
              displayName: string | null
            } | null
            /** Format: date-time */
            createdAt: string
            /** Format: date-time */
            completedAt: string | null
          }
        }
      }
    }
  }
  deleteImport: {
    parameters: {
      query?: never
      header?: never
      path: {
        knowledgeBaseId: string
        importId: string
      }
      cookie?: never
    }
    requestBody?: never
    responses: {
      /** @description Default Response */
      204: {
        headers: {
          [name: string]: unknown
        }
        content: {
          'application/json': null
        }
      }
    }
  }
  downloadImport: {
    parameters: {
      query?: never
      header?: never
      path: {
        knowledgeBaseId: string
        importId: string
      }
      cookie?: never
    }
    requestBody?: never
    responses: {
      /** @description Default Response */
      200: {
        headers: {
          [name: string]: unknown
        }
        content: {
          'application/json': {
            /** Format: uri */
            url: string
            /** Format: date-time */
            expiresAt: string
          }
        }
      }
    }
  }
  createInstruction: {
    parameters: {
      query?: never
      header?: never
      path: {
        knowledgeBaseId: string
      }
      cookie?: never
    }
    /** @description CreateInstructionInput */
    requestBody: {
      content: {
        'application/json': {
          statement: string
          scopeSourceIds?: string[] | null
          rebuildPaths?: string[]
          verified?: boolean
        }
      }
    }
    responses: {
      /** @description CreateInstructionResponse */
      201: {
        headers: {
          [name: string]: unknown
        }
        content: {
          'application/json': {
            /** @description Instruction */
            instruction: {
              id: string
              knowledgeBaseId: string
              /** @enum {string} */
              origin: 'conflict' | 'human'
              /** @enum {string} */
              status: 'active' | 'archived'
              statement: string
              scopeSourceIds: string[] | null
              /** Format: date-time */
              archivedAt: string | null
              archivedReason: string | null
              sourceIssueId: string | null
              /** @description Actor */
              createdBy: {
                id: string | null
                displayName: string | null
              } | null
              /** @description Actor */
              updatedBy: {
                id: string | null
                displayName: string | null
              } | null
              /** Format: date-time */
              createdAt: string
              /** Format: date-time */
              updatedAt: string | null
            }
            rebuildJobId: string | null
          }
        }
      }
    }
  }
  deleteInstruction: {
    parameters: {
      query?: never
      header?: never
      path: {
        knowledgeBaseId: string
        instructionId: string
      }
      cookie?: never
    }
    requestBody?: never
    responses: {
      /** @description Default Response */
      204: {
        headers: {
          [name: string]: unknown
        }
        content: {
          'application/json': null
        }
      }
    }
  }
  updateInstruction: {
    parameters: {
      query?: never
      header?: never
      path: {
        knowledgeBaseId: string
        instructionId: string
      }
      cookie?: never
    }
    /** @description UpdateInstructionInput */
    requestBody: {
      content: {
        'application/json': {
          statement?: string
          scopeSourceIds?: string[] | null
        }
      }
    }
    responses: {
      /** @description Instruction */
      200: {
        headers: {
          [name: string]: unknown
        }
        content: {
          'application/json': {
            id: string
            knowledgeBaseId: string
            /** @enum {string} */
            origin: 'conflict' | 'human'
            /** @enum {string} */
            status: 'active' | 'archived'
            statement: string
            scopeSourceIds: string[] | null
            /** Format: date-time */
            archivedAt: string | null
            archivedReason: string | null
            sourceIssueId: string | null
            /** @description Actor */
            createdBy: {
              id: string | null
              displayName: string | null
            } | null
            /** @description Actor */
            updatedBy: {
              id: string | null
              displayName: string | null
            } | null
            /** Format: date-time */
            createdAt: string
            /** Format: date-time */
            updatedAt: string | null
          }
        }
      }
    }
  }
  applyIssues: {
    parameters: {
      query?: never
      header?: never
      path: {
        knowledgeBaseId: string
      }
      cookie?: never
    }
    requestBody: {
      content: {
        'application/json': {
          issueIds: string[]
        }
      }
    }
    responses: {
      /** @description JobAccepted */
      202: {
        headers: {
          [name: string]: unknown
        }
        content: {
          'application/json': {
            jobId: string
          }
        }
      }
    }
  }
  dismissIssue: {
    parameters: {
      query?: never
      header?: never
      path: {
        knowledgeBaseId: string
        issueId: string
      }
      cookie?: never
    }
    requestBody?: never
    responses: {
      /** @description Issue */
      200: {
        headers: {
          [name: string]: unknown
        }
        content: {
          'application/json': {
            id: string
            knowledgeBaseId: string
            /** @description IssueContent */
            content: {
              /** @enum {string} */
              kind:
                | 'conflict'
                | 'gap'
                | 'update_required'
                | 'add_entry'
                | 'remove_entry'
                | 'split_entry'
                | 'merge_entry'
              /** @enum {string} */
              severity: 'critical' | 'suggestion'
              scopePath: string
              issue: string
              suggestedFix: string
              citedSourceIds?: string[]
              claimKey?: string
              involvedScopes?: string[]
              currentClaim?: string
              alternativeClaim?: string
              /** @enum {string} */
              currentAuthority?: 'primary' | 'secondary' | 'community'
              /** @enum {string} */
              alternativeAuthority?: 'primary' | 'secondary' | 'community'
              /** @enum {string} */
              suggestedResolution?: 'keep_existing' | 'accept_new'
            }
            /** @enum {string} */
            status: 'open' | 'accepted' | 'rejected'
            /** @enum {string|null} */
            resolution: 'keep_existing' | 'accept_new' | null
            /** @description IssueResolvedBy */
            resolvedBy: {
              id: string
              /** @enum {string} */
              kind: 'user' | 'robot'
            } | null
            /** Format: date-time */
            createdAt: string
            /** Format: date-time */
            resolvedAt: string | null
          }
        }
      }
    }
  }
  reopenIssue: {
    parameters: {
      query?: never
      header?: never
      path: {
        knowledgeBaseId: string
        issueId: string
      }
      cookie?: never
    }
    requestBody?: never
    responses: {
      /** @description Issue */
      200: {
        headers: {
          [name: string]: unknown
        }
        content: {
          'application/json': {
            id: string
            knowledgeBaseId: string
            /** @description IssueContent */
            content: {
              /** @enum {string} */
              kind:
                | 'conflict'
                | 'gap'
                | 'update_required'
                | 'add_entry'
                | 'remove_entry'
                | 'split_entry'
                | 'merge_entry'
              /** @enum {string} */
              severity: 'critical' | 'suggestion'
              scopePath: string
              issue: string
              suggestedFix: string
              citedSourceIds?: string[]
              claimKey?: string
              involvedScopes?: string[]
              currentClaim?: string
              alternativeClaim?: string
              /** @enum {string} */
              currentAuthority?: 'primary' | 'secondary' | 'community'
              /** @enum {string} */
              alternativeAuthority?: 'primary' | 'secondary' | 'community'
              /** @enum {string} */
              suggestedResolution?: 'keep_existing' | 'accept_new'
            }
            /** @enum {string} */
            status: 'open' | 'accepted' | 'rejected'
            /** @enum {string|null} */
            resolution: 'keep_existing' | 'accept_new' | null
            /** @description IssueResolvedBy */
            resolvedBy: {
              id: string
              /** @enum {string} */
              kind: 'user' | 'robot'
            } | null
            /** Format: date-time */
            createdAt: string
            /** Format: date-time */
            resolvedAt: string | null
          }
        }
      }
    }
  }
  resolveIssue: {
    parameters: {
      query?: never
      header?: never
      path: {
        knowledgeBaseId: string
        issueId: string
      }
      cookie?: never
    }
    requestBody: {
      content: {
        'application/json': {
          /** @enum {string} */
          resolution: 'keep_existing' | 'accept_new'
        }
      }
    }
    responses: {
      /** @description ResolveIssueResponse */
      200: {
        headers: {
          [name: string]: unknown
        }
        content: {
          'application/json': {
            /** @description Issue */
            issue: {
              id: string
              knowledgeBaseId: string
              /** @description IssueContent */
              content: {
                /** @enum {string} */
                kind:
                  | 'conflict'
                  | 'gap'
                  | 'update_required'
                  | 'add_entry'
                  | 'remove_entry'
                  | 'split_entry'
                  | 'merge_entry'
                /** @enum {string} */
                severity: 'critical' | 'suggestion'
                scopePath: string
                issue: string
                suggestedFix: string
                citedSourceIds?: string[]
                claimKey?: string
                involvedScopes?: string[]
                currentClaim?: string
                alternativeClaim?: string
                /** @enum {string} */
                currentAuthority?: 'primary' | 'secondary' | 'community'
                /** @enum {string} */
                alternativeAuthority?: 'primary' | 'secondary' | 'community'
                /** @enum {string} */
                suggestedResolution?: 'keep_existing' | 'accept_new'
              }
              /** @enum {string} */
              status: 'open' | 'accepted' | 'rejected'
              /** @enum {string|null} */
              resolution: 'keep_existing' | 'accept_new' | null
              /** @description IssueResolvedBy */
              resolvedBy: {
                id: string
                /** @enum {string} */
                kind: 'user' | 'robot'
              } | null
              /** Format: date-time */
              createdAt: string
              /** Format: date-time */
              resolvedAt: string | null
            }
            jobId: string | null
          }
        }
      }
    }
  }
  getJob: {
    parameters: {
      query?: never
      header?: never
      path: {
        knowledgeBaseId: string
        jobId: string
      }
      cookie?: never
    }
    requestBody?: never
    responses: {
      /** @description Job */
      200: {
        headers: {
          [name: string]: unknown
        }
        content: {
          'application/json': {
            id: string
            /** @enum {string} */
            status: 'pending' | 'queued' | 'running' | 'succeeded' | 'failed' | 'cancelled'
            /** Format: date-time */
            startedAt: string | null
            /** Format: date-time */
            completedAt: string | null
            result?: unknown
            error?: string | null
          }
        }
      }
    }
  }
  refreshKnowledgeBase: {
    parameters: {
      query?: never
      header?: never
      path: {
        knowledgeBaseId: string
      }
      cookie?: never
    }
    requestBody?: never
    responses: {
      /** @description RefreshAccepted */
      202: {
        headers: {
          [name: string]: unknown
        }
        content: {
          'application/json': {
            jobId: string
            started: boolean
          }
        }
      }
    }
  }
  listSources: {
    parameters: {
      query?: {
        cursor?: string
        limit?: number
        status?: 'pending' | 'processing' | 'ready' | 'failed' | 'skipped'
        importId?: string
        ids?: string
      }
      header?: never
      path: {
        knowledgeBaseId: string
      }
      cookie?: never
    }
    requestBody?: never
    responses: {
      /** @description Default Response */
      200: {
        headers: {
          [name: string]: unknown
        }
        content: {
          'application/json': {
            data: {
              /** Format: uuid */
              id: string
              /** Format: uuid */
              knowledgeBaseId: string
              filename: string
              /** @enum {string} */
              kind: 'web' | 'file' | 'dataset'
              sizeBytes: number
              /** @enum {string} */
              status: 'pending' | 'processing' | 'ready' | 'failed' | 'skipped'
              tldr: string | null
              topics: string[] | null
              canonicalUrl: string | null
              /** Format: date-time */
              fetchedAt: string | null
              /** Format: date-time */
              distilledAt: string | null
              /** Format: date-time */
              createdAt: string
            }[]
            nextCursor: string | null
          }
        }
      }
    }
  }
  getSource: {
    parameters: {
      query?: never
      header?: never
      path: {
        knowledgeBaseId: string
        sourceId: string
      }
      cookie?: never
    }
    requestBody?: never
    responses: {
      /** @description Source */
      200: {
        headers: {
          [name: string]: unknown
        }
        content: {
          'application/json': {
            /** Format: uuid */
            id: string
            /** Format: uuid */
            knowledgeBaseId: string
            filename: string
            /** @enum {string} */
            kind: 'web' | 'file' | 'dataset'
            sizeBytes: number
            /** @enum {string} */
            status: 'pending' | 'processing' | 'ready' | 'failed' | 'skipped'
            tldr: string | null
            topics: string[] | null
            canonicalUrl: string | null
            /** Format: date-time */
            fetchedAt: string | null
            /** Format: date-time */
            distilledAt: string | null
            /** Format: date-time */
            createdAt: string
          }
        }
      }
    }
  }
  deleteSource: {
    parameters: {
      query?: never
      header?: never
      path: {
        knowledgeBaseId: string
        sourceId: string
      }
      cookie?: never
    }
    requestBody?: never
    responses: {
      /** @description Default Response */
      204: {
        headers: {
          [name: string]: unknown
        }
        content: {
          'application/json': null
        }
      }
    }
  }
  getSourceContent: {
    parameters: {
      query?: {
        /** @description Output representation. `json` (default) returns the structured resource; `markdown` / `plain` return the rendered, LLM-ready text. */
        format?: 'json' | 'markdown' | 'plain'
        startLine?: number
        endLine?: number
      }
      header?: never
      path: {
        knowledgeBaseId: string
        sourceId: string
      }
      cookie?: never
    }
    requestBody?: never
    responses: {
      /** @description SourceContent */
      200: {
        headers: {
          [name: string]: unknown
        }
        content: {
          'application/json': {
            /** Format: uuid */
            sourceId: string
            content: string
            totalLines: number
            slice: {
              start: number
              end: number
            }
          }
          'text/markdown': string
          'text/plain': string
        }
      }
    }
  }
  saveConversation: {
    parameters: {
      query?: never
      header?: never
      path: {
        threadId: string
      }
      cookie?: never
    }
    /** @description SaveConversationInput */
    requestBody: {
      content: {
        'application/json': {
          messages: {
            /** @enum {string} */
            role: 'user' | 'assistant' | 'system' | 'tool'
            /** @default null */
            content?: string | null
            /** @default null */
            toolName?: string | null
            /**
             * @default null
             * @enum {string|null}
             */
            toolType?: 'call' | 'result' | null
          }[]
          modelProvider?: string
          modelId?: string
          /** @description ConversationTokenUsage */
          tokenUsage?: {
            inputTokens?: number
            outputTokens?: number
            totalTokens?: number
          }
          /** @description ConversationMetadata */
          metadata?: {
            [key: string]: string | string[]
          }
        }
      }
    }
    responses: {
      /** @description Conversation */
      200: {
        headers: {
          [name: string]: unknown
        }
        content: {
          'application/json': {
            id: string
            threadId: string
            /** @description ConversationMetadata */
            metadata: {
              [key: string]: string | string[]
            } | null
            /** Format: date-time */
            startedAt: string
            /** Format: date-time */
            messagesUpdatedAt: string
            messages: {
              /** @enum {string} */
              role: 'user' | 'assistant' | 'system' | 'tool'
              /** @default null */
              content: string | null
              /** @default null */
              toolName: string | null
              /**
               * @default null
               * @enum {string|null}
               */
              toolType: 'call' | 'result' | null
            }[]
            modelProvider: string | null
            modelId: string | null
            /** @description ConversationTokenUsage */
            tokenUsage: {
              inputTokens?: number
              outputTokens?: number
              totalTokens?: number
            } | null
            /** @description ConversationCoreMetrics */
            coreMetrics: {
              successScore?: number
              /** @enum {string} */
              sentiment?: 'positive' | 'neutral' | 'negative'
              contentGaps?: string[]
            } | null
            /** Format: date-time */
            classifiedAt: string | null
            classificationError: string | null
            /** Format: date-time */
            createdAt: string
            /** Format: date-time */
            updatedAt: string
          }
        }
      }
    }
  }
  classifyConversation: {
    parameters: {
      query?: never
      header?: never
      path: {
        threadId: string
      }
      cookie?: never
    }
    /** @description ClassifyConversationInput */
    requestBody: {
      content: {
        'application/json': {
          coreMetrics?: {
            successScore: number
            /** @enum {string} */
            sentiment: 'positive' | 'neutral' | 'negative'
            contentGaps: string[]
          }
          classificationError?: string
        }
      }
    }
    responses: {
      /** @description Conversation */
      200: {
        headers: {
          [name: string]: unknown
        }
        content: {
          'application/json': {
            id: string
            threadId: string
            /** @description ConversationMetadata */
            metadata: {
              [key: string]: string | string[]
            } | null
            /** Format: date-time */
            startedAt: string
            /** Format: date-time */
            messagesUpdatedAt: string
            messages: {
              /** @enum {string} */
              role: 'user' | 'assistant' | 'system' | 'tool'
              /** @default null */
              content: string | null
              /** @default null */
              toolName: string | null
              /**
               * @default null
               * @enum {string|null}
               */
              toolType: 'call' | 'result' | null
            }[]
            modelProvider: string | null
            modelId: string | null
            /** @description ConversationTokenUsage */
            tokenUsage: {
              inputTokens?: number
              outputTokens?: number
              totalTokens?: number
            } | null
            /** @description ConversationCoreMetrics */
            coreMetrics: {
              successScore?: number
              /** @enum {string} */
              sentiment?: 'positive' | 'neutral' | 'negative'
              contentGaps?: string[]
            } | null
            /** Format: date-time */
            classifiedAt: string | null
            classificationError: string | null
            /** Format: date-time */
            createdAt: string
            /** Format: date-time */
            updatedAt: string
          }
        }
      }
    }
  }
}
