@sanity/client 8.3.0 → 8.4.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.
Files changed (38) hide show
  1. package/dist/{browserUpload-2tz6Sdqp.js → browserUpload-C7PwCs-C.js} +6 -9
  2. package/dist/browserUpload-C7PwCs-C.js.map +1 -0
  3. package/dist/{browserUpload-CwpNx7Vl.js → browserUpload-D-2Rmfjo.js} +6 -9
  4. package/dist/browserUpload-D-2Rmfjo.js.map +1 -0
  5. package/dist/{config-3wiPP-sZ.js → config-CgJ16jET.js} +4 -2
  6. package/dist/config-CgJ16jET.js.map +1 -0
  7. package/dist/csm.js +1 -1
  8. package/dist/{dist-C9ExSk2R.js → dist-C5K_YcEU.js} +3 -2
  9. package/dist/{dist-C9ExSk2R.js.map → dist-C5K_YcEU.js.map} +1 -1
  10. package/dist/index.d.ts +2 -2
  11. package/dist/index.js +912 -75
  12. package/dist/index.js.map +1 -1
  13. package/dist/index.node.d.ts +3255 -2
  14. package/dist/index.node.js +835 -19
  15. package/dist/index.node.js.map +1 -1
  16. package/dist/media-library.d.ts +1 -1
  17. package/dist/rolldown-runtime-4YWMqDIC.js +9 -0
  18. package/dist/{stegaEncodeSourceMap-DbM2fTN4.js → stegaEncodeSourceMap-CO1HKnm2.js} +2 -2
  19. package/dist/{stegaEncodeSourceMap-DbM2fTN4.js.map → stegaEncodeSourceMap-CO1HKnm2.js.map} +1 -1
  20. package/dist/{types-0x2hPfhJ.d.ts → types-DiPF0ENT.d.ts} +3256 -3
  21. package/package.json +3 -2
  22. package/src/SanityClient.ts +7 -0
  23. package/src/assets/AssetsClient.ts +5 -0
  24. package/src/config.ts +1 -0
  25. package/src/context/ContextClient.ts +1006 -0
  26. package/src/context/openapi.json +5345 -0
  27. package/src/context/reads.ts +206 -0
  28. package/src/context/store.ts +100 -0
  29. package/src/context/types.gen.ts +2428 -0
  30. package/src/context/types.ts +228 -0
  31. package/src/data/dataMethods.ts +4 -1
  32. package/src/defineCreateClient.ts +1 -0
  33. package/src/http/browserUpload.ts +0 -12
  34. package/src/types.ts +23 -2
  35. package/src/validators.ts +1 -0
  36. package/dist/browserUpload-2tz6Sdqp.js.map +0 -1
  37. package/dist/browserUpload-CwpNx7Vl.js.map +0 -1
  38. package/dist/config-3wiPP-sZ.js.map +0 -1
@@ -1726,6 +1726,3235 @@ declare class CollaborationCommentsClient {
1726
1726
  */
1727
1727
  listen<Opts extends CollaborationCommentsListenOptions>(query: string, params: QueryParams | undefined, options: Opts): Observable<ListenEventFromOptions<CollaborationCommentDocument, Opts>>;
1728
1728
  }
