@digilogiclabs/platform-core 1.14.0 → 1.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,10 @@
1
- import { p as ILogger, q as IMetrics, I as IPlatform, P as PlatformHealthStatus, u as MetricsSummary, v as ICrypto, w as EncryptOptions, x as EncryptedField, D as DeterministicEncryptedField, K as KeyRotationResult, y as CryptoKeyMetadata, e as IDatabase, k as IQueryBuilder, Q as QueryResult, l as ICache, m as IStorage, U as UploadOptions, S as StorageFile, n as IEmail, t as EmailMessage, z as EmailResult, o as IQueue, s as JobOptions, J as Job, R as RepeatOptions, A as JobState, B as JobEventType, F as JobEventHandler, G as IAI, H as AIConfig, L as AIChatRequest, O as AIChatResponse, T as AIStreamChunk, V as AIStreamCallback, W as AICompletionRequest, X as AICompletionResponse, Y as AIEmbeddingRequest, Z as AIEmbeddingResponse, _ as AIModelConfig, $ as AIModelType, a0 as AIProvider, a1 as IRAG, a2 as RAGConfig, a3 as CreateCollectionOptions, a4 as RAGCollection, a5 as RAGDocument, a6 as IngestionOptions, a7 as BulkIngestionResult, a8 as IngestionResult, a9 as DocumentStatus, aa as RAGChunk, ab as RAGSearchQuery, ac as RAGSearchResponse, ad as RAGSearchResult, ae as ContextAssemblyConfig, af as AssembledContext, ag as RAGPipeline } from './ConsoleEmail-CqXhZmFN.js';
2
- export { aI as AIChatChoice, br as AIConfigSchema, aO as AIError, aN as AIErrorCode, aC as AIErrorMessages, aJ as AIFinishReason, aF as AIMessage, bk as AIProviderSchema, aE as AIRole, aM as AIRouterConfig, aH as AITool, aG as AIToolCall, aK as AIUsageInfo, am as BackoffOptions, by as BulkheadConfigSchema, bI as CacheConfig, bn as CacheConfigSchema, be as CacheProviderSchema, aS as ChunkingConfig, aQ as ChunkingPresets, aR as ChunkingStrategy, bw as CircuitBreakerConfigSchema, C as ConsoleEmail, h as ConsoleLogger, aX as CryptoAlgorithm, bP as CryptoConfig, bt as CryptoConfigSchema, aW as CryptoKeyStatus, bH as DatabaseConfig, bm as DatabaseConfigSchema, bd as DatabaseProviderSchema, b7 as EmailAddress, b8 as EmailAttachment, bK as EmailConfig, bp as EmailConfigSchema, bg as EmailProviderSchema, E as EnvSecrets, aw as GetSecretOptions, as as HistogramStats, ah as ICacheOptions, r as ISecrets, b1 as ISpan, b0 as ITracing, aj as JobContext, ak as JobEvent, ai as JobResult, ap as LogEntry, an as LogLevel, bj as LogLevelSchema, ao as LogMeta, aq as LoggerConfig, bA as LoggingConfigSchema, aD as MemoryAI, a as MemoryCache, M as MemoryDatabase, c as MemoryEmail, i as MemoryMetrics, d as MemoryQueue, aP as MemoryRAG, f as MemorySecrets, b as MemoryStorage, a_ as MemoryTracing, ar as MetricTags, bB as MetricsConfigSchema, bO as MiddlewareConfig, bE as MiddlewareConfigSchema, N as NoopLogger, j as NoopMetrics, a$ as NoopTracing, bN as ObservabilityConfig, bD as ObservabilityConfigSchema, bG as PlatformConfig, bF as PlatformConfigSchema, bL as QueueConfig, bq as QueueConfigSchema, bh as QueueProviderSchema, al as QueueStats, bs as RAGConfigSchema, aU as RAGFilter, aV as RAGPipelineStep, bl as RAGProviderSchema, bM as ResilienceConfig, bz as ResilienceConfigSchema, bv as RetryConfigSchema, ay as RotateSecretOptions, az as RotationResult, aL as RoutingStrategy, aT as SearchMode, au as Secret, av as SecretMetadata, bQ as SecurityConfig, bu as SecurityConfigSchema, ax as SetSecretOptions, b2 as SpanContext, bc as SpanEvent, b5 as SpanKind, b3 as SpanOptions, b4 as SpanStatus, bb as SpanStatusCode, bJ as StorageConfig, bo as StorageConfigSchema, bf as StorageProviderSchema, bx as TimeoutConfigSchema, at as TimingStats, b6 as TracingConfig, bC as TracingConfigSchema, bi as TracingProviderSchema, b9 as calculateBackoff, aA as createAIError, g as createPlatform, aY as createPlatformAsync, aZ as createScopedMetrics, ba as generateJobId, bU as getDefaultConfig, aB as isAIError, bR as loadConfig, bT as safeValidateConfig, bS as validateConfig } from './ConsoleEmail-CqXhZmFN.js';
1
+ import { m as IMetrics, I as IPlatform, P as PlatformHealthStatus, q as MetricsSummary, r as ICrypto, s as EncryptOptions, t as EncryptedField, D as DeterministicEncryptedField, K as KeyRotationResult, u as CryptoKeyMetadata, e as IDatabase, i as IQueryBuilder, Q as QueryResult, j as IStorage, U as UploadOptions, S as StorageFile, k as IEmail, p as EmailMessage, v as EmailResult, l as IQueue, o as JobOptions, J as Job, R as RepeatOptions, w as JobState, x as JobEventType, y as JobEventHandler, z as IRAG, A as RAGConfig, B as CreateCollectionOptions, F as RAGCollection, G as RAGDocument, H as IngestionOptions, L as BulkIngestionResult, O as IngestionResult, T as DocumentStatus, V as RAGChunk, W as RAGSearchQuery, X as RAGSearchResponse, Y as RAGSearchResult, Z as ContextAssemblyConfig, _ as AssembledContext, $ as RAGPipeline } from './ConsoleEmail-CO0OM4UT.js';
2
+ export { aH as AIConfigSchema, aA as AIProviderSchema, a4 as BackoffOptions, aO as BulkheadConfigSchema, aY as CacheConfig, aD as CacheConfigSchema, au as CacheProviderSchema, ah as ChunkingConfig, af as ChunkingPresets, ag as ChunkingStrategy, aM as CircuitBreakerConfigSchema, C as ConsoleEmail, am as CryptoAlgorithm, b3 as CryptoConfig, aJ as CryptoConfigSchema, al as CryptoKeyStatus, aX as DatabaseConfig, aC as DatabaseConfigSchema, at as DatabaseProviderSchema, ap as EmailAddress, aq as EmailAttachment, a_ as EmailConfig, aF as EmailConfigSchema, aw as EmailProviderSchema, E as EnvSecrets, aa as GetSecretOptions, a6 as HistogramStats, n as ISecrets, a1 as JobContext, a2 as JobEvent, a0 as JobResult, az as LogLevelSchema, aQ as LoggingConfigSchema, a as MemoryCache, M as MemoryDatabase, c as MemoryEmail, h as MemoryMetrics, d as MemoryQueue, ae as MemoryRAG, f as MemorySecrets, b as MemoryStorage, a5 as MetricTags, aR as MetricsConfigSchema, b2 as MiddlewareConfig, aU as MiddlewareConfigSchema, N as NoopMetrics, b1 as ObservabilityConfig, aT as ObservabilityConfigSchema, aW as PlatformConfig, aV as PlatformConfigSchema, a$ as QueueConfig, aG as QueueConfigSchema, ax as QueueProviderSchema, a3 as QueueStats, aI as RAGConfigSchema, aj as RAGFilter, ak as RAGPipelineStep, aB as RAGProviderSchema, b0 as ResilienceConfig, aP as ResilienceConfigSchema, aL as RetryConfigSchema, ac as RotateSecretOptions, ad as RotationResult, ai as SearchMode, a8 as Secret, a9 as SecretMetadata, b4 as SecurityConfig, aK as SecurityConfigSchema, ab as SetSecretOptions, aZ as StorageConfig, aE as StorageConfigSchema, av as StorageProviderSchema, aN as TimeoutConfigSchema, a7 as TimingStats, aS as TracingConfigSchema, ay as TracingProviderSchema, ar as calculateBackoff, g as createPlatform, an as createPlatformAsync, ao as createScopedMetrics, as as generateJobId, b8 as getDefaultConfig, b5 as loadConfig, b7 as safeValidateConfig, b6 as validateConfig } from './ConsoleEmail-CO0OM4UT.js';
3
+ import { a as ILogger, I as ICache, c as IAI, A as AIConfig, d as AIChatRequest, e as AIChatResponse, f as AIStreamChunk, g as AIStreamCallback, h as AICompletionRequest, i as AICompletionResponse, j as AIEmbeddingRequest, k as AIEmbeddingResponse, l as AIModelConfig, m as AIModelType, n as AIProvider } from './IAI-D8wA_i8N.js';
4
+ export { z as AIChatChoice, G as AIError, F as AIErrorCode, u as AIErrorMessages, B as AIFinishReason, w as AIMessage, v as AIRole, E as AIRouterConfig, y as AITool, x as AIToolCall, D as AIUsageInfo, C as ConsoleLogger, o as ICacheOptions, K as ISpan, b as ITracing, q as LogEntry, L as LogLevel, p as LogMeta, r as LoggerConfig, M as MemoryAI, H as MemoryTracing, N as NoopLogger, J as NoopTracing, R as RoutingStrategy, S as SpanContext, V as SpanEvent, Q as SpanKind, O as SpanOptions, P as SpanStatus, U as SpanStatusCode, T as TracingConfig, s as createAIError, t as isAIError } from './IAI-D8wA_i8N.js';
3
5
  export { w as IMigrationDatabase, I as IMigrator, q as Migration, r as MigrationRecord, t as MigrationResult, u as MigrationStatus, M as Migrator, v as MigratorConfig, S as SQL, o as createBetaInvitesTable, n as createBetaSettingsTable, p as createBetaTestersTable, f as createDomainVerificationsTable, c as createMigration, b as createSsoOidcConfigsTable, m as createSsoSessionsTable, k as createTenantInvitationsTable, j as createTenantMembersTable, l as createTenantUsageTable, i as createTenantsTable, h as createVerifiedDomainsTable, d as defineMigration, e as enterpriseMigrations, g as generateVersion, a as getEnterpriseMigrations, s as sqlMigration } from './index-DzQ0Js5Z.js';
