@digilogiclabs/platform-core 1.1.1 → 1.2.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.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { p as ILogger, q as IMetrics, I as IPlatform, P as PlatformHealthStatus, u as MetricsSummary, e as IDatabase, k as IQueryBuilder, Q as QueryResult, l as ICache, m as IStorage, U as UploadOptions, S as StorageFile, n as IEmail, t as EmailMessage, v as EmailResult, o as IQueue, s as JobOptions, J as Job, R as RepeatOptions, w as JobState, x as JobEventType, y as JobEventHandler } from './ConsoleEmail-CYPpn2sR.js';
2
- export { G as BackoffOptions, ax as BulkheadConfigSchema, aH as CacheConfig, aq as CacheConfigSchema, aj as CacheProviderSchema, av as CircuitBreakerConfigSchema, C as ConsoleEmail, h as ConsoleLogger, aG as DatabaseConfig, ap as DatabaseConfigSchema, ai as DatabaseProviderSchema, ac as EmailAddress, ad as EmailAttachment, aJ as EmailConfig, as as EmailConfigSchema, al as EmailProviderSchema, E as EnvSecrets, Z as GetSecretOptions, V as HistogramStats, z as ICacheOptions, r as ISecrets, a6 as ISpan, a5 as ITracing, B as JobContext, D as JobEvent, A as JobResult, K as LogEntry, L as LogLevel, ao as LogLevelSchema, H as LogMeta, O as LoggerConfig, az as LoggingConfigSchema, a as MemoryCache, M as MemoryDatabase, c as MemoryEmail, i as MemoryMetrics, d as MemoryQueue, f as MemorySecrets, b as MemoryStorage, a3 as MemoryTracing, T as MetricTags, aA as MetricsConfigSchema, aN as MiddlewareConfig, aD as MiddlewareConfigSchema, N as NoopLogger, j as NoopMetrics, a4 as NoopTracing, aM as ObservabilityConfig, aC as ObservabilityConfigSchema, aF as PlatformConfig, aE as PlatformConfigSchema, aK as QueueConfig, at as QueueConfigSchema, am as QueueProviderSchema, F as QueueStats, aL as ResilienceConfig, ay as ResilienceConfigSchema, au as RetryConfigSchema, $ as RotateSecretOptions, a0 as RotationResult, X as Secret, Y as SecretMetadata, _ as SetSecretOptions, a7 as SpanContext, ah as SpanEvent, aa as SpanKind, a8 as SpanOptions, a9 as SpanStatus, ag as SpanStatusCode, aI as StorageConfig, ar as StorageConfigSchema, ak as StorageProviderSchema, aw as TimeoutConfigSchema, W as TimingStats, ab as TracingConfig, aB as TracingConfigSchema, an as TracingProviderSchema, ae as calculateBackoff, g as createPlatform, a1 as createPlatformAsync, a2 as createScopedMetrics, af as generateJobId, aR as getDefaultConfig, aO as loadConfig, aQ as safeValidateConfig, aP as validateConfig } from './ConsoleEmail-CYPpn2sR.js';
1
+ import { p as ILogger, q as IMetrics, I as IPlatform, P as PlatformHealthStatus, u as MetricsSummary, e as IDatabase, k as IQueryBuilder, Q as QueryResult, l as ICache, m as IStorage, U as UploadOptions, S as StorageFile, n as IEmail, t as EmailMessage, v as EmailResult, o as IQueue, s as JobOptions, J as Job, R as RepeatOptions, w as JobState, x as JobEventType, y as JobEventHandler, z as IAI, A as AIConfig, B as AIChatRequest, D as AIChatResponse, F as AIStreamChunk, G as AIStreamCallback, H as AICompletionRequest, K as AICompletionResponse, L as AIEmbeddingRequest, O as AIEmbeddingResponse, T as AIModelConfig, V as AIModelType, W as AIProvider, X as IRAG, Y as RAGConfig, Z as CreateCollectionOptions, _ as RAGCollection, $ as RAGDocument, a0 as IngestionOptions, a1 as BulkIngestionResult, a2 as IngestionResult, a3 as DocumentStatus, a4 as RAGChunk, a5 as RAGSearchQuery, a6 as RAGSearchResponse, a7 as RAGSearchResult, a8 as ContextAssemblyConfig, a9 as AssembledContext, aa as RAGPipeline } from './ConsoleEmail-hUDFsKoA.js';
2
+ export { aC as AIChatChoice, bj as AIConfigSchema, aI as AIError, aH as AIErrorCode, aw as AIErrorMessages, aD as AIFinishReason, az as AIMessage, bc as AIProviderSchema, ay as AIRole, aG as AIRouterConfig, aB as AITool, aA as AIToolCall, aE as AIUsageInfo, ag as BackoffOptions, bo as BulkheadConfigSchema, by as CacheConfig, bf as CacheConfigSchema, b6 as CacheProviderSchema, aM as ChunkingConfig, aK as ChunkingPresets, aL as ChunkingStrategy, bm as CircuitBreakerConfigSchema, C as ConsoleEmail, h as ConsoleLogger, bx as DatabaseConfig, be as DatabaseConfigSchema, b5 as DatabaseProviderSchema, a$ as EmailAddress, b0 as EmailAttachment, bA as EmailConfig, bh as EmailConfigSchema, b8 as EmailProviderSchema, E as EnvSecrets, aq as GetSecretOptions, am as HistogramStats, ab as ICacheOptions, r as ISecrets, aV as ISpan, aU as ITracing, ad as JobContext, ae as JobEvent, ac as JobResult, aj as LogEntry, ah as LogLevel, bb as LogLevelSchema, ai as LogMeta, ak as LoggerConfig, bq as LoggingConfigSchema, ax as MemoryAI, a as MemoryCache, M as MemoryDatabase, c as MemoryEmail, i as MemoryMetrics, d as MemoryQueue, aJ as MemoryRAG, f as MemorySecrets, b as MemoryStorage, aS as MemoryTracing, al as MetricTags, br as MetricsConfigSchema, bE as MiddlewareConfig, bu as MiddlewareConfigSchema, N as NoopLogger, j as NoopMetrics, aT as NoopTracing, bD as ObservabilityConfig, bt as ObservabilityConfigSchema, bw as PlatformConfig, bv as PlatformConfigSchema, bB as QueueConfig, bi as QueueConfigSchema, b9 as QueueProviderSchema, af as QueueStats, bk as RAGConfigSchema, aO as RAGFilter, aP as RAGPipelineStep, bd as RAGProviderSchema, bC as ResilienceConfig, bp as ResilienceConfigSchema, bl as RetryConfigSchema, as as RotateSecretOptions, at as RotationResult, aF as RoutingStrategy, aN as SearchMode, ao as Secret, ap as SecretMetadata, ar as SetSecretOptions, aW as SpanContext, b4 as SpanEvent, aZ as SpanKind, aX as SpanOptions, aY as SpanStatus, b3 as SpanStatusCode, bz as StorageConfig, bg as StorageConfigSchema, b7 as StorageProviderSchema, bn as TimeoutConfigSchema, an as TimingStats, a_ as TracingConfig, bs as TracingConfigSchema, ba as TracingProviderSchema, b1 as calculateBackoff, au as createAIError, g as createPlatform, aQ as createPlatformAsync, aR as createScopedMetrics, b2 as generateJobId, bI as getDefaultConfig, av as isAIError, bF as loadConfig, bH as safeValidateConfig, bG as validateConfig } from './ConsoleEmail-hUDFsKoA.js';
3
3
  export { t as IMigrationDatabase, I as IMigrator, n as Migration, o as MigrationRecord, p as MigrationResult, q as MigrationStatus, M as Migrator, r as MigratorConfig, S as SQL, f as createDomainVerificationsTable, c as createMigration, b as createSsoOidcConfigsTable, m as createSsoSessionsTable, k as createTenantInvitationsTable, j as createTenantMembersTable, l as createTenantUsageTable, i as createTenantsTable, h as createVerifiedDomainsTable, d as defineMigration, e as enterpriseMigrations, g as generateVersion, a as getEnterpriseMigrations, s as sqlMigration } from './index-CepDdu7h.js';
4
4
  import { SupabaseClient } from '@supabase/supabase-js';
5
5
  import { Pool } from 'pg';
@@ -4535,357 +4535,6 @@ declare class MemoryTenant implements ITenant {
4535
4535
  clear(): void;
4536
4536
  }
4537
4537
 
