@fortemi/core 2026.7.7 → 2026.7.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -458,6 +458,11 @@ interface BlobStore {
458
458
  read(checksum: string): Promise<Uint8Array | null>;
459
459
  /** True when the bytes for this checksum are physically present. */
460
460
  has(checksum: string): Promise<boolean>;
461
+ /**
462
+ * Physically remove one checksum. Import staging uses this only to roll back
463
+ * content that was absent before promotion.
464
+ */
465
+ delete?(checksum: string): Promise<boolean>;
461
466
  /**
462
467
  * Reconcile stored bytes against the authoritative live-checksum set
463
468
  * derived from canonical attachment manifests (ADR-013 D4).
@@ -476,6 +481,7 @@ declare class MemoryBlobStore implements BlobStore {
476
481
  put(bytes: Uint8Array): Promise<string>;
477
482
  read(checksum: string): Promise<Uint8Array | null>;
478
483
  has(checksum: string): Promise<boolean>;
484
+ delete(checksum: string): Promise<boolean>;
479
485
  reconcile(liveChecksums: Iterable<string>, opts?: BlobReconcileOptions): Promise<BlobReconcileResult>;
480
486
  gc(opts?: BlobGcOptions): Promise<BlobGcResult>;
481
487
  diagnostics(): Promise<BlobStoreDiagnostics>;
@@ -624,12 +630,55 @@ declare function signShard(input: SignShardInput): Promise<Uint8Array>;
624
630
  *
625
631
  * A shard is a gzip-compressed tar archive (.shard) containing serialized
626
632
  * knowledge data with a manifest for integrity verification.
633
+ *
634
+ * @implements @.aiwg/adrs/ADR-011-shard-server-conformance-and-version-negotiation.md
635
+ * @schema @packages/core/schemas/knowledge-shard.schema.receipt.json
636
+ * @created 2026-07-17
637
+ * @agent Codex
627
638
  */
628
639
 
629
- declare const CURRENT_SHARD_VERSION = "1.0.0";
640
+ declare const CURRENT_SHARD_VERSION = "1.2.0";
630
641
  declare const SHARD_FORMAT = "matric-shard";
631
642
  /** 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';
643
+ type ShardComponent = 'notes' | 'collections' | 'tags' | 'templates' | 'links' | 'note_originals' | 'note_original_history' | 'note_revised_current' | 'note_revisions' | 'embedding_sets' | 'embedding_configs' | 'embedding_set_members' | 'embeddings' | 'provenance_activities' | 'named_locations' | 'provenance_locations' | 'provenance_devices' | 'provenance_records' | 'skos_schemes' | 'skos_concepts' | 'skos_labels' | 'skos_notes' | 'skos_relations' | 'skos_mapping_relations' | 'skos_scheme_memberships' | 'note_skos_tags' | 'skos_collections' | 'skos_collection_members' | 'provenance_edges' | 'community_assignments' | 'communities' | 'graph_edges' | 'graph_sources';
644
+ type KnowledgeShardProfile = 'core-v1' | 'full-v1' | 'record-v1';
645
+ type ShardBackend = 'pglite' | 'record-store';
646
+ type ShardOperation = 'export' | 'import';
647
+ type ShardAuthorityStatus = 'supported' | 'candidate' | 'reserved' | 'unknown' | 'unprofiled';
648
+ interface ShardProfileRegistryEntry {
649
+ profile: KnowledgeShardProfile;
650
+ authority_status: 'supported' | 'candidate' | 'reserved';
651
+ components: ShardComponent[];
652
+ }
653
+ interface ShardLossEntry {
654
+ code: string;
655
+ message: string;
656
+ component?: ShardComponent;
657
+ count?: number;
658
+ }
659
+ interface ShardCapabilityReport {
660
+ schema_version: 'fortemi.shard.capability-report.v1';
661
+ backend: ShardBackend;
662
+ operation: ShardOperation;
663
+ requested_profile: string | null;
664
+ authority_status: ShardAuthorityStatus;
665
+ backend_supported: boolean;
666
+ portable: boolean;
667
+ authority: {
668
+ repository: string;
669
+ commit: string;
670
+ contract_sha256: string;
671
+ contract_revision: string;
672
+ schema_version: string;
673
+ schema_bundle_sha256: string;
674
+ };
675
+ advertised_profiles: KnowledgeShardProfile[];
676
+ supported_components: ShardComponent[];
677
+ declared_components: ShardComponent[];
678
+ unsupported_components: ShardComponent[];
679
+ omitted_components: ShardComponent[];
680
+ losses: ShardLossEntry[];
681
+ }
633
682
  interface ShardAttachmentReference {
634
683
  id: string;
635
684
  path: string;
@@ -639,6 +688,12 @@ interface ShardAttachmentReference {
639
688
  }
640
689
  interface ShardAttachmentProjection {
641
690
  extracted_text: string | null;
691
+ /** Legacy unprofiled relationship timestamp; outside core-v1. */
692
+ created_at?: string;
693
+ /** Legacy unprofiled attachment tombstone; outside core-v1. */
694
+ deleted_at?: string | null;
695
+ extraction_status?: 'extracted' | 'pending' | 'failed' | 'blocked' | 'deferred';
696
+ reason?: null | 'extraction_pending' | 'extractor_failed' | 'quarantined' | 'large_binary' | 'unsupported_mime' | 'no_extracted_text';
642
697
  attachment: ShardAttachmentReference;
643
698
  }