6
+ import { I as IAIUsage, A as AIUsageConfig, U as UsageRecord, a as UsageQuery, b as UsageQueryResult, Q as Quota, c as QuotaType, d as UsageCategory, e as QuotaStatus, B as Budget, f as BudgetStatus, g as UsageInterval, h as UsageSummary, i as UsageTrend, C as CostBreakdown, j as UsageInvoice, k as AlertType, l as UsageAlert } from './agents-Cc65YUoW.js';
7
+ export { G as AgentBudget, q as AgentCumulativeUsage, s as AgentIterationCallback, r as AgentIterationEvent, u as AgentLoopOptions, v as AgentLoopResult, t as AgentStopReason, o as AgentTool, p as AgentToolResult, y as AgentTracer, x as AgentTracerOptions, F as AgentUsageRecordParams, H as AgentUsageTracker, E as AgentUsageTrackerOptions, D as DEFAULT_AGENT_LOOP_OPTIONS, M as MemoryAIUsage, O as OllamaAdapter, n as OllamaAdapterConfig, T as ToolExecutor, K as TracedAIOptions, m as UsageInvoiceItem, z as createAgentTracer, J as createAgentUsageTracker, L as createTracedAI, w as runAgentLoop } from './agents-Cc65YUoW.js';
4
8
  import { aS as IBeta, aT as BetaConfig, aU as BetaSettings, aV as UpdateBetaSettingsOptions, aW as CreateBetaCodesOptions, aX as BetaInviteCode, aY as ListBetaCodesOptions, aZ as BetaValidationResult, a_ as BetaConsumeResult, a$ as BetaTester, b0 as BetaStats, b1 as BetaCodeUsageReport } from './env-BJWliXSO.js';
5
9
  export { al as AllowlistConfig, A as ApiError, d as ApiErrorCode, f as ApiErrorCodeType, h as ApiPaginatedResponse, Q as ApiSecurityConfig, V as ApiSecurityContext, g as ApiSuccessResponse, aD as AuditRequest, H as AuthCookiesConfig, N as AuthMethod, aL as BetaClientConfig, b6 as BetaCodeStatus, C as CommonApiErrors, ar as CommonRateLimits, ac as DateRangeInput, a6 as DateRangeSchema, ag as DeploymentStage, aa as EmailInput, $ as EmailSchema, E as EnvValidationConfig, p as EnvValidationResult, ai as FlagDefinition, aj as FlagDefinitions, ah as FlagValue, r as KEYCLOAK_DEFAULT_ROLES, F as KeycloakCallbacksConfig, K as KeycloakConfig, G as KeycloakJwtFields, q as KeycloakTokenSet, ae as LoginInput, a8 as LoginSchema, b2 as MemoryBeta, ay as OpsAuditActor, aA as OpsAuditEvent, aC as OpsAuditLoggerOptions, aB as OpsAuditRecord, az as OpsAuditResource, b7 as PG_ERROR_MAP, ab as PaginationInput, a5 as PaginationSchema, a0 as PasswordSchema, a3 as PersonNameSchema, a2 as PhoneSchema, aq as RateLimitCheckResult, b as RateLimitOptions, P as RateLimitPreset, a as RateLimitRule, R as RateLimitStore, J as RedirectCallbackConfig, ak as ResolvedFlags, O as RouteAuditConfig, ad as SearchQueryInput, a7 as SearchQuerySchema, U as SecuritySession, af as SignupInput, a9 as SignupSchema, a1 as SlugSchema, aF as StandardAuditActionType, aE as StandardAuditActions, S as StandardRateLimitPresets, T as TokenRefreshResult, _ as WrapperPresets, ao as buildAllowlist, I as buildAuthCookies, Z as buildErrorBody, M as buildKeycloakCallbacks, e as buildPagination, Y as buildRateLimitHeaders, aw as buildRateLimitResponseHeaders, L as buildRedirectCallback, y as buildTokenRefreshParams, n as checkEnvVars, at as checkRateLimit, c as classifyError, aR as clearStoredBetaCode, aJ as createAuditActor, aK as createAuditLogger, aM as createBetaClient, an as createFeatureFlags, as as createMemoryRateLimitStore, a4 as createSafeTextSchema, am as detectStage, aG as extractAuditIp, aI as extractAuditRequestId, aH as extractAuditUserAgent, X as extractClientIp, aN as fetchBetaSettings, b3 as generateBetaCode, b5 as generateBetaId, l as getBoolEnv, B as getEndSessionEndpoint, o as getEnvSummary, m as getIntEnv, k as getOptionalEnv, au as getRateLimitStatus, j as getRequiredEnv, aQ as getStoredBetaCode, z as getTokenEndpoint, w as hasAllRoles, u as hasAnyRole, t as hasRole, ap as isAllowlisted, i as isApiError, x as isTokenExpired, b4 as normalizeBetaCode, s as parseKeycloakRoles, D as refreshKeycloakToken, av as resetRateLimitForKey, ax as resolveIdentifier, W as resolveRateLimitIdentifier, aP as storeBetaCode, aO as validateBetaCode, v as validateEnvVars } from './env-BJWliXSO.js';
6
10
  export { H as HTML_TAG_PATTERN, i as URL_DOMAIN_PATTERN, U as URL_PROTOCOL_PATTERN, c as constantTimeEqual, b as containsHtml, a as containsUrls, f as defangUrl, e as escapeHtml, g as getCorrelationId, d as sanitizeApiError, h as sanitizeForEmail, s as stripHtml } from './security-BvLXaQkv.js';
@@ -4938,566 +4942,6 @@ declare class MemoryPromptStore implements IPromptStore {
4938
4942
  private average;
4939
4943
  }
4940
4944
 