1729
+ /**
1730
+ * This file was auto-generated by openapi-typescript.
1731
+ * Do not make direct changes to the file.
1732
+ */
1733
+ interface paths {
1734
+ '/{apiVersion}/context/knowledge-bases': {
1735
+ parameters: {
1736
+ query?: never;
1737
+ header?: never;
1738
+ path?: never;
1739
+ cookie?: never;
1740
+ };
1741
+ /**
1742
+ * List knowledge bases
1743
+ * @description Returns the organization's knowledge bases visible to the caller, cursor-paginated.
1744
+ */
1745
+ get: operations['listKnowledgeBases'];
1746
+ put?: never;
1747
+ /**
1748
+ * Create a knowledge base
1749
+ * @description Creates a knowledge base bound to a Sanity dataset, where its content documents will be stored.
1750
+ */
1751
+ post: operations['createKnowledgeBase'];
1752
+ delete?: never;
1753
+ options?: never;
1754
+ head?: never;
1755
+ patch?: never;
1756
+ trace?: never;
1757
+ };
1758
+ '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}': {
1759
+ parameters: {
1760
+ query?: never;
1761
+ header?: never;
1762
+ path?: never;
1763
+ cookie?: never;
1764
+ };
1765
+ /**
1766
+ * Get a knowledge base
1767
+ * @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.
1768
+ */
1769
+ get: operations['getKnowledgeBase'];
1770
+ put?: never;
1771
+ post?: never;
1772
+ /**
1773
+ * Delete a knowledge base
1774
+ * @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.
1775
+ */
1776
+ delete: operations['deleteKnowledgeBase'];
1777
+ options?: never;
1778
+ head?: never;
1779
+ /**
1780
+ * Update a knowledge base
1781
+ * @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.
1782
+ */
1783
+ patch: operations['updateKnowledgeBase'];
1784
+ trace?: never;
1785
+ };
1786
+ '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/build': {
1787
+ parameters: {
1788
+ query?: never;
1789
+ header?: never;
1790
+ path?: never;
1791
+ cookie?: never;
1792
+ };
1793
+ get?: never;
1794
+ put?: never;
1795
+ /**
1796
+ * Trigger a knowledge base build
1797
+ * @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.
1798
+ */
1799
+ post: operations['buildKnowledgeBase'];
1800
+ delete?: never;
1801
+ options?: never;
1802
+ head?: never;
1803
+ patch?: never;
1804
+ trace?: never;
1805
+ };
1806
+ '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/build/cancel': {
1807
+ parameters: {
1808
+ query?: never;
1809
+ header?: never;
1810
+ path?: never;
1811
+ cookie?: never;
1812
+ };
1813
+ get?: never;
1814
+ put?: never;
1815
+ /**
1816
+ * Cancel an in-progress build
1817
+ * @description Cancels the running build and resets the knowledge base so it can be rebuilt.
1818
+ */
1819
+ post: operations['cancelKnowledgeBaseBuild'];
1820
+ delete?: never;
1821
+ options?: never;
1822
+ head?: never;
1823
+ patch?: never;
1824
+ trace?: never;
1825
+ };
1826
+ '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/entries/{entryPath}/rebuild': {
1827
+ parameters: {
1828
+ query?: never;
1829
+ header?: never;
1830
+ path?: never;
1831
+ cookie?: never;
1832
+ };
1833
+ get?: never;
1834
+ put?: never;
1835
+ /**
1836
+ * Rebuild an entry from its sources
1837
+ * @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.
1838
+ */
1839
+ post: operations['rebuildEntry'];
1840
+ delete?: never;
1841
+ options?: never;
1842
+ head?: never;
1843
+ patch?: never;
1844
+ trace?: never;
1845
+ };
1846
+ '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/imports': {
1847
+ parameters: {
1848
+ query?: never;
1849
+ header?: never;
1850
+ path?: never;
1851
+ cookie?: never;
1852
+ };
1853
+ /**
1854
+ * List imports
1855
+ * @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`.
1856
+ */
1857
+ get: operations['listImports'];
1858
+ put?: never;
1859
+ /**
1860
+ * Create an import (text, crawl, or dataset)
1861
+ * @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.
1862
+ */
1863
+ post: operations['createImport'];
1864
+ delete?: never;
1865
+ options?: never;
1866
+ head?: never;
1867
+ patch?: never;
1868
+ trace?: never;
1869
+ };
1870
+ '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/imports/uploads': {
1871
+ parameters: {
1872
+ query?: never;
1873
+ header?: never;
1874
+ path?: never;
1875
+ cookie?: never;
1876
+ };
1877
+ get?: never;
1878
+ put?: never;
1879
+ /**
1880
+ * Start a file-upload import
1881
+ * @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.
1882
+ */
1883
+ post: operations['startUpload'];
1884
+ delete?: never;
1885
+ options?: never;
1886
+ head?: never;
1887
+ patch?: never;
1888
+ trace?: never;
1889
+ };
1890
+ '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/imports/uploads/{importId}/complete': {
1891
+ parameters: {
1892
+ query?: never;
1893
+ header?: never;
1894
+ path?: never;
1895
+ cookie?: never;
1896
+ };
1897
+ get?: never;
1898
+ put?: never;
1899
+ /**
1900
+ * Complete a file-upload import
1901
+ * @description Call after the file bytes are uploaded to the signed URL. Starts processing and returns a job id to poll.
1902
+ */
1903
+ post: operations['completeUpload'];
1904
+ delete?: never;
1905
+ options?: never;
1906
+ head?: never;
1907
+ patch?: never;
1908
+ trace?: never;
1909
+ };
1910
+ '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/imports/{importId}': {
1911
+ parameters: {
1912
+ query?: never;
1913
+ header?: never;
1914
+ path?: never;
1915
+ cookie?: never;
1916
+ };
1917
+ /**
1918
+ * Get a single import
1919
+ * @description Returns one import with its kind and processing status.
1920
+ */
1921
+ get: operations['getImport'];
1922
+ put?: never;
1923
+ post?: never;
1924
+ /**
1925
+ * Delete an import
1926
+ * @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.
1927
+ */
1928
+ delete: operations['deleteImport'];
1929
+ options?: never;
1930
+ head?: never;
1931
+ patch?: never;
1932
+ trace?: never;
1933
+ };
1934
+ '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/imports/{importId}/download': {
1935
+ parameters: {
1936
+ query?: never;
1937
+ header?: never;
1938
+ path?: never;
1939
+ cookie?: never;
1940
+ };
1941
+ /**
1942
+ * Get a download URL for an import
1943
+ * @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`.
1944
+ */
1945
+ get: operations['downloadImport'];
1946
+ put?: never;
1947
+ post?: never;
1948
+ delete?: never;
1949
+ options?: never;
1950
+ head?: never;
1951
+ patch?: never;
1952
+ trace?: never;
1953
+ };
1954
+ '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/instructions': {
1955
+ parameters: {
1956
+ query?: never;
1957
+ header?: never;
1958
+ path?: never;
1959
+ cookie?: never;
1960
+ };
1961
+ get?: never;
1962
+ put?: never;
1963
+ /**
1964
+ * Author a human instruction
1965
+ * @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.
1966
+ */
1967
+ post: operations['createInstruction'];
1968
+ delete?: never;
1969
+ options?: never;
1970
+ head?: never;
1971
+ patch?: never;
1972
+ trace?: never;
1973
+ };
1974
+ '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/instructions/{instructionId}': {
1975
+ parameters: {
1976
+ query?: never;
1977
+ header?: never;
1978
+ path?: never;
1979
+ cookie?: never;
1980
+ };
1981
+ get?: never;
1982
+ put?: never;
1983
+ post?: never;
1984
+ /**
1985
+ * Delete an instruction
1986
+ * @description Deletes the rule. Builds stop honoring it from the next run.
1987
+ */
1988
+ delete: operations['deleteInstruction'];
1989
+ options?: never;
1990
+ head?: never;
1991
+ /**
1992
+ * Edit an instruction
1993
+ * @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.
1994
+ */
1995
+ patch: operations['updateInstruction'];
1996
+ trace?: never;
1997
+ };
1998
+ '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/issues/apply': {
1999
+ parameters: {
2000
+ query?: never;
2001
+ header?: never;
2002
+ path?: never;
2003
+ cookie?: never;
2004
+ };
2005
+ get?: never;
2006
+ put?: never;
2007
+ /**
2008
+ * Apply accepted issues to a Context
2009
+ * @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.
2010
+ */
2011
+ post: operations['applyIssues'];
2012
+ delete?: never;
2013
+ options?: never;
2014
+ head?: never;
2015
+ patch?: never;
2016
+ trace?: never;
2017
+ };
2018
+ '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/issues/{issueId}/dismiss': {
2019
+ parameters: {
2020
+ query?: never;
2021
+ header?: never;
2022
+ path?: never;
2023
+ cookie?: never;
2024
+ };
2025
+ get?: never;
2026
+ put?: never;
2027
+ /**
2028
+ * Dismiss an issue
2029
+ * @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.
2030
+ */
2031
+ post: operations['dismissIssue'];
2032
+ delete?: never;
2033
+ options?: never;
2034
+ head?: never;
2035
+ patch?: never;
2036
+ trace?: never;
2037
+ };
2038
+ '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/issues/{issueId}/reopen': {
2039
+ parameters: {
2040
+ query?: never;
2041
+ header?: never;
2042
+ path?: never;
2043
+ cookie?: never;
2044
+ };
2045
+ get?: never;
2046
+ put?: never;
2047
+ /**
2048
+ * Reopen an accepted conflict
2049
+ * @description Returns an accepted conflict to triage, clearing its resolution and deleting the instruction it minted. Idempotent for issues that are not accepted conflicts.
2050
+ */
2051
+ post: operations['reopenIssue'];
2052
+ delete?: never;
2053
+ options?: never;
2054
+ head?: never;
2055
+ patch?: never;
2056
+ trace?: never;
2057
+ };
2058
+ '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/issues/{issueId}/resolve': {
2059
+ parameters: {
2060
+ query?: never;
2061
+ header?: never;
2062
+ path?: never;
2063
+ cookie?: never;
2064
+ };
2065
+ get?: never;
2066
+ put?: never;
2067
+ /**
2068
+ * Resolve a conflict issue
2069
+ * @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.
2070
+ */
2071
+ post: operations['resolveIssue'];
2072
+ delete?: never;
2073
+ options?: never;
2074
+ head?: never;
2075
+ patch?: never;
2076
+ trace?: never;
2077
+ };
2078
+ '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/jobs/{jobId}': {
2079
+ parameters: {
2080
+ query?: never;
2081
+ header?: never;
2082
+ path?: never;
2083
+ cookie?: never;
2084
+ };
2085
+ /**
2086
+ * Get a job by id
2087
+ * @description Returns the status of a job, such as a build or an import. Job ids come from the endpoint that queued the work.
2088
+ */
2089
+ get: operations['getJob'];
2090
+ put?: never;
2091
+ post?: never;
2092
+ delete?: never;
2093
+ options?: never;
2094
+ head?: never;
2095
+ patch?: never;
2096
+ trace?: never;
2097
+ };
2098
+ '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/refresh': {
2099
+ parameters: {
2100
+ query?: never;
2101
+ header?: never;
2102
+ path?: never;
2103
+ cookie?: never;
2104
+ };
2105
+ get?: never;
2106
+ put?: never;
2107
+ /**
2108
+ * Trigger an incremental refresh
2109
+ * @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.
2110
+ */
2111
+ post: operations['refreshKnowledgeBase'];
2112
+ delete?: never;
2113
+ options?: never;
2114
+ head?: never;
2115
+ patch?: never;
2116
+ trace?: never;
2117
+ };
2118
+ '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/sources': {
2119
+ parameters: {
2120
+ query?: never;
2121
+ header?: never;
2122
+ path?: never;
2123
+ cookie?: never;
2124
+ };
2125
+ /**
2126
+ * List sources
2127
+ * @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`.
2128
+ */
2129
+ get: operations['listSources'];
2130
+ put?: never;
2131
+ post?: never;
2132
+ delete?: never;
2133
+ options?: never;
2134
+ head?: never;
2135
+ patch?: never;
2136
+ trace?: never;
2137
+ };
2138
+ '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/sources/{sourceId}': {
2139
+ parameters: {
2140
+ query?: never;
2141
+ header?: never;
2142
+ path?: never;
2143
+ cookie?: never;
2144
+ };
2145
+ /**
2146
+ * Get a single source
2147
+ * @description Returns one source with its metadata and processing status.
2148
+ */
2149
+ get: operations['getSource'];
2150
+ put?: never;
2151
+ post?: never;
2152
+ /**
2153
+ * Delete a source
2154
+ * @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.
2155
+ */
2156
+ delete: operations['deleteSource'];
2157
+ options?: never;
2158
+ head?: never;
2159
+ patch?: never;
2160
+ trace?: never;
2161
+ };
2162
+ '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}/sources/{sourceId}/content': {
2163
+ parameters: {
2164
+ query?: never;
2165
+ header?: never;
2166
+ path?: never;
2167
+ cookie?: never;
2168
+ };
2169
+ /**
2170
+ * Read a source's distilled content
2171
+ * @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.
2172
+ */
2173
+ get: operations['getSourceContent'];
2174
+ put?: never;
2175
+ post?: never;
2176
+ delete?: never;
2177
+ options?: never;
2178
+ head?: never;
2179
+ patch?: never;
2180
+ trace?: never;
2181
+ };
2182
+ '/{apiVersion}/context/organizations/{organizationId}/conversations/{threadId}': {
2183
+ parameters: {
2184
+ query?: never;
2185
+ header?: never;
2186
+ path?: never;
2187
+ cookie?: never;
2188
+ };
2189
+ get?: never;
2190
+ /**
2191
+ * Record a conversation
2192
+ * @description Upserts the conversation telemetry for one thread. `threadId` identifies the conversation within your organization — reuse means the same conversation. Messages replace the stored transcript wholesale; `metadata` and model fields only overwrite when present. Last write per thread wins — retries are safe.
2193
+ */
2194
+ put: operations['saveConversation'];
2195
+ post?: never;
2196
+ delete?: never;
2197
+ options?: never;
2198
+ head?: never;
2199
+ /**
2200
+ * Record a classification verdict
2201
+ * @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.
2202
+ */
2203
+ patch: operations['classifyConversation'];
2204
+ trace?: never;
2205
+ };
2206
+ }
2207
+ interface components {
2208
+ schemas: {
2209
+ /** @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. */
2210
+ ConversationDoc: {
2211
+ _id: string;
2212
+ _rev: string;
2213
+ /** Format: date-time */
2214
+ _createdAt: string;
2215
+ /** Format: date-time */
2216
+ _updatedAt: string;
2217
+ /** @enum {string} */
2218
+ _type: 'sanity.context.conversation';
2219
+ /** @enum {number} */
2220
+ schemaVersion: 1;
2221
+ organizationId: string;
2222
+ threadId: string;
2223
+ /** @description ConversationMetadata */
2224
+ metadata: {
2225
+ [key: string]: string | string[];
2226
+ } | null;
2227
+ /** Format: date-time */
2228
+ startedAt: string;
2229
+ /** Format: date-time */
2230
+ messagesUpdatedAt: string;
2231
+ messages: {
2232
+ /** @enum {string} */
2233
+ role: 'user' | 'assistant' | 'system' | 'tool';
2234
+ /** @default null */
2235
+ content: string | null;
2236
+ /** @default null */
2237
+ toolName: string | null;
2238
+ /**
2239
+ * @default null
2240
+ * @enum {string|null}
2241
+ */
2242
+ toolType: 'call' | 'result' | null;
2243
+ }[];
2244
+ modelProvider: string | null;
2245
+ modelId: string | null;
2246
+ /** @description ConversationTokenUsage */
2247
+ tokenUsage: {
2248
+ inputTokens?: number;
2249
+ outputTokens?: number;
2250
+ totalTokens?: number;
2251
+ } | null;
2252
+ /** @description ConversationCoreMetrics */
2253
+ coreMetrics: {
2254
+ successScore?: number;
2255
+ /** @enum {string} */
2256
+ sentiment?: 'positive' | 'neutral' | 'negative';
2257
+ contentGaps?: string[];
2258
+ } | null;
2259
+ /** Format: date-time */
2260
+ classifiedAt: string | null;
2261
+ classificationError: string | null;
2262
+ };
2263
+ /** @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. */
2264
+ EntryDoc: {
2265
+ _id: string;
2266
+ _rev: string;
2267
+ /** Format: date-time */
2268
+ _createdAt: string;
2269
+ /** Format: date-time */
2270
+ _updatedAt: string;
2271
+ knowledgeBaseId: string;
2272
+ /** @enum {string} */
2273
+ _type: 'sanity.context.entry';
2274
+ schemaVersion: number;
2275
+ revisionId: string;
2276
+ path: string;
2277
+ title: string;
2278
+ tldr?: {
2279
+ scope: string;
2280
+ excludes: string;
2281
+ neighbors?: string[];
2282
+ /** @enum {string} */
2283
+ centrality: 'core' | 'standard' | 'peripheral';
2284
+ };
2285
+ body?: string;
2286
+ topicHeadings?: string[];
2287
+ citations?: {
2288
+ sourceId: string;
2289
+ supports?: string;
2290
+ spans?: {
2291
+ sourceLineStart: number;
2292
+ sourceLineEnd: number;
2293
+ quote: string;
2294
+ }[];
2295
+ claim?: {
2296
+ exact: string;
2297
+ prefix?: string;
2298
+ suffix?: string;
2299
+ };
2300
+ /** @enum {string} */
2301
+ groundingState?: 'drifted';
2302
+ _key: string;
2303
+ /** @enum {string} */
2304
+ _type: 'sanity.context.citation';
2305
+ filename: string;
2306
+ mime?: string;
2307
+ excerpt?: string;
2308
+ }[];
2309
+ /** @enum {string} */
2310
+ status: 'virtual' | 'outlined' | 'filled' | 'stale' | 'generation_failed';
2311
+ generatedAt: string;
2312
+ };
2313
+ /** @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. */
2314
+ InstructionDoc: {
2315
+ _id: string;
2316
+ _rev: string;
2317
+ /** Format: date-time */
2318
+ _createdAt: string;
2319
+ /** Format: date-time */
2320
+ _updatedAt: string;
2321
+ knowledgeBaseId: string;
2322
+ /** @enum {string} */
2323
+ _type: 'sanity.context.instruction';
2324
+ /** @enum {number} */
2325
+ schemaVersion: 1;
2326
+ statement: string;
2327
+ scopeSources: {
2328
+ _key: string;
2329
+ sourceId: string;
2330
+ contentHash: string;
2331
+ }[] | null;
2332
+ /** @enum {string} */
2333
+ status: 'active' | 'archived';
2334
+ archivedAt: string | null;
2335
+ archivedReason: string | null;
2336
+ /** @enum {string} */
2337
+ origin: 'conflict';
2338
+ sourceIssueId: string;
2339
+ } | {
2340
+ _id: string;
2341
+ _rev: string;
2342
+ /** Format: date-time */
2343
+ _createdAt: string;
2344
+ /** Format: date-time */
2345
+ _updatedAt: string;
2346
+ knowledgeBaseId: string;
2347
+ /** @enum {string} */
2348
+ _type: 'sanity.context.instruction';
2349
+ /** @enum {number} */
2350
+ schemaVersion: 1;
2351
+ statement: string;
2352
+ scopeSources: {
2353
+ _key: string;
2354
+ sourceId: string;
2355
+ contentHash: string;
2356
+ }[] | null;
2357
+ /** @enum {string} */
2358
+ status: 'active' | 'archived';
2359
+ archivedAt: string | null;
2360
+ archivedReason: string | null;
2361
+ /** @enum {string} */
2362
+ origin: 'human';
2363
+ /** @enum {string|null} */
2364
+ sourceIssueId: null;
2365
+ };
2366
+ /** @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`. */
2367
+ IssueDoc: {
2368
+ _id: string;
2369
+ _rev: string;
2370
+ /** Format: date-time */
2371
+ _createdAt: string;
2372
+ /** Format: date-time */
2373
+ _updatedAt: string;
2374
+ knowledgeBaseId: string;
2375
+ /** @enum {string} */
2376
+ _type: 'sanity.context.issue';
2377
+ /** @enum {number} */
2378
+ schemaVersion: 1;
2379
+ /** @description IssueContent */
2380
+ content: {
2381
+ /** @enum {string} */
2382
+ kind: 'conflict' | 'gap' | 'update_required' | 'add_entry' | 'remove_entry' | 'split_entry' | 'merge_entry';
2383
+ /** @enum {string} */
2384
+ severity: 'critical' | 'suggestion';
2385
+ scopePath: string;
2386
+ issue: string;
2387
+ suggestedFix: string;
2388
+ citedSourceIds?: string[];
2389
+ claimKey?: string;
2390
+ involvedScopes?: string[];
2391
+ currentClaim?: string;
2392
+ alternativeClaim?: string;
2393
+ /** @enum {string} */
2394
+ currentAuthority?: 'primary' | 'secondary' | 'community';
2395
+ /** @enum {string} */
2396
+ alternativeAuthority?: 'primary' | 'secondary' | 'community';
2397
+ /** @enum {string} */
2398
+ suggestedResolution?: 'keep_existing' | 'accept_new';
2399
+ };
2400
+ fingerprint: string;
2401
+ revisionId: string | null;
2402
+ /** @enum {string} */
2403
+ status: 'open';
2404
+ /** @enum {string|null} */
2405
+ resolution: null;
2406
+ /** @enum {string|null} */
2407
+ resolvedAt: null;
2408
+ /** @enum {string|null} */
2409
+ resolvedBy: null;
2410
+ } | {
2411
+ _id: string;
2412
+ _rev: string;
2413
+ /** Format: date-time */
2414
+ _createdAt: string;
2415
+ /** Format: date-time */
2416
+ _updatedAt: string;
2417
+ knowledgeBaseId: string;
2418
+ /** @enum {string} */
2419
+ _type: 'sanity.context.issue';
2420
+ /** @enum {number} */
2421
+ schemaVersion: 1;
2422
+ /** @description IssueContent */
2423
+ content: {
2424
+ /** @enum {string} */
2425
+ kind: 'conflict' | 'gap' | 'update_required' | 'add_entry' | 'remove_entry' | 'split_entry' | 'merge_entry';
2426
+ /** @enum {string} */
2427
+ severity: 'critical' | 'suggestion';
2428
+ scopePath: string;
2429
+ issue: string;
2430
+ suggestedFix: string;
2431
+ citedSourceIds?: string[];
2432
+ claimKey?: string;
2433
+ involvedScopes?: string[];
2434
+ currentClaim?: string;
2435
+ alternativeClaim?: string;
2436
+ /** @enum {string} */
2437
+ currentAuthority?: 'primary' | 'secondary' | 'community';
2438
+ /** @enum {string} */
2439
+ alternativeAuthority?: 'primary' | 'secondary' | 'community';
2440
+ /** @enum {string} */
2441
+ suggestedResolution?: 'keep_existing' | 'accept_new';
2442
+ };
2443
+ fingerprint: string;
2444
+ revisionId: string | null;
2445
+ /** @enum {string} */
2446
+ status: 'accepted';
2447
+ /** Format: date-time */
2448
+ resolvedAt: string;
2449
+ resolvedBy: {
2450
+ id: string;
2451
+ /** @enum {string} */
2452
+ kind: 'user' | 'robot';
2453
+ } | null;
2454
+ /** @enum {string|null} */
2455
+ resolution: 'keep_existing' | 'accept_new' | null;
2456
+ } | {
2457
+ _id: string;
2458
+ _rev: string;
2459
+ /** Format: date-time */
2460
+ _createdAt: string;
2461
+ /** Format: date-time */
2462
+ _updatedAt: string;
2463
+ knowledgeBaseId: string;
2464
+ /** @enum {string} */
2465
+ _type: 'sanity.context.issue';
2466
+ /** @enum {number} */
2467
+ schemaVersion: 1;
2468
+ /** @description IssueContent */
2469
+ content: {
2470
+ /** @enum {string} */
2471
+ kind: 'conflict' | 'gap' | 'update_required' | 'add_entry' | 'remove_entry' | 'split_entry' | 'merge_entry';
2472
+ /** @enum {string} */
2473
+ severity: 'critical' | 'suggestion';
2474
+ scopePath: string;
2475
+ issue: string;
2476
+ suggestedFix: string;
2477
+ citedSourceIds?: string[];
2478
+ claimKey?: string;
2479
+ involvedScopes?: string[];
2480
+ currentClaim?: string;
2481
+ alternativeClaim?: string;
2482
+ /** @enum {string} */
2483
+ currentAuthority?: 'primary' | 'secondary' | 'community';
2484
+ /** @enum {string} */
2485
+ alternativeAuthority?: 'primary' | 'secondary' | 'community';
2486
+ /** @enum {string} */
2487
+ suggestedResolution?: 'keep_existing' | 'accept_new';
2488
+ };
2489
+ fingerprint: string;
2490
+ revisionId: string | null;
2491
+ /** @enum {string} */
2492
+ status: 'rejected';
2493
+ /** Format: date-time */
2494
+ resolvedAt: string;
2495
+ resolvedBy: {
2496
+ id: string;
2497
+ /** @enum {string} */
2498
+ kind: 'user' | 'robot';
2499
+ } | null;
2500
+ /** @enum {string|null} */
2501
+ resolution: null;
2502
+ };
2503
+ /** @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. */
2504
+ McpDoc: {
2505
+ _id: string;
2506
+ _rev: string;
2507
+ /** Format: date-time */
2508
+ _createdAt: string;
2509
+ /** Format: date-time */
2510
+ _updatedAt: string;
2511
+ /** @enum {string} */
2512
+ _type: 'sanity.context.mcp';
2513
+ /** @enum {number} */
2514
+ schemaVersion: 1;
2515
+ organizationId: string;
2516
+ publicId: string;
2517
+ title: string;
2518
+ name: string;
2519
+ sources: ({
2520
+ /** @enum {string} */
2521
+ type: 'knowledge-base';
2522
+ id: string;
2523
+ } | {
2524
+ /** @enum {string} */
2525
+ type: 'dataset';
2526
+ id: string;
2527
+ })[];
2528
+ instructions: string | null;
2529
+ groqFilter: string | null;
2530
+ };
2531
+ };
2532
+ responses: never;
2533
+ parameters: never;
2534
+ requestBodies: never;
2535
+ headers: never;
2536
+ pathItems: never;
2537
+ }
2538
+ interface operations {
2539
+ listKnowledgeBases: {
2540
+ parameters: {
2541
+ query: {
2542
+ cursor?: string;
2543
+ limit?: number;
2544
+ organizationId: string;
2545
+ };
2546
+ header?: never;
2547
+ path: {
2548
+ apiVersion: string;
2549
+ };
2550
+ cookie?: never;
2551
+ };
2552
+ requestBody?: never;
2553
+ responses: {
2554
+ /** @description Default Response */
2555
+ 200: {
2556
+ headers: {
2557
+ [name: string]: unknown;
2558
+ };
2559
+ content: {
2560
+ 'application/json': {
2561
+ data: {
2562
+ /** Format: uuid */
2563
+ id: string;
2564
+ publicId: string;
2565
+ organizationId: string;
2566
+ title: string;
2567
+ description: string;
2568
+ /** @enum {string} */
2569
+ state: 'created' | 'building' | 'ready' | 'review' | 'stale' | 'paused';
2570
+ activeJobId: string | null;
2571
+ isBuilding: boolean;
2572
+ buildStageState: {
2573
+ jobId: string;
2574
+ stages: {
2575
+ /** @enum {string} */
2576
+ id: 'tldr' | 'map' | 'triage' | 'plan' | 'organize' | 'arrange' | 'write' | 'review' | 'polish';
2577
+ /** @enum {string} */
2578
+ status: 'pending' | 'running' | 'done' | 'failed';
2579
+ units?: {
2580
+ /** @enum {string} */
2581
+ unit: 'sources' | 'groups' | 'entries' | 'rounds';
2582
+ done: number;
2583
+ total?: number;
2584
+ };
2585
+ }[];
2586
+ } | null;
2587
+ /** Format: date-time */
2588
+ lastCheckedAt: string | null;
2589
+ /** Format: date-time */
2590
+ lastChangedAt: string | null;
2591
+ hasPendingChanges: boolean;
2592
+ pendingChanges: {
2593
+ added: number;
2594
+ changed: number;
2595
+ removed: number;
2596
+ } | null;
2597
+ pipelineOutdated: boolean;
2598
+ rebuildRecommended: {
2599
+ reason: string;
2600
+ /** Format: date-time */
2601
+ at: string;
2602
+ } | null;
2603
+ hasWebSource: boolean;
2604
+ hasDatasetSource: boolean;
2605
+ sourceUsage: {
2606
+ used: number;
2607
+ limit: number;
2608
+ } | null;
2609
+ refreshEnabled: boolean;
2610
+ /** @enum {string} */
2611
+ refreshFrequency: 'weekly' | 'monthly';
2612
+ /** Format: date-time */
2613
+ refreshNextRunAt: string | null;
2614
+ refreshInFlight: boolean;
2615
+ openIssueCount: number;
2616
+ instructionCount: number;
2617
+ /** Format: date-time */
2618
+ createdAt: string;
2619
+ /** Format: date-time */
2620
+ updatedAt: string;
2621
+ }[];
2622
+ nextCursor: string | null;
2623
+ };
2624
+ };
2625
+ };
2626
+ };
2627
+ };
2628
+ createKnowledgeBase: {
2629
+ parameters: {
2630
+ query?: never;
2631
+ header?: never;
2632
+ path: {
2633
+ apiVersion: string;
2634
+ };
2635
+ cookie?: never;
2636
+ };
2637
+ requestBody: {
2638
+ content: {
2639
+ 'application/json': {
2640
+ organizationId: string;
2641
+ title: string;
2642
+ description: string;
2643
+ };
2644
+ };
2645
+ };
2646
+ responses: {
2647
+ /** @description KnowledgeBase */
2648
+ 201: {
2649
+ headers: {
2650
+ [name: string]: unknown;
2651
+ };
2652
+ content: {
2653
+ 'application/json': {
2654
+ /** Format: uuid */
2655
+ id: string;
2656
+ publicId: string;
2657
+ organizationId: string;
2658
+ title: string;
2659
+ description: string;
2660
+ /** @enum {string} */
2661
+ state: 'created' | 'building' | 'ready' | 'review' | 'stale' | 'paused';
2662
+ activeJobId: string | null;
2663
+ isBuilding: boolean;
2664
+ buildStageState: {
2665
+ jobId: string;
2666
+ stages: {
2667
+ /** @enum {string} */
2668
+ id: 'tldr' | 'map' | 'triage' | 'plan' | 'organize' | 'arrange' | 'write' | 'review' | 'polish';
2669
+ /** @enum {string} */
2670
+ status: 'pending' | 'running' | 'done' | 'failed';
2671
+ units?: {
2672
+ /** @enum {string} */
2673
+ unit: 'sources' | 'groups' | 'entries' | 'rounds';
2674
+ done: number;
2675
+ total?: number;
2676
+ };
2677
+ }[];
2678
+ } | null;
2679
+ /** Format: date-time */
2680
+ lastCheckedAt: string | null;
2681
+ /** Format: date-time */
2682
+ lastChangedAt: string | null;
2683
+ hasPendingChanges: boolean;
2684
+ pendingChanges: {
2685
+ added: number;
2686
+ changed: number;
2687
+ removed: number;
2688
+ } | null;
2689
+ pipelineOutdated: boolean;
2690
+ rebuildRecommended: {
2691
+ reason: string;
2692
+ /** Format: date-time */
2693
+ at: string;
2694
+ } | null;
2695
+ hasWebSource: boolean;
2696
+ hasDatasetSource: boolean;
2697
+ sourceUsage: {
2698
+ used: number;
2699
+ limit: number;
2700
+ } | null;
2701
+ refreshEnabled: boolean;
2702
+ /** @enum {string} */
2703
+ refreshFrequency: 'weekly' | 'monthly';
2704
+ /** Format: date-time */
2705
+ refreshNextRunAt: string | null;
2706
+ refreshInFlight: boolean;
2707
+ openIssueCount: number;
2708
+ instructionCount: number;
2709
+ /** Format: date-time */
2710
+ createdAt: string;
2711
+ /** Format: date-time */
2712
+ updatedAt: string;
2713
+ };
2714
+ };
2715
+ };
2716
+ };
2717
+ };
2718
+ getKnowledgeBase: {
2719
+ parameters: {
2720
+ query?: never;
2721
+ header?: never;
2722
+ path: {
2723
+ knowledgeBaseId: string;
2724
+ };
2725
+ cookie?: never;
2726
+ };
2727
+ requestBody?: never;
2728
+ responses: {
2729
+ /** @description KnowledgeBase */
2730
+ 200: {
2731
+ headers: {
2732
+ [name: string]: unknown;
2733
+ };
2734
+ content: {
2735
+ 'application/json': {
2736
+ /** Format: uuid */
2737
+ id: string;
2738
+ publicId: string;
2739
+ organizationId: string;
2740
+ title: string;
2741
+ description: string;
2742
+ /** @enum {string} */
2743
+ state: 'created' | 'building' | 'ready' | 'review' | 'stale' | 'paused';
2744
+ activeJobId: string | null;
2745
+ isBuilding: boolean;
2746
+ buildStageState: {
2747
+ jobId: string;
2748
+ stages: {
2749
+ /** @enum {string} */
2750
+ id: 'tldr' | 'map' | 'triage' | 'plan' | 'organize' | 'arrange' | 'write' | 'review' | 'polish';
2751
+ /** @enum {string} */
2752
+ status: 'pending' | 'running' | 'done' | 'failed';
2753
+ units?: {
2754
+ /** @enum {string} */
2755
+ unit: 'sources' | 'groups' | 'entries' | 'rounds';
2756
+ done: number;
2757
+ total?: number;
2758
+ };
2759
+ }[];
2760
+ } | null;
2761
+ /** Format: date-time */
2762
+ lastCheckedAt: string | null;
2763
+ /** Format: date-time */
2764
+ lastChangedAt: string | null;
2765
+ hasPendingChanges: boolean;
2766
+ pendingChanges: {
2767
+ added: number;
2768
+ changed: number;
2769
+ removed: number;
2770
+ } | null;
2771
+ pipelineOutdated: boolean;
2772
+ rebuildRecommended: {
2773
+ reason: string;
2774
+ /** Format: date-time */
2775
+ at: string;
2776
+ } | null;
2777
+ hasWebSource: boolean;
2778
+ hasDatasetSource: boolean;
2779
+ sourceUsage: {
2780
+ used: number;
2781
+ limit: number;
2782
+ } | null;
2783
+ refreshEnabled: boolean;
2784
+ /** @enum {string} */
2785
+ refreshFrequency: 'weekly' | 'monthly';
2786
+ /** Format: date-time */
2787
+ refreshNextRunAt: string | null;
2788
+ refreshInFlight: boolean;
2789
+ openIssueCount: number;
2790
+ instructionCount: number;
2791
+ /** Format: date-time */
2792
+ createdAt: string;
2793
+ /** Format: date-time */
2794
+ updatedAt: string;
2795
+ };
2796
+ };
2797
+ };
2798
+ };
2799
+ };
2800
+ deleteKnowledgeBase: {
2801
+ parameters: {
2802
+ query?: never;
2803
+ header?: never;
2804
+ path: {
2805
+ knowledgeBaseId: string;
2806
+ };
2807
+ cookie?: never;
2808
+ };
2809
+ requestBody?: never;
2810
+ responses: {
2811
+ /** @description Default Response */
2812
+ 204: {
2813
+ headers: {
2814
+ [name: string]: unknown;
2815
+ };
2816
+ content: {
2817
+ 'application/json': null;
2818
+ };
2819
+ };
2820
+ };
2821
+ };
2822
+ updateKnowledgeBase: {
2823
+ parameters: {
2824
+ query?: never;
2825
+ header?: never;
2826
+ path: {
2827
+ knowledgeBaseId: string;
2828
+ };
2829
+ cookie?: never;
2830
+ };
2831
+ requestBody: {
2832
+ content: {
2833
+ 'application/json': {
2834
+ title?: string;
2835
+ description?: string;
2836
+ refreshEnabled?: boolean;
2837
+ /** @enum {string} */
2838
+ refreshFrequency?: 'weekly' | 'monthly';
2839
+ };
2840
+ };
2841
+ };
2842
+ responses: {
2843
+ /** @description KnowledgeBase */
2844
+ 200: {
2845
+ headers: {
2846
+ [name: string]: unknown;
2847
+ };
2848
+ content: {
2849
+ 'application/json': {
2850
+ /** Format: uuid */
2851
+ id: string;
2852
+ publicId: string;
2853
+ organizationId: string;
2854
+ title: string;
2855
+ description: string;
2856
+ /** @enum {string} */
2857
+ state: 'created' | 'building' | 'ready' | 'review' | 'stale' | 'paused';
2858
+ activeJobId: string | null;
2859
+ isBuilding: boolean;
2860
+ buildStageState: {
2861
+ jobId: string;
2862
+ stages: {
2863
+ /** @enum {string} */
2864
+ id: 'tldr' | 'map' | 'triage' | 'plan' | 'organize' | 'arrange' | 'write' | 'review' | 'polish';
2865
+ /** @enum {string} */
2866
+ status: 'pending' | 'running' | 'done' | 'failed';
2867
+ units?: {
2868
+ /** @enum {string} */
2869
+ unit: 'sources' | 'groups' | 'entries' | 'rounds';
2870
+ done: number;
2871
+ total?: number;
2872
+ };
2873
+ }[];
2874
+ } | null;
2875
+ /** Format: date-time */
2876
+ lastCheckedAt: string | null;
2877
+ /** Format: date-time */
2878
+ lastChangedAt: string | null;
2879
+ hasPendingChanges: boolean;
2880
+ pendingChanges: {
2881
+ added: number;
2882
+ changed: number;
2883
+ removed: number;
2884
+ } | null;
2885
+ pipelineOutdated: boolean;
2886
+ rebuildRecommended: {
2887
+ reason: string;
2888
+ /** Format: date-time */
2889
+ at: string;
2890
+ } | null;
2891
+ hasWebSource: boolean;
2892
+ hasDatasetSource: boolean;
2893
+ sourceUsage: {
2894
+ used: number;
2895
+ limit: number;
2896
+ } | null;
2897
+ refreshEnabled: boolean;
2898
+ /** @enum {string} */
2899
+ refreshFrequency: 'weekly' | 'monthly';
2900
+ /** Format: date-time */
2901
+ refreshNextRunAt: string | null;
2902
+ refreshInFlight: boolean;
2903
+ openIssueCount: number;
2904
+ instructionCount: number;
2905
+ /** Format: date-time */
2906
+ createdAt: string;
2907
+ /** Format: date-time */
2908
+ updatedAt: string;
2909
+ };
2910
+ };
2911
+ };
2912
+ };
2913
+ };
2914
+ buildKnowledgeBase: {
2915
+ parameters: {
2916
+ query?: never;
2917
+ header?: never;
2918
+ path: {
2919
+ knowledgeBaseId: string;
2920
+ };
2921
+ cookie?: never;
2922
+ };
2923
+ requestBody?: never;
2924
+ responses: {
2925
+ /** @description JobAccepted */
2926
+ 202: {
2927
+ headers: {
2928
+ [name: string]: unknown;
2929
+ };
2930
+ content: {
2931
+ 'application/json': {
2932
+ jobId: string;
2933
+ };
2934
+ };
2935
+ };
2936
+ };
2937
+ };
2938
+ cancelKnowledgeBaseBuild: {
2939
+ parameters: {
2940
+ query?: never;
2941
+ header?: never;
2942
+ path: {
2943
+ knowledgeBaseId: string;
2944
+ };
2945
+ cookie?: never;
2946
+ };
2947
+ requestBody?: never;
2948
+ responses: {
2949
+ /** @description Default Response */
2950
+ 200: {
2951
+ headers: {
2952
+ [name: string]: unknown;
2953
+ };
2954
+ content: {
2955
+ 'application/json': {
2956
+ cancelled: boolean;
2957
+ };
2958
+ };
2959
+ };
2960
+ };
2961
+ };
2962
+ rebuildEntry: {
2963
+ parameters: {
2964
+ query?: never;
2965
+ header?: never;
2966
+ path: {
2967
+ knowledgeBaseId: string;
2968
+ entryPath: string;
2969
+ };
2970
+ cookie?: never;
2971
+ };
2972
+ requestBody?: never;
2973
+ responses: {
2974
+ /** @description RebuildEntryResponse */
2975
+ 202: {
2976
+ headers: {
2977
+ [name: string]: unknown;
2978
+ };
2979
+ content: {
2980
+ 'application/json': {
2981
+ jobId: string;
2982
+ affectedEntries: {
2983
+ id: string;
2984
+ path: string;
2985
+ title: string;
2986
+ }[];
2987
+ };
2988
+ };
2989
+ };
2990
+ };
2991
+ };
2992
+ listImports: {
2993
+ parameters: {
2994
+ query?: {
2995
+ cursor?: string;
2996
+ limit?: number;
2997
+ };
2998
+ header?: never;
2999
+ path: {
3000
+ knowledgeBaseId: string;
3001
+ };
3002
+ cookie?: never;
3003
+ };
3004
+ requestBody?: never;
3005
+ responses: {
3006
+ /** @description Default Response */
3007
+ 200: {
3008
+ headers: {
3009
+ [name: string]: unknown;
3010
+ };
3011
+ content: {
3012
+ 'application/json': {
3013
+ data: {
3014
+ /** Format: uuid */
3015
+ id: string;
3016
+ /** Format: uuid */
3017
+ knowledgeBaseId: string;
3018
+ name: string | null;
3019
+ sizeBytes: number | null;
3020
+ /** @enum {string} */
3021
+ status: 'uploading' | 'processing' | 'complete' | 'failed';
3022
+ /** @enum {string} */
3023
+ sourceKind: 'web' | 'file' | 'dataset';
3024
+ /** Format: date-time */
3025
+ lastCheckedAt: string | null;
3026
+ sourceCount: number;
3027
+ totalDistillableCount: number;
3028
+ distilledCount: number;
3029
+ unsupportedCount: number;
3030
+ statusDetail: string | null;
3031
+ error: string | null;
3032
+ /** @description CrawlOptions */
3033
+ crawlOptions: {
3034
+ includePaths?: string[];
3035
+ excludePaths?: string[];
3036
+ maxDepth?: number;
3037
+ sitemapOnly?: boolean;
3038
+ ignoreQueryParameters?: boolean;
3039
+ pageLimit?: number;
3040
+ } | null;
3041
+ /** @description DatasetSourceBinding */
3042
+ datasetSource: {
3043
+ sanityProjectId: string;
3044
+ sanityDatasetId: string;
3045
+ query: string;
3046
+ } | null;
3047
+ /** @description Actor */
3048
+ createdBy: {
3049
+ id: string | null;
3050
+ displayName: string | null;
3051
+ } | null;
3052
+ /** Format: date-time */
3053
+ createdAt: string;
3054
+ /** Format: date-time */
3055
+ completedAt: string | null;
3056
+ }[];
3057
+ nextCursor: string | null;
3058
+ };
3059
+ };
3060
+ };
3061
+ };
3062
+ };
3063
+ createImport: {
3064
+ parameters: {
3065
+ query?: never;
3066
+ header?: never;
3067
+ path: {
3068
+ knowledgeBaseId: string;
3069
+ };
3070
+ cookie?: never;
3071
+ };
3072
+ /** @description CreateImportInput */
3073
+ requestBody: {
3074
+ content: {
3075
+ 'application/json': {
3076
+ /** @enum {string} */
3077
+ type: 'text';
3078
+ title: string;
3079
+ content: string;
3080
+ /**
3081
+ * @default text/markdown
3082
+ * @enum {string}
3083
+ */
3084
+ contentType?: 'text/markdown' | 'text/plain';
3085
+ } | {
3086
+ /** Format: uri */
3087
+ url: string;
3088
+ /** @description CrawlOptions */
3089
+ options?: {
3090
+ includePaths?: string[];
3091
+ excludePaths?: string[];
3092
+ maxDepth?: number;
3093
+ sitemapOnly?: boolean;
3094
+ ignoreQueryParameters?: boolean;
3095
+ pageLimit?: number;
3096
+ };
3097
+ /** @enum {string} */
3098
+ type: 'crawl';
3099
+ } | {
3100
+ sanityProjectId: string;
3101
+ sanityDatasetId: string;
3102
+ query: string;
3103
+ /** @enum {string} */
3104
+ type: 'dataset';
3105
+ };
3106
+ };
3107
+ };
3108
+ responses: {
3109
+ /** @description JobAccepted */
3110
+ 202: {
3111
+ headers: {
3112
+ [name: string]: unknown;
3113
+ };
3114
+ content: {
3115
+ 'application/json': {
3116
+ jobId: string;
3117
+ };
3118
+ };
3119
+ };
3120
+ };
3121
+ };
3122
+ startUpload: {
3123
+ parameters: {
3124
+ query?: never;
3125
+ header?: never;
3126
+ path: {
3127
+ knowledgeBaseId: string;
3128
+ };
3129
+ cookie?: never;
3130
+ };
3131
+ requestBody: {
3132
+ content: {
3133
+ 'application/json': {
3134
+ filename: string;
3135
+ contentType?: string;
3136
+ };
3137
+ };
3138
+ };
3139
+ responses: {
3140
+ /** @description Default Response */
3141
+ 201: {
3142
+ headers: {
3143
+ [name: string]: unknown;
3144
+ };
3145
+ content: {
3146
+ 'application/json': {
3147
+ /** Format: uuid */
3148
+ importId: string;
3149
+ /** Format: uri */
3150
+ uploadUrl: string;
3151
+ };
3152
+ };
3153
+ };
3154
+ };
3155
+ };
3156
+ completeUpload: {
3157
+ parameters: {
3158
+ query?: never;
3159
+ header?: never;
3160
+ path: {
3161
+ knowledgeBaseId: string;
3162
+ importId: string;
3163
+ };
3164
+ cookie?: never;
3165
+ };
3166
+ requestBody?: never;
3167
+ responses: {
3168
+ /** @description JobAccepted */
3169
+ 202: {
3170
+ headers: {
3171
+ [name: string]: unknown;
3172
+ };
3173
+ content: {
3174
+ 'application/json': {
3175
+ jobId: string;
3176
+ };
3177
+ };
3178
+ };
3179
+ };
3180
+ };
3181
+ getImport: {
3182
+ parameters: {
3183
+ query?: never;
3184
+ header?: never;
3185
+ path: {
3186
+ knowledgeBaseId: string;
3187
+ importId: string;
3188
+ };
3189
+ cookie?: never;
3190
+ };
3191
+ requestBody?: never;
3192
+ responses: {
3193
+ /** @description Import */
3194
+ 200: {
3195
+ headers: {
3196
+ [name: string]: unknown;
3197
+ };
3198
+ content: {
3199
+ 'application/json': {
3200
+ /** Format: uuid */
3201
+ id: string;
3202
+ /** Format: uuid */
3203
+ knowledgeBaseId: string;
3204
+ name: string | null;
3205
+ sizeBytes: number | null;
3206
+ /** @enum {string} */
3207
+ status: 'uploading' | 'processing' | 'complete' | 'failed';
3208
+ /** @enum {string} */
3209
+ sourceKind: 'web' | 'file' | 'dataset';
3210
+ /** Format: date-time */
3211
+ lastCheckedAt: string | null;
3212
+ sourceCount: number;
3213
+ totalDistillableCount: number;
3214
+ distilledCount: number;
3215
+ unsupportedCount: number;
3216
+ statusDetail: string | null;
3217
+ error: string | null;
3218
+ /** @description CrawlOptions */
3219
+ crawlOptions: {
3220
+ includePaths?: string[];
3221
+ excludePaths?: string[];
3222
+ maxDepth?: number;
3223
+ sitemapOnly?: boolean;
3224
+ ignoreQueryParameters?: boolean;
3225
+ pageLimit?: number;
3226
+ } | null;
3227
+ /** @description DatasetSourceBinding */
3228
+ datasetSource: {
3229
+ sanityProjectId: string;
3230
+ sanityDatasetId: string;
3231
+ query: string;
3232
+ } | null;
3233
+ /** @description Actor */
3234
+ createdBy: {
3235
+ id: string | null;
3236
+ displayName: string | null;
3237
+ } | null;
3238
+ /** Format: date-time */
3239
+ createdAt: string;
3240
+ /** Format: date-time */
3241
+ completedAt: string | null;
3242
+ };
3243
+ };
3244
+ };
3245
+ };
3246
+ };
3247
+ deleteImport: {
3248
+ parameters: {
3249
+ query?: never;
3250
+ header?: never;
3251
+ path: {
3252
+ knowledgeBaseId: string;
3253
+ importId: string;
3254
+ };
3255
+ cookie?: never;
3256
+ };
3257
+ requestBody?: never;
3258
+ responses: {
3259
+ /** @description Default Response */
3260
+ 204: {
3261
+ headers: {
3262
+ [name: string]: unknown;
3263
+ };
3264
+ content: {
3265
+ 'application/json': null;
3266
+ };
3267
+ };
3268
+ };
3269
+ };
3270
+ downloadImport: {
3271
+ parameters: {
3272
+ query?: never;
3273
+ header?: never;
3274
+ path: {
3275
+ knowledgeBaseId: string;
3276
+ importId: string;
3277
+ };
3278
+ cookie?: never;
3279
+ };
3280
+ requestBody?: never;
3281
+ responses: {
3282
+ /** @description Default Response */
3283
+ 200: {
3284
+ headers: {
3285
+ [name: string]: unknown;
3286
+ };
3287
+ content: {
3288
+ 'application/json': {
3289
+ /** Format: uri */
3290
+ url: string;
3291
+ /** Format: date-time */
3292
+ expiresAt: string;
3293
+ };
3294
+ };
3295
+ };
3296
+ };
3297
+ };
3298
+ createInstruction: {
3299
+ parameters: {
3300
+ query?: never;
3301
+ header?: never;
3302
+ path: {
3303
+ knowledgeBaseId: string;
3304
+ };
3305
+ cookie?: never;
3306
+ };
3307
+ /** @description CreateInstructionInput */
3308
+ requestBody: {
3309
+ content: {
3310
+ 'application/json': {
3311
+ statement: string;
3312
+ scopeSourceIds?: string[] | null;
3313
+ rebuildPaths?: string[];
3314
+ verified?: boolean;
3315
+ };
3316
+ };
3317
+ };
3318
+ responses: {
3319
+ /** @description CreateInstructionResponse */
3320
+ 201: {
3321
+ headers: {
3322
+ [name: string]: unknown;
3323
+ };
3324
+ content: {
3325
+ 'application/json': {
3326
+ /** @description Instruction */
3327
+ instruction: {
3328
+ id: string;
3329
+ knowledgeBaseId: string;
3330
+ /** @enum {string} */
3331
+ origin: 'conflict' | 'human';
3332
+ /** @enum {string} */
3333
+ status: 'active' | 'archived';
3334
+ statement: string;
3335
+ scopeSourceIds: string[] | null;
3336
+ /** Format: date-time */
3337
+ archivedAt: string | null;
3338
+ archivedReason: string | null;
3339
+ sourceIssueId: string | null;
3340
+ /** @description Actor */
3341
+ createdBy: {
3342
+ id: string | null;
3343
+ displayName: string | null;
3344
+ } | null;
3345
+ /** @description Actor */
3346
+ updatedBy: {
3347
+ id: string | null;
3348
+ displayName: string | null;
3349
+ } | null;
3350
+ /** Format: date-time */
3351
+ createdAt: string;
3352
+ /** Format: date-time */
3353
+ updatedAt: string | null;
3354
+ };
3355
+ rebuildJobId: string | null;
3356
+ };
3357
+ };
3358
+ };
3359
+ };
3360
+ };
3361
+ deleteInstruction: {
3362
+ parameters: {
3363
+ query?: never;
3364
+ header?: never;
3365
+ path: {
3366
+ knowledgeBaseId: string;
3367
+ instructionId: string;
3368
+ };
3369
+ cookie?: never;
3370
+ };
3371
+ requestBody?: never;
3372
+ responses: {
3373
+ /** @description Default Response */
3374
+ 204: {
3375
+ headers: {
3376
+ [name: string]: unknown;
3377
+ };
3378
+ content: {
3379
+ 'application/json': null;
3380
+ };
3381
+ };
3382
+ };
3383
+ };
3384
+ updateInstruction: {
3385
+ parameters: {
3386
+ query?: never;
3387
+ header?: never;
3388
+ path: {
3389
+ knowledgeBaseId: string;
3390
+ instructionId: string;
3391
+ };
3392
+ cookie?: never;
3393
+ };
3394
+ /** @description UpdateInstructionInput */
3395
+ requestBody: {
3396
+ content: {
3397
+ 'application/json': {
3398
+ statement?: string;
3399
+ scopeSourceIds?: string[] | null;
3400
+ };
3401
+ };
3402
+ };
3403
+ responses: {
3404
+ /** @description Instruction */
3405
+ 200: {
3406
+ headers: {
3407
+ [name: string]: unknown;
3408
+ };
3409
+ content: {
3410
+ 'application/json': {
3411
+ id: string;
3412
+ knowledgeBaseId: string;
3413
+ /** @enum {string} */
3414
+ origin: 'conflict' | 'human';
3415
+ /** @enum {string} */
3416
+ status: 'active' | 'archived';
3417
+ statement: string;
3418
+ scopeSourceIds: string[] | null;
3419
+ /** Format: date-time */
3420
+ archivedAt: string | null;
3421
+ archivedReason: string | null;
3422
+ sourceIssueId: string | null;
3423
+ /** @description Actor */
3424
+ createdBy: {
3425
+ id: string | null;
3426
+ displayName: string | null;
3427
+ } | null;
3428
+ /** @description Actor */
3429
+ updatedBy: {
3430
+ id: string | null;
3431
+ displayName: string | null;
3432
+ } | null;
3433
+ /** Format: date-time */
3434
+ createdAt: string;
3435
+ /** Format: date-time */
3436
+ updatedAt: string | null;
3437
+ };
3438
+ };
3439
+ };
3440
+ };
3441
+ };
3442
+ applyIssues: {
3443
+ parameters: {
3444
+ query?: never;
3445
+ header?: never;
3446
+ path: {
3447
+ knowledgeBaseId: string;
3448
+ };
3449
+ cookie?: never;
3450
+ };
3451
+ requestBody: {
3452
+ content: {
3453
+ 'application/json': {
3454
+ issueIds: string[];
3455
+ };
3456
+ };
3457
+ };
3458
+ responses: {
3459
+ /** @description JobAccepted */
3460
+ 202: {
3461
+ headers: {
3462
+ [name: string]: unknown;
3463
+ };
3464
+ content: {
3465
+ 'application/json': {
3466
+ jobId: string;
3467
+ };
3468
+ };
3469
+ };
3470
+ };
3471
+ };
3472
+ dismissIssue: {
3473
+ parameters: {
3474
+ query?: never;
3475
+ header?: never;
3476
+ path: {
3477
+ knowledgeBaseId: string;
3478
+ issueId: string;
3479
+ };
3480
+ cookie?: never;
3481
+ };
3482
+ requestBody?: never;
3483
+ responses: {
3484
+ /** @description Issue */
3485
+ 200: {
3486
+ headers: {
3487
+ [name: string]: unknown;
3488
+ };
3489
+ content: {
3490
+ 'application/json': {
3491
+ id: string;
3492
+ knowledgeBaseId: string;
3493
+ /** @description IssueContent */
3494
+ content: {
3495
+ /** @enum {string} */
3496
+ kind: 'conflict' | 'gap' | 'update_required' | 'add_entry' | 'remove_entry' | 'split_entry' | 'merge_entry';
3497
+ /** @enum {string} */
3498
+ severity: 'critical' | 'suggestion';
3499
+ scopePath: string;
3500
+ issue: string;
3501
+ suggestedFix: string;
3502
+ citedSourceIds?: string[];
3503
+ claimKey?: string;
3504
+ involvedScopes?: string[];
3505
+ currentClaim?: string;
3506
+ alternativeClaim?: string;
3507
+ /** @enum {string} */
3508
+ currentAuthority?: 'primary' | 'secondary' | 'community';
3509
+ /** @enum {string} */
3510
+ alternativeAuthority?: 'primary' | 'secondary' | 'community';
3511
+ /** @enum {string} */
3512
+ suggestedResolution?: 'keep_existing' | 'accept_new';
3513
+ };
3514
+ /** @enum {string} */
3515
+ status: 'open' | 'accepted' | 'rejected';
3516
+ /** @enum {string|null} */
3517
+ resolution: 'keep_existing' | 'accept_new' | null;
3518
+ /** @description IssueResolvedBy */
3519
+ resolvedBy: {
3520
+ id: string;
3521
+ /** @enum {string} */
3522
+ kind: 'user' | 'robot';
3523
+ } | null;
3524
+ /** Format: date-time */
3525
+ createdAt: string;
3526
+ /** Format: date-time */
3527
+ resolvedAt: string | null;
3528
+ };
3529
+ };
3530
+ };
3531
+ };
3532
+ };
3533
+ reopenIssue: {
3534
+ parameters: {
3535
+ query?: never;
3536
+ header?: never;
3537
+ path: {
3538
+ knowledgeBaseId: string;
3539
+ issueId: string;
3540
+ };
3541
+ cookie?: never;
3542
+ };
3543
+ requestBody?: never;
3544
+ responses: {
3545
+ /** @description Issue */
3546
+ 200: {
3547
+ headers: {
3548
+ [name: string]: unknown;
3549
+ };
3550
+ content: {
3551
+ 'application/json': {
3552
+ id: string;
3553
+ knowledgeBaseId: string;
3554
+ /** @description IssueContent */
3555
+ content: {
3556
+ /** @enum {string} */
3557
+ kind: 'conflict' | 'gap' | 'update_required' | 'add_entry' | 'remove_entry' | 'split_entry' | 'merge_entry';
3558
+ /** @enum {string} */
3559
+ severity: 'critical' | 'suggestion';
3560
+ scopePath: string;
3561
+ issue: string;
3562
+ suggestedFix: string;
3563
+ citedSourceIds?: string[];
3564
+ claimKey?: string;
3565
+ involvedScopes?: string[];
3566
+ currentClaim?: string;
3567
+ alternativeClaim?: string;
3568
+ /** @enum {string} */
3569
+ currentAuthority?: 'primary' | 'secondary' | 'community';
3570
+ /** @enum {string} */
3571
+ alternativeAuthority?: 'primary' | 'secondary' | 'community';
3572
+ /** @enum {string} */
3573
+ suggestedResolution?: 'keep_existing' | 'accept_new';
3574
+ };
3575
+ /** @enum {string} */
3576
+ status: 'open' | 'accepted' | 'rejected';
3577
+ /** @enum {string|null} */
3578
+ resolution: 'keep_existing' | 'accept_new' | null;
3579
+ /** @description IssueResolvedBy */
3580
+ resolvedBy: {
3581
+ id: string;
3582
+ /** @enum {string} */
3583
+ kind: 'user' | 'robot';
3584
+ } | null;
3585
+ /** Format: date-time */
3586
+ createdAt: string;
3587
+ /** Format: date-time */
3588
+ resolvedAt: string | null;
3589
+ };
3590
+ };
3591
+ };
3592
+ };
3593
+ };
3594
+ resolveIssue: {
3595
+ parameters: {
3596
+ query?: never;
3597
+ header?: never;
3598
+ path: {
3599
+ knowledgeBaseId: string;
3600
+ issueId: string;
3601
+ };
3602
+ cookie?: never;
3603
+ };
3604
+ requestBody: {
3605
+ content: {
3606
+ 'application/json': {
3607
+ /** @enum {string} */
3608
+ resolution: 'keep_existing' | 'accept_new';
3609
+ };
3610
+ };
3611
+ };
3612
+ responses: {
3613
+ /** @description ResolveIssueResponse */
3614
+ 200: {
3615
+ headers: {
3616
+ [name: string]: unknown;
3617
+ };
3618
+ content: {
3619
+ 'application/json': {
3620
+ /** @description Issue */
3621
+ issue: {
3622
+ id: string;
3623
+ knowledgeBaseId: string;
3624
+ /** @description IssueContent */
3625
+ content: {
3626
+ /** @enum {string} */
3627
+ kind: 'conflict' | 'gap' | 'update_required' | 'add_entry' | 'remove_entry' | 'split_entry' | 'merge_entry';
3628
+ /** @enum {string} */
3629
+ severity: 'critical' | 'suggestion';
3630
+ scopePath: string;
3631
+ issue: string;
3632
+ suggestedFix: string;
3633
+ citedSourceIds?: string[];
3634
+ claimKey?: string;
3635
+ involvedScopes?: string[];
3636
+ currentClaim?: string;
3637
+ alternativeClaim?: string;
3638
+ /** @enum {string} */
3639
+ currentAuthority?: 'primary' | 'secondary' | 'community';
3640
+ /** @enum {string} */
3641
+ alternativeAuthority?: 'primary' | 'secondary' | 'community';
3642
+ /** @enum {string} */
3643
+ suggestedResolution?: 'keep_existing' | 'accept_new';
3644
+ };
3645
+ /** @enum {string} */
3646
+ status: 'open' | 'accepted' | 'rejected';
3647
+ /** @enum {string|null} */
3648
+ resolution: 'keep_existing' | 'accept_new' | null;
3649
+ /** @description IssueResolvedBy */
3650
+ resolvedBy: {
3651
+ id: string;
3652
+ /** @enum {string} */
3653
+ kind: 'user' | 'robot';
3654
+ } | null;
3655
+ /** Format: date-time */
3656
+ createdAt: string;
3657
+ /** Format: date-time */
3658
+ resolvedAt: string | null;
3659
+ };
3660
+ jobId: string | null;
3661
+ };
3662
+ };
3663
+ };
3664
+ };
3665
+ };
3666
+ getJob: {
3667
+ parameters: {
3668
+ query?: never;
3669
+ header?: never;
3670
+ path: {
3671
+ knowledgeBaseId: string;
3672
+ jobId: string;
3673
+ };
3674
+ cookie?: never;
3675
+ };
3676
+ requestBody?: never;
3677
+ responses: {
3678
+ /** @description Job */
3679
+ 200: {
3680
+ headers: {
3681
+ [name: string]: unknown;
3682
+ };
3683
+ content: {
3684
+ 'application/json': {
3685
+ id: string;
3686
+ /** @enum {string} */
3687
+ status: 'pending' | 'queued' | 'running' | 'succeeded' | 'failed' | 'cancelled';
3688
+ /** Format: date-time */
3689
+ startedAt: string | null;
3690
+ /** Format: date-time */
3691
+ completedAt: string | null;
3692
+ result?: unknown;
3693
+ error?: string | null;
3694
+ };
3695
+ };
3696
+ };
3697
+ };
3698
+ };
3699
+ refreshKnowledgeBase: {
3700
+ parameters: {
3701
+ query?: never;
3702
+ header?: never;
3703
+ path: {
3704
+ knowledgeBaseId: string;
3705
+ };
3706
+ cookie?: never;
3707
+ };
3708
+ requestBody?: never;
3709
+ responses: {
3710
+ /** @description RefreshAccepted */
3711
+ 202: {
3712
+ headers: {
3713
+ [name: string]: unknown;
3714
+ };
3715
+ content: {
3716
+ 'application/json': {
3717
+ jobId: string;
3718
+ started: boolean;
3719
+ };
3720
+ };
3721
+ };
3722
+ };
3723
+ };
3724
+ listSources: {
3725
+ parameters: {
3726
+ query?: {
3727
+ cursor?: string;
3728
+ limit?: number;
3729
+ status?: 'pending' | 'processing' | 'ready' | 'failed' | 'skipped';
3730
+ importId?: string;
3731
+ ids?: string;
3732
+ };
3733
+ header?: never;
3734
+ path: {
3735
+ knowledgeBaseId: string;
3736
+ };
3737
+ cookie?: never;
3738
+ };
3739
+ requestBody?: never;
3740
+ responses: {
3741
+ /** @description Default Response */
3742
+ 200: {
3743
+ headers: {
3744
+ [name: string]: unknown;
3745
+ };
3746
+ content: {
3747
+ 'application/json': {
3748
+ data: {
3749
+ /** Format: uuid */
3750
+ id: string;
3751
+ /** Format: uuid */
3752
+ knowledgeBaseId: string;
3753
+ filename: string;
3754
+ /** @enum {string} */
3755
+ kind: 'web' | 'file' | 'dataset';
3756
+ sizeBytes: number;
3757
+ /** @enum {string} */
3758
+ status: 'pending' | 'processing' | 'ready' | 'failed' | 'skipped';
3759
+ tldr: string | null;
3760
+ topics: string[] | null;
3761
+ canonicalUrl: string | null;
3762
+ /** Format: date-time */
3763
+ fetchedAt: string | null;
3764
+ /** Format: date-time */
3765
+ distilledAt: string | null;
3766
+ /** Format: date-time */
3767
+ createdAt: string;
3768
+ }[];
3769
+ nextCursor: string | null;
3770
+ };
3771
+ };
3772
+ };
3773
+ };
3774
+ };
3775
+ getSource: {
3776
+ parameters: {
3777
+ query?: never;
3778
+ header?: never;
3779
+ path: {
3780
+ knowledgeBaseId: string;
3781
+ sourceId: string;
3782
+ };
3783
+ cookie?: never;
3784
+ };
3785
+ requestBody?: never;
3786
+ responses: {
3787
+ /** @description Source */
3788
+ 200: {
3789
+ headers: {
3790
+ [name: string]: unknown;
3791
+ };
3792
+ content: {
3793
+ 'application/json': {
3794
+ /** Format: uuid */
3795
+ id: string;
3796
+ /** Format: uuid */
3797
+ knowledgeBaseId: string;
3798
+ filename: string;
3799
+ /** @enum {string} */
3800
+ kind: 'web' | 'file' | 'dataset';
3801
+ sizeBytes: number;
3802
+ /** @enum {string} */
3803
+ status: 'pending' | 'processing' | 'ready' | 'failed' | 'skipped';
3804
+ tldr: string | null;
3805
+ topics: string[] | null;
3806
+ canonicalUrl: string | null;
3807
+ /** Format: date-time */
3808
+ fetchedAt: string | null;
3809
+ /** Format: date-time */
3810
+ distilledAt: string | null;
3811
+ /** Format: date-time */
3812
+ createdAt: string;
3813
+ };
3814
+ };
3815
+ };
3816
+ };
3817
+ };
3818
+ deleteSource: {
3819
+ parameters: {
3820
+ query?: never;
3821
+ header?: never;
3822
+ path: {
3823
+ knowledgeBaseId: string;
3824
+ sourceId: string;
3825
+ };
3826
+ cookie?: never;
3827
+ };
3828
+ requestBody?: never;
3829
+ responses: {
3830
+ /** @description Default Response */
3831
+ 204: {
3832
+ headers: {
3833
+ [name: string]: unknown;
3834
+ };
3835
+ content: {
3836
+ 'application/json': null;
3837
+ };
3838
+ };
3839
+ };
3840
+ };
3841
+ getSourceContent: {
3842
+ parameters: {
3843
+ query?: {
3844
+ /** @description Output representation. `json` (default) returns the structured resource; `markdown` / `plain` return the rendered, LLM-ready text. */
3845
+ format?: 'json' | 'markdown' | 'plain';
3846
+ startLine?: number;
3847
+ endLine?: number;
3848
+ };
3849
+ header?: never;
3850
+ path: {
3851
+ knowledgeBaseId: string;
3852
+ sourceId: string;
3853
+ };
3854
+ cookie?: never;
3855
+ };
3856
+ requestBody?: never;
3857
+ responses: {
3858
+ /** @description SourceContent */
3859
+ 200: {
3860
+ headers: {
3861
+ [name: string]: unknown;
3862
+ };
3863
+ content: {
3864
+ 'application/json': {
3865
+ /** Format: uuid */
3866
+ sourceId: string;
3867
+ content: string;
3868
+ totalLines: number;
3869
+ slice: {
3870
+ start: number;
3871
+ end: number;
3872
+ };
3873
+ };
3874
+ 'text/markdown': string;
3875
+ 'text/plain': string;
3876
+ };
3877
+ };
3878
+ };
3879
+ };
3880
+ saveConversation: {
3881
+ parameters: {
3882
+ query?: never;
3883
+ header?: never;
3884
+ path: {
3885
+ threadId: string;
3886
+ };
3887
+ cookie?: never;
3888
+ };
3889
+ /** @description SaveConversationInput */
3890
+ requestBody: {
3891
+ content: {
3892
+ 'application/json': {
3893
+ messages: {
3894
+ /** @enum {string} */
3895
+ role: 'user' | 'assistant' | 'system' | 'tool';
3896
+ /** @default null */
3897
+ content?: string | null;
3898
+ /** @default null */
3899
+ toolName?: string | null;
3900
+ /**
3901
+ * @default null
3902
+ * @enum {string|null}
3903
+ */
3904
+ toolType?: 'call' | 'result' | null;
3905
+ }[];
3906
+ modelProvider?: string;
3907
+ modelId?: string;
3908
+ /** @description ConversationTokenUsage */
3909
+ tokenUsage?: {
3910
+ inputTokens?: number;
3911
+ outputTokens?: number;
3912
+ totalTokens?: number;
3913
+ };
3914
+ /** @description ConversationMetadata */
3915
+ metadata?: {
3916
+ [key: string]: string | string[];
3917
+ };
3918
+ };
3919
+ };
3920
+ };
3921
+ responses: {
3922
+ /** @description Conversation */
3923
+ 200: {
3924
+ headers: {
3925
+ [name: string]: unknown;
3926
+ };
3927
+ content: {
3928
+ 'application/json': {
3929
+ id: string;
3930
+ threadId: string;
3931
+ /** @description ConversationMetadata */
3932
+ metadata: {
3933
+ [key: string]: string | string[];
3934
+ } | null;
3935
+ /** Format: date-time */
3936
+ startedAt: string;
3937
+ /** Format: date-time */
3938
+ messagesUpdatedAt: string;
3939
+ messages: {
3940
+ /** @enum {string} */
3941
+ role: 'user' | 'assistant' | 'system' | 'tool';
3942
+ /** @default null */
3943
+ content: string | null;
3944
+ /** @default null */
3945
+ toolName: string | null;
3946
+ /**
3947
+ * @default null
3948
+ * @enum {string|null}
3949
+ */
3950
+ toolType: 'call' | 'result' | null;
3951
+ }[];
3952
+ modelProvider: string | null;
3953
+ modelId: string | null;
3954
+ /** @description ConversationTokenUsage */
3955
+ tokenUsage: {
3956
+ inputTokens?: number;
3957
+ outputTokens?: number;
3958
+ totalTokens?: number;
3959
+ } | null;
3960
+ /** @description ConversationCoreMetrics */
3961
+ coreMetrics: {
3962
+ successScore?: number;
3963
+ /** @enum {string} */
3964
+ sentiment?: 'positive' | 'neutral' | 'negative';
3965
+ contentGaps?: string[];
3966
+ } | null;
3967
+ /** Format: date-time */
3968
+ classifiedAt: string | null;
3969
+ classificationError: string | null;
3970
+ /** Format: date-time */
3971
+ createdAt: string;
3972
+ /** Format: date-time */
3973
+ updatedAt: string;
3974
+ };
3975
+ };
3976
+ };
3977
+ };
3978
+ };
3979
+ classifyConversation: {
3980
+ parameters: {
3981
+ query?: never;
3982
+ header?: never;
3983
+ path: {
3984
+ threadId: string;
3985
+ };
3986
+ cookie?: never;
3987
+ };
3988
+ /** @description ClassifyConversationInput */
3989
+ requestBody: {
3990
+ content: {
3991
+ 'application/json': {
3992
+ coreMetrics?: {
3993
+ successScore: number;
3994
+ /** @enum {string} */
3995
+ sentiment: 'positive' | 'neutral' | 'negative';
3996
+ contentGaps: string[];
3997
+ };
3998
+ classificationError?: string;
3999
+ };
4000
+ };
4001
+ };
4002
+ responses: {
4003
+ /** @description Conversation */
4004
+ 200: {
4005
+ headers: {
4006
+ [name: string]: unknown;
4007
+ };
4008
+ content: {
4009
+ 'application/json': {
4010
+ id: string;
4011
+ threadId: string;
4012
+ /** @description ConversationMetadata */
4013
+ metadata: {
4014
+ [key: string]: string | string[];
4015
+ } | null;
4016
+ /** Format: date-time */
4017
+ startedAt: string;
4018
+ /** Format: date-time */
4019
+ messagesUpdatedAt: string;
4020
+ messages: {
4021
+ /** @enum {string} */
4022
+ role: 'user' | 'assistant' | 'system' | 'tool';
4023
+ /** @default null */
4024
+ content: string | null;
4025
+ /** @default null */
4026
+ toolName: string | null;
4027
+ /**
4028
+ * @default null
4029
+ * @enum {string|null}
4030
+ */
4031
+ toolType: 'call' | 'result' | null;
4032
+ }[];
4033
+ modelProvider: string | null;
4034
+ modelId: string | null;
4035
+ /** @description ConversationTokenUsage */
4036
+ tokenUsage: {
4037
+ inputTokens?: number;
4038
+ outputTokens?: number;
4039
+ totalTokens?: number;
4040
+ } | null;
4041
+ /** @description ConversationCoreMetrics */
4042
+ coreMetrics: {
4043
+ successScore?: number;
4044
+ /** @enum {string} */
4045
+ sentiment?: 'positive' | 'neutral' | 'negative';
4046
+ contentGaps?: string[];
4047
+ } | null;
4048
+ /** Format: date-time */
4049
+ classifiedAt: string | null;
4050
+ classificationError: string | null;
4051
+ /** Format: date-time */
4052
+ createdAt: string;
4053
+ /** Format: date-time */
4054
+ updatedAt: string;
4055
+ };
4056
+ };
4057
+ };
4058
+ };
4059
+ };
4060
+ }
4061
+ declare namespace types_d_exports {
4062
+ export { ApplyIssuesParams, ApplyIssuesResponse, ClassifyConversationParams, ContextListenOptions, ContextRequestOptions, Conversation, ConversationDoc, CreateFileImportParams, CreateImportParams, CreateInstructionParams, CreateInstructionResponse, CreateKnowledgeBaseParams, DismissIssueResponse, EditInstructionParams, EditKnowledgeBaseParams, Entry, EntryDoc, Import, ImportDetail, ImportDownloadResponse, ImportsResponse, Instruction, InstructionDoc, IssueDoc, Job, JobAccepted, KnowledgeBase, KnowledgeBasesResponse, McpDoc, RebuildEntryResponse, ReopenIssueResponse, RequestOptions$2 as RequestOptions, ResolveIssueParams, ResolveIssueResponse, SaveConversationParams, Source, SourceContentResponse, SourceDetail, SourcesResponse, StagedUpload, possibleStoreRequestOptions };
4063
+ }
4064
+ /** Options accepted by every Context method. @beta */
4065
+ type RequestOptions$2 = {
4066
+ signal?: AbortSignal;
4067
+ tag?: string;
4068
+ };
4069
+ /** @internal */
4070
+ declare const possibleStoreRequestOptions: readonly ['headers', 'signal', 'tag', 'timeout', 'token'];
4071
+ /**
4072
+ * Request options honored by `context.fetch`.
4073
+ *
4074
+ * @beta
4075
+ */
4076
+ type ContextRequestOptions = Pick<RequestOptions, (typeof possibleStoreRequestOptions)[number]>;
4077
+ /**
4078
+ * Listener options for `context.listen`.
4079
+ *
4080
+ * `includeAllVersions` is left out: Context documents are written by the
4081
+ * Context API with no drafts or versions, so it would never make a
4082
+ * difference.
4083
+ *
4084
+ * @beta
4085
+ */
4086
+ type ContextListenOptions = Omit<ListenOptions, 'includeAllVersions'> | Omit<ResumableListenOptions, 'includeAllVersions'>;
4087
+ /**
4088
+ * A file import. The client stages the upload, PUTs the bytes straight to
4089
+ * storage with a signed URL, and confirms. The Context API never holds the
4090
+ * file content.
4091
+ * @beta
4092
+ */
4093
+ type CreateFileImportParams = {
4094
+ type: 'file';
4095
+ /** Same shapes `assets.upload` accepts, minus node streams: the bytes go
4096
+ * out through `fetch`, which has no portable stream support. */
4097
+ file: Exclude<UploadBody, NodeJS.ReadableStream>;
4098
+ filename: string;
4099
+ contentType?: string;
4100
+ };
4101
+ type KnowledgeBasesPath = '/{apiVersion}/context/knowledge-bases';
4102
+ type ConversationPath = '/{apiVersion}/context/organizations/{organizationId}/conversations/{threadId}';
4103
+ type KnowledgeBasePath = '/{apiVersion}/context/knowledge-bases/{knowledgeBaseId}';
4104
+ type ImportsPath = `${KnowledgeBasePath}/imports`;
4105
+ type ImportPath = `${KnowledgeBasePath}/imports/{importId}`;
4106
+ type UploadsPath = `${KnowledgeBasePath}/imports/uploads`;
4107
+ type EntryRebuildPath = `${KnowledgeBasePath}/entries/{entryPath}/rebuild`;
4108
+ type SourcesPath = `${KnowledgeBasePath}/sources`;
4109
+ type SourcePath = `${KnowledgeBasePath}/sources/{sourceId}`;
4110
+ type SourceContentPath = `${KnowledgeBasePath}/sources/{sourceId}/content`;
4111
+ type IssuesApplyPath = `${KnowledgeBasePath}/issues/apply`;
4112
+ type InstructionPath = `${KnowledgeBasePath}/instructions/{instructionId}`;
4113
+ type JobPath = `${KnowledgeBasePath}/jobs/{jobId}`;
4114
+ type IssueResolvePath = `${KnowledgeBasePath}/issues/{issueId}/resolve`;
4115
+ type IssueDismissPath = `${KnowledgeBasePath}/issues/{issueId}/dismiss`;
4116
+ type IssueReopenPath = `${KnowledgeBasePath}/issues/{issueId}/reopen`;
4117
+ type InstructionsPath = `${KnowledgeBasePath}/instructions`;
4118
+ type JsonResponse<T> = T extends {
4119
+ content: {
4120
+ 'application/json': infer R;
4121
+ };
4122
+ } ? R : never;
4123
+ type JsonBody<T> = T extends {
4124
+ requestBody: {
4125
+ content: {
4126
+ 'application/json': infer R;
4127
+ };
4128
+ };
4129
+ } ? R : never;
4130
+ /**
4131
+ * A knowledge base: one buildable body of knowledge inside Context.
4132
+ * @beta
4133
+ */
4134
+ type KnowledgeBase = JsonResponse<paths[KnowledgeBasePath]['get']['responses']['200']>;
4135
+ /**
4136
+ * Parameters for creating a knowledge base.
4137
+ * @beta
4138
+ */
4139
+ type CreateKnowledgeBaseParams = JsonBody<paths[KnowledgeBasesPath]['post']>;
4140
+ /** @beta */
4141
+ type EditKnowledgeBaseParams = JsonBody<paths[KnowledgeBasePath]['patch']>;
4142
+ /**
4143
+ * Parameters for importing content. Discriminated on `type`:
4144
+ * inline text, a website crawl, or a Sanity dataset bind.
4145
+ * @beta
4146
+ */
4147
+ type CreateImportParams = JsonBody<paths[ImportsPath]['post']>;
4148
+ /**
4149
+ * Accepted async work. Poll the job with `jobs.get` until it reaches a
4150
+ * terminal state.
4151
+ * @beta
4152
+ */
4153
+ type JobAccepted = JsonResponse<paths[`${KnowledgeBasePath}/build`]['post']['responses']['202']>;
4154
+ /** @beta */
4155
+ type Job = JsonResponse<paths[JobPath]['get']['responses']['200']>;
4156
+ /**
4157
+ * Accepted entry rebuild: the job to poll plus every entry the rebuild
4158
+ * touches.
4159
+ * @beta
4160
+ */
4161
+ type RebuildEntryResponse = JsonResponse<paths[EntryRebuildPath]['post']['responses']['202']>;
4162
+ /** @beta */
4163
+ type ApplyIssuesParams = JsonBody<paths[IssuesApplyPath]['post']>;
4164
+ /** @beta */
4165
+ type ApplyIssuesResponse = JsonResponse<paths[IssuesApplyPath]['post']['responses']['202']>;
4166
+ /** @beta */
4167
+ type ResolveIssueParams = JsonBody<paths[IssueResolvePath]['post']>;
4168
+ /** @beta */
4169
+ type ResolveIssueResponse = JsonResponse<paths[IssueResolvePath]['post']['responses']['200']>;
4170
+ /** @beta */
4171
+ type DismissIssueResponse = JsonResponse<paths[IssueDismissPath]['post']['responses']['200']>;
4172
+ /** @beta */
4173
+ type ReopenIssueResponse = JsonResponse<paths[IssueReopenPath]['post']['responses']['200']>;
4174
+ /** @beta */
4175
+ type CreateInstructionParams = JsonBody<paths[InstructionsPath]['post']>;
4176
+ /**
4177
+ * A standing instruction, as the instruction endpoints return it.
4178
+ * @beta
4179
+ */
4180
+ type Instruction = JsonResponse<paths[InstructionPath]['patch']['responses']['200']>;
4181
+ /** The created instruction, wrapped the way the create endpoint returns it. @beta */
4182
+ type CreateInstructionResponse = JsonResponse<paths[InstructionsPath]['post']['responses']['201']>;
4183
+ /** @beta */
4184
+ type EditInstructionParams = JsonBody<paths[InstructionPath]['patch']>;
4185
+ /** @beta */
4186
+ type KnowledgeBasesResponse = JsonResponse<paths[KnowledgeBasesPath]['get']['responses']['200']>;
4187
+ /** @beta */
4188
+ type ImportsResponse = JsonResponse<paths[ImportsPath]['get']['responses']['200']>;
4189
+ /** @beta */
4190
+ type Import = ImportsResponse['data'][number];
4191
+ /** @beta */
4192
+ type ImportDetail = JsonResponse<paths[ImportPath]['get']['responses']['200']>;
4193
+ /** @beta */
4194
+ type ImportDownloadResponse = JsonResponse<paths[`${ImportPath}/download`]['get']['responses']['200']>;
4195
+ /**
4196
+ * The staged half of a file upload: PUT the bytes to `uploadUrl`, then
4197
+ * confirm with the complete endpoint. `imports.create({type: 'file'})` does
4198
+ * all of this in one call.
4199
+ * @beta
4200
+ */
4201
+ type StagedUpload = JsonResponse<paths[UploadsPath]['post']['responses']['201']>;
4202
+ /** @beta */
4203
+ type SourcesResponse = JsonResponse<paths[SourcesPath]['get']['responses']['200']>;
4204
+ /** @beta */
4205
+ type Source = SourcesResponse['data'][number];
4206
+ /** @beta */
4207
+ type SourceDetail = JsonResponse<paths[SourcePath]['get']['responses']['200']>;
4208
+ /** @beta */
4209
+ type SourceContentResponse = JsonResponse<paths[SourceContentPath]['get']['responses']['200']>;
4210
+ /**
4211
+ * A recorded conversation: one agent thread's transcript plus the
4212
+ * classification recorded on it. Standalone org-level telemetry — dimensions
4213
+ * (MCP endpoints, app, the customer's own keys) live in the `metadata` bag.
4214
+ * @beta
4215
+ */
4216
+ type Conversation = JsonResponse<paths[ConversationPath]['put']['responses']['200']>;
4217
+ /**
4218
+ * Body for the conversation ingest upsert. Messages replace the stored
4219
+ * transcript wholesale; `metadata` and model fields only overwrite when
4220
+ * present.
4221
+ * @beta
4222
+ */
4223
+ type SaveConversationParams = JsonBody<paths[ConversationPath]['put']>;
4224
+ /** Exactly one of a verdict (`coreMetrics`) or a failure (`classificationError`). @beta */
4225
+ type ClassifyConversationParams = JsonBody<paths[ConversationPath]['patch']>;
4226
+ /**
4227
+ * The raw `sanity.context.entry` document shape, as stored in the
4228
+ * organization's document store. For typing GROQ reads.
4229
+ * @beta
4230
+ */
4231
+ type EntryDoc = components['schemas']['EntryDoc'];
4232
+ /** @beta */
4233
+ type IssueDoc = components['schemas']['IssueDoc'];
4234
+ /** @beta */
4235
+ type InstructionDoc = components['schemas']['InstructionDoc'];
4236
+ /**
4237
+ * The raw `sanity.context.mcp` document shape (an MCP endpoint
4238
+ * configuration), as stored in the organization's document store. For
4239
+ * typing GROQ reads.
4240
+ * @beta
4241
+ */
4242
+ type McpDoc = components['schemas']['McpDoc'];
4243
+ /**
4244
+ * The metadata view of an entry, as `entries.list` projects it. Bodies stay
4245
+ * behind `entries.get` (or a GROQ read through `context.fetch`).
4246
+ * @beta
4247
+ */
4248
+ type Entry = Pick<EntryDoc, '_id' | 'path' | 'title' | 'tldr' | 'status'>;
4249
+ /**
4250
+ * The raw `sanity.context.conversation` document shape, as stored in the
4251
+ * organization's document store. For typing GROQ reads.
4252
+ * @beta
4253
+ */
4254
+ type ConversationDoc = components['schemas']['ConversationDoc'];
4255
+ type ListOptions$1 = RequestOptions$2 & {
4256
+ cursor?: string;
4257
+ limit?: number;
4258
+ };
4259
+ /**
4260
+ * `client.context` — knowledge bases and everything scoped to them.
4261
+ *
4262
+ * Collection-level management (create, list, get, edit, delete) addresses
4263
+ * knowledge bases per call, like `client.projects`. Everything scoped to one
4264
+ * knowledge base (imports, builds, issues, entries, ...) operates on the
4265
+ * client's configured `resource`, like media libraries:
4266
+ *
4267
+ * @example Full lifecycle
4268
+ * ```ts
4269
+ * const created = await client.context.knowledgeBases.create({
4270
+ * organizationId: 'org123',
4271
+ * title: 'Support docs',
4272
+ * description: 'Product docs and troubleshooting guides',
4273
+ * })
4274
+ *
4275
+ * const kb = createClient({
4276
+ * apiVersion: '2026-08-25',
4277
+ * token,
4278
+ * resource: {type: 'knowledge-base', id: created.publicId},
4279
+ * })
4280
+ *
4281
+ * await kb.context.imports.create({type: 'text', title: 'Refund policy', content: refundMd})
4282
+ * const {jobId} = await kb.context.build()
4283
+ * ```
4284
+ *
4285
+ * @beta
4286
+ */
4287
+ declare class ContextClient {
4288
+ #private;
4289
+ constructor(client: SanityClient, httpRequest: HttpRequest);
4290
+ /** The knowledge base collection: management addressed per call. */
4291
+ knowledgeBases: {
4292
+ /** Create a knowledge base. Requires the org-level knowledge-base create grant. */
4293
+ create: (params: CreateKnowledgeBaseParams, options?: RequestOptions$2) => Promise<KnowledgeBase>;
4294
+ /** List the organization's knowledge bases. */
4295
+ list: (params: {
4296
+ organizationId: string;
4297
+ } & ListOptions$1) => Promise<KnowledgeBasesResponse>;
4298
+ /** Fetch a knowledge base by its id. */
4299
+ get: (knowledgeBaseId: string, options?: RequestOptions$2) => Promise<KnowledgeBase>;
4300
+ /** Edit a knowledge base's configuration. */
4301
+ edit: (knowledgeBaseId: string, params: EditKnowledgeBaseParams, options?: RequestOptions$2) => Promise<KnowledgeBase>;
4302
+ /** Delete a knowledge base and its generated content. */
4303
+ delete: (knowledgeBaseId: string, options?: RequestOptions$2) => Promise<void>;
4304
+ };
4305
+ /**
4306
+ * GROQ over the organization's Context documents (conversation telemetry
4307
+ * today; the store holds every Context family and the caller's access
4308
+ * decides what a query returns, so filter on `_type`).
4309
+ *
4310
+ * Requires `context.organizationId` in the client configuration.
4311
+ */
4312
+ fetch<R = unknown>(query: string, params?: QueryParams, options?: ContextRequestOptions): Promise<R>;
4313
+ /**
4314
+ * Listen for changes to the organization's Context documents. Mirrors
4315
+ * `client.listen(query, params, options)` and emits mutation events by
4316
+ * default.
4317
+ */
4318
+ listen<Opts extends ContextListenOptions | undefined = undefined>(query: string, params?: QueryParams, options?: Opts): Observable<ListenEventFromOptions<SanityDocument, Opts>>;
4319
+ /**
4320
+ * Conversation telemetry. `threadId` identifies the conversation within
4321
+ * the organization — reuse means the same conversation. Beyond the canned
4322
+ * `get`, reads go through {@link fetch} and {@link listen} with GROQ
4323
+ * (`_type == "sanity.context.conversation"`).
4324
+ *
4325
+ * Requires `context.organizationId` in the client configuration.
4326
+ */
4327
+ conversations: {
4328
+ /**
4329
+ * Record a conversation. Messages replace the stored transcript
4330
+ * wholesale; `metadata` and model fields only overwrite when present.
4331
+ * Last write per thread wins — retries are safe.
4332
+ */
4333
+ save: (params: {
4334
+ threadId: string;
4335
+ } & SaveConversationParams, options?: RequestOptions$2) => Promise<Conversation>;
4336
+ /**
4337
+ * Record the classification your own model produced for one thread:
4338
+ * exactly one of `coreMetrics` (a verdict) or `classificationError`
4339
+ * (why classification failed).
4340
+ */
4341
+ classify: (params: {
4342
+ threadId: string;
4343
+ } & ClassifyConversationParams, options?: RequestOptions$2) => Promise<Conversation>;
4344
+ /**
4345
+ * One recorded conversation by its thread id, or `null` when the thread
4346
+ * was never recorded. Runs:
4347
+ *
4348
+ * `*[_type == "sanity.context.conversation" && organizationId == $org && threadId == $threadId][0]`
4349
+ *
4350
+ * For anything more, use {@link fetch}.
4351
+ */
4352
+ get: (params: {
4353
+ threadId: string;
4354
+ }, options?: ContextRequestOptions) => Promise<ConversationDoc | null>;
4355
+ };
4356
+ /**
4357
+ * Build the configured knowledge base. The server waits for pending import
4358
+ * processing before assembling, so importing and building back to back is
4359
+ * safe. Track the returned job with {@link jobs}.
4360
+ */
4361
+ build(options?: RequestOptions$2): Promise<JobAccepted>;
4362
+ /** Cancel the running build, if any. */
4363
+ cancelBuild(options?: RequestOptions$2): Promise<{
4364
+ cancelled: boolean;
4365
+ }>;
4366
+ /** Run an incremental refresh: re-check sources and apply what changed. */
4367
+ refresh(options?: RequestOptions$2): Promise<{
4368
+ jobId: string;
4369
+ started: boolean;
4370
+ }>;
4371
+ /** Imports: feed content into the configured knowledge base. */
4372
+ imports: {
4373
+ /**
4374
+ * Import content. One entry point, discriminated on `type`: inline
4375
+ * `text`, a website `crawl`, a Sanity `dataset` bind, or a `file`
4376
+ * upload. Processing queues automatically. The file variant stages the
4377
+ * upload, PUTs the bytes to a signed storage URL, and confirms; the
4378
+ * bytes never pass through the Context API.
4379
+ */
4380
+ create: (params: CreateImportParams | CreateFileImportParams, options?: RequestOptions$2) => Promise<JobAccepted>;
4381
+ list: (params?: ListOptions$1) => Promise<{
4382
+ data: {
4383
+ id: string;
4384
+ knowledgeBaseId: string;
4385
+ name: string | null;
4386
+ sizeBytes: number | null;
4387
+ status: 'uploading' | 'processing' | 'complete' | 'failed';
4388
+ sourceKind: 'web' | 'file' | 'dataset';
4389
+ lastCheckedAt: string | null;
4390
+ sourceCount: number;
4391
+ totalDistillableCount: number;
4392
+ distilledCount: number;
4393
+ unsupportedCount: number;
4394
+ statusDetail: string | null;
4395
+ error: string | null;
4396
+ crawlOptions: {
4397
+ includePaths?: string[];
4398
+ excludePaths?: string[];
4399
+ maxDepth?: number;
4400
+ sitemapOnly?: boolean;
4401
+ ignoreQueryParameters?: boolean;
4402
+ pageLimit?: number;
4403
+ } | null;
4404
+ datasetSource: {
4405
+ sanityProjectId: string;
4406
+ sanityDatasetId: string;
4407
+ query: string;
4408
+ } | null;
4409
+ createdBy: {
4410
+ id: string | null;
4411
+ displayName: string | null;
4412
+ } | null;
4413
+ createdAt: string;
4414
+ completedAt: string | null;
4415
+ }[];
4416
+ nextCursor: string | null;
4417
+ }>;
4418
+ get: (params: {
4419
+ importId: string;
4420
+ }, options?: RequestOptions$2) => Promise<{
4421
+ id: string;
4422
+ knowledgeBaseId: string;
4423
+ name: string | null;
4424
+ sizeBytes: number | null;
4425
+ status: 'uploading' | 'processing' | 'complete' | 'failed';
4426
+ sourceKind: 'web' | 'file' | 'dataset';
4427
+ lastCheckedAt: string | null;
4428
+ sourceCount: number;
4429
+ totalDistillableCount: number;
4430
+ distilledCount: number;
4431
+ unsupportedCount: number;
4432
+ statusDetail: string | null;
4433
+ error: string | null;
4434
+ crawlOptions: {
4435
+ includePaths?: string[];
4436
+ excludePaths?: string[];
4437
+ maxDepth?: number;
4438
+ sitemapOnly?: boolean;
4439
+ ignoreQueryParameters?: boolean;
4440
+ pageLimit?: number;
4441
+ } | null;
4442
+ datasetSource: {
4443
+ sanityProjectId: string;
4444
+ sanityDatasetId: string;
4445
+ query: string;
4446
+ } | null;
4447
+ createdBy: {
4448
+ id: string | null;
4449
+ displayName: string | null;
4450
+ } | null;
4451
+ createdAt: string;
4452
+ completedAt: string | null;
4453
+ }>;
4454
+ /** A short-lived signed URL for the original uploaded bytes. */
4455
+ download: (params: {
4456
+ importId: string;
4457
+ }, options?: RequestOptions$2) => Promise<{
4458
+ url: string;
4459
+ expiresAt: string;
4460
+ }>;
4461
+ delete: (params: {
4462
+ importId: string;
4463
+ }, options?: RequestOptions$2) => Promise<void>;
4464
+ };
4465
+ /** Jobs: poll async work (builds, imports) to a terminal state. */
4466
+ jobs: {
4467
+ get: (params: {
4468
+ jobId: string;
4469
+ }, options?: RequestOptions$2) => Promise<{
4470
+ id: string;
4471
+ status: 'pending' | 'queued' | 'running' | 'succeeded' | 'failed' | 'cancelled';
4472
+ startedAt: string | null;
4473
+ completedAt: string | null;
4474
+ result?: unknown;
4475
+ error?: string | null;
4476
+ }>;
4477
+ };
4478
+ /**
4479
+ * Issues: findings from builds awaiting triage. Reads are canned GROQ
4480
+ * queries against the organization's document store; for anything more,
4481
+ * use {@link fetch}. Reads require `context.organizationId` alongside the
4482
+ * knowledge-base `resource` in the client configuration.
4483
+ */
4484
+ issues: {
4485
+ /**
4486
+ * Every issue on the knowledge base, oldest first, optionally narrowed
4487
+ * to one status. Drains keyset pages internally and resolves with the
4488
+ * complete set. Runs:
4489
+ *
4490
+ * `*[_type == "sanity.context.issue" && knowledgeBaseId == $kb && status == $status] | order(_createdAt asc, _id asc)`
4491
+ *
4492
+ * (the status clause only when given). For anything more, use {@link fetch}.
4493
+ */
4494
+ list: (params?: {
4495
+ status?: 'open' | 'accepted' | 'rejected';
4496
+ }, options?: ContextRequestOptions) => Promise<IssueDoc[]>;
4497
+ /**
4498
+ * One issue by its document id, or `null` when it does not exist. Runs:
4499
+ *
4500
+ * `*[_type == "sanity.context.issue" && knowledgeBaseId == $kb && _id == $id][0]`
4501
+ *
4502
+ * For anything more, use {@link fetch}.
4503
+ */
4504
+ get: (params: {
4505
+ issueId: string;
4506
+ }, options?: ContextRequestOptions) => Promise<IssueDoc | null>;
4507
+ /** Resolve a conflict issue. Mints the standing instruction, same as the dashboard. */
4508
+ resolve: (params: {
4509
+ issueId: string;
4510
+ } & ResolveIssueParams, options?: RequestOptions$2) => Promise<{
4511
+ issue: {
4512
+ id: string;
4513
+ knowledgeBaseId: string;
4514
+ content: {
4515
+ kind: 'conflict' | 'gap' | 'update_required' | 'add_entry' | 'remove_entry' | 'split_entry' | 'merge_entry';
4516
+ severity: 'critical' | 'suggestion';
4517
+ scopePath: string;
4518
+ issue: string;
4519
+ suggestedFix: string;
4520
+ citedSourceIds?: string[];
4521
+ claimKey?: string;
4522
+ involvedScopes?: string[];
4523
+ currentClaim?: string;
4524
+ alternativeClaim?: string;
4525
+ currentAuthority?: 'primary' | 'secondary' | 'community';
4526
+ alternativeAuthority?: 'primary' | 'secondary' | 'community';
4527
+ suggestedResolution?: 'keep_existing' | 'accept_new';
4528
+ };
4529
+ status: 'open' | 'accepted' | 'rejected';
4530
+ resolution: 'keep_existing' | 'accept_new' | null;
4531
+ resolvedBy: {
4532
+ id: string;
4533
+ kind: 'user' | 'robot';
4534
+ } | null;
4535
+ createdAt: string;
4536
+ resolvedAt: string | null;
4537
+ };
4538
+ jobId: string | null;
4539
+ }>;
4540
+ dismiss: (params: {
4541
+ issueId: string;
4542
+ }, options?: RequestOptions$2) => Promise<{
4543
+ id: string;
4544
+ knowledgeBaseId: string;
4545
+ content: {
4546
+ kind: 'conflict' | 'gap' | 'update_required' | 'add_entry' | 'remove_entry' | 'split_entry' | 'merge_entry';
4547
+ severity: 'critical' | 'suggestion';
4548
+ scopePath: string;
4549
+ issue: string;
4550
+ suggestedFix: string;
4551
+ citedSourceIds?: string[];
4552
+ claimKey?: string;
4553
+ involvedScopes?: string[];
4554
+ currentClaim?: string;
4555
+ alternativeClaim?: string;
4556
+ currentAuthority?: 'primary' | 'secondary' | 'community';
4557
+ alternativeAuthority?: 'primary' | 'secondary' | 'community';
4558
+ suggestedResolution?: 'keep_existing' | 'accept_new';
4559
+ };
4560
+ status: 'open' | 'accepted' | 'rejected';
4561
+ resolution: 'keep_existing' | 'accept_new' | null;
4562
+ resolvedBy: {
4563
+ id: string;
4564
+ kind: 'user' | 'robot';
4565
+ } | null;
4566
+ createdAt: string;
4567
+ resolvedAt: string | null;
4568
+ }>;
4569
+ reopen: (params: {
4570
+ issueId: string;
4571
+ }, options?: RequestOptions$2) => Promise<{
4572
+ id: string;
4573
+ knowledgeBaseId: string;
4574
+ content: {
4575
+ kind: 'conflict' | 'gap' | 'update_required' | 'add_entry' | 'remove_entry' | 'split_entry' | 'merge_entry';
4576
+ severity: 'critical' | 'suggestion';
4577
+ scopePath: string;
4578
+ issue: string;
4579
+ suggestedFix: string;
4580
+ citedSourceIds?: string[];
4581
+ claimKey?: string;
4582
+ involvedScopes?: string[];
4583
+ currentClaim?: string;
4584
+ alternativeClaim?: string;
4585
+ currentAuthority?: 'primary' | 'secondary' | 'community';
4586
+ alternativeAuthority?: 'primary' | 'secondary' | 'community';
4587
+ suggestedResolution?: 'keep_existing' | 'accept_new';
4588
+ };
4589
+ status: 'open' | 'accepted' | 'rejected';
4590
+ resolution: 'keep_existing' | 'accept_new' | null;
4591
+ resolvedBy: {
4592
+ id: string;
4593
+ kind: 'user' | 'robot';
4594
+ } | null;
4595
+ createdAt: string;
4596
+ resolvedAt: string | null;
4597
+ }>;
4598
+ /** Apply already-accepted issues to the knowledge base in one batch. */
4599
+ apply: (params: ApplyIssuesParams, options?: RequestOptions$2) => Promise<{
4600
+ jobId: string;
4601
+ }>;
4602
+ };
4603
+ /** Instructions: standing decisions that steer every build. */
4604
+ instructions: {
4605
+ create: (params: CreateInstructionParams, options?: RequestOptions$2) => Promise<CreateInstructionResponse>;
4606
+ /**
4607
+ * Every current-schema instruction on the knowledge base, oldest first.
4608
+ * Drains keyset pages internally and resolves with the complete set.
4609
+ * Runs:
4610
+ *
4611
+ * `*[_type == "sanity.context.instruction" && knowledgeBaseId == $kb && schemaVersion == 1] | order(_createdAt asc, _id asc)`
4612
+ *
4613
+ * For anything more, use {@link fetch}. Requires `context.organizationId`
4614
+ * alongside the knowledge-base `resource` in the client configuration.
4615
+ */
4616
+ list: (options?: ContextRequestOptions) => Promise<InstructionDoc[]>;
4617
+ edit: (params: {
4618
+ instructionId: string;
4619
+ } & EditInstructionParams, options?: RequestOptions$2) => Promise<{
4620
+ id: string;
4621
+ knowledgeBaseId: string;
4622
+ origin: 'conflict' | 'human';
4623
+ status: 'active' | 'archived';
4624
+ statement: string;
4625
+ scopeSourceIds: string[] | null;
4626
+ archivedAt: string | null;
4627
+ archivedReason: string | null;
4628
+ sourceIssueId: string | null;
4629
+ createdBy: {
4630
+ id: string | null;
4631
+ displayName: string | null;
4632
+ } | null;
4633
+ updatedBy: {
4634
+ id: string | null;
4635
+ displayName: string | null;
4636
+ } | null;
4637
+ createdAt: string;
4638
+ updatedAt: string | null;
4639
+ }>;
4640
+ delete: (params: {
4641
+ instructionId: string;
4642
+ }, options?: RequestOptions$2) => Promise<void>;
4643
+ };
4644
+ /**
4645
+ * Entries: the built outline, one entry per node. Reads are canned GROQ
4646
+ * queries against the organization's document store; for anything more,
4647
+ * use {@link fetch}. Requires `context.organizationId` alongside the
4648
+ * knowledge-base `resource` in the client configuration.
4649
+ */
4650
+ entries: {
4651
+ /**
4652
+ * Every entry, path-ordered, as a metadata view (`_id`, `path`,
4653
+ * `title`, `tldr`, `status`) with bodies excluded. Drains keyset pages
4654
+ * internally and resolves with the complete set. Runs:
4655
+ *
4656
+ * `*[_type == "sanity.context.entry" && knowledgeBaseId == $kb && path > $after] | order(path asc) [0...200] {_id, path, title, tldr, status}`
4657
+ *
4658
+ * For bodies, use `entries.get` or {@link fetch}.
4659
+ */
4660
+ list: (options?: ContextRequestOptions) => Promise<Entry[]>;
4661
+ /**
4662
+ * One entry with its full body and citations, by outline path (e.g.
4663
+ * `billing/refunds`), or `null` when no entry sits at that path. Runs:
4664
+ *
4665
+ * `*[_type == "sanity.context.entry" && knowledgeBaseId == $kb && path == $path][0]`
4666
+ *
4667
+ * For anything more, use {@link fetch}.
4668
+ */
4669
+ get: (params: {
4670
+ path: string;
4671
+ }, options?: ContextRequestOptions) => Promise<EntryDoc | null>;
4672
+ /**
4673
+ * Rebuild one entry from its already-placed sources, by outline path.
4674
+ * Poll the returned job with {@link jobs}; `affectedEntries` lists every
4675
+ * entry the rebuild touches.
4676
+ */
4677
+ rebuild: (params: {
4678
+ path: string;
4679
+ }, options?: RequestOptions$2) => Promise<RebuildEntryResponse>;
4680
+ };
4681
+ /**
4682
+ * MCP endpoint configurations, org-owned documents read with canned GROQ
4683
+ * queries. Requires `context.organizationId` in the client configuration.
4684
+ */
4685
+ mcpEndpoints: {
4686
+ /**
4687
+ * The organization's MCP endpoint configurations, oldest first. Runs:
4688
+ *
4689
+ * `*[_type == "sanity.context.mcp" && organizationId == $org] | order(_createdAt asc, _id asc) [0...500]`
4690
+ *
4691
+ * For anything more, use {@link fetch}.
4692
+ */
4693
+ list: (options?: ContextRequestOptions) => Promise<McpDoc[]>;
4694
+ /**
4695
+ * One MCP endpoint configuration by its URL name, or `null` when none
4696
+ * carries that name. Runs:
4697
+ *
4698
+ * `*[_type == "sanity.context.mcp" && organizationId == $org && name == $name][0]`
4699
+ *
4700
+ * For anything more, use {@link fetch}.
4701
+ */
4702
+ get: (params: {
4703
+ name: string;
4704
+ }, options?: ContextRequestOptions) => Promise<McpDoc | null>;
4705
+ };
4706
+ /** Sources: the distilled units builds cite. */
4707
+ sources: {
4708
+ /**
4709
+ * List sources, optionally filtered by `status` or the `importId` they
4710
+ * came from. `ids` is a lookup mode: it resolves those exact sources
4711
+ * (e.g. from an entry's citations) and overrides `status` and `cursor`.
4712
+ */
4713
+ list: (params?: {
4714
+ status?: Source['status'];
4715
+ importId?: string;
4716
+ ids?: string[];
4717
+ } & ListOptions$1) => Promise<{
4718
+ data: {
4719
+ id: string;
4720
+ knowledgeBaseId: string;
4721
+ filename: string;
4722
+ kind: 'web' | 'file' | 'dataset';
4723
+ sizeBytes: number;
4724
+ status: 'pending' | 'processing' | 'ready' | 'failed' | 'skipped';
4725
+ tldr: string | null;
4726
+ topics: string[] | null;
4727
+ canonicalUrl: string | null;
4728
+ fetchedAt: string | null;
4729
+ distilledAt: string | null;
4730
+ createdAt: string;
4731
+ }[];
4732
+ nextCursor: string | null;
4733
+ }>;
4734
+ get: (params: {
4735
+ sourceId: string;
4736
+ }, options?: RequestOptions$2) => Promise<{
4737
+ id: string;
4738
+ knowledgeBaseId: string;
4739
+ filename: string;
4740
+ kind: 'web' | 'file' | 'dataset';
4741
+ sizeBytes: number;
4742
+ status: 'pending' | 'processing' | 'ready' | 'failed' | 'skipped';
4743
+ tldr: string | null;
4744
+ topics: string[] | null;
4745
+ canonicalUrl: string | null;
4746
+ fetchedAt: string | null;
4747
+ distilledAt: string | null;
4748
+ createdAt: string;
4749
+ }>;
4750
+ /**
4751
+ * Distilled source content, optionally a line range: the evidence behind
4752
+ * a citation or an issue.
4753
+ */
4754
+ content: (params: {
4755
+ sourceId: string;
4756
+ startLine?: number;
4757
+ endLine?: number;
4758
+ }, options?: RequestOptions$2) => Promise<{
4759
+ sourceId: string;
4760
+ content: string;
4761
+ totalLines: number;
4762
+ slice: {
4763
+ start: number;
4764
+ end: number;
4765
+ };
4766
+ }>;
4767
+ delete: (params: {
4768
+ sourceId: string;
4769
+ }, options?: RequestOptions$2) => Promise<void>;
4770
+ };
4771
+ }
4772
+ /**
4773
+ * Observable counterpart of {@link ContextClient}. Collection-level
4774
+ * methods and the GROQ-backed reads; knowledge-base scoped write
4775
+ * operations are promise-based, so use the promise client
4776
+ * (`client.context`) for those.
4777
+ *
4778
+ * @beta
4779
+ */
4780
+ declare class ObservableContextClient {
4781
+ #private;
4782
+ constructor(client: ObservableSanityClient, httpRequest: HttpRequest);
4783
+ /** The knowledge base collection: management addressed per call. */
4784
+ knowledgeBases: {
4785
+ /** Create a knowledge base. Requires the org-level knowledge-base create grant. */
4786
+ create: (params: CreateKnowledgeBaseParams, options?: RequestOptions$2) => Observable<KnowledgeBase>;
4787
+ /** List the organization's knowledge bases. */
4788
+ list: (params: {
4789
+ organizationId: string;
4790
+ } & ListOptions$1) => Observable<KnowledgeBasesResponse>;
4791
+ /** Fetch a knowledge base by its id. */
4792
+ get: (knowledgeBaseId: string, options?: RequestOptions$2) => Observable<KnowledgeBase>;
4793
+ /** Edit a knowledge base's configuration. */
4794
+ edit: (knowledgeBaseId: string, params: EditKnowledgeBaseParams, options?: RequestOptions$2) => Observable<KnowledgeBase>;
4795
+ /** Delete a knowledge base and its generated content. */
4796
+ delete: (knowledgeBaseId: string, options?: RequestOptions$2) => Observable<void>;
4797
+ };
4798
+ /**
4799
+ * GROQ over the organization's Context documents (conversation telemetry
4800
+ * today; the store holds every Context family and the caller's access
4801
+ * decides what a query returns, so filter on `_type`).
4802
+ *
4803
+ * Requires `context.organizationId` in the client configuration.
4804
+ */
4805
+ fetch<R = unknown>(query: string, params?: QueryParams, options?: ContextRequestOptions): Observable<R>;
4806
+ /**
4807
+ * Listen for changes to the organization's Context documents. Mirrors
4808
+ * `client.listen(query, params, options)` and emits mutation events by
4809
+ * default.
4810
+ */
4811
+ listen<Opts extends ContextListenOptions | undefined = undefined>(query: string, params?: QueryParams, options?: Opts): Observable<ListenEventFromOptions<SanityDocument, Opts>>;
4812
+ /**
4813
+ * Conversation telemetry. `threadId` identifies the conversation within
4814
+ * the organization — reuse means the same conversation. Beyond the canned
4815
+ * `get`, reads go through {@link fetch} and {@link listen} with GROQ
4816
+ * (`_type == "sanity.context.conversation"`).
4817
+ *
4818
+ * Requires `context.organizationId` in the client configuration.
4819
+ */
4820
+ conversations: {
4821
+ /**
4822
+ * Record a conversation. Messages replace the stored transcript
4823
+ * wholesale; `metadata` and model fields only overwrite when present.
4824
+ * Last write per thread wins — retries are safe.
4825
+ */
4826
+ save: (params: {
4827
+ threadId: string;
4828
+ } & SaveConversationParams, options?: RequestOptions$2) => Observable<Conversation>;
4829
+ /**
4830
+ * Record the classification your own model produced for one thread:
4831
+ * exactly one of `coreMetrics` (a verdict) or `classificationError`
4832
+ * (why classification failed).
4833
+ */
4834
+ classify: (params: {
4835
+ threadId: string;
4836
+ } & ClassifyConversationParams, options?: RequestOptions$2) => Observable<Conversation>;
4837
+ /**
4838
+ * One recorded conversation by its thread id, or `null` when the thread
4839
+ * was never recorded. Runs:
4840
+ *
4841
+ * `*[_type == "sanity.context.conversation" && organizationId == $org && threadId == $threadId][0]`
4842
+ *
4843
+ * For anything more, use {@link fetch}.
4844
+ */
4845
+ get: (params: {
4846
+ threadId: string;
4847
+ }, options?: ContextRequestOptions) => Observable<ConversationDoc | null>;
4848
+ };
4849
+ /**
4850
+ * Entries: the built outline, one entry per node. Reads are canned GROQ
4851
+ * queries against the organization's document store; for anything more,
4852
+ * use {@link fetch}. Requires `context.organizationId` alongside the
4853
+ * knowledge-base `resource` in the client configuration.
4854
+ */
4855
+ entries: {
4856
+ /**
4857
+ * Every entry, path-ordered, as a metadata view (`_id`, `path`,
4858
+ * `title`, `tldr`, `status`) with bodies excluded. Drains keyset pages
4859
+ * internally and emits the complete set. Runs:
4860
+ *
4861
+ * `*[_type == "sanity.context.entry" && knowledgeBaseId == $kb && path > $after] | order(path asc) [0...200] {_id, path, title, tldr, status}`
4862
+ *
4863
+ * For bodies, use `entries.get` or {@link fetch}.
4864
+ */
4865
+ list: (options?: ContextRequestOptions) => Observable<Entry[]>;
4866
+ /**
4867
+ * One entry with its full body and citations, by outline path (e.g.
4868
+ * `billing/refunds`), or `null` when no entry sits at that path. Runs:
4869
+ *
4870
+ * `*[_type == "sanity.context.entry" && knowledgeBaseId == $kb && path == $path][0]`
4871
+ *
4872
+ * For anything more, use {@link fetch}.
4873
+ */
4874
+ get: (params: {
4875
+ path: string;
4876
+ }, options?: ContextRequestOptions) => Observable<EntryDoc | null>;
4877
+ /**
4878
+ * Rebuild one entry from its already-placed sources, by outline path.
4879
+ * Poll the returned job with the promise client's `jobs`;
4880
+ * `affectedEntries` lists every entry the rebuild touches.
4881
+ */
4882
+ rebuild: (params: {
4883
+ path: string;
4884
+ }, options?: RequestOptions$2) => Observable<RebuildEntryResponse>;
4885
+ };
4886
+ /**
4887
+ * Issues: findings from builds awaiting triage. Reads are canned GROQ
4888
+ * queries against the organization's document store; for anything more,
4889
+ * use {@link fetch}. Requires `context.organizationId` alongside the
4890
+ * knowledge-base `resource` in the client configuration.
4891
+ */
4892
+ issues: {
4893
+ /**
4894
+ * Every issue on the knowledge base, oldest first, optionally narrowed
4895
+ * to one status. Drains keyset pages internally and emits the complete
4896
+ * set. Runs:
4897
+ *
4898
+ * `*[_type == "sanity.context.issue" && knowledgeBaseId == $kb && status == $status] | order(_createdAt asc, _id asc)`
4899
+ *
4900
+ * (the status clause only when given). For anything more, use {@link fetch}.
4901
+ */
4902
+ list: (params?: {
4903
+ status?: 'open' | 'accepted' | 'rejected';
4904
+ }, options?: ContextRequestOptions) => Observable<IssueDoc[]>;
4905
+ /**
4906
+ * One issue by its document id, or `null` when it does not exist. Runs:
4907
+ *
4908
+ * `*[_type == "sanity.context.issue" && knowledgeBaseId == $kb && _id == $id][0]`
4909
+ *
4910
+ * For anything more, use {@link fetch}.
4911
+ */
4912
+ get: (params: {
4913
+ issueId: string;
4914
+ }, options?: ContextRequestOptions) => Observable<IssueDoc | null>;
4915
+ };
4916
+ /**
4917
+ * Instructions: standing decisions that steer every build. The canned
4918
+ * GROQ read; writes are promise-based on `client.context`.
4919
+ */
4920
+ instructions: {
4921
+ /**
4922
+ * Every current-schema instruction on the knowledge base, oldest first.
4923
+ * Drains keyset pages internally and emits the complete set. Runs:
4924
+ *
4925
+ * `*[_type == "sanity.context.instruction" && knowledgeBaseId == $kb && schemaVersion == 1] | order(_createdAt asc, _id asc)`
4926
+ *
4927
+ * For anything more, use {@link fetch}. Requires `context.organizationId`
4928
+ * alongside the knowledge-base `resource` in the client configuration.
4929
+ */
4930
+ list: (options?: ContextRequestOptions) => Observable<InstructionDoc[]>;
4931
+ };
4932
+ /**
4933
+ * MCP endpoint configurations, org-owned documents read with canned GROQ
4934
+ * queries. Requires `context.organizationId` in the client configuration.
4935
+ */
4936
+ mcpEndpoints: {
4937
+ /**
4938
+ * The organization's MCP endpoint configurations, oldest first. Runs:
4939
+ *
4940
+ * `*[_type == "sanity.context.mcp" && organizationId == $org] | order(_createdAt asc, _id asc) [0...500]`
4941
+ *
4942
+ * For anything more, use {@link fetch}.
4943
+ */
4944
+ list: (options?: ContextRequestOptions) => Observable<McpDoc[]>;
4945
+ /**
4946
+ * One MCP endpoint configuration by its URL name, or `null` when none
4947
+ * carries that name. Runs:
4948
+ *
4949
+ * `*[_type == "sanity.context.mcp" && organizationId == $org && name == $name][0]`
4950
+ *
4951
+ * For anything more, use {@link fetch}.
4952
+ */
4953
+ get: (params: {
4954
+ name: string;
4955
+ }, options?: ContextRequestOptions) => Observable<McpDoc | null>;
4956
+ };
4957
+ }
1729
4958
  /**
1730
4959
  * @public
1731
4960
  */
