@versini/sassysaint-common 3.0.0 → 3.1.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/dist/index.d.ts CHANGED
@@ -20,8 +20,9 @@ declare const ALL_PROVIDERS: readonly ["OpenAI", "Anthropic", "Google"];
20
20
  /**
21
21
  * List of available models TODAY.
22
22
  */
23
- declare const MODEL_GPT5 = "gpt-5";
23
+ declare const MODEL_GPT4 = "gpt-4.1";
24
24
  declare const MODEL_GPT4_MINI = "gpt-4.1-nano";
25
+ declare const MODEL_O4_MINI = "o4-mini";
25
26
  declare const MODEL_CLAUDE_HAIKU = "claude-3-5-haiku-latest";
26
27
  declare const MODEL_CLAUDE_SONNET = "claude-sonnet-4-20250514";
27
28
  declare const MODEL_GEMINI_FLASH = "gemini-2.5-flash-preview-05-20";
@@ -31,13 +32,13 @@ declare const MODEL_SONAR_PRO = "sonar-pro";
31
32
  /**
32
33
  * List of all models available TODAY.
33
34
  */
34
- declare const ALL_MODELS: readonly ["gpt-5", "gpt-4.1-nano", "claude-3-5-haiku-latest", "claude-sonnet-4-20250514", "gemini-2.5-flash-preview-05-20", "gemini-2.5-pro", "sonar", "sonar-pro"];
35
+ declare const ALL_MODELS: readonly ["gpt-4.1", "gpt-4.1-nano", "o4-mini", "claude-3-5-haiku-latest", "claude-sonnet-4-20250514", "gemini-2.5-flash-preview-05-20", "gemini-2.5-pro", "sonar", "sonar-pro"];
35
36
  declare const ALL_REASONING_MODELS: string[];
36
37
  /**
37
38
  * List of models available according to the providers.
38
39
  */
