@fortemi/core 2026.7.14 → 2026.7.15

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
@@ -4,7 +4,6 @@ export { C as AIWG_SCAN_REQUIRED_FIELDS, D as AiwgChunkedIndexBuildOptions, F as
4
4
  import { z, ZodType } from 'zod';
5
5
  export { AiwgIndexSchemaValidationResult, getAiwgFortemiIndexExportSchema, validateAiwgFortemiIndexExportSchema, validateAiwgFortemiProjectedRecordSchema } from './aiwg-index-schema.js';
6
6
  import '@bytecask/core';
7
-
8
7
  /**
9
8
  * Generate a RFC 9562 UUIDv7 identifier.
10
9
  *
@@ -12,7 +11,6 @@ import '@bytecask/core';
12
11
  * time-sortable and monotonic within the same millisecond.
13
12
  */
14
13
  declare function generateId(): string;
15
-
16
14
  /**
17
15
  * Typed event bus with IDisposable subscriptions (Monaco-style).
18
16
  * SSE-style pub/sub across all layers.
@@ -57,11 +55,11 @@ interface EventMap {
57
55
  progress?: number;
58
56
  };
59
57
  'capability.required': {
60
- name: string;
61
58
  jobId: string;
59
+ message: string;
60
+ name: string;
62
61
  noteId: string;
63
62
  type: string;
64
- message: string;
65
63
  };
66
64
  'job.completed': {
67
65
  id: string;
@@ -69,17 +67,17 @@ interface EventMap {
69
67
  type: string;
70
68
  };
71
69
  'job.failed': {
70
+ error: string;
72
71
  id: string;
73
72
  noteId: string;
74
73
  type: string;
75
- error: string;
76
74
  };
77
75
  'job.blocked': {
76
+ capability: string;
78
77
  id: string;
78
+ message: string;
79
79
  noteId: string;
80
80
  type: string;
81
- capability: string;
82
- message: string;
83
81
  };
84
82
  'archive.switched': {
85
83
  name: string;
@@ -99,16 +97,16 @@ interface EventMap {
99
97
  name: string;
100
98
  };
101
99
  'provider.fallback': {
100
+ error: string;
101
+ errorCategory: string;
102
102
  fromProvider: string;
103
103
  toProvider: string;
104
- errorCategory: string;
105
- error: string;
106
104
  };
107
105
  'provider.cooldown': {
108
- providerId: string;
109
- errorCategory: string;
110
106
  cooldownMs: number;
107
+ errorCategory: string;
111
108
  expiresAt: number;
109
+ providerId: string;
112
110
  };
113
111
  }
114
112
  type EventHandler<T> = (payload: T) => void;
@@ -126,7 +124,6 @@ declare class TypedEventBus {
126
124
  bridge(port: MessagePort): IDisposable;
127
125
  removeAllListeners(): void;
128
126
  }
129
-
130
127
  /**
131
128
  * PGlite database factory.
132
129
  * Enforces PGlite 0.4.x conventions (explicit database: 'postgres').
@@ -138,8 +135,7 @@ declare class TypedEventBus {
138
135
  * PGlite-backed store therefore do not pull the WASM engine into their bundle,
139
136
  * and `@electric-sql/pglite` is an OPTIONAL dependency of `@fortemi/core`.
140
137
  */
141
-
142
- type PersistenceMode = 'opfs' | 'idb' | 'memory';
138
+ type PersistenceMode = 'idb' | 'memory' | 'opfs';
143
139
  interface CreatePGliteOptions {
144
140
  /**
145
141
  * Restore the instance from a physical data-dir snapshot (issue #187) — schema
@@ -150,7 +146,6 @@ interface CreatePGliteOptions {
150
146
  loadDataDir?: Blob | File;
151
147
  }
152
148
  declare function createPGliteInstance(persistence: PersistenceMode, archiveName?: string, options?: CreatePGliteOptions): Promise<PGlite>;
153
-
154
149
  /**
155
150
  * Physical data-dir snapshot (issue #187).
156
151
  *
@@ -171,7 +166,6 @@ declare function createPGliteInstance(persistence: PersistenceMode, archiveName?
171
166
  * verifies compatibility BEFORE loading and fails fast (`DbSnapshotVersionError`) on
172
167
  * mismatch, so a host can fall back to a shard import.
173
168
  */
174
-
175
169
  /** Snapshot meta envelope schema. */
176
170
  declare const DB_SNAPSHOT_SCHEMA_VERSION: "fortemi.db-snapshot.v1";
177
171
  /**
@@ -182,13 +176,13 @@ declare const DB_SNAPSHOT_SCHEMA_VERSION: "fortemi.db-snapshot.v1";
182
176
  declare const SUPPORTED_PGLITE_VERSION = "0.4.1";
183
177
  /** Schema-migration head this build expects a restored snapshot to carry. */
184
178
  declare const CURRENT_MIGRATION_HEAD: number;
185
- type DbSnapshotCompression = 'none' | 'gzip' | 'auto';
179
+ type DbSnapshotCompression = 'auto' | 'gzip' | 'none';
186
180
  interface DbSnapshotMeta {
187
181
  schema_version: typeof DB_SNAPSHOT_SCHEMA_VERSION;
188
182
  /** PGlite version the data dir was dumped from (data-dir format coupling). */
189
183
  pglite_version: string;
190
184
  /** pgvector extension version at dump time (advisory). */
191
- pgvector_version: string | null;
185
+ pgvector_version: null | string;
192
186
  /** Max applied migration version at dump time (schema coupling). */
193
187
  migration_head: number;
194
188
  /** ISO-8601 dump time. */
@@ -229,7 +223,7 @@ interface DbSnapshotExpectations {
229
223
  migrationHead?: number;
230
224
  pgliteVersion?: string;
231
225
  /** When provided, a differing snapshot pgvector version is a warning, not a failure. */
232
- pgvectorVersion?: string | null;
226
+ pgvectorVersion?: null | string;
233
227
  }
234
228
  interface DbSnapshotCompat {
235
229
  compatible: boolean;
@@ -250,10 +244,10 @@ declare class DbSnapshotVersionError extends Error {
250
244
  readonly meta: DbSnapshotMeta;
251
245
  constructor(reasons: string[], meta: DbSnapshotMeta);
252
246
  }
253
- type DbSnapshotSource = DbSnapshot | string | {
247
+ type DbSnapshotSource = {
254
248
  dataUrl: string;
255
249
  metaUrl?: string;
256
- };
250
+ } | DbSnapshot | string;
257
251
  interface RestoreDbSnapshotOptions {
258
252
  /** Persistence for the restored instance. Defaults to 'memory' (read-only demos). */
259
253
  persistence?: PersistenceMode;
@@ -270,7 +264,6 @@ interface RestoreDbSnapshotOptions {
270
264
  * import). The returned instance is ready to query; do NOT run migrations on it.
271
265
  */
272
266
  declare function restoreDbSnapshot(source: DbSnapshotSource, options?: RestoreDbSnapshotOptions): Promise<PGlite>;
273
-
274
267
  /**
275
268
  * Type-safe client for the PGlite Worker.
276
269
  *
@@ -293,11 +286,11 @@ declare class PGliteWorkerClient {
293
286
  waitReady(): Promise<void>;
294
287
  private send;
295
288
  query<T = Record<string, unknown>>(sql: string, params?: unknown[]): Promise<{
296
- rows: T[];
297
289
  fields?: Array<{
298
- name: string;
299
290
  dataTypeID: number;
291
+ name: string;
300
292
  }>;
293
+ rows: T[];
301
294
  }>;
302
295
  exec(sql: string): Promise<void>;
303
296
  transaction<T>(fn: (tx: TransactionProxy) => Promise<T>): Promise<T>;
@@ -320,12 +313,11 @@ declare class TransactionProxy {
320
313
  }>;
321
314
  exec(sql: string): Promise<void>;
322
315
  }
323
-
324
316
  interface QueryResult<T = Record<string, unknown>> {
325
317
  rows: T[];
326
318
  fields?: Array<{
327
- name: string;
328
319
  dataTypeID: number;
320
+ name: string;
329
321
  }>;
330
322
  }
331
323
  interface QueryExecutor {
@@ -337,7 +329,7 @@ interface DatabaseClient extends QueryExecutor {
337
329
  }
338
330
  interface StorageBackend extends DatabaseClient {
339
331
  readonly id: string;
340
- readonly mode: 'readwrite' | 'readonly';
332
+ readonly mode: 'readonly' | 'readwrite';
341
333
  close(): Promise<void>;
342
334
  }
343
335
  interface StorageOpenRequest {
@@ -350,7 +342,7 @@ interface StorageBackendFactory {
350
342
  interface StorageTopology {
351
343
  primary: StorageBackend;
352
344
  secondary?: StorageBackend;
353
- policy: 'primary-only' | 'read-through-secondary' | 'explicit-replication';
345
+ policy: 'explicit-replication' | 'primary-only' | 'read-through-secondary';
354
346
  }
355
347
  declare class PGliteStorageBackend implements StorageBackend {
356
348
  readonly id: string;
@@ -391,7 +383,6 @@ declare class PGliteWorkerStorageBackendFactory implements StorageBackendFactory
391
383
  constructor(options: PGliteWorkerStorageBackendFactoryOptions);
392
384
  open(input: StorageOpenRequest): Promise<StorageBackend>;
393
385
  }
394
-
395
386
  /**
396
387
  * Field mapper — converts between browser schema and shard (server) schema.
397
388
  *
@@ -403,22 +394,21 @@ declare class PGliteWorkerStorageBackendFactory implements StorageBackendFactory
403
394
  * @created 2026-07-17
404
395
  * @agent Codex
405
396
  */
406
-
407
397
  /** Browser-format note row from the export query (denormalized). */
408
398
  interface BrowserNoteExport {
409
399
  id: string;
410
- title: string | null;
400
+ title: null | string;
411
401
  format: string;
412
402
  source: string;
413
403
  is_starred: boolean;
414
404
  is_archived: boolean;
415
405
  created_at: Date | string;
416
406
  updated_at: Date | string;
417
- deleted_at: Date | string | null;
407
+ deleted_at: Date | null | string;
418
408
  original_content: string;
419
- revised_content: string | null;
409
+ revised_content: null | string;
420
410
  ai_metadata?: unknown;
421
- collection_id?: string | null;
411
+ collection_id?: null | string;
422
412
  attachments?: ShardAttachmentProjection[];
423
413
  tags: string[];
424
414
  }
@@ -428,201 +418,200 @@ declare function noteToShard(note: BrowserNoteExport): ShardNote;
428
418
  declare function noteFromShard(shard: ShardNote): BrowserNoteExport;
429
419
  /** Convert a browser link to shard format (accepts SQL rows or canonical ISO-string records). */
430
420
  declare function linkToShard(link: {
421
+ confidence: null | number;
422
+ created_at: Date | string;
423
+ deleted_at?: Date | null | string;
431
424
  id: string;
425
+ link_type: string;
432
426
  source_note_id: string;
433
427
  target_note_id: string;
434
- link_type: string;
435
- confidence: number | null;
436
- created_at: Date | string;
437
- updated_at?: Date | string | null;
438
- deleted_at?: Date | string | null;
428
+ updated_at?: Date | null | string;
439
429
  }): ShardLink;
440
430
  /** Convert a browser URL-target link row to shard format. */
441
431
  declare function urlLinkToShard(link: {
432
+ confidence: null | number;
433
+ created_at: Date | string;
434
+ deleted_at?: Date | null | string;
442
435
  id: string;
436
+ link_type: string;
437
+ metadata_json?: null | Record<string, unknown> | string;
443
438
  source_note_id: string;
444
439
  to_url: string;
445
- link_type: string;
446
- confidence: number | null;
447
- metadata_json?: Record<string, unknown> | string | null;
448
- created_at: Date | string;
449
- updated_at?: Date | string | null;
450
- deleted_at?: Date | string | null;
440
+ updated_at?: Date | null | string;
451
441
  }): ShardLink;
452
442
  /** Convert a shard link back to browser-insertable format. */
453
443
  declare function linkFromShard(shard: ShardLink): {
444
+ confidence: null | number;
445
+ created_at: string;
446
+ deleted_at: null | string;
454
447
  id: string;
455
- source_note_id: string;
456
- target_note_id: string | null;
457
- to_url: string | null;
458
448
  link_type: string;
459
- confidence: number | null;
460
- created_at: string;
461
- updated_at: string | null;
462
- deleted_at: string | null;
463
449
  metadata: unknown;
450
+ source_note_id: string;
451
+ target_note_id: null | string;
452
+ to_url: null | string;
453
+ updated_at: null | string;
464
454
  };
465
455
  /** Convert a browser collection to shard format (accepts SQL rows or canonical ISO-string records). */
466
456
  declare function collectionToShard(collection: {
457
+ created_at: Date | string;
458
+ deleted_at?: Date | null | string;
459
+ description: null | string;
467
460
  id: string;
468
461
  name: string;
469
- description: string | null;
470
- parent_id: string | null;
471
- created_at: Date | string;
462
+ parent_id: null | string;
472
463
  updated_at?: Date | string;
473
- deleted_at?: Date | string | null;
474
464
  }, noteCount?: number): ShardCollection;
475
465
  /** Convert a shard collection back to browser-insertable format. */
476
466
  declare function collectionFromShard(shard: ShardCollection): {
467
+ created_at: string;
468
+ deleted_at: null | string;
469
+ description: null | string;
477
470
  id: string;
478
471
  name: string;
479
- description: string | null;
480
- parent_id: string | null;
481
- created_at: string;
472
+ parent_id: null | string;
482
473
  updated_at: string;
483
- deleted_at: string | null;
484
474
  };
485
475
  /**
486
476
  * Convert SKOS concepts + note_tag associations into shard flat tag format.
487
477
  * Shard tags are simple string arrays — deduplicated across all notes.
488
478
  */
489
479
  declare function tagsToShard(allTags: Array<{
490
- name: string;
491
480
  created_at: Date | string;
481
+ name: string;
492
482
  }>): ShardTag[];
493
483
  /** Convert a browser template row to shard format. */
494
484
  declare function templateToShard(template: {
495
- id: string;
496
- name: string;
497
- description: string | null;
485
+ collection_id: null | string;
498
486
  content: string;
499
- format: string;
500
- default_tags: string[] | string;
501
- collection_id: string | null;
502
487
  created_at: Date | string;
488
+ default_tags: string | string[];
489
+ description: null | string;
490
+ format: string;
491
+ id: string;
492
+ name: string;
503
493
  updated_at: Date | string;
504
494
  }): ShardTemplate;
505
495
  /** Convert a browser embedding_set to shard format. */
506
496
  declare function embeddingSetToShard(set: {
497
+ compatibility_json?: null | unknown;
498
+ created_at: Date | string;
499
+ criteria_json?: null | unknown;
500
+ description?: null | string;
501
+ dimensions: number;
502
+ document_count?: null | number;
503
+ embedding_count?: null | number;
504
+ freshness_json?: null | unknown;
507
505
  id: string;
508
- name?: string;
509
- slug?: string | null;
510
- description?: string | null;
511
- purpose?: string | null;
512
- document_count?: number | null;
513
- embedding_count?: number | null;
514
506
  is_system?: boolean | null;
515
- keywords_json?: unknown | null;
516
- model_name: string;
517
- dimensions: number;
518
- kind?: 'physical' | 'filter' | 'virtual';
507
+ keywords_json?: null | unknown;
508
+ kind?: 'filter' | 'physical' | 'virtual';
509
+ materialization_json?: null | unknown;
519
510
  mode?: 'auto' | 'manual' | 'mixed' | null;
520
- truncate_dimension?: number | null;
521
- criteria_json?: unknown | null;
522
- source_json?: unknown | null;
523
- compatibility_json?: unknown | null;
524
- materialization_json?: unknown | null;
525
- freshness_json?: unknown | null;
526
- created_at: Date | string;
511
+ model_name: string;
512
+ name?: string;
513
+ purpose?: null | string;
514
+ slug?: null | string;
515
+ source_json?: null | unknown;
516
+ truncate_dimension?: null | number;
527
517
  updated_at?: Date | string;
528
518
  }): ShardEmbeddingSet;
529
519
  /** Convert a shard embedding set back to browser format. */
530
520
  declare function embeddingSetFromShard(shard: ShardEmbeddingSet, fallbackCreatedAt: string): {
521
+ compatibility_json: null | string;
522
+ created_at: string;
523
+ criteria_json: null | string;
524
+ description: null | string;
525
+ dimensions: number;
526
+ document_count: null | number;
527
+ embedding_count: null | number;
528
+ freshness_json: null | string;
531
529
  id: string;
532
- name: string;
533
- slug: string | null;
534
- description: string | null;
535
- purpose: string | null;
536
- document_count: number | null;
537
- embedding_count: number | null;
538
530
  is_system: boolean;
539
- keywords_json: string | null;
540
- model_name: string;
541
- dimensions: number;
542
- kind: 'physical' | 'filter' | 'virtual';
531
+ keywords_json: null | string;
532
+ kind: 'filter' | 'physical' | 'virtual';
533
+ materialization_json: null | string;
543
534
  mode: 'auto' | 'manual' | 'mixed' | null;
544
- truncate_dimension: number | null;
545
- criteria_json: string | null;
546
- source_json: string | null;
547
- compatibility_json: string | null;
548
- materialization_json: string | null;
549
- freshness_json: string | null;
550
- created_at: string;
551
- updated_at: string | null;
535
+ model_name: string;
536
+ name: string;
537
+ purpose: null | string;
538
+ slug: null | string;
539
+ source_json: null | string;
540
+ truncate_dimension: null | number;
541
+ updated_at: null | string;
552
542
  };
553
543
  /** Convert a browser embedding_set_member to shard format. */
554
544
  declare function embeddingSetMemberToShard(member: {
545
+ added_at?: Date | null | string;
546
+ added_by?: null | string;
555
547
  embedding_set_id: string;
548
+ membership_type?: null | string;
556
549
  note_id: string;
557
- membership_type?: string | null;
558
- added_at?: Date | string | null;
559
- added_by?: string | null;
560
550
  }): ShardEmbeddingSetMember;
561
551
  /** Convert a browser embedding_config row to shard format. */
562
552
  declare function embeddingConfigToShard(config: ShardEmbeddingConfig): ShardEmbeddingConfig;
563
553
  /** Convert a browser embedding to shard format. */
564
554
  declare function embeddingToShard(emb: {
555
+ chunk_index?: null | number;
556
+ created_at: Date | string;
557
+ embedding_set_id: string;
565
558
  id: string;
559
+ model_name?: null | string;
560
+ model?: null | string;
566
561
  note_id: string;
567
- embedding_set_id: string;
568
- chunk_index?: number | null;
569
- text?: string | null;
570
- vector: string | number[];
571
- model?: string | null;
572
- model_name?: string | null;
573
- created_at: Date | string;
562
+ text?: null | string;
563
+ vector: number[] | string;
574
564
  }): ShardEmbedding;
575
565
  /** Convert a shard embedding back to browser format. */
576
566
  declare function embeddingFromShard(shard: ShardEmbedding): {
567
+ chunk_index: number;
568
+ created_at: null | string;
569
+ embedding_set_id: null | string;
577
570
  id: string;
571
+ model: null | string;
578
572
  note_id: string;
579
- embedding_set_id: string | null;
580
- chunk_index: number;
581
573
  text: string;
582
574
  vector: string;
583
- model: string | null;
584
- created_at: string | null;
585
575
  };
586
576
  declare function skosSchemeToShard(scheme: {
577
+ created_at: Date | string;
578
+ description: null | string;
587
579
  id: string;
588
580
  title: string;
589
- description: string | null;
590
- created_at: Date | string;
591
581
  updated_at: Date | string;
592
582
  }): ShardSkosScheme;
593
583
  declare function skosConceptToShard(concept: {
584
+ alt_labels: null | string | string[];
585
+ created_at: Date | string;
586
+ definition: null | string;
594
587
  id: string;
595
- scheme_id: string;
596
588
  pref_label: string;
597
- alt_labels: string[] | string | null;
598
- definition: string | null;
599
- created_at: Date | string;
589
+ scheme_id: string;
600
590
  updated_at: Date | string;
601
591
  }): ShardSkosConcept;
602
592
  declare function skosRelationToShard(relation: {
593
+ created_at: Date | string;
603
594
  id: string;
595
+ relation_type: 'broader' | 'narrower' | 'related';
604
596
  source_concept_id: string;
605
597
  target_concept_id: string;
606
- relation_type: 'broader' | 'narrower' | 'related';
607
- created_at: Date | string;
608
598
  }): ShardSkosRelation;
609
599
  declare function noteSkosTagToShard(tag: {
610
- id: string;
611
- note_id: string;
612
600
  concept_id: string;
613
601
  created_at: Date | string;
602
+ id: string;
603
+ note_id: string;
614
604
  }): ShardNoteSkosTag;
615
605
  declare function provenanceEdgeToShard(edge: {
616
- id: string;
617
- entity_type: string;
618
- entity_id: string;
619
606
  activity: string;
620
607
  agent: string;
608
+ attributes: null | Record<string, unknown> | string;
609
+ ended_at: Date | null | string;
610
+ entity_id: string;
611
+ entity_type: string;
612
+ id: string;
621
613
  started_at: Date | string;
622
- ended_at: Date | string | null;
623
- attributes: Record<string, unknown> | string | null;
624
614
  }): ShardProvenanceEdge;
625
-
626
615
  /**
627
616
  * In-place Knowledge Shard reader (issue #189) — the static-file backend.
628
617
  *
@@ -636,7 +625,6 @@ declare function provenanceEdgeToShard(edge: {
636
625
  * links/tags/concepts + full record. Semantic is opt-in via a pluggable provider
637
626
  * (none / brute-force cosine / prebuilt ANN snapshot) — see `StaticSemanticProvider`.
638
627
  */
639
-
640
628
  /** The public note shape — the same browser-insertable record `importShard` produces. */
641
629
  type ShardReaderNote = BrowserNoteExport;
642
630
  interface ShardSearchWeights {
@@ -671,8 +659,8 @@ interface ShardSearchResult {
671
659
  items: ShardReaderNote[];
672
660
  total: number;
673
661
  facets: {
674
- tags: Record<string, number>;
675
662
  source: Record<string, number>;
663
+ tags: Record<string, number>;
676
664
  };
677
665
  rankedItems?: ShardSearchRankedNote[];
678
666
  /** Cluster files fetched to serve this query (0 when served from cache). */
@@ -713,23 +701,23 @@ interface ShardComponentStore {
713
701
  readonly manifest: ShardManifest;
714
702
  read(filename: string): Promise<Uint8Array | undefined>;
715
703
  }
716
- type ShardReaderSource = Uint8Array | Blob | {
704
+ type ShardReaderSource = {
717
705
  baseUrl: string;
718
706
  fetchImpl?: typeof fetch;
719
- };
707
+ } | Blob | Uint8Array;
720
708
  interface ShardReader {
721
709
  readonly manifest: ShardManifest;
722
710
  listNotes(options?: ShardListOptions): Promise<{
723
711
  items: ShardReaderNote[];
724
712
  total: number;
725
713
  }>;
726
- getNote(id: string): Promise<ShardReaderNote | null>;
714
+ getNote(id: string): Promise<null | ShardReaderNote>;
727
715
  search(query: string, options?: ShardSearchOptions): Promise<ShardSearchResult>;
728
716
  linksOf(id: string): Promise<ShardLink[]>;
729
717
  conceptsOf(id: string): Promise<ShardSkosConcept[]>;
730
718
  relationsOf(conceptId: string): Promise<ShardSkosRelation[]>;
731
719
  provenanceOf(id: string): Promise<ShardProvenanceEdge[]>;
732
- getNoteFull(id: string): Promise<ShardNoteFull | null>;
720
+ getNoteFull(id: string): Promise<null | ShardNoteFull>;
733
721
  semantic(query: string, k?: number): Promise<Array<{
734
722
  note: ShardReaderNote;
735
723
  score: number;
@@ -743,7 +731,6 @@ interface ShardReader {
743
731
  * reader than this build throws (the host should fall back to `importShard`).
744
732
  */
745
733
  declare function openShard(source: ShardReaderSource, options?: OpenShardOptions): Promise<ShardReader>;
746
-
747
734
  /**
748
735
  * Backend seam (#191) — a uniform tool-intent operation interface that lets the
749
736
  * PGlite database backend (#187) and the static-file shard backend (#189) be
@@ -756,7 +743,6 @@ declare function openShard(source: ShardReaderSource, options?: OpenShardOptions
756
743
  * regardless of whether the data lives in a queryable PGlite instance, a set of
757
744
  * static shard files fetched over HTTP, or the Fortemi server tier.
758
745
  */
759
-
760
746
  /**
761
747
  * Semantic-search tier a backend offers, in increasing capability:
762
748
  * - `none` — no vector search (text / facets only)
@@ -765,9 +751,9 @@ declare function openShard(source: ShardReaderSource, options?: OpenShardOptions
765
751
  * corpus (PGlite + pgvector, or a prebuilt ANN snapshot)
766
752
  * - `server` — delegated to the remote Fortemi server backend
767
753
  */
768
- type BackendSemanticTier = 'none' | 'cosine-small' | 'ann-full' | 'server';
754
+ type BackendSemanticTier = 'ann-full' | 'cosine-small' | 'none' | 'server';
769
755
  /** Relative startup cost of bringing a backend online. */
770
- type BackendStartupCost = 'instant' | 'index-build' | 'network';
756
+ type BackendStartupCost = 'index-build' | 'instant' | 'network';
771
757
  /** What a backend can do — the unit of capability negotiation. */
772
758
  interface BackendCapabilities {
773
759
  /** Can answer list / get / search read operations. */
@@ -790,7 +776,7 @@ interface BackendCapabilities {
790
776
  */
791
777
  interface BackendNote {
792
778
  id: string;
793
- title: string | null;
779
+ title: null | string;
794
780
  tags: string[];
795
781
  createdAt: string;
796
782
  updatedAt: string;
@@ -808,10 +794,10 @@ interface BackendNoteFull extends BackendNote {
808
794
  interface BackendLink {
809
795
  id: string;
810
796
  fromNoteId: string;
811
- toNoteId: string | null;
812
- toUrl?: string | null;
797
+ toNoteId: null | string;
798
+ toUrl?: null | string;
813
799
  kind: string;
814
- score: number | null;
800
+ score: null | number;
815
801
  createdAt: string;
816
802
  metadata?: Record<string, unknown>;
817
803
  }
@@ -820,7 +806,7 @@ interface BackendConcept {
820
806
  schemeId: string;
821
807
  prefLabel: string;
822
808
  altLabels: string[];
823
- definition: string | null;
809
+ definition: null | string;
824
810
  createdAt: string;
825
811
  updatedAt: string;
826
812
  }
@@ -831,8 +817,8 @@ interface BackendProvenanceEdge {
831
817
  activity: string;
832
818
  agent: string;
833
819
  startedAt: string;
834
- endedAt: string | null;
835
- attributes: Record<string, unknown> | null;
820
+ endedAt: null | string;
821
+ attributes: null | Record<string, unknown>;
836
822
  }
837
823
  /** One search hit — note plus optional rank/snippet when the backend ranks. */
838
824
  interface BackendSearchHit {
@@ -845,8 +831,8 @@ interface BackendSearchResult {
845
831
  hits: BackendSearchHit[];
846
832
  total: number;
847
833
  facets?: {
848
- tags: Record<string, number>;
849
834
  source?: Record<string, number>;
835
+ tags: Record<string, number>;
850
836
  };
851
837
  }
852
838
  interface BackendListOptions {
@@ -941,7 +927,7 @@ interface RemoteBackendConfig {
941
927
  baseUrl: string;
942
928
  id?: string;
943
929
  fetchImpl?: typeof fetch;
944
- headers?: HeadersInit | (() => HeadersInit | Promise<HeadersInit>);
930
+ headers?: (() => HeadersInit | Promise<HeadersInit>) | HeadersInit;
945
931
  authToken?: string;
946
932
  paths?: Partial<RemoteBackendPaths>;
947
933
  }
@@ -958,7 +944,6 @@ interface ShardBackendOptions {
958
944
  * provider is attached.
959
945
  */
960
946
  declare function createShardBackend(reader: ShardReader, options?: ShardBackendOptions): DataBackend;
961
-
962
947
  /**
963
948
  * Capability module system (ADR-002).
964
949
  * Tracks opt-in WASM module states. No WASM loaded by default (CAP-001).
@@ -971,9 +956,8 @@ declare function createShardBackend(reader: ShardReader, options?: ShardBackendO
971
956
  * disabled -> loading (via enable, re-enable)
972
957
  * error -> loading (via enable, retry)
973
958
  */
974
-
975
- type CapabilityState = 'unloaded' | 'loading' | 'ready' | 'error' | 'disabled';
976
- type CapabilityName = 'semantic' | 'llm' | 'audio' | 'vision' | 'pdf';
959
+ type CapabilityState = 'disabled' | 'error' | 'loading' | 'ready' | 'unloaded';
960
+ type CapabilityName = 'audio' | 'llm' | 'pdf' | 'semantic' | 'vision';
977
961
  declare class CapabilityManager {
978
962
  private events;
979
963
  private capabilities;
@@ -1026,13 +1010,11 @@ declare class CapabilityManager {
1026
1010
  state: CapabilityState;
1027
1011
  }>;
1028
1012
  }
1029
-
1030
1013
  /**
1031
1014
  * Sequential SQL migration runner for DatabaseClient.
1032
1015
  * Tracks applied migrations in a schema_version table.
1033
1016
  * Each migration runs in a transaction; version updated atomically.
1034
1017
  */
1035
-
1036
1018
  interface Migration {
1037
1019
  version: number;
1038
1020
  name: string;
@@ -1046,19 +1028,16 @@ declare class MigrationRunner {
1046
1028
  getCurrentVersion(): Promise<number>;
1047
1029
  apply(migrations: Migration[]): Promise<number>;
1048
1030
  getAppliedMigrations(): Promise<Array<{
1049
- version: number;
1050
1031
  name: string;
1032
+ version: number;
1051
1033
  }>>;
1052
1034
  }
1053
-
1054
1035
  declare const allMigrations: Migration[];
1055
-
1056
1036
  /**
1057
1037
  * Multi-archive manager for Fortemi.
1058
1038
  * Each archive is a separate PGlite instance with its own persistence path.
1059
1039
  * Migrations are applied automatically on open.
1060
1040
  */
1061
-
1062
1041
  interface ArchiveInfo {
1063
1042
  name: string;
1064
1043
  createdAt: string;
@@ -1086,7 +1065,7 @@ declare class ArchiveManager {
1086
1065
  */
1087
1066
  constructor(persistenceOrFactory: PersistenceMode | StorageBackendFactory, events?: TypedEventBus | undefined, persistenceOverride?: PersistenceMode);
1088
1067
  getCurrentArchiveName(): string;
1089
- getDb(): StorageBackend | null;
1068
+ getDb(): null | StorageBackend;
1090
1069
  open(archiveName?: string): Promise<StorageBackend>;
1091
1070
  /**
1092
1071
  * Adopt an already-created backend WITHOUT running migrations — for a backend
@@ -1101,14 +1080,12 @@ declare class ArchiveManager {
1101
1080
  listArchives(): ArchiveInfo[];
1102
1081
  close(): Promise<void>;
1103
1082
  }
1104
-
1105
1083
  /**
1106
1084
  * Factory function for creating a FortemiCore instance.
1107
1085
  * All deployment modes use this entry point.
1108
1086
  */
1109
-
1110
1087
  interface FortemiConfig {
1111
- persistence: 'opfs' | 'idb' | 'memory';
1088
+ persistence: 'idb' | 'memory' | 'opfs';
1112
1089
  archiveName?: string;
1113
1090
  }
1114
1091
  interface FortemiCore {
@@ -1117,7 +1094,6 @@ interface FortemiCore {
1117
1094
  destroy(): void;
1118
1095
  }
1119
1096
  declare function createFortemi(config: FortemiConfig): FortemiCore;
1120
-
1121
1097
  /**
1122
1098
  * Compute a browser-local content-identity hash (SHA-256), encoded as
1123
1099
  * `sha256:<64-char lowercase hex>`.
@@ -1147,11 +1123,29 @@ declare function computeHash(data: Uint8Array): string;
1147
1123
  * @returns `'blake3:<64-char lowercase hex>'`
1148
1124
  */
1149
1125
  declare function computeBlobHash(data: Uint8Array): string;
1150
-
1151
1126
  declare const FORTEMI_COMPATIBILITY_PATH = "/api/v1/system/compatibility";
1152
- declare const FORTEMI_COMPATIBILITY_STATES: readonly ["available", "degraded", "preview", "unavailable", "unknown"];
1127
+ declare const FORTEMI_SERVER_COMPATIBILITY_REVISION = "2026-07-06";
1128
+ declare const FORTEMI_COMPATIBILITY_STATES: readonly [
1129
+ "available",
1130
+ "degraded",
1131
+ "preview",
1132
+ "unavailable",
1133
+ "unknown"
1134
+ ];
1153
1135
  type FortemiCompatibilityState = (typeof FORTEMI_COMPATIBILITY_STATES)[number];
1154
- declare const FORTEMI_REQUIRED_COMPATIBILITY_CAPABILITIES: readonly ["core_notes", "search", "jobs", "realtime_activity", "hosted_auth", "premium_components", "backoffice_api", "audit_posture", "quota_status", "kms_status", "mcp_scope_gate"];
1136
+ declare const FORTEMI_REQUIRED_COMPATIBILITY_CAPABILITIES: readonly [
1137
+ "core_notes",
1138
+ "search",
1139
+ "jobs",
1140
+ "realtime_activity",
1141
+ "hosted_auth",
1142
+ "premium_components",
1143
+ "backoffice_api",
1144
+ "audit_posture",
1145
+ "quota_status",
1146
+ "kms_status",
1147
+ "mcp_scope_gate"
1148
+ ];
1155
1149
  type FortemiRequiredCompatibilityCapability = (typeof FORTEMI_REQUIRED_COMPATIBILITY_CAPABILITIES)[number];
1156
1150
  interface FortemiCompatibilityCapability {
1157
1151
  state: FortemiCompatibilityState;
@@ -1161,28 +1155,28 @@ interface FortemiCompatibilityResponse {
1161
1155
  schema_version: number;
1162
1156
  contract_revision: string;
1163
1157
  api: {
1158
+ build_date_present: boolean;
1159
+ git_sha_present: boolean;
1160
+ minimum_hotm_enterprise_client: string;
1164
1161
  name: string;
1165
1162
  version: string;
1166
- minimum_hotm_enterprise_client: string;
1167
- git_sha_present: boolean;
1168
- build_date_present: boolean;
1169
1163
  };
1170
1164
  deployment: {
1171
- mode: string;
1172
1165
  edition: string;
1173
1166
  hosted_multi_tenant_ready: boolean;
1167
+ mode: string;
1174
1168
  };
1175
1169
  auth: {
1176
- required: boolean;
1177
1170
  mode: string;
1178
1171
  oauth_issuer_configured: boolean;
1172
+ required: boolean;
1179
1173
  tenant_context_available: boolean;
1180
1174
  };
1181
1175
  capabilities: Record<string, FortemiCompatibilityCapability>;
1182
1176
  links: {
1183
- openapi: string;
1184
1177
  asyncapi: string;
1185
1178
  health: string;
1179
+ openapi: string;
1186
1180
  streaming_health: string;
1187
1181
  };
1188
1182
  }
@@ -1201,17 +1195,15 @@ declare function fortemiCompatibilityUrl(baseUrl?: string): string;
1201
1195
  declare function validateFortemiCompatibilityResponse(raw: unknown): FortemiCompatibilityValidationResult;
1202
1196
  declare function formatFortemiCompatibilitySummary(response: FortemiCompatibilityResponse): string;
1203
1197
  declare function fetchAndValidateFortemiCompatibility(options?: FetchFortemiCompatibilityOptions): Promise<FortemiCompatibilityValidationResult & {
1204
- url: string;
1205
1198
  status?: number;
1199
+ url: string;
1206
1200
  }>;
1207
-
1208
1201
  interface SWRegistrationResult {
1209
1202
  registered: boolean;
1210
1203
  registration?: ServiceWorkerRegistration;
1211
1204
  error?: string;
1212
1205
  }
1213
1206
  declare function registerServiceWorker(swUrl?: string): Promise<SWRegistrationResult>;
1214
-
1215
1207
  /**
1216
1208
  * REST route definitions for Service Worker.
1217
1209
  * These are pure functions that transform HTTP Request → tool input and tool output → Response.
@@ -1235,8 +1227,7 @@ declare function createRoutes(): RouteHandler[];
1235
1227
  * Match a request against the registered routes and return the first matching
1236
1228
  * handler, or null if no route matches.
1237
1229
  */
1238
- declare function matchRoute(routes: RouteHandler[], request: Request, url: URL): RouteHandler | null;
1239
-
1230
+ declare function matchRoute(routes: RouteHandler[], request: Request, url: URL): null | RouteHandler;
1240
1231
  /**
1241
1232
  * One-shot migration of the pre-bytecask blob layout into the new store.
1242
1233
  *
@@ -1251,7 +1242,6 @@ declare function matchRoute(routes: RouteHandler[], request: Request, url: URL):
1251
1242
  * (ADR-012 D3). The legacy source is deleted only after every entry migrated
1252
1243
  * without error; any failure leaves it untouched for the next attempt.
1253
1244
  */
1254
-
1255
1245
  /** Outcome of one migration attempt (for diagnostics/logging). */
1256
1246
  interface LegacyMigrationReport {
1257
1247
  migrated: number;
@@ -1264,7 +1254,6 @@ interface LegacyMigrationReport {
1264
1254
  * and the new store keeps whatever was already re-put (idempotent on retry).
1265
1255
  */
1266
1256
  declare function migrateLegacyBlobStore(archiveName: string, target: BlobStore, indexedDbFactory?: IDBFactory): Promise<LegacyMigrationReport>;
1267
-
1268
1257
  /**
1269
1258
  * Shared postMessage protocol types for the PGlite worker.
1270
1259
  *
@@ -1279,36 +1268,36 @@ declare function migrateLegacyBlobStore(archiveName: string, target: BlobStore,
1279
1268
  /** Messages from client to worker */
1280
1269
  type WorkerRequest = {
1281
1270
  id: string;
1282
- type: 'QUERY';
1283
- sql: string;
1284
- params?: unknown[];
1271
+ isolationLevel?: string;
1272
+ type: 'BEGIN';
1285
1273
  } | {
1286
1274
  id: string;
1287
- type: 'EXEC';
1275
+ params?: unknown[];
1288
1276
  sql: string;
1277
+ txId: string;
1278
+ type: 'TX_QUERY';
1289
1279
  } | {
1290
1280
  id: string;
1291
- type: 'BEGIN';
1292
- isolationLevel?: string;
1281
+ params?: unknown[];
1282
+ sql: string;
1283
+ type: 'QUERY';
1293
1284
  } | {
1294
1285
  id: string;
1295
- type: 'COMMIT';
1286
+ sql: string;
1296
1287
  txId: string;
1288
+ type: 'TX_EXEC';
1297
1289
  } | {
1298
1290
  id: string;
1299
- type: 'ROLLBACK';
1300
- txId: string;
1291
+ sql: string;
1292
+ type: 'EXEC';
1301
1293
  } | {
1302
1294
  id: string;
1303
- type: 'TX_QUERY';
1304
1295
  txId: string;
1305
- sql: string;
1306
- params?: unknown[];
1296
+ type: 'COMMIT';
1307
1297
  } | {
1308
1298
  id: string;
1309
- type: 'TX_EXEC';
1310
1299
  txId: string;
1311
- sql: string;
1300
+ type: 'ROLLBACK';
1312
1301
  } | {
1313
1302
  id: string;
1314
1303
  type: 'CLOSE';
@@ -1318,40 +1307,38 @@ type WorkerRequest = {
1318
1307
  };
1319
1308
  /** Messages from worker to client */
1320
1309
  type WorkerResponse = {
1310
+ affectedRows?: number;
1321
1311
  id: string;
1322
- type: 'RESULT';
1323
- rows: unknown[];
1312
+ type: 'EXEC_DONE';
1313
+ } | {
1314
+ error: string;
1315
+ id: string;
1316
+ type: 'ERROR';
1317
+ } | {
1324
1318
  fields?: Array<{
1325
- name: string;
1326
1319
  dataTypeID: number;
1320
+ name: string;
1327
1321
  }>;
1328
- } | {
1329
1322
  id: string;
1330
- type: 'EXEC_DONE';
1331
- affectedRows?: number;
1323
+ rows: unknown[];
1324
+ type: 'RESULT';
1332
1325
  } | {
1333
1326
  id: string;
1334
- type: 'TX_STARTED';
1335
1327
  txId: string;
1328
+ type: 'TX_STARTED';
1336
1329
  } | {
1337
1330
  id: string;
1338
- type: 'TX_DONE';
1339
- } | {
1340
- id: string;
1341
- type: 'ERROR';
1342
- error: string;
1331
+ type: 'PONG';
1343
1332
  } | {
1344
1333
  id: string;
1345
- type: 'PONG';
1334
+ type: 'TX_DONE';
1346
1335
  } | {
1347
1336
  type: 'READY';
1348
1337
  };
1349
-
1350
1338
  /**
1351
1339
  * EmbeddingSetsRepository - named, filter, and virtual embedding set API.
1352
1340
  */
1353
-
1354
- type EmbeddingSetKind = 'physical' | 'filter' | 'virtual';
1341
+ type EmbeddingSetKind = 'filter' | 'physical' | 'virtual';
1355
1342
  type EmbeddingSetMode = 'auto' | 'manual' | 'mixed';
1356
1343
  interface EmbeddingSetCriteria {
1357
1344
  query?: string;
@@ -1381,10 +1368,10 @@ interface EmbeddingSetFreshness {
1381
1368
  reason?: string;
1382
1369
  }
1383
1370
  interface EmbeddingCompatibilityPolicy {
1384
- model: 'require-same' | 'allow-compatible-family';
1385
- dimension: 'require-same' | 'allow-truncation';
1386
- duplicateVectors: 'prefer-latest' | 'prefer-set-order' | 'error';
1387
- missingVectors: 'omit' | 'include-unembedded-note' | 'error';
1371
+ model: 'allow-compatible-family' | 'require-same';
1372
+ dimension: 'allow-truncation' | 'require-same';
1373
+ duplicateVectors: 'error' | 'prefer-latest' | 'prefer-set-order';
1374
+ missingVectors: 'error' | 'include-unembedded-note' | 'omit';
1388
1375
  }
1389
1376
  interface VirtualMaterializationPolicy {
1390
1377
  allowed: boolean;
@@ -1402,7 +1389,7 @@ interface CriteriaVirtualSource {
1402
1389
  }
1403
1390
  interface SetOperationVirtualSource {
1404
1391
  type: 'set-operation';
1405
- operation: 'union' | 'intersection' | 'difference';
1392
+ operation: 'difference' | 'intersection' | 'union';
1406
1393
  setIds: string[];
1407
1394
  }
1408
1395
  interface FallbackVirtualSource {
@@ -1422,11 +1409,11 @@ interface SnapshotVirtualSource {
1422
1409
  generatedAt: string;
1423
1410
  inputHash: string;
1424
1411
  }
1425
- type VirtualEmbeddingSetSource = CriteriaVirtualSource | SetOperationVirtualSource | FallbackVirtualSource | LatestCompatibleVirtualSource | SnapshotVirtualSource;
1412
+ type VirtualEmbeddingSetSource = CriteriaVirtualSource | FallbackVirtualSource | LatestCompatibleVirtualSource | SetOperationVirtualSource | SnapshotVirtualSource;
1426
1413
  interface VirtualEmbeddingSetDefinition {
1427
1414
  id: string;
1428
1415
  name: string;
1429
- purpose?: string | null;
1416
+ purpose?: null | string;
1430
1417
  source: VirtualEmbeddingSetSource;
1431
1418
  compatibility: EmbeddingCompatibilityPolicy;
1432
1419
  materialization?: VirtualMaterializationPolicy;
@@ -1441,30 +1428,30 @@ interface EmbeddingSetSelector {
1441
1428
  interface EmbeddingSetDescriptor {
1442
1429
  id: string;
1443
1430
  name: string;
1444
- purpose?: string | null;
1431
+ purpose?: null | string;
1445
1432
  kind: EmbeddingSetKind;
1446
1433
  mode?: EmbeddingSetMode;
1447
1434
  model?: string;
1448
1435
  dimension?: number;
1449
- truncateDimension?: number | null;
1436
+ truncateDimension?: null | number;
1450
1437
  criteria?: EmbeddingSetCriteria | null;
1451
1438
  createdAt?: string;
1452
1439
  updatedAt?: string;
1453
1440
  freshness?: EmbeddingSetFreshness;
1454
1441
  }
1455
1442
  type VirtualEmbeddingSetValidationError = {
1456
- code: 'mixed-models';
1457
- setIds: string[];
1458
- } | {
1459
- code: 'mixed-dimensions';
1443
+ code: 'duplicate-vector';
1444
+ noteId: string;
1460
1445
  setIds: string[];
1461
1446
  } | {
1462
1447
  code: 'missing-vector';
1463
1448
  noteId: string;
1464
1449
  setId: string;
1465
1450
  } | {
1466
- code: 'duplicate-vector';
1467
- noteId: string;
1451
+ code: 'mixed-dimensions';
1452
+ setIds: string[];
1453
+ } | {
1454
+ code: 'mixed-models';
1468
1455
  setIds: string[];
1469
1456
  } | {
1470
1457
  code: 'stale-snapshot';
@@ -1492,29 +1479,29 @@ interface ResolvedEmbeddingSet {
1492
1479
  interface EmbeddingSetRow {
1493
1480
  id: string;
1494
1481
  name: string;
1495
- purpose: string | null;
1482
+ purpose: null | string;
1496
1483
  model_name: string;
1497
1484
  dimensions: number;
1498
1485
  kind: EmbeddingSetKind;
1499
1486
  mode: EmbeddingSetMode | null;
1500
- truncate_dimension: number | null;
1501
- criteria_json: unknown | null;
1502
- source_json: unknown | null;
1503
- compatibility_json: unknown | null;
1504
- materialization_json: unknown | null;
1505
- freshness_json: unknown | null;
1487
+ truncate_dimension: null | number;
1488
+ criteria_json: null | unknown;
1489
+ source_json: null | unknown;
1490
+ compatibility_json: null | unknown;
1491
+ materialization_json: null | unknown;
1492
+ freshness_json: null | unknown;
1506
1493
  created_at: Date;
1507
1494
  updated_at: Date;
1508
1495
  }
1509
1496
  interface EmbeddingSetCreateInput {
1510
1497
  id?: string;
1511
1498
  name: string;
1512
- purpose?: string | null;
1499
+ purpose?: null | string;
1513
1500
  model_name?: string;
1514
1501
  dimensions?: number;
1515
1502
  kind?: EmbeddingSetKind;
1516
1503
  mode?: EmbeddingSetMode | null;
1517
- truncate_dimension?: number | null;
1504
+ truncate_dimension?: null | number;
1518
1505
  criteria?: EmbeddingSetCriteria | null;
1519
1506
  }
1520
1507
  interface EmbeddingSetEmbeddingInput {
@@ -1555,14 +1542,13 @@ declare class EmbeddingSetsRepository {
1555
1542
  private inferDefinitionModel;
1556
1543
  private inferDefinitionDimension;
1557
1544
  }
1558
-
1559
1545
  /**
1560
1546
  * Shared types for repository layer.
1561
1547
  * All repository methods use these types as inputs and outputs.
1562
1548
  */
1563
1549
  interface NoteSummary {
1564
1550
  id: string;
1565
- title: string | null;
1551
+ title: null | string;
1566
1552
  format: string;
1567
1553
  source: string;
1568
1554
  visibility: string;
@@ -1575,20 +1561,20 @@ interface NoteSummary {
1575
1561
  tags: string[];
1576
1562
  }
1577
1563
  interface NoteFull extends NoteSummary {
1578
- archive_id: string | null;
1564
+ archive_id: null | string;
1579
1565
  revision_mode: string;
1580
1566
  original: {
1581
- id: string;
1582
- content: string;
1583
1567
  content_hash: string;
1568
+ content: string;
1584
1569
  created_at: Date;
1570
+ id: string;
1585
1571
  };
1586
1572
  current: {
1573
+ ai_metadata: null | unknown;
1587
1574
  content: string;
1588
- ai_metadata: unknown | null;
1589
1575
  generation_count: number;
1590
- model: string | null;
1591
1576
  is_user_edited: boolean;
1577
+ model: null | string;
1592
1578
  updated_at: Date;
1593
1579
  };
1594
1580
  }
@@ -1617,7 +1603,7 @@ interface NoteUpdateInput {
1617
1603
  interface NoteListOptions {
1618
1604
  limit?: number;
1619
1605
  offset?: number;
1620
- sort?: 'created_at' | 'updated_at' | 'title';
1606
+ sort?: 'created_at' | 'title' | 'updated_at';
1621
1607
  order?: 'asc' | 'desc';
1622
1608
  is_starred?: boolean;
1623
1609
  is_pinned?: boolean;
@@ -1635,7 +1621,7 @@ interface PaginatedResult<T> {
1635
1621
  }
1636
1622
  interface SearchResult {
1637
1623
  id: string;
1638
- title: string | null;
1624
+ title: null | string;
1639
1625
  snippet: string;
1640
1626
  rank: number;
1641
1627
  created_at: Date;
@@ -1645,20 +1631,20 @@ interface SearchResult {
1645
1631
  }
1646
1632
  interface SearchFacets {
1647
1633
  tags: {
1648
- tag: string;
1649
1634
  count: number;
1635
+ tag: string;
1650
1636
  }[];
1651
1637
  collections: {
1638
+ count: number;
1652
1639
  id: string;
1653
1640
  name: string;
1654
- count: number;
1655
1641
  }[];
1656
1642
  }
1657
1643
  interface SearchResponse {
1658
1644
  results: SearchResult[];
1659
1645
  total: number;
1660
1646
  query: string;
1661
- mode: 'text' | 'semantic' | 'hybrid';
1647
+ mode: 'hybrid' | 'semantic' | 'text';
1662
1648
  semantic_available: boolean;
1663
1649
  limit: number;
1664
1650
  offset: number;
@@ -1677,7 +1663,7 @@ interface SearchOptions {
1677
1663
  source?: string;
1678
1664
  visibility?: string;
1679
1665
  include_facets?: boolean;
1680
- mode?: 'text' | 'semantic' | 'hybrid' | 'auto';
1666
+ mode?: 'auto' | 'hybrid' | 'semantic' | 'text';
1681
1667
  embeddingSetId?: string;
1682
1668
  embeddingSetSelector?: EmbeddingSetSelector;
1683
1669
  }
@@ -1687,11 +1673,10 @@ interface NoteRevision {
1687
1673
  revision_number: number;
1688
1674
  type: string;
1689
1675
  content: string;
1690
- ai_metadata: unknown | null;
1691
- model: string | null;
1676
+ ai_metadata: null | unknown;
1677
+ model: null | string;
1692
1678
  created_at: Date;
1693
1679
  }
1694
-
1695
1680
  /**
1696
1681
  * NotesRepository — CRUD and lifecycle operations for the note entity.
1697
1682
  *
@@ -1701,7 +1686,6 @@ interface NoteRevision {
1701
1686
  * - List notes with filtering, pagination, and sorting
1702
1687
  * - Emit domain events via TypedEventBus on every mutation
1703
1688
  */
1704
-
1705
1689
  declare class NotesRepository {
1706
1690
  private db;
1707
1691
  private events?;
@@ -1756,12 +1740,10 @@ declare class NotesRepository {
1756
1740
  */
1757
1741
  getRevisions(noteId: string): Promise<NoteRevision[]>;
1758
1742
  }
1759
-
1760
1743
  /**
1761
1744
  * SearchRepository - full-text search using DatabaseClient tsvector/tsquery,
1762
1745
  * with optional semantic search (pgvector) and hybrid (BM25 + vector RRF).
1763
1746
  */
1764
-
1765
1747
  declare class SearchRepository {
1766
1748
  private db;
1767
1749
  private semanticAvailable;
@@ -1781,7 +1763,6 @@ declare class SearchRepository {
1781
1763
  private fetchFacets;
1782
1764
  private fetchTagMap;
1783
1765
  }
1784
-
1785
1766
  interface GraphNode {
1786
1767
  id: string;
1787
1768
  }
@@ -1811,10 +1792,10 @@ interface SimilarityGraphOptions {
1811
1792
  }
1812
1793
  interface SimilarityGraphRequest extends SimilarityGraphOptions {
1813
1794
  selector: EmbeddingSetSelector;
1814
- source?: 'cache-preferred' | 'live-only' | 'cache-only';
1795
+ source?: 'cache-only' | 'cache-preferred' | 'live-only';
1815
1796
  }
1816
1797
  interface SimilarityGraphProgress {
1817
- phase: 'prepare' | 'neighbors';
1798
+ phase: 'neighbors' | 'prepare';
1818
1799
  done: number;
1819
1800
  total: number;
1820
1801
  }
@@ -1827,7 +1808,7 @@ interface SimilarityGraphCacheKey {
1827
1808
  metric: 'cosine' | 'inner_product' | 'l2';
1828
1809
  model: string;
1829
1810
  dimension: number;
1830
- truncateDimension?: number | null;
1811
+ truncateDimension?: null | number;
1831
1812
  memberHash: string;
1832
1813
  vectorHash: string;
1833
1814
  parameterHash: string;
@@ -1835,12 +1816,12 @@ interface SimilarityGraphCacheKey {
1835
1816
  interface SimilarityGraphResult {
1836
1817
  graph: CommunityGraph;
1837
1818
  graphSource: {
1819
+ freshness: 'fresh' | 'stale' | 'unknown';
1838
1820
  id: string;
1839
- name: string;
1840
1821
  input_hash: string;
1841
- freshness: 'fresh' | 'stale' | 'unknown';
1822
+ name: string;
1842
1823
  };
1843
- cache: 'hit' | 'miss-live-built' | 'stale-live-built' | 'live-only';
1824
+ cache: 'hit' | 'live-only' | 'miss-live-built' | 'stale-live-built';
1844
1825
  freshness: 'fresh' | 'stale' | 'unknown';
1845
1826
  }
1846
1827
  interface CommunityOptions {
@@ -1850,17 +1831,17 @@ declare function detectCommunities(edges: GraphEdge[], nodes?: GraphNode[], opti
1850
1831
  declare class GraphRepository {
1851
1832
  private db;
1852
1833
  constructor(db: QueryExecutor);
1853
- normalizeSimilarityRequest(request: SimilarityGraphRequest): Required<Pick<SimilarityGraphRequest, 'selector' | 'k' | 'minSimilarity' | 'metric' | 'source'>>;
1854
- buildSimilarityGraph(embeddingSet: string | EmbeddingSetSelector, options?: SimilarityGraphOptions): Promise<CommunityGraph>;
1834
+ normalizeSimilarityRequest(request: SimilarityGraphRequest): Required<Pick<SimilarityGraphRequest, 'k' | 'metric' | 'minSimilarity' | 'selector' | 'source'>>;
1835
+ buildSimilarityGraph(embeddingSet: EmbeddingSetSelector | string, options?: SimilarityGraphOptions): Promise<CommunityGraph>;
1855
1836
  buildSimilarityGraphLive(request: SimilarityGraphRequest): Promise<CommunityGraph>;
1856
- getCachedSimilarityGraph(request: SimilarityGraphRequest): Promise<SimilarityGraphResult | null>;
1837
+ getCachedSimilarityGraph(request: SimilarityGraphRequest): Promise<null | SimilarityGraphResult>;
1857
1838
  buildOrLoadSimilarityGraph(request: SimilarityGraphRequest): Promise<SimilarityGraphResult>;
1858
1839
  saveSimilarityGraphArtifact(input: {
1859
- graph: CommunityGraph;
1860
- request: Required<Pick<SimilarityGraphRequest, 'selector' | 'k' | 'minSimilarity' | 'metric' | 'source'>>;
1861
- resolved: ResolvedEmbeddingSet;
1862
1840
  cacheKey: SimilarityGraphCacheKey;
1863
1841
  freshness?: 'fresh' | 'stale' | 'unknown';
1842
+ graph: CommunityGraph;
1843
+ request: Required<Pick<SimilarityGraphRequest, 'k' | 'metric' | 'minSimilarity' | 'selector' | 'source'>>;
1844
+ resolved: ResolvedEmbeddingSet;
1864
1845
  }): Promise<SimilarityGraphResult['graphSource']>;
1865
1846
  markSimilarityGraphStale(graphSourceId: string, reason: string): Promise<void>;
1866
1847
  loadGraphArtifact(graphSourceId: string, noteIds?: string[]): Promise<CommunityGraph>;
@@ -1870,8 +1851,7 @@ declare class GraphRepository {
1870
1851
  private graphFromArtifact;
1871
1852
  buildLinkGraph(linkType?: string): Promise<CommunityGraph>;
1872
1853
  }
1873
-
1874
- type CommunitySourceType = 'computed' | 'precomputed' | 'dynamic' | 'dynamic-snapshot' | 'user-authored' | 'imported';
1854
+ type CommunitySourceType = 'computed' | 'dynamic-snapshot' | 'dynamic' | 'imported' | 'precomputed' | 'user-authored';
1875
1855
  interface CommunityFilterDefinition {
1876
1856
  query?: string;
1877
1857
  tags?: string[];
@@ -1896,8 +1876,8 @@ interface CommunityAssignmentView {
1896
1876
  communitySourceId: string;
1897
1877
  communityId: string;
1898
1878
  noteId: string;
1899
- label?: string | null;
1900
- confidence?: number | null;
1879
+ label?: null | string;
1880
+ confidence?: null | number;
1901
1881
  sourceType: CommunitySourceType;
1902
1882
  }
1903
1883
  interface CommunitySummary {
@@ -1905,7 +1885,7 @@ interface CommunitySummary {
1905
1885
  label: string;
1906
1886
  sourceType: CommunitySourceType;
1907
1887
  size: number;
1908
- confidence?: number | null;
1888
+ confidence?: null | number;
1909
1889
  representativeNoteIds: string[];
1910
1890
  freshness?: 'fresh' | 'stale' | 'unknown';
1911
1891
  }
@@ -1928,7 +1908,6 @@ declare class CommunitiesRepository {
1928
1908
  listCommunitySummaries(sourceId: string): Promise<CommunitySummary[]>;
1929
1909
  private resolveFilterNoteIds;
1930
1910
  }
1931
-
1932
1911
  /**
1933
1912
  * Shared SQL condition builder for note filtering.
1934
1913
  * Used by both SearchRepository and NotesRepository to prevent drift
@@ -1936,7 +1915,6 @@ declare class CommunitiesRepository {
1936
1915
  *
1937
1916
  * @implements #87 shared condition builder
1938
1917
  */
1939
-
1940
1918
  interface ConditionResult {
1941
1919
  conditions: string[];
1942
1920
  params: unknown[];
@@ -1950,8 +1928,7 @@ interface ConditionResult {
1950
1928
  * @param startIdx - Starting parameter index ($N)
1951
1929
  * @param includeDeleted - Whether to include soft-deleted notes (default: false)
1952
1930
  */
1953
- declare function buildNoteConditions(options: Pick<SearchOptions, 'tags' | 'collection_id' | 'date_from' | 'date_to' | 'is_starred' | 'is_archived' | 'format' | 'source' | 'visibility'>, startIdx: number, includeDeleted?: boolean): ConditionResult;
1954
-
1931
+ declare function buildNoteConditions(options: Pick<SearchOptions, 'collection_id' | 'date_from' | 'date_to' | 'format' | 'is_archived' | 'is_starred' | 'source' | 'tags' | 'visibility'>, startIdx: number, includeDeleted?: boolean): ConditionResult;
1955
1932
  /**
1956
1933
  * Job queue worker — polls job_queue for pending jobs, dispatches to registered
1957
1934
  * handlers, manages status transitions and exponential backoff retries.
@@ -1963,7 +1940,6 @@ declare function buildNoteConditions(options: Pick<SearchOptions, 'tags' | 'coll
1963
1940
  * concept_tagging: 4 (extract concepts from enriched content, requires llm)
1964
1941
  * linking: 5 (find related notes, requires embeddings to exist)
1965
1942
  */
1966
-
1967
1943
  interface JobQueueOptions {
1968
1944
  /** How often to poll for new jobs (ms). Default: 5000 */
1969
1945
  pollIntervalMs?: number;
@@ -1980,17 +1956,17 @@ interface Job {
1980
1956
  job_type: string;
1981
1957
  status: string;
1982
1958
  priority: number;
1983
- required_capability: string | null;
1959
+ required_capability: null | string;
1984
1960
  retry_count: number;
1985
1961
  max_retries: number;
1986
- error: string | null;
1987
- result: unknown | null;
1962
+ error: null | string;
1963
+ result: null | unknown;
1988
1964
  created_at: Date;
1989
1965
  updated_at: Date;
1990
1966
  }
1991
1967
  type JobHandler = (job: Job, db: DatabaseClient) => Promise<unknown>;
1992
1968
  /** Job types listed in execution priority order (lower number = runs first) */
1993
- type JobType = 'ai_revision' | 'title_generation' | 'embedding' | 'concept_tagging' | 'linking';
1969
+ type JobType = 'ai_revision' | 'concept_tagging' | 'embedding' | 'linking' | 'title_generation';
1994
1970
  /**
1995
1971
  * Job priorities — lower number = runs first.
1996
1972
  * Correct dependency order:
@@ -2006,7 +1982,7 @@ interface EnqueueJobInput {
2006
1982
  noteId: string;
2007
1983
  jobType: JobType;
2008
1984
  priority?: number;
2009
- requiredCapability?: string | null;
1985
+ requiredCapability?: null | string;
2010
1986
  }
2011
1987
  /** Enqueue a job into the job_queue table. Returns the new job ID. */
2012
1988
  declare function enqueueJob(db: DatabaseClient, input: EnqueueJobInput): Promise<string>;
@@ -2024,11 +2000,11 @@ interface JobStatus {
2024
2000
  job_type: string;
2025
2001
  status: string;
2026
2002
  priority: number;
2027
- required_capability: string | null;
2003
+ required_capability: null | string;
2028
2004
  retry_count: number;
2029
2005
  max_retries: number;
2030
- error: string | null;
2031
- result: unknown | null;
2006
+ error: null | string;
2007
+ result: null | unknown;
2032
2008
  created_at: Date;
2033
2009
  updated_at: Date;
2034
2010
  }
@@ -2063,7 +2039,6 @@ declare function aiRevisionHandler(job: Job, db: DatabaseClient): Promise<unknow
2063
2039
  declare function conceptTaggingHandler(job: Job, db: DatabaseClient): Promise<unknown>;
2064
2040
  /** Linking: find semantically related notes using FTS + vector RRF */
2065
2041
  declare function linkingHandler(job: Job, db: DatabaseClient): Promise<unknown>;
2066
-
2067
2042
  /**
2068
2043
  * TagsRepository — free-form tag management for notes.
2069
2044
  *
@@ -2072,7 +2047,6 @@ declare function linkingHandler(job: Job, db: DatabaseClient): Promise<unknown>;
2072
2047
  * - Look up tags by note or notes by tag
2073
2048
  * - List all tags with usage counts
2074
2049
  */
2075
-
2076
2050
  declare class TagsRepository {
2077
2051
  private db;
2078
2052
  constructor(db: DatabaseClient);
@@ -2081,11 +2055,10 @@ declare class TagsRepository {
2081
2055
  getTagsForNote(noteId: string): Promise<string[]>;
2082
2056
  getNotesForTag(tag: string): Promise<string[]>;
2083
2057
  listAllTags(): Promise<Array<{
2084
- tag: string;
2085
2058
  count: number;
2059
+ tag: string;
2086
2060
  }>>;
2087
2061
  }
2088
-
2089
2062
  /**
2090
2063
  * CollectionsRepository — folder/category management for notes.
2091
2064
  *
@@ -2095,12 +2068,11 @@ declare class TagsRepository {
2095
2068
  * - Assign and unassign notes from collections
2096
2069
  * - Return flat list and shallow tree views
2097
2070
  */
2098
-
2099
2071
  interface CollectionRow {
2100
2072
  id: string;
2101
2073
  name: string;
2102
- description: string | null;
2103
- parent_id: string | null;
2074
+ description: null | string;
2075
+ parent_id: null | string;
2104
2076
  position: number;
2105
2077
  created_at: Date;
2106
2078
  updated_at: Date;
@@ -2120,13 +2092,12 @@ declare class CollectionsRepository {
2120
2092
  listTree(): Promise<Array<CollectionRow & {
2121
2093
  children: CollectionRow[];
2122
2094
  }>>;
2123
- update(id: string, fields: Partial<Pick<CollectionRow, 'name' | 'description' | 'parent_id' | 'position'>>): Promise<CollectionRow>;
2095
+ update(id: string, fields: Partial<Pick<CollectionRow, 'description' | 'name' | 'parent_id' | 'position'>>): Promise<CollectionRow>;
2124
2096
  delete(id: string): Promise<void>;
2125
2097
  assignNote(collectionId: string, noteId: string): Promise<void>;
2126
2098
  unassignNote(collectionId: string, noteId: string): Promise<void>;
2127
2099
  getNotesInCollection(collectionId: string): Promise<string[]>;
2128
2100
  }
2129
-
2130
2101
  /**
2131
2102
  * LinksRepository — bidirectional note link management.
2132
2103
  *
@@ -2135,13 +2106,12 @@ declare class CollectionsRepository {
2135
2106
  * - Soft-delete links
2136
2107
  * - Query outbound, inbound, and backlinks for a note
2137
2108
  */
2138
-
2139
2109
  interface LinkRow {
2140
2110
  id: string;
2141
2111
  source_note_id: string;
2142
2112
  target_note_id: string;
2143
2113
  link_type: string;
2144
- confidence: number | null;
2114
+ confidence: null | number;
2145
2115
  created_at: Date;
2146
2116
  updated_at: Date | null;
2147
2117
  deleted_at: Date | null;
@@ -2152,13 +2122,12 @@ declare class LinksRepository {
2152
2122
  create(sourceNoteId: string, targetNoteId: string, linkType?: string): Promise<LinkRow>;
2153
2123
  get(id: string): Promise<LinkRow>;
2154
2124
  listForNote(noteId: string): Promise<{
2155
- outbound: LinkRow[];
2156
2125
  inbound: LinkRow[];
2126
+ outbound: LinkRow[];
2157
2127
  }>;
2158
2128
  getBacklinks(noteId: string): Promise<string[]>;
2159
2129
  delete(id: string): Promise<void>;
2160
2130
  }
2161
-
2162
2131
  /**
2163
2132
  * SkosRepository — SKOS taxonomy management (schemes, concepts, relations).
2164
2133
  *
@@ -2167,11 +2136,10 @@ declare class LinksRepository {
2167
2136
  * - Create, list, and soft-delete SKOS concepts within schemes
2168
2137
  * - Create and query broader/narrower/related concept relations
2169
2138
  */
2170
-
2171
2139
  interface SkosScheme {
2172
2140
  id: string;
2173
2141
  title: string;
2174
- description: string | null;
2142
+ description: null | string;
2175
2143
  created_at: Date;
2176
2144
  updated_at: Date;
2177
2145
  deleted_at: Date | null;
@@ -2181,7 +2149,7 @@ interface SkosConcept {
2181
2149
  scheme_id: string;
2182
2150
  pref_label: string;
2183
2151
  alt_labels: string[];
2184
- definition: string | null;
2152
+ definition: null | string;
2185
2153
  created_at: Date;
2186
2154
  updated_at: Date;
2187
2155
  deleted_at: Date | null;
@@ -2217,7 +2185,6 @@ declare class SkosRepository {
2217
2185
  untagNote(noteId: string, conceptId: string): Promise<void>;
2218
2186
  conceptsForNote(noteId: string): Promise<SkosConcept[]>;
2219
2187
  }
2220
-
2221
2188
  interface ProvenanceEdge {
2222
2189
  id: string;
2223
2190
  entity_type: string;
@@ -2226,14 +2193,14 @@ interface ProvenanceEdge {
2226
2193
  agent: string;
2227
2194
  started_at: Date;
2228
2195
  ended_at: Date | null;
2229
- attributes: Record<string, unknown> | null;
2196
+ attributes: null | Record<string, unknown>;
2230
2197
  }
2231
2198
  interface RecordProvenanceInput {
2232
2199
  activity: string;
2233
2200
  agent: string;
2234
2201
  startedAt?: Date | string;
2235
- endedAt?: Date | string | null;
2236
- attributes?: Record<string, unknown> | null;
2202
+ endedAt?: Date | null | string;
2203
+ attributes?: null | Record<string, unknown>;
2237
2204
  }
2238
2205
  declare class ProvenanceRepository {
2239
2206
  private db;
@@ -2241,7 +2208,6 @@ declare class ProvenanceRepository {
2241
2208
  recordProvenance(entityType: string, entityId: string, input: RecordProvenanceInput): Promise<ProvenanceEdge>;
2242
2209
  forEntity(entityType: string, entityId: string): Promise<ProvenanceEdge[]>;
2243
2210
  }
2244
-
2245
2211
  /**
2246
2212
  * captureKnowledge — tool function for creating notes.
2247
2213
  *
@@ -2252,13 +2218,11 @@ declare class ProvenanceRepository {
2252
2218
  *
2253
2219
  * Input is Zod-validated at entry. All writes delegate to NotesRepository.
2254
2220
  */
2255
-
2256
2221
  interface CaptureKnowledgeResult {
2257
2222
  action: string;
2258
2223
  notes: NoteFull[];
2259
2224
  }
2260
2225
  declare function captureKnowledge(db: DatabaseClient, rawInput: unknown, events?: TypedEventBus): Promise<CaptureKnowledgeResult>;
2261
-
2262
2226
  /**
2263
2227
  * manageNote — tool function for note lifecycle operations.
2264
2228
  *
@@ -2266,14 +2230,12 @@ declare function captureKnowledge(db: DatabaseClient, rawInput: unknown, events?
2266
2230
  *
2267
2231
  * Input is Zod-validated at entry. All mutations delegate to NotesRepository.
2268
2232
  */
2269
-
2270
2233
  interface ManageNoteResult {
2271
2234
  action: string;
2272
2235
  note_id: string;
2273
2236
  note?: NoteFull;
2274
2237
  }
2275
2238
  declare function manageNote(db: DatabaseClient, rawInput: unknown, events?: TypedEventBus): Promise<ManageNoteResult>;
2276
-
2277
2239
  /**
2278
2240
  * searchTool — tool function wrapping SearchRepository.
2279
2241
  *
@@ -2283,9 +2245,7 @@ declare function manageNote(db: DatabaseClient, rawInput: unknown, events?: Type
2283
2245
  *
2284
2246
  * Input is Zod-validated at entry.
2285
2247
  */
2286
-
2287
2248
  declare function searchTool(db: DatabaseClient, rawInput: unknown): Promise<SearchResponse>;
2288
-
2289
2249
  /**
2290
2250
  * Zod schemas for tool function inputs.
2291
2251
  *
@@ -2293,147 +2253,182 @@ declare function searchTool(db: DatabaseClient, rawInput: unknown): Promise<Sear
2293
2253
  * the tool functions. All inputs are validated at the tool boundary so that
2294
2254
  * repository methods only receive well-typed data.
2295
2255
  */
2296
-
2297
2256
  declare const CaptureKnowledgeInputSchema: z.ZodObject<{
2298
- action: z.ZodEnum<["create", "bulk_create", "from_template"]>;
2299
- content: z.ZodOptional<z.ZodString>;
2300
- title: z.ZodOptional<z.ZodString>;
2301
- format: z.ZodDefault<z.ZodEnum<["markdown", "plain", "html"]>>;
2302
- source: z.ZodDefault<z.ZodString>;
2303
- visibility: z.ZodDefault<z.ZodEnum<["private", "shared", "public"]>>;
2304
- tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2257
+ action: z.ZodEnum<[
2258
+ "create",
2259
+ "bulk_create",
2260
+ "from_template"
2261
+ ]>;
2305
2262
  archive_id: z.ZodOptional<z.ZodString>;
2263
+ content: z.ZodOptional<z.ZodString>;
2264
+ format: z.ZodDefault<z.ZodEnum<[
2265
+ "markdown",
2266
+ "plain",
2267
+ "html"
2268
+ ]>>;
2306
2269
  notes: z.ZodOptional<z.ZodArray<z.ZodObject<{
2307
2270
  content: z.ZodString;
2308
- title: z.ZodOptional<z.ZodString>;
2309
- format: z.ZodDefault<z.ZodEnum<["markdown", "plain", "html"]>>;
2271
+ format: z.ZodDefault<z.ZodEnum<[
2272
+ "markdown",
2273
+ "plain",
2274
+ "html"
2275
+ ]>>;
2310
2276
  tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2277
+ title: z.ZodOptional<z.ZodString>;
2311
2278
  }, "strip", z.ZodTypeAny, {
2312
- format: "markdown" | "plain" | "html";
2313
2279
  content: string;
2314
- title?: string | undefined;
2280
+ format: "html" | "markdown" | "plain";
2315
2281
  tags?: string[] | undefined;
2282
+ title?: string | undefined;
2316
2283
  }, {
2317
2284
  content: string;
2318
- title?: string | undefined;
2285
+ format?: "html" | "markdown" | "plain" | undefined;
2319
2286
  tags?: string[] | undefined;
2320
- format?: "markdown" | "plain" | "html" | undefined;
2287
+ title?: string | undefined;
2321
2288
  }>, "many">>;
2289
+ source: z.ZodDefault<z.ZodString>;
2290
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2322
2291
  template: z.ZodOptional<z.ZodString>;
2292
+ title: z.ZodOptional<z.ZodString>;
2323
2293
  variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
2294
+ visibility: z.ZodDefault<z.ZodEnum<[
2295
+ "private",
2296
+ "shared",
2297
+ "public"
2298
+ ]>>;
2324
2299
  }, "strip", z.ZodTypeAny, {
2325
- source: string;
2326
- format: "markdown" | "plain" | "html";
2327
- visibility: "private" | "shared" | "public";
2328
- action: "create" | "bulk_create" | "from_template";
2329
- title?: string | undefined;
2300
+ action: "bulk_create" | "create" | "from_template";
2301
+ archive_id?: string | undefined;
2302
+ content?: string | undefined;
2303
+ format: "html" | "markdown" | "plain";
2330
2304
  notes?: {
2331
- format: "markdown" | "plain" | "html";
2332
2305
  content: string;
2333
- title?: string | undefined;
2306
+ format: "html" | "markdown" | "plain";
2334
2307
  tags?: string[] | undefined;
2308
+ title?: string | undefined;
2335
2309
  }[] | undefined;
2310
+ source: string;
2336
2311
  tags?: string[] | undefined;
2337
- archive_id?: string | undefined;
2338
- content?: string | undefined;
2339
2312
  template?: string | undefined;
2313
+ title?: string | undefined;
2340
2314
  variables?: Record<string, string> | undefined;
2315
+ visibility: "private" | "public" | "shared";
2341
2316
  }, {
2342
- action: "create" | "bulk_create" | "from_template";
2343
- title?: string | undefined;
2317
+ action: "bulk_create" | "create" | "from_template";
2318
+ archive_id?: string | undefined;
2319
+ content?: string | undefined;
2320
+ format?: "html" | "markdown" | "plain" | undefined;
2344
2321
  notes?: {
2345
2322
  content: string;
2346
- title?: string | undefined;
2323
+ format?: "html" | "markdown" | "plain" | undefined;
2347
2324
  tags?: string[] | undefined;
2348
- format?: "markdown" | "plain" | "html" | undefined;
2325
+ title?: string | undefined;
2349
2326
  }[] | undefined;
2350
- tags?: string[] | undefined;
2351
2327
  source?: string | undefined;
2352
- archive_id?: string | undefined;
2353
- format?: "markdown" | "plain" | "html" | undefined;
2354
- visibility?: "private" | "shared" | "public" | undefined;
2355
- content?: string | undefined;
2328
+ tags?: string[] | undefined;
2356
2329
  template?: string | undefined;
2330
+ title?: string | undefined;
2357
2331
  variables?: Record<string, string> | undefined;
2332
+ visibility?: "private" | "public" | "shared" | undefined;
2358
2333
  }>;
2359
2334
  type CaptureKnowledgeInput = z.infer<typeof CaptureKnowledgeInputSchema>;
2360
2335
  declare const ManageNoteInputSchema: z.ZodObject<{
2361
- action: z.ZodEnum<["update", "delete", "restore", "archive", "unarchive", "star", "unstar"]>;
2362
- note_id: z.ZodString;
2363
- title: z.ZodOptional<z.ZodString>;
2336
+ action: z.ZodEnum<[
2337
+ "update",
2338
+ "delete",
2339
+ "restore",
2340
+ "archive",
2341
+ "unarchive",
2342
+ "star",
2343
+ "unstar"
2344
+ ]>;
2364
2345
  content: z.ZodOptional<z.ZodString>;
2365
2346
  format: z.ZodOptional<z.ZodString>;
2347
+ note_id: z.ZodString;
2348
+ title: z.ZodOptional<z.ZodString>;
2366
2349
  visibility: z.ZodOptional<z.ZodString>;
2367
2350
  }, "strip", z.ZodTypeAny, {
2368
- action: "update" | "delete" | "restore" | "archive" | "unarchive" | "star" | "unstar";
2351
+ action: "archive" | "delete" | "restore" | "star" | "unarchive" | "unstar" | "update";
2352
+ content?: string | undefined;
2353
+ format?: string | undefined;
2369
2354
  note_id: string;
2370
2355
  title?: string | undefined;
2371
- format?: string | undefined;
2372
2356
  visibility?: string | undefined;
2373
- content?: string | undefined;
2374
2357
  }, {
2375
- action: "update" | "delete" | "restore" | "archive" | "unarchive" | "star" | "unstar";
2358
+ action: "archive" | "delete" | "restore" | "star" | "unarchive" | "unstar" | "update";
2359
+ content?: string | undefined;
2360
+ format?: string | undefined;
2376
2361
  note_id: string;
2377
2362
  title?: string | undefined;
2378
- format?: string | undefined;
2379
2363
  visibility?: string | undefined;
2380
- content?: string | undefined;
2381
2364
  }>;
2382
2365
  type ManageNoteInput = z.infer<typeof ManageNoteInputSchema>;
2383
2366
  declare const SearchInputSchema: z.ZodObject<{
2384
- query: z.ZodString;
2385
- mode: z.ZodDefault<z.ZodEnum<["text", "semantic", "hybrid", "auto"]>>;
2386
- query_embedding: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
2387
- embeddingSetId: z.ZodOptional<z.ZodString>;
2388
- limit: z.ZodDefault<z.ZodNumber>;
2389
- offset: z.ZodDefault<z.ZodNumber>;
2390
- tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2391
2367
  collection_id: z.ZodOptional<z.ZodString>;
2392
2368
  date_from: z.ZodOptional<z.ZodDate>;
2393
2369
  date_to: z.ZodOptional<z.ZodDate>;
2394
- is_starred: z.ZodOptional<z.ZodBoolean>;
2370
+ embeddingSetId: z.ZodOptional<z.ZodString>;
2371
+ format: z.ZodOptional<z.ZodEnum<[
2372
+ "markdown",
2373
+ "plain",
2374
+ "html"
2375
+ ]>>;
2376
+ include_facets: z.ZodDefault<z.ZodBoolean>;
2395
2377
  is_archived: z.ZodOptional<z.ZodBoolean>;
2396
- format: z.ZodOptional<z.ZodEnum<["markdown", "plain", "html"]>>;
2378
+ is_starred: z.ZodOptional<z.ZodBoolean>;
2379
+ limit: z.ZodDefault<z.ZodNumber>;
2380
+ mode: z.ZodDefault<z.ZodEnum<[
2381
+ "text",
2382
+ "semantic",
2383
+ "hybrid",
2384
+ "auto"
2385
+ ]>>;
2386
+ offset: z.ZodDefault<z.ZodNumber>;
2387
+ query_embedding: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
2388
+ query: z.ZodString;
2397
2389
  source: z.ZodOptional<z.ZodString>;
2398
- visibility: z.ZodOptional<z.ZodEnum<["private", "shared", "public"]>>;
2399
- include_facets: z.ZodDefault<z.ZodBoolean>;
2390
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2391
+ visibility: z.ZodOptional<z.ZodEnum<[
2392
+ "private",
2393
+ "shared",
2394
+ "public"
2395
+ ]>>;
2400
2396
  }, "strip", z.ZodTypeAny, {
2401
- limit: number;
2402
- offset: number;
2403
- include_facets: boolean;
2404
- mode: "auto" | "text" | "semantic" | "hybrid";
2405
- query: string;
2406
- tags?: string[] | undefined;
2407
- source?: string | undefined;
2408
- format?: "markdown" | "plain" | "html" | undefined;
2409
- visibility?: "private" | "shared" | "public" | undefined;
2410
- is_starred?: boolean | undefined;
2411
- is_archived?: boolean | undefined;
2412
2397
  collection_id?: string | undefined;
2413
2398
  date_from?: Date | undefined;
2414
2399
  date_to?: Date | undefined;
2415
2400
  embeddingSetId?: string | undefined;
2401
+ format?: "html" | "markdown" | "plain" | undefined;
2402
+ include_facets: boolean;
2403
+ is_archived?: boolean | undefined;
2404
+ is_starred?: boolean | undefined;
2405
+ limit: number;
2406
+ mode: "auto" | "hybrid" | "semantic" | "text";
2407
+ offset: number;
2416
2408
  query_embedding?: number[] | undefined;
2417
- }, {
2418
2409
  query: string;
2419
- tags?: string[] | undefined;
2420
2410
  source?: string | undefined;
2421
- format?: "markdown" | "plain" | "html" | undefined;
2422
- visibility?: "private" | "shared" | "public" | undefined;
2423
- is_starred?: boolean | undefined;
2424
- is_archived?: boolean | undefined;
2425
- limit?: number | undefined;
2426
- offset?: number | undefined;
2411
+ tags?: string[] | undefined;
2412
+ visibility?: "private" | "public" | "shared" | undefined;
2413
+ }, {
2427
2414
  collection_id?: string | undefined;
2428
2415
  date_from?: Date | undefined;
2429
2416
  date_to?: Date | undefined;
2430
- include_facets?: boolean | undefined;
2431
- mode?: "auto" | "text" | "semantic" | "hybrid" | undefined;
2432
2417
  embeddingSetId?: string | undefined;
2418
+ format?: "html" | "markdown" | "plain" | undefined;
2419
+ include_facets?: boolean | undefined;
2420
+ is_archived?: boolean | undefined;
2421
+ is_starred?: boolean | undefined;
2422
+ limit?: number | undefined;
2423
+ mode?: "auto" | "hybrid" | "semantic" | "text" | undefined;
2424
+ offset?: number | undefined;
2433
2425
  query_embedding?: number[] | undefined;
2426
+ query: string;
2427
+ source?: string | undefined;
2428
+ tags?: string[] | undefined;
2429
+ visibility?: "private" | "public" | "shared" | undefined;
2434
2430
  }>;
2435
2431
  type SearchInput = z.infer<typeof SearchInputSchema>;
2436
-
2437
2432
  /**
2438
2433
  * FortemiToolManifest — registry of all Fortemi tool definitions.
2439
2434
  *
@@ -2445,12 +2440,11 @@ type SearchInput = z.infer<typeof SearchInputSchema>;
2445
2440
  * operations. Additional tools will be added incrementally as repositories
2446
2441
  * are implemented.
2447
2442
  */
2448
-
2449
2443
  interface FortemiToolDefinition {
2450
2444
  id: string;
2451
2445
  name: string;
2452
2446
  description: string;
2453
- category: 'capture' | 'search' | 'manage' | 'organize' | 'process' | 'analyze' | 'system';
2447
+ category: 'analyze' | 'capture' | 'manage' | 'organize' | 'process' | 'search' | 'system';
2454
2448
  inputSchema: ZodType;
2455
2449
  tags: string[];
2456
2450
  sideEffects: boolean;
@@ -2486,7 +2480,6 @@ declare class FortemiToolManifest {
2486
2480
  getCategoryCounts(): Record<string, number>;
2487
2481
  }
2488
2482
  declare const fortemiManifest: FortemiToolManifest;
2489
-
2490
2483
  declare const GetNoteInputSchema: z.ZodObject<{
2491
2484
  note_id: z.ZodString;
2492
2485
  }, "strip", z.ZodTypeAny, {
@@ -2496,51 +2489,61 @@ declare const GetNoteInputSchema: z.ZodObject<{
2496
2489
  }>;
2497
2490
  type GetNoteInput = z.infer<typeof GetNoteInputSchema>;
2498
2491
  declare function getNote(db: DatabaseClient, rawInput: unknown, events?: TypedEventBus): Promise<NoteFull>;
2499
-
2500
2492
  declare const ListNotesInputSchema: z.ZodObject<{
2493
+ collection_id: z.ZodOptional<z.ZodString>;
2494
+ include_deleted: z.ZodOptional<z.ZodBoolean>;
2495
+ is_archived: z.ZodOptional<z.ZodBoolean>;
2496
+ is_starred: z.ZodOptional<z.ZodBoolean>;
2501
2497
  limit: z.ZodDefault<z.ZodNumber>;
2502
2498
  offset: z.ZodDefault<z.ZodNumber>;
2503
- sort: z.ZodDefault<z.ZodEnum<["created_at", "updated_at", "title"]>>;
2504
- order: z.ZodDefault<z.ZodEnum<["asc", "desc"]>>;
2505
- is_starred: z.ZodOptional<z.ZodBoolean>;
2506
- is_archived: z.ZodOptional<z.ZodBoolean>;
2499
+ order: z.ZodDefault<z.ZodEnum<[
2500
+ "asc",
2501
+ "desc"
2502
+ ]>>;
2503
+ sort: z.ZodDefault<z.ZodEnum<[
2504
+ "created_at",
2505
+ "updated_at",
2506
+ "title"
2507
+ ]>>;
2507
2508
  tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2508
- collection_id: z.ZodOptional<z.ZodString>;
2509
- include_deleted: z.ZodOptional<z.ZodBoolean>;
2510
2509
  }, "strip", z.ZodTypeAny, {
2511
- sort: "title" | "created_at" | "updated_at";
2510
+ collection_id?: string | undefined;
2511
+ include_deleted?: boolean | undefined;
2512
+ is_archived?: boolean | undefined;
2513
+ is_starred?: boolean | undefined;
2512
2514
  limit: number;
2513
2515
  offset: number;
2514
2516
  order: "asc" | "desc";
2517
+ sort: "created_at" | "title" | "updated_at";
2515
2518
  tags?: string[] | undefined;
2516
- is_starred?: boolean | undefined;
2517
- is_archived?: boolean | undefined;
2518
- include_deleted?: boolean | undefined;
2519
- collection_id?: string | undefined;
2520
2519
  }, {
2521
- tags?: string[] | undefined;
2522
- sort?: "title" | "created_at" | "updated_at" | undefined;
2523
- is_starred?: boolean | undefined;
2520
+ collection_id?: string | undefined;
2521
+ include_deleted?: boolean | undefined;
2524
2522
  is_archived?: boolean | undefined;
2523
+ is_starred?: boolean | undefined;
2525
2524
  limit?: number | undefined;
2526
2525
  offset?: number | undefined;
2527
2526
  order?: "asc" | "desc" | undefined;
2528
- include_deleted?: boolean | undefined;
2529
- collection_id?: string | undefined;
2527
+ sort?: "created_at" | "title" | "updated_at" | undefined;
2528
+ tags?: string[] | undefined;
2530
2529
  }>;
2531
2530
  type ListNotesInput = z.infer<typeof ListNotesInputSchema>;
2532
2531
  declare function listNotes(db: DatabaseClient, rawInput: unknown, events?: TypedEventBus): Promise<PaginatedResult<NoteSummary>>;
2533
-
2534
2532
  declare const ManageTagsInputSchema: z.ZodObject<{
2535
- action: z.ZodEnum<["add", "remove", "list_for_note", "list_all"]>;
2533
+ action: z.ZodEnum<[
2534
+ "add",
2535
+ "remove",
2536
+ "list_for_note",
2537
+ "list_all"
2538
+ ]>;
2536
2539
  note_id: z.ZodOptional<z.ZodString>;
2537
2540
  tag: z.ZodOptional<z.ZodString>;
2538
2541
  }, "strip", z.ZodTypeAny, {
2539
- action: "add" | "remove" | "list_for_note" | "list_all";
2542
+ action: "add" | "list_all" | "list_for_note" | "remove";
2540
2543
  note_id?: string | undefined;
2541
2544
  tag?: string | undefined;
2542
2545
  }, {
2543
- action: "add" | "remove" | "list_for_note" | "list_all";
2546
+ action: "add" | "list_all" | "list_for_note" | "remove";
2544
2547
  note_id?: string | undefined;
2545
2548
  tag?: string | undefined;
2546
2549
  }>;
@@ -2549,32 +2552,38 @@ interface ManageTagsResult {
2549
2552
  action: string;
2550
2553
  tags?: string[];
2551
2554
  all_tags?: Array<{
2552
- tag: string;
2553
2555
  count: number;
2556
+ tag: string;
2554
2557
  }>;
2555
2558
  }
2556
2559
  declare function manageTags(db: DatabaseClient, rawInput: unknown): Promise<ManageTagsResult>;
2557
-
2558
2560
  declare const ManageCollectionsInputSchema: z.ZodObject<{
2559
- action: z.ZodEnum<["create", "list", "list_tree", "assign", "unassign", "delete"]>;
2560
- name: z.ZodOptional<z.ZodString>;
2561
- description: z.ZodOptional<z.ZodString>;
2562
- parent_id: z.ZodOptional<z.ZodString>;
2561
+ action: z.ZodEnum<[
2562
+ "create",
2563
+ "list",
2564
+ "list_tree",
2565
+ "assign",
2566
+ "unassign",
2567
+ "delete"
2568
+ ]>;
2563
2569
  collection_id: z.ZodOptional<z.ZodString>;
2570
+ description: z.ZodOptional<z.ZodString>;
2571
+ name: z.ZodOptional<z.ZodString>;
2564
2572
  note_id: z.ZodOptional<z.ZodString>;
2573
+ parent_id: z.ZodOptional<z.ZodString>;
2565
2574
  }, "strip", z.ZodTypeAny, {
2566
- action: "create" | "delete" | "list" | "assign" | "unassign" | "list_tree";
2567
- name?: string | undefined;
2575
+ action: "assign" | "create" | "delete" | "list_tree" | "list" | "unassign";
2568
2576
  collection_id?: string | undefined;
2569
- note_id?: string | undefined;
2570
2577
  description?: string | undefined;
2578
+ name?: string | undefined;
2579
+ note_id?: string | undefined;
2571
2580
  parent_id?: string | undefined;
2572
2581
  }, {
2573
- action: "create" | "delete" | "list" | "assign" | "unassign" | "list_tree";
2574
- name?: string | undefined;
2582
+ action: "assign" | "create" | "delete" | "list_tree" | "list" | "unassign";
2575
2583
  collection_id?: string | undefined;
2576
- note_id?: string | undefined;
2577
2584
  description?: string | undefined;
2585
+ name?: string | undefined;
2586
+ note_id?: string | undefined;
2578
2587
  parent_id?: string | undefined;
2579
2588
  }>;
2580
2589
  type ManageCollectionsInput = z.infer<typeof ManageCollectionsInputSchema>;
@@ -2589,28 +2598,32 @@ interface ManageCollectionsResult {
2589
2598
  note_id?: string;
2590
2599
  }
2591
2600
  declare function manageCollections(db: DatabaseClient, rawInput: unknown): Promise<ManageCollectionsResult>;
2592
-
2593
2601
  declare const ManageLinksInputSchema: z.ZodObject<{
2594
- action: z.ZodEnum<["create", "list", "backlinks", "delete"]>;
2595
- source_note_id: z.ZodOptional<z.ZodString>;
2596
- target_note_id: z.ZodOptional<z.ZodString>;
2602
+ action: z.ZodEnum<[
2603
+ "create",
2604
+ "list",
2605
+ "backlinks",
2606
+ "delete"
2607
+ ]>;
2597
2608
  link_id: z.ZodOptional<z.ZodString>;
2598
2609
  link_type: z.ZodDefault<z.ZodString>;
2599
2610
  note_id: z.ZodOptional<z.ZodString>;
2611
+ source_note_id: z.ZodOptional<z.ZodString>;
2612
+ target_note_id: z.ZodOptional<z.ZodString>;
2600
2613
  }, "strip", z.ZodTypeAny, {
2601
- action: "create" | "delete" | "list" | "backlinks";
2614
+ action: "backlinks" | "create" | "delete" | "list";
2615
+ link_id?: string | undefined;
2602
2616
  link_type: string;
2603
2617
  note_id?: string | undefined;
2604
2618
  source_note_id?: string | undefined;
2605
2619
  target_note_id?: string | undefined;
2606
- link_id?: string | undefined;
2607
2620
  }, {
2608
- action: "create" | "delete" | "list" | "backlinks";
2621
+ action: "backlinks" | "create" | "delete" | "list";
2622
+ link_id?: string | undefined;
2623
+ link_type?: string | undefined;
2609
2624
  note_id?: string | undefined;
2610
2625
  source_note_id?: string | undefined;
2611
2626
  target_note_id?: string | undefined;
2612
- link_id?: string | undefined;
2613
- link_type?: string | undefined;
2614
2627
  }>;
2615
2628
  type ManageLinksInput = z.infer<typeof ManageLinksInputSchema>;
2616
2629
  interface ManageLinksResult {
@@ -2622,9 +2635,13 @@ interface ManageLinksResult {
2622
2635
  link_id?: string;
2623
2636
  }
2624
2637
  declare function manageLinks(db: DatabaseClient, rawInput: unknown): Promise<ManageLinksResult>;
2625
-
2626
2638
  declare const ManageArchiveInputSchema: z.ZodObject<{
2627
- action: z.ZodEnum<["list", "create", "switch", "delete"]>;
2639
+ action: z.ZodEnum<[
2640
+ "list",
2641
+ "create",
2642
+ "switch",
2643
+ "delete"
2644
+ ]>;
2628
2645
  name: z.ZodOptional<z.ZodString>;
2629
2646
  }, "strip", z.ZodTypeAny, {
2630
2647
  action: "create" | "delete" | "list" | "switch";
@@ -2641,15 +2658,19 @@ interface ManageArchiveResult {
2641
2658
  name?: string;
2642
2659
  }
2643
2660
  declare function manageArchive(archiveManager: ArchiveManager, rawInput: unknown): Promise<ManageArchiveResult>;
2644
-
2645
2661
  declare const ManageCapabilitiesInputSchema: z.ZodObject<{
2646
- action: z.ZodEnum<["list", "enable", "disable", "status"]>;
2662
+ action: z.ZodEnum<[
2663
+ "list",
2664
+ "enable",
2665
+ "disable",
2666
+ "status"
2667
+ ]>;
2647
2668
  capability: z.ZodOptional<z.ZodString>;
2648
2669
  }, "strip", z.ZodTypeAny, {
2649
- action: "status" | "enable" | "disable" | "list";
2670
+ action: "disable" | "enable" | "list" | "status";
2650
2671
  capability?: string | undefined;
2651
2672
  }, {
2652
- action: "status" | "enable" | "disable" | "list";
2673
+ action: "disable" | "enable" | "list" | "status";
2653
2674
  capability?: string | undefined;
2654
2675
  }>;
2655
2676
  type ManageCapabilitiesInput = z.infer<typeof ManageCapabilitiesInputSchema>;
@@ -2667,7 +2688,6 @@ interface ManageCapabilitiesResult {
2667
2688
  capability?: CapabilityInfo;
2668
2689
  }
2669
2690
  declare function manageCapabilities(capabilityManager: CapabilityManager, rawInput: unknown): Promise<ManageCapabilitiesResult>;
2670
-
2671
2691
  /**
2672
2692
  * AttachmentsRepository — attach and retrieve binary files linked to notes.
2673
2693
  *
@@ -2680,16 +2700,15 @@ declare function manageCapabilities(capabilityManager: CapabilityManager, rawInp
2680
2700
  * - Reconcile/GC blob bytes against the canonical manifest live set
2681
2701
  * (ADR-013 D2/D4: manifests are the sole lifecycle authority)
2682
2702
  */
2683
-
2684
2703
  interface AttachmentRow {
2685
2704
  id: string;
2686
2705
  note_id: string;
2687
2706
  blob_id: string;
2688
- document_type_id: string | null;
2689
- mime_type: string | null;
2690
- extracted_text: string | null;
2707
+ document_type_id: null | string;
2708
+ mime_type: null | string;
2709
+ extracted_text: null | string;
2691
2710
  filename: string;
2692
- display_name: string | null;
2711
+ display_name: null | string;
2693
2712
  position: number;
2694
2713
  created_at: Date;
2695
2714
  deleted_at: Date | null;
@@ -2698,7 +2717,7 @@ interface AttachmentBlobRow {
2698
2717
  id: string;
2699
2718
  content_hash: string;
2700
2719
  size_bytes: number;
2701
- storage_path: string | null;
2720
+ storage_path: null | string;
2702
2721
  created_at: Date;
2703
2722
  }
2704
2723
  interface AttachInput {
@@ -2741,7 +2760,7 @@ declare class AttachmentsRepository {
2741
2760
  * the recoverable reference-only state (metadata intact, bytes
2742
2761
  * re-hydratable from a shard sidecar or a re-attach of the same content).
2743
2762
  */
2744
- getBlob(attachmentId: string): Promise<Uint8Array | null>;
2763
+ getBlob(attachmentId: string): Promise<null | Uint8Array>;
2745
2764
  /**
2746
2765
  * True when the attachment's bytes are physically present in the BlobStore.
2747
2766
  * False means reference-only (recoverable), not an error.
@@ -2778,35 +2797,40 @@ declare class AttachmentsRepository {
2778
2797
  gcBlobs(opts?: BlobGcOptions): Promise<BlobGcResult>;
2779
2798
  private blobChecksumOf;
2780
2799
  }
2781
-
2782
2800
  declare const ManageAttachmentsInputSchema: z.ZodObject<{
2783
- action: z.ZodEnum<["attach", "list", "get", "get_blob", "delete"]>;
2784
- note_id: z.ZodOptional<z.ZodString>;
2785
- attachment_id: z.ZodOptional<z.ZodString>;
2786
2801
  /** Base64-encoded file data for the 'attach' action */
2787
2802
  data_base64: z.ZodOptional<z.ZodString>;
2803
+ action: z.ZodEnum<[
2804
+ "attach",
2805
+ "list",
2806
+ "get",
2807
+ "get_blob",
2808
+ "delete"
2809
+ ]>;
2810
+ attachment_id: z.ZodOptional<z.ZodString>;
2811
+ display_name: z.ZodOptional<z.ZodString>;
2812
+ extracted_text: z.ZodOptional<z.ZodString>;
2788
2813
  filename: z.ZodOptional<z.ZodString>;
2789
2814
  mime_type: z.ZodOptional<z.ZodString>;
2790
- extracted_text: z.ZodOptional<z.ZodString>;
2791
- display_name: z.ZodOptional<z.ZodString>;
2815
+ note_id: z.ZodOptional<z.ZodString>;
2792
2816
  }, "strip", z.ZodTypeAny, {
2793
- action: "delete" | "list" | "attach" | "get" | "get_blob";
2794
- filename?: string | undefined;
2795
- note_id?: string | undefined;
2796
- extracted_text?: string | undefined;
2817
+ action: "attach" | "delete" | "get_blob" | "get" | "list";
2797
2818
  attachment_id?: string | undefined;
2798
2819
  data_base64?: string | undefined;
2799
- mime_type?: string | undefined;
2800
2820
  display_name?: string | undefined;
2801
- }, {
2802
- action: "delete" | "list" | "attach" | "get" | "get_blob";
2821
+ extracted_text?: string | undefined;
2803
2822
  filename?: string | undefined;
2823
+ mime_type?: string | undefined;
2804
2824
  note_id?: string | undefined;
2805
- extracted_text?: string | undefined;
2825
+ }, {
2826
+ action: "attach" | "delete" | "get_blob" | "get" | "list";
2806
2827
  attachment_id?: string | undefined;
2807
2828
  data_base64?: string | undefined;
2808
- mime_type?: string | undefined;
2809
2829
  display_name?: string | undefined;
2830
+ extracted_text?: string | undefined;
2831
+ filename?: string | undefined;
2832
+ mime_type?: string | undefined;
2833
+ note_id?: string | undefined;
2810
2834
  }>;
2811
2835
  type ManageAttachmentsInput = z.infer<typeof ManageAttachmentsInputSchema>;
2812
2836
  interface ManageAttachmentsResult {
@@ -2819,7 +2843,6 @@ interface ManageAttachmentsResult {
2819
2843
  size_bytes?: number;
2820
2844
  }
2821
2845
  declare function manageAttachments(db: DatabaseClient, blobStore: BlobStore, rawInput: unknown): Promise<ManageAttachmentsResult>;
2822
-
2823
2846
  /**
2824
2847
  * GPU capability detection for WebGPU-based LLM inference.
2825
2848
  * Used to select appropriate model tier based on available GPU memory.
@@ -2833,7 +2856,7 @@ interface GpuCapabilities {
2833
2856
  maxBufferSizeBytes: number;
2834
2857
  supportsF16: boolean;
2835
2858
  }
2836
- type VramTier = 'low' | 'medium' | 'high' | 'unknown';
2859
+ type VramTier = 'high' | 'low' | 'medium' | 'unknown';
2837
2860
  declare function detectGpuCapabilities(): Promise<GpuCapabilities>;
2838
2861
  declare function estimateVramTier(caps: GpuCapabilities): VramTier;
2839
2862
  /**
@@ -2841,15 +2864,13 @@ declare function estimateVramTier(caps: GpuCapabilities): VramTier;
2841
2864
  * Uses f32 quantization when f16 shaders aren't available (e.g., SwiftShader).
2842
2865
  */
2843
2866
  declare function selectLlmModel(tier: VramTier, supportsF16?: boolean): string;
2844
-
2845
2867
  /**
2846
2868
  * Enhanced inference capability detection.
2847
2869
  * Extends gpu-detect.ts with VRAM estimation, model fit, Chrome AI, and WebNN detection.
2848
2870
  *
2849
2871
  * @implements #115 hardware capability detection improvements
2850
2872
  */
2851
-
2852
- type RecommendedTier = 'high' | 'medium' | 'low' | 'cpu-only';
2873
+ type RecommendedTier = 'cpu-only' | 'high' | 'low' | 'medium';
2853
2874
  interface InferenceCapabilities {
2854
2875
  webgpu: boolean;
2855
2876
  wasm: boolean;
@@ -2881,7 +2902,6 @@ declare function estimateModelFit(modelSizeMB: number, availableVramMB: number):
2881
2902
  * Superset of detectGpuCapabilities() — adds VRAM estimation, WebNN, Chrome AI, etc.
2882
2903
  */
2883
2904
  declare function detectInferenceCapabilities(): Promise<InferenceCapabilities>;
2884
-
2885
2905
  /**
2886
2906
  * Text chunking utility for embedding generation.
2887
2907
  * Splits long text into overlapping chunks suitable for embedding models.
@@ -2890,7 +2910,6 @@ declare function detectInferenceCapabilities(): Promise<InferenceCapabilities>;
2890
2910
  */
2891
2911
  /** Split text into overlapping chunks for embedding. */
2892
2912
  declare function chunkText(text: string, maxChars?: number, overlap?: number): string[];
2893
-
2894
2913
  /**
2895
2914
  * Embedding generation job handler.
2896
2915
  * Generates and stores vector embeddings for note content.
@@ -2898,7 +2917,6 @@ declare function chunkText(text: string, maxChars?: number, overlap?: number): s
2898
2917
  *
2899
2918
  * @implements #63 embedding generation
2900
2919
  */
2901
-
2902
2920
  /** Type for the embed function — injected by the semantic capability module */
2903
2921
  type EmbedFunction = (texts: string[]) => Promise<number[][]>;
2904
2922
  declare function setEmbedFunction(fn: EmbedFunction | null): void;
@@ -2907,7 +2925,6 @@ declare function getEmbedFunction(): EmbedFunction | null;
2907
2925
  declare function embeddingGenerationHandler(job: {
2908
2926
  note_id: string;
2909
2927
  }, db: DatabaseClient): Promise<unknown>;
2910
-
2911
2928
  /**
2912
2929
  * LLM completion function injection.
2913
2930
  * Provides the slot for an LLM function — injected by the llm capability module.
@@ -2922,7 +2939,6 @@ type LlmCompleteFn = (prompt: string, options?: {
2922
2939
  }) => Promise<string>;
2923
2940
  declare function setLlmFunction(fn: LlmCompleteFn | null): void;
2924
2941
  declare function getLlmFunction(): LlmCompleteFn | null;
2925
-
2926
2942
  /**
2927
2943
  * Auto-tagging utility using embedding similarity.
2928
2944
  * Suggests tags based on cosine similarity between note and tag vocabulary embeddings.
@@ -2936,7 +2952,6 @@ declare function cosineSimilarity(a: number[], b: number[]): number;
2936
2952
  * Returns tags sorted by descending similarity score, filtered by threshold.
2937
2953
  */
2938
2954
  declare function suggestTags(noteEmbedding: number[], tagEmbeddings: Map<string, number[]>, threshold?: number, maxTags?: number): string[];
2939
-
2940
2955
  /**
2941
2956
  * Off-main-thread query-embedding transport for the semantic capability.
2942
2957
  *
@@ -2964,7 +2979,6 @@ declare function suggestTags(noteEmbedding: number[], tagEmbeddings: Map<string,
2964
2979
  *
2965
2980
  * @implements #180 off-main-thread / pluggable query-embedding transport
2966
2981
  */
2967
-
2968
2982
  /**
2969
2983
  * Minimal transport contract satisfied by both `Worker` and `MessagePort`.
2970
2984
  * Core only needs to post messages and listen for replies.
@@ -3026,8 +3040,8 @@ interface EmbedWorkerOptions {
3026
3040
  * ```
3027
3041
  */
3028
3042
  declare function createWorkerEmbedFunction(port: EmbedTransportPort, options?: EmbedWorkerOptions): {
3029
- embed: EmbedFunction;
3030
3043
  dispose: () => void;
3044
+ embed: EmbedFunction;
3031
3045
  };
3032
3046
  /**
3033
3047
  * Wire a host-owned embed function to the message protocol (worker side).
@@ -3059,7 +3073,6 @@ declare function createWorkerEmbedFunction(port: EmbedTransportPort, options?: E
3059
3073
  * ```
3060
3074
  */
3061
3075
  declare function handleEmbedRequests(port: EmbedTransportPort, embed: EmbedFunction): () => void;
3062
-
3063
3076
  /**
3064
3077
  * Semantic capability loader — registers the embedding pipeline with CapabilityManager.
3065
3078
  *
@@ -3074,7 +3087,6 @@ declare function handleEmbedRequests(port: EmbedTransportPort, embed: EmbedFunct
3074
3087
  * @implements #62 semantic capability loader
3075
3088
  * @implements #180 off-main-thread / pluggable query-embedding transport
3076
3089
  */
3077
-
3078
3090
  /**
3079
3091
  * Register the semantic capability with a CapabilityManager.
3080
3092
  * The loader will be called when capabilityManager.enable('semantic') is invoked.
@@ -3112,7 +3124,6 @@ declare function registerSemanticCapabilityWorker(manager: CapabilityManager, po
3112
3124
  * any active off-main-thread transport. Called when the capability is disabled.
3113
3125
  */
3114
3126
  declare function unregisterSemanticCapability(): void;
3115
-
3116
3127
  /**
3117
3128
  * LLM capability loader — registers the local LLM with CapabilityManager.
3118
3129
  *
@@ -3121,7 +3132,6 @@ declare function unregisterSemanticCapability(): void;
3121
3132
  *
3122
3133
  * @implements #65 LLM capability loader
3123
3134
  */
3124
-
3125
3135
  interface LlmCapabilityOptions {
3126
3136
  modelOverride?: string;
3127
3137
  onProgress?: (pct: number, text: string) => void;
@@ -3139,7 +3149,6 @@ declare function registerLlmCapability(manager: CapabilityManager, completeFn: L
3139
3149
  * Unregister the LLM capability — clears the completion function.
3140
3150
  */
3141
3151
  declare function unregisterLlmCapability(): void;
3142
-
3143
3152
  /**
3144
3153
  * Formal InferenceProvider interface.
3145
3154
  * Core contract for all inference providers — remote APIs, local servers, in-browser models.
@@ -3179,10 +3188,10 @@ interface CompletionResponse {
3179
3188
  text: string;
3180
3189
  model: string;
3181
3190
  usage?: {
3182
- promptTokens: number;
3183
3191
  completionTokens: number;
3192
+ promptTokens: number;
3184
3193
  };
3185
- finishReason?: 'stop' | 'length' | 'content_filter';
3194
+ finishReason?: 'content_filter' | 'length' | 'stop';
3186
3195
  }
3187
3196
  interface StreamChunk {
3188
3197
  text: string;
@@ -3195,13 +3204,13 @@ interface ModelInfo {
3195
3204
  contextWindow?: number;
3196
3205
  owned_by?: string;
3197
3206
  }
3198
- type ProbeStatus = 'ok' | 'degraded' | 'down';
3207
+ type ProbeStatus = 'degraded' | 'down' | 'ok';
3199
3208
  interface ProbeResult {
3200
3209
  status: ProbeStatus;
3201
3210
  latencyMs: number;
3202
3211
  message?: string;
3203
3212
  }
3204
- type ProviderTier = 'remote' | 'local-server' | 'in-browser' | 'chrome-ai';
3213
+ type ProviderTier = 'chrome-ai' | 'in-browser' | 'local-server' | 'remote';
3205
3214
  interface InferenceProvider {
3206
3215
  readonly id: string;
3207
3216
  readonly name: string;
@@ -3220,14 +3229,12 @@ interface InferenceProvider {
3220
3229
  /** Clean up resources */
3221
3230
  dispose(): void;
3222
3231
  }
3223
-
3224
3232
  /**
3225
3233
  * ProviderRegistry — manages InferenceProvider instances.
3226
3234
  * Supports add/remove/getActive/setActive and derives CapabilityManager state.
3227
3235
  *
3228
3236
  * @implements #112 provider registry
3229
3237
  */
3230
-
3231
3238
  declare class ProviderRegistry {
3232
3239
  private events?;
3233
3240
  private providers;
@@ -3274,11 +3281,10 @@ declare class ProviderRegistry {
3274
3281
  */
3275
3282
  declare function createLegacyProvider(options: {
3276
3283
  embedFn?: EmbedFunction | null;
3277
- llmFn?: LlmCompleteFn | null;
3278
3284
  id?: string;
3285
+ llmFn?: LlmCompleteFn | null;
3279
3286
  name?: string;
3280
3287
  }): InferenceProvider;
3281
-
3282
3288
  /**
3283
3289
  * OpenAI-compatible inference provider.
3284
3290
  * Works with OpenAI, OpenRouter, Anthropic (via OpenRouter), Ollama, LM Studio,
@@ -3288,7 +3294,6 @@ declare function createLegacyProvider(options: {
3288
3294
  *
3289
3295
  * @implements #113 remote provider support
3290
3296
  */
3291
-
3292
3297
  interface OpenAIProviderConfig {
3293
3298
  id: string;
3294
3299
  name: string;
@@ -3326,7 +3331,6 @@ declare class OpenAICompatibleProvider implements InferenceProvider {
3326
3331
  private fetch;
3327
3332
  private rawFetch;
3328
3333
  }
3329
-
3330
3334
  /**
3331
3335
  * Local inference server auto-discovery.
3332
3336
  * Probes known local endpoints (Ollama, LM Studio, llama.cpp, vLLM, Jan, LocalAI)
@@ -3334,7 +3338,6 @@ declare class OpenAICompatibleProvider implements InferenceProvider {
3334
3338
  *
3335
3339
  * @implements #116 local server auto-discovery
3336
3340
  */
3337
-
3338
3341
  interface LocalEndpoint {
3339
3342
  id: string;
3340
3343
  name: string;
@@ -3356,7 +3359,7 @@ interface DiscoveryOptions {
3356
3359
  skipPorts?: number[];
3357
3360
  }
3358
3361
  declare const LOCAL_ENDPOINTS: LocalEndpoint[];
3359
- type ModelCategory = 'embedding' | 'vision' | 'chat';
3362
+ type ModelCategory = 'chat' | 'embedding' | 'vision';
3360
3363
  /**
3361
3364
  * Classify a model by its ID/name into embedding, vision, or chat.
3362
3365
  */
@@ -3366,7 +3369,6 @@ declare function classifyModel(modelId: string): ModelCategory;
3366
3369
  * Returns all reachable providers with their available models.
3367
3370
  */
3368
3371
  declare function discoverLocalProviders(options?: DiscoveryOptions): Promise<DiscoveredProvider[]>;
3369
-
3370
3372
  /**
3371
3373
  * FallbackRouter — wraps multiple InferenceProviders with automatic failover.
3372
3374
  * Routes requests to the highest-priority available provider, falling through
@@ -3374,7 +3376,6 @@ declare function discoverLocalProviders(options?: DiscoveryOptions): Promise<Dis
3374
3376
  *
3375
3377
  * @implements #114 provider fallback chains with cooldown
3376
3378
  */
3377
-
3378
3379
  interface FallbackRouterConfig {
3379
3380
  /** Ordered list of providers (highest priority first) */
3380
3381
  providers: InferenceProvider[];
@@ -3393,7 +3394,7 @@ interface CooldownConfig {
3393
3394
  /** Cooldown for content policy errors — default 0 (immediate retry with next) */
3394
3395
  contentPolicy?: number;
3395
3396
  }
3396
- type ErrorCategory = 'rate_limit' | 'server_error' | 'connection_failure' | 'content_policy' | 'context_window' | 'unknown';
3397
+ type ErrorCategory = 'connection_failure' | 'content_policy' | 'context_window' | 'rate_limit' | 'server_error' | 'unknown';
3397
3398
  declare function classifyError(error: unknown): ErrorCategory;
3398
3399
  interface FallbackEvent {
3399
3400
  fromProvider: string;
@@ -3421,9 +3422,9 @@ declare class FallbackRouter implements InferenceProvider {
3421
3422
  getAvailableProviders(): InferenceProvider[];
3422
3423
  /** Get providers in cooldown with their expiry info */
3423
3424
  getCoolingDown(): Array<{
3424
- providerId: string;
3425
3425
  category: ErrorCategory;
3426
3426
  expiresAt: number;
3427
+ providerId: string;
3427
3428
  }>;
3428
3429
  /** Manually clear cooldown for a provider */
3429
3430
  clearCooldown(providerId: string): void;
@@ -3444,7 +3445,6 @@ declare class FallbackRouter implements InferenceProvider {
3444
3445
  private withFallback;
3445
3446
  private applyCooldown;
3446
3447
  }
3447
-
3448
3448
  interface FortemiBridgeCapabilities {
3449
3449
  secureSecrets: boolean;
3450
3450
  providerRouting: boolean;
@@ -3453,14 +3453,14 @@ interface FortemiBridgeCapabilities {
3453
3453
  }
3454
3454
  interface FortemiSecretStore {
3455
3455
  isAvailable(): boolean | Promise<boolean>;
3456
- getSecret(key: string): Promise<string | null>;
3456
+ getSecret(key: string): Promise<null | string>;
3457
3457
  setSecret(key: string, value: string): Promise<void>;
3458
3458
  deleteSecret(key: string): Promise<void>;
3459
3459
  }
3460
3460
  interface BridgeProviderInfo {
3461
3461
  id: string;
3462
3462
  name: string;
3463
- tier: 'remote' | 'local-server' | 'in-browser' | 'chrome-ai';
3463
+ tier: 'chrome-ai' | 'in-browser' | 'local-server' | 'remote';
3464
3464
  requiresApiKey: boolean;
3465
3465
  capabilities: {
3466
3466
  chat?: boolean;
@@ -3488,8 +3488,7 @@ interface FortemiBridgeHost {
3488
3488
  declare function getFortemiBridge(host?: FortemiBridgeHost | undefined): FortemiBridge | null;
3489
3489
  declare function getFortemiSecretStore(host?: FortemiBridgeHost | undefined): FortemiSecretStore | null;
3490
3490
  declare function hasFortemiSecureSecrets(host?: FortemiBridgeHost | undefined): Promise<boolean>;
3491
-
3492
- type CspDirectiveName = 'default-src' | 'base-uri' | 'object-src' | 'frame-ancestors' | 'img-src' | 'font-src' | 'style-src' | 'script-src' | 'connect-src' | 'worker-src' | 'manifest-src' | 'report-uri';
3491
+ type CspDirectiveName = 'base-uri' | 'connect-src' | 'default-src' | 'font-src' | 'frame-ancestors' | 'img-src' | 'manifest-src' | 'object-src' | 'report-uri' | 'script-src' | 'style-src' | 'worker-src';
3493
3492
  type CspDirectives = Partial<Record<CspDirectiveName, string[]>>;
3494
3493
  interface PluginCspOptions {
3495
3494
  scriptSrc?: string[];
@@ -3528,14 +3527,13 @@ interface CspViolationReport {
3528
3527
  raw: unknown;
3529
3528
  }
3530
3529
  declare function buildPluginCsp(options?: PluginCspOptions): string;
3531
- declare function computeSri(data: Uint8Array | ArrayBuffer, algorithm?: string): Promise<string>;
3532
- declare function verifySri(data: Uint8Array | ArrayBuffer, integrity: string): Promise<boolean>;
3530
+ declare function computeSri(data: ArrayBuffer | Uint8Array, algorithm?: string): Promise<string>;
3531
+ declare function verifySri(data: ArrayBuffer | Uint8Array, integrity: string): Promise<boolean>;
3533
3532
  declare function isPluginScriptAllowed(url: string, policy: PluginScriptPolicy): boolean;
3534
3533
  declare function fetchPluginScript(descriptor: PluginScriptDescriptor, policy: PluginScriptPolicy, fetchFn?: typeof fetch): Promise<LoadedPluginScript>;
3535
3534
  declare function appendPluginScript(descriptor: PluginScriptDescriptor, policy: PluginScriptPolicy, doc?: Document): Promise<HTMLScriptElement>;
3536
3535
  declare function parseCspReport(body: unknown): CspViolationReport;
3537
- declare function createCspReportHandler(onReport: (report: CspViolationReport) => void | Promise<void>): (request: Request) => Promise<Response>;
3538
-
3536
+ declare function createCspReportHandler(onReport: (report: CspViolationReport) => Promise<void> | void): (request: Request) => Promise<Response>;
3539
3537
  /**
3540
3538
  * Knowledge Shard portability profiles derived from the pinned Fortemi receipt.
3541
3539
  *
@@ -3544,21 +3542,25 @@ declare function createCspReportHandler(onReport: (report: CspViolationReport) =
3544
3542
  * @created 2026-07-17
3545
3543
  * @agent Codex
3546
3544
  */
3547
-
3548
- declare const CORE_V1_COMPONENTS: readonly ["notes", "collections", "tags", "templates", "links"];
3545
+ declare const CORE_V1_COMPONENTS: readonly [
3546
+ "notes",
3547
+ "collections",
3548
+ "tags",
3549
+ "templates",
3550
+ "links"
3551
+ ];
3549
3552
  declare function getKnowledgeShardProfileRegistry(): ShardProfileRegistryEntry[];
3550
3553
  interface CreateShardCapabilityReportInput {
3551
3554
  backend: ShardBackend;
3552
3555
  operation: ShardOperation;
3553
- requestedProfile: string | null;
3554
- requestedSchemaVersion?: string | null;
3556
+ requestedProfile: null | string;
3557
+ requestedSchemaVersion?: null | string;
3555
3558
  declaredComponents?: readonly ShardComponent[];
3556
3559
  omittedComponents?: readonly ShardComponent[];
3557
3560
  losses?: readonly ShardLossEntry[];
3558
3561
  }
3559
3562
  declare function createShardCapabilityReport(input: CreateShardCapabilityReportInput): ShardCapabilityReport;
3560
- declare function profileSupportError(report: ShardCapabilityReport): string | null;
3561
-
3563
+ declare function profileSupportError(report: ShardCapabilityReport): null | string;
3562
3564
  /**
3563
3565
  * Minimal tar + gzip packing/unpacking for shard archives.
3564
3566
  *
@@ -3590,7 +3592,6 @@ declare function packTarGz(files: Map<string, Uint8Array>, opts?: {
3590
3592
  declare function unpackTarGz(data: Uint8Array, opts?: {
3591
3593
  maxDecompressedBytes?: number;
3592
3594
  }): Map<string, Uint8Array>;
3593
-
3594
3595
  /**
3595
3596
  * SHA-256 checksum utilities for shard integrity verification.
3596
3597
  * Uses the Web Crypto API (browser-native, no extra dependencies).
@@ -3621,16 +3622,13 @@ declare function sha256Hex(data: Uint8Array): Promise<string>;
3621
3622
  * @returns Object with `valid` flag and list of failed filenames.
3622
3623
  */
3623
3624
  declare function validateChecksums(checksums: Record<string, string>, files: Map<string, Uint8Array>): Promise<{
3624
- valid: boolean;
3625
3625
  failures: string[];
3626
+ valid: boolean;
3626
3627
  }>;
3627
-
3628
3628
  /** Presence semantics for Knowledge Shard schema 2.0 (Fortemi #1083). */
3629
-
3630
- type ShardPresenceState = 'absent' | 'null' | 'empty' | 'value';
3631
- type StoredPresenceState = ShardPresenceState | 'legacy-indeterminate';
3629
+ type ShardPresenceState = 'absent' | 'empty' | 'null' | 'value';
3630
+ type StoredPresenceState = 'legacy-indeterminate' | ShardPresenceState;
3632
3631
  type ShardPresenceMap = Record<string, StoredPresenceState>;
3633
-
3634
3632
  /**
3635
3633
  * Shard export pipeline — query all entities, serialize, pack into .shard archive.
3636
3634
  *
@@ -3642,7 +3640,6 @@ type ShardPresenceMap = Record<string, StoredPresenceState>;
3642
3640
  * @created 2026-07-17
3643
3641
  * @agent Codex
3644
3642
  */
3645
-
3646
3643
  declare function exportShardWithReport(db: DatabaseClient, options: ExportOptions & {
3647
3644
  profile: string;
3648
3645
  }): Promise<ShardExportResult>;
@@ -3654,7 +3651,6 @@ declare function exportShardWithReport(db: DatabaseClient, options: ExportOption
3654
3651
  * @returns Compressed shard archive bytes
3655
3652
  */
3656
3653
  declare function exportShard(db: DatabaseClient, options?: ExportOptions): Promise<Uint8Array>;
3657
-
3658
3654
  /**
3659
3655
  * Shard import pipeline — unpack, validate, field-map, transactional insert.
3660
3656
  *
@@ -3666,7 +3662,6 @@ declare function exportShard(db: DatabaseClient, options?: ExportOptions): Promi
3666
3662
  * @created 2026-07-17
3667
3663
  * @agent Codex
3668
3664
  */
3669
-
3670
3665
  /**
3671
3666
  * Import a .shard archive into the database.
3672
3667
  *
@@ -3678,8 +3673,7 @@ declare function exportShard(db: DatabaseClient, options?: ExportOptions): Promi
3678
3673
  * @param options Import options (conflict strategy)
3679
3674
  * @returns Import result with counts, warnings, and errors
3680
3675
  */
3681
- declare function importShard(db: DatabaseClient, data: Uint8Array | ArrayBuffer, options?: ImportOptions): Promise<ImportResult>;
3682
-
3676
+ declare function importShard(db: DatabaseClient, data: ArrayBuffer | Uint8Array, options?: ImportOptions): Promise<ImportResult>;
3683
3677
  interface ShardSchemaValidationResult {
3684
3678
  valid: boolean;
3685
3679
  errors: string[];
@@ -3689,13 +3683,12 @@ type CoreV1SchemaVersion = '1.0.0' | '1.1.0' | '1.2.0' | '2.0.0';
3689
3683
  declare function getKnowledgeShardSchema(): unknown;
3690
3684
  declare function getKnowledgeShardContractReceipt(): unknown;
3691
3685
  declare function validateShardManifest(value: unknown): ShardSchemaValidationResult;
3692
- declare function validateShardArchive(input: Uint8Array | ArrayBuffer | ShardFiles): ShardSchemaValidationResult;
3693
- declare function validateCoreV1ShardArchive(input: Uint8Array | ArrayBuffer | ShardFiles): Promise<ShardSchemaValidationResult>;
3694
- declare function validateRecordV1ShardArchive(input: Uint8Array | ArrayBuffer | ShardFiles): Promise<ShardSchemaValidationResult>;
3695
- declare function validateFullV1ShardArchive(input: Uint8Array | ArrayBuffer | ShardFiles): Promise<ShardSchemaValidationResult>;
3696
- declare function validateShardComponentRecord(component: ShardComponent | 'templates', value: unknown, profile?: 'core-v1' | 'record-v1' | 'full-v1', version?: CoreV1SchemaVersion): ShardSchemaValidationResult;
3697
- declare function assertShardComponentRecord(component: ShardComponent | 'templates', value: unknown, profile?: 'core-v1' | 'record-v1' | 'full-v1', version?: CoreV1SchemaVersion): void;
3698
-
3686
+ declare function validateShardArchive(input: ArrayBuffer | ShardFiles | Uint8Array): ShardSchemaValidationResult;
3687
+ declare function validateCoreV1ShardArchive(input: ArrayBuffer | ShardFiles | Uint8Array): Promise<ShardSchemaValidationResult>;
3688
+ declare function validateRecordV1ShardArchive(input: ArrayBuffer | ShardFiles | Uint8Array): Promise<ShardSchemaValidationResult>;
3689
+ declare function validateFullV1ShardArchive(input: ArrayBuffer | ShardFiles | Uint8Array): Promise<ShardSchemaValidationResult>;
3690
+ declare function validateShardComponentRecord(component: 'templates' | ShardComponent, value: unknown, profile?: 'core-v1' | 'full-v1' | 'record-v1', version?: CoreV1SchemaVersion): ShardSchemaValidationResult;
3691
+ declare function assertShardComponentRecord(component: 'templates' | ShardComponent, value: unknown, profile?: 'core-v1' | 'full-v1' | 'record-v1', version?: CoreV1SchemaVersion): void;
3699
3692
  /**
3700
3693
  * Pluggable semantic providers for the in-place shard reader (issue #189).
3701
3694
  *
@@ -3711,7 +3704,6 @@ declare function assertShardComponentRecord(component: ShardComponent | 'templat
3711
3704
  * The interface is the extension point; no ANN engine is
3712
3705
  * bundled here.
3713
3706
  */
3714
-
3715
3707
  /** A note id paired with its embedding vector, as stored in a static vectors file. */
3716
3708
  interface VectorEntry {
3717
3709
  id: string;
@@ -3722,7 +3714,7 @@ interface CosineSemanticProviderOptions {
3722
3714
  * Embeds the query into the SAME space as the corpus vectors. Host-owned so it
3723
3715
  * matches the build-time embedding model exactly (sync or async).
3724
3716
  */
3725
- embedQuery: (query: string) => Promise<number[]> | number[];
3717
+ embedQuery: (query: string) => number[] | Promise<number[]>;
3726
3718
  /**
3727
3719
  * JSONL file (one `{ id, vector }` per line) mapping note id → vector, served
3728
3720
  * as a static asset alongside the shard. Default `vectors.jsonl`.
@@ -3738,7 +3730,6 @@ interface CosineSemanticProviderOptions {
3738
3730
  * `StaticSemanticProvider` instead.
3739
3731
  */
3740
3732
  declare function createCosineSemanticProvider(options: CosineSemanticProviderOptions): StaticSemanticProvider;
3741
-
3742
3733
  /**
3743
3734
  * Shard warm / prefetch API — pre-stage and (optionally) verify shard bytes
3744
3735
  * without building the index.
@@ -3861,7 +3852,6 @@ declare function getPrefetchedSha256(url: string): string | undefined;
3861
3852
  * you need to evict it.
3862
3853
  */
3863
3854
  declare function clearPrefetchedShard(url?: string): void;
3864
-
3865
3855
  /**
3866
3856
  * Canonical RecordStore contract — the writable structured-record layer that
3867
3857
  * exists independently of PGlite (#323, ADR-013 D3).
@@ -3871,15 +3861,14 @@ declare function clearPrefetchedShard(url?: string): void;
3871
3861
  * replay of the change journal — rebuildable at any time without touching
3872
3862
  * canonical records or attachment bytes.
3873
3863
  */
3874
-
3875
3864
  interface PresenceTrackedRecord {
3876
3865
  /** Internal schema-2.0 state; never serialized as a shard component field. */
3877
3866
  __fortemi_presence?: ShardPresenceMap;
3878
3867
  }
3879
3868
  interface NoteRecord0 extends PresenceTrackedRecord {
3880
3869
  id: string;
3881
- archive_id: string | null;
3882
- title: string | null;
3870
+ archive_id: null | string;
3871
+ title: null | string;
3883
3872
  format: string;
3884
3873
  source: string;
3885
3874
  visibility: string;
@@ -3889,7 +3878,7 @@ interface NoteRecord0 extends PresenceTrackedRecord {
3889
3878
  is_archived: boolean;
3890
3879
  created_at: string;
3891
3880
  updated_at: string;
3892
- deleted_at: string | null;
3881
+ deleted_at: null | string;
3893
3882
  }
3894
3883
  interface NoteOriginalRecord extends PresenceTrackedRecord {
3895
3884
  id: string;
@@ -3901,10 +3890,10 @@ interface NoteOriginalRecord extends PresenceTrackedRecord {
3901
3890
  interface NoteRevisedCurrentRecord extends PresenceTrackedRecord {
3902
3891
  /** Keyed by note id (mirrors the SQL PK `note_id`). */
3903
3892
  id: string;
3904
- content: string | null;
3905
- ai_metadata: unknown | null;
3893
+ content: null | string;
3894
+ ai_metadata: null | unknown;
3906
3895
  generation_count: number;
3907
- model: string | null;
3896
+ model: null | string;
3908
3897
  is_user_edited: boolean;
3909
3898
  updated_at: string;
3910
3899
  }
@@ -3920,19 +3909,19 @@ interface LinkRecord0 extends PresenceTrackedRecord {
3920
3909
  target_note_id: string;
3921
3910
  link_type: string;
3922
3911
  created_at: string;
3923
- deleted_at: string | null;
3912
+ deleted_at: null | string;
3924
3913
  /** Exact record-v1 shard metadata; internal projection state, not a domain field. */
3925
3914
  __fortemi_shard_metadata?: unknown;
3926
3915
  }
3927
3916
  interface CollectionRecord extends PresenceTrackedRecord {
3928
3917
  id: string;
3929
3918
  name: string;
3930
- description: string | null;
3919
+ description: null | string;
3931
3920
  /** Omitted only by legacy schema-v1 callers; built-in stores normalize it to null. */
3932
- parent_id?: string | null;
3921
+ parent_id?: null | string;
3933
3922
  created_at: string;
3934
3923
  updated_at: string;
3935
- deleted_at: string | null;
3924
+ deleted_at: null | string;
3936
3925
  }
3937
3926
  interface CollectionNoteRecord extends PresenceTrackedRecord {
3938
3927
  id: string;
@@ -3944,16 +3933,16 @@ interface AttachmentRecord extends PresenceTrackedRecord {
3944
3933
  id: string;
3945
3934
  note_id: string;
3946
3935
  blob_id: string;
3947
- document_type_id: string | null;
3948
- mime_type: string | null;
3949
- extracted_text: string | null;
3936
+ document_type_id: null | string;
3937
+ mime_type: null | string;
3938
+ extracted_text: null | string;
3950
3939
  filename: string;
3951
- display_name: string | null;
3940
+ display_name: null | string;
3952
3941
  position: number;
3953
3942
  created_at: string;
3954
- deleted_at: string | null;
3943
+ deleted_at: null | string;
3955
3944
  /** Exact record-v1 extraction projection state. */
3956
- __fortemi_extraction_status?: 'extracted' | 'pending' | 'failed' | 'blocked' | 'deferred';
3945
+ __fortemi_extraction_status?: 'blocked' | 'deferred' | 'extracted' | 'failed' | 'pending';
3957
3946
  __fortemi_extraction_reason?: unknown;
3958
3947
  __fortemi_projection_presence?: ShardPresenceMap;
3959
3948
  }
@@ -3992,7 +3981,7 @@ interface JournalEntry {
3992
3981
  seq: number;
3993
3982
  /** ISO-8601 commit timestamp. */
3994
3983
  ts: string;
3995
- op: 'put' | 'delete';
3984
+ op: 'delete' | 'put';
3996
3985
  collection: RecordCollectionName;
3997
3986
  id: string;
3998
3987
  /** Snapshot for `put`; absent for `delete`. */
@@ -4021,14 +4010,14 @@ interface RecordListOptions {
4021
4010
  }
4022
4011
  type RecordMutation = {
4023
4012
  [C in RecordCollectionName]: {
4024
- op: 'put';
4025
4013
  collection: C;
4014
+ op: 'put';
4026
4015
  record: RecordCollections[C];
4027
4016
  };
4028
4017
  }[RecordCollectionName] | {
4029
- op: 'delete';
4030
4018
  collection: RecordCollectionName;
4031
4019
  id: string;
4020
+ op: 'delete';
4032
4021
  };
4033
4022
  /**
4034
4023
  * The writable canonical structured-record store. Implementations MUST make
@@ -4037,7 +4026,7 @@ type RecordMutation = {
4037
4026
  * neither, never one without the other.
4038
4027
  */
4039
4028
  interface RecordStore {
4040
- get<C extends RecordCollectionName>(collection: C, id: string): Promise<RecordCollections[C] | null>;
4029
+ get<C extends RecordCollectionName>(collection: C, id: string): Promise<null | RecordCollections[C]>;
4041
4030
  /** Insert or replace one record, journaled atomically. */
4042
4031
  put<C extends RecordCollectionName>(collection: C, record: RecordCollections[C]): Promise<JournalEntry>;
4043
4032
  /** Hard-remove one record, journaled atomically (soft-delete is a field upstream). */
@@ -4056,19 +4045,17 @@ interface RecordStore {
4056
4045
  readonly capabilities: RecordStoreCapabilities;
4057
4046
  close(): Promise<void>;
4058
4047
  }
4059
-
4060
4048
  /**
4061
4049
  * In-memory RecordStore — the test/SSR tier of the canonical record layer.
4062
4050
  * Same commit semantics as the durable store: record + journal move together.
4063
4051
  */
4064
-
4065
4052
  declare class MemoryRecordStore implements RecordStore {
4066
4053
  readonly capabilities: RecordStoreCapabilities;
4067
4054
  private collections;
4068
4055
  private journal;
4069
4056
  private seq;
4070
4057
  private table;
4071
- get<C extends RecordCollectionName>(collection: C, id: string): Promise<RecordCollections[C] | null>;
4058
+ get<C extends RecordCollectionName>(collection: C, id: string): Promise<null | RecordCollections[C]>;
4072
4059
  put<C extends RecordCollectionName>(collection: C, record: RecordCollections[C]): Promise<JournalEntry>;
4073
4060
  remove(collection: RecordCollectionName, id: string): Promise<JournalEntry>;
4074
4061
  applyBatch(mutations: readonly RecordMutation[]): Promise<JournalEntry[]>;
@@ -4077,7 +4064,6 @@ declare class MemoryRecordStore implements RecordStore {
4077
4064
  headSeq(): Promise<number>;
4078
4065
  close(): Promise<void>;
4079
4066
  }
4080
-
4081
4067
  /**
4082
4068
  * Durable canonical RecordStore over IndexedDB (#323, ADR-013 D3).
4083
4069
  *
@@ -4095,7 +4081,6 @@ declare class MemoryRecordStore implements RecordStore {
4095
4081
  * database structure grows. Additive-only, mirroring the SQL migration
4096
4082
  * discipline.
4097
4083
  */
4098
-
4099
4084
  /** Logical record-schema version stored in `meta` (independent of DB_VERSION). */
4100
4085
  declare const RECORD_SCHEMA_VERSION = 2;
4101
4086
  interface CreateRecordStoreOptions {
@@ -4108,7 +4093,7 @@ declare class IdbRecordStore implements RecordStore {
4108
4093
  private constructor();
4109
4094
  static open(archiveName: string, options?: CreateRecordStoreOptions): Promise<IdbRecordStore>;
4110
4095
  private ensureSchemaVersion;
4111
- get<C extends RecordCollectionName>(collection: C, id: string): Promise<RecordCollections[C] | null>;
4096
+ get<C extends RecordCollectionName>(collection: C, id: string): Promise<null | RecordCollections[C]>;
4112
4097
  put<C extends RecordCollectionName>(collection: C, record: RecordCollections[C]): Promise<JournalEntry>;
4113
4098
  remove(collection: RecordCollectionName, id: string): Promise<JournalEntry>;
4114
4099
  applyBatch(mutations: readonly RecordMutation[]): Promise<JournalEntry[]>;
@@ -4119,7 +4104,6 @@ declare class IdbRecordStore implements RecordStore {
4119
4104
  }
4120
4105
  /** Open the durable canonical record store for one archive namespace. */
4121
4106
  declare function createRecordStore(archiveName: string, options?: CreateRecordStoreOptions): Promise<IdbRecordStore>;
4122
-
4123
4107
  /**
4124
4108
  * Canonical notes repository — DB-free note/tag/link/collection workflows
4125
4109
  * over the RecordStore (#323). Mirrors the SQL repositories' semantics
@@ -4130,7 +4114,6 @@ declare function createRecordStore(archiveName: string, options?: CreateRecordSt
4130
4114
  * text scan. Ranked FTS, vectors, and complex joins are explicitly NOT
4131
4115
  * served here — `store.capabilities` reports the boundary (ADR-013 D3).
4132
4116
  */
4133
-
4134
4117
  interface CanonicalNoteCreateInput {
4135
4118
  id?: string;
4136
4119
  title?: string;
@@ -4177,11 +4160,10 @@ declare class CanonicalNotesRepository {
4177
4160
  softDeleteLink(linkId: string): Promise<void>;
4178
4161
  /** Active links touching a note (either direction). */
4179
4162
  linksOf(noteId: string): Promise<LinkRecord0[]>;
4180
- createCollection(name: string, description?: string, parentId?: string | null): Promise<CollectionRecord>;
4163
+ createCollection(name: string, description?: string, parentId?: null | string): Promise<CollectionRecord>;
4181
4164
  addNoteToCollection(collectionId: string, noteId: string): Promise<void>;
4182
4165
  notesInCollection(collectionId: string): Promise<NoteRecord0[]>;
4183
4166
  }
4184
-
4185
4167
  /**
4186
4168
  * Canonical attachments repository — DB-free attachment manifests over the
4187
4169
  * RecordStore, bytes through the Bytecask BlobStore (#323, ADR-013 D2/D4/D5).
@@ -4191,7 +4173,6 @@ declare class CanonicalNotesRepository {
4191
4173
  * bytes inline; the manifest-derived live set drives reconcile/gc; missing
4192
4174
  * bytes are the recoverable reference-only state.
4193
4175
  */
4194
-
4195
4176
  interface CanonicalAttachInput {
4196
4177
  noteId: string;
4197
4178
  data: Uint8Array;
@@ -4208,7 +4189,7 @@ declare class CanonicalAttachmentsRepository {
4208
4189
  attach(input: CanonicalAttachInput): Promise<AttachmentRecord>;
4209
4190
  get(id: string): Promise<AttachmentRecord>;
4210
4191
  /** Null when bytes are absent — the recoverable reference-only state. */
4211
- getBlob(attachmentId: string): Promise<Uint8Array | null>;
4192
+ getBlob(attachmentId: string): Promise<null | Uint8Array>;
4212
4193
  hasBlob(attachmentId: string): Promise<boolean>;
4213
4194
  list(noteId: string): Promise<AttachmentRecord[]>;
4214
4195
  /** Soft-delete the manifest; bytes are only swept via reconcile/gc. */
@@ -4221,7 +4202,6 @@ declare class CanonicalAttachmentsRepository {
4221
4202
  gcBlobs(opts?: BlobGcOptions): Promise<BlobGcResult>;
4222
4203
  private checksumOf;
4223
4204
  }
4224
-
4225
4205
  /**
4226
4206
  * PGlite attachment projection (#320, ADR-013 D3).
4227
4207
  *
@@ -4237,7 +4217,6 @@ declare class CanonicalAttachmentsRepository {
4237
4217
  * and no trigger touches it.
4238
4218
  * - Bytes never enter PGlite; only metadata is projected.
4239
4219
  */
4240
-
4241
4220
  interface AttachmentProjectionResult {
4242
4221
  blobs: number;
4243
4222
  attachments: number;
@@ -4258,7 +4237,6 @@ declare function projectAttachments(db: DatabaseClient, store: RecordStore): Pro
4258
4237
  * dropped and rebuilt" invariant made executable.
4259
4238
  */
4260
4239
  declare function dropAttachmentProjection(db: DatabaseClient): Promise<void>;
4261
-
4262
4240
  /**
4263
4241
  * PGlite record projection — notes tier (#323 cycle 2, ADR-013 D3).
4264
4242
  *
@@ -4276,7 +4254,6 @@ declare function dropAttachmentProjection(db: DatabaseClient): Promise<void>;
4276
4254
  * - Bytes never enter PGlite; `projectRecords` composes this pass with the
4277
4255
  * attachment projection for a full canonical → PGlite rebuild.
4278
4256
  */
4279
-
4280
4257
  interface NoteProjectionResult {
4281
4258
  notes: number;
4282
4259
  tags: number;
@@ -4307,7 +4284,6 @@ declare function projectRecords(db: DatabaseClient, store: RecordStore): Promise
4307
4284
  * created outside the canonical tier) so FKs allow the deletes.
4308
4285
  */
4309
4286
  declare function dropNoteProjection(db: DatabaseClient): Promise<void>;
4310
-
4311
4287
  /**
4312
4288
  * Writable non-PGlite `DataBackend` over the canonical RecordStore
4313
4289
  * (#323 cycle 2, ADR-013 D3) — the record tier in the backend seam.
@@ -4324,7 +4300,6 @@ declare function dropNoteProjection(db: DatabaseClient): Promise<void>;
4324
4300
  * optional methods rather than receiving silently empty emulations.
4325
4301
  * `merge: true` is served by `importShardToRecords` (record-shard.ts).
4326
4302
  */
4327
-
4328
4303
  interface RecordBackendOptions {
4329
4304
  id?: string;
4330
4305
  }
@@ -4340,7 +4315,6 @@ interface RecordBackendManageNoteResult {
4340
4315
  * archive / unarchive / star / unstar).
4341
4316
  */
4342
4317
  declare function createRecordBackend(store: RecordStore, options?: RecordBackendOptions): DataBackend;
4343
-
4344
4318
  /**
4345
4319
  * DB-free Knowledge Shard export/import over the canonical RecordStore
4346
4320
  * (#323 cycle 2, ADR-013 D3/D6) — the same `.shard` archive format as the
@@ -4363,7 +4337,6 @@ declare function createRecordBackend(store: RecordStore, options?: RecordBackend
4363
4337
  * @created 2026-07-17
4364
4338
  * @agent Codex
4365
4339
  */
4366
-
4367
4340
  declare function exportShardFromRecordsWithReport(store: RecordStore, options: ExportOptions & {
4368
4341
  profile: string;
4369
4342
  }): Promise<ShardExportResult>;
@@ -4385,14 +4358,12 @@ declare function exportShardFromRecords(store: RecordStore, options?: ExportOpti
4385
4358
  * `blobStore`. Components the canonical tier cannot persist are skipped with
4386
4359
  * explicit warnings and reported under `skipped`.
4387
4360
  */
4388
- declare function importShardToRecords(store: RecordStore, data: Uint8Array | ArrayBuffer, options?: ImportOptions): Promise<ImportResult>;
4389
-
4361
+ declare function importShardToRecords(store: RecordStore, data: ArrayBuffer | Uint8Array, options?: ImportOptions): Promise<ImportResult>;
4390
4362
  /**
4391
4363
  * @implements @.aiwg/adrs/ADR-011-shard-server-conformance-and-version-negotiation.md
4392
4364
  * @source @packages/core/src/shard/schema-validator.ts
4393
4365
  * @created 2026-07-17
4394
4366
  * @agent Codex
4395
4367
  */
4396
- declare const VERSION = "2026.7.14";
4397
-
4398
- export { 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, BlobGcOptions, BlobGcResult, BlobReconcileOptions, BlobReconcileResult, BlobStore, type BridgeCapability, type BridgeProviderInfo, type BrowserNoteExport, CORE_V1_COMPONENTS, CURRENT_MIGRATION_HEAD, 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 CooldownConfig, type CooldownEvent, type CosineSemanticProviderOptions, 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, 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, ImportOptions, 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, 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 PresenceTrackedRecord, 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, SUPPORTED_PGLITE_VERSION, type SWRegistrationResult, type SearchFacets, type SearchInput, SearchInputSchema, type SearchOptions, SearchRepository, type SearchResponse, type SearchResult, ShardBackend, type ShardBackendOptions, ShardCapabilityReport, ShardCollection, ShardComponent, type ShardComponentStore, ShardEmbedding, ShardEmbeddingConfig, ShardEmbeddingSet, ShardEmbeddingSetMember, ShardExportResult, ShardLink, type ShardListOptions, ShardLossEntry, ShardManifest, ShardNote, type ShardNoteFull, ShardNoteSkosTag, ShardOperation, ShardProfileRegistryEntry, 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, 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, formatFortemiCompatibilitySummary, fortemiCompatibilityUrl, fortemiManifest, fromPrefetched, generateId, getEmbedFunction, getFortemiBridge, getFortemiSecretStore, getJobQueueStatus, getKnowledgeShardContractReceipt, getKnowledgeShardProfileRegistry, getKnowledgeShardSchema, getLlmFunction, getNote, getPrefetchedSha256, handleEmbedRequests, hasFortemiSecureSecrets, importShard, importShardToRecords, isPluginScriptAllowed, isShardPrefetched, 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, registerLlmCapability, registerSemanticCapability, registerSemanticCapabilityWorker, registerServiceWorker, restoreDbSnapshot, searchTool, selectBackend, selectLlmModel, setEmbedFunction, setLlmFunction, sha256Hex, skosConceptToShard, skosRelationToShard, skosSchemeToShard, suggestTags, tagsToShard, templateToShard, titleGenerationHandler, unpackTarGz, unregisterLlmCapability, unregisterSemanticCapability, urlLinkToShard, validateChecksums, validateCoreV1ShardArchive, validateFortemiCompatibilityResponse, validateFullV1ShardArchive, validateRecordV1ShardArchive, validateShardArchive, validateShardComponentRecord, validateShardManifest, verifyDbSnapshotMeta, verifySri };
4368
+ declare const VERSION = "2026.7.15";
4369
+ export { 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, BlobGcOptions, BlobGcResult, BlobReconcileOptions, BlobReconcileResult, BlobStore, type BridgeCapability, type BridgeProviderInfo, type BrowserNoteExport, CORE_V1_COMPONENTS, CURRENT_MIGRATION_HEAD, 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 CooldownConfig, type CooldownEvent, type CosineSemanticProviderOptions, 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, ExportOptions, FORTEMI_COMPATIBILITY_PATH, FORTEMI_COMPATIBILITY_STATES, FORTEMI_REQUIRED_COMPATIBILITY_CAPABILITIES, FORTEMI_SERVER_COMPATIBILITY_REVISION, 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, ImportOptions, 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, 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 PresenceTrackedRecord, 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, SUPPORTED_PGLITE_VERSION, type SWRegistrationResult, type SearchFacets, type SearchInput, SearchInputSchema, type SearchOptions, SearchRepository, type SearchResponse, type SearchResult, ShardBackend, type ShardBackendOptions, ShardCapabilityReport, ShardCollection, ShardComponent, type ShardComponentStore, ShardEmbedding, ShardEmbeddingConfig, ShardEmbeddingSet, ShardEmbeddingSetMember, ShardExportResult, ShardLink, type ShardListOptions, ShardLossEntry, ShardManifest, ShardNote, type ShardNoteFull, ShardNoteSkosTag, ShardOperation, ShardProfileRegistryEntry, 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, 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, formatFortemiCompatibilitySummary, fortemiCompatibilityUrl, fortemiManifest, fromPrefetched, generateId, getEmbedFunction, getFortemiBridge, getFortemiSecretStore, getJobQueueStatus, getKnowledgeShardContractReceipt, getKnowledgeShardProfileRegistry, getKnowledgeShardSchema, getLlmFunction, getNote, getPrefetchedSha256, handleEmbedRequests, hasFortemiSecureSecrets, importShard, importShardToRecords, isPluginScriptAllowed, isShardPrefetched, 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, registerLlmCapability, registerSemanticCapability, registerSemanticCapabilityWorker, registerServiceWorker, restoreDbSnapshot, searchTool, selectBackend, selectLlmModel, setEmbedFunction, setLlmFunction, sha256Hex, skosConceptToShard, skosRelationToShard, skosSchemeToShard, suggestTags, tagsToShard, templateToShard, titleGenerationHandler, unpackTarGz, unregisterLlmCapability, unregisterSemanticCapability, urlLinkToShard, validateChecksums, validateCoreV1ShardArchive, validateFortemiCompatibilityResponse, validateFullV1ShardArchive, validateRecordV1ShardArchive, validateShardArchive, validateShardComponentRecord, validateShardManifest, verifyDbSnapshotMeta, verifySri };