@sanity/client 8.7.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, and revisions. Content documents in the bound dataset are deleted best-effort, and stored source files are reclaimed by a separate cleanup.
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. PUT the file bytes to it, then call `POST .../imports/uploads/{importId}/complete` to start ingestion. The bytes never pass through this API. Supports the `Idempotency-Key` header.
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 that every future build honors. Tie it to one or more sources with `scopeSourceIds`, or leave it null to apply knowledge-base-wide. Pass `rebuildPaths` to immediately rebuild those entries under the new rule; the response carries the rebuild job id, or null when the rebuild could not start (the rule is saved either way). Pass `verified` after a completed synchronous contradiction check to skip the background one; if the requested rebuild fails to start, the background check runs anyway so the contradicting pages get filed as issues.
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 with one of two choices: `keep_existing` or `accept_new` (rewrites the entry; the returned `jobId` tracks it). Only conflict issues are resolvable, and a dismissed issue must be reopened first. The decision becomes a standing instruction for every future build; `resolvedBy` records who decided.
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 or an import. 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. 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,84 +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
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
+ */
578
+ error: string | null
579
+ /**
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.
582
+ * @default null
583
+ */
584
+ timestamp: string | null
517
585
  }[]
586
+ /** @description The provider of the model the agent used. `null` until a save includes `modelProvider`. */
518
587
  modelProvider: string | null
588
+ /** @description The ID of the model the agent used. `null` until a save includes `modelId`. */
519
589
  modelId: string | null
520
- /** @description ConversationTokenUsage */
590
+ /** @description The running total of token usage for the conversation. `null` until a save includes `tokenUsage`. */
521
591
  tokenUsage: {
592
+ /** @description The number of input tokens. */
522
593
  inputTokens?: number
594
+ /** @description The number of output tokens. */
523
595
  outputTokens?: number
596
+ /** @description The total number of tokens. */
524
597
  totalTokens?: number
525
598
  } | null
526
- /** @description ConversationCoreMetrics */
599
+ /** @description The latest classification result. `null` until you record one. */
527
600
  coreMetrics: {
601
+ /** @description How well the agent resolved the user's needs, from 1 to 10. */
528
602
  successScore?: number
529
- /** @enum {string} */
603
+ /**
604
+ * @description The overall sentiment of the conversation.
605
+ * @enum {string}
606
+ */
530
607
  sentiment?: 'positive' | 'neutral' | 'negative'
608
+ /** @description Topics the agent couldn't answer because it lacked content. */
531
609
  contentGaps?: string[]
532
610
  } | null
533
- /** 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
+ */
534
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. */
535
617
  classificationError: string | null
536
618
  /**
537
- * @description ConversationSharing
619
+ * @description Your choice to share conversation telemetry with Sanity. `null` until a save includes `sharing`.
538
620
  * @default null
539
621
  */
540
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. */
541
624
  metrics?: boolean
625
+ /** @description Whether to share full conversation transcripts with Sanity. When `true`, the API also sets `metrics` to `true`. */
542
626
  conversations?: boolean
627
+ /** @description How the Sanity team can reach you about your agent, such as an email address or a Discord handle. */
543
628
  contact?: string
544
629
  } | null
545
630
  }