644
699
  /** @deprecated Legacy React shard field name. Server shards use `attachments`. */
@@ -669,9 +724,19 @@ interface ShardMigrationHistoryEntry {
669
724
  changes: string[];
670
725
  }
671
726
  /** Manifest included in every shard as manifest.json. */
727
+ interface ShardProducer {
728
+ name: string;
729
+ version: string;
730
+ revision?: string;
731
+ }
672
732
  interface ShardManifest {
673
733
  version: string;
674
- matric_version: string;
734
+ /** Named server-owned portability profile. Required for canonical interchange. */
735
+ profile?: string;
736
+ /** Structured producer identity used by canonical profiles. */
737
+ producer?: ShardProducer;
738
+ /** @deprecated Legacy producer release field. */
739
+ matric_version?: string;
675
740
  format: typeof SHARD_FORMAT;
676
741
  created_at: string;
677
742
  components: ShardComponent[];
@@ -685,6 +750,11 @@ interface ShardManifest {
685
750
  }
686
751
  /** Options for shard export. */
687
752
  interface ExportOptions {
753
+ /**
754
+ * Explicit portability profile. Only profiles advertised by the selected
755
+ * producer are accepted. Omit to retain the legacy unprofiled React archive.
756
+ */
757
+ profile?: string;
688
758
  includeEmbeddings?: boolean;
689
759
  /** Filter to specific collection (export only notes in this collection). */
690
760
  collectionId?: string;
@@ -728,9 +798,10 @@ interface ImportOptions {
728
798
  /**
729
799
  * Destination for hydrating attachment bytes from a portable `blobs/<hex>`
730
800
  * 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).
801
+ * hex matches an imported attachment's `content_hash` are promoted before
802
+ * the logical transaction. A transaction failure removes only bytes that
803
+ * were absent before promotion. Stores without the optional `delete`
804
+ * capability fail before promotion. Absent → reference-only metadata.
734
805
  */
735
806
  blobStore?: BlobStore;
736
807
  /**
@@ -783,6 +854,13 @@ interface ImportResult {
783
854
  warnings: string[];
784
855
  errors: string[];
785
856
  duration_ms: number;
857
+ capability_report: ShardCapabilityReport;
858
+ }
859
+ interface ShardExportResult {
860
+ success: boolean;
861
+ archive: Uint8Array | null;
862
+ errors: string[];
863
+ capability_report: ShardCapabilityReport;
786
864
  }
787
865
  /** Note as serialized in the shard JSONL. */
788
866
  interface ShardNote {
@@ -802,7 +880,8 @@ interface ShardNote {
802
880
  tags: string[];
803
881
  created_at: string;
804
882
  updated_at: string;
805
- deleted_at: string | null;
883
+ /** Schema 1.1 core-v1 tombstone; legacy unprofiled archives also carry it. */
884
+ deleted_at?: string | null;
806
885
  }
807
886
  /** Collection as serialized in the shard JSON array. */
808
887
  interface ShardCollection {
@@ -811,6 +890,9 @@ interface ShardCollection {
811
890
  description: string | null;
812
891
  parent_id: string | null;
813
892
  created_at: string;
893
+ /** Legacy unprofiled fields; outside core-v1. */
894
+ updated_at?: string;
895
+ deleted_at?: string | null;
814
896
  note_count?: number;
815
897
  }
816
898
  /** Tag as serialized in the shard JSON array. */
@@ -975,84 +1057,16 @@ interface ShardArtifactFreshness {
975
1057
  };
976
1058
  }
977
1059
 
978
- /**
979
- * LinksRepository — bidirectional note link management.
980
- *
981
- * Responsibilities:
982
- * - Create typed links between notes with duplicate prevention
983
- * - Soft-delete links
984
- * - Query outbound, inbound, and backlinks for a note
985
- */
986
-
987
- interface LinkRow {
988
- id: string;
989
- source_note_id: string;
990
- target_note_id: string;
991
- link_type: string;
992
- confidence: number | null;
993
- created_at: Date;
994
- updated_at: Date | null;
995
- deleted_at: Date | null;
996
- }
997
- declare class LinksRepository {
998
- private db;
999
- constructor(db: DatabaseClient);
1000
- create(sourceNoteId: string, targetNoteId: string, linkType?: string): Promise<LinkRow>;
1001
- get(id: string): Promise<LinkRow>;
1002
- listForNote(noteId: string): Promise<{
1003
- outbound: LinkRow[];
1004
- inbound: LinkRow[];
1005
- }>;
1006
- getBacklinks(noteId: string): Promise<string[]>;
1007
- delete(id: string): Promise<void>;
1008
- }
1009
-
1010
- /**
1011
- * CollectionsRepository — folder/category management for notes.
1012
- *
1013
- * Responsibilities:
1014
- * - Create, read, update, and soft-delete collections
1015
- * - Prevent circular parent references
1016
- * - Assign and unassign notes from collections
1017
- * - Return flat list and shallow tree views
1018
- */
1019
-
1020
- interface CollectionRow {
1021
- id: string;
1022
- name: string;
1023
- description: string | null;
1024
- parent_id: string | null;
1025
- position: number;
1026
- created_at: Date;
1027
- updated_at: Date;
1028
- deleted_at: Date | null;
1029
- }
1030
- interface CollectionCreateInput {
1031
- name: string;
1032
- description?: string;
1033
- parent_id?: string;
1034
- }
1035
- declare class CollectionsRepository {
1036
- private db;
1037
- constructor(db: DatabaseClient);
1038
- create(input: CollectionCreateInput): Promise<CollectionRow>;
1039
- get(id: string): Promise<CollectionRow>;
1040
- list(): Promise<CollectionRow[]>;
1041
- listTree(): Promise<Array<CollectionRow & {
1042
- children: CollectionRow[];
1043
- }>>;
1044
- update(id: string, fields: Partial<Pick<CollectionRow, 'name' | 'description' | 'parent_id' | 'position'>>): Promise<CollectionRow>;
1045
- delete(id: string): Promise<void>;
1046
- assignNote(collectionId: string, noteId: string): Promise<void>;
1047
- unassignNote(collectionId: string, noteId: string): Promise<void>;
1048
- getNotesInCollection(collectionId: string): Promise<string[]>;
1049
- }
1050
-
1051
1060
  /**
1052
1061
  * Field mapper — converts between browser schema and shard (server) schema.
1053
1062
  *
1054
1063
  * The browser uses different field names than the server shard format.
1055
1064
  * This module handles all rename transforms bidirectionally.
1065
+ *
1066
+ * @implements @.aiwg/adrs/ADR-011-shard-server-conformance-and-version-negotiation.md
1067
+ * @schema @packages/core/schemas/knowledge-shard.schema.receipt.json
1068
+ * @created 2026-07-17
1069
+ * @agent Codex
1056
1070
  */
1057
1071
 
1058
1072
  /** Browser-format note row from the export query (denormalized). */
@@ -1077,8 +1091,17 @@ interface BrowserNoteExport {
1077
1091
  declare function noteToShard(note: BrowserNoteExport): ShardNote;
1078
1092
  /** Convert a shard note back to browser-insertable format. */
1079
1093
  declare function noteFromShard(shard: ShardNote): BrowserNoteExport;
1080
- /** Convert a browser link to shard format. */
1081
- declare function linkToShard(link: LinkRow): ShardLink;
1094
+ /** Convert a browser link to shard format (accepts SQL rows or canonical ISO-string records). */
1095
+ declare function linkToShard(link: {
1096
+ id: string;
1097
+ source_note_id: string;
1098
+ target_note_id: string;
1099
+ link_type: string;
1100
+ confidence: number | null;
1101
+ created_at: Date | string;
1102
+ updated_at?: Date | string | null;
1103
+ deleted_at?: Date | string | null;
1104
+ }): ShardLink;
1082
1105
  /** Convert a browser URL-target link row to shard format. */
1083
1106
  declare function urlLinkToShard(link: {
1084
1107
  id: string;
@@ -1088,6 +1111,8 @@ declare function urlLinkToShard(link: {
1088
1111
  confidence: number | null;
1089
1112
  metadata_json?: Record<string, unknown> | string | null;
1090
1113
  created_at: Date | string;
1114
+ updated_at?: Date | string | null;
1115
+ deleted_at?: Date | string | null;
1091
1116
  }): ShardLink;
1092
1117
  /** Convert a shard link back to browser-insertable format. */
1093
1118
  declare function linkFromShard(shard: ShardLink): {
@@ -1098,10 +1123,20 @@ declare function linkFromShard(shard: ShardLink): {
1098
1123
  link_type: string;
1099
1124
  confidence: number | null;
1100
1125
  created_at: string;
1126
+ updated_at: string | null;
1127
+ deleted_at: string | null;
1101
1128
  metadata: Record<string, unknown> | null;
1102
1129
  };
1103
- /** Convert a browser collection to shard format. */
1104
- declare function collectionToShard(collection: CollectionRow, noteCount?: number): ShardCollection;
1130
+ /** Convert a browser collection to shard format (accepts SQL rows or canonical ISO-string records). */
1131
+ declare function collectionToShard(collection: {
1132
+ id: string;
1133
+ name: string;
1134
+ description: string | null;
1135
+ parent_id: string | null;
1136
+ created_at: Date | string;
1137
+ updated_at?: Date | string;
1138
+ deleted_at?: Date | string | null;
1139
+ }, noteCount?: number): ShardCollection;
1105
1140
  /** Convert a shard collection back to browser-insertable format. */
1106
1141
  declare function collectionFromShard(shard: ShardCollection): {
1107
1142
  id: string;
@@ -1109,6 +1144,8 @@ declare function collectionFromShard(shard: ShardCollection): {
1109
1144
  description: string | null;
1110
1145
  parent_id: string | null;
1111
1146
  created_at: string;
1147
+ updated_at: string;
1148
+ deleted_at: string | null;
1112
1149
  };
1113
1150
  /**
1114
1151
  * Convert SKOS concepts + note_tag associations into shard flat tag format.
@@ -2714,6 +2751,79 @@ declare class TagsRepository {
2714
2751
  }>>;
2715
2752
  }
2716
2753
 
2754
+ /**
2755
+ * CollectionsRepository — folder/category management for notes.
2756
+ *
2757
+ * Responsibilities:
2758
+ * - Create, read, update, and soft-delete collections
2759
+ * - Prevent circular parent references
2760
+ * - Assign and unassign notes from collections
2761
+ * - Return flat list and shallow tree views
2762
+ */
2763
+
2764
+ interface CollectionRow {
2765
+ id: string;
2766
+ name: string;
2767
+ description: string | null;
2768
+ parent_id: string | null;
2769
+ position: number;
2770
+ created_at: Date;
2771
+ updated_at: Date;
2772
+ deleted_at: Date | null;
2773
+ }
2774
+ interface CollectionCreateInput {
2775
+ name: string;
2776
+ description?: string;
2777
+ parent_id?: string;
2778
+ }
2779
+ declare class CollectionsRepository {
2780
+ private db;
2781
+ constructor(db: DatabaseClient);
2782
+ create(input: CollectionCreateInput): Promise<CollectionRow>;
2783
+ get(id: string): Promise<CollectionRow>;
2784
+ list(): Promise<CollectionRow[]>;
2785
+ listTree(): Promise<Array<CollectionRow & {
2786
+ children: CollectionRow[];
2787
+ }>>;
2788
+ update(id: string, fields: Partial<Pick<CollectionRow, 'name' | 'description' | 'parent_id' | 'position'>>): Promise<CollectionRow>;
2789
+ delete(id: string): Promise<void>;
2790
+ assignNote(collectionId: string, noteId: string): Promise<void>;
2791
+ unassignNote(collectionId: string, noteId: string): Promise<void>;
2792
+ getNotesInCollection(collectionId: string): Promise<string[]>;
2793
+ }
2794
+
2795
+ /**
2796
+ * LinksRepository — bidirectional note link management.
2797
+ *
2798
+ * Responsibilities:
2799
+ * - Create typed links between notes with duplicate prevention
2800
+ * - Soft-delete links
2801
+ * - Query outbound, inbound, and backlinks for a note
2802
+ */
2803
+
2804
+ interface LinkRow {
2805
+ id: string;
2806
+ source_note_id: string;
2807
+ target_note_id: string;
2808
+ link_type: string;
2809
+ confidence: number | null;
2810
+ created_at: Date;
2811
+ updated_at: Date | null;
2812
+ deleted_at: Date | null;
2813
+ }
2814
+ declare class LinksRepository {
2815
+ private db;
2816
+ constructor(db: DatabaseClient);
2817
+ create(sourceNoteId: string, targetNoteId: string, linkType?: string): Promise<LinkRow>;
2818
+ get(id: string): Promise<LinkRow>;
2819
+ listForNote(noteId: string): Promise<{
2820
+ outbound: LinkRow[];
2821
+ inbound: LinkRow[];
2822
+ }>;
2823
+ getBacklinks(noteId: string): Promise<string[]>;
2824
+ delete(id: string): Promise<void>;
2825
+ }
2826
+
2717
2827
  /**
2718
2828
  * SkosRepository — SKOS taxonomy management (schemes, concepts, relations).
2719
2829
  *
@@ -4091,6 +4201,28 @@ declare function appendPluginScript(descriptor: PluginScriptDescriptor, policy:
4091
4201
  declare function parseCspReport(body: unknown): CspViolationReport;
4092
4202
  declare function createCspReportHandler(onReport: (report: CspViolationReport) => void | Promise<void>): (request: Request) => Promise<Response>;
4093
4203
 
4204
+ /**
4205
+ * Knowledge Shard portability profiles derived from the pinned Fortemi receipt.
4206
+ *
4207
+ * @implements @.aiwg/adrs/ADR-011-shard-server-conformance-and-version-negotiation.md
4208
+ * @schema @packages/core/schemas/knowledge-shard/upstream-contract.json
4209
+ * @created 2026-07-17
4210
+ * @agent Codex
4211
+ */
4212
+
4213
+ declare const CORE_V1_COMPONENTS: readonly ["notes", "collections", "tags", "templates", "links"];
4214
+ declare function getKnowledgeShardProfileRegistry(): ShardProfileRegistryEntry[];
4215
+ interface CreateShardCapabilityReportInput {
4216
+ backend: ShardBackend;
4217
+ operation: ShardOperation;
4218
+ requestedProfile: string | null;
4219
+ declaredComponents?: readonly ShardComponent[];
4220
+ omittedComponents?: readonly ShardComponent[];
4221
+ losses?: readonly ShardLossEntry[];
4222
+ }
4223
+ declare function createShardCapabilityReport(input: CreateShardCapabilityReportInput): ShardCapabilityReport;
4224
+ declare function profileSupportError(report: ShardCapabilityReport): string | null;
4225
+
4094
4226
  /**
4095
4227
  * Minimal tar + gzip packing/unpacking for shard archives.
4096
4228
  *
@@ -4161,8 +4293,17 @@ declare function validateChecksums(checksums: Record<string, string>, files: Map
4161
4293
  * Shard export pipeline — query all entities, serialize, pack into .shard archive.
4162
4294
  *
4163
4295
  * Pipeline: query DB → field-map → serialize (JSONL/JSON) → compute checksums → build manifest → tar.gz
4296
+ *
4297
+ * @implements @.aiwg/adrs/ADR-011-shard-server-conformance-and-version-negotiation.md
4298
+ * @depends @packages/core/src/shard/profile-registry.ts
4299
+ * @schema @packages/core/schemas/knowledge-shard.schema.receipt.json
4300
+ * @created 2026-07-17
4301
+ * @agent Codex
4164
4302
  */
4165
4303
 
4304
+ declare function exportShardWithReport(db: DatabaseClient, options: ExportOptions & {
4305
+ profile: string;
4306
+ }): Promise<ShardExportResult>;
4166
4307
  /**
4167
4308
  * Export knowledge data from the database as a .shard archive (Uint8Array).
4168
4309
  *
@@ -4177,6 +4318,11 @@ declare function exportShard(db: DatabaseClient, options?: ExportOptions): Promi
4177
4318
  *
4178
4319
  * Pipeline: ArrayBuffer → gunzip → untar → parse manifest → validate checksums →
4179
4320
  * parse components → field-map → BEGIN transaction → INSERT all → COMMIT
4321
+ *
4322
+ * @implements @.aiwg/adrs/ADR-011-shard-server-conformance-and-version-negotiation.md
4323
+ * @depends @packages/core/src/shard/schema-validator.ts
4324
+ * @created 2026-07-17
4325
+ * @agent Codex
4180
4326
  */
4181
4327
 
4182
4328
  /**
@@ -4197,11 +4343,16 @@ interface ShardSchemaValidationResult {
4197
4343
  errors: string[];
4198
4344
  }
4199
4345
  type ShardFiles = Map<string, Uint8Array>;
4346
+ type CoreV1SchemaVersion = '1.0.0' | '1.1.0' | '1.2.0';
4200
4347
  declare function getKnowledgeShardSchema(): unknown;
4348
+ declare function getKnowledgeShardContractReceipt(): unknown;
4201
4349
  declare function validateShardManifest(value: unknown): ShardSchemaValidationResult;
4202
4350
  declare function validateShardArchive(input: Uint8Array | ArrayBuffer | ShardFiles): ShardSchemaValidationResult;
4203
- declare function validateShardComponentRecord(component: ShardComponent | 'templates', value: unknown): ShardSchemaValidationResult;
4204
- declare function assertShardComponentRecord(component: ShardComponent | 'templates', value: unknown): void;
4351
+ declare function validateCoreV1ShardArchive(input: Uint8Array | ArrayBuffer | ShardFiles): Promise<ShardSchemaValidationResult>;
4352
+ declare function validateRecordV1ShardArchive(input: Uint8Array | ArrayBuffer | ShardFiles): Promise<ShardSchemaValidationResult>;
4353
+ declare function validateFullV1ShardArchive(input: Uint8Array | ArrayBuffer | ShardFiles): Promise<ShardSchemaValidationResult>;
4354
+ declare function validateShardComponentRecord(component: ShardComponent | 'templates', value: unknown, profile?: 'core-v1' | 'record-v1' | 'full-v1', version?: CoreV1SchemaVersion): ShardSchemaValidationResult;
4355
+ declare function assertShardComponentRecord(component: ShardComponent | 'templates', value: unknown, profile?: 'core-v1' | 'record-v1' | 'full-v1', version?: CoreV1SchemaVersion): void;
4205
4356
 
4206
4357
  /**
4207
4358
  * Pluggable semantic providers for the in-place shard reader (issue #189).
@@ -4549,9 +4700,8 @@ interface AiwgKnowledgeShardOptions {
4549
4700
  createdAt?: string;
4550
4701
  matricVersion?: string;
4551
4702
  /**
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.
4703
+ * Reserved for a future full-v1 converter. Passing true currently fails
4704
+ * closed because a partial rich-component inventory is not a valid profile.
4555
4705
  */
4556
4706
  includeNativeRichComponents?: boolean;
4557
4707
  }
@@ -4891,7 +5041,7 @@ interface NoteOriginalRecord {
4891
5041
  interface NoteRevisedCurrentRecord {
4892
5042
  /** Keyed by note id (mirrors the SQL PK `note_id`). */
4893
5043
  id: string;
4894
- content: string;
5044
+ content: string | null;
4895
5045
  ai_metadata: unknown | null;
4896
5046
  generation_count: number;
4897
5047
  model: string | null;
@@ -4983,6 +5133,8 @@ interface JournalEntry {
4983
5133
  interface RecordStoreCapabilities {
4984
5134
  crud: true;
4985
5135
  journal: true;
5136
+ /** Multi-collection record and journal mutations commit atomically. */
5137
+ atomicBatch?: true;
4986
5138
  /** Bounded substring scan over titles/content — not ranked FTS. */
4987
5139
  boundedTextScan: true;
4988
5140
  fullTextSearch: false;
@@ -4994,6 +5146,17 @@ interface RecordListOptions {
4994
5146
  /** Maximum records returned (applied after filtering). */
4995
5147
  limit?: number;
4996
5148
  }
5149
+ type RecordMutation = {
5150
+ [C in RecordCollectionName]: {
5151
+ op: 'put';
5152
+ collection: C;
5153
+ record: RecordCollections[C];
5154
+ };
5155
+ }[RecordCollectionName] | {
5156
+ op: 'delete';
5157
+ collection: RecordCollectionName;
5158
+ id: string;
5159
+ };
4997
5160
  /**
4998
5161
  * The writable canonical structured-record store. Implementations MUST make
4999
5162
  * each `put`/`remove` an atomic commit of the record mutation plus its
@@ -5006,6 +5169,11 @@ interface RecordStore {
5006
5169
  put<C extends RecordCollectionName>(collection: C, record: RecordCollections[C]): Promise<JournalEntry>;
5007
5170
  /** Hard-remove one record, journaled atomically (soft-delete is a field upstream). */
5008
5171
  remove(collection: RecordCollectionName, id: string): Promise<JournalEntry>;
5172
+ /**
5173
+ * Commit all record mutations and their journal entries as one transaction.
5174
+ * An error leaves both record state and the journal unchanged.
5175
+ */
5176
+ applyBatch?(mutations: readonly RecordMutation[]): Promise<JournalEntry[]>;
5009
5177
  /** All records of a collection (insertion order not guaranteed). */
5010
5178
  list<C extends RecordCollectionName>(collection: C, opts?: RecordListOptions): Promise<RecordCollections[C][]>;
5011
5179
  /** Journal entries with `seq > sinceSeq`, ascending. */
@@ -5030,6 +5198,7 @@ declare class MemoryRecordStore implements RecordStore {
5030
5198
  get<C extends RecordCollectionName>(collection: C, id: string): Promise<RecordCollections[C] | null>;
5031
5199
  put<C extends RecordCollectionName>(collection: C, record: RecordCollections[C]): Promise<JournalEntry>;
5032
5200
  remove(collection: RecordCollectionName, id: string): Promise<JournalEntry>;
5201
+ applyBatch(mutations: readonly RecordMutation[]): Promise<JournalEntry[]>;
5033
5202
  list<C extends RecordCollectionName>(collection: C, opts?: RecordListOptions): Promise<RecordCollections[C][]>;
5034
5203
  journalSince(sinceSeq: number, limit?: number): Promise<JournalEntry[]>;
5035
5204
  headSeq(): Promise<number>;
@@ -5069,6 +5238,7 @@ declare class IdbRecordStore implements RecordStore {
5069
5238
  get<C extends RecordCollectionName>(collection: C, id: string): Promise<RecordCollections[C] | null>;
5070
5239
  put<C extends RecordCollectionName>(collection: C, record: RecordCollections[C]): Promise<JournalEntry>;
5071
5240
  remove(collection: RecordCollectionName, id: string): Promise<JournalEntry>;
5241
+ applyBatch(mutations: readonly RecordMutation[]): Promise<JournalEntry[]>;
5072
5242
  list<C extends RecordCollectionName>(collection: C, opts?: RecordListOptions): Promise<RecordCollections[C][]>;
5073
5243
  journalSince(sinceSeq: number, limit?: number): Promise<JournalEntry[]>;
5074
5244
  headSeq(): Promise<number>;
@@ -5099,6 +5269,8 @@ interface CanonicalNoteCreateInput {
5099
5269
  interface CanonicalNoteUpdateInput {
5100
5270
  title?: string;
5101
5271
  content?: string;
5272
+ format?: string;
5273
+ visibility?: string;
5102
5274
  is_starred?: boolean;
5103
5275
  is_pinned?: boolean;
5104
5276
  is_archived?: boolean;
@@ -5214,6 +5386,140 @@ declare function projectAttachments(db: DatabaseClient, store: RecordStore): Pro
5214
5386
  */
5215
5387
  declare function dropAttachmentProjection(db: DatabaseClient): Promise<void>;
5216
5388
 
5217
- declare const VERSION = "2026.7.7";
5389
+ /**
5390
+ * PGlite record projection — notes tier (#323 cycle 2, ADR-013 D3).
5391
+ *
5392
+ * Projects canonical note / tag / link / collection state (RecordStore) into
5393
+ * the optional PGlite tables, completing the projection the attachment tier
5394
+ * (#320, attachment-projection.ts) deferred to this cycle. Properties:
5395
+ *
5396
+ * - Idempotent: rows upsert on their primary keys; re-running with the same
5397
+ * canonical state changes nothing.
5398
+ * - Rebuildable: dropping the projection rows and re-projecting yields
5399
+ * equivalent query results — canonical records are the source of truth.
5400
+ * - Reconciling: canonically hard-removed rows (note_tag, collection_note)
5401
+ * are deleted from the projection so parity holds after removals, not just
5402
+ * after inserts.
5403
+ * - Bytes never enter PGlite; `projectRecords` composes this pass with the
5404
+ * attachment projection for a full canonical → PGlite rebuild.
5405
+ */
5406
+
5407
+ interface NoteProjectionResult {
5408
+ notes: number;
5409
+ tags: number;
5410
+ links: number;
5411
+ collections: number;
5412
+ memberships: number;
5413
+ }
5414
+ interface RecordProjectionResult extends NoteProjectionResult {
5415
+ attachments: AttachmentProjectionResult;
5416
+ }
5417
+ /**
5418
+ * Project all canonical note-tier records into PGlite. Safe to run at any
5419
+ * time: startup, after journal consumption, or as a full rebuild after the
5420
+ * projection was dropped. Parent rows land before children (note before
5421
+ * note_original / tags / links / memberships) so FKs hold.
5422
+ */
5423
+ declare function projectNotes(db: DatabaseClient, store: RecordStore): Promise<NoteProjectionResult>;
5424
+ /**
5425
+ * Full canonical → PGlite projection: note tier, then attachment tier
5426
+ * (parents before children). This is the "PGlite is a derived, rebuildable
5427
+ * projection" invariant (#322 acceptance) made executable.
5428
+ */
5429
+ declare function projectRecords(db: DatabaseClient, store: RecordStore): Promise<RecordProjectionResult>;
5430
+ /**
5431
+ * Drop the note-tier projection rows (test/rebuild support). Canonical
5432
+ * records are untouched. Callers must drop dependent projections first
5433
+ * (attachments via `dropAttachmentProjection`, plus any embedding/SKOS rows
5434
+ * created outside the canonical tier) so FKs allow the deletes.
5435
+ */
5436
+ declare function dropNoteProjection(db: DatabaseClient): Promise<void>;
5437
+
5438
+ /**
5439
+ * Writable non-PGlite `DataBackend` over the canonical RecordStore
5440
+ * (#323 cycle 2, ADR-013 D3) — the record tier in the backend seam.
5441
+ *
5442
+ * Fills the seam's historical gap: the static shard backend is read-only and
5443
+ * the PGlite backend needs a database. This adapter serves the canonical
5444
+ * repositories' full write surface plus the bounded read tier (id / recent /
5445
+ * tag / link lookups and a bounded substring scan) with instant startup.
5446
+ *
5447
+ * Capability boundary, reported honestly: `semantic: 'none'` (no vectors) and
5448
+ * search is a bounded scan, not ranked FTS. SKOS concepts and provenance
5449
+ * edges are not part of the canonical record collections, so `conceptsOf` /
5450
+ * `provenanceOf` are deliberately absent — callers feature-detect via the
5451
+ * optional methods rather than receiving silently empty emulations.
5452
+ * `merge: true` is served by `importShardToRecords` (record-shard.ts).
5453
+ */
5454
+
5455
+ interface RecordBackendOptions {
5456
+ id?: string;
5457
+ }
5458
+ interface RecordBackendManageNoteResult {
5459
+ action: string;
5460
+ note_id: string;
5461
+ note?: CanonicalNoteView;
5462
+ }
5463
+ /**
5464
+ * Wrap a canonical `RecordStore` as a writable `DataBackend`. Reads and
5465
+ * writes delegate to `CanonicalNotesRepository`; `manageNote` accepts the
5466
+ * same Zod-validated input as the PGlite tool (update / delete / restore /
5467
+ * archive / unarchive / star / unstar).
5468
+ */
5469
+ declare function createRecordBackend(store: RecordStore, options?: RecordBackendOptions): DataBackend;
5470
+
5471
+ /**
5472
+ * DB-free Knowledge Shard export/import over the canonical RecordStore
5473
+ * (#323 cycle 2, ADR-013 D3/D6) — the same `.shard` archive format as the
5474
+ * PGlite pipeline (`shard/shard-export.ts` / `shard/shard-import.ts`), built
5475
+ * from and applied to canonical records with zero PGlite.
5476
+ *
5477
+ * Capability boundary (reported, never emulated): the canonical tier holds
5478
+ * notes, tags, note-to-note links, collections, and attachment manifests.
5479
+ * Shard components outside that set (templates, embeddings, SKOS, provenance,
5480
+ * graph/community artifacts, URL links) are skipped on import with explicit
5481
+ * warnings, and are never emitted on export.
5482
+ *
5483
+ * Atomicity: manifest, version, signature (ADR-014 verify-before-persist),
5484
+ * and checksum validation all run before mutation. Verified sidecar bytes are
5485
+ * promoted with rollback, then every record and journal mutation commits in
5486
+ * one multi-collection RecordStore batch.
5487
+ *
5488
+ * @implements @.aiwg/adrs/ADR-011-shard-server-conformance-and-version-negotiation.md
5489
+ * @depends @packages/core/src/shard/schema-validator.ts
5490
+ * @created 2026-07-17
5491
+ * @agent Codex
5492
+ */
5493
+
5494
+ declare function exportShardFromRecordsWithReport(store: RecordStore, options: ExportOptions & {
5495
+ profile: string;
5496
+ }): Promise<ShardExportResult>;
5497
+ /**
5498
+ * Export canonical records as a `.shard` archive (Uint8Array), format-parity
5499
+ * with the PGlite `exportShard`. Honored options: `collectionId` / `tag`
5500
+ * filters, `clusterNotesSize`, and the portable byte sidecar
5501
+ * (`includeBlobs` + `blobStore`). Embedding options are inert — the canonical
5502
+ * tier stores no embeddings, so there is nothing to include.
5503
+ */
5504
+ declare function exportShardFromRecords(store: RecordStore, options?: ExportOptions): Promise<Uint8Array>;
5505
+ /**
5506
+ * Import a `.shard` archive into the canonical RecordStore (and optionally
5507
+ * hydrate attachment bytes into a Bytecask BlobStore) with zero PGlite.
5508
+ *
5509
+ * Honors `conflictStrategy` (`skip` default / `replace` / `error` — `error`
5510
+ * conflicts are pre-scanned so nothing is written), the ADR-014
5511
+ * `verifySignature`/`trustStore` policy, and byte-sidecar hydration via
5512
+ * `blobStore`. Components the canonical tier cannot persist are skipped with
5513
+ * explicit warnings and reported under `skipped`.
5514
+ */
5515
+ declare function importShardToRecords(store: RecordStore, data: Uint8Array | ArrayBuffer, options?: ImportOptions): Promise<ImportResult>;
5516
+
5517
+ /**
5518
+ * @implements @.aiwg/adrs/ADR-011-shard-server-conformance-and-version-negotiation.md
5519
+ * @source @packages/core/src/shard/schema-validator.ts
5520
+ * @created 2026-07-17
5521
+ * @agent Codex
5522
+ */
5523
+ declare const VERSION = "2026.7.9";
5218
5524
 
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 };
5525
+ 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, CORE_V1_COMPONENTS, 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, type KnowledgeShardProfile, 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 NoteProjectionResult, 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 RecordBackendManageNoteResult, type RecordBackendOptions, type RecordCollectionName, type RecordCollections, type RecordListOptions, type RecordMutation, type RecordProjectionResult, 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 ShardAuthorityStatus, type ShardBackend, type ShardBackendOptions, type ShardCapabilityReport, type ShardClusterRef, type ShardCollection, type ShardComponent, type ShardComponentStore, type ShardEmbedding, type ShardEmbeddingConfig, type ShardEmbeddingSet, type ShardEmbeddingSetMember, type ShardExportResult, type ShardLayout, type ShardLink, type ShardListOptions, type ShardLossEntry, type ShardManifest, type ShardNote, type ShardNoteFull, type ShardNoteSkosTag, type ShardOperation, type ShardProfileRegistryEntry, 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, createRecordBackend, createRecordStore, createRemoteBackend, createRoutes, createShardBackend, createShardCapabilityReport, createWorkerEmbedFunction, defaultStorageBackendFactory, detectCommunities, detectGpuCapabilities, detectInferenceCapabilities, discoverLocalProviders, dropAttachmentProjection, dropNoteProjection, dumpDbSnapshot, embeddingConfigToShard, embeddingFromShard, embeddingGenerationHandler, embeddingSetFromShard, embeddingSetMemberToShard, embeddingSetToShard, embeddingToShard, enqueueFullWorkflow, enqueueJob, enqueueNoteCreationJobs, estimateModelFit, estimateVramMB, estimateVramTier, exportShard, exportShardFromRecords, exportShardFromRecordsWithReport, exportShardWithReport, fetchAndValidateFortemiCompatibility, fetchPluginScript, filterAiwgRecordsByPrivacy, findAiwgStaticDuplicatePairs, formatFortemiCompatibilitySummary, fortemiCompatibilityUrl, fortemiManifest, fromPrefetched, generateId, getAiwgFortemiFacets, getEmbedFunction, getFortemiBridge, getFortemiSecretStore, getJobQueueStatus, getKnowledgeShardContractReceipt, getKnowledgeShardProfileRegistry, getKnowledgeShardSchema, getLlmFunction, getNote, getPrefetchedSha256, handleEmbedRequests, hasFortemiSecureSecrets, importShard, importShardToRecords, isPluginScriptAllowed, isShardPrefetched, isShardSigningSupported, linkFromShard, linkToShard, linkingHandler, listNotes, manageArchive, manageAttachments, manageCapabilities, manageCollections, manageLinks, manageNote, manageTags, matchRoute, migrateLegacyBlobStore, noteFromShard, noteSkosTagToShard, noteToShard, openShard, packTarGz, parseCspReport, prefetchShard, profileSupportError, projectAttachments, projectNotes, projectRecords, 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, validateCoreV1ShardArchive, validateFortemiCompatibilityResponse, validateFullV1ShardArchive, validateRecordV1ShardArchive, validateShardArchive, validateShardComponentRecord, validateShardManifest, verifyDbSnapshotMeta, verifyShardSignature, verifySri };