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