@mikesaintsg/core 0.0.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.js ADDED
@@ -0,0 +1,828 @@
1
+ class O extends Error {
2
+ cause;
3
+ }
4
+ function Z(r) {
5
+ return r instanceof O;
6
+ }
7
+ class E extends Error {
8
+ code;
9
+ cause;
10
+ constructor(n, f, i) {
11
+ super(f), this.name = "CoreError", this.code = n, this.cause = i;
12
+ }
13
+ }
14
+ function Q(r) {
15
+ return r instanceof E;
16
+ }
17
+ function M(r) {
18
+ return { ok: !0, value: r };
19
+ }
20
+ function I(r) {
21
+ return { ok: !1, error: r };
22
+ }
23
+ function ee(r) {
24
+ return r.ok === !0;
25
+ }
26
+ function te(r) {
27
+ return !r.ok;
28
+ }
29
+ function ne(r, n) {
30
+ return r.ok ? r.value : n;
31
+ }
32
+ function re(r) {
33
+ if (r.ok)
34
+ return r.value;
35
+ throw r.error instanceof Error ? r.error : new Error(String(r.error));
36
+ }
37
+ function oe(r, n) {
38
+ return r.ok ? M(n(r.value)) : r;
39
+ }
40
+ function ae(r, n) {
41
+ return r.ok ? r : I(n(r.error));
42
+ }
43
+ function se(r, n) {
44
+ return r.ok ? n(r.value) : r;
45
+ }
46
+ async function P(r) {
47
+ const f = new TextEncoder().encode(r), i = await crypto.subtle.digest("SHA-256", f);
48
+ return Array.from(new Uint8Array(i)).map((e) => e.toString(16).padStart(2, "0")).join("");
49
+ }
50
+ function R(r) {
51
+ return {
52
+ ...r,
53
+ embedding: Array.from(r.embedding)
54
+ };
55
+ }
56
+ function S(r) {
57
+ const n = r.embedding;
58
+ return {
59
+ ...r,
60
+ embedding: new Float32Array(n)
61
+ };
62
+ }
63
+ function x(r) {
64
+ return r.byteLength;
65
+ }
66
+ const N = "text-embedding-3-small", F = 1536, k = "https://api.openai.com/v1", L = "voyage-2", U = 1024, B = "https://api.voyageai.com/v1", $ = 1e3, j = 100, q = 50, H = "documents", G = "metadata", v = "vectorstore_metadata", C = 100, D = "_metadata.json", T = "chunk_", J = 3e4, V = 3e4, z = 10, Y = 100, X = "You have unsaved changes. Are you sure you want to leave?";
67
+ function ie(r) {
68
+ const {
69
+ apiKey: n,
70
+ model: f = N,
71
+ baseURL: i = k,
72
+ dimensions: o = F
73
+ } = r;
74
+ if (!n)
75
+ throw new E("ADAPTER_ERROR", "OpenAI API key is required");
76
+ const e = {
77
+ provider: "openai",
78
+ model: f,
79
+ dimensions: o
80
+ };
81
+ return {
82
+ async embed(a, t) {
83
+ if (a.length === 0)
84
+ return [];
85
+ const u = `${i}/embeddings`, s = {
86
+ method: "POST",
87
+ headers: {
88
+ "Content-Type": "application/json",
89
+ Authorization: `Bearer ${n}`
90
+ },
91
+ body: JSON.stringify({
92
+ input: a,
93
+ model: f,
94
+ dimensions: o
95
+ })
96
+ };
97
+ t?.signal && (s.signal = t.signal);
98
+ const l = await fetch(u, s);
99
+ if (!l.ok) {
100
+ const d = await l.text().catch(() => "Unknown error");
101
+ throw new E(
102
+ "ADAPTER_ERROR",
103
+ `OpenAI API error (${l.status}): ${d}`
104
+ );
105
+ }
106
+ return [...(await l.json()).data].sort((d, p) => d.index - p.index).map((d) => new Float32Array(d.embedding));
107
+ },
108
+ getModelMetadata() {
109
+ return e;
110
+ }
111
+ };
112
+ }
113
+ function ce(r) {
114
+ const {
115
+ apiKey: n,
116
+ model: f = L,
117
+ baseURL: i = B
118
+ } = r;
119
+ if (!n)
120
+ throw new E("ADAPTER_ERROR", "Voyage AI API key is required");
121
+ const o = {
122
+ provider: "anthropic",
123
+ model: f,
124
+ dimensions: U
125
+ };
126
+ return {
127
+ async embed(e, a) {
128
+ if (e.length === 0)
129
+ return [];
130
+ const t = `${i}/embeddings`, u = {
131
+ method: "POST",
132
+ headers: {
133
+ "Content-Type": "application/json",
134
+ Authorization: `Bearer ${n}`
135
+ },
136
+ body: JSON.stringify({
137
+ input: e,
138
+ model: f
139
+ })
140
+ };
141
+ a?.signal && (u.signal = a.signal);
142
+ const s = await fetch(t, u);
143
+ if (!s.ok) {
144
+ const c = await s.text().catch(() => "Unknown error");
145
+ throw new E(
146
+ "ADAPTER_ERROR",
147
+ `Voyage AI API error (${s.status}): ${c}`
148
+ );
149
+ }
150
+ return [...(await s.json()).data].sort((c, d) => c.index - d.index).map((c) => new Float32Array(c.embedding));
151
+ },
152
+ getModelMetadata() {
153
+ return o;
154
+ }
155
+ };
156
+ }
157
+ function ue(r, n = {}) {
158
+ const {
159
+ maxBatchSize: f = j,
160
+ flushDelayMs: i = q,
161
+ deduplicate: o = !0,
162
+ cache: e
163
+ } = n, a = [];
164
+ let t;
165
+ function u() {
166
+ t === void 0 && (t = setTimeout(() => {
167
+ t = void 0, s();
168
+ }, i));
169
+ }
170
+ async function s() {
171
+ if (a.length === 0) return;
172
+ const l = a.splice(0, a.length), y = [], c = /* @__PURE__ */ new Map();
173
+ for (const m of l) {
174
+ const h = c.get(m.contentHash);
175
+ h ? o ? h.push(m) : (y.push(m.text), c.set(m.contentHash + "_" + y.length, [m])) : (y.push(m.text), c.set(m.contentHash, [m]));
176
+ }
177
+ const d = [], p = [], A = /* @__PURE__ */ new Map();
178
+ for (const m of l) {
179
+ if (A.has(m.contentHash)) continue;
180
+ const h = e?.get(m.contentHash);
181
+ h ? A.set(m.contentHash, h) : p.includes(m.contentHash) || (d.push(m.text), p.push(m.contentHash));
182
+ }
183
+ try {
184
+ let m = [];
185
+ if (d.length > 0) {
186
+ m = await r.embed(d);
187
+ for (let h = 0; h < m.length; h++) {
188
+ const g = p[h], w = m[h];
189
+ g !== void 0 && w !== void 0 && (e?.set(g, w), A.set(g, w));
190
+ }
191
+ }
192
+ for (const h of l) {
193
+ const g = A.get(h.contentHash);
194
+ g ? h.resolve(g) : h.reject(new Error(`No embedding found for content hash: ${h.contentHash}`));
195
+ }
196
+ } catch (m) {
197
+ for (const h of l)
198
+ h.reject(m);
199
+ }
200
+ }
201
+ return {
202
+ // Passthrough methods from base adapter
203
+ async embed(l, y) {
204
+ return r.embed(l, y);
205
+ },
206
+ getModelMetadata() {
207
+ return r.getModelMetadata();
208
+ },
209
+ // Batched methods
210
+ async queue(l, y) {
211
+ const c = await P(l), d = e?.get(c);
212
+ return d || new Promise((p, A) => {
213
+ a.push({
214
+ text: l,
215
+ contentHash: c,
216
+ resolve: p,
217
+ reject: A
218
+ }), a.length >= f ? (t !== void 0 && (clearTimeout(t), t = void 0), s()) : u();
219
+ });
220
+ },
221
+ async queueBatch(l, y) {
222
+ const c = l.map((d) => this.queue(d, y));
223
+ return Promise.all(c);
224
+ },
225
+ async flush() {
226
+ t !== void 0 && (clearTimeout(t), t = void 0), await s();
227
+ },
228
+ getPendingCount() {
229
+ return a.length;
230
+ },
231
+ getCache() {
232
+ return e;
233
+ }
234
+ };
235
+ }
236
+ function de(r = {}) {
237
+ const {
238
+ maxEntries: n = $,
239
+ maxBytes: f,
240
+ ttlMs: i,
241
+ onEvict: o
242
+ } = r, e = /* @__PURE__ */ new Map();
243
+ let a = 0, t = 0;
244
+ function u() {
245
+ let c = 0;
246
+ for (const d of e.values())
247
+ c += x(d.embedding);
248
+ return c;
249
+ }
250
+ function s(c) {
251
+ return i === void 0 ? !1 : Date.now() - c.createdAt > i;
252
+ }
253
+ function l() {
254
+ for (; e.size > n; )
255
+ y();
256
+ if (f !== void 0)
257
+ for (; u() > f && e.size > 0; )
258
+ y();
259
+ }
260
+ function y() {
261
+ let c, d = 1 / 0;
262
+ for (const [p, A] of e.entries())
263
+ A.lastAccess < d && (d = A.lastAccess, c = p);
264
+ if (c !== void 0) {
265
+ const p = e.get(c);
266
+ e.delete(c), p && o && o(c, p.embedding);
267
+ }
268
+ }
269
+ return {
270
+ get(c) {
271
+ const d = e.get(c);
272
+ if (!d) {
273
+ t++;
274
+ return;
275
+ }
276
+ if (s(d)) {
277
+ e.delete(c), o && o(c, d.embedding), t++;
278
+ return;
279
+ }
280
+ return d.hitCount++, d.lastAccess = Date.now(), a++, d.embedding;
281
+ },
282
+ set(c, d) {
283
+ const p = Date.now();
284
+ e.set(c, {
285
+ embedding: d,
286
+ createdAt: p,
287
+ hitCount: 0,
288
+ lastAccess: p
289
+ }), l();
290
+ },
291
+ has(c) {
292
+ const d = e.get(c);
293
+ return d ? s(d) ? (e.delete(c), o && o(c, d.embedding), !1) : !0 : !1;
294
+ },
295
+ remove(c) {
296
+ const d = e.get(c);
297
+ return d && o && o(c, d.embedding), e.delete(c);
298
+ },
299
+ clear() {
300
+ if (o)
301
+ for (const [c, d] of e.entries())
302
+ o(c, d.embedding);
303
+ e.clear(), a = 0, t = 0;
304
+ },
305
+ getStats() {
306
+ const c = e.size, d = a + t;
307
+ return {
308
+ entries: c,
309
+ hits: a,
310
+ misses: t,
311
+ hitRate: d > 0 ? a / d : 0,
312
+ estimatedBytes: u()
313
+ };
314
+ }
315
+ };
316
+ }
317
+ function fe(r = {}) {
318
+ return {
319
+ formatSchemas(n) {
320
+ return n.map((f) => ({
321
+ type: "function",
322
+ function: {
323
+ name: f.name,
324
+ description: f.description,
325
+ parameters: f.parameters
326
+ }
327
+ }));
328
+ },
329
+ parseToolCalls(n) {
330
+ if (!n || typeof n != "object")
331
+ return [];
332
+ const i = n.choices?.[0]?.message?.tool_calls;
333
+ if (!i || !Array.isArray(i))
334
+ return [];
335
+ const o = [];
336
+ for (const e of i) {
337
+ if (!e || typeof e != "object" || !("id" in e) || !("function" in e)) continue;
338
+ const a = e.function;
339
+ if (!a || typeof a != "object" || !("name" in a) || !("arguments" in a)) continue;
340
+ let t = {};
341
+ try {
342
+ const u = JSON.parse(String(a.arguments));
343
+ u && typeof u == "object" && !Array.isArray(u) && (t = u);
344
+ } catch {
345
+ }
346
+ o.push({
347
+ id: String(e.id),
348
+ name: String(a.name),
349
+ arguments: t
350
+ });
351
+ }
352
+ return o;
353
+ },
354
+ formatResult(n) {
355
+ return {
356
+ tool_call_id: n.callId,
357
+ role: "tool",
358
+ content: n.success ? JSON.stringify(n.value) : JSON.stringify({ error: n.error })
359
+ };
360
+ }
361
+ };
362
+ }
363
+ function le(r = {}) {
364
+ return {
365
+ formatSchemas(n) {
366
+ return n.map((f) => ({
367
+ name: f.name,
368
+ description: f.description,
369
+ input_schema: f.parameters
370
+ }));
371
+ },
372
+ parseToolCalls(n) {
373
+ if (!n || typeof n != "object")
374
+ return [];
375
+ const f = n;
376
+ if (!f.content || !Array.isArray(f.content))
377
+ return [];
378
+ const i = [];
379
+ for (const o of f.content) {
380
+ if (!o || typeof o != "object" || !("type" in o) || o.type !== "tool_use" || !("id" in o) || !("name" in o) || !("input" in o)) continue;
381
+ const a = o, t = a.id, u = a.name, s = a.input;
382
+ typeof t != "string" || typeof u != "string" || !s || typeof s != "object" || Array.isArray(s) || i.push({
383
+ id: t,
384
+ name: u,
385
+ arguments: s
386
+ });
387
+ }
388
+ return i;
389
+ },
390
+ formatResult(n) {
391
+ return {
392
+ type: "tool_result",
393
+ tool_use_id: n.callId,
394
+ content: n.success ? JSON.stringify(n.value) : JSON.stringify({ error: n.error }),
395
+ is_error: !n.success
396
+ };
397
+ }
398
+ };
399
+ }
400
+ function me(r) {
401
+ const {
402
+ database: n,
403
+ documentsStore: f = H,
404
+ metadataStore: i = G
405
+ } = r, o = n.store(f), e = n.store(i);
406
+ return {
407
+ async load() {
408
+ return o.all();
409
+ },
410
+ async loadMetadata() {
411
+ return e.get(v);
412
+ },
413
+ async save(a) {
414
+ const t = Array.isArray(a) ? a : [a];
415
+ for (const u of t)
416
+ await o.set(u, u.id);
417
+ },
418
+ async saveMetadata(a) {
419
+ await e.set(a, v);
420
+ },
421
+ async remove(a) {
422
+ const t = Array.isArray(a) ? a : [a];
423
+ for (const u of t)
424
+ await o.remove(u);
425
+ },
426
+ async clear() {
427
+ await o.clear(), await e.clear();
428
+ },
429
+ async isAvailable() {
430
+ try {
431
+ return await o.all(), !0;
432
+ } catch {
433
+ return !1;
434
+ }
435
+ }
436
+ };
437
+ }
438
+ function ye(r) {
439
+ const {
440
+ directory: n,
441
+ chunkSize: f = C
442
+ } = r;
443
+ return {
444
+ async load() {
445
+ const i = await n.listFiles(), o = [];
446
+ for (const e of i)
447
+ if (e.getName().startsWith(T))
448
+ try {
449
+ const t = await e.getText(), u = JSON.parse(t);
450
+ for (const s of u)
451
+ o.push(S(s));
452
+ } catch {
453
+ }
454
+ return o;
455
+ },
456
+ async loadMetadata() {
457
+ const i = await n.getFile(D);
458
+ if (i)
459
+ try {
460
+ const o = await i.getText();
461
+ return JSON.parse(o);
462
+ } catch {
463
+ return;
464
+ }
465
+ },
466
+ async save(i) {
467
+ const o = Array.isArray(i) ? i : [i];
468
+ if (o.length === 0) return;
469
+ const e = await this.load(), a = new Map(e.map((s) => [s.id, s]));
470
+ for (const s of o)
471
+ a.set(s.id, s);
472
+ const t = await n.listFiles();
473
+ for (const s of t)
474
+ s.getName().startsWith(T) && await n.removeFile(s.getName());
475
+ const u = Array.from(a.values());
476
+ for (let s = 0; s < u.length; s += f) {
477
+ const l = u.slice(s, s + f), y = Math.floor(s / f), c = `${T}${y}.json`;
478
+ await (await n.createFile(c)).write(JSON.stringify(l.map(R)));
479
+ }
480
+ },
481
+ async saveMetadata(i) {
482
+ await (await n.createFile(D)).write(JSON.stringify(i));
483
+ },
484
+ async remove(i) {
485
+ const o = Array.isArray(i) ? i : [i], e = new Set(o), t = (await this.load()).filter((u) => !e.has(u.id));
486
+ await this.clear(), t.length > 0 && await this.save(t);
487
+ },
488
+ async clear() {
489
+ const i = await n.listFiles();
490
+ for (const o of i)
491
+ await n.removeFile(o.getName());
492
+ },
493
+ async isAvailable() {
494
+ try {
495
+ return await n.listFiles(), !0;
496
+ } catch {
497
+ return !1;
498
+ }
499
+ }
500
+ };
501
+ }
502
+ function he(r) {
503
+ const {
504
+ baseURL: n,
505
+ headers: f = {},
506
+ timeout: i = J
507
+ } = r;
508
+ async function o(e, a) {
509
+ const t = new AbortController(), u = setTimeout(() => t.abort(), i);
510
+ try {
511
+ return await fetch(e, {
512
+ ...a,
513
+ signal: t.signal,
514
+ headers: {
515
+ "Content-Type": "application/json",
516
+ ...f,
517
+ ...a.headers
518
+ }
519
+ });
520
+ } finally {
521
+ clearTimeout(u);
522
+ }
523
+ }
524
+ return {
525
+ async load() {
526
+ const e = await o(`${n}/documents`, {
527
+ method: "GET"
528
+ });
529
+ if (!e.ok)
530
+ throw new E(
531
+ "ADAPTER_ERROR",
532
+ `HTTP load failed (${e.status})`
533
+ );
534
+ return (await e.json()).map(S);
535
+ },
536
+ async loadMetadata() {
537
+ try {
538
+ const e = await o(`${n}/metadata`, {
539
+ method: "GET"
540
+ });
541
+ if (e.status === 404)
542
+ return;
543
+ if (!e.ok)
544
+ throw new E(
545
+ "ADAPTER_ERROR",
546
+ `HTTP loadMetadata failed (${e.status})`
547
+ );
548
+ return await e.json();
549
+ } catch (e) {
550
+ if (e instanceof E) throw e;
551
+ return;
552
+ }
553
+ },
554
+ async save(e) {
555
+ const a = Array.isArray(e) ? e : [e], t = await o(`${n}/documents`, {
556
+ method: "POST",
557
+ body: JSON.stringify(a.map(R))
558
+ });
559
+ if (!t.ok)
560
+ throw new E(
561
+ "ADAPTER_ERROR",
562
+ `HTTP save failed (${t.status})`
563
+ );
564
+ },
565
+ async saveMetadata(e) {
566
+ const a = await o(`${n}/metadata`, {
567
+ method: "PUT",
568
+ body: JSON.stringify(e)
569
+ });
570
+ if (!a.ok)
571
+ throw new E(
572
+ "ADAPTER_ERROR",
573
+ `HTTP saveMetadata failed (${a.status})`
574
+ );
575
+ },
576
+ async remove(e) {
577
+ const a = Array.isArray(e) ? e : [e], t = await o(`${n}/documents`, {
578
+ method: "DELETE",
579
+ body: JSON.stringify({ ids: a })
580
+ });
581
+ if (!t.ok)
582
+ throw new E(
583
+ "ADAPTER_ERROR",
584
+ `HTTP remove failed (${t.status})`
585
+ );
586
+ },
587
+ async clear() {
588
+ const e = await o(`${n}/documents`, {
589
+ method: "DELETE"
590
+ });
591
+ if (!e.ok)
592
+ throw new E(
593
+ "ADAPTER_ERROR",
594
+ `HTTP clear failed (${e.status})`
595
+ );
596
+ },
597
+ async isAvailable() {
598
+ try {
599
+ return (await o(`${n}/health`, {
600
+ method: "GET"
601
+ })).ok;
602
+ } catch {
603
+ return !1;
604
+ }
605
+ }
606
+ };
607
+ }
608
+ function pe(r) {
609
+ const {
610
+ registry: n,
611
+ timeout: f = V,
612
+ onError: i,
613
+ onBeforeExecute: o,
614
+ onAfterExecute: e
615
+ } = r;
616
+ async function a(t) {
617
+ if (!n.has(t.name))
618
+ return {
619
+ callId: t.id,
620
+ name: t.name,
621
+ success: !1,
622
+ error: `Tool not found: ${t.name}`
623
+ };
624
+ o?.(t);
625
+ try {
626
+ const u = new Promise((l, y) => {
627
+ setTimeout(() => {
628
+ y(new Error(`Tool execution timed out after ${f}ms`));
629
+ }, f);
630
+ }), s = await Promise.race([
631
+ n.execute(t.name, t.arguments),
632
+ u
633
+ ]);
634
+ return e?.(t, s), {
635
+ callId: t.id,
636
+ name: t.name,
637
+ success: !0,
638
+ value: s
639
+ };
640
+ } catch (u) {
641
+ i?.(u, t);
642
+ const s = u instanceof Error ? u.message : String(u);
643
+ return {
644
+ callId: t.id,
645
+ name: t.name,
646
+ success: !1,
647
+ error: s
648
+ };
649
+ }
650
+ }
651
+ return {
652
+ async execute(t) {
653
+ return a(t);
654
+ },
655
+ async executeAll(t) {
656
+ return await Promise.all(
657
+ t.map((s) => a(s))
658
+ );
659
+ },
660
+ hasTool(t) {
661
+ return n.has(t);
662
+ }
663
+ };
664
+ }
665
+ function Ae(r) {
666
+ const {
667
+ vectorStore: n,
668
+ name: f,
669
+ description: i,
670
+ defaultLimit: o = z,
671
+ maxLimit: e = Y,
672
+ scoreThreshold: a,
673
+ formatResult: t = K,
674
+ extendParameters: u = {},
675
+ buildFilter: s
676
+ } = r, l = {
677
+ type: "object",
678
+ properties: {
679
+ query: {
680
+ type: "string",
681
+ description: "The search query to find relevant documents"
682
+ },
683
+ limit: {
684
+ type: "integer",
685
+ description: `Maximum number of results to return (default: ${o}, max: ${e})`,
686
+ minimum: 1,
687
+ maximum: e,
688
+ default: o
689
+ },
690
+ ...u
691
+ },
692
+ required: ["query"]
693
+ }, y = {
694
+ name: f,
695
+ description: i,
696
+ parameters: l
697
+ };
698
+ async function c(d) {
699
+ const p = d.query;
700
+ if (typeof p != "string" || p.length === 0)
701
+ return [];
702
+ const A = d.limit;
703
+ let m = o;
704
+ typeof A == "number" && Number.isInteger(A) && (m = Math.min(Math.max(1, A), e));
705
+ const h = s?.(d), g = h !== void 0 ? { limit: m, filter: h } : { limit: m }, w = await n.search(p, g);
706
+ let _ = w;
707
+ return a !== void 0 && (_ = w.filter((b) => b.score >= a)), _.map(t);
708
+ }
709
+ return { schema: y, handler: c };
710
+ }
711
+ function K(r) {
712
+ return {
713
+ content: r.content,
714
+ score: r.score,
715
+ metadata: r.metadata
716
+ };
717
+ }
718
+ function Ee(r) {
719
+ const {
720
+ form: n,
721
+ confirmFn: f,
722
+ message: i = X,
723
+ excludePages: o = [],
724
+ onlyFromPages: e
725
+ } = r;
726
+ return async function(t, u) {
727
+ return W(t, u, o, e) || !n.isDirty() ? !0 : await Promise.resolve(f(i));
728
+ };
729
+ }
730
+ function W(r, n, f, i) {
731
+ return !!(f.includes(r) || i !== void 0 && !i.includes(n));
732
+ }
733
+ function ge(r) {
734
+ const {
735
+ database: n,
736
+ storeName: f,
737
+ autoprune: i,
738
+ onSaveError: o
739
+ } = r, e = n.store(f);
740
+ i !== void 0 && i > 0 && a(i);
741
+ async function a(t) {
742
+ const s = Date.now() - t, l = await e.all();
743
+ let y = 0;
744
+ for (const c of l)
745
+ c.updatedAt < s && (await e.remove(c.id), y++);
746
+ return y;
747
+ }
748
+ return {
749
+ async save(t, u) {
750
+ try {
751
+ const s = {
752
+ id: t,
753
+ messages: [...u.getMessages()],
754
+ metadata: u.getMetadata(),
755
+ updatedAt: Date.now()
756
+ };
757
+ await e.set(s, t);
758
+ } catch (s) {
759
+ throw o?.(s, t), s;
760
+ }
761
+ },
762
+ async load(t) {
763
+ return e.get(t);
764
+ },
765
+ async delete(t) {
766
+ await e.remove(t);
767
+ },
768
+ async list() {
769
+ return (await e.all()).map((u) => u.id);
770
+ },
771
+ async prune(t) {
772
+ return a(t);
773
+ }
774
+ };
775
+ }
776
+ export {
777
+ V as BRIDGE_DEFAULT_TIMEOUT,
778
+ E as CoreError,
779
+ q as EMBEDDING_BATCH_DEFAULT_FLUSH_DELAY_MS,
780
+ j as EMBEDDING_BATCH_DEFAULT_MAX_SIZE,
781
+ $ as EMBEDDING_CACHE_DEFAULT_MAX_ENTRIES,
782
+ O as EcosystemError,
783
+ X as FORM_DIRTY_DEFAULT_MESSAGE,
784
+ J as HTTP_DEFAULT_TIMEOUT,
785
+ H as INDEXEDDB_DEFAULT_DOCUMENTS_STORE,
786
+ G as INDEXEDDB_DEFAULT_METADATA_STORE,
787
+ k as OPENAI_API_BASE_URL,
788
+ F as OPENAI_DEFAULT_EMBEDDING_DIMENSIONS,
789
+ N as OPENAI_DEFAULT_EMBEDDING_MODEL,
790
+ C as OPFS_DEFAULT_CHUNK_SIZE,
791
+ T as OPFS_DOCUMENTS_PREFIX,
792
+ D as OPFS_METADATA_FILE,
793
+ z as RETRIEVAL_DEFAULT_LIMIT,
794
+ Y as RETRIEVAL_MAX_LIMIT,
795
+ v as VECTORSTORE_METADATA_KEY,
796
+ B as VOYAGE_API_BASE_URL,
797
+ U as VOYAGE_DEFAULT_EMBEDDING_DIMENSIONS,
798
+ L as VOYAGE_DEFAULT_EMBEDDING_MODEL,
799
+ se as chain,
800
+ P as computeContentHash,
801
+ ce as createAnthropicEmbeddingAdapter,
802
+ le as createAnthropicToolFormatAdapter,
803
+ ue as createBatchedEmbeddingAdapter,
804
+ de as createEmbeddingCache,
805
+ Ee as createFormDirtyGuard,
806
+ he as createHTTPVectorStorePersistence,
807
+ me as createIndexedDBVectorStorePersistence,
808
+ ye as createOPFSVectorStorePersistence,
809
+ ie as createOpenAIEmbeddingAdapter,
810
+ fe as createOpenAIToolFormatAdapter,
811
+ Ae as createRetrievalTool,
812
+ ge as createSessionPersistence,
813
+ pe as createToolCallBridge,
814
+ S as deserializeStoredDocument,
815
+ I as err,
816
+ x as estimateEmbeddingBytes,
817
+ Q as isCoreError,
818
+ Z as isEcosystemError,
819
+ te as isErr,
820
+ ee as isOk,
821
+ oe as map,
822
+ ae as mapErr,
823
+ M as ok,
824
+ R as serializeStoredDocument,
825
+ ne as unwrap,
826
+ re as unwrapOrThrow
827
+ };
828
+ //# sourceMappingURL=index.js.map