@fortemi/core 2026.7.4 → 2026.7.7
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/aiwg-index-schema.d.ts +9 -0
- package/dist/aiwg-index-schema.js +724 -0
- package/dist/aiwg-index-schema.js.map +1 -0
- package/dist/aiwg-index.d.ts +514 -1
- package/dist/aiwg-index.js +22 -2374
- package/dist/aiwg-index.js.map +1 -1
- package/dist/index.d.ts +1516 -18
- package/dist/index.js +2939 -1430
- package/dist/index.js.map +1 -1
- package/package.json +8 -2
- package/dist/aiwg-index-C2G7iy-b.d.ts +0 -826
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PGlite } from '@electric-sql/pglite';
|
|
2
|
-
import {
|
|
3
|
-
export { A as AIWG_SCAN_REQUIRED_FIELDS, r as AiwgChunkedIndexBuildOptions, s as AiwgChunkedIndexBuildResult, t as AiwgChunkedIndexDetailLoader, u as AiwgChunkedIndexLoadOptions, v as AiwgChunkedIndexLoader, w as AiwgChunkedIndexProgress, x as AiwgChunkedIndexProgressPhase, y as AiwgChunkedIndexQueryOptions, z as AiwgChunkedIndexQueryResult, C as AiwgChunkedIndexValidationResult, D as AiwgFortemiAttachmentReference, F as AiwgFortemiBinarySource, G as AiwgFortemiChunk, H as AiwgFortemiChunkDetailRef, J as AiwgFortemiChunkManifest, K as AiwgFortemiChunkPart, L as AiwgFortemiChunkPartRef, M as AiwgFortemiIndexExport, N as AiwgFortemiIndexExportSchemaVersion, O as AiwgFortemiProjectedRecord, P as AiwgFortemiProvenance, Q as AiwgFortemiProvenanceEvent, R as AiwgFortemiRecord, T as AiwgFortemiRecordEmbedding, U as AiwgFortemiRecordSchemaVersion, V as AiwgFortemiRecordSource, W as AiwgFortemiRecordType, X as AiwgFortemiRelationship, Y as AiwgFortemiRelationshipDirection, Z as AiwgFortemiSearchProjection, _ as AiwgFortemiSkosConcept, $ as AiwgFortemiSkosRelation, a0 as AiwgFortemiSkosRelationType, a1 as AiwgHeadlessEmbeddingBackend, a2 as AiwgIndexController, a3 as AiwgIndexControllerListener, a4 as AiwgIndexControllerSnapshot, a5 as AiwgIndexGraphOptions, a6 as AiwgIndexQueryMatch, a7 as AiwgIndexQueryOptions, a8 as AiwgIndexQueryRankedItem, a9 as AiwgIndexQueryResult, aa as AiwgIndexQueryWeights, ab as AiwgIndexValidationResult, ac as AiwgPrivacyClassification, ad as AiwgPrivacyFilterOptions, ae as AiwgProvenanceConfidence, af as AiwgRelationshipDirection, ag as AiwgRelationshipEdgeSummary, ah as AiwgRelationshipNodeSummary, ai as AiwgRelationshipQueryOptions, aj as AiwgRelationshipSetOperation, ak as AiwgRelationshipSetOptions, al as AiwgRelationshipSetResult, am as AiwgRelationshipTraversalOptions, an as AiwgRelationshipTraversalResult, ao as AiwgReviewAction, ap as AiwgReviewDecision, aq as AiwgReviewDecisionExport, ar as AiwgReviewInput, as as AiwgStaticDuplicatePair, at as AiwgStaticEmbeddingRecord, au as AiwgStaticEmbeddingSet, av as AiwgStaticHybridQueryOptions, aw as AiwgStaticSemanticQueryOptions, ax as AiwgStaticSemanticResult, ay as BuildAiwgStaticEmbeddingSetOptions, az as CURRENT_SHARD_VERSION, aA as ConflictStrategy, aB as ImportCounts, aC as ImportProgress, aD as ImportProgressPhase, aE as MemoryBlobStore, aF as SHARD_FORMAT, aG as ShardClusterRef, aH as ShardLayout, aI as aiwgFortemiIndexToCommunityGraph, aJ as assertAiwgFortemiChunkManifest, aK as assertAiwgFortemiChunkPart, aL as assertAiwgFortemiIndexExport, aM as assertAiwgStaticEmbeddingSet, aN as buildAiwgChunkedIndex, aO as buildAiwgStaticEmbeddingSet, aP as createAiwgFetchChunkLoader, aQ as createAiwgFetchDetailLoader, aR as createAiwgIndexController, aS as createAiwgReviewDecisionExport, aT as createBlobStore, aU as filterAiwgRecordsByPrivacy, aV as findAiwgStaticDuplicatePairs, aW as getAiwgFortemiFacets, aX as queryAiwgFortemiIndex, aY as queryAiwgHybridIndex, aZ as queryAiwgSemanticIndex, a_ as validateAiwgFortemiChunkManifest, a$ as validateAiwgFortemiChunkPart, b0 as validateAiwgFortemiIndexExport, b1 as validateAiwgStaticEmbeddingSet } from './aiwg-index-C2G7iy-b.js';
|
|
2
|
+
import { ProbeReport } from '@bytecask/core';
|
|
4
3
|
import { z, ZodType } from 'zod';
|
|
4
|
+
export { AiwgIndexSchemaValidationResult, getAiwgFortemiIndexExportSchema, validateAiwgFortemiIndexExportSchema, validateAiwgFortemiProjectedRecordSchema } from './aiwg-index-schema.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Generate a RFC 9562 UUIDv7 identifier.
|
|
@@ -390,6 +390,591 @@ declare class PGliteWorkerStorageBackendFactory implements StorageBackendFactory
|
|
|
390
390
|
open(input: StorageOpenRequest): Promise<StorageBackend>;
|
|
391
391
|
}
|
|
392
392
|
|
|
393
|
+
/**
|
|
394
|
+
* Content-addressed attachment-byte storage — the Fortemi `BlobStore` seam.
|
|
395
|
+
*
|
|
396
|
+
* The store computes the key: `put(bytes)` BLAKE3-hashes the payload and
|
|
397
|
+
* returns the canonical checksum encoding `blake3:<64-char lowercase hex>`
|
|
398
|
+
* (server convention; ADR-012 D1/D3). Every method at this seam speaks that
|
|
399
|
+
* canonical encoding — the bare-hex ⇄ prefixed conversions live in
|
|
400
|
+
* `shard/blob-sidecar.ts` helpers and inside the bytecask adapter here, and
|
|
401
|
+
* nowhere else.
|
|
402
|
+
*
|
|
403
|
+
* Lifecycle authority (ADR-013 D2): canonical attachment manifests decide
|
|
404
|
+
* which bytes are live. `reconcile(liveChecksums)` hands that authoritative
|
|
405
|
+
* set to the store; `gc()` physically removes only unreferenced,
|
|
406
|
+
* age-thresholded objects. Internal refcounts are an implementation detail,
|
|
407
|
+
* never a source of truth.
|
|
408
|
+
*
|
|
409
|
+
* Implementations:
|
|
410
|
+
* - `createBlobStore()` — `@bytecask/core` behind a dynamic import
|
|
411
|
+
* (IndexedDB tier by default, OPFS opt-in, memory fallback). Zero bundle
|
|
412
|
+
* cost until the first byte operation (ADR-012 D6).
|
|
413
|
+
* - `createLazyBlobStore()` — synchronous facade that defers the dynamic
|
|
414
|
+
* import until the first method call (what `FortemiProvider` wires).
|
|
415
|
+
* - `MemoryBlobStore` — dependency-free in-process implementation for
|
|
416
|
+
* tests and the no-persistence tier.
|
|
417
|
+
*/
|
|
418
|
+
|
|
419
|
+
type BlobBackendKind = 'idb' | 'opfs' | 'memory';
|
|
420
|
+
interface BlobStoreDiagnostics {
|
|
421
|
+
/** The storage tier actually serving bytes. */
|
|
422
|
+
backend: BlobBackendKind;
|
|
423
|
+
/** Tier-probe outcome from `@bytecask/core` (null for memory/test stores). */
|
|
424
|
+
probe: ProbeReport | null;
|
|
425
|
+
}
|
|
426
|
+
interface BlobReconcileOptions {
|
|
427
|
+
/** Physically remove unreferenced objects now instead of leaving them for gc(). */
|
|
428
|
+
removeUnreferenced?: boolean;
|
|
429
|
+
}
|
|
430
|
+
interface BlobReconcileResult {
|
|
431
|
+
/** Live checksums whose bytes are present. */
|
|
432
|
+
referenced: number;
|
|
433
|
+
/** Live checksums whose bytes are absent — the reference-only set. */
|
|
434
|
+
missing: string[];
|
|
435
|
+
/** Stored checksums not in the live set — GC candidates. */
|
|
436
|
+
unreferenced: string[];
|
|
437
|
+
/** Objects physically removed (only when `removeUnreferenced`). */
|
|
438
|
+
removed: number;
|
|
439
|
+
bytesFreed: number;
|
|
440
|
+
}
|
|
441
|
+
interface BlobGcOptions {
|
|
442
|
+
/** Collect only unreferenced objects at least this old (ms). Default 0. */
|
|
443
|
+
minAgeMs?: number;
|
|
444
|
+
}
|
|
445
|
+
interface BlobGcResult {
|
|
446
|
+
collected: number;
|
|
447
|
+
bytesFreed: number;
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* The Fortemi attachment-byte seam. All checksums are the canonical
|
|
451
|
+
* `blake3:<hex>` encoding stored in `attachment_blob.content_hash` and shard
|
|
452
|
+
* projection records.
|
|
453
|
+
*/
|
|
454
|
+
interface BlobStore {
|
|
455
|
+
/** Store bytes, return their canonical checksum. Idempotent (content-addressed). */
|
|
456
|
+
put(bytes: Uint8Array): Promise<string>;
|
|
457
|
+
/** Fetch bytes by canonical checksum; null when absent (reference-only). */
|
|
458
|
+
read(checksum: string): Promise<Uint8Array | null>;
|
|
459
|
+
/** True when the bytes for this checksum are physically present. */
|
|
460
|
+
has(checksum: string): Promise<boolean>;
|
|
461
|
+
/**
|
|
462
|
+
* Reconcile stored bytes against the authoritative live-checksum set
|
|
463
|
+
* derived from canonical attachment manifests (ADR-013 D4).
|
|
464
|
+
*/
|
|
465
|
+
reconcile(liveChecksums: Iterable<string>, opts?: BlobReconcileOptions): Promise<BlobReconcileResult>;
|
|
466
|
+
/** Physically remove unreferenced, age-thresholded objects. */
|
|
467
|
+
gc(opts?: BlobGcOptions): Promise<BlobGcResult>;
|
|
468
|
+
/** Selected backend + probe report, for capability/diagnostic surfaces. */
|
|
469
|
+
diagnostics(): Promise<BlobStoreDiagnostics>;
|
|
470
|
+
close(): Promise<void>;
|
|
471
|
+
}
|
|
472
|
+
declare class MemoryBlobStore implements BlobStore {
|
|
473
|
+
private now;
|
|
474
|
+
private entries;
|
|
475
|
+
constructor(now?: () => number);
|
|
476
|
+
put(bytes: Uint8Array): Promise<string>;
|
|
477
|
+
read(checksum: string): Promise<Uint8Array | null>;
|
|
478
|
+
has(checksum: string): Promise<boolean>;
|
|
479
|
+
reconcile(liveChecksums: Iterable<string>, opts?: BlobReconcileOptions): Promise<BlobReconcileResult>;
|
|
480
|
+
gc(opts?: BlobGcOptions): Promise<BlobGcResult>;
|
|
481
|
+
diagnostics(): Promise<BlobStoreDiagnostics>;
|
|
482
|
+
close(): Promise<void>;
|
|
483
|
+
}
|
|
484
|
+
interface CreateBlobStoreOptions {
|
|
485
|
+
/** Force a tier; omit to probe IndexedDB → OPFS → memory (measured default). */
|
|
486
|
+
backend?: BlobBackendKind;
|
|
487
|
+
/** Injectable IDBFactory for tests (fake-indexeddb). Defaults to the global. */
|
|
488
|
+
indexedDB?: IDBFactory;
|
|
489
|
+
/** Skip the one-shot migration of the pre-bytecask blob layout. */
|
|
490
|
+
migrateLegacy?: boolean;
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* Construct the bytecask-backed BlobStore for one archive namespace.
|
|
494
|
+
*
|
|
495
|
+
* `@bytecask/core` is reached only through a dynamic `import()` here, so
|
|
496
|
+
* hosts that never touch attachment bytes never load it. The namespace is a
|
|
497
|
+
* function of `archiveName` alone — identical in DB-free and PGlite modes.
|
|
498
|
+
*
|
|
499
|
+
* Tiering: IndexedDB by default (measured default per bytecask's C3
|
|
500
|
+
* benchmark), memory fallback when IndexedDB is unavailable. The OPFS opt-in
|
|
501
|
+
* tier arrives with the upstream `createBlobStore()` factory switch
|
|
502
|
+
* (`@bytecask/core` 2026.7.2); requesting it now fails loudly rather than
|
|
503
|
+
* silently falling back.
|
|
504
|
+
*/
|
|
505
|
+
declare function createBlobStore(archiveName: string, options?: CreateBlobStoreOptions): Promise<BlobStore>;
|
|
506
|
+
/**
|
|
507
|
+
* Synchronous facade over {@link createBlobStore}: construction is free, the
|
|
508
|
+
* dynamic import happens on the first byte operation. This is what
|
|
509
|
+
* `FortemiProvider` wires so hosts that never touch attachment bytes never
|
|
510
|
+
* pay for the substrate (ADR-012 D6).
|
|
511
|
+
*/
|
|
512
|
+
declare function createLazyBlobStore(archiveName: string, options?: CreateBlobStoreOptions): BlobStore;
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* Signed Knowledge-Shard verification (#324, ADR-014).
|
|
516
|
+
*
|
|
517
|
+
* Authenticity — as distinct from the consistency the in-archive checksums
|
|
518
|
+
* provide (SEC7) — comes from an Ed25519 signature over a canonical payload
|
|
519
|
+
* that commits to the manifest digest and the referenced blob-byte digests.
|
|
520
|
+
* Verification is pure and side-effect-free; it runs BEFORE any record or
|
|
521
|
+
* blob mutation (ADR-013 D6 / ADR-014 D3). Bytecask never sees keys.
|
|
522
|
+
*/
|
|
523
|
+
|
|
524
|
+
declare const SIGNATURE_ENTRY = "signature.json";
|
|
525
|
+
declare const SIGNING_ENVELOPE_VERSION = "1";
|
|
526
|
+
declare const SIGNING_ALGORITHM = "ed25519";
|
|
527
|
+
interface ShardSigner {
|
|
528
|
+
key_id: string;
|
|
529
|
+
algorithm: typeof SIGNING_ALGORITHM;
|
|
530
|
+
/** Raw 32-byte Ed25519 public key, base64url. */
|
|
531
|
+
public_key: string;
|
|
532
|
+
}
|
|
533
|
+
/** The signed payload (never contains its own signature — ADR-014 D2). */
|
|
534
|
+
interface ShardSigningPayload {
|
|
535
|
+
format_version: typeof SIGNING_ENVELOPE_VERSION;
|
|
536
|
+
signer: ShardSigner;
|
|
537
|
+
/** SHA-256 hex of the canonical manifest.json bytes. */
|
|
538
|
+
manifest_digest: string;
|
|
539
|
+
/** Sorted bare-hex BLAKE3 digests of referenced sidecar blobs. */
|
|
540
|
+
blob_digests: string[];
|
|
541
|
+
}
|
|
542
|
+
/** `signature.json` archive entry: the payload plus its base64url signature. */
|
|
543
|
+
interface ShardSignatureEnvelope extends ShardSigningPayload {
|
|
544
|
+
signature: string;
|
|
545
|
+
}
|
|
546
|
+
interface TrustedKey {
|
|
547
|
+
key_id: string;
|
|
548
|
+
/** Raw 32-byte Ed25519 public key, base64url. */
|
|
549
|
+
public_key: string;
|
|
550
|
+
revoked?: boolean;
|
|
551
|
+
}
|
|
552
|
+
interface ShardTrustStore {
|
|
553
|
+
resolve(keyId: string): TrustedKey | null | Promise<TrustedKey | null>;
|
|
554
|
+
}
|
|
555
|
+
/** In-memory allowlist trust store seeded from `{ key_id, public_key }` entries. */
|
|
556
|
+
declare class AllowlistTrustStore implements ShardTrustStore {
|
|
557
|
+
private keys;
|
|
558
|
+
constructor(keys: TrustedKey[]);
|
|
559
|
+
resolve(keyId: string): TrustedKey | null;
|
|
560
|
+
/** Mark a key revoked without removing it (still resolvable, verdict `revoked`). */
|
|
561
|
+
revoke(keyId: string): void;
|
|
562
|
+
}
|
|
563
|
+
type ShardSignatureVerdict = {
|
|
564
|
+
ok: true;
|
|
565
|
+
keyId: string;
|
|
566
|
+
} | {
|
|
567
|
+
ok: false;
|
|
568
|
+
reason: 'unsigned';
|
|
569
|
+
} | {
|
|
570
|
+
ok: false;
|
|
571
|
+
reason: 'malformed';
|
|
572
|
+
detail: string;
|
|
573
|
+
} | {
|
|
574
|
+
ok: false;
|
|
575
|
+
reason: 'unknown-signer';
|
|
576
|
+
keyId: string;
|
|
577
|
+
} | {
|
|
578
|
+
ok: false;
|
|
579
|
+
reason: 'revoked';
|
|
580
|
+
keyId: string;
|
|
581
|
+
} | {
|
|
582
|
+
ok: false;
|
|
583
|
+
reason: 'bad-signature';
|
|
584
|
+
keyId: string;
|
|
585
|
+
} | {
|
|
586
|
+
ok: false;
|
|
587
|
+
reason: 'content-mismatch';
|
|
588
|
+
detail: string;
|
|
589
|
+
} | {
|
|
590
|
+
ok: false;
|
|
591
|
+
reason: 'unsupported';
|
|
592
|
+
};
|
|
593
|
+
/** True when this runtime's WebCrypto verifies Ed25519 (ADR-014 D1). */
|
|
594
|
+
declare function isShardSigningSupported(): Promise<boolean>;
|
|
595
|
+
/** Sorted bare-hex BLAKE3 digests of the sidecar blobs present in the archive. */
|
|
596
|
+
declare function sidecarBlobDigests(files: Map<string, Uint8Array>): string[];
|
|
597
|
+
interface VerifyShardSignatureInput {
|
|
598
|
+
files: Map<string, Uint8Array>;
|
|
599
|
+
trustStore: ShardTrustStore;
|
|
600
|
+
}
|
|
601
|
+
/**
|
|
602
|
+
* Verify a shard's Ed25519 signature over its canonical payload. Pure: reads
|
|
603
|
+
* archive bytes, resolves the key, checks the signature and the
|
|
604
|
+
* manifest/blob-digest commitments. No persistence, no mutation.
|
|
605
|
+
*/
|
|
606
|
+
declare function verifyShardSignature(input: VerifyShardSignatureInput): Promise<ShardSignatureVerdict>;
|
|
607
|
+
interface SignShardInput {
|
|
608
|
+
files: Map<string, Uint8Array>;
|
|
609
|
+
keyId: string;
|
|
610
|
+
/** Ed25519 private key (raw 32-byte seed or PKCS8), imported by the caller. */
|
|
611
|
+
privateKey: CryptoKey;
|
|
612
|
+
/** Raw 32-byte public key, base64url — embedded in the envelope + trust store. */
|
|
613
|
+
publicKey: string;
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
* Produce the `signature.json` envelope for an assembled archive `files` map.
|
|
617
|
+
* The caller adds the returned bytes to the archive under {@link SIGNATURE_ENTRY}
|
|
618
|
+
* (excluded from manifest.checksums — it post-dates the manifest).
|
|
619
|
+
*/
|
|
620
|
+
declare function signShard(input: SignShardInput): Promise<Uint8Array>;
|
|
621
|
+
|
|
622
|
+
/**
|
|
623
|
+
* Shard format types — matches the fortemi server matric-shard specification.
|
|
624
|
+
*
|
|
625
|
+
* A shard is a gzip-compressed tar archive (.shard) containing serialized
|
|
626
|
+
* knowledge data with a manifest for integrity verification.
|
|
627
|
+
*/
|
|
628
|
+
|
|
629
|
+
declare const CURRENT_SHARD_VERSION = "1.0.0";
|
|
630
|
+
declare const SHARD_FORMAT = "matric-shard";
|
|
631
|
+
/** Components that can appear in a shard archive. */
|
|
632
|
+
type ShardComponent = 'notes' | 'collections' | 'tags' | 'templates' | 'links' | 'embedding_sets' | 'embedding_configs' | 'embedding_set_members' | 'embeddings' | 'skos_schemes' | 'skos_concepts' | 'skos_relations' | 'note_skos_tags' | 'provenance_edges' | 'community_assignments' | 'communities' | 'graph_edges' | 'graph_sources';
|
|
633
|
+
interface ShardAttachmentReference {
|
|
634
|
+
id: string;
|
|
635
|
+
path: string;
|
|
636
|
+
mime: string | null;
|
|
637
|
+
checksum: string;
|
|
638
|
+
bytes: number;
|
|
639
|
+
}
|
|
640
|
+
interface ShardAttachmentProjection {
|
|
641
|
+
extracted_text: string | null;
|
|
642
|
+
attachment: ShardAttachmentReference;
|
|
643
|
+
}
|
|
644
|
+
/** @deprecated Legacy React shard field name. Server shards use `attachments`. */
|
|
645
|
+
type ShardBinarySource = ShardAttachmentProjection;
|
|
646
|
+
/**
|
|
647
|
+
* Reference to one cluster file of a component split across addressable files
|
|
648
|
+
* (`notes/000.jsonl`, `notes/001.jsonl`, …). `offset` preserves deterministic
|
|
649
|
+
* component order; readers discover each cluster's size from its contents.
|
|
650
|
+
*/
|
|
651
|
+
interface ShardClusterRef {
|
|
652
|
+
href: string;
|
|
653
|
+
offset: number;
|
|
654
|
+
}
|
|
655
|
+
/**
|
|
656
|
+
* Optional clustered layout (additive — absent on monolithic shards). When a
|
|
657
|
+
* component is present here, its records live in the listed cluster files instead
|
|
658
|
+
* of (or in addition to) the single `<component>.jsonl`. Both `importShard` and
|
|
659
|
+
* the in-place reader consume it; a monolithic shard omits `layout` entirely.
|
|
660
|
+
*/
|
|
661
|
+
interface ShardLayout {
|
|
662
|
+
clusters?: Partial<Record<ShardComponent, ShardClusterRef[]>>;
|
|
663
|
+
}
|
|
664
|
+
interface ShardMigrationHistoryEntry {
|
|
665
|
+
from_version: string;
|
|
666
|
+
to_version: string;
|
|
667
|
+
migrated_at: string;
|
|
668
|
+
migrated_by: string;
|
|
669
|
+
changes: string[];
|
|
670
|
+
}
|
|
671
|
+
/** Manifest included in every shard as manifest.json. */
|
|
672
|
+
interface ShardManifest {
|
|
673
|
+
version: string;
|
|
674
|
+
matric_version: string;
|
|
675
|
+
format: typeof SHARD_FORMAT;
|
|
676
|
+
created_at: string;
|
|
677
|
+
components: ShardComponent[];
|
|
678
|
+
counts: Partial<Record<ShardComponent | 'community_sets', number>>;
|
|
679
|
+
checksums: Record<string, string>;
|
|
680
|
+
min_reader_version: string;
|
|
681
|
+
migrated_from?: string | null;
|
|
682
|
+
migration_history?: ShardMigrationHistoryEntry[];
|
|
683
|
+
/** Clustered component layout for partial fetch (issue #189). Absent → monolithic. */
|
|
684
|
+
layout?: ShardLayout;
|
|
685
|
+
}
|
|
686
|
+
/** Options for shard export. */
|
|
687
|
+
interface ExportOptions {
|
|
688
|
+
includeEmbeddings?: boolean;
|
|
689
|
+
/** Filter to specific collection (export only notes in this collection). */
|
|
690
|
+
collectionId?: string;
|
|
691
|
+
/** Filter to notes with this tag (e.g. 'app:research' for app-scoped export). */
|
|
692
|
+
tag?: string;
|
|
693
|
+
/** Export only these embedding sets and their member/vector rows. */
|
|
694
|
+
embeddingSetIds?: string[];
|
|
695
|
+
/** Preserve virtual selector materialization metadata and virtual member rows. */
|
|
696
|
+
includeMaterializedSelectors?: boolean;
|
|
697
|
+
/**
|
|
698
|
+
* When set to a positive integer, emit notes as clustered files
|
|
699
|
+
* (`notes/000.jsonl`, …) of this many records each, and record the layout in
|
|
700
|
+
* the manifest, so an in-place reader can fetch only the clusters it needs
|
|
701
|
+
* (issue #189). Absent → a single monolithic `notes.jsonl` (unchanged).
|
|
702
|
+
*/
|
|
703
|
+
clusterNotesSize?: number;
|
|
704
|
+
/**
|
|
705
|
+
* Pack attachment bytes into a portable content-addressed `blobs/<hex>`
|
|
706
|
+
* sidecar (Fortemi/fortemi#1046), producing a self-contained shard whose
|
|
707
|
+
* attachments survive a round-trip (`getBlob()` returns real bytes on the
|
|
708
|
+
* importing host). Requires {@link blobStore}. Absent/false → reference-only
|
|
709
|
+
* (server default), which remains a valid shard.
|
|
710
|
+
*/
|
|
711
|
+
includeBlobs?: boolean;
|
|
712
|
+
/**
|
|
713
|
+
* Byte source for the sidecar. Required when `includeBlobs` is set; attachment
|
|
714
|
+
* bytes are read by their `content_hash`. A blob the store cannot return is
|
|
715
|
+
* skipped (its attachment stays reference-only) rather than failing export.
|
|
716
|
+
*/
|
|
717
|
+
blobStore?: BlobStore;
|
|
718
|
+
}
|
|
719
|
+
/** Conflict resolution strategy for shard import. */
|
|
720
|
+
type ConflictStrategy = 'skip' | 'replace' | 'error';
|
|
721
|
+
/** Options for shard import. */
|
|
722
|
+
interface ImportOptions {
|
|
723
|
+
conflictStrategy?: ConflictStrategy;
|
|
724
|
+
/** Rows processed between cooperative yields. Defaults to 250. */
|
|
725
|
+
batchSize?: number;
|
|
726
|
+
/** Progress callback for long-running import phases. */
|
|
727
|
+
onProgress?: (progress: ImportProgress) => void;
|
|
728
|
+
/**
|
|
729
|
+
* Destination for hydrating attachment bytes from a portable `blobs/<hex>`
|
|
730
|
+
* sidecar (Fortemi/fortemi#1046). When provided, sidecar entries whose bare
|
|
731
|
+
* hex matches an imported attachment's `content_hash` are written to this
|
|
732
|
+
* store after the import transaction commits, so `getBlob()` returns real
|
|
733
|
+
* bytes. Absent → attachments import as reference-only metadata (unchanged).
|
|
734
|
+
*/
|
|
735
|
+
blobStore?: BlobStore;
|
|
736
|
+
/**
|
|
737
|
+
* Publisher-provenance policy for signed shards (#324, ADR-014):
|
|
738
|
+
* - `require` — reject unsigned or bad-signature shards (default when a
|
|
739
|
+
* `trustStore` is supplied);
|
|
740
|
+
* - `prefer` — verify signed shards; import unsigned ones with a warning;
|
|
741
|
+
* still reject a present-but-invalid signature;
|
|
742
|
+
* - `trusted-local-only` — ignore signatures (own-export import).
|
|
743
|
+
* When both `trustStore` and this are omitted, verification is skipped
|
|
744
|
+
* entirely (checksum-only, unchanged behavior).
|
|
745
|
+
*/
|
|
746
|
+
verifySignature?: 'require' | 'prefer' | 'trusted-local-only';
|
|
747
|
+
/** Trust store resolving signer key_id → public key (required for `require`/`prefer`). */
|
|
748
|
+
trustStore?: ShardTrustStore;
|
|
749
|
+
}
|
|
750
|
+
type ImportProgressPhase = 'unpack' | 'validate' | 'collections' | 'notes' | 'skos' | 'templates' | 'links' | 'provenance' | 'embedding_sets' | 'embedding_configs' | 'embeddings' | 'embedding_set_members' | 'graph' | 'communities' | 'index';
|
|
751
|
+
interface ImportProgress {
|
|
752
|
+
phase: ImportProgressPhase;
|
|
753
|
+
done: number;
|
|
754
|
+
total: number;
|
|
755
|
+
}
|
|
756
|
+
/** Per-entity import counts. */
|
|
757
|
+
interface ImportCounts {
|
|
758
|
+
notes: number;
|
|
759
|
+
collections: number;
|
|
760
|
+
templates: number;
|
|
761
|
+
tags: number;
|
|
762
|
+
links: number;
|
|
763
|
+
embedding_sets: number;
|
|
764
|
+
embedding_configs: number;
|
|
765
|
+
embedding_set_members: number;
|
|
766
|
+
embeddings: number;
|
|
767
|
+
skos_schemes: number;
|
|
768
|
+
skos_concepts: number;
|
|
769
|
+
skos_relations: number;
|
|
770
|
+
note_skos_tags: number;
|
|
771
|
+
provenance_edges: number;
|
|
772
|
+
graph_sources: number;
|
|
773
|
+
graph_edges: number;
|
|
774
|
+
community_sets: number;
|
|
775
|
+
communities: number;
|
|
776
|
+
community_assignments: number;
|
|
777
|
+
}
|
|
778
|
+
/** Result of a shard import operation. */
|
|
779
|
+
interface ImportResult {
|
|
780
|
+
success: boolean;
|
|
781
|
+
counts: ImportCounts;
|
|
782
|
+
skipped: Partial<ImportCounts>;
|
|
783
|
+
warnings: string[];
|
|
784
|
+
errors: string[];
|
|
785
|
+
duration_ms: number;
|
|
786
|
+
}
|
|
787
|
+
/** Note as serialized in the shard JSONL. */
|
|
788
|
+
interface ShardNote {
|
|
789
|
+
id: string;
|
|
790
|
+
title: string | null;
|
|
791
|
+
original_content: string;
|
|
792
|
+
revised_content: string | null;
|
|
793
|
+
metadata?: Record<string, unknown> | null;
|
|
794
|
+
collection_id?: string | null;
|
|
795
|
+
attachments?: ShardAttachmentProjection[];
|
|
796
|
+
/** @deprecated Legacy React shard field name. Use `attachments`. */
|
|
797
|
+
binary_sources?: ShardBinarySource[];
|
|
798
|
+
format: string;
|
|
799
|
+
source: string;
|
|
800
|
+
starred: boolean;
|
|
801
|
+
archived: boolean;
|
|
802
|
+
tags: string[];
|
|
803
|
+
created_at: string;
|
|
804
|
+
updated_at: string;
|
|
805
|
+
deleted_at: string | null;
|
|
806
|
+
}
|
|
807
|
+
/** Collection as serialized in the shard JSON array. */
|
|
808
|
+
interface ShardCollection {
|
|
809
|
+
id: string;
|
|
810
|
+
name: string;
|
|
811
|
+
description: string | null;
|
|
812
|
+
parent_id: string | null;
|
|
813
|
+
created_at: string;
|
|
814
|
+
note_count?: number;
|
|
815
|
+
}
|
|
816
|
+
/** Tag as serialized in the shard JSON array. */
|
|
817
|
+
interface ShardTag {
|
|
818
|
+
name: string;
|
|
819
|
+
created_at: string;
|
|
820
|
+
}
|
|
821
|
+
/** Template as serialized in the shard JSON array. */
|
|
822
|
+
interface ShardTemplate {
|
|
823
|
+
id: string;
|
|
824
|
+
name: string;
|
|
825
|
+
description: string | null;
|
|
826
|
+
content: string;
|
|
827
|
+
format: string;
|
|
828
|
+
default_tags: string[];
|
|
829
|
+
collection_id: string | null;
|
|
830
|
+
created_at: string;
|
|
831
|
+
updated_at: string;
|
|
832
|
+
}
|
|
833
|
+
/** Link as serialized in the shard JSONL. */
|
|
834
|
+
interface ShardLink {
|
|
835
|
+
id: string;
|
|
836
|
+
from_note_id: string;
|
|
837
|
+
to_note_id: string | null;
|
|
838
|
+
/** Optional for legacy React shards exported before URL links existed. */
|
|
839
|
+
to_url?: string | null;
|
|
840
|
+
kind: string;
|
|
841
|
+
score: number | null;
|
|
842
|
+
created_at: string;
|
|
843
|
+
/** Optional for legacy React shards exported before link metadata existed. */
|
|
844
|
+
metadata?: Record<string, unknown> | null;
|
|
845
|
+
}
|
|
846
|
+
/**
|
|
847
|
+
* Embedding set as serialized in the shard JSON array.
|
|
848
|
+
*
|
|
849
|
+
* Fields beyond id/model/dimension are optional for backward compatibility:
|
|
850
|
+
* legacy React shards omit them and import falls back to the same defaults
|
|
851
|
+
* `embeddingSetFromShard` applies (name → model, is_system → false, …).
|
|
852
|
+
*/
|
|
853
|
+
interface ShardEmbeddingSet {
|
|
854
|
+
id: string;
|
|
855
|
+
name?: string;
|
|
856
|
+
slug?: string | null;
|
|
857
|
+
description?: string | null;
|
|
858
|
+
purpose?: string | null;
|
|
859
|
+
document_count?: number;
|
|
860
|
+
embedding_count?: number;
|
|
861
|
+
is_system?: boolean;
|
|
862
|
+
keywords?: string[];
|
|
863
|
+
model: string;
|
|
864
|
+
dimension: number;
|
|
865
|
+
kind?: 'physical' | 'filter' | 'virtual';
|
|
866
|
+
mode?: 'auto' | 'manual' | 'mixed' | null;
|
|
867
|
+
truncate_dimension?: number | null;
|
|
868
|
+
criteria?: Record<string, unknown> | null;
|
|
869
|
+
source?: Record<string, unknown> | null;
|
|
870
|
+
compatibility?: Record<string, unknown> | null;
|
|
871
|
+
materialization?: Record<string, unknown> | null;
|
|
872
|
+
freshness?: ShardArtifactFreshness | null;
|
|
873
|
+
created_at?: string;
|
|
874
|
+
updated_at?: string;
|
|
875
|
+
}
|
|
876
|
+
/** Embedding set member as serialized in the shard JSONL. */
|
|
877
|
+
interface ShardEmbeddingSetMember {
|
|
878
|
+
embedding_set_id: string;
|
|
879
|
+
note_id: string;
|
|
880
|
+
/** Legacy React shard field; new exports use server membership metadata instead. */
|
|
881
|
+
embedding_id?: string;
|
|
882
|
+
/** Optional for legacy React shards; import defaults to 'materialized'. */
|
|
883
|
+
membership_type?: string;
|
|
884
|
+
/** Optional for legacy React shards; import falls back to the manifest timestamp. */
|
|
885
|
+
added_at?: string;
|
|
886
|
+
/** Optional for legacy React shards; import defaults to NULL. */
|
|
887
|
+
added_by?: string | null;
|
|
888
|
+
}
|
|
889
|
+
/** Embedding config as serialized in the shard JSON array. */
|
|
890
|
+
interface ShardEmbeddingConfig {
|
|
891
|
+
id: string;
|
|
892
|
+
name: string;
|
|
893
|
+
description: string | null;
|
|
894
|
+
model: string;
|
|
895
|
+
dimension: number;
|
|
896
|
+
chunk_size: number;
|
|
897
|
+
chunk_overlap: number;
|
|
898
|
+
is_default: boolean;
|
|
899
|
+
}
|
|
900
|
+
/**
|
|
901
|
+
* Embedding as serialized in the shard JSONL.
|
|
902
|
+
*
|
|
903
|
+
* Server metadata fields (`chunk_index`, `text`, `model`) are optional for
|
|
904
|
+
* backward compatibility: legacy React shards exported before migration 0016
|
|
905
|
+
* carry only `id`, `note_id`, `embedding_set_id`, `vector`, `created_at`.
|
|
906
|
+
* Import normalizes absent metadata to schema defaults (0, '', NULL).
|
|
907
|
+
*/
|
|
908
|
+
interface ShardEmbedding {
|
|
909
|
+
id: string;
|
|
910
|
+
note_id: string;
|
|
911
|
+
chunk_index?: number;
|
|
912
|
+
text?: string;
|
|
913
|
+
vector: number[];
|
|
914
|
+
model?: string;
|
|
915
|
+
/** React shard extension used to preserve local embedding-set scoping. */
|
|
916
|
+
embedding_set_id?: string;
|
|
917
|
+
/** React shard extension used to preserve local creation ordering. */
|
|
918
|
+
created_at?: string;
|
|
919
|
+
}
|
|
920
|
+
/** SKOS scheme as serialized in the shard JSON array. */
|
|
921
|
+
interface ShardSkosScheme {
|
|
922
|
+
id: string;
|
|
923
|
+
title: string;
|
|
924
|
+
description: string | null;
|
|
925
|
+
created_at: string;
|
|
926
|
+
updated_at: string;
|
|
927
|
+
}
|
|
928
|
+
/** SKOS concept as serialized in the shard JSON array. */
|
|
929
|
+
interface ShardSkosConcept {
|
|
930
|
+
id: string;
|
|
931
|
+
scheme_id: string;
|
|
932
|
+
pref_label: string;
|
|
933
|
+
alt_labels: string[];
|
|
934
|
+
definition: string | null;
|
|
935
|
+
created_at: string;
|
|
936
|
+
updated_at: string;
|
|
937
|
+
}
|
|
938
|
+
/** SKOS concept relation as serialized in the shard JSONL. */
|
|
939
|
+
interface ShardSkosRelation {
|
|
940
|
+
id: string;
|
|
941
|
+
source_concept_id: string;
|
|
942
|
+
target_concept_id: string;
|
|
943
|
+
relation_type: 'broader' | 'narrower' | 'related';
|
|
944
|
+
created_at: string;
|
|
945
|
+
}
|
|
946
|
+
/** Note-to-SKOS-concept assignment as serialized in the shard JSONL. */
|
|
947
|
+
interface ShardNoteSkosTag {
|
|
948
|
+
id: string;
|
|
949
|
+
note_id: string;
|
|
950
|
+
concept_id: string;
|
|
951
|
+
created_at: string;
|
|
952
|
+
}
|
|
953
|
+
/** Provenance edge as serialized in the shard JSONL. */
|
|
954
|
+
interface ShardProvenanceEdge {
|
|
955
|
+
id: string;
|
|
956
|
+
entity_type: string;
|
|
957
|
+
entity_id: string;
|
|
958
|
+
activity: string;
|
|
959
|
+
agent: string;
|
|
960
|
+
started_at: string;
|
|
961
|
+
ended_at: string | null;
|
|
962
|
+
attributes: Record<string, unknown> | null;
|
|
963
|
+
}
|
|
964
|
+
interface ShardArtifactFreshness {
|
|
965
|
+
status: 'fresh' | 'stale' | 'unknown';
|
|
966
|
+
checked_at?: string;
|
|
967
|
+
stale_reason?: string;
|
|
968
|
+
source_hashes?: {
|
|
969
|
+
notes?: string;
|
|
970
|
+
links?: string;
|
|
971
|
+
embeddings?: string;
|
|
972
|
+
embedding_set_members?: string;
|
|
973
|
+
virtual_set_definition?: string;
|
|
974
|
+
parameters?: string;
|
|
975
|
+
};
|
|
976
|
+
}
|
|
977
|
+
|
|
393
978
|
/**
|
|
394
979
|
* LinksRepository — bidirectional note link management.
|
|
395
980
|
*
|
|
@@ -483,6 +1068,7 @@ interface BrowserNoteExport {
|
|
|
483
1068
|
deleted_at: Date | string | null;
|
|
484
1069
|
original_content: string;
|
|
485
1070
|
revised_content: string | null;
|
|
1071
|
+
ai_metadata?: Record<string, unknown> | null;
|
|
486
1072
|
collection_id?: string | null;
|
|
487
1073
|
attachments?: ShardAttachmentProjection[];
|
|
488
1074
|
tags: string[];
|
|
@@ -622,7 +1208,7 @@ declare function embeddingFromShard(shard: ShardEmbedding): {
|
|
|
622
1208
|
chunk_index: number;
|
|
623
1209
|
text: string;
|
|
624
1210
|
vector: string;
|
|
625
|
-
model: string;
|
|
1211
|
+
model: string | null;
|
|
626
1212
|
created_at: string | null;
|
|
627
1213
|
};
|
|
628
1214
|
declare function skosSchemeToShard(scheme: {
|
|
@@ -1279,6 +1865,34 @@ declare function createRoutes(): RouteHandler[];
|
|
|
1279
1865
|
*/
|
|
1280
1866
|
declare function matchRoute(routes: RouteHandler[], request: Request, url: URL): RouteHandler | null;
|
|
1281
1867
|
|
|
1868
|
+
/**
|
|
1869
|
+
* One-shot migration of the pre-bytecask blob layout into the new store.
|
|
1870
|
+
*
|
|
1871
|
+
* The legacy layout (shipped through v2026.7.x) was:
|
|
1872
|
+
* - IndexedDB: database `fortemi-<archive>-blobs`, object store `blobs`,
|
|
1873
|
+
* values keyed by the full checksum string (`blake3:<hex>`, historically
|
|
1874
|
+
* also `sha256:<hex>`).
|
|
1875
|
+
* - OPFS: directory `fortemi-<archive>-blobs/<h0h1>/<h2h3>/<checksum>`.
|
|
1876
|
+
*
|
|
1877
|
+
* Migration re-`put()`s every payload — the new store recomputes BLAKE3, so
|
|
1878
|
+
* legacy `sha256:`-keyed entries converge to canonical keys for free
|
|
1879
|
+
* (ADR-012 D3). The legacy source is deleted only after every entry migrated
|
|
1880
|
+
* without error; any failure leaves it untouched for the next attempt.
|
|
1881
|
+
*/
|
|
1882
|
+
|
|
1883
|
+
/** Outcome of one migration attempt (for diagnostics/logging). */
|
|
1884
|
+
interface LegacyMigrationReport {
|
|
1885
|
+
migrated: number;
|
|
1886
|
+
/** Migration aborted without deleting the legacy source. */
|
|
1887
|
+
failed: boolean;
|
|
1888
|
+
}
|
|
1889
|
+
/**
|
|
1890
|
+
* Migrate any legacy blob layout for `archiveName` into `target`, then delete
|
|
1891
|
+
* the legacy source. Failures are contained: the legacy data stays in place
|
|
1892
|
+
* and the new store keeps whatever was already re-put (idempotent on retry).
|
|
1893
|
+
*/
|
|
1894
|
+
declare function migrateLegacyBlobStore(archiveName: string, target: BlobStore, indexedDbFactory?: IDBFactory): Promise<LegacyMigrationReport>;
|
|
1895
|
+
|
|
1282
1896
|
/**
|
|
1283
1897
|
* Shared postMessage protocol types for the PGlite worker.
|
|
1284
1898
|
*
|
|
@@ -1614,6 +2228,13 @@ interface NoteCreateInput {
|
|
|
1614
2228
|
visibility?: string;
|
|
1615
2229
|
tags?: string[];
|
|
1616
2230
|
archive_id?: string;
|
|
2231
|
+
/**
|
|
2232
|
+
* Explicit primary key. When omitted a UUIDv7 is minted (the default). Supply
|
|
2233
|
+
* this only for deterministic seeding or cross-instance identity — e.g. two
|
|
2234
|
+
* in-browser databases that must agree on a shared note's id so a shard swap
|
|
2235
|
+
* can dedupe it under the `skip` conflict strategy.
|
|
2236
|
+
*/
|
|
2237
|
+
id?: string;
|
|
1617
2238
|
}
|
|
1618
2239
|
interface NoteUpdateInput {
|
|
1619
2240
|
title?: string;
|
|
@@ -2606,11 +3227,13 @@ declare function manageCapabilities(capabilityManager: CapabilityManager, rawInp
|
|
|
2606
3227
|
* AttachmentsRepository — attach and retrieve binary files linked to notes.
|
|
2607
3228
|
*
|
|
2608
3229
|
* Responsibilities:
|
|
2609
|
-
* - Content-addressed blob deduplication via
|
|
3230
|
+
* - Content-addressed blob deduplication via the store-computed BLAKE3 hash
|
|
2610
3231
|
* - Store blob metadata in DatabaseClient (attachment_blob table)
|
|
2611
|
-
* - Store binary data in a BlobStore implementation
|
|
3232
|
+
* - Store binary data in a BlobStore implementation (bytes-first ordering)
|
|
2612
3233
|
* - Create/soft-delete attachment records linked to notes
|
|
2613
3234
|
* - List active attachments for a note
|
|
3235
|
+
* - Reconcile/GC blob bytes against the canonical manifest live set
|
|
3236
|
+
* (ADR-013 D2/D4: manifests are the sole lifecycle authority)
|
|
2614
3237
|
*/
|
|
2615
3238
|
|
|
2616
3239
|
interface AttachmentRow {
|
|
@@ -2648,11 +3271,16 @@ declare class AttachmentsRepository {
|
|
|
2648
3271
|
/**
|
|
2649
3272
|
* Attach a binary file to a note.
|
|
2650
3273
|
*
|
|
2651
|
-
*
|
|
2652
|
-
*
|
|
2653
|
-
*
|
|
2654
|
-
*
|
|
2655
|
-
*
|
|
3274
|
+
* Bytes are written first (`put()` is idempotent — content addressing makes
|
|
3275
|
+
* replays safe), then the metadata rows commit (ADR-013 D5). A crash
|
|
3276
|
+
* between the two leaves an unreferenced blob that reconcile/gc sweeps —
|
|
3277
|
+
* never a manifest without recoverable state. The store-computed BLAKE3
|
|
3278
|
+
* `content_hash` (`blake3:<hex>`) matches the server convention and is the
|
|
3279
|
+
* key used by the portable Knowledge-Shard byte sidecar.
|
|
3280
|
+
*
|
|
3281
|
+
* If a blob row with the same content hash already exists, it is reused
|
|
3282
|
+
* (deduplication) — re-putting the bytes also heals a previously
|
|
3283
|
+
* reference-only blob whose bytes went missing.
|
|
2656
3284
|
*
|
|
2657
3285
|
* Returns the newly created AttachmentRow.
|
|
2658
3286
|
*/
|
|
@@ -2664,9 +3292,16 @@ declare class AttachmentsRepository {
|
|
|
2664
3292
|
get(id: string): Promise<AttachmentRow>;
|
|
2665
3293
|
/**
|
|
2666
3294
|
* Retrieve the raw binary data for an attachment.
|
|
2667
|
-
* Returns null
|
|
3295
|
+
* Returns null when the bytes are not present — the attachment is then in
|
|
3296
|
+
* the recoverable reference-only state (metadata intact, bytes
|
|
3297
|
+
* re-hydratable from a shard sidecar or a re-attach of the same content).
|
|
2668
3298
|
*/
|
|
2669
3299
|
getBlob(attachmentId: string): Promise<Uint8Array | null>;
|
|
3300
|
+
/**
|
|
3301
|
+
* True when the attachment's bytes are physically present in the BlobStore.
|
|
3302
|
+
* False means reference-only (recoverable), not an error.
|
|
3303
|
+
*/
|
|
3304
|
+
hasBlob(attachmentId: string): Promise<boolean>;
|
|
2670
3305
|
/**
|
|
2671
3306
|
* List active (non-deleted) attachments for a note.
|
|
2672
3307
|
* Ordered by position ascending, then created_at ascending.
|
|
@@ -2674,9 +3309,29 @@ declare class AttachmentsRepository {
|
|
|
2674
3309
|
list(noteId: string): Promise<AttachmentRow[]>;
|
|
2675
3310
|
/**
|
|
2676
3311
|
* Soft-delete an attachment by setting deleted_at to the current timestamp.
|
|
2677
|
-
* The
|
|
3312
|
+
* The blob row is untouched and no bytes are removed inline — physical
|
|
3313
|
+
* removal happens only through deferred `reconcileBlobs()`/`gcBlobs()`
|
|
3314
|
+
* against the canonical live set (ADR-013 D4).
|
|
2678
3315
|
*/
|
|
2679
3316
|
delete(id: string): Promise<void>;
|
|
3317
|
+
/**
|
|
3318
|
+
* The authoritative live-checksum set: content hashes referenced by at
|
|
3319
|
+
* least one non-deleted attachment. This — not any refcount — decides
|
|
3320
|
+
* which bytes are reachable.
|
|
3321
|
+
*/
|
|
3322
|
+
liveBlobChecksums(): Promise<string[]>;
|
|
3323
|
+
/**
|
|
3324
|
+
* Reconcile the BlobStore against the canonical live set (startup, after
|
|
3325
|
+
* quota events, after interrupted writes). `missing` lists reference-only
|
|
3326
|
+
* checksums; `unreferenced` lists GC candidates.
|
|
3327
|
+
*/
|
|
3328
|
+
reconcileBlobs(opts?: BlobReconcileOptions): Promise<BlobReconcileResult>;
|
|
3329
|
+
/**
|
|
3330
|
+
* Deferred, age-thresholded physical removal of unreachable bytes.
|
|
3331
|
+
* Runs a reconcile first so GC always acts on current manifest truth.
|
|
3332
|
+
*/
|
|
3333
|
+
gcBlobs(opts?: BlobGcOptions): Promise<BlobGcResult>;
|
|
3334
|
+
private blobChecksumOf;
|
|
2680
3335
|
}
|
|
2681
3336
|
|
|
2682
3337
|
declare const ManageAttachmentsInputSchema: z.ZodObject<{
|
|
@@ -3489,6 +4144,12 @@ declare function sha256Hex(data: Uint8Array): Promise<string>;
|
|
|
3489
4144
|
* checked against the whole archive (see `prefetchShard`'s `expectedSha256`,
|
|
3490
4145
|
* which is real integrity because the hash arrives on a separate channel).
|
|
3491
4146
|
*
|
|
4147
|
+
* The signed-manifest path is now implemented: `verifyShardSignature`
|
|
4148
|
+
* (`shard-signature.ts`, #324/ADR-014) authenticates publisher provenance via
|
|
4149
|
+
* an Ed25519 signature over the manifest digest + blob-digest set, and
|
|
4150
|
+
* `importShard` runs it BEFORE any record or blob mutation. These in-archive
|
|
4151
|
+
* checksums remain the consistency layer *inside* that verified boundary.
|
|
4152
|
+
*
|
|
3492
4153
|
* @returns Object with `valid` flag and list of failed filenames.
|
|
3493
4154
|
*/
|
|
3494
4155
|
declare function validateChecksums(checksums: Record<string, string>, files: Map<string, Uint8Array>): Promise<{
|
|
@@ -3708,14 +4369,851 @@ declare function getPrefetchedSha256(url: string): string | undefined;
|
|
|
3708
4369
|
*/
|
|
3709
4370
|
declare function clearPrefetchedShard(url?: string): void;
|
|
3710
4371
|
|
|
3711
|
-
|
|
4372
|
+
type AiwgFortemiRecordType = string;
|
|
4373
|
+
type AiwgFortemiRecordSchemaVersion = 'aiwg.fortemi.index.record.v1' | 'aiwg.fortemi.index.record.v2';
|
|
4374
|
+
type AiwgFortemiIndexExportSchemaVersion = 'aiwg.fortemi.index.export.v1' | 'aiwg.fortemi.index.export.v2';
|
|
4375
|
+
type AiwgPrivacyClassification = 'private' | 'sanitized' | 'public';
|
|
4376
|
+
type AiwgProvenanceConfidence = 'source' | 'candidate' | 'reviewed' | 'rejected';
|
|
4377
|
+
type AiwgReviewAction = 'accept' | 'reject' | 'defer';
|
|
4378
|
+
type AiwgFortemiRelationshipDirection = 'upstream' | 'downstream' | 'related';
|
|
4379
|
+
interface AiwgFortemiRecordSource {
|
|
4380
|
+
path: string;
|
|
4381
|
+
repo_relative_path: string;
|
|
4382
|
+
locator: string;
|
|
4383
|
+
origin?: string;
|
|
4384
|
+
generated?: boolean;
|
|
4385
|
+
checksum?: string;
|
|
4386
|
+
updated_at?: string;
|
|
4387
|
+
}
|
|
4388
|
+
interface AiwgFortemiRelationship {
|
|
4389
|
+
type: string;
|
|
4390
|
+
target_id: string;
|
|
4391
|
+
source_path?: string;
|
|
4392
|
+
target_path?: string;
|
|
4393
|
+
direction?: AiwgFortemiRelationshipDirection;
|
|
4394
|
+
label?: string;
|
|
4395
|
+
confidence?: number;
|
|
4396
|
+
privacy?: AiwgPrivacyClassification;
|
|
4397
|
+
metadata?: Record<string, unknown>;
|
|
4398
|
+
}
|
|
4399
|
+
interface AiwgFortemiProvenance {
|
|
4400
|
+
field: string;
|
|
4401
|
+
source: string;
|
|
4402
|
+
path: string;
|
|
4403
|
+
confidence: AiwgProvenanceConfidence;
|
|
4404
|
+
privacy: AiwgPrivacyClassification;
|
|
4405
|
+
}
|
|
4406
|
+
type AiwgFortemiSkosRelationType = 'broader' | 'narrower' | 'related' | string;
|
|
4407
|
+
interface AiwgFortemiSkosConcept {
|
|
4408
|
+
id: string;
|
|
4409
|
+
prefLabel: string;
|
|
4410
|
+
definition?: string;
|
|
4411
|
+
scheme?: string;
|
|
4412
|
+
notation?: string;
|
|
4413
|
+
uri?: string;
|
|
4414
|
+
altLabels?: string[];
|
|
4415
|
+
metadata?: Record<string, unknown>;
|
|
4416
|
+
}
|
|
4417
|
+
interface AiwgFortemiSkosRelation {
|
|
4418
|
+
type: AiwgFortemiSkosRelationType;
|
|
4419
|
+
source_id: string;
|
|
4420
|
+
target_id: string;
|
|
4421
|
+
source_path?: string;
|
|
4422
|
+
metadata?: Record<string, unknown>;
|
|
4423
|
+
}
|
|
4424
|
+
interface AiwgFortemiProvenanceEvent {
|
|
4425
|
+
id?: string;
|
|
4426
|
+
activity: string;
|
|
4427
|
+
agent?: string;
|
|
4428
|
+
started_at?: string;
|
|
4429
|
+
ended_at?: string;
|
|
4430
|
+
source?: string;
|
|
4431
|
+
path?: string;
|
|
4432
|
+
confidence?: AiwgProvenanceConfidence;
|
|
4433
|
+
privacy?: AiwgPrivacyClassification;
|
|
4434
|
+
attributes?: Record<string, unknown>;
|
|
4435
|
+
}
|
|
4436
|
+
interface AiwgFortemiSearchProjection {
|
|
4437
|
+
title?: string;
|
|
4438
|
+
name?: string;
|
|
4439
|
+
summary?: string;
|
|
4440
|
+
body?: string;
|
|
4441
|
+
triggers?: string[];
|
|
4442
|
+
aliases?: string[];
|
|
4443
|
+
capability?: string;
|
|
4444
|
+
tags?: string[];
|
|
4445
|
+
phase?: string;
|
|
4446
|
+
type?: string;
|
|
4447
|
+
frontmatter?: Record<string, unknown>;
|
|
4448
|
+
}
|
|
4449
|
+
interface AiwgFortemiChunk {
|
|
4450
|
+
id?: string;
|
|
4451
|
+
text?: string;
|
|
4452
|
+
body?: string;
|
|
4453
|
+
summary?: string;
|
|
4454
|
+
source_path?: string;
|
|
4455
|
+
metadata?: Record<string, unknown>;
|
|
4456
|
+
}
|
|
4457
|
+
interface AiwgFortemiRecordEmbedding {
|
|
4458
|
+
id?: string;
|
|
4459
|
+
embedding?: number[];
|
|
4460
|
+
vector?: number[];
|
|
4461
|
+
model?: string;
|
|
4462
|
+
granularity?: string;
|
|
4463
|
+
input_hash?: string;
|
|
4464
|
+
source_path?: string;
|
|
4465
|
+
metadata?: Record<string, unknown>;
|
|
4466
|
+
}
|
|
4467
|
+
type AiwgFortemiAttachmentReference = ShardAttachmentReference;
|
|
4468
|
+
type AiwgFortemiBinarySource = ShardBinarySource;
|
|
4469
|
+
interface AiwgFortemiRecord {
|
|
4470
|
+
schema_version: AiwgFortemiRecordSchemaVersion;
|
|
4471
|
+
id: string;
|
|
4472
|
+
type: AiwgFortemiRecordType;
|
|
4473
|
+
source: AiwgFortemiRecordSource;
|
|
4474
|
+
title?: string;
|
|
4475
|
+
text?: string;
|
|
4476
|
+
facets: Record<string, string[]>;
|
|
4477
|
+
tags: string[];
|
|
4478
|
+
concepts: string[];
|
|
4479
|
+
relationships: AiwgFortemiRelationship[];
|
|
4480
|
+
provenance: AiwgFortemiProvenance[];
|
|
4481
|
+
search?: AiwgFortemiSearchProjection;
|
|
4482
|
+
chunks?: AiwgFortemiChunk[];
|
|
4483
|
+
binary_sources?: AiwgFortemiBinarySource[];
|
|
4484
|
+
embeddings?: AiwgFortemiRecordEmbedding[];
|
|
4485
|
+
compatibility?: Record<string, unknown>;
|
|
4486
|
+
/** Optional rich SKOS metadata for static consumers that need labels/definitions without opening a shard. */
|
|
4487
|
+
skos_concepts?: AiwgFortemiSkosConcept[];
|
|
4488
|
+
/** Optional SKOS relationship edges among concepts referenced by this record. */
|
|
4489
|
+
skos_relations?: AiwgFortemiSkosRelation[];
|
|
4490
|
+
/** Optional W3C PROV-style activity chain for this record. */
|
|
4491
|
+
provenance_events?: AiwgFortemiProvenanceEvent[];
|
|
4492
|
+
privacy: {
|
|
4493
|
+
classification: AiwgPrivacyClassification;
|
|
4494
|
+
pii: boolean;
|
|
4495
|
+
locality?: string;
|
|
4496
|
+
};
|
|
4497
|
+
updated_at: string;
|
|
4498
|
+
}
|
|
4499
|
+
interface AiwgFortemiIndexExport {
|
|
4500
|
+
schema_version: AiwgFortemiIndexExportSchemaVersion;
|
|
4501
|
+
generated_at: string;
|
|
4502
|
+
source: {
|
|
4503
|
+
repo: string;
|
|
4504
|
+
privacy: AiwgPrivacyClassification;
|
|
4505
|
+
graph?: string;
|
|
4506
|
+
};
|
|
4507
|
+
items: AiwgFortemiRecord[];
|
|
4508
|
+
compatibility?: {
|
|
4509
|
+
previous_schema_version: 'aiwg.fortemi.index.export.v1';
|
|
4510
|
+
strategy: 'supported';
|
|
4511
|
+
};
|
|
4512
|
+
}
|
|
4513
|
+
interface AiwgFortemiChunkPartRef {
|
|
4514
|
+
href: string;
|
|
4515
|
+
offset: number;
|
|
4516
|
+
count: number;
|
|
4517
|
+
}
|
|
4518
|
+
declare const AIWG_SCAN_REQUIRED_FIELDS: Array<keyof AiwgFortemiRecord>;
|
|
4519
|
+
type AiwgFortemiProjectedRecord = Pick<AiwgFortemiRecord, 'schema_version' | 'id' | 'type' | 'title' | 'text' | 'facets' | 'tags' | 'concepts' | 'privacy'> & Partial<AiwgFortemiRecord>;
|
|
4520
|
+
type AiwgDetailIdEncoding = 'uri' | 'base64url';
|
|
4521
|
+
interface AiwgFortemiChunkDetailRef {
|
|
4522
|
+
href: string;
|
|
4523
|
+
encoding?: AiwgDetailIdEncoding;
|
|
4524
|
+
}
|
|
4525
|
+
interface AiwgFortemiChunkManifest {
|
|
4526
|
+
schema_version: 'aiwg.fortemi.index.chunk-manifest.v1';
|
|
4527
|
+
generated_at: string;
|
|
4528
|
+
source: AiwgFortemiIndexExport['source'];
|
|
4529
|
+
source_export_schema_version?: AiwgFortemiIndexExportSchemaVersion;
|
|
4530
|
+
total: number;
|
|
4531
|
+
part_size: number;
|
|
4532
|
+
facets?: Record<string, Record<string, number>>;
|
|
4533
|
+
projection?: Array<keyof AiwgFortemiRecord>;
|
|
4534
|
+
detail?: AiwgFortemiChunkDetailRef;
|
|
4535
|
+
parts: AiwgFortemiChunkPartRef[];
|
|
4536
|
+
}
|
|
4537
|
+
interface AiwgFortemiChunkPart {
|
|
4538
|
+
schema_version: 'aiwg.fortemi.index.chunk.v1';
|
|
4539
|
+
manifest_schema_version: 'aiwg.fortemi.index.chunk-manifest.v1';
|
|
4540
|
+
offset: number;
|
|
4541
|
+
items: AiwgFortemiRecord[];
|
|
4542
|
+
}
|
|
4543
|
+
interface AiwgIndexValidationResult {
|
|
3712
4544
|
valid: boolean;
|
|
3713
4545
|
errors: string[];
|
|
4546
|
+
counts: Partial<Record<string, number>>;
|
|
4547
|
+
}
|
|
4548
|
+
interface AiwgKnowledgeShardOptions {
|
|
4549
|
+
createdAt?: string;
|
|
4550
|
+
matricVersion?: string;
|
|
4551
|
+
/**
|
|
4552
|
+
* Include React-native SKOS and provenance component files. The default
|
|
4553
|
+
* portable profile keeps those projections in lossless note metadata so the
|
|
4554
|
+
* shard remains importable by the current Fortemi server.
|
|
4555
|
+
*/
|
|
4556
|
+
includeNativeRichComponents?: boolean;
|
|
4557
|
+
}
|
|
4558
|
+
interface AiwgChunkedIndexValidationResult {
|
|
4559
|
+
valid: boolean;
|
|
4560
|
+
errors: string[];
|
|
4561
|
+
}
|
|
4562
|
+
interface AiwgIndexQueryOptions {
|
|
4563
|
+
types?: AiwgFortemiRecordType[];
|
|
4564
|
+
facets?: Record<string, string[]>;
|
|
4565
|
+
tags?: string[];
|
|
4566
|
+
concepts?: string[];
|
|
4567
|
+
privacy?: AiwgPrivacyClassification[];
|
|
4568
|
+
relationshipTargetId?: string;
|
|
4569
|
+
limit?: number;
|
|
4570
|
+
offset?: number;
|
|
4571
|
+
rank?: boolean;
|
|
4572
|
+
snippets?: boolean;
|
|
4573
|
+
snippetLength?: number;
|
|
4574
|
+
weights?: Partial<AiwgIndexQueryWeights>;
|
|
4575
|
+
includeMatches?: boolean;
|
|
4576
|
+
searchProfile?: 'default' | 'aiwg-discovery';
|
|
4577
|
+
}
|
|
4578
|
+
interface AiwgIndexQueryWeights {
|
|
4579
|
+
title: number;
|
|
4580
|
+
text: number;
|
|
4581
|
+
tag: number;
|
|
4582
|
+
concept: number;
|
|
4583
|
+
facet: number;
|
|
4584
|
+
id: number;
|
|
4585
|
+
source: number;
|
|
4586
|
+
}
|
|
4587
|
+
interface AiwgIndexQueryMatch {
|
|
4588
|
+
field: 'title' | 'text' | 'tag' | 'concept' | 'facet' | 'id' | 'source';
|
|
4589
|
+
value: string;
|
|
4590
|
+
score?: number;
|
|
4591
|
+
reason?: string;
|
|
4592
|
+
}
|
|
4593
|
+
interface AiwgIndexQueryRankedItem {
|
|
4594
|
+
item: AiwgFortemiRecord;
|
|
4595
|
+
rank: number;
|
|
4596
|
+
snippet?: string;
|
|
4597
|
+
matches?: AiwgIndexQueryMatch[];
|
|
4598
|
+
}
|
|
4599
|
+
interface AiwgIndexQueryResult {
|
|
4600
|
+
items: AiwgFortemiRecord[];
|
|
4601
|
+
total: number;
|
|
4602
|
+
facets: Record<string, Record<string, number>>;
|
|
4603
|
+
rankedItems?: AiwgIndexQueryRankedItem[];
|
|
4604
|
+
}
|
|
4605
|
+
type AiwgChunkedIndexLoader = (part: AiwgFortemiChunkPartRef, manifest: AiwgFortemiChunkManifest) => Promise<unknown>;
|
|
4606
|
+
type AiwgChunkedIndexDetailLoader = (id: string, manifest: AiwgFortemiChunkManifest) => Promise<unknown>;
|
|
4607
|
+
interface AiwgChunkedIndexLoadOptions {
|
|
4608
|
+
maxCachedParts?: number;
|
|
4609
|
+
detailLoader?: AiwgChunkedIndexDetailLoader;
|
|
4610
|
+
maxCachedDetails?: number;
|
|
4611
|
+
maxCachedMatches?: number;
|
|
4612
|
+
}
|
|
4613
|
+
type AiwgChunkedIndexProgressPhase = 'part' | 'query';
|
|
4614
|
+
interface AiwgChunkedIndexProgress {
|
|
4615
|
+
phase: AiwgChunkedIndexProgressPhase;
|
|
4616
|
+
done: number;
|
|
4617
|
+
total: number;
|
|
4618
|
+
href?: string;
|
|
4619
|
+
}
|
|
4620
|
+
interface AiwgChunkedIndexQueryOptions extends AiwgIndexQueryOptions {
|
|
4621
|
+
onProgress?: (progress: AiwgChunkedIndexProgress) => void;
|
|
4622
|
+
}
|
|
4623
|
+
interface AiwgChunkedIndexQueryResult extends AiwgIndexQueryResult {
|
|
4624
|
+
manifestTotal: number;
|
|
4625
|
+
scannedParts: number;
|
|
4626
|
+
fetchedParts: number;
|
|
4627
|
+
complete: boolean;
|
|
4628
|
+
}
|
|
4629
|
+
interface AiwgReviewDecision {
|
|
4630
|
+
item_id: string;
|
|
4631
|
+
action: AiwgReviewAction;
|
|
4632
|
+
reason?: string;
|
|
4633
|
+
updated_at: string;
|
|
4634
|
+
}
|
|
4635
|
+
interface AiwgReviewDecisionExport {
|
|
4636
|
+
schema_version: 'aiwg.fortemi.review-decisions.v1';
|
|
4637
|
+
generated_at: string;
|
|
4638
|
+
source_export_schema_version: AiwgFortemiIndexExportSchemaVersion;
|
|
4639
|
+
decisions: AiwgReviewDecision[];
|
|
4640
|
+
}
|
|
4641
|
+
interface AiwgIndexGraphOptions {
|
|
4642
|
+
communityFacet?: string;
|
|
4643
|
+
communityTagPrefix?: string;
|
|
4644
|
+
relationshipWeights?: Record<string, number>;
|
|
4645
|
+
includeDanglingRelationships?: boolean;
|
|
4646
|
+
}
|
|
4647
|
+
type AiwgRelationshipDirection = 'in' | 'out' | 'both';
|
|
4648
|
+
type AiwgRelationshipSetOperation = 'intersection' | 'union' | 'difference';
|
|
4649
|
+
interface AiwgRelationshipTraversalOptions {
|
|
4650
|
+
direction?: AiwgRelationshipDirection;
|
|
4651
|
+
relationshipType?: string;
|
|
4652
|
+
relationshipDirection?: AiwgFortemiRelationshipDirection;
|
|
4653
|
+
limit?: number;
|
|
4654
|
+
}
|
|
4655
|
+
interface AiwgRelationshipQueryOptions extends AiwgRelationshipTraversalOptions {
|
|
4656
|
+
sourceId?: string;
|
|
4657
|
+
targetId?: string;
|
|
4658
|
+
endpointId?: string;
|
|
4659
|
+
type?: string;
|
|
4660
|
+
}
|
|
4661
|
+
interface AiwgRelationshipEdgeSummary {
|
|
4662
|
+
source_id: string;
|
|
4663
|
+
target_id: string;
|
|
4664
|
+
type: string;
|
|
4665
|
+
source_path?: string;
|
|
4666
|
+
target_path?: string;
|
|
4667
|
+
direction?: AiwgFortemiRelationshipDirection;
|
|
4668
|
+
}
|
|
4669
|
+
interface AiwgRelationshipNodeSummary {
|
|
4670
|
+
id: string;
|
|
4671
|
+
type: AiwgFortemiRecordType;
|
|
4672
|
+
title: string;
|
|
4673
|
+
}
|
|
4674
|
+
interface AiwgRelationshipTraversalResult {
|
|
4675
|
+
nodes: AiwgRelationshipNodeSummary[];
|
|
4676
|
+
edges: AiwgRelationshipEdgeSummary[];
|
|
4677
|
+
complete: boolean;
|
|
4678
|
+
scannedParts?: number;
|
|
4679
|
+
fetchedParts?: number;
|
|
4680
|
+
}
|
|
4681
|
+
interface AiwgRelationshipSetOptions extends AiwgRelationshipTraversalOptions {
|
|
4682
|
+
op: AiwgRelationshipSetOperation;
|
|
4683
|
+
a: string;
|
|
4684
|
+
b: string;
|
|
4685
|
+
}
|
|
4686
|
+
interface AiwgRelationshipSetResult {
|
|
4687
|
+
ids: string[];
|
|
4688
|
+
op: AiwgRelationshipSetOperation;
|
|
4689
|
+
}
|
|
4690
|
+
interface AiwgStaticEmbeddingRecord {
|
|
4691
|
+
record_id: string;
|
|
4692
|
+
embedding: number[];
|
|
4693
|
+
embedding_id?: string;
|
|
4694
|
+
granularity?: string;
|
|
4695
|
+
input_hash: string;
|
|
4696
|
+
source_path?: string;
|
|
4697
|
+
}
|
|
4698
|
+
interface AiwgStaticEmbeddingSet {
|
|
4699
|
+
schema_version: 'aiwg.fortemi.embedding.set.v1';
|
|
4700
|
+
id: string;
|
|
4701
|
+
model: string;
|
|
4702
|
+
dimensions: number;
|
|
4703
|
+
generated_at: string;
|
|
4704
|
+
granularity: 'title-summary' | 'body' | 'chunked-body' | string;
|
|
4705
|
+
metric?: 'cosine' | 'dot' | 'euclidean';
|
|
4706
|
+
input_hash_algorithm?: string;
|
|
4707
|
+
embeddings: AiwgStaticEmbeddingRecord[];
|
|
4708
|
+
}
|
|
4709
|
+
interface AiwgHeadlessEmbeddingBackend {
|
|
4710
|
+
model: string;
|
|
4711
|
+
dimensions: number;
|
|
4712
|
+
embed(input: string, record: AiwgFortemiRecord): number[] | Promise<number[]>;
|
|
4713
|
+
}
|
|
4714
|
+
interface AiwgPrivacyFilterOptions {
|
|
4715
|
+
/** Include records classified `private` (default false). */
|
|
4716
|
+
includePrivate?: boolean;
|
|
4717
|
+
/** Include records flagged `pii` (default false). */
|
|
4718
|
+
includePii?: boolean;
|
|
4719
|
+
}
|
|
4720
|
+
/** Drop `private`/`pii` records unless explicitly opted in (SEC6, default-safe). */
|
|
4721
|
+
declare function filterAiwgRecordsByPrivacy(records: AiwgFortemiRecord[], options?: AiwgPrivacyFilterOptions): AiwgFortemiRecord[];
|
|
4722
|
+
interface BuildAiwgStaticEmbeddingSetOptions {
|
|
4723
|
+
id: string;
|
|
4724
|
+
backend: AiwgHeadlessEmbeddingBackend;
|
|
4725
|
+
records?: AiwgFortemiRecord[];
|
|
4726
|
+
generatedAt?: string | Date;
|
|
4727
|
+
granularity?: AiwgStaticEmbeddingSet['granularity'];
|
|
4728
|
+
metric?: AiwgStaticEmbeddingSet['metric'];
|
|
4729
|
+
textForRecord?: (record: AiwgFortemiRecord) => string;
|
|
4730
|
+
/** Privacy filtering (SEC6). Default-safe: excludes `private`/`pii` records. */
|
|
4731
|
+
privacy?: AiwgPrivacyFilterOptions;
|
|
4732
|
+
}
|
|
4733
|
+
interface AiwgStaticSemanticQueryOptions {
|
|
4734
|
+
limit?: number;
|
|
4735
|
+
offset?: number;
|
|
4736
|
+
minScore?: number;
|
|
4737
|
+
}
|
|
4738
|
+
interface AiwgStaticSemanticResult {
|
|
4739
|
+
item: AiwgFortemiRecord;
|
|
4740
|
+
score: number;
|
|
4741
|
+
embedding?: AiwgStaticEmbeddingRecord;
|
|
4742
|
+
}
|
|
4743
|
+
interface AiwgStaticHybridQueryOptions extends AiwgStaticSemanticQueryOptions, AiwgIndexQueryOptions {
|
|
4744
|
+
lexicalWeight?: number;
|
|
4745
|
+
semanticWeight?: number;
|
|
4746
|
+
}
|
|
4747
|
+
interface AiwgStaticDuplicatePair {
|
|
4748
|
+
left: AiwgFortemiRecord;
|
|
4749
|
+
right: AiwgFortemiRecord;
|
|
4750
|
+
score: number;
|
|
4751
|
+
}
|
|
4752
|
+
interface AiwgReviewInput {
|
|
4753
|
+
item_id: string;
|
|
4754
|
+
action: AiwgReviewAction;
|
|
4755
|
+
reason?: string;
|
|
4756
|
+
}
|
|
4757
|
+
interface AiwgIndexControllerSnapshot {
|
|
4758
|
+
index: AiwgFortemiIndexExport | null;
|
|
4759
|
+
chunked: {
|
|
4760
|
+
manifest: AiwgFortemiChunkManifest;
|
|
4761
|
+
cachedParts: number;
|
|
4762
|
+
maxCachedParts: number;
|
|
4763
|
+
} | null;
|
|
4764
|
+
data: AiwgIndexQueryResult | null;
|
|
4765
|
+
error: Error | null;
|
|
4766
|
+
reviewDecisions: AiwgReviewDecision[];
|
|
4767
|
+
}
|
|
4768
|
+
type AiwgIndexControllerListener = (snapshot: AiwgIndexControllerSnapshot) => void;
|
|
4769
|
+
interface AiwgIndexController {
|
|
4770
|
+
loadIndex(value: unknown): AiwgFortemiIndexExport;
|
|
4771
|
+
loadChunkedIndex(manifest: unknown, loader: AiwgChunkedIndexLoader, options?: AiwgChunkedIndexLoadOptions): AiwgFortemiChunkManifest;
|
|
4772
|
+
getIndex(): AiwgFortemiIndexExport | null;
|
|
4773
|
+
getChunkedManifest(): AiwgFortemiChunkManifest | null;
|
|
4774
|
+
getSnapshot(): AiwgIndexControllerSnapshot;
|
|
4775
|
+
query(query?: string, options?: AiwgIndexQueryOptions): AiwgIndexQueryResult;
|
|
4776
|
+
queryChunked(query?: string, options?: AiwgChunkedIndexQueryOptions): Promise<AiwgChunkedIndexQueryResult>;
|
|
4777
|
+
getRecord(id: string): Promise<AiwgFortemiRecord>;
|
|
4778
|
+
neighbors(id: string, options?: AiwgRelationshipTraversalOptions): Promise<AiwgRelationshipTraversalResult>;
|
|
4779
|
+
relationshipQuery(options?: AiwgRelationshipQueryOptions): Promise<AiwgRelationshipTraversalResult>;
|
|
4780
|
+
relationshipSet(options: AiwgRelationshipSetOptions): Promise<AiwgRelationshipSetResult>;
|
|
4781
|
+
clearChunkCache(): void;
|
|
4782
|
+
toCommunityGraph(options?: AiwgIndexGraphOptions): ReturnType<typeof aiwgFortemiIndexToCommunityGraph>;
|
|
4783
|
+
toCommunityGraphChunked(options?: AiwgIndexGraphOptions & {
|
|
4784
|
+
onProgress?: (progress: AiwgChunkedIndexProgress) => void;
|
|
4785
|
+
}): Promise<ReturnType<typeof aiwgFortemiIndexToCommunityGraph>>;
|
|
4786
|
+
setReviewDecision(input: AiwgReviewInput): AiwgReviewDecision;
|
|
4787
|
+
clearReviewDecision(itemId: string): void;
|
|
4788
|
+
createReviewDecisionExport(generatedAt?: string): AiwgReviewDecisionExport;
|
|
4789
|
+
subscribe(listener: AiwgIndexControllerListener): () => void;
|
|
4790
|
+
}
|
|
4791
|
+
declare function validateAiwgFortemiIndexExport(value: unknown): AiwgIndexValidationResult;
|
|
4792
|
+
declare function assertAiwgFortemiIndexExport(value: unknown): AiwgFortemiIndexExport;
|
|
4793
|
+
declare function validateAiwgFortemiChunkManifest(value: unknown): AiwgChunkedIndexValidationResult;
|
|
4794
|
+
declare function assertAiwgFortemiChunkManifest(value: unknown): AiwgFortemiChunkManifest;
|
|
4795
|
+
declare function validateAiwgFortemiChunkPart(value: unknown, partRef?: AiwgFortemiChunkPartRef, manifest?: AiwgFortemiChunkManifest): AiwgChunkedIndexValidationResult;
|
|
4796
|
+
declare function assertAiwgFortemiChunkPart(value: unknown, partRef?: AiwgFortemiChunkPartRef, manifest?: AiwgFortemiChunkManifest): AiwgFortemiChunkPart;
|
|
4797
|
+
declare function createAiwgFetchChunkLoader(baseUrl?: string | URL): AiwgChunkedIndexLoader;
|
|
4798
|
+
declare function createAiwgFetchDetailLoader(baseUrl?: string | URL): AiwgChunkedIndexDetailLoader;
|
|
4799
|
+
declare function getAiwgFortemiFacets(items: AiwgFortemiRecord[]): Record<string, Record<string, number>>;
|
|
4800
|
+
declare function buildAiwgStaticEmbeddingSet(index: AiwgFortemiIndexExport, options: BuildAiwgStaticEmbeddingSetOptions): Promise<AiwgStaticEmbeddingSet>;
|
|
4801
|
+
interface AiwgChunkedIndexBuildOptions {
|
|
4802
|
+
partSize?: number;
|
|
4803
|
+
projection?: Array<keyof AiwgFortemiRecord>;
|
|
4804
|
+
detailHref?: string;
|
|
4805
|
+
idEncoding?: AiwgDetailIdEncoding;
|
|
4806
|
+
generatedAt?: string;
|
|
4807
|
+
/** Privacy filtering (SEC6). Default-safe: excludes `private`/`pii` records. */
|
|
4808
|
+
privacy?: AiwgPrivacyFilterOptions;
|
|
4809
|
+
}
|
|
4810
|
+
interface AiwgChunkedIndexBuildResult {
|
|
4811
|
+
manifest: AiwgFortemiChunkManifest;
|
|
4812
|
+
parts: Array<{
|
|
4813
|
+
href: string;
|
|
4814
|
+
part: AiwgFortemiChunkPart;
|
|
4815
|
+
}>;
|
|
4816
|
+
details: Array<{
|
|
4817
|
+
id: string;
|
|
4818
|
+
href: string;
|
|
4819
|
+
record: AiwgFortemiRecord;
|
|
4820
|
+
}>;
|
|
4821
|
+
}
|
|
4822
|
+
declare function buildAiwgChunkedIndex(index: AiwgFortemiIndexExport, options?: AiwgChunkedIndexBuildOptions): AiwgChunkedIndexBuildResult;
|
|
4823
|
+
declare function queryAiwgFortemiIndex(index: AiwgFortemiIndexExport, query?: string, options?: AiwgIndexQueryOptions): AiwgIndexQueryResult;
|
|
4824
|
+
declare function validateAiwgStaticEmbeddingSet(value: unknown): AiwgChunkedIndexValidationResult;
|
|
4825
|
+
declare function assertAiwgStaticEmbeddingSet(value: unknown): AiwgStaticEmbeddingSet;
|
|
4826
|
+
declare function queryAiwgSemanticIndex(index: AiwgFortemiIndexExport, embeddingSet: AiwgStaticEmbeddingSet, queryEmbedding: number[], options?: AiwgStaticSemanticQueryOptions): AiwgStaticSemanticResult[];
|
|
4827
|
+
declare function queryAiwgHybridIndex(index: AiwgFortemiIndexExport, embeddingSet: AiwgStaticEmbeddingSet, query: string, queryEmbedding: number[], options?: AiwgStaticHybridQueryOptions): AiwgStaticSemanticResult[];
|
|
4828
|
+
declare function findAiwgStaticDuplicatePairs(index: AiwgFortemiIndexExport, embeddingSet: AiwgStaticEmbeddingSet, threshold?: number, options?: {
|
|
4829
|
+
maxEmbeddings?: number;
|
|
4830
|
+
}): AiwgStaticDuplicatePair[];
|
|
4831
|
+
declare function createAiwgReviewDecisionExport(source: Pick<AiwgFortemiIndexExport, 'schema_version'>, decisions: AiwgReviewDecision[], generatedAt?: string): AiwgReviewDecisionExport;
|
|
4832
|
+
declare function createAiwgIndexController(initialIndex?: AiwgFortemiIndexExport): AiwgIndexController;
|
|
4833
|
+
declare function aiwgFortemiIndexToCommunityGraph(index: AiwgFortemiIndexExport, options?: AiwgIndexGraphOptions): {
|
|
4834
|
+
nodes: {
|
|
4835
|
+
id: string;
|
|
4836
|
+
}[];
|
|
4837
|
+
edges: {
|
|
4838
|
+
source: string;
|
|
4839
|
+
target: string;
|
|
4840
|
+
kind: string;
|
|
4841
|
+
weight: number;
|
|
4842
|
+
}[];
|
|
4843
|
+
communities: {
|
|
4844
|
+
id: string;
|
|
4845
|
+
nodes: string[];
|
|
4846
|
+
}[];
|
|
4847
|
+
};
|
|
4848
|
+
/**
|
|
4849
|
+
* Convert the static AIWG/Fortemi v2 index contract into a portable Knowledge
|
|
4850
|
+
* Shard. Every note retains the complete source envelope and record in metadata,
|
|
4851
|
+
* so the native note/link/SKOS/provenance projections are reversible.
|
|
4852
|
+
*/
|
|
4853
|
+
declare function aiwgFortemiIndexToKnowledgeShard(index: AiwgFortemiIndexExport, options?: AiwgKnowledgeShardOptions): Promise<Uint8Array>;
|
|
4854
|
+
/**
|
|
4855
|
+
* Recover the exact AIWG index envelope and records embedded by
|
|
4856
|
+
* {@link aiwgFortemiIndexToKnowledgeShard}.
|
|
4857
|
+
*/
|
|
4858
|
+
declare function aiwgFortemiIndexFromKnowledgeShard(bytes: Uint8Array): AiwgFortemiIndexExport;
|
|
4859
|
+
|
|
4860
|
+
/**
|
|
4861
|
+
* Canonical RecordStore contract — the writable structured-record layer that
|
|
4862
|
+
* exists independently of PGlite (#323, ADR-013 D3).
|
|
4863
|
+
*
|
|
4864
|
+
* Records mirror the browser SQL rows one-to-one (same field names, ISO-8601
|
|
4865
|
+
* timestamp strings) so the optional PGlite projection is a row-for-row
|
|
4866
|
+
* replay of the change journal — rebuildable at any time without touching
|
|
4867
|
+
* canonical records or attachment bytes.
|
|
4868
|
+
*/
|
|
4869
|
+
interface NoteRecord0 {
|
|
4870
|
+
id: string;
|
|
4871
|
+
archive_id: string | null;
|
|
4872
|
+
title: string | null;
|
|
4873
|
+
format: string;
|
|
4874
|
+
source: string;
|
|
4875
|
+
visibility: string;
|
|
4876
|
+
revision_mode: string;
|
|
4877
|
+
is_starred: boolean;
|
|
4878
|
+
is_pinned: boolean;
|
|
4879
|
+
is_archived: boolean;
|
|
4880
|
+
created_at: string;
|
|
4881
|
+
updated_at: string;
|
|
4882
|
+
deleted_at: string | null;
|
|
4883
|
+
}
|
|
4884
|
+
interface NoteOriginalRecord {
|
|
4885
|
+
id: string;
|
|
4886
|
+
note_id: string;
|
|
4887
|
+
content: string;
|
|
4888
|
+
content_hash: string;
|
|
4889
|
+
created_at: string;
|
|
4890
|
+
}
|
|
4891
|
+
interface NoteRevisedCurrentRecord {
|
|
4892
|
+
/** Keyed by note id (mirrors the SQL PK `note_id`). */
|
|
4893
|
+
id: string;
|
|
4894
|
+
content: string;
|
|
4895
|
+
ai_metadata: unknown | null;
|
|
4896
|
+
generation_count: number;
|
|
4897
|
+
model: string | null;
|
|
4898
|
+
is_user_edited: boolean;
|
|
4899
|
+
updated_at: string;
|
|
4900
|
+
}
|
|
4901
|
+
interface NoteTagRecord {
|
|
4902
|
+
id: string;
|
|
4903
|
+
note_id: string;
|
|
4904
|
+
tag: string;
|
|
4905
|
+
created_at: string;
|
|
3714
4906
|
}
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
4907
|
+
interface LinkRecord0 {
|
|
4908
|
+
id: string;
|
|
4909
|
+
source_note_id: string;
|
|
4910
|
+
target_note_id: string;
|
|
4911
|
+
link_type: string;
|
|
4912
|
+
created_at: string;
|
|
4913
|
+
deleted_at: string | null;
|
|
4914
|
+
}
|
|
4915
|
+
interface CollectionRecord {
|
|
4916
|
+
id: string;
|
|
4917
|
+
name: string;
|
|
4918
|
+
description: string | null;
|
|
4919
|
+
created_at: string;
|
|
4920
|
+
updated_at: string;
|
|
4921
|
+
deleted_at: string | null;
|
|
4922
|
+
}
|
|
4923
|
+
interface CollectionNoteRecord {
|
|
4924
|
+
id: string;
|
|
4925
|
+
collection_id: string;
|
|
4926
|
+
note_id: string;
|
|
4927
|
+
created_at: string;
|
|
4928
|
+
}
|
|
4929
|
+
interface AttachmentRecord {
|
|
4930
|
+
id: string;
|
|
4931
|
+
note_id: string;
|
|
4932
|
+
blob_id: string;
|
|
4933
|
+
document_type_id: string | null;
|
|
4934
|
+
mime_type: string | null;
|
|
4935
|
+
extracted_text: string | null;
|
|
4936
|
+
filename: string;
|
|
4937
|
+
display_name: string | null;
|
|
4938
|
+
position: number;
|
|
4939
|
+
created_at: string;
|
|
4940
|
+
deleted_at: string | null;
|
|
4941
|
+
}
|
|
4942
|
+
interface AttachmentBlobRecord {
|
|
4943
|
+
id: string;
|
|
4944
|
+
content_hash: string;
|
|
4945
|
+
size_bytes: number;
|
|
4946
|
+
created_at: string;
|
|
4947
|
+
}
|
|
4948
|
+
/** Collection name → record type. The store is generic over this map. */
|
|
4949
|
+
interface RecordCollections {
|
|
4950
|
+
note: NoteRecord0;
|
|
4951
|
+
note_original: NoteOriginalRecord;
|
|
4952
|
+
note_revised_current: NoteRevisedCurrentRecord;
|
|
4953
|
+
note_tag: NoteTagRecord;
|
|
4954
|
+
link: LinkRecord0;
|
|
4955
|
+
collection: CollectionRecord;
|
|
4956
|
+
collection_note: CollectionNoteRecord;
|
|
4957
|
+
attachment: AttachmentRecord;
|
|
4958
|
+
attachment_blob: AttachmentBlobRecord;
|
|
4959
|
+
}
|
|
4960
|
+
type RecordCollectionName = keyof RecordCollections;
|
|
4961
|
+
declare const RECORD_COLLECTIONS: readonly RecordCollectionName[];
|
|
4962
|
+
/**
|
|
4963
|
+
* One committed mutation. Journal entries carry the full record snapshot so
|
|
4964
|
+
* the PGlite projection (and any other consumer) can replay mutations without
|
|
4965
|
+
* re-reading canonical state, and so a rebuild has a total order to follow.
|
|
4966
|
+
*/
|
|
4967
|
+
interface JournalEntry {
|
|
4968
|
+
/** Monotonically increasing commit sequence (assigned by the store). */
|
|
4969
|
+
seq: number;
|
|
4970
|
+
/** ISO-8601 commit timestamp. */
|
|
4971
|
+
ts: string;
|
|
4972
|
+
op: 'put' | 'delete';
|
|
4973
|
+
collection: RecordCollectionName;
|
|
4974
|
+
id: string;
|
|
4975
|
+
/** Snapshot for `put`; absent for `delete`. */
|
|
4976
|
+
record?: RecordCollections[RecordCollectionName];
|
|
4977
|
+
}
|
|
4978
|
+
/**
|
|
4979
|
+
* What the canonical record tier can and cannot serve, reported explicitly
|
|
4980
|
+
* (never emulated badly). Advanced capabilities may require the optional
|
|
4981
|
+
* PGlite projection (ADR-013 D3).
|
|
4982
|
+
*/
|
|
4983
|
+
interface RecordStoreCapabilities {
|
|
4984
|
+
crud: true;
|
|
4985
|
+
journal: true;
|
|
4986
|
+
/** Bounded substring scan over titles/content — not ranked FTS. */
|
|
4987
|
+
boundedTextScan: true;
|
|
4988
|
+
fullTextSearch: false;
|
|
4989
|
+
vectorSearch: false;
|
|
4990
|
+
sqlJoins: false;
|
|
4991
|
+
}
|
|
4992
|
+
declare const RECORD_STORE_CAPABILITIES: RecordStoreCapabilities;
|
|
4993
|
+
interface RecordListOptions {
|
|
4994
|
+
/** Maximum records returned (applied after filtering). */
|
|
4995
|
+
limit?: number;
|
|
4996
|
+
}
|
|
4997
|
+
/**
|
|
4998
|
+
* The writable canonical structured-record store. Implementations MUST make
|
|
4999
|
+
* each `put`/`remove` an atomic commit of the record mutation plus its
|
|
5000
|
+
* journal entry (the recoverable commit protocol): a torn write leaves
|
|
5001
|
+
* neither, never one without the other.
|
|
5002
|
+
*/
|
|
5003
|
+
interface RecordStore {
|
|
5004
|
+
get<C extends RecordCollectionName>(collection: C, id: string): Promise<RecordCollections[C] | null>;
|
|
5005
|
+
/** Insert or replace one record, journaled atomically. */
|
|
5006
|
+
put<C extends RecordCollectionName>(collection: C, record: RecordCollections[C]): Promise<JournalEntry>;
|
|
5007
|
+
/** Hard-remove one record, journaled atomically (soft-delete is a field upstream). */
|
|
5008
|
+
remove(collection: RecordCollectionName, id: string): Promise<JournalEntry>;
|
|
5009
|
+
/** All records of a collection (insertion order not guaranteed). */
|
|
5010
|
+
list<C extends RecordCollectionName>(collection: C, opts?: RecordListOptions): Promise<RecordCollections[C][]>;
|
|
5011
|
+
/** Journal entries with `seq > sinceSeq`, ascending. */
|
|
5012
|
+
journalSince(sinceSeq: number, limit?: number): Promise<JournalEntry[]>;
|
|
5013
|
+
/** Highest committed sequence (0 when empty). */
|
|
5014
|
+
headSeq(): Promise<number>;
|
|
5015
|
+
readonly capabilities: RecordStoreCapabilities;
|
|
5016
|
+
close(): Promise<void>;
|
|
5017
|
+
}
|
|
5018
|
+
|
|
5019
|
+
/**
|
|
5020
|
+
* In-memory RecordStore — the test/SSR tier of the canonical record layer.
|
|
5021
|
+
* Same commit semantics as the durable store: record + journal move together.
|
|
5022
|
+
*/
|
|
5023
|
+
|
|
5024
|
+
declare class MemoryRecordStore implements RecordStore {
|
|
5025
|
+
readonly capabilities: RecordStoreCapabilities;
|
|
5026
|
+
private collections;
|
|
5027
|
+
private journal;
|
|
5028
|
+
private seq;
|
|
5029
|
+
private table;
|
|
5030
|
+
get<C extends RecordCollectionName>(collection: C, id: string): Promise<RecordCollections[C] | null>;
|
|
5031
|
+
put<C extends RecordCollectionName>(collection: C, record: RecordCollections[C]): Promise<JournalEntry>;
|
|
5032
|
+
remove(collection: RecordCollectionName, id: string): Promise<JournalEntry>;
|
|
5033
|
+
list<C extends RecordCollectionName>(collection: C, opts?: RecordListOptions): Promise<RecordCollections[C][]>;
|
|
5034
|
+
journalSince(sinceSeq: number, limit?: number): Promise<JournalEntry[]>;
|
|
5035
|
+
headSeq(): Promise<number>;
|
|
5036
|
+
close(): Promise<void>;
|
|
5037
|
+
}
|
|
5038
|
+
|
|
5039
|
+
/**
|
|
5040
|
+
* Durable canonical RecordStore over IndexedDB (#323, ADR-013 D3).
|
|
5041
|
+
*
|
|
5042
|
+
* One database per archive namespace: `fortemi-<archive>-records`. Object
|
|
5043
|
+
* stores: one per record collection (keyPath `id`), plus `journal`
|
|
5044
|
+
* (autoIncrement `seq`) and `meta` (schema version).
|
|
5045
|
+
*
|
|
5046
|
+
* Recoverable commit protocol (ADR-013 D5): every mutation writes the record
|
|
5047
|
+
* change AND its journal entry in a single IndexedDB transaction, so a torn
|
|
5048
|
+
* write commits neither. The journal `seq` is the total order the optional
|
|
5049
|
+
* PGlite projection consumes.
|
|
5050
|
+
*
|
|
5051
|
+
* Schema evolution: `meta.schemaVersion` records the logical record-schema
|
|
5052
|
+
* version; `migrate` hooks run inside the version-change transaction when the
|
|
5053
|
+
* database structure grows. Additive-only, mirroring the SQL migration
|
|
5054
|
+
* discipline.
|
|
5055
|
+
*/
|
|
5056
|
+
|
|
5057
|
+
/** Logical record-schema version stored in `meta` (independent of DB_VERSION). */
|
|
5058
|
+
declare const RECORD_SCHEMA_VERSION = 1;
|
|
5059
|
+
interface CreateRecordStoreOptions {
|
|
5060
|
+
/** Injectable factory for tests (fake-indexeddb). Defaults to the global. */
|
|
5061
|
+
indexedDB?: IDBFactory;
|
|
5062
|
+
}
|
|
5063
|
+
declare class IdbRecordStore implements RecordStore {
|
|
5064
|
+
private db;
|
|
5065
|
+
readonly capabilities: RecordStoreCapabilities;
|
|
5066
|
+
private constructor();
|
|
5067
|
+
static open(archiveName: string, options?: CreateRecordStoreOptions): Promise<IdbRecordStore>;
|
|
5068
|
+
private ensureSchemaVersion;
|
|
5069
|
+
get<C extends RecordCollectionName>(collection: C, id: string): Promise<RecordCollections[C] | null>;
|
|
5070
|
+
put<C extends RecordCollectionName>(collection: C, record: RecordCollections[C]): Promise<JournalEntry>;
|
|
5071
|
+
remove(collection: RecordCollectionName, id: string): Promise<JournalEntry>;
|
|
5072
|
+
list<C extends RecordCollectionName>(collection: C, opts?: RecordListOptions): Promise<RecordCollections[C][]>;
|
|
5073
|
+
journalSince(sinceSeq: number, limit?: number): Promise<JournalEntry[]>;
|
|
5074
|
+
headSeq(): Promise<number>;
|
|
5075
|
+
close(): Promise<void>;
|
|
5076
|
+
}
|
|
5077
|
+
/** Open the durable canonical record store for one archive namespace. */
|
|
5078
|
+
declare function createRecordStore(archiveName: string, options?: CreateRecordStoreOptions): Promise<IdbRecordStore>;
|
|
5079
|
+
|
|
5080
|
+
/**
|
|
5081
|
+
* Canonical notes repository — DB-free note/tag/link/collection workflows
|
|
5082
|
+
* over the RecordStore (#323). Mirrors the SQL repositories' semantics
|
|
5083
|
+
* (UUIDv7 ids, immutable note_original, mutable note_revised_current,
|
|
5084
|
+
* soft-delete everywhere) so the PGlite projection replay is row-for-row.
|
|
5085
|
+
*
|
|
5086
|
+
* Query tier: id/recent/tag/link/collection lookups plus a bounded substring
|
|
5087
|
+
* text scan. Ranked FTS, vectors, and complex joins are explicitly NOT
|
|
5088
|
+
* served here — `store.capabilities` reports the boundary (ADR-013 D3).
|
|
5089
|
+
*/
|
|
5090
|
+
|
|
5091
|
+
interface CanonicalNoteCreateInput {
|
|
5092
|
+
id?: string;
|
|
5093
|
+
title?: string;
|
|
5094
|
+
content: string;
|
|
5095
|
+
format?: string;
|
|
5096
|
+
source?: string;
|
|
5097
|
+
visibility?: string;
|
|
5098
|
+
}
|
|
5099
|
+
interface CanonicalNoteUpdateInput {
|
|
5100
|
+
title?: string;
|
|
5101
|
+
content?: string;
|
|
5102
|
+
is_starred?: boolean;
|
|
5103
|
+
is_pinned?: boolean;
|
|
5104
|
+
is_archived?: boolean;
|
|
5105
|
+
}
|
|
5106
|
+
interface CanonicalNoteView {
|
|
5107
|
+
note: NoteRecord0;
|
|
5108
|
+
original_content: string;
|
|
5109
|
+
revised_content: string;
|
|
5110
|
+
tags: string[];
|
|
5111
|
+
}
|
|
5112
|
+
declare class CanonicalNotesRepository {
|
|
5113
|
+
private store;
|
|
5114
|
+
constructor(store: RecordStore);
|
|
5115
|
+
create(input: CanonicalNoteCreateInput): Promise<CanonicalNoteView>;
|
|
5116
|
+
get(noteId: string): Promise<CanonicalNoteView | null>;
|
|
5117
|
+
update(noteId: string, input: CanonicalNoteUpdateInput): Promise<CanonicalNoteView>;
|
|
5118
|
+
/** Soft-delete: sets `deleted_at`; the record (and history) remains. */
|
|
5119
|
+
softDelete(noteId: string): Promise<void>;
|
|
5120
|
+
restore(noteId: string): Promise<void>;
|
|
5121
|
+
/** Non-deleted notes, most recently updated first. */
|
|
5122
|
+
listRecent(limit?: number): Promise<NoteRecord0[]>;
|
|
5123
|
+
/**
|
|
5124
|
+
* Bounded substring scan over title + revised content (case-insensitive).
|
|
5125
|
+
* This is deliberately not ranked FTS — see `store.capabilities`.
|
|
5126
|
+
*/
|
|
5127
|
+
searchText(query: string, limit?: number): Promise<NoteRecord0[]>;
|
|
5128
|
+
addTag(noteId: string, tag: string): Promise<void>;
|
|
5129
|
+
removeTag(noteId: string, tag: string): Promise<void>;
|
|
5130
|
+
notesByTag(tag: string): Promise<NoteRecord0[]>;
|
|
5131
|
+
createLink(sourceNoteId: string, targetNoteId: string, linkType?: string): Promise<LinkRecord0>;
|
|
5132
|
+
softDeleteLink(linkId: string): Promise<void>;
|
|
5133
|
+
/** Active links touching a note (either direction). */
|
|
5134
|
+
linksOf(noteId: string): Promise<LinkRecord0[]>;
|
|
5135
|
+
createCollection(name: string, description?: string): Promise<CollectionRecord>;
|
|
5136
|
+
addNoteToCollection(collectionId: string, noteId: string): Promise<void>;
|
|
5137
|
+
notesInCollection(collectionId: string): Promise<NoteRecord0[]>;
|
|
5138
|
+
}
|
|
5139
|
+
|
|
5140
|
+
/**
|
|
5141
|
+
* Canonical attachments repository — DB-free attachment manifests over the
|
|
5142
|
+
* RecordStore, bytes through the Bytecask BlobStore (#323, ADR-013 D2/D4/D5).
|
|
5143
|
+
*
|
|
5144
|
+
* Same lifecycle semantics as the SQL-backed AttachmentsRepository: bytes
|
|
5145
|
+
* first (idempotent put), then manifest commit; soft-delete never removes
|
|
5146
|
+
* bytes inline; the manifest-derived live set drives reconcile/gc; missing
|
|
5147
|
+
* bytes are the recoverable reference-only state.
|
|
5148
|
+
*/
|
|
5149
|
+
|
|
5150
|
+
interface CanonicalAttachInput {
|
|
5151
|
+
noteId: string;
|
|
5152
|
+
data: Uint8Array;
|
|
5153
|
+
filename: string;
|
|
5154
|
+
mimeType?: string;
|
|
5155
|
+
extractedText?: string;
|
|
5156
|
+
displayName?: string;
|
|
5157
|
+
}
|
|
5158
|
+
declare class CanonicalAttachmentsRepository {
|
|
5159
|
+
private store;
|
|
5160
|
+
private blobStore;
|
|
5161
|
+
constructor(store: RecordStore, blobStore: BlobStore);
|
|
5162
|
+
/** Bytes-first attach (ADR-013 D5); dedupes on the store-computed hash. */
|
|
5163
|
+
attach(input: CanonicalAttachInput): Promise<AttachmentRecord>;
|
|
5164
|
+
get(id: string): Promise<AttachmentRecord>;
|
|
5165
|
+
/** Null when bytes are absent — the recoverable reference-only state. */
|
|
5166
|
+
getBlob(attachmentId: string): Promise<Uint8Array | null>;
|
|
5167
|
+
hasBlob(attachmentId: string): Promise<boolean>;
|
|
5168
|
+
list(noteId: string): Promise<AttachmentRecord[]>;
|
|
5169
|
+
/** Soft-delete the manifest; bytes are only swept via reconcile/gc. */
|
|
5170
|
+
delete(id: string): Promise<void>;
|
|
5171
|
+
/** Authoritative live set: hashes referenced by non-deleted manifests. */
|
|
5172
|
+
liveBlobChecksums(): Promise<string[]>;
|
|
5173
|
+
/** Startup / post-quota reconciliation against canonical manifests (ADR-013 D4). */
|
|
5174
|
+
reconcileBlobs(opts?: BlobReconcileOptions): Promise<BlobReconcileResult>;
|
|
5175
|
+
/** Deferred reachability-based blob GC. */
|
|
5176
|
+
gcBlobs(opts?: BlobGcOptions): Promise<BlobGcResult>;
|
|
5177
|
+
private checksumOf;
|
|
5178
|
+
}
|
|
5179
|
+
|
|
5180
|
+
/**
|
|
5181
|
+
* PGlite attachment projection (#320, ADR-013 D3).
|
|
5182
|
+
*
|
|
5183
|
+
* Projects canonical attachment state (RecordStore) into the optional PGlite
|
|
5184
|
+
* `attachment_blob` / `attachment` tables. Properties:
|
|
5185
|
+
*
|
|
5186
|
+
* - Idempotent: every row upserts on its primary key; re-running with the
|
|
5187
|
+
* same canonical state changes nothing.
|
|
5188
|
+
* - Rebuildable: dropping the projection rows and re-projecting yields
|
|
5189
|
+
* equivalent query results — the canonical records are the source of truth.
|
|
5190
|
+
* - Derived refcounts: `attachment_blob.reference_count` is recomputed from
|
|
5191
|
+
* live manifests on every projection pass; it is never lifecycle authority
|
|
5192
|
+
* and no trigger touches it.
|
|
5193
|
+
* - Bytes never enter PGlite; only metadata is projected.
|
|
5194
|
+
*/
|
|
5195
|
+
|
|
5196
|
+
interface AttachmentProjectionResult {
|
|
5197
|
+
blobs: number;
|
|
5198
|
+
attachments: number;
|
|
5199
|
+
}
|
|
5200
|
+
/**
|
|
5201
|
+
* Project all canonical attachment records into PGlite. Safe to run at any
|
|
5202
|
+
* time: startup, after journal consumption, or as a full rebuild after the
|
|
5203
|
+
* projection was dropped.
|
|
5204
|
+
*
|
|
5205
|
+
* The parent `note` rows must already exist in the projection (note
|
|
5206
|
+
* projection is the #323 cycle-2 surface); this function owns only the
|
|
5207
|
+
* attachment tables.
|
|
5208
|
+
*/
|
|
5209
|
+
declare function projectAttachments(db: DatabaseClient, store: RecordStore): Promise<AttachmentProjectionResult>;
|
|
5210
|
+
/**
|
|
5211
|
+
* Drop the attachment projection rows (test/rebuild support). Canonical
|
|
5212
|
+
* records and Bytecask bytes are untouched — this is the "PGlite can be
|
|
5213
|
+
* dropped and rebuilt" invariant made executable.
|
|
5214
|
+
*/
|
|
5215
|
+
declare function dropAttachmentProjection(db: DatabaseClient): Promise<void>;
|
|
3718
5216
|
|
|
3719
|
-
declare const VERSION = "2026.7.
|
|
5217
|
+
declare const VERSION = "2026.7.7";
|
|
3720
5218
|
|
|
3721
|
-
export { type AiwgIndexSchemaValidationResult, type ArchiveInfo, ArchiveManager, type AttachInput, type AttachmentBlobRow, type AttachmentRow, AttachmentsRepository, type BackendCandidate, type BackendCapabilities, type BackendConcept, type BackendLink, type BackendListOptions, type BackendNote, type BackendNoteFull, type BackendProvenanceEdge, type BackendRequest, type BackendSearchHit, type BackendSearchQueryOptions, type BackendSearchResult, type BackendSelection, type BackendSemanticTier, type BackendStartupCost, BlobStore, type BridgeCapability, type BridgeProviderInfo, type BrowserNoteExport, CURRENT_MIGRATION_HEAD, 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 CooldownConfig, type CooldownEvent, type CosineSemanticProviderOptions, type CreatePGliteOptions, type CspDirectiveName, type CspDirectives, type CspViolationReport, DB_SNAPSHOT_SCHEMA_VERSION, type DataBackend, type DatabaseClient, type DbSnapshot, type DbSnapshotCompat, type DbSnapshotCompression, type DbSnapshotExpectations, type DbSnapshotMeta, type DbSnapshotSource, DbSnapshotVersionError, type DiscoveredProvider, type DiscoveryOptions, type DumpDbSnapshotOptions, type DumpableDb, EMBED_REQUEST_KIND, EMBED_RESPONSE_KIND, type EmbedFunction, type EmbedRequest, type EmbedRequestMessage, type EmbedResponse, type EmbedResponseMessage, type EmbedTransportPort, type EmbedWorkerOptions, 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, ExportOptions, FORTEMI_COMPATIBILITY_PATH, FORTEMI_COMPATIBILITY_STATES, FORTEMI_REQUIRED_COMPATIBILITY_CAPABILITIES, type FallbackEvent, FallbackRouter, type FallbackRouterConfig, type FetchFortemiCompatibilityOptions, type FortemiBridge, type FortemiBridgeCapabilities, type FortemiBridgeHost, type FortemiCompatibilityCapability, type FortemiCompatibilityResponse, type FortemiCompatibilityState, type FortemiCompatibilityValidationResult, type FortemiConfig, type FortemiCore, type FortemiInferenceRouter, type FortemiRequiredCompatibilityCapability, type FortemiSecretStore, type FortemiToolDefinition, FortemiToolManifest, type GetNoteInput, GetNoteInputSchema, type GpuCapabilities, type GraphCommunity, type GraphEdge, type GraphNode, GraphRepository, type IDisposable, ImportOptions, 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, type Migration, MigrationRunner, type ModelCategory, type ModelFitResult, type ModelInfo, type NoteCreateInput, type NoteFull, type NoteListOptions, type NoteRevision, type NoteSkosTag, type NoteSummary, type NoteUpdateInput, NotesRepository, OpenAICompatibleProvider, type OpenAIProviderConfig, type OpenShardOptions, type PGliteBackendOptions, PGliteStorageBackend, PGliteStorageBackendFactory, PGliteWorkerClient, PGliteWorkerStorageBackend, PGliteWorkerStorageBackendFactory, type PGliteWorkerStorageBackendFactoryOptions, type PaginatedResult, type PersistenceMode, type PluginCspOptions, type PluginScriptDescriptor, type PluginScriptPolicy, type PrefetchOptions, type PrefetchResult, type ProbeResult, type ProbeStatus, type ProvenanceEdge, ProvenanceRepository, type ProviderCapabilities, ProviderRegistry, type ProviderTier, type QueryExecutor, type QueryResult, type RecommendedTier, type RecordProvenanceInput, type RemoteBackendConfig, type RemoteBackendPaths, type ResolvedEmbeddingRow, type ResolvedEmbeddingSet, type RestoreDbSnapshotOptions, type RouteHandler, SUPPORTED_PGLITE_VERSION, type SWRegistrationResult, type SearchFacets, type SearchInput, SearchInputSchema, type SearchOptions, SearchRepository, type SearchResponse, type SearchResult, type ShardBackendOptions, ShardCollection, ShardComponent, type ShardComponentStore, ShardEmbedding, ShardEmbeddingConfig, ShardEmbeddingSet, ShardEmbeddingSetMember, ShardLink, type ShardListOptions, ShardManifest, ShardNote, type ShardNoteFull, ShardNoteSkosTag, ShardProvenanceEdge, type ShardReader, type ShardReaderNote, type ShardReaderSource, type ShardSchemaValidationResult, type ShardSearchOptions, type ShardSearchRankedNote, type ShardSearchResult, type ShardSearchWeights, ShardSkosConcept, ShardSkosRelation, ShardSkosScheme, ShardTag, ShardTemplate, type SimilarityGraphCacheKey, type SimilarityGraphOptions, type SimilarityGraphRequest, type SimilarityGraphResult, type SkosConcept, type SkosRelation, SkosRepository, type SkosScheme, type StaticSemanticProvider, type StorageBackend, type StorageBackendFactory, type StorageOpenRequest, type StorageTopology, type StreamChunk, TagsRepository, TransactionProxy, TypedEventBus, VERSION, type VectorEntry, type VirtualEmbeddingSetDefinition, type VirtualEmbeddingSetSource, type VirtualEmbeddingSetValidationError, type VirtualMaterializationPolicy, type VramTier, type WorkerRequest, type WorkerResponse, aiRevisionHandler, allMigrations, appendPluginScript, assertShardComponentRecord, buildNoteConditions, buildPluginCsp, captureKnowledge, chunkText, classifyError, classifyModel, clearPrefetchedShard, collectionFromShard, collectionToShard, computeBlobHash, computeHash, computeSri, conceptTaggingHandler, cosineSimilarity, createCosineSemanticProvider, createCspReportHandler, createFortemi, createLegacyProvider, createPGliteBackend, createPGliteInstance, createRemoteBackend, createRoutes, createShardBackend, createWorkerEmbedFunction, defaultStorageBackendFactory, detectCommunities, detectGpuCapabilities, detectInferenceCapabilities, discoverLocalProviders, dumpDbSnapshot, embeddingConfigToShard, embeddingFromShard, embeddingGenerationHandler, embeddingSetFromShard, embeddingSetMemberToShard, embeddingSetToShard, embeddingToShard, enqueueFullWorkflow, enqueueJob, enqueueNoteCreationJobs, estimateModelFit, estimateVramMB, estimateVramTier, exportShard, fetchAndValidateFortemiCompatibility, fetchPluginScript, formatFortemiCompatibilitySummary, fortemiCompatibilityUrl, fortemiManifest, fromPrefetched, generateId, getAiwgFortemiIndexExportSchema, getEmbedFunction, getFortemiBridge, getFortemiSecretStore, getJobQueueStatus, getKnowledgeShardSchema, getLlmFunction, getNote, getPrefetchedSha256, handleEmbedRequests, hasFortemiSecureSecrets, importShard, isPluginScriptAllowed, isShardPrefetched, linkFromShard, linkToShard, linkingHandler, listNotes, manageArchive, manageAttachments, manageCapabilities, manageCollections, manageLinks, manageNote, manageTags, matchRoute, noteFromShard, noteSkosTagToShard, noteToShard, openShard, packTarGz, parseCspReport, prefetchShard, provenanceEdgeToShard, registerLlmCapability, registerSemanticCapability, registerSemanticCapabilityWorker, registerServiceWorker, restoreDbSnapshot, searchTool, selectBackend, selectLlmModel, setEmbedFunction, setLlmFunction, sha256Hex, skosConceptToShard, skosRelationToShard, skosSchemeToShard, suggestTags, tagsToShard, templateToShard, titleGenerationHandler, unpackTarGz, unregisterLlmCapability, unregisterSemanticCapability, urlLinkToShard, validateAiwgFortemiIndexExportSchema, validateAiwgFortemiProjectedRecordSchema, validateChecksums, validateFortemiCompatibilityResponse, validateShardArchive, validateShardComponentRecord, validateShardManifest, verifyDbSnapshotMeta, verifySri };
|
|
5219
|
+
export { AIWG_SCAN_REQUIRED_FIELDS, type AiwgChunkedIndexBuildOptions, type AiwgChunkedIndexBuildResult, type AiwgChunkedIndexDetailLoader, type AiwgChunkedIndexLoadOptions, type AiwgChunkedIndexLoader, type AiwgChunkedIndexProgress, type AiwgChunkedIndexProgressPhase, type AiwgChunkedIndexQueryOptions, type AiwgChunkedIndexQueryResult, type AiwgChunkedIndexValidationResult, type AiwgFortemiAttachmentReference, type AiwgFortemiBinarySource, type AiwgFortemiChunk, type AiwgFortemiChunkDetailRef, type AiwgFortemiChunkManifest, type AiwgFortemiChunkPart, type AiwgFortemiChunkPartRef, type AiwgFortemiIndexExport, type AiwgFortemiIndexExportSchemaVersion, type AiwgFortemiProjectedRecord, type AiwgFortemiProvenance, type AiwgFortemiProvenanceEvent, type AiwgFortemiRecord, type AiwgFortemiRecordEmbedding, type AiwgFortemiRecordSchemaVersion, type AiwgFortemiRecordSource, type AiwgFortemiRecordType, type AiwgFortemiRelationship, type AiwgFortemiRelationshipDirection, type AiwgFortemiSearchProjection, type AiwgFortemiSkosConcept, type AiwgFortemiSkosRelation, type AiwgFortemiSkosRelationType, type AiwgHeadlessEmbeddingBackend, type AiwgIndexController, type AiwgIndexControllerListener, type AiwgIndexControllerSnapshot, type AiwgIndexGraphOptions, type AiwgIndexQueryMatch, type AiwgIndexQueryOptions, type AiwgIndexQueryRankedItem, type AiwgIndexQueryResult, type AiwgIndexQueryWeights, type AiwgIndexValidationResult, type AiwgKnowledgeShardOptions, type AiwgPrivacyClassification, type AiwgPrivacyFilterOptions, type AiwgProvenanceConfidence, type AiwgRelationshipDirection, type AiwgRelationshipEdgeSummary, type AiwgRelationshipNodeSummary, type AiwgRelationshipQueryOptions, type AiwgRelationshipSetOperation, type AiwgRelationshipSetOptions, type AiwgRelationshipSetResult, type AiwgRelationshipTraversalOptions, type AiwgRelationshipTraversalResult, type AiwgReviewAction, type AiwgReviewDecision, type AiwgReviewDecisionExport, type AiwgReviewInput, type AiwgStaticDuplicatePair, type AiwgStaticEmbeddingRecord, type AiwgStaticEmbeddingSet, type AiwgStaticHybridQueryOptions, type AiwgStaticSemanticQueryOptions, type AiwgStaticSemanticResult, AllowlistTrustStore, type ArchiveInfo, ArchiveManager, type AttachInput, type AttachmentBlobRecord, type AttachmentBlobRow, type AttachmentProjectionResult, type AttachmentRecord, type AttachmentRow, AttachmentsRepository, type BackendCandidate, type BackendCapabilities, type BackendConcept, type BackendLink, type BackendListOptions, type BackendNote, type BackendNoteFull, type BackendProvenanceEdge, type BackendRequest, type BackendSearchHit, type BackendSearchQueryOptions, type BackendSearchResult, type BackendSelection, type BackendSemanticTier, type BackendStartupCost, type BlobBackendKind, type BlobGcOptions, type BlobGcResult, type BlobReconcileOptions, type BlobReconcileResult, type BlobStore, type BlobStoreDiagnostics, type BridgeCapability, type BridgeProviderInfo, type BrowserNoteExport, type BuildAiwgStaticEmbeddingSetOptions, CURRENT_MIGRATION_HEAD, CURRENT_SHARD_VERSION, type CanonicalAttachInput, CanonicalAttachmentsRepository, type CanonicalNoteCreateInput, type CanonicalNoteUpdateInput, type CanonicalNoteView, CanonicalNotesRepository, type CapabilityInfo, CapabilityManager, type CapabilityName, type CapabilityState, type CaptureKnowledgeInput, CaptureKnowledgeInputSchema, type CaptureKnowledgeResult, type CollectionCreateInput, type CollectionNoteRecord, type CollectionRecord, 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 CosineSemanticProviderOptions, type CreateBlobStoreOptions, type CreatePGliteOptions, type CreateRecordStoreOptions, type CspDirectiveName, type CspDirectives, type CspViolationReport, DB_SNAPSHOT_SCHEMA_VERSION, type DataBackend, type DatabaseClient, type DbSnapshot, type DbSnapshotCompat, type DbSnapshotCompression, type DbSnapshotExpectations, type DbSnapshotMeta, type DbSnapshotSource, DbSnapshotVersionError, type DiscoveredProvider, type DiscoveryOptions, type DumpDbSnapshotOptions, type DumpableDb, EMBED_REQUEST_KIND, EMBED_RESPONSE_KIND, type EmbedFunction, type EmbedRequest, type EmbedRequestMessage, type EmbedResponse, type EmbedResponseMessage, type EmbedTransportPort, type EmbedWorkerOptions, 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, FORTEMI_COMPATIBILITY_PATH, FORTEMI_COMPATIBILITY_STATES, FORTEMI_REQUIRED_COMPATIBILITY_CAPABILITIES, type FallbackEvent, FallbackRouter, type FallbackRouterConfig, type FetchFortemiCompatibilityOptions, type FortemiBridge, type FortemiBridgeCapabilities, type FortemiBridgeHost, type FortemiCompatibilityCapability, type FortemiCompatibilityResponse, type FortemiCompatibilityState, type FortemiCompatibilityValidationResult, type FortemiConfig, type FortemiCore, type FortemiInferenceRouter, type FortemiRequiredCompatibilityCapability, type FortemiSecretStore, type FortemiToolDefinition, FortemiToolManifest, type GetNoteInput, GetNoteInputSchema, type GpuCapabilities, type GraphCommunity, type GraphEdge, type GraphNode, GraphRepository, type IDisposable, IdbRecordStore, 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, type JournalEntry, LOCAL_ENDPOINTS, type LegacyMigrationReport, type LinkRecord0, 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, MemoryRecordStore, type Migration, MigrationRunner, type ModelCategory, type ModelFitResult, type ModelInfo, type NoteCreateInput, type NoteFull, type NoteListOptions, type NoteOriginalRecord, type NoteRecord0, type NoteRevisedCurrentRecord, type NoteRevision, type NoteSkosTag, type NoteSummary, type NoteTagRecord, type NoteUpdateInput, NotesRepository, OpenAICompatibleProvider, type OpenAIProviderConfig, type OpenShardOptions, type PGliteBackendOptions, PGliteStorageBackend, PGliteStorageBackendFactory, PGliteWorkerClient, PGliteWorkerStorageBackend, PGliteWorkerStorageBackendFactory, type PGliteWorkerStorageBackendFactoryOptions, type PaginatedResult, type PersistenceMode, type PluginCspOptions, type PluginScriptDescriptor, type PluginScriptPolicy, type PrefetchOptions, type PrefetchResult, type ProbeResult, type ProbeStatus, type ProvenanceEdge, ProvenanceRepository, type ProviderCapabilities, ProviderRegistry, type ProviderTier, type QueryExecutor, type QueryResult, RECORD_COLLECTIONS, RECORD_SCHEMA_VERSION, RECORD_STORE_CAPABILITIES, type RecommendedTier, type RecordCollectionName, type RecordCollections, type RecordListOptions, type RecordProvenanceInput, type RecordStore, type RecordStoreCapabilities, type RemoteBackendConfig, type RemoteBackendPaths, type ResolvedEmbeddingRow, type ResolvedEmbeddingSet, type RestoreDbSnapshotOptions, type RouteHandler, SHARD_FORMAT, SIGNATURE_ENTRY, SIGNING_ENVELOPE_VERSION, SUPPORTED_PGLITE_VERSION, type SWRegistrationResult, type SearchFacets, type SearchInput, SearchInputSchema, type SearchOptions, SearchRepository, type SearchResponse, type SearchResult, type ShardBackendOptions, type ShardClusterRef, type ShardCollection, type ShardComponent, type ShardComponentStore, type ShardEmbedding, type ShardEmbeddingConfig, type ShardEmbeddingSet, type ShardEmbeddingSetMember, type ShardLayout, type ShardLink, type ShardListOptions, type ShardManifest, type ShardNote, type ShardNoteFull, type ShardNoteSkosTag, type ShardProvenanceEdge, type ShardReader, type ShardReaderNote, type ShardReaderSource, type ShardSchemaValidationResult, type ShardSearchOptions, type ShardSearchRankedNote, type ShardSearchResult, type ShardSearchWeights, type ShardSignatureEnvelope, type ShardSignatureVerdict, type ShardSigner, type ShardSigningPayload, type ShardSkosConcept, type ShardSkosRelation, type ShardSkosScheme, type ShardTag, type ShardTemplate, type ShardTrustStore, type SignShardInput, type SimilarityGraphCacheKey, type SimilarityGraphOptions, type SimilarityGraphRequest, type SimilarityGraphResult, type SkosConcept, type SkosRelation, SkosRepository, type SkosScheme, type StaticSemanticProvider, type StorageBackend, type StorageBackendFactory, type StorageOpenRequest, type StorageTopology, type StreamChunk, TagsRepository, TransactionProxy, type TrustedKey, TypedEventBus, VERSION, type VectorEntry, type VerifyShardSignatureInput, type VirtualEmbeddingSetDefinition, type VirtualEmbeddingSetSource, type VirtualEmbeddingSetValidationError, type VirtualMaterializationPolicy, type VramTier, type WorkerRequest, type WorkerResponse, aiRevisionHandler, aiwgFortemiIndexFromKnowledgeShard, aiwgFortemiIndexToCommunityGraph, aiwgFortemiIndexToKnowledgeShard, allMigrations, appendPluginScript, assertAiwgFortemiChunkManifest, assertAiwgFortemiChunkPart, assertAiwgFortemiIndexExport, assertAiwgStaticEmbeddingSet, assertShardComponentRecord, buildAiwgChunkedIndex, buildAiwgStaticEmbeddingSet, buildNoteConditions, buildPluginCsp, captureKnowledge, chunkText, classifyError, classifyModel, clearPrefetchedShard, collectionFromShard, collectionToShard, computeBlobHash, computeHash, computeSri, conceptTaggingHandler, cosineSimilarity, createAiwgFetchChunkLoader, createAiwgFetchDetailLoader, createAiwgIndexController, createAiwgReviewDecisionExport, createBlobStore, createCosineSemanticProvider, createCspReportHandler, createFortemi, createLazyBlobStore, createLegacyProvider, createPGliteBackend, createPGliteInstance, createRecordStore, createRemoteBackend, createRoutes, createShardBackend, createWorkerEmbedFunction, defaultStorageBackendFactory, detectCommunities, detectGpuCapabilities, detectInferenceCapabilities, discoverLocalProviders, dropAttachmentProjection, dumpDbSnapshot, embeddingConfigToShard, embeddingFromShard, embeddingGenerationHandler, embeddingSetFromShard, embeddingSetMemberToShard, embeddingSetToShard, embeddingToShard, enqueueFullWorkflow, enqueueJob, enqueueNoteCreationJobs, estimateModelFit, estimateVramMB, estimateVramTier, exportShard, fetchAndValidateFortemiCompatibility, fetchPluginScript, filterAiwgRecordsByPrivacy, findAiwgStaticDuplicatePairs, formatFortemiCompatibilitySummary, fortemiCompatibilityUrl, fortemiManifest, fromPrefetched, generateId, getAiwgFortemiFacets, getEmbedFunction, getFortemiBridge, getFortemiSecretStore, getJobQueueStatus, getKnowledgeShardSchema, getLlmFunction, getNote, getPrefetchedSha256, handleEmbedRequests, hasFortemiSecureSecrets, importShard, isPluginScriptAllowed, isShardPrefetched, isShardSigningSupported, linkFromShard, linkToShard, linkingHandler, listNotes, manageArchive, manageAttachments, manageCapabilities, manageCollections, manageLinks, manageNote, manageTags, matchRoute, migrateLegacyBlobStore, noteFromShard, noteSkosTagToShard, noteToShard, openShard, packTarGz, parseCspReport, prefetchShard, projectAttachments, provenanceEdgeToShard, queryAiwgFortemiIndex, queryAiwgHybridIndex, queryAiwgSemanticIndex, registerLlmCapability, registerSemanticCapability, registerSemanticCapabilityWorker, registerServiceWorker, restoreDbSnapshot, searchTool, selectBackend, selectLlmModel, setEmbedFunction, setLlmFunction, sha256Hex, sidecarBlobDigests, signShard, skosConceptToShard, skosRelationToShard, skosSchemeToShard, suggestTags, tagsToShard, templateToShard, titleGenerationHandler, unpackTarGz, unregisterLlmCapability, unregisterSemanticCapability, urlLinkToShard, validateAiwgFortemiChunkManifest, validateAiwgFortemiChunkPart, validateAiwgFortemiIndexExport, validateAiwgStaticEmbeddingSet, validateChecksums, validateFortemiCompatibilityResponse, validateShardArchive, validateShardComponentRecord, validateShardManifest, verifyDbSnapshotMeta, verifyShardSignature, verifySri };
|