@versini/sassysaint-common 4.7.0 → 4.8.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 +6 -3
- package/dist/index.js +59 -59
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
@@ -15,6 +15,7 @@ declare const PROVIDER_GOOGLE = "Google";
|
|
15
15
|
declare const PROVIDER_SUMMARY = "Summary";
|
16
16
|
declare const PROVIDER_MEMORY = "Memory";
|
17
17
|
declare const PROVIDER_PERPLEXITY = "Perplexity";
|
18
|
+
declare const PROVIDER_MISTRAL = "Mistral";
|
18
19
|
declare const DEFAULT_PROVIDER = "OpenAI";
|
19
20
|
declare const ALL_PROVIDERS: readonly ["OpenAI", "Anthropic", "Google"];
|
20
21
|
/**
|
@@ -29,10 +30,12 @@ declare const MODEL_GEMINI_FLASH = "gemini-2.5-flash";
|
|
29
30
|
declare const MODEL_GEMINI_PRO = "gemini-2.5-pro";
|
30
31
|
declare const MODEL_SONAR = "sonar";
|
31
32
|
declare const MODEL_SONAR_PRO = "sonar-pro";
|
33
|
+
declare const MODEL_DEV = "mistralai/mistral-small-3.2-24b-instruct:free";
|
32
34
|
/**
|
33
35
|
* List of all models available TODAY.
|
36
|
+
* This is used by the client to display the list of models.
|
34
37
|
*/
|
35
|
-
declare const ALL_MODELS: readonly ["gpt-5", "gpt-4.1-nano", "o4-mini", "claude-3-5-haiku-20241022", "claude-sonnet-4-20250514", "gemini-2.5-flash", "gemini-2.5-pro"
|
38
|
+
declare const ALL_MODELS: readonly ["gpt-5", "gpt-4.1-nano", "o4-mini", "claude-3-5-haiku-20241022", "claude-sonnet-4-20250514", "gemini-2.5-flash", "gemini-2.5-pro"];
|
36
39
|
declare const ALL_REASONING_MODELS: string[];
|
37
40
|
/**
|
38
41
|
* List of models available according to the providers.
|
@@ -58,7 +61,7 @@ declare const PROVIDER_ROLE_MAP: {
|
|
58
61
|
* Header string for Diggidy Chat Id. Used to identify the chat in the server
|
59
62
|
* when there is a client abort.
|
60
63
|
*/
|
61
|
-
declare const
|
64
|
+
declare const DIGGIDY_CHAT_ID_HEADER = "x-diggidy-chat-id";
|
62
65
|
/**
|
63
66
|
* This function finds the provider associated with a given model name. It
|
64
67
|
* checks the model name against a list of approximate models for each provider.
|
@@ -380,4 +383,4 @@ declare function isEntitlementLoaded(state: EntitlementStateLike | null | undefi
|
|
380
383
|
declare function toCapabilitySet(capabilities: string[] | undefined | null): Set<string> | null;
|
381
384
|
declare function isEntitled(capabilitiesOrSet: string[] | Set<string> | null | undefined, required: CapabilityInput, options?: IsEntitledOptions): boolean;
|
382
385
|
|
383
|
-
export { ALL_MODELS, ALL_PROVIDERS, ALL_REASONING_MODELS, APPLICATION_NAME, CAPABILITIES, type CapabilityInput, DEFAULT_PROVIDER,
|
386
|
+
export { ALL_MODELS, ALL_PROVIDERS, ALL_REASONING_MODELS, APPLICATION_NAME, CAPABILITIES, type CapabilityInput, DEFAULT_PROVIDER, DIGGIDY_CHAT_ID_HEADER, type EntitlementStateLike, type IsEntitledOptions, MODELS_PER_PROVIDER, MODEL_CLAUDE_HAIKU, MODEL_CLAUDE_SONNET, MODEL_DEV, MODEL_GEMINI_FLASH, MODEL_GEMINI_PRO, MODEL_GPT4_MINI, MODEL_GPT5, MODEL_O4_MINI, MODEL_SONAR, MODEL_SONAR_PRO, PLAN_FREE, PLAN_PLUS, PLAN_PREMIUM, POLICY_GRANTS, PROVIDER_ANTHROPIC, PROVIDER_GOOGLE, PROVIDER_MEMORY, PROVIDER_MISTRAL, 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, isEntitled, isEntitlementLoaded, toCapabilitySet };
|
package/dist/index.js
CHANGED
@@ -1,24 +1,22 @@
|
|
1
|
-
const
|
1
|
+
const D = "system", a = "user", c = "assistant", te = "hidden", ne = "data", i = "OpenAI", E = "Anthropic", y = "Google", g = "Summary", L = "Memory", u = "Perplexity", re = "Mistral", oe = i, se = [
|
2
2
|
i,
|
3
3
|
E,
|
4
4
|
y
|
5
|
-
], d = "gpt-5",
|
5
|
+
], d = "gpt-5", p = "gpt-4.1-nano", M = "o4-mini", f = "claude-3-5-haiku-20241022", O = "claude-sonnet-4-20250514", R = "gemini-2.5-flash", l = "gemini-2.5-pro", T = "sonar", m = "sonar-pro", ae = "mistralai/mistral-small-3.2-24b-instruct:free", ce = [
|
6
6
|
d,
|
7
|
-
|
8
|
-
|
7
|
+
p,
|
8
|
+
M,
|
9
9
|
f,
|
10
10
|
O,
|
11
11
|
R,
|
12
|
-
|
13
|
-
|
14
|
-
P
|
15
|
-
], ae = [
|
12
|
+
l
|
13
|
+
], ie = [
|
16
14
|
d,
|
17
15
|
O,
|
18
|
-
|
19
|
-
],
|
16
|
+
l
|
17
|
+
], w = "claude-sonnet-4", h = "claude-3", b = "gpt-", N = "o3", C = "o4", U = "gemini", v = "sonar", K = {
|
20
18
|
[E]: [
|
21
|
-
|
19
|
+
w,
|
22
20
|
h
|
23
21
|
],
|
24
22
|
[i]: [
|
@@ -28,37 +26,37 @@ const L = "system", a = "user", c = "assistant", te = "hidden", ne = "data", i =
|
|
28
26
|
],
|
29
27
|
[y]: [U],
|
30
28
|
[u]: [v]
|
31
|
-
},
|
32
|
-
[i]: [
|
29
|
+
}, Ee = {
|
30
|
+
[i]: [p, d],
|
33
31
|
[E]: [f, O],
|
34
|
-
[y]: [R,
|
35
|
-
[u]: [
|
36
|
-
},
|
37
|
-
[i]: [
|
32
|
+
[y]: [R, l],
|
33
|
+
[u]: [T, m]
|
34
|
+
}, ye = {
|
35
|
+
[i]: [D, a, c],
|
38
36
|
[E]: [a, c],
|
39
|
-
[
|
40
|
-
[
|
37
|
+
[g]: [a, c],
|
38
|
+
[L]: [a, c],
|
41
39
|
[y]: [a, c],
|
42
40
|
[u]: [a, c]
|
43
|
-
},
|
41
|
+
}, Ae = "x-diggidy-chat-id", ue = (n) => {
|
44
42
|
for (const [e, r] of Object.entries(
|
45
43
|
K
|
46
44
|
))
|
47
45
|
if (r.some((t) => n.startsWith(t)))
|
48
46
|
return e;
|
49
47
|
return null;
|
50
|
-
},
|
48
|
+
}, de = "timestamp", Oe = "tokenUsage", le = "Diggidy";
|
51
49
|
class s extends Error {
|
52
50
|
constructor(e, r, t) {
|
53
51
|
super(e), this.code = r, this.originalError = t, this.name = "CryptoError";
|
54
52
|
}
|
55
53
|
}
|
56
|
-
const
|
54
|
+
const _ = {
|
57
55
|
keySize: 4096,
|
58
56
|
debug: !1
|
59
57
|
};
|
60
58
|
async function k(n = {}) {
|
61
|
-
const e = { ...
|
59
|
+
const e = { ..._, ...n };
|
62
60
|
try {
|
63
61
|
const r = {
|
64
62
|
modulusLength: e.keySize,
|
@@ -109,7 +107,7 @@ async function G(n) {
|
|
109
107
|
);
|
110
108
|
}
|
111
109
|
}
|
112
|
-
async function
|
110
|
+
async function P(n) {
|
113
111
|
try {
|
114
112
|
const e = JSON.parse(n);
|
115
113
|
return await crypto.subtle.importKey(
|
@@ -155,7 +153,7 @@ async function F(n, e, r) {
|
|
155
153
|
);
|
156
154
|
}
|
157
155
|
}
|
158
|
-
async function
|
156
|
+
async function V(n, e) {
|
159
157
|
try {
|
160
158
|
const r = Uint8Array.from(
|
161
159
|
atob(n.data),
|
@@ -176,9 +174,9 @@ async function Y(n, e) {
|
|
176
174
|
);
|
177
175
|
}
|
178
176
|
}
|
179
|
-
async function
|
177
|
+
async function Y(n, e, r) {
|
180
178
|
try {
|
181
|
-
const t = await
|
179
|
+
const t = await P(
|
182
180
|
n.serverPublicKey
|
183
181
|
);
|
184
182
|
return {
|
@@ -196,7 +194,7 @@ async function H(n, e, r) {
|
|
196
194
|
);
|
197
195
|
}
|
198
196
|
}
|
199
|
-
function
|
197
|
+
function H(n) {
|
200
198
|
return !(!n || !n.clientKeyPair || !n.serverPublicKey);
|
201
199
|
}
|
202
200
|
function x() {
|
@@ -209,14 +207,14 @@ function x() {
|
|
209
207
|
const r = Array.from(e).map((t) => t.toString(36)).join("");
|
210
208
|
return `device_${n}_${r}`;
|
211
209
|
}
|
212
|
-
function
|
210
|
+
function I() {
|
213
211
|
return typeof window < "u" && typeof window.crypto < "u" && typeof window.crypto.subtle < "u";
|
214
212
|
}
|
215
|
-
function
|
213
|
+
function S() {
|
216
214
|
return typeof window < "u" && (window.isSecureContext || window.location.protocol === "https:");
|
217
215
|
}
|
218
216
|
function X() {
|
219
|
-
return
|
217
|
+
return I() && S();
|
220
218
|
}
|
221
219
|
function $(n) {
|
222
220
|
const e = new Uint8Array(n);
|
@@ -248,11 +246,11 @@ function z(n) {
|
|
248
246
|
function W(n, ...e) {
|
249
247
|
typeof process < "u" && process.env && process.env.NODE_ENV === "development" && console.info(`🔐 [Crypto] ${n}`, ...e);
|
250
248
|
}
|
251
|
-
const
|
249
|
+
const pe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, CryptoError: s, DEFAULT_CRYPTO_CONFIG: _, arrayBufferToBase64: $, base64ToArrayBuffer: j, canUseEncryption: X, debugLog: W, decryptFromServer: V, encryptForServer: F, establishCryptoSession: Y, exportPublicKey: G, generateClientKeyPair: k, generateDeviceId: x, importServerPublicKey: P, isCryptoSessionValid: H, isSecureContext: S, isWebCryptoSupported: I, safeParse: z, safeStringify: B }, Symbol.toStringTag, { value: "Module" })), J = "sassy:free", Z = "sassy:plus", Q = "sassy:advanced", fe = {
|
252
250
|
PLAN_FREE: J,
|
253
251
|
PLAN_PLUS: Z,
|
254
252
|
PLAN_PREMIUM: Q
|
255
|
-
},
|
253
|
+
}, Re = {
|
256
254
|
TOOL: {
|
257
255
|
DATETIME: "getDateTime",
|
258
256
|
IMAGES: "getImages",
|
@@ -271,57 +269,59 @@ const Oe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
271
269
|
CODEINTERPRETER: "addon:codeinterpreter"
|
272
270
|
}
|
273
271
|
};
|
274
|
-
function
|
272
|
+
function _e(n) {
|
275
273
|
return !!n && Array.isArray(n.capabilities) && n.capabilities.length >= 0;
|
276
274
|
}
|
277
275
|
function q(n) {
|
278
276
|
return n ? new Set(n) : null;
|
279
277
|
}
|
280
|
-
function
|
278
|
+
function Pe(n, e, r) {
|
281
279
|
if (!e || Array.isArray(e) && e.length === 0)
|
282
280
|
return !0;
|
283
281
|
const t = n instanceof Set ? n : q(n);
|
284
282
|
return !t || t.size === 0 ? !1 : typeof e == "string" ? t.has(e) : r?.any === !0 ? e.some((o) => t.has(o)) : e.every((o) => t.has(o));
|
285
283
|
}
|
286
284
|
export {
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
285
|
+
ce as ALL_MODELS,
|
286
|
+
se as ALL_PROVIDERS,
|
287
|
+
ie as ALL_REASONING_MODELS,
|
288
|
+
le as APPLICATION_NAME,
|
289
|
+
Re as CAPABILITIES,
|
290
|
+
oe as DEFAULT_PROVIDER,
|
291
|
+
Ae as DIGGIDY_CHAT_ID_HEADER,
|
292
|
+
Ee as MODELS_PER_PROVIDER,
|
295
293
|
f as MODEL_CLAUDE_HAIKU,
|
296
294
|
O as MODEL_CLAUDE_SONNET,
|
295
|
+
ae as MODEL_DEV,
|
297
296
|
R as MODEL_GEMINI_FLASH,
|
298
|
-
|
299
|
-
|
297
|
+
l as MODEL_GEMINI_PRO,
|
298
|
+
p as MODEL_GPT4_MINI,
|
300
299
|
d as MODEL_GPT5,
|
301
|
-
|
302
|
-
|
303
|
-
|
300
|
+
M as MODEL_O4_MINI,
|
301
|
+
T as MODEL_SONAR,
|
302
|
+
m as MODEL_SONAR_PRO,
|
304
303
|
J as PLAN_FREE,
|
305
304
|
Z as PLAN_PLUS,
|
306
305
|
Q as PLAN_PREMIUM,
|
307
|
-
|
306
|
+
fe as POLICY_GRANTS,
|
308
307
|
E as PROVIDER_ANTHROPIC,
|
309
308
|
y as PROVIDER_GOOGLE,
|
310
|
-
|
309
|
+
L as PROVIDER_MEMORY,
|
310
|
+
re as PROVIDER_MISTRAL,
|
311
311
|
i as PROVIDER_OPENAI,
|
312
312
|
u as PROVIDER_PERPLEXITY,
|
313
|
-
|
314
|
-
|
313
|
+
ye as PROVIDER_ROLE_MAP,
|
314
|
+
g as PROVIDER_SUMMARY,
|
315
315
|
c as ROLE_ASSISTANT,
|
316
316
|
te as ROLE_HIDDEN,
|
317
317
|
ne as ROLE_INTERNAL,
|
318
|
-
|
318
|
+
D as ROLE_SYSTEM,
|
319
319
|
a as ROLE_USER,
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
320
|
+
de as SORT_BY_TIMESTAMP,
|
321
|
+
Oe as SORT_BY_TOKEN_USAGE,
|
322
|
+
pe as crypto,
|
323
|
+
ue as findProvider,
|
324
|
+
Pe as isEntitled,
|
325
|
+
_e as isEntitlementLoaded,
|
326
326
|
q as toCapabilitySet
|
327
327
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@versini/sassysaint-common",
|
3
|
-
"version": "4.
|
3
|
+
"version": "4.8.0",
|
4
4
|
"license": "MIT",
|
5
5
|
"author": "Arno Versini",
|
6
6
|
"publishConfig": {
|
@@ -32,5 +32,5 @@
|
|
32
32
|
"test:watch": "vitest",
|
33
33
|
"watch": "npm-run-all dev"
|
34
34
|
},
|
35
|
-
"gitHead": "
|
35
|
+
"gitHead": "c9acb4172e96e234105e1742d41f19dbbee7cd04"
|
36
36
|
}
|