@sanity/client 8.8.0 → 8.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1846,13 +1846,13 @@ interface paths {
1846
1846
  };
1847
1847
  /**
1848
1848
  * List knowledge bases
1849
- * @description Returns the organization's knowledge bases visible to the caller, cursor-paginated.
1849
+ * @description Returns the knowledge bases you can access in the organization set by `organizationId`. Results are cursor-paginated.
1850
1850
  */
1851
1851
  get: operations['listKnowledgeBases'];
1852
1852
  put?: never;
1853
1853
  /**
1854
1854
  * Create a knowledge base
1855
- * @description Creates a knowledge base bound to a Sanity dataset, where its content documents will be stored.
1855
+ * @description Creates a knowledge base in your organization. To add content to it, create an import.
1856
1856
  */
1857
1857
  post: operations['createKnowledgeBase'];
1858
1858
  delete?: never;
@@ -1870,21 +1870,21 @@ interface paths {
1870
1870
  };
1871
1871
  /**
1872
1872
  * Get a knowledge base
1873
- * @description Returns the knowledge base object: metadata and state. Resolves from the id alone, the public id (`kb...`) or the uuid; access is decided against the knowledge base's own organization, and an id the caller cannot read returns 404. For the built content, use the outline or entries endpoints.
1873
+ * @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.
1874
1874
  */
1875
1875
  get: operations['getKnowledgeBase'];
1876
1876
  put?: never;
1877
1877
  post?: never;
1878
1878
  /**
1879
1879
  * Delete a knowledge base
1880
- * @description Removes the knowledge base and everything it owns: sources, imports, revisions, the content documents in the bound dataset, and the stored source files. Returns 409 `buildInFlight` while a build, refresh, apply, or import is running, since that work would write files back after the delete; retry once it finishes.
1880
+ * @description Deletes the knowledge base and everything it owns: its sources, imports, revisions, stored source files, and its documents in your organization's document store. While a build, refresh, apply, or import is running, the request returns `409` with code `buildInFlight`. Retry after that work finishes.
1881
1881
  */
1882
1882
  delete: operations['deleteKnowledgeBase'];
1883
1883
  options?: never;
1884
1884
  head?: never;
1885
1885
  /**
1886
1886
  * Update a knowledge base
1887
- * @description Edits the name and description, or the recurring refresh controls (`refreshEnabled`, `refreshFrequency`). Refresh fields return 422 for knowledge bases with no web or dataset source. Disabling pauses the schedule; manual refresh still works.
1887
+ * @description Updates the title, the description, or the recurring refresh settings (`refreshEnabled` and `refreshFrequency`). Setting a refresh field on a knowledge base with no website or dataset source returns `422` with code `refreshControlsUnavailable`. Setting `refreshEnabled` to `false` pauses the schedule, and you can still start a refresh manually.
1888
1888
  */
1889
1889
  patch: operations['updateKnowledgeBase'];
1890
1890
  trace?: never;
