@combycode/llm-sdk 1.0.0-rc.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 (228) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/LICENSE +21 -0
  3. package/README.md +103 -0
  4. package/dist/agent/approval-types.d.ts +49 -0
  5. package/dist/agent/context-registry/layers.d.ts +39 -0
  6. package/dist/agent/context-registry/registry-internal.d.ts +14 -0
  7. package/dist/agent/context-registry/registry.d.ts +104 -0
  8. package/dist/agent/context-registry/types.d.ts +110 -0
  9. package/dist/agent/guardrail-types.d.ts +58 -0
  10. package/dist/agent/history-types.d.ts +40 -0
  11. package/dist/agent/history.d.ts +111 -0
  12. package/dist/agent/loop-config.d.ts +67 -0
  13. package/dist/agent/loop-internals.d.ts +46 -0
  14. package/dist/agent/loop-step-state.d.ts +20 -0
  15. package/dist/agent/loop.d.ts +133 -0
  16. package/dist/agent/tool-key.d.ts +3 -0
  17. package/dist/agent/types.d.ts +138 -0
  18. package/dist/bus/agent-bus.d.ts +99 -0
  19. package/dist/bus/async-context.browser.d.ts +13 -0
  20. package/dist/bus/async-context.d.ts +11 -0
  21. package/dist/bus/async-context.types.d.ts +14 -0
  22. package/dist/bus/hook-bus.d.ts +43 -0
  23. package/dist/bus/hook-map.d.ts +592 -0
  24. package/dist/helpers/agent.d.ts +32 -0
  25. package/dist/helpers/batch.d.ts +74 -0
  26. package/dist/helpers/calibration-store.d.ts +27 -0
  27. package/dist/helpers/calibration-types.d.ts +64 -0
  28. package/dist/helpers/chain.d.ts +30 -0
  29. package/dist/helpers/client-pool.d.ts +15 -0
  30. package/dist/helpers/client-resolver.d.ts +62 -0
  31. package/dist/helpers/collection.d.ts +19 -0
  32. package/dist/helpers/consolidate.d.ts +66 -0
  33. package/dist/helpers/content.d.ts +25 -0
  34. package/dist/helpers/conversation-export.d.ts +14 -0
  35. package/dist/helpers/conversation-zip.d.ts +28 -0
  36. package/dist/helpers/count-tokens.d.ts +26 -0
  37. package/dist/helpers/define-tool.d.ts +66 -0
  38. package/dist/helpers/delegate.d.ts +6 -0
  39. package/dist/helpers/embed.d.ts +24 -0
  40. package/dist/helpers/engine.d.ts +121 -0
  41. package/dist/helpers/estimate-types.d.ts +67 -0
  42. package/dist/helpers/estimate.d.ts +45 -0
  43. package/dist/helpers/estimator.d.ts +48 -0
  44. package/dist/helpers/handoff-types.d.ts +18 -0
  45. package/dist/helpers/handoff.d.ts +14 -0
  46. package/dist/helpers/llm.d.ts +24 -0
  47. package/dist/helpers/mcp.d.ts +82 -0
  48. package/dist/helpers/media.d.ts +58 -0
  49. package/dist/helpers/models.d.ts +36 -0
  50. package/dist/helpers/moderate-types.d.ts +73 -0
  51. package/dist/helpers/moderate.d.ts +13 -0
  52. package/dist/helpers/moderation-guardrail.d.ts +29 -0
  53. package/dist/helpers/observer.d.ts +36 -0
  54. package/dist/helpers/one-shot.d.ts +86 -0
  55. package/dist/helpers/parallel.d.ts +16 -0
  56. package/dist/helpers/realtime.d.ts +25 -0
  57. package/dist/helpers/route.d.ts +29 -0
  58. package/dist/helpers/select-model.d.ts +41 -0
  59. package/dist/helpers/server.d.ts +32 -0
  60. package/dist/helpers/transcribe.d.ts +36 -0
  61. package/dist/index.browser.js +38047 -0
  62. package/dist/index.d.ts +275 -0
  63. package/dist/index.js +37974 -0
  64. package/dist/llm/audio/voices.d.ts +7 -0
  65. package/dist/llm/client-config.d.ts +37 -0
  66. package/dist/llm/client-internal.d.ts +28 -0
  67. package/dist/llm/client.d.ts +68 -0
  68. package/dist/llm/providers/_shared/constants.d.ts +5 -0
  69. package/dist/llm/providers/_shared/response-utils.d.ts +8 -0
  70. package/dist/llm/providers/anthropic/batch.d.ts +19 -0
  71. package/dist/llm/providers/anthropic/constants.d.ts +13 -0
  72. package/dist/llm/providers/anthropic/files.d.ts +23 -0
  73. package/dist/llm/providers/anthropic/messages.d.ts +30 -0
  74. package/dist/llm/providers/google/batch.d.ts +20 -0
  75. package/dist/llm/providers/google/constants.d.ts +6 -0
  76. package/dist/llm/providers/google/embeddings.d.ts +15 -0
  77. package/dist/llm/providers/google/files.d.ts +22 -0
  78. package/dist/llm/providers/google/generate.d.ts +27 -0
  79. package/dist/llm/providers/google/interactions.d.ts +30 -0
  80. package/dist/llm/providers/google/media.d.ts +27 -0
  81. package/dist/llm/providers/google/realtime.d.ts +27 -0
  82. package/dist/llm/providers/openai/batch.d.ts +19 -0
  83. package/dist/llm/providers/openai/completions.d.ts +25 -0
  84. package/dist/llm/providers/openai/embeddings.d.ts +16 -0
  85. package/dist/llm/providers/openai/files.d.ts +23 -0
  86. package/dist/llm/providers/openai/media.d.ts +28 -0
  87. package/dist/llm/providers/openai/moderations.d.ts +19 -0
  88. package/dist/llm/providers/openai/realtime.d.ts +24 -0
  89. package/dist/llm/providers/openai/responses.d.ts +29 -0
  90. package/dist/llm/providers/openai/tiers.d.ts +13 -0
  91. package/dist/llm/providers/openai/transcription.d.ts +20 -0
  92. package/dist/llm/providers/openrouter/completions.d.ts +15 -0
  93. package/dist/llm/providers/openrouter/embeddings.d.ts +7 -0
  94. package/dist/llm/providers/openrouter/media.d.ts +25 -0
  95. package/dist/llm/providers/openrouter/responses.d.ts +17 -0
  96. package/dist/llm/providers/xai/batch.d.ts +19 -0
  97. package/dist/llm/providers/xai/completions.d.ts +24 -0
  98. package/dist/llm/providers/xai/files.d.ts +23 -0
  99. package/dist/llm/providers/xai/media.d.ts +27 -0
  100. package/dist/llm/providers/xai/responses.d.ts +20 -0
  101. package/dist/llm/realtime/session.d.ts +34 -0
  102. package/dist/llm/realtime/types.d.ts +66 -0
  103. package/dist/llm/server-state.d.ts +32 -0
  104. package/dist/llm/types/audio.d.ts +18 -0
  105. package/dist/llm/types/messages.d.ts +125 -0
  106. package/dist/llm/types/options.d.ts +51 -0
  107. package/dist/llm/types/provider.d.ts +39 -0
  108. package/dist/llm/types/request.d.ts +51 -0
  109. package/dist/llm/types/response.d.ts +36 -0
  110. package/dist/llm/types/schema-utils.d.ts +8 -0
  111. package/dist/llm/types/stream.d.ts +42 -0
  112. package/dist/llm/types/tiers.d.ts +11 -0
  113. package/dist/llm/types/tools.d.ts +20 -0
  114. package/dist/network/engine.d.ts +87 -0
  115. package/dist/network/errors.d.ts +14 -0
  116. package/dist/network/queue-state-config.d.ts +41 -0
  117. package/dist/network/queue-state.d.ts +45 -0
  118. package/dist/network/rate-limiter.d.ts +49 -0
  119. package/dist/network/realtime-connection.d.ts +40 -0
  120. package/dist/network/request-queue.d.ts +40 -0
  121. package/dist/network/semaphore.d.ts +12 -0
  122. package/dist/network/sse.d.ts +3 -0
  123. package/dist/network/types.d.ts +127 -0
  124. package/dist/plugins/batch/batcher.d.ts +45 -0
  125. package/dist/plugins/batch/strategy.d.ts +20 -0
  126. package/dist/plugins/batch/types.d.ts +54 -0
  127. package/dist/plugins/cache/cache.d.ts +50 -0
  128. package/dist/plugins/cache/file-store.d.ts +15 -0
  129. package/dist/plugins/cache/memory-store.d.ts +10 -0
  130. package/dist/plugins/cache/types.d.ts +28 -0
  131. package/dist/plugins/configuration/configuration.d.ts +71 -0
  132. package/dist/plugins/context-guard/facts.d.ts +14 -0
  133. package/dist/plugins/context-guard/guard.d.ts +27 -0
  134. package/dist/plugins/context-guard/strategies/layered.d.ts +24 -0
  135. package/dist/plugins/context-guard/strategies/truncate.d.ts +19 -0
  136. package/dist/plugins/context-guard/tools.d.ts +50 -0
  137. package/dist/plugins/context-guard/types.d.ts +110 -0
  138. package/dist/plugins/context-measurer/calibration/store.d.ts +19 -0
  139. package/dist/plugins/context-measurer/counter/count-api.d.ts +41 -0
  140. package/dist/plugins/context-measurer/counter/heuristic.d.ts +25 -0
  141. package/dist/plugins/context-measurer/counter/hybrid.d.ts +33 -0
  142. package/dist/plugins/context-measurer/counter/tiktoken.d.ts +13 -0
  143. package/dist/plugins/context-measurer/measurer.d.ts +49 -0
  144. package/dist/plugins/context-measurer/types.d.ts +40 -0
  145. package/dist/plugins/cost-collector/collector.d.ts +42 -0
  146. package/dist/plugins/cost-collector/cost-collector-internal.d.ts +58 -0
  147. package/dist/plugins/cost-collector/cost-collector-types.d.ts +42 -0
  148. package/dist/plugins/embeddings/types.d.ts +23 -0
  149. package/dist/plugins/files/attachment.d.ts +79 -0
  150. package/dist/plugins/files/provider-adapter.d.ts +37 -0
  151. package/dist/plugins/files/registry.d.ts +48 -0
  152. package/dist/plugins/files/strategy.d.ts +38 -0
  153. package/dist/plugins/internal-tools/backends/local.d.ts +12 -0
  154. package/dist/plugins/internal-tools/builtin/builtin.d.ts +21 -0
  155. package/dist/plugins/internal-tools/builtin/clarify.d.ts +12 -0
  156. package/dist/plugins/internal-tools/builtin/classify.d.ts +12 -0
  157. package/dist/plugins/internal-tools/builtin/score.d.ts +13 -0
  158. package/dist/plugins/internal-tools/builtin/structure.d.ts +11 -0
  159. package/dist/plugins/internal-tools/builtin/summarize.d.ts +19 -0
  160. package/dist/plugins/internal-tools/id.d.ts +12 -0
  161. package/dist/plugins/internal-tools/registry.d.ts +24 -0
  162. package/dist/plugins/internal-tools/runner/define.d.ts +7 -0
  163. package/dist/plugins/internal-tools/runner/json-enforcement.d.ts +3 -0
  164. package/dist/plugins/internal-tools/runner/runner.d.ts +47 -0
  165. package/dist/plugins/internal-tools/runner/template.d.ts +10 -0
  166. package/dist/plugins/internal-tools/runner/types.d.ts +57 -0
  167. package/dist/plugins/internal-tools/runner/variants.d.ts +34 -0
  168. package/dist/plugins/internal-tools/types.d.ts +80 -0
  169. package/dist/plugins/logger/console-sink.d.ts +26 -0
  170. package/dist/plugins/logger/logger.d.ts +38 -0
  171. package/dist/plugins/logger/types.d.ts +25 -0
  172. package/dist/plugins/mcp/base-transport.d.ts +58 -0
  173. package/dist/plugins/mcp/client.d.ts +92 -0
  174. package/dist/plugins/mcp/jsonrpc.d.ts +20 -0
  175. package/dist/plugins/mcp/oauth.d.ts +122 -0
  176. package/dist/plugins/mcp/sampling.d.ts +17 -0
  177. package/dist/plugins/mcp/tools.d.ts +20 -0
  178. package/dist/plugins/mcp/transport-http.d.ts +50 -0
  179. package/dist/plugins/mcp/transport-stdio.d.ts +23 -0
  180. package/dist/plugins/mcp/transport-ws.d.ts +32 -0
  181. package/dist/plugins/mcp/transport.d.ts +29 -0
  182. package/dist/plugins/mcp/types.d.ts +202 -0
  183. package/dist/plugins/mcp/url-guard.d.ts +70 -0
  184. package/dist/plugins/mcp/win-spawn.d.ts +20 -0
  185. package/dist/plugins/media/file-store.d.ts +24 -0
  186. package/dist/plugins/media/memory-store.d.ts +17 -0
  187. package/dist/plugins/media/output.d.ts +44 -0
  188. package/dist/plugins/media/source-image.d.ts +36 -0
  189. package/dist/plugins/media/types.d.ts +146 -0
  190. package/dist/plugins/model-catalog/catalog.d.ts +152 -0
  191. package/dist/plugins/permissions/glob.d.ts +6 -0
  192. package/dist/plugins/permissions/matchers.d.ts +7 -0
  193. package/dist/plugins/permissions/policy.d.ts +10 -0
  194. package/dist/plugins/permissions/types.d.ts +22 -0
  195. package/dist/plugins/persistence/file.d.ts +25 -0
  196. package/dist/plugins/persistence/memory.d.ts +23 -0
  197. package/dist/plugins/persistence/types.d.ts +21 -0
  198. package/dist/plugins/retrieval/chunker.d.ts +28 -0
  199. package/dist/plugins/retrieval/hosted-google.d.ts +60 -0
  200. package/dist/plugins/retrieval/hosted-openai.d.ts +45 -0
  201. package/dist/plugins/retrieval/hosted-xai.d.ts +57 -0
  202. package/dist/plugins/retrieval/index.d.ts +70 -0
  203. package/dist/plugins/retrieval/local.d.ts +50 -0
  204. package/dist/plugins/retrieval/types.d.ts +161 -0
  205. package/dist/plugins/retrieval/vector-store.d.ts +70 -0
  206. package/dist/plugins/scheduler/scheduler.d.ts +31 -0
  207. package/dist/plugins/telemetry/telemetry.d.ts +118 -0
  208. package/dist/plugins/tool-catalog/catalog.d.ts +31 -0
  209. package/dist/plugins/tool-catalog/errors.d.ts +22 -0
  210. package/dist/plugins/tool-catalog/types.d.ts +44 -0
  211. package/dist/runtime/runtime.d.ts +20 -0
  212. package/dist/server/auth.d.ts +25 -0
  213. package/dist/server/dispatch.d.ts +35 -0
  214. package/dist/server/loaders.d.ts +26 -0
  215. package/dist/server/oai-adapter.d.ts +30 -0
  216. package/dist/server/oai-types.d.ts +114 -0
  217. package/dist/server/response-store.d.ts +59 -0
  218. package/dist/server/router.d.ts +59 -0
  219. package/dist/server/server.d.ts +61 -0
  220. package/dist/types/request-context.d.ts +46 -0
  221. package/dist/util/async.d.ts +3 -0
  222. package/dist/util/base64.d.ts +8 -0
  223. package/dist/util/duration.d.ts +12 -0
  224. package/dist/util/http.d.ts +9 -0
  225. package/dist/util/image-mime.d.ts +8 -0
  226. package/dist/util/json-schema.d.ts +7 -0
  227. package/dist/util/wav.d.ts +20 -0
  228. package/package.json +95 -0