@@ -2889,6 +6118,8 @@ declare class ObservableSanityClient {
2889
6118
  };
2890
6119
  functions: ObservableFunctionsClient;
2891
6120
  releases: ObservableReleasesClient;
6121
+ /** @beta */
6122
+ context: ObservableContextClient;
2892
6123
  /**
2893
6124
  * Instance properties
2894
6125
  */
@@ -3523,6 +6754,8 @@ declare class SanityClient {
3523
6754
  };
3524
6755
  functions: FunctionsClient;
3525
6756
  releases: ReleasesClient;
6757
+ /** @beta */
6758
+ context: ContextClient;
3526
6759
  /**
3527
6760
  * Observable version of the Sanity client, with the same configuration as the promise-based one
3528
6761
  */
@@ -4472,6 +7705,9 @@ type ClientVariant = ClientVariantConditions | string;
4472
7705
  type ClientConfigResource = {
4473
7706
  type: 'canvas';
4474
7707
  id: string;
7708
+ } | {
7709
+ type: 'knowledge-base';
7710
+ id: string;
4475
7711
  } | {
4476
7712
  type: 'media-library';
4477
7713
  id: string;
@@ -4659,6 +7895,16 @@ interface ClientConfig {
4659
7895
  collaboration?: {
4660
7896
  organizationId?: string;
4661
7897
  };
7898
+ /**
7899
+ * Organization-scoped configuration for Context APIs.
7900
+ *
7901
+ * Currently this is used by `context.insights` methods.
7902
+ *
7903
+ * @beta
7904
+ */
7905
+ context?: {
7906
+ organizationId?: string;
7907
+ };
4662
7908
  }
4663
7909
  /** @public */
4664
7910
  interface InitializedClientConfig extends ClientConfig {
@@ -4924,6 +8170,7 @@ type DatasetAclMode = 'public' | 'private' | 'custom';
4924
8170
  /** @public */
4925
8171
  type DatasetCreateOptions = {
4926
8172
  aclMode?: DatasetAclMode;
8173
+ description?: string;
4927
8174
  embeddings?: {
4928
8175
  enabled: boolean;
4929
8176
  projection?: string;
@@ -4932,6 +8179,7 @@ type DatasetCreateOptions = {
4932
8179
  /** @public */
4933
8180
  type DatasetEditOptions = {
4934
8181
  aclMode?: DatasetAclMode;
8182
+ description?: string;
4935
8183
  };
4936
8184
  /** @public */
4937
8185
  type EmbeddingsSettings = {
@@ -4948,17 +8196,22 @@ type EmbeddingsSettingsBody = {
4948
8196
  type DatasetResponse = {
4949
8197
  datasetName: string;
4950
8198
  aclMode: DatasetAclMode;
8199
+ description: string;
4951
8200
  };
4952
8201
  /** @public */
4953
8202
  type DatasetsResponse = {
4954
8203
  name: string;
4955
8204
  aclMode: DatasetAclMode;
8205
+ description: string;
4956
8206
  createdAt: string;
4957
8207
  createdByUserId: string;
4958
8208
  addonFor: string | null;
4959
8209
  datasetProfile: string;
4960
8210
  features: string[];
4961
- tags: string[];
8211
+ tags: {
8212
+ name: string;
8213
+ title: string;
8214
+ }[];
4962
8215
  }[];
4963
8216
  /** @public */
4964
8217
  interface SanityProjectMember {
@@ -6722,5 +9975,5 @@ declare const createClient: (config: ClientConfig) => SanityClient;
6722
9975
  * @deprecated Use the named export `createClient` instead of the `default` export
6723
9976
  */
6724
9977
  declare const deprecatedCreateClient: (config: ClientConfig) => SanityClient;
6725
- export { Action, ActionError, ActionErrorItem, type AgentActionParam, type AgentActionParams, type AgentActionPath, type AgentActionPathSegment, type AgentActionTarget, AllDocumentIdsMutationOptions, AllDocumentsMutationOptions, AnimatedImageFormat, AnimatedTransformOptions, Any, ApiError, ArchiveReleaseAction, AssetMetadataType, type AssetsClient, AttributeSet, AuthProvider, AuthProviderResponse, BaseActionOptions, BaseMutationOptions, BasePatch, BaseTransaction, ChannelError, ChannelErrorEvent, ClientConfig, ClientError, ClientPerspective, ClientReturn, ClientVariant, ClientVariantConditions, type CollaborationCommentCreate, type CollaborationCommentDocument, type CollaborationCommentFieldValue, type CollaborationCommentMessage, type CollaborationCommentPortableTextBlock, type CollaborationCommentRange, type CollaborationCommentReactionShortName, type CollaborationCommentSelection, type CollaborationCommentStatus, type CollaborationCommentTarget, type CollaborationCommentUpdate, type CollaborationCommentsClient, type CollaborationCommentsListenOptions, type CollaborationCommentsRequestOptions, type CollaborationCommentsWriteOptions, ConnectionFailedError, type ConstantAgentActionParam, ContentSourceMap, ContentSourceMapDocument, ContentSourceMapDocumentBase, ContentSourceMapDocumentValueSource, ContentSourceMapDocuments, ContentSourceMapLiteralSource, ContentSourceMapMapping, ContentSourceMapMappings, type ContentSourceMapParsedPath, type ContentSourceMapParsedPathKeyedSegment, ContentSourceMapPaths, ContentSourceMapRemoteDocument, ContentSourceMapSource, ContentSourceMapUnknownSource, ContentSourceMapValueMapping, CorsOriginError, CreateAction, CreateReleaseAction, CreateVariantAction, CreateVariantDefinitionAction, CreateVersionAction, CurrentSanityUser, DatasetAclMode, DatasetCreateOptions, DatasetEditOptions, DatasetResponse, type DatasetsClient, DatasetsResponse, DeleteAction, DeleteReleaseAction, DeleteVariantAction, DeleteVariantDefinitionAction, DiscardAction, DiscardVersionAction, DisconnectError, DisconnectEvent, type DocumentAgentActionParam, EXPERIMENTAL_API_WARNING, EditAction, EditReleaseAction, EditVariantAction, EditVariantDefinitionAction, EditableReleaseDocument, EmbeddingsSettings, EmbeddingsSettingsBody, ErrorProps, type EventSourceEvent, type EventSourceInstance, type FieldAgentActionParam, type FilterDefault, FilteredResponseQueryOptions, FirstDocumentIdMutationOptions, FirstDocumentMutationOptions, FitMode, type GenerateInstruction, type GenerateOperation, type GenerateTarget, type GenerateTargetDocument, type GenerateTargetInclude, type GroqAgentActionParam, type HttpError, HttpRequest, IdentifiedSanityDocumentStub, type ImageDescriptionOperation, ImportReleaseAction, InitializedClientConfig, type InitializedStegaConfig, InsertPatch, type InvokeFunctionEvent, type InvokeFunctionOptions, type InvokeFunctionRequest, ListenEvent, ListenEventName, ListenOptions, ListenParams, type LiveClient, LiveEvent, LiveEventGoAway, LiveEventMessage, LiveEventReconnect, LiveEventRestart, LiveEventWelcome, type Logger, MediaLibraryAssetDocument, MediaLibraryAssetInstanceIdentifier, MediaLibraryAssetVersion, MediaLibraryPlaybackInfoOptions, type MediaLibraryVideoClient, MediaLibraryVideoPlaybackTransformations, MessageError, MessageParseError, MultipleActionResult, MultipleMutationResult, Mutation, MutationError, MutationErrorItem, MutationEvent, MutationOperation, MutationSelection, MutationSelectionQueryParams, type ObservableAssetsClient, type ObservableCollaborationCommentsClient, type ObservableDatasetsClient, type ObservableMediaLibraryVideoClient, ObservablePatch, ObservablePatchBuilder, type ObservableProjectsClient, ObservableSanityClient, ObservableTransaction, type ObservableUsersClient, OpenEvent, PartialExcept, Patch, PatchBuilder, type PatchDocument, PatchMutationOperation, type PatchOperation, PatchOperations, PatchSelection, type PatchTarget, type ProjectsClient, type PromptRequest, PublishAction, PublishReleaseAction, PublishVariantAction, QueryOptions, QueryParams, QueryParseError, QueryWithoutParams, RawQueryResponse, RawQuerylessQueryResponse, RawRequestOptions, ReconnectEvent, ReleaseAction, ReleaseCardinality, ReleaseDocument, ReleaseId, ReleaseState, ReleaseType, ReplaceDraftAction, ReplaceVersionAction, RequestHandler, RequestHandlerOptions, RequestObservableOptions, RequestOptions, RequestUrlOptions, Requester, ResetEvent, type ResolveStudioUrl, ResponseQueryOptions, ResumableListenEventNames, ResumableListenOptions, SanityAssetDocument, SanityClient, SanityDocument, SanityDocumentStub, SanityImageAssetDocument, SanityImagePalette, SanityProject, SanityProjectMember, SanityQueries, SanityReference, SanityUser, ScheduleReleaseAction, ServerError, type ServerSentEvent, SingleActionResult, SingleMutationResult, StackablePerspective, type StegaConfig, type StegaConfigRequiredKeys, StillImageFormat, StoryboardTransformOptions, type StudioBaseRoute, type StudioBaseUrl, type StudioUrl, SyncTag, ThumbnailTransformOptions, type TimeoutErrorLike, Transaction, TransactionAllDocumentIdsMutationOptions, TransactionAllDocumentsMutationOptions, TransactionFirstDocumentIdMutationOptions, TransactionFirstDocumentMutationOptions, TransactionMutationOptions, type TransformDocument, type TransformOperation, type TransformTarget, type TransformTargetDocument, type TransformTargetInclude, type TranslateDocument, type TranslateTarget, type TranslateTargetInclude, UnarchiveReleaseAction, UnfilteredResponseQueryOptions, UnfilteredResponseWithoutQuery, UnpublishAction, UnpublishVariantAction, UnpublishVersionAction, UnscheduleReleaseAction, UploadBody, UploadClientConfig, UploadEvent, UploadProgressEvent, UploadResponseEvent, type UsersClient, VariantAction, VariantDefinitionAction, VersionAction, VideoPlaybackInfo, VideoPlaybackInfoItem, VideoPlaybackInfoItemPublic, VideoPlaybackInfoItemSigned, VideoPlaybackInfoPublic, VideoPlaybackInfoSigned, VideoPlaybackTokens, VideoRenditionInfo, VideoRenditionInfoPublic, VideoRenditionInfoSigned, VideoSubtitleInfo, VideoSubtitleInfoPublic, VideoSubtitleInfoSigned, WelcomeBackEvent, WelcomeEvent, type _listen, connectEventSource, createClient, deprecatedCreateClient as default, formatQueryParseError, isHttpError, isQueryParseError, isTimeoutError, requester, validateApiPerspective };
9978
+ export { Action, ActionError, ActionErrorItem, type AgentActionParam, type AgentActionParams, type AgentActionPath, type AgentActionPathSegment, type AgentActionTarget, AllDocumentIdsMutationOptions, AllDocumentsMutationOptions, AnimatedImageFormat, AnimatedTransformOptions, Any, ApiError, ArchiveReleaseAction, AssetMetadataType, type AssetsClient, AttributeSet, AuthProvider, AuthProviderResponse, BaseActionOptions, BaseMutationOptions, BasePatch, BaseTransaction, ChannelError, ChannelErrorEvent, ClientConfig, ClientError, ClientPerspective, ClientReturn, ClientVariant, ClientVariantConditions, type CollaborationCommentCreate, type CollaborationCommentDocument, type CollaborationCommentFieldValue, type CollaborationCommentMessage, type CollaborationCommentPortableTextBlock, type CollaborationCommentRange, type CollaborationCommentReactionShortName, type CollaborationCommentSelection, type CollaborationCommentStatus, type CollaborationCommentTarget, type CollaborationCommentUpdate, type CollaborationCommentsClient, type CollaborationCommentsListenOptions, type CollaborationCommentsRequestOptions, type CollaborationCommentsWriteOptions, ConnectionFailedError, type ConstantAgentActionParam, ContentSourceMap, ContentSourceMapDocument, ContentSourceMapDocumentBase, ContentSourceMapDocumentValueSource, ContentSourceMapDocuments, ContentSourceMapLiteralSource, ContentSourceMapMapping, ContentSourceMapMappings, type ContentSourceMapParsedPath, type ContentSourceMapParsedPathKeyedSegment, ContentSourceMapPaths, ContentSourceMapRemoteDocument, ContentSourceMapSource, ContentSourceMapUnknownSource, ContentSourceMapValueMapping, types_d_exports as Context, CorsOriginError, CreateAction, CreateReleaseAction, CreateVariantAction, CreateVariantDefinitionAction, CreateVersionAction, CurrentSanityUser, DatasetAclMode, DatasetCreateOptions, DatasetEditOptions, DatasetResponse, type DatasetsClient, DatasetsResponse, DeleteAction, DeleteReleaseAction, DeleteVariantAction, DeleteVariantDefinitionAction, DiscardAction, DiscardVersionAction, DisconnectError, DisconnectEvent, type DocumentAgentActionParam, EXPERIMENTAL_API_WARNING, EditAction, EditReleaseAction, EditVariantAction, EditVariantDefinitionAction, EditableReleaseDocument, EmbeddingsSettings, EmbeddingsSettingsBody, ErrorProps, type EventSourceEvent, type EventSourceInstance, type FieldAgentActionParam, type FilterDefault, FilteredResponseQueryOptions, FirstDocumentIdMutationOptions, FirstDocumentMutationOptions, FitMode, type GenerateInstruction, type GenerateOperation, type GenerateTarget, type GenerateTargetDocument, type GenerateTargetInclude, type GroqAgentActionParam, type HttpError, HttpRequest, IdentifiedSanityDocumentStub, type ImageDescriptionOperation, ImportReleaseAction, InitializedClientConfig, type InitializedStegaConfig, InsertPatch, type InvokeFunctionEvent, type InvokeFunctionOptions, type InvokeFunctionRequest, ListenEvent, ListenEventName, ListenOptions, ListenParams, type LiveClient, LiveEvent, LiveEventGoAway, LiveEventMessage, LiveEventReconnect, LiveEventRestart, LiveEventWelcome, type Logger, MediaLibraryAssetDocument, MediaLibraryAssetInstanceIdentifier, MediaLibraryAssetVersion, MediaLibraryPlaybackInfoOptions, type MediaLibraryVideoClient, MediaLibraryVideoPlaybackTransformations, MessageError, MessageParseError, MultipleActionResult, MultipleMutationResult, Mutation, MutationError, MutationErrorItem, MutationEvent, MutationOperation, MutationSelection, MutationSelectionQueryParams, type ObservableAssetsClient, type ObservableCollaborationCommentsClient, type ObservableDatasetsClient, type ObservableMediaLibraryVideoClient, ObservablePatch, ObservablePatchBuilder, type ObservableProjectsClient, ObservableSanityClient, ObservableTransaction, type ObservableUsersClient, OpenEvent, PartialExcept, Patch, PatchBuilder, type PatchDocument, PatchMutationOperation, type PatchOperation, PatchOperations, PatchSelection, type PatchTarget, type ProjectsClient, type PromptRequest, PublishAction, PublishReleaseAction, PublishVariantAction, QueryOptions, QueryParams, QueryParseError, QueryWithoutParams, RawQueryResponse, RawQuerylessQueryResponse, RawRequestOptions, ReconnectEvent, ReleaseAction, ReleaseCardinality, ReleaseDocument, ReleaseId, ReleaseState, ReleaseType, ReplaceDraftAction, ReplaceVersionAction, RequestHandler, RequestHandlerOptions, RequestObservableOptions, RequestOptions, RequestUrlOptions, Requester, ResetEvent, type ResolveStudioUrl, ResponseQueryOptions, ResumableListenEventNames, ResumableListenOptions, SanityAssetDocument, SanityClient, SanityDocument, SanityDocumentStub, SanityImageAssetDocument, SanityImagePalette, SanityProject, SanityProjectMember, SanityQueries, SanityReference, SanityUser, ScheduleReleaseAction, ServerError, type ServerSentEvent, SingleActionResult, SingleMutationResult, StackablePerspective, type StegaConfig, type StegaConfigRequiredKeys, StillImageFormat, StoryboardTransformOptions, type StudioBaseRoute, type StudioBaseUrl, type StudioUrl, SyncTag, ThumbnailTransformOptions, type TimeoutErrorLike, Transaction, TransactionAllDocumentIdsMutationOptions, TransactionAllDocumentsMutationOptions, TransactionFirstDocumentIdMutationOptions, TransactionFirstDocumentMutationOptions, TransactionMutationOptions, type TransformDocument, type TransformOperation, type TransformTarget, type TransformTargetDocument, type TransformTargetInclude, type TranslateDocument, type TranslateTarget, type TranslateTargetInclude, UnarchiveReleaseAction, UnfilteredResponseQueryOptions, UnfilteredResponseWithoutQuery, UnpublishAction, UnpublishVariantAction, UnpublishVersionAction, UnscheduleReleaseAction, UploadBody, UploadClientConfig, UploadEvent, UploadProgressEvent, UploadResponseEvent, type UsersClient, VariantAction, VariantDefinitionAction, VersionAction, VideoPlaybackInfo, VideoPlaybackInfoItem, VideoPlaybackInfoItemPublic, VideoPlaybackInfoItemSigned, VideoPlaybackInfoPublic, VideoPlaybackInfoSigned, VideoPlaybackTokens, VideoRenditionInfo, VideoRenditionInfoPublic, VideoRenditionInfoSigned, VideoSubtitleInfo, VideoSubtitleInfoPublic, VideoSubtitleInfoSigned, WelcomeBackEvent, WelcomeEvent, type _listen, connectEventSource, createClient, deprecatedCreateClient as default, formatQueryParseError, isHttpError, isQueryParseError, isTimeoutError, requester, validateApiPerspective };
6726
9979
  //# sourceMappingURL=index.node.d.ts.map