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