@@ -0,0 +1,70 @@
1
+ /** Retrieval plugin — ergonomic entry helpers.
2
+ *
3
+ * Usage (local, browser-safe):
4
+ *
5
+ * const retrieval = localRetrieval({
6
+ * embedAdapter: new OpenAIEmbeddingAdapter({ apiKey }),
7
+ * fetch: engine.fetch,
8
+ * embeddingModel: 'text-embedding-3-small',
9
+ * });
10
+ * const corpus = await retrieval.createCorpus({ name: 'my-docs' });
11
+ * await retrieval.addDocument(corpus, { text: '...', label: 'doc.txt' });
12
+ * const tool = retrieval.asTool([corpus]); // AgentTool for any provider
13
+ * const hits = await retrieval.search([corpus], 'query');
14
+ *
15
+ * Usage (hosted OpenAI vector stores):
16
+ *
17
+ * const retrieval = openaiRetrieval({ apiKey, fetch: engine.fetch });
18
+ * const corpus = await retrieval.createCorpus({ name: 'my-store' });
19
+ * await retrieval.addDocument(corpus, { text: '...', label: 'doc.txt' });
20
+ * const toolSpec = retrieval.asTool([corpus]); // ProviderToolSpec for Responses API
21
+ *
22
+ * Usage (hosted Google Gemini File Search):
23
+ *
24
+ * const retrieval = googleRetrieval({ apiKey, fetch: engine.fetch });
25
+ * const corpus = await retrieval.createCorpus({ name: 'my-store' });
26
+ * await retrieval.addDocument(corpus, { text: '...', label: 'doc.txt' });
27
+ * const toolSpec = retrieval.asTool([corpus]); // ProviderToolSpec for generateContent
28
+ *
29
+ * Usage (hosted xAI Grok Collections):
30
+ *
31
+ * const retrieval = xaiRetrieval({ apiKey, managementApiKey, fetch: engine.fetch });
32
+ * const corpus = await retrieval.createCorpus({ name: 'my-collection' });
33
+ * await retrieval.addDocument(corpus, { text: '...', label: 'doc.txt' });
34
+ * const hits = await retrieval.search([corpus], 'query'); // direct search supported
35
+ * const toolSpec = retrieval.asTool([corpus]); // file_search for Responses API
36
+ */
37
+ export { LocalRetrievalBackend } from './local';
38
+ export type { LocalRetrievalConfig } from './local';
39
+ export { HostedOpenAIRetrievalBackend } from './hosted-openai';
40
+ export type { HostedOpenAIRetrievalConfig } from './hosted-openai';
41
+ export { HostedGoogleRetrievalBackend } from './hosted-google';
42
+ export type { HostedGoogleRetrievalConfig } from './hosted-google';
43
+ export { HostedXaiRetrievalBackend } from './hosted-xai';
44
+ export type { HostedXaiRetrievalConfig } from './hosted-xai';
45
+ export { InMemoryVectorStore } from './vector-store';
46
+ export type { VectorStore, VectorEntry, InMemoryVectorStoreConfig } from './vector-store';
47
+ export { chunkText, DEFAULT_CHUNK_MAX_TOKENS, DEFAULT_CHUNK_OVERLAP_TOKENS } from './chunker';
48
+ export type { ChunkOptions, TextChunk, EstimateTokensFn } from './chunker';
49
+ export type { RetrievalBackend, RetrievalBackendName, RetrievalCapabilities, RetrievalHit, CorpusRef, DocumentRef, DocumentSource, IndexStatus, IndexState, IndexCounts, ProviderToolSpec, CreateCorpusOptions, AddDocumentOptions, RetrievalSearchOptions, AsToolOptions, ChunkingOptions, } from './types';
50
+ import { LocalRetrievalBackend } from './local';
51
+ import type { LocalRetrievalConfig } from './local';
52
+ import { HostedOpenAIRetrievalBackend } from './hosted-openai';
53
+ import type { HostedOpenAIRetrievalConfig } from './hosted-openai';
54
+ import { HostedGoogleRetrievalBackend } from './hosted-google';
55
+ import type { HostedGoogleRetrievalConfig } from './hosted-google';
56
+ import { HostedXaiRetrievalBackend } from './hosted-xai';
57
+ import type { HostedXaiRetrievalConfig } from './hosted-xai';
58
+ /** Build a local (zero-dep, cross-env) retrieval backend. */
59
+ export declare function localRetrieval(config: LocalRetrievalConfig): LocalRetrievalBackend;
60
+ /** Build a hosted OpenAI Vector Stores retrieval backend. */
61
+ export declare function openaiRetrieval(config: HostedOpenAIRetrievalConfig): HostedOpenAIRetrievalBackend;
62
+ /** Build a hosted Google Gemini File Search retrieval backend. */
63
+ export declare function googleRetrieval(config: HostedGoogleRetrievalConfig): HostedGoogleRetrievalBackend;
64
+ /** Build a hosted xAI Grok Collections retrieval backend. */
65
+ export declare function xaiRetrieval(config: HostedXaiRetrievalConfig): HostedXaiRetrievalBackend;
66
+ /** Generic factory when the backend is selected at runtime. */
67
+ export declare function createRetrieval(backend: 'local', config: LocalRetrievalConfig): LocalRetrievalBackend;
68
+ export declare function createRetrieval(backend: 'hostedOpenAI', config: HostedOpenAIRetrievalConfig): HostedOpenAIRetrievalBackend;
69
+ export declare function createRetrieval(backend: 'hostedGoogle', config: HostedGoogleRetrievalConfig): HostedGoogleRetrievalBackend;
70
+ export declare function createRetrieval(backend: 'hostedXai', config: HostedXaiRetrievalConfig): HostedXaiRetrievalBackend;
@@ -0,0 +1,50 @@
1
+ /** Local retrieval backend — zero-dep, cross-env (including browser).
2
+ *
3
+ * Uses OUR embed() helper for vectors and an in-memory VectorStore by default.
4
+ * Callers can inject any VectorStore implementation (pgvector, Qdrant, etc.).
5
+ *
6
+ * `asTool()` returns a real AgentTool so it works with Anthropic and every
7
+ * other provider that runs tool calls client-side. */
8
+ import type { AgentTool } from '../../agent/types';
9
+ import type { EngineFetch } from '../../network/types';
10
+ import type { EmbeddingProviderAdapter } from '../embeddings/types';
11
+ import type { Persistence } from '../persistence/types';
12
+ import type { AddDocumentOptions, AsToolOptions, CorpusRef, CreateCorpusOptions, DocumentRef, DocumentSource, IndexStatus, RetrievalBackend, RetrievalCapabilities, RetrievalHit, RetrievalSearchOptions } from './types';
13
+ import { type VectorStore } from './vector-store';
14
+ export interface LocalRetrievalConfig {
15
+ /** Embedding adapter — required for the local backend. */
16
+ embedAdapter: EmbeddingProviderAdapter;
17
+ /** Engine fetch function (NetworkEngine.fetch), passed to the embed adapter. */
18
+ fetch: EngineFetch;
19
+ /** Pluggable vector store. Defaults to InMemoryVectorStore.
20
+ * // bring-your-own backend: pass your own VectorStore implementation here. */
21
+ vectorStore?: VectorStore;
22
+ /** Optional persistence for the default InMemoryVectorStore (ignored when
23
+ * a custom vectorStore is provided). */
24
+ persistence?: Persistence;
25
+ /** Embedding model identifier (e.g. 'text-embedding-3-small'). */
26
+ embeddingModel: string;
27
+ /** Default chunk size in tokens. */
28
+ defaultMaxTokens?: number;
29
+ /** Default overlap in tokens. */
30
+ defaultOverlapTokens?: number;
31
+ }
32
+ export declare class LocalRetrievalBackend implements RetrievalBackend {
33
+ readonly capabilities: RetrievalCapabilities;
34
+ private readonly embedAdapter;
35
+ private readonly fetch;
36
+ private readonly vectorStore;
37
+ private readonly embeddingModel;
38
+ private readonly defaultMaxTokens;
39
+ private readonly defaultOverlapTokens;
40
+ private readonly corpora;
41
+ constructor(config: LocalRetrievalConfig);
42
+ createCorpus(opts: CreateCorpusOptions): Promise<CorpusRef>;
43
+ addDocument(corpus: CorpusRef, source: DocumentSource, opts?: AddDocumentOptions): Promise<DocumentRef>;
44
+ indexStatus(corpus: CorpusRef): Promise<IndexStatus>;
45
+ removeDocument(corpus: CorpusRef, docId: string): Promise<void>;
46
+ deleteCorpus(corpus: CorpusRef): Promise<void>;
47
+ listCorpora(): Promise<CorpusRef[]>;
48
+ asTool(corpora: CorpusRef[], opts?: AsToolOptions): AgentTool;
49
+ search(corpora: CorpusRef[], query: string, opts?: RetrievalSearchOptions): Promise<RetrievalHit[]>;
50
+ }
@@ -0,0 +1,161 @@
1
+ /** Retrieval (RAG) subsystem — shared types.
2
+ *
3
+ * Five-stage lifecycle shared by all backends:
4
+ * create corpus -> add documents -> index -> search / asTool -> cleanup
5
+ *
6
+ * Provider-specific divergences live in capability flags + an `extra` passthrough
7
+ * bag, NOT in the core contract. This keeps the interface stable as Google and
8
+ * xAI backends are added later.
9
+ *
10
+ * Anti-lock-in: CorpusRef/DocumentRef carry the original source metadata alongside
11
+ * the opaque provider id. The source documents are the rebuildable source of truth;
12
+ * never depend on exporting a hosted store's embeddings. */
13
+ import type { AgentTool } from '../../agent/types';
14
+ /** Text supplied by the caller; everything else is derived. */
15
+ export interface DocumentSource {
16
+ /** Plain text content. */
17
+ text: string;
18
+ /** Caller-supplied label, e.g. a filename or URL. Stored for citation. */
19
+ label?: string;
20
+ /** Arbitrary key-value metadata the caller wants attached to chunks/hits. */
21
+ metadata?: Record<string, unknown>;
22
+ }
23
+ /** Opaque reference to a corpus (vector store) on a particular backend.
24
+ * Carries the original creation options for rebuild support. */
25
+ export interface CorpusRef {
26
+ /** Backend-specific identifier (e.g. OpenAI vector store id, or local UUID). */
27
+ id: string;
28
+ /** Human-readable label; stored alongside the id for display. */
29
+ name: string;
30
+ /** Which backend created this corpus. Needed for dispatch. */
31
+ backend: RetrievalBackendName;
32
+ /** Provider-specific extra fields (passthrough bag, not part of the core API). */
33
+ extra?: Record<string, unknown>;
34
+ }
35
+ /** Reference to a single document within a corpus. */
36
+ export interface DocumentRef {
37
+ /** Backend-specific document identifier. */
38
+ id: string;
39
+ /** The corpus this document belongs to. */
40
+ corpusId: string;
41
+ /** The original source supplied by the caller (for rebuildability). */
42
+ source: DocumentSource;
43
+ /** Provider-specific extra fields. */
44
+ extra?: Record<string, unknown>;
45
+ }
46
+ /** Normalized indexing state across all backends. */
47
+ export type IndexState = 'pending' | 'indexing' | 'ready' | 'error';
48
+ export interface IndexCounts {
49
+ /** Total documents in corpus. */
50
+ total: number;
51
+ /** Documents fully indexed. */
52
+ indexed: number;
53
+ /** Documents in error state. */
54
+ failed: number;
55
+ }
56
+ export interface IndexStatus {
57
+ state: IndexState;
58
+ /** File-level counts (may be absent when not supported by a backend). */
59
+ counts?: IndexCounts;
60
+ }
61
+ export interface RetrievalHit {
62
+ /** Matched text chunk. */
63
+ text: string;
64
+ /** Cosine similarity score (0-1) or backend-specific relevance score. */
65
+ score: number;
66
+ /** Document reference id within the corpus. */
67
+ docId: string;
68
+ /** Original caller metadata attached to the document. */
69
+ metadata?: Record<string, unknown>;
70
+ /** Human-readable citation string (label + position). */
71
+ citation?: string;
72
+ }
73
+ /** Provider-native tool specification (splice directly into a provider API call).
74
+ * OpenAI/xAI shape: { type: 'file_search', vector_store_ids: [...] }
75
+ * Gemini shape: { fileSearch: { fileSearchStoreNames: [...] } } (no top-level type field)
76
+ * The index signature allows arbitrary provider-specific keys. */
77
+ export interface ProviderToolSpec {
78
+ type?: string;
79
+ vector_store_ids?: string[];
80
+ max_num_results?: number;
81
+ filters?: Record<string, unknown>;
82
+ [key: string]: unknown;
83
+ }
84
+ /** Chunking strategy — named so defaults are never magic. */
85
+ export interface ChunkingOptions {
86
+ /** Maximum chunk size in tokens (approximate via char heuristic). */
87
+ maxTokens?: number;
88
+ /** Overlap between consecutive chunks in tokens. */
89
+ overlapTokens?: number;
90
+ }
91
+ export interface CreateCorpusOptions {
92
+ name: string;
93
+ chunking?: ChunkingOptions;
94
+ /** How long the corpus lives on hosted backends (e.g. OpenAI `last_active_days`). */
95
+ expiresAfter?: {
96
+ anchor: 'last_active_at';
97
+ days: number;
98
+ };
99
+ /** Embedding model for hosted backends that allow selection. */
100
+ embeddingModel?: string;
101
+ }
102
+ export interface AddDocumentOptions {
103
+ metadata?: Record<string, unknown>;
104
+ }
105
+ export interface RetrievalSearchOptions {
106
+ /** Maximum number of hits to return (default: DEFAULT_SEARCH_TOP_K). */
107
+ maxResults?: number;
108
+ /** Minimum score threshold to include a hit (0-1). */
109
+ minScore?: number;
110
+ /** Backend-specific search mode (e.g. 'hybrid', 'semantic'). */
111
+ searchMode?: string;
112
+ /** Metadata filters (backend-specific). */
113
+ filters?: Record<string, unknown>;
114
+ }
115
+ export interface AsToolOptions {
116
+ maxResults?: number;
117
+ searchMode?: string;
118
+ filters?: Record<string, unknown>;
119
+ }
120
+ /** Static description of what a backend supports. Callers check these to
121
+ * degrade gracefully rather than hitting runtime errors. */
122
+ export interface RetrievalCapabilities {
123
+ /** Whether the caller can control chunking (vs. fully automatic). */
124
+ userChunking: boolean;
125
+ /** Available search modes (e.g. ['hybrid'], ['cosine']). */
126
+ searchModes: string[];
127
+ /** Whether the backend supports corpus expiration. */
128
+ expiration: boolean;
129
+ /** Whether `search()` is supported directly (false for server-side-only). */
130
+ directSearch: boolean;
131
+ /** Identifier field name in returned hits (informational). */
132
+ idField: string;
133
+ /** Citation format emitted in `RetrievalHit.citation`. */
134
+ citationFormat: 'label:offset' | 'file_id' | 'gemini' | 'collections-uri' | 'none';
135
+ }
136
+ export type RetrievalBackendName = 'local' | 'hostedOpenAI' | 'hostedGoogle' | 'hostedXai' | (string & NonNullable<unknown>);
137
+ /** Unified interface all retrieval backends must implement. */
138
+ export interface RetrievalBackend {
139
+ /** Descriptor: what this backend supports. Used for graceful degradation. */
140
+ readonly capabilities: RetrievalCapabilities;
141
+ /** Create a new corpus (vector store). */
142
+ createCorpus(opts: CreateCorpusOptions): Promise<CorpusRef>;
143
+ /** Add a document to a corpus (hides 1-step vs. 2-step upload differences). */
144
+ addDocument(corpus: CorpusRef, source: DocumentSource, opts?: AddDocumentOptions): Promise<DocumentRef>;
145
+ /** Normalized index status across all backends. */
146
+ indexStatus(corpus: CorpusRef): Promise<IndexStatus>;
147
+ /** Remove a single document from a corpus. */
148
+ removeDocument(corpus: CorpusRef, docId: string): Promise<void>;
149
+ /** Delete an entire corpus and all its documents. */
150
+ deleteCorpus(corpus: CorpusRef): Promise<void>;
151
+ /** List all corpora managed by this backend. */
152
+ listCorpora(): Promise<CorpusRef[]>;
153
+ /** Build a tool that can be passed to an AgentLoop (local: AgentTool) or
154
+ * spliced into a Responses call (hosted: ProviderToolSpec).
155
+ * The return type is a union: callers inspect `typeof result === 'object' &&
156
+ * 'execute' in result` to distinguish AgentTool from ProviderToolSpec. */
157
+ asTool(corpora: CorpusRef[], opts?: AsToolOptions): AgentTool | ProviderToolSpec;
158
+ /** Direct search — supported by local and potentially some hosted backends.
159
+ * Backends that do not support it throw with a clear message. */
160
+ search(corpora: CorpusRef[], query: string, opts?: RetrievalSearchOptions): Promise<RetrievalHit[]>;
161
+ }
@@ -0,0 +1,70 @@
1
+ /** VectorStore — interface + in-memory reference implementation.
2
+ *
3
+ * The interface is intentionally minimal so callers can plug a real DB
4
+ * (pgvector, Qdrant, Weaviate, etc.) via their own adapter:
5
+ *
6
+ * // bring-your-own backend:
7
+ * class MyPgVectorStore implements VectorStore { ... }
8
+ * const backend = localRetrieval({ vectorStore: new MyPgVectorStore() });
9
+ *
10
+ * The bundled `InMemoryVectorStore` is the default. It uses cosine similarity,
11
+ * runs fully in-process, works in the browser, and has zero external deps.
12
+ * It supports optional persistence via the cross-env `Persistence` layer so
13
+ * vectors survive process restarts (opt-in; default is ephemeral). */
14
+ import type { Persistence } from '../persistence/types';
15
+ /** A single chunk stored in the vector store. */
16
+ export interface VectorEntry {
17
+ /** Corpus-scoped unique identifier for this chunk. */
18
+ id: string;
19
+ /** ID of the source document. */
20
+ docId: string;
21
+ /** ID of the corpus this entry belongs to. */
22
+ corpusId: string;
23
+ /** The embedding vector. */
24
+ vector: number[];
25
+ /** The original text of this chunk. */
26
+ text: string;
27
+ /** Caller-provided metadata from the document source. */
28
+ metadata?: Record<string, unknown>;
29
+ /** Human-readable citation (e.g. "label:offset"). */
30
+ citation?: string;
31
+ }
32
+ /** Pluggable vector storage. Implement this to use any real DB backend.
33
+ * The in-memory default `InMemoryVectorStore` satisfies this contract. */
34
+ export interface VectorStore {
35
+ /** Insert an entry. Overwrites any existing entry with the same `id`. */
36
+ upsert(entry: VectorEntry): Promise<void>;
37
+ /** Remove all entries for a given document. */
38
+ removeByDocId(corpusId: string, docId: string): Promise<void>;
39
+ /** Remove all entries for an entire corpus. */
40
+ removeByCorpusId(corpusId: string): Promise<void>;
41
+ /** Top-k nearest neighbours within a corpus by cosine similarity.
42
+ * Returns at most `topK` hits ordered by descending score. */
43
+ query(corpusId: string, vector: number[], topK: number): Promise<Array<{
44
+ entry: VectorEntry;
45
+ score: number;
46
+ }>>;
47
+ /** Count stored entries, optionally scoped to a corpus. */
48
+ count(corpusId?: string): Promise<number>;
49
+ }
50
+ export interface InMemoryVectorStoreConfig {
51
+ /** Optional persistence layer. When supplied the store saves/loads via it.
52
+ * Omit (default) for an entirely ephemeral in-process store. */
53
+ persistence?: Persistence;
54
+ }
55
+ export declare class InMemoryVectorStore implements VectorStore {
56
+ private entries;
57
+ private readonly persistence;
58
+ private loaded;
59
+ constructor(config?: InMemoryVectorStoreConfig);
60
+ upsert(entry: VectorEntry): Promise<void>;
61
+ removeByDocId(corpusId: string, docId: string): Promise<void>;
62
+ removeByCorpusId(corpusId: string): Promise<void>;
63
+ query(corpusId: string, vector: number[], topK: number): Promise<Array<{
64
+ entry: VectorEntry;
65
+ score: number;
66
+ }>>;
67
+ count(corpusId?: string): Promise<number>;
68
+ private ensureLoaded;
69
+ private persist;
70
+ }
@@ -0,0 +1,31 @@
1
+ /** Scheduler — durable task scheduling. Tasks survive restarts when backed
2
+ * by a Persistence implementation. Functions registered by name; tasks are
3
+ * `{ name, args, fireAt }`. */
4
+ import type { Persistence } from '../persistence/types';
5
+ export interface ScheduledTaskDef {
6
+ id: string;
7
+ name: string;
8
+ args: Record<string, unknown>;
9
+ fireAt: number;
10
+ type: 'once' | 'periodic';
11
+ interval: number | null;
12
+ }
13
+ export declare class Scheduler {
14
+ private persistence;
15
+ private handlers;
16
+ private timers;
17
+ private running;
18
+ constructor(persistence: Persistence);
19
+ register(name: string, fn: (args: Record<string, unknown>) => void | Promise<void>): void;
20
+ after(duration: string | number, taskName: string, args?: Record<string, unknown>): Promise<string>;
21
+ at(datetime: Date | number, taskName: string, args?: Record<string, unknown>): Promise<string>;
22
+ every(interval: string | number, taskName: string, args?: Record<string, unknown>): Promise<string>;
23
+ cancel(taskId: string): Promise<void>;
24
+ start(): Promise<void>;
25
+ stop(): void;
26
+ pending(): Promise<ScheduledTaskDef[]>;
27
+ private scheduleTimer;
28
+ private fireTask;
29
+ }
30
+ /** Parse duration string ('30s', '5m', '1h', '2d') or raw number (ms) into ms. */
31
+ export declare function parseDuration(input: string | number): number;
@@ -0,0 +1,118 @@
1
+ /** TelemetryAdapter — a single tap (HookBus.onAny) that turns the SDK's events
2
+ * into the three OpenTelemetry signals, with NO `@opentelemetry` dependency:
3
+ *
4
+ * - TRACES spans opened/closed from start/complete event pairs, correlated
5
+ * by `traceId = sessionId:requestId`.
6
+ * - METRICS event-driven counters/gauges (cost, tokens, retries, queue depth,
7
+ * latency samples) — updated ON events, not polled.
8
+ * - LOGS the full event stream (name + category + traceId + raw ctx).
9
+ *
10
+ * An in-memory store backs the sandbox sidebar; `toOtlpTraces()` shapes spans
11
+ * into OTLP-compatible JSON for a real OTel exporter to forward. */
12
+ import type { HookBus } from '../../bus/hook-bus';
13
+ import type { HookName } from '../../bus/hook-map';
14
+ export type SpanKind = 'llm' | 'http' | 'media' | 'agent' | 'tool' | 'mcp' | 'other';
15
+ export interface Span {
16
+ traceId: string;
17
+ spanId: string;
18
+ name: string;
19
+ kind: SpanKind;
20
+ startTime: number;
21
+ endTime?: number;
22
+ durationMs?: number;
23
+ status: 'unset' | 'ok' | 'error';
24
+ attributes: Record<string, unknown>;
25
+ }
26
+ export interface TelemetryEvent {
27
+ seq: number;
28
+ time: number;
29
+ name: HookName;
30
+ category: string;
31
+ traceId?: string;
32
+ ctx: unknown;
33
+ }
34
+ export interface TelemetryMetrics {
35
+ requests: number;
36
+ errors: number;
37
+ retries: number;
38
+ rateLimitHits: number;
39
+ completions: number;
40
+ mediaGenerated: number;
41
+ costUsd: number;
42
+ inputTokens: number;
43
+ outputTokens: number;
44
+ inFlight: number;
45
+ queueDepth: number;
46
+ latency: {
47
+ count: number;
48
+ min: number;
49
+ max: number;
50
+ avg: number;
51
+ };
52
+ }
53
+ /** OpenTelemetry Resource — identifies the SERVICE producing this telemetry, so
54
+ * a shared backend can separate streams from different apps and attribute cost
55
+ * per service (`sum by service.name`). Stamped on every span/metric/log. */
56
+ export interface TelemetryResource {
57
+ /** Primary grouping key, e.g. "billing-api". OTel default: "unknown_service". */
58
+ serviceName: string;
59
+ /** Optional namespace/group, e.g. "prod" or a team. */
60
+ serviceNamespace?: string;
61
+ /** Unique instance (pod/host/process); a good default is the engine sessionId. */
62
+ serviceInstanceId?: string;
63
+ serviceVersion?: string;
64
+ /** Arbitrary resource attributes (deployment.environment, cloud.region, …). */
65
+ attributes?: Record<string, string>;
66
+ }
67
+ export interface TelemetryAdapterOptions {
68
+ /** Cap on retained events (ring buffer). Default 2000. */
69
+ maxEvents?: number;
70
+ /** Service identity stamped on all exported telemetry. */
71
+ resource?: TelemetryResource;
72
+ }
73
+ export declare class TelemetryAdapter {
74
+ readonly events: TelemetryEvent[];
75
+ readonly spans: Span[];
76
+ readonly metrics: TelemetryMetrics;
77
+ /** Service identity stamped on exported telemetry. */
78
+ readonly resource: TelemetryResource;
79
+ private seq;
80
+ private latSum;
81
+ private readonly open;
82
+ private readonly maxEvents;
83
+ private readonly unsub;
84
+ constructor(hooks: HookBus, opts?: TelemetryAdapterOptions);
85
+ /** Stop tapping the bus. */
86
+ destroy(): void;
87
+ private handle;
88
+ private openSpan;
89
+ private closeSpan;
90
+ private recordLatency;
91
+ /** OTLP resource attributes (service.name + extras) — stamped on all exports. */
92
+ private resourceAttributes;
93
+ /** Snapshot: completed spans, event log, current metrics. */
94
+ snapshot(): {
95
+ spans: Span[];
96
+ events: TelemetryEvent[];
97
+ metrics: TelemetryMetrics;
98
+ };
99
+ /** A debug bundle as a JSON string, with large strings (base64 blobs) trimmed
100
+ * — for "save the session to a file" download. */
101
+ serialize(): string;
102
+ /** Shape completed spans into OTLP-compatible JSON (resourceSpans) for an
103
+ * external OpenTelemetry exporter — no SDK dependency here. */
104
+ toOtlpTraces(): unknown;
105
+ }
106
+ /** Redact sensitive query parameters from a URL string.
107
+ * Replaces values of params in SENSITIVE_QUERY_PARAMS with REDACTED. */
108
+ export declare function sanitizeUrl(url: string): string;
109
+ /** Redact sensitive header values, returning a new record. */
110
+ export declare function sanitizeHeaders(headers: Record<string, string>): Record<string, string>;
111
+ /** JSON.stringify replacer that truncates huge strings (base64 media blobs) so
112
+ * an exported debug bundle stays small + readable. Also unwraps Error objects:
113
+ * `message`/`stack` are non-enumerable, so a raw `JSON.stringify(error)` drops
114
+ * the most useful field — the actual provider message (e.g. a 400 reason).
115
+ *
116
+ * Only safe, non-sensitive Error fields are exported: name, message, code, cause.
117
+ * Arbitrary attached props (which could carry secrets) are NOT spread. */
118
+ export declare function trimReplacer(_key: string, value: unknown): unknown;
@@ -0,0 +1,31 @@
1
+ /** ToolCatalog — registry of tools, per-agent scopes, gated execution. */
2
+ import type { AgentBus } from '../../bus/agent-bus';
3
+ import type { PermissionPolicy } from '../permissions/policy';
4
+ import type { AgentScope, CatalogedTool, ToolCallRequest, ToolCallResult, ToolDefinition } from './types';
5
+ export interface ToolCatalogConfig {
6
+ bus?: AgentBus;
7
+ policy?: PermissionPolicy;
8
+ }
9
+ export declare class ToolCatalog {
10
+ private readonly tools;
11
+ private readonly scopes;
12
+ private readonly bus;
13
+ private readonly defaultPolicy;
14
+ constructor(config?: ToolCatalogConfig);
15
+ register(tool: CatalogedTool): void;
16
+ unregister(name: string): boolean;
17
+ has(name: string): boolean;
18
+ setAgentScope(agentId: string, scope: AgentScope): void;
19
+ removeAgentScope(agentId: string): void;
20
+ getAgentScope(agentId: string): AgentScope | undefined;
21
+ visibleTo(agentId: string): ToolDefinition[];
22
+ getDefinition(name: string, agentId?: string): ToolDefinition | undefined;
23
+ search(query: {
24
+ name?: string;
25
+ description?: string;
26
+ }, agentId?: string): ToolDefinition[];
27
+ call(req: ToolCallRequest): Promise<ToolCallResult>;
28
+ private scopeAllows;
29
+ private buildContext;
30
+ private emitEvent;
31
+ }
@@ -0,0 +1,22 @@
1
+ /** Typed errors thrown by ToolCatalog. */
2
+ import type { PermissionTarget } from '../permissions/types';
3
+ export declare class ToolNotFound extends Error {
4
+ readonly toolName: string;
5
+ constructor(toolName: string);
6
+ }
7
+ export declare class NoToolAccess extends Error {
8
+ readonly source: string;
9
+ readonly toolName: string;
10
+ readonly reasonDetail: string;
11
+ constructor(source: string, toolName: string, reasonDetail: string);
12
+ }
13
+ export declare class PermissionDenied extends Error {
14
+ readonly source: string;
15
+ readonly target: PermissionTarget;
16
+ readonly action: string;
17
+ readonly reasonDetail?: string;
18
+ constructor(source: string, target: PermissionTarget, action: string, reasonDetail?: string);
19
+ }
20
+ export declare class ToolRegistrationError extends Error {
21
+ constructor(message: string);
22
+ }
@@ -0,0 +1,44 @@
1
+ /** ToolCatalog types — strict tool-policy contract. */
2
+ import type { JsonSchema } from '../../llm/types/tools';
3
+ import type { PermissionPolicy } from '../permissions/policy';
4
+ import type { PermissionTarget } from '../permissions/types';
5
+ export interface ToolDefinition {
6
+ name: string;
7
+ description: string;
8
+ parameters: JsonSchema;
9
+ }
10
+ export type ToolCategory = 'internal' | 'external';
11
+ export interface TargetDeclaration {
12
+ kind: string;
13
+ value?: PermissionTarget;
14
+ pattern?: string | string[];
15
+ }
16
+ export interface CatalogedTool {
17
+ definition: ToolDefinition;
18
+ category: ToolCategory;
19
+ declaredTargets: TargetDeclaration[];
20
+ declaredActions: string[];
21
+ execute: (input: Record<string, unknown>, ctx: ToolContext) => Promise<unknown>;
22
+ }
23
+ export interface ToolContext {
24
+ source: string;
25
+ correlationId?: string;
26
+ checkAccess(target: PermissionTarget, action: string): void;
27
+ emit(kind: string, payload: unknown): Promise<void>;
28
+ }
29
+ export interface AgentScope {
30
+ toolNames: readonly string[] | '*';
31
+ externalAllowed?: boolean;
32
+ policy?: PermissionPolicy;
33
+ }
34
+ export interface ToolCallRequest {
35
+ toolName: string;
36
+ source: string;
37
+ input: Record<string, unknown>;
38
+ correlationId?: string;
39
+ }
40
+ export interface ToolCallResult {
41
+ callId: string;
42
+ output: unknown;
43
+ durationMs: number;
44
+ }
@@ -0,0 +1,20 @@
1
+ /** Runtime detection + lazy Node-only module access.
2
+ *
3
+ * The SDK is cross-environment: it runs on Node/Bun (server) and bundles for
4
+ * the browser. Browser bundlers cannot resolve `node:*` builtins, so NO module
5
+ * on a reachable import path may statically `import 'node:…'`. Node access goes
6
+ * through the lazy loaders here instead — the dynamic `import()` only executes
7
+ * when the feature is actually used, and rejects cleanly in the browser with a
8
+ * friendly message (callers catch it or let it surface). */
9
+ /** True when running inside a browser (DOM present), false on Node/Bun. */
10
+ export declare function isBrowser(): boolean;
11
+ /** Lazily load `node:fs/promises`; throws a friendly error in the browser.
12
+ * The isBrowser() guard runs first so the browser bundle never reaches the
13
+ * (stubbed) import — keeping node: out of the browser graph entirely. */
14
+ export declare function nodeFsPromises(): Promise<typeof import('node:fs/promises')>;
15
+ /** Lazily load `node:fs` (sync helpers like existsSync); browser-friendly error. */
16
+ export declare function nodeFs(): Promise<typeof import('node:fs')>;
17
+ /** Lazily load `node:path`; browser-friendly error. */
18
+ export declare function nodePath(): Promise<typeof import('node:path')>;
19
+ /** Lazily load `node:child_process` (stdio MCP transport); browser-friendly error. */
20
+ export declare function nodeChildProcess(): Promise<typeof import('node:child_process')>;
@@ -0,0 +1,25 @@
1
+ /** AuthPlugin — server-side authentication slot.
2
+ *
3
+ * Servers without an AuthPlugin treat all requests as unauthenticated
4
+ * (userId = null). When attached, every request runs through `verify()`;
5
+ * the returned userId scopes the ResponseStore key. */
6
+ export interface AuthVerifyResult {
7
+ /** Stable owner id used to scope ResponseStore entries. */
8
+ userId: string;
9
+ /** Free-form metadata for downstream plugins (roles, scopes, etc.). */
10
+ metadata?: Record<string, unknown>;
11
+ }
12
+ export interface AuthPlugin {
13
+ /** Inspect request headers and return the authenticated userId, or throw to reject. */
14
+ verify(headers: Record<string, string>): Promise<AuthVerifyResult> | AuthVerifyResult;
15
+ }
16
+ /** Bearer key auth — the simplest authenticator. Each known key maps to a userId. */
17
+ export declare class BearerKeyAuth implements AuthPlugin {
18
+ private readonly keys;
19
+ constructor(config: {
20
+ keys: Record<string, string>;
21
+ } | {
22
+ keys: string[];
23
+ });
24
+ verify(headers: Record<string, string>): AuthVerifyResult;
25
+ }