@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.
@@ -13,13 +13,13 @@ export interface paths {
13
13
  }
14
14
  /**
15
15
  * List knowledge bases
16
- * @description Returns the organization's knowledge bases visible to the caller, cursor-paginated.
16
+ * @description Returns the knowledge bases you can access in the organization set by `organizationId`. Results are cursor-paginated.
17
17
  */
18
18
  get: operations['listKnowledgeBases']
19
19
  put?: never
20
20
  /**
21
21
  * Create a knowledge base
22
- * @description Creates a knowledge base bound to a Sanity dataset, where its content documents will be stored.
22
+ * @description Creates a knowledge base in your organization. To add content to it, create an import.
23
23
  */
24
24
  post: operations['createKnowledgeBase']
25
25
  delete?: never
@@ -37,21 +37,21 @@ export interface paths {
37
37
  }
38
38
  /**
39
39
  * Get a knowledge base
40
- * @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.
40
+ * @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.
41
41
  */
42
42
  get: operations['getKnowledgeBase']
43
43
  put?: never
44
44
  post?: never
45
45
  /**
46
46
  * Delete a knowledge base
47
- * @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.
47
+ * @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.
48
48
  */
49
49
  delete: operations['deleteKnowledgeBase']
50
50
  options?: never
51
51
  head?: never
52
52
  /**
53
53
  * Update a knowledge base
54
- * @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.
54
+ * @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.
55
55
  */
56
56
  patch: operations['updateKnowledgeBase']
57
57
  trace?: never
