@fortemi/core 2026.7.14 → 2026.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -1
- package/dist/aiwg-index-schema.d.ts +0 -1
- package/dist/aiwg-index.d.ts +29 -30
- package/dist/index.d.ts +756 -579
- package/dist/index.js +1083 -43
- package/dist/index.js.map +1 -1
- package/package.json +7 -3
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ export { C as AIWG_SCAN_REQUIRED_FIELDS, D as AiwgChunkedIndexBuildOptions, F as
|
|
|
4
4
|
import { z, ZodType } from 'zod';
|
|
5
5
|
export { AiwgIndexSchemaValidationResult, getAiwgFortemiIndexExportSchema, validateAiwgFortemiIndexExportSchema, validateAiwgFortemiProjectedRecordSchema } from './aiwg-index-schema.js';
|
|
6
6
|
import '@bytecask/core';
|
|
7
|
-
|
|
8
7
|
/**
|
|
9
8
|
* Generate a RFC 9562 UUIDv7 identifier.
|
|
10
9
|
*
|
|
@@ -12,7 +11,6 @@ import '@bytecask/core';
|
|
|
12
11
|
* time-sortable and monotonic within the same millisecond.
|
|
13
12
|
*/
|
|
14
13
|
declare function generateId(): string;
|
|
15
|
-
|
|
16
14
|
/**
|
|
17
15
|
* Typed event bus with IDisposable subscriptions (Monaco-style).
|
|
18
16
|
* SSE-style pub/sub across all layers.
|
|
@@ -42,6 +40,14 @@ interface EventMap {
|
|
|
42
40
|
id: string;
|
|
43
41
|
revisionNumber: number;
|
|
44
42
|
};
|
|
43
|
+
'source.upserted': {
|
|
44
|
+
counts: Record<string, number>;
|
|
45
|
+
importRunId: string;
|
|
46
|
+
};
|
|
47
|
+
'purge.completed': {
|
|
48
|
+
counts: Record<string, number>;
|
|
49
|
+
receiptId: string;
|
|
50
|
+
};
|
|
45
51
|
'search.reindexed': Record<string, never>;
|
|
46
52
|
'embedding.ready': {
|
|
47
53
|
noteId: string;
|
|
@@ -57,11 +63,11 @@ interface EventMap {
|
|
|
57
63
|
progress?: number;
|
|
58
64
|
};
|
|
59
65
|
'capability.required': {
|
|
60
|
-
name: string;
|
|
61
66
|
jobId: string;
|
|
67
|
+
message: string;
|
|
68
|
+
name: string;
|
|
62
69
|
noteId: string;
|
|
63
70
|
type: string;
|
|
64
|
-
message: string;
|
|
65
71
|
};
|
|
66
72
|
'job.completed': {
|
|
67
73
|
id: string;
|
|
@@ -69,17 +75,17 @@ interface EventMap {
|
|
|
69
75
|
type: string;
|
|
70
76
|
};
|
|
71
77
|
'job.failed': {
|
|
78
|
+
error: string;
|
|
72
79
|
id: string;
|
|
73
80
|
noteId: string;
|
|
74
81
|
type: string;
|
|
75
|
-
error: string;
|
|
76
82
|
};
|
|
77
83
|
'job.blocked': {
|
|
84
|
+
capability: string;
|
|
78
85
|
id: string;
|
|
86
|
+
message: string;
|
|
79
87
|
noteId: string;
|
|
80
88
|
type: string;
|
|
81
|
-
capability: string;
|
|
82
|
-
message: string;
|
|
83
89
|
};
|
|
84
90
|
'archive.switched': {
|
|
85
91
|
name: string;
|
|
@@ -99,16 +105,16 @@ interface EventMap {
|
|
|
99
105
|
name: string;
|
|
100
106
|
};
|
|
101
107
|
'provider.fallback': {
|
|
108
|
+
error: string;
|
|
109
|
+
errorCategory: string;
|
|
102
110
|
fromProvider: string;
|
|
103
111
|
toProvider: string;
|
|
104
|
-
errorCategory: string;
|
|
105
|
-
error: string;
|
|
106
112
|
};
|
|
107
113
|
'provider.cooldown': {
|
|
108
|
-
providerId: string;
|
|
109
|
-
errorCategory: string;
|
|
110
114
|
cooldownMs: number;
|
|
115
|
+
errorCategory: string;
|
|
111
116
|
expiresAt: number;
|
|
117
|
+
providerId: string;
|
|
112
118
|
};
|
|
113
119
|
}
|
|
114
120
|
type EventHandler<T> = (payload: T) => void;
|
|
@@ -126,7 +132,6 @@ declare class TypedEventBus {
|
|
|
126
132
|
bridge(port: MessagePort): IDisposable;
|
|
127
133
|
removeAllListeners(): void;
|
|
128
134
|
}
|
|
129
|
-
|
|
130
135
|
/**
|
|
131
136
|
* PGlite database factory.
|
|
132
137
|
* Enforces PGlite 0.4.x conventions (explicit database: 'postgres').
|
|
@@ -138,8 +143,7 @@ declare class TypedEventBus {
|
|
|
138
143
|
* PGlite-backed store therefore do not pull the WASM engine into their bundle,
|
|
139
144
|
* and `@electric-sql/pglite` is an OPTIONAL dependency of `@fortemi/core`.
|
|
140
145
|
*/
|
|
141
|
-
|
|
142
|
-
type PersistenceMode = 'opfs' | 'idb' | 'memory';
|
|
146
|
+
type PersistenceMode = 'idb' | 'memory' | 'opfs';
|
|
143
147
|
interface CreatePGliteOptions {
|
|
144
148
|
/**
|
|
145
149
|
* Restore the instance from a physical data-dir snapshot (issue #187) — schema
|
|
@@ -150,7 +154,6 @@ interface CreatePGliteOptions {
|
|
|
150
154
|
loadDataDir?: Blob | File;
|
|
151
155
|
}
|
|
152
156
|
declare function createPGliteInstance(persistence: PersistenceMode, archiveName?: string, options?: CreatePGliteOptions): Promise<PGlite>;
|
|
153
|
-
|
|
154
157
|
/**
|
|
155
158
|
* Physical data-dir snapshot (issue #187).
|
|
156
159
|
*
|
|
@@ -171,7 +174,6 @@ declare function createPGliteInstance(persistence: PersistenceMode, archiveName?
|
|
|
171
174
|
* verifies compatibility BEFORE loading and fails fast (`DbSnapshotVersionError`) on
|
|
172
175
|
* mismatch, so a host can fall back to a shard import.
|
|
173
176
|
*/
|
|
174
|
-
|
|
175
177
|
/** Snapshot meta envelope schema. */
|
|
176
178
|
declare const DB_SNAPSHOT_SCHEMA_VERSION: "fortemi.db-snapshot.v1";
|
|
177
179
|
/**
|
|
@@ -182,13 +184,13 @@ declare const DB_SNAPSHOT_SCHEMA_VERSION: "fortemi.db-snapshot.v1";
|
|
|
182
184
|
declare const SUPPORTED_PGLITE_VERSION = "0.4.1";
|
|
183
185
|
/** Schema-migration head this build expects a restored snapshot to carry. */
|
|
184
186
|
declare const CURRENT_MIGRATION_HEAD: number;
|
|
185
|
-
type DbSnapshotCompression = '
|
|
187
|
+
type DbSnapshotCompression = 'auto' | 'gzip' | 'none';
|
|
186
188
|
interface DbSnapshotMeta {
|
|
187
189
|
schema_version: typeof DB_SNAPSHOT_SCHEMA_VERSION;
|
|
188
190
|
/** PGlite version the data dir was dumped from (data-dir format coupling). */
|
|
189
191
|
pglite_version: string;
|
|
190
192
|
/** pgvector extension version at dump time (advisory). */
|
|
191
|
-
pgvector_version:
|
|
193
|
+
pgvector_version: null | string;
|
|
192
194
|
/** Max applied migration version at dump time (schema coupling). */
|
|
193
195
|
migration_head: number;
|
|
194
196
|
/** ISO-8601 dump time. */
|
|
@@ -229,7 +231,7 @@ interface DbSnapshotExpectations {
|
|
|
229
231
|
migrationHead?: number;
|
|
230
232
|
pgliteVersion?: string;
|
|
231
233
|
/** When provided, a differing snapshot pgvector version is a warning, not a failure. */
|
|
232
|
-
pgvectorVersion?:
|
|
234
|
+
pgvectorVersion?: null | string;
|
|
233
235
|
}
|
|
234
236
|
interface DbSnapshotCompat {
|
|
235
237
|
compatible: boolean;
|
|
@@ -250,10 +252,10 @@ declare class DbSnapshotVersionError extends Error {
|
|
|
250
252
|
readonly meta: DbSnapshotMeta;
|
|
251
253
|
constructor(reasons: string[], meta: DbSnapshotMeta);
|
|
252
254
|
}
|
|
253
|
-
type DbSnapshotSource =
|
|
255
|
+
type DbSnapshotSource = {
|
|
254
256
|
dataUrl: string;
|
|
255
257
|
metaUrl?: string;
|
|
256
|
-
};
|
|
258
|
+
} | DbSnapshot | string;
|
|
257
259
|
interface RestoreDbSnapshotOptions {
|
|
258
260
|
/** Persistence for the restored instance. Defaults to 'memory' (read-only demos). */
|
|
259
261
|
persistence?: PersistenceMode;
|
|
@@ -270,7 +272,6 @@ interface RestoreDbSnapshotOptions {
|
|
|
270
272
|
* import). The returned instance is ready to query; do NOT run migrations on it.
|
|
271
273
|
*/
|
|
272
274
|
declare function restoreDbSnapshot(source: DbSnapshotSource, options?: RestoreDbSnapshotOptions): Promise<PGlite>;
|
|
273
|
-
|
|
274
275
|
/**
|
|
275
276
|
* Type-safe client for the PGlite Worker.
|
|
276
277
|
*
|
|
@@ -293,11 +294,11 @@ declare class PGliteWorkerClient {
|
|
|
293
294
|
waitReady(): Promise<void>;
|
|
294
295
|
private send;
|
|
295
296
|
query<T = Record<string, unknown>>(sql: string, params?: unknown[]): Promise<{
|
|
296
|
-
rows: T[];
|
|
297
297
|
fields?: Array<{
|
|
298
|
-
name: string;
|
|
299
298
|
dataTypeID: number;
|
|
299
|
+
name: string;
|
|
300
300
|
}>;
|
|
301
|
+
rows: T[];
|
|
301
302
|
}>;
|
|
302
303
|
exec(sql: string): Promise<void>;
|
|
303
304
|
transaction<T>(fn: (tx: TransactionProxy) => Promise<T>): Promise<T>;
|
|
@@ -320,12 +321,11 @@ declare class TransactionProxy {
|
|
|
320
321
|
}>;
|
|
321
322
|
exec(sql: string): Promise<void>;
|
|
322
323
|
}
|
|
323
|
-
|
|
324
324
|
interface QueryResult<T = Record<string, unknown>> {
|
|
325
325
|
rows: T[];
|
|
326
326
|
fields?: Array<{
|
|
327
|
-
name: string;
|
|
328
327
|
dataTypeID: number;
|
|
328
|
+
name: string;
|
|
329
329
|
}>;
|
|
330
330
|
}
|
|
331
331
|
interface QueryExecutor {
|
|
@@ -337,7 +337,7 @@ interface DatabaseClient extends QueryExecutor {
|
|
|
337
337
|
}
|
|
338
338
|
interface StorageBackend extends DatabaseClient {
|
|
339
339
|
readonly id: string;
|
|
340
|
-
readonly mode: '
|
|
340
|
+
readonly mode: 'readonly' | 'readwrite';
|
|
341
341
|
close(): Promise<void>;
|
|
342
342
|
}
|
|
343
343
|
interface StorageOpenRequest {
|
|
@@ -350,7 +350,7 @@ interface StorageBackendFactory {
|
|
|
350
350
|
interface StorageTopology {
|
|
351
351
|
primary: StorageBackend;
|
|
352
352
|
secondary?: StorageBackend;
|
|
353
|
-
policy: 'primary-only' | 'read-through-secondary'
|
|
353
|
+
policy: 'explicit-replication' | 'primary-only' | 'read-through-secondary';
|
|
354
354
|
}
|
|
355
355
|
declare class PGliteStorageBackend implements StorageBackend {
|
|
356
356
|
readonly id: string;
|
|
@@ -391,7 +391,6 @@ declare class PGliteWorkerStorageBackendFactory implements StorageBackendFactory
|
|
|
391
391
|
constructor(options: PGliteWorkerStorageBackendFactoryOptions);
|
|
392
392
|
open(input: StorageOpenRequest): Promise<StorageBackend>;
|
|
393
393
|
}
|
|
394
|
-
|
|
395
394
|
/**
|
|
396
395
|
* Field mapper — converts between browser schema and shard (server) schema.
|
|
397
396
|
*
|
|
@@ -403,22 +402,21 @@ declare class PGliteWorkerStorageBackendFactory implements StorageBackendFactory
|
|
|
403
402
|
* @created 2026-07-17
|
|
404
403
|
* @agent Codex
|
|
405
404
|
*/
|
|
406
|
-
|
|
407
405
|
/** Browser-format note row from the export query (denormalized). */
|
|
408
406
|
interface BrowserNoteExport {
|
|
409
407
|
id: string;
|
|
410
|
-
title:
|
|
408
|
+
title: null | string;
|
|
411
409
|
format: string;
|
|
412
410
|
source: string;
|
|
413
411
|
is_starred: boolean;
|
|
414
412
|
is_archived: boolean;
|
|
415
413
|
created_at: Date | string;
|
|
416
414
|
updated_at: Date | string;
|
|
417
|
-
deleted_at: Date |
|
|
415
|
+
deleted_at: Date | null | string;
|
|
418
416
|
original_content: string;
|
|
419
|
-
revised_content:
|
|
417
|
+
revised_content: null | string;
|
|
420
418
|
ai_metadata?: unknown;
|
|
421
|
-
collection_id?:
|
|
419
|
+
collection_id?: null | string;
|
|
422
420
|
attachments?: ShardAttachmentProjection[];
|
|
423
421
|
tags: string[];
|
|
424
422
|
}
|
|
@@ -428,201 +426,200 @@ declare function noteToShard(note: BrowserNoteExport): ShardNote;
|
|
|
428
426
|
declare function noteFromShard(shard: ShardNote): BrowserNoteExport;
|
|
429
427
|
/** Convert a browser link to shard format (accepts SQL rows or canonical ISO-string records). */
|
|
430
428
|
declare function linkToShard(link: {
|
|
429
|
+
confidence: null | number;
|
|
430
|
+
created_at: Date | string;
|
|
431
|
+
deleted_at?: Date | null | string;
|
|
431
432
|
id: string;
|
|
433
|
+
link_type: string;
|
|
432
434
|
source_note_id: string;
|
|
433
435
|
target_note_id: string;
|
|
434
|
-
|
|
435
|
-
confidence: number | null;
|
|
436
|
-
created_at: Date | string;
|
|
437
|
-
updated_at?: Date | string | null;
|
|
438
|
-
deleted_at?: Date | string | null;
|
|
436
|
+
updated_at?: Date | null | string;
|
|
439
437
|
}): ShardLink;
|
|
440
438
|
/** Convert a browser URL-target link row to shard format. */
|
|
441
439
|
declare function urlLinkToShard(link: {
|
|
440
|
+
confidence: null | number;
|
|
441
|
+
created_at: Date | string;
|
|
442
|
+
deleted_at?: Date | null | string;
|
|
442
443
|
id: string;
|
|
444
|
+
link_type: string;
|
|
445
|
+
metadata_json?: null | Record<string, unknown> | string;
|
|
443
446
|
source_note_id: string;
|
|
444
447
|
to_url: string;
|
|
445
|
-
|
|
446
|
-
confidence: number | null;
|
|
447
|
-
metadata_json?: Record<string, unknown> | string | null;
|
|
448
|
-
created_at: Date | string;
|
|
449
|
-
updated_at?: Date | string | null;
|
|
450
|
-
deleted_at?: Date | string | null;
|
|
448
|
+
updated_at?: Date | null | string;
|
|
451
449
|
}): ShardLink;
|
|
452
450
|
/** Convert a shard link back to browser-insertable format. */
|
|
453
451
|
declare function linkFromShard(shard: ShardLink): {
|
|
452
|
+
confidence: null | number;
|
|
453
|
+
created_at: string;
|
|
454
|
+
deleted_at: null | string;
|
|
454
455
|
id: string;
|
|
455
|
-
source_note_id: string;
|
|
456
|
-
target_note_id: string | null;
|
|
457
|
-
to_url: string | null;
|
|
458
456
|
link_type: string;
|
|
459
|
-
confidence: number | null;
|
|
460
|
-
created_at: string;
|
|
461
|
-
updated_at: string | null;
|
|
462
|
-
deleted_at: string | null;
|
|
463
457
|
metadata: unknown;
|
|
458
|
+
source_note_id: string;
|
|
459
|
+
target_note_id: null | string;
|
|
460
|
+
to_url: null | string;
|
|
461
|
+
updated_at: null | string;
|
|
464
462
|
};
|
|
465
463
|
/** Convert a browser collection to shard format (accepts SQL rows or canonical ISO-string records). */
|
|
466
464
|
declare function collectionToShard(collection: {
|
|
465
|
+
created_at: Date | string;
|
|
466
|
+
deleted_at?: Date | null | string;
|
|
467
|
+
description: null | string;
|
|
467
468
|
id: string;
|
|
468
469
|
name: string;
|
|
469
|
-
|
|
470
|
-
parent_id: string | null;
|
|
471
|
-
created_at: Date | string;
|
|
470
|
+
parent_id: null | string;
|
|
472
471
|
updated_at?: Date | string;
|
|
473
|
-
deleted_at?: Date | string | null;
|
|
474
472
|
}, noteCount?: number): ShardCollection;
|
|
475
473
|
/** Convert a shard collection back to browser-insertable format. */
|
|
476
474
|
declare function collectionFromShard(shard: ShardCollection): {
|
|
475
|
+
created_at: string;
|
|
476
|
+
deleted_at: null | string;
|
|
477
|
+
description: null | string;
|
|
477
478
|
id: string;
|
|
478
479
|
name: string;
|
|
479
|
-
|
|
480
|
-
parent_id: string | null;
|
|
481
|
-
created_at: string;
|
|
480
|
+
parent_id: null | string;
|
|
482
481
|
updated_at: string;
|
|
483
|
-
deleted_at: string | null;
|
|
484
482
|
};
|
|
485
483
|
/**
|
|
486
484
|
* Convert SKOS concepts + note_tag associations into shard flat tag format.
|
|
487
485
|
* Shard tags are simple string arrays — deduplicated across all notes.
|
|
488
486
|
*/
|
|
489
487
|
declare function tagsToShard(allTags: Array<{
|
|
490
|
-
name: string;
|
|
491
488
|
created_at: Date | string;
|
|
489
|
+
name: string;
|
|
492
490
|
}>): ShardTag[];
|
|
493
491
|
/** Convert a browser template row to shard format. */
|
|
494
492
|
declare function templateToShard(template: {
|
|
495
|
-
|
|
496
|
-
name: string;
|
|
497
|
-
description: string | null;
|
|
493
|
+
collection_id: null | string;
|
|
498
494
|
content: string;
|
|
499
|
-
format: string;
|
|
500
|
-
default_tags: string[] | string;
|
|
501
|
-
collection_id: string | null;
|
|
502
495
|
created_at: Date | string;
|
|
496
|
+
default_tags: string | string[];
|
|
497
|
+
description: null | string;
|
|
498
|
+
format: string;
|
|
499
|
+
id: string;
|
|
500
|
+
name: string;
|
|
503
501
|
updated_at: Date | string;
|
|
504
502
|
}): ShardTemplate;
|
|
505
503
|
/** Convert a browser embedding_set to shard format. */
|
|
506
504
|
declare function embeddingSetToShard(set: {
|
|
505
|
+
compatibility_json?: null | unknown;
|
|
506
|
+
created_at: Date | string;
|
|
507
|
+
criteria_json?: null | unknown;
|
|
508
|
+
description?: null | string;
|
|
509
|
+
dimensions: number;
|
|
510
|
+
document_count?: null | number;
|
|
511
|
+
embedding_count?: null | number;
|
|
512
|
+
freshness_json?: null | unknown;
|
|
507
513
|
id: string;
|
|
508
|
-
name?: string;
|
|
509
|
-
slug?: string | null;
|
|
510
|
-
description?: string | null;
|
|
511
|
-
purpose?: string | null;
|
|
512
|
-
document_count?: number | null;
|
|
513
|
-
embedding_count?: number | null;
|
|
514
514
|
is_system?: boolean | null;
|
|
515
|
-
keywords_json?:
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
kind?: 'physical' | 'filter' | 'virtual';
|
|
515
|
+
keywords_json?: null | unknown;
|
|
516
|
+
kind?: 'filter' | 'physical' | 'virtual';
|
|
517
|
+
materialization_json?: null | unknown;
|
|
519
518
|
mode?: 'auto' | 'manual' | 'mixed' | null;
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
created_at: Date | string;
|
|
519
|
+
model_name: string;
|
|
520
|
+
name?: string;
|
|
521
|
+
purpose?: null | string;
|
|
522
|
+
slug?: null | string;
|
|
523
|
+
source_json?: null | unknown;
|
|
524
|
+
truncate_dimension?: null | number;
|
|
527
525
|
updated_at?: Date | string;
|
|
528
526
|
}): ShardEmbeddingSet;
|
|
529
527
|
/** Convert a shard embedding set back to browser format. */
|
|
530
528
|
declare function embeddingSetFromShard(shard: ShardEmbeddingSet, fallbackCreatedAt: string): {
|
|
529
|
+
compatibility_json: null | string;
|
|
530
|
+
created_at: string;
|
|
531
|
+
criteria_json: null | string;
|
|
532
|
+
description: null | string;
|
|
533
|
+
dimensions: number;
|
|
534
|
+
document_count: null | number;
|
|
535
|
+
embedding_count: null | number;
|
|
536
|
+
freshness_json: null | string;
|
|
531
537
|
id: string;
|
|
532
|
-
name: string;
|
|
533
|
-
slug: string | null;
|
|
534
|
-
description: string | null;
|
|
535
|
-
purpose: string | null;
|
|
536
|
-
document_count: number | null;
|
|
537
|
-
embedding_count: number | null;
|
|
538
538
|
is_system: boolean;
|
|
539
|
-
keywords_json:
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
kind: 'physical' | 'filter' | 'virtual';
|
|
539
|
+
keywords_json: null | string;
|
|
540
|
+
kind: 'filter' | 'physical' | 'virtual';
|
|
541
|
+
materialization_json: null | string;
|
|
543
542
|
mode: 'auto' | 'manual' | 'mixed' | null;
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
updated_at: string | null;
|
|
543
|
+
model_name: string;
|
|
544
|
+
name: string;
|
|
545
|
+
purpose: null | string;
|
|
546
|
+
slug: null | string;
|
|
547
|
+
source_json: null | string;
|
|
548
|
+
truncate_dimension: null | number;
|
|
549
|
+
updated_at: null | string;
|
|
552
550
|
};
|
|
553
551
|
/** Convert a browser embedding_set_member to shard format. */
|
|
554
552
|
declare function embeddingSetMemberToShard(member: {
|
|
553
|
+
added_at?: Date | null | string;
|
|
554
|
+
added_by?: null | string;
|
|
555
555
|
embedding_set_id: string;
|
|
556
|
+
membership_type?: null | string;
|
|
556
557
|
note_id: string;
|
|
557
|
-
membership_type?: string | null;
|
|
558
|
-
added_at?: Date | string | null;
|
|
559
|
-
added_by?: string | null;
|
|
560
558
|
}): ShardEmbeddingSetMember;
|
|
561
559
|
/** Convert a browser embedding_config row to shard format. */
|
|
562
560
|
declare function embeddingConfigToShard(config: ShardEmbeddingConfig): ShardEmbeddingConfig;
|
|
563
561
|
/** Convert a browser embedding to shard format. */
|
|
564
562
|
declare function embeddingToShard(emb: {
|
|
563
|
+
chunk_index?: null | number;
|
|
564
|
+
created_at: Date | string;
|
|
565
|
+
embedding_set_id: string;
|
|
565
566
|
id: string;
|
|
567
|
+
model_name?: null | string;
|
|
568
|
+
model?: null | string;
|
|
566
569
|
note_id: string;
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
text?: string | null;
|
|
570
|
-
vector: string | number[];
|
|
571
|
-
model?: string | null;
|
|
572
|
-
model_name?: string | null;
|
|
573
|
-
created_at: Date | string;
|
|
570
|
+
text?: null | string;
|
|
571
|
+
vector: number[] | string;
|
|
574
572
|
}): ShardEmbedding;
|
|
575
573
|
/** Convert a shard embedding back to browser format. */
|
|
576
574
|
declare function embeddingFromShard(shard: ShardEmbedding): {
|
|
575
|
+
chunk_index: number;
|
|
576
|
+
created_at: null | string;
|
|
577
|
+
embedding_set_id: null | string;
|
|
577
578
|
id: string;
|
|
579
|
+
model: null | string;
|
|
578
580
|
note_id: string;
|
|
579
|
-
embedding_set_id: string | null;
|
|
580
|
-
chunk_index: number;
|
|
581
581
|
text: string;
|
|
582
582
|
vector: string;
|
|
583
|
-
model: string | null;
|
|
584
|
-
created_at: string | null;
|
|
585
583
|
};
|
|
586
584
|
declare function skosSchemeToShard(scheme: {
|
|
585
|
+
created_at: Date | string;
|
|
586
|
+
description: null | string;
|
|
587
587
|
id: string;
|
|
588
588
|
title: string;
|
|
589
|
-
description: string | null;
|
|
590
|
-
created_at: Date | string;
|
|
591
589
|
updated_at: Date | string;
|
|
592
590
|
}): ShardSkosScheme;
|
|
593
591
|
declare function skosConceptToShard(concept: {
|
|
592
|
+
alt_labels: null | string | string[];
|
|
593
|
+
created_at: Date | string;
|
|
594
|
+
definition: null | string;
|
|
594
595
|
id: string;
|
|
595
|
-
scheme_id: string;
|
|
596
596
|
pref_label: string;
|
|
597
|
-
|
|
598
|
-
definition: string | null;
|
|
599
|
-
created_at: Date | string;
|
|
597
|
+
scheme_id: string;
|
|
600
598
|
updated_at: Date | string;
|
|
601
599
|
}): ShardSkosConcept;
|
|
602
600
|
declare function skosRelationToShard(relation: {
|
|
601
|
+
created_at: Date | string;
|
|
603
602
|
id: string;
|
|
603
|
+
relation_type: 'broader' | 'narrower' | 'related';
|
|
604
604
|
source_concept_id: string;
|
|
605
605
|
target_concept_id: string;
|
|
606
|
-
relation_type: 'broader' | 'narrower' | 'related';
|
|
607
|
-
created_at: Date | string;
|
|
608
606
|
}): ShardSkosRelation;
|
|
609
607
|
declare function noteSkosTagToShard(tag: {
|
|
610
|
-
id: string;
|
|
611
|
-
note_id: string;
|
|
612
608
|
concept_id: string;
|
|
613
609
|
created_at: Date | string;
|
|
610
|
+
id: string;
|
|
611
|
+
note_id: string;
|
|
614
612
|
}): ShardNoteSkosTag;
|
|
615
613
|
declare function provenanceEdgeToShard(edge: {
|
|
616
|
-
id: string;
|
|
617
|
-
entity_type: string;
|
|
618
|
-
entity_id: string;
|
|
619
614
|
activity: string;
|
|
620
615
|
agent: string;
|
|
616
|
+
attributes: null | Record<string, unknown> | string;
|
|
617
|
+
ended_at: Date | null | string;
|
|
618
|
+
entity_id: string;
|
|
619
|
+
entity_type: string;
|
|
620
|
+
id: string;
|
|
621
621
|
started_at: Date | string;
|
|
622
|
-
ended_at: Date | string | null;
|
|
623
|
-
attributes: Record<string, unknown> | string | null;
|
|
624
622
|
}): ShardProvenanceEdge;
|
|
625
|
-
|
|
626
623
|
/**
|
|
627
624
|
* In-place Knowledge Shard reader (issue #189) — the static-file backend.
|
|
628
625
|
*
|
|
@@ -636,7 +633,6 @@ declare function provenanceEdgeToShard(edge: {
|
|
|
636
633
|
* links/tags/concepts + full record. Semantic is opt-in via a pluggable provider
|
|
637
634
|
* (none / brute-force cosine / prebuilt ANN snapshot) — see `StaticSemanticProvider`.
|
|
638
635
|
*/
|
|
639
|
-
|
|
640
636
|
/** The public note shape — the same browser-insertable record `importShard` produces. */
|
|
641
637
|
type ShardReaderNote = BrowserNoteExport;
|
|
642
638
|
interface ShardSearchWeights {
|
|
@@ -671,8 +667,8 @@ interface ShardSearchResult {
|
|
|
671
667
|
items: ShardReaderNote[];
|
|
672
668
|
total: number;
|
|
673
669
|
facets: {
|
|
674
|
-
tags: Record<string, number>;
|
|
675
670
|
source: Record<string, number>;
|
|
671
|
+
tags: Record<string, number>;
|
|
676
672
|
};
|
|
677
673
|
rankedItems?: ShardSearchRankedNote[];
|
|
678
674
|
/** Cluster files fetched to serve this query (0 when served from cache). */
|
|
@@ -713,23 +709,23 @@ interface ShardComponentStore {
|
|
|
713
709
|
readonly manifest: ShardManifest;
|
|
714
710
|
read(filename: string): Promise<Uint8Array | undefined>;
|
|
715
711
|
}
|
|
716
|
-
type ShardReaderSource =
|
|
712
|
+
type ShardReaderSource = {
|
|
717
713
|
baseUrl: string;
|
|
718
714
|
fetchImpl?: typeof fetch;
|
|
719
|
-
};
|
|
715
|
+
} | Blob | Uint8Array;
|
|
720
716
|
interface ShardReader {
|
|
721
717
|
readonly manifest: ShardManifest;
|
|
722
718
|
listNotes(options?: ShardListOptions): Promise<{
|
|
723
719
|
items: ShardReaderNote[];
|
|
724
720
|
total: number;
|
|
725
721
|
}>;
|
|
726
|
-
getNote(id: string): Promise<
|
|
722
|
+
getNote(id: string): Promise<null | ShardReaderNote>;
|
|
727
723
|
search(query: string, options?: ShardSearchOptions): Promise<ShardSearchResult>;
|
|
728
724
|
linksOf(id: string): Promise<ShardLink[]>;
|
|
729
725
|
conceptsOf(id: string): Promise<ShardSkosConcept[]>;
|
|
730
726
|
relationsOf(conceptId: string): Promise<ShardSkosRelation[]>;
|
|
731
727
|
provenanceOf(id: string): Promise<ShardProvenanceEdge[]>;
|
|
732
|
-
getNoteFull(id: string): Promise<
|
|
728
|
+
getNoteFull(id: string): Promise<null | ShardNoteFull>;
|
|
733
729
|
semantic(query: string, k?: number): Promise<Array<{
|
|
734
730
|
note: ShardReaderNote;
|
|
735
731
|
score: number;
|
|
@@ -743,7 +739,6 @@ interface ShardReader {
|
|
|
743
739
|
* reader than this build throws (the host should fall back to `importShard`).
|
|
744
740
|
*/
|
|
745
741
|
declare function openShard(source: ShardReaderSource, options?: OpenShardOptions): Promise<ShardReader>;
|
|
746
|
-
|
|
747
742
|
/**
|
|
748
743
|
* Backend seam (#191) — a uniform tool-intent operation interface that lets the
|
|
749
744
|
* PGlite database backend (#187) and the static-file shard backend (#189) be
|
|
@@ -756,7 +751,6 @@ declare function openShard(source: ShardReaderSource, options?: OpenShardOptions
|
|
|
756
751
|
* regardless of whether the data lives in a queryable PGlite instance, a set of
|
|
757
752
|
* static shard files fetched over HTTP, or the Fortemi server tier.
|
|
758
753
|
*/
|
|
759
|
-
|
|
760
754
|
/**
|
|
761
755
|
* Semantic-search tier a backend offers, in increasing capability:
|
|
762
756
|
* - `none` — no vector search (text / facets only)
|
|
@@ -765,9 +759,9 @@ declare function openShard(source: ShardReaderSource, options?: OpenShardOptions
|
|
|
765
759
|
* corpus (PGlite + pgvector, or a prebuilt ANN snapshot)
|
|
766
760
|
* - `server` — delegated to the remote Fortemi server backend
|
|
767
761
|
*/
|
|
768
|
-
type BackendSemanticTier = '
|
|
762
|
+
type BackendSemanticTier = 'ann-full' | 'cosine-small' | 'none' | 'server';
|
|
769
763
|
/** Relative startup cost of bringing a backend online. */
|
|
770
|
-
type BackendStartupCost = '
|
|
764
|
+
type BackendStartupCost = 'index-build' | 'instant' | 'network';
|
|
771
765
|
/** What a backend can do — the unit of capability negotiation. */
|
|
772
766
|
interface BackendCapabilities {
|
|
773
767
|
/** Can answer list / get / search read operations. */
|
|
@@ -790,7 +784,7 @@ interface BackendCapabilities {
|
|
|
790
784
|
*/
|
|
791
785
|
interface BackendNote {
|
|
792
786
|
id: string;
|
|
793
|
-
title:
|
|
787
|
+
title: null | string;
|
|
794
788
|
tags: string[];
|
|
795
789
|
createdAt: string;
|
|
796
790
|
updatedAt: string;
|
|
@@ -808,10 +802,10 @@ interface BackendNoteFull extends BackendNote {
|
|
|
808
802
|
interface BackendLink {
|
|
809
803
|
id: string;
|
|
810
804
|
fromNoteId: string;
|
|
811
|
-
toNoteId:
|
|
812
|
-
toUrl?:
|
|
805
|
+
toNoteId: null | string;
|
|
806
|
+
toUrl?: null | string;
|
|
813
807
|
kind: string;
|
|
814
|
-
score:
|
|
808
|
+
score: null | number;
|
|
815
809
|
createdAt: string;
|
|
816
810
|
metadata?: Record<string, unknown>;
|
|
817
811
|
}
|
|
@@ -820,7 +814,7 @@ interface BackendConcept {
|
|
|
820
814
|
schemeId: string;
|
|
821
815
|
prefLabel: string;
|
|
822
816
|
altLabels: string[];
|
|
823
|
-
definition:
|
|
817
|
+
definition: null | string;
|
|
824
818
|
createdAt: string;
|
|
825
819
|
updatedAt: string;
|
|
826
820
|
}
|
|
@@ -831,8 +825,8 @@ interface BackendProvenanceEdge {
|
|
|
831
825
|
activity: string;
|
|
832
826
|
agent: string;
|
|
833
827
|
startedAt: string;
|
|
834
|
-
endedAt:
|
|
835
|
-
attributes: Record<string, unknown
|
|
828
|
+
endedAt: null | string;
|
|
829
|
+
attributes: null | Record<string, unknown>;
|
|
836
830
|
}
|
|
837
831
|
/** One search hit — note plus optional rank/snippet when the backend ranks. */
|
|
838
832
|
interface BackendSearchHit {
|
|
@@ -845,8 +839,8 @@ interface BackendSearchResult {
|
|
|
845
839
|
hits: BackendSearchHit[];
|
|
846
840
|
total: number;
|
|
847
841
|
facets?: {
|
|
848
|
-
tags: Record<string, number>;
|
|
849
842
|
source?: Record<string, number>;
|
|
843
|
+
tags: Record<string, number>;
|
|
850
844
|
};
|
|
851
845
|
}
|
|
852
846
|
interface BackendListOptions {
|
|
@@ -941,7 +935,7 @@ interface RemoteBackendConfig {
|
|
|
941
935
|
baseUrl: string;
|
|
942
936
|
id?: string;
|
|
943
937
|
fetchImpl?: typeof fetch;
|
|
944
|
-
headers?:
|
|
938
|
+
headers?: (() => HeadersInit | Promise<HeadersInit>) | HeadersInit;
|
|
945
939
|
authToken?: string;
|
|
946
940
|
paths?: Partial<RemoteBackendPaths>;
|
|
947
941
|
}
|
|
@@ -958,7 +952,6 @@ interface ShardBackendOptions {
|
|
|
958
952
|
* provider is attached.
|
|
959
953
|
*/
|
|
960
954
|
declare function createShardBackend(reader: ShardReader, options?: ShardBackendOptions): DataBackend;
|
|
961
|
-
|
|
962
955
|
/**
|
|
963
956
|
* Capability module system (ADR-002).
|
|
964
957
|
* Tracks opt-in WASM module states. No WASM loaded by default (CAP-001).
|
|
@@ -971,9 +964,8 @@ declare function createShardBackend(reader: ShardReader, options?: ShardBackendO
|
|
|
971
964
|
* disabled -> loading (via enable, re-enable)
|
|
972
965
|
* error -> loading (via enable, retry)
|
|
973
966
|
*/
|
|
974
|
-
|
|
975
|
-
type
|
|
976
|
-
type CapabilityName = 'semantic' | 'llm' | 'audio' | 'vision' | 'pdf';
|
|
967
|
+
type CapabilityState = 'disabled' | 'error' | 'loading' | 'ready' | 'unloaded';
|
|
968
|
+
type CapabilityName = 'audio' | 'llm' | 'pdf' | 'semantic' | 'vision';
|
|
977
969
|
declare class CapabilityManager {
|
|
978
970
|
private events;
|
|
979
971
|
private capabilities;
|
|
@@ -1026,13 +1018,11 @@ declare class CapabilityManager {
|
|
|
1026
1018
|
state: CapabilityState;
|
|
1027
1019
|
}>;
|
|
1028
1020
|
}
|
|
1029
|
-
|
|
1030
1021
|
/**
|
|
1031
1022
|
* Sequential SQL migration runner for DatabaseClient.
|
|
1032
1023
|
* Tracks applied migrations in a schema_version table.
|
|
1033
1024
|
* Each migration runs in a transaction; version updated atomically.
|
|
1034
1025
|
*/
|
|
1035
|
-
|
|
1036
1026
|
interface Migration {
|
|
1037
1027
|
version: number;
|
|
1038
1028
|
name: string;
|
|
@@ -1046,19 +1036,16 @@ declare class MigrationRunner {
|
|
|
1046
1036
|
getCurrentVersion(): Promise<number>;
|
|
1047
1037
|
apply(migrations: Migration[]): Promise<number>;
|
|
1048
1038
|
getAppliedMigrations(): Promise<Array<{
|
|
1049
|
-
version: number;
|
|
1050
1039
|
name: string;
|
|
1040
|
+
version: number;
|
|
1051
1041
|
}>>;
|
|
1052
1042
|
}
|
|
1053
|
-
|
|
1054
1043
|
declare const allMigrations: Migration[];
|
|
1055
|
-
|
|
1056
1044
|
/**
|
|
1057
1045
|
* Multi-archive manager for Fortemi.
|
|
1058
1046
|
* Each archive is a separate PGlite instance with its own persistence path.
|
|
1059
1047
|
* Migrations are applied automatically on open.
|
|
1060
1048
|
*/
|
|
1061
|
-
|
|
1062
1049
|
interface ArchiveInfo {
|
|
1063
1050
|
name: string;
|
|
1064
1051
|
createdAt: string;
|
|
@@ -1086,7 +1073,7 @@ declare class ArchiveManager {
|
|
|
1086
1073
|
*/
|
|
1087
1074
|
constructor(persistenceOrFactory: PersistenceMode | StorageBackendFactory, events?: TypedEventBus | undefined, persistenceOverride?: PersistenceMode);
|
|
1088
1075
|
getCurrentArchiveName(): string;
|
|
1089
|
-
getDb():
|
|
1076
|
+
getDb(): null | StorageBackend;
|
|
1090
1077
|
open(archiveName?: string): Promise<StorageBackend>;
|
|
1091
1078
|
/**
|
|
1092
1079
|
* Adopt an already-created backend WITHOUT running migrations — for a backend
|
|
@@ -1101,14 +1088,12 @@ declare class ArchiveManager {
|
|
|
1101
1088
|
listArchives(): ArchiveInfo[];
|
|
1102
1089
|
close(): Promise<void>;
|
|
1103
1090
|
}
|
|
1104
|
-
|
|
1105
1091
|
/**
|
|
1106
1092
|
* Factory function for creating a FortemiCore instance.
|
|
1107
1093
|
* All deployment modes use this entry point.
|
|
1108
1094
|
*/
|
|
1109
|
-
|
|
1110
1095
|
interface FortemiConfig {
|
|
1111
|
-
persistence: '
|
|
1096
|
+
persistence: 'idb' | 'memory' | 'opfs';
|
|
1112
1097
|
archiveName?: string;
|
|
1113
1098
|
}
|
|
1114
1099
|
interface FortemiCore {
|
|
@@ -1117,7 +1102,6 @@ interface FortemiCore {
|
|
|
1117
1102
|
destroy(): void;
|
|
1118
1103
|
}
|
|
1119
1104
|
declare function createFortemi(config: FortemiConfig): FortemiCore;
|
|
1120
|
-
|
|
1121
1105
|
/**
|
|
1122
1106
|
* Compute a browser-local content-identity hash (SHA-256), encoded as
|
|
1123
1107
|
* `sha256:<64-char lowercase hex>`.
|
|
@@ -1147,11 +1131,29 @@ declare function computeHash(data: Uint8Array): string;
|
|
|
1147
1131
|
* @returns `'blake3:<64-char lowercase hex>'`
|
|
1148
1132
|
*/
|
|
1149
1133
|
declare function computeBlobHash(data: Uint8Array): string;
|
|
1150
|
-
|
|
1151
1134
|
declare const FORTEMI_COMPATIBILITY_PATH = "/api/v1/system/compatibility";
|
|
1152
|
-
declare const
|
|
1135
|
+
declare const FORTEMI_SERVER_COMPATIBILITY_REVISION = "2026-07-06";
|
|
1136
|
+
declare const FORTEMI_COMPATIBILITY_STATES: readonly [
|
|
1137
|
+
"available",
|
|
1138
|
+
"degraded",
|
|
1139
|
+
"preview",
|
|
1140
|
+
"unavailable",
|
|
1141
|
+
"unknown"
|
|
1142
|
+
];
|
|
1153
1143
|
type FortemiCompatibilityState = (typeof FORTEMI_COMPATIBILITY_STATES)[number];
|
|
1154
|
-
declare const FORTEMI_REQUIRED_COMPATIBILITY_CAPABILITIES: readonly [
|
|
1144
|
+
declare const FORTEMI_REQUIRED_COMPATIBILITY_CAPABILITIES: readonly [
|
|
1145
|
+
"core_notes",
|
|
1146
|
+
"search",
|
|
1147
|
+
"jobs",
|
|
1148
|
+
"realtime_activity",
|
|
1149
|
+
"hosted_auth",
|
|
1150
|
+
"premium_components",
|
|
1151
|
+
"backoffice_api",
|
|
1152
|
+
"audit_posture",
|
|
1153
|
+
"quota_status",
|
|
1154
|
+
"kms_status",
|
|
1155
|
+
"mcp_scope_gate"
|
|
1156
|
+
];
|
|
1155
1157
|
type FortemiRequiredCompatibilityCapability = (typeof FORTEMI_REQUIRED_COMPATIBILITY_CAPABILITIES)[number];
|
|
1156
1158
|
interface FortemiCompatibilityCapability {
|
|
1157
1159
|
state: FortemiCompatibilityState;
|
|
@@ -1161,28 +1163,28 @@ interface FortemiCompatibilityResponse {
|
|
|
1161
1163
|
schema_version: number;
|
|
1162
1164
|
contract_revision: string;
|
|
1163
1165
|
api: {
|
|
1166
|
+
build_date_present: boolean;
|
|
1167
|
+
git_sha_present: boolean;
|
|
1168
|
+
minimum_hotm_enterprise_client: string;
|
|
1164
1169
|
name: string;
|
|
1165
1170
|
version: string;
|
|
1166
|
-
minimum_hotm_enterprise_client: string;
|
|
1167
|
-
git_sha_present: boolean;
|
|
1168
|
-
build_date_present: boolean;
|
|
1169
1171
|
};
|
|
1170
1172
|
deployment: {
|
|
1171
|
-
mode: string;
|
|
1172
1173
|
edition: string;
|
|
1173
1174
|
hosted_multi_tenant_ready: boolean;
|
|
1175
|
+
mode: string;
|
|
1174
1176
|
};
|
|
1175
1177
|
auth: {
|
|
1176
|
-
required: boolean;
|
|
1177
1178
|
mode: string;
|
|
1178
1179
|
oauth_issuer_configured: boolean;
|
|
1180
|
+
required: boolean;
|
|
1179
1181
|
tenant_context_available: boolean;
|
|
1180
1182
|
};
|
|
1181
1183
|
capabilities: Record<string, FortemiCompatibilityCapability>;
|
|
1182
1184
|
links: {
|
|
1183
|
-
openapi: string;
|
|
1184
1185
|
asyncapi: string;
|
|
1185
1186
|
health: string;
|
|
1187
|
+
openapi: string;
|
|
1186
1188
|
streaming_health: string;
|
|
1187
1189
|
};
|
|
1188
1190
|
}
|
|
@@ -1201,17 +1203,15 @@ declare function fortemiCompatibilityUrl(baseUrl?: string): string;
|
|
|
1201
1203
|
declare function validateFortemiCompatibilityResponse(raw: unknown): FortemiCompatibilityValidationResult;
|
|
1202
1204
|
declare function formatFortemiCompatibilitySummary(response: FortemiCompatibilityResponse): string;
|
|
1203
1205
|
declare function fetchAndValidateFortemiCompatibility(options?: FetchFortemiCompatibilityOptions): Promise<FortemiCompatibilityValidationResult & {
|
|
1204
|
-
url: string;
|
|
1205
1206
|
status?: number;
|
|
1207
|
+
url: string;
|
|
1206
1208
|
}>;
|
|
1207
|
-
|
|
1208
1209
|
interface SWRegistrationResult {
|
|
1209
1210
|
registered: boolean;
|
|
1210
1211
|
registration?: ServiceWorkerRegistration;
|
|
1211
1212
|
error?: string;
|
|
1212
1213
|
}
|
|
1213
1214
|
declare function registerServiceWorker(swUrl?: string): Promise<SWRegistrationResult>;
|
|
1214
|
-
|
|
1215
1215
|
/**
|
|
1216
1216
|
* REST route definitions for Service Worker.
|
|
1217
1217
|
* These are pure functions that transform HTTP Request → tool input and tool output → Response.
|
|
@@ -1235,8 +1235,7 @@ declare function createRoutes(): RouteHandler[];
|
|
|
1235
1235
|
* Match a request against the registered routes and return the first matching
|
|
1236
1236
|
* handler, or null if no route matches.
|
|
1237
1237
|
*/
|
|
1238
|
-
declare function matchRoute(routes: RouteHandler[], request: Request, url: URL):
|
|
1239
|
-
|
|
1238
|
+
declare function matchRoute(routes: RouteHandler[], request: Request, url: URL): null | RouteHandler;
|
|
1240
1239
|
/**
|
|
1241
1240
|
* One-shot migration of the pre-bytecask blob layout into the new store.
|
|
1242
1241
|
*
|
|
@@ -1251,7 +1250,6 @@ declare function matchRoute(routes: RouteHandler[], request: Request, url: URL):
|
|
|
1251
1250
|
* (ADR-012 D3). The legacy source is deleted only after every entry migrated
|
|
1252
1251
|
* without error; any failure leaves it untouched for the next attempt.
|
|
1253
1252
|
*/
|
|
1254
|
-
|
|
1255
1253
|
/** Outcome of one migration attempt (for diagnostics/logging). */
|
|
1256
1254
|
interface LegacyMigrationReport {
|
|
1257
1255
|
migrated: number;
|
|
@@ -1264,7 +1262,6 @@ interface LegacyMigrationReport {
|
|
|
1264
1262
|
* and the new store keeps whatever was already re-put (idempotent on retry).
|
|
1265
1263
|
*/
|
|
1266
1264
|
declare function migrateLegacyBlobStore(archiveName: string, target: BlobStore, indexedDbFactory?: IDBFactory): Promise<LegacyMigrationReport>;
|
|
1267
|
-
|
|
1268
1265
|
/**
|
|
1269
1266
|
* Shared postMessage protocol types for the PGlite worker.
|
|
1270
1267
|
*
|
|
@@ -1279,36 +1276,36 @@ declare function migrateLegacyBlobStore(archiveName: string, target: BlobStore,
|
|
|
1279
1276
|
/** Messages from client to worker */
|
|
1280
1277
|
type WorkerRequest = {
|
|
1281
1278
|
id: string;
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
params?: unknown[];
|
|
1279
|
+
isolationLevel?: string;
|
|
1280
|
+
type: 'BEGIN';
|
|
1285
1281
|
} | {
|
|
1286
1282
|
id: string;
|
|
1287
|
-
|
|
1283
|
+
params?: unknown[];
|
|
1288
1284
|
sql: string;
|
|
1285
|
+
txId: string;
|
|
1286
|
+
type: 'TX_QUERY';
|
|
1289
1287
|
} | {
|
|
1290
1288
|
id: string;
|
|
1291
|
-
|
|
1292
|
-
|
|
1289
|
+
params?: unknown[];
|
|
1290
|
+
sql: string;
|
|
1291
|
+
type: 'QUERY';
|
|
1293
1292
|
} | {
|
|
1294
1293
|
id: string;
|
|
1295
|
-
|
|
1294
|
+
sql: string;
|
|
1296
1295
|
txId: string;
|
|
1296
|
+
type: 'TX_EXEC';
|
|
1297
1297
|
} | {
|
|
1298
1298
|
id: string;
|
|
1299
|
-
|
|
1300
|
-
|
|
1299
|
+
sql: string;
|
|
1300
|
+
type: 'EXEC';
|
|
1301
1301
|
} | {
|
|
1302
1302
|
id: string;
|
|
1303
|
-
type: 'TX_QUERY';
|
|
1304
1303
|
txId: string;
|
|
1305
|
-
|
|
1306
|
-
params?: unknown[];
|
|
1304
|
+
type: 'COMMIT';
|
|
1307
1305
|
} | {
|
|
1308
1306
|
id: string;
|
|
1309
|
-
type: 'TX_EXEC';
|
|
1310
1307
|
txId: string;
|
|
1311
|
-
|
|
1308
|
+
type: 'ROLLBACK';
|
|
1312
1309
|
} | {
|
|
1313
1310
|
id: string;
|
|
1314
1311
|
type: 'CLOSE';
|
|
@@ -1318,40 +1315,38 @@ type WorkerRequest = {
|
|
|
1318
1315
|
};
|
|
1319
1316
|
/** Messages from worker to client */
|
|
1320
1317
|
type WorkerResponse = {
|
|
1318
|
+
affectedRows?: number;
|
|
1321
1319
|
id: string;
|
|
1322
|
-
type: '
|
|
1323
|
-
|
|
1320
|
+
type: 'EXEC_DONE';
|
|
1321
|
+
} | {
|
|
1322
|
+
error: string;
|
|
1323
|
+
id: string;
|
|
1324
|
+
type: 'ERROR';
|
|
1325
|
+
} | {
|
|
1324
1326
|
fields?: Array<{
|
|
1325
|
-
name: string;
|
|
1326
1327
|
dataTypeID: number;
|
|
1328
|
+
name: string;
|
|
1327
1329
|
}>;
|
|
1328
|
-
} | {
|
|
1329
1330
|
id: string;
|
|
1330
|
-
|
|
1331
|
-
|
|
1331
|
+
rows: unknown[];
|
|
1332
|
+
type: 'RESULT';
|
|
1332
1333
|
} | {
|
|
1333
1334
|
id: string;
|
|
1334
|
-
type: 'TX_STARTED';
|
|
1335
1335
|
txId: string;
|
|
1336
|
+
type: 'TX_STARTED';
|
|
1336
1337
|
} | {
|
|
1337
1338
|
id: string;
|
|
1338
|
-
type: '
|
|
1339
|
-
} | {
|
|
1340
|
-
id: string;
|
|
1341
|
-
type: 'ERROR';
|
|
1342
|
-
error: string;
|
|
1339
|
+
type: 'PONG';
|
|
1343
1340
|
} | {
|
|
1344
1341
|
id: string;
|
|
1345
|
-
type: '
|
|
1342
|
+
type: 'TX_DONE';
|
|
1346
1343
|
} | {
|
|
1347
1344
|
type: 'READY';
|
|
1348
1345
|
};
|
|
1349
|
-
|
|
1350
1346
|
/**
|
|
1351
1347
|
* EmbeddingSetsRepository - named, filter, and virtual embedding set API.
|
|
1352
1348
|
*/
|
|
1353
|
-
|
|
1354
|
-
type EmbeddingSetKind = 'physical' | 'filter' | 'virtual';
|
|
1349
|
+
type EmbeddingSetKind = 'filter' | 'physical' | 'virtual';
|
|
1355
1350
|
type EmbeddingSetMode = 'auto' | 'manual' | 'mixed';
|
|
1356
1351
|
interface EmbeddingSetCriteria {
|
|
1357
1352
|
query?: string;
|
|
@@ -1381,10 +1376,10 @@ interface EmbeddingSetFreshness {
|
|
|
1381
1376
|
reason?: string;
|
|
1382
1377
|
}
|
|
1383
1378
|
interface EmbeddingCompatibilityPolicy {
|
|
1384
|
-
model: '
|
|
1385
|
-
dimension: '
|
|
1386
|
-
duplicateVectors: 'prefer-latest' | 'prefer-set-order'
|
|
1387
|
-
missingVectors: '
|
|
1379
|
+
model: 'allow-compatible-family' | 'require-same';
|
|
1380
|
+
dimension: 'allow-truncation' | 'require-same';
|
|
1381
|
+
duplicateVectors: 'error' | 'prefer-latest' | 'prefer-set-order';
|
|
1382
|
+
missingVectors: 'error' | 'include-unembedded-note' | 'omit';
|
|
1388
1383
|
}
|
|
1389
1384
|
interface VirtualMaterializationPolicy {
|
|
1390
1385
|
allowed: boolean;
|
|
@@ -1402,7 +1397,7 @@ interface CriteriaVirtualSource {
|
|
|
1402
1397
|
}
|
|
1403
1398
|
interface SetOperationVirtualSource {
|
|
1404
1399
|
type: 'set-operation';
|
|
1405
|
-
operation: '
|
|
1400
|
+
operation: 'difference' | 'intersection' | 'union';
|
|
1406
1401
|
setIds: string[];
|
|
1407
1402
|
}
|
|
1408
1403
|
interface FallbackVirtualSource {
|
|
@@ -1422,11 +1417,11 @@ interface SnapshotVirtualSource {
|
|
|
1422
1417
|
generatedAt: string;
|
|
1423
1418
|
inputHash: string;
|
|
1424
1419
|
}
|
|
1425
|
-
type VirtualEmbeddingSetSource = CriteriaVirtualSource |
|
|
1420
|
+
type VirtualEmbeddingSetSource = CriteriaVirtualSource | FallbackVirtualSource | LatestCompatibleVirtualSource | SetOperationVirtualSource | SnapshotVirtualSource;
|
|
1426
1421
|
interface VirtualEmbeddingSetDefinition {
|
|
1427
1422
|
id: string;
|
|
1428
1423
|
name: string;
|
|
1429
|
-
purpose?:
|
|
1424
|
+
purpose?: null | string;
|
|
1430
1425
|
source: VirtualEmbeddingSetSource;
|
|
1431
1426
|
compatibility: EmbeddingCompatibilityPolicy;
|
|
1432
1427
|
materialization?: VirtualMaterializationPolicy;
|
|
@@ -1441,30 +1436,30 @@ interface EmbeddingSetSelector {
|
|
|
1441
1436
|
interface EmbeddingSetDescriptor {
|
|
1442
1437
|
id: string;
|
|
1443
1438
|
name: string;
|
|
1444
|
-
purpose?:
|
|
1439
|
+
purpose?: null | string;
|
|
1445
1440
|
kind: EmbeddingSetKind;
|
|
1446
1441
|
mode?: EmbeddingSetMode;
|
|
1447
1442
|
model?: string;
|
|
1448
1443
|
dimension?: number;
|
|
1449
|
-
truncateDimension?:
|
|
1444
|
+
truncateDimension?: null | number;
|
|
1450
1445
|
criteria?: EmbeddingSetCriteria | null;
|
|
1451
1446
|
createdAt?: string;
|
|
1452
1447
|
updatedAt?: string;
|
|
1453
1448
|
freshness?: EmbeddingSetFreshness;
|
|
1454
1449
|
}
|
|
1455
1450
|
type VirtualEmbeddingSetValidationError = {
|
|
1456
|
-
code: '
|
|
1457
|
-
|
|
1458
|
-
} | {
|
|
1459
|
-
code: 'mixed-dimensions';
|
|
1451
|
+
code: 'duplicate-vector';
|
|
1452
|
+
noteId: string;
|
|
1460
1453
|
setIds: string[];
|
|
1461
1454
|
} | {
|
|
1462
1455
|
code: 'missing-vector';
|
|
1463
1456
|
noteId: string;
|
|
1464
1457
|
setId: string;
|
|
1465
1458
|
} | {
|
|
1466
|
-
code: '
|
|
1467
|
-
|
|
1459
|
+
code: 'mixed-dimensions';
|
|
1460
|
+
setIds: string[];
|
|
1461
|
+
} | {
|
|
1462
|
+
code: 'mixed-models';
|
|
1468
1463
|
setIds: string[];
|
|
1469
1464
|
} | {
|
|
1470
1465
|
code: 'stale-snapshot';
|
|
@@ -1492,29 +1487,29 @@ interface ResolvedEmbeddingSet {
|
|
|
1492
1487
|
interface EmbeddingSetRow {
|
|
1493
1488
|
id: string;
|
|
1494
1489
|
name: string;
|
|
1495
|
-
purpose:
|
|
1490
|
+
purpose: null | string;
|
|
1496
1491
|
model_name: string;
|
|
1497
1492
|
dimensions: number;
|
|
1498
1493
|
kind: EmbeddingSetKind;
|
|
1499
1494
|
mode: EmbeddingSetMode | null;
|
|
1500
|
-
truncate_dimension:
|
|
1501
|
-
criteria_json:
|
|
1502
|
-
source_json:
|
|
1503
|
-
compatibility_json:
|
|
1504
|
-
materialization_json:
|
|
1505
|
-
freshness_json:
|
|
1495
|
+
truncate_dimension: null | number;
|
|
1496
|
+
criteria_json: null | unknown;
|
|
1497
|
+
source_json: null | unknown;
|
|
1498
|
+
compatibility_json: null | unknown;
|
|
1499
|
+
materialization_json: null | unknown;
|
|
1500
|
+
freshness_json: null | unknown;
|
|
1506
1501
|
created_at: Date;
|
|
1507
1502
|
updated_at: Date;
|
|
1508
1503
|
}
|
|
1509
1504
|
interface EmbeddingSetCreateInput {
|
|
1510
1505
|
id?: string;
|
|
1511
1506
|
name: string;
|
|
1512
|
-
purpose?:
|
|
1507
|
+
purpose?: null | string;
|
|
1513
1508
|
model_name?: string;
|
|
1514
1509
|
dimensions?: number;
|
|
1515
1510
|
kind?: EmbeddingSetKind;
|
|
1516
1511
|
mode?: EmbeddingSetMode | null;
|
|
1517
|
-
truncate_dimension?:
|
|
1512
|
+
truncate_dimension?: null | number;
|
|
1518
1513
|
criteria?: EmbeddingSetCriteria | null;
|
|
1519
1514
|
}
|
|
1520
1515
|
interface EmbeddingSetEmbeddingInput {
|
|
@@ -1555,14 +1550,65 @@ declare class EmbeddingSetsRepository {
|
|
|
1555
1550
|
private inferDefinitionModel;
|
|
1556
1551
|
private inferDefinitionDimension;
|
|
1557
1552
|
}
|
|
1558
|
-
|
|
1553
|
+
declare const REGISTERED_METADATA_PATHS: readonly [
|
|
1554
|
+
"provider",
|
|
1555
|
+
"model",
|
|
1556
|
+
"role",
|
|
1557
|
+
"event_kind",
|
|
1558
|
+
"sensitivity",
|
|
1559
|
+
"import_run_id"
|
|
1560
|
+
];
|
|
1561
|
+
type RegisteredMetadataPath = typeof REGISTERED_METADATA_PATHS[number];
|
|
1562
|
+
type MetadataPredicate = {
|
|
1563
|
+
gte?: number | string;
|
|
1564
|
+
lte?: number | string;
|
|
1565
|
+
op: 'range';
|
|
1566
|
+
path: RegisteredMetadataPath;
|
|
1567
|
+
} | {
|
|
1568
|
+
op: 'eq';
|
|
1569
|
+
path: RegisteredMetadataPath;
|
|
1570
|
+
value: boolean | null | number | string;
|
|
1571
|
+
} | {
|
|
1572
|
+
op: 'exists';
|
|
1573
|
+
path: RegisteredMetadataPath;
|
|
1574
|
+
value?: boolean;
|
|
1575
|
+
} | {
|
|
1576
|
+
op: 'in';
|
|
1577
|
+
path: RegisteredMetadataPath;
|
|
1578
|
+
value: readonly (boolean | null | number | string)[];
|
|
1579
|
+
};
|
|
1580
|
+
interface EvidenceLocator {
|
|
1581
|
+
note_id: string;
|
|
1582
|
+
chunk?: {
|
|
1583
|
+
index: number;
|
|
1584
|
+
kind: 'attachment' | 'current' | 'title';
|
|
1585
|
+
};
|
|
1586
|
+
span?: {
|
|
1587
|
+
end: number;
|
|
1588
|
+
start: number;
|
|
1589
|
+
};
|
|
1590
|
+
source?: {
|
|
1591
|
+
external_id_hash: string;
|
|
1592
|
+
import_run_id: string;
|
|
1593
|
+
namespace: string;
|
|
1594
|
+
schema_version: string;
|
|
1595
|
+
};
|
|
1596
|
+
metadata_paths: RegisteredMetadataPath[];
|
|
1597
|
+
}
|
|
1598
|
+
interface MetadataPredicateConditionResult {
|
|
1599
|
+
conditions: string[];
|
|
1600
|
+
joins: string[];
|
|
1601
|
+
params: unknown[];
|
|
1602
|
+
nextIdx: number;
|
|
1603
|
+
}
|
|
1604
|
+
declare function buildMetadataPredicateConditions(options: Pick<SearchOptions, 'archive_id' | 'metadataPredicates' | 'tenant_id'>, startIdx: number): MetadataPredicateConditionResult;
|
|
1559
1605
|
/**
|
|
1560
1606
|
* Shared types for repository layer.
|
|
1561
1607
|
* All repository methods use these types as inputs and outputs.
|
|
1562
1608
|
*/
|
|
1563
1609
|
interface NoteSummary {
|
|
1564
1610
|
id: string;
|
|
1565
|
-
title:
|
|
1611
|
+
title: null | string;
|
|
1566
1612
|
format: string;
|
|
1567
1613
|
source: string;
|
|
1568
1614
|
visibility: string;
|
|
@@ -1575,20 +1621,20 @@ interface NoteSummary {
|
|
|
1575
1621
|
tags: string[];
|
|
1576
1622
|
}
|
|
1577
1623
|
interface NoteFull extends NoteSummary {
|
|
1578
|
-
archive_id:
|
|
1624
|
+
archive_id: null | string;
|
|
1579
1625
|
revision_mode: string;
|
|
1580
1626
|
original: {
|
|
1581
|
-
id: string;
|
|
1582
|
-
content: string;
|
|
1583
1627
|
content_hash: string;
|
|
1628
|
+
content: string;
|
|
1584
1629
|
created_at: Date;
|
|
1630
|
+
id: string;
|
|
1585
1631
|
};
|
|
1586
1632
|
current: {
|
|
1633
|
+
ai_metadata: null | unknown;
|
|
1587
1634
|
content: string;
|
|
1588
|
-
ai_metadata: unknown | null;
|
|
1589
1635
|
generation_count: number;
|
|
1590
|
-
model: string | null;
|
|
1591
1636
|
is_user_edited: boolean;
|
|
1637
|
+
model: null | string;
|
|
1592
1638
|
updated_at: Date;
|
|
1593
1639
|
};
|
|
1594
1640
|
}
|
|
@@ -1617,7 +1663,7 @@ interface NoteUpdateInput {
|
|
|
1617
1663
|
interface NoteListOptions {
|
|
1618
1664
|
limit?: number;
|
|
1619
1665
|
offset?: number;
|
|
1620
|
-
sort?: 'created_at' | '
|
|
1666
|
+
sort?: 'created_at' | 'title' | 'updated_at';
|
|
1621
1667
|
order?: 'asc' | 'desc';
|
|
1622
1668
|
is_starred?: boolean;
|
|
1623
1669
|
is_pinned?: boolean;
|
|
@@ -1635,30 +1681,31 @@ interface PaginatedResult<T> {
|
|
|
1635
1681
|
}
|
|
1636
1682
|
interface SearchResult {
|
|
1637
1683
|
id: string;
|
|
1638
|
-
title:
|
|
1684
|
+
title: null | string;
|
|
1639
1685
|
snippet: string;
|
|
1640
1686
|
rank: number;
|
|
1641
1687
|
created_at: Date;
|
|
1642
1688
|
updated_at: Date;
|
|
1643
1689
|
tags: string[];
|
|
1644
1690
|
has_embedding?: boolean;
|
|
1691
|
+
locators?: EvidenceLocator[];
|
|
1645
1692
|
}
|
|
1646
1693
|
interface SearchFacets {
|
|
1647
1694
|
tags: {
|
|
1648
|
-
tag: string;
|
|
1649
1695
|
count: number;
|
|
1696
|
+
tag: string;
|
|
1650
1697
|
}[];
|
|
1651
1698
|
collections: {
|
|
1699
|
+
count: number;
|
|
1652
1700
|
id: string;
|
|
1653
1701
|
name: string;
|
|
1654
|
-
count: number;
|
|
1655
1702
|
}[];
|
|
1656
1703
|
}
|
|
1657
1704
|
interface SearchResponse {
|
|
1658
1705
|
results: SearchResult[];
|
|
1659
1706
|
total: number;
|
|
1660
1707
|
query: string;
|
|
1661
|
-
mode: '
|
|
1708
|
+
mode: 'hybrid' | 'semantic' | 'text';
|
|
1662
1709
|
semantic_available: boolean;
|
|
1663
1710
|
limit: number;
|
|
1664
1711
|
offset: number;
|
|
@@ -1676,8 +1723,11 @@ interface SearchOptions {
|
|
|
1676
1723
|
format?: string;
|
|
1677
1724
|
source?: string;
|
|
1678
1725
|
visibility?: string;
|
|
1726
|
+
tenant_id?: string;
|
|
1727
|
+
archive_id?: null | string;
|
|
1728
|
+
metadataPredicates?: readonly MetadataPredicate[];
|
|
1679
1729
|
include_facets?: boolean;
|
|
1680
|
-
mode?: '
|
|
1730
|
+
mode?: 'auto' | 'hybrid' | 'semantic' | 'text';
|
|
1681
1731
|
embeddingSetId?: string;
|
|
1682
1732
|
embeddingSetSelector?: EmbeddingSetSelector;
|
|
1683
1733
|
}
|
|
@@ -1687,11 +1737,10 @@ interface NoteRevision {
|
|
|
1687
1737
|
revision_number: number;
|
|
1688
1738
|
type: string;
|
|
1689
1739
|
content: string;
|
|
1690
|
-
ai_metadata:
|
|
1691
|
-
model:
|
|
1740
|
+
ai_metadata: null | unknown;
|
|
1741
|
+
model: null | string;
|
|
1692
1742
|
created_at: Date;
|
|
1693
1743
|
}
|
|
1694
|
-
|
|
1695
1744
|
/**
|
|
1696
1745
|
* NotesRepository — CRUD and lifecycle operations for the note entity.
|
|
1697
1746
|
*
|
|
@@ -1701,7 +1750,6 @@ interface NoteRevision {
|
|
|
1701
1750
|
* - List notes with filtering, pagination, and sorting
|
|
1702
1751
|
* - Emit domain events via TypedEventBus on every mutation
|
|
1703
1752
|
*/
|
|
1704
|
-
|
|
1705
1753
|
declare class NotesRepository {
|
|
1706
1754
|
private db;
|
|
1707
1755
|
private events?;
|
|
@@ -1756,12 +1804,10 @@ declare class NotesRepository {
|
|
|
1756
1804
|
*/
|
|
1757
1805
|
getRevisions(noteId: string): Promise<NoteRevision[]>;
|
|
1758
1806
|
}
|
|
1759
|
-
|
|
1760
1807
|
/**
|
|
1761
1808
|
* SearchRepository - full-text search using DatabaseClient tsvector/tsquery,
|
|
1762
1809
|
* with optional semantic search (pgvector) and hybrid (BM25 + vector RRF).
|
|
1763
1810
|
*/
|
|
1764
|
-
|
|
1765
1811
|
declare class SearchRepository {
|
|
1766
1812
|
private db;
|
|
1767
1813
|
private semanticAvailable;
|
|
@@ -1774,6 +1820,8 @@ declare class SearchRepository {
|
|
|
1774
1820
|
private scopeToResolvedEmbeddingRows;
|
|
1775
1821
|
private fetchEmbeddingStatus;
|
|
1776
1822
|
private attachEmbeddingStatus;
|
|
1823
|
+
private fetchLocatorMap;
|
|
1824
|
+
private metadataPaths;
|
|
1777
1825
|
search(query: string, options?: SearchOptions, queryEmbedding?: number[]): Promise<SearchResponse>;
|
|
1778
1826
|
semanticSearch(queryEmbedding: number[], options?: SearchOptions): Promise<SearchResponse>;
|
|
1779
1827
|
hybridSearch(query: string, queryEmbedding: number[], options?: SearchOptions): Promise<SearchResponse>;
|
|
@@ -1781,7 +1829,100 @@ declare class SearchRepository {
|
|
|
1781
1829
|
private fetchFacets;
|
|
1782
1830
|
private fetchTagMap;
|
|
1783
1831
|
}
|
|
1784
|
-
|
|
1832
|
+
type SourceUpsertPolicy = 'conflict' | 'replace' | 'version';
|
|
1833
|
+
type SourceUpsertOutcome = 'conflict' | 'inserted' | 'rejected' | 'replaced' | 'unchanged' | 'versioned';
|
|
1834
|
+
interface SourceIdentityInput {
|
|
1835
|
+
tenant_id?: string;
|
|
1836
|
+
archive_id?: null | string;
|
|
1837
|
+
namespace: string;
|
|
1838
|
+
external_id: string;
|
|
1839
|
+
source_schema_version: string;
|
|
1840
|
+
import_run_id: string;
|
|
1841
|
+
caller_stable_id?: string;
|
|
1842
|
+
}
|
|
1843
|
+
interface SourceUpsertItem {
|
|
1844
|
+
source: SourceIdentityInput;
|
|
1845
|
+
title?: null | string;
|
|
1846
|
+
content: string;
|
|
1847
|
+
format?: string;
|
|
1848
|
+
visibility?: string;
|
|
1849
|
+
metadata?: null | Record<string, unknown>;
|
|
1850
|
+
policy?: SourceUpsertPolicy;
|
|
1851
|
+
}
|
|
1852
|
+
interface SourceUpsertOptions {
|
|
1853
|
+
dryRun?: boolean;
|
|
1854
|
+
maxItems?: number;
|
|
1855
|
+
}
|
|
1856
|
+
interface SourceUpsertItemResult {
|
|
1857
|
+
index: number;
|
|
1858
|
+
outcome: SourceUpsertOutcome;
|
|
1859
|
+
note_id?: string;
|
|
1860
|
+
external_id_hash: string;
|
|
1861
|
+
content_digest: string;
|
|
1862
|
+
reason?: string;
|
|
1863
|
+
}
|
|
1864
|
+
interface SourceUpsertBatchResult {
|
|
1865
|
+
import_run_id: string;
|
|
1866
|
+
dry_run: boolean;
|
|
1867
|
+
outcomes: SourceUpsertItemResult[];
|
|
1868
|
+
counts: Record<SourceUpsertOutcome, number>;
|
|
1869
|
+
}
|
|
1870
|
+
declare class SourceUpsertRepository {
|
|
1871
|
+
private db;
|
|
1872
|
+
private events?;
|
|
1873
|
+
constructor(db: DatabaseClient, events?: TypedEventBus | undefined);
|
|
1874
|
+
upsertBatch(items: readonly SourceUpsertItem[], options?: SourceUpsertOptions): Promise<SourceUpsertBatchResult>;
|
|
1875
|
+
private finish;
|
|
1876
|
+
}
|
|
1877
|
+
interface PurgeSelector {
|
|
1878
|
+
tenant_id?: string;
|
|
1879
|
+
archive_id?: null | string;
|
|
1880
|
+
note_ids?: readonly string[];
|
|
1881
|
+
source?: {
|
|
1882
|
+
external_id?: string;
|
|
1883
|
+
namespace: string;
|
|
1884
|
+
};
|
|
1885
|
+
}
|
|
1886
|
+
interface PurgeCounts {
|
|
1887
|
+
notes: number;
|
|
1888
|
+
revisions: number;
|
|
1889
|
+
links: number;
|
|
1890
|
+
tags: number;
|
|
1891
|
+
embeddings: number;
|
|
1892
|
+
attachments: number;
|
|
1893
|
+
blobs: number;
|
|
1894
|
+
graph_edges: number;
|
|
1895
|
+
provenance_edges: number;
|
|
1896
|
+
source_identities: number;
|
|
1897
|
+
}
|
|
1898
|
+
interface DeletionReceipt {
|
|
1899
|
+
id: string;
|
|
1900
|
+
operation_key: string;
|
|
1901
|
+
tenant_id: string;
|
|
1902
|
+
archive_id: null | string;
|
|
1903
|
+
selector_hash: string;
|
|
1904
|
+
outcome: 'completed';
|
|
1905
|
+
counts: PurgeCounts;
|
|
1906
|
+
completed_at: string;
|
|
1907
|
+
policy: {
|
|
1908
|
+
authority: 'fortemi#1092';
|
|
1909
|
+
mode: 'terminal-purge';
|
|
1910
|
+
receipt_contains_content: false;
|
|
1911
|
+
};
|
|
1912
|
+
}
|
|
1913
|
+
interface PurgePreview {
|
|
1914
|
+
selector_hash: string;
|
|
1915
|
+
counts: PurgeCounts;
|
|
1916
|
+
}
|
|
1917
|
+
declare class LifecyclePurgeRepository {
|
|
1918
|
+
private db;
|
|
1919
|
+
private events?;
|
|
1920
|
+
constructor(db: DatabaseClient, events?: TypedEventBus | undefined);
|
|
1921
|
+
preview(selector: PurgeSelector): Promise<PurgePreview>;
|
|
1922
|
+
purge(selector: PurgeSelector, operationKey: string): Promise<DeletionReceipt>;
|
|
1923
|
+
private count;
|
|
1924
|
+
private deleteSelected;
|
|
1925
|
+
}
|
|
1785
1926
|
interface GraphNode {
|
|
1786
1927
|
id: string;
|
|
1787
1928
|
}
|
|
@@ -1811,10 +1952,10 @@ interface SimilarityGraphOptions {
|
|
|
1811
1952
|
}
|
|
1812
1953
|
interface SimilarityGraphRequest extends SimilarityGraphOptions {
|
|
1813
1954
|
selector: EmbeddingSetSelector;
|
|
1814
|
-
source?: 'cache-
|
|
1955
|
+
source?: 'cache-only' | 'cache-preferred' | 'live-only';
|
|
1815
1956
|
}
|
|
1816
1957
|
interface SimilarityGraphProgress {
|
|
1817
|
-
phase: '
|
|
1958
|
+
phase: 'neighbors' | 'prepare';
|
|
1818
1959
|
done: number;
|
|
1819
1960
|
total: number;
|
|
1820
1961
|
}
|
|
@@ -1827,7 +1968,7 @@ interface SimilarityGraphCacheKey {
|
|
|
1827
1968
|
metric: 'cosine' | 'inner_product' | 'l2';
|
|
1828
1969
|
model: string;
|
|
1829
1970
|
dimension: number;
|
|
1830
|
-
truncateDimension?:
|
|
1971
|
+
truncateDimension?: null | number;
|
|
1831
1972
|
memberHash: string;
|
|
1832
1973
|
vectorHash: string;
|
|
1833
1974
|
parameterHash: string;
|
|
@@ -1835,12 +1976,12 @@ interface SimilarityGraphCacheKey {
|
|
|
1835
1976
|
interface SimilarityGraphResult {
|
|
1836
1977
|
graph: CommunityGraph;
|
|
1837
1978
|
graphSource: {
|
|
1979
|
+
freshness: 'fresh' | 'stale' | 'unknown';
|
|
1838
1980
|
id: string;
|
|
1839
|
-
name: string;
|
|
1840
1981
|
input_hash: string;
|
|
1841
|
-
|
|
1982
|
+
name: string;
|
|
1842
1983
|
};
|
|
1843
|
-
cache: 'hit' | '
|
|
1984
|
+
cache: 'hit' | 'live-only' | 'miss-live-built' | 'stale-live-built';
|
|
1844
1985
|
freshness: 'fresh' | 'stale' | 'unknown';
|
|
1845
1986
|
}
|
|
1846
1987
|
interface CommunityOptions {
|
|
@@ -1850,17 +1991,17 @@ declare function detectCommunities(edges: GraphEdge[], nodes?: GraphNode[], opti
|
|
|
1850
1991
|
declare class GraphRepository {
|
|
1851
1992
|
private db;
|
|
1852
1993
|
constructor(db: QueryExecutor);
|
|
1853
|
-
normalizeSimilarityRequest(request: SimilarityGraphRequest): Required<Pick<SimilarityGraphRequest, '
|
|
1854
|
-
buildSimilarityGraph(embeddingSet:
|
|
1994
|
+
normalizeSimilarityRequest(request: SimilarityGraphRequest): Required<Pick<SimilarityGraphRequest, 'k' | 'metric' | 'minSimilarity' | 'selector' | 'source'>>;
|
|
1995
|
+
buildSimilarityGraph(embeddingSet: EmbeddingSetSelector | string, options?: SimilarityGraphOptions): Promise<CommunityGraph>;
|
|
1855
1996
|
buildSimilarityGraphLive(request: SimilarityGraphRequest): Promise<CommunityGraph>;
|
|
1856
|
-
getCachedSimilarityGraph(request: SimilarityGraphRequest): Promise<
|
|
1997
|
+
getCachedSimilarityGraph(request: SimilarityGraphRequest): Promise<null | SimilarityGraphResult>;
|
|
1857
1998
|
buildOrLoadSimilarityGraph(request: SimilarityGraphRequest): Promise<SimilarityGraphResult>;
|
|
1858
1999
|
saveSimilarityGraphArtifact(input: {
|
|
1859
|
-
graph: CommunityGraph;
|
|
1860
|
-
request: Required<Pick<SimilarityGraphRequest, 'selector' | 'k' | 'minSimilarity' | 'metric' | 'source'>>;
|
|
1861
|
-
resolved: ResolvedEmbeddingSet;
|
|
1862
2000
|
cacheKey: SimilarityGraphCacheKey;
|
|
1863
2001
|
freshness?: 'fresh' | 'stale' | 'unknown';
|
|
2002
|
+
graph: CommunityGraph;
|
|
2003
|
+
request: Required<Pick<SimilarityGraphRequest, 'k' | 'metric' | 'minSimilarity' | 'selector' | 'source'>>;
|
|
2004
|
+
resolved: ResolvedEmbeddingSet;
|
|
1864
2005
|
}): Promise<SimilarityGraphResult['graphSource']>;
|
|
1865
2006
|
markSimilarityGraphStale(graphSourceId: string, reason: string): Promise<void>;
|
|
1866
2007
|
loadGraphArtifact(graphSourceId: string, noteIds?: string[]): Promise<CommunityGraph>;
|
|
@@ -1870,8 +2011,7 @@ declare class GraphRepository {
|
|
|
1870
2011
|
private graphFromArtifact;
|
|
1871
2012
|
buildLinkGraph(linkType?: string): Promise<CommunityGraph>;
|
|
1872
2013
|
}
|
|
1873
|
-
|
|
1874
|
-
type CommunitySourceType = 'computed' | 'precomputed' | 'dynamic' | 'dynamic-snapshot' | 'user-authored' | 'imported';
|
|
2014
|
+
type CommunitySourceType = 'computed' | 'dynamic-snapshot' | 'dynamic' | 'imported' | 'precomputed' | 'user-authored';
|
|
1875
2015
|
interface CommunityFilterDefinition {
|
|
1876
2016
|
query?: string;
|
|
1877
2017
|
tags?: string[];
|
|
@@ -1896,8 +2036,8 @@ interface CommunityAssignmentView {
|
|
|
1896
2036
|
communitySourceId: string;
|
|
1897
2037
|
communityId: string;
|
|
1898
2038
|
noteId: string;
|
|
1899
|
-
label?:
|
|
1900
|
-
confidence?:
|
|
2039
|
+
label?: null | string;
|
|
2040
|
+
confidence?: null | number;
|
|
1901
2041
|
sourceType: CommunitySourceType;
|
|
1902
2042
|
}
|
|
1903
2043
|
interface CommunitySummary {
|
|
@@ -1905,7 +2045,7 @@ interface CommunitySummary {
|
|
|
1905
2045
|
label: string;
|
|
1906
2046
|
sourceType: CommunitySourceType;
|
|
1907
2047
|
size: number;
|
|
1908
|
-
confidence?:
|
|
2048
|
+
confidence?: null | number;
|
|
1909
2049
|
representativeNoteIds: string[];
|
|
1910
2050
|
freshness?: 'fresh' | 'stale' | 'unknown';
|
|
1911
2051
|
}
|
|
@@ -1928,7 +2068,6 @@ declare class CommunitiesRepository {
|
|
|
1928
2068
|
listCommunitySummaries(sourceId: string): Promise<CommunitySummary[]>;
|
|
1929
2069
|
private resolveFilterNoteIds;
|
|
1930
2070
|
}
|
|
1931
|
-
|
|
1932
2071
|
/**
|
|
1933
2072
|
* Shared SQL condition builder for note filtering.
|
|
1934
2073
|
* Used by both SearchRepository and NotesRepository to prevent drift
|
|
@@ -1936,7 +2075,6 @@ declare class CommunitiesRepository {
|
|
|
1936
2075
|
*
|
|
1937
2076
|
* @implements #87 shared condition builder
|
|
1938
2077
|
*/
|
|
1939
|
-
|
|
1940
2078
|
interface ConditionResult {
|
|
1941
2079
|
conditions: string[];
|
|
1942
2080
|
params: unknown[];
|
|
@@ -1950,8 +2088,7 @@ interface ConditionResult {
|
|
|
1950
2088
|
* @param startIdx - Starting parameter index ($N)
|
|
1951
2089
|
* @param includeDeleted - Whether to include soft-deleted notes (default: false)
|
|
1952
2090
|
*/
|
|
1953
|
-
declare function buildNoteConditions(options: Pick<SearchOptions, '
|
|
1954
|
-
|
|
2091
|
+
declare function buildNoteConditions(options: Pick<SearchOptions, 'collection_id' | 'date_from' | 'date_to' | 'format' | 'is_archived' | 'is_starred' | 'source' | 'tags' | 'visibility'>, startIdx: number, includeDeleted?: boolean): ConditionResult;
|
|
1955
2092
|
/**
|
|
1956
2093
|
* Job queue worker — polls job_queue for pending jobs, dispatches to registered
|
|
1957
2094
|
* handlers, manages status transitions and exponential backoff retries.
|
|
@@ -1963,7 +2100,6 @@ declare function buildNoteConditions(options: Pick<SearchOptions, 'tags' | 'coll
|
|
|
1963
2100
|
* concept_tagging: 4 (extract concepts from enriched content, requires llm)
|
|
1964
2101
|
* linking: 5 (find related notes, requires embeddings to exist)
|
|
1965
2102
|
*/
|
|
1966
|
-
|
|
1967
2103
|
interface JobQueueOptions {
|
|
1968
2104
|
/** How often to poll for new jobs (ms). Default: 5000 */
|
|
1969
2105
|
pollIntervalMs?: number;
|
|
@@ -1980,17 +2116,17 @@ interface Job {
|
|
|
1980
2116
|
job_type: string;
|
|
1981
2117
|
status: string;
|
|
1982
2118
|
priority: number;
|
|
1983
|
-
required_capability:
|
|
2119
|
+
required_capability: null | string;
|
|
1984
2120
|
retry_count: number;
|
|
1985
2121
|
max_retries: number;
|
|
1986
|
-
error:
|
|
1987
|
-
result:
|
|
2122
|
+
error: null | string;
|
|
2123
|
+
result: null | unknown;
|
|
1988
2124
|
created_at: Date;
|
|
1989
2125
|
updated_at: Date;
|
|
1990
2126
|
}
|
|
1991
2127
|
type JobHandler = (job: Job, db: DatabaseClient) => Promise<unknown>;
|
|
1992
2128
|
/** Job types listed in execution priority order (lower number = runs first) */
|
|
1993
|
-
type JobType = 'ai_revision' | '
|
|
2129
|
+
type JobType = 'ai_revision' | 'concept_tagging' | 'embedding' | 'linking' | 'title_generation';
|
|
1994
2130
|
/**
|
|
1995
2131
|
* Job priorities — lower number = runs first.
|
|
1996
2132
|
* Correct dependency order:
|
|
@@ -2006,7 +2142,7 @@ interface EnqueueJobInput {
|
|
|
2006
2142
|
noteId: string;
|
|
2007
2143
|
jobType: JobType;
|
|
2008
2144
|
priority?: number;
|
|
2009
|
-
requiredCapability?:
|
|
2145
|
+
requiredCapability?: null | string;
|
|
2010
2146
|
}
|
|
2011
2147
|
/** Enqueue a job into the job_queue table. Returns the new job ID. */
|
|
2012
2148
|
declare function enqueueJob(db: DatabaseClient, input: EnqueueJobInput): Promise<string>;
|
|
@@ -2024,11 +2160,11 @@ interface JobStatus {
|
|
|
2024
2160
|
job_type: string;
|
|
2025
2161
|
status: string;
|
|
2026
2162
|
priority: number;
|
|
2027
|
-
required_capability:
|
|
2163
|
+
required_capability: null | string;
|
|
2028
2164
|
retry_count: number;
|
|
2029
2165
|
max_retries: number;
|
|
2030
|
-
error:
|
|
2031
|
-
result:
|
|
2166
|
+
error: null | string;
|
|
2167
|
+
result: null | unknown;
|
|
2032
2168
|
created_at: Date;
|
|
2033
2169
|
updated_at: Date;
|
|
2034
2170
|
}
|
|
@@ -2063,7 +2199,6 @@ declare function aiRevisionHandler(job: Job, db: DatabaseClient): Promise<unknow
|
|
|
2063
2199
|
declare function conceptTaggingHandler(job: Job, db: DatabaseClient): Promise<unknown>;
|
|
2064
2200
|
/** Linking: find semantically related notes using FTS + vector RRF */
|
|
2065
2201
|
declare function linkingHandler(job: Job, db: DatabaseClient): Promise<unknown>;
|
|
2066
|
-
|
|
2067
2202
|
/**
|
|
2068
2203
|
* TagsRepository — free-form tag management for notes.
|
|
2069
2204
|
*
|
|
@@ -2072,7 +2207,6 @@ declare function linkingHandler(job: Job, db: DatabaseClient): Promise<unknown>;
|
|
|
2072
2207
|
* - Look up tags by note or notes by tag
|
|
2073
2208
|
* - List all tags with usage counts
|
|
2074
2209
|
*/
|
|
2075
|
-
|
|
2076
2210
|
declare class TagsRepository {
|
|
2077
2211
|
private db;
|
|
2078
2212
|
constructor(db: DatabaseClient);
|
|
@@ -2081,11 +2215,10 @@ declare class TagsRepository {
|
|
|
2081
2215
|
getTagsForNote(noteId: string): Promise<string[]>;
|
|
2082
2216
|
getNotesForTag(tag: string): Promise<string[]>;
|
|
2083
2217
|
listAllTags(): Promise<Array<{
|
|
2084
|
-
tag: string;
|
|
2085
2218
|
count: number;
|
|
2219
|
+
tag: string;
|
|
2086
2220
|
}>>;
|
|
2087
2221
|
}
|
|
2088
|
-
|
|
2089
2222
|
/**
|
|
2090
2223
|
* CollectionsRepository — folder/category management for notes.
|
|
2091
2224
|
*
|
|
@@ -2095,12 +2228,11 @@ declare class TagsRepository {
|
|
|
2095
2228
|
* - Assign and unassign notes from collections
|
|
2096
2229
|
* - Return flat list and shallow tree views
|
|
2097
2230
|
*/
|
|
2098
|
-
|
|
2099
2231
|
interface CollectionRow {
|
|
2100
2232
|
id: string;
|
|
2101
2233
|
name: string;
|
|
2102
|
-
description:
|
|
2103
|
-
parent_id:
|
|
2234
|
+
description: null | string;
|
|
2235
|
+
parent_id: null | string;
|
|
2104
2236
|
position: number;
|
|
2105
2237
|
created_at: Date;
|
|
2106
2238
|
updated_at: Date;
|
|
@@ -2120,13 +2252,12 @@ declare class CollectionsRepository {
|
|
|
2120
2252
|
listTree(): Promise<Array<CollectionRow & {
|
|
2121
2253
|
children: CollectionRow[];
|
|
2122
2254
|
}>>;
|
|
2123
|
-
update(id: string, fields: Partial<Pick<CollectionRow, '
|
|
2255
|
+
update(id: string, fields: Partial<Pick<CollectionRow, 'description' | 'name' | 'parent_id' | 'position'>>): Promise<CollectionRow>;
|
|
2124
2256
|
delete(id: string): Promise<void>;
|
|
2125
2257
|
assignNote(collectionId: string, noteId: string): Promise<void>;
|
|
2126
2258
|
unassignNote(collectionId: string, noteId: string): Promise<void>;
|
|
2127
2259
|
getNotesInCollection(collectionId: string): Promise<string[]>;
|
|
2128
2260
|
}
|
|
2129
|
-
|
|
2130
2261
|
/**
|
|
2131
2262
|
* LinksRepository — bidirectional note link management.
|
|
2132
2263
|
*
|
|
@@ -2135,13 +2266,12 @@ declare class CollectionsRepository {
|
|
|
2135
2266
|
* - Soft-delete links
|
|
2136
2267
|
* - Query outbound, inbound, and backlinks for a note
|
|
2137
2268
|
*/
|
|
2138
|
-
|
|
2139
2269
|
interface LinkRow {
|
|
2140
2270
|
id: string;
|
|
2141
2271
|
source_note_id: string;
|
|
2142
2272
|
target_note_id: string;
|
|
2143
2273
|
link_type: string;
|
|
2144
|
-
confidence:
|
|
2274
|
+
confidence: null | number;
|
|
2145
2275
|
created_at: Date;
|
|
2146
2276
|
updated_at: Date | null;
|
|
2147
2277
|
deleted_at: Date | null;
|
|
@@ -2152,13 +2282,12 @@ declare class LinksRepository {
|
|
|
2152
2282
|
create(sourceNoteId: string, targetNoteId: string, linkType?: string): Promise<LinkRow>;
|
|
2153
2283
|
get(id: string): Promise<LinkRow>;
|
|
2154
2284
|
listForNote(noteId: string): Promise<{
|
|
2155
|
-
outbound: LinkRow[];
|
|
2156
2285
|
inbound: LinkRow[];
|
|
2286
|
+
outbound: LinkRow[];
|
|
2157
2287
|
}>;
|
|
2158
2288
|
getBacklinks(noteId: string): Promise<string[]>;
|
|
2159
2289
|
delete(id: string): Promise<void>;
|
|
2160
2290
|
}
|
|
2161
|
-
|
|
2162
2291
|
/**
|
|
2163
2292
|
* SkosRepository — SKOS taxonomy management (schemes, concepts, relations).
|
|
2164
2293
|
*
|
|
@@ -2167,11 +2296,10 @@ declare class LinksRepository {
|
|
|
2167
2296
|
* - Create, list, and soft-delete SKOS concepts within schemes
|
|
2168
2297
|
* - Create and query broader/narrower/related concept relations
|
|
2169
2298
|
*/
|
|
2170
|
-
|
|
2171
2299
|
interface SkosScheme {
|
|
2172
2300
|
id: string;
|
|
2173
2301
|
title: string;
|
|
2174
|
-
description:
|
|
2302
|
+
description: null | string;
|
|
2175
2303
|
created_at: Date;
|
|
2176
2304
|
updated_at: Date;
|
|
2177
2305
|
deleted_at: Date | null;
|
|
@@ -2181,7 +2309,7 @@ interface SkosConcept {
|
|
|
2181
2309
|
scheme_id: string;
|
|
2182
2310
|
pref_label: string;
|
|
2183
2311
|
alt_labels: string[];
|
|
2184
|
-
definition:
|
|
2312
|
+
definition: null | string;
|
|
2185
2313
|
created_at: Date;
|
|
2186
2314
|
updated_at: Date;
|
|
2187
2315
|
deleted_at: Date | null;
|
|
@@ -2217,7 +2345,6 @@ declare class SkosRepository {
|
|
|
2217
2345
|
untagNote(noteId: string, conceptId: string): Promise<void>;
|
|
2218
2346
|
conceptsForNote(noteId: string): Promise<SkosConcept[]>;
|
|
2219
2347
|
}
|
|
2220
|
-
|
|
2221
2348
|
interface ProvenanceEdge {
|
|
2222
2349
|
id: string;
|
|
2223
2350
|
entity_type: string;
|
|
@@ -2226,14 +2353,14 @@ interface ProvenanceEdge {
|
|
|
2226
2353
|
agent: string;
|
|
2227
2354
|
started_at: Date;
|
|
2228
2355
|
ended_at: Date | null;
|
|
2229
|
-
attributes: Record<string, unknown
|
|
2356
|
+
attributes: null | Record<string, unknown>;
|
|
2230
2357
|
}
|
|
2231
2358
|
interface RecordProvenanceInput {
|
|
2232
2359
|
activity: string;
|
|
2233
2360
|
agent: string;
|
|
2234
2361
|
startedAt?: Date | string;
|
|
2235
|
-
endedAt?: Date |
|
|
2236
|
-
attributes?: Record<string, unknown
|
|
2362
|
+
endedAt?: Date | null | string;
|
|
2363
|
+
attributes?: null | Record<string, unknown>;
|
|
2237
2364
|
}
|
|
2238
2365
|
declare class ProvenanceRepository {
|
|
2239
2366
|
private db;
|
|
@@ -2241,7 +2368,6 @@ declare class ProvenanceRepository {
|
|
|
2241
2368
|
recordProvenance(entityType: string, entityId: string, input: RecordProvenanceInput): Promise<ProvenanceEdge>;
|
|
2242
2369
|
forEntity(entityType: string, entityId: string): Promise<ProvenanceEdge[]>;
|
|
2243
2370
|
}
|
|
2244
|
-
|
|
2245
2371
|
/**
|
|
2246
2372
|
* captureKnowledge — tool function for creating notes.
|
|
2247
2373
|
*
|
|
@@ -2252,13 +2378,11 @@ declare class ProvenanceRepository {
|
|
|
2252
2378
|
*
|
|
2253
2379
|
* Input is Zod-validated at entry. All writes delegate to NotesRepository.
|
|
2254
2380
|
*/
|
|
2255
|
-
|
|
2256
2381
|
interface CaptureKnowledgeResult {
|
|
2257
2382
|
action: string;
|
|
2258
2383
|
notes: NoteFull[];
|
|
2259
2384
|
}
|
|
2260
2385
|
declare function captureKnowledge(db: DatabaseClient, rawInput: unknown, events?: TypedEventBus): Promise<CaptureKnowledgeResult>;
|
|
2261
|
-
|
|
2262
2386
|
/**
|
|
2263
2387
|
* manageNote — tool function for note lifecycle operations.
|
|
2264
2388
|
*
|
|
@@ -2266,14 +2390,12 @@ declare function captureKnowledge(db: DatabaseClient, rawInput: unknown, events?
|
|
|
2266
2390
|
*
|
|
2267
2391
|
* Input is Zod-validated at entry. All mutations delegate to NotesRepository.
|
|
2268
2392
|
*/
|
|
2269
|
-
|
|
2270
2393
|
interface ManageNoteResult {
|
|
2271
2394
|
action: string;
|
|
2272
2395
|
note_id: string;
|
|
2273
2396
|
note?: NoteFull;
|
|
2274
2397
|
}
|
|
2275
2398
|
declare function manageNote(db: DatabaseClient, rawInput: unknown, events?: TypedEventBus): Promise<ManageNoteResult>;
|
|
2276
|
-
|
|
2277
2399
|
/**
|
|
2278
2400
|
* searchTool — tool function wrapping SearchRepository.
|
|
2279
2401
|
*
|
|
@@ -2283,9 +2405,7 @@ declare function manageNote(db: DatabaseClient, rawInput: unknown, events?: Type
|
|
|
2283
2405
|
*
|
|
2284
2406
|
* Input is Zod-validated at entry.
|
|
2285
2407
|
*/
|
|
2286
|
-
|
|
2287
2408
|
declare function searchTool(db: DatabaseClient, rawInput: unknown): Promise<SearchResponse>;
|
|
2288
|
-
|
|
2289
2409
|
/**
|
|
2290
2410
|
* Zod schemas for tool function inputs.
|
|
2291
2411
|
*
|
|
@@ -2293,147 +2413,182 @@ declare function searchTool(db: DatabaseClient, rawInput: unknown): Promise<Sear
|
|
|
2293
2413
|
* the tool functions. All inputs are validated at the tool boundary so that
|
|
2294
2414
|
* repository methods only receive well-typed data.
|
|
2295
2415
|
*/
|
|
2296
|
-
|
|
2297
2416
|
declare const CaptureKnowledgeInputSchema: z.ZodObject<{
|
|
2298
|
-
action: z.ZodEnum<[
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
visibility: z.ZodDefault<z.ZodEnum<["private", "shared", "public"]>>;
|
|
2304
|
-
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
2417
|
+
action: z.ZodEnum<[
|
|
2418
|
+
"create",
|
|
2419
|
+
"bulk_create",
|
|
2420
|
+
"from_template"
|
|
2421
|
+
]>;
|
|
2305
2422
|
archive_id: z.ZodOptional<z.ZodString>;
|
|
2423
|
+
content: z.ZodOptional<z.ZodString>;
|
|
2424
|
+
format: z.ZodDefault<z.ZodEnum<[
|
|
2425
|
+
"markdown",
|
|
2426
|
+
"plain",
|
|
2427
|
+
"html"
|
|
2428
|
+
]>>;
|
|
2306
2429
|
notes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2307
2430
|
content: z.ZodString;
|
|
2308
|
-
|
|
2309
|
-
|
|
2431
|
+
format: z.ZodDefault<z.ZodEnum<[
|
|
2432
|
+
"markdown",
|
|
2433
|
+
"plain",
|
|
2434
|
+
"html"
|
|
2435
|
+
]>>;
|
|
2310
2436
|
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
2437
|
+
title: z.ZodOptional<z.ZodString>;
|
|
2311
2438
|
}, "strip", z.ZodTypeAny, {
|
|
2312
|
-
format: "markdown" | "plain" | "html";
|
|
2313
2439
|
content: string;
|
|
2314
|
-
|
|
2440
|
+
format: "html" | "markdown" | "plain";
|
|
2315
2441
|
tags?: string[] | undefined;
|
|
2442
|
+
title?: string | undefined;
|
|
2316
2443
|
}, {
|
|
2317
2444
|
content: string;
|
|
2318
|
-
|
|
2445
|
+
format?: "html" | "markdown" | "plain" | undefined;
|
|
2319
2446
|
tags?: string[] | undefined;
|
|
2320
|
-
|
|
2447
|
+
title?: string | undefined;
|
|
2321
2448
|
}>, "many">>;
|
|
2449
|
+
source: z.ZodDefault<z.ZodString>;
|
|
2450
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
2322
2451
|
template: z.ZodOptional<z.ZodString>;
|
|
2452
|
+
title: z.ZodOptional<z.ZodString>;
|
|
2323
2453
|
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
2454
|
+
visibility: z.ZodDefault<z.ZodEnum<[
|
|
2455
|
+
"private",
|
|
2456
|
+
"shared",
|
|
2457
|
+
"public"
|
|
2458
|
+
]>>;
|
|
2324
2459
|
}, "strip", z.ZodTypeAny, {
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
title?: string | undefined;
|
|
2460
|
+
action: "bulk_create" | "create" | "from_template";
|
|
2461
|
+
archive_id?: string | undefined;
|
|
2462
|
+
content?: string | undefined;
|
|
2463
|
+
format: "html" | "markdown" | "plain";
|
|
2330
2464
|
notes?: {
|
|
2331
|
-
format: "markdown" | "plain" | "html";
|
|
2332
2465
|
content: string;
|
|
2333
|
-
|
|
2466
|
+
format: "html" | "markdown" | "plain";
|
|
2334
2467
|
tags?: string[] | undefined;
|
|
2468
|
+
title?: string | undefined;
|
|
2335
2469
|
}[] | undefined;
|
|
2470
|
+
source: string;
|
|
2336
2471
|
tags?: string[] | undefined;
|
|
2337
|
-
archive_id?: string | undefined;
|
|
2338
|
-
content?: string | undefined;
|
|
2339
2472
|
template?: string | undefined;
|
|
2473
|
+
title?: string | undefined;
|
|
2340
2474
|
variables?: Record<string, string> | undefined;
|
|
2475
|
+
visibility: "private" | "public" | "shared";
|
|
2341
2476
|
}, {
|
|
2342
|
-
action: "
|
|
2343
|
-
|
|
2477
|
+
action: "bulk_create" | "create" | "from_template";
|
|
2478
|
+
archive_id?: string | undefined;
|
|
2479
|
+
content?: string | undefined;
|
|
2480
|
+
format?: "html" | "markdown" | "plain" | undefined;
|
|
2344
2481
|
notes?: {
|
|
2345
2482
|
content: string;
|
|
2346
|
-
|
|
2483
|
+
format?: "html" | "markdown" | "plain" | undefined;
|
|
2347
2484
|
tags?: string[] | undefined;
|
|
2348
|
-
|
|
2485
|
+
title?: string | undefined;
|
|
2349
2486
|
}[] | undefined;
|
|
2350
|
-
tags?: string[] | undefined;
|
|
2351
2487
|
source?: string | undefined;
|
|
2352
|
-
|
|
2353
|
-
format?: "markdown" | "plain" | "html" | undefined;
|
|
2354
|
-
visibility?: "private" | "shared" | "public" | undefined;
|
|
2355
|
-
content?: string | undefined;
|
|
2488
|
+
tags?: string[] | undefined;
|
|
2356
2489
|
template?: string | undefined;
|
|
2490
|
+
title?: string | undefined;
|
|
2357
2491
|
variables?: Record<string, string> | undefined;
|
|
2492
|
+
visibility?: "private" | "public" | "shared" | undefined;
|
|
2358
2493
|
}>;
|
|
2359
2494
|
type CaptureKnowledgeInput = z.infer<typeof CaptureKnowledgeInputSchema>;
|
|
2360
2495
|
declare const ManageNoteInputSchema: z.ZodObject<{
|
|
2361
|
-
action: z.ZodEnum<[
|
|
2362
|
-
|
|
2363
|
-
|
|
2496
|
+
action: z.ZodEnum<[
|
|
2497
|
+
"update",
|
|
2498
|
+
"delete",
|
|
2499
|
+
"restore",
|
|
2500
|
+
"archive",
|
|
2501
|
+
"unarchive",
|
|
2502
|
+
"star",
|
|
2503
|
+
"unstar"
|
|
2504
|
+
]>;
|
|
2364
2505
|
content: z.ZodOptional<z.ZodString>;
|
|
2365
2506
|
format: z.ZodOptional<z.ZodString>;
|
|
2507
|
+
note_id: z.ZodString;
|
|
2508
|
+
title: z.ZodOptional<z.ZodString>;
|
|
2366
2509
|
visibility: z.ZodOptional<z.ZodString>;
|
|
2367
2510
|
}, "strip", z.ZodTypeAny, {
|
|
2368
|
-
action: "
|
|
2511
|
+
action: "archive" | "delete" | "restore" | "star" | "unarchive" | "unstar" | "update";
|
|
2512
|
+
content?: string | undefined;
|
|
2513
|
+
format?: string | undefined;
|
|
2369
2514
|
note_id: string;
|
|
2370
2515
|
title?: string | undefined;
|
|
2371
|
-
format?: string | undefined;
|
|
2372
2516
|
visibility?: string | undefined;
|
|
2373
|
-
content?: string | undefined;
|
|
2374
2517
|
}, {
|
|
2375
|
-
action: "
|
|
2518
|
+
action: "archive" | "delete" | "restore" | "star" | "unarchive" | "unstar" | "update";
|
|
2519
|
+
content?: string | undefined;
|
|
2520
|
+
format?: string | undefined;
|
|
2376
2521
|
note_id: string;
|
|
2377
2522
|
title?: string | undefined;
|
|
2378
|
-
format?: string | undefined;
|
|
2379
2523
|
visibility?: string | undefined;
|
|
2380
|
-
content?: string | undefined;
|
|
2381
2524
|
}>;
|
|
2382
2525
|
type ManageNoteInput = z.infer<typeof ManageNoteInputSchema>;
|
|
2383
2526
|
declare const SearchInputSchema: z.ZodObject<{
|
|
2384
|
-
query: z.ZodString;
|
|
2385
|
-
mode: z.ZodDefault<z.ZodEnum<["text", "semantic", "hybrid", "auto"]>>;
|
|
2386
|
-
query_embedding: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
2387
|
-
embeddingSetId: z.ZodOptional<z.ZodString>;
|
|
2388
|
-
limit: z.ZodDefault<z.ZodNumber>;
|
|
2389
|
-
offset: z.ZodDefault<z.ZodNumber>;
|
|
2390
|
-
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
2391
2527
|
collection_id: z.ZodOptional<z.ZodString>;
|
|
2392
2528
|
date_from: z.ZodOptional<z.ZodDate>;
|
|
2393
2529
|
date_to: z.ZodOptional<z.ZodDate>;
|
|
2394
|
-
|
|
2530
|
+
embeddingSetId: z.ZodOptional<z.ZodString>;
|
|
2531
|
+
format: z.ZodOptional<z.ZodEnum<[
|
|
2532
|
+
"markdown",
|
|
2533
|
+
"plain",
|
|
2534
|
+
"html"
|
|
2535
|
+
]>>;
|
|
2536
|
+
include_facets: z.ZodDefault<z.ZodBoolean>;
|
|
2395
2537
|
is_archived: z.ZodOptional<z.ZodBoolean>;
|
|
2396
|
-
|
|
2538
|
+
is_starred: z.ZodOptional<z.ZodBoolean>;
|
|
2539
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
2540
|
+
mode: z.ZodDefault<z.ZodEnum<[
|
|
2541
|
+
"text",
|
|
2542
|
+
"semantic",
|
|
2543
|
+
"hybrid",
|
|
2544
|
+
"auto"
|
|
2545
|
+
]>>;
|
|
2546
|
+
offset: z.ZodDefault<z.ZodNumber>;
|
|
2547
|
+
query_embedding: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
2548
|
+
query: z.ZodString;
|
|
2397
2549
|
source: z.ZodOptional<z.ZodString>;
|
|
2398
|
-
|
|
2399
|
-
|
|
2550
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
2551
|
+
visibility: z.ZodOptional<z.ZodEnum<[
|
|
2552
|
+
"private",
|
|
2553
|
+
"shared",
|
|
2554
|
+
"public"
|
|
2555
|
+
]>>;
|
|
2400
2556
|
}, "strip", z.ZodTypeAny, {
|
|
2401
|
-
limit: number;
|
|
2402
|
-
offset: number;
|
|
2403
|
-
include_facets: boolean;
|
|
2404
|
-
mode: "auto" | "text" | "semantic" | "hybrid";
|
|
2405
|
-
query: string;
|
|
2406
|
-
tags?: string[] | undefined;
|
|
2407
|
-
source?: string | undefined;
|
|
2408
|
-
format?: "markdown" | "plain" | "html" | undefined;
|
|
2409
|
-
visibility?: "private" | "shared" | "public" | undefined;
|
|
2410
|
-
is_starred?: boolean | undefined;
|
|
2411
|
-
is_archived?: boolean | undefined;
|
|
2412
2557
|
collection_id?: string | undefined;
|
|
2413
2558
|
date_from?: Date | undefined;
|
|
2414
2559
|
date_to?: Date | undefined;
|
|
2415
2560
|
embeddingSetId?: string | undefined;
|
|
2561
|
+
format?: "html" | "markdown" | "plain" | undefined;
|
|
2562
|
+
include_facets: boolean;
|
|
2563
|
+
is_archived?: boolean | undefined;
|
|
2564
|
+
is_starred?: boolean | undefined;
|
|
2565
|
+
limit: number;
|
|
2566
|
+
mode: "auto" | "hybrid" | "semantic" | "text";
|
|
2567
|
+
offset: number;
|
|
2416
2568
|
query_embedding?: number[] | undefined;
|
|
2417
|
-
}, {
|
|
2418
2569
|
query: string;
|
|
2419
|
-
tags?: string[] | undefined;
|
|
2420
2570
|
source?: string | undefined;
|
|
2421
|
-
|
|
2422
|
-
visibility?: "private" | "
|
|
2423
|
-
|
|
2424
|
-
is_archived?: boolean | undefined;
|
|
2425
|
-
limit?: number | undefined;
|
|
2426
|
-
offset?: number | undefined;
|
|
2571
|
+
tags?: string[] | undefined;
|
|
2572
|
+
visibility?: "private" | "public" | "shared" | undefined;
|
|
2573
|
+
}, {
|
|
2427
2574
|
collection_id?: string | undefined;
|
|
2428
2575
|
date_from?: Date | undefined;
|
|
2429
2576
|
date_to?: Date | undefined;
|
|
2430
|
-
include_facets?: boolean | undefined;
|
|
2431
|
-
mode?: "auto" | "text" | "semantic" | "hybrid" | undefined;
|
|
2432
2577
|
embeddingSetId?: string | undefined;
|
|
2578
|
+
format?: "html" | "markdown" | "plain" | undefined;
|
|
2579
|
+
include_facets?: boolean | undefined;
|
|
2580
|
+
is_archived?: boolean | undefined;
|
|
2581
|
+
is_starred?: boolean | undefined;
|
|
2582
|
+
limit?: number | undefined;
|
|
2583
|
+
mode?: "auto" | "hybrid" | "semantic" | "text" | undefined;
|
|
2584
|
+
offset?: number | undefined;
|
|
2433
2585
|
query_embedding?: number[] | undefined;
|
|
2586
|
+
query: string;
|
|
2587
|
+
source?: string | undefined;
|
|
2588
|
+
tags?: string[] | undefined;
|
|
2589
|
+
visibility?: "private" | "public" | "shared" | undefined;
|
|
2434
2590
|
}>;
|
|
2435
2591
|
type SearchInput = z.infer<typeof SearchInputSchema>;
|
|
2436
|
-
|
|
2437
2592
|
/**
|
|
2438
2593
|
* FortemiToolManifest — registry of all Fortemi tool definitions.
|
|
2439
2594
|
*
|
|
@@ -2445,12 +2600,11 @@ type SearchInput = z.infer<typeof SearchInputSchema>;
|
|
|
2445
2600
|
* operations. Additional tools will be added incrementally as repositories
|
|
2446
2601
|
* are implemented.
|
|
2447
2602
|
*/
|
|
2448
|
-
|
|
2449
2603
|
interface FortemiToolDefinition {
|
|
2450
2604
|
id: string;
|
|
2451
2605
|
name: string;
|
|
2452
2606
|
description: string;
|
|
2453
|
-
category: '
|
|
2607
|
+
category: 'analyze' | 'capture' | 'manage' | 'organize' | 'process' | 'search' | 'system';
|
|
2454
2608
|
inputSchema: ZodType;
|
|
2455
2609
|
tags: string[];
|
|
2456
2610
|
sideEffects: boolean;
|
|
@@ -2486,7 +2640,6 @@ declare class FortemiToolManifest {
|
|
|
2486
2640
|
getCategoryCounts(): Record<string, number>;
|
|
2487
2641
|
}
|
|
2488
2642
|
declare const fortemiManifest: FortemiToolManifest;
|
|
2489
|
-
|
|
2490
2643
|
declare const GetNoteInputSchema: z.ZodObject<{
|
|
2491
2644
|
note_id: z.ZodString;
|
|
2492
2645
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -2496,51 +2649,61 @@ declare const GetNoteInputSchema: z.ZodObject<{
|
|
|
2496
2649
|
}>;
|
|
2497
2650
|
type GetNoteInput = z.infer<typeof GetNoteInputSchema>;
|
|
2498
2651
|
declare function getNote(db: DatabaseClient, rawInput: unknown, events?: TypedEventBus): Promise<NoteFull>;
|
|
2499
|
-
|
|
2500
2652
|
declare const ListNotesInputSchema: z.ZodObject<{
|
|
2653
|
+
collection_id: z.ZodOptional<z.ZodString>;
|
|
2654
|
+
include_deleted: z.ZodOptional<z.ZodBoolean>;
|
|
2655
|
+
is_archived: z.ZodOptional<z.ZodBoolean>;
|
|
2656
|
+
is_starred: z.ZodOptional<z.ZodBoolean>;
|
|
2501
2657
|
limit: z.ZodDefault<z.ZodNumber>;
|
|
2502
2658
|
offset: z.ZodDefault<z.ZodNumber>;
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2659
|
+
order: z.ZodDefault<z.ZodEnum<[
|
|
2660
|
+
"asc",
|
|
2661
|
+
"desc"
|
|
2662
|
+
]>>;
|
|
2663
|
+
sort: z.ZodDefault<z.ZodEnum<[
|
|
2664
|
+
"created_at",
|
|
2665
|
+
"updated_at",
|
|
2666
|
+
"title"
|
|
2667
|
+
]>>;
|
|
2507
2668
|
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
2508
|
-
collection_id: z.ZodOptional<z.ZodString>;
|
|
2509
|
-
include_deleted: z.ZodOptional<z.ZodBoolean>;
|
|
2510
2669
|
}, "strip", z.ZodTypeAny, {
|
|
2511
|
-
|
|
2670
|
+
collection_id?: string | undefined;
|
|
2671
|
+
include_deleted?: boolean | undefined;
|
|
2672
|
+
is_archived?: boolean | undefined;
|
|
2673
|
+
is_starred?: boolean | undefined;
|
|
2512
2674
|
limit: number;
|
|
2513
2675
|
offset: number;
|
|
2514
2676
|
order: "asc" | "desc";
|
|
2677
|
+
sort: "created_at" | "title" | "updated_at";
|
|
2515
2678
|
tags?: string[] | undefined;
|
|
2516
|
-
is_starred?: boolean | undefined;
|
|
2517
|
-
is_archived?: boolean | undefined;
|
|
2518
|
-
include_deleted?: boolean | undefined;
|
|
2519
|
-
collection_id?: string | undefined;
|
|
2520
2679
|
}, {
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
is_starred?: boolean | undefined;
|
|
2680
|
+
collection_id?: string | undefined;
|
|
2681
|
+
include_deleted?: boolean | undefined;
|
|
2524
2682
|
is_archived?: boolean | undefined;
|
|
2683
|
+
is_starred?: boolean | undefined;
|
|
2525
2684
|
limit?: number | undefined;
|
|
2526
2685
|
offset?: number | undefined;
|
|
2527
2686
|
order?: "asc" | "desc" | undefined;
|
|
2528
|
-
|
|
2529
|
-
|
|
2687
|
+
sort?: "created_at" | "title" | "updated_at" | undefined;
|
|
2688
|
+
tags?: string[] | undefined;
|
|
2530
2689
|
}>;
|
|
2531
2690
|
type ListNotesInput = z.infer<typeof ListNotesInputSchema>;
|
|
2532
2691
|
declare function listNotes(db: DatabaseClient, rawInput: unknown, events?: TypedEventBus): Promise<PaginatedResult<NoteSummary>>;
|
|
2533
|
-
|
|
2534
2692
|
declare const ManageTagsInputSchema: z.ZodObject<{
|
|
2535
|
-
action: z.ZodEnum<[
|
|
2693
|
+
action: z.ZodEnum<[
|
|
2694
|
+
"add",
|
|
2695
|
+
"remove",
|
|
2696
|
+
"list_for_note",
|
|
2697
|
+
"list_all"
|
|
2698
|
+
]>;
|
|
2536
2699
|
note_id: z.ZodOptional<z.ZodString>;
|
|
2537
2700
|
tag: z.ZodOptional<z.ZodString>;
|
|
2538
2701
|
}, "strip", z.ZodTypeAny, {
|
|
2539
|
-
action: "add" | "
|
|
2702
|
+
action: "add" | "list_all" | "list_for_note" | "remove";
|
|
2540
2703
|
note_id?: string | undefined;
|
|
2541
2704
|
tag?: string | undefined;
|
|
2542
2705
|
}, {
|
|
2543
|
-
action: "add" | "
|
|
2706
|
+
action: "add" | "list_all" | "list_for_note" | "remove";
|
|
2544
2707
|
note_id?: string | undefined;
|
|
2545
2708
|
tag?: string | undefined;
|
|
2546
2709
|
}>;
|
|
@@ -2549,32 +2712,38 @@ interface ManageTagsResult {
|
|
|
2549
2712
|
action: string;
|
|
2550
2713
|
tags?: string[];
|
|
2551
2714
|
all_tags?: Array<{
|
|
2552
|
-
tag: string;
|
|
2553
2715
|
count: number;
|
|
2716
|
+
tag: string;
|
|
2554
2717
|
}>;
|
|
2555
2718
|
}
|
|
2556
2719
|
declare function manageTags(db: DatabaseClient, rawInput: unknown): Promise<ManageTagsResult>;
|
|
2557
|
-
|
|
2558
2720
|
declare const ManageCollectionsInputSchema: z.ZodObject<{
|
|
2559
|
-
action: z.ZodEnum<[
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2721
|
+
action: z.ZodEnum<[
|
|
2722
|
+
"create",
|
|
2723
|
+
"list",
|
|
2724
|
+
"list_tree",
|
|
2725
|
+
"assign",
|
|
2726
|
+
"unassign",
|
|
2727
|
+
"delete"
|
|
2728
|
+
]>;
|
|
2563
2729
|
collection_id: z.ZodOptional<z.ZodString>;
|
|
2730
|
+
description: z.ZodOptional<z.ZodString>;
|
|
2731
|
+
name: z.ZodOptional<z.ZodString>;
|
|
2564
2732
|
note_id: z.ZodOptional<z.ZodString>;
|
|
2733
|
+
parent_id: z.ZodOptional<z.ZodString>;
|
|
2565
2734
|
}, "strip", z.ZodTypeAny, {
|
|
2566
|
-
action: "
|
|
2567
|
-
name?: string | undefined;
|
|
2735
|
+
action: "assign" | "create" | "delete" | "list_tree" | "list" | "unassign";
|
|
2568
2736
|
collection_id?: string | undefined;
|
|
2569
|
-
note_id?: string | undefined;
|
|
2570
2737
|
description?: string | undefined;
|
|
2738
|
+
name?: string | undefined;
|
|
2739
|
+
note_id?: string | undefined;
|
|
2571
2740
|
parent_id?: string | undefined;
|
|
2572
2741
|
}, {
|
|
2573
|
-
action: "
|
|
2574
|
-
name?: string | undefined;
|
|
2742
|
+
action: "assign" | "create" | "delete" | "list_tree" | "list" | "unassign";
|
|
2575
2743
|
collection_id?: string | undefined;
|
|
2576
|
-
note_id?: string | undefined;
|
|
2577
2744
|
description?: string | undefined;
|
|
2745
|
+
name?: string | undefined;
|
|
2746
|
+
note_id?: string | undefined;
|
|
2578
2747
|
parent_id?: string | undefined;
|
|
2579
2748
|
}>;
|
|
2580
2749
|
type ManageCollectionsInput = z.infer<typeof ManageCollectionsInputSchema>;
|
|
@@ -2589,28 +2758,32 @@ interface ManageCollectionsResult {
|
|
|
2589
2758
|
note_id?: string;
|
|
2590
2759
|
}
|
|
2591
2760
|
declare function manageCollections(db: DatabaseClient, rawInput: unknown): Promise<ManageCollectionsResult>;
|
|
2592
|
-
|
|
2593
2761
|
declare const ManageLinksInputSchema: z.ZodObject<{
|
|
2594
|
-
action: z.ZodEnum<[
|
|
2595
|
-
|
|
2596
|
-
|
|
2762
|
+
action: z.ZodEnum<[
|
|
2763
|
+
"create",
|
|
2764
|
+
"list",
|
|
2765
|
+
"backlinks",
|
|
2766
|
+
"delete"
|
|
2767
|
+
]>;
|
|
2597
2768
|
link_id: z.ZodOptional<z.ZodString>;
|
|
2598
2769
|
link_type: z.ZodDefault<z.ZodString>;
|
|
2599
2770
|
note_id: z.ZodOptional<z.ZodString>;
|
|
2771
|
+
source_note_id: z.ZodOptional<z.ZodString>;
|
|
2772
|
+
target_note_id: z.ZodOptional<z.ZodString>;
|
|
2600
2773
|
}, "strip", z.ZodTypeAny, {
|
|
2601
|
-
action: "
|
|
2774
|
+
action: "backlinks" | "create" | "delete" | "list";
|
|
2775
|
+
link_id?: string | undefined;
|
|
2602
2776
|
link_type: string;
|
|
2603
2777
|
note_id?: string | undefined;
|
|
2604
2778
|
source_note_id?: string | undefined;
|
|
2605
2779
|
target_note_id?: string | undefined;
|
|
2606
|
-
link_id?: string | undefined;
|
|
2607
2780
|
}, {
|
|
2608
|
-
action: "
|
|
2781
|
+
action: "backlinks" | "create" | "delete" | "list";
|
|
2782
|
+
link_id?: string | undefined;
|
|
2783
|
+
link_type?: string | undefined;
|
|
2609
2784
|
note_id?: string | undefined;
|
|
2610
2785
|
source_note_id?: string | undefined;
|
|
2611
2786
|
target_note_id?: string | undefined;
|
|
2612
|
-
link_id?: string | undefined;
|
|
2613
|
-
link_type?: string | undefined;
|
|
2614
2787
|
}>;
|
|
2615
2788
|
type ManageLinksInput = z.infer<typeof ManageLinksInputSchema>;
|
|
2616
2789
|
interface ManageLinksResult {
|
|
@@ -2622,9 +2795,13 @@ interface ManageLinksResult {
|
|
|
2622
2795
|
link_id?: string;
|
|
2623
2796
|
}
|
|
2624
2797
|
declare function manageLinks(db: DatabaseClient, rawInput: unknown): Promise<ManageLinksResult>;
|
|
2625
|
-
|
|
2626
2798
|
declare const ManageArchiveInputSchema: z.ZodObject<{
|
|
2627
|
-
action: z.ZodEnum<[
|
|
2799
|
+
action: z.ZodEnum<[
|
|
2800
|
+
"list",
|
|
2801
|
+
"create",
|
|
2802
|
+
"switch",
|
|
2803
|
+
"delete"
|
|
2804
|
+
]>;
|
|
2628
2805
|
name: z.ZodOptional<z.ZodString>;
|
|
2629
2806
|
}, "strip", z.ZodTypeAny, {
|
|
2630
2807
|
action: "create" | "delete" | "list" | "switch";
|
|
@@ -2641,15 +2818,19 @@ interface ManageArchiveResult {
|
|
|
2641
2818
|
name?: string;
|
|
2642
2819
|
}
|
|
2643
2820
|
declare function manageArchive(archiveManager: ArchiveManager, rawInput: unknown): Promise<ManageArchiveResult>;
|
|
2644
|
-
|
|
2645
2821
|
declare const ManageCapabilitiesInputSchema: z.ZodObject<{
|
|
2646
|
-
action: z.ZodEnum<[
|
|
2822
|
+
action: z.ZodEnum<[
|
|
2823
|
+
"list",
|
|
2824
|
+
"enable",
|
|
2825
|
+
"disable",
|
|
2826
|
+
"status"
|
|
2827
|
+
]>;
|
|
2647
2828
|
capability: z.ZodOptional<z.ZodString>;
|
|
2648
2829
|
}, "strip", z.ZodTypeAny, {
|
|
2649
|
-
action: "
|
|
2830
|
+
action: "disable" | "enable" | "list" | "status";
|
|
2650
2831
|
capability?: string | undefined;
|
|
2651
2832
|
}, {
|
|
2652
|
-
action: "
|
|
2833
|
+
action: "disable" | "enable" | "list" | "status";
|
|
2653
2834
|
capability?: string | undefined;
|
|
2654
2835
|
}>;
|
|
2655
2836
|
type ManageCapabilitiesInput = z.infer<typeof ManageCapabilitiesInputSchema>;
|
|
@@ -2667,7 +2848,6 @@ interface ManageCapabilitiesResult {
|
|
|
2667
2848
|
capability?: CapabilityInfo;
|
|
2668
2849
|
}
|
|
2669
2850
|
declare function manageCapabilities(capabilityManager: CapabilityManager, rawInput: unknown): Promise<ManageCapabilitiesResult>;
|
|
2670
|
-
|
|
2671
2851
|
/**
|
|
2672
2852
|
* AttachmentsRepository — attach and retrieve binary files linked to notes.
|
|
2673
2853
|
*
|
|
@@ -2680,16 +2860,15 @@ declare function manageCapabilities(capabilityManager: CapabilityManager, rawInp
|
|
|
2680
2860
|
* - Reconcile/GC blob bytes against the canonical manifest live set
|
|
2681
2861
|
* (ADR-013 D2/D4: manifests are the sole lifecycle authority)
|
|
2682
2862
|
*/
|
|
2683
|
-
|
|
2684
2863
|
interface AttachmentRow {
|
|
2685
2864
|
id: string;
|
|
2686
2865
|
note_id: string;
|
|
2687
2866
|
blob_id: string;
|
|
2688
|
-
document_type_id:
|
|
2689
|
-
mime_type:
|
|
2690
|
-
extracted_text:
|
|
2867
|
+
document_type_id: null | string;
|
|
2868
|
+
mime_type: null | string;
|
|
2869
|
+
extracted_text: null | string;
|
|
2691
2870
|
filename: string;
|
|
2692
|
-
display_name:
|
|
2871
|
+
display_name: null | string;
|
|
2693
2872
|
position: number;
|
|
2694
2873
|
created_at: Date;
|
|
2695
2874
|
deleted_at: Date | null;
|
|
@@ -2698,7 +2877,7 @@ interface AttachmentBlobRow {
|
|
|
2698
2877
|
id: string;
|
|
2699
2878
|
content_hash: string;
|
|
2700
2879
|
size_bytes: number;
|
|
2701
|
-
storage_path:
|
|
2880
|
+
storage_path: null | string;
|
|
2702
2881
|
created_at: Date;
|
|
2703
2882
|
}
|
|
2704
2883
|
interface AttachInput {
|
|
@@ -2741,7 +2920,7 @@ declare class AttachmentsRepository {
|
|
|
2741
2920
|
* the recoverable reference-only state (metadata intact, bytes
|
|
2742
2921
|
* re-hydratable from a shard sidecar or a re-attach of the same content).
|
|
2743
2922
|
*/
|
|
2744
|
-
getBlob(attachmentId: string): Promise<
|
|
2923
|
+
getBlob(attachmentId: string): Promise<null | Uint8Array>;
|
|
2745
2924
|
/**
|
|
2746
2925
|
* True when the attachment's bytes are physically present in the BlobStore.
|
|
2747
2926
|
* False means reference-only (recoverable), not an error.
|
|
@@ -2778,35 +2957,40 @@ declare class AttachmentsRepository {
|
|
|
2778
2957
|
gcBlobs(opts?: BlobGcOptions): Promise<BlobGcResult>;
|
|
2779
2958
|
private blobChecksumOf;
|
|
2780
2959
|
}
|
|
2781
|
-
|
|
2782
2960
|
declare const ManageAttachmentsInputSchema: z.ZodObject<{
|
|
2783
|
-
action: z.ZodEnum<["attach", "list", "get", "get_blob", "delete"]>;
|
|
2784
|
-
note_id: z.ZodOptional<z.ZodString>;
|
|
2785
|
-
attachment_id: z.ZodOptional<z.ZodString>;
|
|
2786
2961
|
/** Base64-encoded file data for the 'attach' action */
|
|
2787
2962
|
data_base64: z.ZodOptional<z.ZodString>;
|
|
2963
|
+
action: z.ZodEnum<[
|
|
2964
|
+
"attach",
|
|
2965
|
+
"list",
|
|
2966
|
+
"get",
|
|
2967
|
+
"get_blob",
|
|
2968
|
+
"delete"
|
|
2969
|
+
]>;
|
|
2970
|
+
attachment_id: z.ZodOptional<z.ZodString>;
|
|
2971
|
+
display_name: z.ZodOptional<z.ZodString>;
|
|
2972
|
+
extracted_text: z.ZodOptional<z.ZodString>;
|
|
2788
2973
|
filename: z.ZodOptional<z.ZodString>;
|
|
2789
2974
|
mime_type: z.ZodOptional<z.ZodString>;
|
|
2790
|
-
|
|
2791
|
-
display_name: z.ZodOptional<z.ZodString>;
|
|
2975
|
+
note_id: z.ZodOptional<z.ZodString>;
|
|
2792
2976
|
}, "strip", z.ZodTypeAny, {
|
|
2793
|
-
action: "
|
|
2794
|
-
filename?: string | undefined;
|
|
2795
|
-
note_id?: string | undefined;
|
|
2796
|
-
extracted_text?: string | undefined;
|
|
2977
|
+
action: "attach" | "delete" | "get_blob" | "get" | "list";
|
|
2797
2978
|
attachment_id?: string | undefined;
|
|
2798
2979
|
data_base64?: string | undefined;
|
|
2799
|
-
mime_type?: string | undefined;
|
|
2800
2980
|
display_name?: string | undefined;
|
|
2801
|
-
|
|
2802
|
-
action: "delete" | "list" | "attach" | "get" | "get_blob";
|
|
2981
|
+
extracted_text?: string | undefined;
|
|
2803
2982
|
filename?: string | undefined;
|
|
2983
|
+
mime_type?: string | undefined;
|
|
2804
2984
|
note_id?: string | undefined;
|
|
2805
|
-
|
|
2985
|
+
}, {
|
|
2986
|
+
action: "attach" | "delete" | "get_blob" | "get" | "list";
|
|
2806
2987
|
attachment_id?: string | undefined;
|
|
2807
2988
|
data_base64?: string | undefined;
|
|
2808
|
-
mime_type?: string | undefined;
|
|
2809
2989
|
display_name?: string | undefined;
|
|
2990
|
+
extracted_text?: string | undefined;
|
|
2991
|
+
filename?: string | undefined;
|
|
2992
|
+
mime_type?: string | undefined;
|
|
2993
|
+
note_id?: string | undefined;
|
|
2810
2994
|
}>;
|
|
2811
2995
|
type ManageAttachmentsInput = z.infer<typeof ManageAttachmentsInputSchema>;
|
|
2812
2996
|
interface ManageAttachmentsResult {
|
|
@@ -2819,7 +3003,6 @@ interface ManageAttachmentsResult {
|
|
|
2819
3003
|
size_bytes?: number;
|
|
2820
3004
|
}
|
|
2821
3005
|
declare function manageAttachments(db: DatabaseClient, blobStore: BlobStore, rawInput: unknown): Promise<ManageAttachmentsResult>;
|
|
2822
|
-
|
|
2823
3006
|
/**
|
|
2824
3007
|
* GPU capability detection for WebGPU-based LLM inference.
|
|
2825
3008
|
* Used to select appropriate model tier based on available GPU memory.
|
|
@@ -2833,7 +3016,7 @@ interface GpuCapabilities {
|
|
|
2833
3016
|
maxBufferSizeBytes: number;
|
|
2834
3017
|
supportsF16: boolean;
|
|
2835
3018
|
}
|
|
2836
|
-
type VramTier = '
|
|
3019
|
+
type VramTier = 'high' | 'low' | 'medium' | 'unknown';
|
|
2837
3020
|
declare function detectGpuCapabilities(): Promise<GpuCapabilities>;
|
|
2838
3021
|
declare function estimateVramTier(caps: GpuCapabilities): VramTier;
|
|
2839
3022
|
/**
|
|
@@ -2841,15 +3024,13 @@ declare function estimateVramTier(caps: GpuCapabilities): VramTier;
|
|
|
2841
3024
|
* Uses f32 quantization when f16 shaders aren't available (e.g., SwiftShader).
|
|
2842
3025
|
*/
|
|
2843
3026
|
declare function selectLlmModel(tier: VramTier, supportsF16?: boolean): string;
|
|
2844
|
-
|
|
2845
3027
|
/**
|
|
2846
3028
|
* Enhanced inference capability detection.
|
|
2847
3029
|
* Extends gpu-detect.ts with VRAM estimation, model fit, Chrome AI, and WebNN detection.
|
|
2848
3030
|
*
|
|
2849
3031
|
* @implements #115 hardware capability detection improvements
|
|
2850
3032
|
*/
|
|
2851
|
-
|
|
2852
|
-
type RecommendedTier = 'high' | 'medium' | 'low' | 'cpu-only';
|
|
3033
|
+
type RecommendedTier = 'cpu-only' | 'high' | 'low' | 'medium';
|
|
2853
3034
|
interface InferenceCapabilities {
|
|
2854
3035
|
webgpu: boolean;
|
|
2855
3036
|
wasm: boolean;
|
|
@@ -2881,7 +3062,6 @@ declare function estimateModelFit(modelSizeMB: number, availableVramMB: number):
|
|
|
2881
3062
|
* Superset of detectGpuCapabilities() — adds VRAM estimation, WebNN, Chrome AI, etc.
|
|
2882
3063
|
*/
|
|
2883
3064
|
declare function detectInferenceCapabilities(): Promise<InferenceCapabilities>;
|
|
2884
|
-
|
|
2885
3065
|
/**
|
|
2886
3066
|
* Text chunking utility for embedding generation.
|
|
2887
3067
|
* Splits long text into overlapping chunks suitable for embedding models.
|
|
@@ -2890,7 +3070,6 @@ declare function detectInferenceCapabilities(): Promise<InferenceCapabilities>;
|
|
|
2890
3070
|
*/
|
|
2891
3071
|
/** Split text into overlapping chunks for embedding. */
|
|
2892
3072
|
declare function chunkText(text: string, maxChars?: number, overlap?: number): string[];
|
|
2893
|
-
|
|
2894
3073
|
/**
|
|
2895
3074
|
* Embedding generation job handler.
|
|
2896
3075
|
* Generates and stores vector embeddings for note content.
|
|
@@ -2898,7 +3077,6 @@ declare function chunkText(text: string, maxChars?: number, overlap?: number): s
|
|
|
2898
3077
|
*
|
|
2899
3078
|
* @implements #63 embedding generation
|
|
2900
3079
|
*/
|
|
2901
|
-
|
|
2902
3080
|
/** Type for the embed function — injected by the semantic capability module */
|
|
2903
3081
|
type EmbedFunction = (texts: string[]) => Promise<number[][]>;
|
|
2904
3082
|
declare function setEmbedFunction(fn: EmbedFunction | null): void;
|
|
@@ -2907,7 +3085,6 @@ declare function getEmbedFunction(): EmbedFunction | null;
|
|
|
2907
3085
|
declare function embeddingGenerationHandler(job: {
|
|
2908
3086
|
note_id: string;
|
|
2909
3087
|
}, db: DatabaseClient): Promise<unknown>;
|
|
2910
|
-
|
|
2911
3088
|
/**
|
|
2912
3089
|
* LLM completion function injection.
|
|
2913
3090
|
* Provides the slot for an LLM function — injected by the llm capability module.
|
|
@@ -2922,7 +3099,6 @@ type LlmCompleteFn = (prompt: string, options?: {
|
|
|
2922
3099
|
}) => Promise<string>;
|
|
2923
3100
|
declare function setLlmFunction(fn: LlmCompleteFn | null): void;
|
|
2924
3101
|
declare function getLlmFunction(): LlmCompleteFn | null;
|
|
2925
|
-
|
|
2926
3102
|
/**
|
|
2927
3103
|
* Auto-tagging utility using embedding similarity.
|
|
2928
3104
|
* Suggests tags based on cosine similarity between note and tag vocabulary embeddings.
|
|
@@ -2936,7 +3112,6 @@ declare function cosineSimilarity(a: number[], b: number[]): number;
|
|
|
2936
3112
|
* Returns tags sorted by descending similarity score, filtered by threshold.
|
|
2937
3113
|
*/
|
|
2938
3114
|
declare function suggestTags(noteEmbedding: number[], tagEmbeddings: Map<string, number[]>, threshold?: number, maxTags?: number): string[];
|
|
2939
|
-
|
|
2940
3115
|
/**
|
|
2941
3116
|
* Off-main-thread query-embedding transport for the semantic capability.
|
|
2942
3117
|
*
|
|
@@ -2964,7 +3139,6 @@ declare function suggestTags(noteEmbedding: number[], tagEmbeddings: Map<string,
|
|
|
2964
3139
|
*
|
|
2965
3140
|
* @implements #180 off-main-thread / pluggable query-embedding transport
|
|
2966
3141
|
*/
|
|
2967
|
-
|
|
2968
3142
|
/**
|
|
2969
3143
|
* Minimal transport contract satisfied by both `Worker` and `MessagePort`.
|
|
2970
3144
|
* Core only needs to post messages and listen for replies.
|
|
@@ -3026,8 +3200,8 @@ interface EmbedWorkerOptions {
|
|
|
3026
3200
|
* ```
|
|
3027
3201
|
*/
|
|
3028
3202
|
declare function createWorkerEmbedFunction(port: EmbedTransportPort, options?: EmbedWorkerOptions): {
|
|
3029
|
-
embed: EmbedFunction;
|
|
3030
3203
|
dispose: () => void;
|
|
3204
|
+
embed: EmbedFunction;
|
|
3031
3205
|
};
|
|
3032
3206
|
/**
|
|
3033
3207
|
* Wire a host-owned embed function to the message protocol (worker side).
|
|
@@ -3059,7 +3233,6 @@ declare function createWorkerEmbedFunction(port: EmbedTransportPort, options?: E
|
|
|
3059
3233
|
* ```
|
|
3060
3234
|
*/
|
|
3061
3235
|
declare function handleEmbedRequests(port: EmbedTransportPort, embed: EmbedFunction): () => void;
|
|
3062
|
-
|
|
3063
3236
|
/**
|
|
3064
3237
|
* Semantic capability loader — registers the embedding pipeline with CapabilityManager.
|
|
3065
3238
|
*
|
|
@@ -3074,7 +3247,6 @@ declare function handleEmbedRequests(port: EmbedTransportPort, embed: EmbedFunct
|
|
|
3074
3247
|
* @implements #62 semantic capability loader
|
|
3075
3248
|
* @implements #180 off-main-thread / pluggable query-embedding transport
|
|
3076
3249
|
*/
|
|
3077
|
-
|
|
3078
3250
|
/**
|
|
3079
3251
|
* Register the semantic capability with a CapabilityManager.
|
|
3080
3252
|
* The loader will be called when capabilityManager.enable('semantic') is invoked.
|
|
@@ -3112,7 +3284,6 @@ declare function registerSemanticCapabilityWorker(manager: CapabilityManager, po
|
|
|
3112
3284
|
* any active off-main-thread transport. Called when the capability is disabled.
|
|
3113
3285
|
*/
|
|
3114
3286
|
declare function unregisterSemanticCapability(): void;
|
|
3115
|
-
|
|
3116
3287
|
/**
|
|
3117
3288
|
* LLM capability loader — registers the local LLM with CapabilityManager.
|
|
3118
3289
|
*
|
|
@@ -3121,7 +3292,6 @@ declare function unregisterSemanticCapability(): void;
|
|
|
3121
3292
|
*
|
|
3122
3293
|
* @implements #65 LLM capability loader
|
|
3123
3294
|
*/
|
|
3124
|
-
|
|
3125
3295
|
interface LlmCapabilityOptions {
|
|
3126
3296
|
modelOverride?: string;
|
|
3127
3297
|
onProgress?: (pct: number, text: string) => void;
|
|
@@ -3139,7 +3309,6 @@ declare function registerLlmCapability(manager: CapabilityManager, completeFn: L
|
|
|
3139
3309
|
* Unregister the LLM capability — clears the completion function.
|
|
3140
3310
|
*/
|
|
3141
3311
|
declare function unregisterLlmCapability(): void;
|
|
3142
|
-
|
|
3143
3312
|
/**
|
|
3144
3313
|
* Formal InferenceProvider interface.
|
|
3145
3314
|
* Core contract for all inference providers — remote APIs, local servers, in-browser models.
|
|
@@ -3179,10 +3348,10 @@ interface CompletionResponse {
|
|
|
3179
3348
|
text: string;
|
|
3180
3349
|
model: string;
|
|
3181
3350
|
usage?: {
|
|
3182
|
-
promptTokens: number;
|
|
3183
3351
|
completionTokens: number;
|
|
3352
|
+
promptTokens: number;
|
|
3184
3353
|
};
|
|
3185
|
-
finishReason?: '
|
|
3354
|
+
finishReason?: 'content_filter' | 'length' | 'stop';
|
|
3186
3355
|
}
|
|
3187
3356
|
interface StreamChunk {
|
|
3188
3357
|
text: string;
|
|
@@ -3195,13 +3364,13 @@ interface ModelInfo {
|
|
|
3195
3364
|
contextWindow?: number;
|
|
3196
3365
|
owned_by?: string;
|
|
3197
3366
|
}
|
|
3198
|
-
type ProbeStatus = '
|
|
3367
|
+
type ProbeStatus = 'degraded' | 'down' | 'ok';
|
|
3199
3368
|
interface ProbeResult {
|
|
3200
3369
|
status: ProbeStatus;
|
|
3201
3370
|
latencyMs: number;
|
|
3202
3371
|
message?: string;
|
|
3203
3372
|
}
|
|
3204
|
-
type ProviderTier = '
|
|
3373
|
+
type ProviderTier = 'chrome-ai' | 'in-browser' | 'local-server' | 'remote';
|
|
3205
3374
|
interface InferenceProvider {
|
|
3206
3375
|
readonly id: string;
|
|
3207
3376
|
readonly name: string;
|
|
@@ -3220,14 +3389,12 @@ interface InferenceProvider {
|
|
|
3220
3389
|
/** Clean up resources */
|
|
3221
3390
|
dispose(): void;
|
|
3222
3391
|
}
|
|
3223
|
-
|
|
3224
3392
|
/**
|
|
3225
3393
|
* ProviderRegistry — manages InferenceProvider instances.
|
|
3226
3394
|
* Supports add/remove/getActive/setActive and derives CapabilityManager state.
|
|
3227
3395
|
*
|
|
3228
3396
|
* @implements #112 provider registry
|
|
3229
3397
|
*/
|
|
3230
|
-
|
|
3231
3398
|
declare class ProviderRegistry {
|
|
3232
3399
|
private events?;
|
|
3233
3400
|
private providers;
|
|
@@ -3274,11 +3441,10 @@ declare class ProviderRegistry {
|
|
|
3274
3441
|
*/
|
|
3275
3442
|
declare function createLegacyProvider(options: {
|
|
3276
3443
|
embedFn?: EmbedFunction | null;
|
|
3277
|
-
llmFn?: LlmCompleteFn | null;
|
|
3278
3444
|
id?: string;
|
|
3445
|
+
llmFn?: LlmCompleteFn | null;
|
|
3279
3446
|
name?: string;
|
|
3280
3447
|
}): InferenceProvider;
|
|
3281
|
-
|
|
3282
3448
|
/**
|
|
3283
3449
|
* OpenAI-compatible inference provider.
|
|
3284
3450
|
* Works with OpenAI, OpenRouter, Anthropic (via OpenRouter), Ollama, LM Studio,
|
|
@@ -3288,7 +3454,6 @@ declare function createLegacyProvider(options: {
|
|
|
3288
3454
|
*
|
|
3289
3455
|
* @implements #113 remote provider support
|
|
3290
3456
|
*/
|
|
3291
|
-
|
|
3292
3457
|
interface OpenAIProviderConfig {
|
|
3293
3458
|
id: string;
|
|
3294
3459
|
name: string;
|
|
@@ -3326,7 +3491,6 @@ declare class OpenAICompatibleProvider implements InferenceProvider {
|
|
|
3326
3491
|
private fetch;
|
|
3327
3492
|
private rawFetch;
|
|
3328
3493
|
}
|
|
3329
|
-
|
|
3330
3494
|
/**
|
|
3331
3495
|
* Local inference server auto-discovery.
|
|
3332
3496
|
* Probes known local endpoints (Ollama, LM Studio, llama.cpp, vLLM, Jan, LocalAI)
|
|
@@ -3334,7 +3498,6 @@ declare class OpenAICompatibleProvider implements InferenceProvider {
|
|
|
3334
3498
|
*
|
|
3335
3499
|
* @implements #116 local server auto-discovery
|
|
3336
3500
|
*/
|
|
3337
|
-
|
|
3338
3501
|
interface LocalEndpoint {
|
|
3339
3502
|
id: string;
|
|
3340
3503
|
name: string;
|
|
@@ -3356,7 +3519,7 @@ interface DiscoveryOptions {
|
|
|
3356
3519
|
skipPorts?: number[];
|
|
3357
3520
|
}
|
|
3358
3521
|
declare const LOCAL_ENDPOINTS: LocalEndpoint[];
|
|
3359
|
-
type ModelCategory = '
|
|
3522
|
+
type ModelCategory = 'chat' | 'embedding' | 'vision';
|
|
3360
3523
|
/**
|
|
3361
3524
|
* Classify a model by its ID/name into embedding, vision, or chat.
|
|
3362
3525
|
*/
|
|
@@ -3366,7 +3529,6 @@ declare function classifyModel(modelId: string): ModelCategory;
|
|
|
3366
3529
|
* Returns all reachable providers with their available models.
|
|
3367
3530
|
*/
|
|
3368
3531
|
declare function discoverLocalProviders(options?: DiscoveryOptions): Promise<DiscoveredProvider[]>;
|
|
3369
|
-
|
|
3370
3532
|
/**
|
|
3371
3533
|
* FallbackRouter — wraps multiple InferenceProviders with automatic failover.
|
|
3372
3534
|
* Routes requests to the highest-priority available provider, falling through
|
|
@@ -3374,7 +3536,6 @@ declare function discoverLocalProviders(options?: DiscoveryOptions): Promise<Dis
|
|
|
3374
3536
|
*
|
|
3375
3537
|
* @implements #114 provider fallback chains with cooldown
|
|
3376
3538
|
*/
|
|
3377
|
-
|
|
3378
3539
|
interface FallbackRouterConfig {
|
|
3379
3540
|
/** Ordered list of providers (highest priority first) */
|
|
3380
3541
|
providers: InferenceProvider[];
|
|
@@ -3393,7 +3554,7 @@ interface CooldownConfig {
|
|
|
3393
3554
|
/** Cooldown for content policy errors — default 0 (immediate retry with next) */
|
|
3394
3555
|
contentPolicy?: number;
|
|
3395
3556
|
}
|
|
3396
|
-
type ErrorCategory = '
|
|
3557
|
+
type ErrorCategory = 'connection_failure' | 'content_policy' | 'context_window' | 'rate_limit' | 'server_error' | 'unknown';
|
|
3397
3558
|
declare function classifyError(error: unknown): ErrorCategory;
|
|
3398
3559
|
interface FallbackEvent {
|
|
3399
3560
|
fromProvider: string;
|
|
@@ -3421,9 +3582,9 @@ declare class FallbackRouter implements InferenceProvider {
|
|
|
3421
3582
|
getAvailableProviders(): InferenceProvider[];
|
|
3422
3583
|
/** Get providers in cooldown with their expiry info */
|
|
3423
3584
|
getCoolingDown(): Array<{
|
|
3424
|
-
providerId: string;
|
|
3425
3585
|
category: ErrorCategory;
|
|
3426
3586
|
expiresAt: number;
|
|
3587
|
+
providerId: string;
|
|
3427
3588
|
}>;
|
|
3428
3589
|
/** Manually clear cooldown for a provider */
|
|
3429
3590
|
clearCooldown(providerId: string): void;
|
|
@@ -3444,7 +3605,6 @@ declare class FallbackRouter implements InferenceProvider {
|
|
|
3444
3605
|
private withFallback;
|
|
3445
3606
|
private applyCooldown;
|
|
3446
3607
|
}
|
|
3447
|
-
|
|
3448
3608
|
interface FortemiBridgeCapabilities {
|
|
3449
3609
|
secureSecrets: boolean;
|
|
3450
3610
|
providerRouting: boolean;
|
|
@@ -3453,14 +3613,14 @@ interface FortemiBridgeCapabilities {
|
|
|
3453
3613
|
}
|
|
3454
3614
|
interface FortemiSecretStore {
|
|
3455
3615
|
isAvailable(): boolean | Promise<boolean>;
|
|
3456
|
-
getSecret(key: string): Promise<
|
|
3616
|
+
getSecret(key: string): Promise<null | string>;
|
|
3457
3617
|
setSecret(key: string, value: string): Promise<void>;
|
|
3458
3618
|
deleteSecret(key: string): Promise<void>;
|
|
3459
3619
|
}
|
|
3460
3620
|
interface BridgeProviderInfo {
|
|
3461
3621
|
id: string;
|
|
3462
3622
|
name: string;
|
|
3463
|
-
tier: '
|
|
3623
|
+
tier: 'chrome-ai' | 'in-browser' | 'local-server' | 'remote';
|
|
3464
3624
|
requiresApiKey: boolean;
|
|
3465
3625
|
capabilities: {
|
|
3466
3626
|
chat?: boolean;
|
|
@@ -3488,8 +3648,7 @@ interface FortemiBridgeHost {
|
|
|
3488
3648
|
declare function getFortemiBridge(host?: FortemiBridgeHost | undefined): FortemiBridge | null;
|
|
3489
3649
|
declare function getFortemiSecretStore(host?: FortemiBridgeHost | undefined): FortemiSecretStore | null;
|
|
3490
3650
|
declare function hasFortemiSecureSecrets(host?: FortemiBridgeHost | undefined): Promise<boolean>;
|
|
3491
|
-
|
|
3492
|
-
type CspDirectiveName = 'default-src' | 'base-uri' | 'object-src' | 'frame-ancestors' | 'img-src' | 'font-src' | 'style-src' | 'script-src' | 'connect-src' | 'worker-src' | 'manifest-src' | 'report-uri';
|
|
3651
|
+
type CspDirectiveName = 'base-uri' | 'connect-src' | 'default-src' | 'font-src' | 'frame-ancestors' | 'img-src' | 'manifest-src' | 'object-src' | 'report-uri' | 'script-src' | 'style-src' | 'worker-src';
|
|
3493
3652
|
type CspDirectives = Partial<Record<CspDirectiveName, string[]>>;
|
|
3494
3653
|
interface PluginCspOptions {
|
|
3495
3654
|
scriptSrc?: string[];
|
|
@@ -3528,14 +3687,13 @@ interface CspViolationReport {
|
|
|
3528
3687
|
raw: unknown;
|
|
3529
3688
|
}
|
|
3530
3689
|
declare function buildPluginCsp(options?: PluginCspOptions): string;
|
|
3531
|
-
declare function computeSri(data:
|
|
3532
|
-
declare function verifySri(data:
|
|
3690
|
+
declare function computeSri(data: ArrayBuffer | Uint8Array, algorithm?: string): Promise<string>;
|
|
3691
|
+
declare function verifySri(data: ArrayBuffer | Uint8Array, integrity: string): Promise<boolean>;
|
|
3533
3692
|
declare function isPluginScriptAllowed(url: string, policy: PluginScriptPolicy): boolean;
|
|
3534
3693
|
declare function fetchPluginScript(descriptor: PluginScriptDescriptor, policy: PluginScriptPolicy, fetchFn?: typeof fetch): Promise<LoadedPluginScript>;
|
|
3535
3694
|
declare function appendPluginScript(descriptor: PluginScriptDescriptor, policy: PluginScriptPolicy, doc?: Document): Promise<HTMLScriptElement>;
|
|
3536
3695
|
declare function parseCspReport(body: unknown): CspViolationReport;
|
|
3537
|
-
declare function createCspReportHandler(onReport: (report: CspViolationReport) => void |
|
|
3538
|
-
|
|
3696
|
+
declare function createCspReportHandler(onReport: (report: CspViolationReport) => Promise<void> | void): (request: Request) => Promise<Response>;
|
|
3539
3697
|
/**
|
|
3540
3698
|
* Knowledge Shard portability profiles derived from the pinned Fortemi receipt.
|
|
3541
3699
|
*
|
|
@@ -3544,21 +3702,25 @@ declare function createCspReportHandler(onReport: (report: CspViolationReport) =
|
|
|
3544
3702
|
* @created 2026-07-17
|
|
3545
3703
|
* @agent Codex
|
|
3546
3704
|
*/
|
|
3547
|
-
|
|
3548
|
-
|
|
3705
|
+
declare const CORE_V1_COMPONENTS: readonly [
|
|
3706
|
+
"notes",
|
|
3707
|
+
"collections",
|
|
3708
|
+
"tags",
|
|
3709
|
+
"templates",
|
|
3710
|
+
"links"
|
|
3711
|
+
];
|
|
3549
3712
|
declare function getKnowledgeShardProfileRegistry(): ShardProfileRegistryEntry[];
|
|
3550
3713
|
interface CreateShardCapabilityReportInput {
|
|
3551
3714
|
backend: ShardBackend;
|
|
3552
3715
|
operation: ShardOperation;
|
|
3553
|
-
requestedProfile:
|
|
3554
|
-
requestedSchemaVersion?:
|
|
3716
|
+
requestedProfile: null | string;
|
|
3717
|
+
requestedSchemaVersion?: null | string;
|
|
3555
3718
|
declaredComponents?: readonly ShardComponent[];
|
|
3556
3719
|
omittedComponents?: readonly ShardComponent[];
|
|
3557
3720
|
losses?: readonly ShardLossEntry[];
|
|
3558
3721
|
}
|
|
3559
3722
|
declare function createShardCapabilityReport(input: CreateShardCapabilityReportInput): ShardCapabilityReport;
|
|
3560
|
-
declare function profileSupportError(report: ShardCapabilityReport):
|
|
3561
|
-
|
|
3723
|
+
declare function profileSupportError(report: ShardCapabilityReport): null | string;
|
|
3562
3724
|
/**
|
|
3563
3725
|
* Minimal tar + gzip packing/unpacking for shard archives.
|
|
3564
3726
|
*
|
|
@@ -3590,7 +3752,6 @@ declare function packTarGz(files: Map<string, Uint8Array>, opts?: {
|
|
|
3590
3752
|
declare function unpackTarGz(data: Uint8Array, opts?: {
|
|
3591
3753
|
maxDecompressedBytes?: number;
|
|
3592
3754
|
}): Map<string, Uint8Array>;
|
|
3593
|
-
|
|
3594
3755
|
/**
|
|
3595
3756
|
* SHA-256 checksum utilities for shard integrity verification.
|
|
3596
3757
|
* Uses the Web Crypto API (browser-native, no extra dependencies).
|
|
@@ -3621,16 +3782,13 @@ declare function sha256Hex(data: Uint8Array): Promise<string>;
|
|
|
3621
3782
|
* @returns Object with `valid` flag and list of failed filenames.
|
|
3622
3783
|
*/
|
|
3623
3784
|
declare function validateChecksums(checksums: Record<string, string>, files: Map<string, Uint8Array>): Promise<{
|
|
3624
|
-
valid: boolean;
|
|
3625
3785
|
failures: string[];
|
|
3786
|
+
valid: boolean;
|
|
3626
3787
|
}>;
|
|
3627
|
-
|
|
3628
3788
|
/** Presence semantics for Knowledge Shard schema 2.0 (Fortemi #1083). */
|
|
3629
|
-
|
|
3630
|
-
type
|
|
3631
|
-
type StoredPresenceState = ShardPresenceState | 'legacy-indeterminate';
|
|
3789
|
+
type ShardPresenceState = 'absent' | 'empty' | 'null' | 'value';
|
|
3790
|
+
type StoredPresenceState = 'legacy-indeterminate' | ShardPresenceState;
|
|
3632
3791
|
type ShardPresenceMap = Record<string, StoredPresenceState>;
|
|
3633
|
-
|
|
3634
3792
|
/**
|
|
3635
3793
|
* Shard export pipeline — query all entities, serialize, pack into .shard archive.
|
|
3636
3794
|
*
|
|
@@ -3642,7 +3800,6 @@ type ShardPresenceMap = Record<string, StoredPresenceState>;
|
|
|
3642
3800
|
* @created 2026-07-17
|
|
3643
3801
|
* @agent Codex
|
|
3644
3802
|
*/
|
|
3645
|
-
|
|
3646
3803
|
declare function exportShardWithReport(db: DatabaseClient, options: ExportOptions & {
|
|
3647
3804
|
profile: string;
|
|
3648
3805
|
}): Promise<ShardExportResult>;
|
|
@@ -3654,7 +3811,6 @@ declare function exportShardWithReport(db: DatabaseClient, options: ExportOption
|
|
|
3654
3811
|
* @returns Compressed shard archive bytes
|
|
3655
3812
|
*/
|
|
3656
3813
|
declare function exportShard(db: DatabaseClient, options?: ExportOptions): Promise<Uint8Array>;
|
|
3657
|
-
|
|
3658
3814
|
/**
|
|
3659
3815
|
* Shard import pipeline — unpack, validate, field-map, transactional insert.
|
|
3660
3816
|
*
|
|
@@ -3666,7 +3822,6 @@ declare function exportShard(db: DatabaseClient, options?: ExportOptions): Promi
|
|
|
3666
3822
|
* @created 2026-07-17
|
|
3667
3823
|
* @agent Codex
|
|
3668
3824
|
*/
|
|
3669
|
-
|
|
3670
3825
|
/**
|
|
3671
3826
|
* Import a .shard archive into the database.
|
|
3672
3827
|
*
|
|
@@ -3678,8 +3833,7 @@ declare function exportShard(db: DatabaseClient, options?: ExportOptions): Promi
|
|
|
3678
3833
|
* @param options Import options (conflict strategy)
|
|
3679
3834
|
* @returns Import result with counts, warnings, and errors
|
|
3680
3835
|
*/
|
|
3681
|
-
declare function importShard(db: DatabaseClient, data:
|
|
3682
|
-
|
|
3836
|
+
declare function importShard(db: DatabaseClient, data: ArrayBuffer | Uint8Array, options?: ImportOptions): Promise<ImportResult>;
|
|
3683
3837
|
interface ShardSchemaValidationResult {
|
|
3684
3838
|
valid: boolean;
|
|
3685
3839
|
errors: string[];
|
|
@@ -3689,13 +3843,12 @@ type CoreV1SchemaVersion = '1.0.0' | '1.1.0' | '1.2.0' | '2.0.0';
|
|
|
3689
3843
|
declare function getKnowledgeShardSchema(): unknown;
|
|
3690
3844
|
declare function getKnowledgeShardContractReceipt(): unknown;
|
|
3691
3845
|
declare function validateShardManifest(value: unknown): ShardSchemaValidationResult;
|
|
3692
|
-
declare function validateShardArchive(input:
|
|
3693
|
-
declare function validateCoreV1ShardArchive(input:
|
|
3694
|
-
declare function validateRecordV1ShardArchive(input:
|
|
3695
|
-
declare function validateFullV1ShardArchive(input:
|
|
3696
|
-
declare function validateShardComponentRecord(component:
|
|
3697
|
-
declare function assertShardComponentRecord(component:
|
|
3698
|
-
|
|
3846
|
+
declare function validateShardArchive(input: ArrayBuffer | ShardFiles | Uint8Array): ShardSchemaValidationResult;
|
|
3847
|
+
declare function validateCoreV1ShardArchive(input: ArrayBuffer | ShardFiles | Uint8Array): Promise<ShardSchemaValidationResult>;
|
|
3848
|
+
declare function validateRecordV1ShardArchive(input: ArrayBuffer | ShardFiles | Uint8Array): Promise<ShardSchemaValidationResult>;
|
|
3849
|
+
declare function validateFullV1ShardArchive(input: ArrayBuffer | ShardFiles | Uint8Array): Promise<ShardSchemaValidationResult>;
|
|
3850
|
+
declare function validateShardComponentRecord(component: 'templates' | ShardComponent, value: unknown, profile?: 'core-v1' | 'full-v1' | 'record-v1', version?: CoreV1SchemaVersion): ShardSchemaValidationResult;
|
|
3851
|
+
declare function assertShardComponentRecord(component: 'templates' | ShardComponent, value: unknown, profile?: 'core-v1' | 'full-v1' | 'record-v1', version?: CoreV1SchemaVersion): void;
|
|
3699
3852
|
/**
|
|
3700
3853
|
* Pluggable semantic providers for the in-place shard reader (issue #189).
|
|
3701
3854
|
*
|
|
@@ -3711,7 +3864,6 @@ declare function assertShardComponentRecord(component: ShardComponent | 'templat
|
|
|
3711
3864
|
* The interface is the extension point; no ANN engine is
|
|
3712
3865
|
* bundled here.
|
|
3713
3866
|
*/
|
|
3714
|
-
|
|
3715
3867
|
/** A note id paired with its embedding vector, as stored in a static vectors file. */
|
|
3716
3868
|
interface VectorEntry {
|
|
3717
3869
|
id: string;
|
|
@@ -3722,7 +3874,7 @@ interface CosineSemanticProviderOptions {
|
|
|
3722
3874
|
* Embeds the query into the SAME space as the corpus vectors. Host-owned so it
|
|
3723
3875
|
* matches the build-time embedding model exactly (sync or async).
|
|
3724
3876
|
*/
|
|
3725
|
-
embedQuery: (query: string) =>
|
|
3877
|
+
embedQuery: (query: string) => number[] | Promise<number[]>;
|
|
3726
3878
|
/**
|
|
3727
3879
|
* JSONL file (one `{ id, vector }` per line) mapping note id → vector, served
|
|
3728
3880
|
* as a static asset alongside the shard. Default `vectors.jsonl`.
|
|
@@ -3738,7 +3890,6 @@ interface CosineSemanticProviderOptions {
|
|
|
3738
3890
|
* `StaticSemanticProvider` instead.
|
|
3739
3891
|
*/
|
|
3740
3892
|
declare function createCosineSemanticProvider(options: CosineSemanticProviderOptions): StaticSemanticProvider;
|
|
3741
|
-
|
|
3742
3893
|
/**
|
|
3743
3894
|
* Shard warm / prefetch API — pre-stage and (optionally) verify shard bytes
|
|
3744
3895
|
* without building the index.
|
|
@@ -3861,7 +4012,6 @@ declare function getPrefetchedSha256(url: string): string | undefined;
|
|
|
3861
4012
|
* you need to evict it.
|
|
3862
4013
|
*/
|
|
3863
4014
|
declare function clearPrefetchedShard(url?: string): void;
|
|
3864
|
-
|
|
3865
4015
|
/**
|
|
3866
4016
|
* Canonical RecordStore contract — the writable structured-record layer that
|
|
3867
4017
|
* exists independently of PGlite (#323, ADR-013 D3).
|
|
@@ -3871,15 +4021,14 @@ declare function clearPrefetchedShard(url?: string): void;
|
|
|
3871
4021
|
* replay of the change journal — rebuildable at any time without touching
|
|
3872
4022
|
* canonical records or attachment bytes.
|
|
3873
4023
|
*/
|
|
3874
|
-
|
|
3875
4024
|
interface PresenceTrackedRecord {
|
|
3876
4025
|
/** Internal schema-2.0 state; never serialized as a shard component field. */
|
|
3877
4026
|
__fortemi_presence?: ShardPresenceMap;
|
|
3878
4027
|
}
|
|
3879
4028
|
interface NoteRecord0 extends PresenceTrackedRecord {
|
|
3880
4029
|
id: string;
|
|
3881
|
-
archive_id:
|
|
3882
|
-
title:
|
|
4030
|
+
archive_id: null | string;
|
|
4031
|
+
title: null | string;
|
|
3883
4032
|
format: string;
|
|
3884
4033
|
source: string;
|
|
3885
4034
|
visibility: string;
|
|
@@ -3889,7 +4038,7 @@ interface NoteRecord0 extends PresenceTrackedRecord {
|
|
|
3889
4038
|
is_archived: boolean;
|
|
3890
4039
|
created_at: string;
|
|
3891
4040
|
updated_at: string;
|
|
3892
|
-
deleted_at:
|
|
4041
|
+
deleted_at: null | string;
|
|
3893
4042
|
}
|
|
3894
4043
|
interface NoteOriginalRecord extends PresenceTrackedRecord {
|
|
3895
4044
|
id: string;
|
|
@@ -3901,10 +4050,10 @@ interface NoteOriginalRecord extends PresenceTrackedRecord {
|
|
|
3901
4050
|
interface NoteRevisedCurrentRecord extends PresenceTrackedRecord {
|
|
3902
4051
|
/** Keyed by note id (mirrors the SQL PK `note_id`). */
|
|
3903
4052
|
id: string;
|
|
3904
|
-
content:
|
|
3905
|
-
ai_metadata:
|
|
4053
|
+
content: null | string;
|
|
4054
|
+
ai_metadata: null | unknown;
|
|
3906
4055
|
generation_count: number;
|
|
3907
|
-
model:
|
|
4056
|
+
model: null | string;
|
|
3908
4057
|
is_user_edited: boolean;
|
|
3909
4058
|
updated_at: string;
|
|
3910
4059
|
}
|
|
@@ -3920,19 +4069,19 @@ interface LinkRecord0 extends PresenceTrackedRecord {
|
|
|
3920
4069
|
target_note_id: string;
|
|
3921
4070
|
link_type: string;
|
|
3922
4071
|
created_at: string;
|
|
3923
|
-
deleted_at:
|
|
4072
|
+
deleted_at: null | string;
|
|
3924
4073
|
/** Exact record-v1 shard metadata; internal projection state, not a domain field. */
|
|
3925
4074
|
__fortemi_shard_metadata?: unknown;
|
|
3926
4075
|
}
|
|
3927
4076
|
interface CollectionRecord extends PresenceTrackedRecord {
|
|
3928
4077
|
id: string;
|
|
3929
4078
|
name: string;
|
|
3930
|
-
description:
|
|
4079
|
+
description: null | string;
|
|
3931
4080
|
/** Omitted only by legacy schema-v1 callers; built-in stores normalize it to null. */
|
|
3932
|
-
parent_id?:
|
|
4081
|
+
parent_id?: null | string;
|
|
3933
4082
|
created_at: string;
|
|
3934
4083
|
updated_at: string;
|
|
3935
|
-
deleted_at:
|
|
4084
|
+
deleted_at: null | string;
|
|
3936
4085
|
}
|
|
3937
4086
|
interface CollectionNoteRecord extends PresenceTrackedRecord {
|
|
3938
4087
|
id: string;
|
|
@@ -3944,16 +4093,16 @@ interface AttachmentRecord extends PresenceTrackedRecord {
|
|
|
3944
4093
|
id: string;
|
|
3945
4094
|
note_id: string;
|
|
3946
4095
|
blob_id: string;
|
|
3947
|
-
document_type_id:
|
|
3948
|
-
mime_type:
|
|
3949
|
-
extracted_text:
|
|
4096
|
+
document_type_id: null | string;
|
|
4097
|
+
mime_type: null | string;
|
|
4098
|
+
extracted_text: null | string;
|
|
3950
4099
|
filename: string;
|
|
3951
|
-
display_name:
|
|
4100
|
+
display_name: null | string;
|
|
3952
4101
|
position: number;
|
|
3953
4102
|
created_at: string;
|
|
3954
|
-
deleted_at:
|
|
4103
|
+
deleted_at: null | string;
|
|
3955
4104
|
/** Exact record-v1 extraction projection state. */
|
|
3956
|
-
__fortemi_extraction_status?: '
|
|
4105
|
+
__fortemi_extraction_status?: 'blocked' | 'deferred' | 'extracted' | 'failed' | 'pending';
|
|
3957
4106
|
__fortemi_extraction_reason?: unknown;
|
|
3958
4107
|
__fortemi_projection_presence?: ShardPresenceMap;
|
|
3959
4108
|
}
|
|
@@ -3967,6 +4116,42 @@ interface ShardManifestRecord extends PresenceTrackedRecord {
|
|
|
3967
4116
|
id: string;
|
|
3968
4117
|
manifest: Record<string, unknown>;
|
|
3969
4118
|
}
|
|
4119
|
+
interface SourceIdentityRecord extends PresenceTrackedRecord {
|
|
4120
|
+
id: string;
|
|
4121
|
+
tenant_id: string;
|
|
4122
|
+
archive_id: null | string;
|
|
4123
|
+
namespace: string;
|
|
4124
|
+
external_id: string;
|
|
4125
|
+
external_id_hash: string;
|
|
4126
|
+
source_schema_version: string;
|
|
4127
|
+
content_digest: string;
|
|
4128
|
+
import_run_id: string;
|
|
4129
|
+
caller_stable_id: null | string;
|
|
4130
|
+
note_id: string;
|
|
4131
|
+
created_at: string;
|
|
4132
|
+
updated_at: string;
|
|
4133
|
+
}
|
|
4134
|
+
interface SourceImportRunRecord extends PresenceTrackedRecord {
|
|
4135
|
+
id: string;
|
|
4136
|
+
tenant_id: string;
|
|
4137
|
+
archive_id: null | string;
|
|
4138
|
+
namespace: string;
|
|
4139
|
+
started_at: string;
|
|
4140
|
+
completed_at: null | string;
|
|
4141
|
+
checkpoint: Record<string, unknown>;
|
|
4142
|
+
receipt: Record<string, unknown>;
|
|
4143
|
+
}
|
|
4144
|
+
interface DeletionReceiptRecord extends PresenceTrackedRecord {
|
|
4145
|
+
id: string;
|
|
4146
|
+
operation_key: string;
|
|
4147
|
+
tenant_id: string;
|
|
4148
|
+
archive_id: null | string;
|
|
4149
|
+
selector_hash: string;
|
|
4150
|
+
outcome: string;
|
|
4151
|
+
counts: Record<string, number>;
|
|
4152
|
+
completed_at: string;
|
|
4153
|
+
policy: Record<string, unknown>;
|
|
4154
|
+
}
|
|
3970
4155
|
/** Collection name → record type. The store is generic over this map. */
|
|
3971
4156
|
interface RecordCollections {
|
|
3972
4157
|
note: NoteRecord0;
|
|
@@ -3979,6 +4164,9 @@ interface RecordCollections {
|
|
|
3979
4164
|
attachment: AttachmentRecord;
|
|
3980
4165
|
attachment_blob: AttachmentBlobRecord;
|
|
3981
4166
|
shard_manifest: ShardManifestRecord;
|
|
4167
|
+
source_identity: SourceIdentityRecord;
|
|
4168
|
+
source_import_run: SourceImportRunRecord;
|
|
4169
|
+
deletion_receipt: DeletionReceiptRecord;
|
|
3982
4170
|
}
|
|
3983
4171
|
type RecordCollectionName = keyof RecordCollections;
|
|
3984
4172
|
declare const RECORD_COLLECTIONS: readonly RecordCollectionName[];
|
|
@@ -3992,7 +4180,7 @@ interface JournalEntry {
|
|
|
3992
4180
|
seq: number;
|
|
3993
4181
|
/** ISO-8601 commit timestamp. */
|
|
3994
4182
|
ts: string;
|
|
3995
|
-
op: '
|
|
4183
|
+
op: 'delete' | 'put';
|
|
3996
4184
|
collection: RecordCollectionName;
|
|
3997
4185
|
id: string;
|
|
3998
4186
|
/** Snapshot for `put`; absent for `delete`. */
|
|
@@ -4010,6 +4198,10 @@ interface RecordStoreCapabilities {
|
|
|
4010
4198
|
atomicBatch?: true;
|
|
4011
4199
|
/** Bounded substring scan over titles/content — not ranked FTS. */
|
|
4012
4200
|
boundedTextScan: true;
|
|
4201
|
+
sourceAddressedUpsert?: true;
|
|
4202
|
+
deletionReceipts?: true;
|
|
4203
|
+
typedMetadataPredicates?: false;
|
|
4204
|
+
evidenceLocators?: true;
|
|
4013
4205
|
fullTextSearch: false;
|
|
4014
4206
|
vectorSearch: false;
|
|
4015
4207
|
sqlJoins: false;
|
|
@@ -4021,14 +4213,14 @@ interface RecordListOptions {
|
|
|
4021
4213
|
}
|
|
4022
4214
|
type RecordMutation = {
|
|
4023
4215
|
[C in RecordCollectionName]: {
|
|
4024
|
-
op: 'put';
|
|
4025
4216
|
collection: C;
|
|
4217
|
+
op: 'put';
|
|
4026
4218
|
record: RecordCollections[C];
|
|
4027
4219
|
};
|
|
4028
4220
|
}[RecordCollectionName] | {
|
|
4029
|
-
op: 'delete';
|
|
4030
4221
|
collection: RecordCollectionName;
|
|
4031
4222
|
id: string;
|
|
4223
|
+
op: 'delete';
|
|
4032
4224
|
};
|
|
4033
4225
|
/**
|
|
4034
4226
|
* The writable canonical structured-record store. Implementations MUST make
|
|
@@ -4037,7 +4229,7 @@ type RecordMutation = {
|
|
|
4037
4229
|
* neither, never one without the other.
|
|
4038
4230
|
*/
|
|
4039
4231
|
interface RecordStore {
|
|
4040
|
-
get<C extends RecordCollectionName>(collection: C, id: string): Promise<RecordCollections[C]
|
|
4232
|
+
get<C extends RecordCollectionName>(collection: C, id: string): Promise<null | RecordCollections[C]>;
|
|
4041
4233
|
/** Insert or replace one record, journaled atomically. */
|
|
4042
4234
|
put<C extends RecordCollectionName>(collection: C, record: RecordCollections[C]): Promise<JournalEntry>;
|
|
4043
4235
|
/** Hard-remove one record, journaled atomically (soft-delete is a field upstream). */
|
|
@@ -4056,19 +4248,17 @@ interface RecordStore {
|
|
|
4056
4248
|
readonly capabilities: RecordStoreCapabilities;
|
|
4057
4249
|
close(): Promise<void>;
|
|
4058
4250
|
}
|
|
4059
|
-
|
|
4060
4251
|
/**
|
|
4061
4252
|
* In-memory RecordStore — the test/SSR tier of the canonical record layer.
|
|
4062
4253
|
* Same commit semantics as the durable store: record + journal move together.
|
|
4063
4254
|
*/
|
|
4064
|
-
|
|
4065
4255
|
declare class MemoryRecordStore implements RecordStore {
|
|
4066
4256
|
readonly capabilities: RecordStoreCapabilities;
|
|
4067
4257
|
private collections;
|
|
4068
4258
|
private journal;
|
|
4069
4259
|
private seq;
|
|
4070
4260
|
private table;
|
|
4071
|
-
get<C extends RecordCollectionName>(collection: C, id: string): Promise<RecordCollections[C]
|
|
4261
|
+
get<C extends RecordCollectionName>(collection: C, id: string): Promise<null | RecordCollections[C]>;
|
|
4072
4262
|
put<C extends RecordCollectionName>(collection: C, record: RecordCollections[C]): Promise<JournalEntry>;
|
|
4073
4263
|
remove(collection: RecordCollectionName, id: string): Promise<JournalEntry>;
|
|
4074
4264
|
applyBatch(mutations: readonly RecordMutation[]): Promise<JournalEntry[]>;
|
|
@@ -4077,7 +4267,6 @@ declare class MemoryRecordStore implements RecordStore {
|
|
|
4077
4267
|
headSeq(): Promise<number>;
|
|
4078
4268
|
close(): Promise<void>;
|
|
4079
4269
|
}
|
|
4080
|
-
|
|
4081
4270
|
/**
|
|
4082
4271
|
* Durable canonical RecordStore over IndexedDB (#323, ADR-013 D3).
|
|
4083
4272
|
*
|
|
@@ -4095,7 +4284,6 @@ declare class MemoryRecordStore implements RecordStore {
|
|
|
4095
4284
|
* database structure grows. Additive-only, mirroring the SQL migration
|
|
4096
4285
|
* discipline.
|
|
4097
4286
|
*/
|
|
4098
|
-
|
|
4099
4287
|
/** Logical record-schema version stored in `meta` (independent of DB_VERSION). */
|
|
4100
4288
|
declare const RECORD_SCHEMA_VERSION = 2;
|
|
4101
4289
|
interface CreateRecordStoreOptions {
|
|
@@ -4108,7 +4296,7 @@ declare class IdbRecordStore implements RecordStore {
|
|
|
4108
4296
|
private constructor();
|
|
4109
4297
|
static open(archiveName: string, options?: CreateRecordStoreOptions): Promise<IdbRecordStore>;
|
|
4110
4298
|
private ensureSchemaVersion;
|
|
4111
|
-
get<C extends RecordCollectionName>(collection: C, id: string): Promise<RecordCollections[C]
|
|
4299
|
+
get<C extends RecordCollectionName>(collection: C, id: string): Promise<null | RecordCollections[C]>;
|
|
4112
4300
|
put<C extends RecordCollectionName>(collection: C, record: RecordCollections[C]): Promise<JournalEntry>;
|
|
4113
4301
|
remove(collection: RecordCollectionName, id: string): Promise<JournalEntry>;
|
|
4114
4302
|
applyBatch(mutations: readonly RecordMutation[]): Promise<JournalEntry[]>;
|
|
@@ -4119,7 +4307,6 @@ declare class IdbRecordStore implements RecordStore {
|
|
|
4119
4307
|
}
|
|
4120
4308
|
/** Open the durable canonical record store for one archive namespace. */
|
|
4121
4309
|
declare function createRecordStore(archiveName: string, options?: CreateRecordStoreOptions): Promise<IdbRecordStore>;
|
|
4122
|
-
|
|
4123
4310
|
/**
|
|
4124
4311
|
* Canonical notes repository — DB-free note/tag/link/collection workflows
|
|
4125
4312
|
* over the RecordStore (#323). Mirrors the SQL repositories' semantics
|
|
@@ -4130,7 +4317,6 @@ declare function createRecordStore(archiveName: string, options?: CreateRecordSt
|
|
|
4130
4317
|
* text scan. Ranked FTS, vectors, and complex joins are explicitly NOT
|
|
4131
4318
|
* served here — `store.capabilities` reports the boundary (ADR-013 D3).
|
|
4132
4319
|
*/
|
|
4133
|
-
|
|
4134
4320
|
interface CanonicalNoteCreateInput {
|
|
4135
4321
|
id?: string;
|
|
4136
4322
|
title?: string;
|
|
@@ -4177,11 +4363,10 @@ declare class CanonicalNotesRepository {
|
|
|
4177
4363
|
softDeleteLink(linkId: string): Promise<void>;
|
|
4178
4364
|
/** Active links touching a note (either direction). */
|
|
4179
4365
|
linksOf(noteId: string): Promise<LinkRecord0[]>;
|
|
4180
|
-
createCollection(name: string, description?: string, parentId?:
|
|
4366
|
+
createCollection(name: string, description?: string, parentId?: null | string): Promise<CollectionRecord>;
|
|
4181
4367
|
addNoteToCollection(collectionId: string, noteId: string): Promise<void>;
|
|
4182
4368
|
notesInCollection(collectionId: string): Promise<NoteRecord0[]>;
|
|
4183
4369
|
}
|
|
4184
|
-
|
|
4185
4370
|
/**
|
|
4186
4371
|
* Canonical attachments repository — DB-free attachment manifests over the
|
|
4187
4372
|
* RecordStore, bytes through the Bytecask BlobStore (#323, ADR-013 D2/D4/D5).
|
|
@@ -4191,7 +4376,6 @@ declare class CanonicalNotesRepository {
|
|
|
4191
4376
|
* bytes inline; the manifest-derived live set drives reconcile/gc; missing
|
|
4192
4377
|
* bytes are the recoverable reference-only state.
|
|
4193
4378
|
*/
|
|
4194
|
-
|
|
4195
4379
|
interface CanonicalAttachInput {
|
|
4196
4380
|
noteId: string;
|
|
4197
4381
|
data: Uint8Array;
|
|
@@ -4208,7 +4392,7 @@ declare class CanonicalAttachmentsRepository {
|
|
|
4208
4392
|
attach(input: CanonicalAttachInput): Promise<AttachmentRecord>;
|
|
4209
4393
|
get(id: string): Promise<AttachmentRecord>;
|
|
4210
4394
|
/** Null when bytes are absent — the recoverable reference-only state. */
|
|
4211
|
-
getBlob(attachmentId: string): Promise<
|
|
4395
|
+
getBlob(attachmentId: string): Promise<null | Uint8Array>;
|
|
4212
4396
|
hasBlob(attachmentId: string): Promise<boolean>;
|
|
4213
4397
|
list(noteId: string): Promise<AttachmentRecord[]>;
|
|
4214
4398
|
/** Soft-delete the manifest; bytes are only swept via reconcile/gc. */
|
|
@@ -4221,7 +4405,6 @@ declare class CanonicalAttachmentsRepository {
|
|
|
4221
4405
|
gcBlobs(opts?: BlobGcOptions): Promise<BlobGcResult>;
|
|
4222
4406
|
private checksumOf;
|
|
4223
4407
|
}
|
|
4224
|
-
|
|
4225
4408
|
/**
|
|
4226
4409
|
* PGlite attachment projection (#320, ADR-013 D3).
|
|
4227
4410
|
*
|
|
@@ -4237,7 +4420,6 @@ declare class CanonicalAttachmentsRepository {
|
|
|
4237
4420
|
* and no trigger touches it.
|
|
4238
4421
|
* - Bytes never enter PGlite; only metadata is projected.
|
|
4239
4422
|
*/
|
|
4240
|
-
|
|
4241
4423
|
interface AttachmentProjectionResult {
|
|
4242
4424
|
blobs: number;
|
|
4243
4425
|
attachments: number;
|
|
@@ -4258,7 +4440,6 @@ declare function projectAttachments(db: DatabaseClient, store: RecordStore): Pro
|
|
|
4258
4440
|
* dropped and rebuilt" invariant made executable.
|
|
4259
4441
|
*/
|
|
4260
4442
|
declare function dropAttachmentProjection(db: DatabaseClient): Promise<void>;
|
|
4261
|
-
|
|
4262
4443
|
/**
|
|
4263
4444
|
* PGlite record projection — notes tier (#323 cycle 2, ADR-013 D3).
|
|
4264
4445
|
*
|
|
@@ -4276,7 +4457,6 @@ declare function dropAttachmentProjection(db: DatabaseClient): Promise<void>;
|
|
|
4276
4457
|
* - Bytes never enter PGlite; `projectRecords` composes this pass with the
|
|
4277
4458
|
* attachment projection for a full canonical → PGlite rebuild.
|
|
4278
4459
|
*/
|
|
4279
|
-
|
|
4280
4460
|
interface NoteProjectionResult {
|
|
4281
4461
|
notes: number;
|
|
4282
4462
|
tags: number;
|
|
@@ -4307,7 +4487,6 @@ declare function projectRecords(db: DatabaseClient, store: RecordStore): Promise
|
|
|
4307
4487
|
* created outside the canonical tier) so FKs allow the deletes.
|
|
4308
4488
|
*/
|
|
4309
4489
|
declare function dropNoteProjection(db: DatabaseClient): Promise<void>;
|
|
4310
|
-
|
|
4311
4490
|
/**
|
|
4312
4491
|
* Writable non-PGlite `DataBackend` over the canonical RecordStore
|
|
4313
4492
|
* (#323 cycle 2, ADR-013 D3) — the record tier in the backend seam.
|
|
@@ -4324,7 +4503,6 @@ declare function dropNoteProjection(db: DatabaseClient): Promise<void>;
|
|
|
4324
4503
|
* optional methods rather than receiving silently empty emulations.
|
|
4325
4504
|
* `merge: true` is served by `importShardToRecords` (record-shard.ts).
|
|
4326
4505
|
*/
|
|
4327
|
-
|
|
4328
4506
|
interface RecordBackendOptions {
|
|
4329
4507
|
id?: string;
|
|
4330
4508
|
}
|
|
@@ -4340,7 +4518,6 @@ interface RecordBackendManageNoteResult {
|
|
|
4340
4518
|
* archive / unarchive / star / unstar).
|
|
4341
4519
|
*/
|
|
4342
4520
|
declare function createRecordBackend(store: RecordStore, options?: RecordBackendOptions): DataBackend;
|
|
4343
|
-
|
|
4344
4521
|
/**
|
|
4345
4522
|
* DB-free Knowledge Shard export/import over the canonical RecordStore
|
|
4346
4523
|
* (#323 cycle 2, ADR-013 D3/D6) — the same `.shard` archive format as the
|
|
@@ -4363,7 +4540,6 @@ declare function createRecordBackend(store: RecordStore, options?: RecordBackend
|
|
|
4363
4540
|
* @created 2026-07-17
|
|
4364
4541
|
* @agent Codex
|
|
4365
4542
|
*/
|
|
4366
|
-
|
|
4367
4543
|
declare function exportShardFromRecordsWithReport(store: RecordStore, options: ExportOptions & {
|
|
4368
4544
|
profile: string;
|
|
4369
4545
|
}): Promise<ShardExportResult>;
|
|
@@ -4385,14 +4561,15 @@ declare function exportShardFromRecords(store: RecordStore, options?: ExportOpti
|
|
|
4385
4561
|
* `blobStore`. Components the canonical tier cannot persist are skipped with
|
|
4386
4562
|
* explicit warnings and reported under `skipped`.
|
|
4387
4563
|
*/
|
|
4388
|
-
declare function importShardToRecords(store: RecordStore, data:
|
|
4389
|
-
|
|
4564
|
+
declare function importShardToRecords(store: RecordStore, data: ArrayBuffer | Uint8Array, options?: ImportOptions): Promise<ImportResult>;
|
|
4565
|
+
declare function upsertRecordStoreSources(store: RecordStore, items: readonly SourceUpsertItem[], options?: SourceUpsertOptions): Promise<SourceUpsertBatchResult>;
|
|
4566
|
+
declare function previewRecordStorePurge(store: RecordStore, selector: PurgeSelector): Promise<PurgePreview>;
|
|
4567
|
+
declare function purgeRecordStoreGraph(store: RecordStore, selector: PurgeSelector, operationKey: string): Promise<DeletionReceipt>;
|
|
4390
4568
|
/**
|
|
4391
4569
|
* @implements @.aiwg/adrs/ADR-011-shard-server-conformance-and-version-negotiation.md
|
|
4392
4570
|
* @source @packages/core/src/shard/schema-validator.ts
|
|
4393
4571
|
* @created 2026-07-17
|
|
4394
4572
|
* @agent Codex
|
|
4395
4573
|
*/
|
|
4396
|
-
declare const VERSION = "2026.
|
|
4397
|
-
|
|
4398
|
-
export { type ArchiveInfo, ArchiveManager, type AttachInput, type AttachmentBlobRecord, type AttachmentBlobRow, type AttachmentProjectionResult, type AttachmentRecord, type AttachmentRow, AttachmentsRepository, type BackendCandidate, type BackendCapabilities, type BackendConcept, type BackendLink, type BackendListOptions, type BackendNote, type BackendNoteFull, type BackendProvenanceEdge, type BackendRequest, type BackendSearchHit, type BackendSearchQueryOptions, type BackendSearchResult, type BackendSelection, type BackendSemanticTier, type BackendStartupCost, BlobGcOptions, BlobGcResult, BlobReconcileOptions, BlobReconcileResult, BlobStore, type BridgeCapability, type BridgeProviderInfo, type BrowserNoteExport, CORE_V1_COMPONENTS, CURRENT_MIGRATION_HEAD, type CanonicalAttachInput, CanonicalAttachmentsRepository, type CanonicalNoteCreateInput, type CanonicalNoteUpdateInput, type CanonicalNoteView, CanonicalNotesRepository, type CapabilityInfo, CapabilityManager, type CapabilityName, type CapabilityState, type CaptureKnowledgeInput, CaptureKnowledgeInputSchema, type CaptureKnowledgeResult, type CollectionCreateInput, type CollectionNoteRecord, type CollectionRecord, type CollectionRow, CollectionsRepository, CommunitiesRepository, type CommunityAssignmentView, type CommunityCreateInput, type CommunityFilterDefinition, type CommunityGraph, type CommunityOptions, type CommunitySourceDescriptor, type CommunitySourceType, type CommunitySummary, type CompletionRequest, type CompletionResponse, type ConditionResult, type CooldownConfig, type CooldownEvent, type CosineSemanticProviderOptions, type CreatePGliteOptions, type CreateRecordStoreOptions, type CspDirectiveName, type CspDirectives, type CspViolationReport, DB_SNAPSHOT_SCHEMA_VERSION, type DataBackend, type DatabaseClient, type DbSnapshot, type DbSnapshotCompat, type DbSnapshotCompression, type DbSnapshotExpectations, type DbSnapshotMeta, type DbSnapshotSource, DbSnapshotVersionError, type DiscoveredProvider, type DiscoveryOptions, type DumpDbSnapshotOptions, type DumpableDb, EMBED_REQUEST_KIND, EMBED_RESPONSE_KIND, type EmbedFunction, type EmbedRequest, type EmbedRequestMessage, type EmbedResponse, type EmbedResponseMessage, type EmbedTransportPort, type EmbedWorkerOptions, type EmbeddingCompatibilityPolicy, type EmbeddingSetCreateInput, type EmbeddingSetCriteria, type EmbeddingSetDescriptor, type EmbeddingSetEmbeddingInput, type EmbeddingSetFreshness, type EmbeddingSetKind, type EmbeddingSetMode, type EmbeddingSetRow, type EmbeddingSetSelector, EmbeddingSetsRepository, type EnqueueJobInput, type ErrorCategory, type EventMap, ExportOptions, FORTEMI_COMPATIBILITY_PATH, FORTEMI_COMPATIBILITY_STATES, FORTEMI_REQUIRED_COMPATIBILITY_CAPABILITIES, type FallbackEvent, FallbackRouter, type FallbackRouterConfig, type FetchFortemiCompatibilityOptions, type FortemiBridge, type FortemiBridgeCapabilities, type FortemiBridgeHost, type FortemiCompatibilityCapability, type FortemiCompatibilityResponse, type FortemiCompatibilityState, type FortemiCompatibilityValidationResult, type FortemiConfig, type FortemiCore, type FortemiInferenceRouter, type FortemiRequiredCompatibilityCapability, type FortemiSecretStore, type FortemiToolDefinition, FortemiToolManifest, type GetNoteInput, GetNoteInputSchema, type GpuCapabilities, type GraphCommunity, type GraphEdge, type GraphNode, GraphRepository, type IDisposable, IdbRecordStore, ImportOptions, ImportResult, type InferenceCapabilities, type InferenceProvider, JOB_CAPABILITIES, JOB_PRIORITIES, type JobQueueOptions, JobQueueWorker, type JobStatus, type JobType, type JournalEntry, LOCAL_ENDPOINTS, type LegacyMigrationReport, type LinkRecord0, type LinkRow, LinksRepository, type ListNotesInput, ListNotesInputSchema, type LlmCapabilityOptions, type LlmCompleteFn, type LoadedPluginScript, type LocalEndpoint, type ManageArchiveInput, ManageArchiveInputSchema, type ManageArchiveResult, type ManageAttachmentsInput, ManageAttachmentsInputSchema, type ManageAttachmentsResult, type ManageCapabilitiesInput, ManageCapabilitiesInputSchema, type ManageCapabilitiesResult, type ManageCollectionsInput, ManageCollectionsInputSchema, type ManageCollectionsResult, type ManageLinksInput, ManageLinksInputSchema, type ManageLinksResult, type ManageNoteInput, ManageNoteInputSchema, type ManageNoteResult, type ManageTagsInput, ManageTagsInputSchema, type ManageTagsResult, MemoryRecordStore, type Migration, MigrationRunner, type ModelCategory, type ModelFitResult, type ModelInfo, type NoteCreateInput, type NoteFull, type NoteListOptions, type NoteOriginalRecord, type NoteProjectionResult, type NoteRecord0, type NoteRevisedCurrentRecord, type NoteRevision, type NoteSkosTag, type NoteSummary, type NoteTagRecord, type NoteUpdateInput, NotesRepository, OpenAICompatibleProvider, type OpenAIProviderConfig, type OpenShardOptions, type PGliteBackendOptions, PGliteStorageBackend, PGliteStorageBackendFactory, PGliteWorkerClient, PGliteWorkerStorageBackend, PGliteWorkerStorageBackendFactory, type PGliteWorkerStorageBackendFactoryOptions, type PaginatedResult, type PersistenceMode, type PluginCspOptions, type PluginScriptDescriptor, type PluginScriptPolicy, type PrefetchOptions, type PrefetchResult, type PresenceTrackedRecord, type ProbeResult, type ProbeStatus, type ProvenanceEdge, ProvenanceRepository, type ProviderCapabilities, ProviderRegistry, type ProviderTier, type QueryExecutor, type QueryResult, RECORD_COLLECTIONS, RECORD_SCHEMA_VERSION, RECORD_STORE_CAPABILITIES, type RecommendedTier, type RecordBackendManageNoteResult, type RecordBackendOptions, type RecordCollectionName, type RecordCollections, type RecordListOptions, type RecordMutation, type RecordProjectionResult, type RecordProvenanceInput, type RecordStore, type RecordStoreCapabilities, type RemoteBackendConfig, type RemoteBackendPaths, type ResolvedEmbeddingRow, type ResolvedEmbeddingSet, type RestoreDbSnapshotOptions, type RouteHandler, SUPPORTED_PGLITE_VERSION, type SWRegistrationResult, type SearchFacets, type SearchInput, SearchInputSchema, type SearchOptions, SearchRepository, type SearchResponse, type SearchResult, ShardBackend, type ShardBackendOptions, ShardCapabilityReport, ShardCollection, ShardComponent, type ShardComponentStore, ShardEmbedding, ShardEmbeddingConfig, ShardEmbeddingSet, ShardEmbeddingSetMember, ShardExportResult, ShardLink, type ShardListOptions, ShardLossEntry, ShardManifest, ShardNote, type ShardNoteFull, ShardNoteSkosTag, ShardOperation, ShardProfileRegistryEntry, ShardProvenanceEdge, type ShardReader, type ShardReaderNote, type ShardReaderSource, type ShardSchemaValidationResult, type ShardSearchOptions, type ShardSearchRankedNote, type ShardSearchResult, type ShardSearchWeights, ShardSkosConcept, ShardSkosRelation, ShardSkosScheme, ShardTag, ShardTemplate, type SimilarityGraphCacheKey, type SimilarityGraphOptions, type SimilarityGraphRequest, type SimilarityGraphResult, type SkosConcept, type SkosRelation, SkosRepository, type SkosScheme, type StaticSemanticProvider, type StorageBackend, type StorageBackendFactory, type StorageOpenRequest, type StorageTopology, type StreamChunk, TagsRepository, TransactionProxy, TypedEventBus, VERSION, type VectorEntry, type VirtualEmbeddingSetDefinition, type VirtualEmbeddingSetSource, type VirtualEmbeddingSetValidationError, type VirtualMaterializationPolicy, type VramTier, type WorkerRequest, type WorkerResponse, aiRevisionHandler, allMigrations, appendPluginScript, assertShardComponentRecord, buildNoteConditions, buildPluginCsp, captureKnowledge, chunkText, classifyError, classifyModel, clearPrefetchedShard, collectionFromShard, collectionToShard, computeBlobHash, computeHash, computeSri, conceptTaggingHandler, cosineSimilarity, createCosineSemanticProvider, createCspReportHandler, createFortemi, createLegacyProvider, createPGliteBackend, createPGliteInstance, createRecordBackend, createRecordStore, createRemoteBackend, createRoutes, createShardBackend, createShardCapabilityReport, createWorkerEmbedFunction, defaultStorageBackendFactory, detectCommunities, detectGpuCapabilities, detectInferenceCapabilities, discoverLocalProviders, dropAttachmentProjection, dropNoteProjection, dumpDbSnapshot, embeddingConfigToShard, embeddingFromShard, embeddingGenerationHandler, embeddingSetFromShard, embeddingSetMemberToShard, embeddingSetToShard, embeddingToShard, enqueueFullWorkflow, enqueueJob, enqueueNoteCreationJobs, estimateModelFit, estimateVramMB, estimateVramTier, exportShard, exportShardFromRecords, exportShardFromRecordsWithReport, exportShardWithReport, fetchAndValidateFortemiCompatibility, fetchPluginScript, formatFortemiCompatibilitySummary, fortemiCompatibilityUrl, fortemiManifest, fromPrefetched, generateId, getEmbedFunction, getFortemiBridge, getFortemiSecretStore, getJobQueueStatus, getKnowledgeShardContractReceipt, getKnowledgeShardProfileRegistry, getKnowledgeShardSchema, getLlmFunction, getNote, getPrefetchedSha256, handleEmbedRequests, hasFortemiSecureSecrets, importShard, importShardToRecords, isPluginScriptAllowed, isShardPrefetched, linkFromShard, linkToShard, linkingHandler, listNotes, manageArchive, manageAttachments, manageCapabilities, manageCollections, manageLinks, manageNote, manageTags, matchRoute, migrateLegacyBlobStore, noteFromShard, noteSkosTagToShard, noteToShard, openShard, packTarGz, parseCspReport, prefetchShard, profileSupportError, projectAttachments, projectNotes, projectRecords, provenanceEdgeToShard, registerLlmCapability, registerSemanticCapability, registerSemanticCapabilityWorker, registerServiceWorker, restoreDbSnapshot, searchTool, selectBackend, selectLlmModel, setEmbedFunction, setLlmFunction, sha256Hex, skosConceptToShard, skosRelationToShard, skosSchemeToShard, suggestTags, tagsToShard, templateToShard, titleGenerationHandler, unpackTarGz, unregisterLlmCapability, unregisterSemanticCapability, urlLinkToShard, validateChecksums, validateCoreV1ShardArchive, validateFortemiCompatibilityResponse, validateFullV1ShardArchive, validateRecordV1ShardArchive, validateShardArchive, validateShardComponentRecord, validateShardManifest, verifyDbSnapshotMeta, verifySri };
|
|
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 };
|