@burtson-labs/bandit-engine 2.0.164 → 2.0.166
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/README.md +4 -1
- package/dist/aiProviderStore-HY5G4QAK.mjs +8 -0
- package/dist/chat-RCMZYACB.mjs +15 -0
- package/dist/chat-provider.js +186 -111
- package/dist/chat-provider.js.map +1 -1
- package/dist/chat-provider.mjs +7 -8
- package/dist/{chunk-J6SWNO7Z.mjs → chunk-33OSALGS.mjs} +25 -7
- package/dist/{chunk-J6SWNO7Z.mjs.map → chunk-33OSALGS.mjs.map} +1 -1
- package/dist/{chunk-5KBTOCQZ.mjs → chunk-6KRAPGXE.mjs} +13 -85
- package/dist/chunk-6KRAPGXE.mjs.map +1 -0
- package/dist/{chunk-VBHI4TJC.mjs → chunk-75OBTJPN.mjs} +6 -6
- package/dist/{chunk-URZSIL7X.mjs → chunk-A6W6XIDD.mjs} +7 -7
- package/dist/{chunk-CQJGUYRW.mjs → chunk-GRPTCHFN.mjs} +150 -42
- package/dist/chunk-GRPTCHFN.mjs.map +1 -0
- package/dist/{chunk-OCVZVBQQ.mjs → chunk-HNXPDIWC.mjs} +12 -3
- package/dist/chunk-HNXPDIWC.mjs.map +1 -0
- package/dist/{chunk-IZX2J65Q.mjs → chunk-IB2LPSQQ.mjs} +2 -2
- package/dist/{chunk-PNQRS5EN.mjs → chunk-M4DWPNZZ.mjs} +11 -11
- package/dist/{chunk-O6P37PFR.mjs → chunk-MM3NRLVR.mjs} +4 -4
- package/dist/{chunk-WLNZL6SP.mjs → chunk-Q2DINRIU.mjs} +6 -6
- package/dist/{chunk-WLNZL6SP.mjs.map → chunk-Q2DINRIU.mjs.map} +1 -1
- package/dist/{chunk-JYBQAKSZ.mjs → chunk-WSZE3DDJ.mjs} +8 -8
- package/dist/{chunk-TY5VL3SG.mjs → chunk-YH5YWK4K.mjs} +3 -3
- package/dist/index.d.mts +97 -4
- package/dist/index.d.ts +97 -4
- package/dist/index.js +200 -133
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -21
- package/dist/index.mjs.map +1 -1
- package/dist/management/management.js +171 -123
- package/dist/management/management.js.map +1 -1
- package/dist/management/management.mjs +10 -11
- package/dist/{memoryUtils-2FVXDSS6.mjs → memoryUtils-HGCYEUCD.mjs} +1 -3
- package/dist/{memoryUtils-2FVXDSS6.mjs.map → memoryUtils-HGCYEUCD.mjs.map} +1 -1
- package/dist/modals/chat-modal/chat-modal.js +161 -33
- package/dist/modals/chat-modal/chat-modal.js.map +1 -1
- package/dist/modals/chat-modal/chat-modal.mjs +6 -7
- package/dist/modelStore-F6JQUXGG.mjs +8 -0
- package/dist/shared/custom-element.mjs +0 -1
- package/docs/03_provider_integration.md +5 -2
- package/package.json +1 -1
- package/dist/aiProviderStore-PEGSX4PK.mjs +0 -9
- package/dist/chat-OSAVW6L2.mjs +0 -16
- package/dist/chunk-5KBTOCQZ.mjs.map +0 -1
- package/dist/chunk-BJTO5JO5.mjs +0 -11
- package/dist/chunk-CQJGUYRW.mjs.map +0 -1
- package/dist/chunk-OCVZVBQQ.mjs.map +0 -1
- package/dist/modelStore-7XYYDCNC.mjs +0 -9
- package/dist/modelStore-7XYYDCNC.mjs.map +0 -1
- /package/dist/{aiProviderStore-PEGSX4PK.mjs.map → aiProviderStore-HY5G4QAK.mjs.map} +0 -0
- /package/dist/{chat-OSAVW6L2.mjs.map → chat-RCMZYACB.mjs.map} +0 -0
- /package/dist/{chunk-VBHI4TJC.mjs.map → chunk-75OBTJPN.mjs.map} +0 -0
- /package/dist/{chunk-URZSIL7X.mjs.map → chunk-A6W6XIDD.mjs.map} +0 -0
- /package/dist/{chunk-IZX2J65Q.mjs.map → chunk-IB2LPSQQ.mjs.map} +0 -0
- /package/dist/{chunk-PNQRS5EN.mjs.map → chunk-M4DWPNZZ.mjs.map} +0 -0
- /package/dist/{chunk-O6P37PFR.mjs.map → chunk-MM3NRLVR.mjs.map} +0 -0
- /package/dist/{chunk-JYBQAKSZ.mjs.map → chunk-WSZE3DDJ.mjs.map} +0 -0
- /package/dist/{chunk-TY5VL3SG.mjs.map → chunk-YH5YWK4K.mjs.map} +0 -0
- /package/dist/{chunk-BJTO5JO5.mjs.map → modelStore-F6JQUXGG.mjs.map} +0 -0
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
StreamingMarkdown_default,
|
|
6
6
|
isNativeShell,
|
|
7
7
|
isStandalonePwa
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-IB2LPSQQ.mjs";
|
|
9
9
|
import {
|
|
10
10
|
useMCPToolsStore
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-MM3NRLVR.mjs";
|
|
12
12
|
import {
|
|
13
13
|
ArrowDown,
|
|
14
14
|
ArrowUp,
|
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
useNotificationService,
|
|
48
48
|
useTTS,
|
|
49
49
|
useVoiceStore
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-Q2DINRIU.mjs";
|
|
51
51
|
import {
|
|
52
52
|
brandingService_default,
|
|
53
53
|
detectMessageMood,
|
|
@@ -68,22 +68,22 @@ import {
|
|
|
68
68
|
useMemoryStore,
|
|
69
69
|
useProjectStore,
|
|
70
70
|
useVectorStore
|
|
71
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-33OSALGS.mjs";
|
|
72
72
|
import {
|
|
73
73
|
indexedDBService_default,
|
|
74
74
|
useModelStore,
|
|
75
75
|
usePackageSettingsStore,
|
|
76
76
|
usePreferencesStore
|
|
77
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-YH5YWK4K.mjs";
|
|
78
78
|
import {
|
|
79
79
|
authenticationService,
|
|
80
80
|
readPersistedToken,
|
|
81
81
|
useAIProviderStore,
|
|
82
82
|
useAuthenticationStore
|
|
83
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-GRPTCHFN.mjs";
|
|
84
84
|
import {
|
|
85
85
|
debugLogger
|
|
86
|
-
} from "./chunk-
|
|
86
|
+
} from "./chunk-HNXPDIWC.mjs";
|
|
87
87
|
|
|
88
88
|
// src/chat/chat.tsx
|
|
89
89
|
import { useCallback as useCallback6, useEffect as useEffect17, useLayoutEffect, useRef as useRef16, useState as useState19 } from "react";
|
|
@@ -11900,4 +11900,4 @@ export {
|
|
|
11900
11900
|
IS_STORE_BUILD,
|
|
11901
11901
|
chat_default
|
|
11902
11902
|
};
|
|
11903
|
-
//# sourceMappingURL=chunk-
|
|
11903
|
+
//# sourceMappingURL=chunk-WSZE3DDJ.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
debugLogger
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-HNXPDIWC.mjs";
|
|
4
4
|
|
|
5
5
|
// src/store/modelStore.ts
|
|
6
6
|
import { create as create3 } from "zustand";
|
|
@@ -357,7 +357,7 @@ var usePreferencesStore = create2((set, get) => ({
|
|
|
357
357
|
}));
|
|
358
358
|
get().savePreferences();
|
|
359
359
|
if (key === "banditModelsEnabled" && prevValue !== value) {
|
|
360
|
-
import("./modelStore-
|
|
360
|
+
import("./modelStore-F6JQUXGG.mjs").then(({ useModelStore: useModelStore2 }) => {
|
|
361
361
|
useModelStore2.getState().handleBanditPersonalitiesPreferenceChange(value);
|
|
362
362
|
});
|
|
363
363
|
}
|
|
@@ -877,4 +877,4 @@ export {
|
|
|
877
877
|
usePreferencesStore,
|
|
878
878
|
useModelStore
|
|
879
879
|
};
|
|
880
|
-
//# sourceMappingURL=chunk-
|
|
880
|
+
//# sourceMappingURL=chunk-YH5YWK4K.mjs.map
|
package/dist/index.d.mts
CHANGED
|
@@ -117,7 +117,8 @@ declare function defineCustomElement<Props extends Record<string, unknown>>(name
|
|
|
117
117
|
* Centralized logging service that provides environment-aware debug logging.
|
|
118
118
|
*
|
|
119
119
|
* Features:
|
|
120
|
-
* - Production builds: Only
|
|
120
|
+
* - Production builds: Only warnings and errors are shown; set
|
|
121
|
+
* localStorage `bandit:debug` to "1" to see info logs too
|
|
121
122
|
* - Development mode: All logs are shown with clear debug prefixes
|
|
122
123
|
* - Consistent formatting for debugging purposes
|
|
123
124
|
* - Clear indication that logs are for debugging
|
|
@@ -147,9 +148,10 @@ declare class DebugLogger {
|
|
|
147
148
|
* DISABLED to prevent console flooding during chat processing
|
|
148
149
|
*/
|
|
149
150
|
debug(message: string, context?: LogContext): void;
|
|
151
|
+
private verboseEnabled;
|
|
150
152
|
/**
|
|
151
|
-
* Info logs - shown in
|
|
152
|
-
*
|
|
153
|
+
* Info logs - shown in development, or in production when localStorage
|
|
154
|
+
* `bandit:debug` is "1"
|
|
153
155
|
*/
|
|
154
156
|
info(message: string, context?: LogContext): void;
|
|
155
157
|
/**
|
|
@@ -246,14 +248,105 @@ interface JwtClaims {
|
|
|
246
248
|
* Present when user belongs to a team.
|
|
247
249
|
*/
|
|
248
250
|
teamId?: string;
|
|
251
|
+
/**
|
|
252
|
+
* Identifiers of the teams this user OWNS (Team.createdBy == email).
|
|
253
|
+
* Present only when the user owns at least one team.
|
|
254
|
+
*/
|
|
255
|
+
ownedTeamIds?: string[];
|
|
256
|
+
/**
|
|
257
|
+
* Host domains this token can reach — tenant workspaces appear here as
|
|
258
|
+
* "{slug}.banditai.ai". The tenant app gates access on this claim.
|
|
259
|
+
*/
|
|
260
|
+
domains?: string[];
|
|
261
|
+
/**
|
|
262
|
+
* Current subscription tier inferred from the JWT.
|
|
263
|
+
*/
|
|
264
|
+
subscriptionType?: string;
|
|
265
|
+
/**
|
|
266
|
+
* Indicates whether the subscription is active.
|
|
267
|
+
*/
|
|
268
|
+
isSubscribed?: boolean;
|
|
269
|
+
/**
|
|
270
|
+
* Optional avatar reference (an S3 app-asset id) for the user's profile
|
|
271
|
+
* picture. Resolved to an image via the file-storage download endpoint.
|
|
272
|
+
*/
|
|
273
|
+
avatarUrl?: string;
|
|
274
|
+
}
|
|
275
|
+
declare const TOKEN_KEY = "authToken";
|
|
276
|
+
declare const AUTH_TOKEN_CHANGED_EVENT = "bandit:auth-token-changed";
|
|
277
|
+
/**
|
|
278
|
+
* Where the live access token is kept.
|
|
279
|
+
*
|
|
280
|
+
* - `localStorage` — the historical contract: the JWT is persisted under
|
|
281
|
+
* `authToken` and readable by any script on the page. Default, so npm
|
|
282
|
+
* consumers that wire `tokenFactory: () => localStorage.getItem("authToken")`
|
|
283
|
+
* keep working unchanged.
|
|
284
|
+
* - `memory` — the JWT lives only in the auth store for the life of the page.
|
|
285
|
+
* The host app is responsible for restoring it at boot (an HttpOnly refresh
|
|
286
|
+
* cookie, secure native storage, ...) through a `TokenPersistence` and a
|
|
287
|
+
* `refresh` handler. Nothing token-shaped is written to Web Storage.
|
|
288
|
+
*/
|
|
289
|
+
type TokenStorageMode = "localStorage" | "memory";
|
|
290
|
+
/**
|
|
291
|
+
* Optional write-through mirror of the live token. Used by the native shell
|
|
292
|
+
* to keep the session in the OS keychain / Android Keystore instead of the
|
|
293
|
+
* WebView's localStorage. Failures are the host's to handle; the in-memory
|
|
294
|
+
* session is already valid when these run.
|
|
295
|
+
*/
|
|
296
|
+
interface TokenPersistence {
|
|
297
|
+
write(token: string): void | Promise<void>;
|
|
298
|
+
clear(): void | Promise<void>;
|
|
299
|
+
}
|
|
300
|
+
interface AuthSessionHandlers {
|
|
301
|
+
/**
|
|
302
|
+
* Obtain a fresh access token silently (refresh cookie, device token, ...).
|
|
303
|
+
* Resolve `true` after calling `setToken` with the new token, `false` when
|
|
304
|
+
* an interactive sign-in is needed. Deduplicated by the service.
|
|
305
|
+
*/
|
|
306
|
+
refresh?: () => Promise<boolean>;
|
|
307
|
+
/**
|
|
308
|
+
* Runs synchronously inside `clearToken()`, before the token is dropped,
|
|
309
|
+
* with the token being dropped — the moment to revoke it server-side.
|
|
310
|
+
*/
|
|
311
|
+
beforeClear?: (token: string | null) => void;
|
|
312
|
+
}
|
|
313
|
+
interface AuthSessionConfig {
|
|
314
|
+
storage: TokenStorageMode;
|
|
315
|
+
persistence?: TokenPersistence | null;
|
|
316
|
+
handlers?: AuthSessionHandlers;
|
|
249
317
|
}
|
|
250
318
|
declare class AuthenticationService {
|
|
319
|
+
private storageMode;
|
|
320
|
+
private persistence;
|
|
321
|
+
private handlers;
|
|
322
|
+
/** Bumped on every setToken/clearToken; async flows compare it to detect a superseded session. */
|
|
323
|
+
private revision;
|
|
324
|
+
private refreshInFlight;
|
|
325
|
+
private lastPersist;
|
|
326
|
+
/**
|
|
327
|
+
* Pick the storage contract for this host. Call once at boot, before the
|
|
328
|
+
* first `setToken`. Switching modes never moves a token by itself: the
|
|
329
|
+
* host migrates (e.g. reads the legacy localStorage value, then clears it).
|
|
330
|
+
*/
|
|
331
|
+
configureSession(config: AuthSessionConfig): void;
|
|
332
|
+
getStorageMode(): TokenStorageMode;
|
|
333
|
+
getSessionRevision(): number;
|
|
251
334
|
getToken(): string | null;
|
|
252
335
|
setToken(token: string): void;
|
|
253
336
|
clearToken(): void;
|
|
337
|
+
/** True when the host registered a silent refresh path. */
|
|
338
|
+
canRefresh(): boolean;
|
|
339
|
+
/**
|
|
340
|
+
* Ask the host for a fresh token. Concurrent callers share one attempt.
|
|
341
|
+
* Resolves false when no refresh path exists or it did not produce a token.
|
|
342
|
+
*/
|
|
343
|
+
tryRefresh(): Promise<boolean>;
|
|
344
|
+
/** Resolves once the most recent persistence write/clear has settled. */
|
|
345
|
+
whenPersisted(): Promise<void>;
|
|
254
346
|
isAuthenticated(): boolean;
|
|
255
347
|
isTokenExpired(token: string): boolean;
|
|
256
348
|
parseJwtClaims(token: string): JwtClaims | null;
|
|
349
|
+
private mirror;
|
|
257
350
|
}
|
|
258
351
|
declare const authenticationService: AuthenticationService;
|
|
259
352
|
|
|
@@ -1438,4 +1531,4 @@ declare const useVectorStore: () => {
|
|
|
1438
1531
|
initializeVectorService: () => Promise<void>;
|
|
1439
1532
|
};
|
|
1440
1533
|
|
|
1441
|
-
export { Chat, type CreateMemoryOptions, DebugLogger, FeatureEvaluation, FeatureFlagConfig, FeatureFlagContext, type FeatureFlagContextValue, FeatureFlagProvider, type FeatureFlagProviderProps, FeatureFlagService, FeatureKey, FeedbackButton, type FeedbackButtonProps, type FeedbackCategories, FeedbackModal, type FeedbackModalProps, type FeedbackPriorities, type FeedbackRequest, type FeedbackResponse, type FileUploadResult, type GatewayQueryOptions, InterestsEditor, type LogContext, MANAGEMENT_SECTIONS, Management, type ManagementAccess, type ManagementAccessInput, type ManagementLink, type ManagementProps, type ManagementRequest, type ManagementSectionDef, type ManagementSectionId, type MemorySearchFilters, type MigrationProgress, type MigrationStatus, type NotificationConfig, type NotificationContextType, NotificationProvider, type NotificationProviderProps, NotificationService, SYSTEM_FLAGS, type SearchOptions, type SearchResult, StreamingTTSClient, SubscriptionExpiredGuard, type SubscriptionExpiredGuardProps, SubscriptionExpiredModal, type SubscriptionExpiredModalProps, SubscriptionTier, type TTSOptions, type TTSProgress, TTSState, TrialUsage, type UploadRequest, type UseTTSReturn, VectorDatabaseService, type VectorDocument, type VectorMemory, type VectorMemoryMetadata, VectorMigrationService, type VectorStoreStatus, type VoiceState, authenticationService, debugLogger, defineCustomElement, featureFlagService, getCriticalConfig, getFeatureMatrix, getStreamingTTSClient, getSystemConstants, getTTSState, handleHttpError, handleSubscriptionUpgrade, handleValidationError, initializeCoreSystem, isWorkspaceAdminRole, notificationService, pauseTTS, previewTierUpgrade, resolveManagementSections, resumeTTS, showInfoNotification, showSuccessNotification, speakStream as speakWithStreaming, stopTTS, syncSubscriptionWithAPI, updateSubscriptionTier, useFeatureFlag, useFeatureVisibility, useFeatures, useGatewayHealth, useGatewayMemory, useGatewayModels, useGlobalTTS, useManagementAccess, useNotification, useNotificationService, useTTS, useVectorStore, useVoiceStore, useVoices, validateEnvironment, validateSystemIntegrity, vectorDatabaseService, vectorMigrationService };
|
|
1534
|
+
export { AUTH_TOKEN_CHANGED_EVENT, type AuthSessionConfig, type AuthSessionHandlers, Chat, type CreateMemoryOptions, DebugLogger, FeatureEvaluation, FeatureFlagConfig, FeatureFlagContext, type FeatureFlagContextValue, FeatureFlagProvider, type FeatureFlagProviderProps, FeatureFlagService, FeatureKey, FeedbackButton, type FeedbackButtonProps, type FeedbackCategories, FeedbackModal, type FeedbackModalProps, type FeedbackPriorities, type FeedbackRequest, type FeedbackResponse, type FileUploadResult, type GatewayQueryOptions, InterestsEditor, type JwtClaims, type LogContext, MANAGEMENT_SECTIONS, Management, type ManagementAccess, type ManagementAccessInput, type ManagementLink, type ManagementProps, type ManagementRequest, type ManagementSectionDef, type ManagementSectionId, type MemorySearchFilters, type MigrationProgress, type MigrationStatus, type NotificationConfig, type NotificationContextType, NotificationProvider, type NotificationProviderProps, NotificationService, SYSTEM_FLAGS, type SearchOptions, type SearchResult, StreamingTTSClient, SubscriptionExpiredGuard, type SubscriptionExpiredGuardProps, SubscriptionExpiredModal, type SubscriptionExpiredModalProps, SubscriptionTier, TOKEN_KEY, type TTSOptions, type TTSProgress, TTSState, type TokenPersistence, type TokenStorageMode, TrialUsage, type UploadRequest, type UseTTSReturn, VectorDatabaseService, type VectorDocument, type VectorMemory, type VectorMemoryMetadata, VectorMigrationService, type VectorStoreStatus, type VoiceState, authenticationService, debugLogger, defineCustomElement, featureFlagService, getCriticalConfig, getFeatureMatrix, getStreamingTTSClient, getSystemConstants, getTTSState, handleHttpError, handleSubscriptionUpgrade, handleValidationError, initializeCoreSystem, isWorkspaceAdminRole, notificationService, pauseTTS, previewTierUpgrade, resolveManagementSections, resumeTTS, showInfoNotification, showSuccessNotification, speakStream as speakWithStreaming, stopTTS, syncSubscriptionWithAPI, updateSubscriptionTier, useFeatureFlag, useFeatureVisibility, useFeatures, useGatewayHealth, useGatewayMemory, useGatewayModels, useGlobalTTS, useManagementAccess, useNotification, useNotificationService, useTTS, useVectorStore, useVoiceStore, useVoices, validateEnvironment, validateSystemIntegrity, vectorDatabaseService, vectorMigrationService };
|
package/dist/index.d.ts
CHANGED
|
@@ -117,7 +117,8 @@ declare function defineCustomElement<Props extends Record<string, unknown>>(name
|
|
|
117
117
|
* Centralized logging service that provides environment-aware debug logging.
|
|
118
118
|
*
|
|
119
119
|
* Features:
|
|
120
|
-
* - Production builds: Only
|
|
120
|
+
* - Production builds: Only warnings and errors are shown; set
|
|
121
|
+
* localStorage `bandit:debug` to "1" to see info logs too
|
|
121
122
|
* - Development mode: All logs are shown with clear debug prefixes
|
|
122
123
|
* - Consistent formatting for debugging purposes
|
|
123
124
|
* - Clear indication that logs are for debugging
|
|
@@ -147,9 +148,10 @@ declare class DebugLogger {
|
|
|
147
148
|
* DISABLED to prevent console flooding during chat processing
|
|
148
149
|
*/
|
|
149
150
|
debug(message: string, context?: LogContext): void;
|
|
151
|
+
private verboseEnabled;
|
|
150
152
|
/**
|
|
151
|
-
* Info logs - shown in
|
|
152
|
-
*
|
|
153
|
+
* Info logs - shown in development, or in production when localStorage
|
|
154
|
+
* `bandit:debug` is "1"
|
|
153
155
|
*/
|
|
154
156
|
info(message: string, context?: LogContext): void;
|
|
155
157
|
/**
|
|
@@ -246,14 +248,105 @@ interface JwtClaims {
|
|
|
246
248
|
* Present when user belongs to a team.
|
|
247
249
|
*/
|
|
248
250
|
teamId?: string;
|
|
251
|
+
/**
|
|
252
|
+
* Identifiers of the teams this user OWNS (Team.createdBy == email).
|
|
253
|
+
* Present only when the user owns at least one team.
|
|
254
|
+
*/
|
|
255
|
+
ownedTeamIds?: string[];
|
|
256
|
+
/**
|
|
257
|
+
* Host domains this token can reach — tenant workspaces appear here as
|
|
258
|
+
* "{slug}.banditai.ai". The tenant app gates access on this claim.
|
|
259
|
+
*/
|
|
260
|
+
domains?: string[];
|
|
261
|
+
/**
|
|
262
|
+
* Current subscription tier inferred from the JWT.
|
|
263
|
+
*/
|
|
264
|
+
subscriptionType?: string;
|
|
265
|
+
/**
|
|
266
|
+
* Indicates whether the subscription is active.
|
|
267
|
+
*/
|
|
268
|
+
isSubscribed?: boolean;
|
|
269
|
+
/**
|
|
270
|
+
* Optional avatar reference (an S3 app-asset id) for the user's profile
|
|
271
|
+
* picture. Resolved to an image via the file-storage download endpoint.
|
|
272
|
+
*/
|
|
273
|
+
avatarUrl?: string;
|
|
274
|
+
}
|
|
275
|
+
declare const TOKEN_KEY = "authToken";
|
|
276
|
+
declare const AUTH_TOKEN_CHANGED_EVENT = "bandit:auth-token-changed";
|
|
277
|
+
/**
|
|
278
|
+
* Where the live access token is kept.
|
|
279
|
+
*
|
|
280
|
+
* - `localStorage` — the historical contract: the JWT is persisted under
|
|
281
|
+
* `authToken` and readable by any script on the page. Default, so npm
|
|
282
|
+
* consumers that wire `tokenFactory: () => localStorage.getItem("authToken")`
|
|
283
|
+
* keep working unchanged.
|
|
284
|
+
* - `memory` — the JWT lives only in the auth store for the life of the page.
|
|
285
|
+
* The host app is responsible for restoring it at boot (an HttpOnly refresh
|
|
286
|
+
* cookie, secure native storage, ...) through a `TokenPersistence` and a
|
|
287
|
+
* `refresh` handler. Nothing token-shaped is written to Web Storage.
|
|
288
|
+
*/
|
|
289
|
+
type TokenStorageMode = "localStorage" | "memory";
|
|
290
|
+
/**
|
|
291
|
+
* Optional write-through mirror of the live token. Used by the native shell
|
|
292
|
+
* to keep the session in the OS keychain / Android Keystore instead of the
|
|
293
|
+
* WebView's localStorage. Failures are the host's to handle; the in-memory
|
|
294
|
+
* session is already valid when these run.
|
|
295
|
+
*/
|
|
296
|
+
interface TokenPersistence {
|
|
297
|
+
write(token: string): void | Promise<void>;
|
|
298
|
+
clear(): void | Promise<void>;
|
|
299
|
+
}
|
|
300
|
+
interface AuthSessionHandlers {
|
|
301
|
+
/**
|
|
302
|
+
* Obtain a fresh access token silently (refresh cookie, device token, ...).
|
|
303
|
+
* Resolve `true` after calling `setToken` with the new token, `false` when
|
|
304
|
+
* an interactive sign-in is needed. Deduplicated by the service.
|
|
305
|
+
*/
|
|
306
|
+
refresh?: () => Promise<boolean>;
|
|
307
|
+
/**
|
|
308
|
+
* Runs synchronously inside `clearToken()`, before the token is dropped,
|
|
309
|
+
* with the token being dropped — the moment to revoke it server-side.
|
|
310
|
+
*/
|
|
311
|
+
beforeClear?: (token: string | null) => void;
|
|
312
|
+
}
|
|
313
|
+
interface AuthSessionConfig {
|
|
314
|
+
storage: TokenStorageMode;
|
|
315
|
+
persistence?: TokenPersistence | null;
|
|
316
|
+
handlers?: AuthSessionHandlers;
|
|
249
317
|
}
|
|
250
318
|
declare class AuthenticationService {
|
|
319
|
+
private storageMode;
|
|
320
|
+
private persistence;
|
|
321
|
+
private handlers;
|
|
322
|
+
/** Bumped on every setToken/clearToken; async flows compare it to detect a superseded session. */
|
|
323
|
+
private revision;
|
|
324
|
+
private refreshInFlight;
|
|
325
|
+
private lastPersist;
|
|
326
|
+
/**
|
|
327
|
+
* Pick the storage contract for this host. Call once at boot, before the
|
|
328
|
+
* first `setToken`. Switching modes never moves a token by itself: the
|
|
329
|
+
* host migrates (e.g. reads the legacy localStorage value, then clears it).
|
|
330
|
+
*/
|
|
331
|
+
configureSession(config: AuthSessionConfig): void;
|
|
332
|
+
getStorageMode(): TokenStorageMode;
|
|
333
|
+
getSessionRevision(): number;
|
|
251
334
|
getToken(): string | null;
|
|
252
335
|
setToken(token: string): void;
|
|
253
336
|
clearToken(): void;
|
|
337
|
+
/** True when the host registered a silent refresh path. */
|
|
338
|
+
canRefresh(): boolean;
|
|
339
|
+
/**
|
|
340
|
+
* Ask the host for a fresh token. Concurrent callers share one attempt.
|
|
341
|
+
* Resolves false when no refresh path exists or it did not produce a token.
|
|
342
|
+
*/
|
|
343
|
+
tryRefresh(): Promise<boolean>;
|
|
344
|
+
/** Resolves once the most recent persistence write/clear has settled. */
|
|
345
|
+
whenPersisted(): Promise<void>;
|
|
254
346
|
isAuthenticated(): boolean;
|
|
255
347
|
isTokenExpired(token: string): boolean;
|
|
256
348
|
parseJwtClaims(token: string): JwtClaims | null;
|
|
349
|
+
private mirror;
|
|
257
350
|
}
|
|
258
351
|
declare const authenticationService: AuthenticationService;
|
|
259
352
|
|
|
@@ -1438,4 +1531,4 @@ declare const useVectorStore: () => {
|
|
|
1438
1531
|
initializeVectorService: () => Promise<void>;
|
|
1439
1532
|
};
|
|
1440
1533
|
|
|
1441
|
-
export { Chat, type CreateMemoryOptions, DebugLogger, FeatureEvaluation, FeatureFlagConfig, FeatureFlagContext, type FeatureFlagContextValue, FeatureFlagProvider, type FeatureFlagProviderProps, FeatureFlagService, FeatureKey, FeedbackButton, type FeedbackButtonProps, type FeedbackCategories, FeedbackModal, type FeedbackModalProps, type FeedbackPriorities, type FeedbackRequest, type FeedbackResponse, type FileUploadResult, type GatewayQueryOptions, InterestsEditor, type LogContext, MANAGEMENT_SECTIONS, Management, type ManagementAccess, type ManagementAccessInput, type ManagementLink, type ManagementProps, type ManagementRequest, type ManagementSectionDef, type ManagementSectionId, type MemorySearchFilters, type MigrationProgress, type MigrationStatus, type NotificationConfig, type NotificationContextType, NotificationProvider, type NotificationProviderProps, NotificationService, SYSTEM_FLAGS, type SearchOptions, type SearchResult, StreamingTTSClient, SubscriptionExpiredGuard, type SubscriptionExpiredGuardProps, SubscriptionExpiredModal, type SubscriptionExpiredModalProps, SubscriptionTier, type TTSOptions, type TTSProgress, TTSState, TrialUsage, type UploadRequest, type UseTTSReturn, VectorDatabaseService, type VectorDocument, type VectorMemory, type VectorMemoryMetadata, VectorMigrationService, type VectorStoreStatus, type VoiceState, authenticationService, debugLogger, defineCustomElement, featureFlagService, getCriticalConfig, getFeatureMatrix, getStreamingTTSClient, getSystemConstants, getTTSState, handleHttpError, handleSubscriptionUpgrade, handleValidationError, initializeCoreSystem, isWorkspaceAdminRole, notificationService, pauseTTS, previewTierUpgrade, resolveManagementSections, resumeTTS, showInfoNotification, showSuccessNotification, speakStream as speakWithStreaming, stopTTS, syncSubscriptionWithAPI, updateSubscriptionTier, useFeatureFlag, useFeatureVisibility, useFeatures, useGatewayHealth, useGatewayMemory, useGatewayModels, useGlobalTTS, useManagementAccess, useNotification, useNotificationService, useTTS, useVectorStore, useVoiceStore, useVoices, validateEnvironment, validateSystemIntegrity, vectorDatabaseService, vectorMigrationService };
|
|
1534
|
+
export { AUTH_TOKEN_CHANGED_EVENT, type AuthSessionConfig, type AuthSessionHandlers, Chat, type CreateMemoryOptions, DebugLogger, FeatureEvaluation, FeatureFlagConfig, FeatureFlagContext, type FeatureFlagContextValue, FeatureFlagProvider, type FeatureFlagProviderProps, FeatureFlagService, FeatureKey, FeedbackButton, type FeedbackButtonProps, type FeedbackCategories, FeedbackModal, type FeedbackModalProps, type FeedbackPriorities, type FeedbackRequest, type FeedbackResponse, type FileUploadResult, type GatewayQueryOptions, InterestsEditor, type JwtClaims, type LogContext, MANAGEMENT_SECTIONS, Management, type ManagementAccess, type ManagementAccessInput, type ManagementLink, type ManagementProps, type ManagementRequest, type ManagementSectionDef, type ManagementSectionId, type MemorySearchFilters, type MigrationProgress, type MigrationStatus, type NotificationConfig, type NotificationContextType, NotificationProvider, type NotificationProviderProps, NotificationService, SYSTEM_FLAGS, type SearchOptions, type SearchResult, StreamingTTSClient, SubscriptionExpiredGuard, type SubscriptionExpiredGuardProps, SubscriptionExpiredModal, type SubscriptionExpiredModalProps, SubscriptionTier, TOKEN_KEY, type TTSOptions, type TTSProgress, TTSState, type TokenPersistence, type TokenStorageMode, TrialUsage, type UploadRequest, type UseTTSReturn, VectorDatabaseService, type VectorDocument, type VectorMemory, type VectorMemoryMetadata, VectorMigrationService, type VectorStoreStatus, type VoiceState, authenticationService, debugLogger, defineCustomElement, featureFlagService, getCriticalConfig, getFeatureMatrix, getStreamingTTSClient, getSystemConstants, getTTSState, handleHttpError, handleSubscriptionUpgrade, handleValidationError, initializeCoreSystem, isWorkspaceAdminRole, notificationService, pauseTTS, previewTierUpgrade, resolveManagementSections, resumeTTS, showInfoNotification, showSuccessNotification, speakStream as speakWithStreaming, stopTTS, syncSubscriptionWithAPI, updateSubscriptionTier, useFeatureFlag, useFeatureVisibility, useFeatures, useGatewayHealth, useGatewayMemory, useGatewayModels, useGlobalTTS, useManagementAccess, useNotification, useNotificationService, useTTS, useVectorStore, useVoiceStore, useVoices, validateEnvironment, validateSystemIntegrity, vectorDatabaseService, vectorMigrationService };
|