UNPKG

@sanity/client

Version:

Client for retrieving, creating and patching data from Sanity.io

14,700 lines • 645 kB
import { f as StegaConfig, l as InitializedStegaConfig } from "./types-CfGzbXrl.js";
import { FetchFunction, RequestOptions } from "get-it";
import { Observable } from "rxjs";
import { ClientPerspective } from "@sanity/client";
/**
 * Include a string in the instruction: do not have to escape $ signs in the string.
 *
 * ```ts
 * client.agent.action.generate({
 *   schemaId,
 *   documentId,
 *   instruction: 'Give the following topic:\n $topic \n ---\nGenerate the full article.',
 *   instructionParams: {
 *     topic: {
 *       type: 'constant',
 *       value: 'Grapefruit'
 *     },
 *   },
 * })
 * ```
 *
 * `type: 'constant'` can also be provided directly as a string, as a shorthand:
 *
 * ```ts
 * client.agent.action.generate({
 *   schemaId,
 *   documentId,
 *   instruction: 'Give the following topic:\n $topic \n ---\nGenerate the full article.',
 *   instructionParams: {
 *     topic: 'Grapefruit'
 *   },
 * })
 * ```
 *
 * @beta
 * */
interface ConstantAgentActionParam {
  type: 'constant';
  value: string;
}
type DocIdParam<TParamConfig extends {
  docIdRequired: boolean;
} = {
  docIdRequired: false;
}> = TParamConfig['docIdRequired'] extends true ? {
  documentId: string;
} : {
  /**
   * If omitted, implicitly uses the documentId of the instruction target
   */
  documentId?: string;
};
/**
 *
 *
 * Includes a LLM-friendly version of the field value in the instruction
 *
 * ```ts
 * client.agent.action.generate({
 *   schemaId,
 *   documentId,
 *   instruction: 'Give the following field value:\n $pte \n ---\nGenerate keywords.',
 *   instructionParams: {
 *     pte: {
 *       type: 'field',
 *       path: ['pteField'],
 *     },
 *   },
 *   target: {path: 'keywords' }
 * })
 *
 * ```
 *
 * @beta
 * */
type FieldAgentActionParam<TParamConfig extends {
  docIdRequired: boolean;
} = {
  docIdRequired: false;
}> = {
  type: 'field';
  /**
   * Examples: 'title', ['array', \{_key: 'arrayItemKey'\}, 'field']
   */
  path: AgentActionPathSegment | AgentActionPath;
} & DocIdParam<TParamConfig>;
/**
 *
 * Includes a LLM-friendly version of the document in the instruction
 *
 * ```ts
 * client.agent.action.generate({
 *   schemaId,
 *   documentId,
 *   instruction: 'Give the following document value:\n $document \n ---\nGenerate keywords.',
 *   instructionParams: {
 *     document: {
 *       type: 'document',
 *     },
 *   },
 *   target: {path: 'keywords' }
 * })
 * ```
 *
 * @beta
 * */
type DocumentAgentActionParam<TParamConfig extends {
  docIdRequired: boolean;
} = {
  docIdRequired: false;
}> = {
  type: 'document';
} & DocIdParam<TParamConfig>;
/**
 * Includes a LLM-friendly version of GROQ query result in the instruction
 *
 * ```ts
 * client.agent.action.generate({
 *   schemaId,
 *   documentId,
 *   instruction: 'Give the following list of titles:\n $list \n ---\nGenerate a similar title.',
 *   instructionParams: {
 *     list: {
 *       type: 'groq',
 *       query: '* [_type==$type].title',
 *       params: {type: 'article'}
 *     },
 *   },
 *   target: {path: 'title' }
 * })
 * ```
 * @beta
 * */
interface GroqAgentActionParam {
  type: 'groq';
  query: string;
  params?: Record<string, string>;
  perspective?: ClientPerspective;
}
/**  @beta */
type AgentActionTypeConfig = {
  include: string[];
  exclude?: never;
} | {
  exclude: string[];
  include?: never;
};
/**  @beta */
type AgentActionPathSegment = string | {
  _key: string;
};
/**  @beta */
type AgentActionPath = AgentActionPathSegment[];
/**  @beta */
interface AgentActionTargetInclude {
  path: AgentActionPathSegment | AgentActionPath;
  /**
   * By default, all children up to `target.maxPathDepth` are included.
   * Fields or array items not on the exclude list, are implicitly included.
   */
  exclude?: AgentActionPathSegment[];
  /**
   * Types can be used to exclude array item types or all fields directly under the target path of a certain type.
   * If you do exclude: ['string'] all string fields under the target will be excluded, for instance.
   *
   * `types.include` and `types.exclude` are mutually exclusive.
   */
  types?: AgentActionTypeConfig;
}
/**
 * @beta
 */
interface AgentActionTarget {
  /**
   * Root target path.
   *
   * Use this to have the instruction only affect a part of the document.
   *
   * To further control the behavior of individual paths under the root, use `include`, `exclude`, `types.include`
   * and `types.exclude`.
   *
   * Example:
   *
   * `path: ['body', {_key: 'someKey'}, 'nestedObject']`
   *
   * Here, the instruction will only write to fields under the nestedObject.
   *
   * Default: [] = the document itself
   *
   * @see #AgentActionPathSegment
   * @see #AgentActionPath
   * */
  path?: AgentActionPathSegment | AgentActionPath;
  /**
   * maxPathDepth controls how deep into the schema from the target root the instruction will affect.
   *
   * Depth is based on path segments:
   * - `title` has depth 1
   * - `array[_key="no"].title` has depth 3
   *
   * Be careful not to set this too high in studios with recursive document schemas, as it could have
   * negative impact on performance; both for runtime and quality of responses.
   *
   * Default: 4
   */
  maxPathDepth?: number;
  /**
   * By default, all children up to `target.maxPathDepth` are included.
   * Fields or array items not on the exclude list, are implicitly included.
   */
  exclude?: AgentActionPathSegment[];
  /**
   * Types can be used to exclude array item types or all fields directly under the target path of a certain type.
   * If you do exclude: ['string'] all string fields under the target will be excluded, for instance.
   *
   * `types.include` and `types.exclude` are mutually exclusive.
   */
  types?: AgentActionTypeConfig;
}
/** @beta */
type AgentActionParam<TParamConfig extends {
  docIdRequired: boolean;
} = {
  docIdRequired: false;
}> = string | ConstantAgentActionParam | FieldAgentActionParam<TParamConfig> | DocumentAgentActionParam<TParamConfig> | GroqAgentActionParam;
/** @beta */
type AgentActionParams<TParamConfig extends {
  docIdRequired: boolean;
} = {
  docIdRequired: false;
}> = Record<string, AgentActionParam<TParamConfig>>;
/** @beta */
interface AgentActionSchema {
  /** schemaId as reported by sanity deploy / sanity schema store */
  schemaId: string;
  /**
   * ### forcePublishedWrite: false (default)
   * By default, agent actions will never write to a published document.
   *
   * Instead, they will force the use of a draft ID ("drafts.some-id") instead of the published ID ("some-id"),
   * even when a published ID is provided.
   *
   * Actions will use state from an existing draft if it exists,
   * or use the published document to create a draft, if no draft exists.
   *
   * Successful responses contains the _id that was mutated by the action.
   *
   *
   * ### forcePublishedWrite: true
   *
   * When forcePublishedWrite: true an agent action will write to the exact id provided.
   * The action will also not fallback to published state for draft ids.
   *
   *
   * ### Versioned ids (releases)
   *
   * When an ID on the form "versions.<release>.some-id" is provided, agent actions will
   * always behave as if `forcePublishedWrite: true`.
   * That is, only the exact document state of the id provided is considered and mutated.
   * */
  forcePublishedWrite?: boolean;
  /**
   * When a type or field in the schema has a function set for `hidden` or `readOnly`, it is conditional.
   *
   * By default, Generate will not output to conditional `readOnly` and `hidden` fields,
   * ie, they are considered to resolve to `readOnly: true` / `hidden: true`.
   *
   * `conditionalPaths` param allows setting the default conditional value for
   * `hidden` and `readOnly` to false,
   * or individually set `hidden` and `readOnly` state for individual document paths.
   *
   * Note: fields and types with explicit readOnly: true or hidden: true in the schema, are not available to Generate,
   * and cannot be changed via conditionalPaths
   *
   * conditionalPaths state only apply to fields and types that have conditional `hidden` or `readOnly` in their schema definition.
   *
   * Consider using `hidden: () => true` in schema config, if a field should be writeable only by Generate and never
   * visible in the studio – then make the field visible to the Generate using `conditionalPaths`.
   *
   * @see GenerateRequestBase#target
   */
  conditionalPaths?: {
    defaultReadOnly?: boolean;
    defaultHidden?: boolean;
    paths?: {
      /** path here is not a relative path: it must be the full document path, regardless of `path` param used in targets */
      path: AgentActionPath;
      readOnly: boolean;
      hidden: boolean;
    }[];
  };
}
/** @beta */
interface AgentActionRequestBase extends AgentActionSchema {
  /**
   * When localeSettings is provided on the request, instruct can write to date and datetime fields.
   * Otherwise, such fields will be ignored.
   */
  localeSettings?: {
    /**
     * A valid Unicode BCP 47 locale identifier used to interpret and format
     * natural language inputs and date output. Examples include "en-US", "fr-FR", or "ja-JP".
     *
     * This affects how phrases like "next Friday" or "in two weeks" are parsed,
     * and how resulting dates are presented (e.g., 12-hour vs 24-hour format).
     *
     * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#getcanonicalocales
     */
    locale: string;
    /**
     * A valid IANA time zone identifier used to resolve relative and absolute
     * date expressions to a specific point in time. Examples include
     * "America/New_York", "Europe/Paris", or "Asia/Tokyo".
     *
     * This ensures phrases like "tomorrow at 9am" are interpreted correctly
     * based on the user's local time.
     *
     * @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
     */
    timeZone: string;
  };
  /**
   * Controls how much variance the instructions will run with.
   *
   * Value must be in the range [0, 1] (inclusive).
   *
   * Defaults:
   * - generate: 0.3
   * - translate: 0
   * - transform: 0
   */
  temperature?: number;
}
/** @beta */
interface AgentActionSync {
  /**
   * By default, noWrite: false.
   * Write enabled operations will mutate the target document, and emit AI presence in the studio.
   *
   * When noWrite: true, the api will not mutate any documents nor emit presence.
   * Ie, when true, no changes will be made to content-lake
   *
   * noWrite: true is incompatible with async: true,
   * as noWrite implies that you will use the return value of the operation
   */
  noWrite?: boolean;
  /**
   * When async: true, requests responds with status 201 and \{_id\} as response body as soon as the request is validated.
   * The instruction operation will carry on in the background.
   *
   * When async: false (default), requests respond with status 200 and the document value after instruction has been applied.
   *
   * async: true is incompatible with noWrite: true, as async: true does not return the resulting document
   */
  async?: false;
}
/** @beta */
interface AgentActionAsync {
  /**
   * When async: true, requests responds with status 201 and \{_id\} as response body as soon as the request is validated.
   * The instruction operation will carry on in the background.
   *
   * When async: false (default), requests respond with status 200 and the document value after instruction has been applied.
   *
   * async: true is incompatible with noWrite, as async: true does not return the resulting document
   */
  async: true;
}
/**  @beta */
type PatchOperation = 'set' | 'append' | 'mixed' | 'unset';
type AnyNonNullable = Exclude<any, null | undefined>;
/**  @beta */
interface PatchRequestBase extends AgentActionSchema {
  /**
   * Target defines which parts of the document will be affected by the instruction.
   * It can be an array, so multiple parts of the document can be separately configured in detail.
   *
   * Omitting target implies that the document itself is the root.
   *
   * Notes:
   * - instruction can only affect fields up to `maxPathDepth`
   * - when multiple targets are provided, they will be coalesced into a single target sharing a common target root.
   * It is therefore an error to provide conflicting include/exclude across targets (ie, include title in one, and exclude it in another)
   *
   * @see AgentActionRequestBase#conditionalPaths
   */
  target: PatchTarget | PatchTarget[];
}
/**  @beta */
type PatchTarget = {
  /**
   * Determines how the target path will be patched.
   *
   * ### Operation types
   * - `'set'` – an *overwriting* operation: sets the full field value for primitive targets, and merges the provided value with existing values for objects
   * - `'append'`:
   *    – array fields: appends new items to the end of the array,
   *    - string fields: '"existing content" "new content"'
   *    - text fields: '"existing content"\\n"new content"'
   *    - number fields: existing + new
   *    - other field types not mentioned will set instead (dates, url)
   * - `'mixed'` –  sets non-array fields, and appends to array fields
   * - `'unset'` – removes whatever value is on the target path
   *
   * All operations except unset requires a `value`.
   *
   * #### Appending in the middle of arrays
   * To append to an array, use the 'append' operation, and provide an array value with one or more array items.
   *
   * `target: {path: ['array'], operation: 'append', value: [{_type: 'item' _key: 'a'}]}` will append the items in the value to the existing array.
   *
   * To insert in the middle of the array, use `target: {path: ['array', {_key: 'appendAfterKey'}], operation: 'append', value: [{_type: 'item' _key: 'a'}]}`.
   * Here, `{_type: 'item' _key: 'a'}` will be appended after the array item with key `'appendAfterKey'`
   *
   * It is optional to provide a _key for inserted array items; if one isn't provided, it will be generated.
   */
  operation: PatchOperation;
  path: AgentActionPathSegment | AgentActionPath;
} & ({
  operation: 'unset';
  value?: never;
} | {
  operation: Exclude<PatchOperation, 'unset'>;
  value: AnyNonNullable;
});
/**
 * Patches an existing document
 * @beta
 */
interface PatchExistingDocumentRequest {
  /**
   * @see #AgentActionSchema.forcePublishedWrite
   */
  documentId: string;
  targetDocument?: never;
}
/**
 * Create a new document, then patch it
 * @beta
 */
interface PatchTargetDocumentRequest<T extends Record<string, Any$1> = Record<string, Any$1>> {
  /**
   * @see #AgentActionSchema.forcePublishedWrite
   */
  targetDocument: GenerateTargetDocument<T>;
  documentId?: never;
}
/** @beta */
type PatchDocumentSync<T extends Record<string, Any$1> = Record<string, Any$1>> = (PatchExistingDocumentRequest | PatchTargetDocumentRequest<T>) & PatchRequestBase & AgentActionSync;
/** @beta */
type PatchDocumentAsync<T extends Record<string, Any$1> = Record<string, Any$1>> = (PatchExistingDocumentRequest | PatchTargetDocumentRequest<T>) & PatchRequestBase & AgentActionAsync;
/** @beta */
type PatchDocument<T extends Record<string, Any$1> = Record<string, Any$1>> = PatchDocumentSync<T> | PatchDocumentAsync<T>;
/**  @beta */
interface PromptRequestBase {
  /**
   * Instruct the LLM how it should generate content. Be as specific and detailed as needed.
   *
   * The LLM only has access to information in the instruction, plus the target schema.
   *
   * String template with support for $variable from `instructionParams`.
   * */
  instruction: string;
  /**
   * param values for the string template, keys are the variable name, ie if the template has "$variable", one key must be "variable"
   *
   * ### Examples
   *
   * #### Constant
   *
   * ##### Shorthand
   * ```ts
   * client.agent.action.prompt({
   *   instruction: 'Give the following topic:\n $topic \n ---\nReturns some facts about it',
   *   instructionParams: {
   *     topic: 'Grapefruit'
   *   },
   * })
   * ```
   * ##### Object-form
   *
   * ```ts
   * client.agent.action.prompt({
   *   instruction: 'Give the following topic:\n $topic \n ---\nReturns some facts about it.',
   *   instructionParams: {
   *     topic: {
   *       type: 'constant',
   *       value: 'Grapefruit'
   *     },
   *   },
   * })
   * ```
   * #### Field
   * ```ts
   * client.agent.action.prompt({
   *   instruction: 'Give the following field value:\n $pte \n ---\nGenerate keywords.',
   *   instructionParams: {
   *     pte: {
   *       type: 'field',
   *       path: ['pteField'],
   *       documentId: 'someSanityDocId'
   *     },
   *   },
   * })
   * ```
   * #### Document
   * ```ts
   * client.agent.action.prompt({
   *   json: true,
   *   instruction: 'Given the following document:$document\nCreate a JSON string[] array with keywords describing it.',
   *   instructionParams: {
   *     document: {
   *       type: 'document',
   *       documentId: 'someSanityDocId'
   *     },
   *   },
   * })
   * ```
   *
   * #### GROQ
   * ```ts
   * client.agent.action.prompt({
   *   instruction: 'Return the best title amongst these: $titles.',
   *   instructionParams: {
   *     titles: {
   *       type: 'groq',
   *       query: '* [_type==$type].title',
   *       params: {type: 'article'}
   *     },
   *   },
   * })
   * ```
   * */
  instructionParams?: AgentActionParams<{
    docIdRequired: true;
  }>;
  /**
   * Controls how much variance the instructions will run with.
   *
   * Value must be in the range [0, 1] (inclusive).
   *
   * Default: 0.3
   */
  temperature?: number;
}
/**
 * @beta
 */
interface PromptJsonResponse<T extends Record<string, Any$1> = Record<string, Any$1>> {
  /**
   *
   * When format is 'json', the response will be json according to the instruction.
   * Note: In addition to setting this to 'json',  `instruction` MUST include the word 'JSON', or 'json' for this to work.
   */
  format: 'json';
}
interface PromptTextResponse {
  /**
   * When format is 'string', the response will be a raw text response to the instruction.
   */
  format?: 'string';
}
/** @beta */
type PromptRequest<T extends Record<string, Any$1> = Record<string, Any$1>> = (PromptTextResponse | PromptJsonResponse<T>) & PromptRequestBase;
/** @beta */
interface TransformRequestBase extends AgentActionRequestBase {
  /** schemaId as reported by sanity deploy / sanity schema store */
  schemaId: string;
  /**
   * The source document the transformation will use as input.
   *
   * @see #AgentActionSchema.forcePublishedWrite
   */
  documentId: string;
  /**
   * The source document's content is first copied to the target,
   * then it is transformed according to the instruction.
   *
   * When omitted, the source document (documentId) is also the target document.
   *
   *  @see #AgentActionSchema.forcePublishedWrite
   */
  targetDocument?: TransformTargetDocument;
  /**
   * Instruct the LLM how to transform the input to th output.
   *
   * String template with support for $variable from `instructionParams`.
   *
   * Capped to 2000 characters, after variables has been injected.
   * */
  instruction: string;
  /**
   *
   * param values for the string template, keys are the variable name, ie if the template has "$variable", one key must be "variable"
   *
   * ### Examples
   *
   * #### Constant
   *
   * ##### Shorthand
   * ```ts
   * client.agent.action.generate({
   *   schemaId,
   *   documentId,
   *   instruction: 'Give the following topic:\n $topic \n ---\nGenerate the full article.',
   *   instructionParams: {
   *     topic: 'Grapefruit'
   *   },
   * })
   * ```
   * ##### Object-form
   *
   * ```ts
   * client.agent.action.transform({
   *   schemaId,
   *   documentId,
   *   instruction: 'Give the following topic:\n $topic \n ---\nGenerate the full article.',
   *   instructionParams: {
   *     topic: {
   *       type: 'constant',
   *       value: 'Grapefruit'
   *     },
   *   },
   * })
   * ```
   * #### Field
   * ```ts
   * client.agent.action.transform({
   *   schemaId,
   *   documentId,
   *   instruction: 'Give the following field value:\n $pte \n ---\nGenerate keywords.',
   *   instructionParams: {
   *     pte: {
   *       type: 'field',
   *       path: ['pteField'],
   *     },
   *   },
   *   target: {path: 'keywords' }
   * })
   * ```
   * #### Document
   * ```ts
   * client.agent.action.transform({
   *   schemaId,
   *   documentId,
   *   instruction: 'Give the following document value:\n $document \n ---\nGenerate keywords.',
   *   instructionParams: {
   *     document: {
   *       type: 'document',
   *     },
   *   },
   *   target: {path: 'keywords' }
   * })
   * ```
   *
   * #### GROQ
   * ```ts
   * client.agent.action.transform({
   *   schemaId,
   *   documentId,
   *   instruction: 'Give the following list of titles:\n $list \n ---\nGenerate a similar title.',
   *   instructionParams: {
   *     list: {
   *       type: 'groq',
   *       query: '* [_type==$type].title',
   *       params: {type: 'article'}
   *     },
   *   },
   *   target: {path: 'title'}
   * })
   * ```
   * */
  instructionParams?: AgentActionParams;
  /**
   * Target defines which parts of the document will be affected by the instruction.
   * It can be an array, so multiple parts of the document can be separately configured in detail.
   *
   * Omitting target implies that the document itself is the root.
   *
   * Notes:
   * - instruction can only affect fields up to `maxPathDepth`
   * - when multiple targets are provided, they will be coalesced into a single target sharing a common target root.
   * It is therefor an error to provide conflicting include/exclude across targets (ie, include title in one, and exclude it in another)
   *
   * Default max depth for transform: 12
   *
   * ## Transforming images
   *
   * To transform an existing image, directly target an image asset path.
   *
   * For example, all the following will transform the image into the provided asset:
   * * `target: {path: ['image', 'asset'] }`
   * * `target: {path: 'image', include: ['asset'] }`
   *
   * Image transform can be combined with regular content targets:
   * * `target: [{path: ['image', 'asset'] }, {include: ['title', 'description']}]`
   *
   * Image transform can have per-path instructions, just like any other target paths:
   * * `target: [{path: ['image', 'asset'], instruction: 'Make the sky blue' }`
   *
   * @see AgentActionRequestBase#conditionalPaths
   */
  target?: TransformTarget | TransformTarget[];
}
/**
 * @see #AgentActionSchema.forcePublishedWrite
 *
 * @beta
 */
type TransformTargetDocument = {
  operation: 'edit';
  _id: string;
} | {
  operation: 'create';
  _id?: string;
} | {
  operation: 'createIfNotExists';
  _id: string;
} | {
  operation: 'createOrReplace';
  _id: string;
};
/**
 *
 * @see #TransformOperation
 * @beta
 */
type ImageDescriptionOperation = {
  type: 'image-description';
  /**
   * When omitted, parent image value will be inferred from the arget path.
   *
   * When specified, the `sourcePath` should be a path to an image (or image asset) field:
   * - `['image']`
   * - `['wrapper', 'mainImage']`
   * - `['heroImage', 'asset'] // the asset segment is optional, but supported`
   */
  sourcePath?: AgentActionPath;
} & ({
  /**
   * When omitted, parent image value will be inferred from the target path.
   *
   * When specified, the `sourcePath` should be a path to an image (or image asset) field:
   * - `['image']`
   * - `['wrapper', 'mainImage']`
   * - `['heroImage', 'asset'] // the asset segment is optional, but supported`
   *
   * Incompatible with `imageUrl`
   *
   */
  sourcePath?: AgentActionPath;
  imageUrl?: never;
} | {
  /**
   * When specified, the image source to be described will be fetched from the URL.
   *
   * Incompatible with `sourcePath`
   */
  imageUrl?: `https://${string}`;
  sourcePath?: never;
});
/**
 *
 * ## `set` by default
 * By default, Transform will change the value of every target field in place using a set operation.
 *
 * ## Image description
 *
 * ### Targeting image fields
 * Images can be transformed to a textual description by targeting a `string`, `text` or Portable Text field (`array` with `block`)
 * with `operation: {type: 'image-description'}`.
 *
 * Custom instructions for image description targets will be used to generate the description.
 *
 * Such targets must be a descendant field of an image object.
 *
 * For example:
 * - `target: {path: ['image', 'description'], operation: {type: 'image-description'} }`
 * - `target: {path: ['array', {_key: 'abc'}, 'alt'], operation: {type: 'image-description'} } //assuming the item in the array on the key-ed path is an image`
 * - `target: {path: ['image'], include: ['portableTextField'], operation: {type: 'image-description'}, instruction: 'Use formatting and headings to describe the image in great detail' }`
 *
 * ### Targeting non-image fields
 * If the target image description lives outside an image object, use the `sourcePath` option to specify the path to the image field.
 * `sourcePath` must be an image or image asset field.
 *
 * For example:
 * - `target: {path: ['description'], operation: operation: {type: 'image-description', sourcePath: ['image', 'asset'] }`
 * - `target: {path: ['wrapper', 'title'], operation: {type: 'image-description', sourcePath: ['array', {_key: 'abc'}, 'image'] }`
 * - `target: {path: ['wrapper'], include: ['portableTextField'], operation: {type: 'image-description', sourcePath: ['image', 'asset'] }, instruction: 'Use formatting and headings to describe the image in great detail' }`
 *
 * ### Targeting images outside the document (URL)
 * If the source image is available on a https URL outside the target document, it is possible to get a description for it using `imageUrl`.
 *
 * Example:
 * - `target: {path: ['description'], operation: operation: {type: 'image-description', imageUrL: 'https://www.sanity.io/static/images/favicons/android-icon-192x192.png?v=2' }`
 * @beta
 */
type TransformOperation = 'set' | ImageDescriptionOperation;
/**
 * @see #TransformOperation
 * @beta
 * */
interface TransformTargetInclude extends AgentActionTargetInclude {
  /**
   * Specifies a tailored instruction of this target.
   *
   * String template with support for $variable from `instructionParams`.  */
  instruction?: string;
  /**
   * By default, all children up to `target.maxPathDepth` are included.
   *
   * When `include` is specified, only segments explicitly listed will be included.
   *
   * Fields or array items not on the include list, are implicitly excluded.
   */
  include?: (AgentActionPathSegment | TransformTargetInclude)[];
  /**
   * Default: `set`
   * @see #TransformOperation
   */
  operation?: TransformOperation;
}
/**
 * @see #TransformOperation
 * @beta
 * */
interface TransformTarget extends AgentActionTarget {
  /**
   * Specifies a tailored instruction of this target.
   *
   * String template with support for $variable from `instructionParams`.
   * */
  instruction?: string;
  /**
   * By default, all children up to `target.maxPathDepth` are included.
   *
   * When `include` is specified, only segments explicitly listed will be included.
   *
   * Fields or array items not on the include list, are implicitly excluded.
   */
  include?: (AgentActionPathSegment | TransformTargetInclude)[];
  /**
   * Default: `set`
   * @see #TransformOperation
   */
  operation?: TransformOperation;
}
/** @beta */
type TransformDocumentSync<T extends Record<string, Any$1> = Record<string, Any$1>> = TransformRequestBase & AgentActionSync;
/** @beta */
type TransformDocumentAsync = TransformRequestBase & AgentActionAsync;
/** @beta */
type TransformDocument<T extends Record<string, Any$1> = Record<string, Any$1>> = TransformDocumentSync<T> | TransformDocumentAsync;
/**  @beta */
interface TranslateRequestBase extends AgentActionRequestBase {
  /** schemaId as reported by sanity deploy / sanity schema store */
  schemaId: string;
  /**
   * The source document the transformation will use as input.
   * @see #AgentActionSchema.forcePublishedWrite
   */
  documentId: string;
  /**
   * The target document will first get content copied over from the source,
   * then it is translated according to the instruction.
   *
   * When omitted, the source document (documentId) is also the target document.
   *
   * @see #AgentActionSchema.forcePublishedWrite
   */
  targetDocument?: TransformTargetDocument;
  /**
   * While optional, it is recommended
   */
  fromLanguage?: TranslateLanguage;
  toLanguage: TranslateLanguage;
  /**
   * `styleGuide` can be used to tailor how the translation should be preformed.
   *
   * String template using $variable from styleGuideParams.
   *
   * Capped to 2000 characters, after variables has been injected.
   *
   * @see #protectedPhrases
   */
  styleGuide?: string;
  /** param values for the string template, keys are the variable name, ie if the template has "$variable", one key must be "variable" */
  styleGuideParams?: AgentActionParams;
  /**
   * When the input string contains any phrase from `protectedPhrases`, the LLM will be instructed not
   * to translate them.
   *
   * It is recommended to use `protectedPhrases` instead of `styleGuide` for deny-list words and phrases,
   * since it keeps token cost low, resulting in faster responses, and limits how much information the LLM
   * has to process, since only phrases that are actually in the input string will be included in the final prompt.
   */
  protectedPhrases?: string[];
  /**
   * When specified, the `toLanguage.id` will be stored in the specified path in the target document.
   *
   * The file _can_ be hidden: true (unlike other fields in the target, which will be ignored)
   */
  languageFieldPath?: AgentActionPathSegment | AgentActionPath;
  /**
   * Target defines which parts of the document will be affected by the instruction.
   * It can be an array, so multiple parts of the document can be separately configured in detail.
   *
   * Omitting target implies that the document itself is the root.
   *
   * Notes:
   * - instruction can only affect fields up to `maxPathDepth`
   * - when multiple targets are provided, they will be coalesced into a single target sharing a common target root.
   * It is therefor an error to provide conflicting include/exclude across targets (ie, include title in one, and exclude it in another)
   *
   * @see AgentActionRequestBase#conditionalPaths
   */
  target?: TranslateTarget | TranslateTarget[];
}
/**  @beta */
interface TranslateLanguage {
  /**
   * Language code
   */
  id: string;
  /**
   * While optional, it is recommended to provide a language title
   */
  title?: string;
}
/**  @beta */
interface TranslateTargetInclude extends AgentActionTargetInclude {
  /** String template using $variable from styleGuideParams.  */
  styleGuide?: string;
  /**
   * By default, all children up to `target.maxPathDepth` are included.
   *
   * When `include` is specified, only segments explicitly listed will be included.
   *
   * Fields or array items not on the include list, are implicitly excluded.
   */
  include?: (AgentActionPathSegment | TranslateTargetInclude)[];
}
/**  @beta */
interface TranslateTarget extends AgentActionTarget {
  /** String template using $variable from styleGuideParams.  */
  styleGuide?: string;
  /**
   * By default, all children up to `target.maxPathDepth` are included.
   *
   * When `include` is specified, only segments explicitly listed will be included.
   *
   * Fields or array items not on the include list, are implicitly excluded.
   */
  include?: (AgentActionPathSegment | TranslateTargetInclude)[];
}
/** @beta */
type TranslateDocumentSync<T extends Record<string, Any$1> = Record<string, Any$1>> = TranslateRequestBase & AgentActionSync;
/** @beta */
type TranslateDocumentAsync = TranslateRequestBase & AgentActionAsync;
/** @beta */
type TranslateDocument<T extends Record<string, Any$1> = Record<string, Any$1>> = TranslateDocumentSync<T> | TranslateDocumentAsync;
/**
 * @public
 * @inline
 */
declare class ObservableAgentsActionClient {
  #private;
  constructor(client: ObservableSanityClient$1, httpRequest: HttpRequest);
  /**
   * Run an instruction to generate content in a target document.
   * @param request - instruction request
   */
  generate<DocumentShape extends Record<string, Any$1>>(request: GenerateInstruction<DocumentShape>): Observable<(typeof request)['async'] extends true ? {
    _id: string;
  } : IdentifiedSanityDocumentStub & DocumentShape>;
  /**
   * Transform a target document based on a source.
   * @param request - translation request
   */
  transform<DocumentShape extends Record<string, Any$1>>(request: TransformDocument<DocumentShape>): Observable<(typeof request)['async'] extends true ? {
    _id: string;
  } : IdentifiedSanityDocumentStub & DocumentShape>;
  /**
   * Translate a target document based on a source.
   * @param request - translation request
   */
  translate<DocumentShape extends Record<string, Any$1>>(request: TranslateDocument<DocumentShape>): Observable<(typeof request)['async'] extends true ? {
    _id: string;
  } : IdentifiedSanityDocumentStub & DocumentShape>;
}
/**
 * @public
 * @inline
 */
declare class AgentActionsClient {
  #private;
  constructor(client: SanityClient$1, httpRequest: HttpRequest);
  /**
   * Run an instruction to generate content in a target document.
   * @param request - instruction request
   */
  generate<DocumentShape extends Record<string, Any$1>>(request: GenerateInstruction<DocumentShape>): Promise<(typeof request)['async'] extends true ? {
    _id: string;
  } : IdentifiedSanityDocumentStub & DocumentShape>;
  /**
   * Transform a target document based on a source.
   * @param request - translation request
   */
  transform<DocumentShape extends Record<string, Any$1>>(request: TransformDocument<DocumentShape>): Promise<(typeof request)['async'] extends true ? {
    _id: string;
  } : IdentifiedSanityDocumentStub & DocumentShape>;
  /**
   * Translate a target document based on a source.
   * @param request - translation request
   */
  translate<DocumentShape extends Record<string, Any$1>>(request: TranslateDocument<DocumentShape>): Promise<(typeof request)['async'] extends true ? {
    _id: string;
  } : IdentifiedSanityDocumentStub & DocumentShape>;
  /**
   * Run a raw instruction and return the result either as text or json
   * @param request - prompt request
   */
  prompt<const DocumentShape extends Record<string, Any$1>>(request: PromptRequest<DocumentShape>): Promise<(typeof request)['format'] extends 'json' ? DocumentShape : string>;
  /**
   * Patch a document using a schema aware API.
   * Does not use an LLM, but uses the schema to ensure paths and values matches the schema.
   * @param request - instruction request
   */
  patch<DocumentShape extends Record<string, Any$1>>(request: PatchDocument<DocumentShape>): Promise<(typeof request)['async'] extends true ? {
    _id: string;
  } : IdentifiedSanityDocumentStub & DocumentShape>;
}
/**
 * @internal
 * @inline
 */
declare class ObservableAssetsClient {
  #private;
  constructor(client: ObservableSanityClient$1, httpRequest: HttpRequest);
  /**
   * Uploads a file asset to the configured dataset
   *
   * @param assetType - Asset type (file)
   * @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
   * @param options - Options to use for the upload
   */
  upload(assetType: 'file', body: UploadBody, options?: UploadClientConfig): Observable<UploadEvent<{
    document: SanityAssetDocument;
  }>>;
  /**
   * Uploads an image asset to the configured dataset
   *
   * @param assetType - Asset type (image)
   * @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
   * @param options - Options to use for the upload
   */
  upload(assetType: 'image', body: UploadBody, options?: UploadClientConfig): Observable<UploadEvent<{
    document: SanityImageAssetDocument;
  }>>;
  /**
   * Uploads a file or an image asset to the configured dataset
   *
   * @param assetType - Asset type (file/image)
   * @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
   * @param options - Options to use for the upload
   */
  upload(assetType: 'file' | 'image', body: UploadBody, options?: UploadClientConfig): Observable<UploadEvent<{
    document: SanityAssetDocument | SanityImageAssetDocument;
  }>>;
}
/**
 * @internal
 * @inline
 */
declare class AssetsClient {
  #private;
  constructor(client: SanityClient$1, httpRequest: HttpRequest);
  /**
   * Uploads a file asset to the configured dataset
   *
   * Note: when the client is configured against a Media Library
   * (`resource: {type: 'media-library', id}`), this resolves to a
   * {@link MediaLibraryAssetDocument} at runtime, not to a
   * {@link SanityAssetDocument}. The declared type cannot express that: the
   * shape depends on the client's configuration rather than on the arguments,
   * so an overload cannot discriminate it, and widening the return type into a
   * union would be a breaking change for every existing caller. Narrow the
   * result yourself (for example, check for `currentVersion`) if you upload to
   * a Media Library. Typing this honestly is deferred to the next major.
   *
   * @param assetType - Asset type (file)
   * @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
   * @param options - Options to use for the upload
   */
  upload(assetType: 'file', body: UploadBody, options?: UploadClientConfig): Promise<SanityAssetDocument>;
  /**
   * Uploads an image asset to the configured dataset
   *
   * Note: against a Media Library this resolves to a
   * {@link MediaLibraryAssetDocument} at runtime. See the `'file'` overload
   * above for why the declared type cannot say so.
   *
   * @param assetType - Asset type (image)
   * @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
   * @param options - Options to use for the upload
   */
  upload(assetType: 'image', body: UploadBody, options?: UploadClientConfig): Promise<SanityImageAssetDocument>;
  /**
   * Uploads a file or an image asset to the configured dataset
   *
   * @param assetType - Asset type (file/image)
   * @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
   * @param options - Options to use for the upload
   */
  upload(assetType: 'file' | 'image', body: UploadBody, options?: UploadClientConfig): Promise<SanityAssetDocument | SanityImageAssetDocument>;
}
/**
 * Maps an array of listen events names to their corresponding listen event type, e.g:
 * ```
 * type Test = MapListenEventNamesToListenEvents<Doc, ['welcome']>
 *    // ^? WelcomeEvent
 * ```
 *
 * @public
 */
type MapListenEventNamesToListenEvents<R extends Record<string, Any$1> = Record<string, Any$1>, Events extends (ResumableListenEventNames | ListenEventName)[] = (ResumableListenEventNames | ListenEventName)[]> = Events extends (infer E)[] ? E extends 'welcome' ? WelcomeEvent : E extends 'mutation' ? MutationEvent<R> : E extends 'reconnect' ? ReconnectEvent : E extends 'welcomeback' ? WelcomeBackEvent : E extends 'reset' ? ResetEvent : E extends 'open' ? OpenEvent : never : never;
/**
 * Maps a ListenOptions object and returns the Listen events opted for, e.g:
 * ```
 * type Test = ListenEventFromOptions<Doc, {events: ['welcome', 'mutation']}>
 *    // ^? WelcomeEvent | MutationEvent<Doc>
 * ```
 *
 * @public
 */
type ListenEventFromOptions<R extends Record<string, Any$1> = Record<string, Any$1>, Opts extends ListenOptions | ResumableListenOptions | undefined = undefined> = Opts extends ListenOptions | ResumableListenOptions ? Opts['events'] extends (ResumableListenEventNames | ListenEventName)[] ? MapListenEventNamesToListenEvents<R, Opts['events']> : ListenEvent<R> : MutationEvent<R>;
/**
 * Set up a listener that will be notified when mutations occur on documents matching the provided query/filter.
 *
 * @param query - GROQ-filter to listen to changes for
 * @param params - Optional query parameters
 * @param options - Optional listener options
 * @public
 */
declare function _listen<R extends Record<string, Any$1> = Record<string, Any$1>, const G extends string = string>(this: SanityClient$1 | ObservableSanityClient$1, query: G, params?: ClientParams<G, ListenParams> | QueryWithoutParams): Observable<MutationEvent<R>>;
/**
 * Set up a listener that will be notified when mutations occur on documents matching the provided query/filter.
 *
 * @param query - GROQ-filter to listen to changes for
 * @param params - Optional query parameters
 * @param options - Optional listener options
 * @public
 */
declare function _listen<R extends Record<string, Any$1> = Record<string, Any$1>, Opts extends ListenOptions | ResumableListenOptions = ListenOptions | ResumableListenOptions, const G extends string = string>(this: SanityClient$1 | ObservableSanityClient$1, query: G, params?: ClientParams<G, ListenParams> | QueryWithoutParams, options?: Opts): Observable<ListenEventFromOptions<R, Opts>>;
/** @internal */
declare const possibleRequestOptions: readonly ['headers', 'signal', 'tag', 'timeout', 'token'];
/**
 * Request options honored by the collaboration comments methods.
 *
 * @beta
 */
type CollaborationCommentsRequestOptions = Pick<RequestOptions$1, (typeof possibleRequestOptions)[number]>;
/**
 * Options for collaboration comments write methods.
 *
 * @beta
 */
type CollaborationCommentsWriteOptions = CollaborationCommentsRequestOptions & {
  /** Transaction ID to associate the write with */
  transactionId?: string;
};
/**
 * Listener options for `collaboration.comments.listen`.
 *
 * `includeAllVersions` is left out: comments are stored as `sanity.comment`
 * documents with no drafts or versions, so it would never make a difference.
 *
 * @beta
 */
type CollaborationCommentsListenOptions = Omit<ListenOptions, 'includeAllVersions'> | Omit<ResumableListenOptions, 'includeAllVersions'>;
/**
 * Status of a comment thread. Replies always share the status of their parent comment.
 *
 * @beta
 */
type CollaborationCommentStatus = 'open' | 'resolved';
/**
 * Emoji short names that can be used as comment reactions.
 *
 * @beta
 */
type CollaborationCommentReactionShortName = ':-1:' | ':+1:' | ':eyes:' | ':heart:' | ':heavy_plus_sign:' | ':rocket:';
/**
 * A single Portable Text block, as used in comment messages and content snapshots.
 *
 * @beta
 */
interface CollaborationCommentPortableTextBlock {
  _type: string;
  children: Array<{
    _type: string;
    [key: string]: Any$1;
  }>;
  [key: string]: Any$1;
}
/**
 * Comment message, as an array of Portable Text blocks.
 *
 * @beta
 */
type CollaborationCommentMessage = CollaborationCommentPortableTextBlock[];
/**
 * The text an inline comment was anchored to, resolved by the API when the
 * comment was created.
 *
 * Holds one entry per Portable Text block the selection spans, keyed by the
 * block it came from. `text` is the plain text of that block with the selected
 * part wrapped in the marker characters `\uF000` (start) and `\uF001` (end).
 *
 * @beta
 */
interface CollaborationCommentSelection {
  type: 'text';
  value: {
    _key: string;
    text: string;
  }[];
}
/**
 * A comment document, as stored by the Comments API.
 *
 * @beta
 */
interface CollaborationCommentDocument extends SanityDocument$1 {
  _type: 'sanity.comment';
  _system?: {
    /** ID of the user that created the comment */
    createdBy?: string;
  };
  /** ID shared by a top-level comment and all of its replies */
  threadId?: string;
  /** Set on replies, pointing to the comment being replied to */
  parentCommentId?: string;
  message: CollaborationCommentMessage;
  reactions: {
    _key: string;
    shortName: CollaborationCommentReactionShortName;
    userId: string;
    addedAt: string;
  }[];
  /** Arbitrary metadata stored with the comment by the creating application */
  context?: Record<string, unknown>;
  target: {
    /** Global document reference (`resourceType:resourceId:documentId`, using the published document ID) */
    document: {
      _ref: `${string}:${string}:${string}`;
      _type: 'globalDocumentReference';
      _weak: true;
    };
    documentType: string;
    /** The exact document ID the comment was created against, e.g. a draft or version ID */
    sourceDocumentId: string;
    documentRevisionId?: string;
    /**
     * Set for field and inline comments. `field` is the `path` the comment was
     * created with; `selection` is set for inline comments only.
     */
    path?: {
      field: string;
      selection?: CollaborationCommentSelection;
    };
  };
  /**
   * Copy of the commented content, as it looked when the comment was created.
   * Set for inline comments only, and holds just the selected fragment of each
   * Portable Text block the selection spans.
   */
  contentSnapshot?: CollaborationCommentPortableTextBlock[];
  status: CollaborationCommentStatus;
  /** Set when the message has been updated after creation */
  lastEditedAt?: string;
}
/**
 * Inline text selection within a Portable Text field.
 * Each endpoint pairs the `_key` of a Portable Text block with a character
 * offset into that block's plain text.
 *
 * @deprecated Use {@link CollaborationCommentAnchor}.
 * @beta
 */
interface CollaborationCommentRange {
  start: {
    _key: string;
    offset: number;
  };
  end: {
    _key: string;
    offset: number;
  };
}
/**
 * Portable Text covering an inline comment anchor. Callers can send just the
 * blocks from the anchor start `_key` through end `_key`, or the full field.
 *
 * @beta
 */
type CollaborationCommentFieldValue = Array<{
  _type: string;
  _key: string;
  [key: string]: Any$1;
}>;
/**
 * Where in `path` a comment is anchored.
 *
 * For `portable-text`, each endpoint pairs the `_key` of a Portable Text
 * block with a character offset into that block's plain text. An optional
 * `fieldValue` is Portable Text covering the anchor. When set, the selection
 * is resolved from those blocks instead of from the live document.
 *
 * @beta
 */
type CollaborationCommentAnchor = {
  type: 'portable-text';
  start: {
    _key: string;
    offset: number;
  };
  end: {
    _key: string;
    offset: number;
  };
  fieldValue?: CollaborationCommentFieldValue;
};
/**
 * Target for a top-level comment. Inline selections require both `path` and
 * `anchor`; field-level comments may set `path` alone.
 *
 * The created comment stores this in a different shape: `path` becomes
 * `target.path.field`, and `anchor` is resolved against the document into
 * `target.path.selection` and `contentSnapshot` rather than being stored.
 *
 * Deprecated `range` + top-level `fieldValue` are still accepted and converted
 * to a `portable-text` `anchor` before the request is sent.
 *
 * @beta
 */
type CollaborationCommentTarget = {
  documentId: string;
  documentType: string;
  documentRevisionId?: string;
} & ({
  /** Path to the field containing the inline comment selection */
  path: string;
  anchor: CollaborationCommentAnchor;
  /**
   * @deprecated Use `anchor`.
   */
  range?: never;
  /**
   * @deprecated Use `anchor.fieldValue`.
   */
  fieldValue?: never;
} | {
  /** Path to the field containing the inline comment selection */
  path: string;
  /**
   * @deprecated Use `anchor`.
   */
  range: CollaborationCommentRange;
  /**
   * Portable Text covering the `range`. When set, the selection is resolved
   * from these blocks instead of from the live document.
   *
   * @deprecated Use `anchor.fieldValue`.
   */
  fieldValue?: CollaborationCommentFieldValue;
  anchor?: never;
} | {
  /** Path to the commented field */
  path?: string;
  anchor?: never;
  /**
   * @deprecated Use `anchor`.
   */
  range?: never;
  /**
   * @deprecated Use `anchor.fieldValue`.
   */
  fieldValue?: never;
});
/**
 * Comment to create with `collaboration.comments.create`.
 *
 * A top-level comment requires `target`; a reply requires `parentCommentId` (never both).
 * Replies inherit `target`, `status`, and `threadId` from the parent comment.
 *
 * ### Examples
 *
 * #### Top-level comment
 * ```ts
 * // `message` is an array of Portable Text blocks
 * await client.collaboration.comments.create({
 *   message,
 *   target: {documentId: 'doc-1', documentType: 'article'},
 * })
 * ```
 *
 * #### Inline comment
 * ```ts
 * await client.collaboration.comments.create({
 *   message,
 *   target: {
 *     documentId: 'doc-1',
 *     documentType: 'article',
 *     path: 'body',
 *     anchor: {
 *       type: 'portable-text',
 *       start: {_key: 'block-1', offset: 0},
 *       end: {_key: 'block-1', offset: 5},
 *     },
 *   },
 * })
 * ```
 *
 * #### Reply
 * ```ts
 * await client.collaboration.comments.create({
 *   message,
 *   parentCommentId: 'comment-1',
 * })
 * ```
 *
 * @beta
 */
type CollaborationCommentCreate = {
  /** Provide to control the ID of the created comment document */
  _id?: string;
  message: CollaborationCommentMessage;
  context?: Record<string, unknown>;
} & ({
  target: CollaborationCommentTarget;
  threadId?: string;
  parentCommentId?: never;
} | {
  parentCommentId: string;
  target?: never;
  threadId?: never;
});
/**
 * Fields that can be updated on an existing comment.
 *
 * An `anchor` re-anchors the comment within the field it already targets.
 * Pass `null` to remove the selection and leave a field-level comment.
 * An optional `fieldValue` on a `portable-text` anchor is resolved from those
 * blocks instead of from the live document.
 *
 * Deprecated `range` + top-level `fieldValue` (and `range: null`) are still
 * accepted and converted to `anchor` before the request is sent.
 *
 * @beta
 */
type CollaborationCommentUpdate = {
  /** Replaces the current message */
  message?: CollaborationCommentMessage;
  /** Cascades to the comment's replies */
  status?: CollaborationCommentStatus;
} & ({
  anchor: CollaborationCommentAnchor;
  /**
   * @deprecated Use `anchor`.
   */
  range?: never;
  /**
   * @deprecated Use `anchor.fieldValue`.
   */
  fieldValue?: never;
} | {
  anchor: null;
  /**
   * @deprecated Use `anchor`.
   */
  range?: never;
  /**
   * @deprecated Use `anchor.fieldValue`.
   */
  fieldValue?: never;
} | {
  /**
   * @deprecated Use `anchor`.
   */
  range: CollaborationCommentRange;
  /**
   * Portable Text covering the `range`. When set, the selection is resolved
   * from these blocks instead of from the live document.
   *
   * @deprecated Use `anchor.fieldValue`.
   */
  fieldValue?: CollaborationCommentFieldValue;
  anchor?: never;
} | {
  /**
   * @deprecated Use `anchor: null`.
   */
  range: null;
  /**
   * @deprecated Use `anchor.fieldValue`.
   */
  fieldValue?: never;
  anchor?: never;
} | {
  anchor?: undefined;
  /**
   * @deprecated Use `anchor`.
   */
  range?: undefined;
  /**
   * @deprecated Use `anchor.fieldValue`.
   */
  fieldValue?: never;
});
/**
 * Comments on the configured organization resource.
 *
 * Requires `collaboration.organizationId`, plus either `resource` or `projectId` and `dataset`.
 *
 * @beta
 */
declare class ObservableCollaborationCommentsClient {
  #private;
  constructor(client: ObservableSanityClient$1, httpRequest: HttpRequest);
  /**
   * Create a comment or reply on the configured resource.
   *
   * A top-level comment requires `target`; a reply requires `parentCommentId` (never both).
   * Replies inherit `target`, `status`, and `threadId` from the parent comment.
   *
   * @param body - Comment to create
   * @param options - Optional request options
   * @returns The created comment
   */
  create(body: CollaborationCommentCreate, options?: CollaborationCommentsWriteOptions): Observable<CollaborationCommentDocument>;
  /**
   * Update an existing comment.
   *
   * Updating `status` cascades to the comment's replies.
   *
   * @param id - Comment document ID
   * @param body - Fields to update
   * @param options - Optional request options
   * @returns The updated comment
   */
  update(id: string, body: CollaborationCommentUpdate, options?: CollaborationCommentsWriteOptions): Observable<CollaborationCommentDocument>;
  /**
   * Delete a comment and its replies.
   *
   * @param id - Comment document ID
   * @param options - Optional request options
   * @returns Mutation result, where `documentIds` covers the comment and every deleted reply
   */
  delete(id: string, options?: CollaborationCommentsWriteOptions): Observable<MultipleMutationResult>;
  /**
   * Add the current user's reaction to a comment.
   *
   * @param id - Comment document ID
   * @param shortName - Emoji short name, for example `:+1:`
   * @param options - Optional request options
   * @returns The comment, with the reaction applied
   */
  addReaction(id: string, shortName: CollaborationCommentReactionShortName, options?: CollaborationCommentsWriteOptions): Observable<CollaborationCommentDocument>;
  /**
   * Remove the current user's reaction from a comment.
   *
   * @param id - Comment document ID
   * @param shortName - Emoji short name, for example `:+1:`
   * @param options - Optional request options
   * @returns The comment, with the reaction removed
   */
  removeReaction(id: string, shortName: CollaborationCommentReactionShortName, options?: CollaborationCommentsWriteOptions): Observable<CollaborationCommentDocument>;
  /**
   * Build the global document reference used by `target.document._ref`, for use in
   * queries and listeners.
   *
   * The reference is built from the configured `resource` and the published ID of
   * the given document ID, since comment references always use published IDs.
   *
   * @example
   * ```ts
   * client.collaboration.comments.listen(
   *   '*[_type == "sanity.comment" && target.document._ref == $ref]',
   *   {ref: client.collaboration.comments.getTargetDocumentRef('doc-1')},
   * )
   * ```
   *
   * @param documentId - Document ID, in published, draft or version form
   * @returns Global document reference, of the form `resourceType:resourceId:documentId`
   */
  getTargetDocumentRef(documentId: string): CollaborationCommentDocument['target']['document']['_ref'];
  /**
   * Fetch comments on the configured resource.
   *
   * Takes the same `query` and `params` as `client.fetch`, and switches from a
   * GET to a POST for queries too large for the request URL in the same way,
   * but queries the comments endpoint, which accepts none of the query options
   * `client.fetch` does (`perspective`, `useCdn`, `filterResponse`,
   * `resultSourceMap`, stega).
   *
   * The query runs against the organization store, which is not scoped to
   * comments, so filter on `_type == "sanity.comment"`.
   *
   * @param query - GROQ-query to perform
   * @param params - Optional query parameters
   * @param options - Optional request options
   */
  fetch<R = unknown>(query: string, params?: QueryParams, options?: CollaborationCommentsRequestOptions): Observable<R>;
  /**
   * Listen for changes to comments on the configured resource.
   *
   * Mirrors `client.listen(query, params)`, and emits mutation events.
   *
   * @param query - GROQ-filter to listen to changes for
   * @param params - Optional query parameters
   */
  listen(query: string, params?: QueryParams): Observable<MutationEvent<CollaborationCommentDocument>>;
  /**
   * Listen for changes to comments on the configured resource.
   *
   * Mirrors `client.listen(query, params, options)`.
   *
   * @param query - GROQ-filter to listen to changes for
   * @param params - Optional query parameters
   * @param options - The same listener options `client.listen` takes, forwarded
   *   to the organization store's listener
   */
  listen<Opts extends CollaborationCommentsListenOptions>(query: string, params: QueryParams | undefined, options: Opts): Observable<ListenEventFromOptions<CollaborationCommentDocument, Opts>>;
}
/**
 * Comments on the configured organization resource.
 *
 * Requires `collaboration.organizationId`, plus either `resource` or `projectId` and `dataset`.
 *
 * @beta
 */
declare class CollaborationCommentsClient {
  #private;
  constructor(client: SanityClient$1, httpRequest: HttpRequest);
  /**
   * Create a comment or reply on the configured resource.
   *
   * A top-level comment requires `target`; a reply requires `parentCommentId` (never both).
   * Replies inherit `target`, `status`, and `threadId` from the parent comment.
   *
   * @param body - Comment to create
   * @param options - Optional request options
   * @returns The created comment
   */
  create(body: CollaborationCommentCreate, options?: CollaborationCommentsWriteOptions): Promise<CollaborationCommentDocument>;
  /**
   * Update an existing comment.
   *
   * Updating `status` cascades to the comment's replies.
   *
   * @param id - Comment document ID
   * @param body - Fields to update
   * @param options - Optional request options
   * @returns The updated comment
   */
  update(id: string, body: CollaborationCommentUpdate, options?: CollaborationCommentsWriteOptions): Promise<CollaborationCommentDocument>;
  /**
   * Delete a comment and its replies.
   *
   * @param id - Comment document ID
   * @param options - Optional request options
   * @returns Mutation result, where `documentIds` covers the comment and every deleted reply
   */
  delete(id: string, options?: CollaborationCommentsWriteOptions): Promise<MultipleMutationResult>;
  /**
   * Add the current user's reaction to a comment.
   *
   * @param id - Comment document ID
   * @param shortName - Emoji short name, for example `:+1:`
   * @param options - Optional request options
   * @returns The comment, with the reaction applied
   */
  addReaction(id: string, shortName: CollaborationCommentReactionShortName, options?: CollaborationCommentsWriteOptions): Promise<CollaborationCommentDocument>;
  /**
   * Remove the current user's reaction from a comment.
   *
   * @param id - Comment document ID
   * @param shortName - Emoji short name, for example `:+1:`
   * @param options - Optional request options
   * @returns The comment, with the reaction removed
   */
  removeReaction(id: string, shortName: CollaborationCommentReactionShortName, options?: CollaborationCommentsWriteOptions): Promise<CollaborationCommentDocument>;
  /**
   * Build the global document reference used by `target.document._ref`, for use in
   * queries and listeners.
   *
   * The reference is built from the configured `resource` and the published ID of
   * the given document ID, since comment references always use published IDs.
   *
   * @example
   * ```ts
   * const comments = await client.collaboration.comments.fetch(
   *   '*[_type == "sanity.comment" && target.document._ref == $ref]',
   *   {ref: client.collaboration.comments.getTargetDocumentRef('doc-1')},
   * )
   * ```
   *
   * @param documentId - Document ID, in published, draft or version form
   * @returns Global document reference, of the form `resourceType:resourceId:documentId`
   */
  getTargetDocumentRef(documentId: string): CollaborationCommentDocument['target']['document']['_ref'];
  /**
   * Fetch comments on the configured resource.
   *
   * Takes the same `query` and `params` as `client.fetch`, and switches from a
   * GET to a POST for queries too large for the request URL in the same way,
   * but queries the comments endpoint, which accepts none of the query options
   * `client.fetch` does (`perspective`, `useCdn`, `filterResponse`,
   * `resultSourceMap`, stega).
   *
   * The query runs against the organization store, which is not scoped to
   * comments, so filter on `_type == "sanity.comment"`.
   *
   * @param query - GROQ-query to perform
   * @param params - Optional query parameters
   * @param options - Optional request options
   */
  fetch<R = unknown>(query: string, params?: QueryParams, options?: CollaborationCommentsRequestOptions): Promise<R>;
  /**
   * Listen for changes to comments on the configured resource.
   *
   * Mirrors `client.listen(query, params)`, and emits mutation events.
   *
   * @param query - GROQ-filter to listen to changes for
   * @param params - Optional query parameters
   */
  listen(query: string, params?: QueryParams): Observable<MutationEvent<CollaborationCommentDocument>>;
  /**
   * Listen for changes to comments on the configured resource.
   *
   * Mirrors `client.listen(query, params, options)`.
   *
   * @param query - GROQ-filter to listen to changes for
   * @param params - Optional query parameters
   * @param options - The same listener options `client.listen` takes, forwarded
   *   to the organization store's listener
   */
  listen<Opts extends CollaborationCommentsListenOptions>(query: string, params: QueryParams | undefined, options: Opts): Observable<ListenEventFromOptions<CollaborationCommentDocument, Opts>>;
}
/**
 * This file was auto-generated by openapi-typescript.
 * Do not make direct changes to the file.
 */
interface paths {
  '/{apiVersion}/context/knowledge-bases': {
    parameters: {
      query?: never;
      header?: never;
      path?: never;
      cookie?: never;
    };
    /**
     * List knowledge bases
     * @description Returns the knowledge bases you can access in the organization set by `organizationId`. Drafts are left out unless you set `includeDrafts` to `true`. Results are cursor-paginated, newest first.
     */
    get: operations['listKnowledgeBases'];
    put?: never;
    /**
     * Create a knowledge base
     * @description Creates a knowledge base in your organization. To add content to it, add a source. Set `draft` to `true` to create a draft, which needs no title or description until you finish it. If your organization's Context document store can't be used, the request returns `503` with code `contextStoreUnavailable` and you can retry.
     */
    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 a knowledge base's metadata and state. `knowledgeBaseId` accepts the public ID (`kb...`) or the UUID, and you don't need to pass an organization. If you can't read the knowledge base, the request returns `404`. To read the built entries, query `sanity.context.entry` documents with GROQ from your organization's document store.
     */
    get: operations['getKnowledgeBase'];
    put?: never;
    post?: never;
    /**
     * Delete a knowledge base
     * @description Deletes the knowledge base and everything it owns: its sources, revisions, stored source files, and its documents in your organization's document store. While a build, refresh, apply, or sync is running, the request returns `409` with code `buildInFlight`. Retry after that work finishes.
     */
    delete: operations['deleteKnowledgeBase'];
    options?: never;
    head?: never;
    /**
     * Update a knowledge base
     * @description Updates the title or the description, or finishes a draft (`draft: false`). Fields equal to their current value are ignored, so sending the current values changes nothing. Finishing a draft with no title returns `422` with code `draftTitleRequired`. How often a website or dataset syncs is set on the source, with `PATCH .../sources/{sourceId}`.
     */
    patch: operations['updateKnowledgeBase'];
    trace?: never;
  };
  '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/build': {
    parameters: {
      query?: never;
      header?: never;
      path?: never;
      cookie?: never;
    };
    get?: never;
    put?: never;
    /**
     * Start a knowledge base build
     * @description Queues a build over the knowledge base's current sources and returns a job ID immediately. If a build is already running, the response returns that build's job ID instead of starting a second build. A draft can't be built: the request returns `409` with code `knowledgeBaseIsDraft`.
     */
    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 a knowledge base build
     * @description Cancels the running build and resets the knowledge base so you can build it again. Returns `cancelled: false` when no build is running.
     */
    post: operations['cancelKnowledgeBaseBuild'];
    delete?: never;
    options?: never;
    head?: never;
    patch?: never;
    trace?: never;
  };
  '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/documents': {
    parameters: {
      query?: never;
      header?: never;
      path?: never;
      cookie?: never;
    };
    /**
     * List documents
     * @description Lists the documents in a knowledge base: the pages, dataset documents and files its sources yield, which builds read and cite. Results are cursor-paginated, and you can filter them by `source` and `state`.
     */
    get: operations['listDocuments'];
    put?: never;
    post?: never;
    delete?: never;
    options?: never;
    head?: never;
    patch?: never;
    trace?: never;
  };
  '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/documents/{documentId}': {
    parameters: {
      query?: never;
      header?: never;
      path?: never;
      cookie?: never;
    };
    /**
     * Get a document
     * @description Returns a document with its conversion status and the chunks of its markdown. Entry citations point at a document's chunks.
     */
    get: operations['getDocument'];
    put?: never;
    post?: never;
    /**
     * Delete a document
     * @description Deletes a document from its source. A page that is still on the website comes back on the next sync of its source unless the crawl options exclude it. Entries that cite the document stay the same until the next build or refresh, which removes the citations.
     */
    delete: operations['deleteDocument'];
    options?: never;
    head?: never;
    /**
     * Keep a missing document
     * @description Keeps a `missing` web page in the knowledge base by setting its `state` back to `active`. A document that isn't `missing` returns `409` with code `documentInvalidState`.
     */
    patch: operations['updateDocument'];
    trace?: never;
  };
  '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/documents/{documentId}/content': {
    parameters: {
      query?: never;
      header?: never;
      path?: never;
      cookie?: never;
    };
    /**
     * Get a document's markdown
     * @description Returns the markdown a document converted to: the text builds read, and the line numbers citations use. Set `chunk` or `lines` to get part of it, and `format` to `markdown` or `plain` to get the text alone instead of JSON. Until the document is converted, the request returns `409` with code `documentNotConverted`. With `format=raw` it returns the document as its source gave it, as an attachment, or `409` with code `documentNotStored` when the document was too large to keep.
     */
    get: operations['getDocumentContent'];
    put?: never;
    post?: never;
    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 rewrite of the entry at `entryPath` from its cited sources and the active instructions, and returns a job ID immediately. The response also lists the other entries built from any of the same sources. An instruction applies to every entry built from its sources, so those entries can change too. Returns `422` with code `entryDocumentInvalid` if the entry document was edited into a shape the API cannot read.
     */
    post: operations['rebuildEntry'];
    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;
    /**
     * Create an instruction
     * @description Creates a standing instruction for how entries built from its documents are written. Every instruction applies to specific documents, set in `scopeDocumentIds`. To rebuild entries under the new instruction right away, pass their paths in `rebuildPaths`. The response includes the rebuild job ID, or `null` if the rebuild could not start. The instruction is saved either way. After the instruction is saved, a background check files issues for entries that contradict it. If you already checked the instruction for contradictions, set `verified` to skip the background check. If the requested rebuild does not start, the background check runs even when `verified` is set.
     */
    post: operations['createInstruction'];
    delete?: never;
    options?: never;
    head?: never;
    patch?: never;
    trace?: never;
  };
  '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/instructions/check': {
    parameters: {
      query?: never;
      header?: never;
      path?: never;
      cookie?: never;
    };
    get?: never;
    put?: never;
    /**
     * Check an instruction for contradictions
     * @description Checks every entry built from any of the documents in `scopeDocumentIds` against `statement`, and returns the entries that contradict it. Nothing is saved. Run it before `POST .../instructions` to find the entries a new instruction would contradict, then pass their paths as `rebuildPaths` and set `verified`. Each checked entry is one model call that counts toward the organization's model spend, and the response waits for all of them, so a check over many entries can take a while. To list the entries without checking them, set `candidatesOnly`; this makes no model calls. To check only some entries, pass their paths in `paths`. Together, these let you check one entry per request and show progress.
     */
    post: operations['checkInstruction'];
    delete?: never;
    options?: never;
    head?: never;
    patch?: never;
    trace?: never;
  };
  '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/instructions/draft': {
    parameters: {
      query?: never;
      header?: never;
      path?: never;
      cookie?: never;
    };
    get?: never;
    put?: never;
    /**
     * Draft an instruction from feedback
     * @description Turns free-form feedback, such as "this is wrong" or "never say X", into a proposed instruction: a statement and the documents it applies to. The documents come from `scopeDocumentIds` if you set it, or otherwise from the documents of the entry in `entryId`. Nothing is saved. Review and edit the draft, then create it with `POST .../instructions`. Each draft is one model call that counts toward the organization's model spend. If the model call fails, the request returns `502` with code `instructionDraftFailed`; retry, or write the instruction yourself.
     */
    post: operations['draftInstruction'];
    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 instruction. Builds stop applying it from the next run. Entries already written under it keep their text until they are rebuilt; pass `rebuild=true` to rebuild every entry built from its documents right away.
     */
    delete: operations['deleteInstruction'];
    options?: never;
    head?: never;
    /**
     * Update an instruction
     * @description Updates the instruction's statement or documents. The change applies from the next build. Any update also reactivates an archived instruction and ties it to the current content of its documents.
     */
    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;
    /**
     * Accept and apply issues
     * @description Accepts the issues in `issueIds`, then queues a job that applies them, rewrites the affected entries, and saves a new revision. Returns a job ID. IDs of issues that no longer exist are skipped. Returns `409` with code `issueNotAutoApplicable`, and accepts none of the issues, if any of them cannot be applied: a `conflict` (resolve it with `POST .../issues/{issueId}/resolve`), or an `update_required` issue whose `scopePath` is `*` or names an entry that no longer exists. Dismiss those instead.
     */
    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 as rejected. If the issue already left triage, the request returns it unchanged. Returns `422` with code `issueDocumentInvalid` if the issue document was edited into a shape the API cannot verify. Returns `409` with code `issueTransitionConflict` if another change to the issue happened at the same time. You can safely retry a `409`.
     */
    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 issue to triage, clears its resolution, and deletes the instruction the resolution created. Reopening an open or dismissed conflict returns it unchanged. Other issue types return `422` with code `issueNotResolvable`.
     */
    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 Resolves a conflict issue by choosing one of its sides. Set `resolution` to the index of a side in `content.sides`. For a conflict on a single entry, index `0` is the entry's current content, so choosing it keeps the entry as it is. Choosing any other side rewrites the entry, and the returned `jobId` tracks the rewrite. The decision becomes a standing instruction for every future build, and `resolvedBy` records who made it. To change a decision, resolve the accepted conflict again. Other issue types, dismissed conflicts, and out-of-range indexes return `422` with code `issueNotResolvable`.
     */
    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
     * @description Returns the status of a background job, such as a build, sync, or refresh. The endpoint that starts the work returns the job ID. A job cancelled before it started never ran, so it returns 404.
     */
    get: operations['getJob'];
    put?: never;
    post?: never;
    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 Lists the sources of a knowledge base: the websites, Sanity datasets and files its documents come from, each with its document counts and its latest sync. Results are cursor-paginated.
     */
    get: operations['listSources'];
    put?: never;
    /**
     * Add a source
     * @description Adds a source to a knowledge base. Set `type` to choose what it reads:
     *
     *     - `web`: a website, crawled from `url`
     *     - `sanity-dataset`: the documents a GROQ query selects in a Sanity dataset
     *     - `files`: files you upload with `POST .../sources/{sourceId}/uploads`, or text you send in `content`
     *
     *     A website or dataset starts its first sync right away. A `files` source syncs when you upload a file, or right away when you send `content`: one request stores the text, adds the source and starts its sync. For a website, set `dryRun` to `true` to preview the crawl without adding the source.
     *
     *     Adding a website that is already a source returns `409` with code `webSourceRootConflict`, and adding more websites than your limit allows returns `409` with code `webSourceRootLimitExceeded`. When the organization's knowledge bases already hold as many source chunks as its plan allows, returns `403` with code `planLimitReached` and adds nothing. Supports the `Idempotency-Key` header.
     */
    post: operations['createSource'];
    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 source
     * @description Returns a source with its settings, document counts and latest sync.
     */
    get: operations['getSource'];
    put?: never;
    post?: never;
    /**
     * Delete a source
     * @description Removes a source and its documents from the knowledge base, and starts a refresh that removes their citations from entries and deletes the entries left with none. A source no other knowledge base uses stops syncing and is deleted once that refresh has run.
     */
    delete: operations['deleteSource'];
    options?: never;
    head?: never;
    /**
     * Update a source
     * @description Changes a source's title, a website's crawl options, a dataset's query, or how often a website or dataset syncs on its own. New crawl options delete the documents whose path they leave out. When that would delete all of the source's documents, or five or more that are over a fifth of them, the request returns `409` with code `sourceDeletionsUnconfirmed` until you send it again with `confirmDeletions` set to `true`. New crawl options sent while the source syncs return `409` with code `syncInProgress`; send them again once the sync finishes. A new query queues a sync, which removes the documents the query no longer selects.
     *
     *     Crawl options on a source that isn't a website, a query on one that isn't a dataset, or a sync frequency on a `files` source, return `422` with code `sourceTypeMismatch`. Setting a sync frequency on a plan without scheduled syncs returns `403` with code `featureNotInPlan`; setting it to `null` always works.
     */
    patch: operations['updateSource'];
    trace?: never;
  };
  '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/sources/{sourceId}/syncs': {
    parameters: {
      query?: never;
      header?: never;
      path?: never;
      cookie?: never;
    };
    /**
     * List a source's syncs
     * @description Lists the syncs of a source, newest first. Results are cursor-paginated.
     */
    get: operations['listSyncs'];
    put?: never;
    /**
     * Sync a source
     * @description Starts a sync of the source. A website or dataset is read again: its sync is queued, and starts once any sync of the source that is running ends, including the first one that started when it was added. Asking again while one waits queues nothing more. Follow it with the source's `latestSync`.
     *
     *     For a `files` source, set `uploadId` to the upload whose file the source should hold from now on; without it, the source reads its current file again. Its sync starts at once and returns a job ID to poll; the finished job's `result` names the sync and whether it is `held`. While a sync of a `files` source is running, including the first one, the request returns `409` with code `syncInProgress` and leaves the upload for a later request. An `uploadId` whose file never arrived returns `404` with code `uploadNotFound`, and an `uploadId` on a source that isn't `files` returns `422` with code `sourceTypeMismatch`.
     *
     *     Supports the `Idempotency-Key` header.
     */
    post: operations['startSync'];
    delete?: never;
    options?: never;
    head?: never;
    patch?: never;
    trace?: never;
  };
  '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/sources/{sourceId}/syncs/{syncId}': {
    parameters: {
      query?: never;
      header?: never;
      path?: never;
      cookie?: never;
    };
    /**
     * Get a sync
     * @description Returns one sync of a source with its status and counts.
     */
    get: operations['getSync'];
    put?: never;
    post?: never;
    delete?: never;
    options?: never;
    head?: never;
    patch?: never;
    trace?: never;
  };
  '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/sources/{sourceId}/syncs/{syncId}/confirm': {
    parameters: {
      query?: never;
      header?: never;
      path?: never;
      cookie?: never;
    };
    get?: never;
    put?: never;
    /**
     * Confirm a held sync's deletions
     * @description Deletes the documents a `held` sync didn't find, unless a sync has found them since, completes the sync, and starts a refresh of each knowledge base that uses the source, which removes their citations from entries. A sync that isn't `held` returns `409` with code `syncNotHeld`.
     */
    post: operations['confirmSync'];
    delete?: never;
    options?: never;
    head?: never;
    patch?: never;
    trace?: never;
  };
  '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/sources/{sourceId}/syncs/{syncId}/discard': {
    parameters: {
      query?: never;
      header?: never;
      path?: never;
      cookie?: never;
    };
    get?: never;
    put?: never;
    /**
     * Discard a held sync's deletions
     * @description Completes a `held` sync without deleting anything: every document stays as it is. A sync that isn't `held` returns `409` with code `syncNotHeld`.
     */
    post: operations['discardSync'];
    delete?: never;
    options?: never;
    head?: never;
    patch?: never;
    trace?: never;
  };
  '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/sources/{sourceId}/uploads': {
    parameters: {
      query?: never;
      header?: never;
      path?: never;
      cookie?: never;
    };
    get?: never;
    put?: never;
    /**
     * Upload a file to a source
     * @description Returns a single-use signed URL for one file of a `files` source, valid for one hour. To add the file:
     *
     *     1. Send the file in a `PUT` request to `uploadUrl`.
     *     2. Call `POST .../sources/{sourceId}/syncs` with the `uploadId`.
     *
     *     The file can be a single document or a zip, tar or gzip archive of them. It replaces the source's current file when it syncs. An upload no sync takes within 24 hours is deleted. A source that isn't `files` returns `422` with code `sourceTypeMismatch`. When the organization's knowledge bases already hold as many source chunks as its plan allows, returns `403` with code `planLimitReached`. Supports the `Idempotency-Key` header.
     */
    post: operations['startSourceUpload'];
    delete?: never;
    options?: never;
    head?: never;
    patch?: never;
    trace?: never;
  };
  '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/sync': {
    parameters: {
      query?: never;
      header?: never;
      path?: never;
      cookie?: never;
    };
    get?: never;
    put?: never;
    /**
     * Sync every source
     * @description Queues a sync of every website and dataset source, which starts once any sync of the source that is running ends. `files` sources sync when you upload a file. New documents, from these syncs or waiting from earlier ones, are then placed in the knowledge base right away instead of waiting to be placed together with the documents that follow them. This covers the documents that arrive within an hour of the request. A refresh writes a limited number of entries, so a large batch is placed over several refreshes.
     */
    post: operations['syncAllSources'];
    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 Creates or updates the recorded conversation for one thread. `threadId` identifies the conversation within your organization, so saving with the same `threadId` updates the same conversation. Requires Context Editor access or higher.
     *
     *     Each save replaces the stored messages. `metadata`, `sharing`, and the model fields change only when you include them. `tokenUsage` is cumulative: send the usage for one generation call, and the API adds it to the conversation total. Usage is added only when the save changes the messages, so retries don't count it twice.
     *
     *     To report a failure, set `error` on the message where it happened: the tool result for a failed tool call, or the assistant message for a turn that failed instead of answering. The Insights dashboard highlights conversations with a failed turn and counts failed tool calls separately, because agents often recover from them.
     *
     *     The last write for a thread wins, so retries are safe. `sharing` records whether you share telemetry with Sanity: metrics only, or full transcripts.
     */
    put: operations['saveConversation'];
    post?: never;
    /**
     * Delete a conversation
     * @description Deletes the recorded conversation for one thread, including its messages and classification. Requires the same access as recording a conversation.
     *
     *     Saving with the same `threadId` afterwards records a new conversation.
     */
    delete: operations['deleteConversation'];
    options?: never;
    head?: never;
    /**
     * Record a conversation classification
     * @description Records the classification your own model produced for one thread. Send exactly one of these fields:
     *
     *     - `coreMetrics`: the classification result. The API sets `classifiedAt` and clears any recorded failure.
     *     - `classificationError`: why classification failed. Any earlier result stays unchanged.
     *
     *     Requires the same access as recording a conversation. The last write wins, so a new classification replaces the previous one.
     */
    patch: operations['classifyConversation'];
    trace?: never;
  };
  '/{apiVersion}/context/organizations/{organizationId}/mcp': {
    parameters: {
      query?: never;
      header?: never;
      path?: never;
      cookie?: never;
    };
    get?: never;
    put?: never;
    /**
     * Create an MCP endpoint
     * @description Creates an MCP endpoint with a title, a name, and the sources it serves. A source is a knowledge base, identified by its ID (`kb…`), or a dataset, identified as `<projectId>.<datasetName>`. An endpoint can serve any number of knowledge bases and at most one dataset, all at once. A GROQ filter is only kept when the endpoint has a dataset. The name must be unique in your organization, and you can't change it later. Duplicate sources with the same `type` and `id` are combined. The response includes the `url` agents connect to. To list or inspect endpoints, query `sanity.context.mcp` documents with GROQ from your organization's document store. Requires the `sanity.context.mcp.create` grant on the organization, which the Administrator and Developer roles have. Adding a dataset also requires full read access to the dataset and, on its project, the Administrator or Developer role or a custom role that can create datasets.
     *
     *     A taken name returns `409` with code `mcpEndpointNameConflict`. A knowledge base that doesn't exist in the organization returns `422` with code `mcpSourceKnowledgeBaseNotFound`, and an invalid GROQ filter returns `422` with code `invalidGroqFilter`.
     */
    post: operations['createMcpEndpoint'];
    delete?: never;
    options?: never;
    head?: never;
    patch?: never;
    trace?: never;
  };
  '/{apiVersion}/context/organizations/{organizationId}/mcp/{mcpEndpoint}': {
    parameters: {
      query?: never;
      header?: never;
      path?: never;
      cookie?: never;
    };
    get?: never;
    put?: never;
    /**
     * Connect to an MCP endpoint
     * @description Receives Model Context Protocol (MCP) messages from agents over streamable HTTP (JSON-RPC 2.0). Agents send MCP messages in `POST` requests to this URL. `mcpEndpoint` is the permanent URL name of the endpoint. Errors are JSON-RPC error objects, not the standard error response.
     */
    post: operations['serveMcpEndpoint'];
    /**
     * Delete an MCP endpoint
     * @description Deletes the MCP endpoint with that name or ID. Agents connected through it lose access, and its name can be used again. Requires the `sanity.context.mcp.delete` grant on the organization. An unknown endpoint returns `404` with code `mcpEndpointNotFound`.
     */
    delete: operations['deleteMcpEndpoint'];
    options?: never;
    head?: never;
    /**
     * Update an MCP endpoint
     * @description Updates the title, sources, instructions, or GROQ filter of the endpoint with that name or ID. To clear an optional field, set it to `null`. An endpoint can have at most one dataset source, and removing it clears the GROQ filter. You can't change the name, so the endpoint URL stays the same. Requires the `sanity.context.mcp.update` grant on the organization. Adding a dataset source requires full read access to the dataset and, on its project, the Administrator or Developer role or a custom role that can create datasets. Changing the GROQ filter requires the same access for the endpoint's dataset. Sending the current values changes nothing.
     *
     *     An unknown endpoint returns `404` with code `mcpEndpointNotFound`. A knowledge base that doesn't exist in the organization returns `422` with code `mcpSourceKnowledgeBaseNotFound`, and an invalid GROQ filter returns `422` with code `invalidGroqFilter`. If the endpoint changed while the update was in progress, the update returns `409` with code `mcpEndpointEditConflict` and changes nothing. You can safely retry it.
     */
    patch: operations['updateMcpEndpoint'];
    trace?: never;
  };
  '/{apiVersion}/context/organizations/{organizationId}/mcp/{mcpEndpoint}/initial-context': {
    parameters: {
      query?: never;
      header?: never;
      path?: never;
      cookie?: never;
    };
    /**
     * Get an MCP endpoint's initial context
     * @description Returns the same text as the `initial_context` MCP tool, as plain text you can add to a system prompt. `heading_offset` shifts markdown headings down by that many levels. The default is `1`, so `#` becomes `##`.
     */
    get: operations['getMcpEndpointInitialContext'];
    put?: never;
    post?: never;
    delete?: never;
    options?: never;
    head?: never;
    patch?: never;
    trace?: never;
  };
  '/{apiVersion}/context/organizations/{organizationId}/mcp/{mcpEndpoint}/status': {
    parameters: {
      query?: never;
      header?: never;
      path?: never;
      cookie?: never;
    };
    /**
     * Check an MCP endpoint
     * @description Checks whether the endpoint is ready for agents, and whether your credentials can read what it serves. A failed check returns `200` with that check's `ok` set to `false`, so you can see every problem at once. `ready` summarizes the result. Returns `404` if the endpoint doesn't exist.
     */
    get: operations['getMcpEndpointStatus'];
    put?: never;
    post?: never;
    delete?: never;
    options?: never;
    head?: never;
    patch?: never;
    trace?: never;
  };
}
interface components {
  schemas: {
    /** @description The body of every error response. Branch on `code`, a stable identifier; `message` is human-readable and can change. */
    ApiErrorBody: {
      statusCode: number;
      error: string;
      /** @enum {string} */
      code: 'knowledgeBaseNotFound' | 'jobNotFound' | 'sourceNotFound' | 'documentNotFound' | 'syncNotFound' | 'uploadNotFound' | 'chunkNotFound' | 'entryNotFound' | 'entryDocumentInvalid' | 'revisionNotFound' | 'revisionNotBrowsable' | 'revisionNotRestorable' | 'buildDecisionsNotFound' | 'issueNotFound' | 'instructionNotFound' | 'routeNotFound' | 'buildInFlight' | 'knowledgeBaseIsDraft' | 'webSourceRootConflict' | 'webSourceRootLimitExceeded' | 'preferenceLimitExceeded' | 'syncInProgress' | 'syncNotHeld' | 'sourceDeletionsUnconfirmed' | 'documentNotConverted' | 'documentNotStored' | 'documentInvalidState' | 'uploadTooLarge' | 'payloadTooLarge' | 'validationError' | 'unsupportedMediaType' | 'sourceTypeMismatch' | 'issueNotResolvable' | 'issueNotAutoApplicable' | 'issueDocumentInvalid' | 'issueTransitionConflict' | 'draftTitleRequired' | 'datasetSourceEmpty' | 'datasetAlreadyBound' | 'datasetSourceNotBound' | 'datasetReadAccessDenied' | 'invalidGroqFilter' | 'mcpEndpointNotFound' | 'mcpEndpointNameConflict' | 'mcpEndpointEditConflict' | 'mcpSourceKnowledgeBaseNotFound' | 'mcpEndpointNotServable' | 'conversationNotFound' | 'missingCredential' | 'invalidCredential' | 'missingOrganization' | 'organizationAccessDenied' | 'knowledgeBaseAccessDenied' | 'contextGrantRequired' | 'knowledgeBaseCreateAccessDenied' | 'mcpEndpointManageAccessDenied' | 'insightsWriteAccessDenied' | 'sharedOrgPreferencesWriteAccessDenied' | 'projectAdminRequired' | 'accessCheckFailed' | 'planLimitReached' | 'featureNotInPlan' | 'buildCapReached' | 'tooManyConnections' | 'jobsUnavailable' | 'contextStoreUnavailable' | 'crawlingUnavailable' | 'crawlPreviewUnavailable' | 'instructionDraftFailed' | 'instructionScopeVanished' | 'purposeDraftFailed' | 'noPurposeEvidence' | 'idempotencyKeyReused' | 'idempotencyRequestInFlight' | 'idempotencyParamsMismatch' | 'internal';
      message: string;
      fields?: {
        [key: string]: unknown;
      };
    };
    /** @description A `sanity.context.conversation` document: one agent conversation and its classification, stored in your organization's document store. No endpoint returns this document. Use this schema to type GROQ query results. To record conversations, use the conversations endpoints. */
    ConversationDoc: {
      /** @description The document ID. */
      _id: string;
      /** @description The document revision. It changes on every write. */
      _rev: string;
      /**
       * Format: date-time
       * @description When the document was created, as an ISO 8601 timestamp.
       */
      _createdAt: string;
      /**
       * Format: date-time
       * @description When the document was last changed, as an ISO 8601 timestamp.
       */
      _updatedAt: string;
      /**
       * @description The document type. Always `sanity.context.conversation`.
       * @enum {string}
       */
      _type: 'sanity.context.conversation';
      /**
       * @description The version of the document shape. Currently `1`.
       * @enum {number}
       */
      schemaVersion: 1;
      /** @description The ID of the organization that owns the conversation. Filter on it in every query, because the document store also holds documents from other features. */
      organizationId: string;
      /** @description Your identifier for the conversation thread, unique within the organization. It is the `threadId` in the conversations endpoint path and determines the document `_id`. */
      threadId: string;
      /** @description Tags that describe the conversation, such as `mcpEndpoints`, `app`, and `environment`. Filter on them in GROQ queries. `null` until a save includes `metadata`. */
      metadata: {
        [key: string]: string | string[];
      } | null;
      /**
       * Format: date-time
       * @description When the API received the first save for this thread, as an ISO 8601 timestamp.
       */
      startedAt: string;
      /**
       * Format: date-time
       * @description When the conversation was last saved, as an ISO 8601 timestamp.
       */
      messagesUpdatedAt: string;
      /** @description The conversation transcript, in order. Each save replaces it. */
      messages: {
        /**
         * @description Who sent the message. `user` is the person talking to the agent, `assistant` is the agent, `system` is a system prompt, and `tool` is a tool call or tool result.
         * @enum {string}
         */
        role: 'user' | 'assistant' | 'system' | 'tool';
        /**
         * @description The message text. `null` when the message has no text, such as a tool call.
         * @default null
         */
        content: string | null;
        /**
         * @description The name of the tool for a `tool` message. `null` on other messages.
         * @default null
         */
        toolName: string | null;
        /**
         * @description The kind of `tool` message. `call` is the agent calling the tool, and `result` is what the tool returned. `null` on other messages.
         * @default null
         * @enum {string|null}
         */
        toolType: 'call' | 'result' | null;
        /**
         * @description Why this step failed, including any stack trace. Set it on the tool result for a failed tool call, or on the assistant message for a turn that failed instead of answering. `null` when the step succeeded.
         * @default null
         */
        error: string | null;
        /**
         * Format: date-time
         * @description When the API first received this message, as an ISO 8601 timestamp. The API sets it. Resending an unchanged message at the same position keeps its timestamp. `null` for messages recorded before timestamps existed.
         * @default null
         */
        timestamp: string | null;
      }[];
      /** @description The provider of the model the agent used. `null` until a save includes `modelProvider`. */
      modelProvider: string | null;
      /** @description The ID of the model the agent used. `null` until a save includes `modelId`. */
      modelId: string | null;
      /** @description The running total of token usage for the conversation. `null` until a save includes `tokenUsage`. */
      tokenUsage: {
        /** @description The number of input tokens. */
        inputTokens?: number;
        /** @description The number of output tokens. */
        outputTokens?: number;
        /** @description The total number of tokens. */
        totalTokens?: number;
      } | null;
      /** @description The latest classification result. `null` until you record one. */
      coreMetrics: {
        /** @description How well the agent resolved the user's needs, from 1 to 10. */
        successScore?: number;
        /**
         * @description The overall sentiment of the conversation.
         * @enum {string}
         */
        sentiment?: 'positive' | 'neutral' | 'negative';
        /** @description Topics the agent couldn't answer because it lacked content. */
        contentGaps?: string[];
      } | null;
      /**
       * Format: date-time
       * @description When the latest classification result was recorded, as an ISO 8601 timestamp. The API sets it. `null` until you record a result.
       */
      classifiedAt: string | null;
      /** @description Why your classifier couldn't classify the conversation. `null` when no failure is recorded. Recording a result clears it. */
      classificationError: string | null;
      /**
       * @description Your choice to share conversation telemetry with Sanity. `null` until a save includes `sharing`.
       * @default null
       */
      sharing: {
        /** @description Whether to share classification metrics with Sanity: scores, sentiment, content gap counts, message counts and sizes, tool names, and model and token usage. Message content is not included. */
        metrics?: boolean;
        /** @description Whether to share full conversation transcripts with Sanity. When `true`, the API also sets `metrics` to `true`. */
        conversations?: boolean;
        /** @description How the Sanity team can reach you about your agent, such as an email address or a Discord handle. */
        contact?: string;
      } | null;
      /**
       * Format: date-time
       * @description When the conversation was last saved, edited or classified through the API, as an ISO 8601 timestamp. Unlike `_updatedAt`, no other write to the document changes it.
       */
      updatedAt?: string;
    };
    /** @description A `sanity.context.entry` document: one entry in a knowledge base outline, stored in your organization's document store. No endpoint returns this document. Use this schema to type GROQ query results. */
    EntryDoc: {
      /** @description The document ID. */
      _id: string;
      /** @description The document revision. It changes on every write. */
      _rev: string;
      /**
       * Format: date-time
       * @description When the document was created, as an ISO 8601 timestamp.
       */
      _createdAt: string;
      /**
       * Format: date-time
       * @description When the document was last changed, as an ISO 8601 timestamp.
       */
      _updatedAt: string;
      /** @description The ID (`kb…`) of the knowledge base this document belongs to. */
      knowledgeBaseId: string;
      /**
       * @description The document type. Always `sanity.context.entry`.
       * @enum {string}
       */
      _type: 'sanity.context.entry';
      /** @description The version of the document shape. Currently `3`. */
      schemaVersion: number;
      /** @description The ID of the build that last wrote this entry's content. An unchanged entry keeps its earlier value across builds. */
      revisionId: string;
      /** @description The entry's slash-delimited path, such as `docs/api/webhooks`. Order entries by `path` to get the knowledge base outline. */
      path: string;
      /** @description The entry title. */
      title: string;
      /** @description The titles of the sections above the entry, top level first, one for each `path` segment before the last. For `groq/functions/math` it holds the titles of `groq` and `groq/functions`. Absent when the entry was written before section titles were recorded. */
      sectionTitles?: string[];
      /** @description A summary of the entry. `scope` is what the entry covers, and `excludes` is what it does not cover. `neighbors` lists the paths of related entries. */
      tldr?: {
        scope: string;
        excludes: string;
        neighbors?: string[];
      };
      /** @description The entry content in Markdown, with inline `[^key]` footnote markers. The text after `^` in each marker is the `_key` of one item in `citations`. Absent when the entry has no content of its own, such as a `virtual` entry. */
      body?: string;
      /** @description The H2 and H3 heading titles in `body`. Absent when the entry has no `body`. */
      topicHeadings?: string[];
      /** @description The passages that back this entry, one item per quoted passage, in the order the body first uses them. A document cited twice with different quotes has two items. Empty when the entry has no `body` or the body cites nothing. */
      citations: {
        /** @description Stable ID of this citation: 10 lowercase letters and digits. An entry body points to it with a `[^key]` marker. */
        _key: string;
        /** @enum {string} */
        _type: 'sanity.context.citation';
        /** @description ID of the document the quote comes from. Read it with `GET .../documents/{documentId}/content`. */
        documentId: string;
        /** @description ID of the chunk of the document that holds the quote's first line. A chunk is the text under one heading, and keeps its ID across versions of the document while its headings stay the same. */
        chunkId: string;
        /** @description The document's name when the entry was written. */
        title: string;
        /** @description Where the document lives on the web. Absent for uploaded files and datasets. */
        url?: string;
        /** @description The passage from the document that backs the claims, copied word for word. */
        quote: string;
        /** @description Up to 32 characters of document text just before the quote, to tell repeats apart. */
        prefix: string;
        /** @description Up to 32 characters of document text just after the quote, to tell repeats apart. */
        suffix: string;
        /** @description First line of the quote in the document, counting from 1. Line numbers match `GET .../documents/{documentId}/content`. A hint: the quote is the stable locator. */
        lineStart: number;
        /** @description Last line of the quote, inclusive. */
        lineEnd: number;
        /** @description The statements in the entry body that this passage backs. */
        claims: string[];
      }[];
      /** @description The IDs of every document the entry was built from, cited or not, sorted. Every citation `documentId` is in this list. */
      documentIds: string[];
      /**
       * @description The entry state. Builds currently write only two values: `virtual` for an entry that groups child entries and has no `body`, and `filled` for an entry with a written `body`. The other values are reserved.
       * @enum {string}
       */
      status: 'virtual' | 'outlined' | 'filled' | 'stale' | 'generation_failed';
      /** @description When the build that last wrote this entry's content ran, as an ISO 8601 timestamp. */
      generatedAt: string;
      /**
       * Format: date-time
       * @description When the entry's content last changed, by a build, a restore or a source being removed. A build that writes the same content leaves it alone, as an ISO 8601 timestamp. Unlike `_updatedAt`, no other write to the document changes it.
       */
      updatedAt?: string;
    };
    /** @description A `sanity.context.instruction` document: a standing instruction that steers every build, stored in your organization's document store. No endpoint returns this document. Use this schema to type GROQ query results. To change instructions, use the instructions endpoints. */
    InstructionDoc: {
      /** @description The document ID. */
      _id: string;
      /** @description The document revision. It changes on every write. */
      _rev: string;
      /**
       * Format: date-time
       * @description When the document was created, as an ISO 8601 timestamp.
       */
      _createdAt: string;
      /**
       * Format: date-time
       * @description When the document was last changed, as an ISO 8601 timestamp.
       */
      _updatedAt: string;
      /** @description The ID (`kb…`) of the knowledge base this document belongs to. */
      knowledgeBaseId: string;
      /**
       * @description The document type. Always `sanity.context.instruction`.
       * @enum {string}
       */
      _type: 'sanity.context.instruction';
      /**
       * @description The version of the document shape. Currently `2`. An instruction without the current version doesn't appear in lists and doesn't affect builds.
       * @enum {number}
       */
      schemaVersion: 2;
      /** @description The instruction, in plain language. Builds follow it over the raw sources. */
      statement: string;
      /** @description The documents the instruction is tied to. The instruction affects the entries built from these documents. The API always sets at least one document. When `null`, the instruction isn't tied to any document and doesn't affect builds. */
      scopeDocuments: {
        /** @description A unique key for this item in the array. It matches `documentId`. */
        _key: string;
        /** @description The ID of the document the instruction is tied to. */
        documentId: string;
        /** @description The document's content hash when the instruction was last checked against it. When the document's content changes, the instruction is checked again. */
        contentHash: string;
      }[] | null;
      /**
       * @description The instruction state. `active` instructions apply to every build. `archived` instructions don't apply: a document changed and no longer supports the instruction. Editing an archived instruction makes it `active` again.
       * @enum {string}
       */
      status: 'active' | 'archived';
      /** @description When the instruction was archived, as an ISO 8601 timestamp. `null` while `active`. */
      archivedAt: string | null;
      /** @description Why the instruction was archived. `null` while `active`. */
      archivedReason: string | null;
      /**
       * Format: date-time
       * @description When the instruction was last created or changed through the API, or archived or re-evaluated by a refresh, as an ISO 8601 timestamp. Unlike `_updatedAt`, no other write to the document changes it.
       */
      updatedAt?: string;
      /**
       * @description Where the instruction came from. `conflict` means it was created when you resolved a conflict issue.
       * @enum {string}
       */
      origin: 'conflict';
      /** @description The `_id` of the conflict issue this instruction resolved. Reopening that issue deletes this instruction. */
      sourceIssueId: string;
    } | {
      /** @description The document ID. */
      _id: string;
      /** @description The document revision. It changes on every write. */
      _rev: string;
      /**
       * Format: date-time
       * @description When the document was created, as an ISO 8601 timestamp.
       */
      _createdAt: string;
      /**
       * Format: date-time
       * @description When the document was last changed, as an ISO 8601 timestamp.
       */
      _updatedAt: string;
      /** @description The ID (`kb…`) of the knowledge base this document belongs to. */
      knowledgeBaseId: string;
      /**
       * @description The document type. Always `sanity.context.instruction`.
       * @enum {string}
       */
      _type: 'sanity.context.instruction';
      /**
       * @description The version of the document shape. Currently `2`. An instruction without the current version doesn't appear in lists and doesn't affect builds.
       * @enum {number}
       */
      schemaVersion: 2;
      /** @description The instruction, in plain language. Builds follow it over the raw sources. */
      statement: string;
      /** @description The documents the instruction is tied to. The instruction affects the entries built from these documents. The API always sets at least one document. When `null`, the instruction isn't tied to any document and doesn't affect builds. */
      scopeDocuments: {
        /** @description A unique key for this item in the array. It matches `documentId`. */
        _key: string;
        /** @description The ID of the document the instruction is tied to. */
        documentId: string;
        /** @description The document's content hash when the instruction was last checked against it. When the document's content changes, the instruction is checked again. */
        contentHash: string;
      }[] | null;
      /**
       * @description The instruction state. `active` instructions apply to every build. `archived` instructions don't apply: a document changed and no longer supports the instruction. Editing an archived instruction makes it `active` again.
       * @enum {string}
       */
      status: 'active' | 'archived';
      /** @description When the instruction was archived, as an ISO 8601 timestamp. `null` while `active`. */
      archivedAt: string | null;
      /** @description Why the instruction was archived. `null` while `active`. */
      archivedReason: string | null;
      /**
       * Format: date-time
       * @description When the instruction was last created or changed through the API, or archived or re-evaluated by a refresh, as an ISO 8601 timestamp. Unlike `_updatedAt`, no other write to the document changes it.
       */
      updatedAt?: string;
      /**
       * @description Where the instruction came from. `human` means it was created directly through the API or the dashboard.
       * @enum {string}
       */
      origin: 'human';
      /**
       * @description Always `null` for a `human` instruction.
       * @enum {string|null}
       */
      sourceIssueId: null;
    };
    /** @description A `sanity.context.issue` document: a build finding waiting for triage, stored in your organization's document store. No endpoint returns this document. Use this schema to type GROQ query results and Sanity Function filters. To change an issue's status, use the issues endpoints. Only a `conflict` issue can have a non-null `resolution`. */
    IssueDoc: {
      /** @description The document ID. */
      _id: string;
      /** @description The document revision. It changes on every write. */
      _rev: string;
      /**
       * Format: date-time
       * @description When the document was created, as an ISO 8601 timestamp.
       */
      _createdAt: string;
      /**
       * Format: date-time
       * @description When the document was last changed, as an ISO 8601 timestamp.
       */
      _updatedAt: string;
      /** @description The ID (`kb…`) of the knowledge base this document belongs to. */
      knowledgeBaseId: string;
      /**
       * @description The document type. Always `sanity.context.issue`.
       * @enum {string}
       */
      _type: 'sanity.context.issue';
      /**
       * @description The version of the document shape. Currently `2`.
       * @enum {number}
       */
      schemaVersion: 2;
      /** @description What an issue found. The shape depends on `kind`. */
      content: {
        /**
         * @description How serious the issue is. `critical`: content is wrong or missing in a way that can mislead an agent. `suggestion`: a change that improves quality.
         * @enum {string}
         */
        severity: 'critical' | 'suggestion';
        /** @description Path of the entry the issue is about, or `*` when it applies to the whole knowledge base. */
        scopePath: string;
        /** @description What the problem is, in one or two sentences. */
        issue: string;
        /** @description What to do to fix the issue. */
        suggestedFix: string;
        /**
         * @description The issue type. `conflict` means two or more positions disagree on the same fact, and you choose which one is correct.
         * @enum {string}
         */
        kind: 'conflict';
        /** @description A key naming the disputed fact, such as `free_tier.request_limit`. It never includes the disputed value, so every side shares it. */
        claimKey: string;
        /** @description One sentence that explains the question, when it needs one. */
        context?: string;
        /** @description The conflicting positions, at least two. To resolve the conflict, pass the index of one side as `resolution`. */
        sides: {
          /** @description The position as a self-contained sentence. This is the option you choose from. */
          claim: string;
          /** @description The disputed value on its own, such as `10,000/month`, without the sentence. */
          value?: string;
          /** @description Paths of the entries that state this position. */
          entryPaths?: string[];
          /** @description IDs of the documents that directly back this position. */
          documentIds?: string[];
          /** @description The documents that state this value, by the names you know them by. */
          where?: string;
          /** @description Quotes from the documents that state this value, copied word for word and checked against each document. A document whose wording could not be checked has none. */
          citations?: {
            /** @description Stable ID of this citation: 10 lowercase letters and digits. An entry body points to it with a `[^key]` marker. */
            _key: string;
            /** @enum {string} */
            _type: 'sanity.context.citation';
            /** @description ID of the document the quote comes from. Read it with `GET .../documents/{documentId}/content`. */
            documentId: string;
            /** @description ID of the chunk of the document that holds the quote's first line. A chunk is the text under one heading, and keeps its ID across versions of the document while its headings stay the same. */
            chunkId: string;
            /** @description The document's name when the entry was written. */
            title: string;
            /** @description Where the document lives on the web. Absent for uploaded files and datasets. */
            url?: string;
            /** @description The passage from the document that backs the claims, copied word for word. */
            quote: string;
            /** @description Up to 32 characters of document text just before the quote, to tell repeats apart. */
            prefix: string;
            /** @description Up to 32 characters of document text just after the quote, to tell repeats apart. */
            suffix: string;
            /** @description First line of the quote in the document, counting from 1. Line numbers match `GET .../documents/{documentId}/content`. A hint: the quote is the stable locator. */
            lineStart: number;
            /** @description Last line of the quote, inclusive. */
            lineEnd: number;
          }[];
          /**
           * @description How much weight the sources behind this position carry. `primary`: your own content, such as uploaded files and pages on your own site. `secondary`: other sources. `community`: forums and Q&A sites.
           * @enum {string}
           */
          authority?: 'primary' | 'secondary' | 'community';
        }[];
        /** @description Index in `sides` of the suggested side, when there is one. It is only a hint: nothing is chosen until you resolve the issue. */
        suggested?: number;
      } | {
        /**
         * @description How serious the issue is. `critical`: content is wrong or missing in a way that can mislead an agent. `suggestion`: a change that improves quality.
         * @enum {string}
         */
        severity: 'critical' | 'suggestion';
        /** @description Path of the entry the issue is about, or `*` when it applies to the whole knowledge base. */
        scopePath: string;
        /** @description What the problem is, in one or two sentences. */
        issue: string;
        /** @description What to do to fix the issue. */
        suggestedFix: string;
        /**
         * @description The issue type. `update_required` means an entry is out of date with its sources or contradicts an instruction, and needs a rewrite.
         * @enum {string}
         */
        kind: 'update_required';
        /** @description IDs of the documents that led to the issue. */
        citedDocumentIds?: string[];
        /** @description A key naming the specific finding, when the check that found it sets one. */
        claimKey?: string;
        /** @description Paths of the entries the issue involves, when it spans more than one entry. */
        involvedScopes?: string[];
      };
      /** @description An identity for the finding that doesn't depend on its wording. It determines the issue's `_id`, so a reworded finding updates the same issue. */
      fingerprint: string;
      /** @description The ID of the build that filed this issue. `null` when the issue was filed outside a build, such as when removing a document leaves an entry without documents. */
      revisionId: string | null;
      /**
       * Format: date-time
       * @description When the issue was last filed, refiled or triaged, as an ISO 8601 timestamp. Unlike `_updatedAt`, no other write to the document changes it.
       */
      updatedAt?: string;
      /**
       * @description The issue status. `open` means it is waiting for triage.
       * @enum {string}
       */
      status: 'open';
      /**
       * @description Always `null` while the issue is `open`.
       * @enum {string|null}
       */
      resolution: null;
      /**
       * @description Always `null` while the issue is `open`.
       * @enum {string|null}
       */
      resolvedAt: null;
      /**
       * @description Always `null` while the issue is `open`.
       * @enum {string|null}
       */
      resolvedBy: null;
    } | {
      /** @description The document ID. */
      _id: string;
      /** @description The document revision. It changes on every write. */
      _rev: string;
      /**
       * Format: date-time
       * @description When the document was created, as an ISO 8601 timestamp.
       */
      _createdAt: string;
      /**
       * Format: date-time
       * @description When the document was last changed, as an ISO 8601 timestamp.
       */
      _updatedAt: string;
      /** @description The ID (`kb…`) of the knowledge base this document belongs to. */
      knowledgeBaseId: string;
      /**
       * @description The document type. Always `sanity.context.issue`.
       * @enum {string}
       */
      _type: 'sanity.context.issue';
      /**
       * @description The version of the document shape. Currently `2`.
       * @enum {number}
       */
      schemaVersion: 2;
      /** @description What an issue found. The shape depends on `kind`. */
      content: {
        /**
         * @description How serious the issue is. `critical`: content is wrong or missing in a way that can mislead an agent. `suggestion`: a change that improves quality.
         * @enum {string}
         */
        severity: 'critical' | 'suggestion';
        /** @description Path of the entry the issue is about, or `*` when it applies to the whole knowledge base. */
        scopePath: string;
        /** @description What the problem is, in one or two sentences. */
        issue: string;
        /** @description What to do to fix the issue. */
        suggestedFix: string;
        /**
         * @description The issue type. `conflict` means two or more positions disagree on the same fact, and you choose which one is correct.
         * @enum {string}
         */
        kind: 'conflict';
        /** @description A key naming the disputed fact, such as `free_tier.request_limit`. It never includes the disputed value, so every side shares it. */
        claimKey: string;
        /** @description One sentence that explains the question, when it needs one. */
        context?: string;
        /** @description The conflicting positions, at least two. To resolve the conflict, pass the index of one side as `resolution`. */
        sides: {
          /** @description The position as a self-contained sentence. This is the option you choose from. */
          claim: string;
          /** @description The disputed value on its own, such as `10,000/month`, without the sentence. */
          value?: string;
          /** @description Paths of the entries that state this position. */
          entryPaths?: string[];
          /** @description IDs of the documents that directly back this position. */
          documentIds?: string[];
          /** @description The documents that state this value, by the names you know them by. */
          where?: string;
          /** @description Quotes from the documents that state this value, copied word for word and checked against each document. A document whose wording could not be checked has none. */
          citations?: {
            /** @description Stable ID of this citation: 10 lowercase letters and digits. An entry body points to it with a `[^key]` marker. */
            _key: string;
            /** @enum {string} */
            _type: 'sanity.context.citation';
            /** @description ID of the document the quote comes from. Read it with `GET .../documents/{documentId}/content`. */
            documentId: string;
            /** @description ID of the chunk of the document that holds the quote's first line. A chunk is the text under one heading, and keeps its ID across versions of the document while its headings stay the same. */
            chunkId: string;
            /** @description The document's name when the entry was written. */
            title: string;
            /** @description Where the document lives on the web. Absent for uploaded files and datasets. */
            url?: string;
            /** @description The passage from the document that backs the claims, copied word for word. */
            quote: string;
            /** @description Up to 32 characters of document text just before the quote, to tell repeats apart. */
            prefix: string;
            /** @description Up to 32 characters of document text just after the quote, to tell repeats apart. */
            suffix: string;
            /** @description First line of the quote in the document, counting from 1. Line numbers match `GET .../documents/{documentId}/content`. A hint: the quote is the stable locator. */
            lineStart: number;
            /** @description Last line of the quote, inclusive. */
            lineEnd: number;
          }[];
          /**
           * @description How much weight the sources behind this position carry. `primary`: your own content, such as uploaded files and pages on your own site. `secondary`: other sources. `community`: forums and Q&A sites.
           * @enum {string}
           */
          authority?: 'primary' | 'secondary' | 'community';
        }[];
        /** @description Index in `sides` of the suggested side, when there is one. It is only a hint: nothing is chosen until you resolve the issue. */
        suggested?: number;
      } | {
        /**
         * @description How serious the issue is. `critical`: content is wrong or missing in a way that can mislead an agent. `suggestion`: a change that improves quality.
         * @enum {string}
         */
        severity: 'critical' | 'suggestion';
        /** @description Path of the entry the issue is about, or `*` when it applies to the whole knowledge base. */
        scopePath: string;
        /** @description What the problem is, in one or two sentences. */
        issue: string;
        /** @description What to do to fix the issue. */
        suggestedFix: string;
        /**
         * @description The issue type. `update_required` means an entry is out of date with its sources or contradicts an instruction, and needs a rewrite.
         * @enum {string}
         */
        kind: 'update_required';
        /** @description IDs of the documents that led to the issue. */
        citedDocumentIds?: string[];
        /** @description A key naming the specific finding, when the check that found it sets one. */
        claimKey?: string;
        /** @description Paths of the entries the issue involves, when it spans more than one entry. */
        involvedScopes?: string[];
      };
      /** @description An identity for the finding that doesn't depend on its wording. It determines the issue's `_id`, so a reworded finding updates the same issue. */
      fingerprint: string;
      /** @description The ID of the build that filed this issue. `null` when the issue was filed outside a build, such as when removing a document leaves an entry without documents. */
      revisionId: string | null;
      /**
       * Format: date-time
       * @description When the issue was last filed, refiled or triaged, as an ISO 8601 timestamp. Unlike `_updatedAt`, no other write to the document changes it.
       */
      updatedAt?: string;
      /**
       * @description The issue status. `accepted` means the issue was resolved or its fix applied.
       * @enum {string}
       */
      status: 'accepted';
      /**
       * Format: date-time
       * @description When the issue left `open`, as an ISO 8601 timestamp.
       */
      resolvedAt: string;
      /** @description Who triaged the issue. `null` while the issue is open, or when the caller could not be identified. */
      resolvedBy: {
        /** @description The ID of the Sanity user or robot token that triaged the issue. */
        id: string;
        /**
         * @description What triaged the issue. `user` is a person, and `robot` is a robot token.
         * @enum {string}
         */
        kind: 'user' | 'robot';
      } | null;
      /** @description The index of the chosen side in `content.sides`. For a conflict on one entry, index `0` is the entry's own position. `null` when the fix was applied without choosing a side. */
      resolution: number | null;
    } | {
      /** @description The document ID. */
      _id: string;
      /** @description The document revision. It changes on every write. */
      _rev: string;
      /**
       * Format: date-time
       * @description When the document was created, as an ISO 8601 timestamp.
       */
      _createdAt: string;
      /**
       * Format: date-time
       * @description When the document was last changed, as an ISO 8601 timestamp.
       */
      _updatedAt: string;
      /** @description The ID (`kb…`) of the knowledge base this document belongs to. */
      knowledgeBaseId: string;
      /**
       * @description The document type. Always `sanity.context.issue`.
       * @enum {string}
       */
      _type: 'sanity.context.issue';
      /**
       * @description The version of the document shape. Currently `2`.
       * @enum {number}
       */
      schemaVersion: 2;
      /** @description What an issue found. The shape depends on `kind`. */
      content: {
        /**
         * @description How serious the issue is. `critical`: content is wrong or missing in a way that can mislead an agent. `suggestion`: a change that improves quality.
         * @enum {string}
         */
        severity: 'critical' | 'suggestion';
        /** @description Path of the entry the issue is about, or `*` when it applies to the whole knowledge base. */
        scopePath: string;
        /** @description What the problem is, in one or two sentences. */
        issue: string;
        /** @description What to do to fix the issue. */
        suggestedFix: string;
        /**
         * @description The issue type. `conflict` means two or more positions disagree on the same fact, and you choose which one is correct.
         * @enum {string}
         */
        kind: 'conflict';
        /** @description A key naming the disputed fact, such as `free_tier.request_limit`. It never includes the disputed value, so every side shares it. */
        claimKey: string;
        /** @description One sentence that explains the question, when it needs one. */
        context?: string;
        /** @description The conflicting positions, at least two. To resolve the conflict, pass the index of one side as `resolution`. */
        sides: {
          /** @description The position as a self-contained sentence. This is the option you choose from. */
          claim: string;
          /** @description The disputed value on its own, such as `10,000/month`, without the sentence. */
          value?: string;
          /** @description Paths of the entries that state this position. */
          entryPaths?: string[];
          /** @description IDs of the documents that directly back this position. */
          documentIds?: string[];
          /** @description The documents that state this value, by the names you know them by. */
          where?: string;
          /** @description Quotes from the documents that state this value, copied word for word and checked against each document. A document whose wording could not be checked has none. */
          citations?: {
            /** @description Stable ID of this citation: 10 lowercase letters and digits. An entry body points to it with a `[^key]` marker. */
            _key: string;
            /** @enum {string} */
            _type: 'sanity.context.citation';
            /** @description ID of the document the quote comes from. Read it with `GET .../documents/{documentId}/content`. */
            documentId: string;
            /** @description ID of the chunk of the document that holds the quote's first line. A chunk is the text under one heading, and keeps its ID across versions of the document while its headings stay the same. */
            chunkId: string;
            /** @description The document's name when the entry was written. */
            title: string;
            /** @description Where the document lives on the web. Absent for uploaded files and datasets. */
            url?: string;
            /** @description The passage from the document that backs the claims, copied word for word. */
            quote: string;
            /** @description Up to 32 characters of document text just before the quote, to tell repeats apart. */
            prefix: string;
            /** @description Up to 32 characters of document text just after the quote, to tell repeats apart. */
            suffix: string;
            /** @description First line of the quote in the document, counting from 1. Line numbers match `GET .../documents/{documentId}/content`. A hint: the quote is the stable locator. */
            lineStart: number;
            /** @description Last line of the quote, inclusive. */
            lineEnd: number;
          }[];
          /**
           * @description How much weight the sources behind this position carry. `primary`: your own content, such as uploaded files and pages on your own site. `secondary`: other sources. `community`: forums and Q&A sites.
           * @enum {string}
           */
          authority?: 'primary' | 'secondary' | 'community';
        }[];
        /** @description Index in `sides` of the suggested side, when there is one. It is only a hint: nothing is chosen until you resolve the issue. */
        suggested?: number;
      } | {
        /**
         * @description How serious the issue is. `critical`: content is wrong or missing in a way that can mislead an agent. `suggestion`: a change that improves quality.
         * @enum {string}
         */
        severity: 'critical' | 'suggestion';
        /** @description Path of the entry the issue is about, or `*` when it applies to the whole knowledge base. */
        scopePath: string;
        /** @description What the problem is, in one or two sentences. */
        issue: string;
        /** @description What to do to fix the issue. */
        suggestedFix: string;
        /**
         * @description The issue type. `update_required` means an entry is out of date with its sources or contradicts an instruction, and needs a rewrite.
         * @enum {string}
         */
        kind: 'update_required';
        /** @description IDs of the documents that led to the issue. */
        citedDocumentIds?: string[];
        /** @description A key naming the specific finding, when the check that found it sets one. */
        claimKey?: string;
        /** @description Paths of the entries the issue involves, when it spans more than one entry. */
        involvedScopes?: string[];
      };
      /** @description An identity for the finding that doesn't depend on its wording. It determines the issue's `_id`, so a reworded finding updates the same issue. */
      fingerprint: string;
      /** @description The ID of the build that filed this issue. `null` when the issue was filed outside a build, such as when removing a document leaves an entry without documents. */
      revisionId: string | null;
      /**
       * Format: date-time
       * @description When the issue was last filed, refiled or triaged, as an ISO 8601 timestamp. Unlike `_updatedAt`, no other write to the document changes it.
       */
      updatedAt?: string;
      /**
       * @description The issue status. `rejected` means the issue was dismissed. Dismissal is final.
       * @enum {string}
       */
      status: 'rejected';
      /**
       * Format: date-time
       * @description When the issue left `open`, as an ISO 8601 timestamp.
       */
      resolvedAt: string;
      /** @description Who triaged the issue. `null` while the issue is open, or when the caller could not be identified. */
      resolvedBy: {
        /** @description The ID of the Sanity user or robot token that triaged the issue. */
        id: string;
        /**
         * @description What triaged the issue. `user` is a person, and `robot` is a robot token.
         * @enum {string}
         */
        kind: 'user' | 'robot';
      } | null;
      /**
       * @description Always `null`, because a dismissal chooses no side.
       * @enum {string|null}
       */
      resolution: null;
    };
    /** @description A `sanity.context.mcp` document: the configuration of one MCP endpoint, stored in your organization's document store. No endpoint returns this document. Use this schema to type GROQ query results and Sanity Function filters. Manage MCP endpoints in the Context dashboard. */
    McpDoc: {
      /** @description The document ID. */
      _id: string;
      /** @description The document revision. It changes on every write. */
      _rev: string;
      /**
       * Format: date-time
       * @description When the document was created, as an ISO 8601 timestamp.
       */
      _createdAt: string;
      /**
       * Format: date-time
       * @description When the document was last changed, as an ISO 8601 timestamp.
       */
      _updatedAt: string;
      /**
       * @description The document type. Always `sanity.context.mcp`.
       * @enum {string}
       */
      _type: 'sanity.context.mcp';
      /**
       * @description The version of the document shape. Currently `1`.
       * @enum {number}
       */
      schemaVersion: 1;
      /** @description The ID of the organization that owns the MCP endpoint. Filter on it in every query, because the document store also holds documents from other features. */
      organizationId: string;
      /** @description The MCP endpoint's public ID (`mcp…`). It is set once at creation, never changes, and determines the document `_id`. */
      publicId: string;
      /** @description The MCP endpoint's display name. You can change it at any time. */
      title: string;
      /** @description The MCP endpoint's name in its URL, in lowercase kebab case such as `my-endpoint`. It is unique within the organization and can't change after creation. */
      name: string;
      /** @description The content sources the MCP endpoint serves, all at once. Each source appears once, there is at most one `dataset` source, and the order has no meaning. With no sources, agents can't connect until one is added. */
      sources: ({
        /**
         * @description The source type. `knowledge-base` serves a whole knowledge base.
         * @enum {string}
         */
        type: 'knowledge-base';
        /** @description The knowledge base ID (`kb…`). */
        id: string;
      } | {
        /**
         * @description The source type. `dataset` serves documents from a Sanity dataset, limited by the MCP endpoint's `groqFilter` when set.
         * @enum {string}
         */
        type: 'dataset';
        /** @description The dataset, as `<projectId>.<datasetName>`. */
        id: string;
        /**
         * @description The studio workspace whose schema agents use, by name. `null` uses the studio's first workspace.
         * @default null
         */
        workspace: string | null;
        /**
         * @description The perspective agents query the dataset with: `published`, `drafts`, or `raw`. `null` uses `published`.
         * @default null
         * @enum {string|null}
         */
        perspective: 'published' | 'drafts' | 'raw' | null;
        /**
         * @description Whether agents can use semantic search on the dataset. `false` turns it off. `true` or `null` use it while the dataset has embeddings enabled and the organization has embeddings usage left.
         * @default null
         */
        semanticSearch: boolean | null;
      })[];
      /** @description Prompt text the MCP endpoint serves to connecting agents. `null` when unset. */
      instructions: string | null;
      /** @description A GROQ filter that limits what the MCP endpoint's `dataset` source serves. It has no effect on `knowledge-base` sources. `null` when unset. The API clears it when the endpoint has no `dataset` source. */
      groqFilter: string | null;
      /**
       * Format: date-time
       * @description When the MCP endpoint was last created or edited through the API, as an ISO 8601 timestamp. Agent use never changes it, unlike `_updatedAt`.
       */
      updatedAt?: string;
      /**
       * Format: date-time
       * @description When an agent last used the MCP endpoint, as an ISO 8601 timestamp. Recorded at most once per UTC day. `null` when it has not been used since usage tracking started.
       */
      lastUsedAt?: string | null;
    };
  };
  responses: never;
  parameters: never;
  requestBodies: never;
  headers: never;
  pathItems: never;
}
interface operations {
  listKnowledgeBases: {
    parameters: {
      query: {
        /** @description The `nextCursor` value from the previous page. Omit it to get the first page. */
        cursor?: string;
        /** @description The maximum number of items to return. */
        limit?: number;
        /** @description The organization to list knowledge bases for. */
        organizationId: string;
        /** @description Set to `true` to also list the organization's drafts, which have `state` set to `draft`. Drafts count toward the plan's knowledge base limit, and `createdBy` says who started each one. */
        includeDrafts?: 'true' | 'false';
      };
      header?: never;
      path: {
        /** @description The API version: a date in the format `vYYYY-MM-DD`, for example `v2026-05-26`, or `vX` for the latest, unstable version. */
        apiVersion: string;
      };
      cookie?: never;
    };
    requestBody?: never;
    responses: {
      /** @description A page of knowledge bases. */
      200: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': {
            /** @description The items on this page. */
            data: {
              /**
               * Format: uuid
               * @description An internal UUID for the knowledge base, still accepted wherever a `knowledgeBaseId` is expected. Use `publicId` instead.
               */
              id: string;
              /** @description The knowledge base's ID, such as `kb3do82whm`. Store this one, and pass it as `knowledgeBaseId` in paths and filters. Treat it as an opaque string. */
              publicId: string;
              /** @description The ID of the organization that owns the knowledge base. */
              organizationId: string;
              /** @description The knowledge base's title. */
              title: string;
              /** @description A short description of what the knowledge base covers. */
              description: string;
              /**
               * @description The knowledge base's state. `draft`: still being set up, so it can't be built yet. `created`: not built yet. `ready`: built. Open issues and failed builds don't change the state. To check for open issues, use `openIssueCount`. To check for a running build, use `isBuilding`.
               * @enum {string}
               */
              state: 'draft' | 'created' | 'ready';
              /** @description The job ID of the most recent build, or `null` if no build has started. Check its progress with `GET .../jobs/{jobId}`. */
              activeJobId: string | null;
              /** @description Whether a build is running now. */
              isBuilding: boolean;
              /** @description Progress of the most recent build, by stage. `null` until a build reports progress. It can briefly belong to an earlier build, so use it only when its `jobId` matches `activeJobId`. */
              buildStageState: {
                /** @description The ID of the build job this progress belongs to. */
                jobId: string;
                /** @description Every stage this build runs, in the order it runs them, with each stage's progress. */
                stages: {
                  /** @description The stage's ID, such as `tldr` or `write`. Which stages a build runs changes between builds and knowledge bases, so treat it as an open string and handle IDs you don't recognize. */
                  id: string;
                  /** @description The stage's share of the whole build, from 0 to 1. The weights of a build's stages sum to 1. */
                  weight: number;
                  /**
                   * @description The stage's status. `pending`: not started. `running`: in progress. `done`: finished. `failed`: the build ended before the stage finished.
                   * @enum {string}
                   */
                  status: 'pending' | 'running' | 'done' | 'failed';
                  /** @description The stage's progress counts. Absent when the stage hasn't reported counts. */
                  units?: {
                    /**
                     * @description What `done` and `total` count: `sources`, `groups` of related content, `entries`, or `rounds` of final fixes. A `rounds` stage has no `total`.
                     * @enum {string}
                     */
                    unit: 'sources' | 'groups' | 'entries' | 'rounds';
                    /** @description How many units the stage has finished. */
                    done: number;
                    /** @description How many units the stage will process. Absent when `unit` is `rounds`. */
                    total?: number;
                  };
                }[];
              } | null;
              /**
               * Format: date-time
               * @description When a refresh last checked the knowledge base for changes, whether or not anything changed. `null` until the first refresh.
               */
              lastCheckedAt: string | null;
              /**
               * Format: date-time
               * @description When the content last changed: the time of the most recent successful build. `null` if the knowledge base has never built.
               */
              lastChangedAt: string | null;
              /** @description Whether sources were added, changed, or removed since the last successful build. A change a check already reviewed without filing an issue, or that a dismissed issue covered, no longer counts. Always `false` before the first build. */
              hasPendingChanges: boolean;
              /** @description Counts of sources added, changed, and removed since the last successful build, excluding changes a check already reviewed without filing an issue or that a dismissed issue covered. Only `GET .../knowledge-bases/{knowledgeBaseId}` computes it. `null` in list responses and before the first build. */
              pendingChanges: {
                /** @description Sources added since the last successful build, including sources no successful build has included yet. */
                added: number;
                /** @description Sources whose content changed since the last successful build. */
                changed: number;
                /** @description Sources that recent refreshes no longer find. */
                removed: number;
              } | null;
              /** @description Whether Sanity Context has improved how it builds knowledge bases since the last successful build. Rebuild to apply the improvements. Always `false` before the first build. */
              pipelineOutdated: boolean;
              /** @description A recommendation to rebuild, because new or changed content doesn't fit the current outline, or pages are out of date with changed sources and only a build updates them. `null` when there's no recommendation. A refresh where the content fits again, a successful build, or adding or removing sources clears it. */
              rebuildRecommended: {
                /** @description Why a rebuild is recommended, written to show to users. */
                reason: string;
                /**
                 * Format: date-time
                 * @description When the recommendation was made.
                 */
                at: string;
              } | null;
              /** @description Whether the knowledge base has at least one website source. */
              hasWebSource: boolean;
              /** @description Whether the knowledge base has at least one Sanity dataset source. */
              hasDatasetSource: boolean;
              /** @description Whether the knowledge base has at least one uploaded file source. */
              hasFileSource: boolean;
              /** @description The number of source chunks in the live documents of the knowledge base's sources, whether or not they have been built: the sum of its sources' `chunkCount`. It includes the chunks counted by `excludedSourceChunks`, and those of documents whose content another document repeats, which builds skip. Documents still being converted add theirs once converted. */
              sourceChunks: number;
              /** @description The number of source chunks in documents the organization's source chunk limit left out of builds. They count toward no limit, and the next build includes them once the limit has room. */
              excludedSourceChunks: number;
              /** @description Why a build request would be denied right now, or `null` if you can build. Only `GET .../knowledge-bases/{knowledgeBaseId}` checks it. List and create responses always return `null`. */
              buildRestriction: {
                /** @description A stable code for the restriction, such as `planLimitReached`. */
                code: string;
                /** @description A readable explanation that you can show to users. */
                message: string;
              } | null;
              /** @description Whether a refresh is running now. While it's `true`, a new refresh request makes the running one run once more when it ends instead of starting another. Only `GET .../knowledge-bases/{knowledgeBaseId}` computes it, so list responses return `false`. */
              refreshInFlight: boolean;
              /** @description The number of open issues waiting for review. Always `0` before the first build. */
              openIssueCount: number;
              /** @description The number of active instructions for the knowledge base. */
              instructionCount: number;
              /** @description Who created the knowledge base. `null` if unknown. */
              createdBy: {
                /** @description The Sanity user ID, or `sanity-system` when Sanity Context made the change. `null` if unknown. */
                id: string | null;
                /** @description The user's name when the action happened. `null` if unknown. For the current name, look up the user by `id`. */
                displayName: string | null;
              } | null;
              /**
               * Format: date-time
               * @description When the knowledge base was created.
               */
              createdAt: string;
              /**
               * Format: date-time
               * @description When the knowledge base was last updated.
               */
              updatedAt: string;
            }[];
            /** @description The cursor for the next page. Pass it as `cursor` to get more results. `null` when there are no more pages. */
            nextCursor: string | null;
          };
        };
      };
      /** @description Error */
      default: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': components['schemas']['ApiErrorBody'];
        };
      };
    };
  };
  createKnowledgeBase: {
    parameters: {
      query?: never;
      header?: {
        /** @description A unique value, such as a UUID, that makes retries safe. A retry with the same key and body returns the first response instead of repeating the work. */
        'Idempotency-Key'?: string;
      };
      path: {
        /** @description The API version: a date in the format `vYYYY-MM-DD`, for example `v2026-05-26`, or `vX` for the latest, unstable version. */
        apiVersion: string;
      };
      cookie?: never;
    };
    requestBody: {
      content: {
        'application/json': {
          /** @description The ID of the organization to create the knowledge base in. */
          organizationId: string;
          /** @description The knowledge base's title. Required unless `draft` is `true`. */
          title?: string;
          /** @description A short description of what the knowledge base covers. Required unless `draft` is `true`. */
          description?: string;
          /** @description Whether to create the knowledge base as a draft. You can add sources to a draft, and they sync right away, but you can't build it, and the list leaves it out unless you set `includeDrafts` to `true`. A draft counts toward your plan's knowledge base limit. To finish it, update it with `draft` set to `false`. */
          draft?: boolean;
        };
      };
    };
    responses: {
      /** @description A knowledge base and its current state. */
      201: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': {
            /**
             * Format: uuid
             * @description An internal UUID for the knowledge base, still accepted wherever a `knowledgeBaseId` is expected. Use `publicId` instead.
             */
            id: string;
            /** @description The knowledge base's ID, such as `kb3do82whm`. Store this one, and pass it as `knowledgeBaseId` in paths and filters. Treat it as an opaque string. */
            publicId: string;
            /** @description The ID of the organization that owns the knowledge base. */
            organizationId: string;
            /** @description The knowledge base's title. */
            title: string;
            /** @description A short description of what the knowledge base covers. */
            description: string;
            /**
             * @description The knowledge base's state. `draft`: still being set up, so it can't be built yet. `created`: not built yet. `ready`: built. Open issues and failed builds don't change the state. To check for open issues, use `openIssueCount`. To check for a running build, use `isBuilding`.
             * @enum {string}
             */
            state: 'draft' | 'created' | 'ready';
            /** @description The job ID of the most recent build, or `null` if no build has started. Check its progress with `GET .../jobs/{jobId}`. */
            activeJobId: string | null;
            /** @description Whether a build is running now. */
            isBuilding: boolean;
            /** @description Progress of the most recent build, by stage. `null` until a build reports progress. It can briefly belong to an earlier build, so use it only when its `jobId` matches `activeJobId`. */
            buildStageState: {
              /** @description The ID of the build job this progress belongs to. */
              jobId: string;
              /** @description Every stage this build runs, in the order it runs them, with each stage's progress. */
              stages: {
                /** @description The stage's ID, such as `tldr` or `write`. Which stages a build runs changes between builds and knowledge bases, so treat it as an open string and handle IDs you don't recognize. */
                id: string;
                /** @description The stage's share of the whole build, from 0 to 1. The weights of a build's stages sum to 1. */
                weight: number;
                /**
                 * @description The stage's status. `pending`: not started. `running`: in progress. `done`: finished. `failed`: the build ended before the stage finished.
                 * @enum {string}
                 */
                status: 'pending' | 'running' | 'done' | 'failed';
                /** @description The stage's progress counts. Absent when the stage hasn't reported counts. */
                units?: {
                  /**
                   * @description What `done` and `total` count: `sources`, `groups` of related content, `entries`, or `rounds` of final fixes. A `rounds` stage has no `total`.
                   * @enum {string}
                   */
                  unit: 'sources' | 'groups' | 'entries' | 'rounds';
                  /** @description How many units the stage has finished. */
                  done: number;
                  /** @description How many units the stage will process. Absent when `unit` is `rounds`. */
                  total?: number;
                };
              }[];
            } | null;
            /**
             * Format: date-time
             * @description When a refresh last checked the knowledge base for changes, whether or not anything changed. `null` until the first refresh.
             */
            lastCheckedAt: string | null;
            /**
             * Format: date-time
             * @description When the content last changed: the time of the most recent successful build. `null` if the knowledge base has never built.
             */
            lastChangedAt: string | null;
            /** @description Whether sources were added, changed, or removed since the last successful build. A change a check already reviewed without filing an issue, or that a dismissed issue covered, no longer counts. Always `false` before the first build. */
            hasPendingChanges: boolean;
            /** @description Counts of sources added, changed, and removed since the last successful build, excluding changes a check already reviewed without filing an issue or that a dismissed issue covered. Only `GET .../knowledge-bases/{knowledgeBaseId}` computes it. `null` in list responses and before the first build. */
            pendingChanges: {
              /** @description Sources added since the last successful build, including sources no successful build has included yet. */
              added: number;
              /** @description Sources whose content changed since the last successful build. */
              changed: number;
              /** @description Sources that recent refreshes no longer find. */
              removed: number;
            } | null;
            /** @description Whether Sanity Context has improved how it builds knowledge bases since the last successful build. Rebuild to apply the improvements. Always `false` before the first build. */
            pipelineOutdated: boolean;
            /** @description A recommendation to rebuild, because new or changed content doesn't fit the current outline, or pages are out of date with changed sources and only a build updates them. `null` when there's no recommendation. A refresh where the content fits again, a successful build, or adding or removing sources clears it. */
            rebuildRecommended: {
              /** @description Why a rebuild is recommended, written to show to users. */
              reason: string;
              /**
               * Format: date-time
               * @description When the recommendation was made.
               */
              at: string;
            } | null;
            /** @description Whether the knowledge base has at least one website source. */
            hasWebSource: boolean;
            /** @description Whether the knowledge base has at least one Sanity dataset source. */
            hasDatasetSource: boolean;
            /** @description Whether the knowledge base has at least one uploaded file source. */
            hasFileSource: boolean;
            /** @description The number of source chunks in the live documents of the knowledge base's sources, whether or not they have been built: the sum of its sources' `chunkCount`. It includes the chunks counted by `excludedSourceChunks`, and those of documents whose content another document repeats, which builds skip. Documents still being converted add theirs once converted. */
            sourceChunks: number;
            /** @description The number of source chunks in documents the organization's source chunk limit left out of builds. They count toward no limit, and the next build includes them once the limit has room. */
            excludedSourceChunks: number;
            /** @description Why a build request would be denied right now, or `null` if you can build. Only `GET .../knowledge-bases/{knowledgeBaseId}` checks it. List and create responses always return `null`. */
            buildRestriction: {
              /** @description A stable code for the restriction, such as `planLimitReached`. */
              code: string;
              /** @description A readable explanation that you can show to users. */
              message: string;
            } | null;
            /** @description Whether a refresh is running now. While it's `true`, a new refresh request makes the running one run once more when it ends instead of starting another. Only `GET .../knowledge-bases/{knowledgeBaseId}` computes it, so list responses return `false`. */
            refreshInFlight: boolean;
            /** @description The number of open issues waiting for review. Always `0` before the first build. */
            openIssueCount: number;
            /** @description The number of active instructions for the knowledge base. */
            instructionCount: number;
            /** @description Who created the knowledge base. `null` if unknown. */
            createdBy: {
              /** @description The Sanity user ID, or `sanity-system` when Sanity Context made the change. `null` if unknown. */
              id: string | null;
              /** @description The user's name when the action happened. `null` if unknown. For the current name, look up the user by `id`. */
              displayName: string | null;
            } | null;
            /**
             * Format: date-time
             * @description When the knowledge base was created.
             */
            createdAt: string;
            /**
             * Format: date-time
             * @description When the knowledge base was last updated.
             */
            updatedAt: string;
          };
        };
      };
      /** @description Error */
      default: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': components['schemas']['ApiErrorBody'];
        };
      };
    };
  };
  getKnowledgeBase: {
    parameters: {
      query?: never;
      header?: never;
      path: {
        /** @description The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted. */
        knowledgeBaseId: string;
        /** @description The API version: a date in the format `vYYYY-MM-DD`, for example `v2026-05-26`, or `vX` for the latest, unstable version. */
        apiVersion: string;
      };
      cookie?: never;
    };
    requestBody?: never;
    responses: {
      /** @description A knowledge base and its current state. */
      200: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': {
            /**
             * Format: uuid
             * @description An internal UUID for the knowledge base, still accepted wherever a `knowledgeBaseId` is expected. Use `publicId` instead.
             */
            id: string;
            /** @description The knowledge base's ID, such as `kb3do82whm`. Store this one, and pass it as `knowledgeBaseId` in paths and filters. Treat it as an opaque string. */
            publicId: string;
            /** @description The ID of the organization that owns the knowledge base. */
            organizationId: string;
            /** @description The knowledge base's title. */
            title: string;
            /** @description A short description of what the knowledge base covers. */
            description: string;
            /**
             * @description The knowledge base's state. `draft`: still being set up, so it can't be built yet. `created`: not built yet. `ready`: built. Open issues and failed builds don't change the state. To check for open issues, use `openIssueCount`. To check for a running build, use `isBuilding`.
             * @enum {string}
             */
            state: 'draft' | 'created' | 'ready';
            /** @description The job ID of the most recent build, or `null` if no build has started. Check its progress with `GET .../jobs/{jobId}`. */
            activeJobId: string | null;
            /** @description Whether a build is running now. */
            isBuilding: boolean;
            /** @description Progress of the most recent build, by stage. `null` until a build reports progress. It can briefly belong to an earlier build, so use it only when its `jobId` matches `activeJobId`. */
            buildStageState: {
              /** @description The ID of the build job this progress belongs to. */
              jobId: string;
              /** @description Every stage this build runs, in the order it runs them, with each stage's progress. */
              stages: {
                /** @description The stage's ID, such as `tldr` or `write`. Which stages a build runs changes between builds and knowledge bases, so treat it as an open string and handle IDs you don't recognize. */
                id: string;
                /** @description The stage's share of the whole build, from 0 to 1. The weights of a build's stages sum to 1. */
                weight: number;
                /**
                 * @description The stage's status. `pending`: not started. `running`: in progress. `done`: finished. `failed`: the build ended before the stage finished.
                 * @enum {string}
                 */
                status: 'pending' | 'running' | 'done' | 'failed';
                /** @description The stage's progress counts. Absent when the stage hasn't reported counts. */
                units?: {
                  /**
                   * @description What `done` and `total` count: `sources`, `groups` of related content, `entries`, or `rounds` of final fixes. A `rounds` stage has no `total`.
                   * @enum {string}
                   */
                  unit: 'sources' | 'groups' | 'entries' | 'rounds';
                  /** @description How many units the stage has finished. */
                  done: number;
                  /** @description How many units the stage will process. Absent when `unit` is `rounds`. */
                  total?: number;
                };
              }[];
            } | null;
            /**
             * Format: date-time
             * @description When a refresh last checked the knowledge base for changes, whether or not anything changed. `null` until the first refresh.
             */
            lastCheckedAt: string | null;
            /**
             * Format: date-time
             * @description When the content last changed: the time of the most recent successful build. `null` if the knowledge base has never built.
             */
            lastChangedAt: string | null;
            /** @description Whether sources were added, changed, or removed since the last successful build. A change a check already reviewed without filing an issue, or that a dismissed issue covered, no longer counts. Always `false` before the first build. */
            hasPendingChanges: boolean;
            /** @description Counts of sources added, changed, and removed since the last successful build, excluding changes a check already reviewed without filing an issue or that a dismissed issue covered. Only `GET .../knowledge-bases/{knowledgeBaseId}` computes it. `null` in list responses and before the first build. */
            pendingChanges: {
              /** @description Sources added since the last successful build, including sources no successful build has included yet. */
              added: number;
              /** @description Sources whose content changed since the last successful build. */
              changed: number;
              /** @description Sources that recent refreshes no longer find. */
              removed: number;
            } | null;
            /** @description Whether Sanity Context has improved how it builds knowledge bases since the last successful build. Rebuild to apply the improvements. Always `false` before the first build. */
            pipelineOutdated: boolean;
            /** @description A recommendation to rebuild, because new or changed content doesn't fit the current outline, or pages are out of date with changed sources and only a build updates them. `null` when there's no recommendation. A refresh where the content fits again, a successful build, or adding or removing sources clears it. */
            rebuildRecommended: {
              /** @description Why a rebuild is recommended, written to show to users. */
              reason: string;
              /**
               * Format: date-time
               * @description When the recommendation was made.
               */
              at: string;
            } | null;
            /** @description Whether the knowledge base has at least one website source. */
            hasWebSource: boolean;
            /** @description Whether the knowledge base has at least one Sanity dataset source. */
            hasDatasetSource: boolean;
            /** @description Whether the knowledge base has at least one uploaded file source. */
            hasFileSource: boolean;
            /** @description The number of source chunks in the live documents of the knowledge base's sources, whether or not they have been built: the sum of its sources' `chunkCount`. It includes the chunks counted by `excludedSourceChunks`, and those of documents whose content another document repeats, which builds skip. Documents still being converted add theirs once converted. */
            sourceChunks: number;
            /** @description The number of source chunks in documents the organization's source chunk limit left out of builds. They count toward no limit, and the next build includes them once the limit has room. */
            excludedSourceChunks: number;
            /** @description Why a build request would be denied right now, or `null` if you can build. Only `GET .../knowledge-bases/{knowledgeBaseId}` checks it. List and create responses always return `null`. */
            buildRestriction: {
              /** @description A stable code for the restriction, such as `planLimitReached`. */
              code: string;
              /** @description A readable explanation that you can show to users. */
              message: string;
            } | null;
            /** @description Whether a refresh is running now. While it's `true`, a new refresh request makes the running one run once more when it ends instead of starting another. Only `GET .../knowledge-bases/{knowledgeBaseId}` computes it, so list responses return `false`. */
            refreshInFlight: boolean;
            /** @description The number of open issues waiting for review. Always `0` before the first build. */
            openIssueCount: number;
            /** @description The number of active instructions for the knowledge base. */
            instructionCount: number;
            /** @description Who created the knowledge base. `null` if unknown. */
            createdBy: {
              /** @description The Sanity user ID, or `sanity-system` when Sanity Context made the change. `null` if unknown. */
              id: string | null;
              /** @description The user's name when the action happened. `null` if unknown. For the current name, look up the user by `id`. */
              displayName: string | null;
            } | null;
            /**
             * Format: date-time
             * @description When the knowledge base was created.
             */
            createdAt: string;
            /**
             * Format: date-time
             * @description When the knowledge base was last updated.
             */
            updatedAt: string;
          };
        };
      };
      /** @description Error */
      default: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': components['schemas']['ApiErrorBody'];
        };
      };
    };
  };
  deleteKnowledgeBase: {
    parameters: {
      query?: never;
      header?: never;
      path: {
        /** @description The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted. */
        knowledgeBaseId: string;
        /** @description The API version: a date in the format `vYYYY-MM-DD`, for example `v2026-05-26`, or `vX` for the latest, unstable version. */
        apiVersion: string;
      };
      cookie?: never;
    };
    requestBody?: never;
    responses: {
      /** @description The knowledge base was deleted. */
      204: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': null;
        };
      };
      /** @description Error */
      default: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': components['schemas']['ApiErrorBody'];
        };
      };
    };
  };
  updateKnowledgeBase: {
    parameters: {
      query?: never;
      header?: never;
      path: {
        /** @description The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted. */
        knowledgeBaseId: string;
        /** @description The API version: a date in the format `vYYYY-MM-DD`, for example `v2026-05-26`, or `vX` for the latest, unstable version. */
        apiVersion: string;
      };
      cookie?: never;
    };
    requestBody: {
      content: {
        'application/json': {
          /** @description The knowledge base's new title. */
          title?: string;
          /** @description The knowledge base's new description. */
          description?: string;
          /**
           * @description Set to `false` to finish a draft, so it can be built and is listed with your other knowledge bases. The knowledge base needs a title, sent here or set before. Ignored when the knowledge base isn't a draft. A finished knowledge base can't become a draft again.
           * @enum {boolean}
           */
          draft?: false;
        };
      };
    };
    responses: {
      /** @description A knowledge base and its current state. */
      200: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': {
            /**
             * Format: uuid
             * @description An internal UUID for the knowledge base, still accepted wherever a `knowledgeBaseId` is expected. Use `publicId` instead.
             */
            id: string;
            /** @description The knowledge base's ID, such as `kb3do82whm`. Store this one, and pass it as `knowledgeBaseId` in paths and filters. Treat it as an opaque string. */
            publicId: string;
            /** @description The ID of the organization that owns the knowledge base. */
            organizationId: string;
            /** @description The knowledge base's title. */
            title: string;
            /** @description A short description of what the knowledge base covers. */
            description: string;
            /**
             * @description The knowledge base's state. `draft`: still being set up, so it can't be built yet. `created`: not built yet. `ready`: built. Open issues and failed builds don't change the state. To check for open issues, use `openIssueCount`. To check for a running build, use `isBuilding`.
             * @enum {string}
             */
            state: 'draft' | 'created' | 'ready';
            /** @description The job ID of the most recent build, or `null` if no build has started. Check its progress with `GET .../jobs/{jobId}`. */
            activeJobId: string | null;
            /** @description Whether a build is running now. */
            isBuilding: boolean;
            /** @description Progress of the most recent build, by stage. `null` until a build reports progress. It can briefly belong to an earlier build, so use it only when its `jobId` matches `activeJobId`. */
            buildStageState: {
              /** @description The ID of the build job this progress belongs to. */
              jobId: string;
              /** @description Every stage this build runs, in the order it runs them, with each stage's progress. */
              stages: {
                /** @description The stage's ID, such as `tldr` or `write`. Which stages a build runs changes between builds and knowledge bases, so treat it as an open string and handle IDs you don't recognize. */
                id: string;
                /** @description The stage's share of the whole build, from 0 to 1. The weights of a build's stages sum to 1. */
                weight: number;
                /**
                 * @description The stage's status. `pending`: not started. `running`: in progress. `done`: finished. `failed`: the build ended before the stage finished.
                 * @enum {string}
                 */
                status: 'pending' | 'running' | 'done' | 'failed';
                /** @description The stage's progress counts. Absent when the stage hasn't reported counts. */
                units?: {
                  /**
                   * @description What `done` and `total` count: `sources`, `groups` of related content, `entries`, or `rounds` of final fixes. A `rounds` stage has no `total`.
                   * @enum {string}
                   */
                  unit: 'sources' | 'groups' | 'entries' | 'rounds';
                  /** @description How many units the stage has finished. */
                  done: number;
                  /** @description How many units the stage will process. Absent when `unit` is `rounds`. */
                  total?: number;
                };
              }[];
            } | null;
            /**
             * Format: date-time
             * @description When a refresh last checked the knowledge base for changes, whether or not anything changed. `null` until the first refresh.
             */
            lastCheckedAt: string | null;
            /**
             * Format: date-time
             * @description When the content last changed: the time of the most recent successful build. `null` if the knowledge base has never built.
             */
            lastChangedAt: string | null;
            /** @description Whether sources were added, changed, or removed since the last successful build. A change a check already reviewed without filing an issue, or that a dismissed issue covered, no longer counts. Always `false` before the first build. */
            hasPendingChanges: boolean;
            /** @description Counts of sources added, changed, and removed since the last successful build, excluding changes a check already reviewed without filing an issue or that a dismissed issue covered. Only `GET .../knowledge-bases/{knowledgeBaseId}` computes it. `null` in list responses and before the first build. */
            pendingChanges: {
              /** @description Sources added since the last successful build, including sources no successful build has included yet. */
              added: number;
              /** @description Sources whose content changed since the last successful build. */
              changed: number;
              /** @description Sources that recent refreshes no longer find. */
              removed: number;
            } | null;
            /** @description Whether Sanity Context has improved how it builds knowledge bases since the last successful build. Rebuild to apply the improvements. Always `false` before the first build. */
            pipelineOutdated: boolean;
            /** @description A recommendation to rebuild, because new or changed content doesn't fit the current outline, or pages are out of date with changed sources and only a build updates them. `null` when there's no recommendation. A refresh where the content fits again, a successful build, or adding or removing sources clears it. */
            rebuildRecommended: {
              /** @description Why a rebuild is recommended, written to show to users. */
              reason: string;
              /**
               * Format: date-time
               * @description When the recommendation was made.
               */
              at: string;
            } | null;
            /** @description Whether the knowledge base has at least one website source. */
            hasWebSource: boolean;
            /** @description Whether the knowledge base has at least one Sanity dataset source. */
            hasDatasetSource: boolean;
            /** @description Whether the knowledge base has at least one uploaded file source. */
            hasFileSource: boolean;
            /** @description The number of source chunks in the live documents of the knowledge base's sources, whether or not they have been built: the sum of its sources' `chunkCount`. It includes the chunks counted by `excludedSourceChunks`, and those of documents whose content another document repeats, which builds skip. Documents still being converted add theirs once converted. */
            sourceChunks: number;
            /** @description The number of source chunks in documents the organization's source chunk limit left out of builds. They count toward no limit, and the next build includes them once the limit has room. */
            excludedSourceChunks: number;
            /** @description Why a build request would be denied right now, or `null` if you can build. Only `GET .../knowledge-bases/{knowledgeBaseId}` checks it. List and create responses always return `null`. */
            buildRestriction: {
              /** @description A stable code for the restriction, such as `planLimitReached`. */
              code: string;
              /** @description A readable explanation that you can show to users. */
              message: string;
            } | null;
            /** @description Whether a refresh is running now. While it's `true`, a new refresh request makes the running one run once more when it ends instead of starting another. Only `GET .../knowledge-bases/{knowledgeBaseId}` computes it, so list responses return `false`. */
            refreshInFlight: boolean;
            /** @description The number of open issues waiting for review. Always `0` before the first build. */
            openIssueCount: number;
            /** @description The number of active instructions for the knowledge base. */
            instructionCount: number;
            /** @description Who created the knowledge base. `null` if unknown. */
            createdBy: {
              /** @description The Sanity user ID, or `sanity-system` when Sanity Context made the change. `null` if unknown. */
              id: string | null;
              /** @description The user's name when the action happened. `null` if unknown. For the current name, look up the user by `id`. */
              displayName: string | null;
            } | null;
            /**
             * Format: date-time
             * @description When the knowledge base was created.
             */
            createdAt: string;
            /**
             * Format: date-time
             * @description When the knowledge base was last updated.
             */
            updatedAt: string;
          };
        };
      };
      /** @description Error */
      default: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': components['schemas']['ApiErrorBody'];
        };
      };
    };
  };
  buildKnowledgeBase: {
    parameters: {
      query?: never;
      header?: {
        /** @description A unique value, such as a UUID, that makes retries safe. A retry with the same key and body returns the first response instead of repeating the work. */
        'Idempotency-Key'?: string;
      };
      path: {
        /** @description The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted. */
        knowledgeBaseId: string;
        /** @description The API version: a date in the format `vYYYY-MM-DD`, for example `v2026-05-26`, or `vX` for the latest, unstable version. */
        apiVersion: string;
      };
      cookie?: never;
    };
    requestBody?: never;
    responses: {
      /** @description A queued job that you can poll for progress. */
      202: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': {
            /** @description The queued job's ID. Check its progress with `GET .../jobs/{jobId}`. Treat it as an opaque string. Its format can change. */
            jobId: string;
          };
        };
      };
      /** @description Error */
      default: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': components['schemas']['ApiErrorBody'];
        };
      };
    };
  };
  cancelKnowledgeBaseBuild: {
    parameters: {
      query?: never;
      header?: never;
      path: {
        /** @description The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted. */
        knowledgeBaseId: string;
        /** @description The API version: a date in the format `vYYYY-MM-DD`, for example `v2026-05-26`, or `vX` for the latest, unstable version. */
        apiVersion: string;
      };
      cookie?: never;
    };
    requestBody?: never;
    responses: {
      /** @description The result of the cancel request. */
      200: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': {
            /** @description Whether a running build was cancelled. `false` when no build was running. */
            cancelled: boolean;
          };
        };
      };
      /** @description Error */
      default: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': components['schemas']['ApiErrorBody'];
        };
      };
    };
  };
  listDocuments: {
    parameters: {
      query?: {
        /** @description The `nextCursor` value from the previous page. Omit it to get the first page. */
        cursor?: string;
        /** @description The maximum number of items to return. */
        limit?: number;
        /** @description Return only the documents of this source. */
        source?: string;
        /** @description Return only documents in this state. Without it, `deleted` documents are left out. */
        state?: 'active' | 'missing' | 'deleted';
        /** @description Comma-separated IDs of the documents to return, up to 200, in any state. Use it to look up the documents entry citations point at. */
        ids?: string;
      };
      header?: never;
      path: {
        /** @description The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted. */
        knowledgeBaseId: string;
        /** @description The API version: a date in the format `vYYYY-MM-DD`, for example `v2026-05-26`, or `vX` for the latest, unstable version. */
        apiVersion: string;
      };
      cookie?: never;
    };
    requestBody?: never;
    responses: {
      /** @description A page of documents. */
      200: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': {
            /** @description The items on this page. */
            data: {
              /**
               * Format: uuid
               * @description The document's ID. Entry citations point at it.
               */
              id: string;
              /**
               * Format: uuid
               * @description The ID of the source the document comes from.
               */
              sourceId: string;
              /**
               * @description The type of the source the document comes from.
               * @enum {string}
               */
              sourceType: 'web' | 'sanity-dataset' | 'files';
              /** @description The document's identity in its source: the page URL, the dataset document `_id`, or the file's path in the upload. */
              externalId: string;
              /** @description The document's title, or its `externalId` when it has none. */
              title: string;
              /** @description Where the document lives on the web. `null` for files and dataset documents. */
              url: string | null;
              /**
               * @description The document's state. `active`: in the knowledge base. `missing`: several crawls in a row didn't find the page, but it stays in the knowledge base until you delete or keep it. `deleted`: removed from the source, or by you.
               * @enum {string}
               */
              state: 'active' | 'missing' | 'deleted';
              /** @description The media type of the document as read. `null` before its content was read. */
              mime: string | null;
              /** @description The size of the document as read, in bytes. `null` before its content was read. */
              sizeBytes: number | null;
              /**
               * @description How far the current content got through conversion to markdown, the text builds read and cite. `pending`: not converted yet. `converted`: ready. `unsupported`: the file type has no converter. `oversized`: too large to convert. `failed`: conversion failed, see `conversionError`.
               * @enum {string}
               */
              conversion: 'pending' | 'converted' | 'unsupported' | 'oversized' | 'failed';
              /** @description Why conversion failed. `null` unless `conversion` is `failed` or `oversized`. */
              conversionError: string | null;
              /**
               * Format: date-time
               * @description When a build left the document out because the organization's source chunk limit had no room for it. No build reads it until a later build finds room, which includes it automatically. `null` while builds include it.
               */
              excludedAt: string | null;
              /**
               * Format: date-time
               * @description When the document says it was last updated: from a page's meta tags, a file's own metadata, or a dataset document's `_updatedAt`. `null` when it doesn't say.
               */
              documentUpdatedAt: string | null;
              /**
               * Format: date-time
               * @description When a sync last found the document in its source.
               */
              lastSeenAt: string;
              /**
               * Format: date-time
               * @description When the document was first read.
               */
              createdAt: string;
              /**
               * Format: date-time
               * @description When the document last changed.
               */
              updatedAt: string;
            }[];
            /** @description The cursor for the next page. Pass it as `cursor` to get more results. `null` when there are no more pages. */
            nextCursor: string | null;
          };
        };
      };
      /** @description Error */
      default: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': components['schemas']['ApiErrorBody'];
        };
      };
    };
  };
  getDocument: {
    parameters: {
      query?: never;
      header?: never;
      path: {
        /** @description The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted. */
        knowledgeBaseId: string;
        /** @description The document's ID. */
        documentId: string;
        /** @description The API version: a date in the format `vYYYY-MM-DD`, for example `v2026-05-26`, or `vX` for the latest, unstable version. */
        apiVersion: string;
      };
      cookie?: never;
    };
    requestBody?: never;
    responses: {
      /** @description A document with the chunks of its markdown. */
      200: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': {
            /**
             * Format: uuid
             * @description The document's ID. Entry citations point at it.
             */
            id: string;
            /**
             * Format: uuid
             * @description The ID of the source the document comes from.
             */
            sourceId: string;
            /**
             * @description The type of the source the document comes from.
             * @enum {string}
             */
            sourceType: 'web' | 'sanity-dataset' | 'files';
            /** @description The document's identity in its source: the page URL, the dataset document `_id`, or the file's path in the upload. */
            externalId: string;
            /** @description The document's title, or its `externalId` when it has none. */
            title: string;
            /** @description Where the document lives on the web. `null` for files and dataset documents. */
            url: string | null;
            /**
             * @description The document's state. `active`: in the knowledge base. `missing`: several crawls in a row didn't find the page, but it stays in the knowledge base until you delete or keep it. `deleted`: removed from the source, or by you.
             * @enum {string}
             */
            state: 'active' | 'missing' | 'deleted';
            /** @description The media type of the document as read. `null` before its content was read. */
            mime: string | null;
            /** @description The size of the document as read, in bytes. `null` before its content was read. */
            sizeBytes: number | null;
            /**
             * @description How far the current content got through conversion to markdown, the text builds read and cite. `pending`: not converted yet. `converted`: ready. `unsupported`: the file type has no converter. `oversized`: too large to convert. `failed`: conversion failed, see `conversionError`.
             * @enum {string}
             */
            conversion: 'pending' | 'converted' | 'unsupported' | 'oversized' | 'failed';
            /** @description Why conversion failed. `null` unless `conversion` is `failed` or `oversized`. */
            conversionError: string | null;
            /**
             * Format: date-time
             * @description When a build left the document out because the organization's source chunk limit had no room for it. No build reads it until a later build finds room, which includes it automatically. `null` while builds include it.
             */
            excludedAt: string | null;
            /**
             * Format: date-time
             * @description When the document says it was last updated: from a page's meta tags, a file's own metadata, or a dataset document's `_updatedAt`. `null` when it doesn't say.
             */
            documentUpdatedAt: string | null;
            /**
             * Format: date-time
             * @description When a sync last found the document in its source.
             */
            lastSeenAt: string;
            /**
             * Format: date-time
             * @description When the document was first read.
             */
            createdAt: string;
            /**
             * Format: date-time
             * @description When the document last changed.
             */
            updatedAt: string;
            /** @description The chunks of the document's current markdown, in order. Empty until `conversion` is `converted`. */
            chunks: {
              /**
               * Format: uuid
               * @description The chunk's ID. Entry citations point at it.
               */
              id: string;
              /** @description The headings above the chunk, outermost first. Empty before the first heading. */
              headingPath: string[];
              /** @description The chunk's first line in the markdown, from 1. */
              lineStart: number;
              /** @description The chunk's last line in the markdown, inclusive. */
              lineEnd: number;
            }[];
          };
        };
      };
      /** @description Error */
      default: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': components['schemas']['ApiErrorBody'];
        };
      };
    };
  };
  deleteDocument: {
    parameters: {
      query?: never;
      header?: never;
      path: {
        /** @description The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted. */
        knowledgeBaseId: string;
        /** @description The document's ID. */
        documentId: string;
        /** @description The API version: a date in the format `vYYYY-MM-DD`, for example `v2026-05-26`, or `vX` for the latest, unstable version. */
        apiVersion: string;
      };
      cookie?: never;
    };
    requestBody?: never;
    responses: {
      /** @description The document was deleted. */
      204: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': null;
        };
      };
      /** @description Error */
      default: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': components['schemas']['ApiErrorBody'];
        };
      };
    };
  };
  updateDocument: {
    parameters: {
      query?: never;
      header?: never;
      path: {
        /** @description The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted. */
        knowledgeBaseId: string;
        /** @description The document's ID. */
        documentId: string;
        /** @description The API version: a date in the format `vYYYY-MM-DD`, for example `v2026-05-26`, or `vX` for the latest, unstable version. */
        apiVersion: string;
      };
      cookie?: never;
    };
    /** @description The changes to make to a document. */
    requestBody: {
      content: {
        'application/json': {
          /**
           * @description Set to `active` to keep a `missing` page in the knowledge base. The count of crawls that missed it starts again.
           * @enum {string}
           */
          state: 'active';
        };
      };
    };
    responses: {
      /** @description One page, dataset document or file that a source yields. */
      200: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': {
            /**
             * Format: uuid
             * @description The document's ID. Entry citations point at it.
             */
            id: string;
            /**
             * Format: uuid
             * @description The ID of the source the document comes from.
             */
            sourceId: string;
            /**
             * @description The type of the source the document comes from.
             * @enum {string}
             */
            sourceType: 'web' | 'sanity-dataset' | 'files';
            /** @description The document's identity in its source: the page URL, the dataset document `_id`, or the file's path in the upload. */
            externalId: string;
            /** @description The document's title, or its `externalId` when it has none. */
            title: string;
            /** @description Where the document lives on the web. `null` for files and dataset documents. */
            url: string | null;
            /**
             * @description The document's state. `active`: in the knowledge base. `missing`: several crawls in a row didn't find the page, but it stays in the knowledge base until you delete or keep it. `deleted`: removed from the source, or by you.
             * @enum {string}
             */
            state: 'active' | 'missing' | 'deleted';
            /** @description The media type of the document as read. `null` before its content was read. */
            mime: string | null;
            /** @description The size of the document as read, in bytes. `null` before its content was read. */
            sizeBytes: number | null;
            /**
             * @description How far the current content got through conversion to markdown, the text builds read and cite. `pending`: not converted yet. `converted`: ready. `unsupported`: the file type has no converter. `oversized`: too large to convert. `failed`: conversion failed, see `conversionError`.
             * @enum {string}
             */
            conversion: 'pending' | 'converted' | 'unsupported' | 'oversized' | 'failed';
            /** @description Why conversion failed. `null` unless `conversion` is `failed` or `oversized`. */
            conversionError: string | null;
            /**
             * Format: date-time
             * @description When a build left the document out because the organization's source chunk limit had no room for it. No build reads it until a later build finds room, which includes it automatically. `null` while builds include it.
             */
            excludedAt: string | null;
            /**
             * Format: date-time
             * @description When the document says it was last updated: from a page's meta tags, a file's own metadata, or a dataset document's `_updatedAt`. `null` when it doesn't say.
             */
            documentUpdatedAt: string | null;
            /**
             * Format: date-time
             * @description When a sync last found the document in its source.
             */
            lastSeenAt: string;
            /**
             * Format: date-time
             * @description When the document was first read.
             */
            createdAt: string;
            /**
             * Format: date-time
             * @description When the document last changed.
             */
            updatedAt: string;
          };
        };
      };
      /** @description Error */
      default: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': components['schemas']['ApiErrorBody'];
        };
      };
    };
  };
  getDocumentContent: {
    parameters: {
      query?: {
        /** @description Response format. `json` (default) returns the markdown with its line numbers. `markdown` and `plain` return the markdown alone, ready to pass to a model. `raw` returns the bytes the source gave, before conversion: the uploaded file, the crawled page, the dataset document as JSON. */
        format?: 'json' | 'markdown' | 'plain' | 'raw';
        /** @description Return only this chunk's lines. Citations name the chunk they quote. */
        chunk?: string;
        /** @description Return only these lines, from 1 and inclusive: `10-20`, or `10` for line 10 to the end. A range past the end returns up to the last line. */
        lines?: string;
      };
      header?: never;
      path: {
        /** @description The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted. */
        knowledgeBaseId: string;
        /** @description The document's ID. */
        documentId: string;
        /** @description The API version: a date in the format `vYYYY-MM-DD`, for example `v2026-05-26`, or `vX` for the latest, unstable version. */
        apiVersion: string;
      };
      cookie?: never;
    };
    requestBody?: never;
    responses: {
      /** @description A document's markdown, or a range of its lines. */
      200: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': {
            /**
             * Format: uuid
             * @description The document's ID.
             */
            documentId: string;
            /**
             * Format: uuid
             * @description The chunk the content was limited to. `null` when no `chunk` was requested.
             */
            chunkId: string | null;
            /** @description The document's markdown, or the requested lines of it. */
            content: string;
            /** @description The number of lines in the whole markdown. */
            totalLines: number;
            /** @description The lines returned, from 1 and inclusive. Shorter than requested when the range runs past the end. Both are `0` when no lines are returned. */
            slice: {
              /** @description The first line returned. */
              start: number;
              /** @description The last line returned. */
              end: number;
            };
          };
        };
      };
      /** @description Error */
      default: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': components['schemas']['ApiErrorBody'];
        };
      };
    };
  };
  rebuildEntry: {
    parameters: {
      query?: never;
      header?: never;
      path: {
        /** @description The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted. */
        knowledgeBaseId: string;
        /** @description The entry's slash-delimited path, such as `pricing/plans/free`, URL-encoded. */
        entryPath: string;
        /** @description The API version: a date in the format `vYYYY-MM-DD`, for example `v2026-05-26`, or `vX` for the latest, unstable version. */
        apiVersion: string;
      };
      cookie?: never;
    };
    requestBody?: never;
    responses: {
      /** @description The job that rebuilds the entry, and the other entries that share its sources. */
      202: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': {
            /** @description ID of the job that rebuilds the entry. Poll it with `GET .../jobs/{jobId}`. */
            jobId: string;
            /** @description Other entries built from any of this entry's sources. An instruction applies to every entry built from its sources, so these entries can change when they are next rebuilt. */
            affectedEntries: {
              /** @description The entry's document ID. */
              id: string;
              /** @description The entry's path, such as `products/api/webhooks`. */
              path: string;
              /** @description The entry's title. */
              title: string;
            }[];
          };
        };
      };
      /** @description Error */
      default: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': components['schemas']['ApiErrorBody'];
        };
      };
    };
  };
  createInstruction: {
    parameters: {
      query?: never;
      header?: never;
      path: {
        /** @description The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted. */
        knowledgeBaseId: string;
        /** @description The API version: a date in the format `vYYYY-MM-DD`, for example `v2026-05-26`, or `vX` for the latest, unstable version. */
        apiVersion: string;
      };
      cookie?: never;
    };
    /** @description The instruction to create, and any entries to rebuild under it. */
    requestBody: {
      content: {
        'application/json': {
          /** @description The instruction in plain language. Builds follow it over what the sources say. */
          statement: string;
          /** @description IDs of the documents the instruction applies to. Builds apply it when they write entries built from these documents. IDs of documents that no longer exist are dropped. If none exist, the request returns `422` with code `instructionScopeVanished`. */
          scopeDocumentIds: string[];
          /** @description Paths of entries to rebuild under the new instruction right away. The response returns the rebuild job ID in `rebuildJobId`. */
          rebuildPaths?: string[];
          /** @description Whether you already checked the instruction for entries that contradict it. When `true`, the background check that files issues for those entries is skipped. It still runs if the rebuild you requested in `rebuildPaths` does not start. */
          verified?: boolean;
        };
      };
    };
    responses: {
      /** @description The created instruction, and the rebuild it started. */
      201: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': {
            /** @description The created instruction. */
            instruction: {
              /** @description The instruction's document ID. */
              id: string;
              /** @description The ID (`kb...`) of the knowledge base the instruction belongs to. */
              knowledgeBaseId: string;
              /**
               * @description How the instruction was created. `human`: someone wrote it. `conflict`: it records the side chosen when a conflict issue was resolved. Both kinds work the same way in builds.
               * @enum {string}
               */
              origin: 'conflict' | 'human';
              /**
               * @description Whether builds apply the instruction. `active`: builds apply it. `archived`: a refresh found that its documents no longer support it, so builds stop applying it. To reactivate an archived instruction, update it.
               * @enum {string}
               */
              status: 'active' | 'archived';
              /** @description The instruction in plain language. Builds follow it over what the sources say. */
              statement: string;
              /** @description IDs of the documents the instruction applies to. Builds apply it when they write entries built from these documents. An empty array means all of its documents were removed, so it applies to no entries. */
              scopeDocumentIds: string[];
              /**
               * Format: date-time
               * @description When a refresh archived the instruction. `null` while it is active.
               */
              archivedAt: string | null;
              /** @description Why the instruction was archived. `null` while it is active. */
              archivedReason: string | null;
              /** @description ID of the conflict issue this instruction records. `null` when `origin` is `human`. */
              sourceIssueId: string | null;
              /** @description Who created the instruction. `null` for instructions created by resolving a conflict, and when the creator is unknown. */
              createdBy: {
                /** @description The Sanity user ID, or `sanity-system` when Sanity Context made the change. `null` if unknown. */
                id: string | null;
                /** @description The user's name when the action happened. `null` if unknown. For the current name, look up the user by `id`. */
                displayName: string | null;
              } | null;
              /** @description Who last updated the instruction through the API. `null` when it was never updated, or when the person is unknown. */
              updatedBy: {
                /** @description The Sanity user ID, or `sanity-system` when Sanity Context made the change. `null` if unknown. */
                id: string | null;
                /** @description The user's name when the action happened. `null` if unknown. For the current name, look up the user by `id`. */
                displayName: string | null;
              } | null;
              /**
               * Format: date-time
               * @description When the instruction was created.
               */
              createdAt: string;
              /**
               * Format: date-time
               * @description When the instruction last changed, including changes a refresh makes. `null` when the time is unknown.
               */
              updatedAt: string | null;
            };
            /** @description ID of the job that rebuilds the entries in `rebuildPaths`. Poll it with `GET .../jobs/{jobId}`. `null` when you didn't pass `rebuildPaths` or the rebuild could not start. The instruction is saved either way. */
            rebuildJobId: string | null;
          };
        };
      };
      /** @description Error */
      default: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': components['schemas']['ApiErrorBody'];
        };
      };
    };
  };
  checkInstruction: {
    parameters: {
      query?: never;
      header?: never;
      path: {
        /** @description The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted. */
        knowledgeBaseId: string;
        /** @description The API version: a date in the format `vYYYY-MM-DD`, for example `v2026-05-26`, or `vX` for the latest, unstable version. */
        apiVersion: string;
      };
      cookie?: never;
    };
    /** @description An instruction to check before creating it. */
    requestBody: {
      content: {
        'application/json': {
          /** @description The instruction in plain language, as you would pass it to create. */
          statement: string;
          /** @description IDs of the documents the instruction will be tied to. The check covers every entry built from any of them. */
          scopeDocumentIds: string[];
          /** @description ID of an entry to leave out of the check, such as the entry the instruction was drafted from. */
          excludeEntryId?: string;
          /** @description Set to `true` to list the entries the check would cover in `candidates` without checking them. This makes no model calls. */
          candidatesOnly?: boolean;
          /** @description Paths of the entries to check. Paths of entries the check would not cover are ignored. Omit it to check every entry built from the documents. */
          paths?: string[];
        };
      };
    };
    responses: {
      /** @description The result of checking an instruction. Nothing is saved. */
      200: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': {
            /** @description How many entries were checked. Entries with no text, and entries whose check failed, are not counted and not reported. `0` when `candidatesOnly` is set. */
            checked: number;
            /** @description The entries that contradict the instruction, ordered by path. Empty when `candidatesOnly` is set. */
            contradictions: {
              /** @description The entry's document ID. */
              id: string;
              /** @description The entry's path, such as `products/api/webhooks`. */
              path: string;
              /** @description The entry's title. */
              title: string;
              /** @description What the entry says now, and why it contradicts the instruction. */
              issue: string;
            }[];
            /** @description The entries the check covers, ordered by path. Only present when `candidatesOnly` is set. */
            candidates?: {
              /** @description The entry's document ID. */
              id: string;
              /** @description The entry's path, such as `products/api/webhooks`. */
              path: string;
              /** @description The entry's title. */
              title: string;
            }[];
          };
        };
      };
      /** @description Error */
      default: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': components['schemas']['ApiErrorBody'];
        };
      };
    };
  };
  draftInstruction: {
    parameters: {
      query?: never;
      header?: never;
      path: {
        /** @description The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted. */
        knowledgeBaseId: string;
        /** @description The API version: a date in the format `vYYYY-MM-DD`, for example `v2026-05-26`, or `vX` for the latest, unstable version. */
        apiVersion: string;
      };
      cookie?: never;
    };
    /** @description Feedback to turn into a proposed instruction. */
    requestBody: {
      content: {
        'application/json': {
          /** @description What should change, in your own words, such as "this is wrong" or "never say X". */
          feedback: string;
          /** @description ID of the entry the feedback is about. The draft reads the entry and its documents for context. If the entry doesn't exist, the request returns `404` with code `entryNotFound`. */
          entryId?: string;
          /** @description The passage of the entry the feedback is about, so the draft addresses that claim. */
          excerpt?: string;
          /** @description IDs of the documents to tie the instruction to. Omit it to use the documents of the entry in `entryId`. If neither gives any documents, the request returns `422` with code `instructionScopeVanished`. */
          scopeDocumentIds?: string[];
        };
      };
    };
    responses: {
      /** @description A proposed instruction. Nothing is saved: pass it to `POST .../instructions` to create it. */
      200: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': {
            /** @description The proposed instruction in plain language, written as a standing rule. */
            statement: string;
            /** @description IDs of the documents the instruction should be tied to: `scopeDocumentIds` from the request, or the documents of the entry in `entryId`. Always at least one. */
            scopeDocumentIds: string[];
          };
        };
      };
      /** @description Error */
      default: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': components['schemas']['ApiErrorBody'];
        };
      };
    };
  };
  deleteInstruction: {
    parameters: {
      query?: {
        /** @description Set to `true` to rebuild every entry built from the instruction's documents once it is deleted, so pages written under the instruction reflect their documents again. The response returns the rebuild job ID in `rebuildJobId`. */
        rebuild?: 'true' | 'false';
      };
      header?: never;
      path: {
        /** @description The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted. */
        knowledgeBaseId: string;
        /** @description The instruction's ID. */
        instructionId: string;
        /** @description The API version: a date in the format `vYYYY-MM-DD`, for example `v2026-05-26`, or `vX` for the latest, unstable version. */
        apiVersion: string;
      };
      cookie?: never;
    };
    requestBody?: never;
    responses: {
      /** @description The rebuild the delete started, if any. */
      200: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': {
            /** @description ID of the job that rebuilds the entries built from the instruction's documents. Poll it with `GET .../jobs/{jobId}`. `null` when you didn't pass `rebuild=true`, no entry is built from those documents, or the rebuild could not start. The instruction is deleted either way. */
            rebuildJobId: string | null;
          };
        };
      };
      /** @description Error */
      default: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': components['schemas']['ApiErrorBody'];
        };
      };
    };
  };
  updateInstruction: {
    parameters: {
      query?: never;
      header?: never;
      path: {
        /** @description The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted. */
        knowledgeBaseId: string;
        /** @description The instruction's ID. */
        instructionId: string;
        /** @description The API version: a date in the format `vYYYY-MM-DD`, for example `v2026-05-26`, or `vX` for the latest, unstable version. */
        apiVersion: string;
      };
      cookie?: never;
    };
    /** @description The changes to make to an instruction. Set `statement`, `scopeDocumentIds`, or both. Any update also reactivates an archived instruction. */
    requestBody: {
      content: {
        'application/json': {
          /** @description The new instruction text. Omit it to keep the current text. */
          statement?: string;
          /** @description IDs of the documents the instruction applies to. Replaces the current list. Omit it to keep the current documents. IDs of documents that no longer exist are dropped. If none exist, the request returns `422` with code `instructionScopeVanished`. */
          scopeDocumentIds?: string[];
        };
      };
    };
    responses: {
      /** @description A standing instruction that shapes how entries built from its documents are written. */
      200: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': {
            /** @description The instruction's document ID. */
            id: string;
            /** @description The ID (`kb...`) of the knowledge base the instruction belongs to. */
            knowledgeBaseId: string;
            /**
             * @description How the instruction was created. `human`: someone wrote it. `conflict`: it records the side chosen when a conflict issue was resolved. Both kinds work the same way in builds.
             * @enum {string}
             */
            origin: 'conflict' | 'human';
            /**
             * @description Whether builds apply the instruction. `active`: builds apply it. `archived`: a refresh found that its documents no longer support it, so builds stop applying it. To reactivate an archived instruction, update it.
             * @enum {string}
             */
            status: 'active' | 'archived';
            /** @description The instruction in plain language. Builds follow it over what the sources say. */
            statement: string;
            /** @description IDs of the documents the instruction applies to. Builds apply it when they write entries built from these documents. An empty array means all of its documents were removed, so it applies to no entries. */
            scopeDocumentIds: string[];
            /**
             * Format: date-time
             * @description When a refresh archived the instruction. `null` while it is active.
             */
            archivedAt: string | null;
            /** @description Why the instruction was archived. `null` while it is active. */
            archivedReason: string | null;
            /** @description ID of the conflict issue this instruction records. `null` when `origin` is `human`. */
            sourceIssueId: string | null;
            /** @description Who created the instruction. `null` for instructions created by resolving a conflict, and when the creator is unknown. */
            createdBy: {
              /** @description The Sanity user ID, or `sanity-system` when Sanity Context made the change. `null` if unknown. */
              id: string | null;
              /** @description The user's name when the action happened. `null` if unknown. For the current name, look up the user by `id`. */
              displayName: string | null;
            } | null;
            /** @description Who last updated the instruction through the API. `null` when it was never updated, or when the person is unknown. */
            updatedBy: {
              /** @description The Sanity user ID, or `sanity-system` when Sanity Context made the change. `null` if unknown. */
              id: string | null;
              /** @description The user's name when the action happened. `null` if unknown. For the current name, look up the user by `id`. */
              displayName: string | null;
            } | null;
            /**
             * Format: date-time
             * @description When the instruction was created.
             */
            createdAt: string;
            /**
             * Format: date-time
             * @description When the instruction last changed, including changes a refresh makes. `null` when the time is unknown.
             */
            updatedAt: string | null;
          };
        };
      };
      /** @description Error */
      default: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': components['schemas']['ApiErrorBody'];
        };
      };
    };
  };
  applyIssues: {
    parameters: {
      query?: never;
      header?: never;
      path: {
        /** @description The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted. */
        knowledgeBaseId: string;
        /** @description The API version: a date in the format `vYYYY-MM-DD`, for example `v2026-05-26`, or `vX` for the latest, unstable version. */
        apiVersion: string;
      };
      cookie?: never;
    };
    requestBody: {
      content: {
        'application/json': {
          /** @description The IDs of the issues to accept and apply. */
          issueIds: string[];
        };
      };
    };
    responses: {
      /** @description A queued job that you can poll for progress. */
      202: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': {
            /** @description The queued job's ID. Check its progress with `GET .../jobs/{jobId}`. Treat it as an opaque string. Its format can change. */
            jobId: string;
          };
        };
      };
      /** @description Error */
      default: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': components['schemas']['ApiErrorBody'];
        };
      };
    };
  };
  dismissIssue: {
    parameters: {
      query?: never;
      header?: never;
      path: {
        /** @description The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted. */
        knowledgeBaseId: string;
        /** @description The issue's document ID. */
        issueId: string;
        /** @description The API version: a date in the format `vYYYY-MM-DD`, for example `v2026-05-26`, or `vX` for the latest, unstable version. */
        apiVersion: string;
      };
      cookie?: never;
    };
    requestBody?: never;
    responses: {
      /** @description An issue found in a knowledge base, and its triage status. */
      200: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': {
            /** @description The issue's document ID. A later build that finds the same issue in unchanged sources reuses this ID, so your triage decision is kept. */
            id: string;
            /** @description The ID (`kb...`) of the knowledge base the issue belongs to. */
            knowledgeBaseId: string;
            /** @description What the issue found. The shape depends on `kind`. */
            content: {
              /**
               * @description How serious the issue is. `critical`: content is wrong or missing in a way that can mislead an agent. `suggestion`: a change that improves quality.
               * @enum {string}
               */
              severity: 'critical' | 'suggestion';
              /** @description Path of the entry the issue is about, or `*` when it applies to the whole knowledge base. */
              scopePath: string;
              /** @description What the problem is, in one or two sentences. */
              issue: string;
              /** @description What to do to fix the issue. */
              suggestedFix: string;
              /**
               * @description The issue type. `conflict` means two or more positions disagree on the same fact, and you choose which one is correct.
               * @enum {string}
               */
              kind: 'conflict';
              /** @description A key naming the disputed fact, such as `free_tier.request_limit`. It never includes the disputed value, so every side shares it. */
              claimKey: string;
              /** @description One sentence that explains the question, when it needs one. */
              context?: string;
              /** @description The conflicting positions, at least two. To resolve the conflict, pass the index of one side as `resolution`. */
              sides: {
                /** @description The position as a self-contained sentence. This is the option you choose from. */
                claim: string;
                /** @description The disputed value on its own, such as `10,000/month`, without the sentence. */
                value?: string;
                /** @description Paths of the entries that state this position. */
                entryPaths?: string[];
                /** @description IDs of the documents that directly back this position. */
                documentIds?: string[];
                /** @description The documents that state this value, by the names you know them by. */
                where?: string;
                /** @description Quotes from the documents that state this value, copied word for word and checked against each document. A document whose wording could not be checked has none. */
                citations?: {
                  /** @description Stable ID of this citation: 10 lowercase letters and digits. An entry body points to it with a `[^key]` marker. */
                  _key: string;
                  /** @enum {string} */
                  _type: 'sanity.context.citation';
                  /** @description ID of the document the quote comes from. Read it with `GET .../documents/{documentId}/content`. */
                  documentId: string;
                  /** @description ID of the chunk of the document that holds the quote's first line. A chunk is the text under one heading, and keeps its ID across versions of the document while its headings stay the same. */
                  chunkId: string;
                  /** @description The document's name when the entry was written. */
                  title: string;
                  /** @description Where the document lives on the web. Absent for uploaded files and datasets. */
                  url?: string;
                  /** @description The passage from the document that backs the claims, copied word for word. */
                  quote: string;
                  /** @description Up to 32 characters of document text just before the quote, to tell repeats apart. */
                  prefix: string;
                  /** @description Up to 32 characters of document text just after the quote, to tell repeats apart. */
                  suffix: string;
                  /** @description First line of the quote in the document, counting from 1. Line numbers match `GET .../documents/{documentId}/content`. A hint: the quote is the stable locator. */
                  lineStart: number;
                  /** @description Last line of the quote, inclusive. */
                  lineEnd: number;
                }[];
                /**
                 * @description How much weight the sources behind this position carry. `primary`: your own content, such as uploaded files and pages on your own site. `secondary`: other sources. `community`: forums and Q&A sites.
                 * @enum {string}
                 */
                authority?: 'primary' | 'secondary' | 'community';
              }[];
              /** @description Index in `sides` of the suggested side, when there is one. It is only a hint: nothing is chosen until you resolve the issue. */
              suggested?: number;
            } | {
              /**
               * @description How serious the issue is. `critical`: content is wrong or missing in a way that can mislead an agent. `suggestion`: a change that improves quality.
               * @enum {string}
               */
              severity: 'critical' | 'suggestion';
              /** @description Path of the entry the issue is about, or `*` when it applies to the whole knowledge base. */
              scopePath: string;
              /** @description What the problem is, in one or two sentences. */
              issue: string;
              /** @description What to do to fix the issue. */
              suggestedFix: string;
              /**
               * @description The issue type. `update_required` means an entry is out of date with its sources or contradicts an instruction, and needs a rewrite.
               * @enum {string}
               */
              kind: 'update_required';
              /** @description IDs of the documents that led to the issue. */
              citedDocumentIds?: string[];
              /** @description A key naming the specific finding, when the check that found it sets one. */
              claimKey?: string;
              /** @description Paths of the entries the issue involves, when it spans more than one entry. */
              involvedScopes?: string[];
            };
            /**
             * @description The triage status. `open`: waiting for triage. `accepted`: accepted with `POST .../issues/apply`, or a conflict resolved to one side. `rejected`: dismissed. A rejected issue stays rejected. You can return an accepted conflict to `open` with `POST .../issues/{issueId}/reopen`.
             * @enum {string}
             */
            status: 'open' | 'accepted' | 'rejected';
            /** @description Index in `content.sides` of the side chosen when the conflict was resolved. For a conflict on a single entry, index `0` is the entry's current content. `null` until a conflict is resolved, and always `null` for other issue types. */
            resolution: number | null;
            /** @description Who triaged the issue, so you can review what your agents decided. `null` while the issue is open, or when the caller could not be identified. */
            resolvedBy: {
              /** @description Sanity user ID of the person or robot that triaged the issue. */
              id: string;
              /**
               * @description `user` when a person made the decision. `robot` when a robot token did, such as an agent.
               * @enum {string}
               */
              kind: 'user' | 'robot';
            } | null;
            /**
             * Format: date-time
             * @description When the issue was first filed.
             */
            createdAt: string;
            /**
             * Format: date-time
             * @description When the issue left `open`. `null` while the issue is open.
             */
            resolvedAt: string | null;
          };
        };
      };
      /** @description Error */
      default: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': components['schemas']['ApiErrorBody'];
        };
      };
    };
  };
  reopenIssue: {
    parameters: {
      query?: never;
      header?: never;
      path: {
        /** @description The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted. */
        knowledgeBaseId: string;
        /** @description The issue's document ID. */
        issueId: string;
        /** @description The API version: a date in the format `vYYYY-MM-DD`, for example `v2026-05-26`, or `vX` for the latest, unstable version. */
        apiVersion: string;
      };
      cookie?: never;
    };
    requestBody?: never;
    responses: {
      /** @description An issue found in a knowledge base, and its triage status. */
      200: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': {
            /** @description The issue's document ID. A later build that finds the same issue in unchanged sources reuses this ID, so your triage decision is kept. */
            id: string;
            /** @description The ID (`kb...`) of the knowledge base the issue belongs to. */
            knowledgeBaseId: string;
            /** @description What the issue found. The shape depends on `kind`. */
            content: {
              /**
               * @description How serious the issue is. `critical`: content is wrong or missing in a way that can mislead an agent. `suggestion`: a change that improves quality.
               * @enum {string}
               */
              severity: 'critical' | 'suggestion';
              /** @description Path of the entry the issue is about, or `*` when it applies to the whole knowledge base. */
              scopePath: string;
              /** @description What the problem is, in one or two sentences. */
              issue: string;
              /** @description What to do to fix the issue. */
              suggestedFix: string;
              /**
               * @description The issue type. `conflict` means two or more positions disagree on the same fact, and you choose which one is correct.
               * @enum {string}
               */
              kind: 'conflict';
              /** @description A key naming the disputed fact, such as `free_tier.request_limit`. It never includes the disputed value, so every side shares it. */
              claimKey: string;
              /** @description One sentence that explains the question, when it needs one. */
              context?: string;
              /** @description The conflicting positions, at least two. To resolve the conflict, pass the index of one side as `resolution`. */
              sides: {
                /** @description The position as a self-contained sentence. This is the option you choose from. */
                claim: string;
                /** @description The disputed value on its own, such as `10,000/month`, without the sentence. */
                value?: string;
                /** @description Paths of the entries that state this position. */
                entryPaths?: string[];
                /** @description IDs of the documents that directly back this position. */
                documentIds?: string[];
                /** @description The documents that state this value, by the names you know them by. */
                where?: string;
                /** @description Quotes from the documents that state this value, copied word for word and checked against each document. A document whose wording could not be checked has none. */
                citations?: {
                  /** @description Stable ID of this citation: 10 lowercase letters and digits. An entry body points to it with a `[^key]` marker. */
                  _key: string;
                  /** @enum {string} */
                  _type: 'sanity.context.citation';
                  /** @description ID of the document the quote comes from. Read it with `GET .../documents/{documentId}/content`. */
                  documentId: string;
                  /** @description ID of the chunk of the document that holds the quote's first line. A chunk is the text under one heading, and keeps its ID across versions of the document while its headings stay the same. */
                  chunkId: string;
                  /** @description The document's name when the entry was written. */
                  title: string;
                  /** @description Where the document lives on the web. Absent for uploaded files and datasets. */
                  url?: string;
                  /** @description The passage from the document that backs the claims, copied word for word. */
                  quote: string;
                  /** @description Up to 32 characters of document text just before the quote, to tell repeats apart. */
                  prefix: string;
                  /** @description Up to 32 characters of document text just after the quote, to tell repeats apart. */
                  suffix: string;
                  /** @description First line of the quote in the document, counting from 1. Line numbers match `GET .../documents/{documentId}/content`. A hint: the quote is the stable locator. */
                  lineStart: number;
                  /** @description Last line of the quote, inclusive. */
                  lineEnd: number;
                }[];
                /**
                 * @description How much weight the sources behind this position carry. `primary`: your own content, such as uploaded files and pages on your own site. `secondary`: other sources. `community`: forums and Q&A sites.
                 * @enum {string}
                 */
                authority?: 'primary' | 'secondary' | 'community';
              }[];
              /** @description Index in `sides` of the suggested side, when there is one. It is only a hint: nothing is chosen until you resolve the issue. */
              suggested?: number;
            } | {
              /**
               * @description How serious the issue is. `critical`: content is wrong or missing in a way that can mislead an agent. `suggestion`: a change that improves quality.
               * @enum {string}
               */
              severity: 'critical' | 'suggestion';
              /** @description Path of the entry the issue is about, or `*` when it applies to the whole knowledge base. */
              scopePath: string;
              /** @description What the problem is, in one or two sentences. */
              issue: string;
              /** @description What to do to fix the issue. */
              suggestedFix: string;
              /**
               * @description The issue type. `update_required` means an entry is out of date with its sources or contradicts an instruction, and needs a rewrite.
               * @enum {string}
               */
              kind: 'update_required';
              /** @description IDs of the documents that led to the issue. */
              citedDocumentIds?: string[];
              /** @description A key naming the specific finding, when the check that found it sets one. */
              claimKey?: string;
              /** @description Paths of the entries the issue involves, when it spans more than one entry. */
              involvedScopes?: string[];
            };
            /**
             * @description The triage status. `open`: waiting for triage. `accepted`: accepted with `POST .../issues/apply`, or a conflict resolved to one side. `rejected`: dismissed. A rejected issue stays rejected. You can return an accepted conflict to `open` with `POST .../issues/{issueId}/reopen`.
             * @enum {string}
             */
            status: 'open' | 'accepted' | 'rejected';
            /** @description Index in `content.sides` of the side chosen when the conflict was resolved. For a conflict on a single entry, index `0` is the entry's current content. `null` until a conflict is resolved, and always `null` for other issue types. */
            resolution: number | null;
            /** @description Who triaged the issue, so you can review what your agents decided. `null` while the issue is open, or when the caller could not be identified. */
            resolvedBy: {
              /** @description Sanity user ID of the person or robot that triaged the issue. */
              id: string;
              /**
               * @description `user` when a person made the decision. `robot` when a robot token did, such as an agent.
               * @enum {string}
               */
              kind: 'user' | 'robot';
            } | null;
            /**
             * Format: date-time
             * @description When the issue was first filed.
             */
            createdAt: string;
            /**
             * Format: date-time
             * @description When the issue left `open`. `null` while the issue is open.
             */
            resolvedAt: string | null;
          };
        };
      };
      /** @description Error */
      default: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': components['schemas']['ApiErrorBody'];
        };
      };
    };
  };
  resolveIssue: {
    parameters: {
      query?: never;
      header?: never;
      path: {
        /** @description The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted. */
        knowledgeBaseId: string;
        /** @description The issue's document ID. */
        issueId: string;
        /** @description The API version: a date in the format `vYYYY-MM-DD`, for example `v2026-05-26`, or `vX` for the latest, unstable version. */
        apiVersion: string;
      };
      cookie?: never;
    };
    requestBody: {
      content: {
        'application/json': {
          /** @description The index of the chosen side in the issue's `content.sides`. */
          resolution: number;
        };
      };
    };
    responses: {
      /** @description The resolved issue, plus the job that rewrites the entry when the decision changes it. */
      200: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': {
            /** @description The resolved conflict issue, now `accepted`. */
            issue: {
              /** @description The issue's document ID. A later build that finds the same issue in unchanged sources reuses this ID, so your triage decision is kept. */
              id: string;
              /** @description The ID (`kb...`) of the knowledge base the issue belongs to. */
              knowledgeBaseId: string;
              /** @description What the issue found. The shape depends on `kind`. */
              content: {
                /**
                 * @description How serious the issue is. `critical`: content is wrong or missing in a way that can mislead an agent. `suggestion`: a change that improves quality.
                 * @enum {string}
                 */
                severity: 'critical' | 'suggestion';
                /** @description Path of the entry the issue is about, or `*` when it applies to the whole knowledge base. */
                scopePath: string;
                /** @description What the problem is, in one or two sentences. */
                issue: string;
                /** @description What to do to fix the issue. */
                suggestedFix: string;
                /**
                 * @description The issue type. `conflict` means two or more positions disagree on the same fact, and you choose which one is correct.
                 * @enum {string}
                 */
                kind: 'conflict';
                /** @description A key naming the disputed fact, such as `free_tier.request_limit`. It never includes the disputed value, so every side shares it. */
                claimKey: string;
                /** @description One sentence that explains the question, when it needs one. */
                context?: string;
                /** @description The conflicting positions, at least two. To resolve the conflict, pass the index of one side as `resolution`. */
                sides: {
                  /** @description The position as a self-contained sentence. This is the option you choose from. */
                  claim: string;
                  /** @description The disputed value on its own, such as `10,000/month`, without the sentence. */
                  value?: string;
                  /** @description Paths of the entries that state this position. */
                  entryPaths?: string[];
                  /** @description IDs of the documents that directly back this position. */
                  documentIds?: string[];
                  /** @description The documents that state this value, by the names you know them by. */
                  where?: string;
                  /** @description Quotes from the documents that state this value, copied word for word and checked against each document. A document whose wording could not be checked has none. */
                  citations?: {
                    /** @description Stable ID of this citation: 10 lowercase letters and digits. An entry body points to it with a `[^key]` marker. */
                    _key: string;
                    /** @enum {string} */
                    _type: 'sanity.context.citation';
                    /** @description ID of the document the quote comes from. Read it with `GET .../documents/{documentId}/content`. */
                    documentId: string;
                    /** @description ID of the chunk of the document that holds the quote's first line. A chunk is the text under one heading, and keeps its ID across versions of the document while its headings stay the same. */
                    chunkId: string;
                    /** @description The document's name when the entry was written. */
                    title: string;
                    /** @description Where the document lives on the web. Absent for uploaded files and datasets. */
                    url?: string;
                    /** @description The passage from the document that backs the claims, copied word for word. */
                    quote: string;
                    /** @description Up to 32 characters of document text just before the quote, to tell repeats apart. */
                    prefix: string;
                    /** @description Up to 32 characters of document text just after the quote, to tell repeats apart. */
                    suffix: string;
                    /** @description First line of the quote in the document, counting from 1. Line numbers match `GET .../documents/{documentId}/content`. A hint: the quote is the stable locator. */
                    lineStart: number;
                    /** @description Last line of the quote, inclusive. */
                    lineEnd: number;
                  }[];
                  /**
                   * @description How much weight the sources behind this position carry. `primary`: your own content, such as uploaded files and pages on your own site. `secondary`: other sources. `community`: forums and Q&A sites.
                   * @enum {string}
                   */
                  authority?: 'primary' | 'secondary' | 'community';
                }[];
                /** @description Index in `sides` of the suggested side, when there is one. It is only a hint: nothing is chosen until you resolve the issue. */
                suggested?: number;
              } | {
                /**
                 * @description How serious the issue is. `critical`: content is wrong or missing in a way that can mislead an agent. `suggestion`: a change that improves quality.
                 * @enum {string}
                 */
                severity: 'critical' | 'suggestion';
                /** @description Path of the entry the issue is about, or `*` when it applies to the whole knowledge base. */
                scopePath: string;
                /** @description What the problem is, in one or two sentences. */
                issue: string;
                /** @description What to do to fix the issue. */
                suggestedFix: string;
                /**
                 * @description The issue type. `update_required` means an entry is out of date with its sources or contradicts an instruction, and needs a rewrite.
                 * @enum {string}
                 */
                kind: 'update_required';
                /** @description IDs of the documents that led to the issue. */
                citedDocumentIds?: string[];
                /** @description A key naming the specific finding, when the check that found it sets one. */
                claimKey?: string;
                /** @description Paths of the entries the issue involves, when it spans more than one entry. */
                involvedScopes?: string[];
              };
              /**
               * @description The triage status. `open`: waiting for triage. `accepted`: accepted with `POST .../issues/apply`, or a conflict resolved to one side. `rejected`: dismissed. A rejected issue stays rejected. You can return an accepted conflict to `open` with `POST .../issues/{issueId}/reopen`.
               * @enum {string}
               */
              status: 'open' | 'accepted' | 'rejected';
              /** @description Index in `content.sides` of the side chosen when the conflict was resolved. For a conflict on a single entry, index `0` is the entry's current content. `null` until a conflict is resolved, and always `null` for other issue types. */
              resolution: number | null;
              /** @description Who triaged the issue, so you can review what your agents decided. `null` while the issue is open, or when the caller could not be identified. */
              resolvedBy: {
                /** @description Sanity user ID of the person or robot that triaged the issue. */
                id: string;
                /**
                 * @description `user` when a person made the decision. `robot` when a robot token did, such as an agent.
                 * @enum {string}
                 */
                kind: 'user' | 'robot';
              } | null;
              /**
               * Format: date-time
               * @description When the issue was first filed.
               */
              createdAt: string;
              /**
               * Format: date-time
               * @description When the issue left `open`. `null` while the issue is open.
               */
              resolvedAt: string | null;
            };
            /** @description ID of the job that rewrites the entry to match the chosen side. Poll it with `GET .../jobs/{jobId}`. `null` when nothing is rewritten: you chose index `0`, or the conflict applies to the whole knowledge base. */
            jobId: string | null;
          };
        };
      };
      /** @description Error */
      default: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': components['schemas']['ApiErrorBody'];
        };
      };
    };
  };
  getJob: {
    parameters: {
      query?: never;
      header?: never;
      path: {
        /** @description The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted. */
        knowledgeBaseId: string;
        /** @description The job ID returned by the endpoint that started the work. */
        jobId: string;
        /** @description The API version: a date in the format `vYYYY-MM-DD`, for example `v2026-05-26`, or `vX` for the latest, unstable version. */
        apiVersion: string;
      };
      cookie?: never;
    };
    requestBody?: never;
    responses: {
      /** @description A background job, such as a build, an update or a sync, and its status. `kind` says which, and determines the shape of `result`. */
      200: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': {
            /** @description The job's ID. Treat it as an opaque string. Its format can change. */
            id: string;
            /** @description The ID (`kb…`) of the knowledge base the job belongs to. */
            knowledgeBaseId: string;
            /**
             * @description The job's status. `queued`: waiting for build capacity. `running`: in progress. `succeeded`: finished successfully. `failed`: stopped with an error. `cancelled`: stopped before it finished. `pending` isn't currently returned.
             * @enum {string}
             */
            status: 'pending' | 'queued' | 'running' | 'succeeded' | 'failed' | 'cancelled';
            /**
             * Format: date-time
             * @description When the job started.
             */
            startedAt: string | null;
            /**
             * Format: date-time
             * @description When the job finished. `null` while the job is queued or running.
             */
            completedAt: string | null;
            /** @description A readable reason the job failed or was cancelled. `null` for any other status. */
            error?: string | null;
            /** @enum {string} */
            kind: 'build';
            /** @description The job's output. Only present when `status` is `succeeded`. */
            result?: {
              /** @description The revision the build produced. */
              revisionId: string;
              /** @description How many entries the built outline has. */
              entryCount: number;
              /** @description How many issues the build filed. */
              issuesCreated: number;
              /** @description How many of those issues are critical. */
              criticalIssueCount: number;
            };
          } | {
            /** @description The job's ID. Treat it as an opaque string. Its format can change. */
            id: string;
            /** @description The ID (`kb…`) of the knowledge base the job belongs to. */
            knowledgeBaseId: string;
            /**
             * @description The job's status. `queued`: waiting for build capacity. `running`: in progress. `succeeded`: finished successfully. `failed`: stopped with an error. `cancelled`: stopped before it finished. `pending` isn't currently returned.
             * @enum {string}
             */
            status: 'pending' | 'queued' | 'running' | 'succeeded' | 'failed' | 'cancelled';
            /**
             * Format: date-time
             * @description When the job started.
             */
            startedAt: string | null;
            /**
             * Format: date-time
             * @description When the job finished. `null` while the job is queued or running.
             */
            completedAt: string | null;
            /** @description A readable reason the job failed or was cancelled. `null` for any other status. */
            error?: string | null;
            /** @enum {string} */
            kind: 'update';
            /** @description The job's output. Only present when `status` is `succeeded`. */
            result?: {
              /** @description The revision the update produced. `null` when no entry changed. */
              revisionId: string | null;
              /** @description How many entries were rewritten. */
              entriesRewritten: number;
            };
          } | {
            /** @description The job's ID. Treat it as an opaque string. Its format can change. */
            id: string;
            /** @description The ID (`kb…`) of the knowledge base the job belongs to. */
            knowledgeBaseId: string;
            /**
             * @description The job's status. `queued`: waiting for build capacity. `running`: in progress. `succeeded`: finished successfully. `failed`: stopped with an error. `cancelled`: stopped before it finished. `pending` isn't currently returned.
             * @enum {string}
             */
            status: 'pending' | 'queued' | 'running' | 'succeeded' | 'failed' | 'cancelled';
            /**
             * Format: date-time
             * @description When the job started.
             */
            startedAt: string | null;
            /**
             * Format: date-time
             * @description When the job finished. `null` while the job is queued or running.
             */
            completedAt: string | null;
            /** @description A readable reason the job failed or was cancelled. `null` for any other status. */
            error?: string | null;
            /** @enum {string} */
            kind: 'sync';
            /** @description The job's output. Only present when `status` is `succeeded`. A job can succeed with its sync `held`: check `result.status`. */
            result?: {
              /**
               * Format: uuid
               * @description The ID of the source the job synced.
               */
              sourceId: string;
              /**
               * Format: uuid
               * @description The ID of the sync the job ran. Follow it with `GET .../sources/{sourceId}/syncs/{syncId}`.
               */
              syncId: string;
              /**
               * @description The sync's status when the job finished. `completed`: the sync applied every change. `held`: the sync would delete many documents and waits for you to confirm or discard the deletion (`POST .../syncs/{syncId}/confirm` or `.../discard`). The sync's own `status` shows whether that has happened since.
               * @enum {string}
               */
              status: 'completed' | 'held';
              /** @description How many documents the held deletion would remove. `null` unless `status` is `held`. */
              heldDeletions: number | null;
            };
          };
        };
      };
      /** @description Error */
      default: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': components['schemas']['ApiErrorBody'];
        };
      };
    };
  };
  listSources: {
    parameters: {
      query?: {
        /** @description The `nextCursor` value from the previous page. Omit it to get the first page. */
        cursor?: string;
        /** @description The maximum number of items to return. */
        limit?: number;
      };
      header?: never;
      path: {
        /** @description The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted. */
        knowledgeBaseId: string;
        /** @description The API version: a date in the format `vYYYY-MM-DD`, for example `v2026-05-26`, or `vX` for the latest, unstable version. */
        apiVersion: string;
      };
      cookie?: never;
    };
    requestBody?: never;
    responses: {
      /** @description A page of sources. */
      200: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': {
            /** @description The items on this page. */
            data: ({
              /**
               * Format: uuid
               * @description The source's ID.
               */
              id: string;
              /** @description The ID (`kb…`) of the knowledge base the source belongs to. */
              knowledgeBaseId: string;
              /** @description The source's title. */
              title: string;
              /** @description The number of `active` and `missing` documents. */
              documentCount: number;
              /** @description How many of those documents are converted to markdown, ready for builds. */
              convertedDocumentCount: number;
              /** @description How many of those documents have a file type that can't be converted. */
              skippedDocumentCount: number;
              /** @description How many of those documents failed to convert or were too large to. */
              failedDocumentCount: number;
              /** @description The number of chunks in its documents' markdown, the unit usage is counted in. */
              chunkCount: number;
              /**
               * Format: date-time
               * @description When a sync of the source last finished. `null` before the first one.
               */
              lastSyncedAt: string | null;
              /** @description The most recent sync, running or finished. `null` before the first one. */
              latestSync: {
                /**
                 * Format: uuid
                 * @description The sync's ID.
                 */
                id: string;
                /**
                 * Format: uuid
                 * @description The ID of the source the sync read.
                 */
                sourceId: string;
                /**
                 * @description `full` reads the whole source and removes what it no longer finds. `incremental` reads only what changed since the last sync.
                 * @enum {string}
                 */
                mode: 'full' | 'incremental';
                /**
                 * @description What started the sync: `schedule`, `manual` (an API call or the dashboard), `upload` (a new file), `event` or `push`.
                 * @enum {string}
                 */
                trigger: 'schedule' | 'manual' | 'upload' | 'event' | 'push';
                /**
                 * @description The sync's status. `running`: still reading or converting. `held`: the sync would delete every document of the source, or five or more that are over a fifth of them, and waits for you to confirm or discard the deletion; the next sync of the source cancels it and holds again if the deletion still stands. `completed`, `failed` and `cancelled` are final.
                 * @enum {string}
                 */
                status: 'running' | 'held' | 'completed' | 'failed' | 'cancelled';
                /** @description The number of documents the sync read. */
                documentsSeen: number;
                /** @description The number of documents the sync added or changed. */
                documentsUpserted: number;
                /** @description The number of documents the sync read that had not changed. */
                documentsUnchanged: number;
                /** @description The number of documents the sync deleted. */
                documentsDeleted: number;
                /** @description The number of web pages the sync marked `missing` because several crawls in a row didn't find them. */
                documentsMissing: number;
                /** @description How many documents the held deletion would remove. Set while the sync is `held`, and kept after you confirm or discard it. `null` when the sync was never held. */
                heldDeletions: number | null;
                /**
                 * @description Why the sync stopped before it read the whole source, so it removed nothing. `page-limit`: the crawl reached its page limit. `source-limit`: the knowledge base had no room for more documents. `stalled`: the crawl stopped making progress. `time-limit`: the crawl ran out of time. `null` when the sync read the whole source, or hasn't finished.
                 * @enum {string|null}
                 */
                partialReason: 'page-limit' | 'source-limit' | 'stalled' | 'time-limit' | null;
                /** @description Why the sync failed, written to show to users. `null` unless `status` is `failed`. */
                error: string | null;
                /**
                 * Format: date-time
                 * @description When the sync started.
                 */
                createdAt: string;
                /**
                 * Format: date-time
                 * @description When the sync finished. `null` while it is `running` or `held`.
                 */
                finishedAt: string | null;
              } | null;
              /**
               * Format: date-time
               * @description When the source was added.
               */
              createdAt: string;
              /**
               * Format: date-time
               * @description When the source last changed.
               */
              updatedAt: string;
              /**
               * @description The source type. `web` is a crawled website.
               * @enum {string}
               */
              type: 'web';
              /** @description The URL the crawl starts from. */
              url: string;
              /** @description Options that control how a website is crawled. */
              crawlOptions: {
                /** @description Regular expressions for URL paths to crawl. When set, the crawl only includes pages whose path matches one of them. */
                includePaths?: string[];
                /** @description Regular expressions for URL paths to skip. Pages whose path matches one of them aren't crawled. */
                excludePaths?: string[];
                /** @description How many levels deep the crawl goes from the root URL. */
                maxDepth?: number;
                /** @description Whether to crawl only the pages listed in the site's sitemap. */
                sitemapOnly?: boolean;
                /** @description Whether to treat URLs that differ only by query string as one page. New crawls set it to `true` unless you set it. Set it to `false` when the query string selects different content, such as pagination. */
                ignoreQueryParameters?: boolean;
                /** @description The maximum number of pages to crawl. The crawl can stop sooner when the knowledge base reaches its source limit. */
                pageLimit?: number;
              };
              /**
               * @description How often the source syncs on its own: `weekly` or `monthly`. `null` when it syncs only when asked to.
               * @enum {string|null}
               */
              syncFrequency: 'weekly' | 'monthly' | null;
            } | {
              /**
               * Format: uuid
               * @description The source's ID.
               */
              id: string;
              /** @description The ID (`kb…`) of the knowledge base the source belongs to. */
              knowledgeBaseId: string;
              /** @description The source's title. */
              title: string;
              /** @description The number of `active` and `missing` documents. */
              documentCount: number;
              /** @description How many of those documents are converted to markdown, ready for builds. */
              convertedDocumentCount: number;
              /** @description How many of those documents have a file type that can't be converted. */
              skippedDocumentCount: number;
              /** @description How many of those documents failed to convert or were too large to. */
              failedDocumentCount: number;
              /** @description The number of chunks in its documents' markdown, the unit usage is counted in. */
              chunkCount: number;
              /**
               * Format: date-time
               * @description When a sync of the source last finished. `null` before the first one.
               */
              lastSyncedAt: string | null;
              /** @description The most recent sync, running or finished. `null` before the first one. */
              latestSync: {
                /**
                 * Format: uuid
                 * @description The sync's ID.
                 */
                id: string;
                /**
                 * Format: uuid
                 * @description The ID of the source the sync read.
                 */
                sourceId: string;
                /**
                 * @description `full` reads the whole source and removes what it no longer finds. `incremental` reads only what changed since the last sync.
                 * @enum {string}
                 */
                mode: 'full' | 'incremental';
                /**
                 * @description What started the sync: `schedule`, `manual` (an API call or the dashboard), `upload` (a new file), `event` or `push`.
                 * @enum {string}
                 */
                trigger: 'schedule' | 'manual' | 'upload' | 'event' | 'push';
                /**
                 * @description The sync's status. `running`: still reading or converting. `held`: the sync would delete every document of the source, or five or more that are over a fifth of them, and waits for you to confirm or discard the deletion; the next sync of the source cancels it and holds again if the deletion still stands. `completed`, `failed` and `cancelled` are final.
                 * @enum {string}
                 */
                status: 'running' | 'held' | 'completed' | 'failed' | 'cancelled';
                /** @description The number of documents the sync read. */
                documentsSeen: number;
                /** @description The number of documents the sync added or changed. */
                documentsUpserted: number;
                /** @description The number of documents the sync read that had not changed. */
                documentsUnchanged: number;
                /** @description The number of documents the sync deleted. */
                documentsDeleted: number;
                /** @description The number of web pages the sync marked `missing` because several crawls in a row didn't find them. */
                documentsMissing: number;
                /** @description How many documents the held deletion would remove. Set while the sync is `held`, and kept after you confirm or discard it. `null` when the sync was never held. */
                heldDeletions: number | null;
                /**
                 * @description Why the sync stopped before it read the whole source, so it removed nothing. `page-limit`: the crawl reached its page limit. `source-limit`: the knowledge base had no room for more documents. `stalled`: the crawl stopped making progress. `time-limit`: the crawl ran out of time. `null` when the sync read the whole source, or hasn't finished.
                 * @enum {string|null}
                 */
                partialReason: 'page-limit' | 'source-limit' | 'stalled' | 'time-limit' | null;
                /** @description Why the sync failed, written to show to users. `null` unless `status` is `failed`. */
                error: string | null;
                /**
                 * Format: date-time
                 * @description When the sync started.
                 */
                createdAt: string;
                /**
                 * Format: date-time
                 * @description When the sync finished. `null` while it is `running` or `held`.
                 */
                finishedAt: string | null;
              } | null;
              /**
               * Format: date-time
               * @description When the source was added.
               */
              createdAt: string;
              /**
               * Format: date-time
               * @description When the source last changed.
               */
              updatedAt: string;
              /**
               * @description The source type. `sanity-dataset` is a GROQ query over a Sanity dataset.
               * @enum {string}
               */
              type: 'sanity-dataset';
              /** @description The ID of the Sanity project the documents come from. */
              sanityProjectId: string;
              /** @description The dataset the documents come from. */
              sanityDatasetId: string;
              /** @description The GROQ query that selects the documents. */
              query: string;
              /**
               * @description How often the source syncs on its own: `weekly` or `monthly`. `null` when it syncs only when asked to.
               * @enum {string|null}
               */
              syncFrequency: 'weekly' | 'monthly' | null;
            } | {
              /**
               * Format: uuid
               * @description The source's ID.
               */
              id: string;
              /** @description The ID (`kb…`) of the knowledge base the source belongs to. */
              knowledgeBaseId: string;
              /** @description The source's title. */
              title: string;
              /** @description The number of `active` and `missing` documents. */
              documentCount: number;
              /** @description How many of those documents are converted to markdown, ready for builds. */
              convertedDocumentCount: number;
              /** @description How many of those documents have a file type that can't be converted. */
              skippedDocumentCount: number;
              /** @description How many of those documents failed to convert or were too large to. */
              failedDocumentCount: number;
              /** @description The number of chunks in its documents' markdown, the unit usage is counted in. */
              chunkCount: number;
              /**
               * Format: date-time
               * @description When a sync of the source last finished. `null` before the first one.
               */
              lastSyncedAt: string | null;
              /** @description The most recent sync, running or finished. `null` before the first one. */
              latestSync: {
                /**
                 * Format: uuid
                 * @description The sync's ID.
                 */
                id: string;
                /**
                 * Format: uuid
                 * @description The ID of the source the sync read.
                 */
                sourceId: string;
                /**
                 * @description `full` reads the whole source and removes what it no longer finds. `incremental` reads only what changed since the last sync.
                 * @enum {string}
                 */
                mode: 'full' | 'incremental';
                /**
                 * @description What started the sync: `schedule`, `manual` (an API call or the dashboard), `upload` (a new file), `event` or `push`.
                 * @enum {string}
                 */
                trigger: 'schedule' | 'manual' | 'upload' | 'event' | 'push';
                /**
                 * @description The sync's status. `running`: still reading or converting. `held`: the sync would delete every document of the source, or five or more that are over a fifth of them, and waits for you to confirm or discard the deletion; the next sync of the source cancels it and holds again if the deletion still stands. `completed`, `failed` and `cancelled` are final.
                 * @enum {string}
                 */
                status: 'running' | 'held' | 'completed' | 'failed' | 'cancelled';
                /** @description The number of documents the sync read. */
                documentsSeen: number;
                /** @description The number of documents the sync added or changed. */
                documentsUpserted: number;
                /** @description The number of documents the sync read that had not changed. */
                documentsUnchanged: number;
                /** @description The number of documents the sync deleted. */
                documentsDeleted: number;
                /** @description The number of web pages the sync marked `missing` because several crawls in a row didn't find them. */
                documentsMissing: number;
                /** @description How many documents the held deletion would remove. Set while the sync is `held`, and kept after you confirm or discard it. `null` when the sync was never held. */
                heldDeletions: number | null;
                /**
                 * @description Why the sync stopped before it read the whole source, so it removed nothing. `page-limit`: the crawl reached its page limit. `source-limit`: the knowledge base had no room for more documents. `stalled`: the crawl stopped making progress. `time-limit`: the crawl ran out of time. `null` when the sync read the whole source, or hasn't finished.
                 * @enum {string|null}
                 */
                partialReason: 'page-limit' | 'source-limit' | 'stalled' | 'time-limit' | null;
                /** @description Why the sync failed, written to show to users. `null` unless `status` is `failed`. */
                error: string | null;
                /**
                 * Format: date-time
                 * @description When the sync started.
                 */
                createdAt: string;
                /**
                 * Format: date-time
                 * @description When the sync finished. `null` while it is `running` or `held`.
                 */
                finishedAt: string | null;
              } | null;
              /**
               * Format: date-time
               * @description When the source was added.
               */
              createdAt: string;
              /**
               * Format: date-time
               * @description When the source last changed.
               */
              updatedAt: string;
              /**
               * @description The source type. `files` is an uploaded file or archive of files.
               * @enum {string}
               */
              type: 'files';
              /** @description The name of the file last synced. `null` before the first upload. */
              filename: string | null;
              /** @description The size of the file last synced, in bytes. `null` before the first upload. */
              sizeBytes: number | null;
            })[];
            /** @description The cursor for the next page. Pass it as `cursor` to get more results. `null` when there are no more pages. */
            nextCursor: string | null;
          };
        };
      };
      /** @description Error */
      default: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': components['schemas']['ApiErrorBody'];
        };
      };
    };
  };
  createSource: {
    parameters: {
      query?: never;
      header?: {
        /** @description A unique value, such as a UUID, that makes retries safe. A retry with the same key and body returns the first response instead of repeating the work. */
        'Idempotency-Key'?: string;
      };
      path: {
        /** @description The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted. */
        knowledgeBaseId: string;
        /** @description The API version: a date in the format `vYYYY-MM-DD`, for example `v2026-05-26`, or `vX` for the latest, unstable version. */
        apiVersion: string;
      };
      cookie?: never;
    };
    /** @description The source to add. The `type` field sets its kind. */
    requestBody: {
      content: {
        'application/json': {
          /**
           * @description The source type. `web` crawls a website.
           * @enum {string}
           */
          type: 'web';
          /**
           * Format: uri
           * @description The URL to start crawling from. It must be a public `http` or `https` URL.
           */
          url: string;
          /** @description Options for the crawl. Options you omit use the defaults. */
          crawlOptions?: {
            /** @description Regular expressions for URL paths to crawl. When set, the crawl only includes pages whose path matches one of them. */
            includePaths?: string[];
            /** @description Regular expressions for URL paths to skip. Pages whose path matches one of them aren't crawled. */
            excludePaths?: string[];
            /** @description How many levels deep the crawl goes from the root URL. */
            maxDepth?: number;
            /** @description Whether to crawl only the pages listed in the site's sitemap. */
            sitemapOnly?: boolean;
            /** @description Whether to treat URLs that differ only by query string as one page. New crawls set it to `true` unless you set it. Set it to `false` when the query string selects different content, such as pagination. */
            ignoreQueryParameters?: boolean;
            /** @description The maximum number of pages to crawl. The crawl can stop sooner when the knowledge base reaches its source limit. */
            pageLimit?: number;
          };
          /** @description Set to `true` to estimate what a crawl would fetch without adding the source. The response is then `200` with a preview of the pages the site has, grouped by path. */
          dryRun?: boolean;
        } | {
          /**
           * @description The source type. `sanity-dataset` reads documents from a Sanity dataset.
           * @enum {string}
           */
          type: 'sanity-dataset';
          /** @description The ID of the Sanity project to read documents from. You need full read access to the dataset and, on its project, the Administrator or Developer role or a custom role that can create datasets. */
          sanityProjectId: string;
          /** @description The dataset to read documents from. */
          sanityDatasetId: string;
          /** @description A GROQ query that selects the documents, with an optional projection. Each sync runs it again. */
          query: string;
        } | {
          /**
           * @description The source type. `files` holds an uploaded file, or text sent with `content`.
           * @enum {string}
           */
          type: 'files';
          /** @description The source's title. */
          title: string;
          /** @description Text or markdown for the source to hold, up to 1,000,000 bytes of UTF-8. The source syncs it at once, with no upload. Larger content goes through `POST .../sources/{sourceId}/uploads`. */
          content?: string;
          /**
           * @description The format of `content`: `text/markdown` (the default) or `text/plain`. Only with `content`.
           * @enum {string}
           */
          contentType?: 'text/markdown' | 'text/plain';
        };
      };
    };
    responses: {
      /** @description The preview of a crawl, when `dryRun` is `true`. */
      200: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': {
            /** @description How many pages the crawl would fetch, roughly. */
            totalPages: number;
            /** @description Whether the site has more pages than the preview counted. */
            truncated: boolean;
            /** @description The largest groups of pages by path, largest first. */
            groups: {
              /** @description The path the pages in the group share, such as `/docs/`. */
              prefix: string;
              /** @description How many pages the group has. */
              count: number;
            }[];
            /** @description How many pages are outside `groups`. */
            otherCount: number;
          };
        };
      };
      /** @description Something that yields documents for a knowledge base: a website, a dataset or files. */
      201: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': {
            /**
             * Format: uuid
             * @description The source's ID.
             */
            id: string;
            /** @description The ID (`kb…`) of the knowledge base the source belongs to. */
            knowledgeBaseId: string;
            /** @description The source's title. */
            title: string;
            /** @description The number of `active` and `missing` documents. */
            documentCount: number;
            /** @description How many of those documents are converted to markdown, ready for builds. */
            convertedDocumentCount: number;
            /** @description How many of those documents have a file type that can't be converted. */
            skippedDocumentCount: number;
            /** @description How many of those documents failed to convert or were too large to. */
            failedDocumentCount: number;
            /** @description The number of chunks in its documents' markdown, the unit usage is counted in. */
            chunkCount: number;
            /**
             * Format: date-time
             * @description When a sync of the source last finished. `null` before the first one.
             */
            lastSyncedAt: string | null;
            /** @description The most recent sync, running or finished. `null` before the first one. */
            latestSync: {
              /**
               * Format: uuid
               * @description The sync's ID.
               */
              id: string;
              /**
               * Format: uuid
               * @description The ID of the source the sync read.
               */
              sourceId: string;
              /**
               * @description `full` reads the whole source and removes what it no longer finds. `incremental` reads only what changed since the last sync.
               * @enum {string}
               */
              mode: 'full' | 'incremental';
              /**
               * @description What started the sync: `schedule`, `manual` (an API call or the dashboard), `upload` (a new file), `event` or `push`.
               * @enum {string}
               */
              trigger: 'schedule' | 'manual' | 'upload' | 'event' | 'push';
              /**
               * @description The sync's status. `running`: still reading or converting. `held`: the sync would delete every document of the source, or five or more that are over a fifth of them, and waits for you to confirm or discard the deletion; the next sync of the source cancels it and holds again if the deletion still stands. `completed`, `failed` and `cancelled` are final.
               * @enum {string}
               */
              status: 'running' | 'held' | 'completed' | 'failed' | 'cancelled';
              /** @description The number of documents the sync read. */
              documentsSeen: number;
              /** @description The number of documents the sync added or changed. */
              documentsUpserted: number;
              /** @description The number of documents the sync read that had not changed. */
              documentsUnchanged: number;
              /** @description The number of documents the sync deleted. */
              documentsDeleted: number;
              /** @description The number of web pages the sync marked `missing` because several crawls in a row didn't find them. */
              documentsMissing: number;
              /** @description How many documents the held deletion would remove. Set while the sync is `held`, and kept after you confirm or discard it. `null` when the sync was never held. */
              heldDeletions: number | null;
              /**
               * @description Why the sync stopped before it read the whole source, so it removed nothing. `page-limit`: the crawl reached its page limit. `source-limit`: the knowledge base had no room for more documents. `stalled`: the crawl stopped making progress. `time-limit`: the crawl ran out of time. `null` when the sync read the whole source, or hasn't finished.
               * @enum {string|null}
               */
              partialReason: 'page-limit' | 'source-limit' | 'stalled' | 'time-limit' | null;
              /** @description Why the sync failed, written to show to users. `null` unless `status` is `failed`. */
              error: string | null;
              /**
               * Format: date-time
               * @description When the sync started.
               */
              createdAt: string;
              /**
               * Format: date-time
               * @description When the sync finished. `null` while it is `running` or `held`.
               */
              finishedAt: string | null;
            } | null;
            /**
             * Format: date-time
             * @description When the source was added.
             */
            createdAt: string;
            /**
             * Format: date-time
             * @description When the source last changed.
             */
            updatedAt: string;
            /**
             * @description The source type. `web` is a crawled website.
             * @enum {string}
             */
            type: 'web';
            /** @description The URL the crawl starts from. */
            url: string;
            /** @description Options that control how a website is crawled. */
            crawlOptions: {
              /** @description Regular expressions for URL paths to crawl. When set, the crawl only includes pages whose path matches one of them. */
              includePaths?: string[];
              /** @description Regular expressions for URL paths to skip. Pages whose path matches one of them aren't crawled. */
              excludePaths?: string[];
              /** @description How many levels deep the crawl goes from the root URL. */
              maxDepth?: number;
              /** @description Whether to crawl only the pages listed in the site's sitemap. */
              sitemapOnly?: boolean;
              /** @description Whether to treat URLs that differ only by query string as one page. New crawls set it to `true` unless you set it. Set it to `false` when the query string selects different content, such as pagination. */
              ignoreQueryParameters?: boolean;
              /** @description The maximum number of pages to crawl. The crawl can stop sooner when the knowledge base reaches its source limit. */
              pageLimit?: number;
            };
            /**
             * @description How often the source syncs on its own: `weekly` or `monthly`. `null` when it syncs only when asked to.
             * @enum {string|null}
             */
            syncFrequency: 'weekly' | 'monthly' | null;
          } | {
            /**
             * Format: uuid
             * @description The source's ID.
             */
            id: string;
            /** @description The ID (`kb…`) of the knowledge base the source belongs to. */
            knowledgeBaseId: string;
            /** @description The source's title. */
            title: string;
            /** @description The number of `active` and `missing` documents. */
            documentCount: number;
            /** @description How many of those documents are converted to markdown, ready for builds. */
            convertedDocumentCount: number;
            /** @description How many of those documents have a file type that can't be converted. */
            skippedDocumentCount: number;
            /** @description How many of those documents failed to convert or were too large to. */
            failedDocumentCount: number;
            /** @description The number of chunks in its documents' markdown, the unit usage is counted in. */
            chunkCount: number;
            /**
             * Format: date-time
             * @description When a sync of the source last finished. `null` before the first one.
             */
            lastSyncedAt: string | null;
            /** @description The most recent sync, running or finished. `null` before the first one. */
            latestSync: {
              /**
               * Format: uuid
               * @description The sync's ID.
               */
              id: string;
              /**
               * Format: uuid
               * @description The ID of the source the sync read.
               */
              sourceId: string;
              /**
               * @description `full` reads the whole source and removes what it no longer finds. `incremental` reads only what changed since the last sync.
               * @enum {string}
               */
              mode: 'full' | 'incremental';
              /**
               * @description What started the sync: `schedule`, `manual` (an API call or the dashboard), `upload` (a new file), `event` or `push`.
               * @enum {string}
               */
              trigger: 'schedule' | 'manual' | 'upload' | 'event' | 'push';
              /**
               * @description The sync's status. `running`: still reading or converting. `held`: the sync would delete every document of the source, or five or more that are over a fifth of them, and waits for you to confirm or discard the deletion; the next sync of the source cancels it and holds again if the deletion still stands. `completed`, `failed` and `cancelled` are final.
               * @enum {string}
               */
              status: 'running' | 'held' | 'completed' | 'failed' | 'cancelled';
              /** @description The number of documents the sync read. */
              documentsSeen: number;
              /** @description The number of documents the sync added or changed. */
              documentsUpserted: number;
              /** @description The number of documents the sync read that had not changed. */
              documentsUnchanged: number;
              /** @description The number of documents the sync deleted. */
              documentsDeleted: number;
              /** @description The number of web pages the sync marked `missing` because several crawls in a row didn't find them. */
              documentsMissing: number;
              /** @description How many documents the held deletion would remove. Set while the sync is `held`, and kept after you confirm or discard it. `null` when the sync was never held. */
              heldDeletions: number | null;
              /**
               * @description Why the sync stopped before it read the whole source, so it removed nothing. `page-limit`: the crawl reached its page limit. `source-limit`: the knowledge base had no room for more documents. `stalled`: the crawl stopped making progress. `time-limit`: the crawl ran out of time. `null` when the sync read the whole source, or hasn't finished.
               * @enum {string|null}
               */
              partialReason: 'page-limit' | 'source-limit' | 'stalled' | 'time-limit' | null;
              /** @description Why the sync failed, written to show to users. `null` unless `status` is `failed`. */
              error: string | null;
              /**
               * Format: date-time
               * @description When the sync started.
               */
              createdAt: string;
              /**
               * Format: date-time
               * @description When the sync finished. `null` while it is `running` or `held`.
               */
              finishedAt: string | null;
            } | null;
            /**
             * Format: date-time
             * @description When the source was added.
             */
            createdAt: string;
            /**
             * Format: date-time
             * @description When the source last changed.
             */
            updatedAt: string;
            /**
             * @description The source type. `sanity-dataset` is a GROQ query over a Sanity dataset.
             * @enum {string}
             */
            type: 'sanity-dataset';
            /** @description The ID of the Sanity project the documents come from. */
            sanityProjectId: string;
            /** @description The dataset the documents come from. */
            sanityDatasetId: string;
            /** @description The GROQ query that selects the documents. */
            query: string;
            /**
             * @description How often the source syncs on its own: `weekly` or `monthly`. `null` when it syncs only when asked to.
             * @enum {string|null}
             */
            syncFrequency: 'weekly' | 'monthly' | null;
          } | {
            /**
             * Format: uuid
             * @description The source's ID.
             */
            id: string;
            /** @description The ID (`kb…`) of the knowledge base the source belongs to. */
            knowledgeBaseId: string;
            /** @description The source's title. */
            title: string;
            /** @description The number of `active` and `missing` documents. */
            documentCount: number;
            /** @description How many of those documents are converted to markdown, ready for builds. */
            convertedDocumentCount: number;
            /** @description How many of those documents have a file type that can't be converted. */
            skippedDocumentCount: number;
            /** @description How many of those documents failed to convert or were too large to. */
            failedDocumentCount: number;
            /** @description The number of chunks in its documents' markdown, the unit usage is counted in. */
            chunkCount: number;
            /**
             * Format: date-time
             * @description When a sync of the source last finished. `null` before the first one.
             */
            lastSyncedAt: string | null;
            /** @description The most recent sync, running or finished. `null` before the first one. */
            latestSync: {
              /**
               * Format: uuid
               * @description The sync's ID.
               */
              id: string;
              /**
               * Format: uuid
               * @description The ID of the source the sync read.
               */
              sourceId: string;
              /**
               * @description `full` reads the whole source and removes what it no longer finds. `incremental` reads only what changed since the last sync.
               * @enum {string}
               */
              mode: 'full' | 'incremental';
              /**
               * @description What started the sync: `schedule`, `manual` (an API call or the dashboard), `upload` (a new file), `event` or `push`.
               * @enum {string}
               */
              trigger: 'schedule' | 'manual' | 'upload' | 'event' | 'push';
              /**
               * @description The sync's status. `running`: still reading or converting. `held`: the sync would delete every document of the source, or five or more that are over a fifth of them, and waits for you to confirm or discard the deletion; the next sync of the source cancels it and holds again if the deletion still stands. `completed`, `failed` and `cancelled` are final.
               * @enum {string}
               */
              status: 'running' | 'held' | 'completed' | 'failed' | 'cancelled';
              /** @description The number of documents the sync read. */
              documentsSeen: number;
              /** @description The number of documents the sync added or changed. */
              documentsUpserted: number;
              /** @description The number of documents the sync read that had not changed. */
              documentsUnchanged: number;
              /** @description The number of documents the sync deleted. */
              documentsDeleted: number;
              /** @description The number of web pages the sync marked `missing` because several crawls in a row didn't find them. */
              documentsMissing: number;
              /** @description How many documents the held deletion would remove. Set while the sync is `held`, and kept after you confirm or discard it. `null` when the sync was never held. */
              heldDeletions: number | null;
              /**
               * @description Why the sync stopped before it read the whole source, so it removed nothing. `page-limit`: the crawl reached its page limit. `source-limit`: the knowledge base had no room for more documents. `stalled`: the crawl stopped making progress. `time-limit`: the crawl ran out of time. `null` when the sync read the whole source, or hasn't finished.
               * @enum {string|null}
               */
              partialReason: 'page-limit' | 'source-limit' | 'stalled' | 'time-limit' | null;
              /** @description Why the sync failed, written to show to users. `null` unless `status` is `failed`. */
              error: string | null;
              /**
               * Format: date-time
               * @description When the sync started.
               */
              createdAt: string;
              /**
               * Format: date-time
               * @description When the sync finished. `null` while it is `running` or `held`.
               */
              finishedAt: string | null;
            } | null;
            /**
             * Format: date-time
             * @description When the source was added.
             */
            createdAt: string;
            /**
             * Format: date-time
             * @description When the source last changed.
             */
            updatedAt: string;
            /**
             * @description The source type. `files` is an uploaded file or archive of files.
             * @enum {string}
             */
            type: 'files';
            /** @description The name of the file last synced. `null` before the first upload. */
            filename: string | null;
            /** @description The size of the file last synced, in bytes. `null` before the first upload. */
            sizeBytes: number | null;
          };
        };
      };
      /** @description Error */
      default: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': components['schemas']['ApiErrorBody'];
        };
      };
    };
  };
  getSource: {
    parameters: {
      query?: never;
      header?: never;
      path: {
        /** @description The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted. */
        knowledgeBaseId: string;
        /** @description The source's ID. */
        sourceId: string;
        /** @description The API version: a date in the format `vYYYY-MM-DD`, for example `v2026-05-26`, or `vX` for the latest, unstable version. */
        apiVersion: string;
      };
      cookie?: never;
    };
    requestBody?: never;
    responses: {
      /** @description Something that yields documents for a knowledge base: a website, a dataset or files. */
      200: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': {
            /**
             * Format: uuid
             * @description The source's ID.
             */
            id: string;
            /** @description The ID (`kb…`) of the knowledge base the source belongs to. */
            knowledgeBaseId: string;
            /** @description The source's title. */
            title: string;
            /** @description The number of `active` and `missing` documents. */
            documentCount: number;
            /** @description How many of those documents are converted to markdown, ready for builds. */
            convertedDocumentCount: number;
            /** @description How many of those documents have a file type that can't be converted. */
            skippedDocumentCount: number;
            /** @description How many of those documents failed to convert or were too large to. */
            failedDocumentCount: number;
            /** @description The number of chunks in its documents' markdown, the unit usage is counted in. */
            chunkCount: number;
            /**
             * Format: date-time
             * @description When a sync of the source last finished. `null` before the first one.
             */
            lastSyncedAt: string | null;
            /** @description The most recent sync, running or finished. `null` before the first one. */
            latestSync: {
              /**
               * Format: uuid
               * @description The sync's ID.
               */
              id: string;
              /**
               * Format: uuid
               * @description The ID of the source the sync read.
               */
              sourceId: string;
              /**
               * @description `full` reads the whole source and removes what it no longer finds. `incremental` reads only what changed since the last sync.
               * @enum {string}
               */
              mode: 'full' | 'incremental';
              /**
               * @description What started the sync: `schedule`, `manual` (an API call or the dashboard), `upload` (a new file), `event` or `push`.
               * @enum {string}
               */
              trigger: 'schedule' | 'manual' | 'upload' | 'event' | 'push';
              /**
               * @description The sync's status. `running`: still reading or converting. `held`: the sync would delete every document of the source, or five or more that are over a fifth of them, and waits for you to confirm or discard the deletion; the next sync of the source cancels it and holds again if the deletion still stands. `completed`, `failed` and `cancelled` are final.
               * @enum {string}
               */
              status: 'running' | 'held' | 'completed' | 'failed' | 'cancelled';
              /** @description The number of documents the sync read. */
              documentsSeen: number;
              /** @description The number of documents the sync added or changed. */
              documentsUpserted: number;
              /** @description The number of documents the sync read that had not changed. */
              documentsUnchanged: number;
              /** @description The number of documents the sync deleted. */
              documentsDeleted: number;
              /** @description The number of web pages the sync marked `missing` because several crawls in a row didn't find them. */
              documentsMissing: number;
              /** @description How many documents the held deletion would remove. Set while the sync is `held`, and kept after you confirm or discard it. `null` when the sync was never held. */
              heldDeletions: number | null;
              /**
               * @description Why the sync stopped before it read the whole source, so it removed nothing. `page-limit`: the crawl reached its page limit. `source-limit`: the knowledge base had no room for more documents. `stalled`: the crawl stopped making progress. `time-limit`: the crawl ran out of time. `null` when the sync read the whole source, or hasn't finished.
               * @enum {string|null}
               */
              partialReason: 'page-limit' | 'source-limit' | 'stalled' | 'time-limit' | null;
              /** @description Why the sync failed, written to show to users. `null` unless `status` is `failed`. */
              error: string | null;
              /**
               * Format: date-time
               * @description When the sync started.
               */
              createdAt: string;
              /**
               * Format: date-time
               * @description When the sync finished. `null` while it is `running` or `held`.
               */
              finishedAt: string | null;
            } | null;
            /**
             * Format: date-time
             * @description When the source was added.
             */
            createdAt: string;
            /**
             * Format: date-time
             * @description When the source last changed.
             */
            updatedAt: string;
            /**
             * @description The source type. `web` is a crawled website.
             * @enum {string}
             */
            type: 'web';
            /** @description The URL the crawl starts from. */
            url: string;
            /** @description Options that control how a website is crawled. */
            crawlOptions: {
              /** @description Regular expressions for URL paths to crawl. When set, the crawl only includes pages whose path matches one of them. */
              includePaths?: string[];
              /** @description Regular expressions for URL paths to skip. Pages whose path matches one of them aren't crawled. */
              excludePaths?: string[];
              /** @description How many levels deep the crawl goes from the root URL. */
              maxDepth?: number;
              /** @description Whether to crawl only the pages listed in the site's sitemap. */
              sitemapOnly?: boolean;
              /** @description Whether to treat URLs that differ only by query string as one page. New crawls set it to `true` unless you set it. Set it to `false` when the query string selects different content, such as pagination. */
              ignoreQueryParameters?: boolean;
              /** @description The maximum number of pages to crawl. The crawl can stop sooner when the knowledge base reaches its source limit. */
              pageLimit?: number;
            };
            /**
             * @description How often the source syncs on its own: `weekly` or `monthly`. `null` when it syncs only when asked to.
             * @enum {string|null}
             */
            syncFrequency: 'weekly' | 'monthly' | null;
          } | {
            /**
             * Format: uuid
             * @description The source's ID.
             */
            id: string;
            /** @description The ID (`kb…`) of the knowledge base the source belongs to. */
            knowledgeBaseId: string;
            /** @description The source's title. */
            title: string;
            /** @description The number of `active` and `missing` documents. */
            documentCount: number;
            /** @description How many of those documents are converted to markdown, ready for builds. */
            convertedDocumentCount: number;
            /** @description How many of those documents have a file type that can't be converted. */
            skippedDocumentCount: number;
            /** @description How many of those documents failed to convert or were too large to. */
            failedDocumentCount: number;
            /** @description The number of chunks in its documents' markdown, the unit usage is counted in. */
            chunkCount: number;
            /**
             * Format: date-time
             * @description When a sync of the source last finished. `null` before the first one.
             */
            lastSyncedAt: string | null;
            /** @description The most recent sync, running or finished. `null` before the first one. */
            latestSync: {
              /**
               * Format: uuid
               * @description The sync's ID.
               */
              id: string;
              /**
               * Format: uuid
               * @description The ID of the source the sync read.
               */
              sourceId: string;
              /**
               * @description `full` reads the whole source and removes what it no longer finds. `incremental` reads only what changed since the last sync.
               * @enum {string}
               */
              mode: 'full' | 'incremental';
              /**
               * @description What started the sync: `schedule`, `manual` (an API call or the dashboard), `upload` (a new file), `event` or `push`.
               * @enum {string}
               */
              trigger: 'schedule' | 'manual' | 'upload' | 'event' | 'push';
              /**
               * @description The sync's status. `running`: still reading or converting. `held`: the sync would delete every document of the source, or five or more that are over a fifth of them, and waits for you to confirm or discard the deletion; the next sync of the source cancels it and holds again if the deletion still stands. `completed`, `failed` and `cancelled` are final.
               * @enum {string}
               */
              status: 'running' | 'held' | 'completed' | 'failed' | 'cancelled';
              /** @description The number of documents the sync read. */
              documentsSeen: number;
              /** @description The number of documents the sync added or changed. */
              documentsUpserted: number;
              /** @description The number of documents the sync read that had not changed. */
              documentsUnchanged: number;
              /** @description The number of documents the sync deleted. */
              documentsDeleted: number;
              /** @description The number of web pages the sync marked `missing` because several crawls in a row didn't find them. */
              documentsMissing: number;
              /** @description How many documents the held deletion would remove. Set while the sync is `held`, and kept after you confirm or discard it. `null` when the sync was never held. */
              heldDeletions: number | null;
              /**
               * @description Why the sync stopped before it read the whole source, so it removed nothing. `page-limit`: the crawl reached its page limit. `source-limit`: the knowledge base had no room for more documents. `stalled`: the crawl stopped making progress. `time-limit`: the crawl ran out of time. `null` when the sync read the whole source, or hasn't finished.
               * @enum {string|null}
               */
              partialReason: 'page-limit' | 'source-limit' | 'stalled' | 'time-limit' | null;
              /** @description Why the sync failed, written to show to users. `null` unless `status` is `failed`. */
              error: string | null;
              /**
               * Format: date-time
               * @description When the sync started.
               */
              createdAt: string;
              /**
               * Format: date-time
               * @description When the sync finished. `null` while it is `running` or `held`.
               */
              finishedAt: string | null;
            } | null;
            /**
             * Format: date-time
             * @description When the source was added.
             */
            createdAt: string;
            /**
             * Format: date-time
             * @description When the source last changed.
             */
            updatedAt: string;
            /**
             * @description The source type. `sanity-dataset` is a GROQ query over a Sanity dataset.
             * @enum {string}
             */
            type: 'sanity-dataset';
            /** @description The ID of the Sanity project the documents come from. */
            sanityProjectId: string;
            /** @description The dataset the documents come from. */
            sanityDatasetId: string;
            /** @description The GROQ query that selects the documents. */
            query: string;
            /**
             * @description How often the source syncs on its own: `weekly` or `monthly`. `null` when it syncs only when asked to.
             * @enum {string|null}
             */
            syncFrequency: 'weekly' | 'monthly' | null;
          } | {
            /**
             * Format: uuid
             * @description The source's ID.
             */
            id: string;
            /** @description The ID (`kb…`) of the knowledge base the source belongs to. */
            knowledgeBaseId: string;
            /** @description The source's title. */
            title: string;
            /** @description The number of `active` and `missing` documents. */
            documentCount: number;
            /** @description How many of those documents are converted to markdown, ready for builds. */
            convertedDocumentCount: number;
            /** @description How many of those documents have a file type that can't be converted. */
            skippedDocumentCount: number;
            /** @description How many of those documents failed to convert or were too large to. */
            failedDocumentCount: number;
            /** @description The number of chunks in its documents' markdown, the unit usage is counted in. */
            chunkCount: number;
            /**
             * Format: date-time
             * @description When a sync of the source last finished. `null` before the first one.
             */
            lastSyncedAt: string | null;
            /** @description The most recent sync, running or finished. `null` before the first one. */
            latestSync: {
              /**
               * Format: uuid
               * @description The sync's ID.
               */
              id: string;
              /**
               * Format: uuid
               * @description The ID of the source the sync read.
               */
              sourceId: string;
              /**
               * @description `full` reads the whole source and removes what it no longer finds. `incremental` reads only what changed since the last sync.
               * @enum {string}
               */
              mode: 'full' | 'incremental';
              /**
               * @description What started the sync: `schedule`, `manual` (an API call or the dashboard), `upload` (a new file), `event` or `push`.
               * @enum {string}
               */
              trigger: 'schedule' | 'manual' | 'upload' | 'event' | 'push';
              /**
               * @description The sync's status. `running`: still reading or converting. `held`: the sync would delete every document of the source, or five or more that are over a fifth of them, and waits for you to confirm or discard the deletion; the next sync of the source cancels it and holds again if the deletion still stands. `completed`, `failed` and `cancelled` are final.
               * @enum {string}
               */
              status: 'running' | 'held' | 'completed' | 'failed' | 'cancelled';
              /** @description The number of documents the sync read. */
              documentsSeen: number;
              /** @description The number of documents the sync added or changed. */
              documentsUpserted: number;
              /** @description The number of documents the sync read that had not changed. */
              documentsUnchanged: number;
              /** @description The number of documents the sync deleted. */
              documentsDeleted: number;
              /** @description The number of web pages the sync marked `missing` because several crawls in a row didn't find them. */
              documentsMissing: number;
              /** @description How many documents the held deletion would remove. Set while the sync is `held`, and kept after you confirm or discard it. `null` when the sync was never held. */
              heldDeletions: number | null;
              /**
               * @description Why the sync stopped before it read the whole source, so it removed nothing. `page-limit`: the crawl reached its page limit. `source-limit`: the knowledge base had no room for more documents. `stalled`: the crawl stopped making progress. `time-limit`: the crawl ran out of time. `null` when the sync read the whole source, or hasn't finished.
               * @enum {string|null}
               */
              partialReason: 'page-limit' | 'source-limit' | 'stalled' | 'time-limit' | null;
              /** @description Why the sync failed, written to show to users. `null` unless `status` is `failed`. */
              error: string | null;
              /**
               * Format: date-time
               * @description When the sync started.
               */
              createdAt: string;
              /**
               * Format: date-time
               * @description When the sync finished. `null` while it is `running` or `held`.
               */
              finishedAt: string | null;
            } | null;
            /**
             * Format: date-time
             * @description When the source was added.
             */
            createdAt: string;
            /**
             * Format: date-time
             * @description When the source last changed.
             */
            updatedAt: string;
            /**
             * @description The source type. `files` is an uploaded file or archive of files.
             * @enum {string}
             */
            type: 'files';
            /** @description The name of the file last synced. `null` before the first upload. */
            filename: string | null;
            /** @description The size of the file last synced, in bytes. `null` before the first upload. */
            sizeBytes: number | null;
          };
        };
      };
      /** @description Error */
      default: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': components['schemas']['ApiErrorBody'];
        };
      };
    };
  };
  deleteSource: {
    parameters: {
      query?: never;
      header?: never;
      path: {
        /** @description The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted. */
        knowledgeBaseId: string;
        /** @description The source's ID. */
        sourceId: string;
        /** @description The API version: a date in the format `vYYYY-MM-DD`, for example `v2026-05-26`, or `vX` for the latest, unstable version. */
        apiVersion: string;
      };
      cookie?: never;
    };
    requestBody?: never;
    responses: {
      /** @description The source was deleted. */
      204: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': null;
        };
      };
      /** @description Error */
      default: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': components['schemas']['ApiErrorBody'];
        };
      };
    };
  };
  updateSource: {
    parameters: {
      query?: never;
      header?: never;
      path: {
        /** @description The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted. */
        knowledgeBaseId: string;
        /** @description The source's ID. */
        sourceId: string;
        /** @description The API version: a date in the format `vYYYY-MM-DD`, for example `v2026-05-26`, or `vX` for the latest, unstable version. */
        apiVersion: string;
      };
      cookie?: never;
    };
    /** @description The changes to make to a source. */
    requestBody: {
      content: {
        'application/json': {
          /** @description The source's title. */
          title?: string;
          /** @description For a `web` source, the crawl options, replacing the stored ones. Documents whose path the new include and exclude paths leave out are deleted. */
          crawlOptions?: {
            /** @description Regular expressions for URL paths to crawl. When set, the crawl only includes pages whose path matches one of them. */
            includePaths?: string[];
            /** @description Regular expressions for URL paths to skip. Pages whose path matches one of them aren't crawled. */
            excludePaths?: string[];
            /** @description How many levels deep the crawl goes from the root URL. */
            maxDepth?: number;
            /** @description Whether to crawl only the pages listed in the site's sitemap. */
            sitemapOnly?: boolean;
            /** @description Whether to treat URLs that differ only by query string as one page. New crawls set it to `true` unless you set it. Set it to `false` when the query string selects different content, such as pagination. */
            ignoreQueryParameters?: boolean;
            /** @description The maximum number of pages to crawl. The crawl can stop sooner when the knowledge base reaches its source limit. */
            pageLimit?: number;
          };
          /** @description For a `sanity-dataset` source, the GROQ query, replacing the stored one. A sync is queued, and removes the documents the query no longer returns. */
          query?: string;
          /**
           * @description For a `web` or `sanity-dataset` source, how often it syncs on its own: `weekly` or `monthly`. `null` stops scheduled syncs, and you can still start a sync yourself. Setting a frequency requires a plan that includes scheduled syncs; without one, the request returns `403` with code `featureNotInPlan`.
           * @enum {string|null}
           */
          syncFrequency?: 'weekly' | 'monthly' | null;
          /** @description Set to `true` to apply new crawl options that delete many documents. Without it, a change that would delete all of the documents, or five or more that are over a fifth of them, returns `409` with code `sourceDeletionsUnconfirmed`. */
          confirmDeletions?: boolean;
        };
      };
    };
    responses: {
      /** @description Something that yields documents for a knowledge base: a website, a dataset or files. */
      200: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': {
            /**
             * Format: uuid
             * @description The source's ID.
             */
            id: string;
            /** @description The ID (`kb…`) of the knowledge base the source belongs to. */
            knowledgeBaseId: string;
            /** @description The source's title. */
            title: string;
            /** @description The number of `active` and `missing` documents. */
            documentCount: number;
            /** @description How many of those documents are converted to markdown, ready for builds. */
            convertedDocumentCount: number;
            /** @description How many of those documents have a file type that can't be converted. */
            skippedDocumentCount: number;
            /** @description How many of those documents failed to convert or were too large to. */
            failedDocumentCount: number;
            /** @description The number of chunks in its documents' markdown, the unit usage is counted in. */
            chunkCount: number;
            /**
             * Format: date-time
             * @description When a sync of the source last finished. `null` before the first one.
             */
            lastSyncedAt: string | null;
            /** @description The most recent sync, running or finished. `null` before the first one. */
            latestSync: {
              /**
               * Format: uuid
               * @description The sync's ID.
               */
              id: string;
              /**
               * Format: uuid
               * @description The ID of the source the sync read.
               */
              sourceId: string;
              /**
               * @description `full` reads the whole source and removes what it no longer finds. `incremental` reads only what changed since the last sync.
               * @enum {string}
               */
              mode: 'full' | 'incremental';
              /**
               * @description What started the sync: `schedule`, `manual` (an API call or the dashboard), `upload` (a new file), `event` or `push`.
               * @enum {string}
               */
              trigger: 'schedule' | 'manual' | 'upload' | 'event' | 'push';
              /**
               * @description The sync's status. `running`: still reading or converting. `held`: the sync would delete every document of the source, or five or more that are over a fifth of them, and waits for you to confirm or discard the deletion; the next sync of the source cancels it and holds again if the deletion still stands. `completed`, `failed` and `cancelled` are final.
               * @enum {string}
               */
              status: 'running' | 'held' | 'completed' | 'failed' | 'cancelled';
              /** @description The number of documents the sync read. */
              documentsSeen: number;
              /** @description The number of documents the sync added or changed. */
              documentsUpserted: number;
              /** @description The number of documents the sync read that had not changed. */
              documentsUnchanged: number;
              /** @description The number of documents the sync deleted. */
              documentsDeleted: number;
              /** @description The number of web pages the sync marked `missing` because several crawls in a row didn't find them. */
              documentsMissing: number;
              /** @description How many documents the held deletion would remove. Set while the sync is `held`, and kept after you confirm or discard it. `null` when the sync was never held. */
              heldDeletions: number | null;
              /**
               * @description Why the sync stopped before it read the whole source, so it removed nothing. `page-limit`: the crawl reached its page limit. `source-limit`: the knowledge base had no room for more documents. `stalled`: the crawl stopped making progress. `time-limit`: the crawl ran out of time. `null` when the sync read the whole source, or hasn't finished.
               * @enum {string|null}
               */
              partialReason: 'page-limit' | 'source-limit' | 'stalled' | 'time-limit' | null;
              /** @description Why the sync failed, written to show to users. `null` unless `status` is `failed`. */
              error: string | null;
              /**
               * Format: date-time
               * @description When the sync started.
               */
              createdAt: string;
              /**
               * Format: date-time
               * @description When the sync finished. `null` while it is `running` or `held`.
               */
              finishedAt: string | null;
            } | null;
            /**
             * Format: date-time
             * @description When the source was added.
             */
            createdAt: string;
            /**
             * Format: date-time
             * @description When the source last changed.
             */
            updatedAt: string;
            /**
             * @description The source type. `web` is a crawled website.
             * @enum {string}
             */
            type: 'web';
            /** @description The URL the crawl starts from. */
            url: string;
            /** @description Options that control how a website is crawled. */
            crawlOptions: {
              /** @description Regular expressions for URL paths to crawl. When set, the crawl only includes pages whose path matches one of them. */
              includePaths?: string[];
              /** @description Regular expressions for URL paths to skip. Pages whose path matches one of them aren't crawled. */
              excludePaths?: string[];
              /** @description How many levels deep the crawl goes from the root URL. */
              maxDepth?: number;
              /** @description Whether to crawl only the pages listed in the site's sitemap. */
              sitemapOnly?: boolean;
              /** @description Whether to treat URLs that differ only by query string as one page. New crawls set it to `true` unless you set it. Set it to `false` when the query string selects different content, such as pagination. */
              ignoreQueryParameters?: boolean;
              /** @description The maximum number of pages to crawl. The crawl can stop sooner when the knowledge base reaches its source limit. */
              pageLimit?: number;
            };
            /**
             * @description How often the source syncs on its own: `weekly` or `monthly`. `null` when it syncs only when asked to.
             * @enum {string|null}
             */
            syncFrequency: 'weekly' | 'monthly' | null;
          } | {
            /**
             * Format: uuid
             * @description The source's ID.
             */
            id: string;
            /** @description The ID (`kb…`) of the knowledge base the source belongs to. */
            knowledgeBaseId: string;
            /** @description The source's title. */
            title: string;
            /** @description The number of `active` and `missing` documents. */
            documentCount: number;
            /** @description How many of those documents are converted to markdown, ready for builds. */
            convertedDocumentCount: number;
            /** @description How many of those documents have a file type that can't be converted. */
            skippedDocumentCount: number;
            /** @description How many of those documents failed to convert or were too large to. */
            failedDocumentCount: number;
            /** @description The number of chunks in its documents' markdown, the unit usage is counted in. */
            chunkCount: number;
            /**
             * Format: date-time
             * @description When a sync of the source last finished. `null` before the first one.
             */
            lastSyncedAt: string | null;
            /** @description The most recent sync, running or finished. `null` before the first one. */
            latestSync: {
              /**
               * Format: uuid
               * @description The sync's ID.
               */
              id: string;
              /**
               * Format: uuid
               * @description The ID of the source the sync read.
               */
              sourceId: string;
              /**
               * @description `full` reads the whole source and removes what it no longer finds. `incremental` reads only what changed since the last sync.
               * @enum {string}
               */
              mode: 'full' | 'incremental';
              /**
               * @description What started the sync: `schedule`, `manual` (an API call or the dashboard), `upload` (a new file), `event` or `push`.
               * @enum {string}
               */
              trigger: 'schedule' | 'manual' | 'upload' | 'event' | 'push';
              /**
               * @description The sync's status. `running`: still reading or converting. `held`: the sync would delete every document of the source, or five or more that are over a fifth of them, and waits for you to confirm or discard the deletion; the next sync of the source cancels it and holds again if the deletion still stands. `completed`, `failed` and `cancelled` are final.
               * @enum {string}
               */
              status: 'running' | 'held' | 'completed' | 'failed' | 'cancelled';
              /** @description The number of documents the sync read. */
              documentsSeen: number;
              /** @description The number of documents the sync added or changed. */
              documentsUpserted: number;
              /** @description The number of documents the sync read that had not changed. */
              documentsUnchanged: number;
              /** @description The number of documents the sync deleted. */
              documentsDeleted: number;
              /** @description The number of web pages the sync marked `missing` because several crawls in a row didn't find them. */
              documentsMissing: number;
              /** @description How many documents the held deletion would remove. Set while the sync is `held`, and kept after you confirm or discard it. `null` when the sync was never held. */
              heldDeletions: number | null;
              /**
               * @description Why the sync stopped before it read the whole source, so it removed nothing. `page-limit`: the crawl reached its page limit. `source-limit`: the knowledge base had no room for more documents. `stalled`: the crawl stopped making progress. `time-limit`: the crawl ran out of time. `null` when the sync read the whole source, or hasn't finished.
               * @enum {string|null}
               */
              partialReason: 'page-limit' | 'source-limit' | 'stalled' | 'time-limit' | null;
              /** @description Why the sync failed, written to show to users. `null` unless `status` is `failed`. */
              error: string | null;
              /**
               * Format: date-time
               * @description When the sync started.
               */
              createdAt: string;
              /**
               * Format: date-time
               * @description When the sync finished. `null` while it is `running` or `held`.
               */
              finishedAt: string | null;
            } | null;
            /**
             * Format: date-time
             * @description When the source was added.
             */
            createdAt: string;
            /**
             * Format: date-time
             * @description When the source last changed.
             */
            updatedAt: string;
            /**
             * @description The source type. `sanity-dataset` is a GROQ query over a Sanity dataset.
             * @enum {string}
             */
            type: 'sanity-dataset';
            /** @description The ID of the Sanity project the documents come from. */
            sanityProjectId: string;
            /** @description The dataset the documents come from. */
            sanityDatasetId: string;
            /** @description The GROQ query that selects the documents. */
            query: string;
            /**
             * @description How often the source syncs on its own: `weekly` or `monthly`. `null` when it syncs only when asked to.
             * @enum {string|null}
             */
            syncFrequency: 'weekly' | 'monthly' | null;
          } | {
            /**
             * Format: uuid
             * @description The source's ID.
             */
            id: string;
            /** @description The ID (`kb…`) of the knowledge base the source belongs to. */
            knowledgeBaseId: string;
            /** @description The source's title. */
            title: string;
            /** @description The number of `active` and `missing` documents. */
            documentCount: number;
            /** @description How many of those documents are converted to markdown, ready for builds. */
            convertedDocumentCount: number;
            /** @description How many of those documents have a file type that can't be converted. */
            skippedDocumentCount: number;
            /** @description How many of those documents failed to convert or were too large to. */
            failedDocumentCount: number;
            /** @description The number of chunks in its documents' markdown, the unit usage is counted in. */
            chunkCount: number;
            /**
             * Format: date-time
             * @description When a sync of the source last finished. `null` before the first one.
             */
            lastSyncedAt: string | null;
            /** @description The most recent sync, running or finished. `null` before the first one. */
            latestSync: {
              /**
               * Format: uuid
               * @description The sync's ID.
               */
              id: string;
              /**
               * Format: uuid
               * @description The ID of the source the sync read.
               */
              sourceId: string;
              /**
               * @description `full` reads the whole source and removes what it no longer finds. `incremental` reads only what changed since the last sync.
               * @enum {string}
               */
              mode: 'full' | 'incremental';
              /**
               * @description What started the sync: `schedule`, `manual` (an API call or the dashboard), `upload` (a new file), `event` or `push`.
               * @enum {string}
               */
              trigger: 'schedule' | 'manual' | 'upload' | 'event' | 'push';
              /**
               * @description The sync's status. `running`: still reading or converting. `held`: the sync would delete every document of the source, or five or more that are over a fifth of them, and waits for you to confirm or discard the deletion; the next sync of the source cancels it and holds again if the deletion still stands. `completed`, `failed` and `cancelled` are final.
               * @enum {string}
               */
              status: 'running' | 'held' | 'completed' | 'failed' | 'cancelled';
              /** @description The number of documents the sync read. */
              documentsSeen: number;
              /** @description The number of documents the sync added or changed. */
              documentsUpserted: number;
              /** @description The number of documents the sync read that had not changed. */
              documentsUnchanged: number;
              /** @description The number of documents the sync deleted. */
              documentsDeleted: number;
              /** @description The number of web pages the sync marked `missing` because several crawls in a row didn't find them. */
              documentsMissing: number;
              /** @description How many documents the held deletion would remove. Set while the sync is `held`, and kept after you confirm or discard it. `null` when the sync was never held. */
              heldDeletions: number | null;
              /**
               * @description Why the sync stopped before it read the whole source, so it removed nothing. `page-limit`: the crawl reached its page limit. `source-limit`: the knowledge base had no room for more documents. `stalled`: the crawl stopped making progress. `time-limit`: the crawl ran out of time. `null` when the sync read the whole source, or hasn't finished.
               * @enum {string|null}
               */
              partialReason: 'page-limit' | 'source-limit' | 'stalled' | 'time-limit' | null;
              /** @description Why the sync failed, written to show to users. `null` unless `status` is `failed`. */
              error: string | null;
              /**
               * Format: date-time
               * @description When the sync started.
               */
              createdAt: string;
              /**
               * Format: date-time
               * @description When the sync finished. `null` while it is `running` or `held`.
               */
              finishedAt: string | null;
            } | null;
            /**
             * Format: date-time
             * @description When the source was added.
             */
            createdAt: string;
            /**
             * Format: date-time
             * @description When the source last changed.
             */
            updatedAt: string;
            /**
             * @description The source type. `files` is an uploaded file or archive of files.
             * @enum {string}
             */
            type: 'files';
            /** @description The name of the file last synced. `null` before the first upload. */
            filename: string | null;
            /** @description The size of the file last synced, in bytes. `null` before the first upload. */
            sizeBytes: number | null;
          };
        };
      };
      /** @description Error */
      default: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': components['schemas']['ApiErrorBody'];
        };
      };
    };
  };
  listSyncs: {
    parameters: {
      query?: {
        /** @description The `nextCursor` value from the previous page. Omit it to get the first page. */
        cursor?: string;
        /** @description The maximum number of items to return. */
        limit?: number;
      };
      header?: never;
      path: {
        /** @description The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted. */
        knowledgeBaseId: string;
        /** @description The source's ID. */
        sourceId: string;
        /** @description The API version: a date in the format `vYYYY-MM-DD`, for example `v2026-05-26`, or `vX` for the latest, unstable version. */
        apiVersion: string;
      };
      cookie?: never;
    };
    requestBody?: never;
    responses: {
      /** @description A page of syncs. */
      200: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': {
            /** @description The items on this page. */
            data: {
              /**
               * Format: uuid
               * @description The sync's ID.
               */
              id: string;
              /**
               * Format: uuid
               * @description The ID of the source the sync read.
               */
              sourceId: string;
              /**
               * @description `full` reads the whole source and removes what it no longer finds. `incremental` reads only what changed since the last sync.
               * @enum {string}
               */
              mode: 'full' | 'incremental';
              /**
               * @description What started the sync: `schedule`, `manual` (an API call or the dashboard), `upload` (a new file), `event` or `push`.
               * @enum {string}
               */
              trigger: 'schedule' | 'manual' | 'upload' | 'event' | 'push';
              /**
               * @description The sync's status. `running`: still reading or converting. `held`: the sync would delete every document of the source, or five or more that are over a fifth of them, and waits for you to confirm or discard the deletion; the next sync of the source cancels it and holds again if the deletion still stands. `completed`, `failed` and `cancelled` are final.
               * @enum {string}
               */
              status: 'running' | 'held' | 'completed' | 'failed' | 'cancelled';
              /** @description The number of documents the sync read. */
              documentsSeen: number;
              /** @description The number of documents the sync added or changed. */
              documentsUpserted: number;
              /** @description The number of documents the sync read that had not changed. */
              documentsUnchanged: number;
              /** @description The number of documents the sync deleted. */
              documentsDeleted: number;
              /** @description The number of web pages the sync marked `missing` because several crawls in a row didn't find them. */
              documentsMissing: number;
              /** @description How many documents the held deletion would remove. Set while the sync is `held`, and kept after you confirm or discard it. `null` when the sync was never held. */
              heldDeletions: number | null;
              /**
               * @description Why the sync stopped before it read the whole source, so it removed nothing. `page-limit`: the crawl reached its page limit. `source-limit`: the knowledge base had no room for more documents. `stalled`: the crawl stopped making progress. `time-limit`: the crawl ran out of time. `null` when the sync read the whole source, or hasn't finished.
               * @enum {string|null}
               */
              partialReason: 'page-limit' | 'source-limit' | 'stalled' | 'time-limit' | null;
              /** @description Why the sync failed, written to show to users. `null` unless `status` is `failed`. */
              error: string | null;
              /**
               * Format: date-time
               * @description When the sync started.
               */
              createdAt: string;
              /**
               * Format: date-time
               * @description When the sync finished. `null` while it is `running` or `held`.
               */
              finishedAt: string | null;
            }[];
            /** @description The cursor for the next page. Pass it as `cursor` to get more results. `null` when there are no more pages. */
            nextCursor: string | null;
          };
        };
      };
      /** @description Error */
      default: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': components['schemas']['ApiErrorBody'];
        };
      };
    };
  };
  startSync: {
    parameters: {
      query?: never;
      header?: {
        /** @description A unique value, such as a UUID, that makes retries safe. A retry with the same key and body returns the first response instead of repeating the work. */
        'Idempotency-Key'?: string;
      };
      path: {
        /** @description The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted. */
        knowledgeBaseId: string;
        /** @description The source's ID. */
        sourceId: string;
        /** @description The API version: a date in the format `vYYYY-MM-DD`, for example `v2026-05-26`, or `vX` for the latest, unstable version. */
        apiVersion: string;
      };
      cookie?: never;
    };
    /** @description What a new sync reads. */
    requestBody: {
      content: {
        'application/json': {
          /**
           * Format: uuid
           * @description For a `files` source, the `uploadId` of the file to sync, from `POST .../sources/{sourceId}/uploads`. Without it, a `files` source reads its current file again. Not allowed for other types.
           */
          uploadId?: string;
        } | null;
      };
    };
    responses: {
      /** @description The sync that was started or queued. */
      202: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': {
            /**
             * Format: uuid
             * @description The ID of the source that will sync.
             */
            sourceId: string;
            /** @description For a `files` source, the ID of the sync's job. Check its progress with `GET .../jobs/{jobId}`; once it succeeds, its `result` names the sync and whether it is `held`. `null` for a website or dataset, whose sync is queued on the source: follow it with the source's `latestSync`. */
            jobId: string | null;
          };
        };
      };
      /** @description Error */
      default: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': components['schemas']['ApiErrorBody'];
        };
      };
    };
  };
  getSync: {
    parameters: {
      query?: never;
      header?: never;
      path: {
        /** @description The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted. */
        knowledgeBaseId: string;
        /** @description The source's ID. */
        sourceId: string;
        /** @description The sync's ID. */
        syncId: string;
        /** @description The API version: a date in the format `vYYYY-MM-DD`, for example `v2026-05-26`, or `vX` for the latest, unstable version. */
        apiVersion: string;
      };
      cookie?: never;
    };
    requestBody?: never;
    responses: {
      /** @description One run of a source's connector. */
      200: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': {
            /**
             * Format: uuid
             * @description The sync's ID.
             */
            id: string;
            /**
             * Format: uuid
             * @description The ID of the source the sync read.
             */
            sourceId: string;
            /**
             * @description `full` reads the whole source and removes what it no longer finds. `incremental` reads only what changed since the last sync.
             * @enum {string}
             */
            mode: 'full' | 'incremental';
            /**
             * @description What started the sync: `schedule`, `manual` (an API call or the dashboard), `upload` (a new file), `event` or `push`.
             * @enum {string}
             */
            trigger: 'schedule' | 'manual' | 'upload' | 'event' | 'push';
            /**
             * @description The sync's status. `running`: still reading or converting. `held`: the sync would delete every document of the source, or five or more that are over a fifth of them, and waits for you to confirm or discard the deletion; the next sync of the source cancels it and holds again if the deletion still stands. `completed`, `failed` and `cancelled` are final.
             * @enum {string}
             */
            status: 'running' | 'held' | 'completed' | 'failed' | 'cancelled';
            /** @description The number of documents the sync read. */
            documentsSeen: number;
            /** @description The number of documents the sync added or changed. */
            documentsUpserted: number;
            /** @description The number of documents the sync read that had not changed. */
            documentsUnchanged: number;
            /** @description The number of documents the sync deleted. */
            documentsDeleted: number;
            /** @description The number of web pages the sync marked `missing` because several crawls in a row didn't find them. */
            documentsMissing: number;
            /** @description How many documents the held deletion would remove. Set while the sync is `held`, and kept after you confirm or discard it. `null` when the sync was never held. */
            heldDeletions: number | null;
            /**
             * @description Why the sync stopped before it read the whole source, so it removed nothing. `page-limit`: the crawl reached its page limit. `source-limit`: the knowledge base had no room for more documents. `stalled`: the crawl stopped making progress. `time-limit`: the crawl ran out of time. `null` when the sync read the whole source, or hasn't finished.
             * @enum {string|null}
             */
            partialReason: 'page-limit' | 'source-limit' | 'stalled' | 'time-limit' | null;
            /** @description Why the sync failed, written to show to users. `null` unless `status` is `failed`. */
            error: string | null;
            /**
             * Format: date-time
             * @description When the sync started.
             */
            createdAt: string;
            /**
             * Format: date-time
             * @description When the sync finished. `null` while it is `running` or `held`.
             */
            finishedAt: string | null;
          };
        };
      };
      /** @description Error */
      default: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': components['schemas']['ApiErrorBody'];
        };
      };
    };
  };
  confirmSync: {
    parameters: {
      query?: never;
      header?: never;
      path: {
        /** @description The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted. */
        knowledgeBaseId: string;
        /** @description The source's ID. */
        sourceId: string;
        /** @description The sync's ID. */
        syncId: string;
        /** @description The API version: a date in the format `vYYYY-MM-DD`, for example `v2026-05-26`, or `vX` for the latest, unstable version. */
        apiVersion: string;
      };
      cookie?: never;
    };
    requestBody?: never;
    responses: {
      /** @description One run of a source's connector. */
      200: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': {
            /**
             * Format: uuid
             * @description The sync's ID.
             */
            id: string;
            /**
             * Format: uuid
             * @description The ID of the source the sync read.
             */
            sourceId: string;
            /**
             * @description `full` reads the whole source and removes what it no longer finds. `incremental` reads only what changed since the last sync.
             * @enum {string}
             */
            mode: 'full' | 'incremental';
            /**
             * @description What started the sync: `schedule`, `manual` (an API call or the dashboard), `upload` (a new file), `event` or `push`.
             * @enum {string}
             */
            trigger: 'schedule' | 'manual' | 'upload' | 'event' | 'push';
            /**
             * @description The sync's status. `running`: still reading or converting. `held`: the sync would delete every document of the source, or five or more that are over a fifth of them, and waits for you to confirm or discard the deletion; the next sync of the source cancels it and holds again if the deletion still stands. `completed`, `failed` and `cancelled` are final.
             * @enum {string}
             */
            status: 'running' | 'held' | 'completed' | 'failed' | 'cancelled';
            /** @description The number of documents the sync read. */
            documentsSeen: number;
            /** @description The number of documents the sync added or changed. */
            documentsUpserted: number;
            /** @description The number of documents the sync read that had not changed. */
            documentsUnchanged: number;
            /** @description The number of documents the sync deleted. */
            documentsDeleted: number;
            /** @description The number of web pages the sync marked `missing` because several crawls in a row didn't find them. */
            documentsMissing: number;
            /** @description How many documents the held deletion would remove. Set while the sync is `held`, and kept after you confirm or discard it. `null` when the sync was never held. */
            heldDeletions: number | null;
            /**
             * @description Why the sync stopped before it read the whole source, so it removed nothing. `page-limit`: the crawl reached its page limit. `source-limit`: the knowledge base had no room for more documents. `stalled`: the crawl stopped making progress. `time-limit`: the crawl ran out of time. `null` when the sync read the whole source, or hasn't finished.
             * @enum {string|null}
             */
            partialReason: 'page-limit' | 'source-limit' | 'stalled' | 'time-limit' | null;
            /** @description Why the sync failed, written to show to users. `null` unless `status` is `failed`. */
            error: string | null;
            /**
             * Format: date-time
             * @description When the sync started.
             */
            createdAt: string;
            /**
             * Format: date-time
             * @description When the sync finished. `null` while it is `running` or `held`.
             */
            finishedAt: string | null;
          };
        };
      };
      /** @description Error */
      default: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': components['schemas']['ApiErrorBody'];
        };
      };
    };
  };
  discardSync: {
    parameters: {
      query?: never;
      header?: never;
      path: {
        /** @description The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted. */
        knowledgeBaseId: string;
        /** @description The source's ID. */
        sourceId: string;
        /** @description The sync's ID. */
        syncId: string;
        /** @description The API version: a date in the format `vYYYY-MM-DD`, for example `v2026-05-26`, or `vX` for the latest, unstable version. */
        apiVersion: string;
      };
      cookie?: never;
    };
    requestBody?: never;
    responses: {
      /** @description One run of a source's connector. */
      200: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': {
            /**
             * Format: uuid
             * @description The sync's ID.
             */
            id: string;
            /**
             * Format: uuid
             * @description The ID of the source the sync read.
             */
            sourceId: string;
            /**
             * @description `full` reads the whole source and removes what it no longer finds. `incremental` reads only what changed since the last sync.
             * @enum {string}
             */
            mode: 'full' | 'incremental';
            /**
             * @description What started the sync: `schedule`, `manual` (an API call or the dashboard), `upload` (a new file), `event` or `push`.
             * @enum {string}
             */
            trigger: 'schedule' | 'manual' | 'upload' | 'event' | 'push';
            /**
             * @description The sync's status. `running`: still reading or converting. `held`: the sync would delete every document of the source, or five or more that are over a fifth of them, and waits for you to confirm or discard the deletion; the next sync of the source cancels it and holds again if the deletion still stands. `completed`, `failed` and `cancelled` are final.
             * @enum {string}
             */
            status: 'running' | 'held' | 'completed' | 'failed' | 'cancelled';
            /** @description The number of documents the sync read. */
            documentsSeen: number;
            /** @description The number of documents the sync added or changed. */
            documentsUpserted: number;
            /** @description The number of documents the sync read that had not changed. */
            documentsUnchanged: number;
            /** @description The number of documents the sync deleted. */
            documentsDeleted: number;
            /** @description The number of web pages the sync marked `missing` because several crawls in a row didn't find them. */
            documentsMissing: number;
            /** @description How many documents the held deletion would remove. Set while the sync is `held`, and kept after you confirm or discard it. `null` when the sync was never held. */
            heldDeletions: number | null;
            /**
             * @description Why the sync stopped before it read the whole source, so it removed nothing. `page-limit`: the crawl reached its page limit. `source-limit`: the knowledge base had no room for more documents. `stalled`: the crawl stopped making progress. `time-limit`: the crawl ran out of time. `null` when the sync read the whole source, or hasn't finished.
             * @enum {string|null}
             */
            partialReason: 'page-limit' | 'source-limit' | 'stalled' | 'time-limit' | null;
            /** @description Why the sync failed, written to show to users. `null` unless `status` is `failed`. */
            error: string | null;
            /**
             * Format: date-time
             * @description When the sync started.
             */
            createdAt: string;
            /**
             * Format: date-time
             * @description When the sync finished. `null` while it is `running` or `held`.
             */
            finishedAt: string | null;
          };
        };
      };
      /** @description Error */
      default: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': components['schemas']['ApiErrorBody'];
        };
      };
    };
  };
  startSourceUpload: {
    parameters: {
      query?: never;
      header?: {
        /** @description A unique value, such as a UUID, that makes retries safe. A retry with the same key and body returns the first response instead of repeating the work. */
        'Idempotency-Key'?: string;
      };
      path: {
        /** @description The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted. */
        knowledgeBaseId: string;
        /** @description The source's ID. */
        sourceId: string;
        /** @description The API version: a date in the format `vYYYY-MM-DD`, for example `v2026-05-26`, or `vX` for the latest, unstable version. */
        apiVersion: string;
      };
      cookie?: never;
    };
    /** @description The file to upload. */
    requestBody: {
      content: {
        'application/json': {
          /** @description The file's name. */
          filename: string;
          /** @description The media type of the file. When set, the `PUT` request must send the same `Content-Type` header. */
          contentType?: string;
        };
      };
    };
    responses: {
      /** @description Where to upload the file. */
      201: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': {
            /**
             * Format: uuid
             * @description The ID of the upload. Pass it to `POST .../syncs` once the file is uploaded.
             */
            uploadId: string;
            /**
             * Format: uri
             * @description A signed URL to send the file to in one `PUT` request. It expires after one hour.
             */
            uploadUrl: string;
          };
        };
      };
      /** @description Error */
      default: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': components['schemas']['ApiErrorBody'];
        };
      };
    };
  };
  syncAllSources: {
    parameters: {
      query?: never;
      header?: never;
      path: {
        /** @description The knowledge base's ID (`kb...`), its `publicId`. Its UUID `id` is also accepted. */
        knowledgeBaseId: string;
        /** @description The API version: a date in the format `vYYYY-MM-DD`, for example `v2026-05-26`, or `vX` for the latest, unstable version. */
        apiVersion: string;
      };
      cookie?: never;
    };
    requestBody?: never;
    responses: {
      /** @description The syncs that were queued. */
      202: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': {
            /** @description The IDs of the sources that will sync. Follow each with the source's `latestSync`. `files` sources aren't included: they sync when you upload a file. */
            sourceIds: string[];
          };
        };
      };
      /** @description Error */
      default: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': components['schemas']['ApiErrorBody'];
        };
      };
    };
  };
  saveConversation: {
    parameters: {
      query?: never;
      header?: never;
      path: {
        /** @description Your ID for the conversation thread, unique within your organization. Up to 200 characters. */
        threadId: string;
        /** @description The API version: a date in the format `vYYYY-MM-DD`, for example `v2026-05-26`, or `vX` for the latest, unstable version. */
        apiVersion: string;
        /** @description The ID of the organization. */
        organizationId: string;
      };
      cookie?: never;
    };
    /** @description A conversation transcript to save for one thread. */
    requestBody: {
      content: {
        'application/json': {
          /** @description The full transcript so far, in order. It replaces the stored messages. */
          messages: {
            /**
             * @description Who sent the message. `user` is the person talking to the agent, `assistant` is the agent, `system` is a system prompt, and `tool` is a tool call or tool result.
             * @enum {string}
             */
            role: 'user' | 'assistant' | 'system' | 'tool';
            /**
             * @description The message text. `null` when the message has no text, such as a tool call.
             * @default null
             */
            content?: string | null;
            /**
             * @description The name of the tool for a `tool` message. `null` on other messages.
             * @default null
             */
            toolName?: string | null;
            /**
             * @description The kind of `tool` message. `call` is the agent calling the tool, and `result` is what the tool returned. `null` on other messages.
             * @default null
             * @enum {string|null}
             */
            toolType?: 'call' | 'result' | null;
            /**
             * @description Why this step failed, including any stack trace. Set it on the tool result for a failed tool call, or on the assistant message for a turn that failed instead of answering. `null` when the step succeeded.
             * @default null
             */
            error?: string | null;
          }[];
          /** @description The provider of the model the agent used. When absent, the stored value stays unchanged. */
          modelProvider?: string;
          /** @description The ID of the model the agent used. When absent, the stored value stays unchanged. */
          modelId?: string;
          /** @description Token usage for one generation call. The API adds it to the conversation total, but only when this save changes the messages. */
          tokenUsage?: {
            /** @description The number of input tokens. */
            inputTokens?: number;
            /** @description The number of output tokens. */
            outputTokens?: number;
            /** @description The total number of tokens. */
            totalTokens?: number;
          };
          /** @description Up to 20 tags that describe the conversation. Well-known keys are `mcpEndpoints` (names of the MCP endpoints the conversation used), `app`, and `environment`. Add any other keys you need. Replaces the stored metadata. When absent, the stored value stays unchanged. */
          metadata?: {
            [key: string]: string | string[];
          };
          /** @description Your choice to share conversation telemetry with Sanity. Replaces the stored setting. When absent, the stored value stays unchanged. */
          sharing?: {
            /** @description Whether to share classification metrics with Sanity: scores, sentiment, content gap counts, message counts and sizes, tool names, and model and token usage. Message content is not included. */
            metrics?: boolean;
            /** @description Whether to share full conversation transcripts with Sanity. When `true`, the API also sets `metrics` to `true`. */
            conversations?: boolean;
            /** @description How the Sanity team can reach you about your agent, such as an email address or a Discord handle. */
            contact?: string;
          };
        };
      };
    };
    responses: {
      /** @description A recorded agent conversation: its transcript, metadata, token usage, and classification. */
      200: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': {
            /** @description The conversation ID, unique within the organization. It matches the `_id` of the conversation document in your document store. */
            id: string;
            /** @description Your identifier for the conversation thread, unique within the organization. Saving with the same `threadId` updates the same conversation. */
            threadId: string;
            /** @description Tags that describe the conversation, such as `mcpEndpoints`, `app`, and `environment`. Filter on them in GROQ queries. `null` until a save includes `metadata`. */
            metadata: {
              [key: string]: string | string[];
            } | null;
            /**
             * Format: date-time
             * @description When the API received the first save for this thread, as an ISO 8601 timestamp.
             */
            startedAt: string;
            /**
             * Format: date-time
             * @description When the conversation was last saved, as an ISO 8601 timestamp.
             */
            messagesUpdatedAt: string;
            /** @description The conversation transcript, in order. Each save replaces it. */
            messages: {
              /**
               * @description Who sent the message. `user` is the person talking to the agent, `assistant` is the agent, `system` is a system prompt, and `tool` is a tool call or tool result.
               * @enum {string}
               */
              role: 'user' | 'assistant' | 'system' | 'tool';
              /**
               * @description The message text. `null` when the message has no text, such as a tool call.
               * @default null
               */
              content: string | null;
              /**
               * @description The name of the tool for a `tool` message. `null` on other messages.
               * @default null
               */
              toolName: string | null;
              /**
               * @description The kind of `tool` message. `call` is the agent calling the tool, and `result` is what the tool returned. `null` on other messages.
               * @default null
               * @enum {string|null}
               */
              toolType: 'call' | 'result' | null;
              /**
               * @description Why this step failed, including any stack trace. Set it on the tool result for a failed tool call, or on the assistant message for a turn that failed instead of answering. `null` when the step succeeded.
               * @default null
               */
              error: string | null;
              /**
               * Format: date-time
               * @description When the API first received this message, as an ISO 8601 timestamp. The API sets it. Resending an unchanged message at the same position keeps its timestamp. `null` for messages recorded before timestamps existed.
               * @default null
               */
              timestamp: string | null;
            }[];
            /** @description The provider of the model the agent used. `null` until a save includes `modelProvider`. */
            modelProvider: string | null;
            /** @description The ID of the model the agent used. `null` until a save includes `modelId`. */
            modelId: string | null;
            /** @description The running total of token usage for the conversation. `null` until a save includes `tokenUsage`. */
            tokenUsage: {
              /** @description The number of input tokens. */
              inputTokens?: number;
              /** @description The number of output tokens. */
              outputTokens?: number;
              /** @description The total number of tokens. */
              totalTokens?: number;
            } | null;
            /** @description The latest classification result. `null` until you record one. */
            coreMetrics: {
              /** @description How well the agent resolved the user's needs, from 1 to 10. */
              successScore?: number;
              /**
               * @description The overall sentiment of the conversation.
               * @enum {string}
               */
              sentiment?: 'positive' | 'neutral' | 'negative';
              /** @description Topics the agent couldn't answer because it lacked content. */
              contentGaps?: string[];
            } | null;
            /**
             * Format: date-time
             * @description When the latest classification result was recorded, as an ISO 8601 timestamp. The API sets it. `null` until you record a result.
             */
            classifiedAt: string | null;
            /** @description Why your classifier couldn't classify the conversation. `null` when no failure is recorded. Recording a result clears it. */
            classificationError: string | null;
            /** @description Your choice to share conversation telemetry with Sanity. `null` until a save includes `sharing`. */
            sharing: {
              /** @description Whether to share classification metrics with Sanity: scores, sentiment, content gap counts, message counts and sizes, tool names, and model and token usage. Message content is not included. */
              metrics?: boolean;
              /** @description Whether to share full conversation transcripts with Sanity. When `true`, the API also sets `metrics` to `true`. */
              conversations?: boolean;
              /** @description How the Sanity team can reach you about your agent, such as an email address or a Discord handle. */
              contact?: string;
            } | null;
            /**
             * Format: date-time
             * @description When the conversation was created, as an ISO 8601 timestamp.
             */
            createdAt: string;
            /**
             * Format: date-time
             * @description When the conversation was last changed, as an ISO 8601 timestamp.
             */
            updatedAt: string;
          };
        };
      };
      /** @description Error */
      default: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': components['schemas']['ApiErrorBody'];
        };
      };
    };
  };
  deleteConversation: {
    parameters: {
      query?: never;
      header?: never;
      path: {
        /** @description Your ID for the conversation thread, unique within your organization. Up to 200 characters. */
        threadId: string;
        /** @description The API version: a date in the format `vYYYY-MM-DD`, for example `v2026-05-26`, or `vX` for the latest, unstable version. */
        apiVersion: string;
        /** @description The ID of the organization. */
        organizationId: string;
      };
      cookie?: never;
    };
    requestBody?: never;
    responses: {
      /** @description Default Response */
      204: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': null;
        };
      };
      /** @description Error */
      default: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': components['schemas']['ApiErrorBody'];
        };
      };
    };
  };
  classifyConversation: {
    parameters: {
      query?: never;
      header?: never;
      path: {
        /** @description Your ID for the conversation thread, unique within your organization. Up to 200 characters. */
        threadId: string;
        /** @description The API version: a date in the format `vYYYY-MM-DD`, for example `v2026-05-26`, or `vX` for the latest, unstable version. */
        apiVersion: string;
        /** @description The ID of the organization. */
        organizationId: string;
      };
      cookie?: never;
    };
    /** @description A classification result or failure for one conversation. Send exactly one of `coreMetrics` or `classificationError`. */
    requestBody: {
      content: {
        'application/json': {
          /** @description The classification result. The API sets `classifiedAt` and clears any recorded `classificationError`. */
          coreMetrics?: {
            /** @description How well the agent resolved the user's needs, as an integer from 1 to 10. */
            successScore: number;
            /**
             * @description The overall sentiment of the conversation.
             * @enum {string}
             */
            sentiment: 'positive' | 'neutral' | 'negative';
            /** @description Topics the agent couldn't answer because it lacked content. */
            contentGaps: string[];
          };
          /** @description Why your classifier couldn't classify the conversation. Any earlier classification result stays unchanged. */
          classificationError?: string;
        };
      };
    };
    responses: {
      /** @description A recorded agent conversation: its transcript, metadata, token usage, and classification. */
      200: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': {
            /** @description The conversation ID, unique within the organization. It matches the `_id` of the conversation document in your document store. */
            id: string;
            /** @description Your identifier for the conversation thread, unique within the organization. Saving with the same `threadId` updates the same conversation. */
            threadId: string;
            /** @description Tags that describe the conversation, such as `mcpEndpoints`, `app`, and `environment`. Filter on them in GROQ queries. `null` until a save includes `metadata`. */
            metadata: {
              [key: string]: string | string[];
            } | null;
            /**
             * Format: date-time
             * @description When the API received the first save for this thread, as an ISO 8601 timestamp.
             */
            startedAt: string;
            /**
             * Format: date-time
             * @description When the conversation was last saved, as an ISO 8601 timestamp.
             */
            messagesUpdatedAt: string;
            /** @description The conversation transcript, in order. Each save replaces it. */
            messages: {
              /**
               * @description Who sent the message. `user` is the person talking to the agent, `assistant` is the agent, `system` is a system prompt, and `tool` is a tool call or tool result.
               * @enum {string}
               */
              role: 'user' | 'assistant' | 'system' | 'tool';
              /**
               * @description The message text. `null` when the message has no text, such as a tool call.
               * @default null
               */
              content: string | null;
              /**
               * @description The name of the tool for a `tool` message. `null` on other messages.
               * @default null
               */
              toolName: string | null;
              /**
               * @description The kind of `tool` message. `call` is the agent calling the tool, and `result` is what the tool returned. `null` on other messages.
               * @default null
               * @enum {string|null}
               */
              toolType: 'call' | 'result' | null;
              /**
               * @description Why this step failed, including any stack trace. Set it on the tool result for a failed tool call, or on the assistant message for a turn that failed instead of answering. `null` when the step succeeded.
               * @default null
               */
              error: string | null;
              /**
               * Format: date-time
               * @description When the API first received this message, as an ISO 8601 timestamp. The API sets it. Resending an unchanged message at the same position keeps its timestamp. `null` for messages recorded before timestamps existed.
               * @default null
               */
              timestamp: string | null;
            }[];
            /** @description The provider of the model the agent used. `null` until a save includes `modelProvider`. */
            modelProvider: string | null;
            /** @description The ID of the model the agent used. `null` until a save includes `modelId`. */
            modelId: string | null;
            /** @description The running total of token usage for the conversation. `null` until a save includes `tokenUsage`. */
            tokenUsage: {
              /** @description The number of input tokens. */
              inputTokens?: number;
              /** @description The number of output tokens. */
              outputTokens?: number;
              /** @description The total number of tokens. */
              totalTokens?: number;
            } | null;
            /** @description The latest classification result. `null` until you record one. */
            coreMetrics: {
              /** @description How well the agent resolved the user's needs, from 1 to 10. */
              successScore?: number;
              /**
               * @description The overall sentiment of the conversation.
               * @enum {string}
               */
              sentiment?: 'positive' | 'neutral' | 'negative';
              /** @description Topics the agent couldn't answer because it lacked content. */
              contentGaps?: string[];
            } | null;
            /**
             * Format: date-time
             * @description When the latest classification result was recorded, as an ISO 8601 timestamp. The API sets it. `null` until you record a result.
             */
            classifiedAt: string | null;
            /** @description Why your classifier couldn't classify the conversation. `null` when no failure is recorded. Recording a result clears it. */
            classificationError: string | null;
            /** @description Your choice to share conversation telemetry with Sanity. `null` until a save includes `sharing`. */
            sharing: {
              /** @description Whether to share classification metrics with Sanity: scores, sentiment, content gap counts, message counts and sizes, tool names, and model and token usage. Message content is not included. */
              metrics?: boolean;
              /** @description Whether to share full conversation transcripts with Sanity. When `true`, the API also sets `metrics` to `true`. */
              conversations?: boolean;
              /** @description How the Sanity team can reach you about your agent, such as an email address or a Discord handle. */
              contact?: string;
            } | null;
            /**
             * Format: date-time
             * @description When the conversation was created, as an ISO 8601 timestamp.
             */
            createdAt: string;
            /**
             * Format: date-time
             * @description When the conversation was last changed, as an ISO 8601 timestamp.
             */
            updatedAt: string;
          };
        };
      };
      /** @description Error */
      default: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': components['schemas']['ApiErrorBody'];
        };
      };
    };
  };
  createMcpEndpoint: {
    parameters: {
      query?: never;
      header?: never;
      path: {
        /** @description The API version: a date in the format `vYYYY-MM-DD`, for example `v2026-05-26`, or `vX` for the latest, unstable version. */
        apiVersion: string;
        /** @description The ID of the organization. */
        organizationId: string;
      };
      cookie?: never;
    };
    /** @description CreateMcpEndpointInput */
    requestBody: {
      content: {
        'application/json': {
          /** @description The endpoint's display title, up to 100 characters. */
          title: string;
          /** @description The endpoint's name, used in its URL. Lowercase letters, digits and single hyphens, up to 64 characters, unique in the organization. It can't be changed after the endpoint is created. `by-name` and names shaped like an endpoint ID are reserved. */
          name: string;
          /** @description The content the endpoint serves: up to 100 sources, any number of knowledge bases and at most one dataset, served together. Order has no meaning. With no sources, agents can't connect until one is added. */
          sources: ({
            /**
             * @description The source type. `knowledge-base` serves a whole knowledge base.
             * @enum {string}
             */
            type: 'knowledge-base';
            /** @description The knowledge base ID (`kb…`). */
            id: string;
          } | {
            /**
             * @description The source type. `dataset` serves documents from a Sanity dataset, limited by the MCP endpoint's `groqFilter` when set.
             * @enum {string}
             */
            type: 'dataset';
            /** @description The dataset, as `<projectId>.<datasetName>`. */
            id: string;
            /**
             * @description The studio workspace whose schema agents use, by name. `null` uses the studio's first workspace.
             * @default null
             */
            workspace?: string | null;
            /**
             * @description The perspective agents query the dataset with: `published`, `drafts`, or `raw`. `null` uses `published`.
             * @default null
             * @enum {string|null}
             */
            perspective?: 'published' | 'drafts' | 'raw' | null;
            /**
             * @description Whether agents can use semantic search on the dataset. `false` turns it off. `true` or `null` use it while the dataset has embeddings enabled and the organization has embeddings usage left.
             * @default null
             */
            semanticSearch?: boolean | null;
          })[];
          /** @description Instructions for connecting agents, up to 10,000 characters. */
          instructions?: string;
          /** @description A GROQ filter that limits which documents the endpoint's dataset source serves, such as `_type in ["post", "author"]`. Knowledge base sources aren't filtered. Kept only while the endpoint has a dataset source. */
          groqFilter?: string;
        };
      };
    };
    responses: {
      /** @description McpEndpoint */
      201: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': {
            /** @description The endpoint's ID (`mcp…`). Update and delete accept it or the endpoint's name. */
            id: string;
            /** @description The ID of the organization that owns the endpoint. */
            organizationId: string;
            /** @description The endpoint's display title. */
            title: string;
            /** @description The endpoint's name, used in its URL. It can't be changed. */
            name: string;
            /** @description The content the endpoint serves: any number of knowledge bases and at most one dataset, served together. With no sources, agents can't connect until one is added. */
            sources: ({
              /**
               * @description The source type. `knowledge-base` serves a whole knowledge base.
               * @enum {string}
               */
              type: 'knowledge-base';
              /** @description The knowledge base ID (`kb…`). */
              id: string;
            } | {
              /**
               * @description The source type. `dataset` serves documents from a Sanity dataset, limited by the MCP endpoint's `groqFilter` when set.
               * @enum {string}
               */
              type: 'dataset';
              /** @description The dataset, as `<projectId>.<datasetName>`. */
              id: string;
              /**
               * @description The studio workspace whose schema agents use, by name. `null` uses the studio's first workspace.
               * @default null
               */
              workspace: string | null;
              /**
               * @description The perspective agents query the dataset with: `published`, `drafts`, or `raw`. `null` uses `published`.
               * @default null
               * @enum {string|null}
               */
              perspective: 'published' | 'drafts' | 'raw' | null;
              /**
               * @description Whether agents can use semantic search on the dataset. `false` turns it off. `true` or `null` use it while the dataset has embeddings enabled and the organization has embeddings usage left.
               * @default null
               */
              semanticSearch: boolean | null;
            })[];
            /** @description Instructions for connecting agents, or `null` if none are set. */
            instructions: string | null;
            /** @description The GROQ filter that limits the endpoint's dataset source, or `null` if none is set or the endpoint has no dataset. */
            groqFilter: string | null;
            /**
             * Format: uri
             * @description The URL agents connect to.
             */
            url: string;
            /**
             * Format: date-time
             * @description When the endpoint was created, as an ISO 8601 timestamp.
             */
            createdAt: string;
            /**
             * Format: date-time
             * @description When the endpoint was last edited, as an ISO 8601 timestamp. Agents using the endpoint don't change it.
             */
            updatedAt: string;
            /**
             * Format: date-time
             * @description When an agent last used the endpoint, as an ISO 8601 timestamp. It's recorded at most once a day, so it can be up to a day behind. `null` if the endpoint hasn't been used since usage tracking started.
             */
            lastUsedAt: string | null;
          };
        };
      };
      /** @description Error */
      default: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': components['schemas']['ApiErrorBody'];
        };
      };
    };
  };
  serveMcpEndpoint: {
    parameters: {
      query?: {
        /**
         * @deprecated
         * @description Agent instructions that replace the endpoint's configured instructions for this request. Deprecated: refused from API version `v2026-11-03`. Configure it on the MCP endpoint instead.
         */
        instructions?: string;
        /**
         * @deprecated
         * @description The perspective for GROQ queries: `published` (default), `previewDrafts`, `raw`, or a release. Deprecated: refused from API version `v2026-11-03`. Configure it on the MCP endpoint instead.
         */
        perspective?: string;
        /**
         * @deprecated
         * @description Set to `true` or `false` to turn semantic search on or off. Omit it to use the dataset source setting. Deprecated: refused from API version `v2026-11-03`. Configure it on the MCP endpoint instead.
         */
        embeddings?: string;
        /**
         * @deprecated
         * @description A GROQ filter that narrows the endpoint's configured content filter for this request. Documents must match both. Deprecated: refused from API version `v2026-11-03`. Configure it on the MCP endpoint instead.
         */
        groqFilter?: string;
        /**
         * @deprecated
         * @description Serves only one side of the endpoint for this request: `knowledge_base` serves its knowledge bases and `groq` serves its dataset. Omit it to serve every source the endpoint has. A request whose chosen side the endpoint doesn't have is refused. Deprecated: refused from API version `v2026-11-03`. Configure it on the MCP endpoint instead.
         */
        mode?: 'knowledge_base' | 'groq';
        /**
         * @deprecated
         * @description Comma-separated knowledge base public IDs (`kb...`) that replace the endpoint's knowledge base sources for this request. Deprecated: refused from API version `v2026-11-03`. Configure it on the MCP endpoint instead.
         */
        knowledgeBases?: string;
        /** @description A JSON array that adds `_url` fields to query results. Each item has `types` (document types), `baseUrl`, and an optional `slugExpression`, a GROQ expression that defaults to `slug.current`. Invalid JSON is ignored. */
        linkResolver?: string;
        /**
         * @deprecated
         * @description The studio workspace to use. Replaces the dataset source's workspace for this request. Deprecated: refused from API version `v2026-11-03`. Configure it on the MCP endpoint instead.
         */
        workspace?: string;
      };
      header?: never;
      path: {
        /** @description The MCP endpoint's name, set when the endpoint was created. */
        mcpEndpoint: string;
        /** @description The API version: a date in the format `vYYYY-MM-DD`, for example `v2026-05-26`, or `vX` for the latest, unstable version. */
        apiVersion: string;
        /** @description The ID of the organization. */
        organizationId: string;
      };
      cookie?: never;
    };
    requestBody?: never;
    responses: {
      /** @description Default Response */
      200: {
        headers: {
          [name: string]: unknown;
        };
        content?: never;
      };
    };
  };
  deleteMcpEndpoint: {
    parameters: {
      query?: never;
      header?: never;
      path: {
        /** @description The MCP endpoint's name, as in its URL, or its ID (`mcp…`). Names can't take the shape of an ID, so either one identifies the endpoint. */
        mcpEndpoint: string;
        /** @description The API version: a date in the format `vYYYY-MM-DD`, for example `v2026-05-26`, or `vX` for the latest, unstable version. */
        apiVersion: string;
        /** @description The ID of the organization. */
        organizationId: string;
      };
      cookie?: never;
    };
    requestBody?: never;
    responses: {
      /** @description Default Response */
      204: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': null;
        };
      };
      /** @description Error */
      default: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': components['schemas']['ApiErrorBody'];
        };
      };
    };
  };
  updateMcpEndpoint: {
    parameters: {
      query?: never;
      header?: never;
      path: {
        /** @description The MCP endpoint's name, as in its URL, or its ID (`mcp…`). Names can't take the shape of an ID, so either one identifies the endpoint. */
        mcpEndpoint: string;
        /** @description The API version: a date in the format `vYYYY-MM-DD`, for example `v2026-05-26`, or `vX` for the latest, unstable version. */
        apiVersion: string;
        /** @description The ID of the organization. */
        organizationId: string;
      };
      cookie?: never;
    };
    /** @description UpdateMcpEndpointInput */
    requestBody: {
      content: {
        'application/json': {
          /** @description The endpoint's display title, up to 100 characters. */
          title?: string;
          /** @description The content the endpoint serves: up to 100 sources, any number of knowledge bases and at most one dataset, served together. Order has no meaning. With no sources, agents can't connect until one is added. */
          sources?: ({
            /**
             * @description The source type. `knowledge-base` serves a whole knowledge base.
             * @enum {string}
             */
            type: 'knowledge-base';
            /** @description The knowledge base ID (`kb…`). */
            id: string;
          } | {
            /**
             * @description The source type. `dataset` serves documents from a Sanity dataset, limited by the MCP endpoint's `groqFilter` when set.
             * @enum {string}
             */
            type: 'dataset';
            /** @description The dataset, as `<projectId>.<datasetName>`. */
            id: string;
            /**
             * @description The studio workspace whose schema agents use, by name. `null` uses the studio's first workspace.
             * @default null
             */
            workspace?: string | null;
            /**
             * @description The perspective agents query the dataset with: `published`, `drafts`, or `raw`. `null` uses `published`.
             * @default null
             * @enum {string|null}
             */
            perspective?: 'published' | 'drafts' | 'raw' | null;
            /**
             * @description Whether agents can use semantic search on the dataset. `false` turns it off. `true` or `null` use it while the dataset has embeddings enabled and the organization has embeddings usage left.
             * @default null
             */
            semanticSearch?: boolean | null;
          })[];
          /** @description Instructions for connecting agents, up to 10,000 characters. `null` removes them. */
          instructions?: string | null;
          /** @description A GROQ filter that limits the endpoint's dataset source. `null` removes it. */
          groqFilter?: string | null;
        };
      };
    };
    responses: {
      /** @description McpEndpoint */
      200: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': {
            /** @description The endpoint's ID (`mcp…`). Update and delete accept it or the endpoint's name. */
            id: string;
            /** @description The ID of the organization that owns the endpoint. */
            organizationId: string;
            /** @description The endpoint's display title. */
            title: string;
            /** @description The endpoint's name, used in its URL. It can't be changed. */
            name: string;
            /** @description The content the endpoint serves: any number of knowledge bases and at most one dataset, served together. With no sources, agents can't connect until one is added. */
            sources: ({
              /**
               * @description The source type. `knowledge-base` serves a whole knowledge base.
               * @enum {string}
               */
              type: 'knowledge-base';
              /** @description The knowledge base ID (`kb…`). */
              id: string;
            } | {
              /**
               * @description The source type. `dataset` serves documents from a Sanity dataset, limited by the MCP endpoint's `groqFilter` when set.
               * @enum {string}
               */
              type: 'dataset';
              /** @description The dataset, as `<projectId>.<datasetName>`. */
              id: string;
              /**
               * @description The studio workspace whose schema agents use, by name. `null` uses the studio's first workspace.
               * @default null
               */
              workspace: string | null;
              /**
               * @description The perspective agents query the dataset with: `published`, `drafts`, or `raw`. `null` uses `published`.
               * @default null
               * @enum {string|null}
               */
              perspective: 'published' | 'drafts' | 'raw' | null;
              /**
               * @description Whether agents can use semantic search on the dataset. `false` turns it off. `true` or `null` use it while the dataset has embeddings enabled and the organization has embeddings usage left.
               * @default null
               */
              semanticSearch: boolean | null;
            })[];
            /** @description Instructions for connecting agents, or `null` if none are set. */
            instructions: string | null;
            /** @description The GROQ filter that limits the endpoint's dataset source, or `null` if none is set or the endpoint has no dataset. */
            groqFilter: string | null;
            /**
             * Format: uri
             * @description The URL agents connect to.
             */
            url: string;
            /**
             * Format: date-time
             * @description When the endpoint was created, as an ISO 8601 timestamp.
             */
            createdAt: string;
            /**
             * Format: date-time
             * @description When the endpoint was last edited, as an ISO 8601 timestamp. Agents using the endpoint don't change it.
             */
            updatedAt: string;
            /**
             * Format: date-time
             * @description When an agent last used the endpoint, as an ISO 8601 timestamp. It's recorded at most once a day, so it can be up to a day behind. `null` if the endpoint hasn't been used since usage tracking started.
             */
            lastUsedAt: string | null;
          };
        };
      };
      /** @description Error */
      default: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': components['schemas']['ApiErrorBody'];
        };
      };
    };
  };
  getMcpEndpointInitialContext: {
    parameters: {
      query?: {
        /**
         * @deprecated
         * @description Agent instructions that replace the endpoint's configured instructions for this request. Deprecated: refused from API version `v2026-11-03`. Configure it on the MCP endpoint instead.
         */
        instructions?: string;
        /**
         * @deprecated
         * @description The perspective for GROQ queries: `published` (default), `previewDrafts`, `raw`, or a release. Deprecated: refused from API version `v2026-11-03`. Configure it on the MCP endpoint instead.
         */
        perspective?: string;
        /**
         * @deprecated
         * @description Set to `true` or `false` to turn semantic search on or off. Omit it to use the dataset source setting. Deprecated: refused from API version `v2026-11-03`. Configure it on the MCP endpoint instead.
         */
        embeddings?: string;
        /**
         * @deprecated
         * @description A GROQ filter that narrows the endpoint's configured content filter for this request. Documents must match both. Deprecated: refused from API version `v2026-11-03`. Configure it on the MCP endpoint instead.
         */
        groqFilter?: string;
        /**
         * @deprecated
         * @description Serves only one side of the endpoint for this request: `knowledge_base` serves its knowledge bases and `groq` serves its dataset. Omit it to serve every source the endpoint has. A request whose chosen side the endpoint doesn't have is refused. Deprecated: refused from API version `v2026-11-03`. Configure it on the MCP endpoint instead.
         */
        mode?: 'knowledge_base' | 'groq';
        /**
         * @deprecated
         * @description Comma-separated knowledge base public IDs (`kb...`) that replace the endpoint's knowledge base sources for this request. Deprecated: refused from API version `v2026-11-03`. Configure it on the MCP endpoint instead.
         */
        knowledgeBases?: string;
        /** @description A JSON array that adds `_url` fields to query results. Each item has `types` (document types), `baseUrl`, and an optional `slugExpression`, a GROQ expression that defaults to `slug.current`. Invalid JSON is ignored. */
        linkResolver?: string;
        /**
         * @deprecated
         * @description The studio workspace to use. Replaces the dataset source's workspace for this request. Deprecated: refused from API version `v2026-11-03`. Configure it on the MCP endpoint instead.
         */
        workspace?: string;
        /** @description How many levels to shift markdown headings down, from `0` to `6`. Defaults to `1`, so `#` becomes `##`. */
        heading_offset?: string;
      };
      header?: never;
      path: {
        /** @description The MCP endpoint's name, set when the endpoint was created. */
        mcpEndpoint: string;
        /** @description The API version: a date in the format `vYYYY-MM-DD`, for example `v2026-05-26`, or `vX` for the latest, unstable version. */
        apiVersion: string;
        /** @description The ID of the organization. */
        organizationId: string;
      };
      cookie?: never;
    };
    requestBody?: never;
    responses: {
      /** @description Default Response */
      200: {
        headers: {
          [name: string]: unknown;
        };
        content?: never;
      };
      /** @description Error */
      default: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': components['schemas']['ApiErrorBody'];
        };
      };
    };
  };
  getMcpEndpointStatus: {
    parameters: {
      query?: {
        /**
         * @deprecated
         * @description Agent instructions that replace the endpoint's configured instructions for this request. Deprecated: refused from API version `v2026-11-03`. Configure it on the MCP endpoint instead.
         */
        instructions?: string;
        /**
         * @deprecated
         * @description The perspective for GROQ queries: `published` (default), `previewDrafts`, `raw`, or a release. Deprecated: refused from API version `v2026-11-03`. Configure it on the MCP endpoint instead.
         */
        perspective?: string;
        /**
         * @deprecated
         * @description Set to `true` or `false` to turn semantic search on or off. Omit it to use the dataset source setting. Deprecated: refused from API version `v2026-11-03`. Configure it on the MCP endpoint instead.
         */
        embeddings?: string;
        /**
         * @deprecated
         * @description A GROQ filter that narrows the endpoint's configured content filter for this request. Documents must match both. Deprecated: refused from API version `v2026-11-03`. Configure it on the MCP endpoint instead.
         */
        groqFilter?: string;
        /**
         * @deprecated
         * @description Serves only one side of the endpoint for this request: `knowledge_base` serves its knowledge bases and `groq` serves its dataset. Omit it to serve every source the endpoint has. A request whose chosen side the endpoint doesn't have is refused. Deprecated: refused from API version `v2026-11-03`. Configure it on the MCP endpoint instead.
         */
        mode?: 'knowledge_base' | 'groq';
        /**
         * @deprecated
         * @description Comma-separated knowledge base public IDs (`kb...`) that replace the endpoint's knowledge base sources for this request. Deprecated: refused from API version `v2026-11-03`. Configure it on the MCP endpoint instead.
         */
        knowledgeBases?: string;
        /** @description A JSON array that adds `_url` fields to query results. Each item has `types` (document types), `baseUrl`, and an optional `slugExpression`, a GROQ expression that defaults to `slug.current`. Invalid JSON is ignored. */
        linkResolver?: string;
        /**
         * @deprecated
         * @description The studio workspace to use. Replaces the dataset source's workspace for this request. Deprecated: refused from API version `v2026-11-03`. Configure it on the MCP endpoint instead.
         */
        workspace?: string;
      };
      header?: never;
      path: {
        /** @description The MCP endpoint's name, set when the endpoint was created. */
        mcpEndpoint: string;
        /** @description The API version: a date in the format `vYYYY-MM-DD`, for example `v2026-05-26`, or `vX` for the latest, unstable version. */
        apiVersion: string;
        /** @description The ID of the organization. */
        organizationId: string;
      };
      cookie?: never;
    };
    requestBody?: never;
    responses: {
      /** @description Default Response */
      200: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': {
            /** @description Whether every check that applies to the connection passed, except `semanticSearch` and `access`. When `true`, the endpoint is ready for an agent whose credentials can read what it serves. */
            ready: boolean;
            /**
             * @deprecated
             * @description Deprecated: use `ready`, which always has the same value.
             */
            requiredOk: boolean;
            /** @description One result per check. A check is `null` when it doesn't apply to the connection. */
            checks: {
              /** @description Whether a deployed studio serves the endpoint's dataset. Its schema tells the agent which document types exist. `null` when the connection doesn't query a dataset. */
              studio: ({
                /**
                 * @description The check passed.
                 * @enum {boolean}
                 */
                ok: true;
                /** @description The name of the studio workspace the connection uses. */
                workspace: string;
                /** @description The workspace's title. */
                workspaceTitle: string;
                /** @description Whether the workspace was picked automatically because none was set. It is `false` when the dataset source's `workspace` chose it, or a `workspace` query parameter on versions before `v2026-11-03`. */
                workspaceAutoSelected: boolean;
                /** @description The deployed studio's workspaces for the endpoint's dataset. */
                availableWorkspaces: {
                  /** @description The workspace's name. */
                  name: string;
                  /** @description The workspace's title. */
                  title: string;
                }[];
              } | {
                /**
                 * @description The check failed.
                 * @enum {boolean}
                 */
                ok: false;
                /** @description Why the check failed, written to show to users. */
                error: string;
              }) | null;
              /** @description Whether semantic search works on the endpoint's dataset. `null` when the connection doesn't query a dataset, or when semantic search is on but the dataset doesn't have embeddings enabled. It never affects `ready`: without it, the agent searches with GROQ only. */
              semanticSearch: ({
                /**
                 * @description The check passed.
                 * @enum {boolean}
                 */
                ok: true;
                /** @description The dataset's embeddings index status, if known. */
                status: string | null;
                /** @description Whether the project is within its embeddings usage limit, or `null` if it couldn't be checked. */
                withinUsageLimit: boolean | null;
                /** @description Whether agents connecting now can use semantic search. On versions before `v2026-11-03`, `?embeddings=true` forces the tool on for agents even when this is `false`. */
                active: boolean;
                /**
                 * @description Why semantic search isn't active: `turnedOff` when the dataset source has it off, `datasetEmbeddingsNotReady` while the dataset's embeddings are still being prepared, and `usageLimitReached` when the organization has no embeddings usage left. `null` when it is active.
                 * @enum {string|null}
                 */
                inactiveReason: 'turnedOff' | 'datasetEmbeddingsNotReady' | 'usageLimitReached' | null;
              } | {
                /**
                 * @description The check failed.
                 * @enum {boolean}
                 */
                ok: false;
                /** @description Why the check failed, written to show to users. */
                error: string;
              }) | null;
              /** @description Whether the studio's schema has document types the agent can query. `null` when the connection doesn't query a dataset. */
              schema: ({
                /**
                 * @description The check passed.
                 * @enum {boolean}
                 */
                ok: true;
                /** @description The number of document types the agent can query, after the endpoint's GROQ filter. */
                documentTypes: number;
                /** @description The perspective agents query the dataset with, such as `published` or `drafts`. */
                perspective: string;
              } | {
                /**
                 * @description The check failed.
                 * @enum {boolean}
                 */
                ok: false;
                /** @description Why the check failed, written to show to users. */
                error: string;
              }) | null;
              /** @description Whether every knowledge base the connection serves exists and has been built. `null` when the connection doesn't serve knowledge bases. */
              knowledgeBases: ({
                /**
                 * @description The check passed.
                 * @enum {boolean}
                 */
                ok: true;
                /** @description The IDs of the knowledge bases the connection serves. */
                resolved: string[];
              } | {
                /**
                 * @description The check failed.
                 * @enum {boolean}
                 */
                ok: false;
                /** @description The IDs of the knowledge bases that exist. */
                resolved: string[];
                /** @description The IDs of knowledge bases that don't exist in the organization. */
                missing: string[];
                /** @description The IDs of knowledge bases that haven't been built yet. Build them before connecting an agent. */
                unbuilt: string[];
                /** @description Why the check failed, written to show to users. */
                error: string;
              }) | null;
              /** @description Whether your credentials can read the knowledge bases the connection serves. It never affects `ready`: agents connect with their own credentials, so check with the agent's token to know whether that agent can connect. `null` when the connection serves no knowledge bases that exist. */
              access: ({
                /**
                 * @description You can read every knowledge base.
                 * @enum {boolean}
                 */
                ok: true;
              } | {
                /**
                 * @description You can't read some of the knowledge bases.
                 * @enum {boolean}
                 */
                ok: false;
                /** @description The IDs of knowledge bases your credentials can't read. */
                denied: string[];
                /** @description What you lack, written to show to users. */
                error: string;
              }) | null;
            };
          };
        };
      };
      /** @description Error */
      default: {
        headers: {
          [name: string]: unknown;
        };
        content: {
          'application/json': components['schemas']['ApiErrorBody'];
        };
      };
    };
  };
}
declare namespace types_d_exports {
  export { ApiErrorBody, Body, ContextListenOptions, ContextRequestOptions, ConversationDoc, CreateFileSourceParams, EntryDoc, ErrorCode, FileUpload, HeaderParams, InstructionDoc, IssueDoc, McpDoc, Operation, PathParams, QueryParams$1 as QueryParams, RequestArgs, RequestInit$1 as RequestInit, Response, ResponseFormat, Route, Source, SyncAccepted, UploadFileParams, components, operations, paths, possibleStoreRequestOptions };
}
/** @internal */
declare const possibleStoreRequestOptions: readonly ['headers', 'signal', 'tag', 'timeout', 'token'];
/**
 * Request options honored by `context.fetch`.
 *
 * @beta
 */
type ContextRequestOptions = Pick<RequestOptions$1, (typeof possibleStoreRequestOptions)[number]>;
/**
 * Listener options for `context.listen`.
 *
 * `includeAllVersions` is left out: Context documents are written by the
 * Context API with no drafts or versions, so it would never make a
 * difference.
 *
 * @beta
 */
type ContextListenOptions = Omit<ListenOptions, 'includeAllVersions'> | Omit<ResumableListenOptions, 'includeAllVersions'>;
type Method = 'get' | 'put' | 'post' | 'patch' | 'delete';
type PathPrefix = '/{apiVersion}/context';
type ContextPath = keyof paths extends (infer K) ? K extends `${PathPrefix}${infer P}` ? P : never : never;
type PathItem<P extends ContextPath> = paths[`${PathPrefix}${P}`];
/**
 * A Context API operation as `METHOD /path`, the path as the Context API's
 * OpenAPI spec writes it after `/{apiVersion}/context`, for example
 * `'POST /knowledge-bases/{knowledgeBaseId}/sources'`.
 *
 * @beta
 */
type Route = { [P in ContextPath]: { [M in Method]: PathItem<P>[M] extends {
  responses: unknown;
} ? `${Uppercase<M>} ${P}` : never; }[Method]; }[ContextPath];
/**
 * The spec's operation object for a route.
 *
 * @beta
 */
type Operation<R extends Route> = R extends `${infer M} ${infer P}` ? P extends ContextPath ? Lowercase<M> extends Method ? PathItem<P>[Lowercase<M>] : never : never : never;
type OperationParameters<R extends Route, In extends 'path' | 'query' | 'header'> = Operation<R> extends {
  parameters: { [K in In]?: infer T; };
} ? NonNullable<T> : never;
/** Path parameters the client fills in from its configuration when a call leaves them out. */
type ConfiguredParam = 'knowledgeBaseId' | 'organizationId';
type SpecPathParams<R extends Route> = Omit<OperationParameters<R, 'path'>, 'apiVersion'>;
/**
 * A route's path parameters. `knowledgeBaseId` defaults to the client's
 * `resource` when it is a knowledge base, and `organizationId` to
 * `context.organizationId`.
 *
 * @beta
 */
type PathParams<R extends Route> = Omit<SpecPathParams<R>, ConfiguredParam> & Partial<Pick<SpecPathParams<R>, Extract<keyof SpecPathParams<R>, ConfiguredParam>>>;
/** @beta */
type QueryParams$1<R extends Route> = OperationParameters<R, 'query'>;
/** @beta */
type HeaderParams<R extends Route> = OperationParameters<R, 'header'>;
/**
 * A route's JSON request body.
 *
 * @beta
 */
type Body<R extends Route> = Operation<R> extends {
  requestBody: {
    content: {
      'application/json': infer B;
    };
  };
} ? B : never;
type SuccessStatus = 200 | 201 | 202 | 204;
type JsonResponse<R extends Route> = Operation<R> extends {
  responses: infer Responses;
} ? { [S in keyof Responses]: S extends SuccessStatus ? S extends 204 ? undefined : Responses[S] extends {
  content: {
    'application/json': infer T;
  };
} ? T : unknown : never; }[keyof Responses] : never;
/**
 * The `format` query values a route takes, such as a document's content in
 * `json`, `markdown` or `plain`. `raw` answers with bytes, so it goes through
 * `requestBytes`.
 *
 * @beta
 */
type ResponseFormat<R extends Route> = Exclude<QueryParams$1<R> extends {
  format?: infer F;
} ? F : never, 'raw'>;
/**
 * What a route resolves with: its success response body, `undefined` for
 * `204 No Content`, and `unknown` where the spec gives no JSON schema. A
 * `format` of `markdown` or `plain` resolves with the text.
 *
 * @beta
 */
type Response<R extends Route, F = never> = [F] extends [never] ? JsonResponse<R> : F extends 'markdown' | 'plain' ? string : JsonResponse<R>;
type RequiredKeys<T> = { [K in keyof T]-?: {} extends Pick<T, K> ? never : K; }[keyof T];
/** Required when `T` has a required key, optional when it has none, absent when `never`. */
type Slot<Name extends string, T> = [T] extends [never] ? { [K in Name]?: never; } : [RequiredKeys<T>] extends [never] ? { [K in Name]?: T; } : { [K in Name]: T; };
/**
 * The second argument of `context.request`: the route's path parameters,
 * query, headers and body, each typed from the spec, plus `signal` and `tag`.
 *
 * @beta
 */
type RequestInit$1<R extends Route, F = never> = Slot<'params', PathParams<R>> & Slot<'query', QueryParams$1<R>> & {
  query?: {
    format?: F;
  };
} & Slot<'headers', HeaderParams<R>> & ([Body<R>] extends [never] ? {
  body?: never;
} : {
  body: Body<R>;
}) & {
  signal?: AbortSignal;
  tag?: string;
};
/**
 * The init argument as a rest tuple: optional when nothing in it is required.
 *
 * @beta
 */
type RequestArgs<R extends Route, F = never> = [RequiredKeys<RequestInit$1<R>>] extends [never] ? [init?: RequestInit$1<R, F>] : [init: RequestInit$1<R, F>];
/**
 * A file for a `files` source. The client stages an upload, PUTs the bytes
 * straight to storage with a signed URL, and starts the source's sync with
 * it. The Context API never holds the file content.
 *
 * @beta
 */
type FileUpload = {
  /** Same shapes `assets.upload` accepts, minus node streams: the bytes go
   * out through `fetch`, which has no portable stream support. A single
   * document, or a zip, tar or gzip archive of them. */
  file: Exclude<UploadBody, NodeJS.ReadableStream>;
  filename: string;
  /** When set, the bytes are PUT with this `Content-Type`. */
  contentType?: string;
};
/** @beta */
type UploadFileParams = FileUpload & {
  sourceId: string;
  knowledgeBaseId?: string;
};
/** @beta */
type CreateFileSourceParams = FileUpload & Omit<Extract<Body<'POST /knowledge-bases/{knowledgeBaseId}/sources'>, {
  type: 'files';
}>, 'content' | 'contentType'> & {
  knowledgeBaseId?: string;
};
/** A `sanity.context.entry` document, for typing GROQ reads. @beta */
type EntryDoc = components['schemas']['EntryDoc'];
/** A `sanity.context.issue` document, for typing GROQ reads. @beta */
type IssueDoc = components['schemas']['IssueDoc'];
/** A `sanity.context.instruction` document, for typing GROQ reads. @beta */
type InstructionDoc = components['schemas']['InstructionDoc'];
/** A `sanity.context.mcp` document, for typing GROQ reads. @beta */
type McpDoc = components['schemas']['McpDoc'];
/** A `sanity.context.conversation` document, for typing GROQ reads. @beta */
type ConversationDoc = components['schemas']['ConversationDoc'];
/** @beta */
type Source = Response<'GET /knowledge-bases/{knowledgeBaseId}/sources/{sourceId}'>;
/** @beta */
type SyncAccepted = Response<'POST /knowledge-bases/{knowledgeBaseId}/sources/{sourceId}/syncs'>;
/**
 * A Context API error code, from the `code` of an error response. Branch on it
 * rather than on `message`, which can change.
 *
 * @beta
 */
type ErrorCode = components['schemas']['ApiErrorBody']['code'];
/**
 * The body of a Context API error response. `code` is one of the known
 * {@link ErrorCode}s, or a code the API added after this client was released.
 *
 * @beta
 */
type ApiErrorBody = Omit<components['schemas']['ApiErrorBody'], 'code'> & {
  code: ErrorCode | (string & {});
};
/**
 * The `client.context` namespaces `@sanity/client` 8.14 and earlier had, kept so the Sanity CLI
 * versions that still call them keep working. Each REST method calls a route the Context API
 * still serves; `imports` and `refresh()` went with their routes, so they throw.
 */
/** @beta @deprecated Use `client.context.request`. */
type LegacyRequestOptions = {
  signal?: AbortSignal;
  tag?: string;
};
/** @beta @deprecated Use `client.context.request`. */
type LegacyEntry = Pick<EntryDoc, '_id' | 'path' | 'title' | 'tldr' | 'status'>;
/**
 * `client.context`: the Context API, typed from its OpenAPI spec.
 *
 * {@link ContextClient.request} calls any operation by its `METHOD /path`,
 * with path parameters, query, headers and body typed from the spec.
 * `knowledgeBaseId` defaults to the client's `knowledge-base` resource and
 * `organizationId` to `context.organizationId`. GROQ reads of the
 * organization's Context documents go through {@link ContextClient.fetch}
 * and {@link ContextClient.listen}.
 *
 * @example
 * ```ts
 * const kb = await client.context.request('POST /knowledge-bases', {
 *   body: {organizationId: 'org123', title: 'Support docs', description: 'Product docs'},
 * })
 * const source = await client.context.request('POST /knowledge-bases/{knowledgeBaseId}/sources', {
 *   params: {knowledgeBaseId: kb.publicId},
 *   body: {type: 'web', url: 'https://example.com/docs'},
 * })
 * ```
 *
 * @beta
 */
declare class ContextClient {
  #private;
  constructor(client: SanityClient$1, httpRequest: HttpRequest);
  /** @deprecated Use `request` with the `/knowledge-bases` routes. Kept for Sanity CLI 8.27 and earlier. */
  knowledgeBases: {
    create: (params: Body<'POST /knowledge-bases'>, options?: LegacyRequestOptions) => Promise<Response<'POST /knowledge-bases'>>;
    list: (params: {
      organizationId: string;
      cursor?: string;
      limit?: number;
    } & LegacyRequestOptions) => Promise<Response<'GET /knowledge-bases'>>;
    get: (id: string, options?: LegacyRequestOptions) => Promise<Response<'GET /knowledge-bases/{knowledgeBaseId}'>>;
    edit: (id: string, params: Body<'PATCH /knowledge-bases/{knowledgeBaseId}'>, options?: LegacyRequestOptions) => Promise<Response<'PATCH /knowledge-bases/{knowledgeBaseId}'>>;
    delete: (id: string, options?: LegacyRequestOptions) => Promise<void>;
  };
  /** @deprecated Use `request` with the MCP endpoint routes. Kept for Sanity CLI 8.27 and earlier. */
  mcpEndpoints: {
    list: (options?: ContextRequestOptions) => Promise<McpDoc[]>;
    get: (params: {
      name: string;
    }, options?: ContextRequestOptions) => Promise<McpDoc | null>;
    create: (params: Body<'POST /organizations/{organizationId}/mcp'>, options?: LegacyRequestOptions) => Promise<Response<'POST /organizations/{organizationId}/mcp'>>;
    edit: (params: {
      name: string;
    } & Body<'PATCH /organizations/{organizationId}/mcp/{mcpEndpoint}'>, options?: LegacyRequestOptions) => Promise<Response<'PATCH /organizations/{organizationId}/mcp/{mcpEndpoint}'>>;
    status: (params: {
      name: string;
    } & QueryParams$1<'GET /organizations/{organizationId}/mcp/{mcpEndpoint}/status'>, options?: LegacyRequestOptions) => Promise<Response<'GET /organizations/{organizationId}/mcp/{mcpEndpoint}/status'>>;
    delete: (params: {
      name: string;
    }, options?: LegacyRequestOptions) => Promise<void>;
    initialContext: (params: {
      name: string;
    } & QueryParams$1<'GET /organizations/{organizationId}/mcp/{mcpEndpoint}/initial-context'>, options?: LegacyRequestOptions) => Promise<Response<'GET /organizations/{organizationId}/mcp/{mcpEndpoint}/initial-context'>>;
  };
  /** @deprecated Use `request` and `fetch`. Kept for Sanity CLI 8.27 and earlier. */
  entries: {
    list: (options?: ContextRequestOptions) => Promise<LegacyEntry[]>;
    get: (params: {
      path: string;
    }, options?: ContextRequestOptions) => Promise<EntryDoc | null>;
    rebuild: (params: {
      path: string;
    }, options?: LegacyRequestOptions) => Promise<Response<'POST /knowledge-bases/{knowledgeBaseId}/entries/{entryPath}/rebuild'>>;
  };
  /** @deprecated Use `request` and `fetch`. Kept for Sanity CLI 8.27 and earlier. */
  issues: {
    list: (params?: {
      status?: 'open' | 'accepted' | 'rejected';
    }, options?: ContextRequestOptions) => Promise<IssueDoc[]>;
    get: (params: {
      issueId: string;
    }, options?: ContextRequestOptions) => Promise<IssueDoc | null>;
    resolve: (params: {
      issueId: string;
    } & Body<'POST /knowledge-bases/{knowledgeBaseId}/issues/{issueId}/resolve'>, options?: LegacyRequestOptions) => Promise<Response<'POST /knowledge-bases/{knowledgeBaseId}/issues/{issueId}/resolve'>>;
    dismiss: (params: {
      issueId: string;
    }, options?: LegacyRequestOptions) => Promise<Response<'POST /knowledge-bases/{knowledgeBaseId}/issues/{issueId}/dismiss'>>;
    reopen: (params: {
      issueId: string;
    }, options?: LegacyRequestOptions) => Promise<Response<'POST /knowledge-bases/{knowledgeBaseId}/issues/{issueId}/reopen'>>;
    apply: (params: Body<'POST /knowledge-bases/{knowledgeBaseId}/issues/apply'>, options?: LegacyRequestOptions) => Promise<Response<'POST /knowledge-bases/{knowledgeBaseId}/issues/apply'>>;
  };
  /** @deprecated Use `request`. Kept for Sanity CLI 8.27 and earlier. */
  jobs: {
    get: (params: {
      jobId: string;
    }, options?: LegacyRequestOptions) => Promise<Response<'GET /knowledge-bases/{knowledgeBaseId}/jobs/{jobId}'>>;
  };
  /** @deprecated Use `request('POST /knowledge-bases/{knowledgeBaseId}/build')`. Kept for Sanity CLI 8.27 and earlier. */
  build: (options?: LegacyRequestOptions) => Promise<Response<'POST /knowledge-bases/{knowledgeBaseId}/build'>>;
  /** @deprecated Use `request('POST /knowledge-bases/{knowledgeBaseId}/build/cancel')`. Kept for Sanity CLI 8.27 and earlier. */
  cancelBuild: (options?: LegacyRequestOptions) => Promise<Response<'POST /knowledge-bases/{knowledgeBaseId}/build/cancel'>>;
  /** @deprecated Removed with the imports API; throws. Use the sources, syncs and documents routes. */
  imports: {
    create: () => never;
    list: () => never;
    get: () => never;
    download: () => never;
    delete: () => never;
  };
  /** @deprecated Removed with the imports API; throws. Use `request('POST /knowledge-bases/{knowledgeBaseId}/sync')`. */
  refresh: () => never;
  /**
   * Call a Context API operation. Resolves with the success response body,
   * or `undefined` for `204 No Content`; rejects with the API's error.
   */
  request<R extends Route, const F extends ResponseFormat<R> = never>(route: R, ...[init]: RequestArgs<R, F>): Promise<Response<R, F>>;
  /**
   * {@link ContextClient.request}, resolving with the response bytes instead
   * of parsed JSON: for a document's content with `format: 'raw'`, the bytes
   * its source gave.
   */
  requestBytes<R extends Route>(route: R, ...[init]: RequestArgs<R, unknown>): Promise<Uint8Array>;
  /**
   * Upload a file to a `files` source and sync it, replacing the file it
   * holds: stages an upload, PUTs the bytes to the signed storage URL, and
   * starts the sync with it. The bytes never pass through the Context API.
   * If the API refuses the sync, the error carries the staged `uploadId`, so
   * a retry can start the sync with it instead of uploading the bytes again.
   */
  uploadFile(params: UploadFileParams, options?: {
    signal?: AbortSignal;
    tag?: string;
  }): Promise<SyncAccepted>;
  /**
   * Add a `files` source holding a file: adds the source, uploads the file
   * with {@link ContextClient.uploadFile}, and resolves with the source as
   * created and the sync the upload started (follow its `jobId`). If the
   * upload fails, the source is deleted again before the error is thrown.
   */
  createFileSource(params: CreateFileSourceParams, options?: {
    signal?: AbortSignal;
    tag?: string;
  }): Promise<{
    source: Source;
    sync: SyncAccepted;
  }>;
  /**
   * GROQ over the organization's Context documents. The store holds every
   * Context document family and the caller's access decides what a query
   * returns, so filter on `_type`.
   *
   * Requires `context.organizationId` in the client configuration.
   */
  fetch<R = unknown>(query: string, params?: QueryParams, options?: ContextRequestOptions): Promise<R>;
  /**
   * Listen for changes to the organization's Context documents. Mirrors
   * `client.listen(query, params, options)` and emits mutation events by
   * default.
   */
  listen<Opts extends ContextListenOptions | undefined = undefined>(query: string, params?: QueryParams, options?: Opts): Observable<ListenEventFromOptions<SanityDocument$1, Opts>>;
}
/**
 * Observable counterpart of {@link ContextClient}.
 *
 * @beta
 */
declare class ObservableContextClient {
  #private;
  constructor(client: ObservableSanityClient$1, httpRequest: HttpRequest);
  /** Call a Context API operation. See {@link ContextClient.request}. */
  request<R extends Route, const F extends ResponseFormat<R> = never>(route: R, ...[init]: RequestArgs<R, F>): Observable<Response<R, F>>;
  /** GROQ over the organization's Context documents. See {@link ContextClient.fetch}. */
  fetch<R = unknown>(query: string, params?: QueryParams, options?: ContextRequestOptions): Observable<R>;
  /** Listen for changes to the organization's Context documents. See {@link ContextClient.listen}. */
  listen<Opts extends ContextListenOptions | undefined = undefined>(query: string, params?: QueryParams, options?: Opts): Observable<ListenEventFromOptions<SanityDocument$1, Opts>>;
}
/**
 * @public
 * @inline
 */
declare class LiveClient {
  #private;
  constructor(client: SanityClient$1 | ObservableSanityClient$1);
  /**
   * Requires `apiVersion` to be `2021-03-25` or later.
   */
  events({ includeDrafts, tag: _tag, waitFor }?: {
    includeDrafts?: boolean;
    /**
     * Optional request tag for the listener. Use to identify the request in logs.
     *
     * @defaultValue `undefined`
     */
    tag?: string;
    /**
     * Delays events until after a Sanity Function has processed them and called the callback endpoint.
     * When omitted, events are delivered immediately.
     */
    waitFor?: 'function';
  }): Observable<LiveEvent>;
}
/** @internal */
declare class BasePatch {
  protected selection: PatchSelection;
  protected operations: PatchOperations;
  constructor(selection: PatchSelection, operations?: PatchOperations);
  /**
   * Sets the given attributes to the document. Does NOT merge objects.
   * The operation is added to the current patch, ready to be commited by `commit()`
   *
   * @param attrs - Attributes to set. To set a deep attribute, use JSONMatch, eg: \{"nested.prop": "value"\}
   */
  set(attrs: AttributeSet): this;
  /**
   * Sets the given attributes to the document if they are not currently set. Does NOT merge objects.
   * The operation is added to the current patch, ready to be commited by `commit()`
   *
   * @param attrs - Attributes to set. To set a deep attribute, use JSONMatch, eg: \{"nested.prop": "value"\}
   */
  setIfMissing(attrs: AttributeSet): this;
  /**
   * Performs a "diff-match-patch" operation on the string attributes provided.
   * The operation is added to the current patch, ready to be commited by `commit()`
   *
   * @param attrs - Attributes to perform operation on. To set a deep attribute, use JSONMatch, eg: \{"nested.prop": "dmp"\}
   */
  diffMatchPatch(attrs: AttributeSet): this;
  /**
   * Unsets the attribute paths provided.
   * The operation is added to the current patch, ready to be commited by `commit()`
   *
   * @param attrs - Attribute paths to unset.
   */
  unset(attrs: string[]): this;
  /**
   * Increment a numeric value. Each entry in the argument is either an attribute or a JSON path. The value may be a positive or negative integer or floating-point value. The operation will fail if target value is not a numeric value, or doesn't exist.
   *
   * @param attrs - Object of attribute paths to increment, values representing the number to increment by.
   */
  inc(attrs: {
    [key: string]: number;
  }): this;
  /**
   * Decrement a numeric value. Each entry in the argument is either an attribute or a JSON path. The value may be a positive or negative integer or floating-point value. The operation will fail if target value is not a numeric value, or doesn't exist.
   *
   * @param attrs - Object of attribute paths to decrement, values representing the number to decrement by.
   */
  dec(attrs: {
    [key: string]: number;
  }): this;
  /**
   * Provides methods for modifying arrays, by inserting, appending and replacing elements via a JSONPath expression.
   *
   * @param at - Location to insert at, relative to the given selector, or 'replace' the matched path
   * @param selector - JSONPath expression, eg `comments[-1]` or `blocks[_key=="abc123"]`
   * @param items - Array of items to insert/replace
   */
  insert(at: 'before' | 'after' | 'replace', selector: string, items: Any$1[]): this;
  /**
   * Append the given items to the array at the given JSONPath
   *
   * @param selector - Attribute/path to append to, eg `comments` or `person.hobbies`
   * @param items - Array of items to append to the array
   */
  append(selector: string, items: Any$1[]): this;
  /**
   * Prepend the given items to the array at the given JSONPath
   *
   * @param selector - Attribute/path to prepend to, eg `comments` or `person.hobbies`
   * @param items - Array of items to prepend to the array
   */
  prepend(selector: string, items: Any$1[]): this;
  /**
   * Change the contents of an array by removing existing elements and/or adding new elements.
   *
   * @param selector - Attribute or JSONPath expression for array
   * @param start - Index at which to start changing the array (with origin 0). If greater than the length of the array, actual starting index will be set to the length of the array. If negative, will begin that many elements from the end of the array (with origin -1) and will be set to 0 if absolute value is greater than the length of the array.x
   * @param deleteCount - An integer indicating the number of old array elements to remove.
   * @param items - The elements to add to the array, beginning at the start index. If you don't specify any elements, splice() will only remove elements from the array.
   */
  splice(selector: string, start: number, deleteCount?: number, items?: Any$1[]): this;
  /**
   * Adds a revision clause, preventing the document from being patched if the `_rev` property does not match the given value
   *
   * @param rev - Revision to lock the patch to
   */
  ifRevisionId(rev: string): this;
  /**
   * Return a plain JSON representation of the patch
   */
  serialize(): PatchMutationOperation;
  /**
   * Return a plain JSON representation of the patch
   */
  toJSON(): PatchMutationOperation;
  /**
   * Clears the patch of all operations
   */
  reset(): this;
  protected _assign(op: keyof PatchOperations, props: Any$1, merge?: boolean): this;
  protected _set(op: keyof PatchOperations, props: Any$1): this;
}
/** @public */
declare class ObservablePatch extends BasePatch {
  #private;
  constructor(selection: PatchSelection, operations?: PatchOperations, client?: ObservableSanityClient$1);
  /**
   * Clones the patch
   */
  clone(): ObservablePatch;
  /**
   * Commit the patch, returning an observable that produces the first patched document
   *
   * @param options - Options for the mutation operation
   */
  commit<R extends Record<string, Any$1> = Record<string, Any$1>>(options: FirstDocumentMutationOptions): Observable<SanityDocument$1<R>>;
  /**
   * Commit the patch, returning an observable that produces an array of the mutated documents
   *
   * @param options - Options for the mutation operation
   */
  commit<R extends Record<string, Any$1> = Record<string, Any$1>>(options: AllDocumentsMutationOptions): Observable<SanityDocument$1<R>[]>;
  /**
   * Commit the patch, returning an observable that produces a mutation result object
   *
   * @param options - Options for the mutation operation
   */
  commit(options: FirstDocumentIdMutationOptions): Observable<SingleMutationResult>;
  /**
   * Commit the patch, returning an observable that produces a mutation result object
   *
   * @param options - Options for the mutation operation
   */
  commit(options: AllDocumentIdsMutationOptions): Observable<MultipleMutationResult>;
  /**
   * Commit the patch, returning an observable that produces the first patched document
   *
   * @param options - Options for the mutation operation
   */
  commit<R extends Record<string, Any$1> = Record<string, Any$1>>(options?: BaseMutationOptions): Observable<SanityDocument$1<R>>;
}
/** @public */
declare class Patch extends BasePatch {
  #private;
  constructor(selection: PatchSelection, operations?: PatchOperations, client?: SanityClient$1);
  /**
   * Clones the patch
   */
  clone(): Patch;
  /**
   * Commit the patch, returning a promise that resolves to the first patched document
   *
   * @param options - Options for the mutation operation
   */
  commit<R extends Record<string, Any$1> = Record<string, Any$1>>(options: FirstDocumentMutationOptions): Promise<SanityDocument$1<R>>;
  /**
   * Commit the patch, returning a promise that resolves to an array of the mutated documents
   *
   * @param options - Options for the mutation operation
   */
  commit<R extends Record<string, Any$1> = Record<string, Any$1>>(options: AllDocumentsMutationOptions): Promise<SanityDocument$1<R>[]>;
  /**
   * Commit the patch, returning a promise that resolves to a mutation result object
   *
   * @param options - Options for the mutation operation
   */
  commit(options: FirstDocumentIdMutationOptions): Promise<SingleMutationResult>;
  /**
   * Commit the patch, returning a promise that resolves to a mutation result object
   *
   * @param options - Options for the mutation operation
   */
  commit(options: AllDocumentIdsMutationOptions): Promise<MultipleMutationResult>;
  /**
   * Commit the patch, returning a promise that resolves to the first patched document
   *
   * @param options - Options for the mutation operation
   */
  commit<R extends Record<string, Any$1> = Record<string, Any$1>>(options?: BaseMutationOptions): Promise<SanityDocument$1<R>>;
}
/** @public */
type PatchBuilder = (patch: Patch) => Patch;
/** @public */
type ObservablePatchBuilder = (patch: ObservablePatch) => ObservablePatch;
/** @internal */
declare class BaseTransaction {
  protected operations: Mutation[];
  protected trxId?: string;
  constructor(operations?: Mutation[], transactionId?: string);
  /**
   * Creates a new Sanity document. If `_id` is provided and already exists, the mutation will fail. If no `_id` is given, one will automatically be generated by the database.
   * The operation is added to the current transaction, ready to be commited by `commit()`
   *
   * @param doc - Document to create. Requires a `_type` property.
   */
  create<R extends Record<string, Any$1> = Record<string, Any$1>>(doc: SanityDocumentStub<R>): this;
  /**
   * Creates a new Sanity document. If a document with the same `_id` already exists, the create operation will be ignored.
   * The operation is added to the current transaction, ready to be commited by `commit()`
   *
   * @param doc - Document to create if it does not already exist. Requires `_id` and `_type` properties.
   */
  createIfNotExists<R extends Record<string, Any$1> = Record<string, Any$1>>(doc: IdentifiedSanityDocumentStub<R>): this;
  /**
   * Creates a new Sanity document, or replaces an existing one if the same `_id` is already used.
   * The operation is added to the current transaction, ready to be commited by `commit()`
   *
   * @param doc - Document to create or replace. Requires `_id` and `_type` properties.
   */
  createOrReplace<R extends Record<string, Any$1> = Record<string, Any$1>>(doc: IdentifiedSanityDocumentStub<R>): this;
  /**
   * Deletes the document with the given document ID
   * The operation is added to the current transaction, ready to be commited by `commit()`
   *
   * @param documentId - Document ID to delete
   */
  delete(documentId: string): this;
  /**
   * Gets the current transaction ID, if any
   */
  transactionId(): string | undefined;
  /**
   * Set the ID of this transaction.
   *
   * @param id - Transaction ID
   */
  transactionId(id: string): this;
  /**
   * Return a plain JSON representation of the transaction
   */
  serialize(): Mutation[];
  /**
   * Return a plain JSON representation of the transaction
   */
  toJSON(): Mutation[];
  /**
   * Clears the transaction of all operations
   */
  reset(): this;
  protected _add(mut: Mutation): this;
}
/** @public */
declare class Transaction extends BaseTransaction {
  #private;
  constructor(operations?: Mutation[], client?: SanityClient$1, transactionId?: string);
  /**
   * Clones the transaction
   */
  clone(): Transaction;
  /**
   * Commit the transaction, returning a promise that resolves to the first mutated document
   *
   * @param options - Options for the mutation operation
   */
  commit<R extends Record<string, Any$1>>(options: TransactionFirstDocumentMutationOptions): Promise<SanityDocument$1<R>>;
  /**
   * Commit the transaction, returning a promise that resolves to an array of the mutated documents
   *
   * @param options - Options for the mutation operation
   */
  commit<R extends Record<string, Any$1>>(options: TransactionAllDocumentsMutationOptions): Promise<SanityDocument$1<R>[]>;
  /**
   * Commit the transaction, returning a promise that resolves to a mutation result object
   *
   * @param options - Options for the mutation operation
   */
  commit(options: TransactionFirstDocumentIdMutationOptions): Promise<SingleMutationResult>;
  /**
   * Commit the transaction, returning a promise that resolves to a mutation result object
   *
   * @param options - Options for the mutation operation
   */
  commit(options: TransactionAllDocumentIdsMutationOptions): Promise<MultipleMutationResult>;
  /**
   * Commit the transaction, returning a promise that resolves to a mutation result object
   *
   * @param options - Options for the mutation operation
   */
  commit(options?: BaseMutationOptions): Promise<MultipleMutationResult>;
  /**
   * Performs a patch on the given document ID. Can either be a builder function or an object of patch operations.
   * The operation is added to the current transaction, ready to be commited by `commit()`
   *
   * @param documentId - Document ID to perform the patch operation on
   * @param patchOps - Operations to perform, or a builder function
   */
  patch(documentId: string, patchOps?: PatchBuilder | PatchOperations): this;
  /**
   * Performs a patch on the given selection. Can either be a builder function or an object of patch operations.
   *
   * @param selection - An object with `query` and optional `params`, defining which document(s) to patch
   * @param patchOps - Operations to perform, or a builder function
   */
  patch(patch: MutationSelection, patchOps?: PatchBuilder | PatchOperations): this;
  /**
   * Adds the given patch instance to the transaction.
   * The operation is added to the current transaction, ready to be commited by `commit()`
   *
   * @param patch - Patch to execute
   */
  patch(patch: Patch): this;
}
/** @public */
declare class ObservableTransaction extends BaseTransaction {
  #private;
  constructor(operations?: Mutation[], client?: ObservableSanityClient$1, transactionId?: string);
  /**
   * Clones the transaction
   */
  clone(): ObservableTransaction;
  /**
   * Commit the transaction, returning an observable that produces the first mutated document
   *
   * @param options - Options for the mutation operation
   */
  commit<R extends Record<string, Any$1>>(options: TransactionFirstDocumentMutationOptions): Observable<SanityDocument$1<R>>;
  /**
   * Commit the transaction, returning an observable that produces an array of the mutated documents
   *
   * @param options - Options for the mutation operation
   */
  commit<R extends Record<string, Any$1>>(options: TransactionAllDocumentsMutationOptions): Observable<SanityDocument$1<R>[]>;
  /**
   * Commit the transaction, returning an observable that produces a mutation result object
   *
   * @param options - Options for the mutation operation
   */
  commit(options: TransactionFirstDocumentIdMutationOptions): Observable<SingleMutationResult>;
  /**
   * Commit the transaction, returning an observable that produces a mutation result object
   *
   * @param options - Options for the mutation operation
   */
  commit(options: TransactionAllDocumentIdsMutationOptions): Observable<MultipleMutationResult>;
  /**
   * Commit the transaction, returning an observable that produces a mutation result object
   *
   * @param options - Options for the mutation operation
   */
  commit(options?: BaseMutationOptions): Observable<MultipleMutationResult>;
  /**
   * Performs a patch on the given document ID. Can either be a builder function or an object of patch operations.
   * The operation is added to the current transaction, ready to be commited by `commit()`
   *
   * @param documentId - Document ID to perform the patch operation on
   * @param patchOps - Operations to perform, or a builder function
   */
  patch(documentId: string, patchOps?: ObservablePatchBuilder | PatchOperations): this;
  /**
   * Adds the given patch instance to the transaction.
   * The operation is added to the current transaction, ready to be commited by `commit()`
   *
   * @param patch - ObservablePatch to execute
   */
  patch(patch: ObservablePatch): this;
}
/**
 * @internal
 * @inline
 */
declare class ObservableDatasetsClient {
  #private;
  constructor(client: ObservableSanityClient$1, httpRequest: HttpRequest);
  /**
   * Create a new dataset with the given name
   *
   * @param name - Name of the dataset to create
   * @param options - Options for the dataset, including optional embeddings configuration
   */
  create(name: string, options?: DatasetCreateOptions): Observable<DatasetResponse>;
  /**
   * Edit a dataset with the given name
   *
   * @param name - Name of the dataset to edit
   * @param options - New options for the dataset
   */
  edit(name: string, options?: DatasetEditOptions): Observable<DatasetResponse>;
  /**
   * Delete a dataset with the given name
   *
   * @param name - Name of the dataset to delete
   */
  delete(name: string): Observable<{
    deleted: true;
  }>;
  /**
   * Fetch a list of datasets for the configured project
   */
  list(): Observable<DatasetsResponse>;
  /**
   * Get embeddings settings for a dataset
   *
   * @param name - Name of the dataset
   */
  getEmbeddingsSettings(name: string): Observable<EmbeddingsSettings>;
  /**
   * Edit embeddings settings for a dataset
   *
   * @param name - Name of the dataset
   * @param settings - Embeddings settings to apply
   */
  editEmbeddingsSettings(name: string, settings: EmbeddingsSettingsBody): Observable<void>;
}
/**
 * @internal
 * @inline
 */
declare class DatasetsClient {
  #private;
  constructor(client: SanityClient$1, httpRequest: HttpRequest);
  /**
   * Create a new dataset with the given name
   *
   * @param name - Name of the dataset to create
   * @param options - Options for the dataset, including optional embeddings configuration
   */
  create(name: string, options?: DatasetCreateOptions): Promise<DatasetResponse>;
  /**
   * Edit a dataset with the given name
   *
   * @param name - Name of the dataset to edit
   * @param options - New options for the dataset
   */
  edit(name: string, options?: DatasetEditOptions): Promise<DatasetResponse>;
  /**
   * Delete a dataset with the given name
   *
   * @param name - Name of the dataset to delete
   */
  delete(name: string): Promise<{
    deleted: true;
  }>;
  /**
   * Fetch a list of datasets for the configured project
   */
  list(): Promise<DatasetsResponse>;
  /**
   * Get embeddings settings for a dataset
   *
   * @param name - Name of the dataset
   */
  getEmbeddingsSettings(name: string): Promise<EmbeddingsSettings>;
  /**
   * Edit embeddings settings for a dataset
   *
   * @param name - Name of the dataset
   * @param settings - Embeddings settings to apply
   */
  editEmbeddingsSettings(name: string, settings: EmbeddingsSettingsBody): Promise<void>;
}
/** @public */
interface DurableCallbackFailure {
  /** A human-readable error message. */
  errorMessage?: string;
  /** Machine-readable error data. */
  errorData?: string;
  /** Stack trace, one frame per entry. */
  stackTrace?: string[];
}
/** @public */
interface DurableCallbackRequestOptions {
  /** Milliseconds to wait for the callback to be accepted. */
  timeout?: number;
  /** Abort the request. */
  signal?: AbortSignal;
}
/** @public */
interface DurableExecution {
  /** ID of the execution. */
  executionId: string;
  /** When the stop was recorded, as reported by the API. */
  stopTimestamp: number;
}
/** @public */
interface DurableStopExecutionOptions extends DurableCallbackRequestOptions {
  /**
   * Organization owning the stack.
   * Overrides `organizationId` from the client config.
   */
  organizationId?: string;
}
/** @public */
interface InvokeFunctionEvent {
  /**
   * Payload handed to the function.
   * The function receives it as `event.data`.
   */
  data?: unknown;
}
/** @public */
interface InvokeFunctionRequest {
  event?: InvokeFunctionEvent;
  /**
   * Stack the function belongs to.
   * Overrides `stackId` from the client config.
   */
  stackId?: string;
  /**
   * Organization owning the stack.
   */
  organizationId?: string;
  /**
   * Milliseconds to wait for the function to return.
   */
  timeout?: number;
  /** Abort the invocation. */
  signal?: AbortSignal;
}
/** @public */
interface InvokeFunctionOptions {
  /**
   * Wait for the function to finish and resolve with its return value.
   *
   * Defaults to `false`: the invocation is started, the request resolves as soon
   * as it is accepted, and the value is always `undefined`. Only function types
   * that support running inline can be invoked synchronously.
   */
  sync?: boolean;
}
/** @public */
declare class ObservableDurablesClient {
  #private;
  constructor(client: ObservableSanityClient$1, httpRequest: HttpRequest);
  /**
   * Resume a durable function waiting on a callback, handing it a result.
   *
   * Emits `undefined` once the callback is accepted.
   *
   * @param callbackId - the id the function handed out from `step.waitForCallback`
   * @param result - JSON-serializable value the waiting step resolves with
   * @param options - request options
   */
  callbackSuccess(callbackId: string, result?: unknown, options?: DurableCallbackRequestOptions): Observable<void>;
  /**
   * Resume a durable function waiting on a callback, failing the waiting step.
   *
   * Emits `undefined` once the callback is accepted.
   *
   * @param callbackId - the id the function handed out from `step.waitForCallback`
   * @param failure - an `Error`, reported by its message and stack, or the failure fields
   * @param options - request options
   */
  callbackFailure(callbackId: string, failure?: Error | DurableCallbackFailure, options?: DurableCallbackRequestOptions): Observable<void>;
  /**
   * Stop a durable function execution.
   *
   * Emits the stopped execution, including its `stopTimestamp`, once the stop is accepted.
   *
   * @param functionId - ID of the durable function
   * @param executionId - ID of the execution to stop
   * @param options - request options
   */
  stopExecution(functionId: string, executionId: string, options?: DurableStopExecutionOptions): Observable<DurableExecution>;
}
/** @public */
declare class DurablesClient {
  #private;
  constructor(client: SanityClient$1, httpRequest: HttpRequest);
  /**
   * Resume a durable function waiting on a callback, handing it a result.
   *
   * The waiting `step.waitForCallback` resolves with `result`, which must be
   * JSON-serializable. Omitting it resolves the step with `null`. The callback
   * id is the only credential the route needs.
   *
   * Resolves with `undefined` once the callback is accepted.
   *
   * @param callbackId - the id the function handed out from `step.waitForCallback`
   * @param result - JSON-serializable value the waiting step resolves with
   * @param options - request options
   */
  callbackSuccess(callbackId: string, result?: unknown, options?: DurableCallbackRequestOptions): Promise<void>;
  /**
   * Resume a durable function waiting on a callback, failing the waiting step.
   *
   * The waiting `step.waitForCallback` rejects. Pass an `Error` to report its
   * message and stack, or the failure fields directly. `errorData` must be a
   * string; serialize structured data before passing it.
   *
   * Resolves with `undefined` once the callback is accepted.
   *
   * @param callbackId - the id the function handed out from `step.waitForCallback`
   * @param failure - an `Error`, reported by its message and stack, or the failure fields
   * @param options - request options
   */
  callbackFailure(callbackId: string, failure?: Error | DurableCallbackFailure, options?: DurableCallbackRequestOptions): Promise<void>;
  /**
   * Stop a durable function execution.
   *
   * Resolves with the stopped execution, including its `stopTimestamp`, once the stop is accepted.
   *
   * @param functionId - ID of the durable function
   * @param executionId - ID of the execution to stop
   * @param options - request options
   */
  stopExecution(functionId: string, executionId: string, options?: DurableStopExecutionOptions): Promise<DurableExecution>;
}
/** @public */
declare class ObservableFunctionsClient {
  #private;
  /** Report back to durable functions. */
  durables: ObservableDurablesClient;
  constructor(client: ObservableSanityClient$1, httpRequest: HttpRequest);
  /**
   * Invoke a deployed function by its name and stackId.
   *
   * The function is invoked within the stack given by `stackId` on the request
   * or the client config. Starts the invocation and emits `undefined` as soon as
   * it is accepted; pass `{sync: true}` to wait for the function's return value
   * instead.
   *
   * @param functionName - name of the deployed function, as declared in the blueprint
   * @param request - payload and request options
   * @param options - invocation options
   */
  invoke(functionName: string, request?: InvokeFunctionRequest, options?: InvokeFunctionOptions & {
    sync?: false;
  }): Observable<undefined>;
  invoke<R = unknown>(functionName: string, request: InvokeFunctionRequest | undefined, options: InvokeFunctionOptions & {
    sync: true;
  }): Observable<R>;
  invoke<R = unknown>(functionName: string, request?: InvokeFunctionRequest, options?: InvokeFunctionOptions): Observable<R | undefined>;
}
/** @public */
declare class FunctionsClient {
  #private;
  /** Report back to durable functions. */
  durables: DurablesClient;
  constructor(client: SanityClient$1, httpRequest: HttpRequest);
  /**
   * Invoke a deployed function by its name and stack ID.
   *
   * The function is invoked within the stack given by `stackId` on the request
   * or the client config. Rejects if neither supplies one.
   *
   * The call is scoped to `projectId`, or to `organizationId` when one is set
   * for a stack deployed at organization scope.
   *
   * The invocation is started by default: the promise resolves with `undefined`
   * as soon as the call is accepted, without waiting for the function to run.
   * Pass `{sync: true}` to keep the request open until the function finishes
   * and resolve with its return value — long-running functions may then need an
   * explicit `timeout`. Only some function types can be invoked synchronously.
   *
   * @param functionName - name of the deployed function, as declared in the blueprint
   * @param request - payload and request options
   * @param options - invocation options
   */
  invoke(functionName: string, request?: InvokeFunctionRequest, options?: InvokeFunctionOptions & {
    sync?: false;
  }): Promise<undefined>;
  invoke<R = unknown>(functionName: string, request: InvokeFunctionRequest | undefined, options: InvokeFunctionOptions & {
    sync: true;
  }): Promise<R>;
  invoke<R = unknown>(functionName: string, request?: InvokeFunctionRequest, options?: InvokeFunctionOptions): Promise<R | undefined>;
}
/**
 * @internal
 * @inline
 */
declare class ObservableMediaLibraryVideoClient {
  #private;
  constructor(client: ObservableSanityClient$1, httpRequest: HttpRequest);
  /**
   * Get video playback information for a media library asset
   *
   * @param assetIdentifier - Asset instance identifier (GDR, video-prefixed ID, or container ID)
   * @param options - Options for transformations and expiration
   */
  getPlaybackInfo(assetIdentifier: MediaLibraryAssetInstanceIdentifier, options?: MediaLibraryPlaybackInfoOptions): Observable<VideoPlaybackInfo>;
}
/**
 * @internal
 * @inline
 */
declare class MediaLibraryVideoClient {
  #private;
  constructor(client: SanityClient$1, httpRequest: HttpRequest);
  /**
   * Get video playback information for a media library asset
   *
   * @param assetIdentifier - Asset instance identifier (GDR, video-prefixed ID, or container ID)
   * @param options - Options for transformations and expiration
   */
  getPlaybackInfo(assetIdentifier: MediaLibraryAssetInstanceIdentifier, options?: MediaLibraryPlaybackInfoOptions): Promise<VideoPlaybackInfo>;
}
type ListOptions = {
  includeMembers?: boolean;
  includeFeatures?: boolean;
  organizationId?: string;
  onlyExplicitMembership?: boolean;
};
type OmittedProjectFields<T extends ListOptions | undefined> = (T extends {
  includeMembers: false;
} ? 'members' : never) | (T extends {
  includeFeatures: false;
} ? 'features' : never);
/**
 * @internal
 * @inline
 */
declare class ObservableProjectsClient {
  #private;
  constructor(client: ObservableSanityClient$1, httpRequest: HttpRequest);
  /**
   * Fetch a list of projects the authenticated user has access to.
   *
   * @param options - Options for the list request
   *   - `includeMembers` - Whether to include members in the response (default: true)
   *   - `includeFeatures` - Whether to include features in the response (default: true)
   *   - `organizationId` - ID of the organization to fetch projects for
   *   - `onlyExplicitMembership` - Whether to include only projects with explicit membership (default: false)
   */
  list<T extends ListOptions>(options?: T): Observable<Omit<SanityProject, OmittedProjectFields<T>>[]>;
  /**
   * Fetch a project by project ID
   *
   * @param projectId - ID of the project to fetch
   */
  getById(projectId: string): Observable<SanityProject>;
}
/**
 * @internal
 * @inline
 */
declare class ProjectsClient {
  #private;
  constructor(client: SanityClient$1, httpRequest: HttpRequest);
  /**
   * Fetch a list of projects the authenticated user has access to.
   *
   * @param options - Options for the list request
   *   - `includeMembers` - Whether to include members in the response (default: true)
   *   - `includeFeatures` - Whether to include features in the response (default: true)
   *   - `organizationId` - ID of the organization to fetch projects for
   *   - `onlyExplicitMembership` - Whether to include only projects with explicit membership (default: false)
   */
  list<T extends ListOptions>(options?: T): Promise<Omit<SanityProject, OmittedProjectFields<T>>[]>;
  /**
   * Fetch a project by project ID
   *
   * @param projectId - ID of the project to fetch
   */
  getById(projectId: string): Promise<SanityProject>;
}
/**
 * @public
 * @inline
 */
declare class ObservableReleasesClient {
  #private;
  constructor(client: ObservableSanityClient$1, httpRequest: HttpRequest);
  /**
   * @public
   *
   * Retrieve a release by id.
   *
   * @category Releases
   *
   * @param params - Release action parameters:
   *   - `releaseId` - The id of the release to retrieve.
   * @param options - Additional query options including abort signal and query tag.
   * @returns An observable that resolves to the release document {@link ReleaseDocument}.
   *
   * @example Retrieving a release by id
   * ```ts
   * client.observable.releases.get({releaseId: 'my-release'}).pipe(
   *   tap((release) => console.log(release)),
   *   // {
   *   //   _id: '_.releases.my-release',
   *   //   name: 'my-release'
   *   //   _type: 'system.release',
   *   //   metadata: {releaseType: 'asap'},
   *   //   _createdAt: '2021-01-01T00:00:00.000Z',
   *   //   ...
   *   // }
   * ).subscribe()
   * ```
   */
  get({ releaseId }: {
    releaseId: string;
  }, options?: {
    signal?: AbortSignal;
    tag?: string;
  }): Observable<ReleaseDocument | undefined>;
  /**
   * @public
   *
   * Creates a new release under the given id, with metadata.
   *
   * @remarks
   * * If no releaseId is provided, a release id will be generated.
   * * If no metadata is provided, then an `undecided` releaseType will be used.
   *
   * @category Releases
   *
   * @param params - Release action parameters:
   *   - `releaseId` - The id of the release to create.
   *   - `metadata` - The metadata to associate with the release {@link ReleaseDocument}.
   * @param options - Additional action options.
   * @returns An observable that resolves to the `transactionId` and the release id and metadata.
   *
   * @example Creating a release with a custom id and metadata
   * ```ts
   * const releaseId = 'my-release'
   * const metadata: ReleaseDocument['metadata'] = {
   *   releaseType: 'asap',
   * }
   *
   * client.observable.releases.create({releaseId, metadata}).pipe(
   *   tap(({transactionId, releaseId, metadata}) => console.log(transactionId, releaseId, metadata)),
   *   // {
   *   //   transactionId: 'transaction-id',
   *   //   releaseId: 'my-release',
   *   //   metadata: {releaseType: 'asap'},
   *   // }
   * ).subscribe()
   * ```
   *
   * @example Creating a release with generated id and metadata
   * ```ts
   * client.observable.releases.create().pipe(
   *   tap(({metadata}) => console.log(metadata)),
   *   // {
   *   //   metadata: {releaseType: 'undecided'},
   *   // }
   * ).subscribe()
   * ```
   *
   * @example Creating a release using a custom transaction id
   * ```ts
   * client.observable.releases.create({transactionId: 'my-transaction-id'}).pipe(
   *   tap(({transactionId, metadata}) => console.log(transactionId, metadata)),
   *   // {
   *   //   transactionId: 'my-transaction-id',
   *   //   metadata: {releaseType: 'undecided'},
   *   // }
   * ).subscribe()
   * ```
   */
  create(options: BaseActionOptions): Observable<SingleActionResult & {
    releaseId: string;
    metadata: ReleaseDocument['metadata'];
  }>;
  create(release: {
    releaseId?: string;
    metadata?: Partial<ReleaseDocument['metadata']>;
  }, options?: BaseActionOptions): Observable<SingleActionResult & {
    releaseId: string;
    metadata: ReleaseDocument['metadata'];
  }>;
  /**
   * @public
   *
   * Edits an existing release, updating the metadata.
   *
   * @category Releases
   *
   * @param params - Release action parameters:
   *   - `releaseId` - The id of the release to edit.
   *   - `patch` - The patch operation to apply on the release metadata {@link PatchMutationOperation}.
   * @param options - Additional action options.
   * @returns An observable that resolves to the `transactionId`.
   */
  edit({ releaseId, patch }: {
    releaseId: string;
    patch: PatchOperations;
  }, options?: BaseActionOptions): Observable<SingleActionResult>;
  /**
   * @public
   *
   * Publishes all documents in a release at once. For larger releases the effect of the publish
   * will be visible immediately when querying but the removal of the `versions.<releasesId>.*`
   * documents and creation of the corresponding published documents with the new content may
   * take some time.
   *
   * During this period both the source and target documents are locked and cannot be
   * modified through any other means.
   *
   * @category Releases
   *
   * @param params - Release action parameters:
   *   - `releaseId` - The id of the release to publish.
   * @param options - Additional action options.
   * @returns An observable that resolves to the `transactionId`.
   */
  publish({ releaseId }: {
    releaseId: string;
  }, options?: BaseActionOptions): Observable<SingleActionResult>;
  /**
   * @public
   *
   * An archive action removes an active release. The documents that comprise the release
   * are deleted and therefore no longer queryable.
   *
   * While the documents remain in retention the last version can still be accessed using document history endpoint.
   *
   * @category Releases
   *
   * @param params - Release action parameters:
   *   - `releaseId` - The id of the release to archive.
   * @param options - Additional action options.
   * @returns An observable that resolves to the `transactionId`.
   */
  archive({ releaseId }: {
    releaseId: string;
  }, options?: BaseActionOptions): Observable<SingleActionResult>;
  /**
   * @public
   *
   * An unarchive action restores an archived release and all documents
   * with the content they had just prior to archiving.
   *
   * @category Releases
   *
   * @param params - Release action parameters:
   *   - `releaseId` - The id of the release to unarchive.
   * @param options - Additional action options.
   * @returns An observable that resolves to the `transactionId`.
   */
  unarchive({ releaseId }: {
    releaseId: string;
  }, options?: BaseActionOptions): Observable<SingleActionResult>;
  /**
   * @public
   *
   * A schedule action queues a release for publishing at the given future time.
   * The release is locked such that no documents in the release can be modified and
   * no documents that it references can be deleted as this would make the publish fail.
   * At the given time, the same logic as for the publish action is triggered.
   *
   * @category Releases
   *
   * @param params - Release action parameters:
   *   - `releaseId` - The id of the release to schedule.
   *   - `publishAt` - The serialised date and time to publish the release. If the `publishAt` is in the past, the release will be published immediately.
   * @param options - Additional action options.
   * @returns An observable that resolves to the `transactionId`.
   */
  schedule({ releaseId, publishAt }: {
    releaseId: string;
    publishAt: string;
  }, options?: BaseActionOptions): Observable<SingleActionResult>;
  /**
   * @public
   *
   * An unschedule action stops a release from being published.
   * The documents in the release are considered unlocked and can be edited again.
   * This may fail if another release is scheduled to be published after this one and
   * has a reference to a document created by this one.
   *
   * @category Releases
   *
   * @param params - Release action parameters:
   *   - `releaseId` - The id of the release to unschedule.
   * @param options - Additional action options.
   * @returns An observable that resolves to the `transactionId`.
   */
  unschedule({ releaseId }: {
    releaseId: string;
  }, options?: BaseActionOptions): Observable<SingleActionResult>;
  /**
   * @public
   *
   * A delete action removes a published or archived release.
   * The backing system document will be removed from the dataset.
   *
   * @category Releases
   *
   * @param params - Release action parameters:
   *   - `releaseId` - The id of the release to delete.
   * @param options - Additional action options.
   * @returns An observable that resolves to the `transactionId`.
   */
  delete({ releaseId }: {
    releaseId: string;
  }, options?: BaseActionOptions): Observable<SingleActionResult>;
  /**
   * @public
   *
   * Fetch the documents in a release by release id.
   *
   * @category Releases
   *
   * @param params - Release action parameters:
   *   - `releaseId` - The id of the release to fetch documents for.
   * @param options - Additional mutation options {@link BaseMutationOptions}.
   * @returns An observable that resolves to the documents in the release.
   */
  fetchDocuments({ releaseId }: {
    releaseId: string;
  }, options?: BaseMutationOptions): Observable<RawQueryResponse$1<SanityDocument$1[]>>;
}
/**
 * @public
 * @inline
 */
declare class ReleasesClient {
  #private;
  constructor(client: SanityClient$1, httpRequest: HttpRequest);
  /**
   * @public
   *
   * Retrieve a release by id.
   *
   * @category Releases
   *
   * @param params - Release action parameters:
   *   - `releaseId` - The id of the release to retrieve.
   * @param options - Additional query options including abort signal and query tag.
   * @returns A promise that resolves to the release document {@link ReleaseDocument}.
   *
   * @example Retrieving a release by id
   * ```ts
   * const release = await client.releases.get({releaseId: 'my-release'})
   * console.log(release)
   * // {
   * //   _id: '_.releases.my-release',
   * //   name: 'my-release'
   * //   _type: 'system.release',
   * //   metadata: {releaseType: 'asap'},
   * //   _createdAt: '2021-01-01T00:00:00.000Z',
   * //   ...
   * // }
   * ```
   */
  get({ releaseId }: {
    releaseId: string;
  }, options?: {
    signal?: AbortSignal;
    tag?: string;
  }): Promise<ReleaseDocument | undefined>;
  /**
   * @public
   *
   * Creates a new release under the given id, with metadata.
   *
   * @remarks
   * * If no releaseId is provided, a release id will be generated.
   * * If no metadata is provided, then an `undecided` releaseType will be used.
   *
   * @category Releases
   *
   * @param params - Release action parameters:
   *   - `releaseId` - The id of the release to create.
   *   - `metadata` - The metadata to associate with the release {@link ReleaseDocument}.
   * @param options - Additional action options.
   * @returns A promise that resolves to the `transactionId` and the release id and metadata.
   *
   * @example Creating a release with a custom id and metadata
   * ```ts
   * const releaseId = 'my-release'
   * const releaseMetadata: ReleaseDocument['metadata'] = {
   *   releaseType: 'asap',
   * }
   *
   * const result =
   *   await client.releases.create({releaseId, metadata: releaseMetadata})
   * console.log(result)
   * // {
   * //   transactionId: 'transaction-id',
   * //   releaseId: 'my-release',
   * //   metadata: {releaseType: 'asap'},
   * // }
   * ```
   *
   * @example Creating a release with generated id and metadata
   * ```ts
   * const {metadata} = await client.releases.create()
   * console.log(metadata.releaseType) // 'undecided'
   * ```
   *
   * @example Creating a release with a custom transaction id
   * ```ts
   * const {transactionId, metadata} = await client.releases.create({transactionId: 'my-transaction-id'})
   * console.log(metadata.releaseType) // 'undecided'
   * console.log(transactionId) // 'my-transaction-id'
   * ```
   */
  create(options: BaseActionOptions): Promise<SingleActionResult & {
    releaseId: string;
    metadata: ReleaseDocument['metadata'];
  }>;
  create(release: {
    releaseId?: string;
    metadata?: Partial<ReleaseDocument['metadata']>;
  }, options?: BaseActionOptions): Promise<SingleActionResult & {
    releaseId: string;
    metadata: ReleaseDocument['metadata'];
  }>;
  /**
   * @public
   *
   * Edits an existing release, updating the metadata.
   *
   * @category Releases
   *
   * @param params - Release action parameters:
   *   - `releaseId` - The id of the release to edit.
   *   - `patch` - The patch operation to apply on the release metadata {@link PatchMutationOperation}.
   * @param options - Additional action options.
   * @returns A promise that resolves to the `transactionId`.
   */
  edit({ releaseId, patch }: {
    releaseId: string;
    patch: PatchOperations;
  }, options?: BaseActionOptions): Promise<SingleActionResult>;
  /**
   * @public
   *
   * Publishes all documents in a release at once. For larger releases the effect of the publish
   * will be visible immediately when querying but the removal of the `versions.<releasesId>.*`
   * documents and creation of the corresponding published documents with the new content may
   * take some time.
   *
   * During this period both the source and target documents are locked and cannot be
   * modified through any other means.
   *
   * @category Releases
   *
   * @param params - Release action parameters:
   *   - `releaseId` - The id of the release to publish.
   * @param options - Additional action options.
   * @returns A promise that resolves to the `transactionId`.
   */
  publish({ releaseId }: {
    releaseId: string;
  }, options?: BaseActionOptions): Promise<SingleActionResult>;
  /**
   * @public
   *
   * An archive action removes an active release. The documents that comprise the release
   * are deleted and therefore no longer queryable.
   *
   * While the documents remain in retention the last version can still be accessed using document history endpoint.
   *
   * @category Releases
   *
   * @param params - Release action parameters:
   *   - `releaseId` - The id of the release to archive.
   * @param options - Additional action options.
   * @returns A promise that resolves to the `transactionId`.
   */
  archive({ releaseId }: {
    releaseId: string;
  }, options?: BaseActionOptions): Promise<SingleActionResult>;
  /**
   * @public
   *
   * An unarchive action restores an archived release and all documents
   * with the content they had just prior to archiving.
   *
   * @category Releases
   *
   * @param params - Release action parameters:
   *   - `releaseId` - The id of the release to unarchive.
   * @param options - Additional action options.
   * @returns A promise that resolves to the `transactionId`.
   */
  unarchive({ releaseId }: {
    releaseId: string;
  }, options?: BaseActionOptions): Promise<SingleActionResult>;
  /**
   * @public
   *
   * A schedule action queues a release for publishing at the given future time.
   * The release is locked such that no documents in the release can be modified and
   * no documents that it references can be deleted as this would make the publish fail.
   * At the given time, the same logic as for the publish action is triggered.
   *
   * @category Releases
   *
   * @param params - Release action parameters:
   *   - `releaseId` - The id of the release to schedule.
   *   - `publishAt` - The serialised date and time to publish the release. If the `publishAt` is in the past, the release will be published immediately.
   * @param options - Additional action options.
   * @returns A promise that resolves to the `transactionId`.
   */
  schedule({ releaseId, publishAt }: {
    releaseId: string;
    publishAt: string;
  }, options?: BaseActionOptions): Promise<SingleActionResult>;
  /**
   * @public
   *
   * An unschedule action stops a release from being published.
   * The documents in the release are considered unlocked and can be edited again.
   * This may fail if another release is scheduled to be published after this one and
   * has a reference to a document created by this one.
   *
   * @category Releases
   *
   * @param params - Release action parameters:
   *   - `releaseId` - The id of the release to unschedule.
   * @param options - Additional action options.
   * @returns A promise that resolves to the `transactionId`.
   */
  unschedule({ releaseId }: {
    releaseId: string;
  }, options?: BaseActionOptions): Promise<SingleActionResult>;
  /**
   * @public
   *
   * A delete action removes a published or archived release.
   * The backing system document will be removed from the dataset.
   *
   * @category Releases
   *
   * @param params - Release action parameters:
   *   - `releaseId` - The id of the release to delete.
   * @param options - Additional action options.
   * @returns A promise that resolves to the `transactionId`.
   */
  delete({ releaseId }: {
    releaseId: string;
  }, options?: BaseActionOptions): Promise<SingleActionResult>;
  /**
   * @public
   *
   * Fetch the documents in a release by release id.
   *
   * @category Releases
   *
   * @param params - Release action parameters:
   *   - `releaseId` - The id of the release to fetch documents for.
   * @param options - Additional mutation options {@link BaseMutationOptions}.
   * @returns A promise that resolves to the documents in the release.
   */
  fetchDocuments({ releaseId }: {
    releaseId: string;
  }, options?: BaseMutationOptions): Promise<RawQueryResponse$1<SanityDocument$1[]>>;
}
/**
 * @public
 * @inline
 */
declare class ObservableUsersClient {
  #private;
  constructor(client: ObservableSanityClient$1, httpRequest: HttpRequest);
  /**
   * Fetch a user by user ID
   *
   * @param id - User ID of the user to fetch. If `me` is provided, a minimal response including the users role is returned.
   */
  getById<T extends string>(id: T): Observable<T extends 'me' ? CurrentSanityUser : SanityUser>;
}
/**
 * @public
 * @inline
 */
declare class UsersClient {
  #private;
  constructor(client: SanityClient$1, httpRequest: HttpRequest);
  /**
   * Fetch a user by user ID
   *
   * @param id - User ID of the user to fetch. If `me` is provided, a minimal response including the users role is returned.
   */
  getById<T extends string>(id: T): Promise<T extends 'me' ? CurrentSanityUser : SanityUser>;
}
/** @public */
declare class ObservableSanityClient$1 {
  #private;
  /**
   * Upload, fetch and delete assets (images and files) in the configured dataset
   *
   * @category Assets
   */
  assets: ObservableAssetsClient;
  /**
   * Create, list, edit and delete datasets in the configured project
   *
   * @category Projects & Datasets
   */
  datasets: ObservableDatasetsClient;
  /**
   * Subscribe to live content updates through the Live Content API
   *
   * @category Real-time
   */
  live: LiveClient;
  /**
   * Interact with Media Library assets
   *
   * @category Assets
   */
  mediaLibrary: {
    /** Upload and manage Media Library video assets */
    video: ObservableMediaLibraryVideoClient;
  };
  /**
   * Fetch information about the projects the authenticated user has access to
   *
   * @category Projects & Datasets
   */
  projects: ObservableProjectsClient;
  /**
   * Fetch information about users in the configured project
   *
   * @category Projects & Datasets
   */
  users: ObservableUsersClient;
  /**
   * Run Agent Actions - AI-powered operations to generate, transform, translate, prompt and patch documents
   *
   * @category Agent Actions
   */
  agent: {
    /** Run individual Agent Action operations */
    action: ObservableAgentsActionClient;
  };
  collaboration: {
    /** @beta */
    comments: ObservableCollaborationCommentsClient;
  };
  functions: ObservableFunctionsClient;
  /**
   * Create and manage content releases and their scheduled publishing
   *
   * @category Releases
   */
  releases: ObservableReleasesClient;
  /** @beta */
  context: ObservableContextClient;
  /**
   * Listen to document changes matching a GROQ query, delivered as server-sent events
   *
   * @category Real-time
   */
  listen: typeof _listen;
  constructor(httpRequest: HttpRequest, config?: ClientConfig$1);
  /**
   * Clone the client - returns a new instance
   *
   * @category Configuration
   */
  clone(): ObservableSanityClient$1;
  /**
   * Returns the current client configuration
   *
   * @category Configuration
   */
  config(): InitializedClientConfig$1;
  /**
   * Reconfigure the client. Note that this _mutates_ the current client.
   */
  config(newConfig?: Partial<ClientConfig$1>): this;
  /**
   * Clone the client with a new (partial) configuration.
   *
   * @category Configuration
   *
   * @param newConfig - New client configuration properties, shallowly merged with existing configuration
   */
  withConfig(newConfig?: Partial<ClientConfig$1>): ObservableSanityClient$1;
  /**
   * The credential the client would attach to a request right now: `{token}`,
   * `{withCredentials: true}` or `{}` for anonymous, so it can be destructured.
   * Emits once and completes. Correct for a static configuration and for a
   * reactive `auth` alike; under the latter it waits while a renewal is
   * pending, so it never yields a credential the client itself would not
   * send. The wait is cancelled by `options.signal` and bounded by the
   * client's `timeout`. Use `observeAuth()` instead to follow changes.
   *
   * @category Configuration
   */
  getAuth(options?: GetAuthOptions): Observable<ResolvedAuth>;
  /**
   * Every credential the client would attach to its requests: the current one
   * when subscribed, then each change, as `{token}`, `{withCredentials: true}`
   * or `{}` for anonymous, like {@link ObservableSanityClient.getAuth}. Under
   * a reactive `auth` it emits each credential once it settles, and nothing
   * while a renewal is pending; a static configuration emits its credential
   * and completes, so the same code can follow the credential whichever way
   * the client is configured.
   *
   * @category Configuration
   */
  observeAuth(): Observable<ResolvedAuth>;
  /**
   * Perform a GROQ-query against the configured dataset.
   *
   * @category Querying
   *
   * @param query - GROQ-query to perform
   */
  fetch<R = Any$1, Q extends QueryWithoutParams = QueryWithoutParams, const G extends string = string>(query: G, params?: Q | QueryWithoutParams): Observable<ClientReturn$1<G, R>>;
  /**
   * Perform a GROQ-query against the configured dataset.
   *
   * @param query - GROQ-query to perform
   * @param params - Optional query parameters
   * @param options - Optional request options
   */
  fetch<R = Any$1, Q extends QueryWithoutParams | QueryParams = QueryParams, const G extends string = string>(query: G, params: Q extends QueryWithoutParams ? QueryWithoutParams : ClientParams<G, Q>, options?: FilteredResponseQueryOptions): Observable<ClientReturn$1<G, R>>;
  /**
   * Perform a GROQ-query against the configured dataset.
   *
   * @param query - GROQ-query to perform
   * @param params - Optional query parameters
   * @param options - Request options
   */
  fetch<R = Any$1, Q extends QueryWithoutParams | QueryParams = QueryParams, const G extends string = string>(query: G, params: Q extends QueryWithoutParams ? QueryWithoutParams : ClientParams<G, Q>, options: UnfilteredResponseQueryOptions): Observable<RawQueryResponse$1<ClientReturn$1<G, R>>>;
  /**
   * Perform a GROQ-query against the configured dataset.
   *
   * @param query - GROQ-query to perform
   * @param params - Optional query parameters
   * @param options - Request options
   */
  fetch<R = Any$1, Q extends QueryWithoutParams | QueryParams = QueryParams, const G extends string = string>(query: G, params: Q extends QueryWithoutParams ? QueryWithoutParams : ClientParams<G, Q>, options: UnfilteredResponseWithoutQuery): Observable<RawQuerylessQueryResponse<ClientReturn$1<G, R>>>;
  /**
   * Fetch a single document with the given ID.
   *
   * @category Querying
   *
   * @param id - Document ID to fetch
   * @param options - Request options
   */
  getDocument<R extends Record<string, Any$1> = Record<string, Any$1>>(id: string, options: {
    signal?: AbortSignal;
    tag?: string;
    releaseId?: string;
    includeAllVersions: true;
  }): Observable<SanityDocument$1<R>[]>;
  /**
   * Fetch a single document with the given ID.
   *
   * @param id - Document ID to fetch
   * @param options - Request options
   */
  getDocument<R extends Record<string, Any$1> = Record<string, Any$1>>(id: string, options?: {
    signal?: AbortSignal;
    tag?: string;
    releaseId?: string;
    includeAllVersions?: false;
  }): Observable<SanityDocument$1<R> | undefined>;
  /**
   * Fetch multiple documents in one request.
   * Should be used sparingly - performing a query is usually a better option.
   * The order/position of documents is preserved based on the original array of IDs.
   * If any of the documents are missing, they will be replaced by a `null` entry in the returned array
   *
   * @category Querying
   *
   * @param ids - Document IDs to fetch
   * @param options - Request options
   */
  getDocuments<R extends Record<string, Any$1> = Record<string, Any$1>>(ids: string[], options?: {
    tag?: string;
  }): Observable<(SanityDocument$1<R> | null)[]>;
  /**
   * Convenient and bandwidth efficient method of checking wether a set of document IDs exists.
   * Returns a set of the IDs that exist.
   *
   * @category Querying
   *
   * @param ids - Document IDs to check
   * @param options - Request options
   */
  documentsExists(ids: string[], options?: {
    signal?: AbortSignal;
    tag?: string;
  }): Observable<Set<string>>;
  /**
   * Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
   * Returns an observable that resolves to the created document.
   *
   * @category Mutations
   *
   * @param document - Document to create
   * @param options - Mutation options
   */
  create<R extends Record<string, Any$1> = Record<string, Any$1>>(document: SanityDocumentStub<R>, options: FirstDocumentMutationOptions): Observable<SanityDocument$1<R>>;
  /**
   * Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
   * Returns an observable that resolves to an array containing the created document.
   *
   * @param document - Document to create
   * @param options - Mutation options
   */
  create<R extends Record<string, Any$1> = Record<string, Any$1>>(document: SanityDocumentStub<R>, options: AllDocumentsMutationOptions): Observable<SanityDocument$1<R>[]>;
  /**
   * Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
   * Returns an observable that resolves to a mutation result object containing the ID of the created document.
   *
   * @param document - Document to create
   * @param options - Mutation options
   */
  create<R extends Record<string, Any$1> = Record<string, Any$1>>(document: SanityDocumentStub<R>, options: FirstDocumentIdMutationOptions): Observable<SingleMutationResult>;
  /**
   * Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
   * Returns an observable that resolves to a mutation result object containing the ID of the created document.
   *
   * @param document - Document to create
   * @param options - Mutation options
   */
  create<R extends Record<string, Any$1> = Record<string, Any$1>>(document: SanityDocumentStub<R>, options: AllDocumentIdsMutationOptions): Observable<MultipleMutationResult>;
  /**
   * Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
   * Returns an observable that resolves to the created document.
   *
   * @param document - Document to create
   * @param options - Mutation options
   */
  create<R extends Record<string, Any$1> = Record<string, Any$1>>(document: SanityDocumentStub<R>, options?: BaseMutationOptions): Observable<SanityDocument$1<R>>;
  /**
   * Create a document if no document with the same ID already exists.
   * Returns an observable that resolves to the created document.
   *
   * @category Mutations
   *
   * @param document - Document to create
   * @param options - Mutation options
   */
  createIfNotExists<R extends Record<string, Any$1> = Record<string, Any$1>>(document: IdentifiedSanityDocumentStub<R>, options: FirstDocumentMutationOptions): Observable<SanityDocument$1<R>>;
  /**
   * Create a document if no document with the same ID already exists.
   * Returns an observable that resolves to an array containing the created document.
   *
   * @param document - Document to create
   * @param options - Mutation options
   */
  createIfNotExists<R extends Record<string, Any$1> = Record<string, Any$1>>(document: IdentifiedSanityDocumentStub<R>, options: AllDocumentsMutationOptions): Observable<SanityDocument$1<R>[]>;
  /**
   * Create a document if no document with the same ID already exists.
   * Returns an observable that resolves to a mutation result object containing the ID of the created document.
   *
   * @param document - Document to create
   * @param options - Mutation options
   */
  createIfNotExists<R extends Record<string, Any$1> = Record<string, Any$1>>(document: IdentifiedSanityDocumentStub<R>, options: FirstDocumentIdMutationOptions): Observable<SingleMutationResult>;
  /**
   * Create a document if no document with the same ID already exists.
   * Returns an observable that resolves to a mutation result object containing the ID of the created document.
   *
   * @param document - Document to create
   * @param options - Mutation options
   */
  createIfNotExists<R extends Record<string, Any$1> = Record<string, Any$1>>(document: IdentifiedSanityDocumentStub<R>, options: AllDocumentIdsMutationOptions): Observable<MultipleMutationResult>;
  /**
   * Create a document if no document with the same ID already exists.
   * Returns an observable that resolves to the created document.
   *
   * @param document - Document to create
   * @param options - Mutation options
   */
  createIfNotExists<R extends Record<string, Any$1> = Record<string, Any$1>>(document: IdentifiedSanityDocumentStub<R>, options?: BaseMutationOptions): Observable<SanityDocument$1<R>>;
  /**
   * Create a document if it does not exist, or replace a document with the same document ID
   * Returns an observable that resolves to the created document.
   *
   * @category Mutations
   *
   * @param document - Document to either create or replace
   * @param options - Mutation options
   */
  createOrReplace<R extends Record<string, Any$1> = Record<string, Any$1>>(document: IdentifiedSanityDocumentStub<R>, options: FirstDocumentMutationOptions): Observable<SanityDocument$1<R>>;
  /**
   * Create a document if it does not exist, or replace a document with the same document ID
   * Returns an observable that resolves to an array containing the created document.
   *
   * @param document - Document to either create or replace
   * @param options - Mutation options
   */
  createOrReplace<R extends Record<string, Any$1> = Record<string, Any$1>>(document: IdentifiedSanityDocumentStub<R>, options: AllDocumentsMutationOptions): Observable<SanityDocument$1<R>[]>;
  /**
   * Create a document if it does not exist, or replace a document with the same document ID
   * Returns an observable that resolves to a mutation result object containing the ID of the created document.
   *
   * @param document - Document to either create or replace
   * @param options - Mutation options
   */
  createOrReplace<R extends Record<string, Any$1> = Record<string, Any$1>>(document: IdentifiedSanityDocumentStub<R>, options: FirstDocumentIdMutationOptions): Observable<SingleMutationResult>;
  /**
   * Create a document if it does not exist, or replace a document with the same document ID
   * Returns an observable that resolves to a mutation result object containing the created document ID.
   *
   * @param document - Document to either create or replace
   * @param options - Mutation options
   */
  createOrReplace<R extends Record<string, Any$1> = Record<string, Any$1>>(document: IdentifiedSanityDocumentStub<R>, options: AllDocumentIdsMutationOptions): Observable<MultipleMutationResult>;
  /**
   * Create a document if it does not exist, or replace a document with the same document ID
   * Returns an observable that resolves to the created document.
   *
   * @param document - Document to either create or replace
   * @param options - Mutation options
   */
  createOrReplace<R extends Record<string, Any$1> = Record<string, Any$1>>(document: IdentifiedSanityDocumentStub<R>, options?: BaseMutationOptions): Observable<SanityDocument$1<R>>;
  /**
   * @public
   *
   * Creates a new version of a published document.
   *
   * @remarks
   * * Requires a document with a `_type` property.
   * * Creating a version with no `releaseId` will create a new draft version of the published document.
   * * If the `document._id` is defined, it should be a draft or release version ID that matches the version ID generated from `publishedId` and `releaseId`.
   * * If the `document._id` is not defined, it will be generated from `publishedId` and `releaseId`.
   * * To create a version of an unpublished document, use the `client.create` method.
   *
   * @category Versions
   *
   * @param params - Version action parameters:
   *   - `document` - The document to create as a new version (must include `_type`).
   *   - `publishedId` - The ID of the published document being versioned.
   *   - `releaseId` - The ID of the release to create the version for.
   * @param options - Additional action options.
   * @returns an observable that resolves to the `transactionId`.
   *
   * @example Creating a new version of a published document with a generated version ID
   * ```ts
   * client.observable.createVersion({
   *   // The document does not need to include an `_id` property since it will be generated from `publishedId` and `releaseId`
   *   document: {_type: 'myDocument', title: 'My Document'},
   *   publishedId: 'myDocument',
   *   releaseId: 'myRelease',
   * })
   *
   * // The following document will be created:
   * // {
   * //   _id: 'versions.myRelease.myDocument',
   * //   _type: 'myDocument',
   * //   title: 'My Document',
   * // }
   * ```
   *
   * @example Creating a new version of a published document with a specified version ID
   * ```ts
   * client.observable.createVersion({
   *   document: {_type: 'myDocument', _id: 'versions.myRelease.myDocument', title: 'My Document'},
   *   // `publishedId` and `releaseId` are not required since `document._id` has been specified
   * })
   *
   * // The following document will be created:
   * // {
   * //   _id: 'versions.myRelease.myDocument',
   * //   _type: 'myDocument',
   * //   title: 'My Document',
   * // }
   * ```
   *
   * @example Creating a new draft version of a published document
   * ```ts
   * client.observable.createVersion({
   *   document: {_type: 'myDocument', title: 'My Document'},
   *   publishedId: 'myDocument',
   * })
   *
   * // The following document will be created:
   * // {
   * //   _id: 'drafts.myDocument',
   * //   _type: 'myDocument',
   * //   title: 'My Document',
   * // }
   * ```
   */
  createVersion<R extends Record<string, Any$1>>(args: {
    document: SanityDocumentStub<R>;
    publishedId: string;
    releaseId?: string;
  }, options?: BaseActionOptions): Observable<SingleActionResult | MultipleActionResult>;
  createVersion<R extends Record<string, Any$1>>(args: {
    document: IdentifiedSanityDocumentStub<R>;
    publishedId?: string;
    releaseId?: string;
  }, options?: BaseActionOptions): Observable<SingleActionResult | MultipleActionResult>;
  createVersion(args: {
    baseId: string;
    releaseId?: string;
    publishedId: string;
    ifBaseRevisionId?: string;
  }, options?: BaseActionOptions): Observable<SingleActionResult | MultipleActionResult>;
  /**
   * Deletes a document with the given document ID.
   * Returns an observable that resolves to the deleted document.
   *
   * @category Mutations
   *
   * @param id - Document ID to delete
   * @param options - Options for the mutation
   */
  delete<R extends Record<string, Any$1> = Record<string, Any$1>>(id: string, options: FirstDocumentMutationOptions): Observable<SanityDocument$1<R>>;
  /**
   * Deletes a document with the given document ID.
   * Returns an observable that resolves to an array containing the deleted document.
   *
   * @param id - Document ID to delete
   * @param options - Options for the mutation
   */
  delete<R extends Record<string, Any$1> = Record<string, Any$1>>(id: string, options: AllDocumentsMutationOptions): Observable<SanityDocument$1<R>[]>;
  /**
   * Deletes a document with the given document ID.
   * Returns an observable that resolves to a mutation result object containing the deleted document ID.
   *
   * @param id - Document ID to delete
   * @param options - Options for the mutation
   */
  delete(id: string, options: FirstDocumentIdMutationOptions): Observable<SingleMutationResult>;
  /**
   * Deletes a document with the given document ID.
   * Returns an observable that resolves to a mutation result object containing the deleted document ID.
   *
   * @param id - Document ID to delete
   * @param options - Options for the mutation
   */
  delete(id: string, options: AllDocumentIdsMutationOptions): Observable<MultipleMutationResult>;
  /**
   * Deletes a document with the given document ID.
   * Returns an observable that resolves to a mutation result object containing the deleted document ID.
   *
   * @param id - Document ID to delete
   * @param options - Options for the mutation
   */
  delete(id: string, options?: BaseMutationOptions): Observable<MultipleMutationResult>;
  /**
   * Deletes one or more documents matching the given query or document ID.
   * Returns an observable that resolves to first deleted document.
   *
   * @param selection - An object with either an `id` or `query` key defining what to delete
   * @param options - Options for the mutation
   */
  delete<R extends Record<string, Any$1> = Record<string, Any$1>>(selection: MutationSelection, options: FirstDocumentMutationOptions): Observable<SanityDocument$1<R>>;
  /**
   * Deletes one or more documents matching the given query or document ID.
   * Returns an observable that resolves to an array containing the deleted documents.
   *
   * @param selection - An object with either an `id` or `query` key defining what to delete
   * @param options - Options for the mutation
   */
  delete<R extends Record<string, Any$1> = Record<string, Any$1>>(selection: MutationSelection, options: AllDocumentsMutationOptions): Observable<SanityDocument$1<R>[]>;
  /**
   * Deletes one or more documents matching the given query or document ID.
   * Returns an observable that resolves to a mutation result object containing the ID of the first deleted document.
   *
   * @param selection - An object with either an `id` or `query` key defining what to delete
   * @param options - Options for the mutation
   */
  delete(selection: MutationSelection, options: FirstDocumentIdMutationOptions): Observable<SingleMutationResult>;
  /**
   * Deletes one or more documents matching the given query or document ID.
   * Returns an observable that resolves to a mutation result object containing the document IDs that were deleted.
   *
   * @param selection - An object with either an `id` or `query` key defining what to delete
   * @param options - Options for the mutation
   */
  delete(selection: MutationSelection, options: AllDocumentIdsMutationOptions): Observable<MultipleMutationResult>;
  /**
   * Deletes one or more documents matching the given query or document ID.
   * Returns an observable that resolves to a mutation result object containing the document IDs that were deleted.
   *
   * @param selection - An object with either an `id` or `query` key defining what to delete
   * @param options - Options for the mutation
   */
  delete(selection: MutationSelection, options?: BaseMutationOptions): Observable<MultipleMutationResult>;
  /**
   * @public
   *
   * Deletes the draft or release version of a document.
   *
   * @remarks
   * * Discarding a version with no `releaseId` will discard the draft version of the published document.
   * * If the draft or release version does not exist, any error will throw.
   *
   * @category Versions
   *
   * @param params - Version action parameters:
   *   - `releaseId` - The ID of the release to discard the document from.
   *   - `publishedId` - The published ID of the document to discard.
   * @param purge - if `true` the document history is also discarded.
   * @param options - Additional action options.
   * @returns an observable that resolves to the `transactionId`.
   *
   * @example Discarding a release version of a document
   * ```ts
   * client.observable.discardVersion({publishedId: 'myDocument', releaseId: 'myRelease'})
   * // The document with the ID `versions.myRelease.myDocument` will be discarded.
   * ```
   *
   * @example Discarding a draft version of a document
   * ```ts
   * client.observable.discardVersion({publishedId: 'myDocument'})
   * // The document with the ID `drafts.myDocument` will be discarded.
   * ```
   */
  discardVersion({ releaseId, publishedId }: {
    releaseId?: string;
    publishedId: string;
  }, purge?: boolean, options?: BaseActionOptions): Observable<SingleActionResult | MultipleActionResult>;
  /**
   * @public
   *
   * Replaces an existing version document.
   *
   * @remarks
   * * Requires a document with a `_type` property.
   * * If the `document._id` is defined, it should be a draft or release version ID that matches the version ID generated from `publishedId` and `releaseId`.
   * * If the `document._id` is not defined, it will be generated from `publishedId` and `releaseId`.
   * * Replacing a version with no `releaseId` will replace the draft version of the published document.
   * * At least one of the **version** or **published** documents must exist.
   *
   * @category Versions
   *
   * @param params - Version action parameters:
   *   - `document` - The new document to replace the version with.
   *   - `releaseId` - The ID of the release where the document version is replaced.
   *   - `publishedId` - The ID of the published document to replace.
   * @param options - Additional action options.
   * @returns an observable that resolves to the `transactionId`.
   *
   * @example Replacing a release version of a published document with a generated version ID
   * ```ts
   * client.observable.replaceVersion({
   *   document: {_type: 'myDocument', title: 'My Document'},
   *   publishedId: 'myDocument',
   *   releaseId: 'myRelease',
   * })
   *
   * // The following document will be patched:
   * // {
   * //   _id: 'versions.myRelease.myDocument',
   * //   _type: 'myDocument',
   * //   title: 'My Document',
   * // }
   * ```
   *
   * @example Replacing a release version of a published document with a specified version ID
   * ```ts
   * client.observable.replaceVersion({
   *   document: {_type: 'myDocument', _id: 'versions.myRelease.myDocument', title: 'My Document'},
   *   // `publishedId` and `releaseId` are not required since `document._id` has been specified
   * })
   *
   * // The following document will be patched:
   * // {
   * //   _id: 'versions.myRelease.myDocument',
   * //   _type: 'myDocument',
   * //   title: 'My Document',
   * // }
   * ```
   *
   * @example Replacing a draft version of a published document
   * ```ts
   * client.observable.replaceVersion({
   *   document: {_type: 'myDocument', title: 'My Document'},
   *   publishedId: 'myDocument',
   * })
   *
   * // The following document will be patched:
   * // {
   * //   _id: 'drafts.myDocument',
   * //   _type: 'myDocument',
   * //   title: 'My Document',
   * // }
   * ```
   */
  replaceVersion<R extends Record<string, Any$1>>(args: {
    document: SanityDocumentStub<R>;
    publishedId: string;
    releaseId?: string;
  }, options?: BaseActionOptions): Observable<SingleActionResult | MultipleActionResult>;
  replaceVersion<R extends Record<string, Any$1>>(args: {
    document: IdentifiedSanityDocumentStub<R>;
    publishedId?: string;
    releaseId?: string;
  }, options?: BaseActionOptions): Observable<SingleActionResult | MultipleActionResult>;
  /**
   * @public
   *
   * Used to indicate when a document within a release should be unpublished when
   * the release is run.
   *
   * @remarks
   * * If the published document does not exist, an error will be thrown.
   *
   * @category Versions
   *
   * @param params - Version action parameters:
   *   - `releaseId` - The ID of the release to unpublish the document from.
   *   - `publishedId` - The published ID of the document to unpublish.
   * @param options - Additional action options.
   * @returns an observable that resolves to the `transactionId`.
   *
   * @example Unpublishing a release version of a published document
   * ```ts
   * client.observable.unpublishVersion({publishedId: 'myDocument', releaseId: 'myRelease'})
   * // The document with the ID `versions.myRelease.myDocument` will be unpublished. when `myRelease` is run.
   * ```
   */
  unpublishVersion({ releaseId, publishedId }: {
    releaseId: string;
    publishedId: string;
  }, options?: BaseActionOptions): Observable<SingleActionResult | MultipleActionResult>;
  /**
   * Perform mutation operations against the configured dataset
   * Returns an observable that resolves to the first mutated document.
   *
   * @category Mutations
   *
   * @param operations - Mutation operations to execute
   * @param options - Mutation options
   */
  mutate<R extends Record<string, Any$1> = Record<string, Any$1>>(operations: Mutation<R>[] | ObservablePatch | ObservableTransaction, options: FirstDocumentMutationOptions): Observable<SanityDocument$1<R>>;
  /**
   * Perform mutation operations against the configured dataset.
   * Returns an observable that resolves to an array of the mutated documents.
   *
   * @param operations - Mutation operations to execute
   * @param options - Mutation options
   */
  mutate<R extends Record<string, Any$1> = Record<string, Any$1>>(operations: Mutation<R>[] | ObservablePatch | ObservableTransaction, options: AllDocumentsMutationOptions): Observable<SanityDocument$1<R>[]>;
  /**
   * Perform mutation operations against the configured dataset
   * Returns an observable that resolves to a mutation result object containing the document ID of the first mutated document.
   *
   * @param operations - Mutation operations to execute
   * @param options - Mutation options
   */
  mutate<R extends Record<string, Any$1> = Record<string, Any$1>>(operations: Mutation<R>[] | ObservablePatch | ObservableTransaction, options: FirstDocumentIdMutationOptions): Observable<SingleMutationResult>;
  /**
   * Perform mutation operations against the configured dataset
   * Returns an observable that resolves to a mutation result object containing the mutated document IDs.
   *
   * @param operations - Mutation operations to execute
   * @param options - Mutation options
   */
  mutate<R extends Record<string, Any$1> = Record<string, Any$1>>(operations: Mutation<R>[] | ObservablePatch | ObservableTransaction, options: AllDocumentIdsMutationOptions): Observable<MultipleMutationResult>;
  /**
   * Perform mutation operations against the configured dataset
   * Returns an observable that resolves to a mutation result object containing the mutated document IDs.
   *
   * @param operations - Mutation operations to execute
   * @param options - Mutation options
   */
  mutate<R extends Record<string, Any$1> = Record<string, Any$1>>(operations: Mutation<R>[] | ObservablePatch | ObservableTransaction, options?: BaseMutationOptions): Observable<MultipleMutationResult>;
  /**
   * Create a new buildable patch of operations to perform
   *
   * @category Mutations
   *
   * @param documentId - Document ID to patch
   * @param operations - Optional object of patch operations to initialize the patch instance with
   * @returns Patch instance - call `.commit()` to perform the operations defined
   */
  patch(documentId: string, operations?: PatchOperations): ObservablePatch;
  /**
   * Create a new buildable patch of operations to perform
   *
   * @param documentIds - Array of document IDs to patch
   * @param operations - Optional object of patch operations to initialize the patch instance with
   * @returns Patch instance - call `.commit()` to perform the operations defined
   */
  patch(documentIds: string[], operations?: PatchOperations): ObservablePatch;
  /**
   * Create a new buildable patch of operations to perform
   *
   * @param selection - An object with `query` and optional `params`, defining which document(s) to patch
   * @param operations - Optional object of patch operations to initialize the patch instance with
   * @returns Patch instance - call `.commit()` to perform the operations defined
   */
  patch(selection: MutationSelection, operations?: PatchOperations): ObservablePatch;
  /**
   * Create a new transaction of mutations
   *
   * @category Mutations
   *
   * @param operations - Optional array of mutation operations to initialize the transaction instance with
   */
  transaction<R extends Record<string, Any$1> = Record<string, Any$1>>(operations?: Mutation<R>[]): ObservableTransaction;
  /**
   * Perform action operations against the configured dataset
   *
   * @category Mutations
   *
   * @param operations - Action operation(s) to execute
   * @param options - Action options
   */
  action(operations: Action | Action[], options?: BaseActionOptions): Observable<SingleActionResult | MultipleActionResult>;
  /**
   * Perform an HTTP request against the Sanity API
   *
   * @category HTTP
   *
   * @param options - Request options
   */
  request<R = Any$1>(options: RawRequestOptions): Observable<R>;
  /**
   * Get a Sanity API URL for the URI provided
   *
   * @category HTTP
   *
   * @param uri - URI/path to build URL for
   * @param canUseCdn - Whether or not to allow using the API CDN for this route
   */
  getUrl(uri: string, canUseCdn?: boolean): string;
  /**
   * Get a Sanity API URL for the data operation and path provided
   *
   * @category HTTP
   *
   * @param operation - Data operation (eg `query`, `mutate`, `listen` or similar)
   * @param path - Path to append after the operation
   */
  getDataUrl(operation: string, path?: string): string;
}
/** @public */
declare class SanityClient$1 {
  #private;
  /**
   * Upload, fetch and delete assets (images and files) in the configured dataset
   *
   * @category Assets
   */
  assets: AssetsClient;
  /**
   * Create, list, edit and delete datasets in the configured project
   *
   * @category Projects & Datasets
   */
  datasets: DatasetsClient;
  /**
   * Subscribe to live content updates through the Live Content API
   *
   * @category Real-time
   */
  live: LiveClient;
  /**
   * Interact with Media Library assets
   *
   * @category Assets
   */
  mediaLibrary: {
    /** Upload and manage Media Library video assets */
    video: MediaLibraryVideoClient;
  };
  /**
   * Fetch information about the projects the authenticated user has access to
   *
   * @category Projects & Datasets
   */
  projects: ProjectsClient;
  /**
   * Fetch information about users in the configured project
   *
   * @category Projects & Datasets
   */
  users: UsersClient;
  /**
   * Run Agent Actions - AI-powered operations to generate, transform, translate, prompt and patch documents
   *
   * @category Agent Actions
   */
  agent: {
    /** Run individual Agent Action operations */
    action: AgentActionsClient;
  };
  collaboration: {
    /** @beta */
    comments: CollaborationCommentsClient;
  };
  functions: FunctionsClient;
  /**
   * Create and manage content releases and their scheduled publishing
   *
   * @category Releases
   */
  releases: ReleasesClient;
  /** @beta */
  context: ContextClient;
  /**
   * Observable version of the Sanity client, with the same configuration as the promise-based one
   *
   * @category Configuration
   */
  observable: ObservableSanityClient$1;
  /**
   * Listen to document changes matching a GROQ query, delivered as server-sent events
   *
   * @category Real-time
   */
  listen: typeof _listen;
  constructor(httpRequest: HttpRequest, config?: ClientConfig$1);
  /**
   * Clone the client - returns a new instance
   *
   * @category Configuration
   */
  clone(): SanityClient$1;
  /**
   * Returns the current client configuration
   *
   * @category Configuration
   */
  config(): InitializedClientConfig$1;
  /**
   * Reconfigure the client. Note that this _mutates_ the current client.
   */
  config(newConfig?: Partial<ClientConfig$1>): this;
  /**
   * Clone the client with a new (partial) configuration.
   *
   * @category Configuration
   *
   * @param newConfig - New client configuration properties, shallowly merged with existing configuration
   */
  withConfig(newConfig?: Partial<ClientConfig$1>): SanityClient$1;
  /**
   * The credential the client would attach to a request right now: `{token}`,
   * `{withCredentials: true}` or `{}` for anonymous, so it can be destructured.
   * Correct for a static configuration and for a reactive `auth` alike; under
   * the latter it waits while a renewal is pending, so it never resolves to
   * a credential the client itself would not send. The wait is
   * cancelled by `options.signal` and bounded by the client's `timeout`.
   * Use `observeAuth()` instead to follow changes.
   *
   * @category Configuration
   */
  getAuth(options?: GetAuthOptions): Promise<ResolvedAuth>;
  /**
   * Every credential the client would attach to its requests: the current one
   * when subscribed, then each change, as `{token}`, `{withCredentials: true}`
   * or `{}` for anonymous, like {@link SanityClient.getAuth}. Under
   * a reactive `auth` it emits each credential once it settles, and nothing
   * while a renewal is pending; a static configuration emits its credential
   * and completes, so the same code can follow the credential whichever way
   * the client is configured.
   *
   * @category Configuration
   */
  observeAuth(): Observable<ResolvedAuth>;
  /**
   * Perform a GROQ-query against the configured dataset.
   *
   * @category Querying
   *
   * @param query - GROQ-query to perform
   */
  fetch<R = Any$1, Q extends QueryWithoutParams = QueryWithoutParams, const G extends string = string>(query: G, params?: Q | QueryWithoutParams): Promise<ClientReturn$1<G, R>>;
  /**
   * Perform a GROQ-query against the configured dataset.
   *
   * @param query - GROQ-query to perform
   * @param params - Optional query parameters
   * @param options - Optional request options
   */
  fetch<R = Any$1, Q extends QueryWithoutParams | QueryParams = QueryParams, const G extends string = string>(query: G, params: Q extends QueryWithoutParams ? QueryWithoutParams : ClientParams<G, Q>, options?: FilteredResponseQueryOptions): Promise<ClientReturn$1<G, R>>;
  /**
   * Perform a GROQ-query against the configured dataset.
   *
   * @param query - GROQ-query to perform
   * @param params - Optional query parameters
   * @param options - Request options
   */
  fetch<R = Any$1, Q extends QueryWithoutParams | QueryParams = QueryParams, const G extends string = string>(query: G, params: Q extends QueryWithoutParams ? QueryWithoutParams : ClientParams<G, Q>, options: UnfilteredResponseQueryOptions): Promise<RawQueryResponse$1<ClientReturn$1<G, R>>>;
  /**
   * Perform a GROQ-query against the configured dataset.
   *
   * @param query - GROQ-query to perform
   * @param params - Optional query parameters
   * @param options - Request options
   */
  fetch<R = Any$1, Q extends QueryWithoutParams | QueryParams = QueryParams, const G extends string = string>(query: G, params: Q extends QueryWithoutParams ? QueryWithoutParams : ClientParams<G, Q>, options: UnfilteredResponseWithoutQuery): Promise<RawQuerylessQueryResponse<ClientReturn$1<G, R>>>;
  /**
   * Fetch a single document with the given ID.
   *
   * @category Querying
   *
   * @param id - Document ID to fetch
   * @param options - Request options
   */
  getDocument<R extends Record<string, Any$1> = Record<string, Any$1>>(id: string, options: {
    signal?: AbortSignal;
    tag?: string;
    releaseId?: string;
    includeAllVersions: true;
  }): Promise<SanityDocument$1<R>[]>;
  /**
   * Fetch a single document with the given ID.
   *
   * @param id - Document ID to fetch
   * @param options - Request options
   */
  getDocument<R extends Record<string, Any$1> = Record<string, Any$1>>(id: string, options?: {
    signal?: AbortSignal;
    tag?: string;
    releaseId?: string;
    includeAllVersions?: false;
  }): Promise<SanityDocument$1<R> | undefined>;
  /**
   * Fetch multiple documents in one request.
   * Should be used sparingly - performing a query is usually a better option.
   * The order/position of documents is preserved based on the original array of IDs.
   * If any of the documents are missing, they will be replaced by a `null` entry in the returned array
   *
   * @category Querying
   *
   * @param ids - Document IDs to fetch
   * @param options - Request options
   */
  getDocuments<R extends Record<string, Any$1> = Record<string, Any$1>>(ids: string[], options?: {
    signal?: AbortSignal;
    tag?: string;
  }): Promise<(SanityDocument$1<R> | null)[]>;
  /**
   * Convenient and bandwidth efficient method of checking wether a set of document IDs exists.
   * Returns a set of the IDs that exist.
   *
   * @category Querying
   *
   * @param ids - Document IDs to check
   * @param options - Request options
   */
  documentsExists(ids: string[], options?: {
    signal?: AbortSignal;
    tag?: string;
  }): Promise<Set<string>>;
  /**
   * Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
   * Returns a promise that resolves to the created document.
   *
   * @category Mutations
   *
   * @param document - Document to create
   * @param options - Mutation options
   */
  create<R extends Record<string, Any$1> = Record<string, Any$1>>(document: SanityDocumentStub<R>, options: FirstDocumentMutationOptions): Promise<SanityDocument$1<R>>;
  /**
   * Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
   * Returns a promise that resolves to an array containing the created document.
   *
   * @param document - Document to create
   * @param options - Mutation options
   */
  create<R extends Record<string, Any$1> = Record<string, Any$1>>(document: SanityDocumentStub<R>, options: AllDocumentsMutationOptions): Promise<SanityDocument$1<R>[]>;
  /**
   * Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
   * Returns a promise that resolves to a mutation result object containing the ID of the created document.
   *
   * @param document - Document to create
   * @param options - Mutation options
   */
  create<R extends Record<string, Any$1> = Record<string, Any$1>>(document: SanityDocumentStub<R>, options: FirstDocumentIdMutationOptions): Promise<SingleMutationResult>;
  /**
   * Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
   * Returns a promise that resolves to a mutation result object containing the ID of the created document.
   *
   * @param document - Document to create
   * @param options - Mutation options
   */
  create<R extends Record<string, Any$1> = Record<string, Any$1>>(document: SanityDocumentStub<R>, options: AllDocumentIdsMutationOptions): Promise<MultipleMutationResult>;
  /**
   * Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
   * Returns a promise that resolves to the created document.
   *
   * @param document - Document to create
   * @param options - Mutation options
   */
  create<R extends Record<string, Any$1> = Record<string, Any$1>>(document: SanityDocumentStub<R>, options?: BaseMutationOptions): Promise<SanityDocument$1<R>>;
  /**
   * Create a document if no document with the same ID already exists.
   * Returns a promise that resolves to the created document.
   *
   * @category Mutations
   *
   * @param document - Document to create
   * @param options - Mutation options
   */
  createIfNotExists<R extends Record<string, Any$1> = Record<string, Any$1>>(document: IdentifiedSanityDocumentStub<R>, options: FirstDocumentMutationOptions): Promise<SanityDocument$1<R>>;
  /**
   * Create a document if no document with the same ID already exists.
   * Returns a promise that resolves to an array containing the created document.
   *
   * @param document - Document to create
   * @param options - Mutation options
   */
  createIfNotExists<R extends Record<string, Any$1> = Record<string, Any$1>>(document: IdentifiedSanityDocumentStub<R>, options: AllDocumentsMutationOptions): Promise<SanityDocument$1<R>[]>;
  /**
   * Create a document if no document with the same ID already exists.
   * Returns a promise that resolves to a mutation result object containing the ID of the created document.
   *
   * @param document - Document to create
   * @param options - Mutation options
   */
  createIfNotExists<R extends Record<string, Any$1> = Record<string, Any$1>>(document: IdentifiedSanityDocumentStub<R>, options: FirstDocumentIdMutationOptions): Promise<SingleMutationResult>;
  /**
   * Create a document if no document with the same ID already exists.
   * Returns a promise that resolves to a mutation result object containing the ID of the created document.
   *
   * @param document - Document to create
   * @param options - Mutation options
   */
  createIfNotExists<R extends Record<string, Any$1> = Record<string, Any$1>>(document: IdentifiedSanityDocumentStub<R>, options: AllDocumentIdsMutationOptions): Promise<MultipleMutationResult>;
  /**
   * Create a document if no document with the same ID already exists.
   * Returns a promise that resolves to the created document.
   *
   * @param document - Document to create
   * @param options - Mutation options
   */
  createIfNotExists<R extends Record<string, Any$1> = Record<string, Any$1>>(document: IdentifiedSanityDocumentStub<R>, options?: BaseMutationOptions): Promise<SanityDocument$1<R>>;
  /**
   * Create a document if it does not exist, or replace a document with the same document ID
   * Returns a promise that resolves to the created document.
   *
   * @category Mutations
   *
   * @param document - Document to either create or replace
   * @param options - Mutation options
   */
  createOrReplace<R extends Record<string, Any$1> = Record<string, Any$1>>(document: IdentifiedSanityDocumentStub<R>, options: FirstDocumentMutationOptions): Promise<SanityDocument$1<R>>;
  /**
   * Create a document if it does not exist, or replace a document with the same document ID
   * Returns a promise that resolves to an array containing the created document.
   *
   * @param document - Document to either create or replace
   * @param options - Mutation options
   */
  createOrReplace<R extends Record<string, Any$1> = Record<string, Any$1>>(document: IdentifiedSanityDocumentStub<R>, options: AllDocumentsMutationOptions): Promise<SanityDocument$1<R>[]>;
  /**
   * Create a document if it does not exist, or replace a document with the same document ID
   * Returns a promise that resolves to a mutation result object containing the ID of the created document.
   *
   * @param document - Document to either create or replace
   * @param options - Mutation options
   */
  createOrReplace<R extends Record<string, Any$1> = Record<string, Any$1>>(document: IdentifiedSanityDocumentStub<R>, options: FirstDocumentIdMutationOptions): Promise<SingleMutationResult>;
  /**
   * Create a document if it does not exist, or replace a document with the same document ID
   * Returns a promise that resolves to a mutation result object containing the created document ID.
   *
   * @param document - Document to either create or replace
   * @param options - Mutation options
   */
  createOrReplace<R extends Record<string, Any$1> = Record<string, Any$1>>(document: IdentifiedSanityDocumentStub<R>, options: AllDocumentIdsMutationOptions): Promise<MultipleMutationResult>;
  /**
   * Create a document if it does not exist, or replace a document with the same document ID
   * Returns a promise that resolves to the created document.
   *
   * @param document - Document to either create or replace
   * @param options - Mutation options
   */
  createOrReplace<R extends Record<string, Any$1> = Record<string, Any$1>>(document: IdentifiedSanityDocumentStub<R>, options?: BaseMutationOptions): Promise<SanityDocument$1<R>>;
  /**
   * @public
   *
   * Creates a new version of a published document.
   *
   * @remarks
   * * The preferred approach is to use `baseId` to refer to the existing published document, but it is also possible to provide a complete `document` instead.
   * * If `document` is provided, it must have a `_type` property.
   * * Creating a version with no `releaseId` will create a new draft version of the published document.
   * * If the `document._id` is defined, it should be a draft or release version ID that matches the version ID generated from `publishedId` and `releaseId`.
   * * If the `document._id` is not defined, it will be generated from `publishedId` and `releaseId`.
   * * To create a version of an unpublished document, use the `client.create` method.
   *
   * @category Versions
   *
   * @param params - Version action parameters:
   *   - `baseId` - The ID of the published document from which to create a new version from.
   *   - `ifBaseRevisionId` - If `baseId` is provided, this ensures the `baseId`'s revision Id is as expected before creating the new version from it.
   *   - `document` - The document to create as a new version (must include `_type`).
   *   - `publishedId` - The ID of the published document being versioned.
   *   - `releaseId` - The ID of the release to create the version for.
   * @param options - Additional action options.
   * @returns A promise that resolves to the `transactionId`.
   *
   * @example Creating a new version of a published document
   * ```ts
   * const transactionId = await client.createVersion({
   *   baseId: 'myDocument',
   *   publishedId: 'myDocument',
   *   releaseId: 'myRelease',
   * })
   *
   * // The following document will be created:
   * // {
   * //   _id: 'versions.myRelease.myDocument',
   * //   _type: 'myDocument',
   * //   title: 'My Document',
   * // }
   * ```
   *
   *
   * @example Creating a new draft version of a published document
   * ```ts
   * const transactionId = await client.createVersion({
   *   baseId: 'myDocument',
   *   publishedId: 'myDocument',
   * })
   *
   * // The following document will be created:
   * // {
   * //   _id: 'drafts.myDocument',
   * //   _type: 'myDocument',
   * //   title: 'My Document',
   * // }
   * ```
   */
  createVersion<R extends Record<string, Any$1>>(args: {
    document: SanityDocumentStub<R>;
    publishedId: string;
    releaseId?: string;
  }, options?: BaseActionOptions): Promise<SingleActionResult | MultipleActionResult>;
  createVersion<R extends Record<string, Any$1>>(args: {
    document: IdentifiedSanityDocumentStub<R>;
    publishedId?: string;
    releaseId?: string;
  }, options?: BaseActionOptions): Promise<SingleActionResult | MultipleActionResult>;
  createVersion(args: {
    publishedId: string;
    baseId: string;
    releaseId?: string;
    ifBaseRevisionId?: string;
  }, options?: BaseActionOptions): Promise<SingleActionResult | MultipleActionResult>;
  /**
   * Deletes a document with the given document ID.
   * Returns a promise that resolves to the deleted document.
   *
   * @category Mutations
   *
   * @param id - Document ID to delete
   * @param options - Options for the mutation
   */
  delete<R extends Record<string, Any$1> = Record<string, Any$1>>(id: string, options: FirstDocumentMutationOptions): Promise<SanityDocument$1<R>>;
  /**
   * Deletes a document with the given document ID.
   * Returns a promise that resolves to an array containing the deleted document.
   *
   * @param id - Document ID to delete
   * @param options - Options for the mutation
   */
  delete<R extends Record<string, Any$1> = Record<string, Any$1>>(id: string, options: AllDocumentsMutationOptions): Promise<SanityDocument$1<R>[]>;
  /**
   * Deletes a document with the given document ID.
   * Returns a promise that resolves to a mutation result object containing the deleted document ID.
   *
   * @param id - Document ID to delete
   * @param options - Options for the mutation
   */
  delete(id: string, options: FirstDocumentIdMutationOptions): Promise<SingleMutationResult>;
  /**
   * Deletes a document with the given document ID.
   * Returns a promise that resolves to a mutation result object containing the deleted document ID.
   *
   * @param id - Document ID to delete
   * @param options - Options for the mutation
   */
  delete(id: string, options: AllDocumentIdsMutationOptions): Promise<MultipleMutationResult>;
  /**
   * Deletes a document with the given document ID.
   * Returns a promise that resolves to a mutation result object containing the deleted document ID.
   *
   * @param id - Document ID to delete
   * @param options - Options for the mutation
   */
  delete(id: string, options?: BaseMutationOptions): Promise<MultipleMutationResult>;
  /**
   * Deletes one or more documents matching the given query or document ID.
   * Returns a promise that resolves to first deleted document.
   *
   * @param selection - An object with either an `id` or `query` key defining what to delete
   * @param options - Options for the mutation
   */
  delete<R extends Record<string, Any$1> = Record<string, Any$1>>(selection: MutationSelection, options: FirstDocumentMutationOptions): Promise<SanityDocument$1<R>>;
  /**
   * Deletes one or more documents matching the given query or document ID.
   * Returns a promise that resolves to an array containing the deleted documents.
   *
   * @param selection - An object with either an `id` or `query` key defining what to delete
   * @param options - Options for the mutation
   */
  delete<R extends Record<string, Any$1> = Record<string, Any$1>>(selection: MutationSelection, options: AllDocumentsMutationOptions): Promise<SanityDocument$1<R>[]>;
  /**
   * Deletes one or more documents matching the given query or document ID.
   * Returns a promise that resolves to a mutation result object containing the ID of the first deleted document.
   *
   * @param selection - An object with either an `id` or `query` key defining what to delete
   * @param options - Options for the mutation
   */
  delete(selection: MutationSelection, options: FirstDocumentIdMutationOptions): Promise<SingleMutationResult>;
  /**
   * Deletes one or more documents matching the given query or document ID.
   * Returns a promise that resolves to a mutation result object containing the document IDs that were deleted.
   *
   * @param selection - An object with either an `id` or `query` key defining what to delete
   * @param options - Options for the mutation
   */
  delete(selection: MutationSelection, options: AllDocumentIdsMutationOptions): Promise<MultipleMutationResult>;
  /**
   * Deletes one or more documents matching the given query or document ID.
   * Returns a promise that resolves to a mutation result object containing the document IDs that were deleted.
   *
   * @param selection - An object with either an `id` or `query` key defining what to delete
   * @param options - Options for the mutation
   */
  delete(selection: MutationSelection, options?: BaseMutationOptions): Promise<MultipleMutationResult>;
  /**
   * @public
   *
   * Deletes the draft or release version of a document.
   *
   * @remarks
   * * Discarding a version with no `releaseId` will discard the draft version of the published document.
   * * If the draft or release version does not exist, any error will throw.
   *
   * @category Versions
   *
   * @param params - Version action parameters:
   *   - `releaseId` - The ID of the release to discard the document from.
   *   - `publishedId` - The published ID of the document to discard.
   * @param purge - if `true` the document history is also discarded.
   * @param options - Additional action options.
   * @returns a promise that resolves to the `transactionId`.
   *
   * @example Discarding a release version of a document
   * ```ts
   * client.discardVersion({publishedId: 'myDocument', releaseId: 'myRelease'})
   * // The document with the ID `versions.myRelease.myDocument` will be discarded.
   * ```
   *
   * @example Discarding a draft version of a document
   * ```ts
   * client.discardVersion({publishedId: 'myDocument'})
   * // The document with the ID `drafts.myDocument` will be discarded.
   * ```
   */
  discardVersion({ releaseId, publishedId }: {
    releaseId?: string;
    publishedId: string;
  }, purge?: boolean, options?: BaseActionOptions): Promise<SingleActionResult | MultipleActionResult>;
  /**
   * @public
   *
   * Replaces an existing version document.
   *
   * @remarks
   * * Requires a document with a `_type` property.
   * * If the `document._id` is defined, it should be a draft or release version ID that matches the version ID generated from `publishedId` and `releaseId`.
   * * If the `document._id` is not defined, it will be generated from `publishedId` and `releaseId`.
   * * Replacing a version with no `releaseId` will replace the draft version of the published document.
   * * At least one of the **version** or **published** documents must exist.
   *
   * @category Versions
   *
   * @param params - Version action parameters:
   *   - `document` - The new document to replace the version with.
   *   - `releaseId` - The ID of the release where the document version is replaced.
   *   - `publishedId` - The ID of the published document to replace.
   * @param options - Additional action options.
   * @returns a promise that resolves to the `transactionId`.
   *
   * @example Replacing a release version of a published document with a generated version ID
   * ```ts
   * await client.replaceVersion({
   *   document: {_type: 'myDocument', title: 'My Document'},
   *   publishedId: 'myDocument',
   *   releaseId: 'myRelease',
   * })
   *
   * // The following document will be patched:
   * // {
   * //   _id: 'versions.myRelease.myDocument',
   * //   _type: 'myDocument',
   * //   title: 'My Document',
   * // }
   * ```
   *
   * @example Replacing a release version of a published document with a specified version ID
   * ```ts
   * await client.replaceVersion({
   *   document: {_type: 'myDocument', _id: 'versions.myRelease.myDocument', title: 'My Document'},
   *   // `publishedId` and `releaseId` are not required since `document._id` has been specified
   * })
   *
   * // The following document will be patched:
   * // {
   * //   _id: 'versions.myRelease.myDocument',
   * //   _type: 'myDocument',
   * //   title: 'My Document',
   * // }
   * ```
   *
   * @example Replacing a draft version of a published document
   * ```ts
   * await client.replaceVersion({
   *   document: {_type: 'myDocument', title: 'My Document'},
   *   publishedId: 'myDocument',
   * })
   *
   * // The following document will be patched:
   * // {
   * //   _id: 'drafts.myDocument',
   * //   _type: 'myDocument',
   * //   title: 'My Document',
   * // }
   * ```
   */
  replaceVersion<R extends Record<string, Any$1>>(args: {
    document: SanityDocumentStub<R>;
    publishedId: string;
    releaseId?: string;
  }, options?: BaseActionOptions): Promise<SingleActionResult | MultipleActionResult>;
  replaceVersion<R extends Record<string, Any$1>>(args: {
    document: IdentifiedSanityDocumentStub<R>;
    publishedId?: string;
    releaseId?: string;
  }, options?: BaseActionOptions): Promise<SingleActionResult | MultipleActionResult>;
  /**
   * @public
   *
   * Used to indicate when a document within a release should be unpublished when
   * the release is run.
   *
   * @remarks
   * * If the published document does not exist, an error will be thrown.
   *
   * @category Versions
   *
   * @param params - Version action parameters:
   *   - `releaseId` - The ID of the release to unpublish the document from.
   *   - `publishedId` - The published ID of the document to unpublish.
   * @param options - Additional action options.
   * @returns a promise that resolves to the `transactionId`.
   *
   * @example Unpublishing a release version of a published document
   * ```ts
   * await client.unpublishVersion({publishedId: 'myDocument', releaseId: 'myRelease'})
   * // The document with the ID `versions.myRelease.myDocument` will be unpublished. when `myRelease` is run.
   * ```
   */
  unpublishVersion({ releaseId, publishedId }: {
    releaseId: string;
    publishedId: string;
  }, options?: BaseActionOptions): Promise<SingleActionResult | MultipleActionResult>;
  /**
   * Perform mutation operations against the configured dataset
   * Returns a promise that resolves to the first mutated document.
   *
   * @category Mutations
   *
   * @param operations - Mutation operations to execute
   * @param options - Mutation options
   */
  mutate<R extends Record<string, Any$1> = Record<string, Any$1>>(operations: Mutation<R>[] | Patch | Transaction, options: FirstDocumentMutationOptions): Promise<SanityDocument$1<R>>;
  /**
   * Perform mutation operations against the configured dataset.
   * Returns a promise that resolves to an array of the mutated documents.
   *
   * @param operations - Mutation operations to execute
   * @param options - Mutation options
   */
  mutate<R extends Record<string, Any$1> = Record<string, Any$1>>(operations: Mutation<R>[] | Patch | Transaction, options: AllDocumentsMutationOptions): Promise<SanityDocument$1<R>[]>;
  /**
   * Perform mutation operations against the configured dataset
   * Returns a promise that resolves to a mutation result object containing the document ID of the first mutated document.
   *
   * @param operations - Mutation operations to execute
   * @param options - Mutation options
   */
  mutate<R extends Record<string, Any$1> = Record<string, Any$1>>(operations: Mutation<R>[] | Patch | Transaction, options: FirstDocumentIdMutationOptions): Promise<SingleMutationResult>;
  /**
   * Perform mutation operations against the configured dataset
   * Returns a promise that resolves to a mutation result object containing the mutated document IDs.
   *
   * @param operations - Mutation operations to execute
   * @param options - Mutation options
   */
  mutate<R extends Record<string, Any$1> = Record<string, Any$1>>(operations: Mutation<R>[] | Patch | Transaction, options: AllDocumentIdsMutationOptions): Promise<MultipleMutationResult>;
  /**
   * Perform mutation operations against the configured dataset
   * Returns a promise that resolves to a mutation result object containing the mutated document IDs.
   *
   * @param operations - Mutation operations to execute
   * @param options - Mutation options
   */
  mutate<R extends Record<string, Any$1> = Record<string, Any$1>>(operations: Mutation<R>[] | Patch | Transaction, options?: BaseMutationOptions): Promise<MultipleMutationResult>;
  /**
   * Create a new buildable patch of operations to perform
   *
   * @category Mutations
   *
   * @param documentId - Document ID to patch
   * @param operations - Optional object of patch operations to initialize the patch instance with
   * @returns Patch instance - call `.commit()` to perform the operations defined
   */
  patch(documentId: string, operations?: PatchOperations): Patch;
  /**
   * Create a new buildable patch of operations to perform
   *
   * @param documentIds - Array of document IDs to patch
   * @param operations - Optional object of patch operations to initialize the patch instance with
   * @returns Patch instance - call `.commit()` to perform the operations defined
   */
  patch(documentIds: string[], operations?: PatchOperations): Patch;
  /**
   * Create a new buildable patch of operations to perform
   *
   * @param selection - An object with `query` and optional `params`, defining which document(s) to patch
   * @param operations - Optional object of patch operations to initialize the patch instance with
   * @returns Patch instance - call `.commit()` to perform the operations defined
   */
  patch(selection: MutationSelection, operations?: PatchOperations): Patch;
  /**
   * Create a new transaction of mutations
   *
   * @category Mutations
   *
   * @param operations - Optional array of mutation operations to initialize the transaction instance with
   */
  transaction<R extends Record<string, Any$1> = Record<string, Any$1>>(operations?: Mutation<R>[]): Transaction;
  /**
   * Perform action operations against the configured dataset
   * Returns a promise that resolves to the transaction result
   *
   * @category Mutations
   *
   * @param operations - Action operation(s) to execute
   * @param options - Action options
   */
  action(operations: Action | Action[], options?: BaseActionOptions): Promise<SingleActionResult | MultipleActionResult>;
  /**
   * Perform a request against the Sanity API
   * NOTE: Only use this for Sanity API endpoints, not for your own APIs!
   *
   * @category HTTP
   *
   * @param options - Request options
   * @returns Promise resolving to the response body
   */
  request<R = Any$1>(options: RawRequestOptions): Promise<R>;
  /**
   * Perform an HTTP request a `/data` sub-endpoint
   * NOTE: Considered internal, thus marked as deprecated. Use `request` instead.
   *
   * @deprecated - Use `request()` or your own HTTP library instead
   * @param endpoint - Endpoint to hit (mutate, query etc)
   * @param body - Request body
   * @param options - Request options
   * @internal
   */
  dataRequest(endpoint: string, body: unknown, options?: BaseMutationOptions): Promise<Any$1>;
  /**
   * Get a Sanity API URL for the URI provided
   *
   * @category HTTP
   *
   * @param uri - URI/path to build URL for
   * @param canUseCdn - Whether or not to allow using the API CDN for this route
   */
  getUrl(uri: string, canUseCdn?: boolean): string;
  /**
   * Get a Sanity API URL for the data operation and path provided
   *
   * @category HTTP
   *
   * @param operation - Data operation (eg `query`, `mutate`, `listen` or similar)
   * @param path - Path to append after the operation
   */
  getDataUrl(operation: string, path?: string): string;
}
/**  @beta */
type GenerateOperation = 'set' | 'append' | 'mixed';
/**  @beta */
interface GenerateRequestBase extends AgentActionRequestBase {
  /** schemaId as reported by sanity deploy / sanity schema store */
  schemaId: string;
  /**
   * Instruct the LLM how it should generate content. Be as specific and detailed as needed.
   *
   * The LLM only has access to information in the instruction, plus the target schema.
   *
   * String template with support for $variable from `instructionParams`.
   * */
  instruction: string;
  /**
   * param values for the string template, keys are the variable name, ie if the template has "$variable", one key must be "variable"
   *
   * ### Examples
   *
   * #### Constant
   *
   * ##### Shorthand
   * ```ts
   * client.agent.action.generate({
   *   schemaId,
   *   documentId,
   *   instruction: 'Give the following topic:\n $topic \n ---\nGenerate the full article.',
   *   instructionParams: {
   *     topic: 'Grapefruit'
   *   },
   * })
   * ```
   * ##### Object-form
   *
   * ```ts
   * client.agent.action.generate({
   *   schemaId,
   *   documentId,
   *   instruction: 'Give the following topic:\n $topic \n ---\nGenerate the full article.',
   *   instructionParams: {
   *     topic: {
   *       type: 'constant',
   *       value: 'Grapefruit'
   *     },
   *   },
   * })
   * ```
   * #### Field
   * ```ts
   * client.agent.action.generate({
   *   schemaId,
   *   documentId,
   *   instruction: 'Give the following field value:\n $pte \n ---\nGenerate keywords.',
   *   instructionParams: {
   *     pte: {
   *       type: 'field',
   *       path: ['pteField'],
   *     },
   *   },
   *   target: {path: 'keywords' }
   * })
   * ```
   * #### Document
   * ```ts
   * client.agent.action.generate({
   *   schemaId,
   *   documentId,
   *   instruction: 'Give the following document value:\n $document \n ---\nGenerate keywords.',
   *   instructionParams: {
   *     document: {
   *       type: 'document',
   *     },
   *   },
   *   target: {path: 'keywords' }
   * })
   * ```
   *
   * #### GROQ
   * ```ts
   * client.agent.action.generate({
   *   schemaId,
   *   documentId,
   *   instruction: 'Give the following list of titles:\n $list \n ---\nGenerate a similar title.',
   *   instructionParams: {
   *     list: {
   *       type: 'groq',
   *       query: '* [_type==$type].title',
   *       params: {type: 'article'}
   *     },
   *   },
   *   target: {path: 'title' }
   * })
   * ```
   * */
  instructionParams?: AgentActionParams;
  /**
   * Target defines which parts of the document will be affected by the instruction.
   * It can be an array, so multiple parts of the document can be separately configured in detail.
   *
   * Omitting target implies that the document itself is the root.
   *
   * Notes:
   * - instruction can only affect fields up to `maxPathDepth`
   * - when multiple targets are provided, they will be coalesced into a single target sharing a common target root.
   * It is therefor an error to provide conflicting include/exclude across targets (ie, include title in one, and exclude it in another)
   *
   * ## Generating images
   *
   * Generate will generate images the same was as AI Assist, for images that have been configured using
   * [AI Assist schema options](https://github.com/sanity-io/assist/tree/main/plugin#image-generation).
   *
   * To generate images _without_ changing the schema, directly target an image asset path.
   *
   * For example, all the following will generate an image into the provided asset:
   * * `target: {path: ['image', 'asset'] }`
   * * `target: {path: 'image', include: ['asset'] }`
   *
   * Image generation can be combined with regular content targets:
   * * `target: [{path: ['image', 'asset'] }, {include: ['title', 'description']}]`
   *
   * Since Generate happens in a single LLM pass, the image will be contextually related to other generated content.
   * @see AgentActionRequestBase#conditionalPaths
   */
  target?: GenerateTarget | GenerateTarget[];
}
/**  @beta */
interface GenerateTargetInclude extends AgentActionTargetInclude {
  /**
   * Sets the operation for this path, and all its children.
   * This overrides any operation set parents or the root target.
   * @see #GenerateTarget.operation
   * @see #include
   */
  operation?: GenerateOperation;
  /**
   * By default, all children up to `target.maxPathDepth` are included.
   *
   * When `include` is specified, only segments explicitly listed will be included.
   *
   * Fields or array items not on the include list, are implicitly excluded.
   */
  include?: (AgentActionPathSegment | GenerateTargetInclude)[];
}
/**  @beta */
interface GenerateTarget extends AgentActionTarget {
  /**
   * Sets the default operation for all paths in the target.
   * Generate runs in `'mixed'` operation mode by default:
   * Changes are set in all non-array fields, and append to all array fields.
   *
   * ### Operation types
   * - `'set'` – an *overwriting* operation, and replaces the full field value.
   * - `'append'`:
   *    – array fields: appends new items to the end of the array,
   *    - string fields: '"existing content" "new content"'
   *    - text fields: '"existing content"\\n"new content"'
   *    - number fields: existing + new
   *    - other field types not mentioned will set instead (dates, url)
   * - `'mixed'` – (default) sets non-array fields, and appends to array fields
   *
   * The default operation can be overridden on a per-path basis using `include`.
   *
   * Nested fields inherit the operation specified by their parent and falls back to the
   * top level target operation if not otherwise specified.
   *
   * Use `include` to change the `operation` of individual fields or items.
   *
   * #### Appending in the middle of arrays
   * `target: {path: ['array'], operation: 'append'}` will append the output of the instruction to the end of the array.
   *
   * To insert in the middle of the array, use `target: {path: ['array', {_key: 'appendAfterKey'}], operation: 'append'}`.
   * Here, the output of the instruction will be appended after the array item with key `'appendAfterKey'`.
   *
   * @see #AgentActionTargetInclude.operation
   * @see #include
   * @see #AgentActionTargetInclude.include
   * @see #AgentActionSchema.forcePublishedWrite
   */
  operation?: GenerateOperation;
  /**
   * By default, all children up to `target.maxPathDepth` are included.
   *
   * When `include` is specified, only segments explicitly listed will be included.
   *
   * Fields or array items not on the include list, are implicitly excluded.
   */
  include?: (AgentActionPathSegment | GenerateTargetInclude)[];
}
/**  @beta */
type GenerateTargetDocument<T extends Record<string, Any$1> = Record<string, Any$1>> = {
  operation: 'edit';
  /**
   * @see #AgentActionSchema.forcePublishedWrite
   */
  _id: string;
} | {
  operation: 'create';
  /**
   * @see #AgentActionSchema.forcePublishedWrite
   */
  _id?: string;
  _type: string;
  initialValues?: T;
} | {
  operation: 'createIfNotExists';
  /**
   * @see #AgentActionSchema.forcePublishedWrite
   */
  _id: string;
  _type: string;
  initialValues?: T;
} | {
  operation: 'createOrReplace';
  /**
   * @see #AgentActionSchema.forcePublishedWrite
   */
  _id: string;
  _type: string;
  initialValues?: T;
};
/**
 * Instruction for an existing document.
 * @beta
 */
interface GenerateExistingDocumentRequest {
  /**
   * @see #AgentActionSchema.forcePublishedWrite
   */
  documentId: string;
  targetDocument?: never;
}
/**
 * Instruction to create a new document
 * @beta
 */
interface GenerateTargetDocumentRequest<T extends Record<string, Any$1> = Record<string, Any$1>> {
  /**
   * @see #AgentActionSchema.forcePublishedWrite
   */
  targetDocument: GenerateTargetDocument<T>;
  documentId?: never;
}
/** @beta */
type GenerateSyncInstruction<T extends Record<string, Any$1> = Record<string, Any$1>> = (GenerateExistingDocumentRequest | GenerateTargetDocumentRequest<T>) & GenerateRequestBase & AgentActionSync;
/** @beta */
type GenerateAsyncInstruction<T extends Record<string, Any$1> = Record<string, Any$1>> = (GenerateExistingDocumentRequest | GenerateTargetDocumentRequest<T>) & GenerateRequestBase & AgentActionAsync;
/** @beta */
type GenerateInstruction<T extends Record<string, Any$1> = Record<string, Any$1>> = GenerateSyncInstruction<T> | GenerateAsyncInstruction<T>;
/**
 * Low-level requester returned by `defineRequester(...).observable`.
 * Surfaces as `client.config().requester` and as the named `requester`
 * export.
 *
 * Defined locally rather than imported from `http/request` so api-extractor
 * inlines it into the bundled `.d.ts` instead of emitting a relative import
 * that doesn't survive into `dist/` ([#1290][]).
 *
 * [#1290]: https://github.com/sanity-io/client/issues/1290
 *
 * @public
 */
type Requester = (options: Any$1) => Observable<unknown>;
/**
 * Used to tag types that is set to `any` as a temporary measure, but should be replaced with proper typings in the future
 * @internal
 */
type Any$1 = any;
declare global {
  interface File {}
}
/** @public */
type UploadBody = File | Blob | Buffer | NodeJS.ReadableStream;
/** @public */
interface RequestOptions$1 {
  timeout?: number;
  token?: string;
  tag?: string;
  headers?: Record<string, string>;
  method?: string;
  query?: Any$1;
  body?: Any$1;
  signal?: AbortSignal;
}
/**
 * The fully resolved request passed to a {@link RequestHandler}.
 *
 * @public
 */
type RequestHandlerOptions = RequestOptions;
/**
 * Intercepts a client request around the normal HTTP pipeline.
 *
 * Call `next(request)` to execute the request. It resolves to the parsed
 * response body and rejects with the same errors the client normally exposes,
 * including {@link ClientError} and {@link ServerError}. A handler can modify
 * the request, retry it by calling `next` again, or return a synthetic body.
 *
 * Browser asset uploads and server-sent event connections do not use this handler.
 *
 * @public
 */
type RequestHandler = (request: RequestHandlerOptions, next: (request: RequestHandlerOptions) => Promise<unknown>) => Promise<unknown>;
/**
 * @public
 * @deprecated – The `r`-prefix is not required, use `string` instead
 */
type ReleaseId = `r${string}`;
/**
 * @deprecated use 'drafts' instead
 */
type DeprecatedPreviewDrafts = 'previewDrafts';
/** @public */
type StackablePerspective = 'published' | 'drafts' | (string & {});
/** @public */
type ClientPerspective$1 = DeprecatedPreviewDrafts | 'published' | 'drafts' | 'raw' | StackablePerspective[];
/**
 * @public
 * @beta
 */
type ClientVariantConditions = Record<string, string>;
/**
 * @public
 * @beta
 */
type ClientVariant = ClientVariantConditions | string;
type ClientConfigResource = {
  type: 'canvas';
  id: string;
} | {
  type: 'knowledge-base';
  id: string;
} | {
  type: 'media-library';
  id: string;
} | {
  type: 'dataset';
  id: string;
} | {
  type: 'dashboard';
  id: string;
};
/**
 * The credential the client sends: a bearer token, the browser's cookies for
 * the API origin, or nothing (`undefined`) for anonymous access. Token mode and
 * cookie mode are mutually exclusive.
 *
 * @public
 */
type Auth = {
  token: string;
} | {
  withCredentials: true;
} | undefined;
/**
 * What `client.getAuth()` resolves to: the current {@link Auth} as an
 * object, so it can be destructured. Anonymous access is `{}`; the two
 * credential forms are the same objects the `auth` observable emits.
 *
 * @public
 */
type ResolvedAuth = {
  token: string;
  withCredentials?: undefined;
} | {
  withCredentials: true;
  token?: undefined;
} | {
  token?: undefined;
  withCredentials?: undefined;
};
/**
 * Options for `client.getAuth()`.
 *
 * @public
 */
interface GetAuthOptions {
  /** Cancels the wait for a reactive `auth` that is withholding its value. */
  signal?: AbortSignal;
}
/** @public */
interface ClientConfig$1 {
  projectId?: string;
  dataset?: string;
  /** @defaultValue true */
  useCdn?: boolean;
  /**
   * The current credential, for apps whose access token changes during the
   * client's lifetime (an OAuth session that refreshes, a user who signs in
   * or out). Each emission is a promise of the credential: an already
   * settled one (`Promise.resolve({token})`) for a credential you hold, or a
   * pending one (the refresh call itself) while a renewal is in progress.
   * Every request waits for the latest emission to settle; every open
   * `listen()` / `live.events()` stream reconnects when a new credential
   * settles, resuming from its last event id, and reconnect attempts made
   * while a renewal is pending wait for it, so they never send an expired
   * token. Rejecting the promise means the credential failed: every request
   * and every open stream on the client ends with that error, and later
   * requests keep failing until a new value is emitted. Retry a refresh
   * inside the promise; reject only when the session is over. Attach a
   * rejection handler to the promise you emit (`renewal.catch(() => {})`)
   * if the client may be idle when it rejects, since an unobserved
   * rejection crashes a Node process.
   *
   * The observable must replay its latest emission to every new subscriber
   * (a `BehaviorSubject` or `shareReplay(1)` does), then emit every change,
   * and never complete. A wait is cancelled by the request's `signal` and
   * bounded by its `timeout`. The client never refreshes a credential
   * itself, and a 401 on a stream ends it with a `ConnectionFailedError`.
   *
   * Cannot be combined with `token` or `withCredentials`, which are the
   * static forms of the same setting. The credential is unknown at
   * configuration time, so the browser-token and cookie-mode checks those
   * options trigger are skipped: set `useCdn: false` yourself when the observable
   * may emit `{withCredentials: true}`, since cookies never reach the CDN.
   */
  auth?: Observable<Promise<Auth>>;
  /**
   * A static bearer token, sent as `Authorization: Bearer <token>` on every
   * request. The recommended form for scripts, servers and functions, where
   * the token does not change. Use `auth` instead when it does.
   */
  token?: string;
  /**
   * Configure the client to work with a specific Sanity resource (Media Library, Canvas, etc.)
   * @remarks
   * This allows the client to interact with resources beyond traditional project datasets.
   * When configured, methods like `fetch()`, `assets.upload()`, and mutations will operate on the specified resource.
   * @example
   * ```ts
   * createClient({
   *   resource: {
   *     type: 'media-library',
   *     id: 'your-media-library-id'
   *   }
   * })
   * ```
   */
  resource?: ClientConfigResource;
  /**
   * @deprecated Use `resource` instead
   * @internal
   */
  '~experimental_resource'?: ClientConfigResource;
  /**
   * What perspective to use for the client. See {@link https://www.sanity.io/docs/perspectives|perspective documentation}
   * @remarks
   * As of API version `v2025-02-19`, the default perspective has changed from `raw` to `published`. {@link https://www.sanity.io/changelog/676aaa9d-2da6-44fb-abe5-580f28047c10|Changelog}
   * @defaultValue 'published'
   */
  perspective?: ClientPerspective$1;
  /**
   * @beta
   */
  variant?: ClientVariant;
  apiHost?: string;
  /**
     @remarks
     * As of API version `v2025-02-19`, the default perspective has changed from `raw` to `published`. {@link https://www.sanity.io/changelog/676aaa9d-2da6-44fb-abe5-580f28047c10|Changelog}
     */
  apiVersion?: string;
  /**
   * Route requests through an HTTP(S) proxy. Node.js only. Can be replaced
   * on an existing client via `client.config({proxy})` or
   * `client.withConfig({proxy})`. For environment-driven proxying, set
   * `HTTP_PROXY`/`HTTPS_PROXY`/`NO_PROXY` before the process starts.
   */
  proxy?: string;
  /**
   * Optional request tag prefix for all request tags
   */
  requestTagPrefix?: string;
  /**
   * Intercepts requests after the client has resolved their URL, headers, and
   * transport options. The handler wraps the normal client pipeline, so errors
   * from `next` are already converted to {@link ClientError} or
   * {@link ServerError}.
   *
   * A handler supplied through `withConfig()` replaces the current handler.
   * To compose handlers, read the current handler from `client.config()` and
   * call it from the replacement.
   *
   * Browser asset uploads and server-sent event connections are not intercepted.
   */
  requestHandler?: RequestHandler;
  /**
   * Optional default headers to include with all requests
   *
   * @remarks request-specific headers will override any default headers with the same name.
   */
  headers?: Record<string, string>;
  ignoreBrowserTokenWarning?: boolean;
  /**
   * Ignore specific warning messages from the client.
   *
   * @remarks
   * - String values perform substring matching (not exact matching) against warning messages
   * - RegExp values are tested against the full warning message
   * - Array values allow multiple patterns to be specified
   *
   * @example
   * ```typescript
   * // Ignore warnings containing "experimental"
   * ignoreWarnings: 'experimental'
   *
   * // Ignore multiple warning types
   * ignoreWarnings: ['experimental', 'deprecated']
   *
   * // Use regex for exact matching
   * ignoreWarnings: /^This is an experimental API version$/
   *
   * // Mix strings and regex patterns
   * ignoreWarnings: ['rate limit', /^deprecated/i]
   * ```
   */
  ignoreWarnings?: string | RegExp | Array<string | RegExp>;
  /**
   * Send the browser's cookies for the API origin with every request instead
   * of a token. Disables `useCdn`, since cookies never reach the CDN.
   */
  withCredentials?: boolean;
  allowReconfigure?: boolean;
  timeout?: number;
  /** Number of retries for requests. Defaults to 5. */
  maxRetries?: number;
  /**
   * The amount of time, in milliseconds, to wait before retrying, given an attemptNumber (starting at 0).
   *
   * Defaults to exponential back-off, starting at 100ms, doubling for each attempt, together with random
   * jitter between 0 and 100 milliseconds. More specifically the following algorithm is used:
   *
   *   Delay = 100 * 2^attemptNumber + randomNumberBetween0and100
   */
  retryDelay?: (attemptNumber: number) => number;
  /**
   * @deprecated Don't use
   */
  useProjectHostname?: boolean;
  /**
   * Resolves the fetch implementation every request (including EventSource
   * connections) goes through. Defaults to the environment entry point's
   * fetch — the Node entry supplies get-it's undici-backed fetch (resolved
   * via the entry point instead of a direct import so `get-it/node`/`undici`
   * stays out of the browser bundle), the browser entry leaves it unset (the
   * global fetch IS the environment's fetch there). Receives the explicit
   * `proxy` config, when set, as its argument.
   *
   * Supplying it in the client config replaces the transport wholesale —
   * custom fetch variants, alternative undici configurations, or a mock
   * (the test suite injects `get-it/mock` this way).
   *
   * Returns get-it's minimal `FetchFunction` contract rather than the full
   * `typeof fetch` — that is what the environments actually provide, and
   * every consumer (the transport, the EventSource fetch resolver) only
   * needs that subset.
   *
   * @internal
   */
  resolveFetch?: (proxyUrl?: string) => FetchFunction;
  /**
   * Adds a `resultSourceMap` key to the API response, with the type `ContentSourceMap`
   */
  resultSourceMap?: boolean | 'withKeyArraySelector';
  /**
   * @deprecated set `cache` and `next` options on `client.fetch` instead
   */
  fetch?: {
    cache?: ResponseQueryOptions['cache'];
    next?: ResponseQueryOptions['next'];
  } | boolean;
  /**
   * Options for how, if enabled, Content Source Maps are encoded into query results using steganography
   */
  stega?: StegaConfig | boolean;
  /**
   * Lineage token for recursion control
   */
  lineage?: string;
  /**
   * ID of the blueprints stack that `functions.invoke()` resolves function
   * names against. Function names are unique within a stack
   */
  stackId?: string;
  /**
   * ID of the organization owning the blueprints stack
   */
  organizationId?: string;
  /**
   * Organization-scoped configuration for collaboration APIs.
   *
   * Currently this is used by `collaboration.comments` methods.
   *
   * @beta
   */
  collaboration?: {
    organizationId?: string;
  };
  /**
   * Organization-scoped configuration for Context APIs.
   *
   * Currently this is used by `context.insights` methods.
   *
   * @beta
   */
  context?: {
    organizationId?: string;
  };
}
/** @public */
interface InitializedClientConfig$1 extends ClientConfig$1 {
  apiHost: string;
  apiVersion: string;
  useProjectHostname: boolean;
  useCdn: boolean;
  /**
   * @deprecated Internal, don't use
   */
  isDefaultApi: boolean;
  /**
   * @deprecated Internal, don't use
   */
  url: string;
  /**
   * @deprecated Internal, don't use
   */
  cdnUrl: string;
  /**
   * The fully initialized stega config, can be used to check if stega is enabled
   */
  stega: InitializedStegaConfig;
  /**
   * The resolved low-level requester for this client. Always populated by
   * `createClient` so internal paths (e.g. the asset upload event stream) can
   * reach the underlying transport.
   *
   * @internal
   */
  requester: Requester;
  /**
   * Default headers to include with all requests
   *
   * @remarks request-specific headers will override any default headers with the same name.
   */
  headers?: Record<string, string>;
  /**
   * The configured static token. `undefined` for a client configured with a
   * reactive `auth`, where `client.getAuth()` reads the credential the client
   * sends (a warning says so on first read).
   */
  token?: string;
  /**
   * The configured static cookie mode. `undefined` for a client configured
   * with a reactive `auth`, where `client.getAuth()` reads the credential the
   * client sends (a warning says so on first read).
   */
  withCredentials?: boolean;
}
/** @public */
type AssetMetadataType = 'location' | 'exif' | 'image' | 'palette' | 'lqip' | 'blurhash' | 'thumbhash' | 'none';
/** @public */
interface UploadClientConfig {
  /**
   * Optional request tag for the upload
   */
  tag?: string;
  /**
   * Whether or not to preserve the original filename (default: true)
   */
  preserveFilename?: boolean;
  /**
   * Filename for this file (optional)
   */
  filename?: string;
  /**
   * Milliseconds to wait before timing the request out.
   *
   * Unlike other requests, uploads have NO timeout unless one is explicitly
   * set here — uploads can legitimately be slow, so timing out is opt-in.
   */
  timeout?: number;
  /**
   * Mime type of the file
   */
  contentType?: string;
  /**
   * Array of metadata parts to extract from asset
   */
  extract?: AssetMetadataType[];
  /**
   * Optional freeform label for the asset. Generally not used.
   */
  label?: string;
  /**
   * Optional title for the asset
   */
  title?: string;
  /**
   * Optional description for the asset
   */
  description?: string;
  /**
   * The credit to person(s) and/or organization(s) required by the supplier of the asset to be used when published
   */
  creditLine?: string;
  /**
   * Source data (when the asset is from an external service)
   */
  source?: {
    /**
     * The (u)id of the asset within the source, i.e. 'i-f323r1E'
     */
    id: string;
    /**
     * The name of the source, i.e. 'unsplash'
     */
    name: string;
    /**
     * A url to where to find the asset, or get more info about it in the source
     */
    url?: string;
  };
}
/** @internal */
interface SanityReference {
  _ref: string;
}
/** @internal */
type SanityDocument$1<T extends Record<string, Any$1> = Record<string, Any$1>> = { [P in keyof T]: T[P]; } & {
  _id: string;
  _rev: string;
  _type: string;
  _createdAt: string;
  _updatedAt: string;
  /**
   * Present when `perspective` is set to `previewDrafts`
   */
  _originalId?: string;
};
/** @internal */
interface SanityAssetDocument extends SanityDocument$1 {
  url: string;
  path: string;
  size: number;
  assetId: string;
  mimeType: string;
  sha1hash: string;
  extension: string;
  uploadId?: string;
  originalFilename?: string;
}
/** @internal */
interface SanityImagePalette {
  background: string;
  foreground: string;
  population: number;
  title: string;
}
/** @internal */
interface SanityImageAssetDocument extends SanityAssetDocument {
  metadata: {
    _type: 'sanity.imageMetadata';
    hasAlpha: boolean;
    isOpaque: boolean;
    lqip?: string;
    blurHash?: string;
    thumbHash?: string;
    dimensions: {
      _type: 'sanity.imageDimensions';
      aspectRatio: number;
      height: number;
      width: number;
    };
    palette?: {
      _type: 'sanity.imagePalette';
      darkMuted?: SanityImagePalette;
      darkVibrant?: SanityImagePalette;
      dominant?: SanityImagePalette;
      lightMuted?: SanityImagePalette;
      lightVibrant?: SanityImagePalette;
      muted?: SanityImagePalette;
      vibrant?: SanityImagePalette;
    };
    image?: {
      _type: 'sanity.imageExifTags';
      [key: string]: Any$1;
    };
    exif?: {
      _type: 'sanity.imageExifMetadata';
      [key: string]: Any$1;
    };
  };
}
/** @public */
interface ErrorProps {
  message: string;
  response: Any$1;
  statusCode: number;
  responseBody: Any$1;
  traceId?: string;
  details: Any$1;
}
/**
 * The internal HTTP request abstraction used by the client. Resolves directly
 * to the parsed response body as a Promise — middleware-level transport
 * details (status codes, headers, progress events) are not exposed. The
 * observable client surface wraps this in an Observable; the promise surface
 * uses it directly.
 *
 * The body is typed as `unknown`; consumers narrow at their own boundary.
 *
 * @internal
 */
type HttpRequest = {
  (options: Any$1, requestHandler?: RequestHandler): Promise<unknown>;
};
/**
 * Target URL for a request. Exactly one of `url` or the deprecated `uri` alias
 * must be given.
 *
 * @internal
 */
type RequestUrlOptions = {
  url: string;
  uri?: never;
} | {
  /**
   * @deprecated Use `url` instead. Support for `uri` will be removed in a future version.
   */
  uri: string;
  url?: never;
};
/** @internal */
type RequestObservableOptions = RequestUrlOptions & Omit<RequestOptions$1, 'url'> & {
  canUseCdn?: boolean;
  useCdn?: boolean;
  /** Per-request cookie override; see {@link RawRequestOptions.withCredentials}. */
  withCredentials?: boolean;
  tag?: string;
  returnQuery?: boolean;
  resultSourceMap?: boolean | 'withKeyArraySelector';
  perspective?: ClientPerspective$1;
  /**
   * @beta
   */
  variant?: ClientVariant;
  lastLiveEventId?: string;
  cacheMode?: 'noStale';
};
/** @public */
interface UploadProgressEvent {
  type: 'progress';
  stage: 'upload' | 'download';
  percent: number;
  total?: number;
  loaded?: number;
  lengthComputable: boolean;
}
/** @public */
interface UploadResponseEvent<T = unknown> {
  type: 'response';
  body: T;
}
/**
 * Events emitted by `client.assets.upload()` when called via the observable
 * API. Progress events are best-effort — they're only emitted when the
 * environment supports tracking upload/download bytes (e.g. browsers via
 * `XMLHttpRequest`). Other runtimes only emit the terminal `response` event.
 *
 * @public
 */
type UploadEvent<T = unknown> = UploadResponseEvent<T> | UploadProgressEvent;
/** @internal */
interface AuthProvider {
  name: string;
  title: string;
  url: string;
}
/** @internal */
type AuthProviderResponse = {
  providers: AuthProvider[];
};
/** @public */
type DatasetAclMode = 'public' | 'private' | 'custom';
/** @public */
type DatasetCreateOptions = {
  aclMode?: DatasetAclMode;
  description?: string | null;
  embeddings?: {
    enabled: boolean;
    projection?: string;
  };
};
/** @public */
type DatasetEditOptions = {
  aclMode?: DatasetAclMode;
  description?: string | null;
};
/** @public */
type EmbeddingsSettings = {
  enabled: boolean;
  projection?: string;
  status: string;
};
/** @public */
type EmbeddingsSettingsBody = {
  enabled: boolean;
  projection?: string;
};
/** @public */
type DatasetResponse = {
  datasetName: string;
  aclMode: DatasetAclMode;
  description: string | null;
};
/** @public */
type DatasetsResponse = {
  name: string;
  aclMode: DatasetAclMode;
  description?: string;
  createdAt: string;
  createdByUserId: string;
  addonFor: string | null;
  datasetProfile: string;
  features: string[];
  tags: {
    name: string;
    title: string;
  }[];
}[];
/** @public */
interface SanityProjectMember {
  id: string;
  role: string;
  isRobot: boolean;
  isCurrentUser: boolean;
}
/** @public */
interface SanityProject {
  id: string;
  displayName: string;
  /**
   * @deprecated Use the `/user-applications` endpoint instead, which lists all deployed studios/applications
   * @see https://www.sanity.io/help/studio-host-user-applications
   */
  studioHost: string | null;
  organizationId: string | null;
  isBlocked: boolean;
  isDisabled: boolean;
  isDisabledByUser: boolean;
  createdAt: string;
  pendingInvites?: number;
  maxRetentionDays?: number;
  members: SanityProjectMember[];
  features: string[];
  metadata: {
    cliInitializedAt?: string;
    color?: string;
    /**
     * @deprecated Use the `/user-applications` endpoint instead, which lists all deployed studios/applications
     * @see https://www.sanity.io/help/studio-host-user-applications
     */
    externalStudioHost?: string;
  };
}
/** @public */
interface SanityUser {
  id: string;
  projectId: string;
  displayName: string;
  familyName: string | null;
  givenName: string | null;
  middleName: string | null;
  imageUrl: string | null;
  createdAt: string;
  updatedAt: string;
  isCurrentUser: boolean;
}
/** @public */
interface CurrentSanityUser {
  id: string;
  name: string;
  email: string;
  profileImage: string | null;
  role: string;
  provider: string;
}
/** @public */
type SanityDocumentStub<T extends Record<string, Any$1> = Record<string, Any$1>> = { [P in keyof T]: T[P]; } & {
  _type: string;
};
/** @public */
type IdentifiedSanityDocumentStub<T extends Record<string, Any$1> = Record<string, Any$1>> = { [P in keyof T]: T[P]; } & {
  _id: string;
} & SanityDocumentStub;
/** @internal */
type InsertPatch = {
  before: string;
  items: Any$1[];
} | {
  after: string;
  items: Any$1[];
} | {
  replace: string;
  items: Any$1[];
};
/** @internal */
interface PatchOperations {
  set?: {
    [key: string]: Any$1;
  };
  setIfMissing?: {
    [key: string]: Any$1;
  };
  diffMatchPatch?: {
    [key: string]: Any$1;
  };
  unset?: string[];
  inc?: {
    [key: string]: number;
  };
  dec?: {
    [key: string]: number;
  };
  insert?: InsertPatch;
  ifRevisionID?: string;
}
/** @public */
interface QueryParams {
  [key: string]: any;
  /** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
  body?: never;
  /** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
  cache?: 'next' extends keyof RequestInit ? never : any;
  /** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
  filterResponse?: never;
  /** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
  headers?: never;
  /** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
  method?: never;
  /** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
  next?: 'next' extends keyof RequestInit ? never : any;
  /** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
  perspective?: never;
  /** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
  variant?: never;
  /** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
  query?: never;
  /** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
  resultSourceMap?: never;
  /** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
  returnQuery?: never;
  /** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
  signal?: never;
  /** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
  stega?: never;
  /** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
  tag?: never;
  /** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
  timeout?: never;
  /** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
  token?: never;
  /** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
  useCdn?: never;
  /** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
  lastLiveEventId?: never;
  /** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
  cacheMode?: never;
}
/**
 * This type can be used with `client.fetch` to indicate that the query has no GROQ parameters.
 * @public
 */
type QueryWithoutParams = Record<string, never> | undefined;
/** @internal */
type MutationSelectionQueryParams = {
  [key: string]: Any$1;
};
/** @internal */
type MutationSelection = {
  query: string;
  params?: MutationSelectionQueryParams;
} | {
  id: string | string[];
};
/** @internal */
type PatchSelection = string | string[] | MutationSelection;
/** @internal */
type PatchMutationOperation = PatchOperations & MutationSelection;
/** @public */
type Mutation<R extends Record<string, Any$1> = Record<string, Any$1>> = {
  create: SanityDocumentStub<R>;
} | {
  createOrReplace: IdentifiedSanityDocumentStub<R>;
} | {
  createIfNotExists: IdentifiedSanityDocumentStub<R>;
} | {
  delete: MutationSelection;
} | {
  patch: PatchMutationOperation;
};
/** @public */
type ReleaseAction = CreateReleaseAction | EditReleaseAction | PublishReleaseAction | ArchiveReleaseAction | UnarchiveReleaseAction | ScheduleReleaseAction | UnscheduleReleaseAction | DeleteReleaseAction | ImportReleaseAction;
/**
 * @public
 * @beta
 */
type VariantDefinitionAction = CreateVariantDefinitionAction | EditVariantDefinitionAction | DeleteVariantDefinitionAction;
/** @public */
type VersionAction = CreateVersionAction | DiscardVersionAction | ReplaceVersionAction | UnpublishVersionAction;
/**
 * @public
 * @beta
 */
type VariantAction = CreateVariantAction | EditVariantAction | DeleteVariantAction | PublishVariantAction | UnpublishVariantAction;
/** @public */
type Action = CreateAction | ReplaceDraftAction | EditAction | DeleteAction | DiscardAction | PublishAction | UnpublishAction | VersionAction | VariantAction | ReleaseAction | VariantDefinitionAction;
/** @public */
type ImportReleaseAction = {
  actionType: 'sanity.action.release.import';
  attributes: IdentifiedSanityDocumentStub;
  releaseId: string;
  ifExists: 'fail' | 'ignore' | 'replace';
} | {
  actionType: 'sanity.action.release.import';
  document: IdentifiedSanityDocumentStub;
  releaseId: string;
  ifExists: 'fail' | 'ignore' | 'replace';
};
/**
 * Creates a new release under the given id, with metadata.
 *
 * @public
 */
interface CreateReleaseAction {
  actionType: 'sanity.action.release.create';
  releaseId: string;
  metadata?: Partial<ReleaseDocument['metadata']>;
}
/**
 * Edits an existing release, updating the metadata.
 *
 * @public
 */
interface EditReleaseAction {
  actionType: 'sanity.action.release.edit';
  releaseId: string;
  patch: PatchOperations;
}
/**
 * Publishes all documents in a release at once.
 *
 * @public
 */
interface PublishReleaseAction {
  actionType: 'sanity.action.release.publish';
  releaseId: string;
}
/**
 * Archives an `active` release, and deletes all the release documents.
 *
 * @public
 */
interface ArchiveReleaseAction {
  actionType: 'sanity.action.release.archive';
  releaseId: string;
}
/**
 * Unarchived an `archived` release, and restores all the release documents.
 *
 * @public
 */
interface UnarchiveReleaseAction {
  actionType: 'sanity.action.release.unarchive';
  releaseId: string;
}
/**
 * Queues release for publishing at the given future time.
 *
 * @public
 */
interface ScheduleReleaseAction {
  actionType: 'sanity.action.release.schedule';
  releaseId: string;
  publishAt: string;
}
/**
 * Unschedules a `scheduled` release, stopping it from being published.
 *
 * @public
 */
interface UnscheduleReleaseAction {
  actionType: 'sanity.action.release.unschedule';
  releaseId: string;
}
/**
 * Deletes a `archived` or `published` release, and all the release documents versions.
 *
 * @public
 */
interface DeleteReleaseAction {
  actionType: 'sanity.action.release.delete';
  releaseId: string;
}
/**
 * Creates a new version of an existing document.
 *
 * If the `document` is provided, the version is created from the document
 * attached to the release as given by `document._id`
 *
 * If the `baseId` and `versionId` are provided, the version is created from the base document
 * and the version is attached to the release as given by `publishedId` and `versionId`
 *
 * @public
 */
type CreateVersionAction = {
  actionType: 'sanity.action.document.version.create';
  publishedId: string;
} & ({
  document: IdentifiedSanityDocumentStub;
} | {
  baseId: string;
  versionId: string;
  ifBaseRevisionId?: string;
});
/**
 * Delete a version of a document.
 *
 * @public
 */
interface DiscardVersionAction {
  actionType: 'sanity.action.document.version.discard';
  versionId: string;
  purge?: boolean;
}
/**
 * Replace an existing version of a document.
 *
 * @public
 */
interface ReplaceVersionAction {
  actionType: 'sanity.action.document.version.replace';
  document: IdentifiedSanityDocumentStub;
}
/**
 * Identify that a version of a document should be unpublished when
 * the release that version is contained within is published.
 *
 * @public
 */
interface UnpublishVersionAction {
  actionType: 'sanity.action.document.version.unpublish';
  versionId: string;
  publishedId: string;
}
/**
 * Creates a variant of a document, either by supplying the full document
 * content, or the base ID of a document to copy.
 *
 * @public
 * @beta
 */
type CreateVariantAction = {
  actionType: 'sanity.action.document.variant.create';
  /**
   * ID of the document group to create a variant in. Must be a published
   * document ID, without a `drafts.` or `versions.` prefix.
   */
  publishedId: string;
  /**
   * Name of the variant definition this document belongs to, as in
   * `_.variants.{variantName}`. Must be a bare name, not a full document ID.
   */
  variantId: string;
  /**
   * Source bundle: `'drafts'`, or a release id.
   *
   * Defaults to the published bundle.
   */
  bundleId?: 'drafts' | (string & {});
} & ({
  /**
   * The full document content. Requires a `_type` property.
   */
  document: SanityDocumentStub;
  baseId?: never;
  ifBaseRevisionId?: never;
} | {
  /**
   * ID of an existing document to copy the content from.
   */
  baseId: string;
  /**
   * When set, the action fails unless the current revision of the base
   * document matches this value.
   */
  ifBaseRevisionId?: string;
  document?: never;
});
/**
 * Modifies a variant version of a document by applying a patch.
 *
 * If no such variant document exists it is first created, by copying the
 * variant's published sibling, or the published document if the variant was
 * never published.
 *
 * @public
 * @beta
 */
interface EditVariantAction {
  actionType: 'sanity.action.document.variant.edit';
  /**
   * ID of the document group the variant belongs to. Must be a published
   * document ID, without a `drafts.` or `versions.` prefix.
   */
  publishedId: string;
  /**
   * Name of the variant definition this document belongs to, as in
   * `_.variants.{variantName}`. Must be a bare name, not a full document ID.
   */
  variantId: string;
  /**
   * Source bundle: `'drafts'`, or a release id.
   *
   * Defaults to the published bundle.
   */
  bundleId?: 'drafts' | (string & {});
  /**
   * Patch operations to apply.
   */
  patch: PatchOperations;
}
/**
 * Deletes a variant of a document.
 *
 * @public
 * @beta
 */
interface DeleteVariantAction {
  actionType: 'sanity.action.document.variant.delete';
  /**
   * ID of the document group the variant belongs to. Must be a published
   * document ID, without a `drafts.` or `versions.` prefix.
   */
  publishedId: string;
  /**
   * Name of the variant definition this document belongs to, as in
   * `_.variants.{variantName}`. Must be a bare name, not a full document ID.
   */
  variantId: string;
  /**
   * Source bundle: `'drafts'`, or a release id.
   *
   * Defaults to the published bundle.
   */
  bundleId?: 'drafts' | (string & {});
  /**
   * Delete document history.
   */
  purge?: boolean;
}
/**
 * Publishes a variant version of a document, replacing the published variant
 * and removing the source variant document.
 *
 * @public
 * @beta
 */
interface PublishVariantAction {
  actionType: 'sanity.action.document.variant.publish';
  /**
   * ID of the document group the variant belongs to. Must be a published
   * document ID, without a `drafts.` or `versions.` prefix.
   */
  publishedId: string;
  /**
   * Name of the variant definition this document belongs to, as in
   * `_.variants.{variantName}`. Must be a bare name, not a full document ID.
   */
  variantId: string;
  /**
   * Bundle to publish from: `'drafts'`, or a release id.
   */
  bundleId: 'drafts' | (string & {});
  /**
   * When set, publishing fails unless the current revision of the source
   * variant document matches this value.
   */
  ifVersionRevisionId?: string;
  /**
   * When set, publishing fails unless the current revision of the published
   * variant document matches this value.
   */
  ifPublishedVariantRevisionId?: string;
}
/**
 * Unpublishes a variant version of a document.
 *
 * By default the published variant is removed and preserved as a draft
 * variant. When a release id is given as the `bundleId`, the deletion is
 * instead staged in that release, and takes effect when it is published.
 *
 * @public
 * @beta
 */
interface UnpublishVariantAction {
  actionType: 'sanity.action.document.variant.unpublish';
  /**
   * ID of the document group the variant belongs to. Must be a published
   * document ID, without a `drafts.` or `versions.` prefix.
   */
  publishedId: string;
  /**
   * Name of the variant definition this document belongs to, as in
   * `_.variants.{variantName}`. Must be a bare name, not a full document ID.
   */
  variantId: string;
  /**
   * The content release in which to stage the unpublish.
   *
   * By default, the currently published document is unpublished immediately.
   */
  bundleId?: string;
}
/**
 * Creates a new `system.variant` definition document.
 *
 * @public
 * @beta
 */
interface CreateVariantDefinitionAction {
  actionType: 'sanity.action.variant.definition.create';
  /**
   * Name of the variant definition to create, as in
   * `_.variants.{variantName}`. Must be a bare name, not a full document ID.
   */
  variantId: string;
  /**
   * Conditions used to select this variant.
   */
  conditions?: ClientVariantConditions;
  /**
   * Selection priority. Higher values are preferred when multiple variants
   * match.
   *
   * Defaults to `0`.
   */
  priority?: number;
  metadata?: Record<string, Any$1>;
}
/**
 * Edits an existing variant definition.
 *
 * @public
 * @beta
 */
interface EditVariantDefinitionAction {
  actionType: 'sanity.action.variant.definition.edit';
  /**
   * Name of the variant definition to edit, as in `_.variants.{variantName}`.
   * Must be a bare name, not a full document ID.
   */
  variantId: string;
  /**
   * Patch operations to apply.
   */
  patch: PatchOperations;
  /**
   * When set, the action fails unless the current revision of the variant
   * definition matches this value.
   */
  ifRevisionId?: string;
}
/**
 * Deletes a variant definition.
 *
 * Deletion fails if any document holds a strong reference to this variant.
 *
 * @public
 * @beta
 */
interface DeleteVariantDefinitionAction {
  actionType: 'sanity.action.variant.definition.delete';
  /**
   * Name of the variant definition to delete, as in
   * `_.variants.{variantName}`. Must be a bare name, not a full document ID.
   */
  variantId: string;
  /**
   * When set, the action fails unless the current revision of the variant
   * definition matches this value.
   */
  ifRevisionId?: string;
}
/**
 * Creates a new draft document. The published version of the document must not already exist.
 * If the draft version of the document already exists the action will fail by default, but
 * this can be adjusted to instead leave the existing document in place.
 *
 * @public
 */
type CreateAction = {
  actionType: 'sanity.action.document.create';
  /**
   * ID of the published document to create a draft for.
   */
  publishedId: string;
  /**
   * Document to create. Requires a `_type` property.
   */
  attributes: IdentifiedSanityDocumentStub;
  /**
   * ifExists controls what to do if the draft already exists
   */
  ifExists: 'fail' | 'ignore';
};
/**
 * Replaces an existing draft document.
 * At least one of the draft or published versions of the document must exist.
 *
 * @public
 * @deprecated Use {@link ReplaceVersionAction} instead
 */
type ReplaceDraftAction = {
  actionType: 'sanity.action.document.replaceDraft';
  /**
   * Published document ID to create draft from, if draft does not exist
   */
  publishedId: string;
  /**
   * Document to create if it does not already exist. Requires `_id` and `_type` properties.
   */
  attributes: IdentifiedSanityDocumentStub;
};
/**
 * Modifies an existing draft document.
 * It applies the given patch to the document referenced by draftId.
 * If there is no such document then one is created using the current state of the published version and then that is updated accordingly.
 *
 * @public
 */
type EditAction = {
  actionType: 'sanity.action.document.edit';
  /**
   * Draft document ID to edit
   */
  draftId: string;
  /**
   * Published document ID to create draft from, if draft does not exist
   */
  publishedId: string;
  /**
   * Patch operations to apply
   */
  patch: PatchOperations;
};
/**
 * Deletes the published version of a document and optionally some (likely all known) draft versions.
 * If any draft version exists that is not specified for deletion this is an error.
 * If the purge flag is set then the document history is also deleted.
 *
 * @public
 */
type DeleteAction = {
  actionType: 'sanity.action.document.delete';
  /**
   * Published document ID to delete
   */
  publishedId: string;
  /**
   * Draft document ID to delete
   */
  includeDrafts: string[];
  /**
   * Delete document history
   */
  purge?: boolean;
};
/**
 * Delete the draft version of a document.
 * It is an error if it does not exist. If the purge flag is set, the document history is also deleted.
 *
 * @public
 * @deprecated Use {@link DiscardVersionAction} instead
 */
type DiscardAction = {
  actionType: 'sanity.action.document.discard';
  /**
   * Draft document ID to delete
   */
  draftId: string;
  /**
   * Delete document history
   */
  purge?: boolean;
};
/**
 * Publishes a draft document.
 * If a published version of the document already exists this is replaced by the current draft document.
 * In either case the draft document is deleted.
 * The optional revision id parameters can be used for optimistic locking to ensure
 * that the draft and/or published versions of the document have not been changed by another client.
 *
 * @public
 */
type PublishAction = {
  actionType: 'sanity.action.document.publish';
  /**
   * Draft document ID to publish
   */
  draftId: string;
  /**
   * Draft revision ID to match
   */
  ifDraftRevisionId?: string;
  /**
   * Published document ID to replace
   */
  publishedId: string;
  /**
   * Published revision ID to match
   */
  ifPublishedRevisionId?: string;
};
/**
 * Retract a published document.
 * If there is no draft version then this is created from the published version.
 * In either case the published version is deleted.
 *
 * @public
 */
type UnpublishAction = {
  actionType: 'sanity.action.document.unpublish';
  /**
   * Draft document ID to replace the published document with
   */
  draftId: string;
  /**
   * Published document ID to delete
   */
  publishedId: string;
};
/**
 * A mutation was performed. Note that when updating multiple documents in a transaction,
 * each document affected will get a separate mutation event.
 *
 * @public
 */
type MutationEvent<R extends Record<string, Any$1> = Record<string, Any$1>> = {
  type: 'mutation';
  /**
   * The ID of the document that was affected
   */
  documentId: string;
  /**
   * A unique ID for this event
   */
  eventId: string;
  /**
   * The user ID of the user that performed the mutation
   */
  identity: string;
  /**
   * An array of mutations that were performed. Note that this can differ slightly from the
   * mutations sent to the server, as the server may perform some mutations automatically.
   */
  mutations: Mutation[];
  /**
   * The revision ID of the document before the mutation was performed
   */
  previousRev?: string;
  /**
   * The revision ID of the document after the mutation was performed
   */
  resultRev?: string;
  /**
   * The document as it looked after the mutation was performed. This is only included if
   * the listener was configured with `includeResult: true`.
   */
  result?: SanityDocument$1<R>;
  /**
   * The document as it looked before the mutation was performed. This is only included if
   * the listener was configured with `includePreviousRevision: true`.
   */
  previous?: SanityDocument$1<R> | null;
  /**
   * The effects of the mutation, if the listener was configured with `effectFormat: 'mendoza'`.
   * Object with `apply` and `revert` arrays, see {@link https://github.com/sanity-io/mendoza}.
   */
  effects?: {
    apply: unknown[];
    revert: unknown[];
  };
  /**
   * A timestamp for when the mutation was performed
   */
  timestamp: string;
  /**
   * The transaction ID for the mutation
   */
  transactionId: string;
  /**
   * The type of transition the document went through.
   *
   * - `update` means the document was previously part of the subscribed set of documents,
   *   and still is.
   * - `appear` means the document was not previously part of the subscribed set of documents,
   *   but is now. This can happen both on create or if updating to a state where it now matches
   *   the filter provided to the listener.
   * - `disappear` means the document was previously part of the subscribed set of documents,
   *   but is no longer. This can happen both on delete or if updating to a state where it no
   *   longer matches the filter provided to the listener.
   */
  transition: 'update' | 'appear' | 'disappear';
  /**
   * Whether the change that triggered this event is visible to queries (query) or only to
   * subsequent transactions (transaction). The listener client can specify a preferred visibility
   * through the `visibility` parameter on the listener, but this is only on a best-effort basis,
   * and may yet not be accurate.
   */
  visibility: 'query' | 'transaction';
  /**
   * The total number of events that will be sent for this transaction.
   * Note that this may differ from the amount of _documents_ affected by the transaction, as this
   * number only includes the documents that matches the given filter.
   *
   * This can be useful if you need to perform changes to all matched documents atomically,
   * eg you would wait for `transactionTotalEvents` events with the same `transactionId` before
   * applying the changes locally.
   */
  transactionTotalEvents: number;
  /**
   * The index of this event within the transaction. Note that events may be delivered out of order,
   * and that the index is zero-based.
   */
  transactionCurrentEvent: number;
};
/**
 * An error occurred. This is different from a network-level error (which will be emitted as 'error').
 * Possible causes are things such as malformed filters, non-existant datasets or similar.
 *
 * @public
 */
type ChannelErrorEvent = {
  type: 'channelError';
  message: string;
};
/**
 * The listener has been told to explicitly disconnect and not reconnect.
 * This is a rare situation, but may occur if the API knows reconnect attempts will fail,
 * eg in the case of a deleted dataset, a blocked project or similar events.
 *
 * Note that this is not treated as an error on the observable, but will complete the observable.
 *
 * @public
 */
type DisconnectEvent = {
  type: 'disconnect';
  reason: string;
};
/**
 * The listener has been disconnected, and a reconnect attempt is scheduled.
 *
 * @public
 */
type ReconnectEvent = {
  type: 'reconnect';
};
/**
 * The listener connection has been established
 * note: it's usually a better option to use the 'welcome' event
 * @public
 */
type OpenEvent = {
  type: 'open';
};
/**
 * Emitted when the listener connection has been successfully established
 * and is ready to receive events.
 *
 * If the listener was created with `enableResume: true` and resume support
 * is available, the `welcome` event will only be emitted on the initial
 * connection. On subsequent reconnects, a `welcomeback` event will be
 * emitted instead, followed by any events that were missed while the
 * connection was disconnected.
 *
 * @public
 */
type WelcomeEvent = {
  type: 'welcome';
  listenerName: string;
};
/**
 * Emitted when the listener reconnects and successfully resumes from
 * its previous position.
 *
 * Even if the listener is created with `enableResume: true`, resume support
 * may not be available. In that case, a reconnect will emit `welcome`
 * instead of `welcomeback`.
 *
 * If resumability is unavailable, even listeners created with `enableResume: true` may still
 * emit `welcome` when reconnected. Subscribers should therefore treat `welcome` after a reconnect
 * the same way they would otherwise treat a `reset` event.
 *
 * @public
 */
type WelcomeBackEvent = {
  type: 'welcomeback';
  listenerName: string;
};
/**
 * The listener can't be resumed or otherwise need to reset its local state
 *
 * If resumability is unavailable, even listeners created with `enableResume: true` may still
 * emit `welcome` when reconnected. Subscribers should therefore treat `welcome` after a reconnect
 * the same way they would otherwise treat a `reset` event.
 *
 * @public
 */
type ResetEvent = {
  type: 'reset';
};
/** @public */
type ListenEvent<R extends Record<string, Any$1> = Record<string, Any$1>> = MutationEvent<R> | ReconnectEvent | WelcomeBackEvent | ResetEvent | WelcomeEvent | OpenEvent;
/** @public */
type ListenEventName =
/** A mutation was performed */
'mutation' |
/** The listener has been (re)established */
'welcome' |
/** The listener has been disconnected, and a reconnect attempt is scheduled */
'reconnect' |
/**
 * The listener connection has been established
 * note: it's usually a better option to use the 'welcome' event
 */
'open';
/** @public */
type ResumableListenEventNames = ListenEventName |
/** The listener has reconnected and successfully resumed from where it left off */
'welcomeback' |
/** The listener can't be resumed or otherwise need to reset its local state */
'reset';
/** @public */
type ListenParams = {
  [key: string]: Any$1;
};
/** @public */
interface ListenOptions {
  /**
   * Whether or not to include the resulting document in addition to the mutations performed.
   * If you do not need the actual document, set this to `false` to reduce bandwidth usage.
   * The result will be available on the `.result` property of the events.
   * @defaultValue `true`
   */
  includeResult?: boolean;
  /**
   * Whether or not to include the mutations that was performed.
   * If you do not need the mutations, set this to `false` to reduce bandwidth usage.
   * @defaultValue `true`
   */
  includeMutations?: boolean;
  /**
   * Whether or not to include the document as it looked before the mutation event.
   * The previous revision will be available on the `.previous` property of the events,
   * and may be `null` in the case of a new document.
   * @defaultValue `false`
   */
  includePreviousRevision?: boolean;
  includeAllVersions?: boolean;
  /**
   * Whether events should be sent as soon as a transaction has been committed (`transaction`, default),
   * or only after they are available for queries (query). Note that this is on a best-effort basis,
   * and listeners with `query` may in certain cases (notably with deferred transactions) receive events
   * that are not yet visible to queries.
   *
   * @defaultValue `'transaction'`
   */
  visibility?: 'transaction' | 'query';
  /**
   * Array of event names to include in the observable. By default, only mutation events are included.
   * Note: `welcomeback` and `reset` events requires `enableResume: true`
   * @defaultValue `['mutation']`
   */
  events?: ListenEventName[];
  /**
   * Format of "effects", eg the resulting changes of a mutation.
   * Currently only `mendoza` is supported, and (if set) will include `apply` and `revert` arrays
   * in the mutation events under the `effects` property.
   *
   * See {@link https://github.com/sanity-io/mendoza | The mendoza docs} for more info
   *
   * @defaultValue `undefined`
   */
  effectFormat?: 'mendoza';
  /**
   * Optional request tag for the listener. Use to identify the request in logs.
   *
   * @defaultValue `undefined`
   */
  tag?: string;
  /**
   * If this is enabled, the client will normally resume events upon reconnect
   * When if enabling this, you should also add the `reset` to the events array and handle the case where the backend is unable to resume.
   * @beta
   * @defaultValue `false`
   */
  enableResume?: boolean;
}
/** @public */
interface ResumableListenOptions extends Omit<ListenOptions, 'events' | 'enableResume'> {
  /**
   * If this is enabled, the client will normally resume events upon reconnect
   * Note that you should also subscribe to `reset`-events and handle the case where the backend is unable to resume
   * @beta
   * @defaultValue `false`
   */
  enableResume: true;
  /**
   * Array of event names to include in the observable. By default, only mutation events are included.
   *
   * @defaultValue `['mutation']`
   */
  events?: ResumableListenEventNames[];
}
/** @public */
interface ResponseQueryOptions extends RequestOptions$1 {
  perspective?: ClientPerspective$1;
  /**
   * @beta
   */
  variant?: ClientVariant;
  resultSourceMap?: boolean | 'withKeyArraySelector';
  returnQuery?: boolean;
  useCdn?: boolean;
  stega?: boolean | StegaConfig;
  cache?: 'next' extends keyof RequestInit ? RequestInit['cache'] : never;
  next?: ('next' extends keyof RequestInit ? RequestInit : never)['next'];
  lastLiveEventId?: string | string[] | null;
  /**
   * When set to `noStale`, APICDN will not return a cached response if the content is stale.
   * Tradeoff between latency and freshness of content.
   *
   * Only to be used with live content queries and when useCdn is true.
   */
  cacheMode?: 'noStale';
}
/** @public */
interface FilteredResponseQueryOptions extends ResponseQueryOptions {
  filterResponse?: true;
}
/** @public */
interface UnfilteredResponseQueryOptions extends ResponseQueryOptions {
  filterResponse: false;
  /**
   * When `filterResponse` is `false`, `returnQuery` also defaults to `true` for
   * backwards compatibility (on the client side, not from the content lake API).
   * Can also explicitly be set to `true`.
   */
  returnQuery?: true;
}
/**
 * When using `filterResponse: false`, but you do not wish to receive back the query from
 * the content lake API.
 *
 * @public
 */
interface UnfilteredResponseWithoutQuery extends ResponseQueryOptions {
  filterResponse: false;
  returnQuery: false;
}
/** @public */
type QueryOptions = FilteredResponseQueryOptions | UnfilteredResponseQueryOptions | UnfilteredResponseWithoutQuery;
/** @public */
interface RawQueryResponse$1<R> {
  query: string;
  ms: number;
  result: R;
  resultSourceMap?: ContentSourceMap$1;
  /** Requires `apiVersion` to be `2021-03-25` or later. */
  syncTags?: SyncTag[];
}
/** @public */
type RawQuerylessQueryResponse<R> = Omit<RawQueryResponse$1<R>, 'query'>;
/** @internal */
type BaseMutationOptions = RequestOptions$1 & {
  visibility?: 'sync' | 'async' | 'deferred';
  returnDocuments?: boolean;
  returnFirst?: boolean;
  dryRun?: boolean;
  autoGenerateArrayKeys?: boolean;
  skipCrossDatasetReferenceValidation?: boolean;
  transactionId?: string;
};
/** @internal */
type FirstDocumentMutationOptions = BaseMutationOptions & {
  returnFirst?: true;
  returnDocuments?: true;
};
/** @internal */
type FirstDocumentIdMutationOptions = BaseMutationOptions & {
  returnFirst?: true;
  returnDocuments: false;
};
/** @internal */
type AllDocumentsMutationOptions = BaseMutationOptions & {
  returnFirst: false;
  returnDocuments?: true;
};
/** @internal */
type MutationOperation = 'create' | 'delete' | 'update' | 'none';
/** @internal */
interface SingleMutationResult {
  transactionId: string;
  documentId: string;
  results: {
    id: string;
    operation: MutationOperation;
  }[];
}
/** @internal */
interface MultipleMutationResult {
  transactionId: string;
  documentIds: string[];
  results: {
    id: string;
    operation: MutationOperation;
  }[];
}
/** @internal */
type AllDocumentIdsMutationOptions = BaseMutationOptions & {
  returnFirst: false;
  returnDocuments: false;
};
/** @internal */
type AttributeSet = {
  [key: string]: Any$1;
};
/** @internal */
type TransactionFirstDocumentMutationOptions = BaseMutationOptions & {
  returnFirst: true;
  returnDocuments: true;
};
/** @internal */
type TransactionFirstDocumentIdMutationOptions = BaseMutationOptions & {
  returnFirst: true;
  returnDocuments?: false;
};
/** @internal */
type TransactionAllDocumentsMutationOptions = BaseMutationOptions & {
  returnFirst?: false;
  returnDocuments: true;
};
/** @internal */
type TransactionAllDocumentIdsMutationOptions = BaseMutationOptions & {
  returnFirst?: false;
  returnDocuments?: false;
};
/** @internal */
type TransactionMutationOptions = TransactionFirstDocumentMutationOptions | TransactionFirstDocumentIdMutationOptions | TransactionAllDocumentsMutationOptions | TransactionAllDocumentIdsMutationOptions;
/** @internal */
type BaseActionOptions = RequestOptions$1 & {
  transactionId?: string;
  skipCrossDatasetReferenceValidation?: boolean;
  dryRun?: boolean;
};
/** @internal */
interface SingleActionResult {
  transactionId: string;
}
/** @internal */
interface MultipleActionResult {
  transactionId: string;
}
/** @internal */
type RawRequestOptions = RequestUrlOptions & {
  method?: string;
  token?: string;
  /** @deprecated has no effect — response parsing is driven by the response `content-type` */
  json?: boolean;
  tag?: string;
  useGlobalApi?: boolean;
  withCredentials?: boolean;
  query?: {
    [key: string]: string | string[];
  };
  headers?: {
    [key: string]: string;
  };
  timeout?: number;
  body?: Any$1;
  maxRedirects?: number;
  /** Max retries for this request; `0` disables retries. Overrides the client-level maximum in both directions. */
  maxRetries?: number;
  signal?: AbortSignal;
};
/** @internal */
interface ApiError {
  error: string;
  message: string;
  statusCode: number;
}
/** @internal */
interface MutationError {
  type: 'mutationError';
  description: string;
  items?: MutationErrorItem[];
}
/**
 * Returned from the Content Lake API when a query is malformed, usually with a start
 * and end column to indicate where the error occurred, but not always. Can we used to
 * provide a more structured error message to the user.
 *
 * This will be located under the response `error` property.
 *
 * @public
 */
interface QueryParseError {
  type: 'queryParseError';
  description: string;
  start?: number;
  end?: number;
  query?: string;
}
/** @internal */
interface MutationErrorItem {
  error: {
    type: string;
    description: string;
    value?: unknown;
  };
}
/** @internal */
interface ActionError {
  type: 'actionError';
  description: string;
  items?: ActionErrorItem[];
}
/** @internal */
interface ActionErrorItem {
  error: {
    type: string;
    description: string;
    value?: unknown;
  };
  index: number;
}
/** @internal */
type PartialExcept<T, K extends keyof T> = Pick<T, K> & Partial<Omit<T, K>>;
/** @beta */
type ReleaseState = 'active' | 'archiving' | 'unarchiving' | 'archived' | 'published' | 'publishing' | 'scheduled' | 'scheduling';
/** @internal */
type ReleaseType = 'asap' | 'scheduled' | 'undecided';
/** @public */
type ReleaseCardinality = 'many' | 'one' | undefined;
/** @internal */
interface ReleaseDocument extends SanityDocument$1 {
  /**
   * typically
   * `_.releases.<name>`
   */
  _id: string;
  /**
   * where a release has _id `_.releases.foo`, the name is `foo`
   */
  name: string;
  _type: 'system.release';
  _createdAt: string;
  _updatedAt: string;
  _rev: string;
  state: ReleaseState;
  error?: {
    message: string;
  };
  finalDocumentStates?: {
    /** Document ID */
    id: string;
  }[];
  /**
   * If defined, it takes precedence over the intendedPublishAt, the state should be 'scheduled'
   */
  publishAt?: string;
  /**
   * If defined, it provides the time the release was actually published
   */
  publishedAt?: string;
  metadata: {
    title?: string;
    description?: string;
    intendedPublishAt?: string;
    releaseType: ReleaseType;
    cardinality?: ReleaseCardinality;
  };
}
/** @internal */
type EditableReleaseDocument = Omit<PartialExcept<ReleaseDocument, '_id'>, 'metadata' | '_type'> & {
  _id: string;
  metadata: Partial<ReleaseDocument['metadata']>;
};
/**
 * DocumentValueSource is a path to a value within a document
 * @public
 */
interface ContentSourceMapDocumentValueSource {
  type: 'documentValue';
  document: number;
  path: number;
}
/**
 * When a value is not from a source, its a literal
 * @public
 */
interface ContentSourceMapLiteralSource {
  type: 'literal';
}
/**
 * When a field source is unknown
 * @public
 */
interface ContentSourceMapUnknownSource {
  type: 'unknown';
}
/** @public */
type ContentSourceMapSource = ContentSourceMapDocumentValueSource | ContentSourceMapLiteralSource | ContentSourceMapUnknownSource;
/**
 * ValueMapping is a mapping when for value that is from a single source value
 * It may refer to a field within a document or a literal value
 * @public
 */
interface ContentSourceMapValueMapping {
  type: 'value';
  source: ContentSourceMapSource;
}
/** @public */
type ContentSourceMapMapping = ContentSourceMapValueMapping;
/** @public */
type ContentSourceMapMappings = Record<string, ContentSourceMapMapping>;
/** @public */
interface ContentSourceMapDocumentBase {
  _id: string;
  _type: string;
}
/** @public */
interface ContentSourceMapDocument extends ContentSourceMapDocumentBase {
  _projectId?: undefined;
  _dataset?: undefined;
}
/** @public */
interface ContentSourceMapRemoteDocument extends ContentSourceMapDocumentBase {
  _projectId: string;
  _dataset: string;
}
/** @public */
type ContentSourceMapDocuments$1 = (ContentSourceMapDocument | ContentSourceMapRemoteDocument)[];
/** @public */
type ContentSourceMapPaths = string[];
/** @public */
interface ContentSourceMap$1 {
  mappings: ContentSourceMapMappings;
  documents: ContentSourceMapDocuments$1;
  paths: ContentSourceMapPaths;
}
/** @public */
type SyncTag = `s1:${string}`;
/** @public */
interface LiveEventRestart {
  type: 'restart';
  id: string;
}
/** @public */
interface LiveEventReconnect {
  type: 'reconnect';
}
/** @public */
interface LiveEventMessage {
  type: 'message';
  id: string;
  tags: SyncTag[];
}
/** @public */
interface LiveEventWelcome {
  type: 'welcome';
}
/**
 * The `id` field is the position at which the connection was rejected or closed.
 * The `reason` field will specify why the connection rejected/closed.
 * @public
 */
interface LiveEventGoAway {
  type: 'goaway';
  id: string;
  reason: string;
}
/** @public */
type LiveEvent = LiveEventRestart | LiveEventReconnect | LiveEventMessage | LiveEventWelcome | LiveEventGoAway;
declare global {
  /**
   * Query result types, keyed by GROQ query string. Empty by default, `sanity typegen` registers
   * the queries it finds:
   * ```ts
   * declare global {
   *   interface SanityQueries {
   *     '*[_type == "post"]': PostsQueryResult
   *   }
   * }
   * ```
   * `client.fetch(query)` and `ClientReturn<typeof query>` then resolve to the registered type.
   *
   * The registry is a global rather than a module augmentation of `@sanity/client` so that it
   * does not depend on module resolution: it resolves the same whether `@sanity/client` is a
   * direct dependency, how many copies of it are installed, and from every subpath export.
   */
  interface SanityQueries {}
  /**
   * Schema types, keyed first by resource and then read as a union. Empty by default; a
   * multi-resource `sanity typegen` run registers one entry per configured resource:
   * ```ts
   * declare global {
   *   interface SanitySchemasByResource {
   *     'ppsg7ml5.test': Author | Movie | Slug
   *   }
   * }
   * ```
   * A resource key is the same string the SDK uses for its runtime cache: `projectId.dataset`
   * for a dataset, with no prefix. Consumers select one document type out of the union by its
   * `_type`, so the union may include object types that are not documents.
   */
  interface SanitySchemasByResource {}
  /**
   * Query result types, keyed by resource and then by GROQ query string. Empty by default; a
   * multi-resource `sanity typegen` run registers the queries it finds per resource:
   * ```ts
   * declare global {
   *   interface SanityQueriesByResource {
   *     'ppsg7ml5.test': {'*[_type == "post"]': PostsQueryResult}
   *   }
   * }
   * ```
   * The flat `SanityQueries` registry stays as it is. It cannot express two datasets whose
   * schemas give the same query text different result types, which is what this adds.
   */
  interface SanityQueriesByResource {}
  /**
   * Projection result types, keyed by resource, then document type, then projection string.
   * Empty by default:
   * ```ts
   * declare global {
   *   interface SanityProjectionsByResource {
   *     'ppsg7ml5.test': {author: {'{name}': {name: string | null}}}
   *   }
   * }
   * ```
   * A projection applies to a document the caller identifies by handle, so the same projection
   * text resolves differently per document type as well as per resource. That is why there is a
   * document-type level here and not in `SanityQueriesByResource`.
   */
  interface SanityProjectionsByResource {}
}
/**
 * The query registry as seen from `@sanity/client`. Inherits every query registered on the global
 * `SanityQueries` interface, and still accepts the older module augmentation form:
 * ```ts
 * declare module '@sanity/client' {
 *   interface SanityQueries {
 *     '*[_type == "post"]': PostsQueryResult
 *   }
 * }
 * ```
 * `@sanity/client` releases that predate the global registry only read this interface, so a
 * generated file that registers queries globally can bridge them with an augmentation that adds
 * the global as a base type. It is harmless on releases that already inherit it:
 * ```ts
 * declare module '@sanity/client' {
 *   interface SanityQueries extends globalThis.SanityQueries {}
 * }
 * ```
 * @public
 */
interface SanityQueries extends globalThis.SanityQueries {}
/**
 * The schema registry as seen from `@sanity/client`. Inherits every resource registered on the
 * global `SanitySchemasByResource`, and also accepts a module augmentation, the same way
 * {@link SanityQueries} does.
 * @public
 */
interface SanitySchemasByResource extends globalThis.SanitySchemasByResource {}
/**
 * The per-resource query registry as seen from `@sanity/client`. Inherits every resource
 * registered on the global `SanityQueriesByResource`, and also accepts a module augmentation.
 * @public
 */
interface SanityQueriesByResource extends globalThis.SanityQueriesByResource {}
/**
 * The projection registry as seen from `@sanity/client`. Inherits every resource registered on
 * the global `SanityProjectionsByResource`, and also accepts a module augmentation.
 * @public
 */
interface SanityProjectionsByResource extends globalThis.SanityProjectionsByResource {}
/**
 * The result type `client.fetch(query)` resolves to for a query of type `GroqString`.
 *
 * A query carrying a `__groqResult` brand, such as the default export of a `.groq` file
 * imported through `@sanity-labs/groq-content-mapper`, resolves to the branded result.
 * Otherwise the query is looked up in {@link SanityQueries}, and when it is not registered
 * there the result is `Fallback`, which defaults to `any`.
 *
 * @remarks
 * Reading the brand is experimental and tracks the `.groq` file imports that
 * `@sanity-labs/groq-content-mapper` is introducing; the registry lookup and the fallback are
 * stable. The brand is read structurally, so this type never imports the package that produced
 * the query and resolves the same across duplicated copies of `@sanity/client`. It is a phantom
 * property: it exists in the type system only and is never present on the string at runtime.
 *
 * @experimental
 * @public
 */
type ClientReturn$1<GroqString extends string, Fallback = Any$1> = GroqString extends {
  readonly __groqResult?: infer Result;
} ? Result : GroqString extends keyof SanityQueries ? SanityQueries[GroqString] : Fallback;
/**
 * The params type `client.fetch(query, params)` accepts for a query of type `GroqString`.
 *
 * A query carrying a `__groqParams` brand, such as the default export of a `.groq` file
 * imported through `@sanity-labs/groq-content-mapper`, resolves to the branded params, so that
 * the params passed alongside it are checked. Any other query resolves to `Fallback`, which
 * defaults to {@link QueryParams}.
 *
 * @remarks
 * Reading the brand is experimental and tracks the `.groq` file imports that
 * `@sanity-labs/groq-content-mapper` is introducing. Like {@link ClientReturn}, this reads the
 * brand structurally and never imports the package that produced the query.
 *
 * Unlike `ClientReturn`, this type sits in a parameter position, so it has to stay relatable
 * while `GroqString` is still a type parameter: code that is generic over the query string, like
 * `function load<const Q extends string>(query: Q, params: QueryParams)`, must keep compiling.
 * TypeScript never relates a value to a deferred conditional type that has an `infer` position,
 * or that distributes over the type parameter it reads, which is why the brand is read through an
 * indexed access and the check is written in the non-distributive tuple form. While deferred,
 * TypeScript then checks the value against both branches, so the params are validated against
 * `Fallback` exactly as they were before the brand existed.
 *
 * @experimental
 * @public
 */
type ClientParams<GroqString extends string, Fallback = QueryParams> = [GroqString] extends [{
  readonly __groqParams?: unknown;
}] ? NonNullable<(GroqString & {
  readonly __groqParams?: unknown;
})['__groqParams']> : Fallback;
/**
 * A string constant containing the experimental API version warning message.
 * Use this with the `ignoreWarnings` option to suppress warnings when using experimental API versions.
 *
 * @example
 * ```typescript
 * import { createClient, EXPERIMENTAL_API_WARNING } from '@sanity/client'
 *
 * const client = createClient({
 *   projectId: 'your-project-id',
 *   dataset: 'production',
 *   apiVersion: 'vX', // experimental version
 *   ignoreWarnings: EXPERIMENTAL_API_WARNING
 * })
 * ```
 *
 * @public
 */
declare const EXPERIMENTAL_API_WARNING = "This is an experimental API version";
/**
 * Fit / resize modes accepted for thumbnail params.
 * @public
 */
type FitMode = 'preserve' | 'stretch' | 'crop' | 'smartcrop' | 'pad';
/**
 * Allowed still image formats (thumbnail + storyboard).
 * @public
 */
type StillImageFormat = 'jpg' | 'png' | 'webp';
/**
 * Allowed animated image formats.
 * @public
 */
type AnimatedImageFormat = 'gif' | 'webp';
/**
 * Thumbnail rendition (single frame) options.
 * @public
 */
interface ThumbnailTransformOptions {
  /** Pixel width of the thumbnail frame. */
  width?: number;
  /** Pixel height of the thumbnail frame. */
  height?: number;
  /** Timestamp (seconds) from which to grab the frame. */
  time?: number;
  /** Resize / fit mode applied to the extracted frame. */
  fit?: FitMode;
  /** Output image format. */
  format?: StillImageFormat;
}
/**
 * Animated preview rendition options (e.g. GIF / animated WebP).
 * @public
 */
interface AnimatedTransformOptions {
  /** Pixel width of the animated output. Max 640 px. */
  width?: number;
  /** Pixel height of the animated output. Max 640 px. */
  height?: number;
  /** Start time in seconds (inclusive). */
  start?: number;
  /** End time in seconds. */
  end?: number;
  /** Frames per second (1–30). */
  fps?: number;
  /** Output animated format. */
  format?: AnimatedImageFormat;
}
/**
 * Storyboard (contact sheet) options.
 * @public
 */
interface StoryboardTransformOptions {
  /** Output image format for the storyboard. */
  format?: StillImageFormat;
}
/**
 * Video-specific playback transformation option groups.
 * Only explicitly provided values are serialized into query parameters.
 * @public
 */
interface MediaLibraryVideoPlaybackTransformations {
  /** Static thumbnail (single frame) options. */
  thumbnail?: ThumbnailTransformOptions;
  /** Animated preview options (GIF / animated WebP). */
  animated?: AnimatedTransformOptions;
  /** Storyboard (contact sheet) options. */
  storyboard?: StoryboardTransformOptions;
}
/**
 * Options for requesting playback info (URLs + optional tokens) for a Media Library video asset.
 *
 * Removed: generic fallback parameters (width, height, fit, format). Supply per‑transformation values instead.
 * Animated transformations intentionally exclude any fit option (not supported by Mux).
 *
 * includeTokens is a client-side flag (not sent to the server) controlling whether
 * returned tokens should be appended to URLs when consumed.
 * @public
 */
interface MediaLibraryPlaybackInfoOptions {
  /** Explicit per-video transformation options (thumbnail, animated, storyboard). */
  transformations?: MediaLibraryVideoPlaybackTransformations;
  /** Expiration hint for secured/signed URLs (string or number, number will be stringified). */
  expiration?: string | number;
}
/** @public */
interface VideoPlaybackInfoItemPublic {
  url: string;
}
/** @public */
interface VideoPlaybackInfoItemSigned extends VideoPlaybackInfoItemPublic {
  token: string;
}
/** @public */
type VideoPlaybackInfoItem = VideoPlaybackInfoItemPublic | VideoPlaybackInfoItemSigned;
/** @public */
interface VideoRenditionInfoPublic {
  /** URL to the MP4 rendition (redirects to CDN) */
  url: string;
  /** Resolution identifier, e.g. "1080p", "480p", "270p" */
  resolution: '1080p' | '480p' | '270p' | (string & {});
}
/** @public */
interface VideoRenditionInfoSigned extends VideoRenditionInfoPublic {
  /** Authentication token for signed playback */
  token: string;
  /** Token expiration time in ISO 8601 format */
  expiresAt: string;
}
/** @public */
type VideoRenditionInfo = VideoRenditionInfoPublic | VideoRenditionInfoSigned;
/** @public */
interface VideoSubtitleInfoPublic {
  /** Subtitle track identifier */
  trackId: string;
  /** ISO 639-1 language code */
  languageCode: string;
  /** URL to the subtitle file */
  url: string;
  /** Whether this track contains closed captions */
  closedCaptions: boolean;
}
/** @public */
interface VideoSubtitleInfoSigned extends VideoSubtitleInfoPublic {
  /** Authentication token for signed playback */
  token: string;
  /** Token expiration time in ISO 8601 format */
  expiresAt: string;
}
/** @public */
type VideoSubtitleInfo = VideoSubtitleInfoPublic | VideoSubtitleInfoSigned;
/** @public */
interface VideoPlaybackInfo<T extends VideoPlaybackInfoItem = VideoPlaybackInfoItem, R extends VideoRenditionInfo = T extends VideoPlaybackInfoItemSigned ? VideoRenditionInfoSigned : VideoRenditionInfo, S extends VideoSubtitleInfo = T extends VideoPlaybackInfoItemSigned ? VideoSubtitleInfoSigned : VideoSubtitleInfo> {
  id: string;
  thumbnail: T;
  animated: T;
  storyboard: T;
  stream: T;
  duration: number;
  aspectRatio: number;
  renditions?: R[];
  subtitles?: S[];
}
/** @public */
type VideoPlaybackInfoSigned = VideoPlaybackInfo<VideoPlaybackInfoItemSigned>;
/** @public */
type VideoPlaybackInfoPublic = VideoPlaybackInfo<VideoPlaybackInfoItemPublic>;
/** @public */
interface VideoPlaybackTokens {
  stream?: string;
  thumbnail?: string;
  storyboard?: string;
  animated?: string;
}
/** @public */
type MediaLibraryAssetInstanceIdentifier = string | SanityReference;
/**
 * A single tracked version of a Media Library asset - one uploaded instance,
 * referencing the underlying (Content Lake shaped) asset document it wraps.
 *
 * @public
 */
interface MediaLibraryAssetVersion {
  _key: string;
  _type: 'sanity.asset.version';
  title?: string;
  instance: SanityReference;
}
/**
 * The document returned by the Media Library upload endpoint
 * (`POST /media-libraries/:id/upload`).
 *
 * This is _not_ the same shape as {@link SanityAssetDocument} /
 * {@link SanityImageAssetDocument}: a Media Library asset is a `sanity.asset`
 * document that tracks one or more uploaded versions, each pointing at its
 * own underlying Content Lake asset document via `currentVersion`/`versions`.
 *
 * Modelled directly on an observed API response. Fields whose full shape has
 * not been confirmed (`parent`, `rootDirectory`, `aspects`) are typed loosely
 * on purpose - widen them once their shape is confirmed.
 *
 * @public
 */
interface MediaLibraryAssetDocument {
  _id: string;
  _type: 'sanity.asset';
  assetType: string;
  title?: string;
  cdnAccessPolicy?: string;
  currentVersion: SanityReference;
  versions: MediaLibraryAssetVersion[];
  aspects?: Record<string, Any$1>;
  parent?: SanityReference | null;
  rootDirectory?: Any$1;
}
export { DiscardAction as $, UnfilteredResponseQueryOptions as $n, PatchBuilder as $r, QueryOptions as $t, ContentSourceMapLiteralSource as A, ImageDescriptionOperation as Ai, SanityImagePalette as An, GenerateTarget as Ar, LiveEventWelcome as At, CreateVariantAction as B, AgentActionParam as Bi, SingleActionResult as Bn, ObservableMediaLibraryVideoClient as Br, MutationErrorItem as Bt, ClientVariant as C, CollaborationCommentsWriteOptions as Ci, ResponseQueryOptions as Cn, VideoSubtitleInfo as Cr, ListenOptions as Ct, ContentSourceMapDocumentBase as D, TranslateDocument as Di, SanityDocument$1 as Dn, WelcomeEvent as Dr, LiveEventMessage as Dt, ContentSourceMapDocument as E, ObservableAssetsClient as Ei, SanityAssetDocument as En, WelcomeBackEvent as Er, LiveEventGoAway as Et, ContentSourceMapSource as F, TransformTargetInclude as Fi, SanityQueriesByResource as Fn, ObservableUsersClient as Fr, MediaLibraryVideoPlaybackTransformations as Ft, DatasetCreateOptions as G, ConstantAgentActionParam as Gi, SyncTag as Gn, DurableCallbackRequestOptions as Gr, OpenEvent as Gt, CreateVersionAction as H, AgentActionPath as Hi, StackablePerspective as Hn, InvokeFunctionOptions as Hr, MutationOperation as Ht, ContentSourceMapUnknownSource as I, PromptRequest as Ii, SanityReference as In, UsersClient as Ir, MultipleActionResult as It, DatasetsResponse as J, GroqAgentActionParam as Ji, TransactionAllDocumentsMutationOptions as Jn, DatasetsClient as Jr, PatchOperations as Jt, DatasetEditOptions as K, DocumentAgentActionParam as Ki, ThumbnailTransformOptions as Kn, DurableExecution as Kr, PartialExcept as Kt, ContentSourceMapValueMapping as L, PatchDocument as Li, SanitySchemasByResource as Ln, ObservableProjectsClient as Lr, MultipleMutationResult as Lt, ContentSourceMapMappings as M, TransformOperation as Mi, SanityProjectMember as Mn, GenerateTargetInclude as Mr, MediaLibraryAssetInstanceIdentifier as Mt, ContentSourceMapPaths as N, TransformTarget as Ni, SanityProjectionsByResource as Nn, ObservableSanityClient$1 as Nr, MediaLibraryAssetVersion as Nt, ContentSourceMapDocumentValueSource as O, TranslateTarget as Oi, SanityDocumentStub as On, GenerateInstruction as Or, LiveEventReconnect as Ot, ContentSourceMapRemoteDocument as P, TransformTargetDocument as Pi, SanityQueries as Pn, SanityClient$1 as Pr, MediaLibraryPlaybackInfoOptions as Pt, DeleteVariantDefinitionAction as Q, UnarchiveReleaseAction as Qn, ObservableTransaction as Qr, PublishVariantAction as Qt, CreateAction as R, PatchOperation as Ri, SanityUser as Rn, ProjectsClient as Rr, Mutation as Rt, ClientReturn$1 as S, CollaborationCommentsRequestOptions as Si, ResolvedAuth as Sn, VideoRenditionInfoSigned as Sr, ListenEventName as St, ContentSourceMap$1 as T, AssetsClient as Ti, ResumableListenOptions as Tn, VideoSubtitleInfoSigned as Tr, LiveEvent as Tt, CurrentSanityUser as U, AgentActionPathSegment as Ui, StillImageFormat as Un, InvokeFunctionRequest as Ur, MutationSelection as Ut, CreateVariantDefinitionAction as V, AgentActionParams as Vi, SingleMutationResult as Vn, InvokeFunctionEvent as Vr, MutationEvent as Vt, DatasetAclMode as W, AgentActionTarget as Wi, StoryboardTransformOptions as Wn, DurableCallbackFailure as Wr, MutationSelectionQueryParams as Wt, DeleteReleaseAction as X, TransactionFirstDocumentMutationOptions as Xn, BaseTransaction as Xr, PublishAction as Xt, DeleteAction as Y, TransactionFirstDocumentIdMutationOptions as Yn, ObservableDatasetsClient as Yr, PatchSelection as Yt, DeleteVariantAction as Z, TransactionMutationOptions as Zn, ObservablePatchBuilder as Zr, PublishReleaseAction as Zt, BaseMutationOptions as _, CollaborationCommentSelection as _i, RequestObservableOptions as _n, VideoPlaybackInfoPublic as _r, IdentifiedSanityDocumentStub as _t, AllDocumentsMutationOptions as a, ApiErrorBody as ai, RawRequestOptions as an, UploadBody as ar, EditVariantAction as at, ClientParams as b, CollaborationCommentUpdate as bi, Requester as bn, VideoRenditionInfo as br, InsertPatch as bt, Any$1 as c, ObservableCollaborationCommentsClient as ci, ReleaseCardinality as cn, UploadProgressEvent as cr, EmbeddingsSettings as ct, AssetMetadataType as d, CollaborationCommentDocument as di, ReleaseState as dn, VariantDefinitionAction as dr, FilteredResponseQueryOptions as dt, Transaction as ei, QueryParams as en, UnfilteredResponseWithoutQuery as er, DiscardVersionAction as et, AttributeSet as f, CollaborationCommentFieldValue as fi, ReleaseType as fn, VersionAction as fr, FirstDocumentIdMutationOptions as ft, BaseActionOptions as g, CollaborationCommentReactionShortName as gi, RequestHandlerOptions as gn, VideoPlaybackInfoItemSigned as gr, HttpRequest as gt, AuthProviderResponse as h, CollaborationCommentRange as hi, RequestHandler as hn, VideoPlaybackInfoItemPublic as hr, GetAuthOptions as ht, AllDocumentIdsMutationOptions as i, LiveClient as ii, RawQuerylessQueryResponse as in, UnscheduleReleaseAction as ir, EditReleaseAction as it, ContentSourceMapMapping as j, TransformDocument as ji, SanityProject as jn, GenerateTargetDocument as jr, MediaLibraryAssetDocument as jt, ContentSourceMapDocuments$1 as k, TranslateTargetInclude as ki, SanityImageAssetDocument as kn, GenerateOperation as kr, LiveEventRestart as kt, ApiError as l, CollaborationCommentAnchor as li, ReleaseDocument as ln, UploadResponseEvent as lr, EmbeddingsSettingsBody as lt, AuthProvider as m, CollaborationCommentPortableTextBlock as mi, ReplaceVersionAction as mn, VideoPlaybackInfoItem as mr, FitMode as mt, ActionError as n, ObservablePatch as ni, QueryWithoutParams as nn, UnpublishVariantAction as nr, EXPERIMENTAL_API_WARNING as nt, AnimatedImageFormat as o, types_d_exports as oi, ReconnectEvent as on, UploadClientConfig as or, EditVariantDefinitionAction as ot, Auth as p, CollaborationCommentMessage as pi, ReplaceDraftAction as pn, VideoPlaybackInfo as pr, FirstDocumentMutationOptions as pt, DatasetResponse as q, FieldAgentActionParam as qi, TransactionAllDocumentIdsMutationOptions as qn, DurableStopExecutionOptions as qr, PatchMutationOperation as qt, ActionErrorItem as r, Patch as ri, RawQueryResponse$1 as rn, UnpublishVersionAction as rr, EditAction as rt, AnimatedTransformOptions as s, CollaborationCommentsClient as si, ReleaseAction as sn, UploadEvent as sr, EditableReleaseDocument as st, Action as t, BasePatch as ti, QueryParseError as tn, UnpublishAction as tr, DisconnectEvent as tt, ArchiveReleaseAction as u, CollaborationCommentCreate as ui, ReleaseId as un, VariantAction as ur, ErrorProps as ut, ChannelErrorEvent as v, CollaborationCommentStatus as vi, RequestOptions$1 as vn, VideoPlaybackInfoSigned as vr, ImportReleaseAction as vt, ClientVariantConditions as w, _listen as wi, ResumableListenEventNames as wn, VideoSubtitleInfoPublic as wr, ListenParams as wt, ClientPerspective$1 as x, CollaborationCommentsListenOptions as xi, ResetEvent as xn, VideoRenditionInfoPublic as xr, ListenEvent as xt, ClientConfig$1 as y, CollaborationCommentTarget as yi, RequestUrlOptions as yn, VideoPlaybackTokens as yr, InitializedClientConfig$1 as yt, CreateReleaseAction as z, PatchTarget as zi, ScheduleReleaseAction as zn, MediaLibraryVideoClient as zr, MutationError as zt };
//# sourceMappingURL=types-BOJbTIy5.d.ts.map