@fortemi/core 2026.6.0 → 2026.6.2
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/README.md +60 -4
- package/dist/aiwg-index.d.ts +212 -0
- package/dist/aiwg-index.js +550 -0
- package/dist/aiwg-index.js.map +1 -0
- package/dist/index.d.ts +182 -163
- package/dist/index.js +976 -171
- package/dist/index.js.map +1 -1
- package/package.json +5 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PGlite } from '@electric-sql/pglite';
|
|
2
2
|
import { z, ZodType } from 'zod';
|
|
3
|
+
export { AiwgChunkedIndexLoadOptions, AiwgChunkedIndexLoader, AiwgChunkedIndexProgress, AiwgChunkedIndexProgressPhase, AiwgChunkedIndexQueryOptions, AiwgChunkedIndexQueryResult, AiwgChunkedIndexValidationResult, AiwgFortemiChunkManifest, AiwgFortemiChunkPart, AiwgFortemiChunkPartRef, AiwgFortemiIndexExport, AiwgFortemiProvenance, AiwgFortemiRecord, AiwgFortemiRecordSource, AiwgFortemiRecordType, AiwgFortemiRelationship, AiwgIndexController, AiwgIndexControllerListener, AiwgIndexControllerSnapshot, AiwgIndexGraphOptions, AiwgIndexQueryMatch, AiwgIndexQueryOptions, AiwgIndexQueryRankedItem, AiwgIndexQueryResult, AiwgIndexQueryWeights, AiwgIndexValidationResult, AiwgPrivacyClassification, AiwgProvenanceConfidence, AiwgReviewAction, AiwgReviewDecision, AiwgReviewDecisionExport, AiwgReviewInput, aiwgFortemiIndexToCommunityGraph, assertAiwgFortemiChunkManifest, assertAiwgFortemiChunkPart, assertAiwgFortemiIndexExport, createAiwgFetchChunkLoader, createAiwgIndexController, createAiwgReviewDecisionExport, getAiwgFortemiFacets, queryAiwgFortemiIndex, validateAiwgFortemiChunkManifest, validateAiwgFortemiChunkPart, validateAiwgFortemiIndexExport } from './aiwg-index.js';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Generate a RFC 9562 UUIDv7 identifier.
|
|
@@ -132,6 +133,56 @@ declare class TypedEventBus {
|
|
|
132
133
|
type PersistenceMode = 'opfs' | 'idb' | 'memory';
|
|
133
134
|
declare function createPGliteInstance(persistence: PersistenceMode, archiveName?: string): Promise<PGlite>;
|
|
134
135
|
|
|
136
|
+
/**
|
|
137
|
+
* Type-safe client for the PGlite Worker.
|
|
138
|
+
*
|
|
139
|
+
* PGliteWorkerClient wraps a Worker instance and exposes the same surface as
|
|
140
|
+
* PGlite (query / exec / transaction) but serialises every call to a typed
|
|
141
|
+
* postMessage exchange. Each outgoing request is tagged with a UUIDv7 `id`;
|
|
142
|
+
* the worker echoes that id in its reply so the client can resolve or reject
|
|
143
|
+
* the matching Promise.
|
|
144
|
+
*
|
|
145
|
+
* TransactionProxy is a lightweight wrapper handed to the callback in
|
|
146
|
+
* transaction(), forwarding TX_QUERY / TX_EXEC messages with the active txId.
|
|
147
|
+
*/
|
|
148
|
+
declare class PGliteWorkerClient {
|
|
149
|
+
private worker;
|
|
150
|
+
private pending;
|
|
151
|
+
private readyPromise;
|
|
152
|
+
private resolveReady;
|
|
153
|
+
constructor(worker: Worker);
|
|
154
|
+
/** Resolves when the worker broadcasts READY after database initialisation. */
|
|
155
|
+
waitReady(): Promise<void>;
|
|
156
|
+
private send;
|
|
157
|
+
query<T = Record<string, unknown>>(sql: string, params?: unknown[]): Promise<{
|
|
158
|
+
rows: T[];
|
|
159
|
+
fields?: Array<{
|
|
160
|
+
name: string;
|
|
161
|
+
dataTypeID: number;
|
|
162
|
+
}>;
|
|
163
|
+
}>;
|
|
164
|
+
exec(sql: string): Promise<void>;
|
|
165
|
+
transaction<T>(fn: (tx: TransactionProxy) => Promise<T>): Promise<T>;
|
|
166
|
+
/** Forward TX_QUERY for TransactionProxy — not part of the public surface. */
|
|
167
|
+
_txQuery<T>(txId: string, sql: string, params?: unknown[]): Promise<{
|
|
168
|
+
rows: T[];
|
|
169
|
+
}>;
|
|
170
|
+
/** Forward TX_EXEC for TransactionProxy — not part of the public surface. */
|
|
171
|
+
_txExec(txId: string, sql: string): Promise<void>;
|
|
172
|
+
ping(): Promise<void>;
|
|
173
|
+
close(): Promise<void>;
|
|
174
|
+
}
|
|
175
|
+
/** Proxy passed to the transaction callback — scopes queries to the active txId. */
|
|
176
|
+
declare class TransactionProxy {
|
|
177
|
+
private client;
|
|
178
|
+
private txId;
|
|
179
|
+
constructor(client: PGliteWorkerClient, txId: string);
|
|
180
|
+
query<T = Record<string, unknown>>(sql: string, params?: unknown[]): Promise<{
|
|
181
|
+
rows: T[];
|
|
182
|
+
}>;
|
|
183
|
+
exec(sql: string): Promise<void>;
|
|
184
|
+
}
|
|
185
|
+
|
|
135
186
|
interface QueryResult<T = Record<string, unknown>> {
|
|
136
187
|
rows: T[];
|
|
137
188
|
fields?: Array<{
|
|
@@ -177,6 +228,24 @@ declare class PGliteStorageBackendFactory implements StorageBackendFactory {
|
|
|
177
228
|
open(input: StorageOpenRequest): Promise<StorageBackend>;
|
|
178
229
|
}
|
|
179
230
|
declare const defaultStorageBackendFactory: PGliteStorageBackendFactory;
|
|
231
|
+
declare class PGliteWorkerStorageBackend implements StorageBackend {
|
|
232
|
+
readonly id: string;
|
|
233
|
+
private client;
|
|
234
|
+
readonly mode = "readwrite";
|
|
235
|
+
constructor(id: string, client: PGliteWorkerClient);
|
|
236
|
+
query<T = Record<string, unknown>>(sql: string, params?: unknown[]): Promise<QueryResult<T>>;
|
|
237
|
+
exec(sql: string): Promise<unknown>;
|
|
238
|
+
transaction<T>(fn: (tx: QueryExecutor) => Promise<T>): Promise<T>;
|
|
239
|
+
close(): Promise<void>;
|
|
240
|
+
}
|
|
241
|
+
interface PGliteWorkerStorageBackendFactoryOptions {
|
|
242
|
+
createWorker: () => Worker;
|
|
243
|
+
}
|
|
244
|
+
declare class PGliteWorkerStorageBackendFactory implements StorageBackendFactory {
|
|
245
|
+
private options;
|
|
246
|
+
constructor(options: PGliteWorkerStorageBackendFactoryOptions);
|
|
247
|
+
open(input: StorageOpenRequest): Promise<StorageBackend>;
|
|
248
|
+
}
|
|
180
249
|
|
|
181
250
|
/**
|
|
182
251
|
* Capability module system (ADR-002).
|
|
@@ -289,7 +358,7 @@ declare class ArchiveManager {
|
|
|
289
358
|
private archives;
|
|
290
359
|
private persistence;
|
|
291
360
|
private backendFactory;
|
|
292
|
-
constructor(persistenceOrFactory: PersistenceMode | StorageBackendFactory, events?: TypedEventBus | undefined);
|
|
361
|
+
constructor(persistenceOrFactory: PersistenceMode | StorageBackendFactory, events?: TypedEventBus | undefined, persistenceOverride?: PersistenceMode);
|
|
293
362
|
getCurrentArchiveName(): string;
|
|
294
363
|
getDb(): StorageBackend | null;
|
|
295
364
|
open(archiveName?: string): Promise<StorageBackend>;
|
|
@@ -471,56 +540,6 @@ type WorkerResponse = {
|
|
|
471
540
|
type: 'READY';
|
|
472
541
|
};
|
|
473
542
|
|
|
474
|
-
/**
|
|
475
|
-
* Type-safe client for the PGlite Worker.
|
|
476
|
-
*
|
|
477
|
-
* PGliteWorkerClient wraps a Worker instance and exposes the same surface as
|
|
478
|
-
* PGlite (query / exec / transaction) but serialises every call to a typed
|
|
479
|
-
* postMessage exchange. Each outgoing request is tagged with a UUIDv7 `id`;
|
|
480
|
-
* the worker echoes that id in its reply so the client can resolve or reject
|
|
481
|
-
* the matching Promise.
|
|
482
|
-
*
|
|
483
|
-
* TransactionProxy is a lightweight wrapper handed to the callback in
|
|
484
|
-
* transaction(), forwarding TX_QUERY / TX_EXEC messages with the active txId.
|
|
485
|
-
*/
|
|
486
|
-
declare class PGliteWorkerClient {
|
|
487
|
-
private worker;
|
|
488
|
-
private pending;
|
|
489
|
-
private readyPromise;
|
|
490
|
-
private resolveReady;
|
|
491
|
-
constructor(worker: Worker);
|
|
492
|
-
/** Resolves when the worker broadcasts READY after database initialisation. */
|
|
493
|
-
waitReady(): Promise<void>;
|
|
494
|
-
private send;
|
|
495
|
-
query<T = Record<string, unknown>>(sql: string, params?: unknown[]): Promise<{
|
|
496
|
-
rows: T[];
|
|
497
|
-
fields?: Array<{
|
|
498
|
-
name: string;
|
|
499
|
-
dataTypeID: number;
|
|
500
|
-
}>;
|
|
501
|
-
}>;
|
|
502
|
-
exec(sql: string): Promise<void>;
|
|
503
|
-
transaction<T>(fn: (tx: TransactionProxy) => Promise<T>): Promise<T>;
|
|
504
|
-
/** Forward TX_QUERY for TransactionProxy — not part of the public surface. */
|
|
505
|
-
_txQuery<T>(txId: string, sql: string, params?: unknown[]): Promise<{
|
|
506
|
-
rows: T[];
|
|
507
|
-
}>;
|
|
508
|
-
/** Forward TX_EXEC for TransactionProxy — not part of the public surface. */
|
|
509
|
-
_txExec(txId: string, sql: string): Promise<void>;
|
|
510
|
-
ping(): Promise<void>;
|
|
511
|
-
close(): Promise<void>;
|
|
512
|
-
}
|
|
513
|
-
/** Proxy passed to the transaction callback — scopes queries to the active txId. */
|
|
514
|
-
declare class TransactionProxy {
|
|
515
|
-
private client;
|
|
516
|
-
private txId;
|
|
517
|
-
constructor(client: PGliteWorkerClient, txId: string);
|
|
518
|
-
query<T = Record<string, unknown>>(sql: string, params?: unknown[]): Promise<{
|
|
519
|
-
rows: T[];
|
|
520
|
-
}>;
|
|
521
|
-
exec(sql: string): Promise<void>;
|
|
522
|
-
}
|
|
523
|
-
|
|
524
543
|
/**
|
|
525
544
|
* EmbeddingSetsRepository - named, filter, and virtual embedding set API.
|
|
526
545
|
*/
|
|
@@ -533,6 +552,18 @@ interface EmbeddingSetCriteria {
|
|
|
533
552
|
collectionIds?: string[];
|
|
534
553
|
conceptIds?: string[];
|
|
535
554
|
noteIds?: string[];
|
|
555
|
+
sources?: string[];
|
|
556
|
+
formats?: string[];
|
|
557
|
+
visibilities?: string[];
|
|
558
|
+
isStarred?: boolean;
|
|
559
|
+
isArchived?: boolean;
|
|
560
|
+
hasTitle?: boolean;
|
|
561
|
+
hasEmbedding?: boolean;
|
|
562
|
+
isUserEdited?: boolean;
|
|
563
|
+
hasAiMetadata?: boolean;
|
|
564
|
+
hasRevisions?: boolean;
|
|
565
|
+
minGenerationCount?: number;
|
|
566
|
+
maxGenerationCount?: number;
|
|
536
567
|
updatedAfter?: string;
|
|
537
568
|
updatedBefore?: string;
|
|
538
569
|
}
|
|
@@ -553,6 +584,9 @@ interface VirtualMaterializationPolicy {
|
|
|
553
584
|
includeResolvedMembers?: boolean;
|
|
554
585
|
includeResolvedEdges?: boolean;
|
|
555
586
|
freshness: 'fresh' | 'stale' | 'unknown';
|
|
587
|
+
inputHash?: string;
|
|
588
|
+
generatedAt?: string;
|
|
589
|
+
resolvedMemberCount?: number;
|
|
556
590
|
}
|
|
557
591
|
interface CriteriaVirtualSource {
|
|
558
592
|
type: 'criteria';
|
|
@@ -646,6 +680,7 @@ interface ResolvedEmbeddingSet {
|
|
|
646
680
|
embeddingIds: string[];
|
|
647
681
|
errors: VirtualEmbeddingSetValidationError[];
|
|
648
682
|
freshness: EmbeddingSetFreshness;
|
|
683
|
+
resolutionSource: 'live' | 'materialized';
|
|
649
684
|
}
|
|
650
685
|
interface EmbeddingSetRow {
|
|
651
686
|
id: string;
|
|
@@ -695,9 +730,12 @@ declare class EmbeddingSetsRepository {
|
|
|
695
730
|
id: string;
|
|
696
731
|
}>;
|
|
697
732
|
resolveSelector(selector: EmbeddingSetSelector): Promise<ResolvedEmbeddingSet>;
|
|
733
|
+
refreshMaterializedVirtualSet(setId: string): Promise<ResolvedEmbeddingSet>;
|
|
734
|
+
markVirtualSetStale(setId: string, reason: string): Promise<void>;
|
|
698
735
|
private resolveDefinition;
|
|
699
736
|
private resolvePhysicalSet;
|
|
700
737
|
private resolvePhysicalRows;
|
|
738
|
+
private resolveMaterializedRows;
|
|
701
739
|
private resolveCriteriaSource;
|
|
702
740
|
private resolveSetOperationSource;
|
|
703
741
|
private resolveFallbackSource;
|
|
@@ -705,6 +743,7 @@ declare class EmbeddingSetsRepository {
|
|
|
705
743
|
private validateCompatibility;
|
|
706
744
|
private resolveDuplicateRows;
|
|
707
745
|
private finalizeResolution;
|
|
746
|
+
private resolutionInputHash;
|
|
708
747
|
private definitionFromRow;
|
|
709
748
|
private inferDefinitionModel;
|
|
710
749
|
private inferDefinitionDimension;
|
|
@@ -951,12 +990,20 @@ interface SimilarityGraphOptions {
|
|
|
951
990
|
k?: number;
|
|
952
991
|
minSimilarity?: number;
|
|
953
992
|
threshold?: number;
|
|
993
|
+
metric?: 'cosine' | 'inner_product' | 'l2';
|
|
994
|
+
batchSize?: number;
|
|
995
|
+
yieldEvery?: number;
|
|
996
|
+
onProgress?: (progress: SimilarityGraphProgress) => void;
|
|
954
997
|
}
|
|
955
998
|
interface SimilarityGraphRequest extends SimilarityGraphOptions {
|
|
956
999
|
selector: EmbeddingSetSelector;
|
|
957
|
-
metric?: 'cosine' | 'inner_product' | 'l2';
|
|
958
1000
|
source?: 'cache-preferred' | 'live-only' | 'cache-only';
|
|
959
1001
|
}
|
|
1002
|
+
interface SimilarityGraphProgress {
|
|
1003
|
+
phase: 'prepare' | 'neighbors';
|
|
1004
|
+
done: number;
|
|
1005
|
+
total: number;
|
|
1006
|
+
}
|
|
960
1007
|
interface SimilarityGraphCacheKey {
|
|
961
1008
|
selectorHash: string;
|
|
962
1009
|
resolvedEmbeddingSetId?: string;
|
|
@@ -1421,19 +1468,19 @@ declare const CaptureKnowledgeInputSchema: z.ZodObject<{
|
|
|
1421
1468
|
}, {
|
|
1422
1469
|
content: string;
|
|
1423
1470
|
title?: string | undefined;
|
|
1424
|
-
format?: "markdown" | "plain" | "html" | undefined;
|
|
1425
1471
|
tags?: string[] | undefined;
|
|
1472
|
+
format?: "markdown" | "plain" | "html" | undefined;
|
|
1426
1473
|
}>, "many">>;
|
|
1427
1474
|
template: z.ZodOptional<z.ZodString>;
|
|
1428
1475
|
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
1429
1476
|
}, "strip", z.ZodTypeAny, {
|
|
1430
1477
|
source: string;
|
|
1431
1478
|
format: "markdown" | "plain" | "html";
|
|
1432
|
-
visibility: "private" | "
|
|
1479
|
+
visibility: "private" | "public" | "shared";
|
|
1433
1480
|
action: "create" | "bulk_create" | "from_template";
|
|
1434
1481
|
title?: string | undefined;
|
|
1435
|
-
archive_id?: string | undefined;
|
|
1436
1482
|
tags?: string[] | undefined;
|
|
1483
|
+
archive_id?: string | undefined;
|
|
1437
1484
|
content?: string | undefined;
|
|
1438
1485
|
notes?: {
|
|
1439
1486
|
format: "markdown" | "plain" | "html";
|
|
@@ -1447,16 +1494,16 @@ declare const CaptureKnowledgeInputSchema: z.ZodObject<{
|
|
|
1447
1494
|
action: "create" | "bulk_create" | "from_template";
|
|
1448
1495
|
source?: string | undefined;
|
|
1449
1496
|
title?: string | undefined;
|
|
1497
|
+
tags?: string[] | undefined;
|
|
1450
1498
|
archive_id?: string | undefined;
|
|
1451
1499
|
format?: "markdown" | "plain" | "html" | undefined;
|
|
1452
|
-
visibility?: "private" | "
|
|
1453
|
-
tags?: string[] | undefined;
|
|
1500
|
+
visibility?: "private" | "public" | "shared" | undefined;
|
|
1454
1501
|
content?: string | undefined;
|
|
1455
1502
|
notes?: {
|
|
1456
1503
|
content: string;
|
|
1457
1504
|
title?: string | undefined;
|
|
1458
|
-
format?: "markdown" | "plain" | "html" | undefined;
|
|
1459
1505
|
tags?: string[] | undefined;
|
|
1506
|
+
format?: "markdown" | "plain" | "html" | undefined;
|
|
1460
1507
|
}[] | undefined;
|
|
1461
1508
|
template?: string | undefined;
|
|
1462
1509
|
variables?: Record<string, string> | undefined;
|
|
@@ -1501,35 +1548,35 @@ declare const SearchInputSchema: z.ZodObject<{
|
|
|
1501
1548
|
visibility: z.ZodOptional<z.ZodEnum<["private", "shared", "public"]>>;
|
|
1502
1549
|
include_facets: z.ZodDefault<z.ZodBoolean>;
|
|
1503
1550
|
}, "strip", z.ZodTypeAny, {
|
|
1504
|
-
|
|
1551
|
+
query: string;
|
|
1505
1552
|
offset: number;
|
|
1553
|
+
limit: number;
|
|
1506
1554
|
include_facets: boolean;
|
|
1507
|
-
mode: "
|
|
1508
|
-
query: string;
|
|
1555
|
+
mode: "text" | "semantic" | "hybrid";
|
|
1509
1556
|
source?: string | undefined;
|
|
1557
|
+
tags?: string[] | undefined;
|
|
1510
1558
|
format?: "markdown" | "plain" | "html" | undefined;
|
|
1511
|
-
visibility?: "private" | "
|
|
1559
|
+
visibility?: "private" | "public" | "shared" | undefined;
|
|
1512
1560
|
is_starred?: boolean | undefined;
|
|
1513
1561
|
is_archived?: boolean | undefined;
|
|
1514
|
-
tags?: string[] | undefined;
|
|
1515
1562
|
collection_id?: string | undefined;
|
|
1516
1563
|
date_from?: Date | undefined;
|
|
1517
1564
|
date_to?: Date | undefined;
|
|
1518
1565
|
}, {
|
|
1519
1566
|
query: string;
|
|
1520
1567
|
source?: string | undefined;
|
|
1568
|
+
tags?: string[] | undefined;
|
|
1569
|
+
offset?: number | undefined;
|
|
1521
1570
|
format?: "markdown" | "plain" | "html" | undefined;
|
|
1522
|
-
visibility?: "private" | "
|
|
1571
|
+
visibility?: "private" | "public" | "shared" | undefined;
|
|
1523
1572
|
is_starred?: boolean | undefined;
|
|
1524
1573
|
is_archived?: boolean | undefined;
|
|
1525
|
-
tags?: string[] | undefined;
|
|
1526
1574
|
limit?: number | undefined;
|
|
1527
|
-
offset?: number | undefined;
|
|
1528
1575
|
collection_id?: string | undefined;
|
|
1529
1576
|
date_from?: Date | undefined;
|
|
1530
1577
|
date_to?: Date | undefined;
|
|
1531
1578
|
include_facets?: boolean | undefined;
|
|
1532
|
-
mode?: "
|
|
1579
|
+
mode?: "text" | "semantic" | "hybrid" | undefined;
|
|
1533
1580
|
}>;
|
|
1534
1581
|
type SearchInput = z.infer<typeof SearchInputSchema>;
|
|
1535
1582
|
|
|
@@ -1607,22 +1654,22 @@ declare const ListNotesInputSchema: z.ZodObject<{
|
|
|
1607
1654
|
collection_id: z.ZodOptional<z.ZodString>;
|
|
1608
1655
|
include_deleted: z.ZodOptional<z.ZodBoolean>;
|
|
1609
1656
|
}, "strip", z.ZodTypeAny, {
|
|
1610
|
-
sort: "
|
|
1611
|
-
limit: number;
|
|
1657
|
+
sort: "title" | "updated_at" | "created_at";
|
|
1612
1658
|
offset: number;
|
|
1659
|
+
limit: number;
|
|
1613
1660
|
order: "asc" | "desc";
|
|
1661
|
+
tags?: string[] | undefined;
|
|
1614
1662
|
is_starred?: boolean | undefined;
|
|
1615
1663
|
is_archived?: boolean | undefined;
|
|
1616
|
-
tags?: string[] | undefined;
|
|
1617
1664
|
include_deleted?: boolean | undefined;
|
|
1618
1665
|
collection_id?: string | undefined;
|
|
1619
1666
|
}, {
|
|
1620
|
-
|
|
1667
|
+
tags?: string[] | undefined;
|
|
1668
|
+
sort?: "title" | "updated_at" | "created_at" | undefined;
|
|
1669
|
+
offset?: number | undefined;
|
|
1621
1670
|
is_starred?: boolean | undefined;
|
|
1622
1671
|
is_archived?: boolean | undefined;
|
|
1623
|
-
tags?: string[] | undefined;
|
|
1624
1672
|
limit?: number | undefined;
|
|
1625
|
-
offset?: number | undefined;
|
|
1626
1673
|
order?: "asc" | "desc" | undefined;
|
|
1627
1674
|
include_deleted?: boolean | undefined;
|
|
1628
1675
|
collection_id?: string | undefined;
|
|
@@ -1636,12 +1683,12 @@ declare const ManageTagsInputSchema: z.ZodObject<{
|
|
|
1636
1683
|
tag: z.ZodOptional<z.ZodString>;
|
|
1637
1684
|
}, "strip", z.ZodTypeAny, {
|
|
1638
1685
|
action: "add" | "remove" | "list_for_note" | "list_all";
|
|
1639
|
-
note_id?: string | undefined;
|
|
1640
1686
|
tag?: string | undefined;
|
|
1687
|
+
note_id?: string | undefined;
|
|
1641
1688
|
}, {
|
|
1642
1689
|
action: "add" | "remove" | "list_for_note" | "list_all";
|
|
1643
|
-
note_id?: string | undefined;
|
|
1644
1690
|
tag?: string | undefined;
|
|
1691
|
+
note_id?: string | undefined;
|
|
1645
1692
|
}>;
|
|
1646
1693
|
type ManageTagsInput = z.infer<typeof ManageTagsInputSchema>;
|
|
1647
1694
|
interface ManageTagsResult {
|
|
@@ -2350,6 +2397,50 @@ declare class FallbackRouter implements InferenceProvider {
|
|
|
2350
2397
|
private applyCooldown;
|
|
2351
2398
|
}
|
|
2352
2399
|
|
|
2400
|
+
interface FortemiBridgeCapabilities {
|
|
2401
|
+
secureSecrets: boolean;
|
|
2402
|
+
providerRouting: boolean;
|
|
2403
|
+
localNetworkAccess: boolean;
|
|
2404
|
+
auditLog: boolean;
|
|
2405
|
+
}
|
|
2406
|
+
interface FortemiSecretStore {
|
|
2407
|
+
isAvailable(): boolean | Promise<boolean>;
|
|
2408
|
+
getSecret(key: string): Promise<string | null>;
|
|
2409
|
+
setSecret(key: string, value: string): Promise<void>;
|
|
2410
|
+
deleteSecret(key: string): Promise<void>;
|
|
2411
|
+
}
|
|
2412
|
+
interface BridgeProviderInfo {
|
|
2413
|
+
id: string;
|
|
2414
|
+
name: string;
|
|
2415
|
+
tier: 'remote' | 'local-server' | 'in-browser' | 'chrome-ai';
|
|
2416
|
+
requiresApiKey: boolean;
|
|
2417
|
+
capabilities: {
|
|
2418
|
+
chat?: boolean;
|
|
2419
|
+
embeddings?: boolean;
|
|
2420
|
+
streaming?: boolean;
|
|
2421
|
+
};
|
|
2422
|
+
}
|
|
2423
|
+
interface FortemiInferenceRouter {
|
|
2424
|
+
listProviders(): Promise<BridgeProviderInfo[]>;
|
|
2425
|
+
probeProvider(providerId: string): Promise<ProbeResult>;
|
|
2426
|
+
complete(providerId: string, request: CompletionRequest): Promise<CompletionResponse>;
|
|
2427
|
+
embed(providerId: string, request: EmbedRequest): Promise<EmbedResponse>;
|
|
2428
|
+
stream?(providerId: string, request: CompletionRequest): AsyncIterable<StreamChunk>;
|
|
2429
|
+
}
|
|
2430
|
+
interface FortemiBridge {
|
|
2431
|
+
version: string;
|
|
2432
|
+
capabilities(): Promise<FortemiBridgeCapabilities>;
|
|
2433
|
+
secrets: FortemiSecretStore;
|
|
2434
|
+
inference?: FortemiInferenceRouter;
|
|
2435
|
+
}
|
|
2436
|
+
interface FortemiBridgeHost {
|
|
2437
|
+
fortemiBridge?: FortemiBridge;
|
|
2438
|
+
fortemiSecureStorage?: FortemiSecretStore;
|
|
2439
|
+
}
|
|
2440
|
+
declare function getFortemiBridge(host?: FortemiBridgeHost | undefined): FortemiBridge | null;
|
|
2441
|
+
declare function getFortemiSecretStore(host?: FortemiBridgeHost | undefined): FortemiSecretStore | null;
|
|
2442
|
+
declare function hasFortemiSecureSecrets(host?: FortemiBridgeHost | undefined): Promise<boolean>;
|
|
2443
|
+
|
|
2353
2444
|
type CspDirectiveName = 'default-src' | 'base-uri' | 'object-src' | 'frame-ancestors' | 'img-src' | 'font-src' | 'style-src' | 'script-src' | 'connect-src' | 'worker-src' | 'manifest-src' | 'report-uri';
|
|
2354
2445
|
type CspDirectives = Partial<Record<CspDirectiveName, string[]>>;
|
|
2355
2446
|
interface PluginCspOptions {
|
|
@@ -2425,12 +2516,26 @@ interface ExportOptions {
|
|
|
2425
2516
|
collectionId?: string;
|
|
2426
2517
|
/** Filter to notes with this tag (e.g. 'app:research' for app-scoped export). */
|
|
2427
2518
|
tag?: string;
|
|
2519
|
+
/** Export only these embedding sets and their member/vector rows. */
|
|
2520
|
+
embeddingSetIds?: string[];
|
|
2521
|
+
/** Preserve virtual selector materialization metadata and virtual member rows. */
|
|
2522
|
+
includeMaterializedSelectors?: boolean;
|
|
2428
2523
|
}
|
|
2429
2524
|
/** Conflict resolution strategy for shard import. */
|
|
2430
2525
|
type ConflictStrategy = 'skip' | 'replace' | 'error';
|
|
2431
2526
|
/** Options for shard import. */
|
|
2432
2527
|
interface ImportOptions {
|
|
2433
2528
|
conflictStrategy?: ConflictStrategy;
|
|
2529
|
+
/** Rows processed between cooperative yields. Defaults to 250. */
|
|
2530
|
+
batchSize?: number;
|
|
2531
|
+
/** Progress callback for long-running import phases. */
|
|
2532
|
+
onProgress?: (progress: ImportProgress) => void;
|
|
2533
|
+
}
|
|
2534
|
+
type ImportProgressPhase = 'unpack' | 'validate' | 'collections' | 'notes' | 'skos' | 'links' | 'provenance' | 'embedding_sets' | 'embeddings' | 'embedding_set_members' | 'graph' | 'communities' | 'index';
|
|
2535
|
+
interface ImportProgress {
|
|
2536
|
+
phase: ImportProgressPhase;
|
|
2537
|
+
done: number;
|
|
2538
|
+
total: number;
|
|
2434
2539
|
}
|
|
2435
2540
|
/** Per-entity import counts. */
|
|
2436
2541
|
interface ImportCounts {
|
|
@@ -2823,92 +2928,6 @@ declare function exportShard(db: DatabaseClient, options?: ExportOptions): Promi
|
|
|
2823
2928
|
*/
|
|
2824
2929
|
declare function importShard(db: DatabaseClient, data: Uint8Array | ArrayBuffer, options?: ImportOptions): Promise<ImportResult>;
|
|
2825
2930
|
|
|
2826
|
-
|
|
2827
|
-
type AiwgPrivacyClassification = 'private' | 'sanitized' | 'public';
|
|
2828
|
-
type AiwgProvenanceConfidence = 'source' | 'candidate' | 'reviewed' | 'rejected';
|
|
2829
|
-
type AiwgReviewAction = 'accept' | 'reject' | 'defer';
|
|
2830
|
-
interface AiwgFortemiRecordSource {
|
|
2831
|
-
path: string;
|
|
2832
|
-
repo_relative_path: string;
|
|
2833
|
-
locator: string;
|
|
2834
|
-
}
|
|
2835
|
-
interface AiwgFortemiRelationship {
|
|
2836
|
-
type: string;
|
|
2837
|
-
target_id: string;
|
|
2838
|
-
source_path?: string;
|
|
2839
|
-
}
|
|
2840
|
-
interface AiwgFortemiProvenance {
|
|
2841
|
-
field: string;
|
|
2842
|
-
source: string;
|
|
2843
|
-
path: string;
|
|
2844
|
-
confidence: AiwgProvenanceConfidence;
|
|
2845
|
-
privacy: AiwgPrivacyClassification;
|
|
2846
|
-
}
|
|
2847
|
-
interface AiwgFortemiRecord {
|
|
2848
|
-
schema_version: 'aiwg.fortemi.index.record.v1';
|
|
2849
|
-
id: string;
|
|
2850
|
-
type: AiwgFortemiRecordType;
|
|
2851
|
-
source: AiwgFortemiRecordSource;
|
|
2852
|
-
title: string;
|
|
2853
|
-
text: string;
|
|
2854
|
-
facets: Record<string, string[]>;
|
|
2855
|
-
tags: string[];
|
|
2856
|
-
concepts: string[];
|
|
2857
|
-
relationships: AiwgFortemiRelationship[];
|
|
2858
|
-
provenance: AiwgFortemiProvenance[];
|
|
2859
|
-
privacy: {
|
|
2860
|
-
classification: AiwgPrivacyClassification;
|
|
2861
|
-
pii: boolean;
|
|
2862
|
-
};
|
|
2863
|
-
updated_at: string;
|
|
2864
|
-
}
|
|
2865
|
-
interface AiwgFortemiIndexExport {
|
|
2866
|
-
schema_version: 'aiwg.fortemi.index.export.v1';
|
|
2867
|
-
generated_at: string;
|
|
2868
|
-
source: {
|
|
2869
|
-
repo: string;
|
|
2870
|
-
privacy: AiwgPrivacyClassification;
|
|
2871
|
-
};
|
|
2872
|
-
items: AiwgFortemiRecord[];
|
|
2873
|
-
}
|
|
2874
|
-
interface AiwgIndexValidationResult {
|
|
2875
|
-
valid: boolean;
|
|
2876
|
-
errors: string[];
|
|
2877
|
-
counts: Partial<Record<AiwgFortemiRecordType, number>>;
|
|
2878
|
-
}
|
|
2879
|
-
interface AiwgIndexQueryOptions {
|
|
2880
|
-
types?: AiwgFortemiRecordType[];
|
|
2881
|
-
facets?: Record<string, string[]>;
|
|
2882
|
-
tags?: string[];
|
|
2883
|
-
concepts?: string[];
|
|
2884
|
-
privacy?: AiwgPrivacyClassification[];
|
|
2885
|
-
relationshipTargetId?: string;
|
|
2886
|
-
limit?: number;
|
|
2887
|
-
offset?: number;
|
|
2888
|
-
}
|
|
2889
|
-
interface AiwgIndexQueryResult {
|
|
2890
|
-
items: AiwgFortemiRecord[];
|
|
2891
|
-
total: number;
|
|
2892
|
-
facets: Record<string, Record<string, number>>;
|
|
2893
|
-
}
|
|
2894
|
-
interface AiwgReviewDecision {
|
|
2895
|
-
item_id: string;
|
|
2896
|
-
action: AiwgReviewAction;
|
|
2897
|
-
reason?: string;
|
|
2898
|
-
updated_at: string;
|
|
2899
|
-
}
|
|
2900
|
-
interface AiwgReviewDecisionExport {
|
|
2901
|
-
schema_version: 'aiwg.fortemi.review-decisions.v1';
|
|
2902
|
-
generated_at: string;
|
|
2903
|
-
source_export_schema_version: string;
|
|
2904
|
-
decisions: AiwgReviewDecision[];
|
|
2905
|
-
}
|
|
2906
|
-
declare function validateAiwgFortemiIndexExport(value: unknown): AiwgIndexValidationResult;
|
|
2907
|
-
declare function assertAiwgFortemiIndexExport(value: unknown): AiwgFortemiIndexExport;
|
|
2908
|
-
declare function getAiwgFortemiFacets(items: AiwgFortemiRecord[]): Record<string, Record<string, number>>;
|
|
2909
|
-
declare function queryAiwgFortemiIndex(index: AiwgFortemiIndexExport, query?: string, options?: AiwgIndexQueryOptions): AiwgIndexQueryResult;
|
|
2910
|
-
declare function createAiwgReviewDecisionExport(source: AiwgFortemiIndexExport, decisions: AiwgReviewDecision[], generatedAt?: string): AiwgReviewDecisionExport;
|
|
2911
|
-
|
|
2912
|
-
declare const VERSION = "2026.6.0";
|
|
2931
|
+
declare const VERSION = "2026.6.2";
|
|
2913
2932
|
|
|
2914
|
-
export { type
|
|
2933
|
+
export { type ArchiveInfo, ArchiveManager, type AttachInput, type AttachmentBlobRow, type AttachmentRow, AttachmentsRepository, type BlobStore, type BridgeCapability, type BridgeProviderInfo, type BrowserNoteExport, CURRENT_SHARD_VERSION, type CapabilityInfo, CapabilityManager, type CapabilityName, type CapabilityState, type CaptureKnowledgeInput, CaptureKnowledgeInputSchema, type CaptureKnowledgeResult, type CollectionCreateInput, type CollectionRow, CollectionsRepository, CommunitiesRepository, type CommunityAssignmentView, type CommunityCreateInput, type CommunityFilterDefinition, type CommunityGraph, type CommunityOptions, type CommunitySourceDescriptor, type CommunitySourceType, type CommunitySummary, type CompletionRequest, type CompletionResponse, type ConditionResult, type ConflictStrategy, type CooldownConfig, type CooldownEvent, type CspDirectiveName, type CspDirectives, type CspViolationReport, type DatabaseClient, type DiscoveredProvider, type DiscoveryOptions, type EmbedFunction, type EmbedRequest, type EmbedResponse, type EmbeddingCompatibilityPolicy, type EmbeddingSetCreateInput, type EmbeddingSetCriteria, type EmbeddingSetDescriptor, type EmbeddingSetEmbeddingInput, type EmbeddingSetFreshness, type EmbeddingSetKind, type EmbeddingSetMode, type EmbeddingSetRow, type EmbeddingSetSelector, EmbeddingSetsRepository, type EnqueueJobInput, type ErrorCategory, type EventMap, type ExportOptions, type FallbackEvent, FallbackRouter, type FallbackRouterConfig, type FortemiBridge, type FortemiBridgeCapabilities, type FortemiBridgeHost, type FortemiConfig, type FortemiCore, type FortemiInferenceRouter, type FortemiSecretStore, type FortemiToolDefinition, FortemiToolManifest, type GetNoteInput, GetNoteInputSchema, type GpuCapabilities, type GraphCommunity, type GraphEdge, type GraphNode, GraphRepository, type IDisposable, type ImportCounts, type ImportOptions, type ImportProgress, type ImportProgressPhase, type ImportResult, type InferenceCapabilities, type InferenceProvider, JOB_CAPABILITIES, JOB_PRIORITIES, type JobQueueOptions, JobQueueWorker, type JobStatus, type JobType, LOCAL_ENDPOINTS, type LinkRow, LinksRepository, type ListNotesInput, ListNotesInputSchema, type LlmCapabilityOptions, type LlmCompleteFn, type LoadedPluginScript, type LocalEndpoint, type ManageArchiveInput, ManageArchiveInputSchema, type ManageArchiveResult, type ManageAttachmentsInput, ManageAttachmentsInputSchema, type ManageAttachmentsResult, type ManageCapabilitiesInput, ManageCapabilitiesInputSchema, type ManageCapabilitiesResult, type ManageCollectionsInput, ManageCollectionsInputSchema, type ManageCollectionsResult, type ManageLinksInput, ManageLinksInputSchema, type ManageLinksResult, type ManageNoteInput, ManageNoteInputSchema, type ManageNoteResult, type ManageTagsInput, ManageTagsInputSchema, type ManageTagsResult, MemoryBlobStore, type Migration, MigrationRunner, type ModelCategory, type ModelFitResult, type ModelInfo, type NoteCreateInput, type NoteFull, type NoteListOptions, type NoteRevision, type NoteSummary, type NoteUpdateInput, NotesRepository, OpenAICompatibleProvider, type OpenAIProviderConfig, PGliteStorageBackend, PGliteStorageBackendFactory, PGliteWorkerClient, PGliteWorkerStorageBackend, PGliteWorkerStorageBackendFactory, type PGliteWorkerStorageBackendFactoryOptions, type PaginatedResult, type PersistenceMode, type PluginCspOptions, type PluginScriptDescriptor, type PluginScriptPolicy, type ProbeResult, type ProbeStatus, type ProviderCapabilities, ProviderRegistry, type ProviderTier, type QueryExecutor, type QueryResult, type RecommendedTier, type ResolvedEmbeddingRow, type ResolvedEmbeddingSet, type RouteHandler, SHARD_FORMAT, type SWRegistrationResult, type SearchFacets, type SearchInput, SearchInputSchema, type SearchOptions, SearchRepository, type SearchResponse, type SearchResult, type ShardCollection, type ShardComponent, type ShardEmbedding, type ShardEmbeddingSet, type ShardEmbeddingSetMember, type ShardLink, type ShardManifest, type ShardNote, type ShardNoteSkosTag, type ShardProvenanceEdge, type ShardSkosConcept, type ShardSkosRelation, type ShardSkosScheme, type ShardTag, type SimilarityGraphCacheKey, type SimilarityGraphOptions, type SimilarityGraphRequest, type SimilarityGraphResult, type SkosConcept, type SkosRelation, SkosRepository, type SkosScheme, type StorageBackend, type StorageBackendFactory, type StorageOpenRequest, type StorageTopology, type StreamChunk, TagsRepository, TransactionProxy, TypedEventBus, VERSION, type VirtualEmbeddingSetDefinition, type VirtualEmbeddingSetSource, type VirtualEmbeddingSetValidationError, type VirtualMaterializationPolicy, type VramTier, type WorkerRequest, type WorkerResponse, aiRevisionHandler, allMigrations, appendPluginScript, buildNoteConditions, buildPluginCsp, captureKnowledge, chunkText, classifyError, classifyModel, collectionFromShard, collectionToShard, computeHash, computeSri, conceptTaggingHandler, cosineSimilarity, createBlobStore, createCspReportHandler, createFortemi, createLegacyProvider, createPGliteInstance, createRoutes, defaultStorageBackendFactory, detectCommunities, detectGpuCapabilities, detectInferenceCapabilities, discoverLocalProviders, embeddingFromShard, embeddingGenerationHandler, embeddingSetFromShard, embeddingSetMemberToShard, embeddingSetToShard, embeddingToShard, enqueueFullWorkflow, enqueueJob, enqueueNoteCreationJobs, estimateModelFit, estimateVramMB, estimateVramTier, exportShard, fetchPluginScript, fortemiManifest, generateId, getEmbedFunction, getFortemiBridge, getFortemiSecretStore, getJobQueueStatus, getLlmFunction, getNote, hasFortemiSecureSecrets, importShard, isPluginScriptAllowed, linkFromShard, linkToShard, linkingHandler, listNotes, manageArchive, manageAttachments, manageCapabilities, manageCollections, manageLinks, manageNote, manageTags, matchRoute, noteFromShard, noteSkosTagToShard, noteToShard, packTarGz, parseCspReport, provenanceEdgeToShard, registerLlmCapability, registerSemanticCapability, registerServiceWorker, searchTool, selectLlmModel, setEmbedFunction, setLlmFunction, sha256Hex, skosConceptToShard, skosRelationToShard, skosSchemeToShard, suggestTags, tagsFromShard, tagsToShard, titleGenerationHandler, unpackTarGz, unregisterLlmCapability, unregisterSemanticCapability, validateChecksums, verifySri };
|