39
40
  declare const MODELS_PER_PROVIDER: {
40
- readonly OpenAI: readonly ["gpt-4.1-nano", "gpt-5"];
41
+ readonly OpenAI: readonly ["gpt-4.1-nano", "gpt-4.1", "o4-mini"];
41
42
  readonly Anthropic: readonly ["claude-3-5-haiku-latest", "claude-sonnet-4-20250514"];
42
43
  readonly Google: readonly ["gemini-2.5-flash-preview-05-20", "gemini-2.5-pro"];
43
44
  readonly Perplexity: readonly ["sonar", "sonar-pro"];
@@ -81,4 +82,202 @@ declare const CALLISTO_CHAT_ID_HEADER = "x-callisto-chat-id";
81
82
  */
82
83
  declare const findProvider: (modelName: string) => null | typeof PROVIDER_ANTHROPIC | typeof PROVIDER_OPENAI | typeof PROVIDER_GOOGLE;
83
84
 
84
- export { ALL_MODELS, ALL_PROVIDERS, ALL_REASONING_MODELS, CALLISTO_CHAT_ID_HEADER, DEFAULT_PROVIDER, MODELS_PER_PROVIDER, MODEL_CLAUDE_HAIKU, MODEL_CLAUDE_SONNET, MODEL_GEMINI_FLASH, MODEL_GEMINI_PRO, MODEL_GPT4_MINI, MODEL_GPT5, MODEL_SONAR, MODEL_SONAR_PRO, PLAN_FREE, PLAN_PLUS, PLAN_PREMIUM, POLICY_GRANTS, PROVIDER_ANTHROPIC, PROVIDER_GOOGLE, PROVIDER_MEMORY, PROVIDER_OPENAI, PROVIDER_PERPLEXITY, PROVIDER_ROLE_MAP, PROVIDER_SUMMARY, ROLE_ASSISTANT, ROLE_HIDDEN, ROLE_INTERNAL, ROLE_SYSTEM, ROLE_USER, findProvider };
85
+ /**
86
+ * TypeScript interfaces for Server-Mediated Encryption
87
+ */
88
+ /**
89
+ * RSA key pair stored in memory for the current session
90
+ */
91
+ interface ClientCryptoKeyPair {
92
+ publicKey: CryptoKey;
93
+ privateKey: CryptoKey;
94
+ }
95
+ /**
96
+ * Serializable format for public key exchange with server
97
+ */
98
+ interface SerializablePublicKey {
99
+ /** Public key in JSON Web Key format */
100
+ jwk: JsonWebKey;
101
+ /** Key type identifier */
102
+ kty: "RSA";
103
+ /** Algorithm identifier */
104
+ alg: "RSA-OAEP-256";
105
+ }
106
+ /**
107
+ * Response from server's key exchange mutation
108
+ */
109
+ interface KeyExchangeResponse {
110
+ /** Server's public key in JWK format */
111
+ serverPublicKey: string;
112
+ /** Server's key identifier for rotation tracking */
113
+ keyId: string;
114
+ /** List of supported encryption algorithms */
115
+ supportedAlgorithms: string[];
116
+ }
117
+ /**
118
+ * Client crypto session state stored in memory
119
+ */
120
+ interface CryptoSession {
121
+ /** Client's RSA key pair */
122
+ clientKeyPair: ClientCryptoKeyPair;
123
+ /** Server's public key for encryption */
124
+ serverPublicKey: CryptoKey;
125
+ /** Unique device/session identifier */
126
+ deviceId: string;
127
+ /** Server's key identifier */
128
+ serverKeyId: string;
129
+ /** When this session was established */
130
+ establishedAt: Date;
131
+ }
132
+ /**
133
+ * Encrypted message format for transport
134
+ */
135
+ interface EncryptedMessage {
136
+ /** Base64-encoded encrypted data */
137
+ data: string;
138
+ /** Algorithm used for encryption */
139
+ algorithm: "RSA-OAEP";
140
+ /** Key ID used for encryption */
141
+ keyId: string;
142
+ }
143
+ /**
144
+ * Parameters for RSA key generation
145
+ */
146
+ interface RSAKeyGenParams {
147
+ /** RSA modulus length in bits */
148
+ modulusLength: 2048 | 4096;
149
+ /** Public exponent */
150
+ publicExponent: Uint8Array;
151
+ /** Hash algorithm for OAEP */
152
+ hash: "SHA-256";
153
+ }
154
+ /**
155
+ * Error types for crypto operations
156
+ */
157
+ declare class CryptoError extends Error {
158
+ readonly code: "KEY_GENERATION_FAILED" | "ENCRYPTION_FAILED" | "DECRYPTION_FAILED" | "KEY_IMPORT_FAILED" | "INVALID_KEY_FORMAT";
159
+ readonly originalError?: Error | undefined;
160
+ constructor(message: string, code: "KEY_GENERATION_FAILED" | "ENCRYPTION_FAILED" | "DECRYPTION_FAILED" | "KEY_IMPORT_FAILED" | "INVALID_KEY_FORMAT", originalError?: Error | undefined);
161
+ }
162
+ /**
163
+ * Configuration options for crypto operations
164
+ */
165
+ interface CryptoConfig {
166
+ /** RSA key size in bits */
167
+ keySize: 2048 | 4096;
168
+ /** Enable debug logging */
169
+ debug: boolean;
170
+ }
171
+ /**
172
+ * Default crypto configuration
173
+ */
174
+ declare const DEFAULT_CRYPTO_CONFIG: CryptoConfig;
175
+
176
+ /**
177
+ * Generate a new RSA key pair for the current session
178
+ */
179
+ declare function generateClientKeyPair(config?: Partial<CryptoConfig>): Promise<ClientCryptoKeyPair>;
180
+ /**
181
+ * Export public key to serializable format for server exchange
182
+ */
183
+ declare function exportPublicKey(publicKey: CryptoKey): Promise<SerializablePublicKey>;
184
+ /**
185
+ * Import server's public key from JWK format
186
+ */
187
+ declare function importServerPublicKey(serverPublicKeyJWK: string): Promise<CryptoKey>;
188
+ /**
189
+ * Encrypt message for transmission to server
190
+ */
191
+ declare function encryptForServer(message: string, serverPublicKey: CryptoKey, serverKeyId: string): Promise<EncryptedMessage>;
192
+ /**
193
+ * Decrypt message received from server
194
+ */
195
+ declare function decryptFromServer(encryptedMessage: EncryptedMessage, clientPrivateKey: CryptoKey): Promise<string>;
196
+ /**
197
+ * Create a complete crypto session with key exchange
198
+ */
199
+ declare function establishCryptoSession(keyExchangeResponse: KeyExchangeResponse, clientKeyPair: ClientCryptoKeyPair, deviceId: string): Promise<CryptoSession>;
200
+ /**
201
+ * Validate that a crypto session is still valid
202
+ */
203
+ declare function isCryptoSessionValid(session: CryptoSession): boolean;
204
+
205
+ /**
206
+ * Utility functions for crypto operations
207
+ */
208
+ /**
209
+ * Generate a unique device ID for this session
210
+ */
211
+ declare function generateDeviceId(): string;
212
+ /**
213
+ * Check if the current environment supports Web Crypto API
214
+ */
215
+ declare function isWebCryptoSupported(): boolean;
216
+ /**
217
+ * Validate that we're in a secure context (required for Web Crypto API)
218
+ */
219
+ declare function isSecureContext(): boolean;
220
+ /**
221
+ * Check if encryption is available in the current environment
222
+ */
223
+ declare function canUseEncryption(): boolean;
224
+ /**
225
+ * Convert ArrayBuffer to base64 string
226
+ */
227
+ declare function arrayBufferToBase64(buffer: ArrayBuffer): string;
228
+ /**
229
+ * Convert base64 string to ArrayBuffer
230
+ */
231
+ declare function base64ToArrayBuffer(base64: string): ArrayBuffer;
232
+ /**
233
+ * Safely stringify JSON with error handling
234
+ */
235
+ declare function safeStringify(obj: unknown): string;
236
+ /**
237
+ * Safely parse JSON with error handling
238
+ */
239
+ declare function safeParse<T = unknown>(json: string): T | null;
240
+ /**
241
+ * Debug logger for crypto operations (only in development)
242
+ *
243
+ * ⚠️ SECURITY WARNING: Never log sensitive data such as:
244
+ * - Private or public key objects
245
+ * - Encrypted or decrypted data
246
+ * - Raw cryptographic material
247
+ * - Device IDs or session identifiers
248
+ *
249
+ * Only log non-sensitive metadata like algorithms, key sizes, operation status, etc.
250
+ */
251
+ declare function debugLog(message: string, ...args: unknown[]): void;
252
+
253
+ type index_ClientCryptoKeyPair = ClientCryptoKeyPair;
254
+ type index_CryptoConfig = CryptoConfig;
255
+ type index_CryptoError = CryptoError;
256
+ declare const index_CryptoError: typeof CryptoError;
257
+ type index_CryptoSession = CryptoSession;
258
+ declare const index_DEFAULT_CRYPTO_CONFIG: typeof DEFAULT_CRYPTO_CONFIG;
259
+ type index_EncryptedMessage = EncryptedMessage;
260
+ type index_KeyExchangeResponse = KeyExchangeResponse;
261
+ type index_RSAKeyGenParams = RSAKeyGenParams;
262
+ type index_SerializablePublicKey = SerializablePublicKey;
263
+ declare const index_arrayBufferToBase64: typeof arrayBufferToBase64;
264
+ declare const index_base64ToArrayBuffer: typeof base64ToArrayBuffer;
265
+ declare const index_canUseEncryption: typeof canUseEncryption;
266
+ declare const index_debugLog: typeof debugLog;
267
+ declare const index_decryptFromServer: typeof decryptFromServer;
268
+ declare const index_encryptForServer: typeof encryptForServer;
269
+ declare const index_establishCryptoSession: typeof establishCryptoSession;
270
+ declare const index_exportPublicKey: typeof exportPublicKey;
271
+ declare const index_generateClientKeyPair: typeof generateClientKeyPair;
272
+ declare const index_generateDeviceId: typeof generateDeviceId;
273
+ declare const index_importServerPublicKey: typeof importServerPublicKey;
274
+ declare const index_isCryptoSessionValid: typeof isCryptoSessionValid;
275
+ declare const index_isSecureContext: typeof isSecureContext;
276
+ declare const index_isWebCryptoSupported: typeof isWebCryptoSupported;
277
+ declare const index_safeParse: typeof safeParse;
278
+ declare const index_safeStringify: typeof safeStringify;
279
+ declare namespace index {
280
+ export { type index_ClientCryptoKeyPair as ClientCryptoKeyPair, type index_CryptoConfig as CryptoConfig, index_CryptoError as CryptoError, type index_CryptoSession as CryptoSession, index_DEFAULT_CRYPTO_CONFIG as DEFAULT_CRYPTO_CONFIG, type index_EncryptedMessage as EncryptedMessage, type index_KeyExchangeResponse as KeyExchangeResponse, type index_RSAKeyGenParams as RSAKeyGenParams, type index_SerializablePublicKey as SerializablePublicKey, index_arrayBufferToBase64 as arrayBufferToBase64, index_base64ToArrayBuffer as base64ToArrayBuffer, index_canUseEncryption as canUseEncryption, index_debugLog as debugLog, index_decryptFromServer as decryptFromServer, index_encryptForServer as encryptForServer, index_establishCryptoSession as establishCryptoSession, index_exportPublicKey as exportPublicKey, index_generateClientKeyPair as generateClientKeyPair, index_generateDeviceId as generateDeviceId, index_importServerPublicKey as importServerPublicKey, index_isCryptoSessionValid as isCryptoSessionValid, index_isSecureContext as isSecureContext, index_isWebCryptoSupported as isWebCryptoSupported, index_safeParse as safeParse, index_safeStringify as safeStringify };
281
+ }
282
+
283
+ export { ALL_MODELS, ALL_PROVIDERS, ALL_REASONING_MODELS, CALLISTO_CHAT_ID_HEADER, DEFAULT_PROVIDER, MODELS_PER_PROVIDER, MODEL_CLAUDE_HAIKU, MODEL_CLAUDE_SONNET, MODEL_GEMINI_FLASH, MODEL_GEMINI_PRO, MODEL_GPT4, MODEL_GPT4_MINI, MODEL_O4_MINI, MODEL_SONAR, MODEL_SONAR_PRO, PLAN_FREE, PLAN_PLUS, PLAN_PREMIUM, POLICY_GRANTS, PROVIDER_ANTHROPIC, PROVIDER_GOOGLE, PROVIDER_MEMORY, PROVIDER_OPENAI, PROVIDER_PERPLEXITY, PROVIDER_ROLE_MAP, PROVIDER_SUMMARY, ROLE_ASSISTANT, ROLE_HIDDEN, ROLE_INTERNAL, ROLE_SYSTEM, ROLE_USER, index as crypto, findProvider };
package/dist/index.js CHANGED
@@ -1,88 +1,291 @@
1
- const T = "system", s = "user", E = "assistant", C = "hidden", f = "data", n = "OpenAI", t = "Anthropic", O = "Google", N = "Summary", S = "Memory", o = "Perplexity", h = n, H = [
2
- n,
3
- t,
4
- O
5
- ], _ = "gpt-5", P = "gpt-4.1-nano", A = "claude-3-5-haiku-latest", R = "claude-sonnet-4-20250514", L = "gemini-2.5-flash-preview-05-20", c = "gemini-2.5-pro", I = "sonar", M = "sonar-pro", i = "claude-sonnet-4", d = "claude-3", l = "gpt-4", p = "gpt-5", G = "o3", u = "o4", V = "gemini", U = "sonar", X = {
6
- [t]: [
7
- i,
8
- d
1
+ const g = "system", s = "user", c = "assistant", ee = "hidden", te = "data", a = "OpenAI", i = "Anthropic", y = "Google", M = "Summary", m = "Memory", d = "Perplexity", re = a, ne = [
2
+ a,
3
+ i,
4
+ y
5
+ ], _ = "gpt-4.1", l = "gpt-4.1-nano", u = "o4-mini", f = "claude-3-5-haiku-latest", p = "claude-sonnet-4-20250514", R = "gemini-2.5-flash-preview-05-20", A = "gemini-2.5-pro", P = "sonar", I = "sonar-pro", b = "claude-sonnet-4", h = "claude-3", T = "gpt-4", N = "o3", v = "o4", K = "gemini", C = "sonar", U = {
6
+ [i]: [
7
+ b,
8
+ h
9
9
  ],
10
- [n]: [
11
- p,
12
- l,
13
- G,
14
- u
10
+ [a]: [
11
+ T,
12
+ N,
13
+ v
15
14
  ],
16
- [O]: [V],
17
- [o]: [U]
18
- }, v = [
19
- _,
20
- P,
21
- A,
22
- R,
23
- L,
24
- c,
25
- I,
26
- M
27
- ], Y = [
15
+ [y]: [K],
16
+ [d]: [C]
17
+ }, oe = [
28
18
  _,
19
+ l,
20
+ u,
21
+ f,
22
+ p,
29
23
  R,
30
- c
31
- ], x = {
32
- [n]: [P, _],
33
- [t]: [A, R],
34
- [O]: [L, c],
35
- [o]: [I, M]
36
- }, F = {
37
- [n]: [T, s, E],
38
- [t]: [s, E],
39
- [N]: [s, E],
40
- [S]: [s, E],
41
- [O]: [s, E],
42
- [o]: [s, E]
43
- }, g = "sassy:free", m = "sassy:plus", y = "sassy:advanced", b = {
44
- PLAN_FREE: g,
45
- PLAN_PLUS: m,
46
- PLAN_PREMIUM: y,
24
+ A,
25
+ P,
26
+ I
27
+ ], se = [
28
+ u,
29
+ p,
30
+ A
31
+ ], ce = {
32
+ [a]: [l, _, u],
33
+ [i]: [f, p],
34
+ [y]: [R, A],
35
+ [d]: [P, I]
36
+ }, ae = {
37
+ [a]: [g, s, c],
38
+ [i]: [s, c],
39
+ [M]: [s, c],
40
+ [m]: [s, c],
41
+ [y]: [s, c],
42
+ [d]: [s, c]
43
+ }, k = "sassy:free", F = "sassy:plus", G = "sassy:advanced", ie = {
44
+ PLAN_FREE: k,
45
+ PLAN_PLUS: F,
46
+ PLAN_PREMIUM: G,
47
47
  REASONING: "sassy:advanced:reasoning"
48
- }, j = "x-callisto-chat-id", k = (D) => {
49
- for (const [e, a] of Object.entries(
50
- X
48
+ }, ye = "x-callisto-chat-id", Ee = (r) => {
49
+ for (const [e, n] of Object.entries(
50
+ U
51
51
  ))
52
- if (a.some((r) => D.startsWith(r)))
52
+ if (n.some((t) => r.startsWith(t)))
53
53
  return e;
54
54
  return null;
55
55
  };
56
+ class o extends Error {
57
+ constructor(e, n, t) {
58
+ super(e), this.code = n, this.originalError = t, this.name = "CryptoError";
59
+ }
60
+ }
61
+ const S = {
62
+ keySize: 4096,
63
+ debug: !1
64
+ };
65
+ async function V(r = {}) {
66
+ const e = { ...S, ...r };
67
+ try {
68
+ const n = {
69
+ modulusLength: e.keySize,
70
+ publicExponent: new Uint8Array([1, 0, 1]),
71
+ // 65537
72
+ hash: "SHA-256"
73
+ }, t = await crypto.subtle.generateKey(
74
+ {
75
+ name: "RSA-OAEP",
76
+ ...n
77
+ },
78
+ !0,
79
+ // extractable for public key export
80
+ ["encrypt", "decrypt"]
81
+ );
82
+ return e.debug && console.info("🔐 Generated RSA key pair:", {
83
+ keySize: e.keySize,
84
+ algorithm: "RSA-OAEP",
85
+ hash: "SHA-256",
86
+ publicKeyType: t.publicKey.type,
87
+ privateKeyType: t.privateKey.type,
88
+ publicKeyUsages: t.publicKey.usages,
89
+ privateKeyUsages: t.privateKey.usages
90
+ }), {
91
+ publicKey: t.publicKey,
92
+ privateKey: t.privateKey
93
+ };
94
+ } catch (n) {
95
+ throw new o(
96
+ `Failed to generate RSA key pair: ${n instanceof Error ? n.message : "Unknown error"}`,
97
+ "KEY_GENERATION_FAILED",
98
+ n instanceof Error ? n : void 0
99
+ );
100
+ }
101
+ }
102
+ async function x(r) {
103
+ try {
104
+ return {
105
+ jwk: await crypto.subtle.exportKey("jwk", r),
106
+ kty: "RSA",
107
+ alg: "RSA-OAEP-256"
108
+ };
109
+ } catch (e) {
110
+ throw new o(
111
+ `Failed to export public key: ${e instanceof Error ? e.message : "Unknown error"}`,
112
+ "KEY_IMPORT_FAILED",
113
+ e instanceof Error ? e : void 0
114
+ );
115
+ }
116
+ }
117
+ async function D(r) {
118
+ try {
119
+ const e = JSON.parse(r);
120
+ return await crypto.subtle.importKey(
121
+ "jwk",
122
+ e,
123
+ {
124
+ name: "RSA-OAEP",
125
+ hash: "SHA-256"
126
+ },
127
+ !1,
128
+ // not extractable
129
+ ["encrypt"]
130
+ );
131
+ } catch (e) {
132
+ throw new o(
133
+ `Failed to import server public key: ${e instanceof Error ? e.message : "Unknown error"}`,
134
+ "KEY_IMPORT_FAILED",
135
+ e instanceof Error ? e : void 0
136
+ );
137
+ }
138
+ }
139
+ async function Y(r, e, n) {
140
+ try {
141
+ const O = new TextEncoder().encode(r), E = await crypto.subtle.encrypt(
142
+ {
143
+ name: "RSA-OAEP"
144
+ },
145
+ e,
146
+ O
147
+ );
148
+ return {
149
+ data: btoa(
150
+ String.fromCharCode(...new Uint8Array(E))
151
+ ),
152
+ algorithm: "RSA-OAEP",
153
+ keyId: n
154
+ };
155
+ } catch (t) {
156
+ throw new o(
157
+ `Failed to encrypt message for server: ${t instanceof Error ? t.message : "Unknown error"}`,
158
+ "ENCRYPTION_FAILED",
159
+ t instanceof Error ? t : void 0
160
+ );
161
+ }
162
+ }
163
+ async function H(r, e) {
164
+ try {
165
+ const n = Uint8Array.from(
166
+ atob(r.data),
167
+ (E) => E.charCodeAt(0)
168
+ ), t = await crypto.subtle.decrypt(
169
+ {
170
+ name: "RSA-OAEP"
171
+ },
172
+ e,
173
+ n
174
+ );
175
+ return new TextDecoder().decode(t);
176
+ } catch (n) {
177
+ throw new o(
178
+ `Failed to decrypt message from server: ${n instanceof Error ? n.message : "Unknown error"}`,
179
+ "DECRYPTION_FAILED",
180
+ n instanceof Error ? n : void 0
181
+ );
182
+ }
183
+ }
184
+ async function X(r, e, n) {
185
+ try {
186
+ const t = await D(
187
+ r.serverPublicKey
188
+ );
189
+ return {
190
+ clientKeyPair: e,
191
+ serverPublicKey: t,
192
+ deviceId: n,
193
+ serverKeyId: r.keyId,
194
+ establishedAt: /* @__PURE__ */ new Date()
195
+ };
196
+ } catch (t) {
197
+ throw new o(
198
+ `Failed to establish crypto session: ${t instanceof Error ? t.message : "Unknown error"}`,
199
+ "KEY_IMPORT_FAILED",
200
+ t instanceof Error ? t : void 0
201
+ );
202
+ }
203
+ }
204
+ function $(r) {
205
+ return !(!r || !r.clientKeyPair || !r.serverPublicKey);
206
+ }
207
+ function j() {
208
+ const r = Date.now().toString(36), e = new Uint8Array(8);
209
+ if (typeof window < "u" && window.crypto?.getRandomValues)
210
+ window.crypto.getRandomValues(e);
211
+ else
212
+ for (let t = 0; t < e.length; t++)
213
+ e[t] = Math.floor(Math.random() * 256);
214
+ const n = Array.from(e).map((t) => t.toString(36)).join("");
215
+ return `device_${r}_${n}`;
216
+ }
217
+ function L() {
218
+ return typeof window < "u" && typeof window.crypto < "u" && typeof window.crypto.subtle < "u";
219
+ }
220
+ function w() {
221
+ return typeof window < "u" && (window.isSecureContext || window.location.protocol === "https:");
222
+ }
223
+ function z() {
224
+ return L() && w();
225
+ }
226
+ function B(r) {
227
+ const e = new Uint8Array(r);
228
+ let n = "";
229
+ for (let t = 0; t < e.byteLength; t++)
230
+ n += String.fromCharCode(e[t]);
231
+ return btoa(n);
232
+ }
233
+ function J(r) {
234
+ const e = atob(r), n = new Uint8Array(e.length);
235
+ for (let t = 0; t < e.length; t++)
236
+ n[t] = e.charCodeAt(t);
237
+ return n.buffer;
238
+ }
239
+ function W(r) {
240
+ try {
241
+ return JSON.stringify(r);
242
+ } catch {
243
+ return String(r);
244
+ }
245
+ }
246
+ function q(r) {
247
+ try {
248
+ return JSON.parse(r);
249
+ } catch {
250
+ return null;
251
+ }
252
+ }
253
+ function Q(r, ...e) {
254
+ typeof process < "u" && process.env && process.env.NODE_ENV === "development" && console.info(`🔐 [Crypto] ${r}`, ...e);
255
+ }
256
+ const de = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, CryptoError: o, DEFAULT_CRYPTO_CONFIG: S, arrayBufferToBase64: B, base64ToArrayBuffer: J, canUseEncryption: z, debugLog: Q, decryptFromServer: H, encryptForServer: Y, establishCryptoSession: X, exportPublicKey: x, generateClientKeyPair: V, generateDeviceId: j, importServerPublicKey: D, isCryptoSessionValid: $, isSecureContext: w, isWebCryptoSupported: L, safeParse: q, safeStringify: W }, Symbol.toStringTag, { value: "Module" }));
56
257
  export {
57
- v as ALL_MODELS,
58
- H as ALL_PROVIDERS,
59
- Y as ALL_REASONING_MODELS,
60
- j as CALLISTO_CHAT_ID_HEADER,
61
- h as DEFAULT_PROVIDER,
62
- x as MODELS_PER_PROVIDER,
63
- A as MODEL_CLAUDE_HAIKU,
64
- R as MODEL_CLAUDE_SONNET,
65
- L as MODEL_GEMINI_FLASH,
66
- c as MODEL_GEMINI_PRO,
67
- P as MODEL_GPT4_MINI,
68
- _ as MODEL_GPT5,
69
- I as MODEL_SONAR,
70
- M as MODEL_SONAR_PRO,
71
- g as PLAN_FREE,
72
- m as PLAN_PLUS,
73
- y as PLAN_PREMIUM,
74
- b as POLICY_GRANTS,
75
- t as PROVIDER_ANTHROPIC,
76
- O as PROVIDER_GOOGLE,
77
- S as PROVIDER_MEMORY,
78
- n as PROVIDER_OPENAI,
79
- o as PROVIDER_PERPLEXITY,
80
- F as PROVIDER_ROLE_MAP,
81
- N as PROVIDER_SUMMARY,
82
- E as ROLE_ASSISTANT,
83
- C as ROLE_HIDDEN,
84
- f as ROLE_INTERNAL,
85
- T as ROLE_SYSTEM,
258
+ oe as ALL_MODELS,
259
+ ne as ALL_PROVIDERS,
260
+ se as ALL_REASONING_MODELS,
261
+ ye as CALLISTO_CHAT_ID_HEADER,
262
+ re as DEFAULT_PROVIDER,
263
+ ce as MODELS_PER_PROVIDER,
264
+ f as MODEL_CLAUDE_HAIKU,
265
+ p as MODEL_CLAUDE_SONNET,
266
+ R as MODEL_GEMINI_FLASH,
267
+ A as MODEL_GEMINI_PRO,
268
+ _ as MODEL_GPT4,
269
+ l as MODEL_GPT4_MINI,
270
+ u as MODEL_O4_MINI,
271
+ P as MODEL_SONAR,
272
+ I as MODEL_SONAR_PRO,
273
+ k as PLAN_FREE,
274
+ F as PLAN_PLUS,
275
+ G as PLAN_PREMIUM,
276
+ ie as POLICY_GRANTS,
277
+ i as PROVIDER_ANTHROPIC,
278
+ y as PROVIDER_GOOGLE,
279
+ m as PROVIDER_MEMORY,
280
+ a as PROVIDER_OPENAI,
281
+ d as PROVIDER_PERPLEXITY,
282
+ ae as PROVIDER_ROLE_MAP,
283
+ M as PROVIDER_SUMMARY,
284
+ c as ROLE_ASSISTANT,
285
+ ee as ROLE_HIDDEN,
286
+ te as ROLE_INTERNAL,
287
+ g as ROLE_SYSTEM,
86
288
  s as ROLE_USER,
87
- k as findProvider
289
+ de as crypto,
290
+ Ee as findProvider
88
291
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@versini/sassysaint-common",
3
- "version": "3.0.0",
3
+ "version": "3.1.1",
4
4
  "license": "MIT",
5
5
  "author": "Arno Versini",
6
6
  "publishConfig": {
@@ -29,5 +29,5 @@
29
29
  "test:watch": "vitest",
30
30
  "watch": "npm-run-all dev"
31
31
  },
32
- "gitHead": "18adc2e2e0af0d3c2cb50fcbcadccb8918a17986"
32
+ "gitHead": "0e5c5f0dd613a0aca2f368b499f82592bf9c2fc1"
33
33
  }