@@ -1899,8 +1899,8 @@ interface paths {
1899
1899
  get?: never;
1900
1900
  put?: never;
1901
1901
  /**
1902
- * Trigger a knowledge base build
1903
- * @description Queues a build over the current corpus and returns a job id right away. If a build is already running, you get that job instead of a second one.
1902
+ * Start a knowledge base build
1903
+ * @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.
1904
1904
  */
1905
1905
  post: operations['buildKnowledgeBase'];
1906
1906
  delete?: never;
@@ -1919,8 +1919,8 @@ interface paths {
1919
1919
  get?: never;
1920
1920
  put?: never;
1921
1921
  /**
1922
- * Cancel an in-progress build
1923
- * @description Cancels the running build and resets the knowledge base so it can be rebuilt.
1922
+ * Cancel a knowledge base build
1923
+ * @description Cancels the running build and resets the knowledge base so you can build it again. Returns `cancelled: false` when no build is running.
1924
1924
  */
1925
1925
  post: operations['cancelKnowledgeBaseBuild'];
1926
1926
  delete?: never;
@@ -1940,7 +1940,7 @@ interface paths {
1940
1940
  put?: never;
1941
1941
  /**
1942
1942
  * Rebuild an entry from its sources
1943
- * @description Queues a re-write of the entry at this path from its cited sources and the active instructions, and returns a job id right away. The response also names the other entries citing any of the same sources: a source-tied rule affects every page citing that source, so those may change too.
1943
+ * @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 that cite any of the same sources. An instruction applies to every entry that cites its sources, so those entries can change too.
1944
1944
  */
1945
1945
  post: operations['rebuildEntry'];
1946
1946
  delete?: never;
@@ -1958,13 +1958,21 @@ interface paths {
1958
1958
  };
1959
1959
  /**
1960
1960
  * List imports
1961
- * @description Everything added to this knowledge base, one row per import: a file upload, web crawl, dataset bind, or inline text. Cursor-paginated. The sources each import produced live under `/sources`.
1961
+ * @description Lists everything added to a knowledge base, one item per import: a file upload, website crawl, Sanity dataset, or inline text. Results are cursor-paginated. To list the sources each import produced, use `GET .../sources`.
1962
1962
  */
1963
1963
  get: operations['listImports'];
1964
1964
  put?: never;
1965
1965
  /**
1966
- * Create an import (text, crawl, or dataset)
1967
- * @description Adds content, discriminated on `type`: `text` for inline content, `crawl` for a website, `dataset` for a GROQ-filtered Sanity dataset. Each variant queues processing and returns a job id to poll. For files, use `POST .../imports/uploads` instead. Re-adding an existing crawl url returns 409 `webSourceRootConflict`; exceeding the crawl root limit returns 409 `webSourceRootLimitExceeded`. Supports the `Idempotency-Key` header.
1966
+ * Create a text, crawl, or dataset import
1967
+ * @description Adds content to a knowledge base. Set `type` to choose what to import:
1968
+ *
1969
+ * - `text`: inline content
1970
+ * - `crawl`: a website
1971
+ * - `dataset`: documents from a Sanity dataset, selected by a GROQ filter
1972
+ *
1973
+ * Each import queues processing and returns a job ID to poll. To import a file, use `POST .../imports/uploads` instead.
1974
+ *
1975
+ * Adding a crawl URL that already exists returns `409` with code `webSourceRootConflict`. Adding more crawl URLs than your limit allows returns `409` with code `webSourceRootLimitExceeded`. Supports the `Idempotency-Key` header.
1968
1976
  */
1969
1977
  post: operations['createImport'];
1970
1978
  delete?: never;
@@ -1983,8 +1991,13 @@ interface paths {
1983
1991
  get?: never;
1984
1992
  put?: never;
1985
1993
  /**
1986
- * Start a file-upload import
1987
- * @description Creates a file-upload import and returns a single-use signed upload URL, valid for one hour. PUT the file bytes to it, then call `POST .../imports/uploads/{importId}/complete` to start ingestion. When `contentType` is set, the PUT must send the same `Content-Type` header; when omitted, the PUT may send any or none. An import that is not completed within 24 hours is deleted. The bytes never pass through this API. Supports the `Idempotency-Key` header.
1994
+ * Start a file upload
1995
+ * @description Creates a file import and returns a single-use signed upload URL that's valid for one hour. To finish the upload:
1996
+ *
1997
+ * 1. Send the file in a `PUT` request to the upload URL.
1998
+ * 2. Call `POST .../imports/uploads/{importId}/complete` to start processing.
1999
+ *
2000
+ * If you set `contentType`, the `PUT` request must send the same `Content-Type` header. If you omit it, the `PUT` request can send any `Content-Type` header or none. An import that isn't completed within 24 hours is deleted. Supports the `Idempotency-Key` header.
1988
2001
  */
1989
2002
  post: operations['startUpload'];
1990
2003
  delete?: never;
@@ -2003,8 +2016,8 @@ interface paths {
2003
2016
  get?: never;
2004
2017
  put?: never;
2005
2018
  /**
2006
- * Complete a file-upload import
2007
- * @description Call after the file bytes are uploaded to the signed URL. Starts processing and returns a job id to poll.
2019
+ * Complete a file upload
2020
+ * @description Starts processing a file after you upload it to the signed URL from `POST .../imports/uploads`. Returns a job ID to poll.
2008
2021
  */
2009
2022
  post: operations['completeUpload'];
2010
2023
  delete?: never;
@@ -2021,15 +2034,15 @@ interface paths {
2021
2034
  cookie?: never;
2022
2035
  };
2023
2036
  /**
2024
- * Get a single import
2025
- * @description Returns one import with its kind and processing status.
2037
+ * Get an import
2038
+ * @description Returns an import with its `sourceKind` and processing `status`.
2026
2039
  */
2027
2040
  get: operations['getImport'];
2028
2041
  put?: never;
2029
2042
  post?: never;
2030
2043
  /**
2031
2044
  * Delete an import
2032
- * @description Removes the import and every source it produced, and cancels its ingest if one is still running. Use it to discard something added by mistake.
2045
+ * @description Deletes the import and every source it produced, and cancels its processing if it is still running. Use it to remove content you added by mistake.
2033
2046
  */
2034
2047
  delete: operations['deleteImport'];
2035
2048
  options?: never;
@@ -2046,7 +2059,7 @@ interface paths {
2046
2059
  };
2047
2060
  /**
2048
2061
  * Get a download URL for an import
2049
- * @description Mints a short-lived signed URL serving the import's original bytes as an attachment. Use it before `expiresAt`; the bytes never pass through this API. Only file and text imports carry original bytes; crawls and dataset binds return 409 `importInvalidState`.
2062
+ * @description Returns a short-lived signed URL that downloads the import's original content. Use the URL before `expiresAt`. Only file and text imports keep their original content. For crawl and dataset imports, the request returns `409` with code `importInvalidState`.
2050
2063
  */
2051
2064
  get: operations['downloadImport'];
2052
2065
  put?: never;
@@ -2067,8 +2080,8 @@ interface paths {
2067
2080
  get?: never;
2068
2081
  put?: never;
2069
2082
  /**
2070
- * Author a human instruction
2071
- * @description Creates a standing rule for how entries citing its sources are written. Tie it to one or more sources with `scopeSourceIds`; every rule is source-tied. Pass `rebuildPaths` to immediately rebuild those entries under the new rule; the response carries the rebuild job id, or null when the rebuild could not start (the rule is saved either way). Pass `verified` after a completed synchronous contradiction check to skip the background one; if the requested rebuild fails to start, the background check runs anyway so the contradicting pages get filed as issues.
2083
+ * Create an instruction
2084
+ * @description Creates a standing instruction for how entries that cite its sources are written. Every instruction applies to specific sources, set in `scopeSourceIds`. 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.
2072
2085
  */
2073
2086
  post: operations['createInstruction'];
2074
2087
  delete?: never;
@@ -2089,14 +2102,14 @@ interface paths {
2089
2102
  post?: never;
2090
2103
  /**
2091
2104
  * Delete an instruction
2092
- * @description Deletes the rule. Builds stop honoring it from the next run.
2105
+ * @description Deletes the instruction. Builds stop applying it from the next run.
2093
2106
  */
2094
2107
  delete: operations['deleteInstruction'];
2095
2108
  options?: never;
2096
2109
  head?: never;
2097
2110
  /**
2098
- * Edit an instruction
2099
- * @description Edits the statement or scope. The change applies from the next build. Any edit re-affirms the rule: an archived rule returns to active, re-anchored to the sources' current content.
2111
+ * Update an instruction
2112
+ * @description Updates the instruction's statement or sources. The change applies from the next build. Any update also reactivates an archived instruction and ties it to the current content of its sources.
2100
2113
  */
2101
2114
  patch: operations['updateInstruction'];
2102
2115
  trace?: never;
@@ -2111,8 +2124,8 @@ interface paths {
2111
2124
  get?: never;
2112
2125
  put?: never;
2113
2126
  /**
2114
- * Apply accepted issues to a Context
2115
- * @description Queues a job that applies accepted issues, rewrites the affected entries, and commits a new revision. Returns a job id. Issue ids that no longer exist are skipped.
2127
+ * Accept and apply issues
2128
+ * @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.
2116
2129
  */
2117
2130
  post: operations['applyIssues'];
2118
2131
  delete?: never;
@@ -2132,7 +2145,7 @@ interface paths {
2132
2145
  put?: never;
2133
2146
  /**
2134
2147
  * Dismiss an issue
2135
- * @description Marks the issue rejected. Idempotent: dismissing an issue that already left the queue returns it as-is. 422 `issueDocumentInvalid` when the document was hand-edited into an unverifiable shape; 409 `issueTransitionConflict` on a concurrent edit, safe to retry.
2148
+ * @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`.
2136
2149
  */
2137
2150
  post: operations['dismissIssue'];
2138
2151
  delete?: never;
@@ -2152,7 +2165,7 @@ interface paths {
2152
2165
  put?: never;
2153
2166
  /**
2154
2167
  * Reopen an accepted conflict
2155
- * @description Returns an accepted conflict to triage, clearing its resolution and deleting the instruction it minted. Idempotent for issues that are not accepted conflicts.
2168
+ * @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`.
2156
2169
  */
2157
2170
  post: operations['reopenIssue'];
2158
2171
  delete?: never;
@@ -2172,7 +2185,7 @@ interface paths {
2172
2185
  put?: never;
2173
2186
  /**
2174
2187
  * Resolve a conflict issue
2175
- * @description Settles a conflict by choosing a side: `resolution` is an index into `content.sides`. Index 0 of a per-entry conflict is the entry's own position, so choosing it keeps the body; any other side rewrites the entry (the returned `jobId` tracks it). Only conflict issues are resolvable, and a dismissed issue must be reopened first. The decision becomes a standing instruction for every future build; `resolvedBy` records who decided.
2188
+ * @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`.
2176
2189
  */
2177
2190
  post: operations['resolveIssue'];
2178
2191
  delete?: never;
@@ -2189,8 +2202,8 @@ interface paths {
2189
2202
  cookie?: never;
2190
2203
  };
2191
2204
  /**
2192
- * Get a job by id
2193
- * @description Returns the status of a job, such as a build, an import, or a refresh. Job ids come from the endpoint that queued the work.
2205
+ * Get a job
2206
+ * @description Returns the status of a background job, such as a build, import, or refresh. The endpoint that starts the work returns the job ID.
2194
2207
  */
2195
2208
  get: operations['getJob'];
2196
2209
  put?: never;
@@ -2211,8 +2224,8 @@ interface paths {
2211
2224
  get?: never;
2212
2225
  put?: never;
2213
2226
  /**
2214
- * Trigger an incremental refresh
2215
- * @description Queues a refresh: recrawls each web source, diffs the corpus against the last build, and files change issues. Returns a job id, with `started: false` when a refresh was already in flight. Supports the `Idempotency-Key` header.
2227
+ * Refresh a knowledge base
2228
+ * @description Queues a refresh that recrawls website sources, re-syncs dataset sources, compares the result with the last build, and files issues for what changed. Returns a job ID. If a refresh is already running, the response has `started: false` and that refresh's job ID. Supports the `Idempotency-Key` header.
2216
2229
  */
2217
2230
  post: operations['refreshKnowledgeBase'];
2218
2231
  delete?: never;
@@ -2230,7 +2243,7 @@ interface paths {
2230
2243
  };
2231
2244
  /**
2232
2245
  * List sources
2233
- * @description The distilled units builds cite: the pages, files, and documents your imports expanded into. Read-only; add content via `/imports`. Cursor-paginated, filter by `status`.
2246
+ * @description Lists the sources in a knowledge base: the pages, files, and documents that imports produce and builds cite. Sources are read-only. To add content, create an import. Results are cursor-paginated, and you can filter them by `status`.
2234
2247
  */
2235
2248
  get: operations['listSources'];
2236
2249
  put?: never;
@@ -2249,15 +2262,15 @@ interface paths {
2249
2262
  cookie?: never;
2250
2263
  };
2251
2264
  /**
2252
- * Get a single source
2253
- * @description Returns one source with its metadata and processing status.
2265
+ * Get a source
2266
+ * @description Returns a source with its metadata and processing status.
2254
2267
  */
2255
2268
  get: operations['getSource'];
2256
2269
  put?: never;
2257
2270
  post?: never;
2258
2271
  /**
2259
2272
  * Delete a source
2260
- * @description Removes the source immediately. Entries are not modified here — citations to it are cleaned up by the next build or check for changes, where entries left without sources become removal proposals. Human-edited entries are never modified.
2273
+ * @description Deletes the source immediately. Entries that cite it stay the same until the next build or refresh, which removes the citations and proposes removing any entry left with no sources.
2261
2274
  */
2262
2275
  delete: operations['deleteSource'];
2263
2276
  options?: never;
@@ -2273,8 +2286,8 @@ interface paths {
2273
2286
  cookie?: never;
2274
2287
  };
2275
2288
  /**
2276
- * Read a source's distilled content
2277
- * @description The distilled markdown builds cite, the same text the pipeline itself reads. Use it to verify an issue's claims against the sources its `citedSourceIds` name. Optional `startLine` and `endLine` (1-indexed, inclusive) fetch just a span. JSON by default; `?format=markdown` returns the raw text. 409 `sourceNotDistilled` until distillation has produced content.
2289
+ * Get a source's distilled content
2290
+ * @description Returns the source's distilled content: the markdown extracted from the original page, file, or document, which is the text builds cite. Use it to check an issue's claims against the sources listed in its `citedSourceIds`. To fetch a range of lines, set `startLine` and `endLine` (1-indexed, inclusive). The response is JSON by default. Set `format` to `markdown` or `plain` to get the text alone. Until the source finishes processing, the request returns `409` with code `sourceNotDistilled`.
2278
2291
  */
2279
2292
  get: operations['getSourceContent'];
2280
2293
  put?: never;
@@ -2295,7 +2308,13 @@ interface paths {
2295
2308
  get?: never;
2296
2309
  /**
2297
2310
  * Record a conversation
2298
- * @description Upserts the conversation telemetry for one thread. `threadId` identifies the conversation within your organization — reuse means the same conversation. Messages replace the stored transcript wholesale; `metadata`, `sharing`, and model fields only overwrite when present. `tokenUsage` accumulates: each save reports one generation call and the stored value is the conversation total, added only when the save changes the transcript so retries never double-count. Report a failure as `error` on the message where it happened: a tool result for a failed tool call, an assistant message for a turn that failed instead of answering. The dashboard highlights conversations with a failed turn and counts failed tool calls separately, since agents often recover from one. Last write per thread wins — retries are safe. `sharing` records your opt-in to share telemetry with Sanity: metadata-only metrics, or full transcripts.
2311
+ * @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.
2312
+ *
2313
+ * 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.
2314
+ *
2315
+ * 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.
2316
+ *
2317
+ * The last write for a thread wins, so retries are safe. `sharing` records whether you share telemetry with Sanity: metrics only, or full transcripts.
2299
2318
  */
2300
2319
  put: operations['saveConversation'];
2301
2320
  post?: never;
@@ -2303,8 +2322,13 @@ interface paths {
2303
2322
  options?: never;
2304
2323
  head?: never;
2305
2324
  /**
2306
- * Record a classification verdict
2307
- * @description Records the classification your own model produced for one thread: exactly one of `coreMetrics` (a verdict — the server stamps `classifiedAt` and clears any recorded failure) or `classificationError` (why classification failed; an earlier verdict stays untouched). No revision guard — like the ingest upsert the writer is an automated classifier, so last write wins and a re-classification simply overwrites.
2325
+ * Record a conversation classification
2326
+ * @description Records the classification your own model produced for one thread. Send exactly one of these fields:
2327
+ *
2328
+ * - `coreMetrics`: the classification result. The API sets `classifiedAt` and clears any recorded failure.
2329
+ * - `classificationError`: why classification failed. Any earlier result stays unchanged.
2330
+ *
2331
+ * Requires the same access as recording a conversation. The last write wins, so a new classification replaces the previous one.
2308
2332
  */
2309
2333
  patch: operations['classifyConversation'];
2310
2334
  trace?: never;
@@ -2312,91 +2336,162 @@ interface paths {
2312
2336
  }
2313
2337
  interface components {
2314
2338
  schemas: {
2315
- /** @description A `sanity.context.conversation` document, one agent conversation transcript with its classification, stored in the organization store. Not returned by any endpoint raw; published so GROQ reads can be typed. Write through the conversation ingest and classify endpoints, never with a raw client. */
2339
+ /** @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. */
2316
2340
  ConversationDoc: {
2341
+ /** @description The document ID. */
2317
2342
  _id: string;
2343
+ /** @description The document revision. It changes on every write. */
2318
2344
  _rev: string;
2319
- /** Format: date-time */
2345
+ /**
2346
+ * Format: date-time
2347
+ * @description When the document was created, as an ISO 8601 timestamp.
2348
+ */
2320
2349
  _createdAt: string;
2321
- /** Format: date-time */
2350
+ /**
2351
+ * Format: date-time
2352
+ * @description When the document was last changed, as an ISO 8601 timestamp.
2353
+ */
2322
2354
  _updatedAt: string;
2323
- /** @enum {string} */
2355
+ /**
2356
+ * @description The document type. Always `sanity.context.conversation`.
2357
+ * @enum {string}
2358
+ */
2324
2359
  _type: 'sanity.context.conversation';
2325
- /** @enum {number} */
2360
+ /**
2361
+ * @description The version of the document shape. Currently `1`.
2362
+ * @enum {number}
2363
+ */
2326
2364
  schemaVersion: 1;
2365
+ /** @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. */
2327
2366
  organizationId: string;
2367
+ /** @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`. */
2328
2368
  threadId: string;
2329
- /** @description ConversationMetadata */
2369
+ /** @description Tags that describe the conversation, such as `mcpEndpoints`, `app`, and `environment`. Filter on them in GROQ queries. `null` until a save includes `metadata`. */
2330
2370
  metadata: {
2331
2371
  [key: string]: string | string[];
2332
2372
  } | null;
2333
- /** Format: date-time */
2373
+ /**
2374
+ * Format: date-time
2375
+ * @description When the API received the first save for this thread, as an ISO 8601 timestamp.
2376
+ */
2334
2377
  startedAt: string;
2335
- /** Format: date-time */
2378
+ /**
2379
+ * Format: date-time
2380
+ * @description When the conversation was last saved, as an ISO 8601 timestamp.
2381
+ */
2336
2382
  messagesUpdatedAt: string;
2383
+ /** @description The conversation transcript, in order. Each save replaces it. */
2337
2384
  messages: {
2338
- /** @enum {string} */
2385
+ /**
2386
+ * @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.
2387
+ * @enum {string}
2388
+ */
2339
2389
  role: 'user' | 'assistant' | 'system' | 'tool';
2340
- /** @default null */
2390
+ /**
2391
+ * @description The message text. `null` when the message has no text, such as a tool call.
2392
+ * @default null
2393
+ */
2341
2394
  content: string | null;
2342
- /** @default null */
2395
+ /**
2396
+ * @description The name of the tool for a `tool` message. `null` on other messages.
2397
+ * @default null
2398
+ */
2343
2399
  toolName: string | null;
2344
2400
  /**
2401
+ * @description The kind of `tool` message. `call` is the agent calling the tool, and `result` is what the tool returned. `null` on other messages.
2345
2402
  * @default null
2346
2403
  * @enum {string|null}
2347
2404
  */
2348
2405
  toolType: 'call' | 'result' | null;
2349
- /** @default null */
2406
+ /**
2407
+ * @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.
2408
+ * @default null
2409
+ */
2350
2410
  error: string | null;
2351
2411
  /**
2352
2412
  * Format: date-time
2413
+ * @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.
2353
2414
  * @default null
2354
2415
  */
2355
2416
  timestamp: string | null;
2356
2417
  }[];
2418
+ /** @description The provider of the model the agent used. `null` until a save includes `modelProvider`. */
2357
2419
  modelProvider: string | null;
2420
+ /** @description The ID of the model the agent used. `null` until a save includes `modelId`. */
2358
2421
  modelId: string | null;
2359
- /** @description ConversationTokenUsage */
2422
+ /** @description The running total of token usage for the conversation. `null` until a save includes `tokenUsage`. */
2360
2423
  tokenUsage: {
2424
+ /** @description The number of input tokens. */
2361
2425
  inputTokens?: number;
2426
+ /** @description The number of output tokens. */
2362
2427
  outputTokens?: number;
2428
+ /** @description The total number of tokens. */
2363
2429
  totalTokens?: number;
2364
2430
  } | null;
2365
- /** @description ConversationCoreMetrics */
2431
+ /** @description The latest classification result. `null` until you record one. */
2366
2432
  coreMetrics: {
2433
+ /** @description How well the agent resolved the user's needs, from 1 to 10. */
2367
2434
  successScore?: number;
2368
- /** @enum {string} */
2435
+ /**
2436
+ * @description The overall sentiment of the conversation.
2437
+ * @enum {string}
2438
+ */
2369
2439
  sentiment?: 'positive' | 'neutral' | 'negative';
2440
+ /** @description Topics the agent couldn't answer because it lacked content. */
2370
2441
  contentGaps?: string[];
2371
2442
  } | null;
2372
- /** Format: date-time */
2443
+ /**
2444
+ * Format: date-time
2445
+ * @description When the latest classification result was recorded, as an ISO 8601 timestamp. The API sets it. `null` until you record a result.
2446
+ */
2373
2447
  classifiedAt: string | null;
2448
+ /** @description Why your classifier couldn't classify the conversation. `null` when no failure is recorded. Recording a result clears it. */
2374
2449
  classificationError: string | null;
2375
2450
  /**
2376
- * @description ConversationSharing
2451
+ * @description Your choice to share conversation telemetry with Sanity. `null` until a save includes `sharing`.
2377
2452
  * @default null
2378
2453
  */
2379
2454
  sharing: {
2455
+ /** @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. */
2380
2456
  metrics?: boolean;
2457
+ /** @description Whether to share full conversation transcripts with Sanity. When `true`, the API also sets `metrics` to `true`. */
2381
2458
  conversations?: boolean;
2459
+ /** @description How the Sanity team can reach you about your agent, such as an email address or a Discord handle. */
2382
2460
  contact?: string;
2383
2461
  } | null;
2384
2462
  };
2385
- /** @description A `sanity.context.entry` document, one outline node stored in the bound dataset. Not returned by any endpoint; published so GROQ reads against the dataset can be typed. The entries endpoints serve the validated wire view. */
2463
+ /** @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. */
2386
2464
  EntryDoc: {
2465
+ /** @description The document ID. */
2387
2466
  _id: string;
2467
+ /** @description The document revision. It changes on every write. */
2388
2468
  _rev: string;
2389
- /** Format: date-time */
2469
+ /**
2470
+ * Format: date-time
2471
+ * @description When the document was created, as an ISO 8601 timestamp.
2472
+ */
2390
2473
  _createdAt: string;
2391
- /** Format: date-time */
2474
+ /**
2475
+ * Format: date-time
2476
+ * @description When the document was last changed, as an ISO 8601 timestamp.
2477
+ */
2392
2478
  _updatedAt: string;
2479
+ /** @description The ID (`kb…`) of the knowledge base this document belongs to. */
2393
2480
  knowledgeBaseId: string;
2394
- /** @enum {string} */
2481
+ /**
2482
+ * @description The document type. Always `sanity.context.entry`.
2483
+ * @enum {string}
2484
+ */
2395
2485
  _type: 'sanity.context.entry';
2486
+ /** @description The version of the document shape. Currently `1`. */
2396
2487
  schemaVersion: number;
2488
+ /** @description The ID of the build that last wrote this entry's content. An unchanged entry keeps its earlier value across builds. */
2397
2489
  revisionId: string;
2490
+ /** @description The entry's slash-delimited path, such as `docs/api/webhooks`. Order entries by `path` to get the knowledge base outline. */
2398
2491
  path: string;
2492
+ /** @description The entry title. */
2399
2493
  title: string;
2494
+ /** @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. `centrality` is how important the entry is: `core`, `standard`, or `peripheral`. */
2400
2495
  tldr?: {
2401
2496
  scope: string;
2402
2497
  excludes: string;
@@ -2404,297 +2499,599 @@ interface components {
2404
2499
  /** @enum {string} */
2405
2500
  centrality: 'core' | 'standard' | 'peripheral';
2406
2501
  };
2502
+ /** @description The entry content in Markdown, with inline `[N]` citation markers. Absent when the entry has no content of its own, such as a `virtual` entry. */
2407
2503
  body?: string;
2504
+ /** @description The H2 and H3 heading titles in `body`. Absent when the entry has no `body`. */
2408
2505
  topicHeadings?: string[];
2506
+ /** @description The sources that back this entry, one item per source. */
2409
2507
  citations?: {
2508
+ /** @description ID of the cited source. */
2410
2509
  sourceId: string;
2510
+ /** @description Which facts in the entry body this source backs, in a short phrase. */
2411
2511
  supports?: string;
2512
+ /** @description Line ranges in the source's distilled content that back those facts, with the quoted text. */
2412
2513
  spans?: {
2514
+ /** @description First line of the range, counting from 1. Line numbers match `GET .../sources/{sourceId}/content`. */
2413
2515
  sourceLineStart: number;
2516
+ /** @description Last line of the range, inclusive. */
2414
2517
  sourceLineEnd: number;
2518
+ /** @description The exact text of the line range in the source. */
2415
2519
  quote: string;
2416
2520
  }[];
2521
+ /** @description The text in the entry body that this citation backs. */
2417
2522
  claim?: {
2523
+ /** @description The exact entry text the citation backs. */
2418
2524
  exact: string;
2525
+ /** @description Text immediately before `exact`, to tell apart repeated phrases. */
2419
2526
  prefix?: string;
2527
+ /** @description Text immediately after `exact`, to tell apart repeated phrases. */
2420
2528
  suffix?: string;
2421
2529
  };
2422
2530
  /** @enum {string} */
2423
2531
  groundingState?: 'drifted';
2532
+ /** @description A unique key for this item in the `citations` array. */
2424
2533
  _key: string;
2425
- /** @enum {string} */
2534
+ /**
2535
+ * @description The citation type. Always `sanity.context.citation`.
2536
+ * @enum {string}
2537
+ */
2426
2538
  _type: 'sanity.context.citation';
2539
+ /** @description A display name for the cited source. Builds currently set it to the `sourceId`. */
2427
2540
  filename: string;
2428
2541
  mime?: string;
2429
2542
  excerpt?: string;
2430
2543
  }[];
2431
- /** @enum {string} */
2544
+ /**
2545
+ * @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.
2546
+ * @enum {string}
2547
+ */
2432
2548
  status: 'virtual' | 'outlined' | 'filled' | 'stale' | 'generation_failed';
2549
+ /** @description When the build that last wrote this entry's content ran, as an ISO 8601 timestamp. */
2433
2550
  generatedAt: string;
2434
2551
  };
2435
- /** @description A `sanity.context.instruction` document, a standing decision steering every build, stored in the bound dataset. Not returned by any endpoint; published so GROQ reads against the dataset can be typed. Write through the instructions endpoints, never with a raw client. */
2552
+ /** @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. */
2436
2553
  InstructionDoc: {
2554
+ /** @description The document ID. */
2437
2555
  _id: string;
2556
+ /** @description The document revision. It changes on every write. */
2438
2557
  _rev: string;
2439
- /** Format: date-time */
2558
+ /**
2559
+ * Format: date-time
2560
+ * @description When the document was created, as an ISO 8601 timestamp.
2561
+ */
2440
2562
  _createdAt: string;
2441
- /** Format: date-time */
2563
+ /**
2564
+ * Format: date-time
2565
+ * @description When the document was last changed, as an ISO 8601 timestamp.
2566
+ */
2442
2567
  _updatedAt: string;
2568
+ /** @description The ID (`kb…`) of the knowledge base this document belongs to. */
2443
2569
  knowledgeBaseId: string;
2444
- /** @enum {string} */
2570
+ /**
2571
+ * @description The document type. Always `sanity.context.instruction`.
2572
+ * @enum {string}
2573
+ */
2445
2574
  _type: 'sanity.context.instruction';
2446
- /** @enum {number} */
2575
+ /**
2576
+ * @description The version of the document shape. Currently `1`. An instruction without the current version doesn't appear in lists and doesn't affect builds.
2577
+ * @enum {number}
2578
+ */
2447
2579
  schemaVersion: 1;
2580
+ /** @description The instruction, in plain language. Builds follow it over the raw sources. */
2448
2581
  statement: string;
2582
+ /** @description The sources the instruction is tied to. The instruction affects the entries that cite these sources. The API always sets at least one source. When `null`, the instruction isn't tied to any source and doesn't affect builds. */
2449
2583
  scopeSources: {
2584
+ /** @description A unique key for this item in the array. It matches `sourceId`. */
2450
2585
  _key: string;
2586
+ /** @description The ID of the source the instruction is tied to. */
2451
2587
  sourceId: string;
2588
+ /** @description The source's content hash when the instruction was last checked against it. When the source content changes, the instruction is checked again. */
2452
2589
  contentHash: string;
2453
2590
  }[] | null;
2454
- /** @enum {string} */
2591
+ /**
2592
+ * @description The instruction state. `active` instructions apply to every build. `archived` instructions don't apply: a source changed and no longer supports the instruction. Editing an archived instruction makes it `active` again.
2593
+ * @enum {string}
2594
+ */
2455
2595
  status: 'active' | 'archived';
2596
+ /** @description When the instruction was archived, as an ISO 8601 timestamp. `null` while `active`. */
2456
2597
  archivedAt: string | null;
2598
+ /** @description Why the instruction was archived. `null` while `active`. */
2457
2599
  archivedReason: string | null;
2458
- /** @enum {string} */
2600
+ /**
2601
+ * @description Where the instruction came from. `conflict` means it was created when you resolved a conflict issue.
2602
+ * @enum {string}
2603
+ */
2459
2604
  origin: 'conflict';
2605
+ /** @description The `_id` of the conflict issue this instruction resolved. Reopening that issue deletes this instruction. */
2460
2606
  sourceIssueId: string;
2461
2607
  } | {
2608
+ /** @description The document ID. */
2462
2609
  _id: string;
2610
+ /** @description The document revision. It changes on every write. */
2463
2611
  _rev: string;
2464
- /** Format: date-time */
2612
+ /**
2613
+ * Format: date-time
2614
+ * @description When the document was created, as an ISO 8601 timestamp.
2615
+ */
2465
2616
  _createdAt: string;
2466
- /** Format: date-time */
2617
+ /**
2618
+ * Format: date-time
2619
+ * @description When the document was last changed, as an ISO 8601 timestamp.
2620
+ */
2467
2621
  _updatedAt: string;
2622
+ /** @description The ID (`kb…`) of the knowledge base this document belongs to. */
2468
2623
  knowledgeBaseId: string;
2469
- /** @enum {string} */
2624
+ /**
2625
+ * @description The document type. Always `sanity.context.instruction`.
2626
+ * @enum {string}
2627
+ */
2470
2628
  _type: 'sanity.context.instruction';
2471
- /** @enum {number} */
2629
+ /**
2630
+ * @description The version of the document shape. Currently `1`. An instruction without the current version doesn't appear in lists and doesn't affect builds.
2631
+ * @enum {number}
2632
+ */
2472
2633
  schemaVersion: 1;
2634
+ /** @description The instruction, in plain language. Builds follow it over the raw sources. */
2473
2635
  statement: string;
2636
+ /** @description The sources the instruction is tied to. The instruction affects the entries that cite these sources. The API always sets at least one source. When `null`, the instruction isn't tied to any source and doesn't affect builds. */
2474
2637
  scopeSources: {
2638
+ /** @description A unique key for this item in the array. It matches `sourceId`. */
2475
2639
  _key: string;
2640
+ /** @description The ID of the source the instruction is tied to. */
2476
2641
  sourceId: string;
2642
+ /** @description The source's content hash when the instruction was last checked against it. When the source content changes, the instruction is checked again. */
2477
2643
  contentHash: string;
2478
2644
  }[] | null;
2479
- /** @enum {string} */
2645
+ /**
2646
+ * @description The instruction state. `active` instructions apply to every build. `archived` instructions don't apply: a source changed and no longer supports the instruction. Editing an archived instruction makes it `active` again.
2647
+ * @enum {string}
2648
+ */
2480
2649
  status: 'active' | 'archived';
2650
+ /** @description When the instruction was archived, as an ISO 8601 timestamp. `null` while `active`. */
2481
2651
  archivedAt: string | null;
2652
+ /** @description Why the instruction was archived. `null` while `active`. */
2482
2653
  archivedReason: string | null;
2483
- /** @enum {string} */
2654
+ /**
2655
+ * @description Where the instruction came from. `human` means it was created directly through the API or the dashboard.
2656
+ * @enum {string}
2657
+ */
2484
2658
  origin: 'human';
2485
- /** @enum {string|null} */
2659
+ /**
2660
+ * @description Always `null` for a `human` instruction.
2661
+ * @enum {string|null}
2662
+ */
2486
2663
  sourceIssueId: null;
2487
2664
  };
2488
- /** @description A `sanity.context.issue` document, a build finding awaiting triage, stored in the bound dataset. Not returned by any endpoint; published so GROQ reads and trigger filters can be typed. Status transitions flow through the issues endpoints, which own the state machine. One invariant the schema cannot express: only a `conflict` issue ever carries a non-null `resolution`. */
2665
+ /** @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`. */
2489
2666
  IssueDoc: {
2667
+ /** @description The document ID. */
2490
2668
  _id: string;
2669
+ /** @description The document revision. It changes on every write. */
2491
2670
  _rev: string;
2492
- /** Format: date-time */
2671
+ /**
2672
+ * Format: date-time
2673
+ * @description When the document was created, as an ISO 8601 timestamp.
2674
+ */
2493
2675
  _createdAt: string;
2494
- /** Format: date-time */
2676
+ /**
2677
+ * Format: date-time
2678
+ * @description When the document was last changed, as an ISO 8601 timestamp.
2679
+ */
2495
2680
  _updatedAt: string;
2681
+ /** @description The ID (`kb…`) of the knowledge base this document belongs to. */
2496
2682
  knowledgeBaseId: string;
2497
- /** @enum {string} */
2683
+ /**
2684
+ * @description The document type. Always `sanity.context.issue`.
2685
+ * @enum {string}
2686
+ */
2498
2687
  _type: 'sanity.context.issue';
2499
- /** @enum {number} */
2688
+ /**
2689
+ * @description The version of the document shape. Currently `1`.
2690
+ * @enum {number}
2691
+ */
2500
2692
  schemaVersion: 1;
2501
- /** @description IssueContent */
2693
+ /** @description What an issue found. The shape depends on `kind`. */
2502
2694
  content: {
2503
- /** @enum {string} */
2695
+ /**
2696
+ * @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.
2697
+ * @enum {string}
2698
+ */
2504
2699
  severity: 'critical' | 'suggestion';
2700
+ /** @description Path of the entry the issue is about, or `*` when it applies to the whole knowledge base. For `add_entry`, the path of the proposed entry. */
2505
2701
  scopePath: string;
2702
+ /** @description What the problem is, in one or two sentences. */
2506
2703
  issue: string;
2704
+ /** @description What to do to fix the issue. */
2507
2705
  suggestedFix: string;
2508
- /** @enum {string} */
2706
+ /**
2707
+ * @description The issue type. `conflict` means two or more positions disagree on the same fact, and you choose which one is correct.
2708
+ * @enum {string}
2709
+ */
2509
2710
  kind: 'conflict';
2711
+ /** @description A key naming the disputed fact, such as `free_tier.request_limit`. It never includes the disputed value, so every side shares it. */
2510
2712
  claimKey: string;
2713
+ /** @description The conflicting positions, at least two. To resolve the conflict, pass the index of one side as `resolution`. */
2511
2714
  sides: {
2715
+ /** @description The position as a self-contained sentence. This is the option you choose from. */
2512
2716
  claim: string;
2717
+ /** @description The disputed value on its own, such as `10,000/month`, without the sentence. */
2513
2718
  value?: string;
2719
+ /** @description Paths of the entries that state this position. */
2514
2720
  entryPaths?: string[];
2721
+ /** @description IDs of the sources that directly back this position. */
2515
2722
  sourceIds?: string[];
2516
- /** @description ConflictSpan */
2723
+ /** @description Where in a source this position was read. */
2517
2724
  span?: {
2725
+ /** @description ID of the source the position was read from. */
2518
2726
  sourceId: string;
2727
+ /** @description First line of the range, counting from 1. Line numbers match `GET .../sources/{sourceId}/content`. */
2519
2728
  lineStart: number;
2729
+ /** @description Last line of the range, inclusive. */
2520
2730
  lineEnd: number;
2521
2731
  };
2522
- /** @enum {string} */
2732
+ /**
2733
+ * @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.
2734
+ * @enum {string}
2735
+ */
2523
2736
  authority?: 'primary' | 'secondary' | 'community';
2524
2737
  }[];
2738
+ /** @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. */
2525
2739
  suggested?: number;
2526
2740
  } | {
2527
- /** @enum {string} */
2741
+ /**
2742
+ * @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.
2743
+ * @enum {string}
2744
+ */
2528
2745
  severity: 'critical' | 'suggestion';
2746
+ /** @description Path of the entry the issue is about, or `*` when it applies to the whole knowledge base. For `add_entry`, the path of the proposed entry. */
2529
2747
  scopePath: string;
2748
+ /** @description What the problem is, in one or two sentences. */
2530
2749
  issue: string;
2750
+ /** @description What to do to fix the issue. */
2531
2751
  suggestedFix: string;
2532
- /** @enum {string} */
2752
+ /**
2753
+ * @description The issue type. `gap`: your sources cover material that entries leave out. `update_required`: an entry is out of date with its sources or contradicts an instruction, and needs a rewrite. `add_entry`: your sources cover a topic that no entry covers. `remove_entry`: an entry has lost its sources or its topic no longer applies. `split_entry`: an entry covers several distinct topics and should become child entries. `merge_entry`: an entry has too few sources to stand alone, so merge it into a nearby entry or keep it as it is.
2754
+ * @enum {string}
2755
+ */
2533
2756
  kind: 'gap' | 'update_required' | 'add_entry' | 'remove_entry' | 'split_entry' | 'merge_entry';
2757
+ /** @description IDs of the sources that led to the issue. For `add_entry`, the sources the new entry would cite. */
2534
2758
  citedSourceIds?: string[];
2759
+ /** @description A key naming the specific finding, when the check that found it sets one. */
2535
2760
  claimKey?: string;
2761
+ /** @description Paths of the entries the issue involves, when it spans more than one entry. */
2536
2762
  involvedScopes?: string[];
2537
2763
  };
2764
+ /** @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. */
2538
2765
  fingerprint: string;
2766
+ /** @description The ID of the build that filed this issue. `null` when the issue was filed outside a build, such as when removing a source leaves an entry without sources. */
2539
2767
  revisionId: string | null;
2540
- /** @enum {string} */
2768
+ /**
2769
+ * @description The issue status. `open` means it is waiting for triage.
2770
+ * @enum {string}
2771
+ */
2541
2772
  status: 'open';
2542
- /** @enum {string|null} */
2773
+ /**
2774
+ * @description Always `null` while the issue is `open`.
2775
+ * @enum {string|null}
2776
+ */
2543
2777
  resolution: null;
2544
- /** @enum {string|null} */
2778
+ /**
2779
+ * @description Always `null` while the issue is `open`.
2780
+ * @enum {string|null}
2781
+ */
2545
2782
  resolvedAt: null;
2546
- /** @enum {string|null} */
2783
+ /**
2784
+ * @description Always `null` while the issue is `open`.
2785
+ * @enum {string|null}
2786
+ */
2547
2787
  resolvedBy: null;
2548
2788
  } | {
2789
+ /** @description The document ID. */
2549
2790
  _id: string;
2791
+ /** @description The document revision. It changes on every write. */
2550
2792
  _rev: string;
2551
- /** Format: date-time */
2793
+ /**
2794
+ * Format: date-time
2795
+ * @description When the document was created, as an ISO 8601 timestamp.
2796
+ */
2552
2797
  _createdAt: string;
2553
- /** Format: date-time */
2798
+ /**
2799
+ * Format: date-time
2800
+ * @description When the document was last changed, as an ISO 8601 timestamp.
2801
+ */
2554
2802
  _updatedAt: string;
2803
+ /** @description The ID (`kb…`) of the knowledge base this document belongs to. */
2555
2804
  knowledgeBaseId: string;
2556
- /** @enum {string} */
2805
+ /**
2806
+ * @description The document type. Always `sanity.context.issue`.
2807
+ * @enum {string}
2808
+ */
2557
2809
  _type: 'sanity.context.issue';
2558
- /** @enum {number} */
2810
+ /**
2811
+ * @description The version of the document shape. Currently `1`.
2812
+ * @enum {number}
2813
+ */
2559
2814
  schemaVersion: 1;
2560
- /** @description IssueContent */
2815
+ /** @description What an issue found. The shape depends on `kind`. */
2561
2816
  content: {
2562
- /** @enum {string} */
2817
+ /**
2818
+ * @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.
2819
+ * @enum {string}
2820
+ */
2563
2821
  severity: 'critical' | 'suggestion';
2822
+ /** @description Path of the entry the issue is about, or `*` when it applies to the whole knowledge base. For `add_entry`, the path of the proposed entry. */
2564
2823
  scopePath: string;
2824
+ /** @description What the problem is, in one or two sentences. */
2565
2825
  issue: string;
2826
+ /** @description What to do to fix the issue. */
2566
2827
  suggestedFix: string;
2567
- /** @enum {string} */
2828
+ /**
2829
+ * @description The issue type. `conflict` means two or more positions disagree on the same fact, and you choose which one is correct.
2830
+ * @enum {string}
2831
+ */
2568
2832
  kind: 'conflict';
2833
+ /** @description A key naming the disputed fact, such as `free_tier.request_limit`. It never includes the disputed value, so every side shares it. */
2569
2834
  claimKey: string;
2835
+ /** @description The conflicting positions, at least two. To resolve the conflict, pass the index of one side as `resolution`. */
2570
2836
  sides: {
2837
+ /** @description The position as a self-contained sentence. This is the option you choose from. */
2571
2838
  claim: string;
2839
+ /** @description The disputed value on its own, such as `10,000/month`, without the sentence. */
2572
2840
  value?: string;
2841
+ /** @description Paths of the entries that state this position. */
2573
2842
  entryPaths?: string[];
2843
+ /** @description IDs of the sources that directly back this position. */
2574
2844
  sourceIds?: string[];
2575
- /** @description ConflictSpan */
2845
+ /** @description Where in a source this position was read. */
2576
2846
  span?: {
2847
+ /** @description ID of the source the position was read from. */
2577
2848
  sourceId: string;
2849
+ /** @description First line of the range, counting from 1. Line numbers match `GET .../sources/{sourceId}/content`. */
2578
2850
  lineStart: number;
2851
+ /** @description Last line of the range, inclusive. */
2579
2852
  lineEnd: number;
2580
2853
  };
2581
- /** @enum {string} */
2854
+ /**
2855
+ * @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.
2856
+ * @enum {string}
2857
+ */
2582
2858
  authority?: 'primary' | 'secondary' | 'community';
2583
2859
  }[];
2860
+ /** @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. */
2584
2861
  suggested?: number;
2585
2862
  } | {
2586
- /** @enum {string} */
2863
+ /**
2864
+ * @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.
2865
+ * @enum {string}
2866
+ */
2587
2867
  severity: 'critical' | 'suggestion';
2868
+ /** @description Path of the entry the issue is about, or `*` when it applies to the whole knowledge base. For `add_entry`, the path of the proposed entry. */
2588
2869
  scopePath: string;
2870
+ /** @description What the problem is, in one or two sentences. */
2589
2871
  issue: string;
2872
+ /** @description What to do to fix the issue. */
2590
2873
  suggestedFix: string;
2591
- /** @enum {string} */
2874
+ /**
2875
+ * @description The issue type. `gap`: your sources cover material that entries leave out. `update_required`: an entry is out of date with its sources or contradicts an instruction, and needs a rewrite. `add_entry`: your sources cover a topic that no entry covers. `remove_entry`: an entry has lost its sources or its topic no longer applies. `split_entry`: an entry covers several distinct topics and should become child entries. `merge_entry`: an entry has too few sources to stand alone, so merge it into a nearby entry or keep it as it is.
2876
+ * @enum {string}
2877
+ */
2592
2878
  kind: 'gap' | 'update_required' | 'add_entry' | 'remove_entry' | 'split_entry' | 'merge_entry';
2879
+ /** @description IDs of the sources that led to the issue. For `add_entry`, the sources the new entry would cite. */
2593
2880
  citedSourceIds?: string[];
2881
+ /** @description A key naming the specific finding, when the check that found it sets one. */
2594
2882
  claimKey?: string;
2883
+ /** @description Paths of the entries the issue involves, when it spans more than one entry. */
2595
2884
  involvedScopes?: string[];
2596
2885
  };
2886
+ /** @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. */
2597
2887
  fingerprint: string;
2888
+ /** @description The ID of the build that filed this issue. `null` when the issue was filed outside a build, such as when removing a source leaves an entry without sources. */
2598
2889
  revisionId: string | null;
2599
- /** @enum {string} */
2890
+ /**
2891
+ * @description The issue status. `accepted` means the issue was resolved or its fix applied.
2892
+ * @enum {string}
2893
+ */
2600
2894
  status: 'accepted';
2601
- /** Format: date-time */
2895
+ /**
2896
+ * Format: date-time
2897
+ * @description When the issue left `open`, as an ISO 8601 timestamp.
2898
+ */
2602
2899
  resolvedAt: string;
2900
+ /** @description Who triaged the issue. `null` while the issue is open, or when the caller could not be identified. */
2603
2901
  resolvedBy: {
2902
+ /** @description The ID of the Sanity user or robot token that triaged the issue. */
2604
2903
  id: string;
2605
- /** @enum {string} */
2904
+ /**
2905
+ * @description What triaged the issue. `user` is a person, and `robot` is a robot token.
2906
+ * @enum {string}
2907
+ */
2606
2908
  kind: 'user' | 'robot';
2607
2909
  } | null;
2910
+ /** @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. */
2608
2911
  resolution: number | null;
2609
2912
  } | {
2913
+ /** @description The document ID. */
2610
2914
  _id: string;
2915
+ /** @description The document revision. It changes on every write. */
2611
2916
  _rev: string;
2612
- /** Format: date-time */
2917
+ /**
2918
+ * Format: date-time
2919
+ * @description When the document was created, as an ISO 8601 timestamp.
2920
+ */
2613
2921
  _createdAt: string;
2614
- /** Format: date-time */
2922
+ /**
2923
+ * Format: date-time
2924
+ * @description When the document was last changed, as an ISO 8601 timestamp.
2925
+ */
2615
2926
  _updatedAt: string;
2927
+ /** @description The ID (`kb…`) of the knowledge base this document belongs to. */
2616
2928
  knowledgeBaseId: string;
2617
- /** @enum {string} */
2929
+ /**
2930
+ * @description The document type. Always `sanity.context.issue`.
2931
+ * @enum {string}
2932
+ */
2618
2933
  _type: 'sanity.context.issue';
2619
- /** @enum {number} */
2934
+ /**
2935
+ * @description The version of the document shape. Currently `1`.
2936
+ * @enum {number}
2937
+ */
2620
2938
  schemaVersion: 1;
2621
- /** @description IssueContent */
2939
+ /** @description What an issue found. The shape depends on `kind`. */
2622
2940
  content: {
2623
- /** @enum {string} */
2941
+ /**
2942
+ * @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.
2943
+ * @enum {string}
2944
+ */
2624
2945
  severity: 'critical' | 'suggestion';
2946
+ /** @description Path of the entry the issue is about, or `*` when it applies to the whole knowledge base. For `add_entry`, the path of the proposed entry. */
2625
2947
  scopePath: string;
2948
+ /** @description What the problem is, in one or two sentences. */
2626
2949
  issue: string;
2950
+ /** @description What to do to fix the issue. */
2627
2951
  suggestedFix: string;
2628
- /** @enum {string} */
2952
+ /**
2953
+ * @description The issue type. `conflict` means two or more positions disagree on the same fact, and you choose which one is correct.
2954
+ * @enum {string}
2955
+ */
2629
2956
  kind: 'conflict';
2957
+ /** @description A key naming the disputed fact, such as `free_tier.request_limit`. It never includes the disputed value, so every side shares it. */
2630
2958
  claimKey: string;
2959
+ /** @description The conflicting positions, at least two. To resolve the conflict, pass the index of one side as `resolution`. */
2631
2960
  sides: {
2961
+ /** @description The position as a self-contained sentence. This is the option you choose from. */
2632
2962
  claim: string;
2963
+ /** @description The disputed value on its own, such as `10,000/month`, without the sentence. */
2633
2964
  value?: string;
2965
+ /** @description Paths of the entries that state this position. */
2634
2966
  entryPaths?: string[];
2967
+ /** @description IDs of the sources that directly back this position. */
2635
2968
  sourceIds?: string[];
2636
- /** @description ConflictSpan */
2969
+ /** @description Where in a source this position was read. */
2637
2970
  span?: {
2971
+ /** @description ID of the source the position was read from. */
2638
2972
  sourceId: string;
2973
+ /** @description First line of the range, counting from 1. Line numbers match `GET .../sources/{sourceId}/content`. */
2639
2974
  lineStart: number;
2975
+ /** @description Last line of the range, inclusive. */
2640
2976
  lineEnd: number;
2641
2977
  };
2642
- /** @enum {string} */
2978
+ /**
2979
+ * @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.
2980
+ * @enum {string}
2981
+ */
2643
2982
  authority?: 'primary' | 'secondary' | 'community';
2644
2983
  }[];
2984
+ /** @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. */
2645
2985
  suggested?: number;
2646
2986
  } | {
2647
- /** @enum {string} */
2987
+ /**
2988
+ * @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.
2989
+ * @enum {string}
2990
+ */
2648
2991
  severity: 'critical' | 'suggestion';
2992
+ /** @description Path of the entry the issue is about, or `*` when it applies to the whole knowledge base. For `add_entry`, the path of the proposed entry. */
2649
2993
  scopePath: string;
2994
+ /** @description What the problem is, in one or two sentences. */
2650
2995
  issue: string;
2996
+ /** @description What to do to fix the issue. */
2651
2997
  suggestedFix: string;
2652
- /** @enum {string} */
2998
+ /**
2999
+ * @description The issue type. `gap`: your sources cover material that entries leave out. `update_required`: an entry is out of date with its sources or contradicts an instruction, and needs a rewrite. `add_entry`: your sources cover a topic that no entry covers. `remove_entry`: an entry has lost its sources or its topic no longer applies. `split_entry`: an entry covers several distinct topics and should become child entries. `merge_entry`: an entry has too few sources to stand alone, so merge it into a nearby entry or keep it as it is.
3000
+ * @enum {string}
3001
+ */
2653
3002
  kind: 'gap' | 'update_required' | 'add_entry' | 'remove_entry' | 'split_entry' | 'merge_entry';
3003
+ /** @description IDs of the sources that led to the issue. For `add_entry`, the sources the new entry would cite. */
2654
3004
  citedSourceIds?: string[];
3005
+ /** @description A key naming the specific finding, when the check that found it sets one. */
2655
3006
  claimKey?: string;
3007
+ /** @description Paths of the entries the issue involves, when it spans more than one entry. */
2656
3008
  involvedScopes?: string[];
2657
3009
  };
3010
+ /** @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. */
2658
3011
  fingerprint: string;
3012
+ /** @description The ID of the build that filed this issue. `null` when the issue was filed outside a build, such as when removing a source leaves an entry without sources. */
2659
3013
  revisionId: string | null;
2660
- /** @enum {string} */
3014
+ /**
3015
+ * @description The issue status. `rejected` means the issue was dismissed. Dismissal is final.
3016
+ * @enum {string}
3017
+ */
2661
3018
  status: 'rejected';
2662
- /** Format: date-time */
3019
+ /**
3020
+ * Format: date-time
3021
+ * @description When the issue left `open`, as an ISO 8601 timestamp.
3022
+ */
2663
3023
  resolvedAt: string;
3024
+ /** @description Who triaged the issue. `null` while the issue is open, or when the caller could not be identified. */
2664
3025
  resolvedBy: {
3026
+ /** @description The ID of the Sanity user or robot token that triaged the issue. */
2665
3027
  id: string;
2666
- /** @enum {string} */
3028
+ /**
3029
+ * @description What triaged the issue. `user` is a person, and `robot` is a robot token.
3030
+ * @enum {string}
3031
+ */
2667
3032
  kind: 'user' | 'robot';
2668
3033
  } | null;
2669
- /** @enum {string|null} */
3034
+ /**
3035
+ * @description Always `null`, because a dismissal chooses no side.
3036
+ * @enum {string|null}
3037
+ */
2670
3038
  resolution: null;
2671
3039
  };
2672
- /** @description A `sanity.context.mcp` document, an org-owned MCP endpoint configuration stored in the organization store. Not returned by any endpoint raw; published so GROQ reads and trigger filters can be typed. Write through the mcp endpoints, never with a raw client. The mcp endpoints serve the validated wire view. */
3040
+ /** @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. */
2673
3041
  McpDoc: {
3042
+ /** @description The document ID. */
2674
3043
  _id: string;
3044
+ /** @description The document revision. It changes on every write. */
2675
3045
  _rev: string;
2676
- /** Format: date-time */
3046
+ /**
3047
+ * Format: date-time
3048
+ * @description When the document was created, as an ISO 8601 timestamp.
3049
+ */
2677
3050
  _createdAt: string;
2678
- /** Format: date-time */
3051
+ /**
3052
+ * Format: date-time
3053
+ * @description When the document was last changed, as an ISO 8601 timestamp.
3054
+ */
2679
3055
  _updatedAt: string;
2680
- /** @enum {string} */
3056
+ /**
3057
+ * @description The document type. Always `sanity.context.mcp`.
3058
+ * @enum {string}
3059
+ */
2681
3060
  _type: 'sanity.context.mcp';
2682
- /** @enum {number} */
3061
+ /**
3062
+ * @description The version of the document shape. Currently `1`.
3063
+ * @enum {number}
3064
+ */
2683
3065
  schemaVersion: 1;
3066
+ /** @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. */
2684
3067
  organizationId: string;
3068
+ /** @description The MCP endpoint's public ID (`mcp…`). It is set once at creation, never changes, and determines the document `_id`. */
2685
3069
  publicId: string;
3070
+ /** @description The MCP endpoint's display name. You can change it at any time. */
2686
3071
  title: string;
3072
+ /** @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. */
2687
3073
  name: string;
3074
+ /** @description The content sources the MCP endpoint serves. Each source appears once, and the order has no meaning. */
2688
3075
  sources: ({
2689
- /** @enum {string} */
3076
+ /**
3077
+ * @description The source type. `knowledge-base` serves a whole knowledge base.
3078
+ * @enum {string}
3079
+ */
2690
3080
  type: 'knowledge-base';
3081
+ /** @description The knowledge base ID (`kb…`). */
2691
3082
  id: string;
2692
3083
  } | {
2693
- /** @enum {string} */
3084
+ /**
3085
+ * @description The source type. `dataset` serves documents from a Sanity dataset, limited by the MCP endpoint's `groqFilter` when set.
3086
+ * @enum {string}
3087
+ */
2694
3088
  type: 'dataset';
3089
+ /** @description The dataset, as `<projectId>.<datasetName>`. */
2695
3090
  id: string;
2696
3091
  })[];
3092
+ /** @description Prompt text the MCP endpoint serves to connecting agents. `null` when unset. */
2697
3093
  instructions: string | null;
3094
+ /** @description A GROQ filter that limits what the MCP endpoint's `dataset` sources serve. It has no effect on `knowledge-base` sources. `null` when unset. */
2698
3095
  groqFilter: string | null;
2699
3096
  };
2700
3097
  };
@@ -2708,8 +3105,11 @@ interface operations {
2708
3105
  listKnowledgeBases: {
2709
3106
  parameters: {
2710
3107
  query: {
3108
+ /** @description The `nextCursor` value from the previous page. Omit it to get the first page. */
2711
3109
  cursor?: string;
3110
+ /** @description The maximum number of items to return. */
2712
3111
  limit?: number;
3112
+ /** @description The organization to list knowledge bases for. */
2713
3113
  organizationId: string;
2714
3114
  };
2715
3115
  header?: never;
@@ -2720,84 +3120,155 @@ interface operations {
2720
3120
  };
2721
3121
  requestBody?: never;
2722
3122
  responses: {
2723
- /** @description Default Response */
3123
+ /** @description A page of knowledge bases. */
2724
3124
  200: {
2725
3125
  headers: {
2726
3126
  [name: string]: unknown;
2727
3127
  };
2728
3128
  content: {
2729
3129
  'application/json': {
3130
+ /** @description The items on this page. */
2730
3131
  data: {
2731
- /** Format: uuid */
3132
+ /**
3133
+ * Format: uuid
3134
+ * @description The knowledge base's unique ID, a UUID. Accepted anywhere a `knowledgeBaseId` is expected.
3135
+ */
2732
3136
  id: string;
3137
+ /** @description The knowledge base ID to show users, such as `kb3do82whm`. Accepted anywhere a `knowledgeBaseId` is expected. Treat it as an opaque string. */
2733
3138
  publicId: string;
3139
+ /** @description The ID of the organization that owns the knowledge base. */
2734
3140
  organizationId: string;
3141
+ /** @description The knowledge base's title. */
2735
3142
  title: string;
3143
+ /** @description A short description of what the knowledge base covers. */
2736
3144
  description: string;
2737
- /** @enum {string} */
3145
+ /**
3146
+ * @description The knowledge base's build state. `created`: not built yet. `ready`: built, with no open issues. `review`: built, with open issues to review. A failed build doesn't change the state. `building`, `stale`, and `paused` aren't currently returned. To check for a running build, use `isBuilding`.
3147
+ * @enum {string}
3148
+ */
2738
3149
  state: 'created' | 'building' | 'ready' | 'review' | 'stale' | 'paused';
3150
+ /** @description The job ID of the most recent build, or `null` if no build has started. Check its progress with `GET .../jobs/{jobId}`. */
2739
3151
  activeJobId: string | null;
3152
+ /** @description Whether a build is running now. */
2740
3153
  isBuilding: boolean;
3154
+ /** @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`. */
2741
3155
  buildStageState: {
3156
+ /** @description The ID of the build job this progress belongs to. */
2742
3157
  jobId: string;
3158
+ /** @description The build's stages and their progress. Stages that haven't reported yet can be missing. */
2743
3159
  stages: {
2744
- /** @enum {string} */
3160
+ /**
3161
+ * @description The stage's ID. The values are listed in the order stages run.
3162
+ * @enum {string}
3163
+ */
2745
3164
  id: 'tldr' | 'map' | 'triage' | 'plan' | 'organize' | 'arrange' | 'write' | 'review' | 'polish';
2746
- /** @enum {string} */
3165
+ /**
3166
+ * @description The stage's status. `pending`: not started. `running`: in progress. `done`: finished. `failed`: the build ended before the stage finished.
3167
+ * @enum {string}
3168
+ */
2747
3169
  status: 'pending' | 'running' | 'done' | 'failed';
3170
+ /** @description The stage's progress counts. Absent when the stage hasn't reported counts. */
2748
3171
  units?: {
2749
- /** @enum {string} */
3172
+ /**
3173
+ * @description What `done` and `total` count: `sources`, `groups` of related content, `entries`, or `rounds` of final fixes. A `rounds` stage has no `total`.
3174
+ * @enum {string}
3175
+ */
2750
3176
  unit: 'sources' | 'groups' | 'entries' | 'rounds';
3177
+ /** @description How many units the stage has finished. */
2751
3178
  done: number;
3179
+ /** @description How many units the stage will process. Absent when `unit` is `rounds`. */
2752
3180
  total?: number;
2753
3181
  };
2754
3182
  }[];
2755
3183
  } | null;
2756
- /** Format: date-time */
3184
+ /**
3185
+ * Format: date-time
3186
+ * @description When a refresh last checked the knowledge base for changes, whether or not anything changed. `null` until the first refresh.
3187
+ */
2757
3188
  lastCheckedAt: string | null;
2758
- /** Format: date-time */
3189
+ /**
3190
+ * Format: date-time
3191
+ * @description When the content last changed: the time of the most recent successful build. `null` if the knowledge base has never built.
3192
+ */
2759
3193
  lastChangedAt: string | null;
3194
+ /** @description Whether sources were added, changed, or removed since the last successful build. Always `false` before the first build. */
2760
3195
  hasPendingChanges: boolean;
3196
+ /** @description Counts of sources added, changed, and removed since the last successful build. Only `GET .../knowledge-bases/{knowledgeBaseId}` computes it. `null` in list responses and before the first build. */
2761
3197
  pendingChanges: {
3198
+ /** @description Sources added since the last successful build, including sources no successful build has included yet. */
2762
3199
  added: number;
3200
+ /** @description Sources whose content changed since the last successful build. */
2763
3201
  changed: number;
3202
+ /** @description Sources that recent refreshes no longer find. */
2764
3203
  removed: number;
2765
3204
  } | null;
3205
+ /** @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. */
2766
3206
  pipelineOutdated: boolean;
3207
+ /** @description A recommendation to rebuild, because new or changed content doesn't fit the current outline. `null` when there's no recommendation. A refresh where the content fits again, a successful build, or adding or removing sources clears it. */
2767
3208
  rebuildRecommended: {
3209
+ /** @description Why a rebuild is recommended, written to show to users. */
2768
3210
  reason: string;
2769
- /** Format: date-time */
3211
+ /**
3212
+ * Format: date-time
3213
+ * @description When the recommendation was made.
3214
+ */
2770
3215
  at: string;
2771
3216
  } | null;
3217
+ /** @description Whether the knowledge base has at least one website source. */
2772
3218
  hasWebSource: boolean;
3219
+ /** @description Whether the knowledge base has at least one Sanity dataset source. */
2773
3220
  hasDatasetSource: boolean;
3221
+ /** @description How many sources the knowledge base uses, and its source limit. */
2774
3222
  sourceUsage: {
3223
+ /** @description The number of sources counted toward the limit, including parts split from large sources. */
2775
3224
  used: number;
3225
+ /** @description The maximum number of sources the knowledge base can have. */
2776
3226
  limit: number;
2777
3227
  } | null;
2778
- /** @description PlanRestriction */
3228
+ /** @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`. */
2779
3229
  buildRestriction: {
3230
+ /** @description A stable code for the restriction, such as `planLimitReached`. */
2780
3231
  code: string;
3232
+ /** @description A readable explanation that you can show to users. */
2781
3233
  message: string;
2782
3234
  } | null;
3235
+ /** @description Whether scheduled refresh is on. Only applies to knowledge bases with a website or dataset source. */
2783
3236
  refreshEnabled: boolean;
2784
- /** @enum {string} */
3237
+ /**
3238
+ * @description How often scheduled refresh runs: `weekly` (the default) or `monthly`.
3239
+ * @enum {string}
3240
+ */
2785
3241
  refreshFrequency: 'weekly' | 'monthly';
2786
- /** Format: date-time */
3242
+ /**
3243
+ * Format: date-time
3244
+ * @description When the next scheduled refresh runs. `null` when scheduled refresh is off or not scheduled yet. Only `GET .../knowledge-bases/{knowledgeBaseId}` computes it, so list responses return `null`.
3245
+ */
2787
3246
  refreshNextRunAt: string | null;
3247
+ /** @description Whether a refresh is running now. While it's `true`, a new refresh request doesn't start another one. Only `GET .../knowledge-bases/{knowledgeBaseId}` computes it, so list responses return `false`. */
2788
3248
  refreshInFlight: boolean;
3249
+ /** @description The number of open issues waiting for review. Always `0` before the first build. */
2789
3250
  openIssueCount: number;
3251
+ /** @description The number of active instructions for the knowledge base. */
2790
3252
  instructionCount: number;
2791
- /** @description Actor */
3253
+ /** @description Who created the knowledge base. `null` if unknown. */
2792
3254
  createdBy: {
3255
+ /** @description The Sanity user ID, or `sanity-system` when Sanity Context made the change. `null` if unknown. */
2793
3256
  id: string | null;
3257
+ /** @description The user's name when the action happened. `null` if unknown. For the current name, look up the user by `id`. */
2794
3258
  displayName: string | null;
2795
3259
  } | null;
2796
- /** Format: date-time */
3260
+ /**
3261
+ * Format: date-time
3262
+ * @description When the knowledge base was created.
3263
+ */
2797
3264
  createdAt: string;
2798
- /** Format: date-time */
3265
+ /**
3266
+ * Format: date-time
3267
+ * @description When the knowledge base was last updated.
3268
+ */
2799
3269
  updatedAt: string;
2800
3270
  }[];
3271
+ /** @description The cursor for the next page. Pass it as `cursor` to get more results. `null` when there are no more pages. */
2801
3272
  nextCursor: string | null;
2802
3273
  };
2803
3274
  };
@@ -2816,88 +3287,160 @@ interface operations {
2816
3287
  requestBody: {
2817
3288
  content: {
2818
3289
  'application/json': {
3290
+ /** @description The ID of the organization to create the knowledge base in. */
2819
3291
  organizationId: string;
3292
+ /** @description The knowledge base's title. */
2820
3293
  title: string;
3294
+ /** @description A short description of what the knowledge base covers. */
2821
3295
  description: string;
2822
3296
  };
2823
3297
  };
2824
3298
  };
2825
3299
  responses: {
2826
- /** @description KnowledgeBase */
3300
+ /** @description A knowledge base and its current state. */
2827
3301
  201: {
2828
3302
  headers: {
2829
3303
  [name: string]: unknown;
2830
3304
  };
2831
3305
  content: {
2832
3306
  'application/json': {
2833
- /** Format: uuid */
3307
+ /**
3308
+ * Format: uuid
3309
+ * @description The knowledge base's unique ID, a UUID. Accepted anywhere a `knowledgeBaseId` is expected.
3310
+ */
2834
3311
  id: string;
3312
+ /** @description The knowledge base ID to show users, such as `kb3do82whm`. Accepted anywhere a `knowledgeBaseId` is expected. Treat it as an opaque string. */
2835
3313
  publicId: string;
3314
+ /** @description The ID of the organization that owns the knowledge base. */
2836
3315
  organizationId: string;
3316
+ /** @description The knowledge base's title. */
2837
3317
  title: string;
3318
+ /** @description A short description of what the knowledge base covers. */
2838
3319
  description: string;
2839
- /** @enum {string} */
3320
+ /**
3321
+ * @description The knowledge base's build state. `created`: not built yet. `ready`: built, with no open issues. `review`: built, with open issues to review. A failed build doesn't change the state. `building`, `stale`, and `paused` aren't currently returned. To check for a running build, use `isBuilding`.
3322
+ * @enum {string}
3323
+ */
2840
3324
  state: 'created' | 'building' | 'ready' | 'review' | 'stale' | 'paused';
3325
+ /** @description The job ID of the most recent build, or `null` if no build has started. Check its progress with `GET .../jobs/{jobId}`. */
2841
3326
  activeJobId: string | null;
3327
+ /** @description Whether a build is running now. */
2842
3328
  isBuilding: boolean;
3329
+ /** @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`. */
2843
3330
  buildStageState: {
3331
+ /** @description The ID of the build job this progress belongs to. */
2844
3332
  jobId: string;
3333
+ /** @description The build's stages and their progress. Stages that haven't reported yet can be missing. */
2845
3334
  stages: {
2846
- /** @enum {string} */
3335
+ /**
3336
+ * @description The stage's ID. The values are listed in the order stages run.
3337
+ * @enum {string}
3338
+ */
2847
3339
  id: 'tldr' | 'map' | 'triage' | 'plan' | 'organize' | 'arrange' | 'write' | 'review' | 'polish';
2848
- /** @enum {string} */
3340
+ /**
3341
+ * @description The stage's status. `pending`: not started. `running`: in progress. `done`: finished. `failed`: the build ended before the stage finished.
3342
+ * @enum {string}
3343
+ */
2849
3344
  status: 'pending' | 'running' | 'done' | 'failed';
3345
+ /** @description The stage's progress counts. Absent when the stage hasn't reported counts. */
2850
3346
  units?: {
2851
- /** @enum {string} */
3347
+ /**
3348
+ * @description What `done` and `total` count: `sources`, `groups` of related content, `entries`, or `rounds` of final fixes. A `rounds` stage has no `total`.
3349
+ * @enum {string}
3350
+ */
2852
3351
  unit: 'sources' | 'groups' | 'entries' | 'rounds';
3352
+ /** @description How many units the stage has finished. */
2853
3353
  done: number;
3354
+ /** @description How many units the stage will process. Absent when `unit` is `rounds`. */
2854
3355
  total?: number;
2855
3356
  };
2856
3357
  }[];
2857
3358
  } | null;
2858
- /** Format: date-time */
3359
+ /**
3360
+ * Format: date-time
3361
+ * @description When a refresh last checked the knowledge base for changes, whether or not anything changed. `null` until the first refresh.
3362
+ */
2859
3363
  lastCheckedAt: string | null;
2860
- /** Format: date-time */
3364
+ /**
3365
+ * Format: date-time
3366
+ * @description When the content last changed: the time of the most recent successful build. `null` if the knowledge base has never built.
3367
+ */
2861
3368
  lastChangedAt: string | null;
3369
+ /** @description Whether sources were added, changed, or removed since the last successful build. Always `false` before the first build. */
2862
3370
  hasPendingChanges: boolean;
3371
+ /** @description Counts of sources added, changed, and removed since the last successful build. Only `GET .../knowledge-bases/{knowledgeBaseId}` computes it. `null` in list responses and before the first build. */
2863
3372
  pendingChanges: {
3373
+ /** @description Sources added since the last successful build, including sources no successful build has included yet. */
2864
3374
  added: number;
3375
+ /** @description Sources whose content changed since the last successful build. */
2865
3376
  changed: number;
3377
+ /** @description Sources that recent refreshes no longer find. */
2866
3378
  removed: number;
2867
3379
  } | null;
3380
+ /** @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. */
2868
3381
  pipelineOutdated: boolean;
3382
+ /** @description A recommendation to rebuild, because new or changed content doesn't fit the current outline. `null` when there's no recommendation. A refresh where the content fits again, a successful build, or adding or removing sources clears it. */
2869
3383
  rebuildRecommended: {
3384
+ /** @description Why a rebuild is recommended, written to show to users. */
2870
3385
  reason: string;
2871
- /** Format: date-time */
3386
+ /**
3387
+ * Format: date-time
3388
+ * @description When the recommendation was made.
3389
+ */
2872
3390
  at: string;
2873
3391
  } | null;
3392
+ /** @description Whether the knowledge base has at least one website source. */
2874
3393
  hasWebSource: boolean;
3394
+ /** @description Whether the knowledge base has at least one Sanity dataset source. */
2875
3395
  hasDatasetSource: boolean;
3396
+ /** @description How many sources the knowledge base uses, and its source limit. */
2876
3397
  sourceUsage: {
3398
+ /** @description The number of sources counted toward the limit, including parts split from large sources. */
2877
3399
  used: number;
3400
+ /** @description The maximum number of sources the knowledge base can have. */
2878
3401
  limit: number;
2879
3402
  } | null;
2880
- /** @description PlanRestriction */
3403
+ /** @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`. */
2881
3404
  buildRestriction: {
3405
+ /** @description A stable code for the restriction, such as `planLimitReached`. */
2882
3406
  code: string;
3407
+ /** @description A readable explanation that you can show to users. */
2883
3408
  message: string;
2884
3409
  } | null;
3410
+ /** @description Whether scheduled refresh is on. Only applies to knowledge bases with a website or dataset source. */
2885
3411
  refreshEnabled: boolean;
2886
- /** @enum {string} */
3412
+ /**
3413
+ * @description How often scheduled refresh runs: `weekly` (the default) or `monthly`.
3414
+ * @enum {string}
3415
+ */
2887
3416
  refreshFrequency: 'weekly' | 'monthly';
2888
- /** Format: date-time */
3417
+ /**
3418
+ * Format: date-time
3419
+ * @description When the next scheduled refresh runs. `null` when scheduled refresh is off or not scheduled yet. Only `GET .../knowledge-bases/{knowledgeBaseId}` computes it, so list responses return `null`.
3420
+ */
2889
3421
  refreshNextRunAt: string | null;
3422
+ /** @description Whether a refresh is running now. While it's `true`, a new refresh request doesn't start another one. Only `GET .../knowledge-bases/{knowledgeBaseId}` computes it, so list responses return `false`. */
2890
3423
  refreshInFlight: boolean;
3424
+ /** @description The number of open issues waiting for review. Always `0` before the first build. */
2891
3425
  openIssueCount: number;
3426
+ /** @description The number of active instructions for the knowledge base. */
2892
3427
  instructionCount: number;
2893
- /** @description Actor */
3428
+ /** @description Who created the knowledge base. `null` if unknown. */
2894
3429
  createdBy: {
3430
+ /** @description The Sanity user ID, or `sanity-system` when Sanity Context made the change. `null` if unknown. */
2895
3431
  id: string | null;
3432
+ /** @description The user's name when the action happened. `null` if unknown. For the current name, look up the user by `id`. */
2896
3433
  displayName: string | null;
2897
3434
  } | null;
2898
- /** Format: date-time */
3435
+ /**
3436
+ * Format: date-time
3437
+ * @description When the knowledge base was created.
3438
+ */
2899
3439
  createdAt: string;
2900
- /** Format: date-time */
3440
+ /**
3441
+ * Format: date-time
3442
+ * @description When the knowledge base was last updated.
3443
+ */
2901
3444
  updatedAt: string;
2902
3445
  };
2903
3446
  };
@@ -2909,87 +3452,157 @@ interface operations {
2909
3452
  query?: never;
2910
3453
  header?: never;
2911
3454
  path: {
3455
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
2912
3456
  knowledgeBaseId: string;
2913
3457
  };
2914
3458
  cookie?: never;
2915
3459
  };
2916
3460
  requestBody?: never;
2917
3461
  responses: {
2918
- /** @description KnowledgeBase */
3462
+ /** @description A knowledge base and its current state. */
2919
3463
  200: {
2920
3464
  headers: {
2921
3465
  [name: string]: unknown;
2922
3466
  };
2923
3467
  content: {
2924
3468
  'application/json': {
2925
- /** Format: uuid */
3469
+ /**
3470
+ * Format: uuid
3471
+ * @description The knowledge base's unique ID, a UUID. Accepted anywhere a `knowledgeBaseId` is expected.
3472
+ */
2926
3473
  id: string;
3474
+ /** @description The knowledge base ID to show users, such as `kb3do82whm`. Accepted anywhere a `knowledgeBaseId` is expected. Treat it as an opaque string. */
2927
3475
  publicId: string;
3476
+ /** @description The ID of the organization that owns the knowledge base. */
2928
3477
  organizationId: string;
3478
+ /** @description The knowledge base's title. */
2929
3479
  title: string;
3480
+ /** @description A short description of what the knowledge base covers. */
2930
3481
  description: string;
2931
- /** @enum {string} */
3482
+ /**
3483
+ * @description The knowledge base's build state. `created`: not built yet. `ready`: built, with no open issues. `review`: built, with open issues to review. A failed build doesn't change the state. `building`, `stale`, and `paused` aren't currently returned. To check for a running build, use `isBuilding`.
3484
+ * @enum {string}
3485
+ */
2932
3486
  state: 'created' | 'building' | 'ready' | 'review' | 'stale' | 'paused';
3487
+ /** @description The job ID of the most recent build, or `null` if no build has started. Check its progress with `GET .../jobs/{jobId}`. */
2933
3488
  activeJobId: string | null;
3489
+ /** @description Whether a build is running now. */
2934
3490
  isBuilding: boolean;
3491
+ /** @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`. */
2935
3492
  buildStageState: {
3493
+ /** @description The ID of the build job this progress belongs to. */
2936
3494
  jobId: string;
3495
+ /** @description The build's stages and their progress. Stages that haven't reported yet can be missing. */
2937
3496
  stages: {
2938
- /** @enum {string} */
3497
+ /**
3498
+ * @description The stage's ID. The values are listed in the order stages run.
3499
+ * @enum {string}
3500
+ */
2939
3501
  id: 'tldr' | 'map' | 'triage' | 'plan' | 'organize' | 'arrange' | 'write' | 'review' | 'polish';
2940
- /** @enum {string} */
3502
+ /**
3503
+ * @description The stage's status. `pending`: not started. `running`: in progress. `done`: finished. `failed`: the build ended before the stage finished.
3504
+ * @enum {string}
3505
+ */
2941
3506
  status: 'pending' | 'running' | 'done' | 'failed';
3507
+ /** @description The stage's progress counts. Absent when the stage hasn't reported counts. */
2942
3508
  units?: {
2943
- /** @enum {string} */
3509
+ /**
3510
+ * @description What `done` and `total` count: `sources`, `groups` of related content, `entries`, or `rounds` of final fixes. A `rounds` stage has no `total`.
3511
+ * @enum {string}
3512
+ */
2944
3513
  unit: 'sources' | 'groups' | 'entries' | 'rounds';
3514
+ /** @description How many units the stage has finished. */
2945
3515
  done: number;
3516
+ /** @description How many units the stage will process. Absent when `unit` is `rounds`. */
2946
3517
  total?: number;
2947
3518
  };
2948
3519
  }[];
2949
3520
  } | null;
2950
- /** Format: date-time */
3521
+ /**
3522
+ * Format: date-time
3523
+ * @description When a refresh last checked the knowledge base for changes, whether or not anything changed. `null` until the first refresh.
3524
+ */
2951
3525
  lastCheckedAt: string | null;
2952
- /** Format: date-time */
3526
+ /**
3527
+ * Format: date-time
3528
+ * @description When the content last changed: the time of the most recent successful build. `null` if the knowledge base has never built.
3529
+ */
2953
3530
  lastChangedAt: string | null;
3531
+ /** @description Whether sources were added, changed, or removed since the last successful build. Always `false` before the first build. */
2954
3532
  hasPendingChanges: boolean;
3533
+ /** @description Counts of sources added, changed, and removed since the last successful build. Only `GET .../knowledge-bases/{knowledgeBaseId}` computes it. `null` in list responses and before the first build. */
2955
3534
  pendingChanges: {
3535
+ /** @description Sources added since the last successful build, including sources no successful build has included yet. */
2956
3536
  added: number;
3537
+ /** @description Sources whose content changed since the last successful build. */
2957
3538
  changed: number;
3539
+ /** @description Sources that recent refreshes no longer find. */
2958
3540
  removed: number;
2959
3541
  } | null;
3542
+ /** @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. */
2960
3543
  pipelineOutdated: boolean;
3544
+ /** @description A recommendation to rebuild, because new or changed content doesn't fit the current outline. `null` when there's no recommendation. A refresh where the content fits again, a successful build, or adding or removing sources clears it. */
2961
3545
  rebuildRecommended: {
3546
+ /** @description Why a rebuild is recommended, written to show to users. */
2962
3547
  reason: string;
2963
- /** Format: date-time */
3548
+ /**
3549
+ * Format: date-time
3550
+ * @description When the recommendation was made.
3551
+ */
2964
3552
  at: string;
2965
3553
  } | null;
3554
+ /** @description Whether the knowledge base has at least one website source. */
2966
3555
  hasWebSource: boolean;
3556
+ /** @description Whether the knowledge base has at least one Sanity dataset source. */
2967
3557
  hasDatasetSource: boolean;
3558
+ /** @description How many sources the knowledge base uses, and its source limit. */
2968
3559
  sourceUsage: {
3560
+ /** @description The number of sources counted toward the limit, including parts split from large sources. */
2969
3561
  used: number;
3562
+ /** @description The maximum number of sources the knowledge base can have. */
2970
3563
  limit: number;
2971
3564
  } | null;
2972
- /** @description PlanRestriction */
3565
+ /** @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`. */
2973
3566
  buildRestriction: {
3567
+ /** @description A stable code for the restriction, such as `planLimitReached`. */
2974
3568
  code: string;
3569
+ /** @description A readable explanation that you can show to users. */
2975
3570
  message: string;
2976
3571
  } | null;
3572
+ /** @description Whether scheduled refresh is on. Only applies to knowledge bases with a website or dataset source. */
2977
3573
  refreshEnabled: boolean;
2978
- /** @enum {string} */
3574
+ /**
3575
+ * @description How often scheduled refresh runs: `weekly` (the default) or `monthly`.
3576
+ * @enum {string}
3577
+ */
2979
3578
  refreshFrequency: 'weekly' | 'monthly';
2980
- /** Format: date-time */
3579
+ /**
3580
+ * Format: date-time
3581
+ * @description When the next scheduled refresh runs. `null` when scheduled refresh is off or not scheduled yet. Only `GET .../knowledge-bases/{knowledgeBaseId}` computes it, so list responses return `null`.
3582
+ */
2981
3583
  refreshNextRunAt: string | null;
3584
+ /** @description Whether a refresh is running now. While it's `true`, a new refresh request doesn't start another one. Only `GET .../knowledge-bases/{knowledgeBaseId}` computes it, so list responses return `false`. */
2982
3585
  refreshInFlight: boolean;
3586
+ /** @description The number of open issues waiting for review. Always `0` before the first build. */
2983
3587
  openIssueCount: number;
3588
+ /** @description The number of active instructions for the knowledge base. */
2984
3589
  instructionCount: number;
2985
- /** @description Actor */
3590
+ /** @description Who created the knowledge base. `null` if unknown. */
2986
3591
  createdBy: {
3592
+ /** @description The Sanity user ID, or `sanity-system` when Sanity Context made the change. `null` if unknown. */
2987
3593
  id: string | null;
3594
+ /** @description The user's name when the action happened. `null` if unknown. For the current name, look up the user by `id`. */
2988
3595
  displayName: string | null;
2989
3596
  } | null;
2990
- /** Format: date-time */
3597
+ /**
3598
+ * Format: date-time
3599
+ * @description When the knowledge base was created.
3600
+ */
2991
3601
  createdAt: string;
2992
- /** Format: date-time */
3602
+ /**
3603
+ * Format: date-time
3604
+ * @description When the knowledge base was last updated.
3605
+ */
2993
3606
  updatedAt: string;
2994
3607
  };
2995
3608
  };
@@ -3001,13 +3614,14 @@ interface operations {
3001
3614
  query?: never;
3002
3615
  header?: never;
3003
3616
  path: {
3617
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
3004
3618
  knowledgeBaseId: string;
3005
3619
  };
3006
3620
  cookie?: never;
3007
3621
  };
3008
3622
  requestBody?: never;
3009
3623
  responses: {
3010
- /** @description Default Response */
3624
+ /** @description The knowledge base was deleted. */
3011
3625
  204: {
3012
3626
  headers: {
3013
3627
  [name: string]: unknown;
@@ -3023,6 +3637,7 @@ interface operations {
3023
3637
  query?: never;
3024
3638
  header?: never;
3025
3639
  path: {
3640
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
3026
3641
  knowledgeBaseId: string;
3027
3642
  };
3028
3643
  cookie?: never;
@@ -3030,90 +3645,165 @@ interface operations {
3030
3645
  requestBody: {
3031
3646
  content: {
3032
3647
  'application/json': {
3648
+ /** @description The knowledge base's new title. */
3033
3649
  title?: string;
3650
+ /** @description The knowledge base's new description. */
3034
3651
  description?: string;
3652
+ /** @description Whether scheduled refresh is on. Turning it off stops only scheduled refreshes, so you can still start a refresh yourself. Turning it on requires a plan that includes scheduled refresh. Requires a website or dataset source. */
3035
3653
  refreshEnabled?: boolean;
3036
- /** @enum {string} */
3654
+ /**
3655
+ * @description How often scheduled refresh runs: `weekly` or `monthly`. Requires a website or dataset source and a plan that includes scheduled refresh.
3656
+ * @enum {string}
3657
+ */
3037
3658
  refreshFrequency?: 'weekly' | 'monthly';
3038
3659
  };
3039
3660
  };
3040
3661
  };
3041
3662
  responses: {
3042
- /** @description KnowledgeBase */
3663
+ /** @description A knowledge base and its current state. */
3043
3664
  200: {
3044
3665
  headers: {
3045
3666
  [name: string]: unknown;
3046
3667
  };
3047
3668
  content: {
3048
3669
  'application/json': {
3049
- /** Format: uuid */
3670
+ /**
3671
+ * Format: uuid
3672
+ * @description The knowledge base's unique ID, a UUID. Accepted anywhere a `knowledgeBaseId` is expected.
3673
+ */
3050
3674
  id: string;
3675
+ /** @description The knowledge base ID to show users, such as `kb3do82whm`. Accepted anywhere a `knowledgeBaseId` is expected. Treat it as an opaque string. */
3051
3676
  publicId: string;
3677
+ /** @description The ID of the organization that owns the knowledge base. */
3052
3678
  organizationId: string;
3679
+ /** @description The knowledge base's title. */
3053
3680
  title: string;
3681
+ /** @description A short description of what the knowledge base covers. */
3054
3682
  description: string;
3055
- /** @enum {string} */
3683
+ /**
3684
+ * @description The knowledge base's build state. `created`: not built yet. `ready`: built, with no open issues. `review`: built, with open issues to review. A failed build doesn't change the state. `building`, `stale`, and `paused` aren't currently returned. To check for a running build, use `isBuilding`.
3685
+ * @enum {string}
3686
+ */
3056
3687
  state: 'created' | 'building' | 'ready' | 'review' | 'stale' | 'paused';
3688
+ /** @description The job ID of the most recent build, or `null` if no build has started. Check its progress with `GET .../jobs/{jobId}`. */
3057
3689
  activeJobId: string | null;
3690
+ /** @description Whether a build is running now. */
3058
3691
  isBuilding: boolean;
3692
+ /** @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`. */
3059
3693
  buildStageState: {
3694
+ /** @description The ID of the build job this progress belongs to. */
3060
3695
  jobId: string;
3696
+ /** @description The build's stages and their progress. Stages that haven't reported yet can be missing. */
3061
3697
  stages: {
3062
- /** @enum {string} */
3698
+ /**
3699
+ * @description The stage's ID. The values are listed in the order stages run.
3700
+ * @enum {string}
3701
+ */
3063
3702
  id: 'tldr' | 'map' | 'triage' | 'plan' | 'organize' | 'arrange' | 'write' | 'review' | 'polish';
3064
- /** @enum {string} */
3703
+ /**
3704
+ * @description The stage's status. `pending`: not started. `running`: in progress. `done`: finished. `failed`: the build ended before the stage finished.
3705
+ * @enum {string}
3706
+ */
3065
3707
  status: 'pending' | 'running' | 'done' | 'failed';
3708
+ /** @description The stage's progress counts. Absent when the stage hasn't reported counts. */
3066
3709
  units?: {
3067
- /** @enum {string} */
3710
+ /**
3711
+ * @description What `done` and `total` count: `sources`, `groups` of related content, `entries`, or `rounds` of final fixes. A `rounds` stage has no `total`.
3712
+ * @enum {string}
3713
+ */
3068
3714
  unit: 'sources' | 'groups' | 'entries' | 'rounds';
3715
+ /** @description How many units the stage has finished. */
3069
3716
  done: number;
3717
+ /** @description How many units the stage will process. Absent when `unit` is `rounds`. */
3070
3718
  total?: number;
3071
3719
  };
3072
3720
  }[];
3073
3721
  } | null;
3074
- /** Format: date-time */
3722
+ /**
3723
+ * Format: date-time
3724
+ * @description When a refresh last checked the knowledge base for changes, whether or not anything changed. `null` until the first refresh.
3725
+ */
3075
3726
  lastCheckedAt: string | null;
3076
- /** Format: date-time */
3727
+ /**
3728
+ * Format: date-time
3729
+ * @description When the content last changed: the time of the most recent successful build. `null` if the knowledge base has never built.
3730
+ */
3077
3731
  lastChangedAt: string | null;
3732
+ /** @description Whether sources were added, changed, or removed since the last successful build. Always `false` before the first build. */
3078
3733
  hasPendingChanges: boolean;
3734
+ /** @description Counts of sources added, changed, and removed since the last successful build. Only `GET .../knowledge-bases/{knowledgeBaseId}` computes it. `null` in list responses and before the first build. */
3079
3735
  pendingChanges: {
3736
+ /** @description Sources added since the last successful build, including sources no successful build has included yet. */
3080
3737
  added: number;
3738
+ /** @description Sources whose content changed since the last successful build. */
3081
3739
  changed: number;
3740
+ /** @description Sources that recent refreshes no longer find. */
3082
3741
  removed: number;
3083
3742
  } | null;
3743
+ /** @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. */
3084
3744
  pipelineOutdated: boolean;
3745
+ /** @description A recommendation to rebuild, because new or changed content doesn't fit the current outline. `null` when there's no recommendation. A refresh where the content fits again, a successful build, or adding or removing sources clears it. */
3085
3746
  rebuildRecommended: {
3747
+ /** @description Why a rebuild is recommended, written to show to users. */
3086
3748
  reason: string;
3087
- /** Format: date-time */
3749
+ /**
3750
+ * Format: date-time
3751
+ * @description When the recommendation was made.
3752
+ */
3088
3753
  at: string;
3089
3754
  } | null;
3755
+ /** @description Whether the knowledge base has at least one website source. */
3090
3756
  hasWebSource: boolean;
3757
+ /** @description Whether the knowledge base has at least one Sanity dataset source. */
3091
3758
  hasDatasetSource: boolean;
3759
+ /** @description How many sources the knowledge base uses, and its source limit. */
3092
3760
  sourceUsage: {
3761
+ /** @description The number of sources counted toward the limit, including parts split from large sources. */
3093
3762
  used: number;
3763
+ /** @description The maximum number of sources the knowledge base can have. */
3094
3764
  limit: number;
3095
3765
  } | null;
3096
- /** @description PlanRestriction */
3766
+ /** @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`. */
3097
3767
  buildRestriction: {
3768
+ /** @description A stable code for the restriction, such as `planLimitReached`. */
3098
3769
  code: string;
3770
+ /** @description A readable explanation that you can show to users. */
3099
3771
  message: string;
3100
3772
  } | null;
3773
+ /** @description Whether scheduled refresh is on. Only applies to knowledge bases with a website or dataset source. */
3101
3774
  refreshEnabled: boolean;
3102
- /** @enum {string} */
3775
+ /**
3776
+ * @description How often scheduled refresh runs: `weekly` (the default) or `monthly`.
3777
+ * @enum {string}
3778
+ */
3103
3779
  refreshFrequency: 'weekly' | 'monthly';
3104
- /** Format: date-time */
3780
+ /**
3781
+ * Format: date-time
3782
+ * @description When the next scheduled refresh runs. `null` when scheduled refresh is off or not scheduled yet. Only `GET .../knowledge-bases/{knowledgeBaseId}` computes it, so list responses return `null`.
3783
+ */
3105
3784
  refreshNextRunAt: string | null;
3785
+ /** @description Whether a refresh is running now. While it's `true`, a new refresh request doesn't start another one. Only `GET .../knowledge-bases/{knowledgeBaseId}` computes it, so list responses return `false`. */
3106
3786
  refreshInFlight: boolean;
3787
+ /** @description The number of open issues waiting for review. Always `0` before the first build. */
3107
3788
  openIssueCount: number;
3789
+ /** @description The number of active instructions for the knowledge base. */
3108
3790
  instructionCount: number;
3109
- /** @description Actor */
3791
+ /** @description Who created the knowledge base. `null` if unknown. */
3110
3792
  createdBy: {
3793
+ /** @description The Sanity user ID, or `sanity-system` when Sanity Context made the change. `null` if unknown. */
3111
3794
  id: string | null;
3795
+ /** @description The user's name when the action happened. `null` if unknown. For the current name, look up the user by `id`. */
3112
3796
  displayName: string | null;
3113
3797
  } | null;
3114
- /** Format: date-time */
3798
+ /**
3799
+ * Format: date-time
3800
+ * @description When the knowledge base was created.
3801
+ */
3115
3802
  createdAt: string;
3116
- /** Format: date-time */
3803
+ /**
3804
+ * Format: date-time
3805
+ * @description When the knowledge base was last updated.
3806
+ */
3117
3807
  updatedAt: string;
3118
3808
  };
3119
3809
  };
@@ -3125,19 +3815,21 @@ interface operations {
3125
3815
  query?: never;
3126
3816
  header?: never;
3127
3817
  path: {
3818
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
3128
3819
  knowledgeBaseId: string;
3129
3820
  };
3130
3821
  cookie?: never;
3131
3822
  };
3132
3823
  requestBody?: never;
3133
3824
  responses: {
3134
- /** @description JobAccepted */
3825
+ /** @description A queued job that you can poll for progress. */
3135
3826
  202: {
3136
3827
  headers: {
3137
3828
  [name: string]: unknown;
3138
3829
  };
3139
3830
  content: {
3140
3831
  'application/json': {
3832
+ /** @description The queued job's ID. Check its progress with `GET .../jobs/{jobId}`. */
3141
3833
  jobId: string;
3142
3834
  };
3143
3835
  };
@@ -3149,19 +3841,21 @@ interface operations {
3149
3841
  query?: never;
3150
3842
  header?: never;
3151
3843
  path: {
3844
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
3152
3845
  knowledgeBaseId: string;
3153
3846
  };
3154
3847
  cookie?: never;
3155
3848
  };
3156
3849
  requestBody?: never;
3157
3850
  responses: {
3158
- /** @description Default Response */
3851
+ /** @description The result of the cancel request. */
3159
3852
  200: {
3160
3853
  headers: {
3161
3854
  [name: string]: unknown;
3162
3855
  };
3163
3856
  content: {
3164
3857
  'application/json': {
3858
+ /** @description Whether a running build was cancelled. `false` when no build was running. */
3165
3859
  cancelled: boolean;
3166
3860
  };
3167
3861
  };
@@ -3173,24 +3867,31 @@ interface operations {
3173
3867
  query?: never;
3174
3868
  header?: never;
3175
3869
  path: {
3870
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
3176
3871
  knowledgeBaseId: string;
3872
+ /** @description The entry's slash-delimited path, such as `pricing/plans/free`, URL-encoded. */
3177
3873
  entryPath: string;
3178
3874
  };
3179
3875
  cookie?: never;
3180
3876
  };
3181
3877
  requestBody?: never;
3182
3878
  responses: {
3183
- /** @description RebuildEntryResponse */
3879
+ /** @description The job that rebuilds the entry, and the other entries that share its sources. */
3184
3880
  202: {
3185
3881
  headers: {
3186
3882
  [name: string]: unknown;
3187
3883
  };
3188
3884
  content: {
3189
3885
  'application/json': {
3886
+ /** @description ID of the job that rebuilds the entry. Poll it with `GET .../jobs/{jobId}`. */
3190
3887
  jobId: string;
3888
+ /** @description Other entries that cite any of this entry's sources. An instruction applies to every entry that cites its sources, so these entries can change when they are next rebuilt. */
3191
3889
  affectedEntries: {
3890
+ /** @description The entry's document ID. */
3192
3891
  id: string;
3892
+ /** @description The entry's path, such as `products/api/webhooks`. */
3193
3893
  path: string;
3894
+ /** @description The entry's title. */
3194
3895
  title: string;
3195
3896
  }[];
3196
3897
  };
@@ -3201,68 +3902,110 @@ interface operations {
3201
3902
  listImports: {
3202
3903
  parameters: {
3203
3904
  query?: {
3905
+ /** @description The `nextCursor` value from the previous page. Omit it to get the first page. */
3204
3906
  cursor?: string;
3907
+ /** @description The maximum number of items to return. */
3205
3908
  limit?: number;
3206
3909
  };
3207
3910
  header?: never;
3208
3911
  path: {
3912
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
3209
3913
  knowledgeBaseId: string;
3210
3914
  };
3211
3915
  cookie?: never;
3212
3916
  };
3213
3917
  requestBody?: never;
3214
3918
  responses: {
3215
- /** @description Default Response */
3919
+ /** @description A page of imports. */
3216
3920
  200: {
3217
3921
  headers: {
3218
3922
  [name: string]: unknown;
3219
3923
  };
3220
3924
  content: {
3221
3925
  'application/json': {
3926
+ /** @description The items on this page. */
3222
3927
  data: {
3223
- /** Format: uuid */
3928
+ /**
3929
+ * Format: uuid
3930
+ * @description The import's ID.
3931
+ */
3224
3932
  id: string;
3225
- /** Format: uuid */
3933
+ /**
3934
+ * Format: uuid
3935
+ * @description The `id` of the knowledge base that the import belongs to.
3936
+ */
3226
3937
  knowledgeBaseId: string;
3938
+ /** @description A label for the import: the file name for an upload, the root URL for a crawl, a label for a dataset query, or the title for inline text. */
3227
3939
  name: string | null;
3940
+ /** @description The size of the uploaded file or inline text, in bytes. `null` for crawl and dataset imports, and until a file upload completes. */
3228
3941
  sizeBytes: number | null;
3229
- /** @enum {string} */
3942
+ /**
3943
+ * @description The import's status. `uploading`: waiting for the file upload to complete. `processing`: content is being fetched and processed. `complete`: processing finished. `failed`: the import, or at least one of its sources, couldn't be processed. See `statusDetail` and `error` for details.
3944
+ * @enum {string}
3945
+ */
3230
3946
  status: 'uploading' | 'processing' | 'complete' | 'failed';
3231
- /** @enum {string} */
3947
+ /**
3948
+ * @description The kind of sources the import produces. `file`: uploads and inline text. `web`: crawls. `dataset`: Sanity datasets.
3949
+ * @enum {string}
3950
+ */
3232
3951
  sourceKind: 'web' | 'file' | 'dataset';
3233
- /** Format: date-time */
3952
+ /**
3953
+ * Format: date-time
3954
+ * @description When the import's website or dataset was last checked, even if nothing changed. `null` for file and text imports, and before the first check.
3955
+ */
3234
3956
  lastCheckedAt: string | null;
3957
+ /** @description The number of sources the import produced, such as crawled pages or files in an archive. Doesn't count parts split from large sources. */
3235
3958
  sourceCount: number;
3959
+ /** @description The number of sources expected to be distilled, including parts split from large sources. Excludes skipped sources. */
3236
3960
  totalDistillableCount: number;
3961
+ /** @description The number of sources distilled so far. Compare it with `totalDistillableCount` to show progress. */
3237
3962
  distilledCount: number;
3963
+ /** @description The number of sources skipped because their file type isn't supported, such as images. */
3238
3964
  unsupportedCount: number;
3965
+ /** @description A note about the import's outcome, written to show to users. It explains a failure or a partial result, such as a crawl that stopped at the source limit. `null` when there's nothing to note. Prefer it over `error`. */
3239
3966
  statusDetail: string | null;
3967
+ /** @description When `status` is `failed`, a readable reason from one failed source. `null` for any other status, or when no single source failed. */
3240
3968
  error: string | null;
3241
- /** @description CrawlOptions */
3969
+ /** @description The options the next crawl of this website uses. An empty object means the defaults. `null` for other import types, and for a crawl whose root URL was removed. */
3242
3970
  crawlOptions: {
3971
+ /** @description Regular expressions for URL paths to crawl. When set, the crawl only includes pages whose path matches one of them. */
3243
3972
  includePaths?: string[];
3973
+ /** @description Regular expressions for URL paths to skip. Pages whose path matches one of them aren't crawled. */
3244
3974
  excludePaths?: string[];
3975
+ /** @description How many levels deep the crawl goes from the root URL. */
3245
3976
  maxDepth?: number;
3977
+ /** @description Whether to crawl only the pages listed in the site's sitemap. */
3246
3978
  sitemapOnly?: boolean;
3979
+ /** @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. */
3247
3980
  ignoreQueryParameters?: boolean;
3981
+ /** @description The maximum number of pages to crawl. The crawl can stop sooner when the knowledge base reaches its source limit. */
3248
3982
  pageLimit?: number;
3249
3983
  } | null;
3250
- /** @description DatasetSourceBinding */
3984
+ /** @description The Sanity project, dataset, and full query a dataset import reads from. `null` for other import types. */
3251
3985
  datasetSource: {
3986
+ /** @description The ID of the Sanity project the documents come from. */
3252
3987
  sanityProjectId: string;
3988
+ /** @description The dataset the documents come from. */
3253
3989
  sanityDatasetId: string;
3990
+ /** @description The full GROQ query that selects the documents, exactly as saved. */
3254
3991
  query: string;
3255
3992
  } | null;
3256
- /** @description Actor */
3993
+ /** @description Who added the import. `null` if unknown. */
3257
3994
  createdBy: {
3995
+ /** @description The Sanity user ID, or `sanity-system` when Sanity Context made the change. `null` if unknown. */
3258
3996
  id: string | null;
3997
+ /** @description The user's name when the action happened. `null` if unknown. For the current name, look up the user by `id`. */
3259
3998
  displayName: string | null;
3260
3999
  } | null;
3261
- /** Format: date-time */
4000
+ /**
4001
+ * Format: date-time
4002
+ * @description When the import was created.
4003
+ */
3262
4004
  createdAt: string;
3263
4005
  /** Format: date-time */
3264
4006
  completedAt: string | null;
3265
4007
  }[];
4008
+ /** @description The cursor for the next page. Pass it as `cursor` to get more results. `null` when there are no more pages. */
3266
4009
  nextCursor: string | null;
3267
4010
  };
3268
4011
  };
@@ -3274,54 +4017,80 @@ interface operations {
3274
4017
  query?: never;
3275
4018
  header?: never;
3276
4019
  path: {
4020
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
3277
4021
  knowledgeBaseId: string;
3278
4022
  };
3279
4023
  cookie?: never;
3280
4024
  };
3281
- /** @description CreateImportInput */
4025
+ /** @description Content to add to a knowledge base. The `type` field sets the kind of import. */
3282
4026
  requestBody: {
3283
4027
  content: {
3284
4028
  'application/json': {
3285
- /** @enum {string} */
4029
+ /**
4030
+ * @description The import type. `text` imports inline content.
4031
+ * @enum {string}
4032
+ */
3286
4033
  type: 'text';
4034
+ /** @description The import's title, shown in the list of imports. */
3287
4035
  title: string;
4036
+ /** @description The text or markdown to import, up to 1,000,000 bytes of UTF-8. */
3288
4037
  content: string;
3289
4038
  /**
4039
+ * @description The format of `content`: `text/markdown` (the default) or `text/plain`.
3290
4040
  * @default text/markdown
3291
4041
  * @enum {string}
3292
4042
  */
3293
4043
  contentType?: 'text/markdown' | 'text/plain';
3294
4044
  } | {
3295
- /** Format: uri */
4045
+ /**
4046
+ * Format: uri
4047
+ * @description The URL to start crawling from. It must be a public `http` or `https` URL.
4048
+ */
3296
4049
  url: string;
3297
- /** @description CrawlOptions */
4050
+ /** @description Options for the crawl. Options you omit use the defaults. */
3298
4051
  options?: {
4052
+ /** @description Regular expressions for URL paths to crawl. When set, the crawl only includes pages whose path matches one of them. */
3299
4053
  includePaths?: string[];
4054
+ /** @description Regular expressions for URL paths to skip. Pages whose path matches one of them aren't crawled. */
3300
4055
  excludePaths?: string[];
4056
+ /** @description How many levels deep the crawl goes from the root URL. */
3301
4057
  maxDepth?: number;
4058
+ /** @description Whether to crawl only the pages listed in the site's sitemap. */
3302
4059
  sitemapOnly?: boolean;
4060
+ /** @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. */
3303
4061
  ignoreQueryParameters?: boolean;
4062
+ /** @description The maximum number of pages to crawl. The crawl can stop sooner when the knowledge base reaches its source limit. */
3304
4063
  pageLimit?: number;
3305
4064
  };
3306
- /** @enum {string} */
4065
+ /**
4066
+ * @description The import type. `crawl` imports a website.
4067
+ * @enum {string}
4068
+ */
3307
4069
  type: 'crawl';
3308
4070
  } | {
4071
+ /** @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. */
3309
4072
  sanityProjectId: string;
4073
+ /** @description The dataset to read documents from, in the project set by `sanityProjectId`. */
3310
4074
  sanityDatasetId: string;
4075
+ /** @description A GROQ query that selects the documents to import, with an optional projection. It can match up to 5,000 documents. Each refresh runs the query again. */
3311
4076
  query: string;
3312
- /** @enum {string} */
4077
+ /**
4078
+ * @description The import type. `dataset` imports documents from a Sanity dataset.
4079
+ * @enum {string}
4080
+ */
3313
4081
  type: 'dataset';
3314
4082
  };
3315
4083
  };
3316
4084
  };
3317
4085
  responses: {
3318
- /** @description JobAccepted */
4086
+ /** @description A queued job that you can poll for progress. */
3319
4087
  202: {
3320
4088
  headers: {
3321
4089
  [name: string]: unknown;
3322
4090
  };
3323
4091
  content: {
3324
4092
  'application/json': {
4093
+ /** @description The queued job's ID. Check its progress with `GET .../jobs/{jobId}`. */
3325
4094
  jobId: string;
3326
4095
  };
3327
4096
  };
@@ -3333,6 +4102,7 @@ interface operations {
3333
4102
  query?: never;
3334
4103
  header?: never;
3335
4104
  path: {
4105
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
3336
4106
  knowledgeBaseId: string;
3337
4107
  };
3338
4108
  cookie?: never;
@@ -3340,22 +4110,30 @@ interface operations {
3340
4110
  requestBody: {
3341
4111
  content: {
3342
4112
  'application/json': {
4113
+ /** @description The file's name. */
3343
4114
  filename: string;
4115
+ /** @description The file's MIME type. If you set it, the `PUT` upload must send the same `Content-Type` header. */
3344
4116
  contentType?: string;
3345
4117
  };
3346
4118
  };
3347
4119
  };
3348
4120
  responses: {
3349
- /** @description Default Response */
4121
+ /** @description The new file import and the URL to upload the file to. */
3350
4122
  201: {
3351
4123
  headers: {
3352
4124
  [name: string]: unknown;
3353
4125
  };
3354
4126
  content: {
3355
4127
  'application/json': {
3356
- /** Format: uuid */
4128
+ /**
4129
+ * Format: uuid
4130
+ * @description The ID of the new import. Use it to complete the upload and track the import.
4131
+ */
3357
4132
  importId: string;
3358
- /** Format: uri */
4133
+ /**
4134
+ * Format: uri
4135
+ * @description A signed URL to send the file to in a single `PUT` request. It expires after one hour.
4136
+ */
3359
4137
  uploadUrl: string;
3360
4138
  };
3361
4139
  };
@@ -3367,20 +4145,23 @@ interface operations {
3367
4145
  query?: never;
3368
4146
  header?: never;
3369
4147
  path: {
4148
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
3370
4149
  knowledgeBaseId: string;
4150
+ /** @description The import's ID. */
3371
4151
  importId: string;
3372
4152
  };
3373
4153
  cookie?: never;
3374
4154
  };
3375
4155
  requestBody?: never;
3376
4156
  responses: {
3377
- /** @description JobAccepted */
4157
+ /** @description A queued job that you can poll for progress. */
3378
4158
  202: {
3379
4159
  headers: {
3380
4160
  [name: string]: unknown;
3381
4161
  };
3382
4162
  content: {
3383
4163
  'application/json': {
4164
+ /** @description The queued job's ID. Check its progress with `GET .../jobs/{jobId}`. */
3384
4165
  jobId: string;
3385
4166
  };
3386
4167
  };
@@ -3392,59 +4173,98 @@ interface operations {
3392
4173
  query?: never;
3393
4174
  header?: never;
3394
4175
  path: {
4176
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
3395
4177
  knowledgeBaseId: string;
4178
+ /** @description The import's ID. */
3396
4179
  importId: string;
3397
4180
  };
3398
4181
  cookie?: never;
3399
4182
  };
3400
4183
  requestBody?: never;
3401
4184
  responses: {
3402
- /** @description Import */
4185
+ /** @description Content added to a knowledge base: a file upload, website crawl, Sanity dataset, or inline text. */
3403
4186
  200: {
3404
4187
  headers: {
3405
4188
  [name: string]: unknown;
3406
4189
  };
3407
4190
  content: {
3408
4191
  'application/json': {
3409
- /** Format: uuid */
4192
+ /**
4193
+ * Format: uuid
4194
+ * @description The import's ID.
4195
+ */
3410
4196
  id: string;
3411
- /** Format: uuid */
4197
+ /**
4198
+ * Format: uuid
4199
+ * @description The `id` of the knowledge base that the import belongs to.
4200
+ */
3412
4201
  knowledgeBaseId: string;
4202
+ /** @description A label for the import: the file name for an upload, the root URL for a crawl, a label for a dataset query, or the title for inline text. */
3413
4203
  name: string | null;
4204
+ /** @description The size of the uploaded file or inline text, in bytes. `null` for crawl and dataset imports, and until a file upload completes. */
3414
4205
  sizeBytes: number | null;
3415
- /** @enum {string} */
4206
+ /**
4207
+ * @description The import's status. `uploading`: waiting for the file upload to complete. `processing`: content is being fetched and processed. `complete`: processing finished. `failed`: the import, or at least one of its sources, couldn't be processed. See `statusDetail` and `error` for details.
4208
+ * @enum {string}
4209
+ */
3416
4210
  status: 'uploading' | 'processing' | 'complete' | 'failed';
3417
- /** @enum {string} */
4211
+ /**
4212
+ * @description The kind of sources the import produces. `file`: uploads and inline text. `web`: crawls. `dataset`: Sanity datasets.
4213
+ * @enum {string}
4214
+ */
3418
4215
  sourceKind: 'web' | 'file' | 'dataset';
3419
- /** Format: date-time */
4216
+ /**
4217
+ * Format: date-time
4218
+ * @description When the import's website or dataset was last checked, even if nothing changed. `null` for file and text imports, and before the first check.
4219
+ */
3420
4220
  lastCheckedAt: string | null;
4221
+ /** @description The number of sources the import produced, such as crawled pages or files in an archive. Doesn't count parts split from large sources. */
3421
4222
  sourceCount: number;
4223
+ /** @description The number of sources expected to be distilled, including parts split from large sources. Excludes skipped sources. */
3422
4224
  totalDistillableCount: number;
4225
+ /** @description The number of sources distilled so far. Compare it with `totalDistillableCount` to show progress. */
3423
4226
  distilledCount: number;
4227
+ /** @description The number of sources skipped because their file type isn't supported, such as images. */
3424
4228
  unsupportedCount: number;
4229
+ /** @description A note about the import's outcome, written to show to users. It explains a failure or a partial result, such as a crawl that stopped at the source limit. `null` when there's nothing to note. Prefer it over `error`. */
3425
4230
  statusDetail: string | null;
4231
+ /** @description When `status` is `failed`, a readable reason from one failed source. `null` for any other status, or when no single source failed. */
3426
4232
  error: string | null;
3427
- /** @description CrawlOptions */
4233
+ /** @description The options the next crawl of this website uses. An empty object means the defaults. `null` for other import types, and for a crawl whose root URL was removed. */
3428
4234
  crawlOptions: {
4235
+ /** @description Regular expressions for URL paths to crawl. When set, the crawl only includes pages whose path matches one of them. */
3429
4236
  includePaths?: string[];
4237
+ /** @description Regular expressions for URL paths to skip. Pages whose path matches one of them aren't crawled. */
3430
4238
  excludePaths?: string[];
4239
+ /** @description How many levels deep the crawl goes from the root URL. */
3431
4240
  maxDepth?: number;
4241
+ /** @description Whether to crawl only the pages listed in the site's sitemap. */
3432
4242
  sitemapOnly?: boolean;
4243
+ /** @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. */
3433
4244
  ignoreQueryParameters?: boolean;
4245
+ /** @description The maximum number of pages to crawl. The crawl can stop sooner when the knowledge base reaches its source limit. */
3434
4246
  pageLimit?: number;
3435
4247
  } | null;
3436
- /** @description DatasetSourceBinding */
4248
+ /** @description The Sanity project, dataset, and full query a dataset import reads from. `null` for other import types. */
3437
4249
  datasetSource: {
4250
+ /** @description The ID of the Sanity project the documents come from. */
3438
4251
  sanityProjectId: string;
4252
+ /** @description The dataset the documents come from. */
3439
4253
  sanityDatasetId: string;
4254
+ /** @description The full GROQ query that selects the documents, exactly as saved. */
3440
4255
  query: string;
3441
4256
  } | null;
3442
- /** @description Actor */
4257
+ /** @description Who added the import. `null` if unknown. */
3443
4258
  createdBy: {
4259
+ /** @description The Sanity user ID, or `sanity-system` when Sanity Context made the change. `null` if unknown. */
3444
4260
  id: string | null;
4261
+ /** @description The user's name when the action happened. `null` if unknown. For the current name, look up the user by `id`. */
3445
4262
  displayName: string | null;
3446
4263
  } | null;
3447
- /** Format: date-time */
4264
+ /**
4265
+ * Format: date-time
4266
+ * @description When the import was created.
4267
+ */
3448
4268
  createdAt: string;
3449
4269
  /** Format: date-time */
3450
4270
  completedAt: string | null;
@@ -3458,14 +4278,16 @@ interface operations {
3458
4278
  query?: never;
3459
4279
  header?: never;
3460
4280
  path: {
4281
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
3461
4282
  knowledgeBaseId: string;
4283
+ /** @description The import's ID. */
3462
4284
  importId: string;
3463
4285
  };
3464
4286
  cookie?: never;
3465
4287
  };
3466
4288
  requestBody?: never;
3467
4289
  responses: {
3468
- /** @description Default Response */
4290
+ /** @description The import and its sources were deleted. */
3469
4291
  204: {
3470
4292
  headers: {
3471
4293
  [name: string]: unknown;
@@ -3481,23 +4303,31 @@ interface operations {
3481
4303
  query?: never;
3482
4304
  header?: never;
3483
4305
  path: {
4306
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
3484
4307
  knowledgeBaseId: string;
4308
+ /** @description The import's ID. */
3485
4309
  importId: string;
3486
4310
  };
3487
4311
  cookie?: never;
3488
4312
  };
3489
4313
  requestBody?: never;
3490
4314
  responses: {
3491
- /** @description Default Response */
4315
+ /** @description A short-lived URL that downloads the import's original content. */
3492
4316
  200: {
3493
4317
  headers: {
3494
4318
  [name: string]: unknown;
3495
4319
  };
3496
4320
  content: {
3497
4321
  'application/json': {
3498
- /** Format: uri */
4322
+ /**
4323
+ * Format: uri
4324
+ * @description A signed URL that downloads the import's original content as a file.
4325
+ */
3499
4326
  url: string;
3500
- /** Format: date-time */
4327
+ /**
4328
+ * Format: date-time
4329
+ * @description When `url` expires, 10 minutes after the request.
4330
+ */
3501
4331
  expiresAt: string;
3502
4332
  };
3503
4333
  };
@@ -3509,58 +4339,89 @@ interface operations {
3509
4339
  query?: never;
3510
4340
  header?: never;
3511
4341
  path: {
4342
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
3512
4343
  knowledgeBaseId: string;
3513
4344
  };
3514
4345
  cookie?: never;
3515
4346
  };
3516
- /** @description CreateInstructionInput */
4347
+ /** @description The instruction to create, and any entries to rebuild under it. */
3517
4348
  requestBody: {
3518
4349
  content: {
3519
4350
  'application/json': {
4351
+ /** @description The instruction in plain language. Builds follow it over what the sources say. */
3520
4352
  statement: string;
4353
+ /** @description IDs of the sources the instruction applies to. Builds apply it when they write entries that cite these sources. IDs of sources that no longer exist are dropped. If none exist, the request returns `422` with code `instructionScopeVanished`. */
3521
4354
  scopeSourceIds: string[];
4355
+ /** @description Paths of entries to rebuild under the new instruction right away. The response returns the rebuild job ID in `rebuildJobId`. */
3522
4356
  rebuildPaths?: string[];
4357
+ /** @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. */
3523
4358
  verified?: boolean;
3524
4359
  };
3525
4360
  };
3526
4361
  };
3527
4362
  responses: {
3528
- /** @description CreateInstructionResponse */
4363
+ /** @description The created instruction, and the rebuild it started. */
3529
4364
  201: {
3530
4365
  headers: {
3531
4366
  [name: string]: unknown;
3532
4367
  };
3533
4368
  content: {
3534
4369
  'application/json': {
3535
- /** @description Instruction */
4370
+ /** @description The created instruction. */
3536
4371
  instruction: {
4372
+ /** @description The instruction's document ID. */
3537
4373
  id: string;
4374
+ /** @description ID of the knowledge base the instruction belongs to. */
3538
4375
  knowledgeBaseId: string;
3539
- /** @enum {string} */
4376
+ /**
4377
+ * @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.
4378
+ * @enum {string}
4379
+ */
3540
4380
  origin: 'conflict' | 'human';
3541
- /** @enum {string} */
4381
+ /**
4382
+ * @description Whether builds apply the instruction. `active`: builds apply it. `archived`: a refresh found that its sources no longer support it, so builds stop applying it. To reactivate an archived instruction, update it.
4383
+ * @enum {string}
4384
+ */
3542
4385
  status: 'active' | 'archived';
4386
+ /** @description The instruction in plain language. Builds follow it over what the sources say. */
3543
4387
  statement: string;
4388
+ /** @description IDs of the sources the instruction applies to. Builds apply it when they write entries that cite these sources. An empty array means all of its sources were removed, so it applies to no entries. */
3544
4389
  scopeSourceIds: string[];
3545
- /** Format: date-time */
4390
+ /**
4391
+ * Format: date-time
4392
+ * @description When a refresh archived the instruction. `null` while it is active.
4393
+ */
3546
4394
  archivedAt: string | null;
4395
+ /** @description Why the instruction was archived. `null` while it is active. */
3547
4396
  archivedReason: string | null;
4397
+ /** @description ID of the conflict issue this instruction records. `null` when `origin` is `human`. */
3548
4398
  sourceIssueId: string | null;
3549
- /** @description Actor */
4399
+ /** @description Who created the instruction. `null` for instructions created by resolving a conflict, and when the creator is unknown. */
3550
4400
  createdBy: {
4401
+ /** @description The Sanity user ID, or `sanity-system` when Sanity Context made the change. `null` if unknown. */
3551
4402
  id: string | null;
4403
+ /** @description The user's name when the action happened. `null` if unknown. For the current name, look up the user by `id`. */
3552
4404
  displayName: string | null;
3553
4405
  } | null;
3554
- /** @description Actor */
4406
+ /** @description Who last updated the instruction through the API. `null` when it was never updated, or when the person is unknown. */
3555
4407
  updatedBy: {
4408
+ /** @description The Sanity user ID, or `sanity-system` when Sanity Context made the change. `null` if unknown. */
3556
4409
  id: string | null;
4410
+ /** @description The user's name when the action happened. `null` if unknown. For the current name, look up the user by `id`. */
3557
4411
  displayName: string | null;
3558
4412
  } | null;
3559
- /** Format: date-time */
4413
+ /**
4414
+ * Format: date-time
4415
+ * @description When the instruction was created.
4416
+ */
3560
4417
  createdAt: string;
3561
- /** Format: date-time */
4418
+ /**
4419
+ * Format: date-time
4420
+ * @description When the instruction last changed, including changes a refresh makes. `null` when the time is unknown.
4421
+ */
3562
4422
  updatedAt: string | null;
3563
4423
  };
4424
+ /** @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. */
3564
4425
  rebuildJobId: string | null;
3565
4426
  };
3566
4427
  };
@@ -3572,14 +4433,16 @@ interface operations {
3572
4433
  query?: never;
3573
4434
  header?: never;
3574
4435
  path: {
4436
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
3575
4437
  knowledgeBaseId: string;
4438
+ /** @description The instruction's ID. */
3576
4439
  instructionId: string;
3577
4440
  };
3578
4441
  cookie?: never;
3579
4442
  };
3580
4443
  requestBody?: never;
3581
4444
  responses: {
3582
- /** @description Default Response */
4445
+ /** @description The instruction was deleted. */
3583
4446
  204: {
3584
4447
  headers: {
3585
4448
  [name: string]: unknown;
@@ -3595,53 +4458,82 @@ interface operations {
3595
4458
  query?: never;
3596
4459
  header?: never;
3597
4460
  path: {
4461
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
3598
4462
  knowledgeBaseId: string;
4463
+ /** @description The instruction's ID. */
3599
4464
  instructionId: string;
3600
4465
  };
3601
4466
  cookie?: never;
3602
4467
  };
3603
- /** @description UpdateInstructionInput */
4468
+ /** @description The changes to make to an instruction. Set `statement`, `scopeSourceIds`, or both. Any update also reactivates an archived instruction. */
3604
4469
  requestBody: {
3605
4470
  content: {
3606
4471
  'application/json': {
4472
+ /** @description The new instruction text. Omit it to keep the current text. */
3607
4473
  statement?: string;
4474
+ /** @description IDs of the sources the instruction applies to. Replaces the current list. Omit it to keep the current sources. IDs of sources that no longer exist are dropped. If none exist, the request returns `422` with code `instructionScopeVanished`. */
3608
4475
  scopeSourceIds?: string[];
3609
4476
  };
3610
4477
  };
3611
4478
  };
3612
4479
  responses: {
3613
- /** @description Instruction */
4480
+ /** @description A standing instruction that shapes how entries that cite its sources are written. */
3614
4481
  200: {
3615
4482
  headers: {
3616
4483
  [name: string]: unknown;
3617
4484
  };
3618
4485
  content: {
3619
4486
  'application/json': {
4487
+ /** @description The instruction's document ID. */
3620
4488
  id: string;
4489
+ /** @description ID of the knowledge base the instruction belongs to. */
3621
4490
  knowledgeBaseId: string;
3622
- /** @enum {string} */
4491
+ /**
4492
+ * @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.
4493
+ * @enum {string}
4494
+ */
3623
4495
  origin: 'conflict' | 'human';
3624
- /** @enum {string} */
4496
+ /**
4497
+ * @description Whether builds apply the instruction. `active`: builds apply it. `archived`: a refresh found that its sources no longer support it, so builds stop applying it. To reactivate an archived instruction, update it.
4498
+ * @enum {string}
4499
+ */
3625
4500
  status: 'active' | 'archived';
4501
+ /** @description The instruction in plain language. Builds follow it over what the sources say. */
3626
4502
  statement: string;
4503
+ /** @description IDs of the sources the instruction applies to. Builds apply it when they write entries that cite these sources. An empty array means all of its sources were removed, so it applies to no entries. */
3627
4504
  scopeSourceIds: string[];
3628
- /** Format: date-time */
4505
+ /**
4506
+ * Format: date-time
4507
+ * @description When a refresh archived the instruction. `null` while it is active.
4508
+ */
3629
4509
  archivedAt: string | null;
4510
+ /** @description Why the instruction was archived. `null` while it is active. */
3630
4511
  archivedReason: string | null;
4512
+ /** @description ID of the conflict issue this instruction records. `null` when `origin` is `human`. */
3631
4513
  sourceIssueId: string | null;
3632
- /** @description Actor */
4514
+ /** @description Who created the instruction. `null` for instructions created by resolving a conflict, and when the creator is unknown. */
3633
4515
  createdBy: {
4516
+ /** @description The Sanity user ID, or `sanity-system` when Sanity Context made the change. `null` if unknown. */
3634
4517
  id: string | null;
4518
+ /** @description The user's name when the action happened. `null` if unknown. For the current name, look up the user by `id`. */
3635
4519
  displayName: string | null;
3636
4520
  } | null;
3637
- /** @description Actor */
4521
+ /** @description Who last updated the instruction through the API. `null` when it was never updated, or when the person is unknown. */
3638
4522
  updatedBy: {
4523
+ /** @description The Sanity user ID, or `sanity-system` when Sanity Context made the change. `null` if unknown. */
3639
4524
  id: string | null;
4525
+ /** @description The user's name when the action happened. `null` if unknown. For the current name, look up the user by `id`. */
3640
4526
  displayName: string | null;
3641
4527
  } | null;
3642
- /** Format: date-time */
4528
+ /**
4529
+ * Format: date-time
4530
+ * @description When the instruction was created.
4531
+ */
3643
4532
  createdAt: string;
3644
- /** Format: date-time */
4533
+ /**
4534
+ * Format: date-time
4535
+ * @description When the instruction last changed, including changes a refresh makes. `null` when the time is unknown.
4536
+ */
3645
4537
  updatedAt: string | null;
3646
4538
  };
3647
4539
  };
@@ -3653,6 +4545,7 @@ interface operations {
3653
4545
  query?: never;
3654
4546
  header?: never;
3655
4547
  path: {
4548
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
3656
4549
  knowledgeBaseId: string;
3657
4550
  };
3658
4551
  cookie?: never;
@@ -3660,18 +4553,20 @@ interface operations {
3660
4553
  requestBody: {
3661
4554
  content: {
3662
4555
  'application/json': {
4556
+ /** @description The IDs of the issues to accept and apply. */
3663
4557
  issueIds: string[];
3664
4558
  };
3665
4559
  };
3666
4560
  };
3667
4561
  responses: {
3668
- /** @description JobAccepted */
4562
+ /** @description A queued job that you can poll for progress. */
3669
4563
  202: {
3670
4564
  headers: {
3671
4565
  [name: string]: unknown;
3672
4566
  };
3673
4567
  content: {
3674
4568
  'application/json': {
4569
+ /** @description The queued job's ID. Check its progress with `GET .../jobs/{jobId}`. */
3675
4570
  jobId: string;
3676
4571
  };
3677
4572
  };
@@ -3683,71 +4578,123 @@ interface operations {
3683
4578
  query?: never;
3684
4579
  header?: never;
3685
4580
  path: {
4581
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
3686
4582
  knowledgeBaseId: string;
4583
+ /** @description The issue's document ID. */
3687
4584
  issueId: string;
3688
4585
  };
3689
4586
  cookie?: never;
3690
4587
  };
3691
4588
  requestBody?: never;
3692
4589
  responses: {
3693
- /** @description Issue */
4590
+ /** @description An issue found in a knowledge base, and its triage status. */
3694
4591
  200: {
3695
4592
  headers: {
3696
4593
  [name: string]: unknown;
3697
4594
  };
3698
4595
  content: {
3699
4596
  'application/json': {
4597
+ /** @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. */
3700
4598
  id: string;
4599
+ /** @description ID of the knowledge base the issue belongs to. */
3701
4600
  knowledgeBaseId: string;
3702
- /** @description IssueContent */
4601
+ /** @description What the issue found. The shape depends on `kind`. */
3703
4602
  content: {
3704
- /** @enum {string} */
4603
+ /**
4604
+ * @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.
4605
+ * @enum {string}
4606
+ */
3705
4607
  severity: 'critical' | 'suggestion';
4608
+ /** @description Path of the entry the issue is about, or `*` when it applies to the whole knowledge base. For `add_entry`, the path of the proposed entry. */
3706
4609
  scopePath: string;
4610
+ /** @description What the problem is, in one or two sentences. */
3707
4611
  issue: string;
4612
+ /** @description What to do to fix the issue. */
3708
4613
  suggestedFix: string;
3709
- /** @enum {string} */
4614
+ /**
4615
+ * @description The issue type. `conflict` means two or more positions disagree on the same fact, and you choose which one is correct.
4616
+ * @enum {string}
4617
+ */
3710
4618
  kind: 'conflict';
4619
+ /** @description A key naming the disputed fact, such as `free_tier.request_limit`. It never includes the disputed value, so every side shares it. */
3711
4620
  claimKey: string;
4621
+ /** @description The conflicting positions, at least two. To resolve the conflict, pass the index of one side as `resolution`. */
3712
4622
  sides: {
4623
+ /** @description The position as a self-contained sentence. This is the option you choose from. */
3713
4624
  claim: string;
4625
+ /** @description The disputed value on its own, such as `10,000/month`, without the sentence. */
3714
4626
  value?: string;
4627
+ /** @description Paths of the entries that state this position. */
3715
4628
  entryPaths?: string[];
4629
+ /** @description IDs of the sources that directly back this position. */
3716
4630
  sourceIds?: string[];
3717
- /** @description ConflictSpan */
4631
+ /** @description Where in a source this position was read. */
3718
4632
  span?: {
4633
+ /** @description ID of the source the position was read from. */
3719
4634
  sourceId: string;
4635
+ /** @description First line of the range, counting from 1. Line numbers match `GET .../sources/{sourceId}/content`. */
3720
4636
  lineStart: number;
4637
+ /** @description Last line of the range, inclusive. */
3721
4638
  lineEnd: number;
3722
4639
  };
3723
- /** @enum {string} */
4640
+ /**
4641
+ * @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.
4642
+ * @enum {string}
4643
+ */
3724
4644
  authority?: 'primary' | 'secondary' | 'community';
3725
4645
  }[];
4646
+ /** @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. */
3726
4647
  suggested?: number;
3727
4648
  } | {
3728
- /** @enum {string} */
4649
+ /**
4650
+ * @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.
4651
+ * @enum {string}
4652
+ */
3729
4653
  severity: 'critical' | 'suggestion';
4654
+ /** @description Path of the entry the issue is about, or `*` when it applies to the whole knowledge base. For `add_entry`, the path of the proposed entry. */
3730
4655
  scopePath: string;
4656
+ /** @description What the problem is, in one or two sentences. */
3731
4657
  issue: string;
4658
+ /** @description What to do to fix the issue. */
3732
4659
  suggestedFix: string;
3733
- /** @enum {string} */
4660
+ /**
4661
+ * @description The issue type. `gap`: your sources cover material that entries leave out. `update_required`: an entry is out of date with its sources or contradicts an instruction, and needs a rewrite. `add_entry`: your sources cover a topic that no entry covers. `remove_entry`: an entry has lost its sources or its topic no longer applies. `split_entry`: an entry covers several distinct topics and should become child entries. `merge_entry`: an entry has too few sources to stand alone, so merge it into a nearby entry or keep it as it is.
4662
+ * @enum {string}
4663
+ */
3734
4664
  kind: 'gap' | 'update_required' | 'add_entry' | 'remove_entry' | 'split_entry' | 'merge_entry';
4665
+ /** @description IDs of the sources that led to the issue. For `add_entry`, the sources the new entry would cite. */
3735
4666
  citedSourceIds?: string[];
4667
+ /** @description A key naming the specific finding, when the check that found it sets one. */
3736
4668
  claimKey?: string;
4669
+ /** @description Paths of the entries the issue involves, when it spans more than one entry. */
3737
4670
  involvedScopes?: string[];
3738
4671
  };
3739
- /** @enum {string} */
4672
+ /**
4673
+ * @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`.
4674
+ * @enum {string}
4675
+ */
3740
4676
  status: 'open' | 'accepted' | 'rejected';
4677
+ /** @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. */
3741
4678
  resolution: number | null;
3742
- /** @description IssueResolvedBy */
4679
+ /** @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. */
3743
4680
  resolvedBy: {
4681
+ /** @description Sanity user ID of the person or robot that triaged the issue. */
3744
4682
  id: string;
3745
- /** @enum {string} */
4683
+ /**
4684
+ * @description `user` when a person made the decision. `robot` when a robot token did, such as an agent.
4685
+ * @enum {string}
4686
+ */
3746
4687
  kind: 'user' | 'robot';
3747
4688
  } | null;
3748
- /** Format: date-time */
4689
+ /**
4690
+ * Format: date-time
4691
+ * @description When the issue was first filed.
4692
+ */
3749
4693
  createdAt: string;
3750
- /** Format: date-time */
4694
+ /**
4695
+ * Format: date-time
4696
+ * @description When the issue left `open`. `null` while the issue is open.
4697
+ */
3751
4698
  resolvedAt: string | null;
3752
4699
  };
3753
4700
  };
@@ -3759,71 +4706,123 @@ interface operations {
3759
4706
  query?: never;
3760
4707
  header?: never;
3761
4708
  path: {
4709
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
3762
4710
  knowledgeBaseId: string;
4711
+ /** @description The issue's document ID. */
3763
4712
  issueId: string;
3764
4713
  };
3765
4714
  cookie?: never;
3766
4715
  };
3767
4716
  requestBody?: never;
3768
4717
  responses: {
3769
- /** @description Issue */
4718
+ /** @description An issue found in a knowledge base, and its triage status. */
3770
4719
  200: {
3771
4720
  headers: {
3772
4721
  [name: string]: unknown;
3773
4722
  };
3774
4723
  content: {
3775
4724
  'application/json': {
4725
+ /** @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. */
3776
4726
  id: string;
4727
+ /** @description ID of the knowledge base the issue belongs to. */
3777
4728
  knowledgeBaseId: string;
3778
- /** @description IssueContent */
4729
+ /** @description What the issue found. The shape depends on `kind`. */
3779
4730
  content: {
3780
- /** @enum {string} */
4731
+ /**
4732
+ * @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.
4733
+ * @enum {string}
4734
+ */
3781
4735
  severity: 'critical' | 'suggestion';
4736
+ /** @description Path of the entry the issue is about, or `*` when it applies to the whole knowledge base. For `add_entry`, the path of the proposed entry. */
3782
4737
  scopePath: string;
4738
+ /** @description What the problem is, in one or two sentences. */
3783
4739
  issue: string;
4740
+ /** @description What to do to fix the issue. */
3784
4741
  suggestedFix: string;
3785
- /** @enum {string} */
4742
+ /**
4743
+ * @description The issue type. `conflict` means two or more positions disagree on the same fact, and you choose which one is correct.
4744
+ * @enum {string}
4745
+ */
3786
4746
  kind: 'conflict';
4747
+ /** @description A key naming the disputed fact, such as `free_tier.request_limit`. It never includes the disputed value, so every side shares it. */
3787
4748
  claimKey: string;
4749
+ /** @description The conflicting positions, at least two. To resolve the conflict, pass the index of one side as `resolution`. */
3788
4750
  sides: {
4751
+ /** @description The position as a self-contained sentence. This is the option you choose from. */
3789
4752
  claim: string;
4753
+ /** @description The disputed value on its own, such as `10,000/month`, without the sentence. */
3790
4754
  value?: string;
4755
+ /** @description Paths of the entries that state this position. */
3791
4756
  entryPaths?: string[];
4757
+ /** @description IDs of the sources that directly back this position. */
3792
4758
  sourceIds?: string[];
3793
- /** @description ConflictSpan */
4759
+ /** @description Where in a source this position was read. */
3794
4760
  span?: {
4761
+ /** @description ID of the source the position was read from. */
3795
4762
  sourceId: string;
4763
+ /** @description First line of the range, counting from 1. Line numbers match `GET .../sources/{sourceId}/content`. */
3796
4764
  lineStart: number;
4765
+ /** @description Last line of the range, inclusive. */
3797
4766
  lineEnd: number;
3798
4767
  };
3799
- /** @enum {string} */
4768
+ /**
4769
+ * @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.
4770
+ * @enum {string}
4771
+ */
3800
4772
  authority?: 'primary' | 'secondary' | 'community';
3801
4773
  }[];
4774
+ /** @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. */
3802
4775
  suggested?: number;
3803
4776
  } | {
3804
- /** @enum {string} */
4777
+ /**
4778
+ * @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.
4779
+ * @enum {string}
4780
+ */
3805
4781
  severity: 'critical' | 'suggestion';
4782
+ /** @description Path of the entry the issue is about, or `*` when it applies to the whole knowledge base. For `add_entry`, the path of the proposed entry. */
3806
4783
  scopePath: string;
4784
+ /** @description What the problem is, in one or two sentences. */
3807
4785
  issue: string;
4786
+ /** @description What to do to fix the issue. */
3808
4787
  suggestedFix: string;
3809
- /** @enum {string} */
4788
+ /**
4789
+ * @description The issue type. `gap`: your sources cover material that entries leave out. `update_required`: an entry is out of date with its sources or contradicts an instruction, and needs a rewrite. `add_entry`: your sources cover a topic that no entry covers. `remove_entry`: an entry has lost its sources or its topic no longer applies. `split_entry`: an entry covers several distinct topics and should become child entries. `merge_entry`: an entry has too few sources to stand alone, so merge it into a nearby entry or keep it as it is.
4790
+ * @enum {string}
4791
+ */
3810
4792
  kind: 'gap' | 'update_required' | 'add_entry' | 'remove_entry' | 'split_entry' | 'merge_entry';
4793
+ /** @description IDs of the sources that led to the issue. For `add_entry`, the sources the new entry would cite. */
3811
4794
  citedSourceIds?: string[];
4795
+ /** @description A key naming the specific finding, when the check that found it sets one. */
3812
4796
  claimKey?: string;
4797
+ /** @description Paths of the entries the issue involves, when it spans more than one entry. */
3813
4798
  involvedScopes?: string[];
3814
4799
  };
3815
- /** @enum {string} */
4800
+ /**
4801
+ * @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`.
4802
+ * @enum {string}
4803
+ */
3816
4804
  status: 'open' | 'accepted' | 'rejected';
4805
+ /** @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. */
3817
4806
  resolution: number | null;
3818
- /** @description IssueResolvedBy */
4807
+ /** @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. */
3819
4808
  resolvedBy: {
4809
+ /** @description Sanity user ID of the person or robot that triaged the issue. */
3820
4810
  id: string;
3821
- /** @enum {string} */
4811
+ /**
4812
+ * @description `user` when a person made the decision. `robot` when a robot token did, such as an agent.
4813
+ * @enum {string}
4814
+ */
3822
4815
  kind: 'user' | 'robot';
3823
4816
  } | null;
3824
- /** Format: date-time */
4817
+ /**
4818
+ * Format: date-time
4819
+ * @description When the issue was first filed.
4820
+ */
3825
4821
  createdAt: string;
3826
- /** Format: date-time */
4822
+ /**
4823
+ * Format: date-time
4824
+ * @description When the issue left `open`. `null` while the issue is open.
4825
+ */
3827
4826
  resolvedAt: string | null;
3828
4827
  };
3829
4828
  };
@@ -3835,7 +4834,9 @@ interface operations {
3835
4834
  query?: never;
3836
4835
  header?: never;
3837
4836
  path: {
4837
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
3838
4838
  knowledgeBaseId: string;
4839
+ /** @description The issue's document ID. */
3839
4840
  issueId: string;
3840
4841
  };
3841
4842
  cookie?: never;
@@ -3843,73 +4844,125 @@ interface operations {
3843
4844
  requestBody: {
3844
4845
  content: {
3845
4846
  'application/json': {
4847
+ /** @description The index of the chosen side in the issue's `content.sides`. */
3846
4848
  resolution: number;
3847
4849
  };
3848
4850
  };
3849
4851
  };
3850
4852
  responses: {
3851
- /** @description ResolveIssueResponse */
4853
+ /** @description The resolved issue, plus the job that rewrites the entry when the decision changes it. */
3852
4854
  200: {
3853
4855
  headers: {
3854
4856
  [name: string]: unknown;
3855
4857
  };
3856
4858
  content: {
3857
4859
  'application/json': {
3858
- /** @description Issue */
4860
+ /** @description The resolved conflict issue, now `accepted`. */
3859
4861
  issue: {
4862
+ /** @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. */
3860
4863
  id: string;
4864
+ /** @description ID of the knowledge base the issue belongs to. */
3861
4865
  knowledgeBaseId: string;
3862
- /** @description IssueContent */
4866
+ /** @description What the issue found. The shape depends on `kind`. */
3863
4867
  content: {
3864
- /** @enum {string} */
4868
+ /**
4869
+ * @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.
4870
+ * @enum {string}
4871
+ */
3865
4872
  severity: 'critical' | 'suggestion';
4873
+ /** @description Path of the entry the issue is about, or `*` when it applies to the whole knowledge base. For `add_entry`, the path of the proposed entry. */
3866
4874
  scopePath: string;
4875
+ /** @description What the problem is, in one or two sentences. */
3867
4876
  issue: string;
4877
+ /** @description What to do to fix the issue. */
3868
4878
  suggestedFix: string;
3869
- /** @enum {string} */
4879
+ /**
4880
+ * @description The issue type. `conflict` means two or more positions disagree on the same fact, and you choose which one is correct.
4881
+ * @enum {string}
4882
+ */
3870
4883
  kind: 'conflict';
4884
+ /** @description A key naming the disputed fact, such as `free_tier.request_limit`. It never includes the disputed value, so every side shares it. */
3871
4885
  claimKey: string;
4886
+ /** @description The conflicting positions, at least two. To resolve the conflict, pass the index of one side as `resolution`. */
3872
4887
  sides: {
4888
+ /** @description The position as a self-contained sentence. This is the option you choose from. */
3873
4889
  claim: string;
4890
+ /** @description The disputed value on its own, such as `10,000/month`, without the sentence. */
3874
4891
  value?: string;
4892
+ /** @description Paths of the entries that state this position. */
3875
4893
  entryPaths?: string[];
4894
+ /** @description IDs of the sources that directly back this position. */
3876
4895
  sourceIds?: string[];
3877
- /** @description ConflictSpan */
4896
+ /** @description Where in a source this position was read. */
3878
4897
  span?: {
4898
+ /** @description ID of the source the position was read from. */
3879
4899
  sourceId: string;
4900
+ /** @description First line of the range, counting from 1. Line numbers match `GET .../sources/{sourceId}/content`. */
3880
4901
  lineStart: number;
4902
+ /** @description Last line of the range, inclusive. */
3881
4903
  lineEnd: number;
3882
4904
  };
3883
- /** @enum {string} */
4905
+ /**
4906
+ * @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.
4907
+ * @enum {string}
4908
+ */
3884
4909
  authority?: 'primary' | 'secondary' | 'community';
3885
4910
  }[];
4911
+ /** @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. */
3886
4912
  suggested?: number;
3887
4913
  } | {
3888
- /** @enum {string} */
4914
+ /**
4915
+ * @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.
4916
+ * @enum {string}
4917
+ */
3889
4918
  severity: 'critical' | 'suggestion';
4919
+ /** @description Path of the entry the issue is about, or `*` when it applies to the whole knowledge base. For `add_entry`, the path of the proposed entry. */
3890
4920
  scopePath: string;
4921
+ /** @description What the problem is, in one or two sentences. */
3891
4922
  issue: string;
4923
+ /** @description What to do to fix the issue. */
3892
4924
  suggestedFix: string;
3893
- /** @enum {string} */
4925
+ /**
4926
+ * @description The issue type. `gap`: your sources cover material that entries leave out. `update_required`: an entry is out of date with its sources or contradicts an instruction, and needs a rewrite. `add_entry`: your sources cover a topic that no entry covers. `remove_entry`: an entry has lost its sources or its topic no longer applies. `split_entry`: an entry covers several distinct topics and should become child entries. `merge_entry`: an entry has too few sources to stand alone, so merge it into a nearby entry or keep it as it is.
4927
+ * @enum {string}
4928
+ */
3894
4929
  kind: 'gap' | 'update_required' | 'add_entry' | 'remove_entry' | 'split_entry' | 'merge_entry';
4930
+ /** @description IDs of the sources that led to the issue. For `add_entry`, the sources the new entry would cite. */
3895
4931
  citedSourceIds?: string[];
4932
+ /** @description A key naming the specific finding, when the check that found it sets one. */
3896
4933
  claimKey?: string;
4934
+ /** @description Paths of the entries the issue involves, when it spans more than one entry. */
3897
4935
  involvedScopes?: string[];
3898
4936
  };
3899
- /** @enum {string} */
4937
+ /**
4938
+ * @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`.
4939
+ * @enum {string}
4940
+ */
3900
4941
  status: 'open' | 'accepted' | 'rejected';
4942
+ /** @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. */
3901
4943
  resolution: number | null;
3902
- /** @description IssueResolvedBy */
4944
+ /** @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. */
3903
4945
  resolvedBy: {
4946
+ /** @description Sanity user ID of the person or robot that triaged the issue. */
3904
4947
  id: string;
3905
- /** @enum {string} */
4948
+ /**
4949
+ * @description `user` when a person made the decision. `robot` when a robot token did, such as an agent.
4950
+ * @enum {string}
4951
+ */
3906
4952
  kind: 'user' | 'robot';
3907
4953
  } | null;
3908
- /** Format: date-time */
4954
+ /**
4955
+ * Format: date-time
4956
+ * @description When the issue was first filed.
4957
+ */
3909
4958
  createdAt: string;
3910
- /** Format: date-time */
4959
+ /**
4960
+ * Format: date-time
4961
+ * @description When the issue left `open`. `null` while the issue is open.
4962
+ */
3911
4963
  resolvedAt: string | null;
3912
4964
  };
4965
+ /** @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. */
3913
4966
  jobId: string | null;
3914
4967
  };
3915
4968
  };
@@ -3921,28 +4974,42 @@ interface operations {
3921
4974
  query?: never;
3922
4975
  header?: never;
3923
4976
  path: {
4977
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
3924
4978
  knowledgeBaseId: string;
4979
+ /** @description The job ID returned by the endpoint that started the work. */
3925
4980
  jobId: string;
3926
4981
  };
3927
4982
  cookie?: never;
3928
4983
  };
3929
4984
  requestBody?: never;
3930
4985
  responses: {
3931
- /** @description Job */
4986
+ /** @description A background job, such as a build, refresh, or import, and its status. */
3932
4987
  200: {
3933
4988
  headers: {
3934
4989
  [name: string]: unknown;
3935
4990
  };
3936
4991
  content: {
3937
4992
  'application/json': {
4993
+ /** @description The job's ID. */
3938
4994
  id: string;
3939
- /** @enum {string} */
4995
+ /**
4996
+ * @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.
4997
+ * @enum {string}
4998
+ */
3940
4999
  status: 'pending' | 'queued' | 'running' | 'succeeded' | 'failed' | 'cancelled';
3941
- /** Format: date-time */
5000
+ /**
5001
+ * Format: date-time
5002
+ * @description When the job started.
5003
+ */
3942
5004
  startedAt: string | null;
3943
- /** Format: date-time */
5005
+ /**
5006
+ * Format: date-time
5007
+ * @description When the job finished. `null` while the job is queued or running.
5008
+ */
3944
5009
  completedAt: string | null;
5010
+ /** @description The job's output. Only present when `status` is `succeeded`. Its shape depends on the kind of job. */
3945
5011
  result?: unknown;
5012
+ /** @description A readable reason the job failed or was cancelled. `null` for any other status. */
3946
5013
  error?: string | null;
3947
5014
  };
3948
5015
  };
@@ -3954,20 +5021,23 @@ interface operations {
3954
5021
  query?: never;
3955
5022
  header?: never;
3956
5023
  path: {
5024
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
3957
5025
  knowledgeBaseId: string;
3958
5026
  };
3959
5027
  cookie?: never;
3960
5028
  };
3961
5029
  requestBody?: never;
3962
5030
  responses: {
3963
- /** @description RefreshAccepted */
5031
+ /** @description A queued refresh job that you can poll for progress. */
3964
5032
  202: {
3965
5033
  headers: {
3966
5034
  [name: string]: unknown;
3967
5035
  };
3968
5036
  content: {
3969
5037
  'application/json': {
5038
+ /** @description The queued job's ID. Check its progress with `GET .../jobs/{jobId}`. */
3970
5039
  jobId: string;
5040
+ /** @description Whether this request started a new refresh. `false` means a refresh was already running, and `jobId` is that refresh. */
3971
5041
  started: boolean;
3972
5042
  };
3973
5043
  };
@@ -3977,49 +5047,84 @@ interface operations {
3977
5047
  listSources: {
3978
5048
  parameters: {
3979
5049
  query?: {
5050
+ /** @description The `nextCursor` value from the previous page. Omit it to get the first page. */
3980
5051
  cursor?: string;
5052
+ /** @description The maximum number of items to return. */
3981
5053
  limit?: number;
5054
+ /** @description Return only sources with this status. */
3982
5055
  status?: 'pending' | 'processing' | 'ready' | 'failed' | 'skipped';
5056
+ /** @description Return only the sources that this import produced. */
3983
5057
  importId?: string;
5058
+ /** @description Comma-separated IDs of the sources to return, up to 200. Includes the parts of large sources that were split, which the default list leaves out. When set, `status` and `cursor` are ignored and every matching source is returned in one page. */
3984
5059
  ids?: string;
3985
5060
  };
3986
5061
  header?: never;
3987
5062
  path: {
5063
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
3988
5064
  knowledgeBaseId: string;
3989
5065
  };
3990
5066
  cookie?: never;
3991
5067
  };
3992
5068
  requestBody?: never;
3993
5069
  responses: {
3994
- /** @description Default Response */
5070
+ /** @description A page of sources. */
3995
5071
  200: {
3996
5072
  headers: {
3997
5073
  [name: string]: unknown;
3998
5074
  };
3999
5075
  content: {
4000
5076
  'application/json': {
5077
+ /** @description The items on this page. */
4001
5078
  data: {
4002
- /** Format: uuid */
5079
+ /**
5080
+ * Format: uuid
5081
+ * @description The source's ID.
5082
+ */
4003
5083
  id: string;
4004
- /** Format: uuid */
5084
+ /**
5085
+ * Format: uuid
5086
+ * @description The `id` of the knowledge base that the source belongs to.
5087
+ */
4005
5088
  knowledgeBaseId: string;
5089
+ /** @description The source's name: the file name for an upload, the page title for a web page, or the document title for a dataset document. */
4006
5090
  filename: string;
4007
- /** @enum {string} */
5091
+ /**
5092
+ * @description Where the source came from. `web`: a crawled web page. `file`: an uploaded file or inline text. `dataset`: a document from a Sanity dataset.
5093
+ * @enum {string}
5094
+ */
4008
5095
  kind: 'web' | 'file' | 'dataset';
5096
+ /** @description The source's size in bytes. */
4009
5097
  sizeBytes: number;
4010
- /** @enum {string} */
5098
+ /**
5099
+ * @description The source's processing status. `pending`: waiting to be processed. `processing`: distilled and being summarized. `ready`: processed and available to builds. `failed`: couldn't be processed. `skipped`: not processed, because its file type isn't supported, it's too large, or it was split into smaller sources.
5100
+ * @enum {string}
5101
+ */
4011
5102
  status: 'pending' | 'processing' | 'ready' | 'failed' | 'skipped';
5103
+ /** @description A short summary of the source. `null` until the source is summarized. */
4012
5104
  tldr: string | null;
5105
+ /** @description Topics the source covers. `null` until the source is summarized. */
4013
5106
  topics: string[] | null;
5107
+ /** @description The page URL of a `web` source. `null` for other kinds. */
4014
5108
  canonicalUrl: string | null;
5109
+ /** @description The `_id` of the Sanity document a `dataset` source came from. Use it to find the document in your studio. `null` for other kinds. */
4015
5110
  externalId: string | null;
4016
- /** Format: date-time */
5111
+ /**
5112
+ * Format: date-time
5113
+ * @description When the source's content was last fetched.
5114
+ */
4017
5115
  fetchedAt: string | null;
4018
- /** Format: date-time */
5116
+ /**
5117
+ * Format: date-time
5118
+ * @description When the source's content was last distilled into markdown. `null` until it's distilled.
5119
+ */
4019
5120
  distilledAt: string | null;
4020
- /** Format: date-time */
5121
+ /**
5122
+ * Format: date-time
5123
+ * @description When the source was added.
5124
+ */
4021
5125
  createdAt: string;
4022
5126
  }[];
5127
+ /** @description The cursor for the next page. Pass it as `cursor` to get more results. `null` when there are no more pages. */
4023
5128
  nextCursor: string | null;
4024
5129
  };
4025
5130
  };
@@ -4031,39 +5136,68 @@ interface operations {
4031
5136
  query?: never;
4032
5137
  header?: never;
4033
5138
  path: {
5139
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
4034
5140
  knowledgeBaseId: string;
5141
+ /** @description The source's ID. */
4035
5142
  sourceId: string;
4036
5143
  };
4037
5144
  cookie?: never;
4038
5145
  };
4039
5146
  requestBody?: never;
4040
5147
  responses: {
4041
- /** @description Source */
5148
+ /** @description A page, file, or document that an import produced and that builds cite. */
4042
5149
  200: {
4043
5150
  headers: {
4044
5151
  [name: string]: unknown;
4045
5152
  };
4046
5153
  content: {
4047
5154
  'application/json': {
4048
- /** Format: uuid */
5155
+ /**
5156
+ * Format: uuid
5157
+ * @description The source's ID.
5158
+ */
4049
5159
  id: string;
4050
- /** Format: uuid */
5160
+ /**
5161
+ * Format: uuid
5162
+ * @description The `id` of the knowledge base that the source belongs to.
5163
+ */
4051
5164
  knowledgeBaseId: string;
5165
+ /** @description The source's name: the file name for an upload, the page title for a web page, or the document title for a dataset document. */
4052
5166
  filename: string;
4053
- /** @enum {string} */
5167
+ /**
5168
+ * @description Where the source came from. `web`: a crawled web page. `file`: an uploaded file or inline text. `dataset`: a document from a Sanity dataset.
5169
+ * @enum {string}
5170
+ */
4054
5171
  kind: 'web' | 'file' | 'dataset';
5172
+ /** @description The source's size in bytes. */
4055
5173
  sizeBytes: number;
4056
- /** @enum {string} */
5174
+ /**
5175
+ * @description The source's processing status. `pending`: waiting to be processed. `processing`: distilled and being summarized. `ready`: processed and available to builds. `failed`: couldn't be processed. `skipped`: not processed, because its file type isn't supported, it's too large, or it was split into smaller sources.
5176
+ * @enum {string}
5177
+ */
4057
5178
  status: 'pending' | 'processing' | 'ready' | 'failed' | 'skipped';
5179
+ /** @description A short summary of the source. `null` until the source is summarized. */
4058
5180
  tldr: string | null;
5181
+ /** @description Topics the source covers. `null` until the source is summarized. */
4059
5182
  topics: string[] | null;
5183
+ /** @description The page URL of a `web` source. `null` for other kinds. */
4060
5184
  canonicalUrl: string | null;
5185
+ /** @description The `_id` of the Sanity document a `dataset` source came from. Use it to find the document in your studio. `null` for other kinds. */
4061
5186
  externalId: string | null;
4062
- /** Format: date-time */
5187
+ /**
5188
+ * Format: date-time
5189
+ * @description When the source's content was last fetched.
5190
+ */
4063
5191
  fetchedAt: string | null;
4064
- /** Format: date-time */
5192
+ /**
5193
+ * Format: date-time
5194
+ * @description When the source's content was last distilled into markdown. `null` until it's distilled.
5195
+ */
4065
5196
  distilledAt: string | null;
4066
- /** Format: date-time */
5197
+ /**
5198
+ * Format: date-time
5199
+ * @description When the source was added.
5200
+ */
4067
5201
  createdAt: string;
4068
5202
  };
4069
5203
  };
@@ -4075,14 +5209,16 @@ interface operations {
4075
5209
  query?: never;
4076
5210
  header?: never;
4077
5211
  path: {
5212
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
4078
5213
  knowledgeBaseId: string;
5214
+ /** @description The source's ID. */
4079
5215
  sourceId: string;
4080
5216
  };
4081
5217
  cookie?: never;
4082
5218
  };
4083
5219
  requestBody?: never;
4084
5220
  responses: {
4085
- /** @description Default Response */
5221
+ /** @description The source was deleted. */
4086
5222
  204: {
4087
5223
  headers: {
4088
5224
  [name: string]: unknown;
@@ -4096,33 +5232,45 @@ interface operations {
4096
5232
  getSourceContent: {
4097
5233
  parameters: {
4098
5234
  query?: {
4099
- /** @description Output representation. `json` (default) returns the structured resource; `markdown` / `plain` return the rendered, LLM-ready text. */
5235
+ /** @description Response format. `json` (default) returns the structured resource. `markdown` and `plain` return the content as rendered text, ready to pass to a model. */
4100
5236
  format?: 'json' | 'markdown' | 'plain';
5237
+ /** @description The first line to return, starting at 1. Omit `startLine` and `endLine` to get the whole content. */
4101
5238
  startLine?: number;
5239
+ /** @description The last line to return, inclusive. A value past the end returns everything up to the last line. */
4102
5240
  endLine?: number;
4103
5241
  };
4104
5242
  header?: never;
4105
5243
  path: {
5244
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
4106
5245
  knowledgeBaseId: string;
5246
+ /** @description The source's ID. */
4107
5247
  sourceId: string;
4108
5248
  };
4109
5249
  cookie?: never;
4110
5250
  };
4111
5251
  requestBody?: never;
4112
5252
  responses: {
4113
- /** @description SourceContent */
5253
+ /** @description A source's distilled markdown, or a range of its lines. */
4114
5254
  200: {
4115
5255
  headers: {
4116
5256
  [name: string]: unknown;
4117
5257
  };
4118
5258
  content: {
4119
5259
  'application/json': {
4120
- /** Format: uuid */
5260
+ /**
5261
+ * Format: uuid
5262
+ * @description The source's ID.
5263
+ */
4121
5264
  sourceId: string;
5265
+ /** @description The distilled markdown, or the requested lines of it. */
4122
5266
  content: string;
5267
+ /** @description The number of lines in the full distilled content. */
4123
5268
  totalLines: number;
5269
+ /** @description The range of lines returned, 1-indexed and inclusive. It can be shorter than requested when the range runs past the end. Both values are `0` when no lines are returned. */
4124
5270
  slice: {
5271
+ /** @description The first line returned. */
4125
5272
  start: number;
5273
+ /** @description The last line returned. */
4126
5274
  end: number;
4127
5275
  };
4128
5276
  };
@@ -4137,115 +5285,184 @@ interface operations {
4137
5285
  query?: never;
4138
5286
  header?: never;
4139
5287
  path: {
5288
+ /** @description Your ID for the conversation thread, unique within your organization. Up to 200 characters. */
4140
5289
  threadId: string;
4141
5290
  };
4142
5291
  cookie?: never;
4143
5292
  };
4144
- /** @description SaveConversationInput */
5293
+ /** @description A conversation transcript to save for one thread. */
4145
5294
  requestBody: {
4146
5295
  content: {
4147
5296
  'application/json': {
5297
+ /** @description The full transcript so far, in order. It replaces the stored messages. */
4148
5298
  messages: {
4149
- /** @enum {string} */
5299
+ /**
5300
+ * @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.
5301
+ * @enum {string}
5302
+ */
4150
5303
  role: 'user' | 'assistant' | 'system' | 'tool';
4151
- /** @default null */
5304
+ /**
5305
+ * @description The message text. `null` when the message has no text, such as a tool call.
5306
+ * @default null
5307
+ */
4152
5308
  content?: string | null;
4153
- /** @default null */
5309
+ /**
5310
+ * @description The name of the tool for a `tool` message. `null` on other messages.
5311
+ * @default null
5312
+ */
4154
5313
  toolName?: string | null;
4155
5314
  /**
5315
+ * @description The kind of `tool` message. `call` is the agent calling the tool, and `result` is what the tool returned. `null` on other messages.
4156
5316
  * @default null
4157
5317
  * @enum {string|null}
4158
5318
  */
4159
5319
  toolType?: 'call' | 'result' | null;
4160
- /** @default null */
5320
+ /**
5321
+ * @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.
5322
+ * @default null
5323
+ */
4161
5324
  error?: string | null;
4162
5325
  }[];
5326
+ /** @description The provider of the model the agent used. When absent, the stored value stays unchanged. */
4163
5327
  modelProvider?: string;
5328
+ /** @description The ID of the model the agent used. When absent, the stored value stays unchanged. */
4164
5329
  modelId?: string;
4165
- /** @description ConversationTokenUsage */
5330
+ /** @description Token usage for one generation call. The API adds it to the conversation total, but only when this save changes the messages. */
4166
5331
  tokenUsage?: {
5332
+ /** @description The number of input tokens. */
4167
5333
  inputTokens?: number;
5334
+ /** @description The number of output tokens. */
4168
5335
  outputTokens?: number;
5336
+ /** @description The total number of tokens. */
4169
5337
  totalTokens?: number;
4170
5338
  };
4171
- /** @description ConversationMetadata */
5339
+ /** @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. */
4172
5340
  metadata?: {
4173
5341
  [key: string]: string | string[];
4174
5342
  };
4175
- /** @description ConversationSharing */
5343
+ /** @description Your choice to share conversation telemetry with Sanity. Replaces the stored setting. When absent, the stored value stays unchanged. */
4176
5344
  sharing?: {
5345
+ /** @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. */
4177
5346
  metrics?: boolean;
5347
+ /** @description Whether to share full conversation transcripts with Sanity. When `true`, the API also sets `metrics` to `true`. */
4178
5348
  conversations?: boolean;
5349
+ /** @description How the Sanity team can reach you about your agent, such as an email address or a Discord handle. */
4179
5350
  contact?: string;
4180
5351
  };
4181
5352
  };
4182
5353
  };
4183
5354
  };
4184
5355
  responses: {
4185
- /** @description Conversation */
5356
+ /** @description A recorded agent conversation: its transcript, metadata, token usage, and classification. */
4186
5357
  200: {
4187
5358
  headers: {
4188
5359
  [name: string]: unknown;
4189
5360
  };
4190
5361
  content: {
4191
5362
  'application/json': {
5363
+ /** @description The conversation ID, unique within the organization. It matches the `_id` of the conversation document in your document store. */
4192
5364
  id: string;
5365
+ /** @description Your identifier for the conversation thread, unique within the organization. Saving with the same `threadId` updates the same conversation. */
4193
5366
  threadId: string;
4194
- /** @description ConversationMetadata */
5367
+ /** @description Tags that describe the conversation, such as `mcpEndpoints`, `app`, and `environment`. Filter on them in GROQ queries. `null` until a save includes `metadata`. */
4195
5368
  metadata: {
4196
5369
  [key: string]: string | string[];
4197
5370
  } | null;
4198
- /** Format: date-time */
5371
+ /**
5372
+ * Format: date-time
5373
+ * @description When the API received the first save for this thread, as an ISO 8601 timestamp.
5374
+ */
4199
5375
  startedAt: string;
4200
- /** Format: date-time */
5376
+ /**
5377
+ * Format: date-time
5378
+ * @description When the conversation was last saved, as an ISO 8601 timestamp.
5379
+ */
4201
5380
  messagesUpdatedAt: string;
5381
+ /** @description The conversation transcript, in order. Each save replaces it. */
4202
5382
  messages: {
4203
- /** @enum {string} */
5383
+ /**
5384
+ * @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.
5385
+ * @enum {string}
5386
+ */
4204
5387
  role: 'user' | 'assistant' | 'system' | 'tool';
4205
- /** @default null */
5388
+ /**
5389
+ * @description The message text. `null` when the message has no text, such as a tool call.
5390
+ * @default null
5391
+ */
4206
5392
  content: string | null;
4207
- /** @default null */
5393
+ /**
5394
+ * @description The name of the tool for a `tool` message. `null` on other messages.
5395
+ * @default null
5396
+ */
4208
5397
  toolName: string | null;
4209
5398
  /**
5399
+ * @description The kind of `tool` message. `call` is the agent calling the tool, and `result` is what the tool returned. `null` on other messages.
4210
5400
  * @default null
4211
5401
  * @enum {string|null}
4212
5402
  */
4213
5403
  toolType: 'call' | 'result' | null;
4214
- /** @default null */
5404
+ /**
5405
+ * @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.
5406
+ * @default null
5407
+ */
4215
5408
  error: string | null;
4216
5409
  /**
4217
5410
  * Format: date-time
5411
+ * @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.
4218
5412
  * @default null
4219
5413
  */
4220
5414
  timestamp: string | null;
4221
5415
  }[];
5416
+ /** @description The provider of the model the agent used. `null` until a save includes `modelProvider`. */
4222
5417
  modelProvider: string | null;
5418
+ /** @description The ID of the model the agent used. `null` until a save includes `modelId`. */
4223
5419
  modelId: string | null;
4224
- /** @description ConversationTokenUsage */
5420
+ /** @description The running total of token usage for the conversation. `null` until a save includes `tokenUsage`. */
4225
5421
  tokenUsage: {
5422
+ /** @description The number of input tokens. */
4226
5423
  inputTokens?: number;
5424
+ /** @description The number of output tokens. */
4227
5425
  outputTokens?: number;
5426
+ /** @description The total number of tokens. */
4228
5427
  totalTokens?: number;
4229
5428
  } | null;
4230
- /** @description ConversationCoreMetrics */
5429
+ /** @description The latest classification result. `null` until you record one. */
4231
5430
  coreMetrics: {
5431
+ /** @description How well the agent resolved the user's needs, from 1 to 10. */
4232
5432
  successScore?: number;
4233
- /** @enum {string} */
5433
+ /**
5434
+ * @description The overall sentiment of the conversation.
5435
+ * @enum {string}
5436
+ */
4234
5437
  sentiment?: 'positive' | 'neutral' | 'negative';
5438
+ /** @description Topics the agent couldn't answer because it lacked content. */
4235
5439
  contentGaps?: string[];
4236
5440
  } | null;
4237
- /** Format: date-time */
5441
+ /**
5442
+ * Format: date-time
5443
+ * @description When the latest classification result was recorded, as an ISO 8601 timestamp. The API sets it. `null` until you record a result.
5444
+ */
4238
5445
  classifiedAt: string | null;
5446
+ /** @description Why your classifier couldn't classify the conversation. `null` when no failure is recorded. Recording a result clears it. */
4239
5447
  classificationError: string | null;
4240
- /** @description ConversationSharing */
5448
+ /** @description Your choice to share conversation telemetry with Sanity. `null` until a save includes `sharing`. */
4241
5449
  sharing: {
5450
+ /** @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. */
4242
5451
  metrics?: boolean;
5452
+ /** @description Whether to share full conversation transcripts with Sanity. When `true`, the API also sets `metrics` to `true`. */
4243
5453
  conversations?: boolean;
5454
+ /** @description How the Sanity team can reach you about your agent, such as an email address or a Discord handle. */
4244
5455
  contact?: string;
4245
5456
  } | null;
4246
- /** Format: date-time */
5457
+ /**
5458
+ * Format: date-time
5459
+ * @description When the conversation was created, as an ISO 8601 timestamp.
5460
+ */
4247
5461
  createdAt: string;
4248
- /** Format: date-time */
5462
+ /**
5463
+ * Format: date-time
5464
+ * @description When the conversation was last changed, as an ISO 8601 timestamp.
5465
+ */
4249
5466
  updatedAt: string;
4250
5467
  };
4251
5468
  };
@@ -4257,89 +5474,143 @@ interface operations {
4257
5474
  query?: never;
4258
5475
  header?: never;
4259
5476
  path: {
5477
+ /** @description Your ID for the conversation thread, unique within your organization. Up to 200 characters. */
4260
5478
  threadId: string;
4261
5479
  };
4262
5480
  cookie?: never;
4263
5481
  };
4264
- /** @description ClassifyConversationInput */
5482
+ /** @description A classification result or failure for one conversation. Send exactly one of `coreMetrics` or `classificationError`. */
4265
5483
  requestBody: {
4266
5484
  content: {
4267
5485
  'application/json': {
5486
+ /** @description The classification result. The API sets `classifiedAt` and clears any recorded `classificationError`. */
4268
5487
  coreMetrics?: {
5488
+ /** @description How well the agent resolved the user's needs, as an integer from 1 to 10. */
4269
5489
  successScore: number;
4270
- /** @enum {string} */
5490
+ /**
5491
+ * @description The overall sentiment of the conversation.
5492
+ * @enum {string}
5493
+ */
4271
5494
  sentiment: 'positive' | 'neutral' | 'negative';
5495
+ /** @description Topics the agent couldn't answer because it lacked content. */
4272
5496
  contentGaps: string[];
4273
5497
  };
5498
+ /** @description Why your classifier couldn't classify the conversation. Any earlier classification result stays unchanged. */
4274
5499
  classificationError?: string;
4275
5500
  };
4276
5501
  };
4277
5502
  };
4278
5503
  responses: {
4279
- /** @description Conversation */
5504
+ /** @description A recorded agent conversation: its transcript, metadata, token usage, and classification. */
4280
5505
  200: {
4281
5506
  headers: {
4282
5507
  [name: string]: unknown;
4283
5508
  };
4284
5509
  content: {
4285
5510
  'application/json': {
5511
+ /** @description The conversation ID, unique within the organization. It matches the `_id` of the conversation document in your document store. */
4286
5512
  id: string;
5513
+ /** @description Your identifier for the conversation thread, unique within the organization. Saving with the same `threadId` updates the same conversation. */
4287
5514
  threadId: string;
4288
- /** @description ConversationMetadata */
5515
+ /** @description Tags that describe the conversation, such as `mcpEndpoints`, `app`, and `environment`. Filter on them in GROQ queries. `null` until a save includes `metadata`. */
4289
5516
  metadata: {
4290
5517
  [key: string]: string | string[];
4291
5518
  } | null;
4292
- /** Format: date-time */
5519
+ /**
5520
+ * Format: date-time
5521
+ * @description When the API received the first save for this thread, as an ISO 8601 timestamp.
5522
+ */
4293
5523
  startedAt: string;
4294
- /** Format: date-time */
5524
+ /**
5525
+ * Format: date-time
5526
+ * @description When the conversation was last saved, as an ISO 8601 timestamp.
5527
+ */
4295
5528
  messagesUpdatedAt: string;
5529
+ /** @description The conversation transcript, in order. Each save replaces it. */
4296
5530
  messages: {
4297
- /** @enum {string} */
5531
+ /**
5532
+ * @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.
5533
+ * @enum {string}
5534
+ */
4298
5535
  role: 'user' | 'assistant' | 'system' | 'tool';
4299
- /** @default null */
5536
+ /**
5537
+ * @description The message text. `null` when the message has no text, such as a tool call.
5538
+ * @default null
5539
+ */
4300
5540
  content: string | null;
4301
- /** @default null */
5541
+ /**
5542
+ * @description The name of the tool for a `tool` message. `null` on other messages.
5543
+ * @default null
5544
+ */
4302
5545
  toolName: string | null;
4303
5546
  /**
5547
+ * @description The kind of `tool` message. `call` is the agent calling the tool, and `result` is what the tool returned. `null` on other messages.
4304
5548
  * @default null
4305
5549
  * @enum {string|null}
4306
5550
  */
4307
5551
  toolType: 'call' | 'result' | null;
4308
- /** @default null */
5552
+ /**
5553
+ * @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.
5554
+ * @default null
5555
+ */
4309
5556
  error: string | null;
4310
5557
  /**
4311
5558
  * Format: date-time
5559
+ * @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.
4312
5560
  * @default null
4313
5561
  */
4314
5562
  timestamp: string | null;
4315
5563
  }[];
5564
+ /** @description The provider of the model the agent used. `null` until a save includes `modelProvider`. */
4316
5565
  modelProvider: string | null;
5566
+ /** @description The ID of the model the agent used. `null` until a save includes `modelId`. */
4317
5567
  modelId: string | null;
4318
- /** @description ConversationTokenUsage */
5568
+ /** @description The running total of token usage for the conversation. `null` until a save includes `tokenUsage`. */
4319
5569
  tokenUsage: {
5570
+ /** @description The number of input tokens. */
4320
5571
  inputTokens?: number;
5572
+ /** @description The number of output tokens. */
4321
5573
  outputTokens?: number;
5574
+ /** @description The total number of tokens. */
4322
5575
  totalTokens?: number;
4323
5576
  } | null;
4324
- /** @description ConversationCoreMetrics */
5577
+ /** @description The latest classification result. `null` until you record one. */
4325
5578
  coreMetrics: {
5579
+ /** @description How well the agent resolved the user's needs, from 1 to 10. */
4326
5580
  successScore?: number;
4327
- /** @enum {string} */
5581
+ /**
5582
+ * @description The overall sentiment of the conversation.
5583
+ * @enum {string}
5584
+ */
4328
5585
  sentiment?: 'positive' | 'neutral' | 'negative';
5586
+ /** @description Topics the agent couldn't answer because it lacked content. */
4329
5587
  contentGaps?: string[];
4330
5588
  } | null;
4331
- /** Format: date-time */
5589
+ /**
5590
+ * Format: date-time
5591
+ * @description When the latest classification result was recorded, as an ISO 8601 timestamp. The API sets it. `null` until you record a result.
5592
+ */
4332
5593
  classifiedAt: string | null;
5594
+ /** @description Why your classifier couldn't classify the conversation. `null` when no failure is recorded. Recording a result clears it. */
4333
5595
  classificationError: string | null;
4334
- /** @description ConversationSharing */
5596
+ /** @description Your choice to share conversation telemetry with Sanity. `null` until a save includes `sharing`. */
4335
5597
  sharing: {
5598
+ /** @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. */
4336
5599
  metrics?: boolean;
5600
+ /** @description Whether to share full conversation transcripts with Sanity. When `true`, the API also sets `metrics` to `true`. */
4337
5601
  conversations?: boolean;
5602
+ /** @description How the Sanity team can reach you about your agent, such as an email address or a Discord handle. */
4338
5603
  contact?: string;
4339
5604
  } | null;
4340
- /** Format: date-time */
5605
+ /**
5606
+ * Format: date-time
5607
+ * @description When the conversation was created, as an ISO 8601 timestamp.
5608
+ */
4341
5609
  createdAt: string;
4342
- /** Format: date-time */
5610
+ /**
5611
+ * Format: date-time
5612
+ * @description When the conversation was last changed, as an ISO 8601 timestamp.
5613
+ */
4343
5614
  updatedAt: string;
4344
5615
  };
4345
5616
  };