@fortemi/core 2026.8.0 → 2026.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/README.md +9 -1
  2. package/benchmarks/dataset-materialization/small-corpus.v1.json +12 -0
  3. package/dist/index.d.ts +1255 -134
  4. package/dist/index.js +2734 -763
  5. package/dist/index.js.map +1 -1
  6. package/package.json +13 -1
  7. package/schemas/dataset-execution-capabilities/fixtures/browser-local.json +14 -0
  8. package/schemas/dataset-execution-capabilities/fixtures/invalid-field-lineage-without-evidence.json +10 -0
  9. package/schemas/dataset-execution-capabilities/fixtures/invalid-incremental-without-checkpoint.json +10 -0
  10. package/schemas/dataset-execution-capabilities/fixtures/portable-shard.json +12 -0
  11. package/schemas/dataset-execution-capabilities/fixtures/remote-alpha.json +12 -0
  12. package/schemas/dataset-execution-capabilities/fixtures/static-cache.json +12 -0
  13. package/schemas/dataset-execution-capabilities/v1.schema.json +164 -0
  14. package/schemas/dataset-ingest/v1.schema.json +138 -0
  15. package/schemas/dataset-lineage/fixtures/golden-observed-field.json +20 -0
  16. package/schemas/dataset-lineage/v1.schema.json +126 -0
  17. package/schemas/dataset-materialization/fixtures/browser.json +11 -0
  18. package/schemas/dataset-materialization/fixtures/degraded.json +12 -0
  19. package/schemas/dataset-materialization/fixtures/deterministic.json +11 -0
  20. package/schemas/dataset-materialization/fixtures/external-adapter.json +11 -0
  21. package/schemas/dataset-materialization/fixtures/nondeterministic.json +11 -0
  22. package/schemas/dataset-materialization/fixtures/server.json +11 -0
  23. package/schemas/dataset-materialization/fixtures/supported.json +12 -0
  24. package/schemas/dataset-materialization/fixtures/unsupported.json +11 -0
  25. package/schemas/dataset-materialization/v1.schema.json +169 -0
  26. package/schemas/source-note-upsert/contract.receipt.json +78 -0
  27. package/schemas/source-note-upsert/v1.conformance.json +100 -0
package/dist/index.d.ts CHANGED
@@ -11,6 +11,845 @@ import '@bytecask/core';
11
11
  * time-sortable and monotonic within the same millisecond.
12
12
  */
13
13
  declare function generateId(): string;