4941
- /**
4942
- * IAIUsage - Per-tenant AI token tracking and cost allocation
4943
- *
4944
- * Provides infrastructure for:
4945
- * - Token usage tracking per tenant
4946
- * - Cost allocation and budgeting
4947
- * - Usage quotas and limits
4948
- * - Billing integration
4949
- * - Analytics and reporting
4950
- */
4951
- type UsageCategory = "chat" | "completion" | "embedding" | "image" | "audio" | "video" | "fine_tuning";
4952
- type UsageInterval = "minute" | "hour" | "day" | "week" | "month" | "year";
4953
- interface UsageRecord {
4954
- id: string;
4955
- /** Tenant ID */
4956
- tenantId: string;
4957
- /** User ID (optional, for per-user tracking) */
4958
- userId?: string;
4959
- /** API key ID (optional) */
4960
- apiKeyId?: string;
4961
- /** Usage category */
4962
- category: UsageCategory;
4963
- /** AI provider */
4964
- provider: string;
4965
- /** Model used */
4966
- model: string;
4967
- /** Input tokens */
4968
- inputTokens: number;
4969
- /** Output tokens */
4970
- outputTokens: number;
4971
- /** Total tokens */
4972
- totalTokens: number;
4973
- /** Cost in USD */
4974
- costUsd: number;
4975
- /** Request latency in ms */
4976
- latencyMs: number;
4977
- /** Request ID for tracing */
4978
- requestId?: string;
4979
- /** Whether the request succeeded */
4980
- success: boolean;
4981
- /** Error message if failed */
4982
- error?: string;
4983
- /** Additional metadata */
4984
- metadata?: Record<string, unknown>;
4985
- /** Created timestamp */
4986
- createdAt: Date;
4987
- }
4988
- type QuotaType = "tokens" | "requests" | "cost";
4989
- interface Quota {
4990
- id: string;
4991
- /** Tenant ID */
4992
- tenantId: string;
4993
- /** Quota type */
4994
- type: QuotaType;
4995
- /** Category (or 'all' for global quota) */
4996
- category: UsageCategory | "all";
4997
- /** Quota limit */
4998
- limit: number;
4999
- /** Quota period */
5000
- period: UsageInterval;
5001
- /** Current usage */
5002
- used: number;
5003
- /** Period start date */
5004
- periodStart: Date;
5005
- /** Period end date */
5006
- periodEnd: Date;
5007
- /** Action when quota exceeded */
5008
- action: "block" | "warn" | "notify" | "overage";
5009
- /** Overage rate (for 'overage' action) */
5010
- overageRate?: number;
5011
- /** Alert thresholds (percentages) */
5012
- alertThresholds?: number[];
5013
- /** Whether quota is enabled */
5014
- enabled: boolean;
5015
- }
5016
- interface QuotaStatus {
5017
- quota: Quota;
5018
- /** Current usage */
5019
- used: number;
5020
- /** Remaining */
5021
- remaining: number;
5022
- /** Usage percentage */
5023
- percentUsed: number;
5024
- /** Whether quota is exceeded */
5025
- exceeded: boolean;
5026
- /** Estimated time until reset */
5027
- resetsIn?: number;
5028
- /** Alerts triggered */
5029
- alertsTriggered: number[];
5030
- }
5031
- interface Budget {
5032
- id: string;
5033
- /** Tenant ID */
5034
- tenantId: string;
5035
- /** Budget name */
5036
- name: string;
5037
- /** Budget amount in USD */
5038
- amount: number;
5039
- /** Budget period */
5040
- period: UsageInterval;
5041
- /** Categories included in budget */
5042
- categories?: UsageCategory[];
5043
- /** Current spend */
5044
- spent: number;
5045
- /** Period start date */
5046
- periodStart: Date;
5047
- /** Period end date */
5048
- periodEnd: Date;
5049
- /** Alert thresholds (percentages) */
5050
- alertThresholds: number[];
5051
- /** Action when budget exceeded */
5052
- action: "block" | "warn" | "notify";
5053
- /** Whether budget is enabled */
5054
- enabled: boolean;
5055
- }
5056
- interface BudgetStatus {
5057
- budget: Budget;
5058
- /** Current spend */
5059
- spent: number;
5060
- /** Remaining */
5061
- remaining: number;
5062
- /** Spend percentage */
5063
- percentSpent: number;
5064
- /** Whether budget is exceeded */
5065
- exceeded: boolean;
5066
- /** Projected spend for full period */
5067
- projected: number;
5068
- /** Alerts triggered */
5069
- alertsTriggered: number[];
5070
- }
5071
- interface UsageInvoiceItem {
5072
- category: UsageCategory;
5073
- provider: string;
5074
- model: string;
5075
- inputTokens: number;
5076
- outputTokens: number;
5077
- totalTokens: number;
5078
- requests: number;
5079
- costUsd: number;
5080
- }
5081
- interface UsageInvoice {
5082
- id: string;
5083
- tenantId: string;
5084
- periodStart: Date;
5085
- periodEnd: Date;
5086
- items: UsageInvoiceItem[];
5087
- subtotal: number;
5088
- discounts?: Array<{
5089
- type: string;
5090
- amount: number;
5091
- description?: string;
5092
- }>;
5093
- total: number;
5094
- currency: string;
5095
- status: "draft" | "pending" | "paid" | "overdue";
5096
- dueDate?: Date;
5097
- paidAt?: Date;
5098
- createdAt: Date;
5099
- }
5100
- interface UsageSummary {
5101
- tenantId: string;
5102
- period: {
5103
- start: Date;
5104
- end: Date;
5105
- interval: UsageInterval;
5106
- };
5107
- totals: {
5108
- inputTokens: number;
5109
- outputTokens: number;
5110
- totalTokens: number;
5111
- requests: number;
5112
- successfulRequests: number;
5113
- failedRequests: number;
5114
- costUsd: number;
5115
- averageLatencyMs: number;
5116
- };
5117
- byCategory: Record<UsageCategory, {
5118
- inputTokens: number;
5119
- outputTokens: number;
5120
- totalTokens: number;
5121
- requests: number;
5122
- costUsd: number;
5123
- }>;
5124
- byModel: Record<string, {
5125
- inputTokens: number;
5126
- outputTokens: number;
5127
- totalTokens: number;
5128
- requests: number;
5129
- costUsd: number;
5130
- }>;
5131
- byUser?: Record<string, {
5132
- inputTokens: number;
5133
- outputTokens: number;
5134
- totalTokens: number;
5135
- requests: number;
5136
- costUsd: number;
5137
- }>;
5138
- }
5139
- interface UsageTrend {
5140
- tenantId: string;
5141
- period: {
5142
- start: Date;
5143
- end: Date;
5144
- interval: UsageInterval;
5145
- };
5146
- dataPoints: Array<{
5147
- timestamp: Date;
5148
- inputTokens: number;
5149
- outputTokens: number;
5150
- totalTokens: number;
5151
- requests: number;
5152
- costUsd: number;
5153
- }>;
5154
- growth: {
5155
- tokens: number;
5156
- requests: number;
5157
- cost: number;
5158
- };
5159
- }
5160
- interface CostBreakdown {
5161
- tenantId: string;
5162
- period: {
5163
- start: Date;
5164
- end: Date;
5165
- };
5166
- total: number;
5167
- byProvider: Record<string, number>;
5168
- byModel: Record<string, number>;
5169
- byCategory: Record<UsageCategory, number>;
5170
- byUser?: Record<string, number>;
5171
- }
5172
- interface UsageQuery {
5173
- tenantId: string;
5174
- startDate?: Date;
5175
- endDate?: Date;
5176
- category?: UsageCategory | UsageCategory[];
5177
- provider?: string | string[];
5178
- model?: string | string[];
5179
- userId?: string;
5180
- success?: boolean;
5181
- limit?: number;
5182
- offset?: number;
5183
- sortBy?: "createdAt" | "totalTokens" | "costUsd" | "latencyMs";
5184
- sortOrder?: "asc" | "desc";
5185
- }
5186
- interface UsageQueryResult {
5187
- records: UsageRecord[];
5188
- total: number;
5189
- aggregations: {
5190
- totalTokens: number;
5191
- totalCost: number;
5192
- averageLatency: number;
5193
- };
5194
- }
5195
- type AlertType = "quota_warning" | "quota_exceeded" | "budget_warning" | "budget_exceeded" | "anomaly";
5196
- interface UsageAlert {
5197
- id: string;
5198
- tenantId: string;
5199
- type: AlertType;
5200
- severity: "info" | "warning" | "critical";
5201
- message: string;
5202
- metadata: {
5203
- quotaId?: string;
5204
- budgetId?: string;
5205
- threshold?: number;
5206
- currentValue?: number;
5207
- limit?: number;
5208
- };
5209
- acknowledged: boolean;
5210
- acknowledgedAt?: Date;
5211
- acknowledgedBy?: string;
5212
- createdAt: Date;
5213
- }
5214
- interface AIUsageConfig {
5215
- /** Enable usage tracking */
5216
- enabled?: boolean;
5217
- /** Default quota period */
5218
- defaultQuotaPeriod?: UsageInterval;
5219
- /** Default budget period */
5220
- defaultBudgetPeriod?: UsageInterval;
5221
- /** Enable per-user tracking */
5222
- trackPerUser?: boolean;
5223
- /** Enable anomaly detection */
5224
- enableAnomalyDetection?: boolean;
5225
- /** Anomaly threshold (standard deviations) */
5226
- anomalyThreshold?: number;
5227
- /** Cost precision (decimal places) */
5228
- costPrecision?: number;
5229
- /** Retention period in days */
5230
- retentionDays?: number;
5231
- }
5232
- /**
5233
- * IAIUsage - AI usage tracking interface
5234
- *
5235
- * @example
5236
- * ```typescript
5237
- * const usage = platform.aiUsage;
5238
- *
5239
- * // Record usage after AI call
5240
- * await usage.record({
5241
- * tenantId: 'tenant_123',
5242
- * category: 'chat',
5243
- * provider: 'openai',
5244
- * model: 'gpt-4',
5245
- * inputTokens: 150,
5246
- * outputTokens: 300,
5247
- * totalTokens: 450,
5248
- * costUsd: 0.018,
5249
- * latencyMs: 1200,
5250
- * success: true,
5251
- * });
5252
- *
5253
- * // Check quota before making request
5254
- * const quotaStatus = await usage.checkQuota('tenant_123', 'tokens', 'chat');
5255
- * if (quotaStatus.exceeded) {
5256
- * throw new Error('Token quota exceeded');
5257
- * }
5258
- *
5259
- * // Get usage summary
5260
- * const summary = await usage.getSummary('tenant_123', 'month');
5261
- * console.log(`Total cost: $${summary.totals.costUsd}`);
5262
- * ```
5263
- */
5264
- interface IAIUsage {
5265
- /**
5266
- * Record a usage event
5267
- */
5268
- record(record: Omit<UsageRecord, "id" | "createdAt">): Promise<UsageRecord>;
5269
- /**
5270
- * Record multiple usage events (batch)
5271
- */
5272
- recordBatch(records: Array<Omit<UsageRecord, "id" | "createdAt">>): Promise<UsageRecord[]>;
5273
- /**
5274
- * Query usage records
5275
- */
5276
- query(query: UsageQuery): Promise<UsageQueryResult>;
5277
- /**
5278
- * Get a specific usage record
5279
- */
5280
- getRecord(recordId: string): Promise<UsageRecord | null>;
5281
- /**
5282
- * Create or update a quota
5283
- */
5284
- setQuota(quota: Omit<Quota, "id" | "used" | "periodStart" | "periodEnd">): Promise<Quota>;
5285
- /**
5286
- * Get a quota
5287
- */
5288
- getQuota(tenantId: string, type: QuotaType, category: UsageCategory | "all"): Promise<Quota | null>;
5289
- /**
5290
- * List quotas for a tenant
5291
- */
5292
- listQuotas(tenantId: string): Promise<Quota[]>;
5293
- /**
5294
- * Check quota status
5295
- */
5296
- checkQuota(tenantId: string, type: QuotaType, category: UsageCategory | "all"): Promise<QuotaStatus>;
5297
- /**
5298
- * Check all quotas for a tenant
5299
- */
5300
- checkAllQuotas(tenantId: string): Promise<QuotaStatus[]>;
5301
- /**
5302
- * Delete a quota
5303
- */
5304
- deleteQuota(quotaId: string): Promise<void>;
5305
- /**
5306
- * Reset quota usage (admin only)
5307
- */
5308
- resetQuota(quotaId: string): Promise<Quota>;
5309
- /**
5310
- * Create or update a budget
5311
- */
5312
- setBudget(budget: Omit<Budget, "id" | "spent" | "periodStart" | "periodEnd">): Promise<Budget>;
5313
- /**
5314
- * Get a budget
5315
- */
5316
- getBudget(budgetId: string): Promise<Budget | null>;
5317
- /**
5318
- * List budgets for a tenant
5319
- */
5320
- listBudgets(tenantId: string): Promise<Budget[]>;
5321
- /**
5322
- * Check budget status
5323
- */
5324
- checkBudget(budgetId: string): Promise<BudgetStatus>;
5325
- /**
5326
- * Check all budgets for a tenant
5327
- */
5328
- checkAllBudgets(tenantId: string): Promise<BudgetStatus[]>;
5329
- /**
5330
- * Delete a budget
5331
- */
5332
- deleteBudget(budgetId: string): Promise<void>;
5333
- /**
5334
- * Get usage summary for a tenant
5335
- */
5336
- getSummary(tenantId: string, period: UsageInterval, date?: Date): Promise<UsageSummary>;
5337
- /**
5338
- * Get usage trends
5339
- */
5340
- getTrends(tenantId: string, period: UsageInterval, dataPoints?: number): Promise<UsageTrend>;
5341
- /**
5342
- * Get cost breakdown
5343
- */
5344
- getCostBreakdown(tenantId: string, startDate: Date, endDate: Date): Promise<CostBreakdown>;
5345
- /**
5346
- * Compare usage between periods
5347
- */
5348
- comparePeriods(tenantId: string, period1Start: Date, period1End: Date, period2Start: Date, period2End: Date): Promise<{
5349
- period1: UsageSummary;
5350
- period2: UsageSummary;
5351
- changes: {
5352
- tokens: number;
5353
- requests: number;
5354
- cost: number;
5355
- latency: number;
5356
- };
5357
- }>;
5358
- /**
5359
- * Generate invoice for a period
5360
- */
5361
- generateInvoice(tenantId: string, periodStart: Date, periodEnd: Date): Promise<UsageInvoice>;
5362
- /**
5363
- * Get an invoice
5364
- */
5365
- getInvoice(invoiceId: string): Promise<UsageInvoice | null>;
5366
- /**
5367
- * List invoices for a tenant
5368
- */
5369
- listInvoices(tenantId: string, options?: {
5370
- status?: UsageInvoice["status"];
5371
- limit?: number;
5372
- offset?: number;
5373
- }): Promise<{
5374
- invoices: UsageInvoice[];
5375
- total: number;
5376
- }>;
5377
- /**
5378
- * Mark invoice as paid
5379
- */
5380
- markInvoicePaid(invoiceId: string): Promise<UsageInvoice>;
5381
- /**
5382
- * Get alerts for a tenant
5383
- */
5384
- getAlerts(tenantId: string, options?: {
5385
- type?: AlertType;
5386
- acknowledged?: boolean;
5387
- limit?: number;
5388
- }): Promise<UsageAlert[]>;
5389
- /**
5390
- * Acknowledge an alert
5391
- */
5392
- acknowledgeAlert(alertId: string, acknowledgedBy?: string): Promise<void>;
5393
- /**
5394
- * Acknowledge all alerts for a tenant
5395
- */
5396
- acknowledgeAllAlerts(tenantId: string, acknowledgedBy?: string): Promise<number>;
5397
- /**
5398
- * Estimate cost for a request
5399
- */
5400
- estimateCost(provider: string, model: string, inputTokens: number, outputTokens: number): Promise<number>;
5401
- /**
5402
- * Get token pricing for models
5403
- */
5404
- getPricing(): Promise<Record<string, Record<string, {
5405
- inputPer1K: number;
5406
- outputPer1K: number;
5407
- }>>>;
5408
- /**
5409
- * Project usage for remainder of period
5410
- */
5411
- projectUsage(tenantId: string, period: UsageInterval): Promise<{
5412
- projected: {
5413
- tokens: number;
5414
- cost: number;
5415
- requests: number;
5416
- };
5417
- confidence: number;
5418
- }>;
5419
- }
5420
- /**
5421
- * MemoryAIUsage - In-memory implementation for testing
5422
- */
5423
- declare class MemoryAIUsage implements IAIUsage {
5424
- private config;
5425
- private records;
5426
- private quotas;
5427
- private budgets;
5428
- private invoices;
5429
- private alerts;
5430
- private pricing;
5431
- constructor(config?: AIUsageConfig);
5432
- record(record: Omit<UsageRecord, "id" | "createdAt">): Promise<UsageRecord>;
5433
- recordBatch(records: Array<Omit<UsageRecord, "id" | "createdAt">>): Promise<UsageRecord[]>;
5434
- query(query: UsageQuery): Promise<UsageQueryResult>;
5435
- getRecord(recordId: string): Promise<UsageRecord | null>;
5436
- setQuota(quota: Omit<Quota, "id" | "used" | "periodStart" | "periodEnd">): Promise<Quota>;
5437
- getQuota(tenantId: string, type: QuotaType, category: UsageCategory | "all"): Promise<Quota | null>;
5438
- listQuotas(tenantId: string): Promise<Quota[]>;
5439
- checkQuota(tenantId: string, type: QuotaType, category: UsageCategory | "all"): Promise<QuotaStatus>;
5440
- checkAllQuotas(tenantId: string): Promise<QuotaStatus[]>;
5441
- deleteQuota(quotaId: string): Promise<void>;
5442
- resetQuota(quotaId: string): Promise<Quota>;
5443
- setBudget(budget: Omit<Budget, "id" | "spent" | "periodStart" | "periodEnd">): Promise<Budget>;
5444
- getBudget(budgetId: string): Promise<Budget | null>;
5445
- listBudgets(tenantId: string): Promise<Budget[]>;
5446
- checkBudget(budgetId: string): Promise<BudgetStatus>;
5447
- checkAllBudgets(tenantId: string): Promise<BudgetStatus[]>;
5448
- deleteBudget(budgetId: string): Promise<void>;
5449
- getSummary(tenantId: string, period: UsageInterval, date?: Date): Promise<UsageSummary>;
5450
- getTrends(tenantId: string, period: UsageInterval, dataPoints?: number): Promise<UsageTrend>;
5451
- getCostBreakdown(tenantId: string, startDate: Date, endDate: Date): Promise<CostBreakdown>;
5452
- comparePeriods(tenantId: string, period1Start: Date, period1End: Date, period2Start: Date, period2End: Date): Promise<{
5453
- period1: UsageSummary;
5454
- period2: UsageSummary;
5455
- changes: {
5456
- tokens: number;
5457
- requests: number;
5458
- cost: number;
5459
- latency: number;
5460
- };
5461
- }>;
5462
- generateInvoice(tenantId: string, periodStart: Date, periodEnd: Date): Promise<UsageInvoice>;
5463
- getInvoice(invoiceId: string): Promise<UsageInvoice | null>;
5464
- listInvoices(tenantId: string, options?: {
5465
- status?: UsageInvoice["status"];
5466
- limit?: number;
5467
- offset?: number;
5468
- }): Promise<{
5469
- invoices: UsageInvoice[];
5470
- total: number;
5471
- }>;
5472
- markInvoicePaid(invoiceId: string): Promise<UsageInvoice>;
5473
- getAlerts(tenantId: string, options?: {
5474
- type?: AlertType;
5475
- acknowledged?: boolean;
5476
- limit?: number;
5477
- }): Promise<UsageAlert[]>;
5478
- acknowledgeAlert(alertId: string, acknowledgedBy?: string): Promise<void>;
5479
- acknowledgeAllAlerts(tenantId: string, acknowledgedBy?: string): Promise<number>;
5480
- estimateCost(provider: string, model: string, inputTokens: number, outputTokens: number): Promise<number>;
5481
- getPricing(): Promise<Record<string, Record<string, {
5482
- inputPer1K: number;
5483
- outputPer1K: number;
5484
- }>>>;
5485
- projectUsage(tenantId: string, period: UsageInterval): Promise<{
5486
- projected: {
5487
- tokens: number;
5488
- cost: number;
5489
- requests: number;
5490
- };
5491
- confidence: number;
5492
- }>;
5493
- private updateQuotaUsage;
5494
- private updateBudgetSpend;
5495
- private createAlert;
5496
- private getPeriodBounds;
5497
- private getIntervalMs;
5498
- private getSummaryForPeriod;
5499
- }
5500
-
5501
4945
  /**
5502
4946
  * IDevice - IoT Device management interface
5503
4947
  *
@@ -13272,4 +12716,4 @@ declare function getSharedRedis(): Redis$2 | null;
13272
12716
  */