4538
- /**
4539
- * IAI - Core AI abstraction interface for platform-core
4540
- *
4541
- * Provides a vendor-agnostic interface for AI operations including:
4542
- * - Text generation (chat, completion)
4543
- * - Embeddings generation
4544
- * - Model routing and fallback
4545
- * - Streaming support
4546
- * - Token usage tracking
4547
- */
4548
- type AIProvider = "openai" | "anthropic" | "google" | "azure" | "bedrock" | "custom";
4549
- type AIModelType = "chat" | "completion" | "embedding" | "image" | "audio" | "video";
4550
- type AIRole = "system" | "user" | "assistant" | "function" | "tool";
4551
- interface AIMessage {
4552
- role: AIRole;
4553
- content: string;
4554
- name?: string;
4555
- toolCallId?: string;
4556
- toolCalls?: AIToolCall[];
4557
- }
4558
- interface AIToolCall {
4559
- id: string;
4560
- type: "function";
4561
- function: {
4562
- name: string;
4563
- arguments: string;
4564
- };
4565
- }
4566
- interface AITool {
4567
- type: "function";
4568
- function: {
4569
- name: string;
4570
- description: string;
4571
- parameters: Record<string, unknown>;
4572
- };
4573
- }
4574
- interface AIModelConfig {
4575
- /** Model identifier (e.g., 'gpt-4', 'claude-3-opus') */
4576
- modelId: string;
4577
- /** Provider for this model */
4578
- provider: AIProvider;
4579
- /** Model capabilities */
4580
- capabilities: AIModelType[];
4581
- /** Maximum context window in tokens */
4582
- maxContextTokens: number;
4583
- /** Maximum output tokens */
4584
- maxOutputTokens: number;
4585
- /** Cost per 1K input tokens in USD */
4586
- inputCostPer1K: number;
4587
- /** Cost per 1K output tokens in USD */
4588
- outputCostPer1K: number;
4589
- /** Supports streaming */
4590
- supportsStreaming: boolean;
4591
- /** Supports function/tool calling */
4592
- supportsTools: boolean;
4593
- /** Supports vision (image input) */
4594
- supportsVision: boolean;
4595
- /** Rate limits per minute */
4596
- rateLimits?: {
4597
- requestsPerMinute: number;
4598
- tokensPerMinute: number;
4599
- };
4600
- /** Custom endpoint for self-hosted models */
4601
- endpoint?: string;
4602
- /** Additional provider-specific config */
4603
- providerConfig?: Record<string, unknown>;
4604
- }
4605
- interface AIChatRequest {
4606
- messages: AIMessage[];
4607
- model?: string;
4608
- temperature?: number;
4609
- maxTokens?: number;
4610
- topP?: number;
4611
- frequencyPenalty?: number;
4612
- presencePenalty?: number;
4613
- stop?: string | string[];
4614
- tools?: AITool[];
4615
- toolChoice?: "auto" | "none" | "required" | {
4616
- type: "function";
4617
- function: {
4618
- name: string;
4619
- };
4620
- };
4621
- stream?: boolean;
4622
- user?: string;
4623
- metadata?: Record<string, unknown>;
4624
- }
4625
- interface AICompletionRequest {
4626
- prompt: string;
4627
- model?: string;
4628
- temperature?: number;
4629
- maxTokens?: number;
4630
- topP?: number;
4631
- frequencyPenalty?: number;
4632
- presencePenalty?: number;
4633
- stop?: string | string[];
4634
- stream?: boolean;
4635
- user?: string;
4636
- metadata?: Record<string, unknown>;
4637
- }
4638
- interface AIEmbeddingRequest {
4639
- input: string | string[];
4640
- model?: string;
4641
- dimensions?: number;
4642
- user?: string;
4643
- metadata?: Record<string, unknown>;
4644
- }
4645
- interface AIChatResponse {
4646
- id: string;
4647
- model: string;
4648
- provider: AIProvider;
4649
- choices: AIChatChoice[];
4650
- usage: AIUsageInfo;
4651
- created: Date;
4652
- finishReason: AIFinishReason;
4653
- }
4654
- interface AIChatChoice {
4655
- index: number;
4656
- message: AIMessage;
4657
- finishReason: AIFinishReason;
4658
- }
4659
- type AIFinishReason = "stop" | "length" | "tool_calls" | "content_filter" | "error";
4660
- interface AICompletionResponse {
4661
- id: string;
4662
- model: string;
4663
- provider: AIProvider;
4664
- text: string;
4665
- usage: AIUsageInfo;
4666
- created: Date;
4667
- finishReason: AIFinishReason;
4668
- }
4669
- interface AIEmbeddingResponse {
4670
- id: string;
4671
- model: string;
4672
- provider: AIProvider;
4673
- embeddings: number[][];
4674
- usage: AIUsageInfo;
4675
- created: Date;
4676
- }
4677
- interface AIUsageInfo {
4678
- promptTokens: number;
4679
- completionTokens: number;
4680
- totalTokens: number;
4681
- estimatedCostUsd: number;
4682
- }
4683
- interface AIStreamChunk {
4684
- id: string;
4685
- model: string;
4686
- provider: AIProvider;
4687
- delta: {
4688
- content?: string;
4689
- toolCalls?: AIToolCall[];
4690
- role?: AIRole;
4691
- };
4692
- finishReason?: AIFinishReason;
4693
- usage?: AIUsageInfo;
4694
- }
4695
- type AIStreamCallback = (chunk: AIStreamChunk) => void | Promise<void>;
4696
- type RoutingStrategy = "priority" | "round-robin" | "least-latency" | "cost-optimized" | "random";
4697
- interface AIRouterConfig {
4698
- /** Primary model to use */
4699
- primaryModel: string;
4700
- /** Fallback models in order of preference */
4701
- fallbackModels?: string[];
4702
- /** Routing strategy for load balancing */
4703
- strategy?: RoutingStrategy;
4704
- /** Maximum retries before failing */
4705
- maxRetries?: number;
4706
- /** Timeout in milliseconds */
4707
- timeoutMs?: number;
4708
- /** Enable automatic fallback on errors */
4709
- autoFallback?: boolean;
4710
- /** Cost budget per request in USD (for cost-optimized routing) */
4711
- costBudget?: number;
4712
- /** Custom routing function */
4713
- customRouter?: (request: AIChatRequest | AICompletionRequest) => string;
4714
- }
4715
- type AIErrorCode = "invalid_request" | "authentication_error" | "rate_limit_exceeded" | "quota_exceeded" | "model_not_found" | "context_length_exceeded" | "content_filter" | "server_error" | "timeout" | "network_error" | "provider_unavailable" | "unknown";
4716
- interface AIError extends Error {
4717
- code: AIErrorCode;
4718
- provider?: AIProvider;
4719
- model?: string;
4720
- statusCode?: number;
4721
- retryable: boolean;
4722
- retryAfterMs?: number;
4723
- }
4724
- declare const AIErrorMessages: Record<AIErrorCode, string>;
4725
- declare function createAIError(code: AIErrorCode, message?: string, options?: {
4726
- provider?: AIProvider;
4727
- model?: string;
4728
- statusCode?: number;
4729
- retryable?: boolean;
4730
- retryAfterMs?: number;
4731
- cause?: Error;
4732
- }): AIError;
4733
- declare function isAIError(error: unknown): error is AIError;
4734
- interface AIConfig {
4735
- /** Default model for chat requests */
4736
- defaultChatModel?: string;
4737
- /** Default model for completion requests */
4738
- defaultCompletionModel?: string;
4739
- /** Default model for embedding requests */
4740
- defaultEmbeddingModel?: string;
4741
- /** Router configuration */
4742
- router?: AIRouterConfig;
4743
- /** Available model configurations */
4744
- models?: AIModelConfig[];
4745
- /** API keys for providers */
4746
- apiKeys?: Partial<Record<AIProvider, string>>;
4747
- /** Default timeout in milliseconds */
4748
- defaultTimeoutMs?: number;
4749
- /** Enable request/response logging */
4750
- enableLogging?: boolean;
4751
- /** Cache embeddings */
4752
- cacheEmbeddings?: boolean;
4753
- /** Embedding cache TTL in seconds */
4754
- embeddingCacheTtlSeconds?: number;
4755
- }
4756
- /**
4757
- * IAI - Core AI interface
4758
- *
4759
- * @example
4760
- * ```typescript
4761
- * const ai = platform.ai;
4762
- *
4763
- * // Chat completion
4764
- * const response = await ai.chat({
4765
- * messages: [
4766
- * { role: 'system', content: 'You are a helpful assistant.' },
4767
- * { role: 'user', content: 'Hello!' }
4768
- * ]
4769
- * });
4770
- *
4771
- * // Streaming chat
4772
- * for await (const chunk of ai.chatStream({
4773
- * messages: [{ role: 'user', content: 'Tell me a story' }]
4774
- * })) {
4775
- * process.stdout.write(chunk.delta.content || '');
4776
- * }
4777
- *
4778
- * // Embeddings
4779
- * const embeddings = await ai.embed({
4780
- * input: ['Hello world', 'Goodbye world']
4781
- * });
4782
- * ```
4783
- */
4784
- interface IAI {
4785
- /**
4786
- * Send a chat completion request
4787
- */
4788
- chat(request: AIChatRequest): Promise<AIChatResponse>;
4789
- /**
4790
- * Send a streaming chat completion request
4791
- */
4792
- chatStream(request: AIChatRequest): AsyncIterable<AIStreamChunk>;
4793
- /**
4794
- * Send a chat completion request with callback-based streaming
4795
- */
4796
- chatWithCallback(request: AIChatRequest, callback: AIStreamCallback): Promise<AIChatResponse>;
4797
- /**
4798
- * Send a text completion request
4799
- */
4800
- complete(request: AICompletionRequest): Promise<AICompletionResponse>;
4801
- /**
4802
- * Send a streaming completion request
4803
- */
4804
- completeStream(request: AICompletionRequest): AsyncIterable<AIStreamChunk>;
4805
- /**
4806
- * Generate embeddings for text
4807
- */
4808
- embed(request: AIEmbeddingRequest): Promise<AIEmbeddingResponse>;
4809
- /**
4810
- * Calculate similarity between two texts
4811
- */
4812
- similarity(text1: string, text2: string, model?: string): Promise<number>;
4813
- /**
4814
- * List available models
4815
- */
4816
- listModels(): Promise<AIModelConfig[]>;
4817
- /**
4818
- * Get model configuration
4819
- */
4820
- getModel(modelId: string): Promise<AIModelConfig | null>;
4821
- /**
4822
- * Check if a model supports a capability
4823
- */
4824
- supportsCapability(modelId: string, capability: AIModelType): Promise<boolean>;
4825
- /**
4826
- * Estimate tokens for text
4827
- */
4828
- estimateTokens(text: string, model?: string): Promise<number>;
4829
- /**
4830
- * Estimate cost for a request
4831
- */
4832
- estimateCost(request: AIChatRequest | AICompletionRequest | AIEmbeddingRequest): Promise<number>;
4833
- /**
4834
- * Check if AI service is healthy
4835
- */
4836
- healthCheck(): Promise<{
4837
- healthy: boolean;
4838
- providers: Record<AIProvider, {
4839
- available: boolean;
4840
- latencyMs?: number;
4841
- error?: string;
4842
- }>;
4843
- }>;
4844
- }
4845
- /**
4846
- * MemoryAI - In-memory implementation for testing
4847
- */
4848
- declare class MemoryAI implements IAI {
4849
- private config;
4850
- private models;
4851
- private responses;
4852
- private embeddings;
4853
- private requestLog;
4854
- constructor(config?: AIConfig);
4855
- setResponse(key: string, response: AIChatResponse | AICompletionResponse): void;
4856
- setEmbedding(text: string, embedding: number[]): void;
4857
- getRequestLog(): Array<{
4858
- type: string;
4859
- request: unknown;
4860
- timestamp: Date;
4861
- }>;
4862
- clearRequestLog(): void;
4863
- chat(request: AIChatRequest): Promise<AIChatResponse>;
4864
- chatStream(request: AIChatRequest): AsyncIterable<AIStreamChunk>;
4865
- chatWithCallback(request: AIChatRequest, callback: AIStreamCallback): Promise<AIChatResponse>;
4866
- complete(request: AICompletionRequest): Promise<AICompletionResponse>;
4867
- completeStream(request: AICompletionRequest): AsyncIterable<AIStreamChunk>;
4868
- embed(request: AIEmbeddingRequest): Promise<AIEmbeddingResponse>;
4869
- similarity(text1: string, text2: string, model?: string): Promise<number>;
4870
- listModels(): Promise<AIModelConfig[]>;
4871
- getModel(modelId: string): Promise<AIModelConfig | null>;
4872
- supportsCapability(modelId: string, capability: AIModelType): Promise<boolean>;
4873
- estimateTokens(text: string, _model?: string): Promise<number>;
4874
- estimateCost(request: AIChatRequest | AICompletionRequest | AIEmbeddingRequest): Promise<number>;
4875
- healthCheck(): Promise<{
4876
- healthy: boolean;
4877
- providers: Record<AIProvider, {
4878
- available: boolean;
4879
- latencyMs?: number;
4880
- error?: string;
4881
- }>;
4882
- }>;
4883
- private estimateTokensSync;
4884
- private calculateCost;
4885
- private generateMockEmbedding;
4886
- private cosineSimilarity;
4887
- }
4888
-
4889
4538
  /**
4890
4539
  * IPromptStore - Prompt management and versioning interface
4891
4540
  *
@@ -5286,583 +4935,100 @@ declare class MemoryPromptStore implements IPromptStore {
5286
4935
  }
5287
4936
 
5288
4937
  /**
5289
- * IRAG - Retrieval Augmented Generation interface
4938
+ * IAIUsage - Per-tenant AI token tracking and cost allocation
5290
4939
  *
5291
- * Provides infrastructure for building RAG pipelines:
5292
- * - Document ingestion and chunking
5293
- * - Vector storage and retrieval
5294
- * - Semantic search
5295
- * - Hybrid search (vector + keyword)
5296
- * - Reranking
5297
- * - Context assembly
4940
+ * Provides infrastructure for:
4941
+ * - Token usage tracking per tenant
4942
+ * - Cost allocation and budgeting
4943
+ * - Usage quotas and limits
4944
+ * - Billing integration
4945
+ * - Analytics and reporting
5298
4946
  */
