@burtson-labs/bandit-engine 2.0.8 → 2.0.9
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/LICENSE +2 -2
- package/README.md +87 -27
- package/dist/chat-OLCX6TBK.mjs +15 -0
- package/dist/chat-provider.js +9413 -0
- package/dist/chat-provider.js.map +1 -0
- package/dist/chat-provider.mjs +17 -0
- package/dist/chunk-5E7S7DK3.mjs +231 -0
- package/dist/chunk-5E7S7DK3.mjs.map +1 -0
- package/dist/chunk-6IHJZCUH.mjs +5658 -0
- package/dist/chunk-6IHJZCUH.mjs.map +1 -0
- package/dist/chunk-6YRLBITU.mjs +9418 -0
- package/dist/chunk-6YRLBITU.mjs.map +1 -0
- package/dist/chunk-CVIOLFMX.mjs +259 -0
- package/dist/chunk-CVIOLFMX.mjs.map +1 -0
- package/dist/chunk-HHKXWNCG.mjs +2810 -0
- package/dist/chunk-HHKXWNCG.mjs.map +1 -0
- package/dist/chunk-JQ6UNJNW.mjs +8757 -0
- package/dist/chunk-JQ6UNJNW.mjs.map +1 -0
- package/dist/chunk-ONQMRE2G.mjs +26 -0
- package/dist/chunk-ONQMRE2G.mjs.map +1 -0
- package/dist/chunk-PXXVEH5M.mjs +8925 -0
- package/dist/chunk-PXXVEH5M.mjs.map +1 -0
- package/dist/{chunk-WYS5CZVG.mjs → chunk-QHLKGSMB.mjs} +2 -2
- package/dist/{chunk-WYS5CZVG.mjs.map → chunk-QHLKGSMB.mjs.map} +1 -1
- package/dist/chunk-VSHO7PF2.mjs +150 -0
- package/dist/chunk-VSHO7PF2.mjs.map +1 -0
- package/dist/cli/cli.js +11 -13
- package/dist/cli/cli.js.map +1 -1
- package/dist/gateway-BXVrH8B-.d.mts +312 -0
- package/dist/gateway-BXVrH8B-.d.ts +312 -0
- package/dist/index.d.mts +11 -309
- package/dist/index.d.ts +11 -309
- package/dist/index.js +118 -83
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +86 -11874
- package/dist/index.mjs.map +1 -1
- package/dist/management/management.js +39335 -0
- package/dist/management/management.js.map +1 -0
- package/dist/management/management.mjs +16 -0
- package/dist/management/management.mjs.map +1 -0
- package/dist/{chunk-BIPELT57.mjs → modals/chat-modal/chat-modal.js} +16653 -20880
- package/dist/modals/chat-modal/chat-modal.js.map +1 -0
- package/dist/modals/chat-modal/chat-modal.mjs +19 -0
- package/dist/modals/chat-modal/chat-modal.mjs.map +1 -0
- package/dist/{modelStore-Y3LZWRQC.mjs → modelStore-CY6SECYD.mjs} +2 -2
- package/dist/modelStore-CY6SECYD.mjs.map +1 -0
- package/dist/public-types.d.mts +32 -0
- package/dist/public-types.d.ts +32 -0
- package/docs/04_local_dev.md +1 -1
- package/docs/api_reference/assets/navigation.js +1 -1
- package/docs/api_reference/assets/search.js +1 -1
- package/docs/api_reference/classes/DebugLogger.html +11 -11
- package/docs/api_reference/classes/FeatureFlagService.html +13 -13
- package/docs/api_reference/classes/NotificationService.html +10 -10
- package/docs/api_reference/classes/StreamingTTSClient.html +9 -9
- package/docs/api_reference/classes/VectorDatabaseService.html +24 -24
- package/docs/api_reference/classes/VectorMigrationService.html +8 -8
- package/docs/api_reference/classes/VoiceService.html +2 -2
- package/docs/api_reference/enums/TTSState.html +2 -2
- package/docs/api_reference/functions/Chat.html +1 -1
- package/docs/api_reference/functions/ChatModal.html +4 -4
- package/docs/api_reference/functions/ChatProvider.html +1 -1
- package/docs/api_reference/functions/FeatureFlagProvider.html +1 -1
- package/docs/api_reference/functions/FeedbackButton.html +1 -1
- package/docs/api_reference/functions/FeedbackModal.html +1 -1
- package/docs/api_reference/functions/Management.html +1 -1
- package/docs/api_reference/functions/NotificationProvider.html +1 -1
- package/docs/api_reference/functions/SubscriptionExpiredGuard.html +1 -1
- package/docs/api_reference/functions/SubscriptionExpiredModal.html +1 -1
- package/docs/api_reference/functions/defineCustomElement.html +1 -1
- package/docs/api_reference/functions/getCriticalConfig.html +1 -1
- package/docs/api_reference/functions/getFeatureMatrix.html +1 -1
- package/docs/api_reference/functions/getStreamingTTSClient.html +1 -1
- package/docs/api_reference/functions/getSystemConstants.html +1 -1
- package/docs/api_reference/functions/getTTSState.html +1 -1
- package/docs/api_reference/functions/handleHttpError.html +1 -1
- package/docs/api_reference/functions/handleSubscriptionUpgrade.html +1 -1
- package/docs/api_reference/functions/handleValidationError.html +1 -1
- package/docs/api_reference/functions/initializeCoreSystem.html +1 -1
- package/docs/api_reference/functions/pauseTTS.html +1 -1
- package/docs/api_reference/functions/previewTierUpgrade.html +1 -1
- package/docs/api_reference/functions/resumeTTS.html +1 -1
- package/docs/api_reference/functions/showInfoNotification.html +1 -1
- package/docs/api_reference/functions/showSuccessNotification.html +1 -1
- package/docs/api_reference/functions/speakWithStreaming.html +1 -1
- package/docs/api_reference/functions/stopTTS.html +1 -1
- package/docs/api_reference/functions/syncSubscriptionWithAPI.html +1 -1
- package/docs/api_reference/functions/updateSubscriptionTier.html +1 -1
- package/docs/api_reference/functions/useFeatureFlag.html +1 -1
- package/docs/api_reference/functions/useFeatureVisibility.html +1 -1
- package/docs/api_reference/functions/useFeatures.html +1 -1
- package/docs/api_reference/functions/useGatewayHealth.html +1 -1
- package/docs/api_reference/functions/useGatewayMemory.html +1 -1
- package/docs/api_reference/functions/useGatewayModels.html +1 -1
- package/docs/api_reference/functions/useGlobalTTS.html +1 -1
- package/docs/api_reference/functions/useNotification.html +1 -1
- package/docs/api_reference/functions/useNotificationService.html +1 -1
- package/docs/api_reference/functions/useTTS.html +1 -1
- package/docs/api_reference/functions/useVectorStore.html +1 -1
- package/docs/api_reference/functions/useVoiceStore.html +2 -2
- package/docs/api_reference/functions/useVoices.html +1 -1
- package/docs/api_reference/functions/validateEnvironment.html +1 -1
- package/docs/api_reference/functions/validateSystemIntegrity.html +1 -1
- package/docs/api_reference/index.html +97 -26
- package/docs/api_reference/interfaces/AIChatRequest.html +2 -2
- package/docs/api_reference/interfaces/AIChatResponse.html +2 -2
- package/docs/api_reference/interfaces/AIGenerateRequest.html +2 -2
- package/docs/api_reference/interfaces/AIGenerateResponse.html +2 -2
- package/docs/api_reference/interfaces/AIMessage.html +2 -2
- package/docs/api_reference/interfaces/AIModel.html +2 -2
- package/docs/api_reference/interfaces/AIProviderConfig.html +2 -2
- package/docs/api_reference/interfaces/ChatConfig.html +3 -3
- package/docs/api_reference/interfaces/ChatModalProps.html +7 -0
- package/docs/api_reference/interfaces/CreateMemoryOptions.html +2 -2
- package/docs/api_reference/interfaces/FeatureEvaluation.html +7 -7
- package/docs/api_reference/interfaces/FeatureFlagConfig.html +9 -9
- package/docs/api_reference/interfaces/FeatureFlagContextValue.html +8 -8
- package/docs/api_reference/interfaces/FeatureFlagProviderProps.html +2 -2
- package/docs/api_reference/interfaces/FeedbackButtonProps.html +10 -10
- package/docs/api_reference/interfaces/FeedbackCategories.html +2 -2
- package/docs/api_reference/interfaces/FeedbackModalProps.html +2 -2
- package/docs/api_reference/interfaces/FeedbackPriorities.html +2 -2
- package/docs/api_reference/interfaces/FeedbackRequest.html +2 -2
- package/docs/api_reference/interfaces/FeedbackResponse.html +2 -2
- package/docs/api_reference/interfaces/FileUploadResult.html +2 -2
- package/docs/api_reference/interfaces/GatewayChatRequest.html +2 -2
- package/docs/api_reference/interfaces/GatewayChatResponse.html +2 -2
- package/docs/api_reference/interfaces/GatewayContract.html +2 -2
- package/docs/api_reference/interfaces/GatewayGenerateRequest.html +2 -2
- package/docs/api_reference/interfaces/GatewayGenerateResponse.html +2 -2
- package/docs/api_reference/interfaces/GatewayHealthResponse.html +2 -2
- package/docs/api_reference/interfaces/GatewayMemoryRecord.html +2 -2
- package/docs/api_reference/interfaces/GatewayMemoryResponse.html +2 -2
- package/docs/api_reference/interfaces/GatewayMessage.html +2 -2
- package/docs/api_reference/interfaces/GatewayMessageContent.html +2 -2
- package/docs/api_reference/interfaces/GatewayModel.html +2 -2
- package/docs/api_reference/interfaces/GatewayModelsResponse.html +2 -2
- package/docs/api_reference/interfaces/MemorySearchFilters.html +2 -2
- package/docs/api_reference/interfaces/MigrationProgress.html +2 -2
- package/docs/api_reference/interfaces/MigrationStatus.html +2 -2
- package/docs/api_reference/interfaces/NotificationConfig.html +2 -2
- package/docs/api_reference/interfaces/NotificationContextType.html +2 -2
- package/docs/api_reference/interfaces/NotificationProviderProps.html +2 -2
- package/docs/api_reference/interfaces/PackageSettings.html +3 -3
- package/docs/api_reference/interfaces/SearchOptions.html +2 -2
- package/docs/api_reference/interfaces/SearchResult.html +2 -2
- package/docs/api_reference/interfaces/SubscriptionExpiredGuardProps.html +2 -2
- package/docs/api_reference/interfaces/SubscriptionExpiredModalProps.html +2 -2
- package/docs/api_reference/interfaces/TTSOptions.html +2 -2
- package/docs/api_reference/interfaces/TTSProgress.html +2 -2
- package/docs/api_reference/interfaces/TrialUsage.html +2 -2
- package/docs/api_reference/interfaces/UploadRequest.html +3 -3
- package/docs/api_reference/interfaces/UseTTSReturn.html +2 -2
- package/docs/api_reference/interfaces/VectorDocument.html +2 -2
- package/docs/api_reference/interfaces/VectorMemory.html +2 -2
- package/docs/api_reference/interfaces/VectorMemoryMetadata.html +2 -2
- package/docs/api_reference/interfaces/VectorStoreStatus.html +2 -2
- package/docs/api_reference/interfaces/VoiceModelsResponse.html +2 -2
- package/docs/api_reference/interfaces/VoiceState.html +2 -2
- package/docs/api_reference/media/LICENSE +2 -2
- package/docs/api_reference/media/PROTECTION-README.md +6 -8
- package/docs/api_reference/modules.html +1 -0
- package/docs/api_reference/types/FeatureKey.html +1 -1
- package/docs/api_reference/types/FeatureMatrix.html +1 -1
- package/docs/api_reference/types/GatewayQueryOptions.html +1 -1
- package/docs/api_reference/types/LogContext.html +1 -1
- package/docs/api_reference/types/SubscriptionTier.html +1 -1
- package/docs/api_reference/variables/DEFAULT_TIER_FEATURES.html +1 -1
- package/docs/api_reference/variables/FeatureFlagContext.html +1 -1
- package/docs/api_reference/variables/OSS_DEFAULT_FEATURES.html +1 -1
- package/docs/api_reference/variables/SYSTEM_FLAGS.html +1 -1
- package/docs/api_reference/variables/authenticationService.html +1 -1
- package/docs/api_reference/variables/debugLogger-1.html +1 -1
- package/docs/api_reference/variables/featureFlagService-1.html +1 -1
- package/docs/api_reference/variables/notificationService-1.html +1 -1
- package/docs/api_reference/variables/vectorDatabaseService-1.html +1 -1
- package/docs/api_reference/variables/vectorMigrationService-1.html +1 -1
- package/docs/api_reference/variables/voiceService-1.html +1 -1
- package/package.json +11 -13
- package/dist/chat-QXB526NZ.mjs +0 -11
- package/dist/chunk-BIPELT57.mjs.map +0 -1
- /package/dist/{chat-QXB526NZ.mjs.map → chat-OLCX6TBK.mjs.map} +0 -0
- /package/dist/{modelStore-Y3LZWRQC.mjs.map → chat-provider.mjs.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -6513,16 +6513,16 @@ var init_vectorDatabaseService = __esm({
|
|
|
6513
6513
|
init_debugLogger();
|
|
6514
6514
|
VectorDatabaseService = class {
|
|
6515
6515
|
baseUrl;
|
|
6516
|
-
|
|
6516
|
+
fileStorageApiUrl;
|
|
6517
6517
|
token = null;
|
|
6518
6518
|
lastAvailabilityState;
|
|
6519
6519
|
lastConfigState;
|
|
6520
|
-
constructor(gatewayApiUrl,
|
|
6520
|
+
constructor(gatewayApiUrl, fileStorageApiUrl) {
|
|
6521
6521
|
this.baseUrl = gatewayApiUrl || "https://localhost:5001/api";
|
|
6522
|
-
this.
|
|
6522
|
+
this.fileStorageApiUrl = fileStorageApiUrl || "https://localhost:5001/api";
|
|
6523
6523
|
debugLogger.info("Vector database service initialized", {
|
|
6524
6524
|
baseUrl: this.baseUrl,
|
|
6525
|
-
|
|
6525
|
+
fileStorageApiUrl: this.fileStorageApiUrl,
|
|
6526
6526
|
hasToken: Boolean(this.token)
|
|
6527
6527
|
});
|
|
6528
6528
|
}
|
|
@@ -6548,11 +6548,11 @@ var init_vectorDatabaseService = __esm({
|
|
|
6548
6548
|
* Check if vector database is available and configured
|
|
6549
6549
|
*/
|
|
6550
6550
|
isAvailable() {
|
|
6551
|
-
const available = !!(this.baseUrl && this.
|
|
6551
|
+
const available = !!(this.baseUrl && this.fileStorageApiUrl && this.token);
|
|
6552
6552
|
if (this.lastAvailabilityState !== available) {
|
|
6553
6553
|
debugLogger.debug("Vector service availability check", {
|
|
6554
6554
|
baseUrl: this.baseUrl,
|
|
6555
|
-
|
|
6555
|
+
fileStorageApiUrl: this.fileStorageApiUrl,
|
|
6556
6556
|
hasToken: Boolean(this.token),
|
|
6557
6557
|
available
|
|
6558
6558
|
});
|
|
@@ -7052,7 +7052,7 @@ var init_vectorDatabaseService = __esm({
|
|
|
7052
7052
|
}
|
|
7053
7053
|
// ===== DOCUMENT OPERATIONS =====
|
|
7054
7054
|
/**
|
|
7055
|
-
* Upload file to
|
|
7055
|
+
* Upload file to file storage API and get file ID
|
|
7056
7056
|
*
|
|
7057
7057
|
* @param file - The file to upload
|
|
7058
7058
|
* @param shareWithTeam - Whether to share the file with team members.
|
|
@@ -7062,8 +7062,8 @@ var init_vectorDatabaseService = __esm({
|
|
|
7062
7062
|
* @returns Promise<FileUploadResult> with success status and file ID
|
|
7063
7063
|
*/
|
|
7064
7064
|
async uploadFile(file, shareWithTeam = true) {
|
|
7065
|
-
if (!this.
|
|
7066
|
-
throw new Error("
|
|
7065
|
+
if (!this.fileStorageApiUrl) {
|
|
7066
|
+
throw new Error("File storage API URL not configured");
|
|
7067
7067
|
}
|
|
7068
7068
|
if (!this.token) {
|
|
7069
7069
|
throw new Error("Authentication token not available");
|
|
@@ -7072,14 +7072,14 @@ var init_vectorDatabaseService = __esm({
|
|
|
7072
7072
|
const formData = new FormData();
|
|
7073
7073
|
formData.append("file", file);
|
|
7074
7074
|
formData.append("shareWithTeam", shareWithTeam.toString());
|
|
7075
|
-
debugLogger.info("Uploading file to
|
|
7075
|
+
debugLogger.info("Uploading file to file storage API", {
|
|
7076
7076
|
filename: file.name,
|
|
7077
7077
|
size: file.size,
|
|
7078
7078
|
type: file.type,
|
|
7079
7079
|
shareWithTeam,
|
|
7080
|
-
|
|
7080
|
+
fileStorageApiUrl: this.fileStorageApiUrl
|
|
7081
7081
|
});
|
|
7082
|
-
const response = await fetch(`${this.
|
|
7082
|
+
const response = await fetch(`${this.fileStorageApiUrl}/file/upload`, {
|
|
7083
7083
|
method: "POST",
|
|
7084
7084
|
headers: {
|
|
7085
7085
|
"Authorization": `Bearer ${this.token}`
|
|
@@ -7088,13 +7088,13 @@ var init_vectorDatabaseService = __esm({
|
|
|
7088
7088
|
});
|
|
7089
7089
|
if (!response.ok) {
|
|
7090
7090
|
const errorData = await response.json().catch(() => ({}));
|
|
7091
|
-
throw new Error(errorData.message || `
|
|
7091
|
+
throw new Error(errorData.message || `file storage upload failed: ${response.status}`);
|
|
7092
7092
|
}
|
|
7093
7093
|
const result = await response.json();
|
|
7094
7094
|
const fileId = result.fileId || result.id;
|
|
7095
|
-
debugLogger.debug("
|
|
7095
|
+
debugLogger.debug("File storage API upload response", result);
|
|
7096
7096
|
debugLogger.debug("Extracted vector file id", { fileId });
|
|
7097
|
-
debugLogger.info("File uploaded successfully to
|
|
7097
|
+
debugLogger.info("File uploaded successfully to file storage", {
|
|
7098
7098
|
fileId,
|
|
7099
7099
|
filename: file.name,
|
|
7100
7100
|
originalResponse: result
|
|
@@ -7105,8 +7105,8 @@ var init_vectorDatabaseService = __esm({
|
|
|
7105
7105
|
message: result.message
|
|
7106
7106
|
};
|
|
7107
7107
|
} catch (error) {
|
|
7108
|
-
debugLogger.error("Failed to upload file to
|
|
7109
|
-
throw new Error(`
|
|
7108
|
+
debugLogger.error("Failed to upload file to file storage", { error });
|
|
7109
|
+
throw new Error(`File storage upload failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
7110
7110
|
}
|
|
7111
7111
|
}
|
|
7112
7112
|
/**
|
|
@@ -7270,7 +7270,7 @@ var init_vectorDatabaseService = __esm({
|
|
|
7270
7270
|
}
|
|
7271
7271
|
}
|
|
7272
7272
|
/**
|
|
7273
|
-
* Get user's files - tries both Gateway API and
|
|
7273
|
+
* Get user's files - tries both Gateway API and file storage API
|
|
7274
7274
|
*/
|
|
7275
7275
|
async getUserFiles(skip = 0, limit = 50) {
|
|
7276
7276
|
if (!this.isAvailable()) {
|
|
@@ -7283,10 +7283,10 @@ var init_vectorDatabaseService = __esm({
|
|
|
7283
7283
|
headers: this.getHeaders()
|
|
7284
7284
|
});
|
|
7285
7285
|
if (!response.ok) {
|
|
7286
|
-
debugLogger.warn("Gateway API files endpoint failed, falling back to
|
|
7286
|
+
debugLogger.warn("Gateway API files endpoint failed, falling back to file storage API", {
|
|
7287
7287
|
status: response.status
|
|
7288
7288
|
});
|
|
7289
|
-
return await this.
|
|
7289
|
+
return await this.getUserFilesFromFileStorage(skip, limit);
|
|
7290
7290
|
}
|
|
7291
7291
|
const result = await response.json();
|
|
7292
7292
|
debugLogger.debug("Gateway API files response", result);
|
|
@@ -7298,17 +7298,17 @@ var init_vectorDatabaseService = __esm({
|
|
|
7298
7298
|
}
|
|
7299
7299
|
return [];
|
|
7300
7300
|
} catch (error) {
|
|
7301
|
-
debugLogger.error("Gateway API failed while fetching user files, trying
|
|
7302
|
-
return await this.
|
|
7301
|
+
debugLogger.error("Gateway API failed while fetching user files, trying file storage API", { error });
|
|
7302
|
+
return await this.getUserFilesFromFileStorage(skip, limit);
|
|
7303
7303
|
}
|
|
7304
7304
|
}
|
|
7305
7305
|
/**
|
|
7306
|
-
* Get user's files from
|
|
7306
|
+
* Get user's files from file storage API as fallback
|
|
7307
7307
|
*/
|
|
7308
|
-
async
|
|
7308
|
+
async getUserFilesFromFileStorage(skip = 0, limit = 50) {
|
|
7309
7309
|
try {
|
|
7310
|
-
debugLogger.debug("Fetching user files from
|
|
7311
|
-
const response = await fetch(`${this.
|
|
7310
|
+
debugLogger.debug("Fetching user files from file storage API", { skip, limit });
|
|
7311
|
+
const response = await fetch(`${this.fileStorageApiUrl}/file/files?skip=${skip}&limit=${limit}`, {
|
|
7312
7312
|
method: "GET",
|
|
7313
7313
|
headers: {
|
|
7314
7314
|
"Authorization": `Bearer ${this.token}`,
|
|
@@ -7316,10 +7316,10 @@ var init_vectorDatabaseService = __esm({
|
|
|
7316
7316
|
}
|
|
7317
7317
|
});
|
|
7318
7318
|
if (!response.ok) {
|
|
7319
|
-
throw new Error(`
|
|
7319
|
+
throw new Error(`File storage API failed: ${response.status}`);
|
|
7320
7320
|
}
|
|
7321
7321
|
const result = await response.json();
|
|
7322
|
-
debugLogger.debug("
|
|
7322
|
+
debugLogger.debug("File storage API files response", result);
|
|
7323
7323
|
if (Array.isArray(result)) {
|
|
7324
7324
|
return this.toRecordArray(result);
|
|
7325
7325
|
}
|
|
@@ -7328,7 +7328,7 @@ var init_vectorDatabaseService = __esm({
|
|
|
7328
7328
|
}
|
|
7329
7329
|
return [];
|
|
7330
7330
|
} catch (error) {
|
|
7331
|
-
debugLogger.error("Failed to fetch user files from
|
|
7331
|
+
debugLogger.error("Failed to fetch user files from file storage API", { error });
|
|
7332
7332
|
return [];
|
|
7333
7333
|
}
|
|
7334
7334
|
}
|
|
@@ -7341,7 +7341,7 @@ var init_vectorDatabaseService = __esm({
|
|
|
7341
7341
|
}
|
|
7342
7342
|
try {
|
|
7343
7343
|
debugLogger.debug("Downloading vector file", { fileId, filename });
|
|
7344
|
-
const response = await fetch(`${this.
|
|
7344
|
+
const response = await fetch(`${this.fileStorageApiUrl}/file/download/${fileId}`, {
|
|
7345
7345
|
method: "GET",
|
|
7346
7346
|
headers: {
|
|
7347
7347
|
"Authorization": `Bearer ${this.token}`
|
|
@@ -7374,7 +7374,7 @@ var init_vectorDatabaseService = __esm({
|
|
|
7374
7374
|
}
|
|
7375
7375
|
try {
|
|
7376
7376
|
debugLogger.debug("Fetching vector file blob", { fileId });
|
|
7377
|
-
const response = await fetch(`${this.
|
|
7377
|
+
const response = await fetch(`${this.fileStorageApiUrl}/file/download/${fileId}`, {
|
|
7378
7378
|
method: "GET",
|
|
7379
7379
|
headers: {
|
|
7380
7380
|
"Authorization": `Bearer ${this.token}`
|
|
@@ -7486,16 +7486,16 @@ var init_vectorDatabaseService = __esm({
|
|
|
7486
7486
|
* Configure the service with API URLs
|
|
7487
7487
|
* This should be called by the main application with environment variables
|
|
7488
7488
|
*/
|
|
7489
|
-
configure(gatewayApiUrl,
|
|
7489
|
+
configure(gatewayApiUrl, fileStorageApiUrl) {
|
|
7490
7490
|
this.baseUrl = gatewayApiUrl;
|
|
7491
|
-
this.
|
|
7492
|
-
if (this.lastConfigState !== `${gatewayApiUrl}|${
|
|
7491
|
+
this.fileStorageApiUrl = fileStorageApiUrl;
|
|
7492
|
+
if (this.lastConfigState !== `${gatewayApiUrl}|${fileStorageApiUrl}`) {
|
|
7493
7493
|
debugLogger.info("Vector database service configured", {
|
|
7494
7494
|
baseUrl: this.baseUrl,
|
|
7495
|
-
|
|
7495
|
+
fileStorageApiUrl: this.fileStorageApiUrl,
|
|
7496
7496
|
hasToken: Boolean(this.token)
|
|
7497
7497
|
});
|
|
7498
|
-
this.lastConfigState = `${gatewayApiUrl}|${
|
|
7498
|
+
this.lastConfigState = `${gatewayApiUrl}|${fileStorageApiUrl}`;
|
|
7499
7499
|
}
|
|
7500
7500
|
}
|
|
7501
7501
|
/**
|
|
@@ -7506,7 +7506,7 @@ var init_vectorDatabaseService = __esm({
|
|
|
7506
7506
|
debugLogger.info("Testing Gateway API connection");
|
|
7507
7507
|
debugLogger.info("Vector service status snapshot", {
|
|
7508
7508
|
baseUrl: this.baseUrl,
|
|
7509
|
-
|
|
7509
|
+
fileStorageApiUrl: this.fileStorageApiUrl,
|
|
7510
7510
|
hasToken: Boolean(this.token),
|
|
7511
7511
|
tokenLength: this.token?.length || 0,
|
|
7512
7512
|
tokenPreview: this.token ? `${this.token.substring(0, 30)}...` : void 0,
|
|
@@ -7533,15 +7533,15 @@ var init_vectorDatabaseService = __esm({
|
|
|
7533
7533
|
debugLogger.error("Cannot reach Gateway API", { error });
|
|
7534
7534
|
}
|
|
7535
7535
|
try {
|
|
7536
|
-
debugLogger.debug("Testing
|
|
7537
|
-
const files = await this.
|
|
7538
|
-
debugLogger.info("
|
|
7536
|
+
debugLogger.debug("Testing file storage API connectivity");
|
|
7537
|
+
const files = await this.getUserFilesFromFileStorage(0, 5);
|
|
7538
|
+
debugLogger.info("File storage API files response", {
|
|
7539
7539
|
count: files.length,
|
|
7540
7540
|
files: files.slice(0, 3)
|
|
7541
7541
|
// Show first 3 files
|
|
7542
7542
|
});
|
|
7543
7543
|
} catch (error) {
|
|
7544
|
-
debugLogger.error("
|
|
7544
|
+
debugLogger.error("File storage API test failed", { error });
|
|
7545
7545
|
}
|
|
7546
7546
|
try {
|
|
7547
7547
|
debugLogger.debug("Testing embedding endpoint availability");
|
|
@@ -8627,8 +8627,8 @@ var init_useVectorStore = __esm({
|
|
|
8627
8627
|
return;
|
|
8628
8628
|
}
|
|
8629
8629
|
const gatewayApiUrl = packageSettings.gatewayApiUrl;
|
|
8630
|
-
const
|
|
8631
|
-
vectorDatabaseService.configure(gatewayApiUrl,
|
|
8630
|
+
const fileStorageApiUrl = packageSettings.fileStorageApiUrl || packageSettings.gatewayApiUrl;
|
|
8631
|
+
vectorDatabaseService.configure(gatewayApiUrl, fileStorageApiUrl);
|
|
8632
8632
|
if (authStore.token) {
|
|
8633
8633
|
vectorDatabaseService.setAuthToken(authStore.token);
|
|
8634
8634
|
}
|
|
@@ -17731,21 +17731,6 @@ ${sanitize(
|
|
|
17731
17731
|
!isMobile && renderAttachmentButton("attach-inline"),
|
|
17732
17732
|
!isMobile && renderMemoryButton("memory-inline"),
|
|
17733
17733
|
!isMobile && renderSttButton("stt-inline"),
|
|
17734
|
-
!isMobile && isFeedbackEnabled && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material14.Tooltip, { title: "Send Feedback", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
17735
|
-
import_material14.IconButton,
|
|
17736
|
-
{
|
|
17737
|
-
onClick: () => setFeedbackModalOpen(true),
|
|
17738
|
-
sx: {
|
|
17739
|
-
bgcolor: badgeBackground,
|
|
17740
|
-
color: fileText,
|
|
17741
|
-
width: primaryIconSize,
|
|
17742
|
-
height: primaryIconSize,
|
|
17743
|
-
borderRadius: "50%",
|
|
17744
|
-
"&:hover": { bgcolor: hoverBadgeBackground }
|
|
17745
|
-
},
|
|
17746
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_Feedback.default, { fontSize: "small" })
|
|
17747
|
-
}
|
|
17748
|
-
) }),
|
|
17749
17734
|
isMobile && hasSecondaryActions && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
17750
17735
|
import_material14.IconButton,
|
|
17751
17736
|
{
|
|
@@ -17765,7 +17750,7 @@ ${sanitize(
|
|
|
17765
17750
|
fontSize: "small",
|
|
17766
17751
|
sx: {
|
|
17767
17752
|
transition: "transform 0.2s ease",
|
|
17768
|
-
transform: moreActionsOpen ? "rotate(
|
|
17753
|
+
transform: moreActionsOpen ? "rotate(0deg)" : "rotate(180deg)"
|
|
17769
17754
|
}
|
|
17770
17755
|
}
|
|
17771
17756
|
)
|
|
@@ -35181,7 +35166,7 @@ var BrandingTab = ({
|
|
|
35181
35166
|
)) }),
|
|
35182
35167
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_material39.Paper, { elevation: 3, sx: { px: 2, py: 1.5, borderRadius: 2, width: "100%", maxWidth: 500 }, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_material39.Typography, { variant: "body1", sx: { color: "text.secondary" }, children: "What's on your mind?" }) }),
|
|
35183
35168
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_material39.Typography, { variant: "caption", sx: { textAlign: "center", color: "text.secondary", mt: 1 }, children: [
|
|
35184
|
-
brandingText ? `${brandingText} \u2022 ` : "",
|
|
35169
|
+
brandingText ? `${brandingText} \u2022 ` : "Bandit AI \u2022 ",
|
|
35185
35170
|
"may be wrong \u2014 double-check important info."
|
|
35186
35171
|
] })
|
|
35187
35172
|
] })
|
|
@@ -37167,7 +37152,10 @@ var import_CheckCircle3 = __toESM(require("@mui/icons-material/CheckCircle"));
|
|
|
37167
37152
|
var import_Error3 = __toESM(require("@mui/icons-material/Error"));
|
|
37168
37153
|
init_debugLogger();
|
|
37169
37154
|
init_indexedDBService();
|
|
37155
|
+
init_conversationSyncStore();
|
|
37170
37156
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
37157
|
+
var DEFAULT_DISPLAY_QUOTA_BYTES = 1024 * 1024 * 1024;
|
|
37158
|
+
var MAX_DISPLAY_QUOTA_BYTES = 5 * 1024 * 1024 * 1024;
|
|
37171
37159
|
var formatBytes = (bytes) => {
|
|
37172
37160
|
if (bytes === 0) return "0 B";
|
|
37173
37161
|
const k = 1024;
|
|
@@ -37384,20 +37372,22 @@ var estimateStoreSize = async (dbName, storeName) => {
|
|
|
37384
37372
|
const storeConfigs6 = [{ name: storeName, keyPath: "id" }];
|
|
37385
37373
|
try {
|
|
37386
37374
|
const items = await indexedDBService_default.getAll(dbName, 1, storeName, storeConfigs6);
|
|
37387
|
-
|
|
37388
|
-
|
|
37375
|
+
const rawItems = Array.isArray(items) ? items : [];
|
|
37376
|
+
debugLogger.info(`Retrieved ${rawItems.length} items from ${dbName}.${storeName}`);
|
|
37377
|
+
if (rawItems.length === 0) {
|
|
37389
37378
|
debugLogger.info(`No items found in ${dbName}.${storeName}`);
|
|
37390
37379
|
return { size: 0, count: 0 };
|
|
37391
37380
|
}
|
|
37392
|
-
const totalSize =
|
|
37381
|
+
const totalSize = rawItems.reduce((acc, item) => {
|
|
37393
37382
|
try {
|
|
37394
|
-
return acc + JSON.stringify(item).length * 2;
|
|
37383
|
+
return acc + JSON.stringify(item ?? "").length * 2;
|
|
37395
37384
|
} catch {
|
|
37396
37385
|
return acc + 1e3;
|
|
37397
37386
|
}
|
|
37398
37387
|
}, 0);
|
|
37399
|
-
|
|
37400
|
-
|
|
37388
|
+
const itemCount = rawItems.length;
|
|
37389
|
+
debugLogger.info(`Estimated size for ${dbName}.${storeName}: ${totalSize} bytes, ${itemCount} items`);
|
|
37390
|
+
return { size: totalSize, count: itemCount };
|
|
37401
37391
|
} catch (dbError) {
|
|
37402
37392
|
debugLogger.info(`Database ${dbName} or store ${storeName} does not exist or is inaccessible`, { error: dbError });
|
|
37403
37393
|
return { size: 0, count: 0 };
|
|
@@ -37421,14 +37411,18 @@ var clearStorageCategory = async (category) => {
|
|
|
37421
37411
|
}
|
|
37422
37412
|
const storeConfigs6 = [{ name: storeName, keyPath: "id" }];
|
|
37423
37413
|
const items = await indexedDBService_default.getAll(dbName, 1, storeName, storeConfigs6);
|
|
37424
|
-
|
|
37425
|
-
|
|
37426
|
-
|
|
37427
|
-
if (
|
|
37428
|
-
|
|
37414
|
+
const records = Array.isArray(items) ? items : [];
|
|
37415
|
+
if (records.length > 0) {
|
|
37416
|
+
for (const rawItem of records) {
|
|
37417
|
+
if (rawItem && typeof rawItem === "object") {
|
|
37418
|
+
const record = rawItem;
|
|
37419
|
+
const candidate = record["id"] ?? record["key"] ?? record["name"];
|
|
37420
|
+
if (typeof candidate === "string" && candidate.length > 0) {
|
|
37421
|
+
await indexedDBService_default.delete(dbName, 1, storeName, candidate, storeConfigs6);
|
|
37422
|
+
}
|
|
37429
37423
|
}
|
|
37430
37424
|
}
|
|
37431
|
-
debugLogger.info(`Cleared ${
|
|
37425
|
+
debugLogger.info(`Cleared ${records.length} items from ${dbName}.${storeName}`);
|
|
37432
37426
|
} else {
|
|
37433
37427
|
debugLogger.info(`No items found in ${dbName}.${storeName}`);
|
|
37434
37428
|
}
|
|
@@ -37456,7 +37450,12 @@ var clearEntireDatabase = async (dbName) => {
|
|
|
37456
37450
|
};
|
|
37457
37451
|
var StorageTab = ({ currentTheme }) => {
|
|
37458
37452
|
const theme = (0, import_material42.useTheme)();
|
|
37459
|
-
const [storageQuota, setStorageQuota] = (0, import_react52.useState)({
|
|
37453
|
+
const [storageQuota, setStorageQuota] = (0, import_react52.useState)({
|
|
37454
|
+
used: 0,
|
|
37455
|
+
quota: 0,
|
|
37456
|
+
available: 0,
|
|
37457
|
+
browserQuotaEstimate: 0
|
|
37458
|
+
});
|
|
37460
37459
|
const [storageCategories, setStorageCategories] = (0, import_react52.useState)([]);
|
|
37461
37460
|
const [loading, setLoading] = (0, import_react52.useState)(true);
|
|
37462
37461
|
const [clearAllDialogOpen, setClearAllDialogOpen] = (0, import_react52.useState)(false);
|
|
@@ -37465,16 +37464,31 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
37465
37464
|
const [snackbarMessage, setSnackbarMessage] = (0, import_react52.useState)("");
|
|
37466
37465
|
const [showSnackbar, setShowSnackbar] = (0, import_react52.useState)(false);
|
|
37467
37466
|
const [snackbarSeverity, setSnackbarSeverity] = (0, import_react52.useState)("success");
|
|
37467
|
+
const { syncEnabled, isAdvancedVectorFeaturesEnabled } = useConversationSyncStore((state) => ({
|
|
37468
|
+
syncEnabled: state.syncEnabled,
|
|
37469
|
+
isAdvancedVectorFeaturesEnabled: state.isAdvancedVectorFeaturesEnabled
|
|
37470
|
+
}));
|
|
37471
|
+
const syncFeaturesActive = syncEnabled || isAdvancedVectorFeaturesEnabled;
|
|
37472
|
+
const usageSummaryMessage = syncFeaturesActive ? "IndexedDB/local storage is shown below. Conversation sync or advanced vector storage may copy items to your configured gateway." : "IndexedDB/local storage lives entirely in this browser when sync features are disabled.";
|
|
37473
|
+
const storageStatusPrimary = syncFeaturesActive ? "IndexedDB/local storage (sync features enabled)" : "IndexedDB/local storage only";
|
|
37468
37474
|
const loadStorageData = async () => {
|
|
37469
37475
|
setLoading(true);
|
|
37470
37476
|
try {
|
|
37471
37477
|
debugLogger.info("Loading storage data...");
|
|
37472
|
-
const [
|
|
37478
|
+
const [quotaEstimate, categories] = await Promise.all([
|
|
37473
37479
|
getStorageQuota(),
|
|
37474
37480
|
getIndexedDBSize()
|
|
37475
37481
|
]);
|
|
37482
|
+
const calculatedUsed = categories.reduce((sum, cat) => sum + cat.size, 0);
|
|
37483
|
+
const browserQuota = quotaEstimate.quota && quotaEstimate.quota > 0 ? quotaEstimate.quota : 0;
|
|
37484
|
+
let normalizedQuota = browserQuota > 0 ? Math.min(Math.max(browserQuota, calculatedUsed || DEFAULT_DISPLAY_QUOTA_BYTES), MAX_DISPLAY_QUOTA_BYTES) : Math.max(DEFAULT_DISPLAY_QUOTA_BYTES, calculatedUsed);
|
|
37485
|
+
const available = Math.max(normalizedQuota - calculatedUsed, 0);
|
|
37476
37486
|
debugLogger.info("Storage data loaded successfully", {
|
|
37477
|
-
|
|
37487
|
+
browserQuota,
|
|
37488
|
+
browserUsageEstimate: quotaEstimate.used,
|
|
37489
|
+
normalizedQuota,
|
|
37490
|
+
calculatedUsed,
|
|
37491
|
+
available,
|
|
37478
37492
|
categoriesCount: categories.length,
|
|
37479
37493
|
categories: categories.map((cat) => ({
|
|
37480
37494
|
name: cat.name,
|
|
@@ -37483,7 +37497,12 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
37483
37497
|
canClear: cat.canClear
|
|
37484
37498
|
}))
|
|
37485
37499
|
});
|
|
37486
|
-
setStorageQuota(
|
|
37500
|
+
setStorageQuota({
|
|
37501
|
+
used: calculatedUsed,
|
|
37502
|
+
quota: normalizedQuota,
|
|
37503
|
+
available,
|
|
37504
|
+
browserQuotaEstimate: browserQuota
|
|
37505
|
+
});
|
|
37487
37506
|
setStorageCategories(categories);
|
|
37488
37507
|
} catch (error) {
|
|
37489
37508
|
debugLogger.error("Failed to load storage data", { error });
|
|
@@ -37491,7 +37510,7 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
37491
37510
|
setSnackbarSeverity("error");
|
|
37492
37511
|
setShowSnackbar(true);
|
|
37493
37512
|
setStorageCategories([]);
|
|
37494
|
-
setStorageQuota({ used: 0, quota: 0 });
|
|
37513
|
+
setStorageQuota({ used: 0, quota: DEFAULT_DISPLAY_QUOTA_BYTES, available: DEFAULT_DISPLAY_QUOTA_BYTES, browserQuotaEstimate: 0 });
|
|
37495
37514
|
} finally {
|
|
37496
37515
|
setLoading(false);
|
|
37497
37516
|
}
|
|
@@ -37504,7 +37523,7 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
37504
37523
|
}, [storageCategories]);
|
|
37505
37524
|
const usagePercentage = (0, import_react52.useMemo)(() => {
|
|
37506
37525
|
if (storageQuota.quota === 0) return 0;
|
|
37507
|
-
const percentage = storageQuota.used / storageQuota.quota * 100;
|
|
37526
|
+
const percentage = Math.min(storageQuota.used / storageQuota.quota * 100, 100);
|
|
37508
37527
|
return percentage > 0 && percentage < 0.1 ? 0.1 : percentage;
|
|
37509
37528
|
}, [storageQuota]);
|
|
37510
37529
|
const clearableCategories = (0, import_react52.useMemo)(() => {
|
|
@@ -37704,7 +37723,7 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
37704
37723
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
37705
37724
|
import_material42.Chip,
|
|
37706
37725
|
{
|
|
37707
|
-
label: `${formatBytes(storageQuota.
|
|
37726
|
+
label: `${formatBytes(storageQuota.available)} Available`,
|
|
37708
37727
|
color: "success",
|
|
37709
37728
|
size: "small",
|
|
37710
37729
|
variant: "outlined"
|
|
@@ -37718,6 +37737,15 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
37718
37737
|
size: "small",
|
|
37719
37738
|
variant: "outlined"
|
|
37720
37739
|
}
|
|
37740
|
+
),
|
|
37741
|
+
storageQuota.browserQuotaEstimate > 0 && storageQuota.quota > 0 && Math.abs(storageQuota.browserQuotaEstimate - storageQuota.quota) > storageQuota.quota * 0.05 && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
37742
|
+
import_material42.Chip,
|
|
37743
|
+
{
|
|
37744
|
+
label: `\u2248${formatBytes(storageQuota.browserQuotaEstimate)} Browser Estimate`,
|
|
37745
|
+
color: "default",
|
|
37746
|
+
size: "small",
|
|
37747
|
+
variant: "outlined"
|
|
37748
|
+
}
|
|
37721
37749
|
)
|
|
37722
37750
|
] }),
|
|
37723
37751
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
@@ -37775,7 +37803,7 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
37775
37803
|
}
|
|
37776
37804
|
)
|
|
37777
37805
|
] }),
|
|
37778
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Typography, { variant: "body2", color: "text.secondary", sx: { mt: "auto" }, children:
|
|
37806
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Typography, { variant: "body2", color: "text.secondary", sx: { mt: "auto" }, children: usageSummaryMessage })
|
|
37779
37807
|
] }) })
|
|
37780
37808
|
] }),
|
|
37781
37809
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Typography, { variant: "h6", gutterBottom: true, sx: { mb: 2, fontWeight: 600, color: "text.primary" }, children: "Storage Categories" }),
|
|
@@ -37903,12 +37931,19 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
37903
37931
|
] }),
|
|
37904
37932
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.List, { children: [
|
|
37905
37933
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.ListItem, { children: [
|
|
37906
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.ListItemIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
37934
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.ListItemIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
37935
|
+
import_CheckCircle3.default,
|
|
37936
|
+
{
|
|
37937
|
+
sx: {
|
|
37938
|
+
color: syncFeaturesActive ? theme.palette.warning.main : theme.palette.success.main
|
|
37939
|
+
}
|
|
37940
|
+
}
|
|
37941
|
+
) }),
|
|
37907
37942
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
37908
37943
|
import_material42.ListItemText,
|
|
37909
37944
|
{
|
|
37910
|
-
primary:
|
|
37911
|
-
secondary: "
|
|
37945
|
+
primary: storageStatusPrimary,
|
|
37946
|
+
secondary: syncFeaturesActive ? "Some features (conversation sync or advanced vector storage) can sync items to your configured gateway storage." : "With conversation sync and advanced vector storage turned off, everything stays in this browser."
|
|
37912
37947
|
}
|
|
37913
37948
|
)
|
|
37914
37949
|
] }),
|