@versini/sassysaint-common 4.12.0 → 4.12.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 +1 -11
- package/dist/index.js +44 -49
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -350,16 +350,6 @@ declare namespace index {
|
|
|
350
350
|
declare const PLAN_BASIC = "sassy:basic";
|
|
351
351
|
declare const PLAN_PLUS = "sassy:plus";
|
|
352
352
|
declare const PLAN_PREMIUM = "sassy:advanced";
|
|
353
|
-
/**
|
|
354
|
-
* List of grants available (coarse grain). This is to be used by client with
|
|
355
|
-
* the isGranted() helper to check for feature availability via JWT
|
|
356
|
-
* capabilities.
|
|
357
|
-
*/
|
|
358
|
-
declare const POLICY_GRANTS: {
|
|
359
|
-
PLAN_BASIC: string;
|
|
360
|
-
PLAN_PLUS: string;
|
|
361
|
-
PLAN_PREMIUM: string;
|
|
362
|
-
};
|
|
363
353
|
/**
|
|
364
354
|
* Capability constants (single source of truth for string ids).
|
|
365
355
|
* NOTE: these map 1:1 to tool names in ALL_TOOLS from @sassysaint/tools
|
|
@@ -408,4 +398,4 @@ declare function isEntitlementLoaded(state: EntitlementStateLike | null | undefi
|
|
|
408
398
|
declare function toCapabilitySet(capabilities: string[] | undefined | null): Set<string> | null;
|
|
409
399
|
declare function isEntitled(capabilitiesOrSet: string[] | Set<string> | null | undefined, required: CapabilityInput, options?: IsEntitledOptions): boolean;
|
|
410
400
|
|
|
411
|
-
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_DISPLAY_NAMES, MODEL_EMBEDDING_TEXT, MODEL_GEMINI_FLASH, MODEL_GEMINI_PRO, MODEL_GPT4_MINI, MODEL_GPT5, MODEL_MEMORY_INFERENCE, MODEL_SONAR, MODEL_SONAR_PRO, PLAN_BASIC, PLAN_PLUS, PLAN_PREMIUM,
|
|
401
|
+
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_DISPLAY_NAMES, MODEL_EMBEDDING_TEXT, MODEL_GEMINI_FLASH, MODEL_GEMINI_PRO, MODEL_GPT4_MINI, MODEL_GPT5, MODEL_MEMORY_INFERENCE, MODEL_SONAR, MODEL_SONAR_PRO, PLAN_BASIC, PLAN_PLUS, PLAN_PREMIUM, 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, getProvidersFromModels, isEntitled, isEntitlementLoaded, toCapabilitySet };
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const L = "system", a = "user", i = "assistant",
|
|
1
|
+
const L = "system", a = "user", i = "assistant", q = "hidden", ee = "data", c = "OpenAI", y = "Anthropic", d = "Google", M = "Summary", T = "Memory", O = "Perplexity", te = "Mistral", ne = c, m = [
|
|
2
2
|
c,
|
|
3
3
|
y,
|
|
4
4
|
d
|
|
5
|
-
], u = "gpt-5", p = "gpt-4.1-nano", f = "claude-haiku-4-5-20251001", A = "claude-sonnet-4-5-20250929", _ = "gemini-2.5-flash", l = "gemini-2.5-pro", R = "sonar", P = "sonar-pro",
|
|
5
|
+
], u = "gpt-5", p = "gpt-4.1-nano", f = "claude-haiku-4-5-20251001", A = "claude-sonnet-4-5-20250929", _ = "gemini-2.5-flash", l = "gemini-2.5-pro", R = "sonar", P = "sonar-pro", re = "mistralai/mistral-small-3.2-24b-instruct:free", oe = "gpt-4o-mini", se = "text-embedding-3-small", ae = {
|
|
6
6
|
[u]: "GPT-5",
|
|
7
7
|
[p]: "GPT-4.1 Nano",
|
|
8
8
|
[f]: "Claude Haiku 4.5",
|
|
@@ -11,14 +11,14 @@ const L = "system", a = "user", i = "assistant", ne = "hidden", re = "data", c =
|
|
|
11
11
|
[l]: "Gemini 2.5 Pro",
|
|
12
12
|
[R]: "Sonar",
|
|
13
13
|
[P]: "Sonar Pro"
|
|
14
|
-
},
|
|
14
|
+
}, ie = [
|
|
15
15
|
u,
|
|
16
16
|
p,
|
|
17
17
|
f,
|
|
18
18
|
A,
|
|
19
19
|
_,
|
|
20
20
|
l
|
|
21
|
-
],
|
|
21
|
+
], ce = [
|
|
22
22
|
u,
|
|
23
23
|
A,
|
|
24
24
|
l
|
|
@@ -34,36 +34,36 @@ const L = "system", a = "user", i = "assistant", ne = "hidden", re = "data", c =
|
|
|
34
34
|
],
|
|
35
35
|
[d]: [v],
|
|
36
36
|
[O]: [U]
|
|
37
|
-
},
|
|
37
|
+
}, k = {
|
|
38
38
|
[c]: [p, u],
|
|
39
39
|
[y]: [f, A],
|
|
40
40
|
[d]: [_, l],
|
|
41
41
|
[O]: [R, P]
|
|
42
|
-
},
|
|
42
|
+
}, Ee = {
|
|
43
43
|
[c]: [L, a, i],
|
|
44
44
|
[y]: [a, i],
|
|
45
45
|
[M]: [a, i],
|
|
46
46
|
[T]: [a, i],
|
|
47
47
|
[d]: [a, i],
|
|
48
48
|
[O]: [a, i]
|
|
49
|
-
},
|
|
49
|
+
}, ye = "x-diggidy-chat-id", de = (n) => {
|
|
50
50
|
for (const [e, r] of Object.entries(
|
|
51
51
|
K
|
|
52
52
|
))
|
|
53
53
|
if (r.some((t) => n.startsWith(t)))
|
|
54
54
|
return e;
|
|
55
55
|
return null;
|
|
56
|
-
},
|
|
56
|
+
}, ue = (n) => {
|
|
57
57
|
if (!n || n.length === 0)
|
|
58
58
|
return [];
|
|
59
59
|
const e = /* @__PURE__ */ new Set();
|
|
60
60
|
for (const r of n)
|
|
61
61
|
for (const [t, E] of Object.entries(
|
|
62
|
-
|
|
62
|
+
k
|
|
63
63
|
))
|
|
64
64
|
E.includes(r) && (t === c || t === y || t === d) && e.add(t);
|
|
65
65
|
return m.filter((r) => e.has(r));
|
|
66
|
-
},
|
|
66
|
+
}, Ae = "timestamp", le = "tokenUsage", Oe = "Diggidy";
|
|
67
67
|
class s extends Error {
|
|
68
68
|
constructor(e, r, t) {
|
|
69
69
|
super(e), this.code = r, this.originalError = t, this.name = "CryptoError";
|
|
@@ -73,7 +73,7 @@ const S = {
|
|
|
73
73
|
keySize: 4096,
|
|
74
74
|
debug: !1
|
|
75
75
|
};
|
|
76
|
-
async function
|
|
76
|
+
async function G(n = {}) {
|
|
77
77
|
const e = { ...S, ...n };
|
|
78
78
|
try {
|
|
79
79
|
const r = {
|
|
@@ -147,7 +147,7 @@ async function I(n) {
|
|
|
147
147
|
);
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
|
-
async function
|
|
150
|
+
async function V(n, e, r) {
|
|
151
151
|
try {
|
|
152
152
|
const E = new TextEncoder().encode(n), o = await crypto.subtle.encrypt(
|
|
153
153
|
{
|
|
@@ -171,7 +171,7 @@ async function Y(n, e, r) {
|
|
|
171
171
|
);
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
|
-
async function
|
|
174
|
+
async function Y(n, e) {
|
|
175
175
|
try {
|
|
176
176
|
const r = Uint8Array.from(
|
|
177
177
|
atob(n.data),
|
|
@@ -264,11 +264,7 @@ function W(n) {
|
|
|
264
264
|
function J(n, ...e) {
|
|
265
265
|
typeof process < "u" && process.env && process.env.NODE_ENV === "development" && console.info(`🔐 [Crypto] ${n}`, ...e);
|
|
266
266
|
}
|
|
267
|
-
const
|
|
268
|
-
PLAN_BASIC: Z,
|
|
269
|
-
PLAN_PLUS: Q,
|
|
270
|
-
PLAN_PREMIUM: q
|
|
271
|
-
}, Se = {
|
|
267
|
+
const pe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, CryptoError: s, DEFAULT_CRYPTO_CONFIG: S, arrayBufferToBase64: j, base64ToArrayBuffer: $, canUseEncryption: X, debugLog: J, decryptFromServer: Y, encryptForServer: V, establishCryptoSession: H, exportPublicKey: F, generateClientKeyPair: G, generateDeviceId: B, importServerPublicKey: I, isCryptoSessionValid: x, isSecureContext: g, isWebCryptoSupported: D, safeParse: W, safeStringify: z }, Symbol.toStringTag, { value: "Module" })), fe = "sassy:basic", _e = "sassy:plus", Re = "sassy:advanced", Pe = {
|
|
272
268
|
TOOL: {
|
|
273
269
|
DATETIME: "getDateTime",
|
|
274
270
|
IMAGES: "getImages",
|
|
@@ -287,62 +283,61 @@ const Re = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
287
283
|
CODEINTERPRETER: "addon:codeinterpreter"
|
|
288
284
|
}
|
|
289
285
|
};
|
|
290
|
-
function
|
|
286
|
+
function Se(n) {
|
|
291
287
|
return !!n && Array.isArray(n.capabilities) && n.capabilities.length >= 0;
|
|
292
288
|
}
|
|
293
|
-
function
|
|
289
|
+
function Z(n) {
|
|
294
290
|
return n ? new Set(n) : null;
|
|
295
291
|
}
|
|
296
|
-
function
|
|
292
|
+
function Ie(n, e, r) {
|
|
297
293
|
if (!e || Array.isArray(e) && e.length === 0)
|
|
298
294
|
return !0;
|
|
299
|
-
const t = n instanceof Set ? n :
|
|
295
|
+
const t = n instanceof Set ? n : Z(n);
|
|
300
296
|
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));
|
|
301
297
|
}
|
|
302
298
|
export {
|
|
303
|
-
|
|
299
|
+
ie as ALL_MODELS,
|
|
304
300
|
m as ALL_PROVIDERS,
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
301
|
+
ce as ALL_REASONING_MODELS,
|
|
302
|
+
Oe as APPLICATION_NAME,
|
|
303
|
+
Pe as CAPABILITIES,
|
|
304
|
+
ne as DEFAULT_PROVIDER,
|
|
305
|
+
ye as DIGGIDY_CHAT_ID_HEADER,
|
|
306
|
+
k as MODELS_PER_PROVIDER,
|
|
311
307
|
f as MODEL_CLAUDE_HAIKU,
|
|
312
308
|
A as MODEL_CLAUDE_SONNET,
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
309
|
+
re as MODEL_DEV,
|
|
310
|
+
ae as MODEL_DISPLAY_NAMES,
|
|
311
|
+
se as MODEL_EMBEDDING_TEXT,
|
|
316
312
|
_ as MODEL_GEMINI_FLASH,
|
|
317
313
|
l as MODEL_GEMINI_PRO,
|
|
318
314
|
p as MODEL_GPT4_MINI,
|
|
319
315
|
u as MODEL_GPT5,
|
|
320
|
-
|
|
316
|
+
oe as MODEL_MEMORY_INFERENCE,
|
|
321
317
|
R as MODEL_SONAR,
|
|
322
318
|
P as MODEL_SONAR_PRO,
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
Pe as POLICY_GRANTS,
|
|
319
|
+
fe as PLAN_BASIC,
|
|
320
|
+
_e as PLAN_PLUS,
|
|
321
|
+
Re as PLAN_PREMIUM,
|
|
327
322
|
y as PROVIDER_ANTHROPIC,
|
|
328
323
|
d as PROVIDER_GOOGLE,
|
|
329
324
|
T as PROVIDER_MEMORY,
|
|
330
|
-
|
|
325
|
+
te as PROVIDER_MISTRAL,
|
|
331
326
|
c as PROVIDER_OPENAI,
|
|
332
327
|
O as PROVIDER_PERPLEXITY,
|
|
333
|
-
|
|
328
|
+
Ee as PROVIDER_ROLE_MAP,
|
|
334
329
|
M as PROVIDER_SUMMARY,
|
|
335
330
|
i as ROLE_ASSISTANT,
|
|
336
|
-
|
|
337
|
-
|
|
331
|
+
q as ROLE_HIDDEN,
|
|
332
|
+
ee as ROLE_INTERNAL,
|
|
338
333
|
L as ROLE_SYSTEM,
|
|
339
334
|
a as ROLE_USER,
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
335
|
+
Ae as SORT_BY_TIMESTAMP,
|
|
336
|
+
le as SORT_BY_TOKEN_USAGE,
|
|
337
|
+
pe as crypto,
|
|
338
|
+
de as findProvider,
|
|
339
|
+
ue as getProvidersFromModels,
|
|
340
|
+
Ie as isEntitled,
|
|
341
|
+
Se as isEntitlementLoaded,
|
|
342
|
+
Z as toCapabilitySet
|
|
348
343
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versini/sassysaint-common",
|
|
3
|
-
"version": "4.12.
|
|
3
|
+
"version": "4.12.1",
|
|
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": "414c62d95d35eca0575db970411a3a5c517b013a"
|
|
36
36
|
}
|