5299
- type DocumentStatus = "pending" | "processing" | "indexed" | "failed";
5300
- interface RAGDocument {
4947
+ type UsageCategory = "chat" | "completion" | "embedding" | "image" | "audio" | "video" | "fine_tuning";
4948
+ type UsageInterval = "minute" | "hour" | "day" | "week" | "month" | "year";
4949
+ interface UsageRecord {
5301
4950
  id: string;
5302
- /** Source identifier (e.g., file path, URL, database ID) */
5303
- source: string;
5304
- /** Document type (pdf, markdown, html, text, etc.) */
5305
- type: string;
5306
- /** Original content */
5307
- content: string;
5308
- /** Document title */
5309
- title?: string;
5310
- /** Document metadata */
5311
- metadata: Record<string, unknown>;
5312
- /** Tenant ID for multi-tenant isolation */
5313
- tenantId?: string;
5314
- /** Collection/namespace */
5315
- collection: string;
5316
- /** Document status */
5317
- status: DocumentStatus;
4951
+ /** Tenant ID */
4952
+ tenantId: string;
4953
+ /** User ID (optional, for per-user tracking) */
4954
+ userId?: string;
4955
+ /** API key ID (optional) */
4956
+ apiKeyId?: string;
4957
+ /** Usage category */
4958
+ category: UsageCategory;
4959
+ /** AI provider */
4960
+ provider: string;
4961
+ /** Model used */
4962
+ model: string;
4963
+ /** Input tokens */
4964
+ inputTokens: number;
4965
+ /** Output tokens */
4966
+ outputTokens: number;
4967
+ /** Total tokens */
4968
+ totalTokens: number;
4969
+ /** Cost in USD */
4970
+ costUsd: number;
4971
+ /** Request latency in ms */
4972
+ latencyMs: number;
4973
+ /** Request ID for tracing */
4974
+ requestId?: string;
4975
+ /** Whether the request succeeded */
4976
+ success: boolean;
5318
4977
  /** Error message if failed */
5319
4978
  error?: string;
5320
- /** Chunk count */
5321
- chunkCount?: number;
5322
- /** Token count */
5323
- tokenCount?: number;
4979
+ /** Additional metadata */
4980
+ metadata?: Record<string, unknown>;
5324
4981
  /** Created timestamp */
5325
4982
  createdAt: Date;
5326
- /** Updated timestamp */
5327
- updatedAt: Date;
5328
4983
  }
5329
- interface RAGChunk {
4984
+ type QuotaType = "tokens" | "requests" | "cost";
4985
+ interface Quota {
5330
4986
  id: string;
5331
- documentId: string;
5332
- /** Chunk index within document */
5333
- index: number;
5334
- /** Chunk content */
5335
- content: string;
5336
- /** Embedding vector */
5337
- embedding?: number[];
5338
- /** Chunk metadata */
5339
- metadata: Record<string, unknown>;
5340
- /** Start character position in original document */
5341
- startOffset?: number;
5342
- /** End character position */
5343
- endOffset?: number;
5344
- /** Token count */
5345
- tokenCount: number;
5346
- /** Collection/namespace */
5347
- collection: string;
5348
- /** Tenant ID */
5349
- tenantId?: string;
5350
- }
5351
- type ChunkingStrategy = "fixed" | "sentence" | "paragraph" | "semantic" | "recursive";
5352
- interface ChunkingConfig {
5353
- /** Chunking strategy */
5354
- strategy: ChunkingStrategy;
5355
- /** Target chunk size in tokens */
5356
- chunkSize: number;
5357
- /** Overlap between chunks in tokens */
5358
- chunkOverlap: number;
5359
- /** Minimum chunk size */
5360
- minChunkSize?: number;
5361
- /** Maximum chunk size */
5362
- maxChunkSize?: number;
5363
- /** Separators for recursive chunking */
5364
- separators?: string[];
5365
- /** Keep metadata in chunks */
5366
- includeMetadata?: boolean;
5367
- /** Add document title to each chunk */
5368
- includeTitle?: boolean;
5369
- }
5370
- declare const ChunkingPresets: Record<string, ChunkingConfig>;
5371
- type SearchMode = "vector" | "keyword" | "hybrid";
5372
- interface RAGSearchQuery {
5373
- /** Search query text */
5374
- query: string;
5375
- /** Collection to search */
5376
- collection: string;
5377
- /** Tenant ID for filtering */
5378
- tenantId?: string;
5379
- /** Search mode */
5380
- mode?: SearchMode;
5381
- /** Maximum results to return */
5382
- limit?: number;
5383
- /** Minimum similarity score (0-1) */
5384
- minScore?: number;
5385
- /** Metadata filters */
5386
- filters?: RAGFilter[];
5387
- /** Include embeddings in results */
5388
- includeEmbeddings?: boolean;
5389
- /** Include original document content */
5390
- includeDocumentContent?: boolean;
5391
- /** Rerank results using cross-encoder */
5392
- rerank?: boolean;
5393
- /** Number of candidates for reranking */
5394
- rerankCandidates?: number;
5395
- }
5396
- interface RAGFilter {
5397
- field: string;
5398
- operator: "eq" | "ne" | "gt" | "gte" | "lt" | "lte" | "in" | "nin" | "contains";
5399
- value: unknown;
5400
- }
5401
- interface RAGSearchResult {
5402
- chunk: RAGChunk;
5403
- score: number;
5404
- document?: RAGDocument;
5405
- highlights?: string[];
5406
- }
5407
- interface RAGSearchResponse {
5408
- results: RAGSearchResult[];
5409
- query: string;
5410
- totalMatches: number;
5411
- searchTimeMs: number;
5412
- mode: SearchMode;
5413
- }
5414
- interface ContextAssemblyConfig {
5415
- /** Maximum tokens for assembled context */
5416
- maxTokens: number;
5417
- /** Template for formatting each chunk */
5418
- chunkTemplate?: string;
5419
- /** Template for the full context */
5420
- contextTemplate?: string;
5421
- /** Include source citations */
5422
- includeCitations?: boolean;
5423
- /** Deduplicate similar chunks */
5424
- deduplicate?: boolean;
5425
- /** Deduplication similarity threshold */
5426
- dedupeThreshold?: number;
5427
- /** Sort order for chunks */
5428
- sortBy?: "score" | "document" | "position";
5429
- }
5430
- interface AssembledContext {
5431
- /** Final assembled context string */
5432
- context: string;
5433
- /** Chunks included in context */
5434
- chunks: RAGChunk[];
5435
- /** Total tokens used */
5436
- tokenCount: number;
5437
- /** Source documents referenced */
5438
- sources: Array<{
5439
- documentId: string;
5440
- title?: string;
5441
- source: string;
5442
- }>;
5443
- /** Chunks excluded due to limits */
5444
- truncated: boolean;
5445
- }
5446
- interface IngestionOptions {
5447
- /** Collection to add documents to */
5448
- collection: string;
5449
4987
  /** Tenant ID */
5450
- tenantId?: string;
5451
- /** Chunking configuration */
5452
- chunking?: Partial<ChunkingConfig>;
5453
- /** Document metadata to attach */
5454
- metadata?: Record<string, unknown>;
5455
- /** Generate embeddings immediately */
5456
- generateEmbeddings?: boolean;
5457
- /** Batch size for processing */
5458
- batchSize?: number;
5459
- /** Skip existing documents */
5460
- skipExisting?: boolean;
5461
- }
5462
- interface IngestionResult {
5463
- documentId: string;
5464
- status: DocumentStatus;
5465
- chunkCount: number;
5466
- tokenCount: number;
5467
- error?: string;
5468
- processingTimeMs: number;
5469
- }
5470
- interface BulkIngestionResult {
5471
- total: number;
5472
- successful: number;
5473
- failed: number;
5474
- results: IngestionResult[];
5475
- totalProcessingTimeMs: number;
5476
- }
5477
- interface RAGCollection {
5478
- name: string;
5479
- description?: string;
5480
- /** Embedding model used */
5481
- embeddingModel: string;
5482
- /** Embedding dimensions */
5483
- dimensions: number;
5484
- /** Distance metric for similarity */
5485
- distanceMetric: "cosine" | "euclidean" | "dotproduct";
5486
- /** Chunking config for this collection */
5487
- chunkingConfig: ChunkingConfig;
5488
- /** Document count */
5489
- documentCount: number;
5490
- /** Chunk count */
5491
- chunkCount: number;
5492
- /** Total token count */
5493
- totalTokens: number;
5494
- /** Created timestamp */
5495
- createdAt: Date;
5496
- /** Updated timestamp */
5497
- updatedAt: Date;
5498
- }
5499
- interface CreateCollectionOptions {
5500
- name: string;
5501
- description?: string;
5502
- embeddingModel?: string;
5503
- dimensions?: number;
5504
- distanceMetric?: "cosine" | "euclidean" | "dotproduct";
5505
- chunkingConfig?: Partial<ChunkingConfig>;
5506
- }
5507
- interface RAGPipelineStep {
5508
- name: string;
5509
- type: "transform" | "filter" | "enrich" | "embed" | "store";
5510
- config: Record<string, unknown>;
4988
+ tenantId: string;
4989
+ /** Quota type */
4990
+ type: QuotaType;
4991
+ /** Category (or 'all' for global quota) */
4992
+ category: UsageCategory | "all";
4993
+ /** Quota limit */
4994
+ limit: number;
4995
+ /** Quota period */
4996
+ period: UsageInterval;
4997
+ /** Current usage */
4998
+ used: number;
4999
+ /** Period start date */
5000
+ periodStart: Date;
5001
+ /** Period end date */
5002
+ periodEnd: Date;
5003
+ /** Action when quota exceeded */
5004
+ action: "block" | "warn" | "notify" | "overage";
5005
+ /** Overage rate (for 'overage' action) */
5006
+ overageRate?: number;
5007
+ /** Alert thresholds (percentages) */
5008
+ alertThresholds?: number[];
5009
+ /** Whether quota is enabled */
5511
5010
  enabled: boolean;
5512
5011
  }
5513
- interface RAGPipeline {
5012
+ interface QuotaStatus {
5013
+ quota: Quota;
5014
+ /** Current usage */
5015
+ used: number;
5016
+ /** Remaining */
5017
+ remaining: number;
5018
+ /** Usage percentage */
5019
+ percentUsed: number;
5020
+ /** Whether quota is exceeded */
5021
+ exceeded: boolean;
5022
+ /** Estimated time until reset */
5023
+ resetsIn?: number;
5024
+ /** Alerts triggered */
5025
+ alertsTriggered: number[];
5026
+ }
5027
+ interface Budget {
5514
5028
  id: string;
5515
- name: string;
5516
- description?: string;
5517
- collection: string;
5518
- steps: RAGPipelineStep[];
5519
- createdAt: Date;
5520
- updatedAt: Date;
5521
- }
5522
- interface RAGConfig {
5523
- /** Default embedding model */
5524
- defaultEmbeddingModel?: string;
5525
- /** Default chunking config */
5526
- defaultChunkingConfig?: Partial<ChunkingConfig>;
5527
- /** Default search mode */
5528
- defaultSearchMode?: SearchMode;
5529
- /** Default result limit */
5530
- defaultLimit?: number;
5531
- /** Enable caching */
5532
- enableCache?: boolean;
5533
- /** Cache TTL in seconds */
5534
- cacheTtlSeconds?: number;
5535
- /** Maximum documents per collection */
5536
- maxDocumentsPerCollection?: number;
5537
- /** Maximum chunks per document */
5538
- maxChunksPerDocument?: number;
5539
- }
5540
- /**
5541
- * IRAG - RAG pipeline interface
5542
- *
5543
- * @example
5544
- * ```typescript
5545
- * const rag = platform.rag;
5546
- *
5547
- * // Create a collection
5548
- * await rag.createCollection({
5549
- * name: 'knowledge-base',
5550
- * embeddingModel: 'text-embedding-3-small',
5551
- * });
5552
- *
5553
- * // Ingest documents
5554
- * await rag.ingest('knowledge-base', [
5555
- * { source: 'doc1.pdf', content: '...', type: 'pdf' },
5556
- * { source: 'doc2.md', content: '...', type: 'markdown' },
5557
- * ]);
5558
- *
5559
- * // Search
5560
- * const results = await rag.search({
5561
- * query: 'How do I configure authentication?',
5562
- * collection: 'knowledge-base',
5563
- * limit: 5,
5564
- * });
5565
- *
5566
- * // Assemble context for LLM
5567
- * const context = await rag.assembleContext(results, {
5568
- * maxTokens: 4000,
5569
- * includeCitations: true,
5570
- * });
5571
- *
5572
- * // Use with AI
5573
- * const response = await ai.chat({
5574
- * messages: [
5575
- * { role: 'system', content: `Use this context: ${context.context}` },
5576
- * { role: 'user', content: 'How do I configure authentication?' }
5577
- * ]
5578
- * });
5579
- * ```
5580
- */
5581
- interface IRAG {
5582
- /**
5583
- * Create a new collection
5584
- */
5585
- createCollection(options: CreateCollectionOptions): Promise<RAGCollection>;
5586
- /**
5587
- * Get a collection by name
5588
- */
5589
- getCollection(name: string): Promise<RAGCollection | null>;
5590
- /**
5591
- * List all collections
5592
- */
5593
- listCollections(tenantId?: string): Promise<RAGCollection[]>;
5594
- /**
5595
- * Delete a collection and all its documents
5596
- */
5597
- deleteCollection(name: string): Promise<void>;
5598
- /**
5599
- * Get collection statistics
5600
- */
5601
- getCollectionStats(name: string): Promise<{
5602
- documentCount: number;
5603
- chunkCount: number;
5604
- totalTokens: number;
5605
- averageChunkSize: number;
5606
- storageBytes: number;
5607
- }>;
5608
- /**
5609
- * Ingest documents into a collection
5610
- */
5611
- ingest(collection: string, documents: Array<Omit<RAGDocument, "id" | "status" | "chunkCount" | "tokenCount" | "createdAt" | "updatedAt">>, options?: Partial<IngestionOptions>): Promise<BulkIngestionResult>;
5612
- /**
5613
- * Ingest a single document
5614
- */
5615
- ingestOne(collection: string, document: Omit<RAGDocument, "id" | "status" | "chunkCount" | "tokenCount" | "createdAt" | "updatedAt" | "collection">, options?: Partial<IngestionOptions>): Promise<IngestionResult>;
5616
- /**
5617
- * Get a document by ID
5618
- */
5619
- getDocument(documentId: string): Promise<RAGDocument | null>;
5620
- /**
5621
- * List documents in a collection
5622
- */
5623
- listDocuments(collection: string, options?: {
5624
- tenantId?: string;
5625
- status?: DocumentStatus;
5626
- limit?: number;
5627
- offset?: number;
5628
- }): Promise<{
5629
- documents: RAGDocument[];
5630
- total: number;
5631
- }>;
5632
- /**
5633
- * Delete a document and its chunks
5634
- */
5635
- deleteDocument(documentId: string): Promise<void>;
5636
- /**
5637
- * Reprocess a document (re-chunk and re-embed)
5638
- */
5639
- reprocessDocument(documentId: string, options?: Partial<IngestionOptions>): Promise<IngestionResult>;
5640
- /**
5641
- * Get chunks for a document
5642
- */
5643
- getChunks(documentId: string): Promise<RAGChunk[]>;
5644
- /**
5645
- * Get a specific chunk by ID
5646
- */
5647
- getChunk(chunkId: string): Promise<RAGChunk | null>;
5648
- /**
5649
- * Update chunk metadata
5650
- */
5651
- updateChunkMetadata(chunkId: string, metadata: Record<string, unknown>): Promise<RAGChunk>;
5652
- /**
5653
- * Search for relevant chunks
5654
- */
5655
- search(query: RAGSearchQuery): Promise<RAGSearchResponse>;
5656
- /**
5657
- * Get similar chunks to a given chunk
5658
- */
5659
- findSimilar(chunkId: string, options?: {
5660
- limit?: number;
5661
- minScore?: number;
5662
- collection?: string;
5663
- }): Promise<RAGSearchResult[]>;
5664
- /**
5665
- * Multi-query search (query expansion)
5666
- */
5667
- multiSearch(queries: RAGSearchQuery[]): Promise<RAGSearchResponse[]>;
5668
- /**
5669
- * Assemble context from search results
5670
- */
5671
- assembleContext(results: RAGSearchResponse | RAGSearchResult[], config?: Partial<ContextAssemblyConfig>): Promise<AssembledContext>;
5672
- /**
5673
- * Query and assemble in one step
5674
- */
5675
- queryWithContext(query: RAGSearchQuery, contextConfig?: Partial<ContextAssemblyConfig>): Promise<{
5676
- searchResponse: RAGSearchResponse;
5677
- context: AssembledContext;
5678
- }>;
5679
- /**
5680
- * Generate embeddings for text
5681
- */
5682
- embed(texts: string | string[], model?: string): Promise<number[][]>;
5683
- /**
5684
- * Update embeddings for a collection
5685
- */
5686
- reembed(collection: string, model?: string, batchSize?: number): Promise<{
5687
- updated: number;
5688
- errors: number;
5689
- }>;
5690
- /**
5691
- * Create a processing pipeline
5692
- */
5693
- createPipeline(pipeline: Omit<RAGPipeline, "id" | "createdAt" | "updatedAt">): Promise<RAGPipeline>;
5694
- /**
5695
- * Get a pipeline
5696
- */
5697
- getPipeline(pipelineId: string): Promise<RAGPipeline | null>;
5698
- /**
5699
- * Run a pipeline on documents
5700
- */
5701
- runPipeline(pipelineId: string, documentIds: string[]): Promise<BulkIngestionResult>;
5702
- }
5703
- /**
5704
- * MemoryRAG - In-memory implementation for testing
5705
- */
5706
- declare class MemoryRAG implements IRAG {
5707
- private config;
5708
- private collections;
5709
- private documents;
5710
- private chunks;
5711
- private pipelines;
5712
- private embeddings;
5713
- constructor(config?: RAGConfig);
5714
- createCollection(options: CreateCollectionOptions): Promise<RAGCollection>;
5715
- getCollection(name: string): Promise<RAGCollection | null>;
5716
- listCollections(tenantId?: string): Promise<RAGCollection[]>;
5717
- deleteCollection(name: string): Promise<void>;
5718
- getCollectionStats(name: string): Promise<{
5719
- documentCount: number;
5720
- chunkCount: number;
5721
- totalTokens: number;
5722
- averageChunkSize: number;
5723
- storageBytes: number;
5724
- }>;
5725
- ingest(collection: string, documents: Array<Omit<RAGDocument, "id" | "status" | "chunkCount" | "tokenCount" | "createdAt" | "updatedAt">>, options?: Partial<IngestionOptions>): Promise<BulkIngestionResult>;
5726
- ingestOne(collection: string, document: Omit<RAGDocument, "id" | "status" | "chunkCount" | "tokenCount" | "createdAt" | "updatedAt" | "collection">, options?: Partial<IngestionOptions>): Promise<IngestionResult>;
5727
- getDocument(documentId: string): Promise<RAGDocument | null>;
5728
- listDocuments(collection: string, options?: {
5729
- tenantId?: string;
5730
- status?: DocumentStatus;
5731
- limit?: number;
5732
- offset?: number;
5733
- }): Promise<{
5734
- documents: RAGDocument[];
5735
- total: number;
5736
- }>;
5737
- deleteDocument(documentId: string): Promise<void>;
5738
- reprocessDocument(documentId: string, options?: Partial<IngestionOptions>): Promise<IngestionResult>;
5739
- getChunks(documentId: string): Promise<RAGChunk[]>;
5740
- getChunk(chunkId: string): Promise<RAGChunk | null>;
5741
- updateChunkMetadata(chunkId: string, metadata: Record<string, unknown>): Promise<RAGChunk>;
5742
- search(query: RAGSearchQuery): Promise<RAGSearchResponse>;
5743
- findSimilar(chunkId: string, options?: {
5744
- limit?: number;
5745
- minScore?: number;
5746
- collection?: string;
5747
- }): Promise<RAGSearchResult[]>;
5748
- multiSearch(queries: RAGSearchQuery[]): Promise<RAGSearchResponse[]>;
5749
- assembleContext(results: RAGSearchResponse | RAGSearchResult[], config?: Partial<ContextAssemblyConfig>): Promise<AssembledContext>;
5750
- queryWithContext(query: RAGSearchQuery, contextConfig?: Partial<ContextAssemblyConfig>): Promise<{
5751
- searchResponse: RAGSearchResponse;
5752
- context: AssembledContext;
5753
- }>;
5754
- embed(texts: string | string[], model?: string): Promise<number[][]>;
5755
- reembed(collection: string, model?: string, batchSize?: number): Promise<{
5756
- updated: number;
5757
- errors: number;
5758
- }>;
5759
- createPipeline(pipeline: Omit<RAGPipeline, "id" | "createdAt" | "updatedAt">): Promise<RAGPipeline>;
5760
- getPipeline(pipelineId: string): Promise<RAGPipeline | null>;
5761
- runPipeline(pipelineId: string, documentIds: string[]): Promise<BulkIngestionResult>;
5762
- private chunkDocument;
5763
- private generateMockEmbedding;
5764
- private cosineSimilarity;
5765
- private keywordScore;
5766
- private matchesFilters;
5767
- private generateHighlights;
5768
- private deduplicateResults;
5769
- }
5770
-
5771
- /**
5772
- * IAIUsage - Per-tenant AI token tracking and cost allocation
5773
- *
5774
- * Provides infrastructure for:
5775
- * - Token usage tracking per tenant
5776
- * - Cost allocation and budgeting
5777
- * - Usage quotas and limits
5778
- * - Billing integration
5779
- * - Analytics and reporting
5780
- */
5781
- type UsageCategory = "chat" | "completion" | "embedding" | "image" | "audio" | "video" | "fine_tuning";
5782
- type UsageInterval = "minute" | "hour" | "day" | "week" | "month" | "year";
5783
- interface UsageRecord {
5784
- id: string;
5785
- /** Tenant ID */
5786
- tenantId: string;
5787
- /** User ID (optional, for per-user tracking) */
5788
- userId?: string;
5789
- /** API key ID (optional) */
5790
- apiKeyId?: string;
5791
- /** Usage category */
5792
- category: UsageCategory;
5793
- /** AI provider */
5794
- provider: string;
5795
- /** Model used */
5796
- model: string;
5797
- /** Input tokens */
5798
- inputTokens: number;
5799
- /** Output tokens */
5800
- outputTokens: number;
5801
- /** Total tokens */
5802
- totalTokens: number;
5803
- /** Cost in USD */
5804
- costUsd: number;
5805
- /** Request latency in ms */
5806
- latencyMs: number;
5807
- /** Request ID for tracing */
5808
- requestId?: string;
5809
- /** Whether the request succeeded */
5810
- success: boolean;
5811
- /** Error message if failed */
5812
- error?: string;
5813
- /** Additional metadata */
5814
- metadata?: Record<string, unknown>;
5815
- /** Created timestamp */
5816
- createdAt: Date;
5817
- }
5818
- type QuotaType = "tokens" | "requests" | "cost";
5819
- interface Quota {
5820
- id: string;
5821
- /** Tenant ID */
5822
- tenantId: string;
5823
- /** Quota type */
5824
- type: QuotaType;
5825
- /** Category (or 'all' for global quota) */
5826
- category: UsageCategory | "all";
5827
- /** Quota limit */
5828
- limit: number;
5829
- /** Quota period */
5830
- period: UsageInterval;
5831
- /** Current usage */
5832
- used: number;
5833
- /** Period start date */
5834
- periodStart: Date;
5835
- /** Period end date */
5836
- periodEnd: Date;
5837
- /** Action when quota exceeded */
5838
- action: "block" | "warn" | "notify" | "overage";
5839
- /** Overage rate (for 'overage' action) */
5840
- overageRate?: number;
5841
- /** Alert thresholds (percentages) */
5842
- alertThresholds?: number[];
5843
- /** Whether quota is enabled */
5844
- enabled: boolean;
5845
- }
5846
- interface QuotaStatus {
5847
- quota: Quota;
5848
- /** Current usage */
5849
- used: number;
5850
- /** Remaining */
5851
- remaining: number;
5852
- /** Usage percentage */
5853
- percentUsed: number;
5854
- /** Whether quota is exceeded */
5855
- exceeded: boolean;
5856
- /** Estimated time until reset */
5857
- resetsIn?: number;
5858
- /** Alerts triggered */
5859
- alertsTriggered: number[];
5860
- }
5861
- interface Budget {
5862
- id: string;
5863
- /** Tenant ID */
5864
- tenantId: string;
5865
- /** Budget name */
5029
+ /** Tenant ID */
5030
+ tenantId: string;
5031
+ /** Budget name */
5866
5032
  name: string;
5867
5033
  /** Budget amount in USD */
5868
5034
  amount: number;
@@ -11489,6 +10655,72 @@ declare class MemoryNotification implements INotification {
11489
10655
  getAllNotifications(): StoredNotification[];
11490
10656
  }
11491
10657
 
10658
+ /**
10659
+ * Memory Scheduler Implementation
10660
+ *
10661
+ * Pure in-memory scheduler for testing without external dependencies.
10662
+ * All operations are synchronous and data is stored in memory.
10663
+ *
10664
+ * Features:
10665
+ * - Cron-based recurring jobs
10666
+ * - One-time scheduled jobs
10667
+ * - Execution history tracking
10668
+ * - No external dependencies (no IQueue required)
10669
+ * - Immediate job execution for testing
10670
+ */
10671
+
10672
+ interface MemorySchedulerConfig extends SchedulerConfig {
10673
+ /** Auto-process jobs immediately when triggered (useful for tests) */
10674
+ autoProcess?: boolean;
10675
+ /** Service name for correlation */
10676
+ serviceName?: string;
10677
+ }
10678
+ declare class MemoryScheduler implements IScheduler {
10679
+ private config;
10680
+ private schedules;
10681
+ private executions;
10682
+ private handlers;
10683
+ private running;
10684
+ private checkTimer?;
10685
+ constructor(config?: MemorySchedulerConfig);
10686
+ create<T>(options: CreateScheduleOptions<T>): Promise<ScheduledJob<T>>;
10687
+ get<T>(id: string): Promise<ScheduledJob<T> | null>;
10688
+ update<T>(id: string, options: UpdateScheduleOptions<T>): Promise<ScheduledJob<T>>;
10689
+ delete(id: string): Promise<void>;
10690
+ pause(id: string): Promise<void>;
10691
+ resume(id: string): Promise<void>;
10692
+ trigger(id: string): Promise<string>;
10693
+ list<T>(query?: ScheduleQuery): Promise<ScheduledJob<T>[]>;
10694
+ getHistory(scheduleId: string, limit?: number): Promise<ScheduleExecution[]>;
10695
+ handle<T>(name: string, handler: ScheduleHandler<T>): void;
10696
+ start(): Promise<void>;
10697
+ stop(): Promise<void>;
10698
+ getStats(): Promise<SchedulerStats>;
10699
+ healthCheck(): Promise<boolean>;
10700
+ close(): Promise<void>;
10701
+ /**
10702
+ * Get all schedules (for testing)
10703
+ */
10704
+ getSchedules(): ScheduledJob<unknown>[];
10705
+ /**
10706
+ * Get all executions (for testing)
10707
+ */
10708
+ getAllExecutions(): Map<string, ScheduleExecution[]>;
10709
+ /**
10710
+ * Clear all schedules and executions (for testing)
10711
+ */
10712
+ clear(): void;
10713
+ /**
10714
+ * Process all pending jobs immediately (for testing)
10715
+ */
10716
+ processAll(): Promise<number>;
10717
+ private checkUpcomingJobs;
10718
+ private executeSchedule;
10719
+ private processScheduledJob;
10720
+ private saveExecution;
10721
+ private completeExecution;
10722
+ }
10723
+
11492
10724
  /**
11493
10725
  * Supabase Database Adapter
11494
10726
  * Production implementation using Supabase as the database provider
@@ -12186,6 +11418,80 @@ declare class DatabaseErrorReporter implements IErrorReporter {
12186
11418
  private rowToReport;
12187
11419
  }
12188
11420
 
11421
+ /**
11422
+ * Database Prompt Store Implementation
11423
+ *
11424
+ * Persists prompts, versions, experiments, and usage analytics to a database.
11425
+ * Supports PostgreSQL and Supabase through the IDatabase interface.
11426
+ */
11427
+
11428
+ interface DatabasePromptStoreConfig extends PromptStoreConfig {
11429
+ /** Table prefix for all prompt tables */
11430
+ tablePrefix?: string;
11431
+ /** Optional cache for prompt lookups */
11432
+ cache?: ICache;
11433
+ }
11434
+ declare class DatabasePromptStore implements IPromptStore {
11435
+ private db;
11436
+ private cache?;
11437
+ private config;
11438
+ private variantAssignments;
11439
+ private get promptsTable();
11440
+ private get versionsTable();
11441
+ private get experimentsTable();
11442
+ private get chainsTable();
11443
+ private get usageTable();
11444
+ constructor(db: IDatabase, config?: DatabasePromptStoreConfig);
11445
+ /**
11446
+ * SQL to create prompt store tables (PostgreSQL)
11447
+ */
11448
+ static getCreateTableSQL(tablePrefix?: string): string;
11449
+ create(prompt: Omit<Prompt, 'id' | 'createdAt' | 'updatedAt'>): Promise<Prompt>;
11450
+ get(idOrSlug: string): Promise<Prompt | null>;
11451
+ update(idOrSlug: string, updates: Partial<Omit<Prompt, 'id' | 'createdAt' | 'updatedAt'>>, changeLog?: string): Promise<Prompt>;
11452
+ delete(idOrSlug: string): Promise<void>;
11453
+ query(query: PromptQuery): Promise<PromptQueryResult>;
11454
+ getVersions(idOrSlug: string): Promise<PromptVersion[]>;
11455
+ getVersion(idOrSlug: string, version: number): Promise<PromptVersion | null>;
11456
+ rollback(idOrSlug: string, version: number): Promise<Prompt>;
11457
+ compareVersions(idOrSlug: string, version1: number, version2: number): Promise<{
11458
+ version1: PromptVersion;
11459
+ version2: PromptVersion;
11460
+ diff: string;
11461
+ }>;
11462
+ render(idOrSlug: string, options?: RenderOptions): Promise<RenderedPrompt>;
11463
+ validate(idOrSlug: string, variables: Record<string, unknown>): Promise<{
11464
+ valid: boolean;
11465
+ errors: Array<{
11466
+ variable: string;
11467
+ message: string;
11468
+ }>;
11469
+ }>;
11470
+ createExperiment(experiment: Omit<PromptExperiment, 'id' | 'createdAt' | 'updatedAt'>): Promise<PromptExperiment>;
11471
+ getExperiment(experimentId: string): Promise<PromptExperiment | null>;
11472
+ startExperiment(experimentId: string): Promise<PromptExperiment>;
11473
+ pauseExperiment(experimentId: string): Promise<PromptExperiment>;
11474
+ completeExperiment(experimentId: string, winningVariantId?: string): Promise<PromptExperiment>;
11475
+ getExperimentMetrics(experimentId: string): Promise<ExperimentMetrics[]>;
11476
+ createChain(chain: Omit<PromptChain, 'id' | 'createdAt' | 'updatedAt'>): Promise<PromptChain>;
11477
+ getChain(chainId: string): Promise<PromptChain | null>;
11478
+ executeChain(chainId: string, initialVariables: Record<string, unknown>): Promise<ChainExecutionResult>;
11479
+ recordUsage(record: Omit<PromptUsageRecord, 'id' | 'createdAt'>): Promise<PromptUsageRecord>;
11480
+ getUsageStats(idOrSlug: string, period: 'hour' | 'day' | 'week' | 'month'): Promise<PromptUsageStats>;
11481
+ recordFeedback(usageId: string, feedback: {
11482
+ rating?: number;
11483
+ comment?: string;
11484
+ }): Promise<void>;
11485
+ private rowToPrompt;
11486
+ private rowToVersion;
11487
+ private rowToExperiment;
11488
+ private rowToChain;
11489
+ private selectVariant;
11490
+ private getVersionById;
11491
+ private average;
11492
+ private invalidateCache;
11493
+ }
11494
+
12189
11495
  /**
12190
11496
  * Queue-based Scheduler Implementation
12191
11497
  *
@@ -12487,6 +11793,432 @@ declare class StripePayment implements IPayment {
12487
11793
  getStripeInstance(): Stripe;
12488
11794
  }
12489
11795
 
11796
+ /**
11797
+ * OpenAIAdapter - Production IAI implementation for OpenAI
11798
+ *
11799
+ * Supports:
11800
+ * - GPT-4, GPT-4 Turbo, GPT-4o, GPT-3.5 Turbo
11801
+ * - Chat completions (streaming and non-streaming)
11802
+ * - Embeddings (text-embedding-3-small, text-embedding-3-large, text-embedding-ada-002)
11803
+ * - Token counting (via tiktoken-compatible estimation)
11804
+ * - Cost tracking
11805
+ * - Tool/function calling
11806
+ */
11807
+
11808
+ interface OpenAIAdapterConfig extends AIConfig {
11809
+ /** OpenAI API key */
11810
+ apiKey: string;
11811
+ /** Organization ID (optional) */
11812
+ organization?: string;
11813
+ /** Base URL for API (for Azure OpenAI or proxies) */
11814
+ baseURL?: string;
11815
+ /** Request timeout in milliseconds */
11816
+ timeoutMs?: number;
11817
+ /** Maximum retries for failed requests */
11818
+ maxRetries?: number;
11819
+ /** Whether to use stream mode by default */
11820
+ defaultStream?: boolean;
11821
+ }
11822
+ declare class OpenAIAdapter implements IAI {
11823
+ private client;
11824
+ private models;
11825
+ private config;
11826
+ constructor(config: OpenAIAdapterConfig);
11827
+ /**
11828
+ * Initialize the OpenAI client lazily
11829
+ */
11830
+ private getClient;
11831
+ chat(request: AIChatRequest): Promise<AIChatResponse>;
11832
+ chatStream(request: AIChatRequest): AsyncIterable<AIStreamChunk>;
11833
+ chatWithCallback(request: AIChatRequest, callback: AIStreamCallback): Promise<AIChatResponse>;
11834
+ complete(request: AICompletionRequest): Promise<AICompletionResponse>;
11835
+ completeStream(request: AICompletionRequest): AsyncIterable<AIStreamChunk>;
11836
+ embed(request: AIEmbeddingRequest): Promise<AIEmbeddingResponse>;
11837
+ similarity(text1: string, text2: string, model?: string): Promise<number>;
11838
+ listModels(): Promise<AIModelConfig[]>;
11839
+ getModel(modelId: string): Promise<AIModelConfig | null>;
11840
+ supportsCapability(modelId: string, capability: AIModelType): Promise<boolean>;
11841
+ estimateTokens(text: string, _model?: string): Promise<number>;
11842
+ estimateCost(request: AIChatRequest | AICompletionRequest | AIEmbeddingRequest): Promise<number>;
11843
+ healthCheck(): Promise<{
11844
+ healthy: boolean;
11845
+ providers: Record<AIProvider, {
11846
+ available: boolean;
11847
+ latencyMs?: number;
11848
+ error?: string;
11849
+ }>;
11850
+ }>;
11851
+ private mapMessages;
11852
+ private mapResponseMessage;
11853
+ private mapFinishReason;
11854
+ private mapUsage;
11855
+ private calculateCost;
11856
+ private cosineSimilarity;
11857
+ private handleError;
11858
+ }
11859
+ /**
11860
+ * Create an OpenAI adapter instance
11861
+ */
11862
+ declare function createOpenAIAdapter(config: OpenAIAdapterConfig): OpenAIAdapter;
11863
+
11864
+ /**
11865
+ * AnthropicAdapter - Production IAI implementation for Anthropic Claude
11866
+ *
11867
+ * Supports:
11868
+ * - Claude 3.5 Sonnet, Claude 3 Opus, Claude 3 Sonnet, Claude 3 Haiku
11869
+ * - Claude 4 Opus, Claude 4 Sonnet
11870
+ * - Chat completions (streaming and non-streaming)
11871
+ * - Tool/function calling
11872
+ * - Vision (image input)
11873
+ * - Token counting
11874
+ * - Cost tracking
11875
+ *
11876
+ * Note: Anthropic does not provide an embeddings API.
11877
+ * For embeddings, use OpenAI or another provider.
11878
+ */
11879
+
11880
+ interface AnthropicAdapterConfig extends AIConfig {
11881
+ /** Anthropic API key */
11882
+ apiKey: string;
11883
+ /** Base URL for API (optional) */
11884
+ baseURL?: string;
11885
+ /** Request timeout in milliseconds */
11886
+ timeoutMs?: number;
11887
+ /** Maximum retries for failed requests */
11888
+ maxRetries?: number;
11889
+ /** Default max tokens for responses (Anthropic requires this) */
11890
+ defaultMaxTokens?: number;
11891
+ }
11892
+ declare class AnthropicAdapter implements IAI {
11893
+ private client;
11894
+ private models;
11895
+ private config;
11896
+ constructor(config: AnthropicAdapterConfig);
11897
+ /**
11898
+ * Initialize the Anthropic client lazily
11899
+ */
11900
+ private getClient;
11901
+ chat(request: AIChatRequest): Promise<AIChatResponse>;
11902
+ chatStream(request: AIChatRequest): AsyncIterable<AIStreamChunk>;
11903
+ chatWithCallback(request: AIChatRequest, callback: AIStreamCallback): Promise<AIChatResponse>;
11904
+ complete(request: AICompletionRequest): Promise<AICompletionResponse>;
11905
+ completeStream(request: AICompletionRequest): AsyncIterable<AIStreamChunk>;
11906
+ embed(_request: AIEmbeddingRequest): Promise<AIEmbeddingResponse>;
11907
+ similarity(_text1: string, _text2: string, _model?: string): Promise<number>;
11908
+ listModels(): Promise<AIModelConfig[]>;
11909
+ getModel(modelId: string): Promise<AIModelConfig | null>;
11910
+ supportsCapability(modelId: string, capability: AIModelType): Promise<boolean>;
11911
+ estimateTokens(text: string, _model?: string): Promise<number>;
11912
+ estimateCost(request: AIChatRequest | AICompletionRequest | AIEmbeddingRequest): Promise<number>;
11913
+ healthCheck(): Promise<{
11914
+ healthy: boolean;
11915
+ providers: Record<AIProvider, {
11916
+ available: boolean;
11917
+ latencyMs?: number;
11918
+ error?: string;
11919
+ }>;
11920
+ }>;
11921
+ private resolveModelId;
11922
+ private separateSystemMessage;
11923
+ private mapMessages;
11924
+ private mapTool;
11925
+ private mapToolChoice;
11926
+ private extractContent;
11927
+ private extractToolCalls;
11928
+ private mapStopReason;
11929
+ private mapUsage;
11930
+ private calculateCost;
11931
+ private handleError;
11932
+ }
11933
+ /**
11934
+ * Create an Anthropic adapter instance
11935
+ */
11936
+ declare function createAnthropicAdapter(config: AnthropicAdapterConfig): AnthropicAdapter;
11937
+
11938
+ /**
11939
+ * GoogleAIAdapter - Production IAI implementation for Google Gemini
11940
+ *
11941
+ * Supports:
11942
+ * - Gemini 2.0 Flash, Gemini 1.5 Pro, Gemini 1.5 Flash
11943
+ * - Chat completions (streaming and non-streaming)
11944
+ * - Embeddings (text-embedding-004)
11945
+ * - Tool/function calling
11946
+ * - Vision (image input)
11947
+ * - Token counting
11948
+ * - Cost tracking
11949
+ */
11950
+
11951
+ interface GoogleAIAdapterConfig extends AIConfig {
11952
+ /** Google AI API key */
11953
+ apiKey: string;
11954
+ /** Request timeout in milliseconds */
11955
+ timeoutMs?: number;
11956
+ /** Safety settings threshold */
11957
+ safetyThreshold?: "BLOCK_NONE" | "BLOCK_LOW_AND_ABOVE" | "BLOCK_MEDIUM_AND_ABOVE" | "BLOCK_ONLY_HIGH";
11958
+ }
11959
+ declare class GoogleAIAdapter implements IAI {
11960
+ private client;
11961
+ private models;
11962
+ private config;
11963
+ constructor(config: GoogleAIAdapterConfig);
11964
+ /**
11965
+ * Initialize the Google AI client lazily
11966
+ */
11967
+ private getClient;
11968
+ /**
11969
+ * Get a generative model instance from Google API
11970
+ */
11971
+ private getGenerativeModel;
11972
+ chat(request: AIChatRequest): Promise<AIChatResponse>;
11973
+ chatStream(request: AIChatRequest): AsyncIterable<AIStreamChunk>;
11974
+ chatWithCallback(request: AIChatRequest, callback: AIStreamCallback): Promise<AIChatResponse>;
11975
+ complete(request: AICompletionRequest): Promise<AICompletionResponse>;
11976
+ completeStream(request: AICompletionRequest): AsyncIterable<AIStreamChunk>;
11977
+ embed(request: AIEmbeddingRequest): Promise<AIEmbeddingResponse>;
11978
+ similarity(text1: string, text2: string, model?: string): Promise<number>;
11979
+ listModels(): Promise<AIModelConfig[]>;
11980
+ getModel(modelId: string): Promise<AIModelConfig | null>;
11981
+ supportsCapability(modelId: string, capability: AIModelType): Promise<boolean>;
11982
+ estimateTokens(text: string, _model?: string): Promise<number>;
11983
+ estimateCost(request: AIChatRequest | AICompletionRequest | AIEmbeddingRequest): Promise<number>;
11984
+ healthCheck(): Promise<{
11985
+ healthy: boolean;
11986
+ providers: Record<AIProvider, {
11987
+ available: boolean;
11988
+ latencyMs?: number;
11989
+ error?: string;
11990
+ }>;
11991
+ }>;
11992
+ private mapMessages;
11993
+ private mapTools;
11994
+ private extractFunctionCalls;
11995
+ private mapFinishReason;
11996
+ private mapUsage;
11997
+ private calculateCost;
11998
+ private cosineSimilarity;
11999
+ private handleError;
12000
+ }
12001
+ /**
12002
+ * Create a Google AI adapter instance
12003
+ */
12004
+ declare function createGoogleAIAdapter(config: GoogleAIAdapterConfig): GoogleAIAdapter;
12005
+
12006
+ /**
12007
+ * PineconeRAG - Production IRAG implementation using Pinecone vector database
12008
+ *
12009
+ * Supports:
12010
+ * - Vector storage and retrieval
12011
+ * - Hybrid search (vector + keyword with sparse vectors)
12012
+ * - Namespace-based multi-tenancy
12013
+ * - Metadata filtering
12014
+ * - Serverless and pod-based indexes
12015
+ */
12016
+
12017
+ interface PineconeRAGConfig extends RAGConfig {
12018
+ /** Pinecone API key */
12019
+ apiKey: string;
12020
+ /** Pinecone environment (for pod-based indexes) */
12021
+ environment?: string;
12022
+ /** Index name */
12023
+ indexName: string;
12024
+ /** AI adapter for embeddings */
12025
+ ai: IAI;
12026
+ /** Default namespace (for multi-tenancy) */
12027
+ defaultNamespace?: string;
12028
+ /** Batch size for upserts */
12029
+ upsertBatchSize?: number;
12030
+ /** Batch size for queries */
12031
+ queryBatchSize?: number;
12032
+ }
12033
+ declare class PineconeRAG implements IRAG {
12034
+ private client;
12035
+ private index;
12036
+ private config;
12037
+ private collections;
12038
+ private documents;
12039
+ private pipelines;
12040
+ constructor(config: PineconeRAGConfig);
12041
+ /**
12042
+ * Initialize Pinecone client lazily
12043
+ */
12044
+ private getClient;
12045
+ /**
12046
+ * Get the index instance
12047
+ */
12048
+ private getIndex;
12049
+ /**
12050
+ * Get namespace for tenant isolation
12051
+ */
12052
+ private getNamespace;
12053
+ createCollection(options: CreateCollectionOptions): Promise<RAGCollection>;
12054
+ getCollection(name: string): Promise<RAGCollection | null>;
12055
+ listCollections(tenantId?: string): Promise<RAGCollection[]>;
12056
+ deleteCollection(name: string): Promise<void>;
12057
+ getCollectionStats(name: string): Promise<{
12058
+ documentCount: number;
12059
+ chunkCount: number;
12060
+ totalTokens: number;
12061
+ averageChunkSize: number;
12062
+ storageBytes: number;
12063
+ }>;
12064
+ ingest(collection: string, documents: Array<Omit<RAGDocument, "id" | "status" | "chunkCount" | "tokenCount" | "createdAt" | "updatedAt">>, options?: Partial<IngestionOptions>): Promise<BulkIngestionResult>;
12065
+ ingestOne(collection: string, document: Omit<RAGDocument, "id" | "status" | "chunkCount" | "tokenCount" | "createdAt" | "updatedAt" | "collection">, options?: Partial<IngestionOptions>): Promise<IngestionResult>;
12066
+ getDocument(documentId: string): Promise<RAGDocument | null>;
12067
+ listDocuments(collection: string, options?: {
12068
+ tenantId?: string;
12069
+ status?: DocumentStatus;
12070
+ limit?: number;
12071
+ offset?: number;
12072
+ }): Promise<{
12073
+ documents: RAGDocument[];
12074
+ total: number;
12075
+ }>;
12076
+ deleteDocument(documentId: string): Promise<void>;
12077
+ reprocessDocument(documentId: string, options?: Partial<IngestionOptions>): Promise<IngestionResult>;
12078
+ getChunks(documentId: string): Promise<RAGChunk[]>;
12079
+ getChunk(chunkId: string): Promise<RAGChunk | null>;
12080
+ updateChunkMetadata(chunkId: string, metadata: Record<string, unknown>): Promise<RAGChunk>;
12081
+ search(query: RAGSearchQuery): Promise<RAGSearchResponse>;
12082
+ findSimilar(chunkId: string, options?: {
12083
+ limit?: number;
12084
+ minScore?: number;
12085
+ collection?: string;
12086
+ }): Promise<RAGSearchResult[]>;
12087
+ multiSearch(queries: RAGSearchQuery[]): Promise<RAGSearchResponse[]>;
12088
+ assembleContext(results: RAGSearchResponse | RAGSearchResult[], config?: Partial<ContextAssemblyConfig>): Promise<AssembledContext>;
12089
+ queryWithContext(query: RAGSearchQuery, contextConfig?: Partial<ContextAssemblyConfig>): Promise<{
12090
+ searchResponse: RAGSearchResponse;
12091
+ context: AssembledContext;
12092
+ }>;
12093
+ embed(texts: string | string[], model?: string): Promise<number[][]>;
12094
+ reembed(collection: string, _model?: string, _batchSize?: number): Promise<{
12095
+ updated: number;
12096
+ errors: number;
12097
+ }>;
12098
+ createPipeline(pipeline: Omit<RAGPipeline, "id" | "createdAt" | "updatedAt">): Promise<RAGPipeline>;
12099
+ getPipeline(pipelineId: string): Promise<RAGPipeline | null>;
12100
+ runPipeline(pipelineId: string, documentIds: string[]): Promise<BulkIngestionResult>;
12101
+ private chunkDocument;
12102
+ private fixedChunk;
12103
+ private sentenceChunk;
12104
+ private paragraphChunk;
12105
+ private recursiveChunk;
12106
+ private groupChunks;
12107
+ private estimateTokens;
12108
+ private buildPineconeFilter;
12109
+ private mapSearchResults;
12110
+ }
12111
+ /**
12112
+ * Create a Pinecone RAG adapter instance
12113
+ */
12114
+ declare function createPineconeRAG(config: PineconeRAGConfig): PineconeRAG;
12115
+
12116
+ /**
12117
+ * WeaviateRAG - Production IRAG implementation using Weaviate vector database
12118
+ *
12119
+ * Supports:
12120
+ * - Vector storage and retrieval
12121
+ * - True hybrid search (BM25 + vector)
12122
+ * - GraphQL-based querying
12123
+ * - Multi-tenancy
12124
+ * - Auto-schema management
12125
+ * - Built-in vectorization modules
12126
+ */
12127
+
12128
+ interface WeaviateRAGConfig extends RAGConfig {
12129
+ /** Weaviate host URL */
12130
+ host: string;
12131
+ /** API key for Weaviate Cloud */
12132
+ apiKey?: string;
12133
+ /** HTTP headers */
12134
+ headers?: Record<string, string>;
12135
+ /** AI adapter for embeddings (optional if using Weaviate's vectorizer) */
12136
+ ai?: IAI;
12137
+ /** Use Weaviate's built-in vectorizer */
12138
+ useBuiltInVectorizer?: boolean;
12139
+ /** Vectorizer module name (e.g., 'text2vec-openai') */
12140
+ vectorizerModule?: string;
12141
+ /** Vectorizer config */
12142
+ vectorizerConfig?: Record<string, unknown>;
12143
+ /** Default tenant ID for multi-tenancy */
12144
+ defaultTenant?: string;
12145
+ }
12146
+ declare class WeaviateRAG implements IRAG {
12147
+ private client;
12148
+ private config;
12149
+ private collections;
12150
+ private documents;
12151
+ private pipelines;
12152
+ constructor(config: WeaviateRAGConfig);
12153
+ /**
12154
+ * Initialize Weaviate client lazily
12155
+ */
12156
+ private getClient;
12157
+ /**
12158
+ * Get class name for collection (Weaviate uses PascalCase class names)
12159
+ */
12160
+ private getClassName;
12161
+ createCollection(options: CreateCollectionOptions): Promise<RAGCollection>;
12162
+ getCollection(name: string): Promise<RAGCollection | null>;
12163
+ listCollections(tenantId?: string): Promise<RAGCollection[]>;
12164
+ deleteCollection(name: string): Promise<void>;
12165
+ getCollectionStats(name: string): Promise<{
12166
+ documentCount: number;
12167
+ chunkCount: number;
12168
+ totalTokens: number;
12169
+ averageChunkSize: number;
12170
+ storageBytes: number;
12171
+ }>;
12172
+ ingest(collection: string, documents: Array<Omit<RAGDocument, "id" | "status" | "chunkCount" | "tokenCount" | "createdAt" | "updatedAt">>, options?: Partial<IngestionOptions>): Promise<BulkIngestionResult>;
12173
+ ingestOne(collection: string, document: Omit<RAGDocument, "id" | "status" | "chunkCount" | "tokenCount" | "createdAt" | "updatedAt" | "collection">, options?: Partial<IngestionOptions>): Promise<IngestionResult>;
12174
+ getDocument(documentId: string): Promise<RAGDocument | null>;
12175
+ listDocuments(collection: string, options?: {
12176
+ tenantId?: string;
12177
+ status?: DocumentStatus;
12178
+ limit?: number;
12179
+ offset?: number;
12180
+ }): Promise<{
12181
+ documents: RAGDocument[];
12182
+ total: number;
12183
+ }>;
12184
+ deleteDocument(documentId: string): Promise<void>;
12185
+ reprocessDocument(documentId: string, options?: Partial<IngestionOptions>): Promise<IngestionResult>;
12186
+ getChunks(documentId: string): Promise<RAGChunk[]>;
12187
+ getChunk(chunkId: string): Promise<RAGChunk | null>;
12188
+ updateChunkMetadata(chunkId: string, metadata: Record<string, unknown>): Promise<RAGChunk>;
12189
+ search(query: RAGSearchQuery): Promise<RAGSearchResponse>;
12190
+ findSimilar(chunkId: string, options?: {
12191
+ limit?: number;
12192
+ minScore?: number;
12193
+ collection?: string;
12194
+ }): Promise<RAGSearchResult[]>;
12195
+ multiSearch(queries: RAGSearchQuery[]): Promise<RAGSearchResponse[]>;
12196
+ assembleContext(results: RAGSearchResponse | RAGSearchResult[], config?: Partial<ContextAssemblyConfig>): Promise<AssembledContext>;
12197
+ queryWithContext(query: RAGSearchQuery, contextConfig?: Partial<ContextAssemblyConfig>): Promise<{
12198
+ searchResponse: RAGSearchResponse;
12199
+ context: AssembledContext;
12200
+ }>;
12201
+ embed(texts: string | string[], model?: string): Promise<number[][]>;
12202
+ reembed(collection: string, _model?: string, _batchSize?: number): Promise<{
12203
+ updated: number;
12204
+ errors: number;
12205
+ }>;
12206
+ createPipeline(pipeline: Omit<RAGPipeline, "id" | "createdAt" | "updatedAt">): Promise<RAGPipeline>;
12207
+ getPipeline(pipelineId: string): Promise<RAGPipeline | null>;
12208
+ runPipeline(pipelineId: string, documentIds: string[]): Promise<BulkIngestionResult>;
12209
+ private chunkDocument;
12210
+ private fixedChunk;
12211
+ private sentenceChunk;
12212
+ private paragraphChunk;
12213
+ private recursiveChunk;
12214
+ private groupChunks;
12215
+ private estimateTokens;
12216
+ }
12217
+ /**
12218
+ * Create a Weaviate RAG adapter instance
12219
+ */
12220
+ declare function createWeaviateRAG(config: WeaviateRAGConfig): WeaviateRAG;
12221
+
12490
12222
  /**
12491
12223
  * Generic OIDC Enterprise SSO Adapter
12492
12224
  *
@@ -12778,4 +12510,4 @@ declare class PostgresTenant implements ITenant {
12778
12510
  private mapRowToInvitation;
12779
12511
  }
12780
12512
 
12781
- export { type AIChatChoice, type AIChatRequest, type AIChatResponse, type AICompletionRequest, type AICompletionResponse, type AIConfig, type AIEmbeddingRequest, type AIEmbeddingResponse, type AIError, type AIErrorCode, AIErrorMessages, type AIFinishReason, type AIMessage, type AIModelConfig, type AIModelType, type AIProvider, type AIRole, type AIRouterConfig, type AIStreamCallback, type AIStreamChunk, type AITool, type AIToolCall, type AIUsageConfig, type AIUsageInfo, type AccountCapabilities, type AccountLink, type AccountType, type Address, type AlertType, type ApiAuthentication, type ApiChangelog, type ApiDocumentation, type ApiEndpoint, type ApiExample, type ApiKey, type ApiKeyStatus, type ApiKeyType, type ApiKeyValidationResult, type ApiParameter, type ApiResponse, type ApiSchema, type ApiSchemaProperty, type ApiUsageStats, type ApiUsageTimeSeries, type AssembledContext, type AuditActor, type AuditCategory, type AuditEvent, AuditEvents, type AuditEvidence, type AuditLogConfig, type AuditOutcome, type AuditQuery, type AuditQueryResult, type AuditRetentionPolicy, type AuditStats, type AuditTarget, type AuthConfig, type AuthError, type AuthErrorCode, AuthErrorMessages, type AuthEventType, type AuthResult, type AuthSession, type AuthStateChangeCallback, type AuthStorage, type AuthUser, type Balance, type BalanceAmount, type BankAccountDetails, type BatchNotificationOptions, type BillingConfig, type BillingDetails, type BillingPeriod, type Breadcrumb, type Budget, type BudgetStatus, type BulkIngestionResult, Bulkhead, type BulkheadOptions, BulkheadRegistry, BulkheadRejectedError, type BulkheadStats, type BullMQConfig, BullMQQueue, type BusinessProfile, type CancelationReason, type CaptureOptions, type CapturePaymentIntentOptions, type CardBrand, type CardDetails, type ChainExecutionResult, type ChunkingConfig, ChunkingPresets, type ChunkingStrategy, CircuitBreaker, type CircuitBreakerOptions, CircuitBreakerRegistry, type CircuitBreakerStats, CircuitOpenError, type CircuitState, type CommandStatus, type ComplianceConfig, type ComplianceReport, type ConfirmPaymentIntentOptions, type ConnectedAccount, type ConnectedAccountStatus, type ConsentPreferences, type ConsentPurpose, type ConsentRecord, type ConsentStatus, type ContextAssemblyConfig, type ControlFramework, type ControlStatus, type CorrelationData, type CostBreakdown, type Coupon, type CreateAccountLinkOptions, type CreateApiKeyOptions, type CreateCollectionOptions, type CreateConnectedAccountOptions, type CreateCustomerOptions, type CreateDsarOptions, type CreatePaymentIntentOptions, type CreatePayoutOptions, type CreateRefundOptions, type CreateSandboxOptions, type CreateScheduleOptions, type CreateTenantOptions, type CreateTransferOptions, type CreateWebhookOptions, type CreditBalance, type CreditTransaction, type CreditType, type CronExpression, CronPresets, type Currency, type Customer, DEFAULT_BULKHEAD_OPTIONS, DEFAULT_CIRCUIT_BREAKER_OPTIONS, DEFAULT_RETRY_OPTIONS, type DataBreachRecord, type DataCategory, type DataInventoryItem, type DataMap, type DataSensitivity, type DataSubjectRequest, type DataType, DatabaseAuditLog, type DatabaseAuditLogConfig, DatabaseErrorReporter, type DatabaseErrorReporterConfig, DefaultTimeouts, type DeleteAccountOptions, type DeleteHookContext, type DeliveryAttempt, type DeliveryQuery, type DeliveryStatus, type DetailedHealthResponse, type DevPortalConfig, type DeveloperMetrics, type Device, type DeviceAuthMethod, type DeviceCommand, type DeviceConfig, type DeviceConnectionState, type DeviceCredentials, type DeviceGroup, type DeviceGroupQuery, type DeviceLocation, type DeviceQuery, type DeviceQueryResult, type DeviceShadow, type DeviceStatus, type DirectoryAttributeMapping, type DirectoryConfig, type DocumentStatus, type DsarAttachment, type DsarNote, type DsarStatus, type DsarType, type DunningActionType, type DunningAttempt, type DunningConfig, type EmailHookContext, EmailMessage, EmailResult, type EnrollMfaOptions, type EnrollMfaResult, type ErrorContext, type ErrorHookContext, type ErrorLevel, type ErrorReport, type ErrorReporterConfig, type EvidenceType, type ExperimentMetrics, type FallbackOptions, type FallbackResult, FallbackStrategies, type FirmwareStatus, type FirmwareUpdate, type FirmwareVersion, type GeneratedSdk, GenericOIDCAuthSSO, type GenericOIDCConfig, type HealthCheckResult, type HealthEndpoints, type HealthEndpointsOptions, type HealthStatus, type HookRegistry, type HttpMethod, HttpWebhook, type HttpWebhookConfig, type IAI, type IAIUsage, type IAuditLog, type IAuth, type IAuthSSO, type IBilling, ICache, type ICompliance, IDatabase, type IDevPortal, type IDevice, IEmail, type IErrorReporter, type IHealth, type IHealthCheckable, ILogger, IMetrics, type INotification, type IPayment, IPlatform, type IPromptStore, IQueryBuilder, IQueue, type IRAG, type IScheduler, IStorage, type ITenant, type IWebhook, type InboundWebhookConfig, type InboundWebhookContext, type IngestionOptions, type IngestionResult, type InsertHookContext, type InviteMemberOptions, type Invoice, type InvoiceLineItem, type InvoiceQuery, type InvoiceStatus, Job, JobEventHandler, JobEventType, type JobHookContext, JobOptions, JobState, type ListTenantsOptions, type LivenessResponse, MemoryAI, MemoryAIUsage, MemoryAuditLog, type MemoryAuditLogConfig, MemoryAuth, MemoryAuthSSO, MemoryBilling, MemoryCompliance, MemoryDevPortal, MemoryDevice, MemoryErrorReporter, type MemoryErrorReporterConfig, MemoryNotification, type MemoryNotificationConfig, MemoryPayment, MemoryPromptStore, MemoryRAG, MemoryRateLimiterStorage, MemoryTenant, MemoryWebhook, type MemoryWebhookConfig, type Meter, type MetricsEndpoint, type MetricsEndpointOptions, MetricsSummary, type MfaChallenge, type MfaFactor, type MfaFactorType, type Middleware, type MiddlewareChain, type MiddlewareChainOptions, type MiddlewareContext, type NotificationAction, type NotificationCategory, type NotificationChannel, type NotificationConfig, type NotificationData, type NotificationPreferences, type NotificationPriority, type NotificationQuery, type NotificationResult, type NotificationStats, type NotificationStatus, type NotificationTarget, NotificationTemplates, type OAuthOptions, type OAuthProvider, type OAuthResult, type OidcAuthRequest, type OidcAuthResponse, type OidcClaimMapping, type OidcIdpConfig, type ParameterLocation, type PaymentConfig, type PaymentError, type PaymentErrorCode, PaymentErrorMessages, type PaymentEventType, type PaymentIntent, type PaymentMethod, type PaymentMethodType, type PaymentStatus, type PaymentWebhookEvent, type Payout, type PayoutStatus, type PiaMitigation, type PiaRisk, type PiaStatus, type PlatformHealthResult, PlatformHealthStatus, type PlatformHooks, type PostgresConfig, PostgresDatabase, PostgresTenant, type PostgresTenantConfig, type Price, type PricingModel, type PricingTier, type PrivacyImpactAssessment, type Product, type Prompt, type PromptChain, type PromptChainStep, type PromptExperiment, type PromptQuery, type PromptQueryResult, type PromptStatus, type PromptStoreConfig, type PromptType, type PromptUsageRecord, type PromptUsageStats, type PromptVariable, type PromptVariant, type PromptVersion, type ProvisioningConfig, type ProvisioningRequest, type ProvisioningResult, type ProvisioningStatus, type PushSubscription, type QueryHookContext, QueryResult, QueueScheduler, type QueueSchedulerConfig, type Quota, type QuotaStatus, type QuotaType, type RAGChunk, type RAGCollection, type RAGConfig, type RAGDocument, type RAGFilter, type RAGPipeline, type RAGPipelineStep, type RAGSearchQuery, type RAGSearchResponse, type RAGSearchResult, type RateLimitAlgorithm, RateLimitError, type RateLimitInfo, type RateLimitOptions, RateLimitPresets, type RateLimiterStorage, type ReadinessResponse, type RecordConsentOptions, RedisCache, type RedisConfig, type Refund, type RefundReason, type RefundStatus, type RenderOptions, type RenderedPrompt, RepeatOptions, ResendEmail, type ResetPasswordOptions, type RetentionAction, type RetentionExecution, type RetentionPolicy, RetryConfigs, type RetryOptions, RetryPredicates, type RetryResult, type RevenueMetrics, type RiskLevel, type RoutingStrategy, S3Storage, type SamlAssertion, type SamlAttributeMapping, type SamlAuthRequest, type SamlAuthResponse, type SamlIdpConfig, type SamlNameIdFormat, type SamlSpConfig, type Sandbox, type SandboxConfig, type SandboxLimits, type SandboxStatus, type SandboxUsage, type ScheduleContext, type ScheduleExecution, type ScheduleHandler, type ScheduleQuery, type ScheduleState, type ScheduleUpdateOptions, type ScheduledJob, type SchedulerConfig, type SchedulerStats, type ScimConfig, type ScimUser, type SdkConfig, type SdkFile, type SdkLanguage, type SearchMode, type SendCommandOptions, type SendNotificationOptions, type ServiceHealth, type ShadowDelta, type ShadowMetadata, type ShadowUpdate, type SignInWithEmailOptions, type SignInWithMagicLinkOptions, type SignInWithPhoneOptions, type SignUpWithEmailOptions, type SignatureAlgorithm, type SlidingWindowRateLimitOptions, type SmtpConfig, SmtpEmail, type SsoSession, type StartupResponse, StorageFile, type StoredAuditEvent, type StoredNotification, StripePayment, type StripePaymentConfig, type Subscription, type SubscriptionDiscount, type SubscriptionItem, type SubscriptionMetrics, type SubscriptionQuery, type SubscriptionStatus, SupabaseAuth, type SupabaseAuthConfig, SupabaseDatabase, SupabaseStorage, type SupabaseStorageConfig, type TaxBreakdown, type TelemetryMessage, type TelemetryQuery, type TelemetryResult, type Tenant, type TenantBranding, type TenantContext, type TenantDatabaseConfig, type TenantInvitation, type TenantIsolationModel, type TenantMember, type TenantMemberStatus, type TenantQuotas, type TenantResolutionOptions, type TenantResolutionStrategy, type TenantRole, type TenantSecuritySettings, type TenantSettings, type TenantStatus, type TenantUsage, TimeoutError, type TimeoutOptions, type TokenBucketOptions, type TosAcceptance, type Transfer, type TransferStatus, type Unsubscribe, type UpdateCustomerOptions, type UpdateHookContext, type UpdatePasswordOptions, type UpdatePaymentIntentOptions, type UpdateScheduleOptions, type UpdateStatus, type UpdateTenantOptions, type UpdateUserOptions, type UpdateWebhookOptions, type UploadHookContext, UploadOptions, UpstashCache, type UsageAlert, type UsageCategory, type UsageEvent, type UsageInterval, type UsageInvoice, type UsageInvoiceItem, type UsageQuery, type UsageQueryResult, type UsageRecord, type UsageSummary, type UsageSummaryRecord, type UsageTrend, type VerificationResult, type VerifyMfaOptions, type VerifyPhoneOtpOptions, type VerifyWebhookOptions, type WebhookConfig, type WebhookDelivery, type WebhookEndpoint, type WebhookEvent, WebhookEventTypes, type WebhookQuery, type WebhookState, type WebhookStats, type WebhookTestEndpoint, type WebhookTestEvent, calculateRetryDelay, composeHookRegistries, correlationContext, createAIError, createAuthError, createBulkhead, createCacheMiddleware, createCachedFallback, createCircuitBreaker, createDefaultPreferences, createErrorReport, createExpressHealthHandlers, createExpressMetricsHandler, createHealthEndpoints, createHealthServer, createHookRegistry, createIpKeyGenerator, createJobContext, createLoggingMiddleware, createMetricsEndpoint, createMetricsMiddleware, createMetricsServer, createMiddlewareChain, createMiddlewareContext, createObservabilityServer, createPaymentError, createRateLimitMiddleware, createRequestContext, createRequestIdMiddleware, createSlowQueryMiddleware, createTenantMiddleware, createTimeoutMiddleware, createUserKeyGenerator, describeCron, filterChannelsByPreferences, formatAmount, generateAuditId, generateChecksum, generateDeliveryId, generateErrorId, generateEventId, generateFingerprint, generateNotificationId, generatePaymentId, generateScheduleId, generateSecureToken, generateWebhookId, generateWebhookSecret, getContext, getCorrelationId, getLogMeta, getNextCronRun, getRequestId, getTenantId, getTraceId, getUserId, isAIError, isAuthError, isInContext, isInQuietHours, isPaymentError, isValidCron, matchAction, matchEventType, raceTimeout, retryable, runWithContext, runWithContextAsync, timedHealthCheck, toHealthCheckResult, withCorrelation, withCorrelationAsync, withFallback, withFallbackChain, withFallbackResult, withRetry, withRetryResult, withTimeout, withTimeoutWrapper };
12513
+ export { AIChatRequest, AIChatResponse, AICompletionRequest, AICompletionResponse, AIConfig, AIEmbeddingRequest, AIEmbeddingResponse, AIModelConfig, AIModelType, AIProvider, AIStreamCallback, AIStreamChunk, type AIUsageConfig, type AccountCapabilities, type AccountLink, type AccountType, type Address, type AlertType, AnthropicAdapter, type AnthropicAdapterConfig, type ApiAuthentication, type ApiChangelog, type ApiDocumentation, type ApiEndpoint, type ApiExample, type ApiKey, type ApiKeyStatus, type ApiKeyType, type ApiKeyValidationResult, type ApiParameter, type ApiResponse, type ApiSchema, type ApiSchemaProperty, type ApiUsageStats, type ApiUsageTimeSeries, AssembledContext, type AuditActor, type AuditCategory, type AuditEvent, AuditEvents, type AuditEvidence, type AuditLogConfig, type AuditOutcome, type AuditQuery, type AuditQueryResult, type AuditRetentionPolicy, type AuditStats, type AuditTarget, type AuthConfig, type AuthError, type AuthErrorCode, AuthErrorMessages, type AuthEventType, type AuthResult, type AuthSession, type AuthStateChangeCallback, type AuthStorage, type AuthUser, type Balance, type BalanceAmount, type BankAccountDetails, type BatchNotificationOptions, type BillingConfig, type BillingDetails, type BillingPeriod, type Breadcrumb, type Budget, type BudgetStatus, BulkIngestionResult, Bulkhead, type BulkheadOptions, BulkheadRegistry, BulkheadRejectedError, type BulkheadStats, type BullMQConfig, BullMQQueue, type BusinessProfile, type CancelationReason, type CaptureOptions, type CapturePaymentIntentOptions, type CardBrand, type CardDetails, type ChainExecutionResult, CircuitBreaker, type CircuitBreakerOptions, CircuitBreakerRegistry, type CircuitBreakerStats, CircuitOpenError, type CircuitState, type CommandStatus, type ComplianceConfig, type ComplianceReport, type ConfirmPaymentIntentOptions, type ConnectedAccount, type ConnectedAccountStatus, type ConsentPreferences, type ConsentPurpose, type ConsentRecord, type ConsentStatus, ContextAssemblyConfig, type ControlFramework, type ControlStatus, type CorrelationData, type CostBreakdown, type Coupon, type CreateAccountLinkOptions, type CreateApiKeyOptions, CreateCollectionOptions, type CreateConnectedAccountOptions, type CreateCustomerOptions, type CreateDsarOptions, type CreatePaymentIntentOptions, type CreatePayoutOptions, type CreateRefundOptions, type CreateSandboxOptions, type CreateScheduleOptions, type CreateTenantOptions, type CreateTransferOptions, type CreateWebhookOptions, type CreditBalance, type CreditTransaction, type CreditType, type CronExpression, CronPresets, type Currency, type Customer, DEFAULT_BULKHEAD_OPTIONS, DEFAULT_CIRCUIT_BREAKER_OPTIONS, DEFAULT_RETRY_OPTIONS, type DataBreachRecord, type DataCategory, type DataInventoryItem, type DataMap, type DataSensitivity, type DataSubjectRequest, type DataType, DatabaseAuditLog, type DatabaseAuditLogConfig, DatabaseErrorReporter, type DatabaseErrorReporterConfig, DatabasePromptStore, type DatabasePromptStoreConfig, DefaultTimeouts, type DeleteAccountOptions, type DeleteHookContext, type DeliveryAttempt, type DeliveryQuery, type DeliveryStatus, type DetailedHealthResponse, type DevPortalConfig, type DeveloperMetrics, type Device, type DeviceAuthMethod, type DeviceCommand, type DeviceConfig, type DeviceConnectionState, type DeviceCredentials, type DeviceGroup, type DeviceGroupQuery, type DeviceLocation, type DeviceQuery, type DeviceQueryResult, type DeviceShadow, type DeviceStatus, type DirectoryAttributeMapping, type DirectoryConfig, DocumentStatus, type DsarAttachment, type DsarNote, type DsarStatus, type DsarType, type DunningActionType, type DunningAttempt, type DunningConfig, type EmailHookContext, EmailMessage, EmailResult, type EnrollMfaOptions, type EnrollMfaResult, type ErrorContext, type ErrorHookContext, type ErrorLevel, type ErrorReport, type ErrorReporterConfig, type EvidenceType, type ExperimentMetrics, type FallbackOptions, type FallbackResult, FallbackStrategies, type FirmwareStatus, type FirmwareUpdate, type FirmwareVersion, type GeneratedSdk, GenericOIDCAuthSSO, type GenericOIDCConfig, GoogleAIAdapter, type GoogleAIAdapterConfig, type HealthCheckResult, type HealthEndpoints, type HealthEndpointsOptions, type HealthStatus, type HookRegistry, type HttpMethod, HttpWebhook, type HttpWebhookConfig, IAI, type IAIUsage, type IAuditLog, type IAuth, type IAuthSSO, type IBilling, ICache, type ICompliance, IDatabase, type IDevPortal, type IDevice, IEmail, type IErrorReporter, type IHealth, type IHealthCheckable, ILogger, IMetrics, type INotification, type IPayment, IPlatform, type IPromptStore, IQueryBuilder, IQueue, IRAG, type IScheduler, IStorage, type ITenant, type IWebhook, type InboundWebhookConfig, type InboundWebhookContext, IngestionOptions, IngestionResult, type InsertHookContext, type InviteMemberOptions, type Invoice, type InvoiceLineItem, type InvoiceQuery, type InvoiceStatus, Job, JobEventHandler, JobEventType, type JobHookContext, JobOptions, JobState, type ListTenantsOptions, type LivenessResponse, MemoryAIUsage, MemoryAuditLog, type MemoryAuditLogConfig, MemoryAuth, MemoryAuthSSO, MemoryBilling, MemoryCompliance, MemoryDevPortal, MemoryDevice, MemoryErrorReporter, type MemoryErrorReporterConfig, MemoryNotification, type MemoryNotificationConfig, MemoryPayment, MemoryPromptStore, MemoryRateLimiterStorage, MemoryScheduler, type MemorySchedulerConfig, MemoryTenant, MemoryWebhook, type MemoryWebhookConfig, type Meter, type MetricsEndpoint, type MetricsEndpointOptions, MetricsSummary, type MfaChallenge, type MfaFactor, type MfaFactorType, type Middleware, type MiddlewareChain, type MiddlewareChainOptions, type MiddlewareContext, type NotificationAction, type NotificationCategory, type NotificationChannel, type NotificationConfig, type NotificationData, type NotificationPreferences, type NotificationPriority, type NotificationQuery, type NotificationResult, type NotificationStats, type NotificationStatus, type NotificationTarget, NotificationTemplates, type OAuthOptions, type OAuthProvider, type OAuthResult, type OidcAuthRequest, type OidcAuthResponse, type OidcClaimMapping, type OidcIdpConfig, OpenAIAdapter, type OpenAIAdapterConfig, type ParameterLocation, type PaymentConfig, type PaymentError, type PaymentErrorCode, PaymentErrorMessages, type PaymentEventType, type PaymentIntent, type PaymentMethod, type PaymentMethodType, type PaymentStatus, type PaymentWebhookEvent, type Payout, type PayoutStatus, type PiaMitigation, type PiaRisk, type PiaStatus, PineconeRAG, type PineconeRAGConfig, type PlatformHealthResult, PlatformHealthStatus, type PlatformHooks, type PostgresConfig, PostgresDatabase, PostgresTenant, type PostgresTenantConfig, type Price, type PricingModel, type PricingTier, type PrivacyImpactAssessment, type Product, type Prompt, type PromptChain, type PromptChainStep, type PromptExperiment, type PromptQuery, type PromptQueryResult, type PromptStatus, type PromptStoreConfig, type PromptType, type PromptUsageRecord, type PromptUsageStats, type PromptVariable, type PromptVariant, type PromptVersion, type ProvisioningConfig, type ProvisioningRequest, type ProvisioningResult, type ProvisioningStatus, type PushSubscription, type QueryHookContext, QueryResult, QueueScheduler, type QueueSchedulerConfig, type Quota, type QuotaStatus, type QuotaType, RAGChunk, RAGCollection, RAGConfig, RAGDocument, RAGPipeline, RAGSearchQuery, RAGSearchResponse, RAGSearchResult, type RateLimitAlgorithm, RateLimitError, type RateLimitInfo, type RateLimitOptions, RateLimitPresets, type RateLimiterStorage, type ReadinessResponse, type RecordConsentOptions, RedisCache, type RedisConfig, type Refund, type RefundReason, type RefundStatus, type RenderOptions, type RenderedPrompt, RepeatOptions, ResendEmail, type ResetPasswordOptions, type RetentionAction, type RetentionExecution, type RetentionPolicy, RetryConfigs, type RetryOptions, RetryPredicates, type RetryResult, type RevenueMetrics, type RiskLevel, S3Storage, type SamlAssertion, type SamlAttributeMapping, type SamlAuthRequest, type SamlAuthResponse, type SamlIdpConfig, type SamlNameIdFormat, type SamlSpConfig, type Sandbox, type SandboxConfig, type SandboxLimits, type SandboxStatus, type SandboxUsage, type ScheduleContext, type ScheduleExecution, type ScheduleHandler, type ScheduleQuery, type ScheduleState, type ScheduleUpdateOptions, type ScheduledJob, type SchedulerConfig, type SchedulerStats, type ScimConfig, type ScimUser, type SdkConfig, type SdkFile, type SdkLanguage, type SendCommandOptions, type SendNotificationOptions, type ServiceHealth, type ShadowDelta, type ShadowMetadata, type ShadowUpdate, type SignInWithEmailOptions, type SignInWithMagicLinkOptions, type SignInWithPhoneOptions, type SignUpWithEmailOptions, type SignatureAlgorithm, type SlidingWindowRateLimitOptions, type SmtpConfig, SmtpEmail, type SsoSession, type StartupResponse, StorageFile, type StoredAuditEvent, type StoredNotification, StripePayment, type StripePaymentConfig, type Subscription, type SubscriptionDiscount, type SubscriptionItem, type SubscriptionMetrics, type SubscriptionQuery, type SubscriptionStatus, SupabaseAuth, type SupabaseAuthConfig, SupabaseDatabase, SupabaseStorage, type SupabaseStorageConfig, type TaxBreakdown, type TelemetryMessage, type TelemetryQuery, type TelemetryResult, type Tenant, type TenantBranding, type TenantContext, type TenantDatabaseConfig, type TenantInvitation, type TenantIsolationModel, type TenantMember, type TenantMemberStatus, type TenantQuotas, type TenantResolutionOptions, type TenantResolutionStrategy, type TenantRole, type TenantSecuritySettings, type TenantSettings, type TenantStatus, type TenantUsage, TimeoutError, type TimeoutOptions, type TokenBucketOptions, type TosAcceptance, type Transfer, type TransferStatus, type Unsubscribe, type UpdateCustomerOptions, type UpdateHookContext, type UpdatePasswordOptions, type UpdatePaymentIntentOptions, type UpdateScheduleOptions, type UpdateStatus, type UpdateTenantOptions, type UpdateUserOptions, type UpdateWebhookOptions, type UploadHookContext, UploadOptions, UpstashCache, type UsageAlert, type UsageCategory, type UsageEvent, type UsageInterval, type UsageInvoice, type UsageInvoiceItem, type UsageQuery, type UsageQueryResult, type UsageRecord, type UsageSummary, type UsageSummaryRecord, type UsageTrend, type VerificationResult, type VerifyMfaOptions, type VerifyPhoneOtpOptions, type VerifyWebhookOptions, WeaviateRAG, type WeaviateRAGConfig, type WebhookConfig, type WebhookDelivery, type WebhookEndpoint, type WebhookEvent, WebhookEventTypes, type WebhookQuery, type WebhookState, type WebhookStats, type WebhookTestEndpoint, type WebhookTestEvent, calculateRetryDelay, composeHookRegistries, correlationContext, createAnthropicAdapter, createAuthError, createBulkhead, createCacheMiddleware, createCachedFallback, createCircuitBreaker, createDefaultPreferences, createErrorReport, createExpressHealthHandlers, createExpressMetricsHandler, createGoogleAIAdapter, createHealthEndpoints, createHealthServer, createHookRegistry, createIpKeyGenerator, createJobContext, createLoggingMiddleware, createMetricsEndpoint, createMetricsMiddleware, createMetricsServer, createMiddlewareChain, createMiddlewareContext, createObservabilityServer, createOpenAIAdapter, createPaymentError, createPineconeRAG, createRateLimitMiddleware, createRequestContext, createRequestIdMiddleware, createSlowQueryMiddleware, createTenantMiddleware, createTimeoutMiddleware, createUserKeyGenerator, createWeaviateRAG, describeCron, filterChannelsByPreferences, formatAmount, generateAuditId, generateChecksum, generateDeliveryId, generateErrorId, generateEventId, generateFingerprint, generateNotificationId, generatePaymentId, generateScheduleId, generateSecureToken, generateWebhookId, generateWebhookSecret, getContext, getCorrelationId, getLogMeta, getNextCronRun, getRequestId, getTenantId, getTraceId, getUserId, isAuthError, isInContext, isInQuietHours, isPaymentError, isValidCron, matchAction, matchEventType, raceTimeout, retryable, runWithContext, runWithContextAsync, timedHealthCheck, toHealthCheckResult, withCorrelation, withCorrelationAsync, withFallback, withFallbackChain, withFallbackResult, withRetry, withRetryResult, withTimeout, withTimeoutWrapper };