@burtson-labs/bandit-engine 2.0.165 → 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 +175 -109
- package/dist/chat-provider.js.map +1 -1
- package/dist/chat-provider.mjs +6 -7
- package/dist/{chunk-FEIDGXVR.mjs → chunk-33OSALGS.mjs} +24 -6
- package/dist/{chunk-FEIDGXVR.mjs.map → chunk-33OSALGS.mjs.map} +1 -1
- package/dist/{chunk-LKGBO5OP.mjs → chunk-6KRAPGXE.mjs} +12 -84
- package/dist/chunk-6KRAPGXE.mjs.map +1 -0
- package/dist/{chunk-6VDL4SLX.mjs → chunk-75OBTJPN.mjs} +5 -5
- package/dist/{chunk-QHGGV4KJ.mjs → chunk-A6W6XIDD.mjs} +6 -6
- package/dist/{chunk-J6LSSK3G.mjs → chunk-GRPTCHFN.mjs} +149 -41
- package/dist/chunk-GRPTCHFN.mjs.map +1 -0
- package/dist/{chunk-ASWUEAWM.mjs → chunk-IB2LPSQQ.mjs} +2 -2
- package/dist/{chunk-RNCASZ2Y.mjs → chunk-M4DWPNZZ.mjs} +10 -10
- package/dist/{chunk-NGGTQVGX.mjs → chunk-MM3NRLVR.mjs} +3 -3
- package/dist/{chunk-RLW4RBIR.mjs → chunk-Q2DINRIU.mjs} +4 -4
- package/dist/{chunk-WSUUW7T2.mjs → chunk-WSZE3DDJ.mjs} +7 -7
- package/dist/{chunk-2EM4ATKI.mjs → chunk-YH5YWK4K.mjs} +2 -2
- package/dist/index.d.mts +92 -1
- package/dist/index.d.ts +92 -1
- package/dist/index.js +188 -130
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -20
- package/dist/index.mjs.map +1 -1
- package/dist/management/management.js +159 -120
- package/dist/management/management.js.map +1 -1
- package/dist/management/management.mjs +9 -10
- 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 +149 -30
- package/dist/modals/chat-modal/chat-modal.js.map +1 -1
- package/dist/modals/chat-modal/chat-modal.mjs +5 -6
- 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-M4BVEKUB.mjs +0 -9
- package/dist/chat-EMKHB23B.mjs +0 -16
- package/dist/chunk-BJTO5JO5.mjs +0 -11
- package/dist/chunk-J6LSSK3G.mjs.map +0 -1
- package/dist/chunk-LKGBO5OP.mjs.map +0 -1
- package/dist/modelStore-7YYELPF6.mjs +0 -9
- package/dist/modelStore-7YYELPF6.mjs.map +0 -1
- /package/dist/{aiProviderStore-M4BVEKUB.mjs.map → aiProviderStore-HY5G4QAK.mjs.map} +0 -0
- /package/dist/{chat-EMKHB23B.mjs.map → chat-RCMZYACB.mjs.map} +0 -0
- /package/dist/{chunk-6VDL4SLX.mjs.map → chunk-75OBTJPN.mjs.map} +0 -0
- /package/dist/{chunk-QHGGV4KJ.mjs.map → chunk-A6W6XIDD.mjs.map} +0 -0
- /package/dist/{chunk-ASWUEAWM.mjs.map → chunk-IB2LPSQQ.mjs.map} +0 -0
- /package/dist/{chunk-RNCASZ2Y.mjs.map → chunk-M4DWPNZZ.mjs.map} +0 -0
- /package/dist/{chunk-NGGTQVGX.mjs.map → chunk-MM3NRLVR.mjs.map} +0 -0
- /package/dist/{chunk-RLW4RBIR.mjs.map → chunk-Q2DINRIU.mjs.map} +0 -0
- /package/dist/{chunk-WSUUW7T2.mjs.map → chunk-WSZE3DDJ.mjs.map} +0 -0
- /package/dist/{chunk-2EM4ATKI.mjs.map → chunk-YH5YWK4K.mjs.map} +0 -0
- /package/dist/{chunk-BJTO5JO5.mjs.map → modelStore-F6JQUXGG.mjs.map} +0 -0
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
StreamingMarkdown_default,
|
|
3
3
|
isNativeShell,
|
|
4
4
|
isStandalonePwa
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-IB2LPSQQ.mjs";
|
|
6
6
|
import {
|
|
7
7
|
aiProviderInitService
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-6KRAPGXE.mjs";
|
|
9
9
|
import {
|
|
10
10
|
addMcpServer,
|
|
11
11
|
deleteMcpServer,
|
|
@@ -13,10 +13,10 @@ import {
|
|
|
13
13
|
listMcpServers,
|
|
14
14
|
updateMcpServer,
|
|
15
15
|
useMCPToolsStore
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-MM3NRLVR.mjs";
|
|
17
17
|
import {
|
|
18
18
|
chat_modal_default
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-75OBTJPN.mjs";
|
|
20
20
|
import {
|
|
21
21
|
AlertCircle,
|
|
22
22
|
AlertTriangle,
|
|
@@ -91,7 +91,7 @@ import {
|
|
|
91
91
|
themeSkinIds,
|
|
92
92
|
useNotificationService,
|
|
93
93
|
useVoiceStore
|
|
94
|
-
} from "./chunk-
|
|
94
|
+
} from "./chunk-Q2DINRIU.mjs";
|
|
95
95
|
import {
|
|
96
96
|
TOPICS,
|
|
97
97
|
brandingService_default,
|
|
@@ -102,21 +102,21 @@ import {
|
|
|
102
102
|
useFeatures,
|
|
103
103
|
useKnowledgeStore2 as useKnowledgeStore,
|
|
104
104
|
useVectorStore
|
|
105
|
-
} from "./chunk-
|
|
105
|
+
} from "./chunk-33OSALGS.mjs";
|
|
106
106
|
import {
|
|
107
107
|
indexedDBService_default,
|
|
108
108
|
models,
|
|
109
109
|
useModelStore,
|
|
110
110
|
usePackageSettingsStore,
|
|
111
111
|
usePreferencesStore
|
|
112
|
-
} from "./chunk-
|
|
112
|
+
} from "./chunk-YH5YWK4K.mjs";
|
|
113
113
|
import {
|
|
114
114
|
AIProviderFactory,
|
|
115
115
|
GatewayService,
|
|
116
116
|
authenticationService,
|
|
117
117
|
useAIProviderStore,
|
|
118
118
|
useAuthenticationStore
|
|
119
|
-
} from "./chunk-
|
|
119
|
+
} from "./chunk-GRPTCHFN.mjs";
|
|
120
120
|
import {
|
|
121
121
|
debugLogger
|
|
122
122
|
} from "./chunk-HNXPDIWC.mjs";
|
|
@@ -9516,7 +9516,7 @@ function useManagementAccess() {
|
|
|
9516
9516
|
|
|
9517
9517
|
// src/management/management.tsx
|
|
9518
9518
|
import { jsx as jsx17, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
9519
|
-
var preloadChatPage = () => import("./chat-
|
|
9519
|
+
var preloadChatPage = () => import("./chat-RCMZYACB.mjs");
|
|
9520
9520
|
var buildCapabilitiesUrl = (gatewayApiUrl) => {
|
|
9521
9521
|
const trimmed = gatewayApiUrl.replace(/\/$/, "");
|
|
9522
9522
|
if (trimmed.endsWith("/api")) {
|
|
@@ -10572,4 +10572,4 @@ export {
|
|
|
10572
10572
|
useManagementAccess,
|
|
10573
10573
|
management_default
|
|
10574
10574
|
};
|
|
10575
|
-
//# sourceMappingURL=chunk-
|
|
10575
|
+
//# sourceMappingURL=chunk-M4DWPNZZ.mjs.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
indexedDBService_default,
|
|
3
3
|
usePackageSettingsStore
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-YH5YWK4K.mjs";
|
|
5
5
|
import {
|
|
6
6
|
authenticationService
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-GRPTCHFN.mjs";
|
|
8
8
|
import {
|
|
9
9
|
debugLogger
|
|
10
10
|
} from "./chunk-HNXPDIWC.mjs";
|
|
@@ -387,4 +387,4 @@ export {
|
|
|
387
387
|
discoverMcpTools,
|
|
388
388
|
useMCPToolsStore
|
|
389
389
|
};
|
|
390
|
-
//# sourceMappingURL=chunk-
|
|
390
|
+
//# sourceMappingURL=chunk-MM3NRLVR.mjs.map
|
|
@@ -6,16 +6,16 @@ import {
|
|
|
6
6
|
useMemoryStore,
|
|
7
7
|
useNotification,
|
|
8
8
|
useVectorStore
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-33OSALGS.mjs";
|
|
10
10
|
import {
|
|
11
11
|
useModelStore,
|
|
12
12
|
usePackageSettingsStore,
|
|
13
13
|
usePreferencesStore
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-YH5YWK4K.mjs";
|
|
15
15
|
import {
|
|
16
16
|
GatewayService,
|
|
17
17
|
authenticationService
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-GRPTCHFN.mjs";
|
|
19
19
|
import {
|
|
20
20
|
debugLogger
|
|
21
21
|
} from "./chunk-HNXPDIWC.mjs";
|
|
@@ -7320,4 +7320,4 @@ export {
|
|
|
7320
7320
|
TenantPreview,
|
|
7321
7321
|
useNotificationService
|
|
7322
7322
|
};
|
|
7323
|
-
//# sourceMappingURL=chunk-
|
|
7323
|
+
//# sourceMappingURL=chunk-Q2DINRIU.mjs.map
|
|
@@ -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,19 +68,19 @@ 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
86
|
} from "./chunk-HNXPDIWC.mjs";
|
|
@@ -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
|
|
@@ -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
|
@@ -248,14 +248,105 @@ interface JwtClaims {
|
|
|
248
248
|
* Present when user belongs to a team.
|
|
249
249
|
*/
|
|
250
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;
|
|
251
317
|
}
|
|
252
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;
|
|
253
334
|
getToken(): string | null;
|
|
254
335
|
setToken(token: string): void;
|
|
255
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>;
|
|
256
346
|
isAuthenticated(): boolean;
|
|
257
347
|
isTokenExpired(token: string): boolean;
|
|
258
348
|
parseJwtClaims(token: string): JwtClaims | null;
|
|
349
|
+
private mirror;
|
|
259
350
|
}
|
|
260
351
|
declare const authenticationService: AuthenticationService;
|
|
261
352
|
|
|
@@ -1440,4 +1531,4 @@ declare const useVectorStore: () => {
|
|
|
1440
1531
|
initializeVectorService: () => Promise<void>;
|
|
1441
1532
|
};
|
|
1442
1533
|
|
|
1443
|
-
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
|
@@ -248,14 +248,105 @@ interface JwtClaims {
|
|
|
248
248
|
* Present when user belongs to a team.
|
|
249
249
|
*/
|
|
250
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;
|
|
251
317
|
}
|
|
252
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;
|
|
253
334
|
getToken(): string | null;
|
|
254
335
|
setToken(token: string): void;
|
|
255
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>;
|
|
256
346
|
isAuthenticated(): boolean;
|
|
257
347
|
isTokenExpired(token: string): boolean;
|
|
258
348
|
parseJwtClaims(token: string): JwtClaims | null;
|
|
349
|
+
private mirror;
|
|
259
350
|
}
|
|
260
351
|
declare const authenticationService: AuthenticationService;
|
|
261
352
|
|
|
@@ -1440,4 +1531,4 @@ declare const useVectorStore: () => {
|
|
|
1440
1531
|
initializeVectorService: () => Promise<void>;
|
|
1441
1532
|
};
|
|
1442
1533
|
|
|
1443
|
-
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 };
|