@retrivora-ai/rag-engine 2.3.5 → 2.3.7

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 (41) hide show
  1. package/dist/{BatchProcessor-tVzb9CdE.d.mts → BatchProcessor-BhLczWj5.d.mts} +179 -3
  2. package/dist/{BatchProcessor-CQDtlggz.d.ts → BatchProcessor-C42_RVWO.d.ts} +179 -3
  3. package/dist/{ILLMProvider-CcJ5N6XD.d.mts → ILLMProvider-B8TAVx3j.d.mts} +63 -1
  4. package/dist/{ILLMProvider-CcJ5N6XD.d.ts → ILLMProvider-B8TAVx3j.d.ts} +63 -1
  5. package/dist/handlers/index.d.mts +2 -2
  6. package/dist/handlers/index.d.ts +2 -2
  7. package/dist/handlers/index.js +493 -217
  8. package/dist/handlers/index.mjs +493 -217
  9. package/dist/{index-BwmyPJHp.d.ts → index-ejOWsaqb.d.ts} +1 -1
  10. package/dist/{index-CL-zF6bD.d.mts → index-xxQOFx-u.d.mts} +1 -1
  11. package/dist/index.css +9 -0
  12. package/dist/index.d.mts +19 -5
  13. package/dist/index.d.ts +19 -5
  14. package/dist/index.js +643 -207
  15. package/dist/index.mjs +683 -252
  16. package/dist/server.d.mts +253 -7
  17. package/dist/server.d.ts +253 -7
  18. package/dist/server.js +1145 -230
  19. package/dist/server.mjs +1131 -230
  20. package/package.json +1 -1
  21. package/src/LicensedRetrivora.ts +273 -0
  22. package/src/components/ChatWidget.tsx +44 -19
  23. package/src/components/ChatWindow.tsx +30 -14
  24. package/src/components/ConfigProvider.tsx +86 -6
  25. package/src/components/DocumentUpload.tsx +8 -2
  26. package/src/config/LicenseConfigResolver.ts +296 -0
  27. package/src/config/RagConfig.ts +4 -0
  28. package/src/config/serverConfig.ts +74 -14
  29. package/src/core/ConfigFetcher.ts +10 -1
  30. package/src/core/ConfigResolver.ts +1 -0
  31. package/src/core/LicenseValidator.ts +21 -12
  32. package/src/core/LicenseVerifier.ts +7 -11
  33. package/src/core/ProjectSettings.ts +247 -0
  34. package/src/handlers/index.ts +65 -5
  35. package/src/hooks/useProjectSettings.ts +105 -0
  36. package/src/index.css +9 -0
  37. package/src/index.ts +37 -0
  38. package/src/llm/providers/UniversalLLMAdapter.ts +67 -12
  39. package/src/server.ts +46 -2
  40. package/src/telemetry/TelemetryService.ts +330 -0
  41. package/src/types/props.ts +14 -2
@@ -1,5 +1,5 @@
1
1
  import { CSSProperties, MouseEvent, ReactNode, ElementType } from 'react';
2
- import { z as Product, m as UIConfig, j as RagMessage, q as VectorMatch, u as UITransformationResponse, i as RagConfig, I as ILLMProvider, f as IngestDocument, C as ChatMessage, c as ChatResponse, A as RetrievalResult, n as UniversalRagConfig } from './ILLMProvider-CcJ5N6XD.mjs';
2
+ import { W as WidgetPosition, Z as Product, s as UIConfig, P as ProjectChatSettings, o as RagMessage, w as VectorMatch, L as LLMConfig, d as EmbeddingConfig, V as VectorDBConfig, J as UITransformationResponse, n as RagConfig, I as ILLMProvider, f as IngestDocument, C as ChatMessage, c as ChatResponse, _ as RetrievalResult, t as UniversalRagConfig } from './ILLMProvider-B8TAVx3j.mjs';
3
3
 
