@versini/sassysaint-common 4.0.3 → 4.0.4
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 +6 -1
- package/dist/index.js +30 -28
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
@@ -82,6 +82,11 @@ declare const CALLISTO_CHAT_ID_HEADER = "x-callisto-chat-id";
|
|
82
82
|
* @returns The provider associated with the model name or null if not found.
|
83
83
|
*/
|
84
84
|
declare const findProvider: (modelName: string) => null | typeof PROVIDER_ANTHROPIC | typeof PROVIDER_OPENAI | typeof PROVIDER_GOOGLE;
|
85
|
+
/**
|
86
|
+
* Sort capabilities are shared across client and server.
|
87
|
+
*/
|
88
|
+
declare const SORT_BY_TIMESTAMP = "timestamp";
|
89
|
+
declare const SORT_BY_TOKEN_USAGE = "tokenUsage";
|
85
90
|
|
86
91
|
/**
|
87
92
|
* TypeScript interfaces for Server-Mediated Encryption
|
@@ -281,4 +286,4 @@ declare namespace index {
|
|
281
286
|
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 };
|
282
287
|
}
|
283
288
|
|
284
|
-
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 };
|
289
|
+
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, SORT_BY_TIMESTAMP, SORT_BY_TOKEN_USAGE, index as crypto, findProvider };
|
package/dist/index.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
const g = "system", s = "user", c = "assistant", te = "hidden", re = "data", a = "OpenAI", i = "Anthropic",
|
1
|
+
const g = "system", s = "user", c = "assistant", te = "hidden", re = "data", a = "OpenAI", i = "Anthropic", E = "Google", M = "Summary", m = "Memory", d = "Perplexity", ne = a, oe = [
|
2
2
|
a,
|
3
3
|
i,
|
4
|
-
|
5
|
-
], _ = "gpt-4.1", l = "gpt-4.1-nano", u = "o4-mini", f = "claude-3-5-haiku-20241022", p = "claude-sonnet-4-20250514", R = "gemini-2.5-flash", A = "gemini-2.5-pro", P = "sonar",
|
4
|
+
E
|
5
|
+
], _ = "gpt-4.1", l = "gpt-4.1-nano", u = "o4-mini", f = "claude-3-5-haiku-20241022", p = "claude-sonnet-4-20250514", R = "gemini-2.5-flash", A = "gemini-2.5-pro", P = "sonar", S = "sonar-pro", se = [
|
6
6
|
_,
|
7
7
|
l,
|
8
8
|
u,
|
@@ -11,59 +11,59 @@ const g = "system", s = "user", c = "assistant", te = "hidden", re = "data", a =
|
|
11
11
|
R,
|
12
12
|
A,
|
13
13
|
P,
|
14
|
-
|
14
|
+
S
|
15
15
|
], ce = [
|
16
16
|
u,
|
17
17
|
p,
|
18
18
|
A
|
19
|
-
], b = "claude-sonnet-4", h = "claude-3",
|
19
|
+
], b = "claude-sonnet-4", h = "claude-3", T = "gpt-4", N = "o3", v = "o4", K = "gemini", C = "sonar", U = {
|
20
20
|
[i]: [
|
21
21
|
b,
|
22
22
|
h
|
23
23
|
],
|
24
24
|
[a]: [
|
25
|
-
N,
|
26
25
|
T,
|
26
|
+
N,
|
27
27
|
v
|
28
28
|
],
|
29
|
-
[
|
29
|
+
[E]: [K],
|
30
30
|
[d]: [C]
|
31
31
|
}, ae = {
|
32
32
|
[a]: [l, _, u],
|
33
33
|
[i]: [f, p],
|
34
|
-
[
|
35
|
-
[d]: [P,
|
34
|
+
[E]: [R, A],
|
35
|
+
[d]: [P, S]
|
36
36
|
}, ie = {
|
37
37
|
[a]: [g, s, c],
|
38
38
|
[i]: [s, c],
|
39
39
|
[M]: [s, c],
|
40
40
|
[m]: [s, c],
|
41
|
-
[
|
41
|
+
[E]: [s, c],
|
42
42
|
[d]: [s, c]
|
43
|
-
}, k = "sassy:free", F = "sassy:plus", G = "sassy:advanced", V = "sassy:advanced:reasoning",
|
43
|
+
}, k = "sassy:free", F = "sassy:plus", G = "sassy:advanced", V = "sassy:advanced:reasoning", Ee = {
|
44
44
|
PLAN_FREE: k,
|
45
45
|
PLAN_PLUS: F,
|
46
46
|
PLAN_PREMIUM: G,
|
47
47
|
REASONING: V
|
48
|
-
},
|
48
|
+
}, ye = "x-callisto-chat-id", de = (r) => {
|
49
49
|
for (const [e, n] of Object.entries(
|
50
50
|
U
|
51
51
|
))
|
52
52
|
if (n.some((t) => r.startsWith(t)))
|
53
53
|
return e;
|
54
54
|
return null;
|
55
|
-
};
|
55
|
+
}, ue = "timestamp", pe = "tokenUsage";
|
56
56
|
class o extends Error {
|
57
57
|
constructor(e, n, t) {
|
58
58
|
super(e), this.code = n, this.originalError = t, this.name = "CryptoError";
|
59
59
|
}
|
60
60
|
}
|
61
|
-
const
|
61
|
+
const I = {
|
62
62
|
keySize: 4096,
|
63
63
|
debug: !1
|
64
64
|
};
|
65
|
-
async function
|
66
|
-
const e = { ...
|
65
|
+
async function Y(r = {}) {
|
66
|
+
const e = { ...I, ...r };
|
67
67
|
try {
|
68
68
|
const n = {
|
69
69
|
modulusLength: e.keySize,
|
@@ -99,7 +99,7 @@ async function x(r = {}) {
|
|
99
99
|
);
|
100
100
|
}
|
101
101
|
}
|
102
|
-
async function
|
102
|
+
async function x(r) {
|
103
103
|
try {
|
104
104
|
return {
|
105
105
|
jwk: await crypto.subtle.exportKey("jwk", r),
|
@@ -138,7 +138,7 @@ async function L(r) {
|
|
138
138
|
}
|
139
139
|
async function X(r, e, n) {
|
140
140
|
try {
|
141
|
-
const O = new TextEncoder().encode(r),
|
141
|
+
const O = new TextEncoder().encode(r), y = await crypto.subtle.encrypt(
|
142
142
|
{
|
143
143
|
name: "RSA-OAEP"
|
144
144
|
},
|
@@ -147,7 +147,7 @@ async function X(r, e, n) {
|
|
147
147
|
);
|
148
148
|
return {
|
149
149
|
data: btoa(
|
150
|
-
String.fromCharCode(...new Uint8Array(
|
150
|
+
String.fromCharCode(...new Uint8Array(y))
|
151
151
|
),
|
152
152
|
algorithm: "RSA-OAEP",
|
153
153
|
keyId: n
|
@@ -164,7 +164,7 @@ async function H(r, e) {
|
|
164
164
|
try {
|
165
165
|
const n = Uint8Array.from(
|
166
166
|
atob(r.data),
|
167
|
-
(
|
167
|
+
(y) => y.charCodeAt(0)
|
168
168
|
), t = await crypto.subtle.decrypt(
|
169
169
|
{
|
170
170
|
name: "RSA-OAEP"
|
@@ -204,7 +204,7 @@ async function $(r, e, n) {
|
|
204
204
|
function j(r) {
|
205
205
|
return !(!r || !r.clientKeyPair || !r.serverPublicKey);
|
206
206
|
}
|
207
|
-
function
|
207
|
+
function B() {
|
208
208
|
const r = Date.now().toString(36), e = new Uint8Array(8);
|
209
209
|
if (typeof window < "u" && window.crypto?.getRandomValues)
|
210
210
|
window.crypto.getRandomValues(e);
|
@@ -220,7 +220,7 @@ function D() {
|
|
220
220
|
function w() {
|
221
221
|
return typeof window < "u" && (window.isSecureContext || window.location.protocol === "https:");
|
222
222
|
}
|
223
|
-
function
|
223
|
+
function z() {
|
224
224
|
return D() && w();
|
225
225
|
}
|
226
226
|
function J(r) {
|
@@ -253,12 +253,12 @@ function Q(r) {
|
|
253
253
|
function Z(r, ...e) {
|
254
254
|
typeof process < "u" && process.env && process.env.NODE_ENV === "development" && console.info(`🔐 [Crypto] ${r}`, ...e);
|
255
255
|
}
|
256
|
-
const
|
256
|
+
const Ae = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, CryptoError: o, DEFAULT_CRYPTO_CONFIG: I, arrayBufferToBase64: J, base64ToArrayBuffer: W, canUseEncryption: z, debugLog: Z, decryptFromServer: H, encryptForServer: X, establishCryptoSession: $, exportPublicKey: x, generateClientKeyPair: Y, generateDeviceId: B, importServerPublicKey: L, isCryptoSessionValid: j, isSecureContext: w, isWebCryptoSupported: D, safeParse: Q, safeStringify: q }, Symbol.toStringTag, { value: "Module" }));
|
257
257
|
export {
|
258
258
|
se as ALL_MODELS,
|
259
259
|
oe as ALL_PROVIDERS,
|
260
260
|
ce as ALL_REASONING_MODELS,
|
261
|
-
|
261
|
+
ye as CALLISTO_CHAT_ID_HEADER,
|
262
262
|
ne as DEFAULT_PROVIDER,
|
263
263
|
ae as MODELS_PER_PROVIDER,
|
264
264
|
f as MODEL_CLAUDE_HAIKU,
|
@@ -269,13 +269,13 @@ export {
|
|
269
269
|
l as MODEL_GPT4_MINI,
|
270
270
|
u as MODEL_O4_MINI,
|
271
271
|
P as MODEL_SONAR,
|
272
|
-
|
272
|
+
S as MODEL_SONAR_PRO,
|
273
273
|
k as PLAN_FREE,
|
274
274
|
F as PLAN_PLUS,
|
275
275
|
G as PLAN_PREMIUM,
|
276
|
-
|
276
|
+
Ee as POLICY_GRANTS,
|
277
277
|
i as PROVIDER_ANTHROPIC,
|
278
|
-
|
278
|
+
E as PROVIDER_GOOGLE,
|
279
279
|
m as PROVIDER_MEMORY,
|
280
280
|
a as PROVIDER_OPENAI,
|
281
281
|
d as PROVIDER_PERPLEXITY,
|
@@ -286,6 +286,8 @@ export {
|
|
286
286
|
re as ROLE_INTERNAL,
|
287
287
|
g as ROLE_SYSTEM,
|
288
288
|
s as ROLE_USER,
|
289
|
-
ue as
|
289
|
+
ue as SORT_BY_TIMESTAMP,
|
290
|
+
pe as SORT_BY_TOKEN_USAGE,
|
291
|
+
Ae as crypto,
|
290
292
|
de as findProvider
|
291
293
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@versini/sassysaint-common",
|
3
|
-
"version": "4.0.
|
3
|
+
"version": "4.0.4",
|
4
4
|
"license": "MIT",
|
5
5
|
"author": "Arno Versini",
|
6
6
|
"publishConfig": {
|
@@ -30,5 +30,5 @@
|
|
30
30
|
"test:watch": "vitest",
|
31
31
|
"watch": "npm-run-all dev"
|
32
32
|
},
|
33
|
-
"gitHead": "
|
33
|
+
"gitHead": "6fbcb4192fea2a841710741760d6c3d6b91c63fa"
|
34
34
|
}
|