546
- /** @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. */
547
632
  EntryDoc: {
633
+ /** @description The document ID. */
548
634
  _id: string
635
+ /** @description The document revision. It changes on every write. */
549
636
  _rev: string
550
- /** Format: date-time */
637
+ /**
638
+ * Format: date-time
639
+ * @description When the document was created, as an ISO 8601 timestamp.
640
+ */
551
641
  _createdAt: string
552
- /** Format: date-time */
642
+ /**
643
+ * Format: date-time
644
+ * @description When the document was last changed, as an ISO 8601 timestamp.
645
+ */
553
646
  _updatedAt: string
647
+ /** @description The ID (`kb…`) of the knowledge base this document belongs to. */
554
648
  knowledgeBaseId: string
555
- /** @enum {string} */
649
+ /**
650
+ * @description The document type. Always `sanity.context.entry`.
651
+ * @enum {string}
652
+ */
556
653
  _type: 'sanity.context.entry'
654
+ /** @description The version of the document shape. Currently `1`. */
557
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. */
558
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. */
559
659
  path: string
660
+ /** @description The entry title. */
560
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`. */
561
663
  tldr?: {
562
664
  scope: string
563
665
  excludes: string
@@ -565,283 +667,635 @@ export interface components {
565
667
  /** @enum {string} */
566
668
  centrality: 'core' | 'standard' | 'peripheral'
567
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. */
568
671
  body?: string
672
+ /** @description The H2 and H3 heading titles in `body`. Absent when the entry has no `body`. */
569
673
  topicHeadings?: string[]
674
+ /** @description The sources that back this entry, one item per source. */
570
675
  citations?: {
676
+ /** @description ID of the cited source. */
571
677
  sourceId: string
678
+ /** @description Which facts in the entry body this source backs, in a short phrase. */
572
679
  supports?: string
680
+ /** @description Line ranges in the source's distilled content that back those facts, with the quoted text. */
573
681
  spans?: {
682
+ /** @description First line of the range, counting from 1. Line numbers match `GET .../sources/{sourceId}/content`. */
574
683
  sourceLineStart: number
684
+ /** @description Last line of the range, inclusive. */
575
685
  sourceLineEnd: number
686
+ /** @description The exact text of the line range in the source. */
576
687
  quote: string
577
688
  }[]
689
+ /** @description The text in the entry body that this citation backs. */
578
690
  claim?: {
691
+ /** @description The exact entry text the citation backs. */
579
692
  exact: string
693
+ /** @description Text immediately before `exact`, to tell apart repeated phrases. */
580
694
  prefix?: string
695
+ /** @description Text immediately after `exact`, to tell apart repeated phrases. */
581
696
  suffix?: string
582
697
  }
583
698
  /** @enum {string} */
584
699
  groundingState?: 'drifted'
700
+ /** @description A unique key for this item in the `citations` array. */
585
701
  _key: string
586
- /** @enum {string} */
702
+ /**
703
+ * @description The citation type. Always `sanity.context.citation`.
704
+ * @enum {string}
705
+ */
587
706
  _type: 'sanity.context.citation'
707
+ /** @description A display name for the cited source. Builds currently set it to the `sourceId`. */
588
708
  filename: string
589
709
  mime?: string
590
710
  excerpt?: string
591
711
  }[]
592
- /** @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
+ */
593
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. */
594
718
  generatedAt: string
595
719
  }
596
- /** @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. */
597
721
  InstructionDoc:
598
722
  | {
723
+ /** @description The document ID. */
599
724
  _id: string
725
+ /** @description The document revision. It changes on every write. */
600
726
  _rev: string
601
- /** Format: date-time */
727
+ /**
728
+ * Format: date-time
729
+ * @description When the document was created, as an ISO 8601 timestamp.
730
+ */
602
731
  _createdAt: string
603
- /** Format: date-time */
732
+ /**
733
+ * Format: date-time
734
+ * @description When the document was last changed, as an ISO 8601 timestamp.
735
+ */
604
736
  _updatedAt: string
737
+ /** @description The ID (`kb…`) of the knowledge base this document belongs to. */
605
738
  knowledgeBaseId: string
606
- /** @enum {string} */
739
+ /**
740
+ * @description The document type. Always `sanity.context.instruction`.
741
+ * @enum {string}
742
+ */
607
743
  _type: 'sanity.context.instruction'
608
- /** @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
+ */
609
748
  schemaVersion: 1
749
+ /** @description The instruction, in plain language. Builds follow it over the raw sources. */
610
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. */
611
752
  scopeSources:
612
753
  | {
754
+ /** @description A unique key for this item in the array. It matches `sourceId`. */
613
755
  _key: string
756
+ /** @description The ID of the source the instruction is tied to. */
614
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. */
615
759
  contentHash: string
616
760
  }[]
617
761
  | null
618
- /** @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
+ */
619
766
  status: 'active' | 'archived'
767
+ /** @description When the instruction was archived, as an ISO 8601 timestamp. `null` while `active`. */
620
768
  archivedAt: string | null
769
+ /** @description Why the instruction was archived. `null` while `active`. */
621
770
  archivedReason: string | null
622
- /** @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
+ */
623
775
  origin: 'conflict'
776
+ /** @description The `_id` of the conflict issue this instruction resolved. Reopening that issue deletes this instruction. */
624
777
  sourceIssueId: string
625
778
  }
626
779
  | {
780
+ /** @description The document ID. */
627
781
  _id: string
782
+ /** @description The document revision. It changes on every write. */
628
783
  _rev: string
629
- /** Format: date-time */
784
+ /**
785
+ * Format: date-time
786
+ * @description When the document was created, as an ISO 8601 timestamp.
787
+ */
630
788
  _createdAt: string
631
- /** Format: date-time */
789
+ /**
790
+ * Format: date-time
791
+ * @description When the document was last changed, as an ISO 8601 timestamp.
792
+ */
632
793
  _updatedAt: string
794
+ /** @description The ID (`kb…`) of the knowledge base this document belongs to. */
633
795
  knowledgeBaseId: string
634
- /** @enum {string} */
796
+ /**
797
+ * @description The document type. Always `sanity.context.instruction`.
798
+ * @enum {string}
799
+ */
635
800
  _type: 'sanity.context.instruction'
636
- /** @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
+ */
637
805
  schemaVersion: 1
806
+ /** @description The instruction, in plain language. Builds follow it over the raw sources. */
638
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. */
639
809
  scopeSources:
640
810
  | {
811
+ /** @description A unique key for this item in the array. It matches `sourceId`. */
641
812
  _key: string
813
+ /** @description The ID of the source the instruction is tied to. */
642
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. */
643
816
  contentHash: string
644
817
  }[]
645
818
  | null
646
- /** @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
+ */
647
823
  status: 'active' | 'archived'
824
+ /** @description When the instruction was archived, as an ISO 8601 timestamp. `null` while `active`. */
648
825
  archivedAt: string | null
826
+ /** @description Why the instruction was archived. `null` while `active`. */
649
827
  archivedReason: string | null
650
- /** @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
+ */
651
832
  origin: 'human'
652
- /** @enum {string|null} */
833
+ /**
834
+ * @description Always `null` for a `human` instruction.
835
+ * @enum {string|null}
836
+ */
653
837
  sourceIssueId: null
654
838
  }
655
- /** @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`. */
656
840
  IssueDoc:
657
841
  | {
842
+ /** @description The document ID. */
658
843
  _id: string
844
+ /** @description The document revision. It changes on every write. */
659
845
  _rev: string
660
- /** Format: date-time */
846
+ /**
847
+ * Format: date-time
848
+ * @description When the document was created, as an ISO 8601 timestamp.
849
+ */
661
850
  _createdAt: string
662
- /** Format: date-time */
851
+ /**
852
+ * Format: date-time
853
+ * @description When the document was last changed, as an ISO 8601 timestamp.
854
+ */
663
855
  _updatedAt: string
856
+ /** @description The ID (`kb…`) of the knowledge base this document belongs to. */
664
857
  knowledgeBaseId: string
665
- /** @enum {string} */
858
+ /**
859
+ * @description The document type. Always `sanity.context.issue`.
860
+ * @enum {string}
861
+ */
666
862
  _type: 'sanity.context.issue'
667
- /** @enum {number} */
863
+ /**
864
+ * @description The version of the document shape. Currently `1`.
865
+ * @enum {number}
866
+ */
668
867
  schemaVersion: 1
669
- /** @description IssueContent */
670
- content: {
671
- /** @enum {string} */
672
- kind:
673
- | 'conflict'
674
- | 'gap'
675
- | 'update_required'
676
- | 'add_entry'
677
- | 'remove_entry'
678
- | 'split_entry'
679
- | 'merge_entry'
680
- /** @enum {string} */
681
- severity: 'critical' | 'suggestion'
682
- scopePath: string
683
- issue: string
684
- suggestedFix: string
685
- citedSourceIds?: string[]
686
- claimKey?: string
687
- involvedScopes?: string[]
688
- currentClaim?: string
689
- alternativeClaim?: string
690
- /** @enum {string} */
691
- currentAuthority?: 'primary' | 'secondary' | 'community'
692
- /** @enum {string} */
693
- alternativeAuthority?: 'primary' | 'secondary' | 'community'
694
- /** @enum {string} */
695
- suggestedResolution?: 'keep_existing' | 'accept_new'
696
- }
868
+ /** @description What an issue found. The shape depends on `kind`. */
869
+ content:
870
+ | {
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
+ */
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. */
877
+ scopePath: string
878
+ /** @description What the problem is, in one or two sentences. */
879
+ issue: string
880
+ /** @description What to do to fix the issue. */
881
+ suggestedFix: 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
+ */
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. */
888
+ claimKey: string
889
+ /** @description The conflicting positions, at least two. To resolve the conflict, pass the index of one side as `resolution`. */
890
+ sides: {
891
+ /** @description The position as a self-contained sentence. This is the option you choose from. */
892
+ claim: string
893
+ /** @description The disputed value on its own, such as `10,000/month`, without the sentence. */
894
+ value?: string
895
+ /** @description Paths of the entries that state this position. */
896
+ entryPaths?: string[]
897
+ /** @description IDs of the sources that directly back this position. */
898
+ sourceIds?: string[]
899
+ /** @description Where in a source this position was read. */
900
+ span?: {
901
+ /** @description ID of the source the position was read from. */
902
+ sourceId: string
903
+ /** @description First line of the range, counting from 1. Line numbers match `GET .../sources/{sourceId}/content`. */
904
+ lineStart: number
905
+ /** @description Last line of the range, inclusive. */
906
+ lineEnd: number
907
+ }
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
+ */
912
+ authority?: 'primary' | 'secondary' | 'community'
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. */
915
+ suggested?: number
916
+ }
917
+ | {
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
+ */
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. */
924
+ scopePath: string
925
+ /** @description What the problem is, in one or two sentences. */
926
+ issue: string
927
+ /** @description What to do to fix the issue. */
928
+ suggestedFix: 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
+ */
933
+ kind:
934
+ | 'gap'
935
+ | 'update_required'
936
+ | 'add_entry'
937
+ | 'remove_entry'
938
+ | 'split_entry'
939
+ | 'merge_entry'
940
+ /** @description IDs of the sources that led to the issue. For `add_entry`, the sources the new entry would cite. */
941
+ citedSourceIds?: string[]
942
+ /** @description A key naming the specific finding, when the check that found it sets one. */
943
+ claimKey?: string
944
+ /** @description Paths of the entries the issue involves, when it spans more than one entry. */
945
+ involvedScopes?: string[]
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. */
697
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. */
698
950
  revisionId: string | null
699
- /** @enum {string} */
951
+ /**
952
+ * @description The issue status. `open` means it is waiting for triage.
953
+ * @enum {string}
954
+ */
700
955
  status: 'open'
701
- /** @enum {string|null} */
956
+ /**
957
+ * @description Always `null` while the issue is `open`.
958
+ * @enum {string|null}
959
+ */
702
960
  resolution: null
703
- /** @enum {string|null} */
961
+ /**
962
+ * @description Always `null` while the issue is `open`.
963
+ * @enum {string|null}
964
+ */
704
965
  resolvedAt: null
705
- /** @enum {string|null} */
966
+ /**
967
+ * @description Always `null` while the issue is `open`.
968
+ * @enum {string|null}
969
+ */
706
970
  resolvedBy: null
707
971
  }
708
972
  | {
973
+ /** @description The document ID. */
709
974
  _id: string
975
+ /** @description The document revision. It changes on every write. */
710
976
  _rev: string
711
- /** Format: date-time */
977
+ /**
978
+ * Format: date-time
979
+ * @description When the document was created, as an ISO 8601 timestamp.
980
+ */
712
981
  _createdAt: string
713
- /** Format: date-time */
982
+ /**
983
+ * Format: date-time
984
+ * @description When the document was last changed, as an ISO 8601 timestamp.
985
+ */
714
986
  _updatedAt: string
987
+ /** @description The ID (`kb…`) of the knowledge base this document belongs to. */
715
988
  knowledgeBaseId: string
716
- /** @enum {string} */
989
+ /**
990
+ * @description The document type. Always `sanity.context.issue`.
991
+ * @enum {string}
992
+ */
717
993
  _type: 'sanity.context.issue'
718
- /** @enum {number} */
994
+ /**
995
+ * @description The version of the document shape. Currently `1`.
996
+ * @enum {number}
997
+ */
719
998
  schemaVersion: 1
720
- /** @description IssueContent */
721
- content: {
722
- /** @enum {string} */
723
- kind:
724
- | 'conflict'
725
- | 'gap'
726
- | 'update_required'
727
- | 'add_entry'
728
- | 'remove_entry'
729
- | 'split_entry'
730
- | 'merge_entry'
731
- /** @enum {string} */
732
- severity: 'critical' | 'suggestion'
733
- scopePath: string
734
- issue: string
735
- suggestedFix: string
736
- citedSourceIds?: string[]
737
- claimKey?: string
738
- involvedScopes?: string[]
739
- currentClaim?: string
740
- alternativeClaim?: string
741
- /** @enum {string} */
742
- currentAuthority?: 'primary' | 'secondary' | 'community'
743
- /** @enum {string} */
744
- alternativeAuthority?: 'primary' | 'secondary' | 'community'
745
- /** @enum {string} */
746
- suggestedResolution?: 'keep_existing' | 'accept_new'
747
- }
999
+ /** @description What an issue found. The shape depends on `kind`. */
1000
+ content:
1001
+ | {
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
+ */
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. */
1008
+ scopePath: string
1009
+ /** @description What the problem is, in one or two sentences. */
1010
+ issue: string
1011
+ /** @description What to do to fix the issue. */
1012
+ suggestedFix: 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
+ */
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. */
1019
+ claimKey: string
1020
+ /** @description The conflicting positions, at least two. To resolve the conflict, pass the index of one side as `resolution`. */
1021
+ sides: {
1022
+ /** @description The position as a self-contained sentence. This is the option you choose from. */
1023
+ claim: string
1024
+ /** @description The disputed value on its own, such as `10,000/month`, without the sentence. */
1025
+ value?: string
1026
+ /** @description Paths of the entries that state this position. */
1027
+ entryPaths?: string[]
1028
+ /** @description IDs of the sources that directly back this position. */
1029
+ sourceIds?: string[]
1030
+ /** @description Where in a source this position was read. */
1031
+ span?: {
1032
+ /** @description ID of the source the position was read from. */
1033
+ sourceId: string
1034
+ /** @description First line of the range, counting from 1. Line numbers match `GET .../sources/{sourceId}/content`. */
1035
+ lineStart: number
1036
+ /** @description Last line of the range, inclusive. */
1037
+ lineEnd: number
1038
+ }
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
+ */
1043
+ authority?: 'primary' | 'secondary' | 'community'
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. */
1046
+ suggested?: number
1047
+ }
1048
+ | {
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
+ */
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. */
1055
+ scopePath: string
1056
+ /** @description What the problem is, in one or two sentences. */
1057
+ issue: string
1058
+ /** @description What to do to fix the issue. */
1059
+ suggestedFix: 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
+ */
1064
+ kind:
1065
+ | 'gap'
1066
+ | 'update_required'
1067
+ | 'add_entry'
1068
+ | 'remove_entry'
1069
+ | 'split_entry'
1070
+ | 'merge_entry'
1071
+ /** @description IDs of the sources that led to the issue. For `add_entry`, the sources the new entry would cite. */
1072
+ citedSourceIds?: string[]
1073
+ /** @description A key naming the specific finding, when the check that found it sets one. */
1074
+ claimKey?: string
1075
+ /** @description Paths of the entries the issue involves, when it spans more than one entry. */
1076
+ involvedScopes?: string[]
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. */
748
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. */
749
1081
  revisionId: string | null
750
- /** @enum {string} */
1082
+ /**
1083
+ * @description The issue status. `accepted` means the issue was resolved or its fix applied.
1084
+ * @enum {string}
1085
+ */
751
1086
  status: 'accepted'
752
- /** Format: date-time */
1087
+ /**
1088
+ * Format: date-time
1089
+ * @description When the issue left `open`, as an ISO 8601 timestamp.
1090
+ */
753
1091
  resolvedAt: string
1092
+ /** @description Who triaged the issue. `null` while the issue is open, or when the caller could not be identified. */
754
1093
  resolvedBy: {
1094
+ /** @description The ID of the Sanity user or robot token that triaged the issue. */
755
1095
  id: string
756
- /** @enum {string} */
1096
+ /**
1097
+ * @description What triaged the issue. `user` is a person, and `robot` is a robot token.
1098
+ * @enum {string}
1099
+ */
757
1100
  kind: 'user' | 'robot'
758
1101
  } | null
759
- /** @enum {string|null} */
760
- resolution: 'keep_existing' | 'accept_new' | 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. */
1103
+ resolution: number | null
761
1104
  }
762
1105
  | {
1106
+ /** @description The document ID. */
763
1107
  _id: string
1108
+ /** @description The document revision. It changes on every write. */
764
1109
  _rev: string
765
- /** Format: date-time */
1110
+ /**
1111
+ * Format: date-time
1112
+ * @description When the document was created, as an ISO 8601 timestamp.
1113
+ */
766
1114
  _createdAt: string
767
- /** Format: date-time */
1115
+ /**
1116
+ * Format: date-time
1117
+ * @description When the document was last changed, as an ISO 8601 timestamp.
1118
+ */
768
1119
  _updatedAt: string
1120
+ /** @description The ID (`kb…`) of the knowledge base this document belongs to. */
769
1121
  knowledgeBaseId: string
770
- /** @enum {string} */
1122
+ /**
1123
+ * @description The document type. Always `sanity.context.issue`.
1124
+ * @enum {string}
1125
+ */
771
1126
  _type: 'sanity.context.issue'
772
- /** @enum {number} */
1127
+ /**
1128
+ * @description The version of the document shape. Currently `1`.
1129
+ * @enum {number}
1130
+ */
773
1131
  schemaVersion: 1
774
- /** @description IssueContent */
775
- content: {
776
- /** @enum {string} */
777
- kind:
778
- | 'conflict'
779
- | 'gap'
780
- | 'update_required'
781
- | 'add_entry'
782
- | 'remove_entry'
783
- | 'split_entry'
784
- | 'merge_entry'
785
- /** @enum {string} */
786
- severity: 'critical' | 'suggestion'
787
- scopePath: string
788
- issue: string
789
- suggestedFix: string
790
- citedSourceIds?: string[]
791
- claimKey?: string
792
- involvedScopes?: string[]
793
- currentClaim?: string
794
- alternativeClaim?: string
795
- /** @enum {string} */
796
- currentAuthority?: 'primary' | 'secondary' | 'community'
797
- /** @enum {string} */
798
- alternativeAuthority?: 'primary' | 'secondary' | 'community'
799
- /** @enum {string} */
800
- suggestedResolution?: 'keep_existing' | 'accept_new'
801
- }
1132
+ /** @description What an issue found. The shape depends on `kind`. */
1133
+ content:
1134
+ | {
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
+ */
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. */
1141
+ scopePath: string
1142
+ /** @description What the problem is, in one or two sentences. */
1143
+ issue: string
1144
+ /** @description What to do to fix the issue. */
1145
+ suggestedFix: 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
+ */
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. */
1152
+ claimKey: string
1153
+ /** @description The conflicting positions, at least two. To resolve the conflict, pass the index of one side as `resolution`. */
1154
+ sides: {
1155
+ /** @description The position as a self-contained sentence. This is the option you choose from. */
1156
+ claim: string
1157
+ /** @description The disputed value on its own, such as `10,000/month`, without the sentence. */
1158
+ value?: string
1159
+ /** @description Paths of the entries that state this position. */
1160
+ entryPaths?: string[]
1161
+ /** @description IDs of the sources that directly back this position. */
1162
+ sourceIds?: string[]
1163
+ /** @description Where in a source this position was read. */
1164
+ span?: {
1165
+ /** @description ID of the source the position was read from. */
1166
+ sourceId: string
1167
+ /** @description First line of the range, counting from 1. Line numbers match `GET .../sources/{sourceId}/content`. */
1168
+ lineStart: number
1169
+ /** @description Last line of the range, inclusive. */
1170
+ lineEnd: number
1171
+ }
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
+ */
1176
+ authority?: 'primary' | 'secondary' | 'community'
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. */
1179
+ suggested?: number
1180
+ }
1181
+ | {
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
+ */
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. */
1188
+ scopePath: string
1189
+ /** @description What the problem is, in one or two sentences. */
1190
+ issue: string
1191
+ /** @description What to do to fix the issue. */
1192
+ suggestedFix: 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
+ */
1197
+ kind:
1198
+ | 'gap'
1199
+ | 'update_required'
1200
+ | 'add_entry'
1201
+ | 'remove_entry'
1202
+ | 'split_entry'
1203
+ | 'merge_entry'
1204
+ /** @description IDs of the sources that led to the issue. For `add_entry`, the sources the new entry would cite. */
1205
+ citedSourceIds?: string[]
1206
+ /** @description A key naming the specific finding, when the check that found it sets one. */
1207
+ claimKey?: string
1208
+ /** @description Paths of the entries the issue involves, when it spans more than one entry. */
1209
+ involvedScopes?: string[]
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. */
802
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. */
803
1214
  revisionId: string | null
804
- /** @enum {string} */
1215
+ /**
1216
+ * @description The issue status. `rejected` means the issue was dismissed. Dismissal is final.
1217
+ * @enum {string}
1218
+ */
805
1219
  status: 'rejected'
806
- /** Format: date-time */
1220
+ /**
1221
+ * Format: date-time
1222
+ * @description When the issue left `open`, as an ISO 8601 timestamp.
1223
+ */
807
1224
  resolvedAt: string
1225
+ /** @description Who triaged the issue. `null` while the issue is open, or when the caller could not be identified. */
808
1226
  resolvedBy: {
1227
+ /** @description The ID of the Sanity user or robot token that triaged the issue. */
809
1228
  id: string
810
- /** @enum {string} */
1229
+ /**
1230
+ * @description What triaged the issue. `user` is a person, and `robot` is a robot token.
1231
+ * @enum {string}
1232
+ */
811
1233
  kind: 'user' | 'robot'
812
1234
  } | null
813
- /** @enum {string|null} */
1235
+ /**
1236
+ * @description Always `null`, because a dismissal chooses no side.
1237
+ * @enum {string|null}
1238
+ */
814
1239
  resolution: null
815
1240
  }
816
- /** @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. */
817
1242
  McpDoc: {
1243
+ /** @description The document ID. */
818
1244
  _id: string
1245
+ /** @description The document revision. It changes on every write. */
819
1246
  _rev: string
820
- /** Format: date-time */
1247
+ /**
1248
+ * Format: date-time
1249
+ * @description When the document was created, as an ISO 8601 timestamp.
1250
+ */
821
1251
  _createdAt: string
822
- /** Format: date-time */
1252
+ /**
1253
+ * Format: date-time
1254
+ * @description When the document was last changed, as an ISO 8601 timestamp.
1255
+ */
823
1256
  _updatedAt: string
824
- /** @enum {string} */
1257
+ /**
1258
+ * @description The document type. Always `sanity.context.mcp`.
1259
+ * @enum {string}
1260
+ */
825
1261
  _type: 'sanity.context.mcp'
826
- /** @enum {number} */
1262
+ /**
1263
+ * @description The version of the document shape. Currently `1`.
1264
+ * @enum {number}
1265
+ */
827
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. */
828
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`. */
829
1270
  publicId: string
1271
+ /** @description The MCP endpoint's display name. You can change it at any time. */
830
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. */
831
1274
  name: string
1275
+ /** @description The content sources the MCP endpoint serves. Each source appears once, and the order has no meaning. */
832
1276
  sources: (
833
1277
  | {
834
- /** @enum {string} */
1278
+ /**
1279
+ * @description The source type. `knowledge-base` serves a whole knowledge base.
1280
+ * @enum {string}
1281
+ */
835
1282
  type: 'knowledge-base'
1283
+ /** @description The knowledge base ID (`kb…`). */
836
1284
  id: string
837
1285
  }
838
1286
  | {
839
- /** @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
+ */
840
1291
  type: 'dataset'
1292
+ /** @description The dataset, as `<projectId>.<datasetName>`. */
841
1293
  id: string
842
1294
  }
843
1295
  )[]
1296
+ /** @description Prompt text the MCP endpoint serves to connecting agents. `null` when unset. */
844
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. */
845
1299
  groqFilter: string | null
846
1300
  }
847
1301
  }
@@ -856,8 +1310,11 @@ export interface operations {
856
1310
  listKnowledgeBases: {
857
1311
  parameters: {
858
1312
  query: {
1313
+ /** @description The `nextCursor` value from the previous page. Omit it to get the first page. */
859
1314
  cursor?: string
1315
+ /** @description The maximum number of items to return. */
860
1316
  limit?: number
1317
+ /** @description The organization to list knowledge bases for. */
861
1318
  organizationId: string
862
1319
  }
863
1320
  header?: never
@@ -868,28 +1325,47 @@ export interface operations {
868
1325
  }
869
1326
  requestBody?: never
870
1327
  responses: {
871
- /** @description Default Response */
1328
+ /** @description A page of knowledge bases. */
872
1329
  200: {
873
1330
  headers: {
874
1331
  [name: string]: unknown
875
1332
  }
876
1333
  content: {
877
1334
  'application/json': {
1335
+ /** @description The items on this page. */
878
1336
  data: {
879
- /** Format: uuid */
1337
+ /**
1338
+ * Format: uuid
1339
+ * @description The knowledge base's unique ID, a UUID. Accepted anywhere a `knowledgeBaseId` is expected.
1340
+ */
880
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. */
881
1343
  publicId: string
1344
+ /** @description The ID of the organization that owns the knowledge base. */
882
1345
  organizationId: string
1346
+ /** @description The knowledge base's title. */
883
1347
  title: string
1348
+ /** @description A short description of what the knowledge base covers. */
884
1349
  description: string
885
- /** @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
+ */
886
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}`. */
887
1356
  activeJobId: string | null
1357
+ /** @description Whether a build is running now. */
888
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`. */
889
1360
  buildStageState: {
1361
+ /** @description The ID of the build job this progress belongs to. */
890
1362
  jobId: string
1363
+ /** @description The build's stages and their progress. Stages that haven't reported yet can be missing. */
891
1364
  stages: {
892
- /** @enum {string} */
1365
+ /**
1366
+ * @description The stage's ID. The values are listed in the order stages run.
1367
+ * @enum {string}
1368
+ */
893
1369
  id:
894
1370
  | 'tldr'
895
1371
  | 'map'
@@ -900,56 +1376,113 @@ export interface operations {
900
1376
  | 'write'
901
1377
  | 'review'
902
1378
  | 'polish'
903
- /** @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
+ */
904
1383
  status: 'pending' | 'running' | 'done' | 'failed'
1384
+ /** @description The stage's progress counts. Absent when the stage hasn't reported counts. */
905
1385
  units?: {
906
- /** @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
+ */
907
1390
  unit: 'sources' | 'groups' | 'entries' | 'rounds'
1391
+ /** @description How many units the stage has finished. */
908
1392
  done: number
1393
+ /** @description How many units the stage will process. Absent when `unit` is `rounds`. */
909
1394
  total?: number
910
1395
  }
911
1396
  }[]
912
1397
  } | null
913
- /** 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
+ */
914
1402
  lastCheckedAt: string | null
915
- /** 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
+ */
916
1407
  lastChangedAt: string | null
1408
+ /** @description Whether sources were added, changed, or removed since the last successful build. Always `false` before the first build. */
917
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. */
918
1411
  pendingChanges: {
1412
+ /** @description Sources added since the last successful build, including sources no successful build has included yet. */
919
1413
  added: number
1414
+ /** @description Sources whose content changed since the last successful build. */
920
1415
  changed: number
1416
+ /** @description Sources that recent refreshes no longer find. */
921
1417
  removed: number
922
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. */
923
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. */
924
1422
  rebuildRecommended: {
1423
+ /** @description Why a rebuild is recommended, written to show to users. */
925
1424
  reason: string
926
- /** Format: date-time */
1425
+ /**
1426
+ * Format: date-time
1427
+ * @description When the recommendation was made.
1428
+ */
927
1429
  at: string
928
1430
  } | null
1431
+ /** @description Whether the knowledge base has at least one website source. */
929
1432
  hasWebSource: boolean
1433
+ /** @description Whether the knowledge base has at least one Sanity dataset source. */
930
1434
  hasDatasetSource: boolean
1435
+ /** @description How many sources the knowledge base uses, and its source limit. */
931
1436
  sourceUsage: {
1437
+ /** @description The number of sources counted toward the limit, including parts split from large sources. */
932
1438
  used: number
1439
+ /** @description The maximum number of sources the knowledge base can have. */
933
1440
  limit: number
934
1441
  } | null
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`. */
1443
+ buildRestriction: {
1444
+ /** @description A stable code for the restriction, such as `planLimitReached`. */
1445
+ code: string
1446
+ /** @description A readable explanation that you can show to users. */
1447
+ message: string
1448
+ } | null
1449
+ /** @description Whether scheduled refresh is on. Only applies to knowledge bases with a website or dataset source. */
935
1450
  refreshEnabled: boolean
936
- /** @enum {string} */
1451
+ /**
1452
+ * @description How often scheduled refresh runs: `weekly` (the default) or `monthly`.
1453
+ * @enum {string}
1454
+ */
937
1455
  refreshFrequency: 'weekly' | 'monthly'
938
- /** 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
+ */
939
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`. */
940
1462
  refreshInFlight: boolean
1463
+ /** @description The number of open issues waiting for review. Always `0` before the first build. */
941
1464
  openIssueCount: number
1465
+ /** @description The number of active instructions for the knowledge base. */
942
1466
  instructionCount: number
943
- /** @description Actor */
1467
+ /** @description Who created the knowledge base. `null` if unknown. */
944
1468
  createdBy: {
1469
+ /** @description The Sanity user ID, or `sanity-system` when Sanity Context made the change. `null` if unknown. */
945
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`. */
946
1472
  displayName: string | null
947
1473
  } | null
948
- /** Format: date-time */
1474
+ /**
1475
+ * Format: date-time
1476
+ * @description When the knowledge base was created.
1477
+ */
949
1478
  createdAt: string
950
- /** Format: date-time */
1479
+ /**
1480
+ * Format: date-time
1481
+ * @description When the knowledge base was last updated.
1482
+ */
951
1483
  updatedAt: string
952
1484
  }[]
1485
+ /** @description The cursor for the next page. Pass it as `cursor` to get more results. `null` when there are no more pages. */
953
1486
  nextCursor: string | null
954
1487
  }
955
1488
  }
@@ -968,34 +1501,55 @@ export interface operations {
968
1501
  requestBody: {
969
1502
  content: {
970
1503
  'application/json': {
1504
+ /** @description The ID of the organization to create the knowledge base in. */
971
1505
  organizationId: string
1506
+ /** @description The knowledge base's title. */
972
1507
  title: string
1508
+ /** @description A short description of what the knowledge base covers. */
973
1509
  description: string
974
1510
  }
975
1511
  }
976
1512
  }
977
1513
  responses: {
978
- /** @description KnowledgeBase */
1514
+ /** @description A knowledge base and its current state. */
979
1515
  201: {
980
1516
  headers: {
981
1517
  [name: string]: unknown
982
1518
  }
983
1519
  content: {
984
1520
  'application/json': {
985
- /** Format: uuid */
1521
+ /**
1522
+ * Format: uuid
1523
+ * @description The knowledge base's unique ID, a UUID. Accepted anywhere a `knowledgeBaseId` is expected.
1524
+ */
986
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. */
987
1527
  publicId: string
1528
+ /** @description The ID of the organization that owns the knowledge base. */
988
1529
  organizationId: string
1530
+ /** @description The knowledge base's title. */
989
1531
  title: string
1532
+ /** @description A short description of what the knowledge base covers. */
990
1533
  description: string
991
- /** @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
+ */
992
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}`. */
993
1540
  activeJobId: string | null
1541
+ /** @description Whether a build is running now. */
994
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`. */
995
1544
  buildStageState: {
1545
+ /** @description The ID of the build job this progress belongs to. */
996
1546
  jobId: string
1547
+ /** @description The build's stages and their progress. Stages that haven't reported yet can be missing. */
997
1548
  stages: {
998
- /** @enum {string} */
1549
+ /**
1550
+ * @description The stage's ID. The values are listed in the order stages run.
1551
+ * @enum {string}
1552
+ */
999
1553
  id:
1000
1554
  | 'tldr'
1001
1555
  | 'map'
@@ -1006,54 +1560,110 @@ export interface operations {
1006
1560
  | 'write'
1007
1561
  | 'review'
1008
1562
  | 'polish'
1009
- /** @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
+ */
1010
1567
  status: 'pending' | 'running' | 'done' | 'failed'
1568
+ /** @description The stage's progress counts. Absent when the stage hasn't reported counts. */
1011
1569
  units?: {
1012
- /** @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
+ */
1013
1574
  unit: 'sources' | 'groups' | 'entries' | 'rounds'
1575
+ /** @description How many units the stage has finished. */
1014
1576
  done: number
1577
+ /** @description How many units the stage will process. Absent when `unit` is `rounds`. */
1015
1578
  total?: number
1016
1579
  }
1017
1580
  }[]
1018
1581
  } | null
1019
- /** 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
+ */
1020
1586
  lastCheckedAt: string | null
1021
- /** 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
+ */
1022
1591
  lastChangedAt: string | null
1592
+ /** @description Whether sources were added, changed, or removed since the last successful build. Always `false` before the first build. */
1023
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. */
1024
1595
  pendingChanges: {
1596
+ /** @description Sources added since the last successful build, including sources no successful build has included yet. */
1025
1597
  added: number
1598
+ /** @description Sources whose content changed since the last successful build. */
1026
1599
  changed: number
1600
+ /** @description Sources that recent refreshes no longer find. */
1027
1601
  removed: number
1028
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. */
1029
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. */
1030
1606
  rebuildRecommended: {
1607
+ /** @description Why a rebuild is recommended, written to show to users. */
1031
1608
  reason: string
1032
- /** Format: date-time */
1609
+ /**
1610
+ * Format: date-time
1611
+ * @description When the recommendation was made.
1612
+ */
1033
1613
  at: string
1034
1614
  } | null
1615
+ /** @description Whether the knowledge base has at least one website source. */
1035
1616
  hasWebSource: boolean
1617
+ /** @description Whether the knowledge base has at least one Sanity dataset source. */
1036
1618
  hasDatasetSource: boolean
1619
+ /** @description How many sources the knowledge base uses, and its source limit. */
1037
1620
  sourceUsage: {
1621
+ /** @description The number of sources counted toward the limit, including parts split from large sources. */
1038
1622
  used: number
1623
+ /** @description The maximum number of sources the knowledge base can have. */
1039
1624
  limit: number
1040
1625
  } | null
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`. */
1627
+ buildRestriction: {
1628
+ /** @description A stable code for the restriction, such as `planLimitReached`. */
1629
+ code: string
1630
+ /** @description A readable explanation that you can show to users. */
1631
+ message: string
1632
+ } | null
1633
+ /** @description Whether scheduled refresh is on. Only applies to knowledge bases with a website or dataset source. */
1041
1634
  refreshEnabled: boolean
1042
- /** @enum {string} */
1635
+ /**
1636
+ * @description How often scheduled refresh runs: `weekly` (the default) or `monthly`.
1637
+ * @enum {string}
1638
+ */
1043
1639
  refreshFrequency: 'weekly' | 'monthly'
1044
- /** 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
+ */
1045
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`. */
1046
1646
  refreshInFlight: boolean
1647
+ /** @description The number of open issues waiting for review. Always `0` before the first build. */
1047
1648
  openIssueCount: number
1649
+ /** @description The number of active instructions for the knowledge base. */
1048
1650
  instructionCount: number
1049
- /** @description Actor */
1651
+ /** @description Who created the knowledge base. `null` if unknown. */
1050
1652
  createdBy: {
1653
+ /** @description The Sanity user ID, or `sanity-system` when Sanity Context made the change. `null` if unknown. */
1051
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`. */
1052
1656
  displayName: string | null
1053
1657
  } | null
1054
- /** Format: date-time */
1658
+ /**
1659
+ * Format: date-time
1660
+ * @description When the knowledge base was created.
1661
+ */
1055
1662
  createdAt: string
1056
- /** Format: date-time */
1663
+ /**
1664
+ * Format: date-time
1665
+ * @description When the knowledge base was last updated.
1666
+ */
1057
1667
  updatedAt: string
1058
1668
  }
1059
1669
  }
@@ -1065,33 +1675,52 @@ export interface operations {
1065
1675
  query?: never
1066
1676
  header?: never
1067
1677
  path: {
1678
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
1068
1679
  knowledgeBaseId: string
1069
1680
  }
1070
1681
  cookie?: never
1071
1682
  }
1072
1683
  requestBody?: never
1073
1684
  responses: {
1074
- /** @description KnowledgeBase */
1685
+ /** @description A knowledge base and its current state. */
1075
1686
  200: {
1076
1687
  headers: {
1077
1688
  [name: string]: unknown
1078
1689
  }
1079
1690
  content: {
1080
1691
  'application/json': {
1081
- /** Format: uuid */
1692
+ /**
1693
+ * Format: uuid
1694
+ * @description The knowledge base's unique ID, a UUID. Accepted anywhere a `knowledgeBaseId` is expected.
1695
+ */
1082
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. */
1083
1698
  publicId: string
1699
+ /** @description The ID of the organization that owns the knowledge base. */
1084
1700
  organizationId: string
1701
+ /** @description The knowledge base's title. */
1085
1702
  title: string
1703
+ /** @description A short description of what the knowledge base covers. */
1086
1704
  description: string
1087
- /** @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
+ */
1088
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}`. */
1089
1711
  activeJobId: string | null
1712
+ /** @description Whether a build is running now. */
1090
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`. */
1091
1715
  buildStageState: {
1716
+ /** @description The ID of the build job this progress belongs to. */
1092
1717
  jobId: string
1718
+ /** @description The build's stages and their progress. Stages that haven't reported yet can be missing. */
1093
1719
  stages: {
1094
- /** @enum {string} */
1720
+ /**
1721
+ * @description The stage's ID. The values are listed in the order stages run.
1722
+ * @enum {string}
1723
+ */
1095
1724
  id:
1096
1725
  | 'tldr'
1097
1726
  | 'map'
@@ -1102,54 +1731,110 @@ export interface operations {
1102
1731
  | 'write'
1103
1732
  | 'review'
1104
1733
  | 'polish'
1105
- /** @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
+ */
1106
1738
  status: 'pending' | 'running' | 'done' | 'failed'
1739
+ /** @description The stage's progress counts. Absent when the stage hasn't reported counts. */
1107
1740
  units?: {
1108
- /** @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
+ */
1109
1745
  unit: 'sources' | 'groups' | 'entries' | 'rounds'
1746
+ /** @description How many units the stage has finished. */
1110
1747
  done: number
1748
+ /** @description How many units the stage will process. Absent when `unit` is `rounds`. */
1111
1749
  total?: number
1112
1750
  }
1113
1751
  }[]
1114
1752
  } | null
1115
- /** 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
+ */
1116
1757
  lastCheckedAt: string | null
1117
- /** 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
+ */
1118
1762
  lastChangedAt: string | null
1763
+ /** @description Whether sources were added, changed, or removed since the last successful build. Always `false` before the first build. */
1119
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. */
1120
1766
  pendingChanges: {
1767
+ /** @description Sources added since the last successful build, including sources no successful build has included yet. */
1121
1768
  added: number
1769
+ /** @description Sources whose content changed since the last successful build. */
1122
1770
  changed: number
1771
+ /** @description Sources that recent refreshes no longer find. */
1123
1772
  removed: number
1124
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. */
1125
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. */
1126
1777
  rebuildRecommended: {
1778
+ /** @description Why a rebuild is recommended, written to show to users. */
1127
1779
  reason: string
1128
- /** Format: date-time */
1780
+ /**
1781
+ * Format: date-time
1782
+ * @description When the recommendation was made.
1783
+ */
1129
1784
  at: string
1130
1785
  } | null
1786
+ /** @description Whether the knowledge base has at least one website source. */
1131
1787
  hasWebSource: boolean
1788
+ /** @description Whether the knowledge base has at least one Sanity dataset source. */
1132
1789
  hasDatasetSource: boolean
1790
+ /** @description How many sources the knowledge base uses, and its source limit. */
1133
1791
  sourceUsage: {
1792
+ /** @description The number of sources counted toward the limit, including parts split from large sources. */
1134
1793
  used: number
1794
+ /** @description The maximum number of sources the knowledge base can have. */
1135
1795
  limit: number
1136
1796
  } | null
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`. */
1798
+ buildRestriction: {
1799
+ /** @description A stable code for the restriction, such as `planLimitReached`. */
1800
+ code: string
1801
+ /** @description A readable explanation that you can show to users. */
1802
+ message: string
1803
+ } | null
1804
+ /** @description Whether scheduled refresh is on. Only applies to knowledge bases with a website or dataset source. */
1137
1805
  refreshEnabled: boolean
1138
- /** @enum {string} */
1806
+ /**
1807
+ * @description How often scheduled refresh runs: `weekly` (the default) or `monthly`.
1808
+ * @enum {string}
1809
+ */
1139
1810
  refreshFrequency: 'weekly' | 'monthly'
1140
- /** 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
+ */
1141
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`. */
1142
1817
  refreshInFlight: boolean
1818
+ /** @description The number of open issues waiting for review. Always `0` before the first build. */
1143
1819
  openIssueCount: number
1820
+ /** @description The number of active instructions for the knowledge base. */
1144
1821
  instructionCount: number
1145
- /** @description Actor */
1822
+ /** @description Who created the knowledge base. `null` if unknown. */
1146
1823
  createdBy: {
1824
+ /** @description The Sanity user ID, or `sanity-system` when Sanity Context made the change. `null` if unknown. */
1147
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`. */
1148
1827
  displayName: string | null
1149
1828
  } | null
1150
- /** Format: date-time */
1829
+ /**
1830
+ * Format: date-time
1831
+ * @description When the knowledge base was created.
1832
+ */
1151
1833
  createdAt: string
1152
- /** Format: date-time */
1834
+ /**
1835
+ * Format: date-time
1836
+ * @description When the knowledge base was last updated.
1837
+ */
1153
1838
  updatedAt: string
1154
1839
  }
1155
1840
  }
@@ -1161,13 +1846,14 @@ export interface operations {
1161
1846
  query?: never
1162
1847
  header?: never
1163
1848
  path: {
1849
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
1164
1850
  knowledgeBaseId: string
1165
1851
  }
1166
1852
  cookie?: never
1167
1853
  }
1168
1854
  requestBody?: never
1169
1855
  responses: {
1170
- /** @description Default Response */
1856
+ /** @description The knowledge base was deleted. */
1171
1857
  204: {
1172
1858
  headers: {
1173
1859
  [name: string]: unknown
@@ -1183,6 +1869,7 @@ export interface operations {
1183
1869
  query?: never
1184
1870
  header?: never
1185
1871
  path: {
1872
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
1186
1873
  knowledgeBaseId: string
1187
1874
  }
1188
1875
  cookie?: never
@@ -1190,36 +1877,60 @@ export interface operations {
1190
1877
  requestBody: {
1191
1878
  content: {
1192
1879
  'application/json': {
1880
+ /** @description The knowledge base's new title. */
1193
1881
  title?: string
1882
+ /** @description The knowledge base's new description. */
1194
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. */
1195
1885
  refreshEnabled?: boolean
1196
- /** @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
+ */
1197
1890
  refreshFrequency?: 'weekly' | 'monthly'
1198
1891
  }
1199
1892
  }
1200
1893
  }
1201
1894
  responses: {
1202
- /** @description KnowledgeBase */
1895
+ /** @description A knowledge base and its current state. */
1203
1896
  200: {
1204
1897
  headers: {
1205
1898
  [name: string]: unknown
1206
1899
  }
1207
1900
  content: {
1208
1901
  'application/json': {
1209
- /** Format: uuid */
1902
+ /**
1903
+ * Format: uuid
1904
+ * @description The knowledge base's unique ID, a UUID. Accepted anywhere a `knowledgeBaseId` is expected.
1905
+ */
1210
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. */
1211
1908
  publicId: string
1909
+ /** @description The ID of the organization that owns the knowledge base. */
1212
1910
  organizationId: string
1911
+ /** @description The knowledge base's title. */
1213
1912
  title: string
1913
+ /** @description A short description of what the knowledge base covers. */
1214
1914
  description: string
1215
- /** @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
+ */
1216
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}`. */
1217
1921
  activeJobId: string | null
1922
+ /** @description Whether a build is running now. */
1218
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`. */
1219
1925
  buildStageState: {
1926
+ /** @description The ID of the build job this progress belongs to. */
1220
1927
  jobId: string
1928
+ /** @description The build's stages and their progress. Stages that haven't reported yet can be missing. */
1221
1929
  stages: {
1222
- /** @enum {string} */
1930
+ /**
1931
+ * @description The stage's ID. The values are listed in the order stages run.
1932
+ * @enum {string}
1933
+ */
1223
1934
  id:
1224
1935
  | 'tldr'
1225
1936
  | 'map'
@@ -1230,54 +1941,110 @@ export interface operations {
1230
1941
  | 'write'
1231
1942
  | 'review'
1232
1943
  | 'polish'
1233
- /** @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
+ */
1234
1948
  status: 'pending' | 'running' | 'done' | 'failed'
1949
+ /** @description The stage's progress counts. Absent when the stage hasn't reported counts. */
1235
1950
  units?: {
1236
- /** @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
+ */
1237
1955
  unit: 'sources' | 'groups' | 'entries' | 'rounds'
1956
+ /** @description How many units the stage has finished. */
1238
1957
  done: number
1958
+ /** @description How many units the stage will process. Absent when `unit` is `rounds`. */
1239
1959
  total?: number
1240
1960
  }
1241
1961
  }[]
1242
1962
  } | null
1243
- /** 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
+ */
1244
1967
  lastCheckedAt: string | null
1245
- /** 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
+ */
1246
1972
  lastChangedAt: string | null
1973
+ /** @description Whether sources were added, changed, or removed since the last successful build. Always `false` before the first build. */
1247
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. */
1248
1976
  pendingChanges: {
1977
+ /** @description Sources added since the last successful build, including sources no successful build has included yet. */
1249
1978
  added: number
1979
+ /** @description Sources whose content changed since the last successful build. */
1250
1980
  changed: number
1981
+ /** @description Sources that recent refreshes no longer find. */
1251
1982
  removed: number
1252
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. */
1253
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. */
1254
1987
  rebuildRecommended: {
1988
+ /** @description Why a rebuild is recommended, written to show to users. */
1255
1989
  reason: string
1256
- /** Format: date-time */
1990
+ /**
1991
+ * Format: date-time
1992
+ * @description When the recommendation was made.
1993
+ */
1257
1994
  at: string
1258
1995
  } | null
1996
+ /** @description Whether the knowledge base has at least one website source. */
1259
1997
  hasWebSource: boolean
1998
+ /** @description Whether the knowledge base has at least one Sanity dataset source. */
1260
1999
  hasDatasetSource: boolean
2000
+ /** @description How many sources the knowledge base uses, and its source limit. */
1261
2001
  sourceUsage: {
2002
+ /** @description The number of sources counted toward the limit, including parts split from large sources. */
1262
2003
  used: number
2004
+ /** @description The maximum number of sources the knowledge base can have. */
1263
2005
  limit: number
1264
2006
  } | null
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`. */
2008
+ buildRestriction: {
2009
+ /** @description A stable code for the restriction, such as `planLimitReached`. */
2010
+ code: string
2011
+ /** @description A readable explanation that you can show to users. */
2012
+ message: string
2013
+ } | null
2014
+ /** @description Whether scheduled refresh is on. Only applies to knowledge bases with a website or dataset source. */
1265
2015
  refreshEnabled: boolean
1266
- /** @enum {string} */
2016
+ /**
2017
+ * @description How often scheduled refresh runs: `weekly` (the default) or `monthly`.
2018
+ * @enum {string}
2019
+ */
1267
2020
  refreshFrequency: 'weekly' | 'monthly'
1268
- /** 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
+ */
1269
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`. */
1270
2027
  refreshInFlight: boolean
2028
+ /** @description The number of open issues waiting for review. Always `0` before the first build. */
1271
2029
  openIssueCount: number
2030
+ /** @description The number of active instructions for the knowledge base. */
1272
2031
  instructionCount: number
1273
- /** @description Actor */
2032
+ /** @description Who created the knowledge base. `null` if unknown. */
1274
2033
  createdBy: {
2034
+ /** @description The Sanity user ID, or `sanity-system` when Sanity Context made the change. `null` if unknown. */
1275
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`. */
1276
2037
  displayName: string | null
1277
2038
  } | null
1278
- /** Format: date-time */
2039
+ /**
2040
+ * Format: date-time
2041
+ * @description When the knowledge base was created.
2042
+ */
1279
2043
  createdAt: string
1280
- /** Format: date-time */
2044
+ /**
2045
+ * Format: date-time
2046
+ * @description When the knowledge base was last updated.
2047
+ */
1281
2048
  updatedAt: string
1282
2049
  }
1283
2050
  }
@@ -1289,19 +2056,21 @@ export interface operations {
1289
2056
  query?: never
1290
2057
  header?: never
1291
2058
  path: {
2059
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
1292
2060
  knowledgeBaseId: string
1293
2061
  }
1294
2062
  cookie?: never
1295
2063
  }
1296
2064
  requestBody?: never
1297
2065
  responses: {
1298
- /** @description JobAccepted */
2066
+ /** @description A queued job that you can poll for progress. */
1299
2067
  202: {
1300
2068
  headers: {
1301
2069
  [name: string]: unknown
1302
2070
  }
1303
2071
  content: {
1304
2072
  'application/json': {
2073
+ /** @description The queued job's ID. Check its progress with `GET .../jobs/{jobId}`. */
1305
2074
  jobId: string
1306
2075
  }
1307
2076
  }
@@ -1313,19 +2082,21 @@ export interface operations {
1313
2082
  query?: never
1314
2083
  header?: never
1315
2084
  path: {
2085
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
1316
2086
  knowledgeBaseId: string
1317
2087
  }
1318
2088
  cookie?: never
1319
2089
  }
1320
2090
  requestBody?: never
1321
2091
  responses: {
1322
- /** @description Default Response */
2092
+ /** @description The result of the cancel request. */
1323
2093
  200: {
1324
2094
  headers: {
1325
2095
  [name: string]: unknown
1326
2096
  }
1327
2097
  content: {
1328
2098
  'application/json': {
2099
+ /** @description Whether a running build was cancelled. `false` when no build was running. */
1329
2100
  cancelled: boolean
1330
2101
  }
1331
2102
  }
@@ -1337,24 +2108,31 @@ export interface operations {
1337
2108
  query?: never
1338
2109
  header?: never
1339
2110
  path: {
2111
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
1340
2112
  knowledgeBaseId: string
2113
+ /** @description The entry's slash-delimited path, such as `pricing/plans/free`, URL-encoded. */
1341
2114
  entryPath: string
1342
2115
  }
1343
2116
  cookie?: never
1344
2117
  }
1345
2118
  requestBody?: never
1346
2119
  responses: {
1347
- /** @description RebuildEntryResponse */
2120
+ /** @description The job that rebuilds the entry, and the other entries that share its sources. */
1348
2121
  202: {
1349
2122
  headers: {
1350
2123
  [name: string]: unknown
1351
2124
  }
1352
2125
  content: {
1353
2126
  'application/json': {
2127
+ /** @description ID of the job that rebuilds the entry. Poll it with `GET .../jobs/{jobId}`. */
1354
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. */
1355
2130
  affectedEntries: {
2131
+ /** @description The entry's document ID. */
1356
2132
  id: string
2133
+ /** @description The entry's path, such as `products/api/webhooks`. */
1357
2134
  path: string
2135
+ /** @description The entry's title. */
1358
2136
  title: string
1359
2137
  }[]
1360
2138
  }
@@ -1365,68 +2143,110 @@ export interface operations {
1365
2143
  listImports: {
1366
2144
  parameters: {
1367
2145
  query?: {
2146
+ /** @description The `nextCursor` value from the previous page. Omit it to get the first page. */
1368
2147
  cursor?: string
2148
+ /** @description The maximum number of items to return. */
1369
2149
  limit?: number
1370
2150
  }
1371
2151
  header?: never
1372
2152
  path: {
2153
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
1373
2154
  knowledgeBaseId: string
1374
2155
  }
1375
2156
  cookie?: never
1376
2157
  }
1377
2158
  requestBody?: never
1378
2159
  responses: {
1379
- /** @description Default Response */
2160
+ /** @description A page of imports. */
1380
2161
  200: {
1381
2162
  headers: {
1382
2163
  [name: string]: unknown
1383
2164
  }
1384
2165
  content: {
1385
2166
  'application/json': {
2167
+ /** @description The items on this page. */
1386
2168
  data: {
1387
- /** Format: uuid */
2169
+ /**
2170
+ * Format: uuid
2171
+ * @description The import's ID.
2172
+ */
1388
2173
  id: string
1389
- /** Format: uuid */
2174
+ /**
2175
+ * Format: uuid
2176
+ * @description The `id` of the knowledge base that the import belongs to.
2177
+ */
1390
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. */
1391
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. */
1392
2182
  sizeBytes: number | null
1393
- /** @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
+ */
1394
2187
  status: 'uploading' | 'processing' | 'complete' | 'failed'
1395
- /** @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
+ */
1396
2192
  sourceKind: 'web' | 'file' | 'dataset'
1397
- /** 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
+ */
1398
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. */
1399
2199
  sourceCount: number
2200
+ /** @description The number of sources expected to be distilled, including parts split from large sources. Excludes skipped sources. */
1400
2201
  totalDistillableCount: number
2202
+ /** @description The number of sources distilled so far. Compare it with `totalDistillableCount` to show progress. */
1401
2203
  distilledCount: number
2204
+ /** @description The number of sources skipped because their file type isn't supported, such as images. */
1402
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`. */
1403
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. */
1404
2209
  error: string | null
1405
- /** @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. */
1406
2211
  crawlOptions: {
2212
+ /** @description Regular expressions for URL paths to crawl. When set, the crawl only includes pages whose path matches one of them. */
1407
2213
  includePaths?: string[]
2214
+ /** @description Regular expressions for URL paths to skip. Pages whose path matches one of them aren't crawled. */
1408
2215
  excludePaths?: string[]
2216
+ /** @description How many levels deep the crawl goes from the root URL. */
1409
2217
  maxDepth?: number
2218
+ /** @description Whether to crawl only the pages listed in the site's sitemap. */
1410
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. */
1411
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. */
1412
2223
  pageLimit?: number
1413
2224
  } | null
1414
- /** @description DatasetSourceBinding */
2225
+ /** @description The Sanity project, dataset, and full query a dataset import reads from. `null` for other import types. */
1415
2226
  datasetSource: {
2227
+ /** @description The ID of the Sanity project the documents come from. */
1416
2228
  sanityProjectId: string
2229
+ /** @description The dataset the documents come from. */
1417
2230
  sanityDatasetId: string
2231
+ /** @description The full GROQ query that selects the documents, exactly as saved. */
1418
2232
  query: string
1419
2233
  } | null
1420
- /** @description Actor */
2234
+ /** @description Who added the import. `null` if unknown. */
1421
2235
  createdBy: {
2236
+ /** @description The Sanity user ID, or `sanity-system` when Sanity Context made the change. `null` if unknown. */
1422
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`. */
1423
2239
  displayName: string | null
1424
2240
  } | null
1425
- /** Format: date-time */
2241
+ /**
2242
+ * Format: date-time
2243
+ * @description When the import was created.
2244
+ */
1426
2245
  createdAt: string
1427
2246
  /** Format: date-time */
1428
2247
  completedAt: string | null
1429
2248
  }[]
2249
+ /** @description The cursor for the next page. Pass it as `cursor` to get more results. `null` when there are no more pages. */
1430
2250
  nextCursor: string | null
1431
2251
  }
1432
2252
  }
@@ -1438,57 +2258,83 @@ export interface operations {
1438
2258
  query?: never
1439
2259
  header?: never
1440
2260
  path: {
2261
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
1441
2262
  knowledgeBaseId: string
1442
2263
  }
1443
2264
  cookie?: never
1444
2265
  }
1445
- /** @description CreateImportInput */
2266
+ /** @description Content to add to a knowledge base. The `type` field sets the kind of import. */
1446
2267
  requestBody: {
1447
2268
  content: {
1448
2269
  'application/json':
1449
2270
  | {
1450
- /** @enum {string} */
2271
+ /**
2272
+ * @description The import type. `text` imports inline content.
2273
+ * @enum {string}
2274
+ */
1451
2275
  type: 'text'
2276
+ /** @description The import's title, shown in the list of imports. */
1452
2277
  title: string
2278
+ /** @description The text or markdown to import, up to 1,000,000 bytes of UTF-8. */
1453
2279
  content: string
1454
2280
  /**
2281
+ * @description The format of `content`: `text/markdown` (the default) or `text/plain`.
1455
2282
  * @default text/markdown
1456
2283
  * @enum {string}
1457
2284
  */
1458
2285
  contentType?: 'text/markdown' | 'text/plain'
1459
2286
  }
1460
2287
  | {
1461
- /** Format: uri */
2288
+ /**
2289
+ * Format: uri
2290
+ * @description The URL to start crawling from. It must be a public `http` or `https` URL.
2291
+ */
1462
2292
  url: string
1463
- /** @description CrawlOptions */
2293
+ /** @description Options for the crawl. Options you omit use the defaults. */
1464
2294
  options?: {
2295
+ /** @description Regular expressions for URL paths to crawl. When set, the crawl only includes pages whose path matches one of them. */
1465
2296
  includePaths?: string[]
2297
+ /** @description Regular expressions for URL paths to skip. Pages whose path matches one of them aren't crawled. */
1466
2298
  excludePaths?: string[]
2299
+ /** @description How many levels deep the crawl goes from the root URL. */
1467
2300
  maxDepth?: number
2301
+ /** @description Whether to crawl only the pages listed in the site's sitemap. */
1468
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. */
1469
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. */
1470
2306
  pageLimit?: number
1471
2307
  }
1472
- /** @enum {string} */
2308
+ /**
2309
+ * @description The import type. `crawl` imports a website.
2310
+ * @enum {string}
2311
+ */
1473
2312
  type: 'crawl'
1474
2313
  }
1475
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. */
1476
2316
  sanityProjectId: string
2317
+ /** @description The dataset to read documents from, in the project set by `sanityProjectId`. */
1477
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. */
1478
2320
  query: string
1479
- /** @enum {string} */
2321
+ /**
2322
+ * @description The import type. `dataset` imports documents from a Sanity dataset.
2323
+ * @enum {string}
2324
+ */
1480
2325
  type: 'dataset'
1481
2326
  }
1482
2327
  }
1483
2328
  }
1484
2329
  responses: {
1485
- /** @description JobAccepted */
2330
+ /** @description A queued job that you can poll for progress. */
1486
2331
  202: {
1487
2332
  headers: {
1488
2333
  [name: string]: unknown
1489
2334
  }
1490
2335
  content: {
1491
2336
  'application/json': {
2337
+ /** @description The queued job's ID. Check its progress with `GET .../jobs/{jobId}`. */
1492
2338
  jobId: string
1493
2339
  }
1494
2340
  }
@@ -1500,6 +2346,7 @@ export interface operations {
1500
2346
  query?: never
1501
2347
  header?: never
1502
2348
  path: {
2349
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
1503
2350
  knowledgeBaseId: string
1504
2351
  }
1505
2352
  cookie?: never
@@ -1507,22 +2354,30 @@ export interface operations {
1507
2354
  requestBody: {
1508
2355
  content: {
1509
2356
  'application/json': {
2357
+ /** @description The file's name. */
1510
2358
  filename: string
2359
+ /** @description The file's MIME type. If you set it, the `PUT` upload must send the same `Content-Type` header. */
1511
2360
  contentType?: string
1512
2361
  }
1513
2362
  }
1514
2363
  }
1515
2364
  responses: {
1516
- /** @description Default Response */
2365
+ /** @description The new file import and the URL to upload the file to. */
1517
2366
  201: {
1518
2367
  headers: {
1519
2368
  [name: string]: unknown
1520
2369
  }
1521
2370
  content: {
1522
2371
  'application/json': {
1523
- /** 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
+ */
1524
2376
  importId: string
1525
- /** 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
+ */
1526
2381
  uploadUrl: string
1527
2382
  }
1528
2383
  }
@@ -1534,20 +2389,23 @@ export interface operations {
1534
2389
  query?: never
1535
2390
  header?: never
1536
2391
  path: {
2392
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
1537
2393
  knowledgeBaseId: string
2394
+ /** @description The import's ID. */
1538
2395
  importId: string
1539
2396
  }
1540
2397
  cookie?: never
1541
2398
  }
1542
2399
  requestBody?: never
1543
2400
  responses: {
1544
- /** @description JobAccepted */
2401
+ /** @description A queued job that you can poll for progress. */
1545
2402
  202: {
1546
2403
  headers: {
1547
2404
  [name: string]: unknown
1548
2405
  }
1549
2406
  content: {
1550
2407
  'application/json': {
2408
+ /** @description The queued job's ID. Check its progress with `GET .../jobs/{jobId}`. */
1551
2409
  jobId: string
1552
2410
  }
1553
2411
  }
@@ -1559,59 +2417,98 @@ export interface operations {
1559
2417
  query?: never
1560
2418
  header?: never
1561
2419
  path: {
2420
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
1562
2421
  knowledgeBaseId: string
2422
+ /** @description The import's ID. */
1563
2423
  importId: string
1564
2424
  }
1565
2425
  cookie?: never
1566
2426
  }
1567
2427
  requestBody?: never
1568
2428
  responses: {
1569
- /** @description Import */
2429
+ /** @description Content added to a knowledge base: a file upload, website crawl, Sanity dataset, or inline text. */
1570
2430
  200: {
1571
2431
  headers: {
1572
2432
  [name: string]: unknown
1573
2433
  }
1574
2434
  content: {
1575
2435
  'application/json': {
1576
- /** Format: uuid */
2436
+ /**
2437
+ * Format: uuid
2438
+ * @description The import's ID.
2439
+ */
1577
2440
  id: string
1578
- /** Format: uuid */
2441
+ /**
2442
+ * Format: uuid
2443
+ * @description The `id` of the knowledge base that the import belongs to.
2444
+ */
1579
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. */
1580
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. */
1581
2449
  sizeBytes: number | null
1582
- /** @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
+ */
1583
2454
  status: 'uploading' | 'processing' | 'complete' | 'failed'
1584
- /** @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
+ */
1585
2459
  sourceKind: 'web' | 'file' | 'dataset'
1586
- /** 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
+ */
1587
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. */
1588
2466
  sourceCount: number
2467
+ /** @description The number of sources expected to be distilled, including parts split from large sources. Excludes skipped sources. */
1589
2468
  totalDistillableCount: number
2469
+ /** @description The number of sources distilled so far. Compare it with `totalDistillableCount` to show progress. */
1590
2470
  distilledCount: number
2471
+ /** @description The number of sources skipped because their file type isn't supported, such as images. */
1591
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`. */
1592
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. */
1593
2476
  error: string | null
1594
- /** @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. */
1595
2478
  crawlOptions: {
2479
+ /** @description Regular expressions for URL paths to crawl. When set, the crawl only includes pages whose path matches one of them. */
1596
2480
  includePaths?: string[]
2481
+ /** @description Regular expressions for URL paths to skip. Pages whose path matches one of them aren't crawled. */
1597
2482
  excludePaths?: string[]
2483
+ /** @description How many levels deep the crawl goes from the root URL. */
1598
2484
  maxDepth?: number
2485
+ /** @description Whether to crawl only the pages listed in the site's sitemap. */
1599
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. */
1600
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. */
1601
2490
  pageLimit?: number
1602
2491
  } | null
1603
- /** @description DatasetSourceBinding */
2492
+ /** @description The Sanity project, dataset, and full query a dataset import reads from. `null` for other import types. */
1604
2493
  datasetSource: {
2494
+ /** @description The ID of the Sanity project the documents come from. */
1605
2495
  sanityProjectId: string
2496
+ /** @description The dataset the documents come from. */
1606
2497
  sanityDatasetId: string
2498
+ /** @description The full GROQ query that selects the documents, exactly as saved. */
1607
2499
  query: string
1608
2500
  } | null
1609
- /** @description Actor */
2501
+ /** @description Who added the import. `null` if unknown. */
1610
2502
  createdBy: {
2503
+ /** @description The Sanity user ID, or `sanity-system` when Sanity Context made the change. `null` if unknown. */
1611
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`. */
1612
2506
  displayName: string | null
1613
2507
  } | null
1614
- /** Format: date-time */
2508
+ /**
2509
+ * Format: date-time
2510
+ * @description When the import was created.
2511
+ */
1615
2512
  createdAt: string
1616
2513
  /** Format: date-time */
1617
2514
  completedAt: string | null
@@ -1625,14 +2522,16 @@ export interface operations {
1625
2522
  query?: never
1626
2523
  header?: never
1627
2524
  path: {
2525
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
1628
2526
  knowledgeBaseId: string
2527
+ /** @description The import's ID. */
1629
2528
  importId: string
1630
2529
  }
1631
2530
  cookie?: never
1632
2531
  }
1633
2532
  requestBody?: never
1634
2533
  responses: {
1635
- /** @description Default Response */
2534
+ /** @description The import and its sources were deleted. */
1636
2535
  204: {
1637
2536
  headers: {
1638
2537
  [name: string]: unknown
@@ -1648,23 +2547,31 @@ export interface operations {
1648
2547
  query?: never
1649
2548
  header?: never
1650
2549
  path: {
2550
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
1651
2551
  knowledgeBaseId: string
2552
+ /** @description The import's ID. */
1652
2553
  importId: string
1653
2554
  }
1654
2555
  cookie?: never
1655
2556
  }
1656
2557
  requestBody?: never
1657
2558
  responses: {
1658
- /** @description Default Response */
2559
+ /** @description A short-lived URL that downloads the import's original content. */
1659
2560
  200: {
1660
2561
  headers: {
1661
2562
  [name: string]: unknown
1662
2563
  }
1663
2564
  content: {
1664
2565
  'application/json': {
1665
- /** Format: uri */
2566
+ /**
2567
+ * Format: uri
2568
+ * @description A signed URL that downloads the import's original content as a file.
2569
+ */
1666
2570
  url: string
1667
- /** Format: date-time */
2571
+ /**
2572
+ * Format: date-time
2573
+ * @description When `url` expires, 10 minutes after the request.
2574
+ */
1668
2575
  expiresAt: string
1669
2576
  }
1670
2577
  }
@@ -1676,58 +2583,89 @@ export interface operations {
1676
2583
  query?: never
1677
2584
  header?: never
1678
2585
  path: {
2586
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
1679
2587
  knowledgeBaseId: string
1680
2588
  }
1681
2589
  cookie?: never
1682
2590
  }
1683
- /** @description CreateInstructionInput */
2591
+ /** @description The instruction to create, and any entries to rebuild under it. */
1684
2592
  requestBody: {
1685
2593
  content: {
1686
2594
  'application/json': {
2595
+ /** @description The instruction in plain language. Builds follow it over what the sources say. */
1687
2596
  statement: string
1688
- scopeSourceIds?: string[] | null
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`. */
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`. */
1689
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. */
1690
2602
  verified?: boolean
1691
2603
  }
1692
2604
  }
1693
2605
  }
1694
2606
  responses: {
1695
- /** @description CreateInstructionResponse */
2607
+ /** @description The created instruction, and the rebuild it started. */
1696
2608
  201: {
1697
2609
  headers: {
1698
2610
  [name: string]: unknown
1699
2611
  }
1700
2612
  content: {
1701
2613
  'application/json': {
1702
- /** @description Instruction */
2614
+ /** @description The created instruction. */
1703
2615
  instruction: {
2616
+ /** @description The instruction's document ID. */
1704
2617
  id: string
2618
+ /** @description ID of the knowledge base the instruction belongs to. */
1705
2619
  knowledgeBaseId: string
1706
- /** @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
+ */
1707
2624
  origin: 'conflict' | 'human'
1708
- /** @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
+ */
1709
2629
  status: 'active' | 'archived'
2630
+ /** @description The instruction in plain language. Builds follow it over what the sources say. */
1710
2631
  statement: string
1711
- scopeSourceIds: string[] | null
1712
- /** Format: date-time */
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. */
2633
+ scopeSourceIds: string[]
2634
+ /**
2635
+ * Format: date-time
2636
+ * @description When a refresh archived the instruction. `null` while it is active.
2637
+ */
1713
2638
  archivedAt: string | null
2639
+ /** @description Why the instruction was archived. `null` while it is active. */
1714
2640
  archivedReason: string | null
2641
+ /** @description ID of the conflict issue this instruction records. `null` when `origin` is `human`. */
1715
2642
  sourceIssueId: string | null
1716
- /** @description Actor */
2643
+ /** @description Who created the instruction. `null` for instructions created by resolving a conflict, and when the creator is unknown. */
1717
2644
  createdBy: {
2645
+ /** @description The Sanity user ID, or `sanity-system` when Sanity Context made the change. `null` if unknown. */
1718
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`. */
1719
2648
  displayName: string | null
1720
2649
  } | null
1721
- /** @description Actor */
2650
+ /** @description Who last updated the instruction through the API. `null` when it was never updated, or when the person is unknown. */
1722
2651
  updatedBy: {
2652
+ /** @description The Sanity user ID, or `sanity-system` when Sanity Context made the change. `null` if unknown. */
1723
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`. */
1724
2655
  displayName: string | null
1725
2656
  } | null
1726
- /** Format: date-time */
2657
+ /**
2658
+ * Format: date-time
2659
+ * @description When the instruction was created.
2660
+ */
1727
2661
  createdAt: string
1728
- /** 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
+ */
1729
2666
  updatedAt: string | null
1730
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. */
1731
2669
  rebuildJobId: string | null
1732
2670
  }
1733
2671
  }
@@ -1739,14 +2677,16 @@ export interface operations {
1739
2677
  query?: never
1740
2678
  header?: never
1741
2679
  path: {
2680
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
1742
2681
  knowledgeBaseId: string
2682
+ /** @description The instruction's ID. */
1743
2683
  instructionId: string
1744
2684
  }
1745
2685
  cookie?: never
1746
2686
  }
1747
2687
  requestBody?: never
1748
2688
  responses: {
1749
- /** @description Default Response */
2689
+ /** @description The instruction was deleted. */
1750
2690
  204: {
1751
2691
  headers: {
1752
2692
  [name: string]: unknown
@@ -1762,53 +2702,82 @@ export interface operations {
1762
2702
  query?: never
1763
2703
  header?: never
1764
2704
  path: {
2705
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
1765
2706
  knowledgeBaseId: string
2707
+ /** @description The instruction's ID. */
1766
2708
  instructionId: string
1767
2709
  }
1768
2710
  cookie?: never
1769
2711
  }
1770
- /** @description UpdateInstructionInput */
2712
+ /** @description The changes to make to an instruction. Set `statement`, `scopeSourceIds`, or both. Any update also reactivates an archived instruction. */
1771
2713
  requestBody: {
1772
2714
  content: {
1773
2715
  'application/json': {
2716
+ /** @description The new instruction text. Omit it to keep the current text. */
1774
2717
  statement?: string
1775
- scopeSourceIds?: string[] | null
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`. */
2719
+ scopeSourceIds?: string[]
1776
2720
  }
1777
2721
  }
1778
2722
  }
1779
2723
  responses: {
1780
- /** @description Instruction */
2724
+ /** @description A standing instruction that shapes how entries that cite its sources are written. */
1781
2725
  200: {
1782
2726
  headers: {
1783
2727
  [name: string]: unknown
1784
2728
  }
1785
2729
  content: {
1786
2730
  'application/json': {
2731
+ /** @description The instruction's document ID. */
1787
2732
  id: string
2733
+ /** @description ID of the knowledge base the instruction belongs to. */
1788
2734
  knowledgeBaseId: string
1789
- /** @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
+ */
1790
2739
  origin: 'conflict' | 'human'
1791
- /** @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
+ */
1792
2744
  status: 'active' | 'archived'
2745
+ /** @description The instruction in plain language. Builds follow it over what the sources say. */
1793
2746
  statement: string
1794
- scopeSourceIds: string[] | null
1795
- /** Format: date-time */
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. */
2748
+ scopeSourceIds: string[]
2749
+ /**
2750
+ * Format: date-time
2751
+ * @description When a refresh archived the instruction. `null` while it is active.
2752
+ */
1796
2753
  archivedAt: string | null
2754
+ /** @description Why the instruction was archived. `null` while it is active. */
1797
2755
  archivedReason: string | null
2756
+ /** @description ID of the conflict issue this instruction records. `null` when `origin` is `human`. */
1798
2757
  sourceIssueId: string | null
1799
- /** @description Actor */
2758
+ /** @description Who created the instruction. `null` for instructions created by resolving a conflict, and when the creator is unknown. */
1800
2759
  createdBy: {
2760
+ /** @description The Sanity user ID, or `sanity-system` when Sanity Context made the change. `null` if unknown. */
1801
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`. */
1802
2763
  displayName: string | null
1803
2764
  } | null
1804
- /** @description Actor */
2765
+ /** @description Who last updated the instruction through the API. `null` when it was never updated, or when the person is unknown. */
1805
2766
  updatedBy: {
2767
+ /** @description The Sanity user ID, or `sanity-system` when Sanity Context made the change. `null` if unknown. */
1806
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`. */
1807
2770
  displayName: string | null
1808
2771
  } | null
1809
- /** Format: date-time */
2772
+ /**
2773
+ * Format: date-time
2774
+ * @description When the instruction was created.
2775
+ */
1810
2776
  createdAt: string
1811
- /** 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
+ */
1812
2781
  updatedAt: string | null
1813
2782
  }
1814
2783
  }
@@ -1820,6 +2789,7 @@ export interface operations {
1820
2789
  query?: never
1821
2790
  header?: never
1822
2791
  path: {
2792
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
1823
2793
  knowledgeBaseId: string
1824
2794
  }
1825
2795
  cookie?: never
@@ -1827,18 +2797,20 @@ export interface operations {
1827
2797
  requestBody: {
1828
2798
  content: {
1829
2799
  'application/json': {
2800
+ /** @description The IDs of the issues to accept and apply. */
1830
2801
  issueIds: string[]
1831
2802
  }
1832
2803
  }
1833
2804
  }
1834
2805
  responses: {
1835
- /** @description JobAccepted */
2806
+ /** @description A queued job that you can poll for progress. */
1836
2807
  202: {
1837
2808
  headers: {
1838
2809
  [name: string]: unknown
1839
2810
  }
1840
2811
  content: {
1841
2812
  'application/json': {
2813
+ /** @description The queued job's ID. Check its progress with `GET .../jobs/{jobId}`. */
1842
2814
  jobId: string
1843
2815
  }
1844
2816
  }
@@ -1850,63 +2822,131 @@ export interface operations {
1850
2822
  query?: never
1851
2823
  header?: never
1852
2824
  path: {
2825
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
1853
2826
  knowledgeBaseId: string
2827
+ /** @description The issue's document ID. */
1854
2828
  issueId: string
1855
2829
  }
1856
2830
  cookie?: never
1857
2831
  }
1858
2832
  requestBody?: never
1859
2833
  responses: {
1860
- /** @description Issue */
2834
+ /** @description An issue found in a knowledge base, and its triage status. */
1861
2835
  200: {
1862
2836
  headers: {
1863
2837
  [name: string]: unknown
1864
2838
  }
1865
2839
  content: {
1866
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. */
1867
2842
  id: string
2843
+ /** @description ID of the knowledge base the issue belongs to. */
1868
2844
  knowledgeBaseId: string
1869
- /** @description IssueContent */
1870
- content: {
1871
- /** @enum {string} */
1872
- kind:
1873
- | 'conflict'
1874
- | 'gap'
1875
- | 'update_required'
1876
- | 'add_entry'
1877
- | 'remove_entry'
1878
- | 'split_entry'
1879
- | 'merge_entry'
1880
- /** @enum {string} */
1881
- severity: 'critical' | 'suggestion'
1882
- scopePath: string
1883
- issue: string
1884
- suggestedFix: string
1885
- citedSourceIds?: string[]
1886
- claimKey?: string
1887
- involvedScopes?: string[]
1888
- currentClaim?: string
1889
- alternativeClaim?: string
1890
- /** @enum {string} */
1891
- currentAuthority?: 'primary' | 'secondary' | 'community'
1892
- /** @enum {string} */
1893
- alternativeAuthority?: 'primary' | 'secondary' | 'community'
1894
- /** @enum {string} */
1895
- suggestedResolution?: 'keep_existing' | 'accept_new'
1896
- }
1897
- /** @enum {string} */
2845
+ /** @description What the issue found. The shape depends on `kind`. */
2846
+ content:
2847
+ | {
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
+ */
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. */
2854
+ scopePath: string
2855
+ /** @description What the problem is, in one or two sentences. */
2856
+ issue: string
2857
+ /** @description What to do to fix the issue. */
2858
+ suggestedFix: 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
+ */
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. */
2865
+ claimKey: string
2866
+ /** @description The conflicting positions, at least two. To resolve the conflict, pass the index of one side as `resolution`. */
2867
+ sides: {
2868
+ /** @description The position as a self-contained sentence. This is the option you choose from. */
2869
+ claim: string
2870
+ /** @description The disputed value on its own, such as `10,000/month`, without the sentence. */
2871
+ value?: string
2872
+ /** @description Paths of the entries that state this position. */
2873
+ entryPaths?: string[]
2874
+ /** @description IDs of the sources that directly back this position. */
2875
+ sourceIds?: string[]
2876
+ /** @description Where in a source this position was read. */
2877
+ span?: {
2878
+ /** @description ID of the source the position was read from. */
2879
+ sourceId: string
2880
+ /** @description First line of the range, counting from 1. Line numbers match `GET .../sources/{sourceId}/content`. */
2881
+ lineStart: number
2882
+ /** @description Last line of the range, inclusive. */
2883
+ lineEnd: number
2884
+ }
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
+ */
2889
+ authority?: 'primary' | 'secondary' | 'community'
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. */
2892
+ suggested?: number
2893
+ }
2894
+ | {
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
+ */
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. */
2901
+ scopePath: string
2902
+ /** @description What the problem is, in one or two sentences. */
2903
+ issue: string
2904
+ /** @description What to do to fix the issue. */
2905
+ suggestedFix: 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
+ */
2910
+ kind:
2911
+ | 'gap'
2912
+ | 'update_required'
2913
+ | 'add_entry'
2914
+ | 'remove_entry'
2915
+ | 'split_entry'
2916
+ | 'merge_entry'
2917
+ /** @description IDs of the sources that led to the issue. For `add_entry`, the sources the new entry would cite. */
2918
+ citedSourceIds?: string[]
2919
+ /** @description A key naming the specific finding, when the check that found it sets one. */
2920
+ claimKey?: string
2921
+ /** @description Paths of the entries the issue involves, when it spans more than one entry. */
2922
+ involvedScopes?: string[]
2923
+ }
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
+ */
1898
2928
  status: 'open' | 'accepted' | 'rejected'
1899
- /** @enum {string|null} */
1900
- resolution: 'keep_existing' | 'accept_new' | null
1901
- /** @description IssueResolvedBy */
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. */
2930
+ resolution: number | null
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. */
1902
2932
  resolvedBy: {
2933
+ /** @description Sanity user ID of the person or robot that triaged the issue. */
1903
2934
  id: string
1904
- /** @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
+ */
1905
2939
  kind: 'user' | 'robot'
1906
2940
  } | null
1907
- /** Format: date-time */
2941
+ /**
2942
+ * Format: date-time
2943
+ * @description When the issue was first filed.
2944
+ */
1908
2945
  createdAt: string
1909
- /** Format: date-time */
2946
+ /**
2947
+ * Format: date-time
2948
+ * @description When the issue left `open`. `null` while the issue is open.
2949
+ */
1910
2950
  resolvedAt: string | null
1911
2951
  }
1912
2952
  }
@@ -1918,63 +2958,131 @@ export interface operations {
1918
2958
  query?: never
1919
2959
  header?: never
1920
2960
  path: {
2961
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
1921
2962
  knowledgeBaseId: string
2963
+ /** @description The issue's document ID. */
1922
2964
  issueId: string
1923
2965
  }
1924
2966
  cookie?: never
1925
2967
  }
1926
2968
  requestBody?: never
1927
2969
  responses: {
1928
- /** @description Issue */
2970
+ /** @description An issue found in a knowledge base, and its triage status. */
1929
2971
  200: {
1930
2972
  headers: {
1931
2973
  [name: string]: unknown
1932
2974
  }
1933
2975
  content: {
1934
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. */
1935
2978
  id: string
2979
+ /** @description ID of the knowledge base the issue belongs to. */
1936
2980
  knowledgeBaseId: string
1937
- /** @description IssueContent */
1938
- content: {
1939
- /** @enum {string} */
1940
- kind:
1941
- | 'conflict'
1942
- | 'gap'
1943
- | 'update_required'
1944
- | 'add_entry'
1945
- | 'remove_entry'
1946
- | 'split_entry'
1947
- | 'merge_entry'
1948
- /** @enum {string} */
1949
- severity: 'critical' | 'suggestion'
1950
- scopePath: string
1951
- issue: string
1952
- suggestedFix: string
1953
- citedSourceIds?: string[]
1954
- claimKey?: string
1955
- involvedScopes?: string[]
1956
- currentClaim?: string
1957
- alternativeClaim?: string
1958
- /** @enum {string} */
1959
- currentAuthority?: 'primary' | 'secondary' | 'community'
1960
- /** @enum {string} */
1961
- alternativeAuthority?: 'primary' | 'secondary' | 'community'
1962
- /** @enum {string} */
1963
- suggestedResolution?: 'keep_existing' | 'accept_new'
1964
- }
1965
- /** @enum {string} */
2981
+ /** @description What the issue found. The shape depends on `kind`. */
2982
+ content:
2983
+ | {
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
+ */
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. */
2990
+ scopePath: string
2991
+ /** @description What the problem is, in one or two sentences. */
2992
+ issue: string
2993
+ /** @description What to do to fix the issue. */
2994
+ suggestedFix: 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
+ */
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. */
3001
+ claimKey: string
3002
+ /** @description The conflicting positions, at least two. To resolve the conflict, pass the index of one side as `resolution`. */
3003
+ sides: {
3004
+ /** @description The position as a self-contained sentence. This is the option you choose from. */
3005
+ claim: string
3006
+ /** @description The disputed value on its own, such as `10,000/month`, without the sentence. */
3007
+ value?: string
3008
+ /** @description Paths of the entries that state this position. */
3009
+ entryPaths?: string[]
3010
+ /** @description IDs of the sources that directly back this position. */
3011
+ sourceIds?: string[]
3012
+ /** @description Where in a source this position was read. */
3013
+ span?: {
3014
+ /** @description ID of the source the position was read from. */
3015
+ sourceId: string
3016
+ /** @description First line of the range, counting from 1. Line numbers match `GET .../sources/{sourceId}/content`. */
3017
+ lineStart: number
3018
+ /** @description Last line of the range, inclusive. */
3019
+ lineEnd: number
3020
+ }
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
+ */
3025
+ authority?: 'primary' | 'secondary' | 'community'
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. */
3028
+ suggested?: number
3029
+ }
3030
+ | {
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
+ */
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. */
3037
+ scopePath: string
3038
+ /** @description What the problem is, in one or two sentences. */
3039
+ issue: string
3040
+ /** @description What to do to fix the issue. */
3041
+ suggestedFix: 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
+ */
3046
+ kind:
3047
+ | 'gap'
3048
+ | 'update_required'
3049
+ | 'add_entry'
3050
+ | 'remove_entry'
3051
+ | 'split_entry'
3052
+ | 'merge_entry'
3053
+ /** @description IDs of the sources that led to the issue. For `add_entry`, the sources the new entry would cite. */
3054
+ citedSourceIds?: string[]
3055
+ /** @description A key naming the specific finding, when the check that found it sets one. */
3056
+ claimKey?: string
3057
+ /** @description Paths of the entries the issue involves, when it spans more than one entry. */
3058
+ involvedScopes?: string[]
3059
+ }
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
+ */
1966
3064
  status: 'open' | 'accepted' | 'rejected'
1967
- /** @enum {string|null} */
1968
- resolution: 'keep_existing' | 'accept_new' | null
1969
- /** @description IssueResolvedBy */
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. */
3066
+ resolution: number | null
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. */
1970
3068
  resolvedBy: {
3069
+ /** @description Sanity user ID of the person or robot that triaged the issue. */
1971
3070
  id: string
1972
- /** @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
+ */
1973
3075
  kind: 'user' | 'robot'
1974
3076
  } | null
1975
- /** Format: date-time */
3077
+ /**
3078
+ * Format: date-time
3079
+ * @description When the issue was first filed.
3080
+ */
1976
3081
  createdAt: string
1977
- /** Format: date-time */
3082
+ /**
3083
+ * Format: date-time
3084
+ * @description When the issue left `open`. `null` while the issue is open.
3085
+ */
1978
3086
  resolvedAt: string | null
1979
3087
  }
1980
3088
  }
@@ -1986,7 +3094,9 @@ export interface operations {
1986
3094
  query?: never
1987
3095
  header?: never
1988
3096
  path: {
3097
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
1989
3098
  knowledgeBaseId: string
3099
+ /** @description The issue's document ID. */
1990
3100
  issueId: string
1991
3101
  }
1992
3102
  cookie?: never
@@ -1994,66 +3104,133 @@ export interface operations {
1994
3104
  requestBody: {
1995
3105
  content: {
1996
3106
  'application/json': {
1997
- /** @enum {string} */
1998
- resolution: 'keep_existing' | 'accept_new'
3107
+ /** @description The index of the chosen side in the issue's `content.sides`. */
3108
+ resolution: number
1999
3109
  }
2000
3110
  }
2001
3111
  }
2002
3112
  responses: {
2003
- /** @description ResolveIssueResponse */
3113
+ /** @description The resolved issue, plus the job that rewrites the entry when the decision changes it. */
2004
3114
  200: {
2005
3115
  headers: {
2006
3116
  [name: string]: unknown
2007
3117
  }
2008
3118
  content: {
2009
3119
  'application/json': {
2010
- /** @description Issue */
3120
+ /** @description The resolved conflict issue, now `accepted`. */
2011
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. */
2012
3123
  id: string
3124
+ /** @description ID of the knowledge base the issue belongs to. */
2013
3125
  knowledgeBaseId: string
2014
- /** @description IssueContent */
2015
- content: {
2016
- /** @enum {string} */
2017
- kind:
2018
- | 'conflict'
2019
- | 'gap'
2020
- | 'update_required'
2021
- | 'add_entry'
2022
- | 'remove_entry'
2023
- | 'split_entry'
2024
- | 'merge_entry'
2025
- /** @enum {string} */
2026
- severity: 'critical' | 'suggestion'
2027
- scopePath: string
2028
- issue: string
2029
- suggestedFix: string
2030
- citedSourceIds?: string[]
2031
- claimKey?: string
2032
- involvedScopes?: string[]
2033
- currentClaim?: string
2034
- alternativeClaim?: string
2035
- /** @enum {string} */
2036
- currentAuthority?: 'primary' | 'secondary' | 'community'
2037
- /** @enum {string} */
2038
- alternativeAuthority?: 'primary' | 'secondary' | 'community'
2039
- /** @enum {string} */
2040
- suggestedResolution?: 'keep_existing' | 'accept_new'
2041
- }
2042
- /** @enum {string} */
3126
+ /** @description What the issue found. The shape depends on `kind`. */
3127
+ content:
3128
+ | {
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
+ */
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. */
3135
+ scopePath: string
3136
+ /** @description What the problem is, in one or two sentences. */
3137
+ issue: string
3138
+ /** @description What to do to fix the issue. */
3139
+ suggestedFix: 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
+ */
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. */
3146
+ claimKey: string
3147
+ /** @description The conflicting positions, at least two. To resolve the conflict, pass the index of one side as `resolution`. */
3148
+ sides: {
3149
+ /** @description The position as a self-contained sentence. This is the option you choose from. */
3150
+ claim: string
3151
+ /** @description The disputed value on its own, such as `10,000/month`, without the sentence. */
3152
+ value?: string
3153
+ /** @description Paths of the entries that state this position. */
3154
+ entryPaths?: string[]
3155
+ /** @description IDs of the sources that directly back this position. */
3156
+ sourceIds?: string[]
3157
+ /** @description Where in a source this position was read. */
3158
+ span?: {
3159
+ /** @description ID of the source the position was read from. */
3160
+ sourceId: string
3161
+ /** @description First line of the range, counting from 1. Line numbers match `GET .../sources/{sourceId}/content`. */
3162
+ lineStart: number
3163
+ /** @description Last line of the range, inclusive. */
3164
+ lineEnd: number
3165
+ }
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
+ */
3170
+ authority?: 'primary' | 'secondary' | 'community'
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. */
3173
+ suggested?: number
3174
+ }
3175
+ | {
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
+ */
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. */
3182
+ scopePath: string
3183
+ /** @description What the problem is, in one or two sentences. */
3184
+ issue: string
3185
+ /** @description What to do to fix the issue. */
3186
+ suggestedFix: 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
+ */
3191
+ kind:
3192
+ | 'gap'
3193
+ | 'update_required'
3194
+ | 'add_entry'
3195
+ | 'remove_entry'
3196
+ | 'split_entry'
3197
+ | 'merge_entry'
3198
+ /** @description IDs of the sources that led to the issue. For `add_entry`, the sources the new entry would cite. */
3199
+ citedSourceIds?: string[]
3200
+ /** @description A key naming the specific finding, when the check that found it sets one. */
3201
+ claimKey?: string
3202
+ /** @description Paths of the entries the issue involves, when it spans more than one entry. */
3203
+ involvedScopes?: string[]
3204
+ }
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
+ */
2043
3209
  status: 'open' | 'accepted' | 'rejected'
2044
- /** @enum {string|null} */
2045
- resolution: 'keep_existing' | 'accept_new' | null
2046
- /** @description IssueResolvedBy */
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. */
3211
+ resolution: number | null
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. */
2047
3213
  resolvedBy: {
3214
+ /** @description Sanity user ID of the person or robot that triaged the issue. */
2048
3215
  id: string
2049
- /** @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
+ */
2050
3220
  kind: 'user' | 'robot'
2051
3221
  } | null
2052
- /** Format: date-time */
3222
+ /**
3223
+ * Format: date-time
3224
+ * @description When the issue was first filed.
3225
+ */
2053
3226
  createdAt: string
2054
- /** Format: date-time */
3227
+ /**
3228
+ * Format: date-time
3229
+ * @description When the issue left `open`. `null` while the issue is open.
3230
+ */
2055
3231
  resolvedAt: string | null
2056
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. */
2057
3234
  jobId: string | null
2058
3235
  }
2059
3236
  }
@@ -2065,28 +3242,42 @@ export interface operations {
2065
3242
  query?: never
2066
3243
  header?: never
2067
3244
  path: {
3245
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
2068
3246
  knowledgeBaseId: string
3247
+ /** @description The job ID returned by the endpoint that started the work. */
2069
3248
  jobId: string
2070
3249
  }
2071
3250
  cookie?: never
2072
3251
  }
2073
3252
  requestBody?: never
2074
3253
  responses: {
2075
- /** @description Job */
3254
+ /** @description A background job, such as a build, refresh, or import, and its status. */
2076
3255
  200: {
2077
3256
  headers: {
2078
3257
  [name: string]: unknown
2079
3258
  }
2080
3259
  content: {
2081
3260
  'application/json': {
3261
+ /** @description The job's ID. */
2082
3262
  id: string
2083
- /** @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
+ */
2084
3267
  status: 'pending' | 'queued' | 'running' | 'succeeded' | 'failed' | 'cancelled'
2085
- /** Format: date-time */
3268
+ /**
3269
+ * Format: date-time
3270
+ * @description When the job started.
3271
+ */
2086
3272
  startedAt: string | null
2087
- /** Format: date-time */
3273
+ /**
3274
+ * Format: date-time
3275
+ * @description When the job finished. `null` while the job is queued or running.
3276
+ */
2088
3277
  completedAt: string | null
3278
+ /** @description The job's output. Only present when `status` is `succeeded`. Its shape depends on the kind of job. */
2089
3279
  result?: unknown
3280
+ /** @description A readable reason the job failed or was cancelled. `null` for any other status. */
2090
3281
  error?: string | null
2091
3282
  }
2092
3283
  }
@@ -2098,20 +3289,23 @@ export interface operations {
2098
3289
  query?: never
2099
3290
  header?: never
2100
3291
  path: {
3292
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
2101
3293
  knowledgeBaseId: string
2102
3294
  }
2103
3295
  cookie?: never
2104
3296
  }
2105
3297
  requestBody?: never
2106
3298
  responses: {
2107
- /** @description RefreshAccepted */
3299
+ /** @description A queued refresh job that you can poll for progress. */
2108
3300
  202: {
2109
3301
  headers: {
2110
3302
  [name: string]: unknown
2111
3303
  }
2112
3304
  content: {
2113
3305
  'application/json': {
3306
+ /** @description The queued job's ID. Check its progress with `GET .../jobs/{jobId}`. */
2114
3307
  jobId: string
3308
+ /** @description Whether this request started a new refresh. `false` means a refresh was already running, and `jobId` is that refresh. */
2115
3309
  started: boolean
2116
3310
  }
2117
3311
  }
@@ -2121,48 +3315,84 @@ export interface operations {
2121
3315
  listSources: {
2122
3316
  parameters: {
2123
3317
  query?: {
3318
+ /** @description The `nextCursor` value from the previous page. Omit it to get the first page. */
2124
3319
  cursor?: string
3320
+ /** @description The maximum number of items to return. */
2125
3321
  limit?: number
3322
+ /** @description Return only sources with this status. */
2126
3323
  status?: 'pending' | 'processing' | 'ready' | 'failed' | 'skipped'
3324
+ /** @description Return only the sources that this import produced. */
2127
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. */
2128
3327
  ids?: string
2129
3328
  }
2130
3329
  header?: never
2131
3330
  path: {
3331
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
2132
3332
  knowledgeBaseId: string
2133
3333
  }
2134
3334
  cookie?: never
2135
3335
  }
2136
3336
  requestBody?: never
2137
3337
  responses: {
2138
- /** @description Default Response */
3338
+ /** @description A page of sources. */
2139
3339
  200: {
2140
3340
  headers: {
2141
3341
  [name: string]: unknown
2142
3342
  }
2143
3343
  content: {
2144
3344
  'application/json': {
3345
+ /** @description The items on this page. */
2145
3346
  data: {
2146
- /** Format: uuid */
3347
+ /**
3348
+ * Format: uuid
3349
+ * @description The source's ID.
3350
+ */
2147
3351
  id: string
2148
- /** Format: uuid */
3352
+ /**
3353
+ * Format: uuid
3354
+ * @description The `id` of the knowledge base that the source belongs to.
3355
+ */
2149
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. */
2150
3358
  filename: string
2151
- /** @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
+ */
2152
3363
  kind: 'web' | 'file' | 'dataset'
3364
+ /** @description The source's size in bytes. */
2153
3365
  sizeBytes: number
2154
- /** @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
+ */
2155
3370
  status: 'pending' | 'processing' | 'ready' | 'failed' | 'skipped'
3371
+ /** @description A short summary of the source. `null` until the source is summarized. */
2156
3372
  tldr: string | null
3373
+ /** @description Topics the source covers. `null` until the source is summarized. */
2157
3374
  topics: string[] | null
3375
+ /** @description The page URL of a `web` source. `null` for other kinds. */
2158
3376
  canonicalUrl: string | null
2159
- /** Format: date-time */
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. */
3378
+ externalId: string | null
3379
+ /**
3380
+ * Format: date-time
3381
+ * @description When the source's content was last fetched.
3382
+ */
2160
3383
  fetchedAt: string | null
2161
- /** 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
+ */
2162
3388
  distilledAt: string | null
2163
- /** Format: date-time */
3389
+ /**
3390
+ * Format: date-time
3391
+ * @description When the source was added.
3392
+ */
2164
3393
  createdAt: string
2165
3394
  }[]
3395
+ /** @description The cursor for the next page. Pass it as `cursor` to get more results. `null` when there are no more pages. */
2166
3396
  nextCursor: string | null
2167
3397
  }
2168
3398
  }
@@ -2174,38 +3404,68 @@ export interface operations {
2174
3404
  query?: never
2175
3405
  header?: never
2176
3406
  path: {
3407
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
2177
3408
  knowledgeBaseId: string
3409
+ /** @description The source's ID. */
2178
3410
  sourceId: string
2179
3411
  }
2180
3412
  cookie?: never
2181
3413
  }
2182
3414
  requestBody?: never
2183
3415
  responses: {
2184
- /** @description Source */
3416
+ /** @description A page, file, or document that an import produced and that builds cite. */
2185
3417
  200: {
2186
3418
  headers: {
2187
3419
  [name: string]: unknown
2188
3420
  }
2189
3421
  content: {
2190
3422
  'application/json': {
2191
- /** Format: uuid */
3423
+ /**
3424
+ * Format: uuid
3425
+ * @description The source's ID.
3426
+ */
2192
3427
  id: string
2193
- /** Format: uuid */
3428
+ /**
3429
+ * Format: uuid
3430
+ * @description The `id` of the knowledge base that the source belongs to.
3431
+ */
2194
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. */
2195
3434
  filename: string
2196
- /** @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
+ */
2197
3439
  kind: 'web' | 'file' | 'dataset'
3440
+ /** @description The source's size in bytes. */
2198
3441
  sizeBytes: number
2199
- /** @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
+ */
2200
3446
  status: 'pending' | 'processing' | 'ready' | 'failed' | 'skipped'
3447
+ /** @description A short summary of the source. `null` until the source is summarized. */
2201
3448
  tldr: string | null
3449
+ /** @description Topics the source covers. `null` until the source is summarized. */
2202
3450
  topics: string[] | null
3451
+ /** @description The page URL of a `web` source. `null` for other kinds. */
2203
3452
  canonicalUrl: string | null
2204
- /** Format: date-time */
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. */
3454
+ externalId: string | null
3455
+ /**
3456
+ * Format: date-time
3457
+ * @description When the source's content was last fetched.
3458
+ */
2205
3459
  fetchedAt: string | null
2206
- /** 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
+ */
2207
3464
  distilledAt: string | null
2208
- /** Format: date-time */
3465
+ /**
3466
+ * Format: date-time
3467
+ * @description When the source was added.
3468
+ */
2209
3469
  createdAt: string
2210
3470
  }
2211
3471
  }
@@ -2217,14 +3477,16 @@ export interface operations {
2217
3477
  query?: never
2218
3478
  header?: never
2219
3479
  path: {
3480
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
2220
3481
  knowledgeBaseId: string
3482
+ /** @description The source's ID. */
2221
3483
  sourceId: string
2222
3484
  }
2223
3485
  cookie?: never
2224
3486
  }
2225
3487
  requestBody?: never
2226
3488
  responses: {
2227
- /** @description Default Response */
3489
+ /** @description The source was deleted. */
2228
3490
  204: {
2229
3491
  headers: {
2230
3492
  [name: string]: unknown
@@ -2238,33 +3500,45 @@ export interface operations {
2238
3500
  getSourceContent: {
2239
3501
  parameters: {
2240
3502
  query?: {
2241
- /** @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. */
2242
3504
  format?: 'json' | 'markdown' | 'plain'
3505
+ /** @description The first line to return, starting at 1. Omit `startLine` and `endLine` to get the whole content. */
2243
3506
  startLine?: number
3507
+ /** @description The last line to return, inclusive. A value past the end returns everything up to the last line. */
2244
3508
  endLine?: number
2245
3509
  }
2246
3510
  header?: never
2247
3511
  path: {
3512
+ /** @description The knowledge base's public ID (`kb...`) or UUID. */
2248
3513
  knowledgeBaseId: string
3514
+ /** @description The source's ID. */
2249
3515
  sourceId: string
2250
3516
  }
2251
3517
  cookie?: never
2252
3518
  }
2253
3519
  requestBody?: never
2254
3520
  responses: {
2255
- /** @description SourceContent */
3521
+ /** @description A source's distilled markdown, or a range of its lines. */
2256
3522
  200: {
2257
3523
  headers: {
2258
3524
  [name: string]: unknown
2259
3525
  }
2260
3526
  content: {
2261
3527
  'application/json': {
2262
- /** Format: uuid */
3528
+ /**
3529
+ * Format: uuid
3530
+ * @description The source's ID.
3531
+ */
2263
3532
  sourceId: string
3533
+ /** @description The distilled markdown, or the requested lines of it. */
2264
3534
  content: string
3535
+ /** @description The number of lines in the full distilled content. */
2265
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. */
2266
3538
  slice: {
3539
+ /** @description The first line returned. */
2267
3540
  start: number
3541
+ /** @description The last line returned. */
2268
3542
  end: number
2269
3543
  }
2270
3544
  }
@@ -2279,106 +3553,184 @@ export interface operations {
2279
3553
  query?: never
2280
3554
  header?: never
2281
3555
  path: {
3556
+ /** @description Your ID for the conversation thread, unique within your organization. Up to 200 characters. */
2282
3557
  threadId: string
2283
3558
  }
2284
3559
  cookie?: never
2285
3560
  }
2286
- /** @description SaveConversationInput */
3561
+ /** @description A conversation transcript to save for one thread. */
2287
3562
  requestBody: {
2288
3563
  content: {
2289
3564
  'application/json': {
3565
+ /** @description The full transcript so far, in order. It replaces the stored messages. */
2290
3566
  messages: {
2291
- /** @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
+ */
2292
3571
  role: 'user' | 'assistant' | 'system' | 'tool'
2293
- /** @default null */
3572
+ /**
3573
+ * @description The message text. `null` when the message has no text, such as a tool call.
3574
+ * @default null
3575
+ */
2294
3576
  content?: string | null
2295
- /** @default null */
3577
+ /**
3578
+ * @description The name of the tool for a `tool` message. `null` on other messages.
3579
+ * @default null
3580
+ */
2296
3581
  toolName?: string | null
2297
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.
2298
3584
  * @default null
2299
3585
  * @enum {string|null}
2300
3586
  */
2301
3587
  toolType?: 'call' | 'result' | 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
+ */
3592
+ error?: string | null
2302
3593
  }[]
3594
+ /** @description The provider of the model the agent used. When absent, the stored value stays unchanged. */
2303
3595
  modelProvider?: string
3596
+ /** @description The ID of the model the agent used. When absent, the stored value stays unchanged. */
2304
3597
  modelId?: string
2305
- /** @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. */
2306
3599
  tokenUsage?: {
3600
+ /** @description The number of input tokens. */
2307
3601
  inputTokens?: number
3602
+ /** @description The number of output tokens. */
2308
3603
  outputTokens?: number
3604
+ /** @description The total number of tokens. */
2309
3605
  totalTokens?: number
2310
3606
  }
2311
- /** @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. */
2312
3608
  metadata?: {
2313
3609
  [key: string]: string | string[]
2314
3610
  }
2315
- /** @description ConversationSharing */
3611
+ /** @description Your choice to share conversation telemetry with Sanity. Replaces the stored setting. When absent, the stored value stays unchanged. */
2316
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. */
2317
3614
  metrics?: boolean
3615
+ /** @description Whether to share full conversation transcripts with Sanity. When `true`, the API also sets `metrics` to `true`. */
2318
3616
  conversations?: boolean
3617
+ /** @description How the Sanity team can reach you about your agent, such as an email address or a Discord handle. */
2319
3618
  contact?: string
2320
3619
  }
2321
3620
  }
2322
3621
  }
2323
3622
  }
2324
3623
  responses: {
2325
- /** @description Conversation */
3624
+ /** @description A recorded agent conversation: its transcript, metadata, token usage, and classification. */
2326
3625
  200: {
2327
3626
  headers: {
2328
3627
  [name: string]: unknown
2329
3628
  }
2330
3629
  content: {
2331
3630
  'application/json': {
3631
+ /** @description The conversation ID, unique within the organization. It matches the `_id` of the conversation document in your document store. */
2332
3632
  id: string
3633
+ /** @description Your identifier for the conversation thread, unique within the organization. Saving with the same `threadId` updates the same conversation. */
2333
3634
  threadId: string
2334
- /** @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`. */
2335
3636
  metadata: {
2336
3637
  [key: string]: string | string[]
2337
3638
  } | null
2338
- /** 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
+ */
2339
3643
  startedAt: string
2340
- /** Format: date-time */
3644
+ /**
3645
+ * Format: date-time
3646
+ * @description When the conversation was last saved, as an ISO 8601 timestamp.
3647
+ */
2341
3648
  messagesUpdatedAt: string
3649
+ /** @description The conversation transcript, in order. Each save replaces it. */
2342
3650
  messages: {
2343
- /** @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
+ */
2344
3655
  role: 'user' | 'assistant' | 'system' | 'tool'
2345
- /** @default null */
3656
+ /**
3657
+ * @description The message text. `null` when the message has no text, such as a tool call.
3658
+ * @default null
3659
+ */
2346
3660
  content: string | null
2347
- /** @default null */
3661
+ /**
3662
+ * @description The name of the tool for a `tool` message. `null` on other messages.
3663
+ * @default null
3664
+ */
2348
3665
  toolName: string | null
2349
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.
2350
3668
  * @default null
2351
3669
  * @enum {string|null}
2352
3670
  */
2353
3671
  toolType: 'call' | 'result' | 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
+ */
3676
+ error: string | null
3677
+ /**
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.
3680
+ * @default null
3681
+ */
3682
+ timestamp: string | null
2354
3683
  }[]
3684
+ /** @description The provider of the model the agent used. `null` until a save includes `modelProvider`. */
2355
3685
  modelProvider: string | null
3686
+ /** @description The ID of the model the agent used. `null` until a save includes `modelId`. */
2356
3687
  modelId: string | null
2357
- /** @description ConversationTokenUsage */
3688
+ /** @description The running total of token usage for the conversation. `null` until a save includes `tokenUsage`. */
2358
3689
  tokenUsage: {
3690
+ /** @description The number of input tokens. */
2359
3691
  inputTokens?: number
3692
+ /** @description The number of output tokens. */
2360
3693
  outputTokens?: number
3694
+ /** @description The total number of tokens. */
2361
3695
  totalTokens?: number
2362
3696
  } | null
2363
- /** @description ConversationCoreMetrics */
3697
+ /** @description The latest classification result. `null` until you record one. */
2364
3698
  coreMetrics: {
3699
+ /** @description How well the agent resolved the user's needs, from 1 to 10. */
2365
3700
  successScore?: number
2366
- /** @enum {string} */
3701
+ /**
3702
+ * @description The overall sentiment of the conversation.
3703
+ * @enum {string}
3704
+ */
2367
3705
  sentiment?: 'positive' | 'neutral' | 'negative'
3706
+ /** @description Topics the agent couldn't answer because it lacked content. */
2368
3707
  contentGaps?: string[]
2369
3708
  } | null
2370
- /** 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
+ */
2371
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. */
2372
3715
  classificationError: string | null
2373
- /** @description ConversationSharing */
3716
+ /** @description Your choice to share conversation telemetry with Sanity. `null` until a save includes `sharing`. */
2374
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. */
2375
3719
  metrics?: boolean
3720
+ /** @description Whether to share full conversation transcripts with Sanity. When `true`, the API also sets `metrics` to `true`. */
2376
3721
  conversations?: boolean
3722
+ /** @description How the Sanity team can reach you about your agent, such as an email address or a Discord handle. */
2377
3723
  contact?: string
2378
3724
  } | null
2379
- /** Format: date-time */
3725
+ /**
3726
+ * Format: date-time
3727
+ * @description When the conversation was created, as an ISO 8601 timestamp.
3728
+ */
2380
3729
  createdAt: string
2381
- /** Format: date-time */
3730
+ /**
3731
+ * Format: date-time
3732
+ * @description When the conversation was last changed, as an ISO 8601 timestamp.
3733
+ */
2382
3734
  updatedAt: string
2383
3735
  }
2384
3736
  }
@@ -2390,82 +3742,143 @@ export interface operations {
2390
3742
  query?: never
2391
3743
  header?: never
2392
3744
  path: {
3745
+ /** @description Your ID for the conversation thread, unique within your organization. Up to 200 characters. */
2393
3746
  threadId: string
2394
3747
  }
2395
3748
  cookie?: never
2396
3749
  }
2397
- /** @description ClassifyConversationInput */
3750
+ /** @description A classification result or failure for one conversation. Send exactly one of `coreMetrics` or `classificationError`. */
2398
3751
  requestBody: {
2399
3752
  content: {
2400
3753
  'application/json': {
3754
+ /** @description The classification result. The API sets `classifiedAt` and clears any recorded `classificationError`. */
2401
3755
  coreMetrics?: {
3756
+ /** @description How well the agent resolved the user's needs, as an integer from 1 to 10. */
2402
3757
  successScore: number
2403
- /** @enum {string} */
3758
+ /**
3759
+ * @description The overall sentiment of the conversation.
3760
+ * @enum {string}
3761
+ */
2404
3762
  sentiment: 'positive' | 'neutral' | 'negative'
3763
+ /** @description Topics the agent couldn't answer because it lacked content. */
2405
3764
  contentGaps: string[]
2406
3765
  }
3766
+ /** @description Why your classifier couldn't classify the conversation. Any earlier classification result stays unchanged. */
2407
3767
  classificationError?: string
2408
3768
  }
2409
3769
  }
2410
3770
  }
2411
3771
  responses: {
2412
- /** @description Conversation */
3772
+ /** @description A recorded agent conversation: its transcript, metadata, token usage, and classification. */
2413
3773
  200: {
2414
3774
  headers: {
2415
3775
  [name: string]: unknown
2416
3776
  }
2417
3777
  content: {
2418
3778
  'application/json': {
3779
+ /** @description The conversation ID, unique within the organization. It matches the `_id` of the conversation document in your document store. */
2419
3780
  id: string
3781
+ /** @description Your identifier for the conversation thread, unique within the organization. Saving with the same `threadId` updates the same conversation. */
2420
3782
  threadId: string
2421
- /** @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`. */
2422
3784
  metadata: {
2423
3785
  [key: string]: string | string[]
2424
3786
  } | null
2425
- /** 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
+ */
2426
3791
  startedAt: string
2427
- /** Format: date-time */
3792
+ /**
3793
+ * Format: date-time
3794
+ * @description When the conversation was last saved, as an ISO 8601 timestamp.
3795
+ */
2428
3796
  messagesUpdatedAt: string
3797
+ /** @description The conversation transcript, in order. Each save replaces it. */
2429
3798
  messages: {
2430
- /** @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
+ */
2431
3803
  role: 'user' | 'assistant' | 'system' | 'tool'
2432
- /** @default null */
3804
+ /**
3805
+ * @description The message text. `null` when the message has no text, such as a tool call.
3806
+ * @default null
3807
+ */
2433
3808
  content: string | null
2434
- /** @default null */
3809
+ /**
3810
+ * @description The name of the tool for a `tool` message. `null` on other messages.
3811
+ * @default null
3812
+ */
2435
3813
  toolName: string | null
2436
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.
2437
3816
  * @default null
2438
3817
  * @enum {string|null}
2439
3818
  */
2440
3819
  toolType: 'call' | 'result' | 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
+ */
3824
+ error: string | null
3825
+ /**
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.
3828
+ * @default null
3829
+ */
3830
+ timestamp: string | null
2441
3831
  }[]
3832
+ /** @description The provider of the model the agent used. `null` until a save includes `modelProvider`. */
2442
3833
  modelProvider: string | null
3834
+ /** @description The ID of the model the agent used. `null` until a save includes `modelId`. */
2443
3835
  modelId: string | null
2444
- /** @description ConversationTokenUsage */
3836
+ /** @description The running total of token usage for the conversation. `null` until a save includes `tokenUsage`. */
2445
3837
  tokenUsage: {
3838
+ /** @description The number of input tokens. */
2446
3839
  inputTokens?: number
3840
+ /** @description The number of output tokens. */
2447
3841
  outputTokens?: number
3842
+ /** @description The total number of tokens. */
2448
3843
  totalTokens?: number
2449
3844
  } | null
2450
- /** @description ConversationCoreMetrics */
3845
+ /** @description The latest classification result. `null` until you record one. */
2451
3846
  coreMetrics: {
3847
+ /** @description How well the agent resolved the user's needs, from 1 to 10. */
2452
3848
  successScore?: number
2453
- /** @enum {string} */
3849
+ /**
3850
+ * @description The overall sentiment of the conversation.
3851
+ * @enum {string}
3852
+ */
2454
3853
  sentiment?: 'positive' | 'neutral' | 'negative'
3854
+ /** @description Topics the agent couldn't answer because it lacked content. */
2455
3855
  contentGaps?: string[]
2456
3856
  } | null
2457
- /** 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
+ */
2458
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. */
2459
3863
  classificationError: string | null
2460
- /** @description ConversationSharing */
3864
+ /** @description Your choice to share conversation telemetry with Sanity. `null` until a save includes `sharing`. */
2461
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. */
2462
3867
  metrics?: boolean
3868
+ /** @description Whether to share full conversation transcripts with Sanity. When `true`, the API also sets `metrics` to `true`. */
2463
3869
  conversations?: boolean
3870
+ /** @description How the Sanity team can reach you about your agent, such as an email address or a Discord handle. */
2464
3871
  contact?: string
2465
3872
  } | null
2466
- /** Format: date-time */
3873
+ /**
3874
+ * Format: date-time
3875
+ * @description When the conversation was created, as an ISO 8601 timestamp.
3876
+ */
2467
3877
  createdAt: string
2468
- /** Format: date-time */
3878
+ /**
3879
+ * Format: date-time
3880
+ * @description When the conversation was last changed, as an ISO 8601 timestamp.
3881
+ */
2469
3882
  updatedAt: string
2470
3883
  }
2471
3884
  }