4
4
  interface ArchitectureCardProps {
5
5
  icon: ReactNode;
@@ -64,7 +64,7 @@ interface ChatWindowProps {
64
64
  }
65
65
  interface ChatWidgetProps {
66
66
  /** Position of the floating button. Defaults to bottom-right. */
67
- position?: 'bottom-right' | 'bottom-left';
67
+ position?: WidgetPosition;
68
68
  /** Called when the user clicks 'Add to Cart' on a product */
69
69
  onAddToCart?: (product: Product) => void;
70
70
  /** Optional custom API URL to send chat messages to */
@@ -123,6 +123,12 @@ interface ClientConfig {
123
123
  model?: string;
124
124
  dimensions?: number;
125
125
  };
126
+ licenseKey?: string;
127
+ headers?: Record<string, string>;
128
+ retrivoraApiBase?: string;
129
+ projectSettings?: ProjectChatSettings;
130
+ autoLoadProjectSettings?: boolean;
131
+ isProjectSettingsLoading?: boolean;
126
132
  }
127
133
  interface ConfigProviderProps {
128
134
  config?: {
@@ -132,6 +138,11 @@ interface ConfigProviderProps {
132
138
  model?: string;
133
139
  dimensions?: number;
134
140
  };
141
+ licenseKey?: string;
142
+ headers?: Record<string, string>;
143
+ retrivoraApiBase?: string;
144
+ projectSettings?: Partial<ProjectChatSettings>;
145
+ autoLoadProjectSettings?: boolean;
135
146
  };
136
147
  children: ReactNode;
137
148
  }
@@ -141,6 +152,171 @@ interface ConfigProviderProps {
141
152
  */
142
153
  declare const SDK_VERSION: string;
143
154
 
155
+ /**
156
+ * ConfigFetcher.ts — Dynamically fetches project credentials from Retrivora Control Plane
157
+ * without hardcoding plain-text master keys in NPM package binaries.
158
+ *
159
+ * SECURITY: The SDK must ONLY call the Retrivora Control Plane at https://www.retrivora.com.
160
+ * It must never call the end user's own localhost or any other endpoint.
161
+ * LLM and embedding calls are proxied through https://www.retrivora.com/api/v1 which
162
+ * forwards to https://llm.retrivora.com with the server-side LITELLM_MASTER_KEY.
163
+ */
164
+
165
+ interface RemoteVectorConfig {
166
+ apiKey: string;
167
+ indexName: string;
168
+ provider: string;
169
+ projectId?: string;
170
+ namespace?: string;
171
+ }
172
+ interface RemoteEmbeddingConfig {
173
+ provider: string;
174
+ model: string;
175
+ baseUrl: string;
176
+ apiKey: string;
177
+ profile?: string;
178
+ }
179
+ interface RemoteLLMConfig {
180
+ provider: string;
181
+ model: string;
182
+ baseUrl: string;
183
+ apiKey: string;
184
+ profile?: string;
185
+ }
186
+ interface RemoteConfig {
187
+ projectId?: string;
188
+ tier?: string;
189
+ isActive?: boolean;
190
+ expiresAt?: string;
191
+ vectorDb: RemoteVectorConfig;
192
+ embedding: RemoteEmbeddingConfig;
193
+ llm: RemoteLLMConfig;
194
+ workspace?: {
195
+ namespace: string;
196
+ indexName: string;
197
+ };
198
+ projectSettings?: ProjectChatSettings;
199
+ }
200
+
201
+ declare class ConfigFetcher {
202
+ private static cache;
203
+ private static readonly TTL_MS;
204
+ /**
205
+ * Fetch full project configuration (vectorDb + embedding + llm + workspace) from Retrivora Control Plane.
206
+ *
207
+ * The SDK calls https://www.retrivora.com/api/v1/config with the project ID and license key.
208
+ * The server validates the license against the database and returns:
209
+ * - validity (tier, isActive, expiresAt)
210
+ * - LLM model info
211
+ * - embedding model info
212
+ * - Pinecone index name and workspace/namespace
213
+ *
214
+ * The Pinecone API key is NOT returned (server-only). The SDK uses local
215
+ * PINECONE_API_KEY if available, or vector operations are handled server-side.
216
+ */
217
+ static fetchRemoteConfig(projectId: string, licenseKey?: string): Promise<RemoteConfig | null>;
218
+ /** Convenience: fetch only vector DB config (backwards compat). */
219
+ static fetchRemoteVectorConfig(projectId: string, licenseKey?: string): Promise<RemoteVectorConfig | null>;
220
+ }
221
+
222
+ /**
223
+ * LicenseConfigResolver — Resolves LLM and embedding configuration
224
+ * based on the user's license tier from Retrivora admin dashboard.
225
+ *
226
+ * The end-user SDK only needs:
227
+ * - licenseKey (JWT token from Retrivora)
228
+ * - projectId (workspace identifier)
229
+ *
230
+ * Configuration includes:
231
+ * 1. Tier-based model selection (/api/v1/config)
232
+ * 2. Provider API credentials (/api/v1/credentials)
233
+ * 3. Vector DB and rate limit settings
234
+ *
235
+ * All provider API keys (Gemini, Groq, Pinecone) are stored on Retrivora backend
236
+ * and never exposed to end-users directly.
237
+ */
238
+
239
+ interface LicenseTierConfig {
240
+ tier: 'free_trial' | 'free' | 'hobby' | 'pro' | 'enterprise';
241
+ llmModel: string;
242
+ embeddingModel: string;
243
+ embeddingDimensions: number;
244
+ maxTokens: number;
245
+ chunkSize: number;
246
+ chunkOverlap: number;
247
+ topK: number;
248
+ vectorDb: {
249
+ provider: string;
250
+ indexName: string;
251
+ };
252
+ rateLimit?: {
253
+ requestsPerMinute: number;
254
+ tokensPerDay: number;
255
+ };
256
+ }
257
+ interface ProviderCredentials {
258
+ geminiApiKey?: string;
259
+ groqApiKey?: string;
260
+ pineconeApiKey?: string;
261
+ textEmbeddingProvider?: string;
262
+ }
263
+ interface ProviderCredentials {
264
+ geminiApiKey?: string;
265
+ groqApiKey?: string;
266
+ pineconeApiKey?: string;
267
+ textEmbeddingProvider?: string;
268
+ }
269
+ /**
270
+ * Resolver for license-based configuration.
271
+ * This is called by the end-user SDK after they instantiate with licenseKey + projectId.
272
+ */
273
+ declare class LicenseConfigResolver {
274
+ private static readonly RETRIVORA_CONFIG_URL;
275
+ private static readonly RETRIVORA_CREDENTIALS_URL;
276
+ private static readonly CACHE_TTL_MS;
277
+ private static configCache;
278
+ /**
279
+ * Validate and resolve configuration from license key
280
+ * @param licenseKey JWT token from Retrivora (format: rtv_eyJ...)
281
+ * @param projectId Workspace identifier
282
+ * @returns Resolved LLM and embedding configs with provider credentials
283
+ */
284
+ static resolveFromLicense(licenseKey: string, projectId: string): Promise<{
285
+ llmConfig: LLMConfig;
286
+ embeddingConfig: EmbeddingConfig;
287
+ vectorDbConfig: VectorDBConfig;
288
+ tierConfig: LicenseTierConfig;
289
+ credentials: ProviderCredentials;
290
+ }>;
291
+ /**
292
+ * Fetch tier configuration from Retrivora config API
293
+ */
294
+ private static fetchTierConfig;
295
+ /**
296
+ * Fetch provider credentials from Retrivora credentials API
297
+ */
298
+ private static fetchProviderCredentials;
299
+ /**
300
+ * Build LLM, embedding, and vector DB configs from tier and credentials
301
+ */
302
+ private static buildConfigs;
303
+ /**
304
+ * Get provider-specific vector DB options
305
+ */
306
+ private static getVectorDbOptions;
307
+ /**
308
+ * Clear configuration cache (useful for testing or manual refresh)
309
+ */
310
+ static clearCache(): void;
311
+ /**
312
+ * Get cache stats for debugging
313
+ */
314
+ static getCacheStats(): {
315
+ size: number;
316
+ entries: string[];
317
+ };
318
+ }
319
+
144
320
  /**
145
321
  * Primary rendering outcome types supported by the decision engine.
146
322
  */
@@ -583,4 +759,4 @@ declare class BatchProcessor {
583
759
  static processConcurrent<T, R>(items: T[], processor: (item: T) => Promise<R>, concurrency?: number, options?: BatchOptions): Promise<BatchResult<R>>;
584
760
  }
585
761
 
586
- export { AuthenticationException as A, type BatchOptions as B, type ChatWidgetProps as C, type DocumentUploadProps as D, EmbeddingFailedException as E, type ArchitectureCardProps as F, type ChatViewportSize as G, DocumentChunker as H, type IRenderRule as I, Pipeline as J, type PipelineStep as K, LicenseValidationError as L, type MessageBubbleProps as M, type ProviderPill as N, type RenderSectionDecision as O, type ProductCardProps as P, type Snippet as Q, RateLimitException as R, type SourceCardProps as S, wrapError as T, type ChatWindowProps as a, type ConfigProviderProps as b, type ClientConfig as c, type ProductCarouselProps as d, BatchProcessor as e, type BatchResult as f, type ChartType as g, type Chunk as h, type ChunkOptions as i, ConfigurationException as j, type DecisionContext as k, type IRendererStrategy as l, type IntentCategory as m, type LicenseValidationRequest as n, type LicenseValidationResponse as o, LicenseValidator as p, ProviderNotFoundException as q, type RenderDecision as r, type RenderType as s, RetrievalException as t, Retrivora as u, RetrivoraError as v, type RetrivoraErrorCode as w, SDKVersionUnsupportedError as x, SDK_VERSION as y, isTransientError as z };
762
+ export { wrapError as $, AuthenticationException as A, type BatchOptions as B, type ChatWidgetProps as C, type DocumentUploadProps as D, EmbeddingFailedException as E, RetrievalException as F, Retrivora as G, RetrivoraError as H, type IRenderRule as I, type RetrivoraErrorCode as J, SDKVersionUnsupportedError as K, type LicenseTierConfig as L, type MessageBubbleProps as M, SDK_VERSION as N, isTransientError as O, type ProductCardProps as P, type ArchitectureCardProps as Q, type RemoteConfig as R, type SourceCardProps as S, type ChatViewportSize as T, DocumentChunker as U, LicenseConfigResolver as V, Pipeline as W, type PipelineStep as X, type ProviderPill as Y, type RenderSectionDecision as Z, type Snippet as _, type ChatWindowProps as a, type ConfigProviderProps as b, type ClientConfig as c, type ProductCarouselProps as d, BatchProcessor as e, type BatchResult as f, type ChartType as g, type Chunk as h, type ChunkOptions as i, ConfigFetcher as j, ConfigurationException as k, type DecisionContext as l, type IRendererStrategy as m, type IntentCategory as n, LicenseValidationError as o, type LicenseValidationRequest as p, type LicenseValidationResponse as q, LicenseValidator as r, type ProviderCredentials as s, ProviderNotFoundException as t, RateLimitException as u, type RemoteEmbeddingConfig as v, type RemoteLLMConfig as w, type RemoteVectorConfig as x, type RenderDecision as y, type RenderType as z };
@@ -1,5 +1,5 @@
1
1
  import { CSSProperties, MouseEvent, ReactNode, ElementType } from 'react';
2
- import { z as Product, m as UIConfig, j as RagMessage, q as VectorMatch, u as UITransformationResponse, i as RagConfig, I as ILLMProvider, f as IngestDocument, C as ChatMessage, c as ChatResponse, A as RetrievalResult, n as UniversalRagConfig } from './ILLMProvider-CcJ5N6XD.js';
2
+ import { W as WidgetPosition, Z as Product, s as UIConfig, P as ProjectChatSettings, o as RagMessage, w as VectorMatch, L as LLMConfig, d as EmbeddingConfig, V as VectorDBConfig, J as UITransformationResponse, n as RagConfig, I as ILLMProvider, f as IngestDocument, C as ChatMessage, c as ChatResponse, _ as RetrievalResult, t as UniversalRagConfig } from './ILLMProvider-B8TAVx3j.js';
3
3
 
4
4
  interface ArchitectureCardProps {
5
5
  icon: ReactNode;
@@ -64,7 +64,7 @@ interface ChatWindowProps {
64
64
  }
65
65
  interface ChatWidgetProps {
66
66
  /** Position of the floating button. Defaults to bottom-right. */
67
- position?: 'bottom-right' | 'bottom-left';
67
+ position?: WidgetPosition;
68
68
  /** Called when the user clicks 'Add to Cart' on a product */
69
69
  onAddToCart?: (product: Product) => void;
70
70
  /** Optional custom API URL to send chat messages to */
@@ -123,6 +123,12 @@ interface ClientConfig {
123
123
  model?: string;
124
124
  dimensions?: number;
125
125
  };
126
+ licenseKey?: string;
127
+ headers?: Record<string, string>;
128
+ retrivoraApiBase?: string;
129
+ projectSettings?: ProjectChatSettings;
130
+ autoLoadProjectSettings?: boolean;
131
+ isProjectSettingsLoading?: boolean;
126
132
  }
127
133
  interface ConfigProviderProps {
128
134
  config?: {
@@ -132,6 +138,11 @@ interface ConfigProviderProps {
132
138
  model?: string;
133
139
  dimensions?: number;
134
140
  };
141
+ licenseKey?: string;
142
+ headers?: Record<string, string>;
143
+ retrivoraApiBase?: string;
144
+ projectSettings?: Partial<ProjectChatSettings>;
145
+ autoLoadProjectSettings?: boolean;
135
146
  };
136
147
  children: ReactNode;
137
148
  }
@@ -141,6 +152,171 @@ interface ConfigProviderProps {
141
152
  */
142
153
  declare const SDK_VERSION: string;
143
154
 
155
+ /**
156
+ * ConfigFetcher.ts — Dynamically fetches project credentials from Retrivora Control Plane
157
+ * without hardcoding plain-text master keys in NPM package binaries.
158
+ *
159
+ * SECURITY: The SDK must ONLY call the Retrivora Control Plane at https://www.retrivora.com.
160
+ * It must never call the end user's own localhost or any other endpoint.
161
+ * LLM and embedding calls are proxied through https://www.retrivora.com/api/v1 which
162
+ * forwards to https://llm.retrivora.com with the server-side LITELLM_MASTER_KEY.
163
+ */
164
+
165
+ interface RemoteVectorConfig {
166
+ apiKey: string;
167
+ indexName: string;
168
+ provider: string;
169
+ projectId?: string;
170
+ namespace?: string;
171
+ }
172
+ interface RemoteEmbeddingConfig {
173
+ provider: string;
174
+ model: string;
175
+ baseUrl: string;
176
+ apiKey: string;
177
+ profile?: string;
178
+ }
179
+ interface RemoteLLMConfig {
180
+ provider: string;
181
+ model: string;
182
+ baseUrl: string;
183
+ apiKey: string;
184
+ profile?: string;
185
+ }
186
+ interface RemoteConfig {
187
+ projectId?: string;
188
+ tier?: string;
189
+ isActive?: boolean;
190
+ expiresAt?: string;
191
+ vectorDb: RemoteVectorConfig;
192
+ embedding: RemoteEmbeddingConfig;
193
+ llm: RemoteLLMConfig;
194
+ workspace?: {
195
+ namespace: string;
196
+ indexName: string;
197
+ };
198
+ projectSettings?: ProjectChatSettings;
199
+ }
200
+
201
+ declare class ConfigFetcher {
202
+ private static cache;
203
+ private static readonly TTL_MS;
204
+ /**
205
+ * Fetch full project configuration (vectorDb + embedding + llm + workspace) from Retrivora Control Plane.
206
+ *
207
+ * The SDK calls https://www.retrivora.com/api/v1/config with the project ID and license key.
208
+ * The server validates the license against the database and returns:
209
+ * - validity (tier, isActive, expiresAt)
210
+ * - LLM model info
211
+ * - embedding model info
212
+ * - Pinecone index name and workspace/namespace
213
+ *
214
+ * The Pinecone API key is NOT returned (server-only). The SDK uses local
215
+ * PINECONE_API_KEY if available, or vector operations are handled server-side.
216
+ */
217
+ static fetchRemoteConfig(projectId: string, licenseKey?: string): Promise<RemoteConfig | null>;
218
+ /** Convenience: fetch only vector DB config (backwards compat). */
219
+ static fetchRemoteVectorConfig(projectId: string, licenseKey?: string): Promise<RemoteVectorConfig | null>;
220
+ }
221
+
222
+ /**
223
+ * LicenseConfigResolver — Resolves LLM and embedding configuration
224
+ * based on the user's license tier from Retrivora admin dashboard.
225
+ *
226
+ * The end-user SDK only needs:
227
+ * - licenseKey (JWT token from Retrivora)
228
+ * - projectId (workspace identifier)
229
+ *
230
+ * Configuration includes:
231
+ * 1. Tier-based model selection (/api/v1/config)
232
+ * 2. Provider API credentials (/api/v1/credentials)
233
+ * 3. Vector DB and rate limit settings
234
+ *
235
+ * All provider API keys (Gemini, Groq, Pinecone) are stored on Retrivora backend
236
+ * and never exposed to end-users directly.
237
+ */
238
+
239
+ interface LicenseTierConfig {
240
+ tier: 'free_trial' | 'free' | 'hobby' | 'pro' | 'enterprise';
241
+ llmModel: string;
242
+ embeddingModel: string;
243
+ embeddingDimensions: number;
244
+ maxTokens: number;
245
+ chunkSize: number;
246
+ chunkOverlap: number;
247
+ topK: number;
248
+ vectorDb: {
249
+ provider: string;
250
+ indexName: string;
251
+ };
252
+ rateLimit?: {
253
+ requestsPerMinute: number;
254
+ tokensPerDay: number;
255
+ };
256
+ }
257
+ interface ProviderCredentials {
258
+ geminiApiKey?: string;
259
+ groqApiKey?: string;
260
+ pineconeApiKey?: string;
261
+ textEmbeddingProvider?: string;
262
+ }
263
+ interface ProviderCredentials {
264
+ geminiApiKey?: string;
265
+ groqApiKey?: string;
266
+ pineconeApiKey?: string;
267
+ textEmbeddingProvider?: string;
268
+ }
269
+ /**
270
+ * Resolver for license-based configuration.
271
+ * This is called by the end-user SDK after they instantiate with licenseKey + projectId.
272
+ */
273
+ declare class LicenseConfigResolver {
274
+ private static readonly RETRIVORA_CONFIG_URL;
275
+ private static readonly RETRIVORA_CREDENTIALS_URL;
276
+ private static readonly CACHE_TTL_MS;
277
+ private static configCache;
278
+ /**
279
+ * Validate and resolve configuration from license key
280
+ * @param licenseKey JWT token from Retrivora (format: rtv_eyJ...)
281
+ * @param projectId Workspace identifier
282
+ * @returns Resolved LLM and embedding configs with provider credentials
283
+ */
284
+ static resolveFromLicense(licenseKey: string, projectId: string): Promise<{
285
+ llmConfig: LLMConfig;
286
+ embeddingConfig: EmbeddingConfig;
287
+ vectorDbConfig: VectorDBConfig;
288
+ tierConfig: LicenseTierConfig;
289
+ credentials: ProviderCredentials;
290
+ }>;
291
+ /**
292
+ * Fetch tier configuration from Retrivora config API
293
+ */
294
+ private static fetchTierConfig;
295
+ /**
296
+ * Fetch provider credentials from Retrivora credentials API
297
+ */
298
+ private static fetchProviderCredentials;
299
+ /**
300
+ * Build LLM, embedding, and vector DB configs from tier and credentials
301
+ */
302
+ private static buildConfigs;
303
+ /**
304
+ * Get provider-specific vector DB options
305
+ */
306
+ private static getVectorDbOptions;
307
+ /**
308
+ * Clear configuration cache (useful for testing or manual refresh)
309
+ */
310
+ static clearCache(): void;
311
+ /**
312
+ * Get cache stats for debugging
313
+ */
314
+ static getCacheStats(): {
315
+ size: number;
316
+ entries: string[];
317
+ };
318
+ }
319
+
144
320
  /**
145
321
  * Primary rendering outcome types supported by the decision engine.
146
322
  */
@@ -583,4 +759,4 @@ declare class BatchProcessor {
583
759
  static processConcurrent<T, R>(items: T[], processor: (item: T) => Promise<R>, concurrency?: number, options?: BatchOptions): Promise<BatchResult<R>>;
584
760
  }
585
761
 
586
- export { AuthenticationException as A, type BatchOptions as B, type ChatWidgetProps as C, type DocumentUploadProps as D, EmbeddingFailedException as E, type ArchitectureCardProps as F, type ChatViewportSize as G, DocumentChunker as H, type IRenderRule as I, Pipeline as J, type PipelineStep as K, LicenseValidationError as L, type MessageBubbleProps as M, type ProviderPill as N, type RenderSectionDecision as O, type ProductCardProps as P, type Snippet as Q, RateLimitException as R, type SourceCardProps as S, wrapError as T, type ChatWindowProps as a, type ConfigProviderProps as b, type ClientConfig as c, type ProductCarouselProps as d, BatchProcessor as e, type BatchResult as f, type ChartType as g, type Chunk as h, type ChunkOptions as i, ConfigurationException as j, type DecisionContext as k, type IRendererStrategy as l, type IntentCategory as m, type LicenseValidationRequest as n, type LicenseValidationResponse as o, LicenseValidator as p, ProviderNotFoundException as q, type RenderDecision as r, type RenderType as s, RetrievalException as t, Retrivora as u, RetrivoraError as v, type RetrivoraErrorCode as w, SDKVersionUnsupportedError as x, SDK_VERSION as y, isTransientError as z };
762
+ export { wrapError as $, AuthenticationException as A, type BatchOptions as B, type ChatWidgetProps as C, type DocumentUploadProps as D, EmbeddingFailedException as E, RetrievalException as F, Retrivora as G, RetrivoraError as H, type IRenderRule as I, type RetrivoraErrorCode as J, SDKVersionUnsupportedError as K, type LicenseTierConfig as L, type MessageBubbleProps as M, SDK_VERSION as N, isTransientError as O, type ProductCardProps as P, type ArchitectureCardProps as Q, type RemoteConfig as R, type SourceCardProps as S, type ChatViewportSize as T, DocumentChunker as U, LicenseConfigResolver as V, Pipeline as W, type PipelineStep as X, type ProviderPill as Y, type RenderSectionDecision as Z, type Snippet as _, type ChatWindowProps as a, type ConfigProviderProps as b, type ClientConfig as c, type ProductCarouselProps as d, BatchProcessor as e, type BatchResult as f, type ChartType as g, type Chunk as h, type ChunkOptions as i, ConfigFetcher as j, ConfigurationException as k, type DecisionContext as l, type IRendererStrategy as m, type IntentCategory as n, LicenseValidationError as o, type LicenseValidationRequest as p, type LicenseValidationResponse as q, LicenseValidator as r, type ProviderCredentials as s, ProviderNotFoundException as t, RateLimitException as u, type RemoteEmbeddingConfig as v, type RemoteLLMConfig as w, type RemoteVectorConfig as x, type RenderDecision as y, type RenderType as z };
@@ -86,6 +86,66 @@ declare const LLM_PROVIDERS: readonly ["openai", "anthropic", "ollama", "gemini"
86
86
  declare const EMBEDDING_PROVIDERS: readonly ["openai", "ollama", "gemini", "qwen", "rest", "universal_rest", "custom"];
87
87
  declare const GRAPH_DB_PROVIDERS: readonly ["neo4j", "memgraph", "simple", "custom"];
88
88
 
89
+ type WidgetPosition = 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
90
+ type ThemeMode = 'light' | 'dark' | 'system';
91
+ type AuthMode = 'public' | 'anonymous' | 'jwt' | 'oauth' | 'okta' | 'auth0' | 'supabase' | 'firebase' | 'sso' | 'custom_token';
92
+ interface ProjectBrandingSettings {
93
+ companyName: string;
94
+ botName: string;
95
+ welcomeMessage: string;
96
+ primaryColor: string;
97
+ secondaryColor: string;
98
+ fontFamily: string;
99
+ borderRadius: number;
100
+ logoUrl: string;
101
+ avatarUrl: string;
102
+ customCss: string;
103
+ }
104
+ interface ProjectAiSettings {
105
+ defaultModel: string;
106
+ embeddingModel: string;
107
+ systemPrompt: string;
108
+ memoryEnabled: boolean;
109
+ multiModelEnabled: boolean;
110
+ citationsEnabled: boolean;
111
+ fileUploadEnabled: boolean;
112
+ }
113
+ interface ProjectAuthSettings {
114
+ mode: AuthMode;
115
+ allowedOrigins: string[];
116
+ requireVerifiedEmail: boolean;
117
+ sessionTtlMinutes: number;
118
+ }
119
+ interface ProjectWidgetSettings {
120
+ position: WidgetPosition;
121
+ theme: ThemeMode;
122
+ lazyLoad: boolean;
123
+ autoReconnect: boolean;
124
+ persistConversations: boolean;
125
+ showRetrivoraBranding: boolean;
126
+ }
127
+ interface ProjectTelemetrySettings {
128
+ enabled: boolean;
129
+ collectBrowser: boolean;
130
+ collectCountry: boolean;
131
+ redactPii: boolean;
132
+ retentionDays: number;
133
+ }
134
+ interface ProjectChatSettings {
135
+ projectId: string;
136
+ branding: ProjectBrandingSettings;
137
+ ai: ProjectAiSettings;
138
+ auth: ProjectAuthSettings;
139
+ widget: ProjectWidgetSettings;
140
+ telemetry: ProjectTelemetrySettings;
141
+ lifecycleHooks: string[];
142
+ conversationFeatures: string[];
143
+ updatedAt?: string;
144
+ }
145
+ declare function createDefaultProjectSettings(projectId: string): ProjectChatSettings;
146
+ declare function normalizeProjectSettings(projectId: string, input: Partial<ProjectChatSettings> | null | undefined): ProjectChatSettings;
147
+ declare function projectSettingsToUiConfig(settings: ProjectChatSettings): Partial<UIConfig>;
148
+
89
149
  /**
90
150
  * Master configuration interface for Retrivora AI.
91
151
  * Each consuming project provides one RagConfig object to drive
@@ -312,6 +372,8 @@ interface RagConfig {
312
372
  embedding: EmbeddingConfig;
313
373
  /** Optional UI branding overrides */
314
374
  ui?: UIConfig;
375
+ /** Optional dashboard-managed project chat settings */
376
+ projectSettings?: ProjectChatSettings;
315
377
  /** Optional RAG pipeline tuning knobs */
316
378
  rag?: RAGConfig;
317
379
  /** Optional Graph database configuration */
@@ -616,4 +678,4 @@ interface ILLMProvider {
616
678
  ping(): Promise<boolean>;
617
679
  }
618
680
 
619
- export type { RetrievalResult as A, BarChartData as B, ChatMessage as C, RetrivoraChunkMetadata as D, EmbedOptions as E, RetrivoraIngestedDocument as F, GraphDBConfig as G, SuggestionsResponse as H, ILLMProvider as I, TableData as J, VisualizationType as K, LLMConfig as L, MessageRole as M, ObservabilityTrace as O, PieChartData as P, RAGConfig as R, ScatterPlotDataPoint as S, TokenUsage as T, UseRagChatOptions as U, VectorDBConfig as V, WorkflowConfig as W, UseRagChatReturn as a, ChatOptions as b, ChatResponse as c, EmbeddingConfig as d, EmbeddingProvider as e, IngestDocument as f, LLMProvider as g, LatencyBreakdown as h, RagConfig as i, RagMessage as j, RetrievalConfig as k, RetrievedChunk as l, UIConfig as m, UniversalRagConfig as n, UpsertDocument as o, VectorDBProvider as p, VectorMatch as q, GraphNode as r, Edge as s, GraphSearchResult as t, UITransformationResponse as u, CarouselProduct as v, IRetriever as w, LineChartDataPoint as x, MetricCardData as y, Product as z };
681
+ export { type RetrivoraChunkMetadata as $, type AuthMode as A, projectSettingsToUiConfig as B, type ChatMessage as C, type GraphNode as D, type EmbedOptions as E, type Edge as F, type GraphDBConfig as G, type GraphSearchResult as H, type ILLMProvider as I, type UITransformationResponse as J, type BarChartData as K, type LLMConfig as L, type CarouselProduct as M, type IRetriever as N, type ObservabilityTrace as O, type ProjectChatSettings as P, type LineChartDataPoint as Q, type RAGConfig as R, type MessageRole as S, type ThemeMode as T, type UseRagChatOptions as U, type VectorDBConfig as V, type WidgetPosition as W, type MetricCardData as X, type PieChartData as Y, type Product as Z, type RetrievalResult as _, type UseRagChatReturn as a, type RetrivoraIngestedDocument as a0, type ScatterPlotDataPoint as a1, type SuggestionsResponse as a2, type TableData as a3, type VisualizationType as a4, type ChatOptions as b, type ChatResponse as c, type EmbeddingConfig as d, type EmbeddingProvider as e, type IngestDocument as f, type LLMProvider as g, type LatencyBreakdown as h, type ProjectAiSettings as i, type ProjectAuthSettings as j, type ProjectBrandingSettings as k, type ProjectTelemetrySettings as l, type ProjectWidgetSettings as m, type RagConfig as n, type RagMessage as o, type RetrievalConfig as p, type RetrievedChunk as q, type TokenUsage as r, type UIConfig as s, type UniversalRagConfig as t, type UpsertDocument as u, type VectorDBProvider as v, type VectorMatch as w, type WorkflowConfig as x, createDefaultProjectSettings as y, normalizeProjectSettings as z };
@@ -86,6 +86,66 @@ declare const LLM_PROVIDERS: readonly ["openai", "anthropic", "ollama", "gemini"
86
86
  declare const EMBEDDING_PROVIDERS: readonly ["openai", "ollama", "gemini", "qwen", "rest", "universal_rest", "custom"];
87
87
  declare const GRAPH_DB_PROVIDERS: readonly ["neo4j", "memgraph", "simple", "custom"];
88
88
 
89
+ type WidgetPosition = 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
90
+ type ThemeMode = 'light' | 'dark' | 'system';
91
+ type AuthMode = 'public' | 'anonymous' | 'jwt' | 'oauth' | 'okta' | 'auth0' | 'supabase' | 'firebase' | 'sso' | 'custom_token';
92
+ interface ProjectBrandingSettings {
93
+ companyName: string;
94
+ botName: string;
95
+ welcomeMessage: string;
96
+ primaryColor: string;
97
+ secondaryColor: string;
98
+ fontFamily: string;
99
+ borderRadius: number;
100
+ logoUrl: string;
101
+ avatarUrl: string;
102
+ customCss: string;
103
+ }
104
+ interface ProjectAiSettings {
105
+ defaultModel: string;
106
+ embeddingModel: string;
107
+ systemPrompt: string;
108
+ memoryEnabled: boolean;
109
+ multiModelEnabled: boolean;
110
+ citationsEnabled: boolean;
111
+ fileUploadEnabled: boolean;
112
+ }
113
+ interface ProjectAuthSettings {
114
+ mode: AuthMode;
115
+ allowedOrigins: string[];
116
+ requireVerifiedEmail: boolean;
117
+ sessionTtlMinutes: number;
118
+ }
119
+ interface ProjectWidgetSettings {
120
+ position: WidgetPosition;
121
+ theme: ThemeMode;
122
+ lazyLoad: boolean;
123
+ autoReconnect: boolean;
124
+ persistConversations: boolean;
125
+ showRetrivoraBranding: boolean;
126
+ }
127
+ interface ProjectTelemetrySettings {
128
+ enabled: boolean;
129
+ collectBrowser: boolean;
130
+ collectCountry: boolean;
131
+ redactPii: boolean;
132
+ retentionDays: number;
133
+ }
134
+ interface ProjectChatSettings {
135
+ projectId: string;
136
+ branding: ProjectBrandingSettings;
137
+ ai: ProjectAiSettings;
138
+ auth: ProjectAuthSettings;
139
+ widget: ProjectWidgetSettings;
140
+ telemetry: ProjectTelemetrySettings;
141
+ lifecycleHooks: string[];
142
+ conversationFeatures: string[];
143
+ updatedAt?: string;
144
+ }
145
+ declare function createDefaultProjectSettings(projectId: string): ProjectChatSettings;
146
+ declare function normalizeProjectSettings(projectId: string, input: Partial<ProjectChatSettings> | null | undefined): ProjectChatSettings;
147
+ declare function projectSettingsToUiConfig(settings: ProjectChatSettings): Partial<UIConfig>;
148
+
89
149
  /**
90
150
  * Master configuration interface for Retrivora AI.
91
151
  * Each consuming project provides one RagConfig object to drive
@@ -312,6 +372,8 @@ interface RagConfig {
312
372
  embedding: EmbeddingConfig;
313
373
  /** Optional UI branding overrides */
314
374
  ui?: UIConfig;
375
+ /** Optional dashboard-managed project chat settings */
376
+ projectSettings?: ProjectChatSettings;
315
377
  /** Optional RAG pipeline tuning knobs */
316
378
  rag?: RAGConfig;
317
379
  /** Optional Graph database configuration */
@@ -616,4 +678,4 @@ interface ILLMProvider {
616
678
  ping(): Promise<boolean>;
617
679
  }
618
680
 
619
- export type { RetrievalResult as A, BarChartData as B, ChatMessage as C, RetrivoraChunkMetadata as D, EmbedOptions as E, RetrivoraIngestedDocument as F, GraphDBConfig as G, SuggestionsResponse as H, ILLMProvider as I, TableData as J, VisualizationType as K, LLMConfig as L, MessageRole as M, ObservabilityTrace as O, PieChartData as P, RAGConfig as R, ScatterPlotDataPoint as S, TokenUsage as T, UseRagChatOptions as U, VectorDBConfig as V, WorkflowConfig as W, UseRagChatReturn as a, ChatOptions as b, ChatResponse as c, EmbeddingConfig as d, EmbeddingProvider as e, IngestDocument as f, LLMProvider as g, LatencyBreakdown as h, RagConfig as i, RagMessage as j, RetrievalConfig as k, RetrievedChunk as l, UIConfig as m, UniversalRagConfig as n, UpsertDocument as o, VectorDBProvider as p, VectorMatch as q, GraphNode as r, Edge as s, GraphSearchResult as t, UITransformationResponse as u, CarouselProduct as v, IRetriever as w, LineChartDataPoint as x, MetricCardData as y, Product as z };
681
+ export { type RetrivoraChunkMetadata as $, type AuthMode as A, projectSettingsToUiConfig as B, type ChatMessage as C, type GraphNode as D, type EmbedOptions as E, type Edge as F, type GraphDBConfig as G, type GraphSearchResult as H, type ILLMProvider as I, type UITransformationResponse as J, type BarChartData as K, type LLMConfig as L, type CarouselProduct as M, type IRetriever as N, type ObservabilityTrace as O, type ProjectChatSettings as P, type LineChartDataPoint as Q, type RAGConfig as R, type MessageRole as S, type ThemeMode as T, type UseRagChatOptions as U, type VectorDBConfig as V, type WidgetPosition as W, type MetricCardData as X, type PieChartData as Y, type Product as Z, type RetrievalResult as _, type UseRagChatReturn as a, type RetrivoraIngestedDocument as a0, type ScatterPlotDataPoint as a1, type SuggestionsResponse as a2, type TableData as a3, type VisualizationType as a4, type ChatOptions as b, type ChatResponse as c, type EmbeddingConfig as d, type EmbeddingProvider as e, type IngestDocument as f, type LLMProvider as g, type LatencyBreakdown as h, type ProjectAiSettings as i, type ProjectAuthSettings as j, type ProjectBrandingSettings as k, type ProjectTelemetrySettings as l, type ProjectWidgetSettings as m, type RagConfig as n, type RagMessage as o, type RetrievalConfig as p, type RetrievedChunk as q, type TokenUsage as r, type UIConfig as s, type UniversalRagConfig as t, type UpsertDocument as u, type VectorDBProvider as v, type VectorMatch as w, type WorkflowConfig as x, createDefaultProjectSettings as y, normalizeProjectSettings as z };
@@ -1,3 +1,3 @@
1
1
  import 'next/server';
2
- export { b as HandlerOptions, d as createChatHandler, e as createFeedbackHandler, f as createHealthHandler, g as createHistoryHandler, h as createIngestHandler, p as createLicenseHandler, i as createRagHandler, j as createSessionsHandler, k as createStreamHandler, q as createSuggestionsHandler, l as createUploadHandler, s as sseErrorFrame, m as sseFrame, n as sseMetaFrame, r as sseObservabilityFrame, o as sseTextFrame, t as sseUIFrame } from '../index-CL-zF6bD.mjs';
3
- import '../ILLMProvider-CcJ5N6XD.mjs';
2
+ export { b as HandlerOptions, d as createChatHandler, e as createFeedbackHandler, f as createHealthHandler, g as createHistoryHandler, h as createIngestHandler, p as createLicenseHandler, i as createRagHandler, j as createSessionsHandler, k as createStreamHandler, q as createSuggestionsHandler, l as createUploadHandler, s as sseErrorFrame, m as sseFrame, n as sseMetaFrame, r as sseObservabilityFrame, o as sseTextFrame, t as sseUIFrame } from '../index-xxQOFx-u.mjs';
3
+ import '../ILLMProvider-B8TAVx3j.mjs';
@@ -1,3 +1,3 @@
1
1
  import 'next/server';
2
- export { b as HandlerOptions, d as createChatHandler, e as createFeedbackHandler, f as createHealthHandler, g as createHistoryHandler, h as createIngestHandler, p as createLicenseHandler, i as createRagHandler, j as createSessionsHandler, k as createStreamHandler, q as createSuggestionsHandler, l as createUploadHandler, s as sseErrorFrame, m as sseFrame, n as sseMetaFrame, r as sseObservabilityFrame, o as sseTextFrame, t as sseUIFrame } from '../index-BwmyPJHp.js';
3
- import '../ILLMProvider-CcJ5N6XD.js';
2
+ export { b as HandlerOptions, d as createChatHandler, e as createFeedbackHandler, f as createHealthHandler, g as createHistoryHandler, h as createIngestHandler, p as createLicenseHandler, i as createRagHandler, j as createSessionsHandler, k as createStreamHandler, q as createSuggestionsHandler, l as createUploadHandler, s as sseErrorFrame, m as sseFrame, n as sseMetaFrame, r as sseObservabilityFrame, o as sseTextFrame, t as sseUIFrame } from '../index-ejOWsaqb.js';
3
+ import '../ILLMProvider-B8TAVx3j.js';