13273
12717
  declare function closeSharedRedis(): Promise<void>;
13274
12718
 
13275
- export { AIChatRequest, AIChatResponse, AICompletionRequest, AICompletionResponse, AIConfig, AIEmbeddingRequest, AIEmbeddingResponse, AIModelConfig, AIModelType, AIProvider, AIStreamCallback, AIStreamChunk, type AIUsageConfig, type AccountCapabilities, type AccountLink, type AccountType, type Address, type AlertType, AnthropicAdapter, type AnthropicAdapterConfig, type ApiAuthentication, type ApiChangelog, type ApiDocumentation, type ApiEndpoint, type ApiExample, type ApiKey, type ApiKeyStatus, type ApiKeyType, type ApiKeyValidationResult, type ApiParameter, type ApiResponse, type ApiSchema, type ApiSchemaProperty, type ApiUsageStats, type ApiUsageTimeSeries, type AppLogContext, type AppLogger, type AppLoggerOptions, AssembledContext, type AuditActor, type AuditCategory, type AuditEvent, AuditEvents, type AuditEvidence, type AuditLogConfig, type AuditOutcome, type AuditQuery, type AuditQueryResult, type AuditRetentionPolicy, type AuditStats, type AuditTarget, type AuthConfig, type AuthError, type AuthErrorCode, AuthErrorMessages, type AuthEventType, type AuthResult, type AuthSession, type AuthStateChangeCallback, type AuthStorage, type AuthUser, type Balance, type BalanceAmount, type BankAccountDetails, type BatchNotificationOptions, BetaCodeUsageReport, BetaConfig, BetaConsumeResult, BetaInviteCode, BetaSettings, BetaStats, BetaTester, BetaValidationResult, type BillingConfig, type BillingDetails, type BillingPeriod, type Breadcrumb, type Budget, type BudgetStatus, BulkIngestionResult, Bulkhead, type BulkheadOptions, BulkheadRegistry, BulkheadRejectedError, type BulkheadStats, type BullMQConfig, BullMQQueue, type BusinessProfile, type CancelationReason, type CaptureOptions, type CapturePaymentIntentOptions, type CardBrand, type CardDetails, type ChainExecutionResult, CircuitBreaker, type CircuitBreakerOptions, CircuitBreakerRegistry, type CircuitBreakerStats, CircuitOpenError, type CircuitState, type CommandStatus, type ComplianceConfig, type ComplianceReport, type ConfirmPaymentIntentOptions, type ConnectedAccount, type ConnectedAccountStatus, type ConsentPreferences, type ConsentPurpose, type ConsentRecord, type ConsentStatus, ContextAssemblyConfig, type ControlFramework, type ControlStatus, type CorrelationData, type CostBreakdown, type Coupon, type CreateAccountLinkOptions, type CreateApiKeyOptions, CreateBetaCodesOptions, CreateCollectionOptions, type CreateConnectedAccountOptions, type CreateCustomerOptions, type CreateDsarOptions, type CreatePaymentIntentOptions, type CreatePayoutOptions, type CreateRefundOptions, type CreateSandboxOptions, type CreateScheduleOptions, type CreateTenantOptions, type CreateTransferOptions, type CreateWebhookOptions, type CreditBalance, type CreditTransaction, type CreditType, type CronExpression, CronPresets, CryptoKeyMetadata, type Currency, type Customer, DEFAULT_BULKHEAD_OPTIONS, DEFAULT_CIRCUIT_BREAKER_OPTIONS, DEFAULT_RETRY_OPTIONS, type DataBreachRecord, type DataCategory, type DataInventoryItem, type DataMap, type DataSensitivity, type DataSubjectRequest, type DataType, DatabaseAIUsage, type DatabaseAIUsageConfig, DatabaseAuditLog, type DatabaseAuditLogConfig, DatabaseBilling, type DatabaseBillingConfig, DatabaseCompliance, DatabaseErrorReporter, type DatabaseErrorReporterConfig, DatabaseNotification, type DatabaseNotificationConfig, DatabasePromptStore, type DatabasePromptStoreConfig, DefaultTimeouts, type DeleteAccountOptions, type DeleteHookContext, type DeliveryAttempt, type DeliveryQuery, type DeliveryStatus, type DetailedHealthResponse, DeterministicEncryptedField, type DevPortalConfig, type DeveloperMetrics, type Device, type DeviceAuthMethod, type DeviceCommand, type DeviceConfig, type DeviceConnectionState, type DeviceCredentials, type DeviceGroup, type DeviceGroupQuery, type DeviceLocation, type DeviceQuery, type DeviceQueryResult, type DeviceShadow, type DeviceStatus, type DirectoryAttributeMapping, type DirectoryConfig, DocumentStatus, type DsarAttachment, type DsarNote, type DsarStatus, type DsarType, type DunningActionType, type DunningAttempt, type DunningConfig, type EmailHookContext, EmailMessage, EmailResult, EncryptOptions, EncryptedField, type EnrollMfaOptions, type EnrollMfaResult, type ErrorContext, type ErrorHookContext, type ErrorLevel, type ErrorReport, type ErrorReporterConfig, type EvidenceType, type ExperimentMetrics, type FallbackOptions, type FallbackResult, FallbackStrategies, type FirmwareStatus, type FirmwareUpdate, type FirmwareVersion, type GeneratedSdk, GenericOIDCAuthSSO, type GenericOIDCConfig, GoogleAIAdapter, type GoogleAIAdapterConfig, type HealthCheckResult, type HealthEndpoints, type HealthEndpointsOptions, type HealthStatus, type HookRegistry, type HttpMethod, HttpWebhook, type HttpWebhookConfig, IAI, type IAIUsage, type IAuditLog, type IAuth, type IAuthSSO, IBeta, type IBilling, ICache, type ICompliance, ICrypto, IDatabase, type IDevPortal, type IDevice, IEmail, type IErrorReporter, type IHealth, type IHealthCheckable, ILogger, IMetrics, type INotification, type IPayment, IPlatform, type IPromptStore, IQueryBuilder, IQueue, IRAG, type IScheduler, IStorage, type ITenant, type IWebhook, type InboundWebhookConfig, type InboundWebhookContext, IngestionOptions, IngestionResult, type InsertHookContext, type InviteMemberOptions, type Invoice, type InvoiceLineItem, type InvoiceQuery, type InvoiceStatus, Job, JobEventHandler, JobEventType, type JobHookContext, JobOptions, JobState, KeyRotationResult, ListBetaCodesOptions, type ListTenantsOptions, type LivenessResponse, MemoryAIUsage, MemoryAuditLog, type MemoryAuditLogConfig, MemoryAuth, MemoryAuthSSO, MemoryBilling, MemoryCompliance, MemoryCrypto, MemoryDevPortal, MemoryDevice, MemoryErrorReporter, type MemoryErrorReporterConfig, MemoryNotification, type MemoryNotificationConfig, MemoryPayment, MemoryPromptStore, MemoryRateLimiterStorage, MemoryScheduler, type MemorySchedulerConfig, MemoryTenant, MemoryWebhook, type MemoryWebhookConfig, type Meter, type MetricsEndpoint, type MetricsEndpointOptions, MetricsSummary, type MfaChallenge, type MfaFactor, type MfaFactorType, type Middleware, type MiddlewareChain, type MiddlewareChainOptions, type MiddlewareContext, NodeCrypto, type NodeCryptoConfig, type NotificationAction, type NotificationCategory, type NotificationChannel, type NotificationConfig, type NotificationData, type NotificationPreferences, type NotificationPriority, type NotificationQuery, type NotificationResult, type NotificationStats, type NotificationStatus, type NotificationTarget, NotificationTemplates, type OAuthOptions, type OAuthProvider, type OAuthResult, type OidcAuthRequest, type OidcAuthResponse, type OidcClaimMapping, type OidcIdpConfig, OpenAIAdapter, type OpenAIAdapterConfig, type ParameterLocation, type PaymentConfig, type PaymentError, type PaymentErrorCode, PaymentErrorMessages, type PaymentEventType, type PaymentIntent, type PaymentMethod, type PaymentMethodType, type PaymentStatus, type PaymentWebhookEvent, type Payout, type PayoutStatus, type PiaMitigation, type PiaRisk, type PiaStatus, PineconeRAG, type PineconeRAGConfig, type PlatformHealthResult, PlatformHealthStatus, type PlatformHooks, PostgresBeta, type PostgresBetaConfig, type PostgresConfig, PostgresDatabase, PostgresTenant, type PostgresTenantConfig, type Price, type PricingModel, type PricingTier, type PrivacyImpactAssessment, type Product, type Prompt, type PromptChain, type PromptChainStep, type PromptExperiment, type PromptQuery, type PromptQueryResult, type PromptStatus, type PromptStoreConfig, type PromptType, type PromptUsageRecord, type PromptUsageStats, type PromptVariable, type PromptVariant, type PromptVersion, type ProvisioningConfig, type ProvisioningRequest, type ProvisioningResult, type ProvisioningStatus, type PushSubscription, type QueryHookContext, QueryResult, QueueScheduler, type QueueSchedulerConfig, type Quota, type QuotaStatus, type QuotaType, RAGChunk, RAGCollection, RAGConfig, RAGDocument, RAGPipeline, RAGSearchQuery, RAGSearchResponse, RAGSearchResult, type RateLimitAlgorithm, RateLimitError, type RateLimitInfo, RateLimitPresets, type RateLimiterStorage, type ReadinessResponse, type RecordConsentOptions, RedisCache, type RedisClientOptions, type RedisConfig, type Refund, type RefundReason, type RefundStatus, type RenderOptions, type RenderedPrompt, RepeatOptions, ResendEmail, type ResetPasswordOptions, type RetentionAction, type RetentionExecution, type RetentionPolicy, RetryConfigs, type RetryOptions, RetryPredicates, type RetryResult, type RevenueMetrics, type RiskLevel, S3Storage, type SamlAssertion, type SamlAttributeMapping, type SamlAuthRequest, type SamlAuthResponse, type SamlIdpConfig, type SamlNameIdFormat, type SamlSpConfig, type Sandbox, type SandboxConfig, type SandboxLimits, type SandboxStatus, type SandboxUsage, type ScheduleContext, type ScheduleExecution, type ScheduleHandler, type ScheduleQuery, type ScheduleState, type ScheduleUpdateOptions, type ScheduledJob, type SchedulerConfig, type SchedulerStats, type ScimConfig, type ScimUser, type SdkConfig, type SdkFile, type SdkLanguage, type SendCommandOptions, type SendNotificationOptions, type ServiceHealth, type ShadowDelta, type ShadowMetadata, type ShadowUpdate, type SignInWithEmailOptions, type SignInWithMagicLinkOptions, type SignInWithPhoneOptions, type SignUpWithEmailOptions, type SignatureAlgorithm, type SlidingWindowRateLimitOptions, type SmtpConfig, SmtpEmail, type SsoSession, type StartupResponse, StorageFile, type StoredAuditEvent, type StoredNotification, StripePayment, type StripePaymentConfig, type Subscription, type SubscriptionDiscount, type SubscriptionItem, type SubscriptionMetrics, type SubscriptionQuery, type SubscriptionStatus, SupabaseAuth, type SupabaseAuthConfig, SupabaseDatabase, SupabaseStorage, type SupabaseStorageConfig, type TaxBreakdown, type TelemetryMessage, type TelemetryQuery, type TelemetryResult, type Tenant, type TenantBranding, type TenantContext, type TenantDatabaseConfig, type TenantInvitation, type TenantIsolationModel, type TenantMember, type TenantMemberStatus, type TenantQuotas, type TenantResolutionOptions, type TenantResolutionStrategy, type TenantRole, type TenantSecuritySettings, type TenantSettings, type TenantStatus, type TenantUsage, TimeoutError, type TimeoutOptions, type TokenBucketOptions, type TosAcceptance, type Transfer, type TransferStatus, type Unsubscribe, UpdateBetaSettingsOptions, type UpdateCustomerOptions, type UpdateHookContext, type UpdatePasswordOptions, type UpdatePaymentIntentOptions, type UpdateScheduleOptions, type UpdateStatus, type UpdateTenantOptions, type UpdateUserOptions, type UpdateWebhookOptions, type UploadHookContext, UploadOptions, UpstashCache, type UsageAlert, type UsageCategory, type UsageEvent, type UsageInterval, type UsageInvoice, type UsageInvoiceItem, type UsageQuery, type UsageQueryResult, type UsageRecord, type UsageSummary, type UsageSummaryRecord, type UsageTrend, type VerificationResult, type VerifyMfaOptions, type VerifyPhoneOtpOptions, type VerifyWebhookOptions, WeaviateRAG, type WeaviateRAGConfig, type WebhookConfig, type WebhookDelivery, type WebhookEndpoint, type WebhookEvent, WebhookEventTypes, type WebhookQuery, type WebhookState, type WebhookStats, type WebhookTestEndpoint, type WebhookTestEvent, calculateRetryDelay, closeSharedRedis, composeHookRegistries, correlationContext, createAnthropicAdapter, createAppLogger, createAuthError, createBulkhead, createCacheMiddleware, createCachedFallback, createCircuitBreaker, createDefaultPreferences, createErrorReport, createExpressHealthHandlers, createExpressMetricsHandler, createGoogleAIAdapter, createHealthEndpoints, createHealthServer, createHookRegistry, createIpKeyGenerator, createJobContext, createLoggingMiddleware, createMetricsEndpoint, createMetricsMiddleware, createMetricsServer, createMiddlewareChain, createMiddlewareContext, createObservabilityServer, createOpenAIAdapter, createPaymentError, createPineconeRAG, createRateLimitMiddleware, createRedisClient, createRequestContext, createRequestIdMiddleware, createSlowQueryMiddleware, createTenantMiddleware, createTimeoutMiddleware, createUserKeyGenerator, createWeaviateRAG, describeCron, filterChannelsByPreferences, formatAmount, generateAuditId, generateChecksum, generateDeliveryId, generateErrorId, generateEventId, generateFingerprint, generateNotificationId, generatePaymentId, generateScheduleId, generateSecureToken, generateWebhookId, generateWebhookSecret, getContext, getLogMeta, getNextCronRun, getRequestId, getSharedRedis, getTenantId, getTraceId, getUserId, isAuthError, isInContext, isInQuietHours, isPaymentError, isValidCron, matchAction, matchEventType, raceTimeout, retryable, runWithContext, runWithContextAsync, timedHealthCheck, toHealthCheckResult, withCorrelation, withCorrelationAsync, withFallback, withFallbackChain, withFallbackResult, withRetry, withRetryResult, withTimeout, withTimeoutWrapper };
12719
+ export { AIChatRequest, AIChatResponse, AICompletionRequest, AICompletionResponse, AIConfig, AIEmbeddingRequest, AIEmbeddingResponse, AIModelConfig, AIModelType, AIProvider, AIStreamCallback, AIStreamChunk, AIUsageConfig, type AccountCapabilities, type AccountLink, type AccountType, type Address, AlertType, AnthropicAdapter, type AnthropicAdapterConfig, type ApiAuthentication, type ApiChangelog, type ApiDocumentation, type ApiEndpoint, type ApiExample, type ApiKey, type ApiKeyStatus, type ApiKeyType, type ApiKeyValidationResult, type ApiParameter, type ApiResponse, type ApiSchema, type ApiSchemaProperty, type ApiUsageStats, type ApiUsageTimeSeries, type AppLogContext, type AppLogger, type AppLoggerOptions, AssembledContext, type AuditActor, type AuditCategory, type AuditEvent, AuditEvents, type AuditEvidence, type AuditLogConfig, type AuditOutcome, type AuditQuery, type AuditQueryResult, type AuditRetentionPolicy, type AuditStats, type AuditTarget, type AuthConfig, type AuthError, type AuthErrorCode, AuthErrorMessages, type AuthEventType, type AuthResult, type AuthSession, type AuthStateChangeCallback, type AuthStorage, type AuthUser, type Balance, type BalanceAmount, type BankAccountDetails, type BatchNotificationOptions, BetaCodeUsageReport, BetaConfig, BetaConsumeResult, BetaInviteCode, BetaSettings, BetaStats, BetaTester, BetaValidationResult, type BillingConfig, type BillingDetails, type BillingPeriod, type Breadcrumb, Budget, BudgetStatus, BulkIngestionResult, Bulkhead, type BulkheadOptions, BulkheadRegistry, BulkheadRejectedError, type BulkheadStats, type BullMQConfig, BullMQQueue, type BusinessProfile, type CancelationReason, type CaptureOptions, type CapturePaymentIntentOptions, type CardBrand, type CardDetails, type ChainExecutionResult, CircuitBreaker, type CircuitBreakerOptions, CircuitBreakerRegistry, type CircuitBreakerStats, CircuitOpenError, type CircuitState, type CommandStatus, type ComplianceConfig, type ComplianceReport, type ConfirmPaymentIntentOptions, type ConnectedAccount, type ConnectedAccountStatus, type ConsentPreferences, type ConsentPurpose, type ConsentRecord, type ConsentStatus, ContextAssemblyConfig, type ControlFramework, type ControlStatus, type CorrelationData, CostBreakdown, type Coupon, type CreateAccountLinkOptions, type CreateApiKeyOptions, CreateBetaCodesOptions, CreateCollectionOptions, type CreateConnectedAccountOptions, type CreateCustomerOptions, type CreateDsarOptions, type CreatePaymentIntentOptions, type CreatePayoutOptions, type CreateRefundOptions, type CreateSandboxOptions, type CreateScheduleOptions, type CreateTenantOptions, type CreateTransferOptions, type CreateWebhookOptions, type CreditBalance, type CreditTransaction, type CreditType, type CronExpression, CronPresets, CryptoKeyMetadata, type Currency, type Customer, DEFAULT_BULKHEAD_OPTIONS, DEFAULT_CIRCUIT_BREAKER_OPTIONS, DEFAULT_RETRY_OPTIONS, type DataBreachRecord, type DataCategory, type DataInventoryItem, type DataMap, type DataSensitivity, type DataSubjectRequest, type DataType, DatabaseAIUsage, type DatabaseAIUsageConfig, DatabaseAuditLog, type DatabaseAuditLogConfig, DatabaseBilling, type DatabaseBillingConfig, DatabaseCompliance, DatabaseErrorReporter, type DatabaseErrorReporterConfig, DatabaseNotification, type DatabaseNotificationConfig, DatabasePromptStore, type DatabasePromptStoreConfig, DefaultTimeouts, type DeleteAccountOptions, type DeleteHookContext, type DeliveryAttempt, type DeliveryQuery, type DeliveryStatus, type DetailedHealthResponse, DeterministicEncryptedField, type DevPortalConfig, type DeveloperMetrics, type Device, type DeviceAuthMethod, type DeviceCommand, type DeviceConfig, type DeviceConnectionState, type DeviceCredentials, type DeviceGroup, type DeviceGroupQuery, type DeviceLocation, type DeviceQuery, type DeviceQueryResult, type DeviceShadow, type DeviceStatus, type DirectoryAttributeMapping, type DirectoryConfig, DocumentStatus, type DsarAttachment, type DsarNote, type DsarStatus, type DsarType, type DunningActionType, type DunningAttempt, type DunningConfig, type EmailHookContext, EmailMessage, EmailResult, EncryptOptions, EncryptedField, type EnrollMfaOptions, type EnrollMfaResult, type ErrorContext, type ErrorHookContext, type ErrorLevel, type ErrorReport, type ErrorReporterConfig, type EvidenceType, type ExperimentMetrics, type FallbackOptions, type FallbackResult, FallbackStrategies, type FirmwareStatus, type FirmwareUpdate, type FirmwareVersion, type GeneratedSdk, GenericOIDCAuthSSO, type GenericOIDCConfig, GoogleAIAdapter, type GoogleAIAdapterConfig, type HealthCheckResult, type HealthEndpoints, type HealthEndpointsOptions, type HealthStatus, type HookRegistry, type HttpMethod, HttpWebhook, type HttpWebhookConfig, IAI, IAIUsage, type IAuditLog, type IAuth, type IAuthSSO, IBeta, type IBilling, ICache, type ICompliance, ICrypto, IDatabase, type IDevPortal, type IDevice, IEmail, type IErrorReporter, type IHealth, type IHealthCheckable, ILogger, IMetrics, type INotification, type IPayment, IPlatform, type IPromptStore, IQueryBuilder, IQueue, IRAG, type IScheduler, IStorage, type ITenant, type IWebhook, type InboundWebhookConfig, type InboundWebhookContext, IngestionOptions, IngestionResult, type InsertHookContext, type InviteMemberOptions, type Invoice, type InvoiceLineItem, type InvoiceQuery, type InvoiceStatus, Job, JobEventHandler, JobEventType, type JobHookContext, JobOptions, JobState, KeyRotationResult, ListBetaCodesOptions, type ListTenantsOptions, type LivenessResponse, MemoryAuditLog, type MemoryAuditLogConfig, MemoryAuth, MemoryAuthSSO, MemoryBilling, MemoryCompliance, MemoryCrypto, MemoryDevPortal, MemoryDevice, MemoryErrorReporter, type MemoryErrorReporterConfig, MemoryNotification, type MemoryNotificationConfig, MemoryPayment, MemoryPromptStore, MemoryRateLimiterStorage, MemoryScheduler, type MemorySchedulerConfig, MemoryTenant, MemoryWebhook, type MemoryWebhookConfig, type Meter, type MetricsEndpoint, type MetricsEndpointOptions, MetricsSummary, type MfaChallenge, type MfaFactor, type MfaFactorType, type Middleware, type MiddlewareChain, type MiddlewareChainOptions, type MiddlewareContext, NodeCrypto, type NodeCryptoConfig, type NotificationAction, type NotificationCategory, type NotificationChannel, type NotificationConfig, type NotificationData, type NotificationPreferences, type NotificationPriority, type NotificationQuery, type NotificationResult, type NotificationStats, type NotificationStatus, type NotificationTarget, NotificationTemplates, type OAuthOptions, type OAuthProvider, type OAuthResult, type OidcAuthRequest, type OidcAuthResponse, type OidcClaimMapping, type OidcIdpConfig, OpenAIAdapter, type OpenAIAdapterConfig, type ParameterLocation, type PaymentConfig, type PaymentError, type PaymentErrorCode, PaymentErrorMessages, type PaymentEventType, type PaymentIntent, type PaymentMethod, type PaymentMethodType, type PaymentStatus, type PaymentWebhookEvent, type Payout, type PayoutStatus, type PiaMitigation, type PiaRisk, type PiaStatus, PineconeRAG, type PineconeRAGConfig, type PlatformHealthResult, PlatformHealthStatus, type PlatformHooks, PostgresBeta, type PostgresBetaConfig, type PostgresConfig, PostgresDatabase, PostgresTenant, type PostgresTenantConfig, type Price, type PricingModel, type PricingTier, type PrivacyImpactAssessment, type Product, type Prompt, type PromptChain, type PromptChainStep, type PromptExperiment, type PromptQuery, type PromptQueryResult, type PromptStatus, type PromptStoreConfig, type PromptType, type PromptUsageRecord, type PromptUsageStats, type PromptVariable, type PromptVariant, type PromptVersion, type ProvisioningConfig, type ProvisioningRequest, type ProvisioningResult, type ProvisioningStatus, type PushSubscription, type QueryHookContext, QueryResult, QueueScheduler, type QueueSchedulerConfig, Quota, QuotaStatus, QuotaType, RAGChunk, RAGCollection, RAGConfig, RAGDocument, RAGPipeline, RAGSearchQuery, RAGSearchResponse, RAGSearchResult, type RateLimitAlgorithm, RateLimitError, type RateLimitInfo, RateLimitPresets, type RateLimiterStorage, type ReadinessResponse, type RecordConsentOptions, RedisCache, type RedisClientOptions, type RedisConfig, type Refund, type RefundReason, type RefundStatus, type RenderOptions, type RenderedPrompt, RepeatOptions, ResendEmail, type ResetPasswordOptions, type RetentionAction, type RetentionExecution, type RetentionPolicy, RetryConfigs, type RetryOptions, RetryPredicates, type RetryResult, type RevenueMetrics, type RiskLevel, S3Storage, type SamlAssertion, type SamlAttributeMapping, type SamlAuthRequest, type SamlAuthResponse, type SamlIdpConfig, type SamlNameIdFormat, type SamlSpConfig, type Sandbox, type SandboxConfig, type SandboxLimits, type SandboxStatus, type SandboxUsage, type ScheduleContext, type ScheduleExecution, type ScheduleHandler, type ScheduleQuery, type ScheduleState, type ScheduleUpdateOptions, type ScheduledJob, type SchedulerConfig, type SchedulerStats, type ScimConfig, type ScimUser, type SdkConfig, type SdkFile, type SdkLanguage, type SendCommandOptions, type SendNotificationOptions, type ServiceHealth, type ShadowDelta, type ShadowMetadata, type ShadowUpdate, type SignInWithEmailOptions, type SignInWithMagicLinkOptions, type SignInWithPhoneOptions, type SignUpWithEmailOptions, type SignatureAlgorithm, type SlidingWindowRateLimitOptions, type SmtpConfig, SmtpEmail, type SsoSession, type StartupResponse, StorageFile, type StoredAuditEvent, type StoredNotification, StripePayment, type StripePaymentConfig, type Subscription, type SubscriptionDiscount, type SubscriptionItem, type SubscriptionMetrics, type SubscriptionQuery, type SubscriptionStatus, SupabaseAuth, type SupabaseAuthConfig, SupabaseDatabase, SupabaseStorage, type SupabaseStorageConfig, type TaxBreakdown, type TelemetryMessage, type TelemetryQuery, type TelemetryResult, type Tenant, type TenantBranding, type TenantContext, type TenantDatabaseConfig, type TenantInvitation, type TenantIsolationModel, type TenantMember, type TenantMemberStatus, type TenantQuotas, type TenantResolutionOptions, type TenantResolutionStrategy, type TenantRole, type TenantSecuritySettings, type TenantSettings, type TenantStatus, type TenantUsage, TimeoutError, type TimeoutOptions, type TokenBucketOptions, type TosAcceptance, type Transfer, type TransferStatus, type Unsubscribe, UpdateBetaSettingsOptions, type UpdateCustomerOptions, type UpdateHookContext, type UpdatePasswordOptions, type UpdatePaymentIntentOptions, type UpdateScheduleOptions, type UpdateStatus, type UpdateTenantOptions, type UpdateUserOptions, type UpdateWebhookOptions, type UploadHookContext, UploadOptions, UpstashCache, UsageAlert, UsageCategory, type UsageEvent, UsageInterval, UsageInvoice, UsageQuery, UsageQueryResult, UsageRecord, UsageSummary, type UsageSummaryRecord, UsageTrend, type VerificationResult, type VerifyMfaOptions, type VerifyPhoneOtpOptions, type VerifyWebhookOptions, WeaviateRAG, type WeaviateRAGConfig, type WebhookConfig, type WebhookDelivery, type WebhookEndpoint, type WebhookEvent, WebhookEventTypes, type WebhookQuery, type WebhookState, type WebhookStats, type WebhookTestEndpoint, type WebhookTestEvent, calculateRetryDelay, closeSharedRedis, composeHookRegistries, correlationContext, createAnthropicAdapter, createAppLogger, createAuthError, createBulkhead, createCacheMiddleware, createCachedFallback, createCircuitBreaker, createDefaultPreferences, createErrorReport, createExpressHealthHandlers, createExpressMetricsHandler, createGoogleAIAdapter, createHealthEndpoints, createHealthServer, createHookRegistry, createIpKeyGenerator, createJobContext, createLoggingMiddleware, createMetricsEndpoint, createMetricsMiddleware, createMetricsServer, createMiddlewareChain, createMiddlewareContext, createObservabilityServer, createOpenAIAdapter, createPaymentError, createPineconeRAG, createRateLimitMiddleware, createRedisClient, createRequestContext, createRequestIdMiddleware, createSlowQueryMiddleware, createTenantMiddleware, createTimeoutMiddleware, createUserKeyGenerator, createWeaviateRAG, describeCron, filterChannelsByPreferences, formatAmount, generateAuditId, generateChecksum, generateDeliveryId, generateErrorId, generateEventId, generateFingerprint, generateNotificationId, generatePaymentId, generateScheduleId, generateSecureToken, generateWebhookId, generateWebhookSecret, getContext, getLogMeta, getNextCronRun, getRequestId, getSharedRedis, getTenantId, getTraceId, getUserId, isAuthError, isInContext, isInQuietHours, isPaymentError, isValidCron, matchAction, matchEventType, raceTimeout, retryable, runWithContext, runWithContextAsync, timedHealthCheck, toHealthCheckResult, withCorrelation, withCorrelationAsync, withFallback, withFallbackChain, withFallbackResult, withRetry, withRetryResult, withTimeout, withTimeoutWrapper };