@nexus-cortex/core 4.130.0 → 4.131.1
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/.env.defaults +168 -2
- package/dist/adapters/ChatCompletionsAPIAdapter.d.ts.map +1 -1
- package/dist/adapters/ChatCompletionsAPIAdapter.js +5 -1
- package/dist/adapters/ChatCompletionsAPIAdapter.js.map +1 -1
- package/dist/commands/SlashCommandRegistry.d.ts.map +1 -1
- package/dist/commands/SlashCommandRegistry.js +7 -0
- package/dist/commands/SlashCommandRegistry.js.map +1 -1
- package/dist/config/AnthropicCredentialService.d.ts.map +1 -1
- package/dist/config/AnthropicCredentialService.js +2 -1
- package/dist/config/AnthropicCredentialService.js.map +1 -1
- package/dist/config/RuntimeConfigRegistry.d.ts.map +1 -1
- package/dist/config/RuntimeConfigRegistry.js +18 -0
- package/dist/config/RuntimeConfigRegistry.js.map +1 -1
- package/dist/config/SettingsLoader.d.ts +3 -0
- package/dist/config/SettingsLoader.d.ts.map +1 -1
- package/dist/config/SettingsLoader.js +42 -0
- package/dist/config/SettingsLoader.js.map +1 -1
- package/dist/config/SettingsSchema.d.ts +19 -0
- package/dist/config/SettingsSchema.d.ts.map +1 -1
- package/dist/config/SettingsSchema.js +172 -0
- package/dist/config/SettingsSchema.js.map +1 -1
- package/dist/config/effectiveConfig.d.ts.map +1 -1
- package/dist/config/effectiveConfig.js +20 -2
- package/dist/config/effectiveConfig.js.map +1 -1
- package/dist/config/index.d.ts +4 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +4 -0
- package/dist/config/index.js.map +1 -1
- package/dist/config/localBrowser.d.ts +13 -0
- package/dist/config/localBrowser.d.ts.map +1 -0
- package/dist/config/localBrowser.js +53 -0
- package/dist/config/localBrowser.js.map +1 -0
- package/dist/config/logRedaction.d.ts +5 -0
- package/dist/config/logRedaction.d.ts.map +1 -0
- package/dist/config/logRedaction.js +68 -0
- package/dist/config/logRedaction.js.map +1 -0
- package/dist/config/secretProviders.d.ts +16 -0
- package/dist/config/secretProviders.d.ts.map +1 -0
- package/dist/config/secretProviders.js +26 -0
- package/dist/config/secretProviders.js.map +1 -0
- package/dist/config/secretsVault.d.ts +121 -0
- package/dist/config/secretsVault.d.ts.map +1 -0
- package/dist/config/secretsVault.js +320 -0
- package/dist/config/secretsVault.js.map +1 -0
- package/dist/config/spaSecretTypes.d.ts +329 -0
- package/dist/config/spaSecretTypes.d.ts.map +1 -0
- package/dist/config/spaSecretTypes.js +326 -0
- package/dist/config/spaSecretTypes.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp/McpClient.d.ts +2 -0
- package/dist/mcp/McpClient.d.ts.map +1 -1
- package/dist/mcp/McpClient.js +9 -1
- package/dist/mcp/McpClient.js.map +1 -1
- package/dist/mcp/McpServerRegistry.d.ts +2 -13
- package/dist/mcp/McpServerRegistry.d.ts.map +1 -1
- package/dist/mcp/McpServerRegistry.js +17 -2
- package/dist/mcp/McpServerRegistry.js.map +1 -1
- package/dist/mcp/essentialMcpTools.d.ts +11 -0
- package/dist/mcp/essentialMcpTools.d.ts.map +1 -0
- package/dist/mcp/essentialMcpTools.js +22 -0
- package/dist/mcp/essentialMcpTools.js.map +1 -0
- package/dist/mcp/mcpSchemaCompat.d.ts +9 -0
- package/dist/mcp/mcpSchemaCompat.d.ts.map +1 -0
- package/dist/mcp/mcpSchemaCompat.js +32 -0
- package/dist/mcp/mcpSchemaCompat.js.map +1 -0
- package/dist/middleware/HelperModelMiddleware.d.ts +4 -0
- package/dist/middleware/HelperModelMiddleware.d.ts.map +1 -1
- package/dist/middleware/HelperModelMiddleware.js +2 -2
- package/dist/middleware/HelperModelMiddleware.js.map +1 -1
- package/dist/middleware/SystemMessageMiddleware.d.ts.map +1 -1
- package/dist/middleware/SystemMessageMiddleware.js +6 -0
- package/dist/middleware/SystemMessageMiddleware.js.map +1 -1
- package/dist/middleware/permissions/DefaultPolicies.d.ts.map +1 -1
- package/dist/middleware/permissions/DefaultPolicies.js +2 -0
- package/dist/middleware/permissions/DefaultPolicies.js.map +1 -1
- package/dist/orchestrator/APIClient.d.ts.map +1 -1
- package/dist/orchestrator/APIClient.js +46 -1
- package/dist/orchestrator/APIClient.js.map +1 -1
- package/dist/orchestrator/CortexOrchestrator.d.ts +43 -8
- package/dist/orchestrator/CortexOrchestrator.d.ts.map +1 -1
- package/dist/orchestrator/CortexOrchestrator.js +339 -38
- package/dist/orchestrator/CortexOrchestrator.js.map +1 -1
- package/dist/orchestrator/HerdrSubAgentRunner.d.ts.map +1 -1
- package/dist/orchestrator/HerdrSubAgentRunner.js +2 -1
- package/dist/orchestrator/HerdrSubAgentRunner.js.map +1 -1
- package/dist/orchestrator/SubAgentProcessManager.d.ts.map +1 -1
- package/dist/orchestrator/SubAgentProcessManager.js +2 -0
- package/dist/orchestrator/SubAgentProcessManager.js.map +1 -1
- package/dist/orchestrator/browserWallNudge.d.ts +93 -0
- package/dist/orchestrator/browserWallNudge.d.ts.map +1 -0
- package/dist/orchestrator/browserWallNudge.js +227 -0
- package/dist/orchestrator/browserWallNudge.js.map +1 -0
- package/dist/orchestrator/citationVerification.d.ts.map +1 -1
- package/dist/orchestrator/citationVerification.js +16 -0
- package/dist/orchestrator/citationVerification.js.map +1 -1
- package/dist/orchestrator/cortexProxyFetch.d.ts +8 -0
- package/dist/orchestrator/cortexProxyFetch.d.ts.map +1 -1
- package/dist/orchestrator/cortexProxyFetch.js +32 -0
- package/dist/orchestrator/cortexProxyFetch.js.map +1 -1
- package/dist/orchestrator/endTurnGates.d.ts +39 -0
- package/dist/orchestrator/endTurnGates.d.ts.map +1 -1
- package/dist/orchestrator/endTurnGates.js +159 -3
- package/dist/orchestrator/endTurnGates.js.map +1 -1
- package/dist/orchestrator/imageTtl.d.ts.map +1 -1
- package/dist/orchestrator/imageTtl.js +14 -5
- package/dist/orchestrator/imageTtl.js.map +1 -1
- package/dist/orchestrator/integrityVerification.d.ts +2 -0
- package/dist/orchestrator/integrityVerification.d.ts.map +1 -1
- package/dist/orchestrator/integrityVerification.js +2 -2
- package/dist/orchestrator/integrityVerification.js.map +1 -1
- package/dist/orchestrator/requestDebugLog.d.ts +4 -0
- package/dist/orchestrator/requestDebugLog.d.ts.map +1 -0
- package/dist/orchestrator/requestDebugLog.js +55 -0
- package/dist/orchestrator/requestDebugLog.js.map +1 -0
- package/dist/orchestrator/requirementsVerification.d.ts +4 -0
- package/dist/orchestrator/requirementsVerification.d.ts.map +1 -1
- package/dist/orchestrator/requirementsVerification.js +12 -6
- package/dist/orchestrator/requirementsVerification.js.map +1 -1
- package/dist/orchestrator/subAgentTimeout.d.ts +3 -0
- package/dist/orchestrator/subAgentTimeout.d.ts.map +1 -1
- package/dist/orchestrator/subAgentTimeout.js +6 -0
- package/dist/orchestrator/subAgentTimeout.js.map +1 -1
- package/dist/orchestrator/toolAllowlist.d.ts +29 -0
- package/dist/orchestrator/toolAllowlist.d.ts.map +1 -1
- package/dist/orchestrator/toolAllowlist.js +45 -0
- package/dist/orchestrator/toolAllowlist.js.map +1 -1
- package/dist/tools/ToolProfile.d.ts +5 -21
- package/dist/tools/ToolProfile.d.ts.map +1 -1
- package/dist/tools/ToolProfile.js +17 -2
- package/dist/tools/ToolProfile.js.map +1 -1
- package/dist/tools/registries/BaseToolRegistry.d.ts.map +1 -1
- package/dist/tools/registries/BaseToolRegistry.js +26 -6
- package/dist/tools/registries/BaseToolRegistry.js.map +1 -1
- package/dist/training/AutoResearchConfirm.d.ts +105 -0
- package/dist/training/AutoResearchConfirm.d.ts.map +1 -0
- package/dist/training/AutoResearchConfirm.js +111 -0
- package/dist/training/AutoResearchConfirm.js.map +1 -0
- package/dist/training/AutoResearchGate.d.ts +6 -0
- package/dist/training/AutoResearchGate.d.ts.map +1 -1
- package/dist/training/AutoResearchGate.js +8 -2
- package/dist/training/AutoResearchGate.js.map +1 -1
- package/dist/training/AutoResearchGuards.d.ts +86 -0
- package/dist/training/AutoResearchGuards.d.ts.map +1 -0
- package/dist/training/AutoResearchGuards.js +81 -0
- package/dist/training/AutoResearchGuards.js.map +1 -0
- package/dist/training/BenchRunner.d.ts +21 -5
- package/dist/training/BenchRunner.d.ts.map +1 -1
- package/dist/training/BenchRunner.js +126 -54
- package/dist/training/BenchRunner.js.map +1 -1
- package/dist/training/EvalGuard.d.ts +43 -0
- package/dist/training/EvalGuard.d.ts.map +1 -0
- package/dist/training/EvalGuard.js +131 -0
- package/dist/training/EvalGuard.js.map +1 -0
- package/dist/training/ExperimentRunner.d.ts +22 -0
- package/dist/training/ExperimentRunner.d.ts.map +1 -1
- package/dist/training/ExperimentRunner.js +45 -9
- package/dist/training/ExperimentRunner.js.map +1 -1
- package/dist/training/endTurnResolver.d.ts +23 -1
- package/dist/training/endTurnResolver.d.ts.map +1 -1
- package/dist/training/endTurnResolver.js +35 -3
- package/dist/training/endTurnResolver.js.map +1 -1
- package/dist/training/mentorRole.d.ts.map +1 -1
- package/dist/training/mentorRole.js +6 -1
- package/dist/training/mentorRole.js.map +1 -1
- package/dist/training/scopeCheck.d.ts +41 -0
- package/dist/training/scopeCheck.d.ts.map +1 -0
- package/dist/training/scopeCheck.js +119 -0
- package/dist/training/scopeCheck.js.map +1 -0
- package/dist/training/usageAccounting.d.ts +13 -0
- package/dist/training/usageAccounting.d.ts.map +1 -1
- package/dist/training/usageAccounting.js +11 -0
- package/dist/training/usageAccounting.js.map +1 -1
- package/dist/utils/repairToolJson.d.ts +19 -0
- package/dist/utils/repairToolJson.d.ts.map +1 -0
- package/dist/utils/repairToolJson.js +122 -0
- package/dist/utils/repairToolJson.js.map +1 -0
- package/package.json +5 -4
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Nexus Secrets - Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Secure storage for API keys, tokens, and sensitive configuration.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Encrypted secret payload stored in database
|
|
8
|
+
*/
|
|
9
|
+
export interface EncryptedSecret {
|
|
10
|
+
/** Base64 encoded initialization vector (12 bytes for AES-GCM) */
|
|
11
|
+
iv: string;
|
|
12
|
+
/** Base64 encoded ciphertext */
|
|
13
|
+
ciphertext: string;
|
|
14
|
+
/** Base64 encoded authentication tag (16 bytes for AES-GCM) */
|
|
15
|
+
tag: string;
|
|
16
|
+
/** Encryption version for future migrations */
|
|
17
|
+
version: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Secret types within a provider
|
|
21
|
+
*/
|
|
22
|
+
export type SecretType = 'api-key' | 'api-secret' | 'token' | 'access-token' | 'refresh-token' | 'account-id' | 'username' | 'password' | 'client-id' | 'client-secret' | 'private-key' | 'public-key' | 'webhook-secret' | 'other';
|
|
23
|
+
/**
|
|
24
|
+
* Known providers with their configurations
|
|
25
|
+
*/
|
|
26
|
+
export type KnownProvider = 'alpaca' | 'huggingface' | 'openai' | 'anthropic' | 'google' | 'github' | 'aws' | 'azure' | 'firebase' | 'supabase' | 'spacetimedb' | 'stripe' | 'twilio' | 'sendgrid' | 'polygon' | 'finnhub' | 'alpha-vantage' | 'iex-cloud' | 'quandl' | 'tradier' | 'interactive-brokers' | 'coinbase' | 'binance' | 'kraken' | 'workos' | 'xai' | 'deepseek' | 'custom';
|
|
27
|
+
/**
|
|
28
|
+
* Provider configuration with expected secret types
|
|
29
|
+
*/
|
|
30
|
+
export interface ProviderConfig {
|
|
31
|
+
id: KnownProvider;
|
|
32
|
+
name: string;
|
|
33
|
+
description: string;
|
|
34
|
+
icon?: string;
|
|
35
|
+
color: string;
|
|
36
|
+
expectedSecrets: SecretType[];
|
|
37
|
+
docsUrl?: string;
|
|
38
|
+
/** Regex patterns to auto-detect this provider from API key format */
|
|
39
|
+
keyPatterns?: RegExp[];
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Registry of known providers and their configurations
|
|
43
|
+
*/
|
|
44
|
+
export declare const PROVIDER_CONFIGS: Record<KnownProvider, ProviderConfig>;
|
|
45
|
+
/**
|
|
46
|
+
* Legacy category type (for backwards compatibility)
|
|
47
|
+
* @deprecated Use provider + secretType instead
|
|
48
|
+
*/
|
|
49
|
+
export type SecretCategory = 'api-keys' | 'database' | 'authentication' | 'services' | 'other';
|
|
50
|
+
/**
|
|
51
|
+
* Secret scope distinguishes platform (developer) secrets from user secrets:
|
|
52
|
+
* - platform: Infrastructure-level secrets (SpacetimeDB, Sentry, etc.) - developer only
|
|
53
|
+
* - user: Personal API keys (Alpaca, OpenAI, etc.) - visible to end users
|
|
54
|
+
*/
|
|
55
|
+
export type SecretScope = 'platform' | 'user';
|
|
56
|
+
/**
|
|
57
|
+
* System-level user ID for platform secrets.
|
|
58
|
+
* Platform secrets use this ID instead of individual user IDs so they're
|
|
59
|
+
* accessible to the platform regardless of which user is logged in.
|
|
60
|
+
* These are infrastructure secrets (API keys for data feeds, etc.) managed by admins.
|
|
61
|
+
*/
|
|
62
|
+
export declare const PLATFORM_SYSTEM_ID = "nexus-platform-system";
|
|
63
|
+
/**
|
|
64
|
+
* Full secret entry stored in database
|
|
65
|
+
*/
|
|
66
|
+
export interface Secret {
|
|
67
|
+
/** Unique identifier (UUID) */
|
|
68
|
+
id: string;
|
|
69
|
+
/** Secret name/key (e.g., "ALPACA_API_KEY") */
|
|
70
|
+
key: string;
|
|
71
|
+
/** Owner user ID */
|
|
72
|
+
userId: string;
|
|
73
|
+
/** Encrypted value payload */
|
|
74
|
+
encrypted: EncryptedSecret;
|
|
75
|
+
/** Optional encrypted description */
|
|
76
|
+
encryptedDescription?: EncryptedSecret;
|
|
77
|
+
/** Provider this secret belongs to (e.g., "alpaca", "openai") */
|
|
78
|
+
provider: KnownProvider;
|
|
79
|
+
/** Type of secret (e.g., "api-key", "token", "password") */
|
|
80
|
+
secretType: SecretType;
|
|
81
|
+
/** Legacy category for organization (deprecated, use provider instead) */
|
|
82
|
+
category: SecretCategory;
|
|
83
|
+
/** Scope: platform (developer infrastructure) or user (personal API keys) */
|
|
84
|
+
scope: SecretScope;
|
|
85
|
+
/** Creation timestamp (Unix ms) */
|
|
86
|
+
createdAt: number;
|
|
87
|
+
/** Last update timestamp (Unix ms) */
|
|
88
|
+
updatedAt: number;
|
|
89
|
+
/** Optional expiration timestamp (Unix ms) */
|
|
90
|
+
expiresAt?: number;
|
|
91
|
+
/** Whether synced to cloud (subscriber feature) */
|
|
92
|
+
synced: boolean;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Secret metadata (without sensitive encrypted values)
|
|
96
|
+
*/
|
|
97
|
+
export interface SecretMetadata {
|
|
98
|
+
id: string;
|
|
99
|
+
key: string;
|
|
100
|
+
provider: KnownProvider;
|
|
101
|
+
secretType: SecretType;
|
|
102
|
+
category: SecretCategory;
|
|
103
|
+
scope: SecretScope;
|
|
104
|
+
description?: string;
|
|
105
|
+
createdAt: number;
|
|
106
|
+
updatedAt: number;
|
|
107
|
+
expiresAt?: number;
|
|
108
|
+
synced: boolean;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Options when creating/updating a secret
|
|
112
|
+
*/
|
|
113
|
+
export interface SecretOptions {
|
|
114
|
+
/** Human-readable description */
|
|
115
|
+
description?: string;
|
|
116
|
+
/** Provider this secret belongs to */
|
|
117
|
+
provider?: KnownProvider;
|
|
118
|
+
/** Type of secret */
|
|
119
|
+
secretType?: SecretType;
|
|
120
|
+
/** Legacy category for organization */
|
|
121
|
+
category?: SecretCategory;
|
|
122
|
+
/** Secret scope (platform or user) - defaults to 'user' */
|
|
123
|
+
scope?: SecretScope;
|
|
124
|
+
/** Optional expiration timestamp */
|
|
125
|
+
expiresAt?: number;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Secrets service configuration
|
|
129
|
+
*/
|
|
130
|
+
export interface SecretsServiceConfig {
|
|
131
|
+
/** User ID for scoping secrets */
|
|
132
|
+
userId: string;
|
|
133
|
+
/** Auth token for key derivation */
|
|
134
|
+
authToken: string;
|
|
135
|
+
/** User's subscription tier */
|
|
136
|
+
tier: SecretTier;
|
|
137
|
+
/** Whether to enable cloud sync (subscriber feature) */
|
|
138
|
+
enableCloudSync?: boolean;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Result of a sync operation
|
|
142
|
+
*/
|
|
143
|
+
export interface SyncResult {
|
|
144
|
+
/** Whether sync was successful */
|
|
145
|
+
success: boolean;
|
|
146
|
+
/** Number of secrets uploaded to cloud */
|
|
147
|
+
uploaded: number;
|
|
148
|
+
/** Number of secrets downloaded from cloud */
|
|
149
|
+
downloaded: number;
|
|
150
|
+
/** Any conflicts encountered */
|
|
151
|
+
conflicts: SyncConflict[];
|
|
152
|
+
/** Error message if sync failed */
|
|
153
|
+
error?: string;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Conflict during sync
|
|
157
|
+
*/
|
|
158
|
+
export interface SyncConflict {
|
|
159
|
+
secretKey: string;
|
|
160
|
+
localUpdatedAt: number;
|
|
161
|
+
remoteUpdatedAt: number;
|
|
162
|
+
resolution: 'local' | 'remote' | 'manual';
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Secret access log entry
|
|
166
|
+
*/
|
|
167
|
+
export interface SecretAccessLog {
|
|
168
|
+
timestamp: number;
|
|
169
|
+
action: 'read' | 'write' | 'delete' | 'list' | 'export' | 'import';
|
|
170
|
+
secretKey: string;
|
|
171
|
+
source: string;
|
|
172
|
+
success: boolean;
|
|
173
|
+
error?: string;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Storage adapter interface for secrets
|
|
177
|
+
*/
|
|
178
|
+
export interface ISecretsStorageAdapter {
|
|
179
|
+
/** Initialize the adapter */
|
|
180
|
+
initialize(): Promise<void>;
|
|
181
|
+
/** Get a secret by ID */
|
|
182
|
+
get(id: string): Promise<Secret | null>;
|
|
183
|
+
/** Get a secret by key */
|
|
184
|
+
getByKey(userId: string, key: string): Promise<Secret | null>;
|
|
185
|
+
/** Save a secret */
|
|
186
|
+
set(secret: Secret): Promise<void>;
|
|
187
|
+
/** Delete a secret by ID */
|
|
188
|
+
delete(id: string): Promise<void>;
|
|
189
|
+
/** List all secrets for a user */
|
|
190
|
+
list(userId: string): Promise<Secret[]>;
|
|
191
|
+
/** Count secrets for a user */
|
|
192
|
+
count(userId: string): Promise<number>;
|
|
193
|
+
/** Get last sync timestamp */
|
|
194
|
+
getLastSync(): Promise<number>;
|
|
195
|
+
/** Set last sync timestamp */
|
|
196
|
+
setLastSync(timestamp: number): Promise<void>;
|
|
197
|
+
/** Clear all secrets (for logout) */
|
|
198
|
+
clear(): Promise<void>;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Main secrets service interface
|
|
202
|
+
*/
|
|
203
|
+
export interface ISecretsService {
|
|
204
|
+
initialize(config: SecretsServiceConfig): Promise<void>;
|
|
205
|
+
isInitialized(): boolean;
|
|
206
|
+
getUserId(): string | null;
|
|
207
|
+
getUserTier(): SecretTier | null;
|
|
208
|
+
lock(): void;
|
|
209
|
+
get(key: string): Promise<string | null>;
|
|
210
|
+
set(key: string, value: string, options?: SecretOptions): Promise<void>;
|
|
211
|
+
delete(key: string): Promise<void>;
|
|
212
|
+
has(key: string): Promise<boolean>;
|
|
213
|
+
list(): Promise<SecretMetadata[]>;
|
|
214
|
+
getBase64(key: string): Promise<string | null>;
|
|
215
|
+
getBasicAuth(keyName: string, secretName: string): Promise<string | null>;
|
|
216
|
+
export(): Promise<Record<string, string>>;
|
|
217
|
+
import(secrets: Record<string, string>, options?: SecretOptions): Promise<void>;
|
|
218
|
+
sync(): Promise<SyncResult>;
|
|
219
|
+
enableCloudSync(): Promise<void>;
|
|
220
|
+
disableCloudSync(): Promise<void>;
|
|
221
|
+
isCloudSyncEnabled(): boolean;
|
|
222
|
+
getUsage(): Promise<{
|
|
223
|
+
used: number;
|
|
224
|
+
limit: number;
|
|
225
|
+
}>;
|
|
226
|
+
}
|
|
227
|
+
/** Maximum secrets for free tier */
|
|
228
|
+
export declare const FREE_TIER_SECRET_LIMIT = 5;
|
|
229
|
+
/** Maximum secrets for pro tier */
|
|
230
|
+
export declare const PRO_TIER_SECRET_LIMIT = 25;
|
|
231
|
+
/** Maximum secrets for creator tier */
|
|
232
|
+
export declare const CREATOR_TIER_SECRET_LIMIT = 100;
|
|
233
|
+
/** Maximum secrets for team tier */
|
|
234
|
+
export declare const TEAM_TIER_SECRET_LIMIT = 1000;
|
|
235
|
+
/** Maximum secrets for admin tier — intentionally 10× team so admins are
|
|
236
|
+
* never gated by the secret cap during platform setup or debugging. */
|
|
237
|
+
export declare const ADMIN_TIER_SECRET_LIMIT = 10000;
|
|
238
|
+
/** Legacy: Maximum secrets for subscriber tiers (kept for backwards compatibility) */
|
|
239
|
+
export declare const SUBSCRIBER_SECRET_LIMIT = 1000;
|
|
240
|
+
/** All tiers recognised by the secrets service. */
|
|
241
|
+
export type SecretTier = 'free' | 'pro' | 'creator' | 'team' | 'admin';
|
|
242
|
+
/** Get secret limit for a tier */
|
|
243
|
+
export declare function getSecretLimitForTier(tier: SecretTier): number;
|
|
244
|
+
/** PBKDF2 iterations for key derivation */
|
|
245
|
+
export declare const PBKDF2_ITERATIONS = 100000;
|
|
246
|
+
/** Encryption version */
|
|
247
|
+
export declare const ENCRYPTION_VERSION = 1;
|
|
248
|
+
/** IndexedDB database name */
|
|
249
|
+
export declare const SECRETS_DB_NAME = "nexus-secrets";
|
|
250
|
+
/** IndexedDB store name */
|
|
251
|
+
export declare const SECRETS_STORE_NAME = "secrets";
|
|
252
|
+
/** IndexedDB store name for bindings */
|
|
253
|
+
export declare const BINDINGS_STORE_NAME = "secret-bindings";
|
|
254
|
+
/**
|
|
255
|
+
* Binding scope determines what the secret is available to:
|
|
256
|
+
* - platform: Available to ALL commands across the entire app
|
|
257
|
+
* - module: Available to all commands within a specific module
|
|
258
|
+
* - command: Available only to a specific command
|
|
259
|
+
*/
|
|
260
|
+
export type BindingScope = 'platform' | 'module' | 'command';
|
|
261
|
+
/**
|
|
262
|
+
* A binding links a secret to a platform, module, or command
|
|
263
|
+
* When a command runs, secrets are resolved in order: platform → module → command
|
|
264
|
+
*/
|
|
265
|
+
export interface SecretBinding {
|
|
266
|
+
/** Unique binding ID */
|
|
267
|
+
id: string;
|
|
268
|
+
/** User ID for scoping */
|
|
269
|
+
userId: string;
|
|
270
|
+
/** Binding scope level */
|
|
271
|
+
scope: BindingScope;
|
|
272
|
+
/** The command shortcut (only for scope='command') */
|
|
273
|
+
command: string | null;
|
|
274
|
+
/** Module ID (for scope='module' or 'command') */
|
|
275
|
+
moduleId: string | null;
|
|
276
|
+
/** Secret key to inject (from secrets store) */
|
|
277
|
+
secretKey: string;
|
|
278
|
+
/** Environment variable name to inject as (e.g., "API_KEY") */
|
|
279
|
+
envVarName: string;
|
|
280
|
+
/** When binding was created */
|
|
281
|
+
createdAt: number;
|
|
282
|
+
/** When binding was last updated */
|
|
283
|
+
updatedAt: number;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Metadata for a binding (used in UI)
|
|
287
|
+
*/
|
|
288
|
+
export interface BindingMetadata {
|
|
289
|
+
id: string;
|
|
290
|
+
scope: BindingScope;
|
|
291
|
+
command: string | null;
|
|
292
|
+
moduleId: string | null;
|
|
293
|
+
secretKey: string;
|
|
294
|
+
envVarName: string;
|
|
295
|
+
createdAt: number;
|
|
296
|
+
updatedAt: number;
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Options when creating a binding
|
|
300
|
+
*/
|
|
301
|
+
export interface BindingOptions {
|
|
302
|
+
envVarName?: string;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Storage adapter interface for secret bindings
|
|
306
|
+
*/
|
|
307
|
+
export interface ISecretBindingsAdapter {
|
|
308
|
+
/** Initialize the adapter */
|
|
309
|
+
initialize(): Promise<void>;
|
|
310
|
+
/** Get all bindings for a user */
|
|
311
|
+
list(userId: string): Promise<SecretBinding[]>;
|
|
312
|
+
/** Get bindings for a specific command (scope='command') */
|
|
313
|
+
getByCommand(userId: string, command: string): Promise<SecretBinding[]>;
|
|
314
|
+
/** Get bindings for a specific module (scope='module') */
|
|
315
|
+
getByModule(userId: string, moduleId: string): Promise<SecretBinding[]>;
|
|
316
|
+
/** Get platform-wide bindings (scope='platform') */
|
|
317
|
+
getPlatformBindings(userId: string): Promise<SecretBinding[]>;
|
|
318
|
+
/** Get a binding by ID */
|
|
319
|
+
get(id: string): Promise<SecretBinding | null>;
|
|
320
|
+
/** Save a binding */
|
|
321
|
+
set(binding: SecretBinding): Promise<void>;
|
|
322
|
+
/** Delete a binding by ID */
|
|
323
|
+
delete(id: string): Promise<void>;
|
|
324
|
+
/** Delete all bindings for a command */
|
|
325
|
+
deleteByCommand(userId: string, command: string): Promise<void>;
|
|
326
|
+
/** Clear all bindings */
|
|
327
|
+
clear(): Promise<void>;
|
|
328
|
+
}
|
|
329
|
+
//# sourceMappingURL=spaSecretTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spaSecretTypes.d.ts","sourceRoot":"","sources":["../../src/config/spaSecretTypes.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAMH;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,kEAAkE;IAClE,EAAE,EAAE,MAAM,CAAC;IACX,gCAAgC;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,GAAG,EAAE,MAAM,CAAC;IACZ,+CAA+C;IAC/C,OAAO,EAAE,MAAM,CAAC;CACjB;AAMD;;GAEG;AACH,MAAM,MAAM,UAAU,GAClB,SAAS,GACT,YAAY,GACZ,OAAO,GACP,cAAc,GACd,eAAe,GACf,YAAY,GACZ,UAAU,GACV,UAAU,GACV,WAAW,GACX,eAAe,GACf,aAAa,GACb,YAAY,GACZ,gBAAgB,GAChB,OAAO,CAAC;AAEZ;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB,QAAQ,GACR,a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U,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5B,kCAAkC;IAClC,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;IAE/C,4DAA4D;IAC5D,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;IAExE,0DAA0D;IAC1D,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;IAExE,oDAAoD;IACpD,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;IAE9D,0BAA0B;IAC1B,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC;IAE/C,qBAAqB;IACrB,GAAG,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3C,6BAA6B;IAC7B,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAElC,wCAAwC;IACxC,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEhE,yBAAyB;IACzB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB"}
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
// GENERATED by packages/core/scripts/sync-spa-secret-types.mjs from nexus-terminal/services/secrets/types.ts — do not edit.
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Nexus Secrets - Type Definitions
|
|
5
|
+
*
|
|
6
|
+
* Secure storage for API keys, tokens, and sensitive configuration.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Registry of known providers and their configurations
|
|
10
|
+
*/
|
|
11
|
+
export const PROVIDER_CONFIGS = {
|
|
12
|
+
alpaca: {
|
|
13
|
+
id: 'alpaca',
|
|
14
|
+
name: 'Alpaca',
|
|
15
|
+
description: 'Commission-free stock & crypto trading API',
|
|
16
|
+
icon: '🦙',
|
|
17
|
+
color: '#FFDC00',
|
|
18
|
+
expectedSecrets: ['api-key', 'api-secret', 'account-id'],
|
|
19
|
+
docsUrl: 'https://alpaca.markets/docs/',
|
|
20
|
+
keyPatterns: [/^PK[A-Z0-9]{18,}$/, /^AK[A-Z0-9]{18,}$/],
|
|
21
|
+
},
|
|
22
|
+
huggingface: {
|
|
23
|
+
id: 'huggingface',
|
|
24
|
+
name: 'Hugging Face',
|
|
25
|
+
description: 'AI models and datasets platform',
|
|
26
|
+
icon: '🤗',
|
|
27
|
+
color: '#FFD21E',
|
|
28
|
+
expectedSecrets: ['api-key', 'token'],
|
|
29
|
+
docsUrl: 'https://huggingface.co/docs',
|
|
30
|
+
keyPatterns: [/^hf_[a-zA-Z0-9]{20,}$/],
|
|
31
|
+
},
|
|
32
|
+
openai: {
|
|
33
|
+
id: 'openai',
|
|
34
|
+
name: 'OpenAI',
|
|
35
|
+
description: 'GPT and AI models API',
|
|
36
|
+
icon: '🧠',
|
|
37
|
+
color: '#10A37F',
|
|
38
|
+
expectedSecrets: ['api-key'],
|
|
39
|
+
docsUrl: 'https://platform.openai.com/docs',
|
|
40
|
+
keyPatterns: [/^sk-[a-zA-Z0-9]{20,}$/],
|
|
41
|
+
},
|
|
42
|
+
anthropic: {
|
|
43
|
+
id: 'anthropic',
|
|
44
|
+
name: 'Anthropic',
|
|
45
|
+
description: 'Claude AI models API',
|
|
46
|
+
icon: '🔮',
|
|
47
|
+
color: '#D4A574',
|
|
48
|
+
expectedSecrets: ['api-key'],
|
|
49
|
+
docsUrl: 'https://docs.anthropic.com',
|
|
50
|
+
keyPatterns: [/^sk-ant-[a-zA-Z0-9-]{20,}$/],
|
|
51
|
+
},
|
|
52
|
+
google: {
|
|
53
|
+
id: 'google',
|
|
54
|
+
name: 'Google Cloud',
|
|
55
|
+
description: 'Google Cloud Platform services',
|
|
56
|
+
icon: '☁️',
|
|
57
|
+
color: '#4285F4',
|
|
58
|
+
expectedSecrets: ['api-key', 'client-id', 'client-secret', 'private-key'],
|
|
59
|
+
docsUrl: 'https://cloud.google.com/docs',
|
|
60
|
+
keyPatterns: [/^AIza[a-zA-Z0-9_-]{35}$/],
|
|
61
|
+
},
|
|
62
|
+
github: {
|
|
63
|
+
id: 'github',
|
|
64
|
+
name: 'GitHub',
|
|
65
|
+
description: 'Code hosting and CI/CD platform',
|
|
66
|
+
icon: '🐙',
|
|
67
|
+
color: '#333333',
|
|
68
|
+
expectedSecrets: ['token', 'client-id', 'client-secret', 'webhook-secret'],
|
|
69
|
+
docsUrl: 'https://docs.github.com',
|
|
70
|
+
keyPatterns: [/^ghp_[a-zA-Z0-9]{36}$/, /^gho_[a-zA-Z0-9]{36}$/, /^github_pat_[a-zA-Z0-9_]{22,}$/],
|
|
71
|
+
},
|
|
72
|
+
aws: {
|
|
73
|
+
id: 'aws',
|
|
74
|
+
name: 'Amazon Web Services',
|
|
75
|
+
description: 'AWS cloud infrastructure',
|
|
76
|
+
icon: '📦',
|
|
77
|
+
color: '#FF9900',
|
|
78
|
+
expectedSecrets: ['api-key', 'api-secret', 'account-id'],
|
|
79
|
+
docsUrl: 'https://docs.aws.amazon.com',
|
|
80
|
+
keyPatterns: [/^AKIA[A-Z0-9]{16}$/],
|
|
81
|
+
},
|
|
82
|
+
azure: {
|
|
83
|
+
id: 'azure',
|
|
84
|
+
name: 'Microsoft Azure',
|
|
85
|
+
description: 'Azure cloud services',
|
|
86
|
+
icon: '☁️',
|
|
87
|
+
color: '#0078D4',
|
|
88
|
+
expectedSecrets: ['api-key', 'client-id', 'client-secret', 'account-id'],
|
|
89
|
+
docsUrl: 'https://docs.microsoft.com/azure',
|
|
90
|
+
},
|
|
91
|
+
firebase: {
|
|
92
|
+
id: 'firebase',
|
|
93
|
+
name: 'Firebase',
|
|
94
|
+
description: 'Google app development platform',
|
|
95
|
+
icon: '🔥',
|
|
96
|
+
color: '#FFCA28',
|
|
97
|
+
expectedSecrets: ['api-key', 'client-id', 'private-key'],
|
|
98
|
+
docsUrl: 'https://firebase.google.com/docs',
|
|
99
|
+
},
|
|
100
|
+
supabase: {
|
|
101
|
+
id: 'supabase',
|
|
102
|
+
name: 'Supabase',
|
|
103
|
+
description: 'Open source Firebase alternative',
|
|
104
|
+
icon: '⚡',
|
|
105
|
+
color: '#3ECF8E',
|
|
106
|
+
expectedSecrets: ['api-key', 'api-secret', 'account-id'],
|
|
107
|
+
docsUrl: 'https://supabase.com/docs',
|
|
108
|
+
},
|
|
109
|
+
spacetimedb: {
|
|
110
|
+
id: 'spacetimedb',
|
|
111
|
+
name: 'SpacetimeDB',
|
|
112
|
+
description: 'Real-time database platform',
|
|
113
|
+
icon: '🌌',
|
|
114
|
+
color: '#6366F1',
|
|
115
|
+
expectedSecrets: ['token', 'account-id'],
|
|
116
|
+
docsUrl: 'https://spacetimedb.com/docs',
|
|
117
|
+
},
|
|
118
|
+
stripe: {
|
|
119
|
+
id: 'stripe',
|
|
120
|
+
name: 'Stripe',
|
|
121
|
+
description: 'Payment processing platform',
|
|
122
|
+
icon: '💳',
|
|
123
|
+
color: '#635BFF',
|
|
124
|
+
expectedSecrets: ['api-key', 'api-secret', 'webhook-secret'],
|
|
125
|
+
docsUrl: 'https://stripe.com/docs',
|
|
126
|
+
keyPatterns: [/^sk_live_[a-zA-Z0-9]{24,}$/, /^sk_test_[a-zA-Z0-9]{24,}$/, /^pk_live_[a-zA-Z0-9]{24,}$/, /^pk_test_[a-zA-Z0-9]{24,}$/, /^whsec_[a-zA-Z0-9]{24,}$/],
|
|
127
|
+
},
|
|
128
|
+
twilio: {
|
|
129
|
+
id: 'twilio',
|
|
130
|
+
name: 'Twilio',
|
|
131
|
+
description: 'Communication APIs (SMS, Voice)',
|
|
132
|
+
icon: '📱',
|
|
133
|
+
color: '#F22F46',
|
|
134
|
+
expectedSecrets: ['account-id', 'api-key', 'api-secret'],
|
|
135
|
+
docsUrl: 'https://www.twilio.com/docs',
|
|
136
|
+
keyPatterns: [/^AC[a-f0-9]{32}$/, /^SK[a-f0-9]{32}$/],
|
|
137
|
+
},
|
|
138
|
+
sendgrid: {
|
|
139
|
+
id: 'sendgrid',
|
|
140
|
+
name: 'SendGrid',
|
|
141
|
+
description: 'Email delivery service',
|
|
142
|
+
icon: '📧',
|
|
143
|
+
color: '#1A82E2',
|
|
144
|
+
expectedSecrets: ['api-key'],
|
|
145
|
+
docsUrl: 'https://docs.sendgrid.com',
|
|
146
|
+
keyPatterns: [/^SG\.[a-zA-Z0-9_-]{22,}\.[a-zA-Z0-9_-]{22,}$/],
|
|
147
|
+
},
|
|
148
|
+
polygon: {
|
|
149
|
+
id: 'polygon',
|
|
150
|
+
name: 'Polygon.io',
|
|
151
|
+
description: 'Stock market data API',
|
|
152
|
+
icon: '📈',
|
|
153
|
+
color: '#8B5CF6',
|
|
154
|
+
expectedSecrets: ['api-key'],
|
|
155
|
+
docsUrl: 'https://polygon.io/docs',
|
|
156
|
+
keyPatterns: [/^[a-zA-Z0-9_]{32}$/],
|
|
157
|
+
},
|
|
158
|
+
finnhub: {
|
|
159
|
+
id: 'finnhub',
|
|
160
|
+
name: 'Finnhub',
|
|
161
|
+
description: 'Real-time stock API',
|
|
162
|
+
icon: '📊',
|
|
163
|
+
color: '#00C853',
|
|
164
|
+
expectedSecrets: ['api-key'],
|
|
165
|
+
docsUrl: 'https://finnhub.io/docs/api',
|
|
166
|
+
},
|
|
167
|
+
'alpha-vantage': {
|
|
168
|
+
id: 'alpha-vantage',
|
|
169
|
+
name: 'Alpha Vantage',
|
|
170
|
+
description: 'Free stock API',
|
|
171
|
+
icon: '📉',
|
|
172
|
+
color: '#1E88E5',
|
|
173
|
+
expectedSecrets: ['api-key'],
|
|
174
|
+
docsUrl: 'https://www.alphavantage.co/documentation/',
|
|
175
|
+
},
|
|
176
|
+
'iex-cloud': {
|
|
177
|
+
id: 'iex-cloud',
|
|
178
|
+
name: 'IEX Cloud',
|
|
179
|
+
description: 'Financial data platform',
|
|
180
|
+
icon: '💹',
|
|
181
|
+
color: '#6C5CE7',
|
|
182
|
+
expectedSecrets: ['api-key', 'api-secret'],
|
|
183
|
+
docsUrl: 'https://iexcloud.io/docs/',
|
|
184
|
+
},
|
|
185
|
+
quandl: {
|
|
186
|
+
id: 'quandl',
|
|
187
|
+
name: 'Quandl/Nasdaq',
|
|
188
|
+
description: 'Financial and economic data',
|
|
189
|
+
icon: '📋',
|
|
190
|
+
color: '#0091EA',
|
|
191
|
+
expectedSecrets: ['api-key'],
|
|
192
|
+
docsUrl: 'https://docs.data.nasdaq.com/',
|
|
193
|
+
},
|
|
194
|
+
tradier: {
|
|
195
|
+
id: 'tradier',
|
|
196
|
+
name: 'Tradier',
|
|
197
|
+
description: 'Brokerage API',
|
|
198
|
+
icon: '🏦',
|
|
199
|
+
color: '#00BCD4',
|
|
200
|
+
expectedSecrets: ['api-key', 'access-token', 'account-id'],
|
|
201
|
+
docsUrl: 'https://documentation.tradier.com/',
|
|
202
|
+
},
|
|
203
|
+
'interactive-brokers': {
|
|
204
|
+
id: 'interactive-brokers',
|
|
205
|
+
name: 'Interactive Brokers',
|
|
206
|
+
description: 'Professional trading platform',
|
|
207
|
+
icon: '🏛️',
|
|
208
|
+
color: '#D32F2F',
|
|
209
|
+
expectedSecrets: ['username', 'password', 'account-id'],
|
|
210
|
+
docsUrl: 'https://interactivebrokers.github.io/',
|
|
211
|
+
},
|
|
212
|
+
coinbase: {
|
|
213
|
+
id: 'coinbase',
|
|
214
|
+
name: 'Coinbase',
|
|
215
|
+
description: 'Cryptocurrency exchange',
|
|
216
|
+
icon: '🪙',
|
|
217
|
+
color: '#0052FF',
|
|
218
|
+
expectedSecrets: ['api-key', 'api-secret'],
|
|
219
|
+
docsUrl: 'https://docs.cloud.coinbase.com/',
|
|
220
|
+
},
|
|
221
|
+
binance: {
|
|
222
|
+
id: 'binance',
|
|
223
|
+
name: 'Binance',
|
|
224
|
+
description: 'Cryptocurrency exchange',
|
|
225
|
+
icon: '🔶',
|
|
226
|
+
color: '#F0B90B',
|
|
227
|
+
expectedSecrets: ['api-key', 'api-secret'],
|
|
228
|
+
docsUrl: 'https://binance-docs.github.io/apidocs/',
|
|
229
|
+
},
|
|
230
|
+
kraken: {
|
|
231
|
+
id: 'kraken',
|
|
232
|
+
name: 'Kraken',
|
|
233
|
+
description: 'Cryptocurrency exchange',
|
|
234
|
+
icon: '🐙',
|
|
235
|
+
color: '#5741D9',
|
|
236
|
+
expectedSecrets: ['api-key', 'private-key'],
|
|
237
|
+
docsUrl: 'https://docs.kraken.com/',
|
|
238
|
+
},
|
|
239
|
+
workos: {
|
|
240
|
+
id: 'workos',
|
|
241
|
+
name: 'WorkOS',
|
|
242
|
+
description: 'Enterprise SSO and directory sync',
|
|
243
|
+
color: '#6363F1',
|
|
244
|
+
expectedSecrets: ['api-key', 'client-id', 'client-secret', 'webhook-secret'],
|
|
245
|
+
docsUrl: 'https://workos.com/docs',
|
|
246
|
+
},
|
|
247
|
+
xai: {
|
|
248
|
+
id: 'xai',
|
|
249
|
+
name: 'xAI',
|
|
250
|
+
description: 'Grok AI models API',
|
|
251
|
+
icon: '𝕏',
|
|
252
|
+
color: '#000000',
|
|
253
|
+
expectedSecrets: ['api-key'],
|
|
254
|
+
docsUrl: 'https://docs.x.ai/',
|
|
255
|
+
keyPatterns: [/^xai-[a-zA-Z0-9]{20,}$/],
|
|
256
|
+
},
|
|
257
|
+
deepseek: {
|
|
258
|
+
id: 'deepseek',
|
|
259
|
+
name: 'DeepSeek',
|
|
260
|
+
description: 'DeepSeek AI models API',
|
|
261
|
+
icon: '🔬',
|
|
262
|
+
color: '#4D6BFE',
|
|
263
|
+
expectedSecrets: ['api-key'],
|
|
264
|
+
docsUrl: 'https://api-docs.deepseek.com/',
|
|
265
|
+
keyPatterns: [/^sk-[a-f0-9]{32,}$/],
|
|
266
|
+
},
|
|
267
|
+
custom: {
|
|
268
|
+
id: 'custom',
|
|
269
|
+
name: 'Custom',
|
|
270
|
+
description: 'Custom provider',
|
|
271
|
+
icon: '⚙️',
|
|
272
|
+
color: '#94a3b8',
|
|
273
|
+
expectedSecrets: ['api-key', 'api-secret', 'token', 'username', 'password', 'account-id', 'other'],
|
|
274
|
+
},
|
|
275
|
+
};
|
|
276
|
+
/**
|
|
277
|
+
* System-level user ID for platform secrets.
|
|
278
|
+
* Platform secrets use this ID instead of individual user IDs so they're
|
|
279
|
+
* accessible to the platform regardless of which user is logged in.
|
|
280
|
+
* These are infrastructure secrets (API keys for data feeds, etc.) managed by admins.
|
|
281
|
+
*/
|
|
282
|
+
export const PLATFORM_SYSTEM_ID = 'nexus-platform-system';
|
|
283
|
+
// =============================================================================
|
|
284
|
+
// CONSTANTS
|
|
285
|
+
// =============================================================================
|
|
286
|
+
/** Maximum secrets for free tier */
|
|
287
|
+
export const FREE_TIER_SECRET_LIMIT = 5;
|
|
288
|
+
/** Maximum secrets for pro tier */
|
|
289
|
+
export const PRO_TIER_SECRET_LIMIT = 25;
|
|
290
|
+
/** Maximum secrets for creator tier */
|
|
291
|
+
export const CREATOR_TIER_SECRET_LIMIT = 100;
|
|
292
|
+
/** Maximum secrets for team tier */
|
|
293
|
+
export const TEAM_TIER_SECRET_LIMIT = 1000;
|
|
294
|
+
/** Maximum secrets for admin tier — intentionally 10× team so admins are
|
|
295
|
+
* never gated by the secret cap during platform setup or debugging. */
|
|
296
|
+
export const ADMIN_TIER_SECRET_LIMIT = 10000;
|
|
297
|
+
/** Legacy: Maximum secrets for subscriber tiers (kept for backwards compatibility) */
|
|
298
|
+
export const SUBSCRIBER_SECRET_LIMIT = 1000;
|
|
299
|
+
/** Get secret limit for a tier */
|
|
300
|
+
export function getSecretLimitForTier(tier) {
|
|
301
|
+
switch (tier) {
|
|
302
|
+
case 'free':
|
|
303
|
+
return FREE_TIER_SECRET_LIMIT;
|
|
304
|
+
case 'pro':
|
|
305
|
+
return PRO_TIER_SECRET_LIMIT;
|
|
306
|
+
case 'creator':
|
|
307
|
+
return CREATOR_TIER_SECRET_LIMIT;
|
|
308
|
+
case 'team':
|
|
309
|
+
return TEAM_TIER_SECRET_LIMIT;
|
|
310
|
+
case 'admin':
|
|
311
|
+
return ADMIN_TIER_SECRET_LIMIT;
|
|
312
|
+
default:
|
|
313
|
+
return FREE_TIER_SECRET_LIMIT;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
/** PBKDF2 iterations for key derivation */
|
|
317
|
+
export const PBKDF2_ITERATIONS = 100000;
|
|
318
|
+
/** Encryption version */
|
|
319
|
+
export const ENCRYPTION_VERSION = 1;
|
|
320
|
+
/** IndexedDB database name */
|
|
321
|
+
export const SECRETS_DB_NAME = 'nexus-secrets';
|
|
322
|
+
/** IndexedDB store name */
|
|
323
|
+
export const SECRETS_STORE_NAME = 'secrets';
|
|
324
|
+
/** IndexedDB store name for bindings */
|
|
325
|
+
export const BINDINGS_STORE_NAME = 'secret-bindings';
|
|
326
|
+
//# sourceMappingURL=spaSecretTypes.js.map
|