14
+ declare const DATASET_INGEST_CONTRACT: "fortemi.dataset-ingest/v1";
15
+ declare const DATASET_INGEST_SCHEMA_VERSION: "1.0.0";
16
+ type DatasetIngestMode = 'full' | 'incremental' | 'snapshot';
17
+ type DatasetRunState = 'cancelled' | 'committed' | 'degraded' | 'failed' | 'running';
18
+ type DatasetVerificationState = 'failed' | 'pending' | 'verified';
19
+ interface DatasetDestinationScope {
20
+ tenant: string;
21
+ dataset: string;
22
+ sourceBinding: string;
23
+ stream: string;
24
+ partition?: string;
25
+ }
26
+ interface DatasetProcessingPlan {
27
+ contract: typeof DATASET_INGEST_CONTRACT;
28
+ schemaVersion: string;
29
+ planId: string;
30
+ planDigest: string;
31
+ sourceRevision: string;
32
+ configurationDigest: string;
33
+ transformationDigest: string;
34
+ destination: DatasetDestinationScope;
35
+ mode: DatasetIngestMode;
36
+ rejectionPolicy: {
37
+ maxRejectedRecords: number;
38
+ mode: 'bounded-reject' | 'dlq' | 'fail-fast';
39
+ };
40
+ reconciliation: {
41
+ enabled: boolean;
42
+ maxTombstones: number;
43
+ };
44
+ }
45
+ interface DatasetCheckpoint {
46
+ contract: typeof DATASET_INGEST_CONTRACT;
47
+ schemaVersion: string;
48
+ scope: DatasetDestinationScope;
49
+ opaque: string;
50
+ sequence: number;
51
+ }
52
+ interface DatasetUpsertMutation {
53
+ operation: 'upsert';
54
+ logicalId: string;
55
+ revision: string;
56
+ digest: string;
57
+ value: unknown;
58
+ locator?: string;
59
+ }
60
+ interface DatasetTombstoneMutation {
61
+ operation: 'tombstone';
62
+ logicalId: string;
63
+ revision: string;
64
+ digest: string;
65
+ locator?: string;
66
+ }
67
+ type DatasetMutation = DatasetTombstoneMutation | DatasetUpsertMutation;
68
+ interface DatasetMutationBatch {
69
+ contract: typeof DATASET_INGEST_CONTRACT;
70
+ schemaVersion: string;
71
+ sequence: number;
72
+ idempotencyKey?: string;
73
+ mutations: DatasetMutation[];
74
+ checkpointBefore?: DatasetCheckpoint;
75
+ checkpointAfter: DatasetCheckpoint;
76
+ enumeration?: {
77
+ approvalId?: string;
78
+ complete: boolean;
79
+ };
80
+ }
81
+ interface DatasetRecordRejection {
82
+ logicalIdDigest: string;
83
+ locator?: string;
84
+ code: string;
85
+ message: string;
86
+ }
87
+ interface DatasetRunReceipt {
88
+ contract: typeof DATASET_INGEST_CONTRACT;
89
+ schemaVersion: string;
90
+ runId: string;
91
+ idempotencyKey: string;
92
+ requestDigest: string;
93
+ planId: string;
94
+ planDigest: string;
95
+ sourceRevision: string;
96
+ destination: DatasetDestinationScope;
97
+ mode: DatasetIngestMode;
98
+ state: 'committed' | 'degraded';
99
+ effects: Array<{
100
+ digest: string;
101
+ logicalId: string;
102
+ operation: DatasetMutation['operation'];
103
+ revision: string;
104
+ }>;
105
+ acceptedRecords: number;
106
+ rejectedRecords: number;
107
+ rejections: DatasetRecordRejection[];
108
+ outputDigest: string;
109
+ checkpointBefore?: DatasetCheckpoint;
110
+ checkpointAfter: DatasetCheckpoint;
111
+ verification: 'verified';
112
+ }
113
+ interface DatasetRunAttempt {
114
+ runId: string;
115
+ state: DatasetRunState;
116
+ verification: DatasetVerificationState;
117
+ idempotencyKey: string;
118
+ errorCode?: DatasetIngestErrorCode;
119
+ }
120
+ interface DatasetRunStatus {
121
+ scope: DatasetDestinationScope;
122
+ lastAttempt?: DatasetRunAttempt;
123
+ lastSuccessful?: DatasetRunReceipt;
124
+ freshness: 'current' | 'never' | 'stale';
125
+ }
126
+ type DatasetIngestErrorCode = 'BATCH_OUT_OF_ORDER' | 'CHECKPOINT_MISMATCH' | 'CHECKPOINT_REGRESSION' | 'CHECKPOINT_SCOPE_MISMATCH' | 'CHECKPOINT_VERSION_UNSUPPORTED' | 'IDEMPOTENCY_CONFLICT' | 'INGEST_CANCELLED' | 'INGEST_CONTRACT_UNSUPPORTED' | 'INGEST_SCHEMA_UNSUPPORTED' | 'RECONCILIATION_APPROVAL_REQUIRED' | 'RECONCILIATION_INCOMPLETE' | 'RECONCILIATION_NOT_ENABLED' | 'RECORD_REJECTED' | 'REJECTION_LIMIT_EXCEEDED';
127
+ declare class DatasetIngestError extends Error {
128
+ readonly code: DatasetIngestErrorCode;
129
+ constructor(code: DatasetIngestErrorCode, message: string);
130
+ }
131
+ interface DatasetStoredRecord {
132
+ logicalId: string;
133
+ revision: string;
134
+ digest: string;
135
+ value?: unknown;
136
+ tombstoned: boolean;
137
+ }
138
+ interface DatasetIngestTransaction {
139
+ getRecord(logicalId: string): DatasetStoredRecord | undefined;
140
+ setRecord(record: DatasetStoredRecord): void;
141
+ getReceipt(idempotencyKey: string): DatasetRunReceipt | undefined;
142
+ setReceipt(receipt: DatasetRunReceipt): void;
143
+ getCheckpoint(): DatasetCheckpoint | undefined;
144
+ setCheckpoint(checkpoint: DatasetCheckpoint): void;
145
+ }
146
+ interface DatasetIngestStore {
147
+ transact<T>(scopeKey: string, operation: (transaction: DatasetIngestTransaction) => Promise<T> | T): Promise<T>;
148
+ getReceipt(scopeKey: string, idempotencyKey: string): Promise<DatasetRunReceipt | undefined>;
149
+ getCheckpoint(scopeKey: string): Promise<DatasetCheckpoint | undefined>;
150
+ getRecords(scopeKey: string): Promise<DatasetStoredRecord[]>;
151
+ }
152
+ declare class MemoryDatasetIngestStore implements DatasetIngestStore {
153
+ private readonly scopes;
154
+ private readonly queues;
155
+ transact<T>(scopeKey: string, operation: (transaction: DatasetIngestTransaction) => Promise<T> | T): Promise<T>;
156
+ getReceipt(scopeKey: string, idempotencyKey: string): Promise<DatasetRunReceipt | undefined>;
157
+ getCheckpoint(scopeKey: string): Promise<DatasetCheckpoint | undefined>;
158
+ getRecords(scopeKey: string): Promise<DatasetStoredRecord[]>;
159
+ }
160
+ declare function datasetDestinationScopeKey(scope: DatasetDestinationScope): string;
161
+ declare function deriveDatasetIngestIdempotencyKey(plan: DatasetProcessingPlan, batch: DatasetMutationBatch): string;
162
+ interface DatasetIngestHooks {
163
+ beforeCommit?: () => Promise<void> | void;
164
+ afterCommit?: (receipt: DatasetRunReceipt) => Promise<void> | void;
165
+ }
166
+ interface ExecuteDatasetBatchOptions {
167
+ signal?: AbortSignal;
168
+ hooks?: DatasetIngestHooks;
169
+ validateRecord?: (mutation: DatasetMutation) => {
170
+ code: string;
171
+ message: string;
172
+ } | undefined;
173
+ }
174
+ declare class DatasetIngestExecutor {
175
+ private readonly store;
176
+ private readonly attempts;
177
+ private readonly successes;
178
+ constructor(store: DatasetIngestStore);
179
+ preview(plan: DatasetProcessingPlan, batch: DatasetMutationBatch): {
180
+ idempotencyKey: string;
181
+ tombstones: number;
182
+ upserts: number;
183
+ };
184
+ connectionCheck(plan: DatasetProcessingPlan, batch: DatasetMutationBatch): {
185
+ compatible: true;
186
+ idempotencyKey: string;
187
+ scopeKey: string;
188
+ };
189
+ executeBatch(plan: DatasetProcessingPlan, batch: DatasetMutationBatch, options?: ExecuteDatasetBatchOptions): Promise<DatasetRunReceipt>;
190
+ resolveAmbiguousCommit(plan: DatasetProcessingPlan, batch: DatasetMutationBatch): Promise<DatasetRunReceipt | undefined>;
191
+ status(scope: DatasetDestinationScope, expectedSourceRevision?: string): DatasetRunStatus;
192
+ }
193
+ declare const DATASET_LINEAGE_CONTRACT: "fortemi.dataset-lineage/v1";
194
+ declare const DATASET_LINEAGE_SCHEMA_VERSION: "1.0.0";
195
+ declare const LINEAGE_ENTITY_KINDS: readonly [
196
+ "dataset",
197
+ "dataset-revision",
198
+ "distribution",
199
+ "record",
200
+ "field",
201
+ "chunk",
202
+ "index",
203
+ "embedding-set",
204
+ "graph-artifact",
205
+ "community-artifact",
206
+ "processing-plan",
207
+ "run"
208
+ ];
209
+ type LineageEntityKind = typeof LINEAGE_ENTITY_KINDS[number];
210
+ declare const LINEAGE_RELATIONSHIP_KINDS: readonly [
211
+ "derived-from",
212
+ "field-derived-from",
213
+ "extracted-from",
214
+ "chunk-of",
215
+ "indexed-from",
216
+ "embedded-from",
217
+ "graph-derived-from",
218
+ "community-derived-from",
219
+ "revision-of",
220
+ "distributed-as",
221
+ "join-influence",
222
+ "filter-influence",
223
+ "aggregation-influence",
224
+ "ordering-influence",
225
+ "similarity-influence"
226
+ ];
227
+ type LineageRelationshipKind = typeof LINEAGE_RELATIONSHIP_KINDS[number];
228
+ type LineageAssertionKind = 'declared' | 'observed';
229
+ type LineagePrivacy = 'confidential' | 'internal' | 'public' | 'restricted';
230
+ interface LineageEntity {
231
+ id: string;
232
+ kind: LineageEntityKind;
233
+ schemaId: string;
234
+ schemaVersion: string;
235
+ revision?: string;
236
+ datasetId?: string;
237
+ createdAt: string;
238
+ attributes?: Record<string, unknown>;
239
+ }
240
+ interface LineageAgent {
241
+ id: string;
242
+ kind: 'organization' | 'person' | 'service' | 'software';
243
+ name: string;
244
+ version?: string;
245
+ }
246
+ interface LineageActivity {
247
+ id: string;
248
+ kind: 'correction' | 'export' | 'import' | 'index' | 'ingest' | 'query' | 'transform';
249
+ planId?: string;
250
+ runId?: string;
251
+ startedAt: string;
252
+ endedAt?: string;
253
+ agentIds: string[];
254
+ }
255
+ interface LineageEvidence {
256
+ id: string;
257
+ revision: string;
258
+ locator: string;
259
+ digest: string;
260
+ mediaType?: string;
261
+ privacy: LineagePrivacy;
262
+ capturedAt: string;
263
+ payload?: unknown;
264
+ }
265
+ interface LineageEvidenceReference {
266
+ evidenceId: string;
267
+ revision: string;
268
+ digest: string;
269
+ locator?: string;
270
+ }
271
+ interface LineageAssertion {
272
+ id: string;
273
+ revision: string;
274
+ relationship: LineageRelationshipKind;
275
+ assertionKind: LineageAssertionKind;
276
+ sourceEntityId: string;
277
+ targetEntityId: string;
278
+ issuerAgentId: string;
279
+ producingActivityId?: string;
280
+ method: string;
281
+ evidence: LineageEvidenceReference[];
282
+ confidence: number;
283
+ privacy: LineagePrivacy;
284
+ schemaId: string;
285
+ schemaVersion: string;
286
+ assertedAt: string;
287
+ }
288
+ interface LineageCorrection {
289
+ id: string;
290
+ assertionId: string;
291
+ assertionRevision: string;
292
+ action: 'correct' | 'retract' | 'supersede';
293
+ issuerAgentId: string;
294
+ activityId: string;
295
+ reason: string;
296
+ recordedAt: string;
297
+ replacementAssertionId?: string;
298
+ replacementRevision?: string;
299
+ }
300
+ interface LineageLedgerArchive {
301
+ contract: typeof DATASET_LINEAGE_CONTRACT;
302
+ schemaVersion: string;
303
+ snapshot: number;
304
+ entities: LineageEntity[];
305
+ agents: LineageAgent[];
306
+ activities: LineageActivity[];
307
+ evidence: LineageEvidence[];
308
+ assertions: LineageAssertion[];
309
+ corrections: LineageCorrection[];
310
+ digest: string;
311
+ }
312
+ interface LineageAuthorizationPolicy {
313
+ canReadEntity(entity: LineageEntity): boolean;
314
+ canReadAssertion(assertion: LineageAssertion): boolean;
315
+ canReadEvidence(evidence: LineageEvidence): boolean;
316
+ }
317
+ interface LineageTraversalRequest {
318
+ startEntityIds: string[];
319
+ direction: 'both' | 'downstream' | 'upstream';
320
+ entityKinds?: LineageEntityKind[];
321
+ relationshipKinds?: LineageRelationshipKind[];
322
+ assertionKinds?: LineageAssertionKind[];
323
+ maximumDepth: number;
324
+ maximumResults: number;
325
+ pageSize: number;
326
+ snapshot?: number;
327
+ cursor?: string;
328
+ includeEvidence?: boolean;
329
+ }
330
+ interface LineageTraversalNode {
331
+ entity: LineageEntity;
332
+ depth: number;
333
+ pathAssertionIds: string[];
334
+ }
335
+ interface LineageTraversalEdge {
336
+ assertion: LineageAssertion;
337
+ status: 'active' | 'corrected' | 'retracted' | 'superseded';
338
+ evidence?: LineageEvidence[];
339
+ }
340
+ interface LineageTraversalResult {
341
+ contract: typeof DATASET_LINEAGE_CONTRACT;
342
+ schemaVersion: string;
343
+ snapshot: number;
344
+ nodes: LineageTraversalNode[];
345
+ edges: LineageTraversalEdge[];
346
+ nextCursor?: string;
347
+ truncated: boolean;
348
+ }
349
+ type LineageValidationCode = 'ACTIVITY_REQUIRED' | 'AGENT_DANGLING' | 'CORRECTION_INVALID' | 'CURSOR_INVALID' | 'EVIDENCE_DANGLING' | 'EVIDENCE_DIGEST_MISMATCH' | 'IDENTITY_DANGLING' | 'IDENTITY_DUPLICATE' | 'IDENTITY_REQUIRED' | 'SNAPSHOT_UNAVAILABLE' | 'TRAVERSAL_LIMIT_EXCEEDED' | 'TYPE_DIRECTION_INVALID' | 'VALUE_INVALID';
350
+ declare class LineageValidationError extends Error {
351
+ readonly code: LineageValidationCode;
352
+ constructor(code: LineageValidationCode, message: string);
353
+ }
354
+ interface LineageProjectionCapabilities {
355
+ entityKinds: LineageEntityKind[];
356
+ relationshipKinds: LineageRelationshipKind[];
357
+ assertionKinds: LineageAssertionKind[];
358
+ preservesEvidence: boolean;
359
+ preservesCorrections: boolean;
360
+ }
361
+ interface LineageLossItem {
362
+ path: string;
363
+ reason: 'corrections-omitted' | 'evidence-omitted' | 'unsupported-assertion-kind' | 'unsupported-entity-kind' | 'unsupported-relationship-kind';
364
+ canonicalDigest: string;
365
+ }
366
+ interface LineageLossReceipt {
367
+ contract: typeof DATASET_LINEAGE_CONTRACT;
368
+ schemaVersion: string;
369
+ sourceDigest: string;
370
+ projectionDigest: string;
371
+ lossless: boolean;
372
+ losses: LineageLossItem[];
373
+ }
374
+ interface LineageProjection {
375
+ contract: typeof DATASET_LINEAGE_CONTRACT;
376
+ schemaVersion: string;
377
+ canonical: false;
378
+ regenerable: true;
379
+ sourceDigest: string;
380
+ entities: LineageEntity[];
381
+ assertions: LineageAssertion[];
382
+ evidence: LineageEvidence[];
383
+ corrections: LineageCorrection[];
384
+ digest: string;
385
+ lossReceipt: LineageLossReceipt;
386
+ }
387
+ declare function computeLineageDigest(value: unknown): string;
388
+ interface DatasetLineageLedgerOptions {
389
+ maximumTraversalDepth?: number;
390
+ maximumTraversalResults?: number;
391
+ maximumPageSize?: number;
392
+ }
393
+ /**
394
+ * Append-only canonical lineage ledger. Graph and index views are projections;
395
+ * this ledger remains the authority for assertions and their evidence.
396
+ */
397
+ declare class DatasetLineageLedger {
398
+ private sequence;
399
+ private readonly entities;
400
+ private readonly agents;
401
+ private readonly activities;
402
+ private readonly evidence;
403
+ private readonly assertions;
404
+ private readonly corrections;
405
+ private readonly maximumTraversalDepth;
406
+ private readonly maximumTraversalResults;
407
+ private readonly maximumPageSize;
408
+ constructor(options?: DatasetLineageLedgerOptions);
409
+ get snapshot(): number;
410
+ appendEntity(entity: LineageEntity): number;
411
+ appendAgent(agent: LineageAgent): number;
412
+ appendActivity(activity: LineageActivity): number;
413
+ appendEvidence(item: LineageEvidence): number;
414
+ appendAssertion(assertion: LineageAssertion): number;
415
+ appendCorrection(correction: LineageCorrection): number;
416
+ traverse(request: LineageTraversalRequest, policy: LineageAuthorizationPolicy): LineageTraversalResult;
417
+ exportArchive(snapshot?: number): LineageLedgerArchive;
418
+ static importArchive(archive: LineageLedgerArchive, options?: DatasetLineageLedgerOptions): DatasetLineageLedger;
419
+ project(capabilities: LineageProjectionCapabilities, snapshot?: number): LineageProjection;
420
+ private append;
421
+ private ensureUnique;
422
+ private visibleAt;
423
+ private sorted;
424
+ private hasReplacementPermission;
425
+ private statusAt;
426
+ private validateTraversalRequest;
427
+ private traversalFingerprint;
428
+ private decodeCursor;
429
+ }
430
+ /**
431
+ * Language-neutral dataset execution capability negotiation contract.
432
+ *
433
+ * A descriptor reports demonstrated behavior for one concrete runtime. It is
434
+ * not inferred from a package/backend name and it does not establish liveness.
435
+ */
436
+ declare const DATASET_EXECUTION_CONTRACT: "fortemi.dataset-execution-capabilities/v1";
437
+ declare const DATASET_EXECUTION_SCHEMA_VERSION: "1.0.0";
438
+ declare const DATASET_EXECUTION_CAPABILITY_IDS: readonly [
439
+ "ingest.full",
440
+ "ingest.snapshot",
441
+ "ingest.incremental",
442
+ "ingest.stream",
443
+ "schema.inspect",
444
+ "identity.stable-revision",
445
+ "identity.record",
446
+ "mutation.upsert",
447
+ "mutation.tombstone",
448
+ "mutation.reconcile",
449
+ "checkpoint.read",
450
+ "checkpoint.write",
451
+ "execution.cancel",
452
+ "rejection.record",
453
+ "index.lexical",
454
+ "index.chunk",
455
+ "index.vector",
456
+ "index.hybrid",
457
+ "index.rerank",
458
+ "index.graph",
459
+ "index.community",
460
+ "lineage.dataset",
461
+ "lineage.record",
462
+ "lineage.field",
463
+ "lineage.relationship-evidence",
464
+ "transaction.atomic-batch",
465
+ "privacy.pre-materialization-filter",
466
+ "pagination.cursor",
467
+ "ordering.deterministic"
468
+ ];
469
+ type DatasetExecutionCapabilityId = typeof DATASET_EXECUTION_CAPABILITY_IDS[number];
470
+ type DatasetExecutionPlane = 'browser-local-archive' | 'live-remote-persistence' | 'portable-shard' | 'server-process' | 'static-cache';
471
+ type DatasetExecutionDataClass = 'canonical' | 'portable-projection' | 'regenerable-index' | 'remote-persistence' | 'static-cache';
472
+ type DatasetExecutionMaturity = 'alpha' | 'beta' | 'experimental' | 'stable';
473
+ type DatasetCapabilityStatus = 'experimental' | 'supported' | 'unsupported';
474
+ interface DatasetCapabilityEvidence {
475
+ id: string;
476
+ kind: 'conformance-report' | 'fixture' | 'live-qualification';
477
+ uri: string;
478
+ digest?: string;
479
+ }
480
+ interface DatasetCapabilityLimits {
481
+ maxInputBytes?: number;
482
+ maxRecordBytes?: number;
483
+ maxBatchRecords?: number;
484
+ maxConcurrency?: number;
485
+ maxPageSize?: number;
486
+ maxTraversalDepth?: number;
487
+ }
488
+ interface DatasetCapabilityDeclaration {
489
+ id: DatasetExecutionCapabilityId;
490
+ version: string;
491
+ status: DatasetCapabilityStatus;
492
+ limits?: DatasetCapabilityLimits;
493
+ evidence: string[];
494
+ }
495
+ interface DatasetExecutionCapabilityDescriptor {
496
+ contract: typeof DATASET_EXECUTION_CONTRACT;
497
+ schemaVersion: string;
498
+ runtime: {
499
+ dataClass: DatasetExecutionDataClass;
500
+ id: string;
501
+ maturity: DatasetExecutionMaturity;
502
+ plane: DatasetExecutionPlane;
503
+ version: string;
504
+ };
505
+ guarantees: {
506
+ availability: 'local-process' | 'remote-service' | 'single-host';
507
+ durability: 'filesystem' | 'memory' | 'process' | 'replicated' | 'wal';
508
+ isolation: 'none' | 'serializable' | 'snapshot';
509
+ ordering: 'backend-cursor' | 'stable-identity' | 'unspecified';
510
+ transaction: 'atomic-batch' | 'none' | 'single-record';
511
+ };
512
+ capabilities: DatasetCapabilityDeclaration[];
513
+ evidence: DatasetCapabilityEvidence[];
514
+ }
515
+ interface DatasetCapabilityRequirement {
516
+ id: DatasetExecutionCapabilityId;
517
+ minimumVersion?: string;
518
+ minimumLimits?: DatasetCapabilityLimits;
519
+ }
520
+ interface DatasetOptionalCapabilityRequirement extends DatasetCapabilityRequirement {
521
+ fallback?: DatasetExecutionCapabilityId[];
522
+ }
523
+ interface DatasetCapabilityNegotiationRequest {
524
+ contract: typeof DATASET_EXECUTION_CONTRACT;
525
+ required: DatasetCapabilityRequirement[];
526
+ optional?: DatasetOptionalCapabilityRequirement[];
527
+ }
528
+ type DatasetCapabilityDiagnosticCode = 'CAPABILITY_DUPLICATE' | 'CAPABILITY_INCONSISTENT' | 'CAPABILITY_LIMIT_INSUFFICIENT' | 'CAPABILITY_VERSION_INSUFFICIENT' | 'CONTRACT_MAJOR_UNSUPPORTED' | 'DESCRIPTOR_INVALID' | 'REQUIRED_CAPABILITY_MISSING' | 'SCHEMA_VERSION_UNSUPPORTED';
529
+ interface DatasetCapabilityDiagnostic {
530
+ code: DatasetCapabilityDiagnosticCode;
531
+ capability?: DatasetExecutionCapabilityId;
532
+ path?: string;
533
+ message: string;
534
+ }
535
+ interface DatasetCapabilityDegradation {
536
+ requested: DatasetExecutionCapabilityId;
537
+ selected?: DatasetExecutionCapabilityId;
538
+ reason: 'limit-insufficient' | 'unsupported' | 'version-insufficient';
539
+ changedGuarantees: string[];
540
+ }
541
+ interface DatasetCapabilityNegotiationResult {
542
+ contract: typeof DATASET_EXECUTION_CONTRACT;
543
+ accepted: boolean;
544
+ runtime: DatasetExecutionCapabilityDescriptor['runtime'];
545
+ selected: DatasetExecutionCapabilityId[];
546
+ degradations: DatasetCapabilityDegradation[];
547
+ diagnostics: DatasetCapabilityDiagnostic[];
548
+ }
549
+ declare function validateDatasetExecutionDescriptor(descriptor: DatasetExecutionCapabilityDescriptor): DatasetCapabilityDiagnostic[];
550
+ /** Pure negotiation: performs no I/O and cannot mutate the descriptor or request. */
551
+ declare function negotiateDatasetExecutionCapabilities(descriptor: DatasetExecutionCapabilityDescriptor, request: DatasetCapabilityNegotiationRequest): DatasetCapabilityNegotiationResult;
552
+ /** Descriptor for the journaled browser-local RecordStore/PGlite projection. */
553
+ declare const FORTEMI_BROWSER_LOCAL_DATASET_EXECUTION_DESCRIPTOR: DatasetExecutionCapabilityDescriptor;
554
+ /** Descriptor for the read-only generated Fortemi index cache. */
555
+ declare const FORTEMI_STATIC_CACHE_DATASET_EXECUTION_DESCRIPTOR: DatasetExecutionCapabilityDescriptor;
556
+ /** Descriptor for a verified, immutable Knowledge Shard projection. */
557
+ declare const FORTEMI_PORTABLE_SHARD_DATASET_EXECUTION_DESCRIPTOR: DatasetExecutionCapabilityDescriptor;
558
+ declare const DATASET_MATERIALIZATION_CONTRACT: "fortemi.dataset-materialization-profile/v1";
559
+ declare const DATASET_MATERIALIZATION_SCHEMA_VERSION: "1.0.0";
560
+ declare const DATASET_MATERIALIZATION_KINDS: readonly [
561
+ "chunking",
562
+ "lexical",
563
+ "vector",
564
+ "hybrid",
565
+ "rerank",
566
+ "entity-relationship-extraction",
567
+ "graph-retrieval",
568
+ "community"
569
+ ];
570
+ type DatasetMaterializationKind = typeof DATASET_MATERIALIZATION_KINDS[number];
571
+ type DatasetMaterializationOperation = 'build' | 'query';
572
+ type DatasetDeterminismClass = 'deterministic' | 'nondeterministic' | 'seeded';
573
+ type DatasetPrivacyBoundary = 'chunking' | 'index-persistence' | 'model-invocation';
574
+ type DatasetProfileStatus = 'experimental' | 'supported' | 'unsupported';
575
+ type DatasetDigest = `sha256:${string}`;
576
+ interface DatasetImplementationIdentity {
577
+ id: string;
578
+ version: string;
579
+ digest: DatasetDigest;
580
+ model?: {
581
+ digest: DatasetDigest;
582
+ id: string;
583
+ version: string;
584
+ };
585
+ }
586
+ interface DatasetMaterializationProfile {
587
+ contract: typeof DATASET_MATERIALIZATION_CONTRACT;
588
+ schemaVersion: string;
589
+ id: string;
590
+ version: string;
591
+ kind: DatasetMaterializationKind;
592
+ status: DatasetProfileStatus;
593
+ operations: DatasetMaterializationOperation[];
594
+ inputTypes: string[];
595
+ implementation: DatasetImplementationIdentity;
596
+ configurationSchema: Record<string, unknown>;
597
+ requiredRuntimeCapabilities: DatasetCapabilityRequirement[];
598
+ optionalRuntimeCapabilities?: Array<DatasetCapabilityRequirement & {
599
+ fallback?: DatasetExecutionCapabilityId[];
600
+ }>;
601
+ determinism: {
602
+ class: DatasetDeterminismClass;
603
+ seedRequired?: boolean;
604
+ };
605
+ privacy: {
606
+ authorizationRequired: true;
607
+ behavior: 'local-only' | 'policy-filtered-external';
608
+ filtersBefore: DatasetPrivacyBoundary[];
609
+ };
610
+ resourceLimits: {
611
+ maxConcurrency: number;
612
+ maxInputBytes: number;
613
+ maxMemoryBytes?: number;
614
+ maxRecords: number;
615
+ timeoutMs?: number;
616
+ };
617
+ output: {
618
+ canonicalMutation: false;
619
+ dataClass: 'regenerable-index';
620
+ };
621
+ }
622
+ interface DatasetProfileNegotiationRequest {
623
+ operation: DatasetMaterializationOperation;
624
+ profile: DatasetMaterializationProfile;
625
+ runtime: DatasetExecutionCapabilityDescriptor;
626
+ fallbackProfiles?: DatasetMaterializationProfile[];
627
+ }
628
+ interface DatasetProfileNegotiationResult {
629
+ accepted: boolean;
630
+ requestedProfile: string;
631
+ selectedProfile?: string;
632
+ runtime: DatasetExecutionCapabilityDescriptor['runtime'];
633
+ degraded: boolean;
634
+ degradations: DatasetCapabilityDegradation[];
635
+ diagnostics: Array<{
636
+ code: 'NO_FALLBACK_PROFILE' | 'OPERATION_UNSUPPORTED' | 'PROFILE_INVALID' | 'PROFILE_UNSUPPORTED';
637
+ message: string;
638
+ path?: string;
639
+ } | DatasetCapabilityDiagnostic>;
640
+ }
641
+ interface DatasetSourceRecord {
642
+ logicalId: string;
643
+ revision: string;
644
+ digest: DatasetDigest;
645
+ content: unknown;
646
+ locator?: string;
647
+ }
648
+ interface DatasetSourceSnapshot {
649
+ datasetId: string;
650
+ revision: string;
651
+ schemaId: string;
652
+ schemaVersion: string;
653
+ schemaDigest: DatasetDigest;
654
+ sourceDigests: DatasetDigest[];
655
+ records: DatasetSourceRecord[];
656
+ }
657
+ interface DatasetPrivacyDecision {
658
+ policyId: string;
659
+ policyVersion: string;
660
+ policyDigest: DatasetDigest;
661
+ allowedRecordDigests: DatasetDigest[];
662
+ deniedRecordDigests: DatasetDigest[];
663
+ evaluatedAt: string;
664
+ }
665
+ interface DatasetMaterializationArtifact {
666
+ kind: 'chunk' | 'community' | 'entity' | 'graph-result' | 'lexical-entry' | 'relationship' | 'reranked-hit' | 'vector';
667
+ logicalId: string;
668
+ sourceRecordDigests: DatasetDigest[];
669
+ digest: DatasetDigest;
670
+ payload?: unknown;
671
+ score?: number;
672
+ }
673
+ interface DatasetMeasuredResources {
674
+ elapsedMs: number;
675
+ inputBytes: number;
676
+ peakMemoryBytes?: number;
677
+ modelInvocations: number;
678
+ persistedBytes: number;
679
+ }
680
+ interface DatasetMaterializationRequest {
681
+ runId: string;
682
+ processingRunId: string;
683
+ snapshot: DatasetSourceSnapshot;
684
+ profile: DatasetMaterializationProfile;
685
+ configuration: unknown;
686
+ operation: 'build';
687
+ mode: 'full' | 'incremental';
688
+ affected?: {
689
+ chunkDigests: DatasetDigest[];
690
+ recordDigests: DatasetDigest[];
691
+ sourceRevisions: string[];
692
+ };
693
+ }
694
+ interface DatasetMaterializationReceipt {
695
+ contract: typeof DATASET_MATERIALIZATION_CONTRACT;
696
+ schemaVersion: string;
697
+ receiptId: string;
698
+ runId: string;
699
+ processingRunId: string;
700
+ source: {
701
+ datasetId: string;
702
+ digests: DatasetDigest[];
703
+ revision: string;
704
+ };
705
+ schema: {
706
+ digest: DatasetDigest;
707
+ id: string;
708
+ version: string;
709
+ };
710
+ profile: {
711
+ configurationDigest: DatasetDigest;
712
+ digest: DatasetDigest;
713
+ id: string;
714
+ implementation: DatasetImplementationIdentity;
715
+ version: string;
716
+ };
717
+ runtime: DatasetExecutionCapabilityDescriptor['runtime'];
718
+ negotiation: Pick<DatasetProfileNegotiationResult, 'degradations' | 'degraded' | 'requestedProfile' | 'selectedProfile'>;
719
+ mode: 'full' | 'incremental';
720
+ affected: {
721
+ chunkDigests: DatasetDigest[];
722
+ recordDigests: DatasetDigest[];
723
+ sourceRevisions: string[];
724
+ };
725
+ output: {
726
+ aggregateDigest: DatasetDigest;
727
+ counts: Record<string, number>;
728
+ digests: DatasetDigest[];
729
+ };
730
+ privacy: DatasetPrivacyDecision;
731
+ resources: DatasetMeasuredResources;
732
+ createdAt: string;
733
+ }
734
+ interface DatasetRetrievalRequest {
735
+ queryId: string;
736
+ operation: 'query';
737
+ profile: DatasetMaterializationProfile;
738
+ query: unknown;
739
+ limit: number;
740
+ }
741
+ interface DatasetRetrievalResponse {
742
+ contract: typeof DATASET_MATERIALIZATION_CONTRACT;
743
+ schemaVersion: string;
744
+ queryId: string;
745
+ requestedProfile: string;
746
+ actualProfile: string;
747
+ actualBackend: {
748
+ id: string;
749
+ plane: DatasetExecutionCapabilityDescriptor['runtime']['plane'];
750
+ version: string;
751
+ };
752
+ degraded: boolean;
753
+ fallbackReason?: string;
754
+ scoreSemantics: {
755
+ comparableAcrossImplementations: false;
756
+ implementationScoped: true;
757
+ };
758
+ results: DatasetMaterializationArtifact[];
759
+ receiptId: string;
760
+ }
761
+ interface DatasetBenchmarkEvidence {
762
+ contract: typeof DATASET_MATERIALIZATION_CONTRACT;
763
+ schemaVersion: string;
764
+ evidenceType: 'benchmark';
765
+ benchmarkId: string;
766
+ corpus: {
767
+ bytes: number;
768
+ digest: DatasetDigest;
769
+ id: string;
770
+ records: number;
771
+ revision: string;
772
+ };
773
+ hardware: {
774
+ accelerator?: string;
775
+ cpu: string;
776
+ memoryBytes: number;
777
+ runtime: string;
778
+ };
779
+ implementation: DatasetImplementationIdentity;
780
+ profile: {
781
+ configurationDigest: DatasetDigest;
782
+ digest: DatasetDigest;
783
+ id: string;
784
+ version: string;
785
+ };
786
+ correctness: {
787
+ passed: boolean;
788
+ receiptDigest: DatasetDigest;
789
+ suite: string;
790
+ };
791
+ freshness: {
792
+ measuredAt: string;
793
+ sourceRevision: string;
794
+ };
795
+ measurements: Array<{
796
+ name: string;
797
+ unit: 'bytes' | 'ms' | 'queries/s' | 'records/s';
798
+ value: number;
799
+ }>;
800
+ claims: {
801
+ corpusScoped: true;
802
+ universalScaleLimit: false;
803
+ };
804
+ }
805
+ interface DatasetMaterializationAdapter {
806
+ readonly backend: {
807
+ id: string;
808
+ version: string;
809
+ };
810
+ materialize(input: Readonly<{
811
+ affected: DatasetMaterializationReceipt['affected'];
812
+ configuration: unknown;
813
+ mode: 'full' | 'incremental';
814
+ profile: DatasetMaterializationProfile;
815
+ snapshot: DatasetSourceSnapshot;
816
+ }>): Promise<{
817
+ artifacts: DatasetMaterializationArtifact[];
818
+ resources: DatasetMeasuredResources;
819
+ }>;
820
+ retrieve?(input: Readonly<{
821
+ profile: DatasetMaterializationProfile;
822
+ request: DatasetRetrievalRequest;
823
+ }>): Promise<DatasetMaterializationArtifact[]>;
824
+ }
825
+ type DatasetRecordAuthorizer = (record: Readonly<DatasetSourceRecord>) => boolean | Promise<boolean>;
826
+ declare class DatasetMaterializationError extends Error {
827
+ readonly code: 'ADAPTER_MISMATCH' | 'CONFIGURATION_INVALID' | 'NEGOTIATION_FAILED' | 'PROFILE_INVALID' | 'RESOURCE_LIMIT_EXCEEDED';
828
+ constructor(code: 'ADAPTER_MISMATCH' | 'CONFIGURATION_INVALID' | 'NEGOTIATION_FAILED' | 'PROFILE_INVALID' | 'RESOURCE_LIMIT_EXCEEDED', message: string);
829
+ }
830
+ declare function digestDatasetMaterializationValue(value: unknown): DatasetDigest;
831
+ /** Negotiate the profile and its required/optional runtime capabilities before any build or query I/O. */
832
+ declare function negotiateDatasetMaterializationProfile(request: DatasetProfileNegotiationRequest): DatasetProfileNegotiationResult;
833
+ /**
834
+ * Runs authorization before the adapter sees text, model inputs, or persistence inputs.
835
+ * The adapter receives a detached immutable snapshot and can only return derived artifacts.
836
+ */
837
+ declare function executeDatasetMaterialization(request: DatasetMaterializationRequest, runtime: DatasetExecutionCapabilityDescriptor, adapter: DatasetMaterializationAdapter, authorize: DatasetRecordAuthorizer, options?: {
838
+ fallbackProfiles?: DatasetMaterializationProfile[];
839
+ now?: () => string;
840
+ }): Promise<{
841
+ artifacts: DatasetMaterializationArtifact[];
842
+ receipt: DatasetMaterializationReceipt;
843
+ }>;
844
+ declare function executeDatasetRetrieval(request: DatasetRetrievalRequest, runtime: DatasetExecutionCapabilityDescriptor, adapter: DatasetMaterializationAdapter, receiptId: string, fallbackProfiles?: DatasetMaterializationProfile[]): Promise<DatasetRetrievalResponse>;
845
+ interface DatasetIncrementalParityResult {
846
+ equivalent: boolean;
847
+ mismatches: Array<'chunks' | 'communities' | 'digests' | 'identities' | 'ordering' | 'relationships'>;
848
+ }
849
+ /** Compares every correctness dimension required before incremental output may replace a full rebuild. */
850
+ declare function compareDatasetIncrementalParity(full: readonly DatasetMaterializationArtifact[], incremental: readonly DatasetMaterializationArtifact[]): DatasetIncrementalParityResult;
851
+ /** Benchmark evidence is publishable only after correctness and source-binding gates pass. */
852
+ declare function validateDatasetBenchmarkEvidence(evidence: DatasetBenchmarkEvidence): string[];
14
853
  /**
15
854
  * Typed event bus with IDisposable subscriptions (Monaco-style).
16
855
  * SSE-style pub/sub across all layers.
@@ -104,6 +943,51 @@ interface EventMap {
104
943
  id: string;
105
944
  name: string;
106
945
  };
946
+ 'provider.route.configured': {
947
+ fallback?: boolean;
948
+ hasRequirements: boolean;
949
+ model?: string;
950
+ providerIds: string[];
951
+ task: string;
952
+ };
953
+ 'provider.route.cleared': {
954
+ task?: string;
955
+ };
956
+ 'provider.route.selected': {
957
+ capability: string;
958
+ model?: string;
959
+ providerId: string;
960
+ providerName: string;
961
+ routeMatched: boolean;
962
+ task?: string;
963
+ tier: string;
964
+ };
965
+ 'provider.route.completed': {
966
+ attempt: number;
967
+ capability: string;
968
+ fallbackCount: number;
969
+ latencyMs: number;
970
+ model?: string;
971
+ providerId: string;
972
+ providerName: string;
973
+ routeMatched: boolean;
974
+ task?: string;
975
+ tier: string;
976
+ };
977
+ 'provider.route.failed': {
978
+ attempt: number;
979
+ capability: string;
980
+ error: string;
981
+ errorCategory: string;
982
+ fallbackCount: number;
983
+ latencyMs: number;
984
+ model?: string;
985
+ providerId?: string;
986
+ providerName?: string;
987
+ routeMatched: boolean;
988
+ task?: string;
989
+ tier?: string;
990
+ };
107
991
  'provider.fallback': {
108
992
  error: string;
109
993
  errorCategory: string;
@@ -1829,8 +2713,12 @@ declare class SearchRepository {
1829
2713
  private fetchFacets;
1830
2714
  private fetchTagMap;
1831
2715
  }
2716
+ declare const SOURCE_UPSERT_CONTRACT_VERSION = "1.0.0";
2717
+ declare const SOURCE_UPSERT_MAX_ITEMS = 500;
1832
2718
  type SourceUpsertPolicy = 'conflict' | 'replace' | 'version';
1833
2719
  type SourceUpsertOutcome = 'conflict' | 'inserted' | 'rejected' | 'replaced' | 'unchanged' | 'versioned';
2720
+ type SourceUpsertBatchOutcome = 'committed' | 'duplicate' | 'preview' | 'rejected';
2721
+ type SourceUpsertReasonCode = 'batch_id_reused_with_different_request' | 'batch_size_out_of_bounds' | 'caller_stable_id_conflict' | 'checkpoint_too_large' | 'content_digest_mismatch' | 'duplicate_external_id_in_batch' | 'invalid_batch_metadata' | 'invalid_item';
1834
2722
  interface SourceIdentityInput {
1835
2723
  tenant_id?: string;
1836
2724
  archive_id?: null | string;
@@ -1838,20 +2726,52 @@ interface SourceIdentityInput {
1838
2726
  external_id: string;
1839
2727
  source_schema_version: string;
1840
2728
  import_run_id: string;
2729
+ source_id?: string;
2730
+ workspace_id?: string;
1841
2731
  caller_stable_id?: string;
1842
2732
  }
1843
2733
  interface SourceUpsertItem {
1844
2734
  source: SourceIdentityInput;
1845
2735
  title?: null | string;
1846
2736
  content: string;
2737
+ content_digest?: string;
1847
2738
  format?: string;
1848
2739
  visibility?: string;
1849
2740
  metadata?: null | Record<string, unknown>;
1850
2741
  policy?: SourceUpsertPolicy;
1851
2742
  }
2743
+ interface SourceUpsertRequestItem {
2744
+ external_id: string;
2745
+ content: string;
2746
+ content_digest?: string;
2747
+ caller_stable_id?: string;
2748
+ title?: string;
2749
+ format?: string;
2750
+ metadata?: Record<string, unknown>;
2751
+ policy?: SourceUpsertPolicy;
2752
+ }
2753
+ interface SourceUpsertRequest {
2754
+ source_namespace: string;
2755
+ source_id?: string;
2756
+ source_schema_version: string;
2757
+ import_run_id: string;
2758
+ batch_id?: string;
2759
+ workspace_id?: string;
2760
+ checkpoint?: Record<string, unknown>;
2761
+ dry_run?: boolean;
2762
+ policy?: SourceUpsertPolicy;
2763
+ items: SourceUpsertRequestItem[];
2764
+ }
2765
+ interface SourceUpsertScope {
2766
+ tenant_id?: string;
2767
+ archive_id?: null | string;
2768
+ }
1852
2769
  interface SourceUpsertOptions {
1853
2770
  dryRun?: boolean;
1854
2771
  maxItems?: number;
2772
+ batchId?: string;
2773
+ checkpoint?: Record<string, unknown>;
2774
+ policy?: SourceUpsertPolicy;
1855
2775
  }
1856
2776
  interface SourceUpsertItemResult {
1857
2777
  index: number;
@@ -1859,20 +2779,30 @@ interface SourceUpsertItemResult {
1859
2779
  note_id?: string;
1860
2780
  external_id_hash: string;
1861
2781
  content_digest: string;
2782
+ reason_code?: SourceUpsertReasonCode;
2783
+ /** @deprecated Use reason_code. Kept for source compatibility. */
1862
2784
  reason?: string;