@@ -66,8 +66,8 @@ export interface paths {
66
66
  get?: never
67
67
  put?: never
68
68
  /**
69
- * Trigger a knowledge base build
70
- * @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.
69
+ * Start a knowledge base build
70
+ * @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.
71
71
  */
72
72
  post: operations['buildKnowledgeBase']
73
73
  delete?: never
@@ -86,8 +86,8 @@ export interface paths {
86
86
  get?: never
87
87
  put?: never
88
88
  /**
89
- * Cancel an in-progress build
90
- * @description Cancels the running build and resets the knowledge base so it can be rebuilt.
89
+ * Cancel a knowledge base build
90
+ * @description Cancels the running build and resets the knowledge base so you can build it again. Returns `cancelled: false` when no build is running.
91
91
  */
92
92
  post: operations['cancelKnowledgeBaseBuild']
93
93
  delete?: never
@@ -107,7 +107,7 @@ export interface paths {
107
107
  put?: never
108
108
  /**
109
109
  * Rebuild an entry from its sources
110
- * @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.
110
+ * @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.
111
111
  */
112
112
  post: operations['rebuildEntry']
113
113
  delete?: never
@@ -125,13 +125,21 @@ export interface paths {
125
125
  }
126
126
  /**
127
127
  * List imports
128
- * @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`.
128
+ * @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`.
129
129
  */
130
130
  get: operations['listImports']
131
131
  put?: never
132
132
  /**
133
- * Create an import (text, crawl, or dataset)
134
- * @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.
133
+ * Create a text, crawl, or dataset import
134
+ * @description Adds content to a knowledge base. Set `type` to choose what to import:
135
+ *
136
+ * - `text`: inline content
137
+ * - `crawl`: a website
138
+ * - `dataset`: documents from a Sanity dataset, selected by a GROQ filter
139
+ *
140
+ * Each import queues processing and returns a job ID to poll. To import a file, use `POST .../imports/uploads` instead.
141
+ *
142
+ * 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.
135
143
  */
136
144
  post: operations['createImport']
137
145
  delete?: never
@@ -150,8 +158,13 @@ export interface paths {
150
158
  get?: never
151
159
  put?: never
152
160
  /**
153
- * Start a file-upload import
154
- * @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.
161
+ * Start a file upload
162
+ * @description Creates a file import and returns a single-use signed upload URL that's valid for one hour. To finish the upload:
163
+ *
164
+ * 1. Send the file in a `PUT` request to the upload URL.
165
+ * 2. Call `POST .../imports/uploads/{importId}/complete` to start processing.
166
+ *
167
+ * 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.
155
168
  */
156
169
  post: operations['startUpload']
157
170
  delete?: never
@@ -170,8 +183,8 @@ export interface paths {
170
183
  get?: never
171
184
  put?: never
172
185
  /**
173
- * Complete a file-upload import
174
- * @description Call after the file bytes are uploaded to the signed URL. Starts processing and returns a job id to poll.
186
+ * Complete a file upload
187
+ * @description Starts processing a file after you upload it to the signed URL from `POST .../imports/uploads`. Returns a job ID to poll.
175
188
  */
176
189
  post: operations['completeUpload']
177
190
  delete?: never
@@ -188,15 +201,15 @@ export interface paths {
188
201
  cookie?: never
189
202
  }
190
203
  /**
191
- * Get a single import
192
- * @description Returns one import with its kind and processing status.
204
+ * Get an import
205
+ * @description Returns an import with its `sourceKind` and processing `status`.
193
206
  */
194
207
  get: operations['getImport']
195
208
  put?: never
196
209
  post?: never
197
210
  /**
198
211
  * Delete an import
199
- * @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.
212
+ * @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.
200
213
  */
201
214
  delete: operations['deleteImport']
202
215
  options?: never
@@ -213,7 +226,7 @@ export interface paths {
213
226
  }
214
227
  /**
215
228
  * Get a download URL for an import
216
- * @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`.
229
+ * @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`.
217
230
  */
218
231
  get: operations['downloadImport']
219
232
  put?: never
@@ -234,8 +247,8 @@ export interface paths {
234
247
  get?: never
235
248
  put?: never
236
249
  /**
237
- * Author a human instruction
238
- * @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.
250
+ * Create an instruction
251
+ * @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.
239
252
  */
240
253
  post: operations['createInstruction']
241
254
  delete?: never
@@ -256,14 +269,14 @@ export interface paths {
256
269
  post?: never
257
270
  /**
258
271
  * Delete an instruction
259
- * @description Deletes the rule. Builds stop honoring it from the next run.
272
+ * @description Deletes the instruction. Builds stop applying it from the next run.
260
273
  */
261
274
  delete: operations['deleteInstruction']
262
275
  options?: never
263
276
  head?: never
264
277
  /**
265
- * Edit an instruction
266
- * @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.
278
+ * Update an instruction
279
+ * @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.
267
280
  */
268
281
  patch: operations['updateInstruction']
269
282
  trace?: never
@@ -278,8 +291,8 @@ export interface paths {
278
291
  get?: never
279
292
  put?: never
280
293
  /**
281
- * Apply accepted issues to a Context
282
- * @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.
294
+ * Accept and apply issues
295
+ * @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.
283
296
  */
284
297
  post: operations['applyIssues']
285
298
  delete?: never
@@ -299,7 +312,7 @@ export interface paths {
299
312
  put?: never
300
313
  /**
301
314
  * Dismiss an issue
302
- * @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.
315
+ * @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`.
303
316
  */
304
317
  post: operations['dismissIssue']
305
318
  delete?: never
@@ -319,7 +332,7 @@ export interface paths {
319
332
  put?: never
320
333
  /**
321
334
  * Reopen an accepted conflict
322
- * @description Returns an accepted conflict to triage, clearing its resolution and deleting the instruction it minted. Idempotent for issues that are not accepted conflicts.
335
+ * @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`.
323
336
  */
324
337
  post: operations['reopenIssue']
325
338
  delete?: never
@@ -339,7 +352,7 @@ export interface paths {
339
352
  put?: never
340
353
  /**
341
354
  * Resolve a conflict issue
342
- * @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.
355
+ * @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`.
343
356
  */
344
357
  post: operations['resolveIssue']
345
358
  delete?: never
@@ -356,8 +369,8 @@ export interface paths {
356
369
  cookie?: never
357
370
  }
358
371
  /**
359
- * Get a job by id
360
- * @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.
372
+ * Get a job
373
+ * @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.
361
374
  */
362
375
  get: operations['getJob']
363
376
  put?: never
@@ -378,8 +391,8 @@ export interface paths {
378
391
  get?: never
379
392
  put?: never
380
393
  /**
381
- * Trigger an incremental refresh
382
- * @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.
394
+ * Refresh a knowledge base
395
+ * @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.
383
396
  */
384
397
  post: operations['refreshKnowledgeBase']
385
398
  delete?: never
@@ -397,7 +410,7 @@ export interface paths {
397
410
  }
398
411
  /**
399
412
  * List sources
400
- * @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`.
413
+ * @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`.
401
414
  */
402
415
  get: operations['listSources']
403
416
  put?: never
@@ -416,15 +429,15 @@ export interface paths {
416
429
  cookie?: never
417
430
  }
418
431
  /**
419
- * Get a single source
420
- * @description Returns one source with its metadata and processing status.
432
+ * Get a source
433
+ * @description Returns a source with its metadata and processing status.
421
434
  */
422
435
  get: operations['getSource']
423
436
  put?: never
424
437
  post?: never
425
438
  /**
426
439
  * Delete a source
427
- * @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.
440
+ * @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.
428
441
  */
429
442
  delete: operations['deleteSource']
430
443
  options?: never
@@ -440,8 +453,8 @@ export interface paths {
440
453
  cookie?: never
441
454
  }
442
455
  /**
443
- * Read a source's distilled content
444
- * @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.
456
+ * Get a source's distilled content
457
+ * @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`.
445
458
  */
446
459
  get: operations['getSourceContent']
447
460
  put?: never
@@ -462,7 +475,13 @@ export interface paths {
462
475
  get?: never
463
476
  /**
464
477
  * Record a conversation
465
- * @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.
478
+ * @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.
479
+ *
480
+ * 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.
481
+ *
482
+ * 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.
483
+ *
484
+ * The last write for a thread wins, so retries are safe. `sharing` records whether you share telemetry with Sanity: metrics only, or full transcripts.
466
485
  */
467
486
  put: operations['saveConversation']
468
487
  post?: never
@@ -470,8 +489,13 @@ export interface paths {
470
489
  options?: never
471
490
  head?: never
472
491
  /**
473
- * Record a classification verdict
474
- * @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.
492
+ * Record a conversation classification
493
+ * @description Records the classification your own model produced for one thread. Send exactly one of these fields:
494
+ *
495
+ * - `coreMetrics`: the classification result. The API sets `classifiedAt` and clears any recorded failure.
496
+ * - `classificationError`: why classification failed. Any earlier result stays unchanged.
497
+ *
498
+ * Requires the same access as recording a conversation. The last write wins, so a new classification replaces the previous one.
475
499
  */
476
500
  patch: operations['classifyConversation']
477
501
  trace?: never
@@ -480,91 +504,162 @@ export interface paths {
480
504
  export type webhooks = Record<string, never>
481
505
  export interface components {
482
506
  schemas: {
483
- /** @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. */
507
+ /** @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. */
484
508
  ConversationDoc: {
509
+ /** @description The document ID. */
485
510
  _id: string
511
+ /** @description The document revision. It changes on every write. */
486
512
  _rev: string
487
- /** Format: date-time */
513
+ /**
514
+ * Format: date-time
515
+ * @description When the document was created, as an ISO 8601 timestamp.
516
+ */
488
517
  _createdAt: string
489
- /** Format: date-time */
518
+ /**
519
+ * Format: date-time
520
+ * @description When the document was last changed, as an ISO 8601 timestamp.
521
+ */
490
522
  _updatedAt: string
491
- /** @enum {string} */
523
+ /**
524
+ * @description The document type. Always `sanity.context.conversation`.
525
+ * @enum {string}
526
+ */
492
527
  _type: 'sanity.context.conversation'
493
- /** @enum {number} */
528
+ /**
529
+ * @description The version of the document shape. Currently `1`.
530
+ * @enum {number}
531
+ */
494
532
  schemaVersion: 1
533
+ /** @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. */
495
534
  organizationId: string
535
+ /** @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`. */
496
536
  threadId: string
497
- /** @description ConversationMetadata */
537
+ /** @description Tags that describe the conversation, such as `mcpEndpoints`, `app`, and `environment`. Filter on them in GROQ queries. `null` until a save includes `metadata`. */
498
538
  metadata: {
499
539
  [key: string]: string | string[]
500
540
  } | null
501
- /** Format: date-time */
541
+ /**
542
+ * Format: date-time
543
+ * @description When the API received the first save for this thread, as an ISO 8601 timestamp.
544
+ */
502
545
  startedAt: string
503
- /** Format: date-time */
546
+ /**
547
+ * Format: date-time
548
+ * @description When the conversation was last saved, as an ISO 8601 timestamp.
549
+ */
504
550
  messagesUpdatedAt: string
551
+ /** @description The conversation transcript, in order. Each save replaces it. */
505
552
  messages: {
506
- /** @enum {string} */
553
+ /**
554
+ * @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.
555
+ * @enum {string}
556
+ */
507
557
  role: 'user' | 'assistant' | 'system' | 'tool'
508
- /** @default null */
558
+ /**
559
+ * @description The message text. `null` when the message has no text, such as a tool call.
560
+ * @default null
561
+ */
509
562
  content: string | null
510
- /** @default null */
563
+ /**
564
+ * @description The name of the tool for a `tool` message. `null` on other messages.
565
+ * @default null
566
+ */
511
567
  toolName: string | null
512
568
  /**
569
+ * @description The kind of `tool` message. `call` is the agent calling the tool, and `result` is what the tool returned. `null` on other messages.
513
570
  * @default null
514
571
  * @enum {string|null}
515
572
  */
516
573
  toolType: 'call' | 'result' | null
517
- /** @default null */
574
+ /**
575
+ * @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.
576
+ * @default null
577
+ */
518
578
  error: string | null
519
579
  /**
520
580
  * Format: date-time
581
+ * @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.
521
582
  * @default null
522
583
  */
523
584
  timestamp: string | null
524
585
  }[]
586
+ /** @description The provider of the model the agent used. `null` until a save includes `modelProvider`. */
525
587
  modelProvider: string | null
588
+ /** @description The ID of the model the agent used. `null` until a save includes `modelId`. */
526
589
  modelId: string | null
527
- /** @description ConversationTokenUsage */
590
+ /** @description The running total of token usage for the conversation. `null` until a save includes `tokenUsage`. */
528
591
  tokenUsage: {
592
+ /** @description The number of input tokens. */
529
593
  inputTokens?: number
594
+ /** @description The number of output tokens. */
530
595
  outputTokens?: number
596
+ /** @description The total number of tokens. */
531
597
  totalTokens?: number
532
598
  } | null
533
- /** @description ConversationCoreMetrics */
599
+ /** @description The latest classification result. `null` until you record one. */
534
600
  coreMetrics: {
601
+ /** @description How well the agent resolved the user's needs, from 1 to 10. */
535
602
  successScore?: number
536
- /** @enum {string} */
603
+ /**
604
+ * @description The overall sentiment of the conversation.
605
+ * @enum {string}
606
+ */
537
607
  sentiment?: 'positive' | 'neutral' | 'negative'
608
+ /** @description Topics the agent couldn't answer because it lacked content. */
538
609
  contentGaps?: string[]
539
610
  } | null
540
- /** Format: date-time */
611
+ /**
612
+ * Format: date-time
613
+ * @description When the latest classification result was recorded, as an ISO 8601 timestamp. The API sets it. `null` until you record a result.
614
+ */
541
615
  classifiedAt: string | null
616
+ /** @description Why your classifier couldn't classify the conversation. `null` when no failure is recorded. Recording a result clears it. */
542
617
  classificationError: string | null
543
618
  /**
544
- * @description ConversationSharing
619
+ * @description Your choice to share conversation telemetry with Sanity. `null` until a save includes `sharing`.
545
620
  * @default null
546
621
  */
547
622
  sharing: {
623
+ /** @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. */
548
624
  metrics?: boolean
625
+ /** @description Whether to share full conversation transcripts with Sanity. When `true`, the API also sets `metrics` to `true`. */
549
626
  conversations?: boolean
627
+ /** @description How the Sanity team can reach you about your agent, such as an email address or a Discord handle. */
550
628
  contact?: string
551
629
  } | null
552
630
  }
553
- /** @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. */
631
+ /** @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. */
554
632
  EntryDoc: {
633
+ /** @description The document ID. */
555
634
  _id: string
635
+ /** @description The document revision. It changes on every write. */
556
636
  _rev: string
557
- /** Format: date-time */
637
+ /**
638
+ * Format: date-time
639
+ * @description When the document was created, as an ISO 8601 timestamp.
640
+ */
558
641
  _createdAt: string
559
- /** Format: date-time */
642
+ /**
643
+ * Format: date-time
644
+ * @description When the document was last changed, as an ISO 8601 timestamp.
645
+ */
560
646
  _updatedAt: string
647
+ /** @description The ID (`kb…`) of the knowledge base this document belongs to. */
561
648
  knowledgeBaseId: string
562
- /** @enum {string} */
649
+ /**
650
+ * @description The document type. Always `sanity.context.entry`.
651
+ * @enum {string}
652
+ */
563
653
  _type: 'sanity.context.entry'
654
+ /** @description The version of the document shape. Currently `1`. */
564
655
  schemaVersion: number
656
+ /** @description The ID of the build that last wrote this entry's content. An unchanged entry keeps its earlier value across builds. */
565
657
  revisionId: string
658
+ /** @description The entry's slash-delimited path, such as `docs/api/webhooks`. Order entries by `path` to get the knowledge base outline. */
566
659
  path: string
660
+ /** @description The entry title. */
567
661
  title: string
662
+ /** @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`. */
568
663
  tldr?: {
569
664
  scope: string
570
665
  excludes: string
@@ -572,141 +667,269 @@ export interface components {
572
667
  /** @enum {string} */
573
668
  centrality: 'core' | 'standard' | 'peripheral'
574
669
  }
670
+ /** @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. */
575
671
  body?: string
672
+ /** @description The H2 and H3 heading titles in `body`. Absent when the entry has no `body`. */
576
673
  topicHeadings?: string[]
674
+ /** @description The sources that back this entry, one item per source. */
577
675
  citations?: {
676
+ /** @description ID of the cited source. */
578
677
  sourceId: string
678
+ /** @description Which facts in the entry body this source backs, in a short phrase. */
579
679
  supports?: string
680
+ /** @description Line ranges in the source's distilled content that back those facts, with the quoted text. */
580
681
  spans?: {
682
+ /** @description First line of the range, counting from 1. Line numbers match `GET .../sources/{sourceId}/content`. */
581
683
  sourceLineStart: number
684
+ /** @description Last line of the range, inclusive. */
582
685
  sourceLineEnd: number
686
+ /** @description The exact text of the line range in the source. */
583
687
  quote: string
584
688
  }[]
689
+ /** @description The text in the entry body that this citation backs. */
585
690
  claim?: {
691
+ /** @description The exact entry text the citation backs. */
586
692
  exact: string
693
+ /** @description Text immediately before `exact`, to tell apart repeated phrases. */
587
694
  prefix?: string
695
+ /** @description Text immediately after `exact`, to tell apart repeated phrases. */
588
696
  suffix?: string
589
697
  }
590
698
  /** @enum {string} */
591
699
  groundingState?: 'drifted'
700
+ /** @description A unique key for this item in the `citations` array. */
592
701
  _key: string
593
- /** @enum {string} */
702
+ /**
703
+ * @description The citation type. Always `sanity.context.citation`.
704
+ * @enum {string}
705
+ */
594
706
  _type: 'sanity.context.citation'
707
+ /** @description A display name for the cited source. Builds currently set it to the `sourceId`. */
595
708
  filename: string
596
709
  mime?: string
597
710
  excerpt?: string
598
711
  }[]
599
- /** @enum {string} */
712
+ /**
713
+ * @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.
714
+ * @enum {string}
715
+ */
600
716
  status: 'virtual' | 'outlined' | 'filled' | 'stale' | 'generation_failed'
717
+ /** @description When the build that last wrote this entry's content ran, as an ISO 8601 timestamp. */
601
718
  generatedAt: string
602
719
  }
603
- /** @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. */
720
+ /** @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. */
604
721
  InstructionDoc:
605
722
  | {
723
+ /** @description The document ID. */
606
724
  _id: string
725
+ /** @description The document revision. It changes on every write. */
607
726
  _rev: string
608
- /** Format: date-time */
727
+ /**
728
+ * Format: date-time
729
+ * @description When the document was created, as an ISO 8601 timestamp.
730
+ */
609
731
  _createdAt: string
610
- /** Format: date-time */
732
+ /**
733
+ * Format: date-time
734
+ * @description When the document was last changed, as an ISO 8601 timestamp.
735
+ */
611
736
  _updatedAt: string
737
+ /** @description The ID (`kb…`) of the knowledge base this document belongs to. */
612
738
  knowledgeBaseId: string
613
- /** @enum {string} */
739
+ /**
740
+ * @description The document type. Always `sanity.context.instruction`.
741
+ * @enum {string}
742
+ */
614
743
  _type: 'sanity.context.instruction'
615
- /** @enum {number} */
744
+ /**
745
+ * @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.
746
+ * @enum {number}
747
+ */
616
748
  schemaVersion: 1
749
+ /** @description The instruction, in plain language. Builds follow it over the raw sources. */
617
750
  statement: string
751
+ /** @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. */
618
752
  scopeSources:
619
753
  | {
754
+ /** @description A unique key for this item in the array. It matches `sourceId`. */
620
755
  _key: string
756
+ /** @description The ID of the source the instruction is tied to. */
621
757
  sourceId: string
758
+ /** @description The source's content hash when the instruction was last checked against it. When the source content changes, the instruction is checked again. */
622
759
  contentHash: string
623
760
  }[]
624
761
  | null
625
- /** @enum {string} */
762
+ /**
763
+ * @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.
764
+ * @enum {string}
765
+ */
626
766
  status: 'active' | 'archived'
767
+ /** @description When the instruction was archived, as an ISO 8601 timestamp. `null` while `active`. */
627
768
  archivedAt: string | null
769
+ /** @description Why the instruction was archived. `null` while `active`. */
628
770
  archivedReason: string | null
629
- /** @enum {string} */
771
+ /**
772
+ * @description Where the instruction came from. `conflict` means it was created when you resolved a conflict issue.
773
+ * @enum {string}
774
+ */
630
775
  origin: 'conflict'
776
+ /** @description The `_id` of the conflict issue this instruction resolved. Reopening that issue deletes this instruction. */
631
777
  sourceIssueId: string
632
778
  }
633
779
  | {
780
+ /** @description The document ID. */
634
781
  _id: string
782
+ /** @description The document revision. It changes on every write. */
635
783
  _rev: string
636
- /** Format: date-time */
784
+ /**
785
+ * Format: date-time
786
+ * @description When the document was created, as an ISO 8601 timestamp.
787
+ */
637
788
  _createdAt: string
638
- /** Format: date-time */
789
+ /**
790
+ * Format: date-time
791
+ * @description When the document was last changed, as an ISO 8601 timestamp.
792
+ */
639
793
  _updatedAt: string
794
+ /** @description The ID (`kb…`) of the knowledge base this document belongs to. */
640
795
  knowledgeBaseId: string
641
- /** @enum {string} */
796
+ /**
797
+ * @description The document type. Always `sanity.context.instruction`.
798
+ * @enum {string}
799
+ */
642
800
  _type: 'sanity.context.instruction'
643
- /** @enum {number} */
801
+ /**
802
+ * @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.
803
+ * @enum {number}
804
+ */
644
805
  schemaVersion: 1
806
+ /** @description The instruction, in plain language. Builds follow it over the raw sources. */
645
807
  statement: string
808
+ /** @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. */
646
809
  scopeSources:
647
810
  | {
811
+ /** @description A unique key for this item in the array. It matches `sourceId`. */
648
812
  _key: string
813
+ /** @description The ID of the source the instruction is tied to. */
649
814
  sourceId: string
815
+ /** @description The source's content hash when the instruction was last checked against it. When the source content changes, the instruction is checked again. */
650
816
  contentHash: string
651
817
  }[]
652
818
  | null
653
- /** @enum {string} */
819
+ /**
820
+ * @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.
821
+ * @enum {string}
822
+ */
654
823
  status: 'active' | 'archived'
824
+ /** @description When the instruction was archived, as an ISO 8601 timestamp. `null` while `active`. */
655
825
  archivedAt: string | null
826
+ /** @description Why the instruction was archived. `null` while `active`. */
656
827
  archivedReason: string | null
657
- /** @enum {string} */
828
+ /**
829
+ * @description Where the instruction came from. `human` means it was created directly through the API or the dashboard.
830
+ * @enum {string}
831
+ */
658
832
  origin: 'human'
659
- /** @enum {string|null} */
833
+ /**
834
+ * @description Always `null` for a `human` instruction.
835
+ * @enum {string|null}
836
+ */
660
837
  sourceIssueId: null
661
838
  }
662
- /** @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`. */
839
+ /** @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`. */
663
840
  IssueDoc:
664
841
  | {
842
+ /** @description The document ID. */
665
843
  _id: string
844
+ /** @description The document revision. It changes on every write. */
666
845
  _rev: string
667
- /** Format: date-time */
846
+ /**
847
+ * Format: date-time
848
+ * @description When the document was created, as an ISO 8601 timestamp.
849
+ */
668
850
  _createdAt: string
669
- /** Format: date-time */
851
+ /**
852
+ * Format: date-time
853
+ * @description When the document was last changed, as an ISO 8601 timestamp.
854
+ */
670
855
  _updatedAt: string
856
+ /** @description The ID (`kb…`) of the knowledge base this document belongs to. */
671
857
  knowledgeBaseId: string
672
- /** @enum {string} */
858
+ /**
859
+ * @description The document type. Always `sanity.context.issue`.
860
+ * @enum {string}
861
+ */
673
862
  _type: 'sanity.context.issue'
674
- /** @enum {number} */
863
+ /**
864
+ * @description The version of the document shape. Currently `1`.
865
+ * @enum {number}
866
+ */
675
867
  schemaVersion: 1
676
- /** @description IssueContent */
868
+ /** @description What an issue found. The shape depends on `kind`. */
677
869
  content:
678
870
  | {
679
- /** @enum {string} */
871
+ /**
872
+ * @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.
873
+ * @enum {string}
874
+ */
680
875
  severity: 'critical' | 'suggestion'
876
+ /** @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. */
681
877
  scopePath: string
878
+ /** @description What the problem is, in one or two sentences. */
682
879
  issue: string
880
+ /** @description What to do to fix the issue. */
683
881
  suggestedFix: string
684
- /** @enum {string} */
882
+ /**
883
+ * @description The issue type. `conflict` means two or more positions disagree on the same fact, and you choose which one is correct.
884
+ * @enum {string}
885
+ */
685
886
  kind: 'conflict'
887
+ /** @description A key naming the disputed fact, such as `free_tier.request_limit`. It never includes the disputed value, so every side shares it. */
686
888
  claimKey: string
889
+ /** @description The conflicting positions, at least two. To resolve the conflict, pass the index of one side as `resolution`. */
687
890
  sides: {
891
+ /** @description The position as a self-contained sentence. This is the option you choose from. */
688
892
  claim: string
893
+ /** @description The disputed value on its own, such as `10,000/month`, without the sentence. */
689
894
  value?: string
895
+ /** @description Paths of the entries that state this position. */
690
896
  entryPaths?: string[]
897
+ /** @description IDs of the sources that directly back this position. */
691
898
  sourceIds?: string[]
692
- /** @description ConflictSpan */
899
+ /** @description Where in a source this position was read. */
693
900
  span?: {
901
+ /** @description ID of the source the position was read from. */
694
902
  sourceId: string
903
+ /** @description First line of the range, counting from 1. Line numbers match `GET .../sources/{sourceId}/content`. */
695
904
  lineStart: number
905
+ /** @description Last line of the range, inclusive. */
696
906
  lineEnd: number
697
907
  }
698
- /** @enum {string} */
908
+ /**
909
+ * @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.
910
+ * @enum {string}
911
+ */
699
912
  authority?: 'primary' | 'secondary' | 'community'
700
913
  }[]
914
+ /** @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. */
701
915
  suggested?: number
702
916
  }
703
917
  | {
704
- /** @enum {string} */
918
+ /**
919
+ * @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.
920
+ * @enum {string}
921
+ */
705
922
  severity: 'critical' | 'suggestion'
923
+ /** @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. */
706
924
  scopePath: string
925
+ /** @description What the problem is, in one or two sentences. */
707
926
  issue: string
927
+ /** @description What to do to fix the issue. */
708
928
  suggestedFix: string
709
- /** @enum {string} */
929
+ /**
930
+ * @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.
931
+ * @enum {string}
932
+ */
710
933
  kind:
711
934
  | 'gap'
712
935
  | 'update_required'
@@ -714,67 +937,130 @@ export interface components {
714
937
  | 'remove_entry'
715
938
  | 'split_entry'
716
939
  | 'merge_entry'
940
+ /** @description IDs of the sources that led to the issue. For `add_entry`, the sources the new entry would cite. */
717
941
  citedSourceIds?: string[]
942
+ /** @description A key naming the specific finding, when the check that found it sets one. */
718
943
  claimKey?: string
944
+ /** @description Paths of the entries the issue involves, when it spans more than one entry. */
719
945
  involvedScopes?: string[]
720
946
  }
947
+ /** @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. */
721
948
  fingerprint: string
949
+ /** @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. */
722
950
  revisionId: string | null
723
- /** @enum {string} */
951
+ /**
952
+ * @description The issue status. `open` means it is waiting for triage.
953
+ * @enum {string}
954
+ */
724
955
  status: 'open'
725
- /** @enum {string|null} */
956
+ /**
957
+ * @description Always `null` while the issue is `open`.
958
+ * @enum {string|null}
959
+ */
726
960
  resolution: null
727
- /** @enum {string|null} */
961
+ /**
962
+ * @description Always `null` while the issue is `open`.
963
+ * @enum {string|null}
964
+ */
728
965
  resolvedAt: null
729
- /** @enum {string|null} */
966
+ /**
967
+ * @description Always `null` while the issue is `open`.
968
+ * @enum {string|null}
969
+ */
730
970
  resolvedBy: null
731
971
  }
732
972
  | {
973
+ /** @description The document ID. */
733
974
  _id: string
975
+ /** @description The document revision. It changes on every write. */
734
976
  _rev: string
735
- /** Format: date-time */
977
+ /**
978
+ * Format: date-time
979
+ * @description When the document was created, as an ISO 8601 timestamp.
980
+ */
736
981
  _createdAt: string
737
- /** Format: date-time */
982
+ /**
983
+ * Format: date-time
984
+ * @description When the document was last changed, as an ISO 8601 timestamp.
985
+ */
738
986
  _updatedAt: string
987
+ /** @description The ID (`kb…`) of the knowledge base this document belongs to. */
739
988
  knowledgeBaseId: string
740
- /** @enum {string} */
989
+ /**
990
+ * @description The document type. Always `sanity.context.issue`.
991
+ * @enum {string}
992
+ */
741
993
  _type: 'sanity.context.issue'
742
- /** @enum {number} */
994
+ /**
995
+ * @description The version of the document shape. Currently `1`.
996
+ * @enum {number}
997
+ */
743
998
  schemaVersion: 1
744
- /** @description IssueContent */
999
+ /** @description What an issue found. The shape depends on `kind`. */
745
1000
  content:
746
1001
  | {
747
- /** @enum {string} */
1002
+ /**
1003
+ * @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.
1004
+ * @enum {string}
1005
+ */
748
1006
  severity: 'critical' | 'suggestion'
1007
+ /** @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. */
749
1008
  scopePath: string
1009
+ /** @description What the problem is, in one or two sentences. */
750
1010
  issue: string
1011
+ /** @description What to do to fix the issue. */
751
1012
  suggestedFix: string
752
- /** @enum {string} */
1013
+ /**
1014
+ * @description The issue type. `conflict` means two or more positions disagree on the same fact, and you choose which one is correct.
1015
+ * @enum {string}
1016
+ */
753
1017
  kind: 'conflict'
1018
+ /** @description A key naming the disputed fact, such as `free_tier.request_limit`. It never includes the disputed value, so every side shares it. */
754
1019
  claimKey: string
1020
+ /** @description The conflicting positions, at least two. To resolve the conflict, pass the index of one side as `resolution`. */
755
1021
  sides: {
1022
+ /** @description The position as a self-contained sentence. This is the option you choose from. */
756
1023
  claim: string
1024
+ /** @description The disputed value on its own, such as `10,000/month`, without the sentence. */
757
1025
  value?: string
1026
+ /** @description Paths of the entries that state this position. */
758
1027
  entryPaths?: string[]
1028
+ /** @description IDs of the sources that directly back this position. */
759
1029
  sourceIds?: string[]
760
- /** @description ConflictSpan */
1030
+ /** @description Where in a source this position was read. */
761
1031
  span?: {
1032
+ /** @description ID of the source the position was read from. */
762
1033
  sourceId: string
1034
+ /** @description First line of the range, counting from 1. Line numbers match `GET .../sources/{sourceId}/content`. */
763
1035
  lineStart: number
1036
+ /** @description Last line of the range, inclusive. */
764
1037
  lineEnd: number
765
1038
  }
766
- /** @enum {string} */
1039
+ /**
1040
+ * @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.
1041
+ * @enum {string}
1042
+ */
767
1043
  authority?: 'primary' | 'secondary' | 'community'
768
1044
  }[]
1045
+ /** @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. */
769
1046
  suggested?: number
770
1047
  }
771
1048
  | {
772
- /** @enum {string} */
1049
+ /**
1050
+ * @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.
1051
+ * @enum {string}
1052
+ */
773
1053
  severity: 'critical' | 'suggestion'
1054
+ /** @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. */
774
1055
  scopePath: string
1056
+ /** @description What the problem is, in one or two sentences. */
775
1057
  issue: string
1058
+ /** @description What to do to fix the issue. */
776
1059
  suggestedFix: string
777
- /** @enum {string} */
1060
+ /**
1061
+ * @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.
1062
+ * @enum {string}
1063
+ */
778
1064
  kind:
779
1065
  | 'gap'
780
1066
  | 'update_required'
@@ -782,69 +1068,132 @@ export interface components {
782
1068
  | 'remove_entry'
783
1069
  | 'split_entry'
784
1070
  | 'merge_entry'
1071
+ /** @description IDs of the sources that led to the issue. For `add_entry`, the sources the new entry would cite. */
785
1072
  citedSourceIds?: string[]
1073
+ /** @description A key naming the specific finding, when the check that found it sets one. */
786
1074
  claimKey?: string
1075
+ /** @description Paths of the entries the issue involves, when it spans more than one entry. */
787
1076
  involvedScopes?: string[]
788
1077
  }
1078
+ /** @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. */
789
1079
  fingerprint: string
1080
+ /** @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. */
790
1081
  revisionId: string | null
791
- /** @enum {string} */
1082
+ /**
1083
+ * @description The issue status. `accepted` means the issue was resolved or its fix applied.
1084
+ * @enum {string}
1085
+ */
792
1086
  status: 'accepted'
793
- /** Format: date-time */
1087
+ /**
1088
+ * Format: date-time
1089
+ * @description When the issue left `open`, as an ISO 8601 timestamp.
1090
+ */
794
1091
  resolvedAt: string
1092
+ /** @description Who triaged the issue. `null` while the issue is open, or when the caller could not be identified. */
795
1093
  resolvedBy: {
1094
+ /** @description The ID of the Sanity user or robot token that triaged the issue. */
796
1095
  id: string
797
- /** @enum {string} */
1096
+ /**
1097
+ * @description What triaged the issue. `user` is a person, and `robot` is a robot token.
1098
+ * @enum {string}
1099
+ */
798
1100
  kind: 'user' | 'robot'
799
1101
  } | null
1102
+ /** @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. */
800
1103
  resolution: number | null
801
1104
  }
802
1105
  | {
1106
+ /** @description The document ID. */
803
1107
  _id: string
1108
+ /** @description The document revision. It changes on every write. */
804
1109
  _rev: string
805
- /** Format: date-time */
1110
+ /**
1111
+ * Format: date-time
1112
+ * @description When the document was created, as an ISO 8601 timestamp.
1113
+ */
806
1114
  _createdAt: string
807
- /** Format: date-time */
1115
+ /**
1116
+ * Format: date-time
1117
+ * @description When the document was last changed, as an ISO 8601 timestamp.
1118
+ */
808
1119
  _updatedAt: string
1120
+ /** @description The ID (`kb…`) of the knowledge base this document belongs to. */
809
1121
  knowledgeBaseId: string
810
- /** @enum {string} */
1122
+ /**
1123
+ * @description The document type. Always `sanity.context.issue`.
1124
+ * @enum {string}
1125
+ */
811
1126
  _type: 'sanity.context.issue'
812
- /** @enum {number} */
1127
+ /**
1128
+ * @description The version of the document shape. Currently `1`.
1129
+ * @enum {number}
1130
+ */
813
1131
  schemaVersion: 1
814
- /** @description IssueContent */
1132
+ /** @description What an issue found. The shape depends on `kind`. */
815
1133
  content:
816
1134
  | {
817
- /** @enum {string} */
1135
+ /**
1136
+ * @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.
1137
+ * @enum {string}
1138
+ */
818
1139
  severity: 'critical' | 'suggestion'
1140
+ /** @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. */
819
1141
  scopePath: string
1142
+ /** @description What the problem is, in one or two sentences. */
820
1143
  issue: string
1144
+ /** @description What to do to fix the issue. */
821
1145
  suggestedFix: string
822
- /** @enum {string} */
1146
+ /**
1147
+ * @description The issue type. `conflict` means two or more positions disagree on the same fact, and you choose which one is correct.
1148
+ * @enum {string}
1149
+ */
823
1150
  kind: 'conflict'
1151
+ /** @description A key naming the disputed fact, such as `free_tier.request_limit`. It never includes the disputed value, so every side shares it. */
824
1152
  claimKey: string
1153
+ /** @description The conflicting positions, at least two. To resolve the conflict, pass the index of one side as `resolution`. */
825
1154
  sides: {
1155
+ /** @description The position as a self-contained sentence. This is the option you choose from. */
826
1156
  claim: string
1157
+ /** @description The disputed value on its own, such as `10,000/month`, without the sentence. */
827
1158
  value?: string
1159
+ /** @description Paths of the entries that state this position. */
828
1160
  entryPaths?: string[]
1161
+ /** @description IDs of the sources that directly back this position. */
829
1162
  sourceIds?: string[]
830
- /** @description ConflictSpan */
1163
+ /** @description Where in a source this position was read. */
831
1164
  span?: {
1165
+ /** @description ID of the source the position was read from. */
832
1166
  sourceId: string
1167
+ /** @description First line of the range, counting from 1. Line numbers match `GET .../sources/{sourceId}/content`. */
833
1168
  lineStart: number
1169
+ /** @description Last line of the range, inclusive. */
834
1170
  lineEnd: number
835
1171
  }
836
- /** @enum {string} */
1172
+ /**
1173
+ * @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.
1174
+ * @enum {string}
1175
+ */
837
1176
  authority?: 'primary' | 'secondary' | 'community'
838
1177
  }[]
1178
+ /** @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. */
839
1179
  suggested?: number
840
1180
  }
841
1181
  | {
842
- /** @enum {string} */
1182
+ /**
1183
+ * @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.
1184
+ * @enum {string}
1185
+ */
843
1186
  severity: 'critical' | 'suggestion'
1187
+ /** @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. */
844
1188
  scopePath: string
1189
+ /** @description What the problem is, in one or two sentences. */
845
1190
  issue: string
1191
+ /** @description What to do to fix the issue. */
846
1192
  suggestedFix: string
847
- /** @enum {string} */
1193
+ /**
1194
+ * @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.
1195
+ * @enum {string}
1196
+ */
848
1197
  kind:
849
1198
  | 'gap'
850
1199
  | 'update_required'
@@ -852,53 +1201,101 @@ export interface components {
852
1201
  | 'remove_entry'
853
1202
  | 'split_entry'
854
1203
  | 'merge_entry'
1204
+ /** @description IDs of the sources that led to the issue. For `add_entry`, the sources the new entry would cite. */
855
1205
  citedSourceIds?: string[]
1206
+ /** @description A key naming the specific finding, when the check that found it sets one. */
856
1207
  claimKey?: string
1208
+ /** @description Paths of the entries the issue involves, when it spans more than one entry. */
857
1209
  involvedScopes?: string[]
858
1210
  }
1211
+ /** @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. */
859
1212
  fingerprint: string
1213
+ /** @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. */
860
1214
  revisionId: string | null
861
- /** @enum {string} */
1215
+ /**
1216
+ * @description The issue status. `rejected` means the issue was dismissed. Dismissal is final.
1217
+ * @enum {string}
1218
+ */
862
1219
  status: 'rejected'
863
- /** Format: date-time */
1220
+ /**
1221
+ * Format: date-time
1222
+ * @description When the issue left `open`, as an ISO 8601 timestamp.
1223
+ */
864
1224
  resolvedAt: string
1225
+ /** @description Who triaged the issue. `null` while the issue is open, or when the caller could not be identified. */
865
1226
  resolvedBy: {
1227
+ /** @description The ID of the Sanity user or robot token that triaged the issue. */
866
1228
  id: string
867
- /** @enum {string} */
1229
+ /**
1230
+ * @description What triaged the issue. `user` is a person, and `robot` is a robot token.
1231
+ * @enum {string}
1232
+ */
868
1233
  kind: 'user' | 'robot'
869
1234
  } | null
870
- /** @enum {string|null} */
1235
+ /**
1236
+ * @description Always `null`, because a dismissal chooses no side.
1237
+ * @enum {string|null}
1238
+ */
871
1239
  resolution: null
872
1240
  }
873
- /** @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. */
1241
+ /** @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. */
874
1242
  McpDoc: {
1243
+ /** @description The document ID. */
875
1244
  _id: string
1245
+ /** @description The document revision. It changes on every write. */
876
1246
  _rev: string
877
- /** Format: date-time */
1247
+ /**
1248
+ * Format: date-time
1249
+ * @description When the document was created, as an ISO 8601 timestamp.
1250
+ */
878
1251
  _createdAt: string
879
- /** Format: date-time */
1252
+ /**
1253
+ * Format: date-time
1254
+ * @description When the document was last changed, as an ISO 8601 timestamp.
1255
+ */
880
1256
  _updatedAt: string
881
- /** @enum {string} */
1257
+ /**
1258
+ * @description The document type. Always `sanity.context.mcp`.
1259
+ * @enum {string}
1260
+ */
882
1261
  _type: 'sanity.context.mcp'
883
- /** @enum {number} */
1262
+ /**
1263
+ * @description The version of the document shape. Currently `1`.
1264
+ * @enum {number}
1265
+ */
884
1266
  schemaVersion: 1
1267
+ /** @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. */
885
1268
  organizationId: string
1269
+ /** @description The MCP endpoint's public ID (`mcp…`). It is set once at creation, never changes, and determines the document `_id`. */
886
1270
  publicId: string
1271
+ /** @description The MCP endpoint's display name. You can change it at any time. */
887
1272
  title: string
1273
+ /** @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. */
888
1274
  name: string
1275
+ /** @description The content sources the MCP endpoint serves. Each source appears once, and the order has no meaning. */
889
1276
  sources: (
890
1277
  | {
891
- /** @enum {string} */
1278
+ /**
1279
+ * @description The source type. `knowledge-base` serves a whole knowledge base.
1280
+ * @enum {string}
1281
+ */
892
1282
  type: 'knowledge-base'
1283
+ /** @description The knowledge base ID (`kb…`). */
893
1284
  id: string
894
1285
  }
895
1286
  | {
896
- /** @enum {string} */
1287
+ /**
1288
+ * @description The source type. `dataset` serves documents from a Sanity dataset, limited by the MCP endpoint's `groqFilter` when set.
1289
+ * @enum {string}
1290
+ */
897
1291
  type: 'dataset'
1292
+ /** @description The dataset, as `<projectId>.<datasetName>`. */
898
1293
  id: string
899
1294
  }
900
1295
  )[]
1296
+ /** @description Prompt text the MCP endpoint serves to connecting agents. `null` when unset. */
901
1297
  instructions: string | null
1298
+ /** @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. */
902
1299
  groqFilter: string | null
903
1300
  }
904
1301
  }
@@ -913,8 +1310,11 @@ export interface operations {
913
1310
  listKnowledgeBases: {
914
1311
  parameters: {
915
1312
  query: {
1313
+ /** @description The `nextCursor` value from the previous page. Omit it to get the first page. */
916
1314
  cursor?: string
1315
+ /** @description The maximum number of items to return. */
917
1316
  limit?: number
1317
+ /** @description The organization to list knowledge bases for. */
918
1318
  organizationId: string
919
1319
  }
920
1320
  header?: never
@@ -925,28 +1325,47 @@ export interface operations {
925
1325
  }
926
1326
  requestBody?: never
927
1327
  responses: {
928
- /** @description Default Response */
1328
+ /** @description A page of knowledge bases. */
929
1329
  200: {
930
1330
  headers: {
931
1331
  [name: string]: unknown
932
1332
  }
933
1333
  content: {
934
1334
  'application/json': {
1335
+ /** @description The items on this page. */
935
1336
  data: {
936
- /** Format: uuid */
1337
+ /**
1338
+ * Format: uuid
1339
+ * @description The knowledge base's unique ID, a UUID. Accepted anywhere a `knowledgeBaseId` is expected.
1340
+ */
937
1341
  id: string
1342
+ /** @description The knowledge base ID to show users, such as `kb3do82whm`. Accepted anywhere a `knowledgeBaseId` is expected. Treat it as an opaque string. */
938
1343
  publicId: string
1344
+ /** @description The ID of the organization that owns the knowledge base. */
939
1345
  organizationId: string
1346
+ /** @description The knowledge base's title. */
940
1347
  title: string
1348
+ /** @description A short description of what the knowledge base covers. */
941
1349
  description: string
942
- /** @enum {string} */
1350
+ /**
1351
+ * @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`.
1352
+ * @enum {string}
1353
+ */
943
1354
  state: 'created' | 'building' | 'ready' | 'review' | 'stale' | 'paused'
1355
+ /** @description The job ID of the most recent build, or `null` if no build has started. Check its progress with `GET .../jobs/{jobId}`. */
944
1356
  activeJobId: string | null
1357
+ /** @description Whether a build is running now. */
945
1358
  isBuilding: boolean
1359
+ /** @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`. */
946
1360
  buildStageState: {
1361
+ /** @description The ID of the build job this progress belongs to. */
947
1362
  jobId: string
1363
+ /** @description The build's stages and their progress. Stages that haven't reported yet can be missing. */
948
1364
  stages: {
949
- /** @enum {string} */
1365
+ /**
1366
+ * @description The stage's ID. The values are listed in the order stages run.
1367
+ * @enum {string}
1368
+ */
950
1369
  id:
951
1370
  | 'tldr'
952
1371
  | 'map'
@@ -957,61 +1376,113 @@ export interface operations {
957
1376
  | 'write'
958
1377
  | 'review'
959
1378
  | 'polish'
960
- /** @enum {string} */
1379
+ /**
1380
+ * @description The stage's status. `pending`: not started. `running`: in progress. `done`: finished. `failed`: the build ended before the stage finished.
1381
+ * @enum {string}
1382
+ */
961
1383
  status: 'pending' | 'running' | 'done' | 'failed'
1384
+ /** @description The stage's progress counts. Absent when the stage hasn't reported counts. */
962
1385
  units?: {
963
- /** @enum {string} */
1386
+ /**
1387
+ * @description What `done` and `total` count: `sources`, `groups` of related content, `entries`, or `rounds` of final fixes. A `rounds` stage has no `total`.
1388
+ * @enum {string}
1389
+ */
964
1390
  unit: 'sources' | 'groups' | 'entries' | 'rounds'
1391
+ /** @description How many units the stage has finished. */
965
1392
  done: number
1393
+ /** @description How many units the stage will process. Absent when `unit` is `rounds`. */
966
1394
  total?: number
967
1395
  }
968
1396
  }[]
969
1397
  } | null
970
- /** Format: date-time */
1398
+ /**
1399
+ * Format: date-time
1400
+ * @description When a refresh last checked the knowledge base for changes, whether or not anything changed. `null` until the first refresh.
1401
+ */
971
1402
  lastCheckedAt: string | null
972
- /** Format: date-time */
1403
+ /**
1404
+ * Format: date-time
1405
+ * @description When the content last changed: the time of the most recent successful build. `null` if the knowledge base has never built.
1406
+ */
973
1407
  lastChangedAt: string | null
1408
+ /** @description Whether sources were added, changed, or removed since the last successful build. Always `false` before the first build. */
974
1409
  hasPendingChanges: boolean
1410
+ /** @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. */
975
1411
  pendingChanges: {
1412
+ /** @description Sources added since the last successful build, including sources no successful build has included yet. */
976
1413
  added: number
1414
+ /** @description Sources whose content changed since the last successful build. */
977
1415
  changed: number
1416
+ /** @description Sources that recent refreshes no longer find. */
978
1417
  removed: number
979
1418
  } | null
1419
+ /** @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. */
980
1420
  pipelineOutdated: boolean
1421
+ /** @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. */
981
1422
  rebuildRecommended: {
1423
+ /** @description Why a rebuild is recommended, written to show to users. */
982
1424
  reason: string
983
- /** Format: date-time */
1425
+ /**
1426
+ * Format: date-time
1427
+ * @description When the recommendation was made.
1428
+ */
984
1429
  at: string
985
1430
  } | null
1431
+ /** @description Whether the knowledge base has at least one website source. */
986
1432
  hasWebSource: boolean
1433
+ /** @description Whether the knowledge base has at least one Sanity dataset source. */
987
1434
  hasDatasetSource: boolean
1435
+ /** @description How many sources the knowledge base uses, and its source limit. */
988
1436
  sourceUsage: {
1437
+ /** @description The number of sources counted toward the limit, including parts split from large sources. */
989
1438
  used: number
1439
+ /** @description The maximum number of sources the knowledge base can have. */
990
1440
  limit: number
991
1441
  } | null
992
- /** @description PlanRestriction */
1442
+ /** @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`. */
993
1443
  buildRestriction: {
1444
+ /** @description A stable code for the restriction, such as `planLimitReached`. */
994
1445
  code: string
1446
+ /** @description A readable explanation that you can show to users. */
995
1447
  message: string
996
1448
  } | null
1449
+ /** @description Whether scheduled refresh is on. Only applies to knowledge bases with a website or dataset source. */
997
1450
  refreshEnabled: boolean
998
- /** @enum {string} */
1451
+ /**
1452
+ * @description How often scheduled refresh runs: `weekly` (the default) or `monthly`.
1453
+ * @enum {string}
1454
+ */
999
1455
  refreshFrequency: 'weekly' | 'monthly'
1000
- /** Format: date-time */
1456
+ /**
1457
+ * Format: date-time
1458
+ * @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`.
1459
+ */
1001
1460
  refreshNextRunAt: string | null
1461
+ /** @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`. */
1002
1462
  refreshInFlight: boolean
1463
+ /** @description The number of open issues waiting for review. Always `0` before the first build. */
1003
1464
  openIssueCount: number
1465
+ /** @description The number of active instructions for the knowledge base. */
1004
1466
  instructionCount: number
1005
- /** @description Actor */
1467
+ /** @description Who created the knowledge base. `null` if unknown. */
1006
1468
  createdBy: {
1469
+ /** @description The Sanity user ID, or `sanity-system` when Sanity Context made the change. `null` if unknown. */
1007
1470
  id: string | null
1471
+ /** @description The user's name when the action happened. `null` if unknown. For the current name, look up the user by `id`. */
1008
1472
  displayName: string | null
1009
1473
  } | null
1010
- /** Format: date-time */
1474
+ /**
1475
+ * Format: date-time
1476
+ * @description When the knowledge base was created.
1477
+ */
1011
1478
  createdAt: string
1012
- /** Format: date-time */
1479
+ /**
1480
+ * Format: date-time
1481
+ * @description When the knowledge base was last updated.
1482
+ */
1013
1483
  updatedAt: string
1014
1484
  }[]
1485
+ /** @description The cursor for the next page. Pass it as `cursor` to get more results. `null` when there are no more pages. */
1015
1486
  nextCursor: string | null
1016
1487
  }
1017
1488
  }
@@ -1030,34 +1501,55 @@ export interface operations {
1030
1501
  requestBody: {
1031
1502
  content: {
1032
1503
  'application/json': {
1504
+ /** @description The ID of the organization to create the knowledge base in. */
1033
1505
  organizationId: string
1506
+ /** @description The knowledge base's title. */
1034
1507
  title: string
1508
+ /** @description A short description of what the knowledge base covers. */
1035
1509
  description: string
1036
1510
  }
1037
1511
  }
1038
1512
  }
1039
1513
  responses: {
1040
- /** @description KnowledgeBase */
1514
+ /** @description A knowledge base and its current state. */
1041
1515
  201: {
1042
1516
  headers: {
1043
1517
  [name: string]: unknown
1044
1518
  }
1045
1519
  content: {
1046
1520
  'application/json': {
1047
- /** Format: uuid */
1521
+ /**
1522
+ * Format: uuid
1523
+ * @description The knowledge base's unique ID, a UUID. Accepted anywhere a `knowledgeBaseId` is expected.
1524
+ */
1048
1525
  id: string
1526
+ /** @description The knowledge base ID to show users, such as `kb3do82whm`. Accepted anywhere a `knowledgeBaseId` is expected. Treat it as an opaque string. */
1049
1527
  publicId: string
1528
+ /** @description The ID of the organization that owns the knowledge base. */
1050
1529
  organizationId: string
1530
+ /** @description The knowledge base's title. */
1051
1531
  title: string
1532
+ /** @description A short description of what the knowledge base covers. */
1052
1533
  description: string
1053
- /** @enum {string} */
1534
+ /**
1535
+ * @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`.
1536
+ * @enum {string}
1537
+ */
1054
1538
  state: 'created' | 'building' | 'ready' | 'review' | 'stale' | 'paused'
1539
+ /** @description The job ID of the most recent build, or `null` if no build has started. Check its progress with `GET .../jobs/{jobId}`. */
1055
1540
  activeJobId: string | null
1541
+ /** @description Whether a build is running now. */
1056
1542
  isBuilding: boolean
1543
+ /** @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`. */
1057
1544
  buildStageState: {
1545
+ /** @description The ID of the build job this progress belongs to. */
1058
1546
  jobId: string
1547
+ /** @description The build's stages and their progress. Stages that haven't reported yet can be missing. */
1059
1548
  stages: {
1060
- /** @enum {string} */
1549
+ /**
1550
+ * @description The stage's ID. The values are listed in the order stages run.
1551
+ * @enum {string}
1552
+ */
1061
1553
  id:
1062
1554
  | 'tldr'
1063
1555
  | 'map'
@@ -1068,59 +1560,110 @@ export interface operations {
1068
1560
  | 'write'
1069
1561
  | 'review'
1070
1562
  | 'polish'
1071
- /** @enum {string} */
1563
+ /**
1564
+ * @description The stage's status. `pending`: not started. `running`: in progress. `done`: finished. `failed`: the build ended before the stage finished.
1565
+ * @enum {string}
1566
+ */
1072
1567
  status: 'pending' | 'running' | 'done' | 'failed'
1568
+ /** @description The stage's progress counts. Absent when the stage hasn't reported counts. */
1073
1569
  units?: {
1074
- /** @enum {string} */
1570
+ /**
1571
+ * @description What `done` and `total` count: `sources`, `groups` of related content, `entries`, or `rounds` of final fixes. A `rounds` stage has no `total`.
1572
+ * @enum {string}
1573
+ */
1075
1574
  unit: 'sources' | 'groups' | 'entries' | 'rounds'
1575
+ /** @description How many units the stage has finished. */
1076
1576
  done: number
1577
+ /** @description How many units the stage will process. Absent when `unit` is `rounds`. */
1077
1578
  total?: number
1078
1579
  }
1079
1580
  }[]
1080
1581
  } | null
1081
- /** Format: date-time */
1582
+ /**
1583
+ * Format: date-time
1584
+ * @description When a refresh last checked the knowledge base for changes, whether or not anything changed. `null` until the first refresh.
1585
+ */
1082
1586
  lastCheckedAt: string | null
1083
- /** Format: date-time */
1587
+ /**
1588
+ * Format: date-time
1589
+ * @description When the content last changed: the time of the most recent successful build. `null` if the knowledge base has never built.
1590
+ */
1084
1591
  lastChangedAt: string | null
1592
+ /** @description Whether sources were added, changed, or removed since the last successful build. Always `false` before the first build. */
1085
1593
  hasPendingChanges: boolean
1594
+ /** @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. */
1086
1595
  pendingChanges: {
1596
+ /** @description Sources added since the last successful build, including sources no successful build has included yet. */
1087
1597
  added: number
1598
+ /** @description Sources whose content changed since the last successful build. */
1088
1599
  changed: number
1600
+ /** @description Sources that recent refreshes no longer find. */
1089
1601
  removed: number
1090
1602
  } | null
1603
+ /** @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. */
1091
1604
  pipelineOutdated: boolean
1605
+ /** @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. */
1092
1606
  rebuildRecommended: {
1607
+ /** @description Why a rebuild is recommended, written to show to users. */
1093
1608
  reason: string
1094
- /** Format: date-time */
1609
+ /**
1610
+ * Format: date-time
1611
+ * @description When the recommendation was made.
1612
+ */
1095
1613
  at: string
1096
1614
  } | null
1615
+ /** @description Whether the knowledge base has at least one website source. */
1097
1616
  hasWebSource: boolean
1617
+ /** @description Whether the knowledge base has at least one Sanity dataset source. */
1098
1618
  hasDatasetSource: boolean
1619
+ /** @description How many sources the knowledge base uses, and its source limit. */
1099
1620
  sourceUsage: {
1621
+ /** @description The number of sources counted toward the limit, including parts split from large sources. */
1100
1622
  used: number
1623
+ /** @description The maximum number of sources the knowledge base can have. */
1101
1624
  limit: number
1102
1625
  } | null
1103
- /** @description PlanRestriction */
1626
+ /** @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`. */
1104
1627
  buildRestriction: {
1628
+ /** @description A stable code for the restriction, such as `planLimitReached`. */
1105
1629
  code: string
1630
+ /** @description A readable explanation that you can show to users. */
1106
1631
  message: string
1107
1632
  } | null
1633
+ /** @description Whether scheduled refresh is on. Only applies to knowledge bases with a website or dataset source. */
1108
1634
  refreshEnabled: boolean
1109
- /** @enum {string} */
1635
+ /**
1636
+ * @description How often scheduled refresh runs: `weekly` (the default) or `monthly`.
1637
+ * @enum {string}
1638
+ */
1110
1639
  refreshFrequency: 'weekly' | 'monthly'
1111
- /** Format: date-time */
1640
+ /**
1641
+ * Format: date-time
1642
+ * @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`.
1643
+ */
1112
1644
  refreshNextRunAt: string | null
1645
+ /** @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`. */
1113
1646
  refreshInFlight: boolean
1647
+ /** @description The number of open issues waiting for review. Always `0` before the first build. */
1114
1648
  openIssueCount: number
1649
+ /** @description The number of active instructions for the knowledge base. */
1115
1650
  instructionCount: number
1116
- /** @description Actor */
1651
+ /** @description Who created the knowledge base. `null` if unknown. */
1117
1652
  createdBy: {
1653
+ /** @description The Sanity user ID, or `sanity-system` when Sanity Context made the change. `null` if unknown. */
1118
1654
  id: string | null
1655
+ /** @description The user's name when the action happened. `null` if unknown. For the current name, look up the user by `id`. */
1119
1656
  displayName: string | null
1120
1657
  } | null
1121
- /** Format: date-time */
1658
+ /**
1659
+ * Format: date-time
1660
+ * @description When the knowledge base was created.
1661
+ */
1122
1662
  createdAt: string
1123
- /** Format: date-time */
1663
+ /**
1664
+ * Format: date-time
1665
+ * @description When the knowledge base was last updated.
1666
+ */
1124
1667
  updatedAt: string
1125
1668
  }
1126
1669
  }
@@ -1132,33 +1675,52 @@ export interface operations {
1132
1675
  query?: never
1133
1676
  header?: never
1134
1677
  path: {
1678
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
1135
1679
  knowledgeBaseId: string
1136
1680
  }
1137
1681
  cookie?: never
1138
1682
  }
1139
1683
  requestBody?: never
1140
1684
  responses: {
1141
- /** @description KnowledgeBase */
1685
+ /** @description A knowledge base and its current state. */
1142
1686
  200: {
1143
1687
  headers: {
1144
1688
  [name: string]: unknown
1145
1689
  }
1146
1690
  content: {
1147
1691
  'application/json': {
1148
- /** Format: uuid */
1692
+ /**
1693
+ * Format: uuid
1694
+ * @description The knowledge base's unique ID, a UUID. Accepted anywhere a `knowledgeBaseId` is expected.
1695
+ */
1149
1696
  id: string
1697
+ /** @description The knowledge base ID to show users, such as `kb3do82whm`. Accepted anywhere a `knowledgeBaseId` is expected. Treat it as an opaque string. */
1150
1698
  publicId: string
1699
+ /** @description The ID of the organization that owns the knowledge base. */
1151
1700
  organizationId: string
1701
+ /** @description The knowledge base's title. */
1152
1702
  title: string
1703
+ /** @description A short description of what the knowledge base covers. */
1153
1704
  description: string
1154
- /** @enum {string} */
1705
+ /**
1706
+ * @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`.
1707
+ * @enum {string}
1708
+ */
1155
1709
  state: 'created' | 'building' | 'ready' | 'review' | 'stale' | 'paused'
1710
+ /** @description The job ID of the most recent build, or `null` if no build has started. Check its progress with `GET .../jobs/{jobId}`. */
1156
1711
  activeJobId: string | null
1712
+ /** @description Whether a build is running now. */
1157
1713
  isBuilding: boolean
1714
+ /** @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`. */
1158
1715
  buildStageState: {
1716
+ /** @description The ID of the build job this progress belongs to. */
1159
1717
  jobId: string
1718
+ /** @description The build's stages and their progress. Stages that haven't reported yet can be missing. */
1160
1719
  stages: {
1161
- /** @enum {string} */
1720
+ /**
1721
+ * @description The stage's ID. The values are listed in the order stages run.
1722
+ * @enum {string}
1723
+ */
1162
1724
  id:
1163
1725
  | 'tldr'
1164
1726
  | 'map'
@@ -1169,59 +1731,110 @@ export interface operations {
1169
1731
  | 'write'
1170
1732
  | 'review'
1171
1733
  | 'polish'
1172
- /** @enum {string} */
1734
+ /**
1735
+ * @description The stage's status. `pending`: not started. `running`: in progress. `done`: finished. `failed`: the build ended before the stage finished.
1736
+ * @enum {string}
1737
+ */
1173
1738
  status: 'pending' | 'running' | 'done' | 'failed'
1739
+ /** @description The stage's progress counts. Absent when the stage hasn't reported counts. */
1174
1740
  units?: {
1175
- /** @enum {string} */
1741
+ /**
1742
+ * @description What `done` and `total` count: `sources`, `groups` of related content, `entries`, or `rounds` of final fixes. A `rounds` stage has no `total`.
1743
+ * @enum {string}
1744
+ */
1176
1745
  unit: 'sources' | 'groups' | 'entries' | 'rounds'
1746
+ /** @description How many units the stage has finished. */
1177
1747
  done: number
1748
+ /** @description How many units the stage will process. Absent when `unit` is `rounds`. */
1178
1749
  total?: number
1179
1750
  }
1180
1751
  }[]
1181
1752
  } | null
1182
- /** Format: date-time */
1753
+ /**
1754
+ * Format: date-time
1755
+ * @description When a refresh last checked the knowledge base for changes, whether or not anything changed. `null` until the first refresh.
1756
+ */
1183
1757
  lastCheckedAt: string | null
1184
- /** Format: date-time */
1758
+ /**
1759
+ * Format: date-time
1760
+ * @description When the content last changed: the time of the most recent successful build. `null` if the knowledge base has never built.
1761
+ */
1185
1762
  lastChangedAt: string | null
1763
+ /** @description Whether sources were added, changed, or removed since the last successful build. Always `false` before the first build. */
1186
1764
  hasPendingChanges: boolean
1765
+ /** @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. */
1187
1766
  pendingChanges: {
1767
+ /** @description Sources added since the last successful build, including sources no successful build has included yet. */
1188
1768
  added: number
1769
+ /** @description Sources whose content changed since the last successful build. */
1189
1770
  changed: number
1771
+ /** @description Sources that recent refreshes no longer find. */
1190
1772
  removed: number
1191
1773
  } | null
1774
+ /** @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. */
1192
1775
  pipelineOutdated: boolean
1776
+ /** @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. */
1193
1777
  rebuildRecommended: {
1778
+ /** @description Why a rebuild is recommended, written to show to users. */
1194
1779
  reason: string
1195
- /** Format: date-time */
1780
+ /**
1781
+ * Format: date-time
1782
+ * @description When the recommendation was made.
1783
+ */
1196
1784
  at: string
1197
1785
  } | null
1786
+ /** @description Whether the knowledge base has at least one website source. */
1198
1787
  hasWebSource: boolean
1788
+ /** @description Whether the knowledge base has at least one Sanity dataset source. */
1199
1789
  hasDatasetSource: boolean
1790
+ /** @description How many sources the knowledge base uses, and its source limit. */
1200
1791
  sourceUsage: {
1792
+ /** @description The number of sources counted toward the limit, including parts split from large sources. */
1201
1793
  used: number
1794
+ /** @description The maximum number of sources the knowledge base can have. */
1202
1795
  limit: number
1203
1796
  } | null
1204
- /** @description PlanRestriction */
1797
+ /** @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`. */
1205
1798
  buildRestriction: {
1799
+ /** @description A stable code for the restriction, such as `planLimitReached`. */
1206
1800
  code: string
1801
+ /** @description A readable explanation that you can show to users. */
1207
1802
  message: string
1208
1803
  } | null
1804
+ /** @description Whether scheduled refresh is on. Only applies to knowledge bases with a website or dataset source. */
1209
1805
  refreshEnabled: boolean
1210
- /** @enum {string} */
1806
+ /**
1807
+ * @description How often scheduled refresh runs: `weekly` (the default) or `monthly`.
1808
+ * @enum {string}
1809
+ */
1211
1810
  refreshFrequency: 'weekly' | 'monthly'
1212
- /** Format: date-time */
1811
+ /**
1812
+ * Format: date-time
1813
+ * @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`.
1814
+ */
1213
1815
  refreshNextRunAt: string | null
1816
+ /** @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`. */
1214
1817
  refreshInFlight: boolean
1818
+ /** @description The number of open issues waiting for review. Always `0` before the first build. */
1215
1819
  openIssueCount: number
1820
+ /** @description The number of active instructions for the knowledge base. */
1216
1821
  instructionCount: number
1217
- /** @description Actor */
1822
+ /** @description Who created the knowledge base. `null` if unknown. */
1218
1823
  createdBy: {
1824
+ /** @description The Sanity user ID, or `sanity-system` when Sanity Context made the change. `null` if unknown. */
1219
1825
  id: string | null
1826
+ /** @description The user's name when the action happened. `null` if unknown. For the current name, look up the user by `id`. */
1220
1827
  displayName: string | null
1221
1828
  } | null
1222
- /** Format: date-time */
1829
+ /**
1830
+ * Format: date-time
1831
+ * @description When the knowledge base was created.
1832
+ */
1223
1833
  createdAt: string
1224
- /** Format: date-time */
1834
+ /**
1835
+ * Format: date-time
1836
+ * @description When the knowledge base was last updated.
1837
+ */
1225
1838
  updatedAt: string
1226
1839
  }
1227
1840
  }
@@ -1233,13 +1846,14 @@ export interface operations {
1233
1846
  query?: never
1234
1847
  header?: never
1235
1848
  path: {
1849
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
1236
1850
  knowledgeBaseId: string
1237
1851
  }
1238
1852
  cookie?: never
1239
1853
  }
1240
1854
  requestBody?: never
1241
1855
  responses: {
1242
- /** @description Default Response */
1856
+ /** @description The knowledge base was deleted. */
1243
1857
  204: {
1244
1858
  headers: {
1245
1859
  [name: string]: unknown
@@ -1255,6 +1869,7 @@ export interface operations {
1255
1869
  query?: never
1256
1870
  header?: never
1257
1871
  path: {
1872
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
1258
1873
  knowledgeBaseId: string
1259
1874
  }
1260
1875
  cookie?: never
@@ -1262,36 +1877,60 @@ export interface operations {
1262
1877
  requestBody: {
1263
1878
  content: {
1264
1879
  'application/json': {
1880
+ /** @description The knowledge base's new title. */
1265
1881
  title?: string
1882
+ /** @description The knowledge base's new description. */
1266
1883
  description?: string
1884
+ /** @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. */
1267
1885
  refreshEnabled?: boolean
1268
- /** @enum {string} */
1886
+ /**
1887
+ * @description How often scheduled refresh runs: `weekly` or `monthly`. Requires a website or dataset source and a plan that includes scheduled refresh.
1888
+ * @enum {string}
1889
+ */
1269
1890
  refreshFrequency?: 'weekly' | 'monthly'
1270
1891
  }
1271
1892
  }
1272
1893
  }
1273
1894
  responses: {
1274
- /** @description KnowledgeBase */
1895
+ /** @description A knowledge base and its current state. */
1275
1896
  200: {
1276
1897
  headers: {
1277
1898
  [name: string]: unknown
1278
1899
  }
1279
1900
  content: {
1280
1901
  'application/json': {
1281
- /** Format: uuid */
1902
+ /**
1903
+ * Format: uuid
1904
+ * @description The knowledge base's unique ID, a UUID. Accepted anywhere a `knowledgeBaseId` is expected.
1905
+ */
1282
1906
  id: string
1907
+ /** @description The knowledge base ID to show users, such as `kb3do82whm`. Accepted anywhere a `knowledgeBaseId` is expected. Treat it as an opaque string. */
1283
1908
  publicId: string
1909
+ /** @description The ID of the organization that owns the knowledge base. */
1284
1910
  organizationId: string
1911
+ /** @description The knowledge base's title. */
1285
1912
  title: string
1913
+ /** @description A short description of what the knowledge base covers. */
1286
1914
  description: string
1287
- /** @enum {string} */
1915
+ /**
1916
+ * @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`.
1917
+ * @enum {string}
1918
+ */
1288
1919
  state: 'created' | 'building' | 'ready' | 'review' | 'stale' | 'paused'
1920
+ /** @description The job ID of the most recent build, or `null` if no build has started. Check its progress with `GET .../jobs/{jobId}`. */
1289
1921
  activeJobId: string | null
1922
+ /** @description Whether a build is running now. */
1290
1923
  isBuilding: boolean
1924
+ /** @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`. */
1291
1925
  buildStageState: {
1926
+ /** @description The ID of the build job this progress belongs to. */
1292
1927
  jobId: string
1928
+ /** @description The build's stages and their progress. Stages that haven't reported yet can be missing. */
1293
1929
  stages: {
1294
- /** @enum {string} */
1930
+ /**
1931
+ * @description The stage's ID. The values are listed in the order stages run.
1932
+ * @enum {string}
1933
+ */
1295
1934
  id:
1296
1935
  | 'tldr'
1297
1936
  | 'map'
@@ -1302,59 +1941,110 @@ export interface operations {
1302
1941
  | 'write'
1303
1942
  | 'review'
1304
1943
  | 'polish'
1305
- /** @enum {string} */
1944
+ /**
1945
+ * @description The stage's status. `pending`: not started. `running`: in progress. `done`: finished. `failed`: the build ended before the stage finished.
1946
+ * @enum {string}
1947
+ */
1306
1948
  status: 'pending' | 'running' | 'done' | 'failed'
1949
+ /** @description The stage's progress counts. Absent when the stage hasn't reported counts. */
1307
1950
  units?: {
1308
- /** @enum {string} */
1951
+ /**
1952
+ * @description What `done` and `total` count: `sources`, `groups` of related content, `entries`, or `rounds` of final fixes. A `rounds` stage has no `total`.
1953
+ * @enum {string}
1954
+ */
1309
1955
  unit: 'sources' | 'groups' | 'entries' | 'rounds'
1956
+ /** @description How many units the stage has finished. */
1310
1957
  done: number
1958
+ /** @description How many units the stage will process. Absent when `unit` is `rounds`. */
1311
1959
  total?: number
1312
1960
  }
1313
1961
  }[]
1314
1962
  } | null
1315
- /** Format: date-time */
1963
+ /**
1964
+ * Format: date-time
1965
+ * @description When a refresh last checked the knowledge base for changes, whether or not anything changed. `null` until the first refresh.
1966
+ */
1316
1967
  lastCheckedAt: string | null
1317
- /** Format: date-time */
1968
+ /**
1969
+ * Format: date-time
1970
+ * @description When the content last changed: the time of the most recent successful build. `null` if the knowledge base has never built.
1971
+ */
1318
1972
  lastChangedAt: string | null
1973
+ /** @description Whether sources were added, changed, or removed since the last successful build. Always `false` before the first build. */
1319
1974
  hasPendingChanges: boolean
1975
+ /** @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. */
1320
1976
  pendingChanges: {
1977
+ /** @description Sources added since the last successful build, including sources no successful build has included yet. */
1321
1978
  added: number
1979
+ /** @description Sources whose content changed since the last successful build. */
1322
1980
  changed: number
1981
+ /** @description Sources that recent refreshes no longer find. */
1323
1982
  removed: number
1324
1983
  } | null
1984
+ /** @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. */
1325
1985
  pipelineOutdated: boolean
1986
+ /** @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. */
1326
1987
  rebuildRecommended: {
1988
+ /** @description Why a rebuild is recommended, written to show to users. */
1327
1989
  reason: string
1328
- /** Format: date-time */
1990
+ /**
1991
+ * Format: date-time
1992
+ * @description When the recommendation was made.
1993
+ */
1329
1994
  at: string
1330
1995
  } | null
1996
+ /** @description Whether the knowledge base has at least one website source. */
1331
1997
  hasWebSource: boolean
1998
+ /** @description Whether the knowledge base has at least one Sanity dataset source. */
1332
1999
  hasDatasetSource: boolean
2000
+ /** @description How many sources the knowledge base uses, and its source limit. */
1333
2001
  sourceUsage: {
2002
+ /** @description The number of sources counted toward the limit, including parts split from large sources. */
1334
2003
  used: number
2004
+ /** @description The maximum number of sources the knowledge base can have. */
1335
2005
  limit: number
1336
2006
  } | null
1337
- /** @description PlanRestriction */
2007
+ /** @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`. */
1338
2008
  buildRestriction: {
2009
+ /** @description A stable code for the restriction, such as `planLimitReached`. */
1339
2010
  code: string
2011
+ /** @description A readable explanation that you can show to users. */
1340
2012
  message: string
1341
2013
  } | null
2014
+ /** @description Whether scheduled refresh is on. Only applies to knowledge bases with a website or dataset source. */
1342
2015
  refreshEnabled: boolean
1343
- /** @enum {string} */
2016
+ /**
2017
+ * @description How often scheduled refresh runs: `weekly` (the default) or `monthly`.
2018
+ * @enum {string}
2019
+ */
1344
2020
  refreshFrequency: 'weekly' | 'monthly'
1345
- /** Format: date-time */
2021
+ /**
2022
+ * Format: date-time
2023
+ * @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`.
2024
+ */
1346
2025
  refreshNextRunAt: string | null
2026
+ /** @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`. */
1347
2027
  refreshInFlight: boolean
2028
+ /** @description The number of open issues waiting for review. Always `0` before the first build. */
1348
2029
  openIssueCount: number
2030
+ /** @description The number of active instructions for the knowledge base. */
1349
2031
  instructionCount: number
1350
- /** @description Actor */
2032
+ /** @description Who created the knowledge base. `null` if unknown. */
1351
2033
  createdBy: {
2034
+ /** @description The Sanity user ID, or `sanity-system` when Sanity Context made the change. `null` if unknown. */
1352
2035
  id: string | null
2036
+ /** @description The user's name when the action happened. `null` if unknown. For the current name, look up the user by `id`. */
1353
2037
  displayName: string | null
1354
2038
  } | null
1355
- /** Format: date-time */
2039
+ /**
2040
+ * Format: date-time
2041
+ * @description When the knowledge base was created.
2042
+ */
1356
2043
  createdAt: string
1357
- /** Format: date-time */
2044
+ /**
2045
+ * Format: date-time
2046
+ * @description When the knowledge base was last updated.
2047
+ */
1358
2048
  updatedAt: string
1359
2049
  }
1360
2050
  }
@@ -1366,19 +2056,21 @@ export interface operations {
1366
2056
  query?: never
1367
2057
  header?: never
1368
2058
  path: {
2059
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
1369
2060
  knowledgeBaseId: string
1370
2061
  }
1371
2062
  cookie?: never
1372
2063
  }
1373
2064
  requestBody?: never
1374
2065
  responses: {
1375
- /** @description JobAccepted */
2066
+ /** @description A queued job that you can poll for progress. */
1376
2067
  202: {
1377
2068
  headers: {
1378
2069
  [name: string]: unknown
1379
2070
  }
1380
2071
  content: {
1381
2072
  'application/json': {
2073
+ /** @description The queued job's ID. Check its progress with `GET .../jobs/{jobId}`. */
1382
2074
  jobId: string
1383
2075
  }
1384
2076
  }
@@ -1390,19 +2082,21 @@ export interface operations {
1390
2082
  query?: never
1391
2083
  header?: never
1392
2084
  path: {
2085
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
1393
2086
  knowledgeBaseId: string
1394
2087
  }
1395
2088
  cookie?: never
1396
2089
  }
1397
2090
  requestBody?: never
1398
2091
  responses: {
1399
- /** @description Default Response */
2092
+ /** @description The result of the cancel request. */
1400
2093
  200: {
1401
2094
  headers: {
1402
2095
  [name: string]: unknown
1403
2096
  }
1404
2097
  content: {
1405
2098
  'application/json': {
2099
+ /** @description Whether a running build was cancelled. `false` when no build was running. */
1406
2100
  cancelled: boolean
1407
2101
  }
1408
2102
  }
@@ -1414,24 +2108,31 @@ export interface operations {
1414
2108
  query?: never
1415
2109
  header?: never
1416
2110
  path: {
2111
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
1417
2112
  knowledgeBaseId: string
2113
+ /** @description The entry's slash-delimited path, such as `pricing/plans/free`, URL-encoded. */
1418
2114
  entryPath: string
1419
2115
  }
1420
2116
  cookie?: never
1421
2117
  }
1422
2118
  requestBody?: never
1423
2119
  responses: {
1424
- /** @description RebuildEntryResponse */
2120
+ /** @description The job that rebuilds the entry, and the other entries that share its sources. */
1425
2121
  202: {
1426
2122
  headers: {
1427
2123
  [name: string]: unknown
1428
2124
  }
1429
2125
  content: {
1430
2126
  'application/json': {
2127
+ /** @description ID of the job that rebuilds the entry. Poll it with `GET .../jobs/{jobId}`. */
1431
2128
  jobId: string
2129
+ /** @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. */
1432
2130
  affectedEntries: {
2131
+ /** @description The entry's document ID. */
1433
2132
  id: string
2133
+ /** @description The entry's path, such as `products/api/webhooks`. */
1434
2134
  path: string
2135
+ /** @description The entry's title. */
1435
2136
  title: string
1436
2137
  }[]
1437
2138
  }
@@ -1442,68 +2143,110 @@ export interface operations {
1442
2143
  listImports: {
1443
2144
  parameters: {
1444
2145
  query?: {
2146
+ /** @description The `nextCursor` value from the previous page. Omit it to get the first page. */
1445
2147
  cursor?: string
2148
+ /** @description The maximum number of items to return. */
1446
2149
  limit?: number
1447
2150
  }
1448
2151
  header?: never
1449
2152
  path: {
2153
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
1450
2154
  knowledgeBaseId: string
1451
2155
  }
1452
2156
  cookie?: never
1453
2157
  }
1454
2158
  requestBody?: never
1455
2159
  responses: {
1456
- /** @description Default Response */
2160
+ /** @description A page of imports. */
1457
2161
  200: {
1458
2162
  headers: {
1459
2163
  [name: string]: unknown
1460
2164
  }
1461
2165
  content: {
1462
2166
  'application/json': {
2167
+ /** @description The items on this page. */
1463
2168
  data: {
1464
- /** Format: uuid */
2169
+ /**
2170
+ * Format: uuid
2171
+ * @description The import's ID.
2172
+ */
1465
2173
  id: string
1466
- /** Format: uuid */
2174
+ /**
2175
+ * Format: uuid
2176
+ * @description The `id` of the knowledge base that the import belongs to.
2177
+ */
1467
2178
  knowledgeBaseId: string
2179
+ /** @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. */
1468
2180
  name: string | null
2181
+ /** @description The size of the uploaded file or inline text, in bytes. `null` for crawl and dataset imports, and until a file upload completes. */
1469
2182
  sizeBytes: number | null
1470
- /** @enum {string} */
2183
+ /**
2184
+ * @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.
2185
+ * @enum {string}
2186
+ */
1471
2187
  status: 'uploading' | 'processing' | 'complete' | 'failed'
1472
- /** @enum {string} */
2188
+ /**
2189
+ * @description The kind of sources the import produces. `file`: uploads and inline text. `web`: crawls. `dataset`: Sanity datasets.
2190
+ * @enum {string}
2191
+ */
1473
2192
  sourceKind: 'web' | 'file' | 'dataset'
1474
- /** Format: date-time */
2193
+ /**
2194
+ * Format: date-time
2195
+ * @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.
2196
+ */
1475
2197
  lastCheckedAt: string | null
2198
+ /** @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. */
1476
2199
  sourceCount: number
2200
+ /** @description The number of sources expected to be distilled, including parts split from large sources. Excludes skipped sources. */
1477
2201
  totalDistillableCount: number
2202
+ /** @description The number of sources distilled so far. Compare it with `totalDistillableCount` to show progress. */
1478
2203
  distilledCount: number
2204
+ /** @description The number of sources skipped because their file type isn't supported, such as images. */
1479
2205
  unsupportedCount: number
2206
+ /** @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`. */
1480
2207
  statusDetail: string | null
2208
+ /** @description When `status` is `failed`, a readable reason from one failed source. `null` for any other status, or when no single source failed. */
1481
2209
  error: string | null
1482
- /** @description CrawlOptions */
2210
+ /** @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. */
1483
2211
  crawlOptions: {
2212
+ /** @description Regular expressions for URL paths to crawl. When set, the crawl only includes pages whose path matches one of them. */
1484
2213
  includePaths?: string[]
2214
+ /** @description Regular expressions for URL paths to skip. Pages whose path matches one of them aren't crawled. */
1485
2215
  excludePaths?: string[]
2216
+ /** @description How many levels deep the crawl goes from the root URL. */
1486
2217
  maxDepth?: number
2218
+ /** @description Whether to crawl only the pages listed in the site's sitemap. */
1487
2219
  sitemapOnly?: boolean
2220
+ /** @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. */
1488
2221
  ignoreQueryParameters?: boolean
2222
+ /** @description The maximum number of pages to crawl. The crawl can stop sooner when the knowledge base reaches its source limit. */
1489
2223
  pageLimit?: number
1490
2224
  } | null
1491
- /** @description DatasetSourceBinding */
2225
+ /** @description The Sanity project, dataset, and full query a dataset import reads from. `null` for other import types. */
1492
2226
  datasetSource: {
2227
+ /** @description The ID of the Sanity project the documents come from. */
1493
2228
  sanityProjectId: string
2229
+ /** @description The dataset the documents come from. */
1494
2230
  sanityDatasetId: string
2231
+ /** @description The full GROQ query that selects the documents, exactly as saved. */
1495
2232
  query: string
1496
2233
  } | null
1497
- /** @description Actor */
2234
+ /** @description Who added the import. `null` if unknown. */
1498
2235
  createdBy: {
2236
+ /** @description The Sanity user ID, or `sanity-system` when Sanity Context made the change. `null` if unknown. */
1499
2237
  id: string | null
2238
+ /** @description The user's name when the action happened. `null` if unknown. For the current name, look up the user by `id`. */
1500
2239
  displayName: string | null
1501
2240
  } | null
1502
- /** Format: date-time */
2241
+ /**
2242
+ * Format: date-time
2243
+ * @description When the import was created.
2244
+ */
1503
2245
  createdAt: string
1504
2246
  /** Format: date-time */
1505
2247
  completedAt: string | null
1506
2248
  }[]
2249
+ /** @description The cursor for the next page. Pass it as `cursor` to get more results. `null` when there are no more pages. */
1507
2250
  nextCursor: string | null
1508
2251
  }
1509
2252
  }
@@ -1515,57 +2258,83 @@ export interface operations {
1515
2258
  query?: never
1516
2259
  header?: never
1517
2260
  path: {
2261
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
1518
2262
  knowledgeBaseId: string
1519
2263
  }
1520
2264
  cookie?: never
1521
2265
  }
1522
- /** @description CreateImportInput */
2266
+ /** @description Content to add to a knowledge base. The `type` field sets the kind of import. */
1523
2267
  requestBody: {
1524
2268
  content: {
1525
2269
  'application/json':
1526
2270
  | {
1527
- /** @enum {string} */
2271
+ /**
2272
+ * @description The import type. `text` imports inline content.
2273
+ * @enum {string}
2274
+ */
1528
2275
  type: 'text'
2276
+ /** @description The import's title, shown in the list of imports. */
1529
2277
  title: string
2278
+ /** @description The text or markdown to import, up to 1,000,000 bytes of UTF-8. */
1530
2279
  content: string
1531
2280
  /**
2281
+ * @description The format of `content`: `text/markdown` (the default) or `text/plain`.
1532
2282
  * @default text/markdown
1533
2283
  * @enum {string}
1534
2284
  */
1535
2285
  contentType?: 'text/markdown' | 'text/plain'
1536
2286
  }
1537
2287
  | {
1538
- /** Format: uri */
2288
+ /**
2289
+ * Format: uri
2290
+ * @description The URL to start crawling from. It must be a public `http` or `https` URL.
2291
+ */
1539
2292
  url: string
1540
- /** @description CrawlOptions */
2293
+ /** @description Options for the crawl. Options you omit use the defaults. */
1541
2294
  options?: {
2295
+ /** @description Regular expressions for URL paths to crawl. When set, the crawl only includes pages whose path matches one of them. */
1542
2296
  includePaths?: string[]
2297
+ /** @description Regular expressions for URL paths to skip. Pages whose path matches one of them aren't crawled. */
1543
2298
  excludePaths?: string[]
2299
+ /** @description How many levels deep the crawl goes from the root URL. */
1544
2300
  maxDepth?: number
2301
+ /** @description Whether to crawl only the pages listed in the site's sitemap. */
1545
2302
  sitemapOnly?: boolean
2303
+ /** @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. */
1546
2304
  ignoreQueryParameters?: boolean
2305
+ /** @description The maximum number of pages to crawl. The crawl can stop sooner when the knowledge base reaches its source limit. */
1547
2306
  pageLimit?: number
1548
2307
  }
1549
- /** @enum {string} */
2308
+ /**
2309
+ * @description The import type. `crawl` imports a website.
2310
+ * @enum {string}
2311
+ */
1550
2312
  type: 'crawl'
1551
2313
  }
1552
2314
  | {
2315
+ /** @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. */
1553
2316
  sanityProjectId: string
2317
+ /** @description The dataset to read documents from, in the project set by `sanityProjectId`. */
1554
2318
  sanityDatasetId: string
2319
+ /** @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. */
1555
2320
  query: string
1556
- /** @enum {string} */
2321
+ /**
2322
+ * @description The import type. `dataset` imports documents from a Sanity dataset.
2323
+ * @enum {string}
2324
+ */
1557
2325
  type: 'dataset'
1558
2326
  }
1559
2327
  }
1560
2328
  }
1561
2329
  responses: {
1562
- /** @description JobAccepted */
2330
+ /** @description A queued job that you can poll for progress. */
1563
2331
  202: {
1564
2332
  headers: {
1565
2333
  [name: string]: unknown
1566
2334
  }
1567
2335
  content: {
1568
2336
  'application/json': {
2337
+ /** @description The queued job's ID. Check its progress with `GET .../jobs/{jobId}`. */
1569
2338
  jobId: string
1570
2339
  }
1571
2340
  }
@@ -1577,6 +2346,7 @@ export interface operations {
1577
2346
  query?: never
1578
2347
  header?: never
1579
2348
  path: {
2349
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
1580
2350
  knowledgeBaseId: string
1581
2351
  }
1582
2352
  cookie?: never
@@ -1584,22 +2354,30 @@ export interface operations {
1584
2354
  requestBody: {
1585
2355
  content: {
1586
2356
  'application/json': {
2357
+ /** @description The file's name. */
1587
2358
  filename: string
2359
+ /** @description The file's MIME type. If you set it, the `PUT` upload must send the same `Content-Type` header. */
1588
2360
  contentType?: string
1589
2361
  }
1590
2362
  }
1591
2363
  }
1592
2364
  responses: {
1593
- /** @description Default Response */
2365
+ /** @description The new file import and the URL to upload the file to. */
1594
2366
  201: {
1595
2367
  headers: {
1596
2368
  [name: string]: unknown
1597
2369
  }
1598
2370
  content: {
1599
2371
  'application/json': {
1600
- /** Format: uuid */
2372
+ /**
2373
+ * Format: uuid
2374
+ * @description The ID of the new import. Use it to complete the upload and track the import.
2375
+ */
1601
2376
  importId: string
1602
- /** Format: uri */
2377
+ /**
2378
+ * Format: uri
2379
+ * @description A signed URL to send the file to in a single `PUT` request. It expires after one hour.
2380
+ */
1603
2381
  uploadUrl: string
1604
2382
  }
1605
2383
  }
@@ -1611,20 +2389,23 @@ export interface operations {
1611
2389
  query?: never
1612
2390
  header?: never
1613
2391
  path: {
2392
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
1614
2393
  knowledgeBaseId: string
2394
+ /** @description The import's ID. */
1615
2395
  importId: string
1616
2396
  }
1617
2397
  cookie?: never
1618
2398
  }
1619
2399
  requestBody?: never
1620
2400
  responses: {
1621
- /** @description JobAccepted */
2401
+ /** @description A queued job that you can poll for progress. */
1622
2402
  202: {
1623
2403
  headers: {
1624
2404
  [name: string]: unknown
1625
2405
  }
1626
2406
  content: {
1627
2407
  'application/json': {
2408
+ /** @description The queued job's ID. Check its progress with `GET .../jobs/{jobId}`. */
1628
2409
  jobId: string
1629
2410
  }
1630
2411
  }
@@ -1636,59 +2417,98 @@ export interface operations {
1636
2417
  query?: never
1637
2418
  header?: never
1638
2419
  path: {
2420
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
1639
2421
  knowledgeBaseId: string
2422
+ /** @description The import's ID. */
1640
2423
  importId: string
1641
2424
  }
1642
2425
  cookie?: never
1643
2426
  }
1644
2427
  requestBody?: never
1645
2428
  responses: {
1646
- /** @description Import */
2429
+ /** @description Content added to a knowledge base: a file upload, website crawl, Sanity dataset, or inline text. */
1647
2430
  200: {
1648
2431
  headers: {
1649
2432
  [name: string]: unknown
1650
2433
  }
1651
2434
  content: {
1652
2435
  'application/json': {
1653
- /** Format: uuid */
2436
+ /**
2437
+ * Format: uuid
2438
+ * @description The import's ID.
2439
+ */
1654
2440
  id: string
1655
- /** Format: uuid */
2441
+ /**
2442
+ * Format: uuid
2443
+ * @description The `id` of the knowledge base that the import belongs to.
2444
+ */
1656
2445
  knowledgeBaseId: string
2446
+ /** @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. */
1657
2447
  name: string | null
2448
+ /** @description The size of the uploaded file or inline text, in bytes. `null` for crawl and dataset imports, and until a file upload completes. */
1658
2449
  sizeBytes: number | null
1659
- /** @enum {string} */
2450
+ /**
2451
+ * @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.
2452
+ * @enum {string}
2453
+ */
1660
2454
  status: 'uploading' | 'processing' | 'complete' | 'failed'
1661
- /** @enum {string} */
2455
+ /**
2456
+ * @description The kind of sources the import produces. `file`: uploads and inline text. `web`: crawls. `dataset`: Sanity datasets.
2457
+ * @enum {string}
2458
+ */
1662
2459
  sourceKind: 'web' | 'file' | 'dataset'
1663
- /** Format: date-time */
2460
+ /**
2461
+ * Format: date-time
2462
+ * @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.
2463
+ */
1664
2464
  lastCheckedAt: string | null
2465
+ /** @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. */
1665
2466
  sourceCount: number
2467
+ /** @description The number of sources expected to be distilled, including parts split from large sources. Excludes skipped sources. */
1666
2468
  totalDistillableCount: number
2469
+ /** @description The number of sources distilled so far. Compare it with `totalDistillableCount` to show progress. */
1667
2470
  distilledCount: number
2471
+ /** @description The number of sources skipped because their file type isn't supported, such as images. */
1668
2472
  unsupportedCount: number
2473
+ /** @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`. */
1669
2474
  statusDetail: string | null
2475
+ /** @description When `status` is `failed`, a readable reason from one failed source. `null` for any other status, or when no single source failed. */
1670
2476
  error: string | null
1671
- /** @description CrawlOptions */
2477
+ /** @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. */
1672
2478
  crawlOptions: {
2479
+ /** @description Regular expressions for URL paths to crawl. When set, the crawl only includes pages whose path matches one of them. */
1673
2480
  includePaths?: string[]
2481
+ /** @description Regular expressions for URL paths to skip. Pages whose path matches one of them aren't crawled. */
1674
2482
  excludePaths?: string[]
2483
+ /** @description How many levels deep the crawl goes from the root URL. */
1675
2484
  maxDepth?: number
2485
+ /** @description Whether to crawl only the pages listed in the site's sitemap. */
1676
2486
  sitemapOnly?: boolean
2487
+ /** @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. */
1677
2488
  ignoreQueryParameters?: boolean
2489
+ /** @description The maximum number of pages to crawl. The crawl can stop sooner when the knowledge base reaches its source limit. */
1678
2490
  pageLimit?: number
1679
2491
  } | null
1680
- /** @description DatasetSourceBinding */
2492
+ /** @description The Sanity project, dataset, and full query a dataset import reads from. `null` for other import types. */
1681
2493
  datasetSource: {
2494
+ /** @description The ID of the Sanity project the documents come from. */
1682
2495
  sanityProjectId: string
2496
+ /** @description The dataset the documents come from. */
1683
2497
  sanityDatasetId: string
2498
+ /** @description The full GROQ query that selects the documents, exactly as saved. */
1684
2499
  query: string
1685
2500
  } | null
1686
- /** @description Actor */
2501
+ /** @description Who added the import. `null` if unknown. */
1687
2502
  createdBy: {
2503
+ /** @description The Sanity user ID, or `sanity-system` when Sanity Context made the change. `null` if unknown. */
1688
2504
  id: string | null
2505
+ /** @description The user's name when the action happened. `null` if unknown. For the current name, look up the user by `id`. */
1689
2506
  displayName: string | null
1690
2507
  } | null
1691
- /** Format: date-time */
2508
+ /**
2509
+ * Format: date-time
2510
+ * @description When the import was created.
2511
+ */
1692
2512
  createdAt: string
1693
2513
  /** Format: date-time */
1694
2514
  completedAt: string | null
@@ -1702,14 +2522,16 @@ export interface operations {
1702
2522
  query?: never
1703
2523
  header?: never
1704
2524
  path: {
2525
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
1705
2526
  knowledgeBaseId: string
2527
+ /** @description The import's ID. */
1706
2528
  importId: string
1707
2529
  }
1708
2530
  cookie?: never
1709
2531
  }
1710
2532
  requestBody?: never
1711
2533
  responses: {
1712
- /** @description Default Response */
2534
+ /** @description The import and its sources were deleted. */
1713
2535
  204: {
1714
2536
  headers: {
1715
2537
  [name: string]: unknown
@@ -1725,23 +2547,31 @@ export interface operations {
1725
2547
  query?: never
1726
2548
  header?: never
1727
2549
  path: {
2550
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
1728
2551
  knowledgeBaseId: string
2552
+ /** @description The import's ID. */
1729
2553
  importId: string
1730
2554
  }
1731
2555
  cookie?: never
1732
2556
  }
1733
2557
  requestBody?: never
1734
2558
  responses: {
1735
- /** @description Default Response */
2559
+ /** @description A short-lived URL that downloads the import's original content. */
1736
2560
  200: {
1737
2561
  headers: {
1738
2562
  [name: string]: unknown
1739
2563
  }
1740
2564
  content: {
1741
2565
  'application/json': {
1742
- /** Format: uri */
2566
+ /**
2567
+ * Format: uri
2568
+ * @description A signed URL that downloads the import's original content as a file.
2569
+ */
1743
2570
  url: string
1744
- /** Format: date-time */
2571
+ /**
2572
+ * Format: date-time
2573
+ * @description When `url` expires, 10 minutes after the request.
2574
+ */
1745
2575
  expiresAt: string
1746
2576
  }
1747
2577
  }
@@ -1753,58 +2583,89 @@ export interface operations {
1753
2583
  query?: never
1754
2584
  header?: never
1755
2585
  path: {
2586
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
1756
2587
  knowledgeBaseId: string
1757
2588
  }
1758
2589
  cookie?: never
1759
2590
  }
1760
- /** @description CreateInstructionInput */
2591
+ /** @description The instruction to create, and any entries to rebuild under it. */
1761
2592
  requestBody: {
1762
2593
  content: {
1763
2594
  'application/json': {
2595
+ /** @description The instruction in plain language. Builds follow it over what the sources say. */
1764
2596
  statement: string
2597
+ /** @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`. */
1765
2598
  scopeSourceIds: string[]
2599
+ /** @description Paths of entries to rebuild under the new instruction right away. The response returns the rebuild job ID in `rebuildJobId`. */
1766
2600
  rebuildPaths?: string[]
2601
+ /** @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. */
1767
2602
  verified?: boolean
1768
2603
  }
1769
2604
  }
1770
2605
  }
1771
2606
  responses: {
1772
- /** @description CreateInstructionResponse */
2607
+ /** @description The created instruction, and the rebuild it started. */
1773
2608
  201: {
1774
2609
  headers: {
1775
2610
  [name: string]: unknown
1776
2611
  }
1777
2612
  content: {
1778
2613
  'application/json': {
1779
- /** @description Instruction */
2614
+ /** @description The created instruction. */
1780
2615
  instruction: {
2616
+ /** @description The instruction's document ID. */
1781
2617
  id: string
2618
+ /** @description ID of the knowledge base the instruction belongs to. */
1782
2619
  knowledgeBaseId: string
1783
- /** @enum {string} */
2620
+ /**
2621
+ * @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.
2622
+ * @enum {string}
2623
+ */
1784
2624
  origin: 'conflict' | 'human'
1785
- /** @enum {string} */
2625
+ /**
2626
+ * @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.
2627
+ * @enum {string}
2628
+ */
1786
2629
  status: 'active' | 'archived'
2630
+ /** @description The instruction in plain language. Builds follow it over what the sources say. */
1787
2631
  statement: string
2632
+ /** @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. */
1788
2633
  scopeSourceIds: string[]
1789
- /** Format: date-time */
2634
+ /**
2635
+ * Format: date-time
2636
+ * @description When a refresh archived the instruction. `null` while it is active.
2637
+ */
1790
2638
  archivedAt: string | null
2639
+ /** @description Why the instruction was archived. `null` while it is active. */
1791
2640
  archivedReason: string | null
2641
+ /** @description ID of the conflict issue this instruction records. `null` when `origin` is `human`. */
1792
2642
  sourceIssueId: string | null
1793
- /** @description Actor */
2643
+ /** @description Who created the instruction. `null` for instructions created by resolving a conflict, and when the creator is unknown. */
1794
2644
  createdBy: {
2645
+ /** @description The Sanity user ID, or `sanity-system` when Sanity Context made the change. `null` if unknown. */
1795
2646
  id: string | null
2647
+ /** @description The user's name when the action happened. `null` if unknown. For the current name, look up the user by `id`. */
1796
2648
  displayName: string | null
1797
2649
  } | null
1798
- /** @description Actor */
2650
+ /** @description Who last updated the instruction through the API. `null` when it was never updated, or when the person is unknown. */
1799
2651
  updatedBy: {
2652
+ /** @description The Sanity user ID, or `sanity-system` when Sanity Context made the change. `null` if unknown. */
1800
2653
  id: string | null
2654
+ /** @description The user's name when the action happened. `null` if unknown. For the current name, look up the user by `id`. */
1801
2655
  displayName: string | null
1802
2656
  } | null
1803
- /** Format: date-time */
2657
+ /**
2658
+ * Format: date-time
2659
+ * @description When the instruction was created.
2660
+ */
1804
2661
  createdAt: string
1805
- /** Format: date-time */
2662
+ /**
2663
+ * Format: date-time
2664
+ * @description When the instruction last changed, including changes a refresh makes. `null` when the time is unknown.
2665
+ */
1806
2666
  updatedAt: string | null
1807
2667
  }
2668
+ /** @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. */
1808
2669
  rebuildJobId: string | null
1809
2670
  }
1810
2671
  }
@@ -1816,14 +2677,16 @@ export interface operations {
1816
2677
  query?: never
1817
2678
  header?: never
1818
2679
  path: {
2680
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
1819
2681
  knowledgeBaseId: string
2682
+ /** @description The instruction's ID. */
1820
2683
  instructionId: string
1821
2684
  }
1822
2685
  cookie?: never
1823
2686
  }
1824
2687
  requestBody?: never
1825
2688
  responses: {
1826
- /** @description Default Response */
2689
+ /** @description The instruction was deleted. */
1827
2690
  204: {
1828
2691
  headers: {
1829
2692
  [name: string]: unknown
@@ -1839,53 +2702,82 @@ export interface operations {
1839
2702
  query?: never
1840
2703
  header?: never
1841
2704
  path: {
2705
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
1842
2706
  knowledgeBaseId: string
2707
+ /** @description The instruction's ID. */
1843
2708
  instructionId: string
1844
2709
  }
1845
2710
  cookie?: never
1846
2711
  }
1847
- /** @description UpdateInstructionInput */
2712
+ /** @description The changes to make to an instruction. Set `statement`, `scopeSourceIds`, or both. Any update also reactivates an archived instruction. */
1848
2713
  requestBody: {
1849
2714
  content: {
1850
2715
  'application/json': {
2716
+ /** @description The new instruction text. Omit it to keep the current text. */
1851
2717
  statement?: string
2718
+ /** @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`. */
1852
2719
  scopeSourceIds?: string[]
1853
2720
  }
1854
2721
  }
1855
2722
  }
1856
2723
  responses: {
1857
- /** @description Instruction */
2724
+ /** @description A standing instruction that shapes how entries that cite its sources are written. */
1858
2725
  200: {
1859
2726
  headers: {
1860
2727
  [name: string]: unknown
1861
2728
  }
1862
2729
  content: {
1863
2730
  'application/json': {
2731
+ /** @description The instruction's document ID. */
1864
2732
  id: string
2733
+ /** @description ID of the knowledge base the instruction belongs to. */
1865
2734
  knowledgeBaseId: string
1866
- /** @enum {string} */
2735
+ /**
2736
+ * @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.
2737
+ * @enum {string}
2738
+ */
1867
2739
  origin: 'conflict' | 'human'
1868
- /** @enum {string} */
2740
+ /**
2741
+ * @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.
2742
+ * @enum {string}
2743
+ */
1869
2744
  status: 'active' | 'archived'
2745
+ /** @description The instruction in plain language. Builds follow it over what the sources say. */
1870
2746
  statement: string
2747
+ /** @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. */
1871
2748
  scopeSourceIds: string[]
1872
- /** Format: date-time */
2749
+ /**
2750
+ * Format: date-time
2751
+ * @description When a refresh archived the instruction. `null` while it is active.
2752
+ */
1873
2753
  archivedAt: string | null
2754
+ /** @description Why the instruction was archived. `null` while it is active. */
1874
2755
  archivedReason: string | null
2756
+ /** @description ID of the conflict issue this instruction records. `null` when `origin` is `human`. */
1875
2757
  sourceIssueId: string | null
1876
- /** @description Actor */
2758
+ /** @description Who created the instruction. `null` for instructions created by resolving a conflict, and when the creator is unknown. */
1877
2759
  createdBy: {
2760
+ /** @description The Sanity user ID, or `sanity-system` when Sanity Context made the change. `null` if unknown. */
1878
2761
  id: string | null
2762
+ /** @description The user's name when the action happened. `null` if unknown. For the current name, look up the user by `id`. */
1879
2763
  displayName: string | null
1880
2764
  } | null
1881
- /** @description Actor */
2765
+ /** @description Who last updated the instruction through the API. `null` when it was never updated, or when the person is unknown. */
1882
2766
  updatedBy: {
2767
+ /** @description The Sanity user ID, or `sanity-system` when Sanity Context made the change. `null` if unknown. */
1883
2768
  id: string | null
2769
+ /** @description The user's name when the action happened. `null` if unknown. For the current name, look up the user by `id`. */
1884
2770
  displayName: string | null
1885
2771
  } | null
1886
- /** Format: date-time */
2772
+ /**
2773
+ * Format: date-time
2774
+ * @description When the instruction was created.
2775
+ */
1887
2776
  createdAt: string
1888
- /** Format: date-time */
2777
+ /**
2778
+ * Format: date-time
2779
+ * @description When the instruction last changed, including changes a refresh makes. `null` when the time is unknown.
2780
+ */
1889
2781
  updatedAt: string | null
1890
2782
  }
1891
2783
  }
@@ -1897,6 +2789,7 @@ export interface operations {
1897
2789
  query?: never
1898
2790
  header?: never
1899
2791
  path: {
2792
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
1900
2793
  knowledgeBaseId: string
1901
2794
  }
1902
2795
  cookie?: never
@@ -1904,18 +2797,20 @@ export interface operations {
1904
2797
  requestBody: {
1905
2798
  content: {
1906
2799
  'application/json': {
2800
+ /** @description The IDs of the issues to accept and apply. */
1907
2801
  issueIds: string[]
1908
2802
  }
1909
2803
  }
1910
2804
  }
1911
2805
  responses: {
1912
- /** @description JobAccepted */
2806
+ /** @description A queued job that you can poll for progress. */
1913
2807
  202: {
1914
2808
  headers: {
1915
2809
  [name: string]: unknown
1916
2810
  }
1917
2811
  content: {
1918
2812
  'application/json': {
2813
+ /** @description The queued job's ID. Check its progress with `GET .../jobs/{jobId}`. */
1919
2814
  jobId: string
1920
2815
  }
1921
2816
  }
@@ -1927,56 +2822,91 @@ export interface operations {
1927
2822
  query?: never
1928
2823
  header?: never
1929
2824
  path: {
2825
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
1930
2826
  knowledgeBaseId: string
2827
+ /** @description The issue's document ID. */
1931
2828
  issueId: string
1932
2829
  }
1933
2830
  cookie?: never
1934
2831
  }
1935
2832
  requestBody?: never
1936
2833
  responses: {
1937
- /** @description Issue */
2834
+ /** @description An issue found in a knowledge base, and its triage status. */
1938
2835
  200: {
1939
2836
  headers: {
1940
2837
  [name: string]: unknown
1941
2838
  }
1942
2839
  content: {
1943
2840
  'application/json': {
2841
+ /** @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. */
1944
2842
  id: string
2843
+ /** @description ID of the knowledge base the issue belongs to. */
1945
2844
  knowledgeBaseId: string
1946
- /** @description IssueContent */
2845
+ /** @description What the issue found. The shape depends on `kind`. */
1947
2846
  content:
1948
2847
  | {
1949
- /** @enum {string} */
2848
+ /**
2849
+ * @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.
2850
+ * @enum {string}
2851
+ */
1950
2852
  severity: 'critical' | 'suggestion'
2853
+ /** @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. */
1951
2854
  scopePath: string
2855
+ /** @description What the problem is, in one or two sentences. */
1952
2856
  issue: string
2857
+ /** @description What to do to fix the issue. */
1953
2858
  suggestedFix: string
1954
- /** @enum {string} */
2859
+ /**
2860
+ * @description The issue type. `conflict` means two or more positions disagree on the same fact, and you choose which one is correct.
2861
+ * @enum {string}
2862
+ */
1955
2863
  kind: 'conflict'
2864
+ /** @description A key naming the disputed fact, such as `free_tier.request_limit`. It never includes the disputed value, so every side shares it. */
1956
2865
  claimKey: string
2866
+ /** @description The conflicting positions, at least two. To resolve the conflict, pass the index of one side as `resolution`. */
1957
2867
  sides: {
2868
+ /** @description The position as a self-contained sentence. This is the option you choose from. */
1958
2869
  claim: string
2870
+ /** @description The disputed value on its own, such as `10,000/month`, without the sentence. */
1959
2871
  value?: string
2872
+ /** @description Paths of the entries that state this position. */
1960
2873
  entryPaths?: string[]
2874
+ /** @description IDs of the sources that directly back this position. */
1961
2875
  sourceIds?: string[]
1962
- /** @description ConflictSpan */
2876
+ /** @description Where in a source this position was read. */
1963
2877
  span?: {
2878
+ /** @description ID of the source the position was read from. */
1964
2879
  sourceId: string
2880
+ /** @description First line of the range, counting from 1. Line numbers match `GET .../sources/{sourceId}/content`. */
1965
2881
  lineStart: number
2882
+ /** @description Last line of the range, inclusive. */
1966
2883
  lineEnd: number
1967
2884
  }
1968
- /** @enum {string} */
2885
+ /**
2886
+ * @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.
2887
+ * @enum {string}
2888
+ */
1969
2889
  authority?: 'primary' | 'secondary' | 'community'
1970
2890
  }[]
2891
+ /** @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. */
1971
2892
  suggested?: number
1972
2893
  }
1973
2894
  | {
1974
- /** @enum {string} */
2895
+ /**
2896
+ * @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.
2897
+ * @enum {string}
2898
+ */
1975
2899
  severity: 'critical' | 'suggestion'
2900
+ /** @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. */
1976
2901
  scopePath: string
2902
+ /** @description What the problem is, in one or two sentences. */
1977
2903
  issue: string
2904
+ /** @description What to do to fix the issue. */
1978
2905
  suggestedFix: string
1979
- /** @enum {string} */
2906
+ /**
2907
+ * @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.
2908
+ * @enum {string}
2909
+ */
1980
2910
  kind:
1981
2911
  | 'gap'
1982
2912
  | 'update_required'
@@ -1984,22 +2914,39 @@ export interface operations {
1984
2914
  | 'remove_entry'
1985
2915
  | 'split_entry'
1986
2916
  | 'merge_entry'
2917
+ /** @description IDs of the sources that led to the issue. For `add_entry`, the sources the new entry would cite. */
1987
2918
  citedSourceIds?: string[]
2919
+ /** @description A key naming the specific finding, when the check that found it sets one. */
1988
2920
  claimKey?: string
2921
+ /** @description Paths of the entries the issue involves, when it spans more than one entry. */
1989
2922
  involvedScopes?: string[]
1990
2923
  }
1991
- /** @enum {string} */
2924
+ /**
2925
+ * @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`.
2926
+ * @enum {string}
2927
+ */
1992
2928
  status: 'open' | 'accepted' | 'rejected'
2929
+ /** @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. */
1993
2930
  resolution: number | null
1994
- /** @description IssueResolvedBy */
2931
+ /** @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. */
1995
2932
  resolvedBy: {
2933
+ /** @description Sanity user ID of the person or robot that triaged the issue. */
1996
2934
  id: string
1997
- /** @enum {string} */
2935
+ /**
2936
+ * @description `user` when a person made the decision. `robot` when a robot token did, such as an agent.
2937
+ * @enum {string}
2938
+ */
1998
2939
  kind: 'user' | 'robot'
1999
2940
  } | null
2000
- /** Format: date-time */
2941
+ /**
2942
+ * Format: date-time
2943
+ * @description When the issue was first filed.
2944
+ */
2001
2945
  createdAt: string
2002
- /** Format: date-time */
2946
+ /**
2947
+ * Format: date-time
2948
+ * @description When the issue left `open`. `null` while the issue is open.
2949
+ */
2003
2950
  resolvedAt: string | null
2004
2951
  }
2005
2952
  }
@@ -2011,56 +2958,91 @@ export interface operations {
2011
2958
  query?: never
2012
2959
  header?: never
2013
2960
  path: {
2961
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
2014
2962
  knowledgeBaseId: string
2963
+ /** @description The issue's document ID. */
2015
2964
  issueId: string
2016
2965
  }
2017
2966
  cookie?: never
2018
2967
  }
2019
2968
  requestBody?: never
2020
2969
  responses: {
2021
- /** @description Issue */
2970
+ /** @description An issue found in a knowledge base, and its triage status. */
2022
2971
  200: {
2023
2972
  headers: {
2024
2973
  [name: string]: unknown
2025
2974
  }
2026
2975
  content: {
2027
2976
  'application/json': {
2977
+ /** @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. */
2028
2978
  id: string
2979
+ /** @description ID of the knowledge base the issue belongs to. */
2029
2980
  knowledgeBaseId: string
2030
- /** @description IssueContent */
2981
+ /** @description What the issue found. The shape depends on `kind`. */
2031
2982
  content:
2032
2983
  | {
2033
- /** @enum {string} */
2984
+ /**
2985
+ * @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.
2986
+ * @enum {string}
2987
+ */
2034
2988
  severity: 'critical' | 'suggestion'
2989
+ /** @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. */
2035
2990
  scopePath: string
2991
+ /** @description What the problem is, in one or two sentences. */
2036
2992
  issue: string
2993
+ /** @description What to do to fix the issue. */
2037
2994
  suggestedFix: string
2038
- /** @enum {string} */
2995
+ /**
2996
+ * @description The issue type. `conflict` means two or more positions disagree on the same fact, and you choose which one is correct.
2997
+ * @enum {string}
2998
+ */
2039
2999
  kind: 'conflict'
3000
+ /** @description A key naming the disputed fact, such as `free_tier.request_limit`. It never includes the disputed value, so every side shares it. */
2040
3001
  claimKey: string
3002
+ /** @description The conflicting positions, at least two. To resolve the conflict, pass the index of one side as `resolution`. */
2041
3003
  sides: {
3004
+ /** @description The position as a self-contained sentence. This is the option you choose from. */
2042
3005
  claim: string
3006
+ /** @description The disputed value on its own, such as `10,000/month`, without the sentence. */
2043
3007
  value?: string
3008
+ /** @description Paths of the entries that state this position. */
2044
3009
  entryPaths?: string[]
3010
+ /** @description IDs of the sources that directly back this position. */
2045
3011
  sourceIds?: string[]
2046
- /** @description ConflictSpan */
3012
+ /** @description Where in a source this position was read. */
2047
3013
  span?: {
3014
+ /** @description ID of the source the position was read from. */
2048
3015
  sourceId: string
3016
+ /** @description First line of the range, counting from 1. Line numbers match `GET .../sources/{sourceId}/content`. */
2049
3017
  lineStart: number
3018
+ /** @description Last line of the range, inclusive. */
2050
3019
  lineEnd: number
2051
3020
  }
2052
- /** @enum {string} */
3021
+ /**
3022
+ * @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.
3023
+ * @enum {string}
3024
+ */
2053
3025
  authority?: 'primary' | 'secondary' | 'community'
2054
3026
  }[]
3027
+ /** @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. */
2055
3028
  suggested?: number
2056
3029
  }
2057
3030
  | {
2058
- /** @enum {string} */
3031
+ /**
3032
+ * @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.
3033
+ * @enum {string}
3034
+ */
2059
3035
  severity: 'critical' | 'suggestion'
3036
+ /** @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. */
2060
3037
  scopePath: string
3038
+ /** @description What the problem is, in one or two sentences. */
2061
3039
  issue: string
3040
+ /** @description What to do to fix the issue. */
2062
3041
  suggestedFix: string
2063
- /** @enum {string} */
3042
+ /**
3043
+ * @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.
3044
+ * @enum {string}
3045
+ */
2064
3046
  kind:
2065
3047
  | 'gap'
2066
3048
  | 'update_required'
@@ -2068,22 +3050,39 @@ export interface operations {
2068
3050
  | 'remove_entry'
2069
3051
  | 'split_entry'
2070
3052
  | 'merge_entry'
3053
+ /** @description IDs of the sources that led to the issue. For `add_entry`, the sources the new entry would cite. */
2071
3054
  citedSourceIds?: string[]
3055
+ /** @description A key naming the specific finding, when the check that found it sets one. */
2072
3056
  claimKey?: string
3057
+ /** @description Paths of the entries the issue involves, when it spans more than one entry. */
2073
3058
  involvedScopes?: string[]
2074
3059
  }
2075
- /** @enum {string} */
3060
+ /**
3061
+ * @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`.
3062
+ * @enum {string}
3063
+ */
2076
3064
  status: 'open' | 'accepted' | 'rejected'
3065
+ /** @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. */
2077
3066
  resolution: number | null
2078
- /** @description IssueResolvedBy */
3067
+ /** @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. */
2079
3068
  resolvedBy: {
3069
+ /** @description Sanity user ID of the person or robot that triaged the issue. */
2080
3070
  id: string
2081
- /** @enum {string} */
3071
+ /**
3072
+ * @description `user` when a person made the decision. `robot` when a robot token did, such as an agent.
3073
+ * @enum {string}
3074
+ */
2082
3075
  kind: 'user' | 'robot'
2083
3076
  } | null
2084
- /** Format: date-time */
3077
+ /**
3078
+ * Format: date-time
3079
+ * @description When the issue was first filed.
3080
+ */
2085
3081
  createdAt: string
2086
- /** Format: date-time */
3082
+ /**
3083
+ * Format: date-time
3084
+ * @description When the issue left `open`. `null` while the issue is open.
3085
+ */
2087
3086
  resolvedAt: string | null
2088
3087
  }
2089
3088
  }
@@ -2095,7 +3094,9 @@ export interface operations {
2095
3094
  query?: never
2096
3095
  header?: never
2097
3096
  path: {
3097
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
2098
3098
  knowledgeBaseId: string
3099
+ /** @description The issue's document ID. */
2099
3100
  issueId: string
2100
3101
  }
2101
3102
  cookie?: never
@@ -2103,56 +3104,90 @@ export interface operations {
2103
3104
  requestBody: {
2104
3105
  content: {
2105
3106
  'application/json': {
3107
+ /** @description The index of the chosen side in the issue's `content.sides`. */
2106
3108
  resolution: number
2107
3109
  }
2108
3110
  }
2109
3111
  }
2110
3112
  responses: {
2111
- /** @description ResolveIssueResponse */
3113
+ /** @description The resolved issue, plus the job that rewrites the entry when the decision changes it. */
2112
3114
  200: {
2113
3115
  headers: {
2114
3116
  [name: string]: unknown
2115
3117
  }
2116
3118
  content: {
2117
3119
  'application/json': {
2118
- /** @description Issue */
3120
+ /** @description The resolved conflict issue, now `accepted`. */
2119
3121
  issue: {
3122
+ /** @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. */
2120
3123
  id: string
3124
+ /** @description ID of the knowledge base the issue belongs to. */
2121
3125
  knowledgeBaseId: string
2122
- /** @description IssueContent */
3126
+ /** @description What the issue found. The shape depends on `kind`. */
2123
3127
  content:
2124
3128
  | {
2125
- /** @enum {string} */
3129
+ /**
3130
+ * @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.
3131
+ * @enum {string}
3132
+ */
2126
3133
  severity: 'critical' | 'suggestion'
3134
+ /** @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. */
2127
3135
  scopePath: string
3136
+ /** @description What the problem is, in one or two sentences. */
2128
3137
  issue: string
3138
+ /** @description What to do to fix the issue. */
2129
3139
  suggestedFix: string
2130
- /** @enum {string} */
3140
+ /**
3141
+ * @description The issue type. `conflict` means two or more positions disagree on the same fact, and you choose which one is correct.
3142
+ * @enum {string}
3143
+ */
2131
3144
  kind: 'conflict'
3145
+ /** @description A key naming the disputed fact, such as `free_tier.request_limit`. It never includes the disputed value, so every side shares it. */
2132
3146
  claimKey: string
3147
+ /** @description The conflicting positions, at least two. To resolve the conflict, pass the index of one side as `resolution`. */
2133
3148
  sides: {
3149
+ /** @description The position as a self-contained sentence. This is the option you choose from. */
2134
3150
  claim: string
3151
+ /** @description The disputed value on its own, such as `10,000/month`, without the sentence. */
2135
3152
  value?: string
3153
+ /** @description Paths of the entries that state this position. */
2136
3154
  entryPaths?: string[]
3155
+ /** @description IDs of the sources that directly back this position. */
2137
3156
  sourceIds?: string[]
2138
- /** @description ConflictSpan */
3157
+ /** @description Where in a source this position was read. */
2139
3158
  span?: {
3159
+ /** @description ID of the source the position was read from. */
2140
3160
  sourceId: string
3161
+ /** @description First line of the range, counting from 1. Line numbers match `GET .../sources/{sourceId}/content`. */
2141
3162
  lineStart: number
3163
+ /** @description Last line of the range, inclusive. */
2142
3164
  lineEnd: number
2143
3165
  }
2144
- /** @enum {string} */
3166
+ /**
3167
+ * @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.
3168
+ * @enum {string}
3169
+ */
2145
3170
  authority?: 'primary' | 'secondary' | 'community'
2146
3171
  }[]
3172
+ /** @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. */
2147
3173
  suggested?: number
2148
3174
  }
2149
3175
  | {
2150
- /** @enum {string} */
3176
+ /**
3177
+ * @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.
3178
+ * @enum {string}
3179
+ */
2151
3180
  severity: 'critical' | 'suggestion'
3181
+ /** @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. */
2152
3182
  scopePath: string
3183
+ /** @description What the problem is, in one or two sentences. */
2153
3184
  issue: string
3185
+ /** @description What to do to fix the issue. */
2154
3186
  suggestedFix: string
2155
- /** @enum {string} */
3187
+ /**
3188
+ * @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.
3189
+ * @enum {string}
3190
+ */
2156
3191
  kind:
2157
3192
  | 'gap'
2158
3193
  | 'update_required'
@@ -2160,24 +3195,42 @@ export interface operations {
2160
3195
  | 'remove_entry'
2161
3196
  | 'split_entry'
2162
3197
  | 'merge_entry'
3198
+ /** @description IDs of the sources that led to the issue. For `add_entry`, the sources the new entry would cite. */
2163
3199
  citedSourceIds?: string[]
3200
+ /** @description A key naming the specific finding, when the check that found it sets one. */
2164
3201
  claimKey?: string
3202
+ /** @description Paths of the entries the issue involves, when it spans more than one entry. */
2165
3203
  involvedScopes?: string[]
2166
3204
  }
2167
- /** @enum {string} */
3205
+ /**
3206
+ * @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`.
3207
+ * @enum {string}
3208
+ */
2168
3209
  status: 'open' | 'accepted' | 'rejected'
3210
+ /** @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. */
2169
3211
  resolution: number | null
2170
- /** @description IssueResolvedBy */
3212
+ /** @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. */
2171
3213
  resolvedBy: {
3214
+ /** @description Sanity user ID of the person or robot that triaged the issue. */
2172
3215
  id: string
2173
- /** @enum {string} */
3216
+ /**
3217
+ * @description `user` when a person made the decision. `robot` when a robot token did, such as an agent.
3218
+ * @enum {string}
3219
+ */
2174
3220
  kind: 'user' | 'robot'
2175
3221
  } | null
2176
- /** Format: date-time */
3222
+ /**
3223
+ * Format: date-time
3224
+ * @description When the issue was first filed.
3225
+ */
2177
3226
  createdAt: string
2178
- /** Format: date-time */
3227
+ /**
3228
+ * Format: date-time
3229
+ * @description When the issue left `open`. `null` while the issue is open.
3230
+ */
2179
3231
  resolvedAt: string | null
2180
3232
  }
3233
+ /** @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. */
2181
3234
  jobId: string | null
2182
3235
  }
2183
3236
  }
@@ -2189,28 +3242,42 @@ export interface operations {
2189
3242
  query?: never
2190
3243
  header?: never
2191
3244
  path: {
3245
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
2192
3246
  knowledgeBaseId: string
3247
+ /** @description The job ID returned by the endpoint that started the work. */
2193
3248
  jobId: string
2194
3249
  }
2195
3250
  cookie?: never
2196
3251
  }
2197
3252
  requestBody?: never
2198
3253
  responses: {
2199
- /** @description Job */
3254
+ /** @description A background job, such as a build, refresh, or import, and its status. */
2200
3255
  200: {
2201
3256
  headers: {
2202
3257
  [name: string]: unknown
2203
3258
  }
2204
3259
  content: {
2205
3260
  'application/json': {
3261
+ /** @description The job's ID. */
2206
3262
  id: string
2207
- /** @enum {string} */
3263
+ /**
3264
+ * @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.
3265
+ * @enum {string}
3266
+ */
2208
3267
  status: 'pending' | 'queued' | 'running' | 'succeeded' | 'failed' | 'cancelled'
2209
- /** Format: date-time */
3268
+ /**
3269
+ * Format: date-time
3270
+ * @description When the job started.
3271
+ */
2210
3272
  startedAt: string | null
2211
- /** Format: date-time */
3273
+ /**
3274
+ * Format: date-time
3275
+ * @description When the job finished. `null` while the job is queued or running.
3276
+ */
2212
3277
  completedAt: string | null
3278
+ /** @description The job's output. Only present when `status` is `succeeded`. Its shape depends on the kind of job. */
2213
3279
  result?: unknown
3280
+ /** @description A readable reason the job failed or was cancelled. `null` for any other status. */
2214
3281
  error?: string | null
2215
3282
  }
2216
3283
  }
@@ -2222,20 +3289,23 @@ export interface operations {
2222
3289
  query?: never
2223
3290
  header?: never
2224
3291
  path: {
3292
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
2225
3293
  knowledgeBaseId: string
2226
3294
  }
2227
3295
  cookie?: never
2228
3296
  }
2229
3297
  requestBody?: never
2230
3298
  responses: {
2231
- /** @description RefreshAccepted */
3299
+ /** @description A queued refresh job that you can poll for progress. */
2232
3300
  202: {
2233
3301
  headers: {
2234
3302
  [name: string]: unknown
2235
3303
  }
2236
3304
  content: {
2237
3305
  'application/json': {
3306
+ /** @description The queued job's ID. Check its progress with `GET .../jobs/{jobId}`. */
2238
3307
  jobId: string
3308
+ /** @description Whether this request started a new refresh. `false` means a refresh was already running, and `jobId` is that refresh. */
2239
3309
  started: boolean
2240
3310
  }
2241
3311
  }
@@ -2245,49 +3315,84 @@ export interface operations {
2245
3315
  listSources: {
2246
3316
  parameters: {
2247
3317
  query?: {
3318
+ /** @description The `nextCursor` value from the previous page. Omit it to get the first page. */
2248
3319
  cursor?: string
3320
+ /** @description The maximum number of items to return. */
2249
3321
  limit?: number
3322
+ /** @description Return only sources with this status. */
2250
3323
  status?: 'pending' | 'processing' | 'ready' | 'failed' | 'skipped'
3324
+ /** @description Return only the sources that this import produced. */
2251
3325
  importId?: string
3326
+ /** @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. */
2252
3327
  ids?: string
2253
3328
  }
2254
3329
  header?: never
2255
3330
  path: {
3331
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
2256
3332
  knowledgeBaseId: string
2257
3333
  }
2258
3334
  cookie?: never
2259
3335
  }
2260
3336
  requestBody?: never
2261
3337
  responses: {
2262
- /** @description Default Response */
3338
+ /** @description A page of sources. */
2263
3339
  200: {
2264
3340
  headers: {
2265
3341
  [name: string]: unknown
2266
3342
  }
2267
3343
  content: {
2268
3344
  'application/json': {
3345
+ /** @description The items on this page. */
2269
3346
  data: {
2270
- /** Format: uuid */
3347
+ /**
3348
+ * Format: uuid
3349
+ * @description The source's ID.
3350
+ */
2271
3351
  id: string
2272
- /** Format: uuid */
3352
+ /**
3353
+ * Format: uuid
3354
+ * @description The `id` of the knowledge base that the source belongs to.
3355
+ */
2273
3356
  knowledgeBaseId: string
3357
+ /** @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. */
2274
3358
  filename: string
2275
- /** @enum {string} */
3359
+ /**
3360
+ * @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.
3361
+ * @enum {string}
3362
+ */
2276
3363
  kind: 'web' | 'file' | 'dataset'
3364
+ /** @description The source's size in bytes. */
2277
3365
  sizeBytes: number
2278
- /** @enum {string} */
3366
+ /**
3367
+ * @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.
3368
+ * @enum {string}
3369
+ */
2279
3370
  status: 'pending' | 'processing' | 'ready' | 'failed' | 'skipped'
3371
+ /** @description A short summary of the source. `null` until the source is summarized. */
2280
3372
  tldr: string | null
3373
+ /** @description Topics the source covers. `null` until the source is summarized. */
2281
3374
  topics: string[] | null
3375
+ /** @description The page URL of a `web` source. `null` for other kinds. */
2282
3376
  canonicalUrl: string | null
3377
+ /** @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. */
2283
3378
  externalId: string | null
2284
- /** Format: date-time */
3379
+ /**
3380
+ * Format: date-time
3381
+ * @description When the source's content was last fetched.
3382
+ */
2285
3383
  fetchedAt: string | null
2286
- /** Format: date-time */
3384
+ /**
3385
+ * Format: date-time
3386
+ * @description When the source's content was last distilled into markdown. `null` until it's distilled.
3387
+ */
2287
3388
  distilledAt: string | null
2288
- /** Format: date-time */
3389
+ /**
3390
+ * Format: date-time
3391
+ * @description When the source was added.
3392
+ */
2289
3393
  createdAt: string
2290
3394
  }[]
3395
+ /** @description The cursor for the next page. Pass it as `cursor` to get more results. `null` when there are no more pages. */
2291
3396
  nextCursor: string | null
2292
3397
  }
2293
3398
  }
@@ -2299,39 +3404,68 @@ export interface operations {
2299
3404
  query?: never
2300
3405
  header?: never
2301
3406
  path: {
3407
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
2302
3408
  knowledgeBaseId: string
3409
+ /** @description The source's ID. */
2303
3410
  sourceId: string
2304
3411
  }
2305
3412
  cookie?: never
2306
3413
  }
2307
3414
  requestBody?: never
2308
3415
  responses: {
2309
- /** @description Source */
3416
+ /** @description A page, file, or document that an import produced and that builds cite. */
2310
3417
  200: {
2311
3418
  headers: {
2312
3419
  [name: string]: unknown
2313
3420
  }
2314
3421
  content: {
2315
3422
  'application/json': {
2316
- /** Format: uuid */
3423
+ /**
3424
+ * Format: uuid
3425
+ * @description The source's ID.
3426
+ */
2317
3427
  id: string
2318
- /** Format: uuid */
3428
+ /**
3429
+ * Format: uuid
3430
+ * @description The `id` of the knowledge base that the source belongs to.
3431
+ */
2319
3432
  knowledgeBaseId: string
3433
+ /** @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. */
2320
3434
  filename: string
2321
- /** @enum {string} */
3435
+ /**
3436
+ * @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.
3437
+ * @enum {string}
3438
+ */
2322
3439
  kind: 'web' | 'file' | 'dataset'
3440
+ /** @description The source's size in bytes. */
2323
3441
  sizeBytes: number
2324
- /** @enum {string} */
3442
+ /**
3443
+ * @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.
3444
+ * @enum {string}
3445
+ */
2325
3446
  status: 'pending' | 'processing' | 'ready' | 'failed' | 'skipped'
3447
+ /** @description A short summary of the source. `null` until the source is summarized. */
2326
3448
  tldr: string | null
3449
+ /** @description Topics the source covers. `null` until the source is summarized. */
2327
3450
  topics: string[] | null
3451
+ /** @description The page URL of a `web` source. `null` for other kinds. */
2328
3452
  canonicalUrl: string | null
3453
+ /** @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. */
2329
3454
  externalId: string | null
2330
- /** Format: date-time */
3455
+ /**
3456
+ * Format: date-time
3457
+ * @description When the source's content was last fetched.
3458
+ */
2331
3459
  fetchedAt: string | null
2332
- /** Format: date-time */
3460
+ /**
3461
+ * Format: date-time
3462
+ * @description When the source's content was last distilled into markdown. `null` until it's distilled.
3463
+ */
2333
3464
  distilledAt: string | null
2334
- /** Format: date-time */
3465
+ /**
3466
+ * Format: date-time
3467
+ * @description When the source was added.
3468
+ */
2335
3469
  createdAt: string
2336
3470
  }
2337
3471
  }
@@ -2343,14 +3477,16 @@ export interface operations {
2343
3477
  query?: never
2344
3478
  header?: never
2345
3479
  path: {
3480
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
2346
3481
  knowledgeBaseId: string
3482
+ /** @description The source's ID. */
2347
3483
  sourceId: string
2348
3484
  }
2349
3485
  cookie?: never
2350
3486
  }
2351
3487
  requestBody?: never
2352
3488
  responses: {
2353
- /** @description Default Response */
3489
+ /** @description The source was deleted. */
2354
3490
  204: {
2355
3491
  headers: {
2356
3492
  [name: string]: unknown
@@ -2364,33 +3500,45 @@ export interface operations {
2364
3500
  getSourceContent: {
2365
3501
  parameters: {
2366
3502
  query?: {
2367
- /** @description Output representation. `json` (default) returns the structured resource; `markdown` / `plain` return the rendered, LLM-ready text. */
3503
+ /** @description Response format. `json` (default) returns the structured resource. `markdown` and `plain` return the content as rendered text, ready to pass to a model. */
2368
3504
  format?: 'json' | 'markdown' | 'plain'
3505
+ /** @description The first line to return, starting at 1. Omit `startLine` and `endLine` to get the whole content. */
2369
3506
  startLine?: number
3507
+ /** @description The last line to return, inclusive. A value past the end returns everything up to the last line. */
2370
3508
  endLine?: number
2371
3509
  }
2372
3510
  header?: never
2373
3511
  path: {
3512
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
2374
3513
  knowledgeBaseId: string
3514
+ /** @description The source's ID. */
2375
3515
  sourceId: string
2376
3516
  }
2377
3517
  cookie?: never
2378
3518
  }
2379
3519
  requestBody?: never
2380
3520
  responses: {
2381
- /** @description SourceContent */
3521
+ /** @description A source's distilled markdown, or a range of its lines. */
2382
3522
  200: {
2383
3523
  headers: {
2384
3524
  [name: string]: unknown
2385
3525
  }
2386
3526
  content: {
2387
3527
  'application/json': {
2388
- /** Format: uuid */
3528
+ /**
3529
+ * Format: uuid
3530
+ * @description The source's ID.
3531
+ */
2389
3532
  sourceId: string
3533
+ /** @description The distilled markdown, or the requested lines of it. */
2390
3534
  content: string
3535
+ /** @description The number of lines in the full distilled content. */
2391
3536
  totalLines: number
3537
+ /** @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. */
2392
3538
  slice: {
3539
+ /** @description The first line returned. */
2393
3540
  start: number
3541
+ /** @description The last line returned. */
2394
3542
  end: number
2395
3543
  }
2396
3544
  }
@@ -2405,115 +3553,184 @@ export interface operations {
2405
3553
  query?: never
2406
3554
  header?: never
2407
3555
  path: {
3556
+ /** @description Your ID for the conversation thread, unique within your organization. Up to 200 characters. */
2408
3557
  threadId: string
2409
3558
  }
2410
3559
  cookie?: never
2411
3560
  }
2412
- /** @description SaveConversationInput */
3561
+ /** @description A conversation transcript to save for one thread. */
2413
3562
  requestBody: {
2414
3563
  content: {
2415
3564
  'application/json': {
3565
+ /** @description The full transcript so far, in order. It replaces the stored messages. */
2416
3566
  messages: {
2417
- /** @enum {string} */
3567
+ /**
3568
+ * @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.
3569
+ * @enum {string}
3570
+ */
2418
3571
  role: 'user' | 'assistant' | 'system' | 'tool'
2419
- /** @default null */
3572
+ /**
3573
+ * @description The message text. `null` when the message has no text, such as a tool call.
3574
+ * @default null
3575
+ */
2420
3576
  content?: string | null
2421
- /** @default null */
3577
+ /**
3578
+ * @description The name of the tool for a `tool` message. `null` on other messages.
3579
+ * @default null
3580
+ */
2422
3581
  toolName?: string | null
2423
3582
  /**
3583
+ * @description The kind of `tool` message. `call` is the agent calling the tool, and `result` is what the tool returned. `null` on other messages.
2424
3584
  * @default null
2425
3585
  * @enum {string|null}
2426
3586
  */
2427
3587
  toolType?: 'call' | 'result' | null
2428
- /** @default null */
3588
+ /**
3589
+ * @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.
3590
+ * @default null
3591
+ */
2429
3592
  error?: string | null
2430
3593
  }[]
3594
+ /** @description The provider of the model the agent used. When absent, the stored value stays unchanged. */
2431
3595
  modelProvider?: string
3596
+ /** @description The ID of the model the agent used. When absent, the stored value stays unchanged. */
2432
3597
  modelId?: string
2433
- /** @description ConversationTokenUsage */
3598
+ /** @description Token usage for one generation call. The API adds it to the conversation total, but only when this save changes the messages. */
2434
3599
  tokenUsage?: {
3600
+ /** @description The number of input tokens. */
2435
3601
  inputTokens?: number
3602
+ /** @description The number of output tokens. */
2436
3603
  outputTokens?: number
3604
+ /** @description The total number of tokens. */
2437
3605
  totalTokens?: number
2438
3606
  }
2439
- /** @description ConversationMetadata */
3607
+ /** @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. */
2440
3608
  metadata?: {
2441
3609
  [key: string]: string | string[]
2442
3610
  }
2443
- /** @description ConversationSharing */
3611
+ /** @description Your choice to share conversation telemetry with Sanity. Replaces the stored setting. When absent, the stored value stays unchanged. */
2444
3612
  sharing?: {
3613
+ /** @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. */
2445
3614
  metrics?: boolean
3615
+ /** @description Whether to share full conversation transcripts with Sanity. When `true`, the API also sets `metrics` to `true`. */
2446
3616
  conversations?: boolean
3617
+ /** @description How the Sanity team can reach you about your agent, such as an email address or a Discord handle. */
2447
3618
  contact?: string
2448
3619
  }
2449
3620
  }
2450
3621
  }
2451
3622
  }
2452
3623
  responses: {
2453
- /** @description Conversation */
3624
+ /** @description A recorded agent conversation: its transcript, metadata, token usage, and classification. */
2454
3625
  200: {
2455
3626
  headers: {
2456
3627
  [name: string]: unknown
2457
3628
  }
2458
3629
  content: {
2459
3630
  'application/json': {
3631
+ /** @description The conversation ID, unique within the organization. It matches the `_id` of the conversation document in your document store. */
2460
3632
  id: string
3633
+ /** @description Your identifier for the conversation thread, unique within the organization. Saving with the same `threadId` updates the same conversation. */
2461
3634
  threadId: string
2462
- /** @description ConversationMetadata */
3635
+ /** @description Tags that describe the conversation, such as `mcpEndpoints`, `app`, and `environment`. Filter on them in GROQ queries. `null` until a save includes `metadata`. */
2463
3636
  metadata: {
2464
3637
  [key: string]: string | string[]
2465
3638
  } | null
2466
- /** Format: date-time */
3639
+ /**
3640
+ * Format: date-time
3641
+ * @description When the API received the first save for this thread, as an ISO 8601 timestamp.
3642
+ */
2467
3643
  startedAt: string
2468
- /** Format: date-time */
3644
+ /**
3645
+ * Format: date-time
3646
+ * @description When the conversation was last saved, as an ISO 8601 timestamp.
3647
+ */
2469
3648
  messagesUpdatedAt: string
3649
+ /** @description The conversation transcript, in order. Each save replaces it. */
2470
3650
  messages: {
2471
- /** @enum {string} */
3651
+ /**
3652
+ * @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.
3653
+ * @enum {string}
3654
+ */
2472
3655
  role: 'user' | 'assistant' | 'system' | 'tool'
2473
- /** @default null */
3656
+ /**
3657
+ * @description The message text. `null` when the message has no text, such as a tool call.
3658
+ * @default null
3659
+ */
2474
3660
  content: string | null
2475
- /** @default null */
3661
+ /**
3662
+ * @description The name of the tool for a `tool` message. `null` on other messages.
3663
+ * @default null
3664
+ */
2476
3665
  toolName: string | null
2477
3666
  /**
3667
+ * @description The kind of `tool` message. `call` is the agent calling the tool, and `result` is what the tool returned. `null` on other messages.
2478
3668
  * @default null
2479
3669
  * @enum {string|null}
2480
3670
  */
2481
3671
  toolType: 'call' | 'result' | null
2482
- /** @default null */
3672
+ /**
3673
+ * @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.
3674
+ * @default null
3675
+ */
2483
3676
  error: string | null
2484
3677
  /**
2485
3678
  * Format: date-time
3679
+ * @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.
2486
3680
  * @default null
2487
3681
  */
2488
3682
  timestamp: string | null
2489
3683
  }[]
3684
+ /** @description The provider of the model the agent used. `null` until a save includes `modelProvider`. */
2490
3685
  modelProvider: string | null
3686
+ /** @description The ID of the model the agent used. `null` until a save includes `modelId`. */
2491
3687
  modelId: string | null
2492
- /** @description ConversationTokenUsage */
3688
+ /** @description The running total of token usage for the conversation. `null` until a save includes `tokenUsage`. */
2493
3689
  tokenUsage: {
3690
+ /** @description The number of input tokens. */
2494
3691
  inputTokens?: number
3692
+ /** @description The number of output tokens. */
2495
3693
  outputTokens?: number
3694
+ /** @description The total number of tokens. */
2496
3695
  totalTokens?: number
2497
3696
  } | null
2498
- /** @description ConversationCoreMetrics */
3697
+ /** @description The latest classification result. `null` until you record one. */
2499
3698
  coreMetrics: {
3699
+ /** @description How well the agent resolved the user's needs, from 1 to 10. */
2500
3700
  successScore?: number
2501
- /** @enum {string} */
3701
+ /**
3702
+ * @description The overall sentiment of the conversation.
3703
+ * @enum {string}
3704
+ */
2502
3705
  sentiment?: 'positive' | 'neutral' | 'negative'
3706
+ /** @description Topics the agent couldn't answer because it lacked content. */
2503
3707
  contentGaps?: string[]
2504
3708
  } | null
2505
- /** Format: date-time */
3709
+ /**
3710
+ * Format: date-time
3711
+ * @description When the latest classification result was recorded, as an ISO 8601 timestamp. The API sets it. `null` until you record a result.
3712
+ */
2506
3713
  classifiedAt: string | null
3714
+ /** @description Why your classifier couldn't classify the conversation. `null` when no failure is recorded. Recording a result clears it. */
2507
3715
  classificationError: string | null
2508
- /** @description ConversationSharing */
3716
+ /** @description Your choice to share conversation telemetry with Sanity. `null` until a save includes `sharing`. */
2509
3717
  sharing: {
3718
+ /** @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. */
2510
3719
  metrics?: boolean
3720
+ /** @description Whether to share full conversation transcripts with Sanity. When `true`, the API also sets `metrics` to `true`. */
2511
3721
  conversations?: boolean
3722
+ /** @description How the Sanity team can reach you about your agent, such as an email address or a Discord handle. */
2512
3723
  contact?: string
2513
3724
  } | null
2514
- /** Format: date-time */
3725
+ /**
3726
+ * Format: date-time
3727
+ * @description When the conversation was created, as an ISO 8601 timestamp.
3728
+ */
2515
3729
  createdAt: string
2516
- /** Format: date-time */
3730
+ /**
3731
+ * Format: date-time
3732
+ * @description When the conversation was last changed, as an ISO 8601 timestamp.
3733
+ */
2517
3734
  updatedAt: string
2518
3735
  }
2519
3736
  }
@@ -2525,89 +3742,143 @@ export interface operations {
2525
3742
  query?: never
2526
3743
  header?: never
2527
3744
  path: {
3745
+ /** @description Your ID for the conversation thread, unique within your organization. Up to 200 characters. */
2528
3746
  threadId: string
2529
3747
  }
2530
3748
  cookie?: never
2531
3749
  }
2532
- /** @description ClassifyConversationInput */
3750
+ /** @description A classification result or failure for one conversation. Send exactly one of `coreMetrics` or `classificationError`. */
2533
3751
  requestBody: {
2534
3752
  content: {
2535
3753
  'application/json': {
3754
+ /** @description The classification result. The API sets `classifiedAt` and clears any recorded `classificationError`. */
2536
3755
  coreMetrics?: {
3756
+ /** @description How well the agent resolved the user's needs, as an integer from 1 to 10. */
2537
3757
  successScore: number
2538
- /** @enum {string} */
3758
+ /**
3759
+ * @description The overall sentiment of the conversation.
3760
+ * @enum {string}
3761
+ */
2539
3762
  sentiment: 'positive' | 'neutral' | 'negative'
3763
+ /** @description Topics the agent couldn't answer because it lacked content. */
2540
3764
  contentGaps: string[]
2541
3765
  }
3766
+ /** @description Why your classifier couldn't classify the conversation. Any earlier classification result stays unchanged. */
2542
3767
  classificationError?: string
2543
3768
  }
2544
3769
  }
2545
3770
  }
2546
3771
  responses: {
2547
- /** @description Conversation */
3772
+ /** @description A recorded agent conversation: its transcript, metadata, token usage, and classification. */
2548
3773
  200: {
2549
3774
  headers: {
2550
3775
  [name: string]: unknown
2551
3776
  }
2552
3777
  content: {
2553
3778
  'application/json': {
3779
+ /** @description The conversation ID, unique within the organization. It matches the `_id` of the conversation document in your document store. */
2554
3780
  id: string
3781
+ /** @description Your identifier for the conversation thread, unique within the organization. Saving with the same `threadId` updates the same conversation. */
2555
3782
  threadId: string
2556
- /** @description ConversationMetadata */
3783
+ /** @description Tags that describe the conversation, such as `mcpEndpoints`, `app`, and `environment`. Filter on them in GROQ queries. `null` until a save includes `metadata`. */
2557
3784
  metadata: {
2558
3785
  [key: string]: string | string[]
2559
3786
  } | null
2560
- /** Format: date-time */
3787
+ /**
3788
+ * Format: date-time
3789
+ * @description When the API received the first save for this thread, as an ISO 8601 timestamp.
3790
+ */
2561
3791
  startedAt: string
2562
- /** Format: date-time */
3792
+ /**
3793
+ * Format: date-time
3794
+ * @description When the conversation was last saved, as an ISO 8601 timestamp.
3795
+ */
2563
3796
  messagesUpdatedAt: string
3797
+ /** @description The conversation transcript, in order. Each save replaces it. */
2564
3798
  messages: {
2565
- /** @enum {string} */
3799
+ /**
3800
+ * @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.
3801
+ * @enum {string}
3802
+ */
2566
3803
  role: 'user' | 'assistant' | 'system' | 'tool'
2567
- /** @default null */
3804
+ /**
3805
+ * @description The message text. `null` when the message has no text, such as a tool call.
3806
+ * @default null
3807
+ */
2568
3808
  content: string | null
2569
- /** @default null */
3809
+ /**
3810
+ * @description The name of the tool for a `tool` message. `null` on other messages.
3811
+ * @default null
3812
+ */
2570
3813
  toolName: string | null
2571
3814
  /**
3815
+ * @description The kind of `tool` message. `call` is the agent calling the tool, and `result` is what the tool returned. `null` on other messages.
2572
3816
  * @default null
2573
3817
  * @enum {string|null}
2574
3818
  */
2575
3819
  toolType: 'call' | 'result' | null
2576
- /** @default null */
3820
+ /**
3821
+ * @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.
3822
+ * @default null
3823
+ */
2577
3824
  error: string | null
2578
3825
  /**
2579
3826
  * Format: date-time
3827
+ * @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.
2580
3828
  * @default null
2581
3829
  */
2582
3830
  timestamp: string | null
2583
3831
  }[]
3832
+ /** @description The provider of the model the agent used. `null` until a save includes `modelProvider`. */
2584
3833
  modelProvider: string | null
3834
+ /** @description The ID of the model the agent used. `null` until a save includes `modelId`. */
2585
3835
  modelId: string | null
2586
- /** @description ConversationTokenUsage */
3836
+ /** @description The running total of token usage for the conversation. `null` until a save includes `tokenUsage`. */
2587
3837
  tokenUsage: {
3838
+ /** @description The number of input tokens. */
2588
3839
  inputTokens?: number
3840
+ /** @description The number of output tokens. */
2589
3841
  outputTokens?: number
3842
+ /** @description The total number of tokens. */
2590
3843
  totalTokens?: number
2591
3844
  } | null
2592
- /** @description ConversationCoreMetrics */
3845
+ /** @description The latest classification result. `null` until you record one. */
2593
3846
  coreMetrics: {
3847
+ /** @description How well the agent resolved the user's needs, from 1 to 10. */
2594
3848
  successScore?: number
2595
- /** @enum {string} */
3849
+ /**
3850
+ * @description The overall sentiment of the conversation.
3851
+ * @enum {string}
3852
+ */
2596
3853
  sentiment?: 'positive' | 'neutral' | 'negative'
3854
+ /** @description Topics the agent couldn't answer because it lacked content. */
2597
3855
  contentGaps?: string[]
2598
3856
  } | null
2599
- /** Format: date-time */
3857
+ /**
3858
+ * Format: date-time
3859
+ * @description When the latest classification result was recorded, as an ISO 8601 timestamp. The API sets it. `null` until you record a result.
3860
+ */
2600
3861
  classifiedAt: string | null
3862
+ /** @description Why your classifier couldn't classify the conversation. `null` when no failure is recorded. Recording a result clears it. */
2601
3863
  classificationError: string | null
2602
- /** @description ConversationSharing */
3864
+ /** @description Your choice to share conversation telemetry with Sanity. `null` until a save includes `sharing`. */
2603
3865
  sharing: {
3866
+ /** @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. */
2604
3867
  metrics?: boolean
3868
+ /** @description Whether to share full conversation transcripts with Sanity. When `true`, the API also sets `metrics` to `true`. */
2605
3869
  conversations?: boolean
3870
+ /** @description How the Sanity team can reach you about your agent, such as an email address or a Discord handle. */
2606
3871
  contact?: string
2607
3872
  } | null
2608
- /** Format: date-time */
3873
+ /**
3874
+ * Format: date-time
3875
+ * @description When the conversation was created, as an ISO 8601 timestamp.
3876
+ */
2609
3877
  createdAt: string
2610
- /** Format: date-time */
3878
+ /**
3879
+ * Format: date-time
3880
+ * @description When the conversation was last changed, as an ISO 8601 timestamp.
3881
+ */
2611
3882
  updatedAt: string
2612
3883
  }
2613
3884
  }