1863
2785
  }
1864
- interface SourceUpsertBatchResult {
2786
+ interface SourceUpsertResponse {
2787
+ contract_version: typeof SOURCE_UPSERT_CONTRACT_VERSION;
1865
2788
  import_run_id: string;
2789
+ batch_id: string;
1866
2790
  dry_run: boolean;
1867
- outcomes: SourceUpsertItemResult[];
2791
+ outcome: SourceUpsertBatchOutcome;
2792
+ checkpoint?: Record<string, unknown>;
2793
+ items: SourceUpsertItemResult[];
1868
2794
  counts: Record<SourceUpsertOutcome, number>;
1869
2795
  }
2796
+ interface SourceUpsertBatchResult extends SourceUpsertResponse {
2797
+ /** @deprecated Use items. Kept for source compatibility. */
2798
+ outcomes: SourceUpsertItemResult[];
2799
+ }
1870
2800
  declare class SourceUpsertRepository {
1871
2801
  private db;
1872
2802
  private events?;
1873
2803
  constructor(db: DatabaseClient, events?: TypedEventBus | undefined);
2804
+ upsertRequest(request: SourceUpsertRequest, scope?: SourceUpsertScope): Promise<SourceUpsertResponse>;
1874
2805
  upsertBatch(items: readonly SourceUpsertItem[], options?: SourceUpsertOptions): Promise<SourceUpsertBatchResult>;
1875
- private finish;
1876
2806
  }
1877
2807
  interface PurgeSelector {
1878
2808
  tenant_id?: string;
@@ -3070,6 +4000,100 @@ declare function detectInferenceCapabilities(): Promise<InferenceCapabilities>;
3070
4000
  */
3071
4001
  /** Split text into overlapping chunks for embedding. */
3072
4002
  declare function chunkText(text: string, maxChars?: number, overlap?: number): string[];
4003
+ /**
4004
+ * Formal InferenceProvider interface.
4005
+ * Core contract for all inference providers — remote APIs, local servers, in-browser models.
4006
+ * Core stays dependency-free: interface only, no implementations.
4007
+ *
4008
+ * @implements #112 formal InferenceProvider interface
4009
+ */
4010
+ interface ProviderCapabilities {
4011
+ embeddings: boolean;
4012
+ chat: boolean;
4013
+ streaming: boolean;
4014
+ vision: boolean;
4015
+ toolCalling: boolean;
4016
+ structuredOutput: boolean;
4017
+ maxContextTokens?: number;
4018
+ }
4019
+ type ProviderPrivacyTier = 'external' | 'host-managed' | 'local';
4020
+ type ProviderCostTier = 'free' | 'high' | 'low' | 'medium';
4021
+ type ProviderDataClass = 'private' | 'public' | 'regulated' | 'sensitive';
4022
+ interface ProviderProfile {
4023
+ privacyTier?: ProviderPrivacyTier;
4024
+ costTier?: ProviderCostTier;
4025
+ maxInputChars?: number;
4026
+ embeddingDimensions?: number[];
4027
+ dataClasses?: ProviderDataClass[];
4028
+ }
4029
+ type InferenceTask = 'chat.general' | 'chat.linking' | 'chat.revision' | 'chat.tagging' | 'embedding.document' | 'embedding.large-document' | 'embedding.query' | 'vision.general';
4030
+ interface EmbedRequest {
4031
+ texts: string[];
4032
+ model?: string;
4033
+ task?: InferenceTask;
4034
+ }
4035
+ interface EmbedResponse {
4036
+ vectors: number[][];
4037
+ model: string;
4038
+ usage?: {
4039
+ totalTokens: number;
4040
+ };
4041
+ }
4042
+ interface CompletionRequest {
4043
+ prompt: string;
4044
+ model?: string;
4045
+ task?: InferenceTask;
4046
+ maxTokens?: number;
4047
+ temperature?: number;
4048
+ systemPrompt?: string;
4049
+ stopSequences?: string[];
4050
+ }
4051
+ interface CompletionResponse {
4052
+ text: string;
4053
+ model: string;
4054
+ usage?: {
4055
+ completionTokens: number;
4056
+ promptTokens: number;
4057
+ };
4058
+ finishReason?: 'content_filter' | 'length' | 'stop';
4059
+ }
4060
+ interface StreamChunk {
4061
+ text: string;
4062
+ done: boolean;
4063
+ }
4064
+ interface ModelInfo {
4065
+ id: string;
4066
+ name?: string;
4067
+ capabilities: Partial<ProviderCapabilities>;
4068
+ contextWindow?: number;
4069
+ owned_by?: string;
4070
+ }
4071
+ type ProbeStatus = 'degraded' | 'down' | 'ok';
4072
+ interface ProbeResult {
4073
+ status: ProbeStatus;
4074
+ latencyMs: number;
4075
+ message?: string;
4076
+ }
4077
+ type ProviderTier = 'chrome-ai' | 'in-browser' | 'local-server' | 'remote';
4078
+ interface InferenceProvider {
4079
+ readonly id: string;
4080
+ readonly name: string;
4081
+ readonly tier: ProviderTier;
4082
+ readonly capabilities: ProviderCapabilities;
4083
+ readonly profile?: ProviderProfile;
4084
+ /** Generate embeddings for text inputs */
4085
+ embed?(request: EmbedRequest): Promise<EmbedResponse>;
4086
+ /** Generate a completion (non-streaming) */
4087
+ complete?(request: CompletionRequest): Promise<CompletionResponse>;
4088
+ /** Generate a streaming completion */
4089
+ stream?(request: CompletionRequest): AsyncIterable<StreamChunk>;
4090
+ /** List available models from this provider */
4091
+ listModels(): Promise<ModelInfo[]>;
4092
+ /** Health check — probe the provider */
4093
+ probe(): Promise<ProbeResult>;
4094
+ /** Clean up resources */
4095
+ dispose(): void;
4096
+ }
3073
4097
  /**
3074
4098
  * Embedding generation job handler.
3075
4099
  * Generates and stores vector embeddings for note content.
@@ -3077,9 +4101,22 @@ declare function chunkText(text: string, maxChars?: number, overlap?: number): s
3077
4101
  *
3078
4102
  * @implements #63 embedding generation
3079
4103
  */
4104
+ interface EmbedFunctionOptions {
4105
+ task?: InferenceTask;
4106
+ model?: string;
4107
+ }
4108
+ interface EmbeddingTaskSelectionOptions {
4109
+ largeDocumentChars?: number;
4110
+ largeDocumentChunks?: number;
4111
+ }
4112
+ declare const DEFAULT_LARGE_DOCUMENT_CHARS = 12000;
4113
+ declare const DEFAULT_LARGE_DOCUMENT_CHUNKS = 12;
3080
4114
  /** Type for the embed function — injected by the semantic capability module */
3081
- type EmbedFunction = (texts: string[]) => Promise<number[][]>;
4115
+ type EmbedFunction = (texts: string[], options?: EmbedFunctionOptions) => Promise<number[][]>;
3082
4116
  declare function setEmbedFunction(fn: EmbedFunction | null): void;
4117
+ declare function setEmbeddingTaskSelectionOptions(options?: EmbeddingTaskSelectionOptions): void;
4118
+ declare function getEmbeddingTaskSelectionOptions(): EmbeddingTaskSelectionOptions;
4119
+ declare function selectEmbeddingTask(content: string, chunks: string[], options?: EmbeddingTaskSelectionOptions): InferenceTask;
3083
4120
  declare function getEmbedFunction(): EmbedFunction | null;
3084
4121
  /** Job handler for embedding generation. Registered in JobQueueWorker. */
3085
4122
  declare function embeddingGenerationHandler(job: {
@@ -3092,11 +4129,14 @@ declare function embeddingGenerationHandler(job: {
3092
4129
  *
3093
4130
  * @implements #66 AI title generation
3094
4131
  */
3095
- /** Type for the LLM completion function — injected by the llm capability module */
3096
- type LlmCompleteFn = (prompt: string, options?: {
4132
+ interface LlmCompleteOptions {
3097
4133
  maxTokens?: number;
3098
4134
  temperature?: number;
3099
- }) => Promise<string>;
4135
+ task?: InferenceTask;
4136
+ model?: string;
4137
+ }
4138
+ /** Type for the LLM completion function — injected by the llm capability module */
4139
+ type LlmCompleteFn = (prompt: string, options?: LlmCompleteOptions) => Promise<string>;
3100
4140
  declare function setLlmFunction(fn: LlmCompleteFn | null): void;
3101
4141
  declare function getLlmFunction(): LlmCompleteFn | null;
3102
4142
  /**
@@ -3309,86 +4349,6 @@ declare function registerLlmCapability(manager: CapabilityManager, completeFn: L
3309
4349
  * Unregister the LLM capability — clears the completion function.
3310
4350
  */
3311
4351
  declare function unregisterLlmCapability(): void;
3312
- /**
3313
- * Formal InferenceProvider interface.
3314
- * Core contract for all inference providers — remote APIs, local servers, in-browser models.
3315
- * Core stays dependency-free: interface only, no implementations.
3316
- *
3317
- * @implements #112 formal InferenceProvider interface
3318
- */
3319
- interface ProviderCapabilities {
3320
- embeddings: boolean;
3321
- chat: boolean;
3322
- streaming: boolean;
3323
- vision: boolean;
3324
- toolCalling: boolean;
3325
- structuredOutput: boolean;
3326
- maxContextTokens?: number;
3327
- }
3328
- interface EmbedRequest {
3329
- texts: string[];
3330
- model?: string;
3331
- }
3332
- interface EmbedResponse {
3333
- vectors: number[][];
3334
- model: string;
3335
- usage?: {
3336
- totalTokens: number;
3337
- };
3338
- }
3339
- interface CompletionRequest {
3340
- prompt: string;
3341
- model?: string;
3342
- maxTokens?: number;
3343
- temperature?: number;
3344
- systemPrompt?: string;
3345
- stopSequences?: string[];
3346
- }
3347
- interface CompletionResponse {
3348
- text: string;
3349
- model: string;
3350
- usage?: {
3351
- completionTokens: number;
3352
- promptTokens: number;
3353
- };
3354
- finishReason?: 'content_filter' | 'length' | 'stop';
3355
- }
3356
- interface StreamChunk {
3357
- text: string;
3358
- done: boolean;
3359
- }
3360
- interface ModelInfo {
3361
- id: string;
3362
- name?: string;
3363
- capabilities: Partial<ProviderCapabilities>;
3364
- contextWindow?: number;
3365
- owned_by?: string;
3366
- }
3367
- type ProbeStatus = 'degraded' | 'down' | 'ok';
3368
- interface ProbeResult {
3369
- status: ProbeStatus;
3370
- latencyMs: number;
3371
- message?: string;
3372
- }
3373
- type ProviderTier = 'chrome-ai' | 'in-browser' | 'local-server' | 'remote';
3374
- interface InferenceProvider {
3375
- readonly id: string;
3376
- readonly name: string;
3377
- readonly tier: ProviderTier;
3378
- readonly capabilities: ProviderCapabilities;
3379
- /** Generate embeddings for text inputs */
3380
- embed?(request: EmbedRequest): Promise<EmbedResponse>;
3381
- /** Generate a completion (non-streaming) */
3382
- complete?(request: CompletionRequest): Promise<CompletionResponse>;
3383
- /** Generate a streaming completion */
3384
- stream?(request: CompletionRequest): AsyncIterable<StreamChunk>;
3385
- /** List available models from this provider */
3386
- listModels(): Promise<ModelInfo[]>;
3387
- /** Health check — probe the provider */
3388
- probe(): Promise<ProbeResult>;
3389
- /** Clean up resources */
3390
- dispose(): void;
3391
- }
3392
4352
  /**
3393
4353
  * ProviderRegistry — manages InferenceProvider instances.
3394
4354
  * Supports add/remove/getActive/setActive and derives CapabilityManager state.
@@ -3399,6 +4359,7 @@ declare class ProviderRegistry {
3399
4359
  private events?;
3400
4360
  private providers;
3401
4361
  private activeId;
4362
+ private routes;
3402
4363
  constructor(events?: TypedEventBus | undefined);
3403
4364
  /** Register a provider. First provider with embedding capability becomes active. */
3404
4365
  add(provider: InferenceProvider): void;
@@ -3406,6 +4367,10 @@ declare class ProviderRegistry {
3406
4367
  remove(id: string): void;
3407
4368
  /** Set the active provider by ID */
3408
4369
  setActive(id: string): void;
4370
+ setRoute(task: InferenceTask, policy: ProviderRoutePolicy): void;
4371
+ getRoute(task: InferenceTask): ProviderRoutePolicy | undefined;
4372
+ clearRoute(task: InferenceTask): void;
4373
+ clearRoutes(): void;
3409
4374
  /** Get the currently active provider */
3410
4375
  getActive(): InferenceProvider | null;
3411
4376
  /** Get a provider by ID */
@@ -3426,6 +4391,10 @@ declare class ProviderRegistry {
3426
4391
  complete(request: CompletionRequest): Promise<CompletionResponse>;
3427
4392
  /** Convenience: stream using active provider */
3428
4393
  stream(request: CompletionRequest): AsyncIterable<StreamChunk>;
4394
+ previewRoute(task: InferenceTask | undefined, capability: keyof ProviderCapabilities, requestModel?: string): ProviderRouteSelection;
4395
+ probeRoute(task: InferenceTask | undefined, capability: keyof ProviderCapabilities, requestModel?: string): Promise<ProviderRouteProbeResult>;
4396
+ validateRoute(task: InferenceTask, capability?: keyof ProviderCapabilities, policy?: ProviderRoutePolicy | undefined): ProviderRouteValidation;
4397
+ validateRoutes(): ProviderRouteValidation[];
3429
4398
  /** Dispose all providers */
3430
4399
  dispose(): void;
3431
4400
  /**
@@ -3434,7 +4403,62 @@ declare class ProviderRegistry {
3434
4403
  * consumers that call getEmbedFunction() / getLlmFunction() still work.
3435
4404
  */
3436
4405
  private syncLegacyFunctions;
4406
+ private resolveProvider;
4407
+ private resolveRouteSelections;
4408
+ private emitRouteSelected;
4409
+ private withRouteFallback;
4410
+ private emitRouteCompleted;
4411
+ private emitRouteFailed;
4412
+ private resolveCandidates;
4413
+ }
4414
+ interface ProviderRoutePolicy {
4415
+ providerIds?: string[];
4416
+ tiers?: ProviderTier[];
4417
+ model?: string;
4418
+ fallback?: boolean;
4419
+ requirements?: ProviderRouteRequirements;
4420
+ }
4421
+ interface ProviderRouteRequirements {
4422
+ privacyTiers?: ProviderPrivacyTier[];
4423
+ maxCostTier?: ProviderCostTier;
4424
+ minContextTokens?: number;
4425
+ minEmbeddingDimensions?: number;
4426
+ dataClass?: ProviderDataClass;
4427
+ maxInputChars?: number;
4428
+ }
4429
+ interface ProviderRouteSelection {
4430
+ provider: InferenceProvider;
4431
+ providerId: string;
4432
+ providerName: string;
4433
+ tier: ProviderTier;
4434
+ capability: keyof ProviderCapabilities;
4435
+ task?: InferenceTask;
4436
+ model?: string;
4437
+ routeMatched: boolean;
4438
+ }
4439
+ interface ProviderRouteProbeResult extends ProviderRouteSelection {
4440
+ probe: ProbeResult;
4441
+ }
4442
+ type ProviderRouteValidationSeverity = 'error' | 'warning';
4443
+ interface ProviderRouteValidationIssue {
4444
+ severity: ProviderRouteValidationSeverity;
4445
+ code: 'empty-explicit-chain' | 'missing-handler' | 'missing-provider' | 'no-eligible-provider' | 'profile-requirement' | 'unsupported-capability';
4446
+ message: string;
4447
+ providerId?: string;
4448
+ }
4449
+ interface ProviderRouteValidation {
4450
+ task: InferenceTask;
4451
+ capability: keyof ProviderCapabilities;
4452
+ policy?: ProviderRoutePolicy;
4453
+ providerIds: string[];
4454
+ eligibleProviderIds: string[];
4455
+ issues: ProviderRouteValidationIssue[];
4456
+ ok: boolean;
3437
4457
  }
4458
+ declare function inferInferenceTaskCapability(task: InferenceTask): keyof ProviderCapabilities;
4459
+ declare function validateProviderRoute(task: InferenceTask, capability: keyof ProviderCapabilities, policy: ProviderRoutePolicy | undefined, providers: InferenceProvider[]): ProviderRouteValidation;
4460
+ declare function providerSatisfiesRouteRequirements(provider: InferenceProvider, requirements: ProviderRouteRequirements | undefined, capability: keyof ProviderCapabilities): boolean;
4461
+ declare function getProviderRouteRequirementIssue(provider: InferenceProvider, requirements: ProviderRouteRequirements | undefined, capability: keyof ProviderCapabilities): string | undefined;
3438
4462
  /**
3439
4463
  * Create an InferenceProvider from legacy bare functions.
3440
4464
  * Used by setEmbedFunction/setLlmFunction backward compat layer.
@@ -3444,6 +4468,7 @@ declare function createLegacyProvider(options: {
3444
4468
  id?: string;
3445
4469
  llmFn?: LlmCompleteFn | null;
3446
4470
  name?: string;
4471
+ profile?: InferenceProvider['profile'];
3447
4472
  }): InferenceProvider;
3448
4473
  /**
3449
4474
  * OpenAI-compatible inference provider.
@@ -3464,12 +4489,14 @@ interface OpenAIProviderConfig {
3464
4489
  tier?: ProviderTier;
3465
4490
  headers?: Record<string, string>;
3466
4491
  timeoutMs?: number;
4492
+ profile?: ProviderProfile;
3467
4493
  }
3468
4494
  declare class OpenAICompatibleProvider implements InferenceProvider {
3469
4495
  readonly id: string;
3470
4496
  readonly name: string;
3471
4497
  readonly tier: ProviderTier;
3472
4498
  readonly capabilities: ProviderCapabilities;
4499
+ readonly profile?: ProviderProfile;
3473
4500
  private baseURL;
3474
4501
  private apiKey?;
3475
4502
  private defaultModel;
@@ -3486,11 +4513,70 @@ declare class OpenAICompatibleProvider implements InferenceProvider {
3486
4513
  dispose(): void;
3487
4514
  private buildMessages;
3488
4515
  private mapFinishReason;
3489
- private isEmbeddingModel;
3490
4516
  private isLocalURL;
3491
4517
  private fetch;
3492
4518
  private rawFetch;
3493
4519
  }
4520
+ interface FortemiBridgeCapabilities {
4521
+ secureSecrets: boolean;
4522
+ providerRouting: boolean;
4523
+ localNetworkAccess: boolean;
4524
+ auditLog: boolean;
4525
+ }
4526
+ interface FortemiSecretStore {
4527
+ isAvailable(): boolean | Promise<boolean>;
4528
+ getSecret(key: string): Promise<null | string>;
4529
+ setSecret(key: string, value: string): Promise<void>;
4530
+ deleteSecret(key: string): Promise<void>;
4531
+ }
4532
+ interface BridgeProviderInfo {
4533
+ id: string;
4534
+ name: string;
4535
+ tier: 'chrome-ai' | 'in-browser' | 'local-server' | 'remote';
4536
+ requiresApiKey: boolean;
4537
+ capabilities: {
4538
+ chat?: boolean;
4539
+ embeddings?: boolean;
4540
+ streaming?: boolean;
4541
+ };
4542
+ profile?: ProviderProfile;
4543
+ }
4544
+ interface FortemiInferenceRouter {
4545
+ listProviders(): Promise<BridgeProviderInfo[]>;
4546
+ probeProvider(providerId: string): Promise<ProbeResult>;
4547
+ complete(providerId: string, request: CompletionRequest): Promise<CompletionResponse>;
4548
+ embed(providerId: string, request: EmbedRequest): Promise<EmbedResponse>;
4549
+ stream?(providerId: string, request: CompletionRequest): AsyncIterable<StreamChunk>;
4550
+ }
4551
+ interface FortemiBridge {
4552
+ version: string;
4553
+ capabilities(): Promise<FortemiBridgeCapabilities>;
4554
+ secrets: FortemiSecretStore;
4555
+ inference?: FortemiInferenceRouter;
4556
+ }
4557
+ interface FortemiBridgeHost {
4558
+ fortemiBridge?: FortemiBridge;
4559
+ fortemiSecureStorage?: FortemiSecretStore;
4560
+ }
4561
+ declare function getFortemiBridge(host?: FortemiBridgeHost | undefined): FortemiBridge | null;
4562
+ declare function getFortemiSecretStore(host?: FortemiBridgeHost | undefined): FortemiSecretStore | null;
4563
+ declare function hasFortemiSecureSecrets(host?: FortemiBridgeHost | undefined): Promise<boolean>;
4564
+ declare class BridgeInferenceProvider implements InferenceProvider {
4565
+ private bridge;
4566
+ readonly id: string;
4567
+ readonly name: string;
4568
+ readonly tier: ProviderTier;
4569
+ readonly capabilities: ProviderCapabilities;
4570
+ readonly profile: InferenceProvider['profile'];
4571
+ constructor(bridge: FortemiBridge, info: BridgeProviderInfo);
4572
+ embed(request: EmbedRequest): Promise<EmbedResponse>;
4573
+ complete(request: CompletionRequest): Promise<CompletionResponse>;
4574
+ stream(request: CompletionRequest): AsyncIterable<StreamChunk>;
4575
+ listModels(): Promise<ModelInfo[]>;
4576
+ probe(): Promise<ProbeResult>;
4577
+ dispose(): void;
4578
+ }
4579
+ declare function createBridgeInferenceProviders(bridge: FortemiBridge): Promise<BridgeInferenceProvider[]>;
3494
4580
  /**
3495
4581
  * Local inference server auto-discovery.
3496
4582
  * Probes known local endpoints (Ollama, LM Studio, llama.cpp, vLLM, Jan, LocalAI)
@@ -3524,11 +4610,57 @@ type ModelCategory = 'chat' | 'embedding' | 'vision';
3524
4610
  * Classify a model by its ID/name into embedding, vision, or chat.
3525
4611
  */
3526
4612
  declare function classifyModel(modelId: string): ModelCategory;
4613
+ declare function inferLocalEmbeddingDimensions(models: ModelInfo[]): number[] | undefined;
4614
+ declare function createLocalProviderProfile(models?: ModelInfo[]): ProviderProfile;
3527
4615
  /**
3528
4616
  * Discover local inference servers by probing known endpoints.
3529
4617
  * Returns all reachable providers with their available models.
3530
4618
  */
3531
4619
  declare function discoverLocalProviders(options?: DiscoveryOptions): Promise<DiscoveredProvider[]>;
4620
+ type ConfiguredInferenceProvider = {
4621
+ config: OpenAIProviderConfig;
4622
+ kind: 'openai-compatible';
4623
+ } | {
4624
+ embedFn?: EmbedFunction | null;
4625
+ id?: string;
4626
+ kind: 'legacy';
4627
+ llmFn?: LlmCompleteFn | null;
4628
+ name?: string;
4629
+ profile?: InferenceProvider['profile'];
4630
+ } | {
4631
+ kind: 'provider';
4632
+ provider: InferenceProvider;
4633
+ };
4634
+ type LegacyInferenceProviderConfig = Omit<Extract<ConfiguredInferenceProvider, {
4635
+ kind: 'legacy';
4636
+ }>, 'kind'>;
4637
+ interface InferenceRuntimeConfig {
4638
+ providers?: ConfiguredInferenceProvider[];
4639
+ routes?: Partial<Record<InferenceTask, ProviderRoutePolicy>>;
4640
+ activeProviderId?: string;
4641
+ bridgeHost?: FortemiBridgeHost;
4642
+ includeBridgeProviders?: boolean;
4643
+ discoverLocal?: boolean | DiscoveryOptions;
4644
+ embeddingTaskSelection?: EmbeddingTaskSelectionOptions;
4645
+ }
4646
+ interface ConfigureInferenceRuntimeOptions extends InferenceRuntimeConfig {
4647
+ registry?: ProviderRegistry;
4648
+ events?: TypedEventBus;
4649
+ capabilityManager?: CapabilityManager;
4650
+ }
4651
+ interface ConfiguredInferenceRuntime {
4652
+ registry: ProviderRegistry;
4653
+ providers: InferenceProvider[];
4654
+ routeValidation: ProviderRouteValidation[];
4655
+ routeIssues: ProviderRouteValidation['issues'];
4656
+ }
4657
+ declare function defineInferenceRuntime(config: InferenceRuntimeConfig): InferenceRuntimeConfig;
4658
+ declare function defineInferenceProvider(provider: InferenceProvider): ConfiguredInferenceProvider;
4659
+ declare function defineOpenAICompatibleProvider(config: OpenAIProviderConfig): ConfiguredInferenceProvider;
4660
+ declare function defineLegacyInferenceProvider(config: LegacyInferenceProviderConfig): ConfiguredInferenceProvider;
4661
+ declare function mergeInferenceRuntimeConfigs(...configs: Array<InferenceRuntimeConfig | null | undefined>): InferenceRuntimeConfig;
4662
+ declare function getConfiguredInferenceProviderId(config: ConfiguredInferenceProvider): string;
4663
+ declare function configureInferenceRuntime(options?: ConfigureInferenceRuntimeOptions): Promise<ConfiguredInferenceRuntime>;
3532
4664
  /**
3533
4665
  * FallbackRouter — wraps multiple InferenceProviders with automatic failover.
3534
4666
  * Routes requests to the highest-priority available provider, falling through
@@ -3605,49 +4737,6 @@ declare class FallbackRouter implements InferenceProvider {
3605
4737
  private withFallback;
3606
4738
  private applyCooldown;
3607
4739
  }
3608
- interface FortemiBridgeCapabilities {
3609
- secureSecrets: boolean;
3610
- providerRouting: boolean;
3611
- localNetworkAccess: boolean;
3612
- auditLog: boolean;
3613
- }
3614
- interface FortemiSecretStore {
3615
- isAvailable(): boolean | Promise<boolean>;
3616
- getSecret(key: string): Promise<null | string>;
3617
- setSecret(key: string, value: string): Promise<void>;
3618
- deleteSecret(key: string): Promise<void>;
3619
- }
3620
- interface BridgeProviderInfo {
3621
- id: string;
3622
- name: string;
3623
- tier: 'chrome-ai' | 'in-browser' | 'local-server' | 'remote';
3624
- requiresApiKey: boolean;
3625
- capabilities: {
3626
- chat?: boolean;
3627
- embeddings?: boolean;
3628
- streaming?: boolean;
3629
- };
3630
- }
3631
- interface FortemiInferenceRouter {
3632
- listProviders(): Promise<BridgeProviderInfo[]>;
3633
- probeProvider(providerId: string): Promise<ProbeResult>;
3634
- complete(providerId: string, request: CompletionRequest): Promise<CompletionResponse>;
3635
- embed(providerId: string, request: EmbedRequest): Promise<EmbedResponse>;
3636
- stream?(providerId: string, request: CompletionRequest): AsyncIterable<StreamChunk>;
3637
- }
3638
- interface FortemiBridge {
3639
- version: string;
3640
- capabilities(): Promise<FortemiBridgeCapabilities>;
3641
- secrets: FortemiSecretStore;
3642
- inference?: FortemiInferenceRouter;
3643
- }
3644
- interface FortemiBridgeHost {
3645
- fortemiBridge?: FortemiBridge;
3646
- fortemiSecureStorage?: FortemiSecretStore;
3647
- }
3648
- declare function getFortemiBridge(host?: FortemiBridgeHost | undefined): FortemiBridge | null;
3649
- declare function getFortemiSecretStore(host?: FortemiBridgeHost | undefined): FortemiSecretStore | null;
3650
- declare function hasFortemiSecureSecrets(host?: FortemiBridgeHost | undefined): Promise<boolean>;
3651
4740
  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';
3652
4741
  type CspDirectives = Partial<Record<CspDirectiveName, string[]>>;
3653
4742
  interface PluginCspOptions {
@@ -4057,6 +5146,16 @@ interface NoteRevisedCurrentRecord extends PresenceTrackedRecord {
4057
5146
  is_user_edited: boolean;
4058
5147
  updated_at: string;
4059
5148
  }
5149
+ interface NoteRevisionRecord extends PresenceTrackedRecord {
5150
+ id: string;
5151
+ note_id: string;
5152
+ revision_number: number;
5153
+ type: string;
5154
+ content: null | string;
5155
+ ai_metadata: null | unknown;
5156
+ model: null | string;
5157
+ created_at: string;
5158
+ }
4060
5159
  interface NoteTagRecord extends PresenceTrackedRecord {
4061
5160
  id: string;
4062
5161
  note_id: string;
@@ -4123,6 +5222,7 @@ interface SourceIdentityRecord extends PresenceTrackedRecord {
4123
5222
  namespace: string;
4124
5223
  external_id: string;
4125
5224
  external_id_hash: string;
5225
+ source_id: null | string;
4126
5226
  source_schema_version: string;
4127
5227
  content_digest: string;
4128
5228
  import_run_id: string;
@@ -4133,6 +5233,10 @@ interface SourceIdentityRecord extends PresenceTrackedRecord {
4133
5233
  }
4134
5234
  interface SourceImportRunRecord extends PresenceTrackedRecord {
4135
5235
  id: string;
5236
+ external_run_id: string;
5237
+ source_id: null | string;
5238
+ source_schema_version: string;
5239
+ workspace_id: null | string;
4136
5240
  tenant_id: string;
4137
5241
  archive_id: null | string;
4138
5242
  namespace: string;
@@ -4141,6 +5245,19 @@ interface SourceImportRunRecord extends PresenceTrackedRecord {
4141
5245
  checkpoint: Record<string, unknown>;
4142
5246
  receipt: Record<string, unknown>;
4143
5247
  }
5248
+ interface SourceImportBatchRecord extends PresenceTrackedRecord {
5249
+ id: string;
5250
+ tenant_id: string;
5251
+ archive_id: null | string;
5252
+ namespace: string;
5253
+ batch_id: string;
5254
+ request_digest: string;
5255
+ import_run_id: string;
5256
+ outcome: 'committed';
5257
+ checkpoint: Record<string, unknown>;
5258
+ receipt: Record<string, unknown>;
5259
+ created_at: string;
5260
+ }
4144
5261
  interface DeletionReceiptRecord extends PresenceTrackedRecord {
4145
5262
  id: string;
4146
5263
  operation_key: string;
@@ -4157,6 +5274,7 @@ interface RecordCollections {
4157
5274
  note: NoteRecord0;
4158
5275
  note_original: NoteOriginalRecord;
4159
5276
  note_revised_current: NoteRevisedCurrentRecord;
5277
+ note_revision: NoteRevisionRecord;
4160
5278
  note_tag: NoteTagRecord;
4161
5279
  link: LinkRecord0;
4162
5280
  collection: CollectionRecord;
@@ -4166,6 +5284,7 @@ interface RecordCollections {
4166
5284
  shard_manifest: ShardManifestRecord;
4167
5285
  source_identity: SourceIdentityRecord;
4168
5286
  source_import_run: SourceImportRunRecord;
5287
+ source_import_batch: SourceImportBatchRecord;
4169
5288
  deletion_receipt: DeletionReceiptRecord;
4170
5289
  }
4171
5290
  type RecordCollectionName = keyof RecordCollections;
@@ -4285,7 +5404,7 @@ declare class MemoryRecordStore implements RecordStore {
4285
5404
  * discipline.
4286
5405
  */
4287
5406
  /** Logical record-schema version stored in `meta` (independent of DB_VERSION). */
4288
- declare const RECORD_SCHEMA_VERSION = 2;
5407
+ declare const RECORD_SCHEMA_VERSION = 3;
4289
5408
  interface CreateRecordStoreOptions {
4290
5409
  /** Injectable factory for tests (fake-indexeddb). Defaults to the global. */
4291
5410
  indexedDB?: IDBFactory;
@@ -4459,6 +5578,7 @@ declare function dropAttachmentProjection(db: DatabaseClient): Promise<void>;
4459
5578
  */
4460
5579
  interface NoteProjectionResult {
4461
5580
  notes: number;
5581
+ revisions: number;
4462
5582
  tags: number;
4463
5583
  links: number;
4464
5584
  collections: number;
@@ -4562,6 +5682,7 @@ declare function exportShardFromRecords(store: RecordStore, options?: ExportOpti
4562
5682
  * explicit warnings and reported under `skipped`.
4563
5683
  */
4564
5684
  declare function importShardToRecords(store: RecordStore, data: ArrayBuffer | Uint8Array, options?: ImportOptions): Promise<ImportResult>;
5685
+ declare function upsertRecordStoreRequest(store: RecordStore, request: SourceUpsertRequest, scope?: SourceUpsertScope): Promise<SourceUpsertResponse>;
4565
5686
  declare function upsertRecordStoreSources(store: RecordStore, items: readonly SourceUpsertItem[], options?: SourceUpsertOptions): Promise<SourceUpsertBatchResult>;
4566
5687
  declare function previewRecordStorePurge(store: RecordStore, selector: PurgeSelector): Promise<PurgePreview>;
4567
5688
  declare function purgeRecordStoreGraph(store: RecordStore, selector: PurgeSelector, operationKey: string): Promise<DeletionReceipt>;
@@ -4571,5 +5692,5 @@ declare function purgeRecordStoreGraph(store: RecordStore, selector: PurgeSelect
4571
5692
  * @created 2026-07-17
4572
5693
  * @agent Codex
4573
5694
  */
4574
- declare const VERSION = "2026.8.0";
4575
- 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 DeletionReceipt, type DeletionReceiptRecord, type DiscoveredProvider, type DiscoveryOptions, type DumpDbSnapshotOptions, type DumpableDb, EMBED_REQUEST_KIND, EMBED_RESPONSE_KIND, type EmbedFunction, type EmbedRequest, type EmbedRequestMessage, type EmbedResponse, type EmbedResponseMessage, type EmbedTransportPort, type EmbedWorkerOptions, type EmbeddingCompatibilityPolicy, type EmbeddingSetCreateInput, type EmbeddingSetCriteria, type EmbeddingSetDescriptor, type EmbeddingSetEmbeddingInput, type EmbeddingSetFreshness, type EmbeddingSetKind, type EmbeddingSetMode, type EmbeddingSetRow, type EmbeddingSetSelector, EmbeddingSetsRepository, type EnqueueJobInput, type ErrorCategory, type EventMap, type EvidenceLocator, 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, LifecyclePurgeRepository, 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 MetadataPredicate, 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 PurgeCounts, type PurgePreview, type PurgeSelector, type QueryExecutor, type QueryResult, RECORD_COLLECTIONS, RECORD_SCHEMA_VERSION, RECORD_STORE_CAPABILITIES, REGISTERED_METADATA_PATHS, type RecommendedTier, type RecordBackendManageNoteResult, type RecordBackendOptions, type RecordCollectionName, type RecordCollections, type RecordListOptions, type RecordMutation, type RecordProjectionResult, type RecordProvenanceInput, type RecordStore, type RecordStoreCapabilities, type RegisteredMetadataPath, 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 SourceIdentityInput, type SourceIdentityRecord, type SourceImportRunRecord, type SourceUpsertBatchResult, type SourceUpsertItem, type SourceUpsertItemResult, type SourceUpsertOptions, type SourceUpsertOutcome, type SourceUpsertPolicy, SourceUpsertRepository, 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, buildMetadataPredicateConditions, 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, previewRecordStorePurge, profileSupportError, projectAttachments, projectNotes, projectRecords, provenanceEdgeToShard, purgeRecordStoreGraph, registerLlmCapability, registerSemanticCapability, registerSemanticCapabilityWorker, registerServiceWorker, restoreDbSnapshot, searchTool, selectBackend, selectLlmModel, setEmbedFunction, setLlmFunction, sha256Hex, skosConceptToShard, skosRelationToShard, skosSchemeToShard, suggestTags, tagsToShard, templateToShard, titleGenerationHandler, unpackTarGz, unregisterLlmCapability, unregisterSemanticCapability, upsertRecordStoreSources, urlLinkToShard, validateChecksums, validateCoreV1ShardArchive, validateFortemiCompatibilityResponse, validateFullV1ShardArchive, validateRecordV1ShardArchive, validateShardArchive, validateShardComponentRecord, validateShardManifest, verifyDbSnapshotMeta, verifySri };
5695
+ declare const VERSION = "2026.9.1";
5696
+ 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, BridgeInferenceProvider, 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 ConfigureInferenceRuntimeOptions, type ConfiguredInferenceProvider, type ConfiguredInferenceRuntime, type CooldownConfig, type CooldownEvent, type CosineSemanticProviderOptions, type CreatePGliteOptions, type CreateRecordStoreOptions, type CspDirectiveName, type CspDirectives, type CspViolationReport, DATASET_EXECUTION_CAPABILITY_IDS, DATASET_EXECUTION_CONTRACT, DATASET_EXECUTION_SCHEMA_VERSION, DATASET_INGEST_CONTRACT, DATASET_INGEST_SCHEMA_VERSION, DATASET_LINEAGE_CONTRACT, DATASET_LINEAGE_SCHEMA_VERSION, DATASET_MATERIALIZATION_CONTRACT, DATASET_MATERIALIZATION_KINDS, DATASET_MATERIALIZATION_SCHEMA_VERSION, DB_SNAPSHOT_SCHEMA_VERSION, DEFAULT_LARGE_DOCUMENT_CHARS, DEFAULT_LARGE_DOCUMENT_CHUNKS, type DataBackend, type DatabaseClient, type DatasetBenchmarkEvidence, type DatasetCapabilityDeclaration, type DatasetCapabilityDegradation, type DatasetCapabilityDiagnostic, type DatasetCapabilityDiagnosticCode, type DatasetCapabilityEvidence, type DatasetCapabilityLimits, type DatasetCapabilityNegotiationRequest, type DatasetCapabilityNegotiationResult, type DatasetCapabilityRequirement, type DatasetCapabilityStatus, type DatasetCheckpoint, type DatasetDestinationScope, type DatasetDeterminismClass, type DatasetDigest, type DatasetExecutionCapabilityDescriptor, type DatasetExecutionCapabilityId, type DatasetExecutionDataClass, type DatasetExecutionMaturity, type DatasetExecutionPlane, type DatasetImplementationIdentity, type DatasetIncrementalParityResult, DatasetIngestError, type DatasetIngestErrorCode, DatasetIngestExecutor, type DatasetIngestHooks, type DatasetIngestMode, type DatasetIngestStore, type DatasetIngestTransaction, DatasetLineageLedger, type DatasetLineageLedgerOptions, type DatasetMaterializationAdapter, type DatasetMaterializationArtifact, DatasetMaterializationError, type DatasetMaterializationKind, type DatasetMaterializationOperation, type DatasetMaterializationProfile, type DatasetMaterializationReceipt, type DatasetMaterializationRequest, type DatasetMeasuredResources, type DatasetMutation, type DatasetMutationBatch, type DatasetOptionalCapabilityRequirement, type DatasetPrivacyBoundary, type DatasetPrivacyDecision, type DatasetProcessingPlan, type DatasetProfileNegotiationRequest, type DatasetProfileNegotiationResult, type DatasetProfileStatus, type DatasetRecordAuthorizer, type DatasetRecordRejection, type DatasetRetrievalRequest, type DatasetRetrievalResponse, type DatasetRunAttempt, type DatasetRunReceipt, type DatasetRunState, type DatasetRunStatus, type DatasetSourceRecord, type DatasetSourceSnapshot, type DatasetStoredRecord, type DatasetTombstoneMutation, type DatasetUpsertMutation, type DatasetVerificationState, type DbSnapshot, type DbSnapshotCompat, type DbSnapshotCompression, type DbSnapshotExpectations, type DbSnapshotMeta, type DbSnapshotSource, DbSnapshotVersionError, type DeletionReceipt, type DeletionReceiptRecord, type DiscoveredProvider, type DiscoveryOptions, type DumpDbSnapshotOptions, type DumpableDb, EMBED_REQUEST_KIND, EMBED_RESPONSE_KIND, type EmbedFunction, type EmbedFunctionOptions, 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 EmbeddingTaskSelectionOptions, type EnqueueJobInput, type ErrorCategory, type EventMap, type EvidenceLocator, type ExecuteDatasetBatchOptions, ExportOptions, FORTEMI_BROWSER_LOCAL_DATASET_EXECUTION_DESCRIPTOR, FORTEMI_COMPATIBILITY_PATH, FORTEMI_COMPATIBILITY_STATES, FORTEMI_PORTABLE_SHARD_DATASET_EXECUTION_DESCRIPTOR, FORTEMI_REQUIRED_COMPATIBILITY_CAPABILITIES, FORTEMI_SERVER_COMPATIBILITY_REVISION, FORTEMI_STATIC_CACHE_DATASET_EXECUTION_DESCRIPTOR, 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, type InferenceRuntimeConfig, type InferenceTask, JOB_CAPABILITIES, JOB_PRIORITIES, type JobQueueOptions, JobQueueWorker, type JobStatus, type JobType, type JournalEntry, LINEAGE_ENTITY_KINDS, LINEAGE_RELATIONSHIP_KINDS, LOCAL_ENDPOINTS, type LegacyInferenceProviderConfig, type LegacyMigrationReport, LifecyclePurgeRepository, type LineageActivity, type LineageAgent, type LineageAssertion, type LineageAssertionKind, type LineageAuthorizationPolicy, type LineageCorrection, type LineageEntity, type LineageEntityKind, type LineageEvidence, type LineageEvidenceReference, type LineageLedgerArchive, type LineageLossItem, type LineageLossReceipt, type LineagePrivacy, type LineageProjection, type LineageProjectionCapabilities, type LineageRelationshipKind, type LineageTraversalEdge, type LineageTraversalNode, type LineageTraversalRequest, type LineageTraversalResult, type LineageValidationCode, LineageValidationError, type LinkRecord0, type LinkRow, LinksRepository, type ListNotesInput, ListNotesInputSchema, type LlmCapabilityOptions, type LlmCompleteFn, type LlmCompleteOptions, 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, MemoryDatasetIngestStore, MemoryRecordStore, type MetadataPredicate, 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 NoteRevisionRecord, 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, type ProviderCostTier, type ProviderDataClass, type ProviderPrivacyTier, type ProviderProfile, ProviderRegistry, type ProviderRoutePolicy, type ProviderRouteProbeResult, type ProviderRouteRequirements, type ProviderRouteSelection, type ProviderRouteValidation, type ProviderRouteValidationIssue, type ProviderRouteValidationSeverity, type ProviderTier, type PurgeCounts, type PurgePreview, type PurgeSelector, type QueryExecutor, type QueryResult, RECORD_COLLECTIONS, RECORD_SCHEMA_VERSION, RECORD_STORE_CAPABILITIES, REGISTERED_METADATA_PATHS, type RecommendedTier, type RecordBackendManageNoteResult, type RecordBackendOptions, type RecordCollectionName, type RecordCollections, type RecordListOptions, type RecordMutation, type RecordProjectionResult, type RecordProvenanceInput, type RecordStore, type RecordStoreCapabilities, type RegisteredMetadataPath, type RemoteBackendConfig, type RemoteBackendPaths, type ResolvedEmbeddingRow, type ResolvedEmbeddingSet, type RestoreDbSnapshotOptions, type RouteHandler, SOURCE_UPSERT_CONTRACT_VERSION, SOURCE_UPSERT_MAX_ITEMS, 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 SourceIdentityInput, type SourceIdentityRecord, type SourceImportBatchRecord, type SourceImportRunRecord, type SourceUpsertBatchOutcome, type SourceUpsertBatchResult, type SourceUpsertItem, type SourceUpsertItemResult, type SourceUpsertOptions, type SourceUpsertOutcome, type SourceUpsertPolicy, type SourceUpsertReasonCode, SourceUpsertRepository, type SourceUpsertRequest, type SourceUpsertRequestItem, type SourceUpsertResponse, type SourceUpsertScope, 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, buildMetadataPredicateConditions, buildNoteConditions, buildPluginCsp, captureKnowledge, chunkText, classifyError, classifyModel, clearPrefetchedShard, collectionFromShard, collectionToShard, compareDatasetIncrementalParity, computeBlobHash, computeHash, computeLineageDigest, computeSri, conceptTaggingHandler, configureInferenceRuntime, cosineSimilarity, createBridgeInferenceProviders, createCosineSemanticProvider, createCspReportHandler, createFortemi, createLegacyProvider, createLocalProviderProfile, createPGliteBackend, createPGliteInstance, createRecordBackend, createRecordStore, createRemoteBackend, createRoutes, createShardBackend, createShardCapabilityReport, createWorkerEmbedFunction, datasetDestinationScopeKey, defaultStorageBackendFactory, defineInferenceProvider, defineInferenceRuntime, defineLegacyInferenceProvider, defineOpenAICompatibleProvider, deriveDatasetIngestIdempotencyKey, detectCommunities, detectGpuCapabilities, detectInferenceCapabilities, digestDatasetMaterializationValue, discoverLocalProviders, dropAttachmentProjection, dropNoteProjection, dumpDbSnapshot, embeddingConfigToShard, embeddingFromShard, embeddingGenerationHandler, embeddingSetFromShard, embeddingSetMemberToShard, embeddingSetToShard, embeddingToShard, enqueueFullWorkflow, enqueueJob, enqueueNoteCreationJobs, estimateModelFit, estimateVramMB, estimateVramTier, executeDatasetMaterialization, executeDatasetRetrieval, exportShard, exportShardFromRecords, exportShardFromRecordsWithReport, exportShardWithReport, fetchAndValidateFortemiCompatibility, fetchPluginScript, formatFortemiCompatibilitySummary, fortemiCompatibilityUrl, fortemiManifest, fromPrefetched, generateId, getConfiguredInferenceProviderId, getEmbedFunction, getEmbeddingTaskSelectionOptions, getFortemiBridge, getFortemiSecretStore, getJobQueueStatus, getKnowledgeShardContractReceipt, getKnowledgeShardProfileRegistry, getKnowledgeShardSchema, getLlmFunction, getNote, getPrefetchedSha256, getProviderRouteRequirementIssue, handleEmbedRequests, hasFortemiSecureSecrets, importShard, importShardToRecords, inferInferenceTaskCapability, inferLocalEmbeddingDimensions, isPluginScriptAllowed, isShardPrefetched, linkFromShard, linkToShard, linkingHandler, listNotes, manageArchive, manageAttachments, manageCapabilities, manageCollections, manageLinks, manageNote, manageTags, matchRoute, mergeInferenceRuntimeConfigs, migrateLegacyBlobStore, negotiateDatasetExecutionCapabilities, negotiateDatasetMaterializationProfile, noteFromShard, noteSkosTagToShard, noteToShard, openShard, packTarGz, parseCspReport, prefetchShard, previewRecordStorePurge, profileSupportError, projectAttachments, projectNotes, projectRecords, provenanceEdgeToShard, providerSatisfiesRouteRequirements, purgeRecordStoreGraph, registerLlmCapability, registerSemanticCapability, registerSemanticCapabilityWorker, registerServiceWorker, restoreDbSnapshot, searchTool, selectBackend, selectEmbeddingTask, selectLlmModel, setEmbedFunction, setEmbeddingTaskSelectionOptions, setLlmFunction, sha256Hex, skosConceptToShard, skosRelationToShard, skosSchemeToShard, suggestTags, tagsToShard, templateToShard, titleGenerationHandler, unpackTarGz, unregisterLlmCapability, unregisterSemanticCapability, upsertRecordStoreRequest, upsertRecordStoreSources, urlLinkToShard, validateChecksums, validateCoreV1ShardArchive, validateDatasetBenchmarkEvidence, validateDatasetExecutionDescriptor, validateFortemiCompatibilityResponse, validateFullV1ShardArchive, validateProviderRoute, validateRecordV1ShardArchive, validateShardArchive, validateShardComponentRecord, validateShardManifest, verifyDbSnapshotMeta, verifySri };