@fortemi/core 2026.7.11 → 2026.7.13
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 +52 -2
- package/dist/aiwg-index-shard-BhF8kKAU.d.ts +1210 -0
- package/dist/aiwg-index-shard.d.ts +2 -0
- package/dist/aiwg-index-shard.js +9999 -0
- package/dist/aiwg-index-shard.js.map +1 -0
- package/dist/aiwg-index.d.ts +16 -55
- package/dist/aiwg-index.js +11 -20
- package/dist/aiwg-index.js.map +1 -1
- package/dist/index.d.ts +59 -1188
- package/dist/index.js +16831 -2471
- package/dist/index.js.map +1 -1
- package/package.json +9 -2
|
@@ -0,0 +1,1210 @@
|
|
|
1
|
+
import { ProbeReport } from '@bytecask/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Content-addressed attachment-byte storage — the Fortemi `BlobStore` seam.
|
|
5
|
+
*
|
|
6
|
+
* The store computes the key: `put(bytes)` BLAKE3-hashes the payload and
|
|
7
|
+
* returns the canonical checksum encoding `blake3:<64-char lowercase hex>`
|
|
8
|
+
* (server convention; ADR-012 D1/D3). Every method at this seam speaks that
|
|
9
|
+
* canonical encoding — the bare-hex ⇄ prefixed conversions live in
|
|
10
|
+
* `shard/blob-sidecar.ts` helpers and inside the bytecask adapter here, and
|
|
11
|
+
* nowhere else.
|
|
12
|
+
*
|
|
13
|
+
* Lifecycle authority (ADR-013 D2): canonical attachment manifests decide
|
|
14
|
+
* which bytes are live. `reconcile(liveChecksums)` hands that authoritative
|
|
15
|
+
* set to the store; `gc()` physically removes only unreferenced,
|
|
16
|
+
* age-thresholded objects. Internal refcounts are an implementation detail,
|
|
17
|
+
* never a source of truth.
|
|
18
|
+
*
|
|
19
|
+
* Implementations:
|
|
20
|
+
* - `createBlobStore()` — `@bytecask/core` behind a dynamic import
|
|
21
|
+
* (IndexedDB tier by default, OPFS opt-in, memory fallback). Zero bundle
|
|
22
|
+
* cost until the first byte operation (ADR-012 D6).
|
|
23
|
+
* - `createLazyBlobStore()` — synchronous facade that defers the dynamic
|
|
24
|
+
* import until the first method call (what `FortemiProvider` wires).
|
|
25
|
+
* - `MemoryBlobStore` — dependency-free in-process implementation for
|
|
26
|
+
* tests and the no-persistence tier.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
type BlobBackendKind = 'idb' | 'opfs' | 'memory';
|
|
30
|
+
interface BlobStoreDiagnostics {
|
|
31
|
+
/** The storage tier actually serving bytes. */
|
|
32
|
+
backend: BlobBackendKind;
|
|
33
|
+
/** Tier-probe outcome from `@bytecask/core` (null for memory/test stores). */
|
|
34
|
+
probe: ProbeReport | null;
|
|
35
|
+
}
|
|
36
|
+
interface BlobReconcileOptions {
|
|
37
|
+
/** Physically remove unreferenced objects now instead of leaving them for gc(). */
|
|
38
|
+
removeUnreferenced?: boolean;
|
|
39
|
+
}
|
|
40
|
+
interface BlobReconcileResult {
|
|
41
|
+
/** Live checksums whose bytes are present. */
|
|
42
|
+
referenced: number;
|
|
43
|
+
/** Live checksums whose bytes are absent — the reference-only set. */
|
|
44
|
+
missing: string[];
|
|
45
|
+
/** Stored checksums not in the live set — GC candidates. */
|
|
46
|
+
unreferenced: string[];
|
|
47
|
+
/** Objects physically removed (only when `removeUnreferenced`). */
|
|
48
|
+
removed: number;
|
|
49
|
+
bytesFreed: number;
|
|
50
|
+
}
|
|
51
|
+
interface BlobGcOptions {
|
|
52
|
+
/** Collect only unreferenced objects at least this old (ms). Default 0. */
|
|
53
|
+
minAgeMs?: number;
|
|
54
|
+
}
|
|
55
|
+
interface BlobGcResult {
|
|
56
|
+
collected: number;
|
|
57
|
+
bytesFreed: number;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The Fortemi attachment-byte seam. All checksums are the canonical
|
|
61
|
+
* `blake3:<hex>` encoding stored in `attachment_blob.content_hash` and shard
|
|
62
|
+
* projection records.
|
|
63
|
+
*/
|
|
64
|
+
interface BlobStore {
|
|
65
|
+
/** Store bytes, return their canonical checksum. Idempotent (content-addressed). */
|
|
66
|
+
put(bytes: Uint8Array): Promise<string>;
|
|
67
|
+
/** Fetch bytes by canonical checksum; null when absent (reference-only). */
|
|
68
|
+
read(checksum: string): Promise<Uint8Array | null>;
|
|
69
|
+
/** True when the bytes for this checksum are physically present. */
|
|
70
|
+
has(checksum: string): Promise<boolean>;
|
|
71
|
+
/**
|
|
72
|
+
* Physically remove one checksum. Import staging uses this only to roll back
|
|
73
|
+
* content that was absent before promotion.
|
|
74
|
+
*/
|
|
75
|
+
delete?(checksum: string): Promise<boolean>;
|
|
76
|
+
/**
|
|
77
|
+
* Reconcile stored bytes against the authoritative live-checksum set
|
|
78
|
+
* derived from canonical attachment manifests (ADR-013 D4).
|
|
79
|
+
*/
|
|
80
|
+
reconcile(liveChecksums: Iterable<string>, opts?: BlobReconcileOptions): Promise<BlobReconcileResult>;
|
|
81
|
+
/** Physically remove unreferenced, age-thresholded objects. */
|
|
82
|
+
gc(opts?: BlobGcOptions): Promise<BlobGcResult>;
|
|
83
|
+
/** Selected backend + probe report, for capability/diagnostic surfaces. */
|
|
84
|
+
diagnostics(): Promise<BlobStoreDiagnostics>;
|
|
85
|
+
close(): Promise<void>;
|
|
86
|
+
}
|
|
87
|
+
declare class MemoryBlobStore implements BlobStore {
|
|
88
|
+
private now;
|
|
89
|
+
private entries;
|
|
90
|
+
constructor(now?: () => number);
|
|
91
|
+
put(bytes: Uint8Array): Promise<string>;
|
|
92
|
+
read(checksum: string): Promise<Uint8Array | null>;
|
|
93
|
+
has(checksum: string): Promise<boolean>;
|
|
94
|
+
delete(checksum: string): Promise<boolean>;
|
|
95
|
+
reconcile(liveChecksums: Iterable<string>, opts?: BlobReconcileOptions): Promise<BlobReconcileResult>;
|
|
96
|
+
gc(opts?: BlobGcOptions): Promise<BlobGcResult>;
|
|
97
|
+
diagnostics(): Promise<BlobStoreDiagnostics>;
|
|
98
|
+
close(): Promise<void>;
|
|
99
|
+
}
|
|
100
|
+
interface CreateBlobStoreOptions {
|
|
101
|
+
/** Force a tier; omit to probe IndexedDB → OPFS → memory (measured default). */
|
|
102
|
+
backend?: BlobBackendKind;
|
|
103
|
+
/** Injectable IDBFactory for tests (fake-indexeddb). Defaults to the global. */
|
|
104
|
+
indexedDB?: IDBFactory;
|
|
105
|
+
/** Skip the one-shot migration of the pre-bytecask blob layout. */
|
|
106
|
+
migrateLegacy?: boolean;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Construct the bytecask-backed BlobStore for one archive namespace.
|
|
110
|
+
*
|
|
111
|
+
* `@bytecask/core` is reached only through a dynamic `import()` here, so
|
|
112
|
+
* hosts that never touch attachment bytes never load it. The namespace is a
|
|
113
|
+
* function of `archiveName` alone — identical in DB-free and PGlite modes.
|
|
114
|
+
*
|
|
115
|
+
* Tiering: IndexedDB by default (measured default per bytecask's C3
|
|
116
|
+
* benchmark), memory fallback when IndexedDB is unavailable. The OPFS opt-in
|
|
117
|
+
* tier arrives with the upstream `createBlobStore()` factory switch
|
|
118
|
+
* (`@bytecask/core` 2026.7.2); requesting it now fails loudly rather than
|
|
119
|
+
* silently falling back.
|
|
120
|
+
*/
|
|
121
|
+
declare function createBlobStore(archiveName: string, options?: CreateBlobStoreOptions): Promise<BlobStore>;
|
|
122
|
+
/**
|
|
123
|
+
* Synchronous facade over {@link createBlobStore}: construction is free, the
|
|
124
|
+
* dynamic import happens on the first byte operation. This is what
|
|
125
|
+
* `FortemiProvider` wires so hosts that never touch attachment bytes never
|
|
126
|
+
* pay for the substrate (ADR-012 D6).
|
|
127
|
+
*/
|
|
128
|
+
declare function createLazyBlobStore(archiveName: string, options?: CreateBlobStoreOptions): BlobStore;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Signed Knowledge-Shard verification (#324, ADR-014).
|
|
132
|
+
*
|
|
133
|
+
* Authenticity — as distinct from the consistency the in-archive checksums
|
|
134
|
+
* provide (SEC7) — comes from an Ed25519 signature over a canonical payload
|
|
135
|
+
* that commits to the manifest digest and the referenced blob-byte digests.
|
|
136
|
+
* Verification is pure and side-effect-free; it runs BEFORE any record or
|
|
137
|
+
* blob mutation (ADR-013 D6 / ADR-014 D3). Bytecask never sees keys.
|
|
138
|
+
*/
|
|
139
|
+
|
|
140
|
+
declare const SIGNATURE_ENTRY = "signature.json";
|
|
141
|
+
declare const SIGNING_ENVELOPE_VERSION = "1";
|
|
142
|
+
declare const SIGNING_ALGORITHM = "ed25519";
|
|
143
|
+
interface ShardSigner {
|
|
144
|
+
key_id: string;
|
|
145
|
+
algorithm: typeof SIGNING_ALGORITHM;
|
|
146
|
+
/** Raw 32-byte Ed25519 public key, base64url. */
|
|
147
|
+
public_key: string;
|
|
148
|
+
}
|
|
149
|
+
/** The signed payload (never contains its own signature — ADR-014 D2). */
|
|
150
|
+
interface ShardSigningPayload {
|
|
151
|
+
format_version: typeof SIGNING_ENVELOPE_VERSION;
|
|
152
|
+
signer: ShardSigner;
|
|
153
|
+
/** SHA-256 hex of the canonical manifest.json bytes. */
|
|
154
|
+
manifest_digest: string;
|
|
155
|
+
/** Sorted bare-hex BLAKE3 digests of referenced sidecar blobs. */
|
|
156
|
+
blob_digests: string[];
|
|
157
|
+
}
|
|
158
|
+
/** `signature.json` archive entry: the payload plus its base64url signature. */
|
|
159
|
+
interface ShardSignatureEnvelope extends ShardSigningPayload {
|
|
160
|
+
signature: string;
|
|
161
|
+
}
|
|
162
|
+
interface TrustedKey {
|
|
163
|
+
key_id: string;
|
|
164
|
+
/** Raw 32-byte Ed25519 public key, base64url. */
|
|
165
|
+
public_key: string;
|
|
166
|
+
revoked?: boolean;
|
|
167
|
+
}
|
|
168
|
+
interface ShardTrustStore {
|
|
169
|
+
resolve(keyId: string): TrustedKey | null | Promise<TrustedKey | null>;
|
|
170
|
+
}
|
|
171
|
+
/** In-memory allowlist trust store seeded from `{ key_id, public_key }` entries. */
|
|
172
|
+
declare class AllowlistTrustStore implements ShardTrustStore {
|
|
173
|
+
private keys;
|
|
174
|
+
constructor(keys: TrustedKey[]);
|
|
175
|
+
resolve(keyId: string): TrustedKey | null;
|
|
176
|
+
/** Mark a key revoked without removing it (still resolvable, verdict `revoked`). */
|
|
177
|
+
revoke(keyId: string): void;
|
|
178
|
+
}
|
|
179
|
+
type ShardSignatureVerdict = {
|
|
180
|
+
ok: true;
|
|
181
|
+
keyId: string;
|
|
182
|
+
} | {
|
|
183
|
+
ok: false;
|
|
184
|
+
reason: 'unsigned';
|
|
185
|
+
} | {
|
|
186
|
+
ok: false;
|
|
187
|
+
reason: 'malformed';
|
|
188
|
+
detail: string;
|
|
189
|
+
} | {
|
|
190
|
+
ok: false;
|
|
191
|
+
reason: 'unknown-signer';
|
|
192
|
+
keyId: string;
|
|
193
|
+
} | {
|
|
194
|
+
ok: false;
|
|
195
|
+
reason: 'revoked';
|
|
196
|
+
keyId: string;
|
|
197
|
+
} | {
|
|
198
|
+
ok: false;
|
|
199
|
+
reason: 'bad-signature';
|
|
200
|
+
keyId: string;
|
|
201
|
+
} | {
|
|
202
|
+
ok: false;
|
|
203
|
+
reason: 'content-mismatch';
|
|
204
|
+
detail: string;
|
|
205
|
+
} | {
|
|
206
|
+
ok: false;
|
|
207
|
+
reason: 'unsupported';
|
|
208
|
+
};
|
|
209
|
+
/** True when this runtime's WebCrypto verifies Ed25519 (ADR-014 D1). */
|
|
210
|
+
declare function isShardSigningSupported(): Promise<boolean>;
|
|
211
|
+
/** Sorted bare-hex BLAKE3 digests of the sidecar blobs present in the archive. */
|
|
212
|
+
declare function sidecarBlobDigests(files: Map<string, Uint8Array>): string[];
|
|
213
|
+
interface VerifyShardSignatureInput {
|
|
214
|
+
files: Map<string, Uint8Array>;
|
|
215
|
+
trustStore: ShardTrustStore;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Verify a shard's Ed25519 signature over its canonical payload. Pure: reads
|
|
219
|
+
* archive bytes, resolves the key, checks the signature and the
|
|
220
|
+
* manifest/blob-digest commitments. No persistence, no mutation.
|
|
221
|
+
*/
|
|
222
|
+
declare function verifyShardSignature(input: VerifyShardSignatureInput): Promise<ShardSignatureVerdict>;
|
|
223
|
+
interface SignShardInput {
|
|
224
|
+
files: Map<string, Uint8Array>;
|
|
225
|
+
keyId: string;
|
|
226
|
+
/** Ed25519 private key (raw 32-byte seed or PKCS8), imported by the caller. */
|
|
227
|
+
privateKey: CryptoKey;
|
|
228
|
+
/** Raw 32-byte public key, base64url — embedded in the envelope + trust store. */
|
|
229
|
+
publicKey: string;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Produce the `signature.json` envelope for an assembled archive `files` map.
|
|
233
|
+
* The caller adds the returned bytes to the archive under {@link SIGNATURE_ENTRY}
|
|
234
|
+
* (excluded from manifest.checksums — it post-dates the manifest).
|
|
235
|
+
*/
|
|
236
|
+
declare function signShard(input: SignShardInput): Promise<Uint8Array>;
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Shard format types — matches the fortemi server matric-shard specification.
|
|
240
|
+
*
|
|
241
|
+
* A shard is a gzip-compressed tar archive (.shard) containing serialized
|
|
242
|
+
* knowledge data with a manifest for integrity verification.
|
|
243
|
+
*
|
|
244
|
+
* @implements @.aiwg/adrs/ADR-011-shard-server-conformance-and-version-negotiation.md
|
|
245
|
+
* @schema @packages/core/schemas/knowledge-shard.schema.receipt.json
|
|
246
|
+
* @created 2026-07-17
|
|
247
|
+
* @agent Codex
|
|
248
|
+
*/
|
|
249
|
+
|
|
250
|
+
declare const CURRENT_SHARD_VERSION = "1.2.0";
|
|
251
|
+
declare const SHARD_FORMAT = "matric-shard";
|
|
252
|
+
/** Components that can appear in a shard archive. */
|
|
253
|
+
type ShardComponent = 'notes' | 'collections' | 'tags' | 'templates' | 'links' | 'note_originals' | 'note_original_history' | 'note_revised_current' | 'note_revisions' | 'embedding_sets' | 'embedding_configs' | 'embedding_set_members' | 'embeddings' | 'provenance_activities' | 'named_locations' | 'provenance_locations' | 'provenance_devices' | 'provenance_records' | 'skos_schemes' | 'skos_concepts' | 'skos_labels' | 'skos_notes' | 'skos_relations' | 'skos_mapping_relations' | 'skos_scheme_memberships' | 'note_skos_tags' | 'skos_collections' | 'skos_collection_members' | 'provenance_edges' | 'community_assignments' | 'communities' | 'graph_edges' | 'graph_sources';
|
|
254
|
+
type KnowledgeShardProfile = 'core-v1' | 'full-v1' | 'record-v1';
|
|
255
|
+
type ShardBackend = 'pglite' | 'record-store';
|
|
256
|
+
type ShardOperation = 'export' | 'import';
|
|
257
|
+
type ShardAuthorityStatus = 'supported' | 'candidate' | 'reserved' | 'unknown' | 'unprofiled';
|
|
258
|
+
interface ShardProfileRegistryEntry {
|
|
259
|
+
profile: KnowledgeShardProfile;
|
|
260
|
+
authority_status: 'supported' | 'candidate' | 'reserved';
|
|
261
|
+
components: ShardComponent[];
|
|
262
|
+
}
|
|
263
|
+
interface ShardLossEntry {
|
|
264
|
+
code: string;
|
|
265
|
+
message: string;
|
|
266
|
+
component?: ShardComponent;
|
|
267
|
+
count?: number;
|
|
268
|
+
record_id?: string;
|
|
269
|
+
field_path?: string;
|
|
270
|
+
source_state?: 'absent' | 'null' | 'empty' | 'value' | 'legacy-indeterminate';
|
|
271
|
+
destination_capability?: string;
|
|
272
|
+
action?: 'reject' | 'omit' | 'default' | 'degrade';
|
|
273
|
+
reason?: string;
|
|
274
|
+
}
|
|
275
|
+
interface ShardCapabilityReport {
|
|
276
|
+
schema_version: 'fortemi.shard.capability-report.v1';
|
|
277
|
+
backend: ShardBackend;
|
|
278
|
+
operation: ShardOperation;
|
|
279
|
+
requested_profile: string | null;
|
|
280
|
+
requested_schema_version: string | null;
|
|
281
|
+
authority_status: ShardAuthorityStatus;
|
|
282
|
+
backend_supported: boolean;
|
|
283
|
+
portable: boolean;
|
|
284
|
+
authority: {
|
|
285
|
+
repository: string;
|
|
286
|
+
commit: string;
|
|
287
|
+
contract_sha256: string;
|
|
288
|
+
contract_revision: string;
|
|
289
|
+
schema_version: string;
|
|
290
|
+
schema_bundle_sha256: string;
|
|
291
|
+
};
|
|
292
|
+
advertised_profiles: KnowledgeShardProfile[];
|
|
293
|
+
supported_components: ShardComponent[];
|
|
294
|
+
declared_components: ShardComponent[];
|
|
295
|
+
unsupported_components: ShardComponent[];
|
|
296
|
+
omitted_components: ShardComponent[];
|
|
297
|
+
losses: ShardLossEntry[];
|
|
298
|
+
}
|
|
299
|
+
interface ShardAttachmentReference {
|
|
300
|
+
id: string;
|
|
301
|
+
path: string;
|
|
302
|
+
mime: string | null;
|
|
303
|
+
checksum: string;
|
|
304
|
+
bytes: number;
|
|
305
|
+
}
|
|
306
|
+
interface ShardAttachmentProjection {
|
|
307
|
+
extracted_text: string | null;
|
|
308
|
+
/** Legacy unprofiled relationship timestamp; outside core-v1. */
|
|
309
|
+
created_at?: string;
|
|
310
|
+
/** Legacy unprofiled attachment tombstone; outside core-v1. */
|
|
311
|
+
deleted_at?: string | null;
|
|
312
|
+
extraction_status?: 'extracted' | 'pending' | 'failed' | 'blocked' | 'deferred';
|
|
313
|
+
reason?: null | 'extraction_pending' | 'extractor_failed' | 'quarantined' | 'large_binary' | 'unsupported_mime' | 'no_extracted_text';
|
|
314
|
+
attachment: ShardAttachmentReference;
|
|
315
|
+
}
|
|
316
|
+
/** @deprecated Legacy React shard field name. Server shards use `attachments`. */
|
|
317
|
+
type ShardBinarySource = ShardAttachmentProjection;
|
|
318
|
+
/**
|
|
319
|
+
* Reference to one cluster file of a component split across addressable files
|
|
320
|
+
* (`notes/000.jsonl`, `notes/001.jsonl`, …). `offset` preserves deterministic
|
|
321
|
+
* component order; readers discover each cluster's size from its contents.
|
|
322
|
+
*/
|
|
323
|
+
interface ShardClusterRef {
|
|
324
|
+
href: string;
|
|
325
|
+
offset: number;
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Optional clustered layout (additive — absent on monolithic shards). When a
|
|
329
|
+
* component is present here, its records live in the listed cluster files instead
|
|
330
|
+
* of (or in addition to) the single `<component>.jsonl`. Both `importShard` and
|
|
331
|
+
* the in-place reader consume it; a monolithic shard omits `layout` entirely.
|
|
332
|
+
*/
|
|
333
|
+
interface ShardLayout {
|
|
334
|
+
clusters?: Partial<Record<ShardComponent, ShardClusterRef[]>>;
|
|
335
|
+
}
|
|
336
|
+
interface ShardMigrationHistoryEntry {
|
|
337
|
+
from_version: string;
|
|
338
|
+
to_version: string;
|
|
339
|
+
migrated_at: string;
|
|
340
|
+
migrated_by: string;
|
|
341
|
+
changes: string[];
|
|
342
|
+
}
|
|
343
|
+
/** Manifest included in every shard as manifest.json. */
|
|
344
|
+
interface ShardProducer {
|
|
345
|
+
name: string;
|
|
346
|
+
version: string;
|
|
347
|
+
revision?: string;
|
|
348
|
+
}
|
|
349
|
+
interface ShardManifest {
|
|
350
|
+
version: string;
|
|
351
|
+
/** Named server-owned portability profile. Required for canonical interchange. */
|
|
352
|
+
profile?: string;
|
|
353
|
+
/** Structured producer identity used by canonical profiles. */
|
|
354
|
+
producer?: ShardProducer;
|
|
355
|
+
/** @deprecated Legacy producer release field. */
|
|
356
|
+
matric_version?: string;
|
|
357
|
+
format: typeof SHARD_FORMAT;
|
|
358
|
+
created_at: string;
|
|
359
|
+
components: ShardComponent[];
|
|
360
|
+
counts: Partial<Record<ShardComponent | 'community_sets', number>>;
|
|
361
|
+
checksums: Record<string, string>;
|
|
362
|
+
min_reader_version: string;
|
|
363
|
+
migrated_from?: string | null;
|
|
364
|
+
migration_history?: ShardMigrationHistoryEntry[];
|
|
365
|
+
/** Clustered component layout for partial fetch (issue #189). Absent → monolithic. */
|
|
366
|
+
layout?: ShardLayout;
|
|
367
|
+
}
|
|
368
|
+
/** Options for shard export. */
|
|
369
|
+
interface ExportOptions {
|
|
370
|
+
/**
|
|
371
|
+
* Explicit portability profile. Only profiles advertised by the selected
|
|
372
|
+
* producer are accepted. Omit to retain the legacy unprofiled React archive.
|
|
373
|
+
*/
|
|
374
|
+
profile?: string;
|
|
375
|
+
/** Explicit authority schema tuple; 2.0.0 is opt-in until matrix receipts pass. */
|
|
376
|
+
schemaVersion?: '1.2.0' | '2.0.0';
|
|
377
|
+
includeEmbeddings?: boolean;
|
|
378
|
+
/** Filter to specific collection (export only notes in this collection). */
|
|
379
|
+
collectionId?: string;
|
|
380
|
+
/** Filter to notes with this tag (e.g. 'app:research' for app-scoped export). */
|
|
381
|
+
tag?: string;
|
|
382
|
+
/** Export only these embedding sets and their member/vector rows. */
|
|
383
|
+
embeddingSetIds?: string[];
|
|
384
|
+
/** Preserve virtual selector materialization metadata and virtual member rows. */
|
|
385
|
+
includeMaterializedSelectors?: boolean;
|
|
386
|
+
/**
|
|
387
|
+
* When set to a positive integer, emit notes as clustered files
|
|
388
|
+
* (`notes/000.jsonl`, …) of this many records each, and record the layout in
|
|
389
|
+
* the manifest, so an in-place reader can fetch only the clusters it needs
|
|
390
|
+
* (issue #189). Absent → a single monolithic `notes.jsonl` (unchanged).
|
|
391
|
+
*/
|
|
392
|
+
clusterNotesSize?: number;
|
|
393
|
+
/**
|
|
394
|
+
* Pack attachment bytes into a portable content-addressed `blobs/<hex>`
|
|
395
|
+
* sidecar (Fortemi/fortemi#1046), producing a self-contained shard whose
|
|
396
|
+
* attachments survive a round-trip (`getBlob()` returns real bytes on the
|
|
397
|
+
* importing host). Requires {@link blobStore}. Absent/false → reference-only
|
|
398
|
+
* (server default), which remains a valid shard.
|
|
399
|
+
*/
|
|
400
|
+
includeBlobs?: boolean;
|
|
401
|
+
/**
|
|
402
|
+
* Byte source for the sidecar. Required when `includeBlobs` is set; attachment
|
|
403
|
+
* bytes are read by their `content_hash`. A blob the store cannot return is
|
|
404
|
+
* skipped (its attachment stays reference-only) rather than failing export.
|
|
405
|
+
*/
|
|
406
|
+
blobStore?: BlobStore;
|
|
407
|
+
/** Optional Ed25519 publisher envelope for newly produced archives. */
|
|
408
|
+
signing?: {
|
|
409
|
+
keyId: string;
|
|
410
|
+
privateKey: CryptoKey;
|
|
411
|
+
publicKey: string;
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
/** Conflict resolution strategy for shard import. */
|
|
415
|
+
type ConflictStrategy = 'skip' | 'replace' | 'error';
|
|
416
|
+
/** Options for shard import. */
|
|
417
|
+
interface ImportOptions {
|
|
418
|
+
conflictStrategy?: ConflictStrategy;
|
|
419
|
+
/** Rows processed between cooperative yields. Defaults to 250. */
|
|
420
|
+
batchSize?: number;
|
|
421
|
+
/** Progress callback for long-running import phases. */
|
|
422
|
+
onProgress?: (progress: ImportProgress) => void;
|
|
423
|
+
/**
|
|
424
|
+
* Destination for hydrating attachment bytes from a portable `blobs/<hex>`
|
|
425
|
+
* sidecar (Fortemi/fortemi#1046). When provided, sidecar entries whose bare
|
|
426
|
+
* hex matches an imported attachment's `content_hash` are promoted before
|
|
427
|
+
* the logical transaction. A transaction failure removes only bytes that
|
|
428
|
+
* were absent before promotion. Stores without the optional `delete`
|
|
429
|
+
* capability fail before promotion. Absent → reference-only metadata.
|
|
430
|
+
*/
|
|
431
|
+
blobStore?: BlobStore;
|
|
432
|
+
/**
|
|
433
|
+
* Publisher-provenance policy for signed shards (#324, ADR-014):
|
|
434
|
+
* - `require` — reject unsigned or bad-signature shards (default when a
|
|
435
|
+
* `trustStore` is supplied);
|
|
436
|
+
* - `prefer` — verify signed shards; import unsigned ones with a warning;
|
|
437
|
+
* still reject a present-but-invalid signature;
|
|
438
|
+
* - `trusted-local-only` — ignore signatures (own-export import).
|
|
439
|
+
* When both `trustStore` and this are omitted, verification is skipped
|
|
440
|
+
* entirely (checksum-only, unchanged behavior).
|
|
441
|
+
*/
|
|
442
|
+
verifySignature?: 'require' | 'prefer' | 'trusted-local-only';
|
|
443
|
+
/** Trust store resolving signer key_id → public key (required for `require`/`prefer`). */
|
|
444
|
+
trustStore?: ShardTrustStore;
|
|
445
|
+
}
|
|
446
|
+
type ImportProgressPhase = 'unpack' | 'validate' | 'collections' | 'notes' | 'skos' | 'templates' | 'links' | 'provenance' | 'embedding_sets' | 'embedding_configs' | 'embeddings' | 'embedding_set_members' | 'graph' | 'communities' | 'index';
|
|
447
|
+
interface ImportProgress {
|
|
448
|
+
phase: ImportProgressPhase;
|
|
449
|
+
done: number;
|
|
450
|
+
total: number;
|
|
451
|
+
}
|
|
452
|
+
/** Per-entity import counts. */
|
|
453
|
+
interface ImportCounts {
|
|
454
|
+
notes: number;
|
|
455
|
+
collections: number;
|
|
456
|
+
templates: number;
|
|
457
|
+
tags: number;
|
|
458
|
+
links: number;
|
|
459
|
+
embedding_sets: number;
|
|
460
|
+
embedding_configs: number;
|
|
461
|
+
embedding_set_members: number;
|
|
462
|
+
embeddings: number;
|
|
463
|
+
skos_schemes: number;
|
|
464
|
+
skos_concepts: number;
|
|
465
|
+
skos_relations: number;
|
|
466
|
+
note_skos_tags: number;
|
|
467
|
+
provenance_edges: number;
|
|
468
|
+
graph_sources: number;
|
|
469
|
+
graph_edges: number;
|
|
470
|
+
community_sets: number;
|
|
471
|
+
communities: number;
|
|
472
|
+
community_assignments: number;
|
|
473
|
+
}
|
|
474
|
+
/** Result of a shard import operation. */
|
|
475
|
+
interface ImportResult {
|
|
476
|
+
success: boolean;
|
|
477
|
+
counts: ImportCounts;
|
|
478
|
+
skipped: Partial<ImportCounts>;
|
|
479
|
+
warnings: string[];
|
|
480
|
+
errors: string[];
|
|
481
|
+
duration_ms: number;
|
|
482
|
+
capability_report: ShardCapabilityReport;
|
|
483
|
+
/** Complete manifest counts when a profile contains components outside legacy counters. */
|
|
484
|
+
component_counts?: ShardManifest['counts'];
|
|
485
|
+
}
|
|
486
|
+
interface ShardExportResult {
|
|
487
|
+
success: boolean;
|
|
488
|
+
archive: Uint8Array | null;
|
|
489
|
+
errors: string[];
|
|
490
|
+
capability_report: ShardCapabilityReport;
|
|
491
|
+
}
|
|
492
|
+
/** Note as serialized in the shard JSONL. */
|
|
493
|
+
interface ShardNote {
|
|
494
|
+
id: string;
|
|
495
|
+
title: string | null;
|
|
496
|
+
original_content: string;
|
|
497
|
+
revised_content: string | null;
|
|
498
|
+
metadata?: unknown;
|
|
499
|
+
collection_id?: string | null;
|
|
500
|
+
attachments?: ShardAttachmentProjection[];
|
|
501
|
+
/** @deprecated Legacy React shard field name. Use `attachments`. */
|
|
502
|
+
binary_sources?: ShardBinarySource[];
|
|
503
|
+
format: string;
|
|
504
|
+
source: string;
|
|
505
|
+
starred: boolean;
|
|
506
|
+
archived: boolean;
|
|
507
|
+
tags: string[];
|
|
508
|
+
created_at: string;
|
|
509
|
+
updated_at: string;
|
|
510
|
+
/** Schema 1.1 core-v1 tombstone; legacy unprofiled archives also carry it. */
|
|
511
|
+
deleted_at?: string | null;
|
|
512
|
+
}
|
|
513
|
+
/** Collection as serialized in the shard JSON array. */
|
|
514
|
+
interface ShardCollection {
|
|
515
|
+
id: string;
|
|
516
|
+
name: string;
|
|
517
|
+
description: string | null;
|
|
518
|
+
parent_id: string | null;
|
|
519
|
+
created_at: string;
|
|
520
|
+
/** Legacy unprofiled fields; outside core-v1. */
|
|
521
|
+
updated_at?: string;
|
|
522
|
+
deleted_at?: string | null;
|
|
523
|
+
note_count?: number;
|
|
524
|
+
}
|
|
525
|
+
/** Tag as serialized in the shard JSON array. */
|
|
526
|
+
interface ShardTag {
|
|
527
|
+
name: string;
|
|
528
|
+
created_at: string;
|
|
529
|
+
}
|
|
530
|
+
/** Template as serialized in the shard JSON array. */
|
|
531
|
+
interface ShardTemplate {
|
|
532
|
+
id: string;
|
|
533
|
+
name: string;
|
|
534
|
+
description: string | null;
|
|
535
|
+
content: string;
|
|
536
|
+
format: string;
|
|
537
|
+
default_tags: string[];
|
|
538
|
+
collection_id: string | null;
|
|
539
|
+
created_at: string;
|
|
540
|
+
updated_at: string;
|
|
541
|
+
}
|
|
542
|
+
/** Link as serialized in the shard JSONL. */
|
|
543
|
+
interface ShardLink {
|
|
544
|
+
id: string;
|
|
545
|
+
from_note_id: string;
|
|
546
|
+
to_note_id: string | null;
|
|
547
|
+
/** Optional for legacy React shards exported before URL links existed. */
|
|
548
|
+
to_url?: string | null;
|
|
549
|
+
kind: string;
|
|
550
|
+
score: number | null;
|
|
551
|
+
created_at: string;
|
|
552
|
+
/** Optional for legacy React shards exported before link metadata existed. */
|
|
553
|
+
metadata?: unknown;
|
|
554
|
+
}
|
|
555
|
+
/**
|
|
556
|
+
* Embedding set as serialized in the shard JSON array.
|
|
557
|
+
*
|
|
558
|
+
* Fields beyond id/model/dimension are optional for backward compatibility:
|
|
559
|
+
* legacy React shards omit them and import falls back to the same defaults
|
|
560
|
+
* `embeddingSetFromShard` applies (name → model, is_system → false, …).
|
|
561
|
+
*/
|
|
562
|
+
interface ShardEmbeddingSet {
|
|
563
|
+
id: string;
|
|
564
|
+
name?: string;
|
|
565
|
+
slug?: string | null;
|
|
566
|
+
description?: string | null;
|
|
567
|
+
purpose?: string | null;
|
|
568
|
+
document_count?: number;
|
|
569
|
+
embedding_count?: number;
|
|
570
|
+
is_system?: boolean;
|
|
571
|
+
keywords?: string[];
|
|
572
|
+
model: string;
|
|
573
|
+
dimension: number;
|
|
574
|
+
kind?: 'physical' | 'filter' | 'virtual';
|
|
575
|
+
mode?: 'auto' | 'manual' | 'mixed' | null;
|
|
576
|
+
truncate_dimension?: number | null;
|
|
577
|
+
criteria?: Record<string, unknown> | null;
|
|
578
|
+
source?: Record<string, unknown> | null;
|
|
579
|
+
compatibility?: Record<string, unknown> | null;
|
|
580
|
+
materialization?: Record<string, unknown> | null;
|
|
581
|
+
freshness?: ShardArtifactFreshness | null;
|
|
582
|
+
created_at?: string;
|
|
583
|
+
updated_at?: string;
|
|
584
|
+
}
|
|
585
|
+
/** Embedding set member as serialized in the shard JSONL. */
|
|
586
|
+
interface ShardEmbeddingSetMember {
|
|
587
|
+
embedding_set_id: string;
|
|
588
|
+
note_id: string;
|
|
589
|
+
/** Legacy React shard field; new exports use server membership metadata instead. */
|
|
590
|
+
embedding_id?: string;
|
|
591
|
+
/** Optional for legacy React shards; import defaults to 'materialized'. */
|
|
592
|
+
membership_type?: string;
|
|
593
|
+
/** Optional for legacy React shards; import falls back to the manifest timestamp. */
|
|
594
|
+
added_at?: string;
|
|
595
|
+
/** Optional for legacy React shards; import defaults to NULL. */
|
|
596
|
+
added_by?: string | null;
|
|
597
|
+
}
|
|
598
|
+
/** Embedding config as serialized in the shard JSON array. */
|
|
599
|
+
interface ShardEmbeddingConfig {
|
|
600
|
+
id: string;
|
|
601
|
+
name: string;
|
|
602
|
+
description: string | null;
|
|
603
|
+
model: string;
|
|
604
|
+
dimension: number;
|
|
605
|
+
chunk_size: number;
|
|
606
|
+
chunk_overlap: number;
|
|
607
|
+
is_default: boolean;
|
|
608
|
+
}
|
|
609
|
+
/**
|
|
610
|
+
* Embedding as serialized in the shard JSONL.
|
|
611
|
+
*
|
|
612
|
+
* Server metadata fields (`chunk_index`, `text`, `model`) are optional for
|
|
613
|
+
* backward compatibility: legacy React shards exported before migration 0016
|
|
614
|
+
* carry only `id`, `note_id`, `embedding_set_id`, `vector`, `created_at`.
|
|
615
|
+
* Import normalizes absent metadata to schema defaults (0, '', NULL).
|
|
616
|
+
*/
|
|
617
|
+
interface ShardEmbedding {
|
|
618
|
+
id: string;
|
|
619
|
+
note_id: string;
|
|
620
|
+
chunk_index?: number;
|
|
621
|
+
text?: string;
|
|
622
|
+
vector: number[];
|
|
623
|
+
model?: string;
|
|
624
|
+
/** React shard extension used to preserve local embedding-set scoping. */
|
|
625
|
+
embedding_set_id?: string;
|
|
626
|
+
/** React shard extension used to preserve local creation ordering. */
|
|
627
|
+
created_at?: string;
|
|
628
|
+
}
|
|
629
|
+
/** SKOS scheme as serialized in the shard JSON array. */
|
|
630
|
+
interface ShardSkosScheme {
|
|
631
|
+
id: string;
|
|
632
|
+
title: string;
|
|
633
|
+
description: string | null;
|
|
634
|
+
created_at: string;
|
|
635
|
+
updated_at: string;
|
|
636
|
+
}
|
|
637
|
+
/** SKOS concept as serialized in the shard JSON array. */
|
|
638
|
+
interface ShardSkosConcept {
|
|
639
|
+
id: string;
|
|
640
|
+
scheme_id: string;
|
|
641
|
+
pref_label: string;
|
|
642
|
+
alt_labels: string[];
|
|
643
|
+
definition: string | null;
|
|
644
|
+
created_at: string;
|
|
645
|
+
updated_at: string;
|
|
646
|
+
}
|
|
647
|
+
/** SKOS concept relation as serialized in the shard JSONL. */
|
|
648
|
+
interface ShardSkosRelation {
|
|
649
|
+
id: string;
|
|
650
|
+
source_concept_id: string;
|
|
651
|
+
target_concept_id: string;
|
|
652
|
+
relation_type: 'broader' | 'narrower' | 'related';
|
|
653
|
+
created_at: string;
|
|
654
|
+
}
|
|
655
|
+
/** Note-to-SKOS-concept assignment as serialized in the shard JSONL. */
|
|
656
|
+
interface ShardNoteSkosTag {
|
|
657
|
+
id: string;
|
|
658
|
+
note_id: string;
|
|
659
|
+
concept_id: string;
|
|
660
|
+
created_at: string;
|
|
661
|
+
}
|
|
662
|
+
/** Provenance edge as serialized in the shard JSONL. */
|
|
663
|
+
interface ShardProvenanceEdge {
|
|
664
|
+
id: string;
|
|
665
|
+
entity_type: string;
|
|
666
|
+
entity_id: string;
|
|
667
|
+
activity: string;
|
|
668
|
+
agent: string;
|
|
669
|
+
started_at: string;
|
|
670
|
+
ended_at: string | null;
|
|
671
|
+
attributes: Record<string, unknown> | null;
|
|
672
|
+
}
|
|
673
|
+
interface ShardArtifactFreshness {
|
|
674
|
+
status: 'fresh' | 'stale' | 'unknown';
|
|
675
|
+
checked_at?: string;
|
|
676
|
+
stale_reason?: string;
|
|
677
|
+
source_hashes?: {
|
|
678
|
+
notes?: string;
|
|
679
|
+
links?: string;
|
|
680
|
+
embeddings?: string;
|
|
681
|
+
embedding_set_members?: string;
|
|
682
|
+
virtual_set_definition?: string;
|
|
683
|
+
parameters?: string;
|
|
684
|
+
};
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
type AiwgFortemiRecordType = string;
|
|
688
|
+
type AiwgFortemiRecordSchemaVersion = 'aiwg.fortemi.index.record.v1' | 'aiwg.fortemi.index.record.v2';
|
|
689
|
+
type AiwgFortemiIndexExportSchemaVersion = 'aiwg.fortemi.index.export.v1' | 'aiwg.fortemi.index.export.v2';
|
|
690
|
+
type AiwgPrivacyClassification = 'private' | 'sanitized' | 'public';
|
|
691
|
+
type AiwgProvenanceConfidence = 'source' | 'candidate' | 'reviewed' | 'rejected';
|
|
692
|
+
type AiwgReviewAction = 'accept' | 'reject' | 'defer';
|
|
693
|
+
type AiwgFortemiRelationshipDirection = 'upstream' | 'downstream' | 'related';
|
|
694
|
+
interface AiwgFortemiRecordSource {
|
|
695
|
+
path: string;
|
|
696
|
+
repo_relative_path: string;
|
|
697
|
+
locator: string;
|
|
698
|
+
origin?: string;
|
|
699
|
+
generated?: boolean;
|
|
700
|
+
checksum?: string;
|
|
701
|
+
updated_at?: string;
|
|
702
|
+
}
|
|
703
|
+
interface AiwgFortemiRelationship {
|
|
704
|
+
type: string;
|
|
705
|
+
target_id: string;
|
|
706
|
+
source_path?: string;
|
|
707
|
+
target_path?: string;
|
|
708
|
+
direction?: AiwgFortemiRelationshipDirection;
|
|
709
|
+
label?: string;
|
|
710
|
+
confidence?: number;
|
|
711
|
+
privacy?: AiwgPrivacyClassification;
|
|
712
|
+
metadata?: Record<string, unknown>;
|
|
713
|
+
}
|
|
714
|
+
interface AiwgFortemiProvenance {
|
|
715
|
+
field: string;
|
|
716
|
+
source: string;
|
|
717
|
+
path: string;
|
|
718
|
+
confidence: AiwgProvenanceConfidence;
|
|
719
|
+
privacy: AiwgPrivacyClassification;
|
|
720
|
+
}
|
|
721
|
+
type AiwgFortemiSkosRelationType = 'broader' | 'narrower' | 'related' | string;
|
|
722
|
+
interface AiwgFortemiSkosConcept {
|
|
723
|
+
id: string;
|
|
724
|
+
prefLabel: string;
|
|
725
|
+
definition?: string;
|
|
726
|
+
scheme?: string;
|
|
727
|
+
notation?: string;
|
|
728
|
+
uri?: string;
|
|
729
|
+
altLabels?: string[];
|
|
730
|
+
metadata?: Record<string, unknown>;
|
|
731
|
+
}
|
|
732
|
+
interface AiwgFortemiSkosRelation {
|
|
733
|
+
type: AiwgFortemiSkosRelationType;
|
|
734
|
+
source_id: string;
|
|
735
|
+
target_id: string;
|
|
736
|
+
source_path?: string;
|
|
737
|
+
metadata?: Record<string, unknown>;
|
|
738
|
+
}
|
|
739
|
+
interface AiwgFortemiProvenanceEvent {
|
|
740
|
+
id?: string;
|
|
741
|
+
activity: string;
|
|
742
|
+
agent?: string;
|
|
743
|
+
started_at?: string;
|
|
744
|
+
ended_at?: string;
|
|
745
|
+
source?: string;
|
|
746
|
+
path?: string;
|
|
747
|
+
confidence?: AiwgProvenanceConfidence;
|
|
748
|
+
privacy?: AiwgPrivacyClassification;
|
|
749
|
+
attributes?: Record<string, unknown>;
|
|
750
|
+
}
|
|
751
|
+
interface AiwgFortemiSearchProjection {
|
|
752
|
+
title?: string;
|
|
753
|
+
name?: string;
|
|
754
|
+
summary?: string;
|
|
755
|
+
body?: string;
|
|
756
|
+
triggers?: string[];
|
|
757
|
+
aliases?: string[];
|
|
758
|
+
capability?: string;
|
|
759
|
+
tags?: string[];
|
|
760
|
+
phase?: string;
|
|
761
|
+
type?: string;
|
|
762
|
+
frontmatter?: Record<string, unknown>;
|
|
763
|
+
}
|
|
764
|
+
interface AiwgFortemiChunk {
|
|
765
|
+
id?: string;
|
|
766
|
+
text?: string;
|
|
767
|
+
body?: string;
|
|
768
|
+
summary?: string;
|
|
769
|
+
source_path?: string;
|
|
770
|
+
metadata?: Record<string, unknown>;
|
|
771
|
+
}
|
|
772
|
+
interface AiwgFortemiRecordEmbedding {
|
|
773
|
+
id?: string;
|
|
774
|
+
embedding?: number[];
|
|
775
|
+
vector?: number[];
|
|
776
|
+
model?: string;
|
|
777
|
+
granularity?: string;
|
|
778
|
+
input_hash?: string;
|
|
779
|
+
source_path?: string;
|
|
780
|
+
metadata?: Record<string, unknown>;
|
|
781
|
+
}
|
|
782
|
+
interface AiwgFortemiAttachmentReference {
|
|
783
|
+
id: string;
|
|
784
|
+
path: string;
|
|
785
|
+
mime: string | null;
|
|
786
|
+
checksum: string;
|
|
787
|
+
bytes: number;
|
|
788
|
+
}
|
|
789
|
+
interface AiwgFortemiBinarySource {
|
|
790
|
+
extracted_text: string | null;
|
|
791
|
+
created_at?: string;
|
|
792
|
+
deleted_at?: string | null;
|
|
793
|
+
extraction_status?: 'extracted' | 'pending' | 'failed' | 'blocked' | 'deferred';
|
|
794
|
+
reason?: null | 'extraction_pending' | 'extractor_failed' | 'quarantined' | 'large_binary' | 'unsupported_mime' | 'no_extracted_text';
|
|
795
|
+
attachment: AiwgFortemiAttachmentReference;
|
|
796
|
+
}
|
|
797
|
+
interface AiwgFortemiRecord {
|
|
798
|
+
schema_version: AiwgFortemiRecordSchemaVersion;
|
|
799
|
+
id: string;
|
|
800
|
+
type: AiwgFortemiRecordType;
|
|
801
|
+
source: AiwgFortemiRecordSource;
|
|
802
|
+
title?: string;
|
|
803
|
+
text?: string;
|
|
804
|
+
facets: Record<string, string[]>;
|
|
805
|
+
tags: string[];
|
|
806
|
+
concepts: string[];
|
|
807
|
+
relationships: AiwgFortemiRelationship[];
|
|
808
|
+
provenance: AiwgFortemiProvenance[];
|
|
809
|
+
search?: AiwgFortemiSearchProjection;
|
|
810
|
+
chunks?: AiwgFortemiChunk[];
|
|
811
|
+
binary_sources?: AiwgFortemiBinarySource[];
|
|
812
|
+
embeddings?: AiwgFortemiRecordEmbedding[];
|
|
813
|
+
compatibility?: Record<string, unknown>;
|
|
814
|
+
/** Optional rich SKOS metadata for static consumers that need labels/definitions without opening a shard. */
|
|
815
|
+
skos_concepts?: AiwgFortemiSkosConcept[];
|
|
816
|
+
/** Optional SKOS relationship edges among concepts referenced by this record. */
|
|
817
|
+
skos_relations?: AiwgFortemiSkosRelation[];
|
|
818
|
+
/** Optional W3C PROV-style activity chain for this record. */
|
|
819
|
+
provenance_events?: AiwgFortemiProvenanceEvent[];
|
|
820
|
+
privacy: {
|
|
821
|
+
classification: AiwgPrivacyClassification;
|
|
822
|
+
pii: boolean;
|
|
823
|
+
locality?: string;
|
|
824
|
+
};
|
|
825
|
+
updated_at: string;
|
|
826
|
+
}
|
|
827
|
+
interface AiwgFortemiIndexExport {
|
|
828
|
+
schema_version: AiwgFortemiIndexExportSchemaVersion;
|
|
829
|
+
generated_at: string;
|
|
830
|
+
source: {
|
|
831
|
+
repo: string;
|
|
832
|
+
privacy: AiwgPrivacyClassification;
|
|
833
|
+
graph?: string;
|
|
834
|
+
};
|
|
835
|
+
items: AiwgFortemiRecord[];
|
|
836
|
+
compatibility?: {
|
|
837
|
+
previous_schema_version: 'aiwg.fortemi.index.export.v1';
|
|
838
|
+
strategy: 'supported';
|
|
839
|
+
};
|
|
840
|
+
}
|
|
841
|
+
interface AiwgFortemiChunkPartRef {
|
|
842
|
+
href: string;
|
|
843
|
+
offset: number;
|
|
844
|
+
count: number;
|
|
845
|
+
}
|
|
846
|
+
declare const AIWG_SCAN_REQUIRED_FIELDS: Array<keyof AiwgFortemiRecord>;
|
|
847
|
+
type AiwgFortemiProjectedRecord = Pick<AiwgFortemiRecord, 'schema_version' | 'id' | 'type' | 'title' | 'text' | 'facets' | 'tags' | 'concepts' | 'privacy'> & Partial<AiwgFortemiRecord>;
|
|
848
|
+
type AiwgDetailIdEncoding = 'uri' | 'base64url';
|
|
849
|
+
interface AiwgFortemiChunkDetailRef {
|
|
850
|
+
href: string;
|
|
851
|
+
encoding?: AiwgDetailIdEncoding;
|
|
852
|
+
}
|
|
853
|
+
interface AiwgFortemiChunkManifest {
|
|
854
|
+
schema_version: 'aiwg.fortemi.index.chunk-manifest.v1';
|
|
855
|
+
generated_at: string;
|
|
856
|
+
source: AiwgFortemiIndexExport['source'];
|
|
857
|
+
source_export_schema_version?: AiwgFortemiIndexExportSchemaVersion;
|
|
858
|
+
total: number;
|
|
859
|
+
part_size: number;
|
|
860
|
+
facets?: Record<string, Record<string, number>>;
|
|
861
|
+
projection?: Array<keyof AiwgFortemiRecord>;
|
|
862
|
+
detail?: AiwgFortemiChunkDetailRef;
|
|
863
|
+
parts: AiwgFortemiChunkPartRef[];
|
|
864
|
+
}
|
|
865
|
+
interface AiwgFortemiChunkPart {
|
|
866
|
+
schema_version: 'aiwg.fortemi.index.chunk.v1';
|
|
867
|
+
manifest_schema_version: 'aiwg.fortemi.index.chunk-manifest.v1';
|
|
868
|
+
offset: number;
|
|
869
|
+
items: AiwgFortemiRecord[];
|
|
870
|
+
}
|
|
871
|
+
interface AiwgIndexValidationResult {
|
|
872
|
+
valid: boolean;
|
|
873
|
+
errors: string[];
|
|
874
|
+
counts: Partial<Record<string, number>>;
|
|
875
|
+
}
|
|
876
|
+
interface AiwgChunkedIndexValidationResult {
|
|
877
|
+
valid: boolean;
|
|
878
|
+
errors: string[];
|
|
879
|
+
}
|
|
880
|
+
interface AiwgIndexQueryOptions {
|
|
881
|
+
types?: AiwgFortemiRecordType[];
|
|
882
|
+
facets?: Record<string, string[]>;
|
|
883
|
+
tags?: string[];
|
|
884
|
+
concepts?: string[];
|
|
885
|
+
privacy?: AiwgPrivacyClassification[];
|
|
886
|
+
relationshipTargetId?: string;
|
|
887
|
+
limit?: number;
|
|
888
|
+
offset?: number;
|
|
889
|
+
rank?: boolean;
|
|
890
|
+
snippets?: boolean;
|
|
891
|
+
snippetLength?: number;
|
|
892
|
+
weights?: Partial<AiwgIndexQueryWeights>;
|
|
893
|
+
includeMatches?: boolean;
|
|
894
|
+
searchProfile?: 'default' | 'aiwg-discovery';
|
|
895
|
+
}
|
|
896
|
+
interface AiwgIndexQueryWeights {
|
|
897
|
+
title: number;
|
|
898
|
+
text: number;
|
|
899
|
+
tag: number;
|
|
900
|
+
concept: number;
|
|
901
|
+
facet: number;
|
|
902
|
+
id: number;
|
|
903
|
+
source: number;
|
|
904
|
+
}
|
|
905
|
+
interface AiwgIndexQueryMatch {
|
|
906
|
+
field: 'title' | 'text' | 'tag' | 'concept' | 'facet' | 'id' | 'source';
|
|
907
|
+
value: string;
|
|
908
|
+
score?: number;
|
|
909
|
+
reason?: string;
|
|
910
|
+
}
|
|
911
|
+
interface AiwgIndexQueryRankedItem {
|
|
912
|
+
item: AiwgFortemiRecord;
|
|
913
|
+
rank: number;
|
|
914
|
+
snippet?: string;
|
|
915
|
+
matches?: AiwgIndexQueryMatch[];
|
|
916
|
+
}
|
|
917
|
+
interface AiwgIndexQueryResult {
|
|
918
|
+
items: AiwgFortemiRecord[];
|
|
919
|
+
total: number;
|
|
920
|
+
facets: Record<string, Record<string, number>>;
|
|
921
|
+
rankedItems?: AiwgIndexQueryRankedItem[];
|
|
922
|
+
}
|
|
923
|
+
type AiwgChunkedIndexLoader = (part: AiwgFortemiChunkPartRef, manifest: AiwgFortemiChunkManifest) => Promise<unknown>;
|
|
924
|
+
type AiwgChunkedIndexDetailLoader = (id: string, manifest: AiwgFortemiChunkManifest) => Promise<unknown>;
|
|
925
|
+
interface AiwgChunkedIndexLoadOptions {
|
|
926
|
+
maxCachedParts?: number;
|
|
927
|
+
detailLoader?: AiwgChunkedIndexDetailLoader;
|
|
928
|
+
maxCachedDetails?: number;
|
|
929
|
+
maxCachedMatches?: number;
|
|
930
|
+
}
|
|
931
|
+
type AiwgChunkedIndexProgressPhase = 'part' | 'query';
|
|
932
|
+
interface AiwgChunkedIndexProgress {
|
|
933
|
+
phase: AiwgChunkedIndexProgressPhase;
|
|
934
|
+
done: number;
|
|
935
|
+
total: number;
|
|
936
|
+
href?: string;
|
|
937
|
+
}
|
|
938
|
+
interface AiwgChunkedIndexQueryOptions extends AiwgIndexQueryOptions {
|
|
939
|
+
onProgress?: (progress: AiwgChunkedIndexProgress) => void;
|
|
940
|
+
}
|
|
941
|
+
interface AiwgChunkedIndexQueryResult extends AiwgIndexQueryResult {
|
|
942
|
+
manifestTotal: number;
|
|
943
|
+
scannedParts: number;
|
|
944
|
+
fetchedParts: number;
|
|
945
|
+
complete: boolean;
|
|
946
|
+
}
|
|
947
|
+
interface AiwgReviewDecision {
|
|
948
|
+
item_id: string;
|
|
949
|
+
action: AiwgReviewAction;
|
|
950
|
+
reason?: string;
|
|
951
|
+
updated_at: string;
|
|
952
|
+
}
|
|
953
|
+
interface AiwgReviewDecisionExport {
|
|
954
|
+
schema_version: 'aiwg.fortemi.review-decisions.v1';
|
|
955
|
+
generated_at: string;
|
|
956
|
+
source_export_schema_version: AiwgFortemiIndexExportSchemaVersion;
|
|
957
|
+
decisions: AiwgReviewDecision[];
|
|
958
|
+
}
|
|
959
|
+
interface AiwgIndexGraphOptions {
|
|
960
|
+
communityFacet?: string;
|
|
961
|
+
communityTagPrefix?: string;
|
|
962
|
+
relationshipWeights?: Record<string, number>;
|
|
963
|
+
includeDanglingRelationships?: boolean;
|
|
964
|
+
}
|
|
965
|
+
type AiwgRelationshipDirection = 'in' | 'out' | 'both';
|
|
966
|
+
type AiwgRelationshipSetOperation = 'intersection' | 'union' | 'difference';
|
|
967
|
+
interface AiwgRelationshipTraversalOptions {
|
|
968
|
+
direction?: AiwgRelationshipDirection;
|
|
969
|
+
relationshipType?: string;
|
|
970
|
+
relationshipDirection?: AiwgFortemiRelationshipDirection;
|
|
971
|
+
limit?: number;
|
|
972
|
+
}
|
|
973
|
+
interface AiwgRelationshipQueryOptions extends AiwgRelationshipTraversalOptions {
|
|
974
|
+
sourceId?: string;
|
|
975
|
+
targetId?: string;
|
|
976
|
+
endpointId?: string;
|
|
977
|
+
type?: string;
|
|
978
|
+
}
|
|
979
|
+
interface AiwgRelationshipEdgeSummary {
|
|
980
|
+
source_id: string;
|
|
981
|
+
target_id: string;
|
|
982
|
+
type: string;
|
|
983
|
+
source_path?: string;
|
|
984
|
+
target_path?: string;
|
|
985
|
+
direction?: AiwgFortemiRelationshipDirection;
|
|
986
|
+
}
|
|
987
|
+
interface AiwgRelationshipNodeSummary {
|
|
988
|
+
id: string;
|
|
989
|
+
type: AiwgFortemiRecordType;
|
|
990
|
+
title: string;
|
|
991
|
+
}
|
|
992
|
+
interface AiwgRelationshipTraversalResult {
|
|
993
|
+
nodes: AiwgRelationshipNodeSummary[];
|
|
994
|
+
edges: AiwgRelationshipEdgeSummary[];
|
|
995
|
+
complete: boolean;
|
|
996
|
+
scannedParts?: number;
|
|
997
|
+
fetchedParts?: number;
|
|
998
|
+
}
|
|
999
|
+
interface AiwgRelationshipSetOptions extends AiwgRelationshipTraversalOptions {
|
|
1000
|
+
op: AiwgRelationshipSetOperation;
|
|
1001
|
+
a: string;
|
|
1002
|
+
b: string;
|
|
1003
|
+
}
|
|
1004
|
+
interface AiwgRelationshipSetResult {
|
|
1005
|
+
ids: string[];
|
|
1006
|
+
op: AiwgRelationshipSetOperation;
|
|
1007
|
+
}
|
|
1008
|
+
interface AiwgStaticEmbeddingRecord {
|
|
1009
|
+
record_id: string;
|
|
1010
|
+
embedding: number[];
|
|
1011
|
+
embedding_id?: string;
|
|
1012
|
+
granularity?: string;
|
|
1013
|
+
input_hash: string;
|
|
1014
|
+
source_path?: string;
|
|
1015
|
+
}
|
|
1016
|
+
interface AiwgStaticEmbeddingSet {
|
|
1017
|
+
schema_version: 'aiwg.fortemi.embedding.set.v1';
|
|
1018
|
+
id: string;
|
|
1019
|
+
model: string;
|
|
1020
|
+
dimensions: number;
|
|
1021
|
+
generated_at: string;
|
|
1022
|
+
granularity: 'title-summary' | 'body' | 'chunked-body' | string;
|
|
1023
|
+
metric?: 'cosine' | 'dot' | 'euclidean';
|
|
1024
|
+
input_hash_algorithm?: string;
|
|
1025
|
+
embeddings: AiwgStaticEmbeddingRecord[];
|
|
1026
|
+
}
|
|
1027
|
+
interface AiwgHeadlessEmbeddingBackend {
|
|
1028
|
+
model: string;
|
|
1029
|
+
dimensions: number;
|
|
1030
|
+
embed(input: string, record: AiwgFortemiRecord): number[] | Promise<number[]>;
|
|
1031
|
+
}
|
|
1032
|
+
interface AiwgPrivacyFilterOptions {
|
|
1033
|
+
/** Include records classified `private` (default false). */
|
|
1034
|
+
includePrivate?: boolean;
|
|
1035
|
+
/** Include records flagged `pii` (default false). */
|
|
1036
|
+
includePii?: boolean;
|
|
1037
|
+
}
|
|
1038
|
+
/** Drop `private`/`pii` records unless explicitly opted in (SEC6, default-safe). */
|
|
1039
|
+
declare function filterAiwgRecordsByPrivacy(records: AiwgFortemiRecord[], options?: AiwgPrivacyFilterOptions): AiwgFortemiRecord[];
|
|
1040
|
+
interface BuildAiwgStaticEmbeddingSetOptions {
|
|
1041
|
+
id: string;
|
|
1042
|
+
backend: AiwgHeadlessEmbeddingBackend;
|
|
1043
|
+
records?: AiwgFortemiRecord[];
|
|
1044
|
+
generatedAt?: string | Date;
|
|
1045
|
+
granularity?: AiwgStaticEmbeddingSet['granularity'];
|
|
1046
|
+
metric?: AiwgStaticEmbeddingSet['metric'];
|
|
1047
|
+
textForRecord?: (record: AiwgFortemiRecord) => string;
|
|
1048
|
+
/** Privacy filtering (SEC6). Default-safe: excludes `private`/`pii` records. */
|
|
1049
|
+
privacy?: AiwgPrivacyFilterOptions;
|
|
1050
|
+
}
|
|
1051
|
+
interface AiwgStaticSemanticQueryOptions {
|
|
1052
|
+
limit?: number;
|
|
1053
|
+
offset?: number;
|
|
1054
|
+
minScore?: number;
|
|
1055
|
+
}
|
|
1056
|
+
interface AiwgStaticSemanticResult {
|
|
1057
|
+
item: AiwgFortemiRecord;
|
|
1058
|
+
score: number;
|
|
1059
|
+
embedding?: AiwgStaticEmbeddingRecord;
|
|
1060
|
+
}
|
|
1061
|
+
interface AiwgStaticHybridQueryOptions extends AiwgStaticSemanticQueryOptions, AiwgIndexQueryOptions {
|
|
1062
|
+
lexicalWeight?: number;
|
|
1063
|
+
semanticWeight?: number;
|
|
1064
|
+
}
|
|
1065
|
+
interface AiwgStaticDuplicatePair {
|
|
1066
|
+
left: AiwgFortemiRecord;
|
|
1067
|
+
right: AiwgFortemiRecord;
|
|
1068
|
+
score: number;
|
|
1069
|
+
}
|
|
1070
|
+
interface AiwgReviewInput {
|
|
1071
|
+
item_id: string;
|
|
1072
|
+
action: AiwgReviewAction;
|
|
1073
|
+
reason?: string;
|
|
1074
|
+
}
|
|
1075
|
+
interface AiwgIndexControllerSnapshot {
|
|
1076
|
+
index: AiwgFortemiIndexExport | null;
|
|
1077
|
+
chunked: {
|
|
1078
|
+
manifest: AiwgFortemiChunkManifest;
|
|
1079
|
+
cachedParts: number;
|
|
1080
|
+
maxCachedParts: number;
|
|
1081
|
+
} | null;
|
|
1082
|
+
data: AiwgIndexQueryResult | null;
|
|
1083
|
+
error: Error | null;
|
|
1084
|
+
reviewDecisions: AiwgReviewDecision[];
|
|
1085
|
+
}
|
|
1086
|
+
type AiwgIndexControllerListener = (snapshot: AiwgIndexControllerSnapshot) => void;
|
|
1087
|
+
interface AiwgIndexController {
|
|
1088
|
+
loadIndex(value: unknown): AiwgFortemiIndexExport;
|
|
1089
|
+
loadChunkedIndex(manifest: unknown, loader: AiwgChunkedIndexLoader, options?: AiwgChunkedIndexLoadOptions): AiwgFortemiChunkManifest;
|
|
1090
|
+
getIndex(): AiwgFortemiIndexExport | null;
|
|
1091
|
+
getChunkedManifest(): AiwgFortemiChunkManifest | null;
|
|
1092
|
+
getSnapshot(): AiwgIndexControllerSnapshot;
|
|
1093
|
+
query(query?: string, options?: AiwgIndexQueryOptions): AiwgIndexQueryResult;
|
|
1094
|
+
queryChunked(query?: string, options?: AiwgChunkedIndexQueryOptions): Promise<AiwgChunkedIndexQueryResult>;
|
|
1095
|
+
getRecord(id: string): Promise<AiwgFortemiRecord>;
|
|
1096
|
+
neighbors(id: string, options?: AiwgRelationshipTraversalOptions): Promise<AiwgRelationshipTraversalResult>;
|
|
1097
|
+
relationshipQuery(options?: AiwgRelationshipQueryOptions): Promise<AiwgRelationshipTraversalResult>;
|
|
1098
|
+
relationshipSet(options: AiwgRelationshipSetOptions): Promise<AiwgRelationshipSetResult>;
|
|
1099
|
+
clearChunkCache(): void;
|
|
1100
|
+
toCommunityGraph(options?: AiwgIndexGraphOptions): ReturnType<typeof aiwgFortemiIndexToCommunityGraph>;
|
|
1101
|
+
toCommunityGraphChunked(options?: AiwgIndexGraphOptions & {
|
|
1102
|
+
onProgress?: (progress: AiwgChunkedIndexProgress) => void;
|
|
1103
|
+
}): Promise<ReturnType<typeof aiwgFortemiIndexToCommunityGraph>>;
|
|
1104
|
+
setReviewDecision(input: AiwgReviewInput): AiwgReviewDecision;
|
|
1105
|
+
clearReviewDecision(itemId: string): void;
|
|
1106
|
+
createReviewDecisionExport(generatedAt?: string): AiwgReviewDecisionExport;
|
|
1107
|
+
subscribe(listener: AiwgIndexControllerListener): () => void;
|
|
1108
|
+
}
|
|
1109
|
+
declare function validateAiwgFortemiIndexExport(value: unknown): AiwgIndexValidationResult;
|
|
1110
|
+
declare function assertAiwgFortemiIndexExport(value: unknown): AiwgFortemiIndexExport;
|
|
1111
|
+
declare function validateAiwgFortemiChunkManifest(value: unknown): AiwgChunkedIndexValidationResult;
|
|
1112
|
+
declare function assertAiwgFortemiChunkManifest(value: unknown): AiwgFortemiChunkManifest;
|
|
1113
|
+
declare function validateAiwgFortemiChunkPart(value: unknown, partRef?: AiwgFortemiChunkPartRef, manifest?: AiwgFortemiChunkManifest): AiwgChunkedIndexValidationResult;
|
|
1114
|
+
declare function assertAiwgFortemiChunkPart(value: unknown, partRef?: AiwgFortemiChunkPartRef, manifest?: AiwgFortemiChunkManifest): AiwgFortemiChunkPart;
|
|
1115
|
+
declare function createAiwgFetchChunkLoader(baseUrl?: string | URL): AiwgChunkedIndexLoader;
|
|
1116
|
+
declare function createAiwgFetchDetailLoader(baseUrl?: string | URL): AiwgChunkedIndexDetailLoader;
|
|
1117
|
+
declare function getAiwgFortemiFacets(items: AiwgFortemiRecord[]): Record<string, Record<string, number>>;
|
|
1118
|
+
declare function buildAiwgStaticEmbeddingSet(index: AiwgFortemiIndexExport, options: BuildAiwgStaticEmbeddingSetOptions): Promise<AiwgStaticEmbeddingSet>;
|
|
1119
|
+
interface AiwgChunkedIndexBuildOptions {
|
|
1120
|
+
partSize?: number;
|
|
1121
|
+
projection?: Array<keyof AiwgFortemiRecord>;
|
|
1122
|
+
detailHref?: string;
|
|
1123
|
+
idEncoding?: AiwgDetailIdEncoding;
|
|
1124
|
+
generatedAt?: string;
|
|
1125
|
+
/** Privacy filtering (SEC6). Default-safe: excludes `private`/`pii` records. */
|
|
1126
|
+
privacy?: AiwgPrivacyFilterOptions;
|
|
1127
|
+
}
|
|
1128
|
+
interface AiwgChunkedIndexBuildResult {
|
|
1129
|
+
manifest: AiwgFortemiChunkManifest;
|
|
1130
|
+
parts: Array<{
|
|
1131
|
+
href: string;
|
|
1132
|
+
part: AiwgFortemiChunkPart;
|
|
1133
|
+
}>;
|
|
1134
|
+
details: Array<{
|
|
1135
|
+
id: string;
|
|
1136
|
+
href: string;
|
|
1137
|
+
record: AiwgFortemiRecord;
|
|
1138
|
+
}>;
|
|
1139
|
+
}
|
|
1140
|
+
declare function buildAiwgChunkedIndex(index: AiwgFortemiIndexExport, options?: AiwgChunkedIndexBuildOptions): AiwgChunkedIndexBuildResult;
|
|
1141
|
+
declare function queryAiwgFortemiIndex(index: AiwgFortemiIndexExport, query?: string, options?: AiwgIndexQueryOptions): AiwgIndexQueryResult;
|
|
1142
|
+
declare function validateAiwgStaticEmbeddingSet(value: unknown): AiwgChunkedIndexValidationResult;
|
|
1143
|
+
declare function assertAiwgStaticEmbeddingSet(value: unknown): AiwgStaticEmbeddingSet;
|
|
1144
|
+
declare function queryAiwgSemanticIndex(index: AiwgFortemiIndexExport, embeddingSet: AiwgStaticEmbeddingSet, queryEmbedding: number[], options?: AiwgStaticSemanticQueryOptions): AiwgStaticSemanticResult[];
|
|
1145
|
+
declare function queryAiwgHybridIndex(index: AiwgFortemiIndexExport, embeddingSet: AiwgStaticEmbeddingSet, query: string, queryEmbedding: number[], options?: AiwgStaticHybridQueryOptions): AiwgStaticSemanticResult[];
|
|
1146
|
+
declare function findAiwgStaticDuplicatePairs(index: AiwgFortemiIndexExport, embeddingSet: AiwgStaticEmbeddingSet, threshold?: number, options?: {
|
|
1147
|
+
maxEmbeddings?: number;
|
|
1148
|
+
}): AiwgStaticDuplicatePair[];
|
|
1149
|
+
declare function createAiwgReviewDecisionExport(source: Pick<AiwgFortemiIndexExport, 'schema_version'>, decisions: AiwgReviewDecision[], generatedAt?: string): AiwgReviewDecisionExport;
|
|
1150
|
+
declare function createAiwgIndexController(initialIndex?: AiwgFortemiIndexExport): AiwgIndexController;
|
|
1151
|
+
declare function aiwgFortemiIndexToCommunityGraph(index: AiwgFortemiIndexExport, options?: AiwgIndexGraphOptions): {
|
|
1152
|
+
nodes: {
|
|
1153
|
+
id: string;
|
|
1154
|
+
}[];
|
|
1155
|
+
edges: {
|
|
1156
|
+
source: string;
|
|
1157
|
+
target: string;
|
|
1158
|
+
kind: string;
|
|
1159
|
+
weight: number;
|
|
1160
|
+
}[];
|
|
1161
|
+
communities: {
|
|
1162
|
+
id: string;
|
|
1163
|
+
nodes: string[];
|
|
1164
|
+
}[];
|
|
1165
|
+
};
|
|
1166
|
+
|
|
1167
|
+
interface AiwgFullV1ConversionResult {
|
|
1168
|
+
success: boolean;
|
|
1169
|
+
archive: Uint8Array | null;
|
|
1170
|
+
profile: 'full-v1';
|
|
1171
|
+
schema_version: '2.0.0';
|
|
1172
|
+
/** Structural validity is separate from semantic losslessness. */
|
|
1173
|
+
lossless: boolean;
|
|
1174
|
+
losses: ShardLossEntry[];
|
|
1175
|
+
receipt: {
|
|
1176
|
+
schema_version: 'fortemi.aiwg-full-v1-conversion-receipt.v1';
|
|
1177
|
+
source_schema_version: 'aiwg.fortemi.index.export.v2';
|
|
1178
|
+
authority_repository: string;
|
|
1179
|
+
authority_commit: string;
|
|
1180
|
+
authority_contract_sha256: string;
|
|
1181
|
+
authority_schema_bundle_sha256: string;
|
|
1182
|
+
manifest_sha256: string | null;
|
|
1183
|
+
component_checksums: Record<string, string>;
|
|
1184
|
+
contract_valid: boolean;
|
|
1185
|
+
signed: false;
|
|
1186
|
+
};
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
interface AiwgKnowledgeShardOptions {
|
|
1190
|
+
createdAt?: string;
|
|
1191
|
+
matricVersion?: string;
|
|
1192
|
+
/** Use the report-bearing entry point for rich conversion. */
|
|
1193
|
+
includeNativeRichComponents?: boolean;
|
|
1194
|
+
}
|
|
1195
|
+
type AiwgKnowledgeShardConversionResult = AiwgFullV1ConversionResult;
|
|
1196
|
+
/**
|
|
1197
|
+
* Convert the static AIWG/Fortemi v2 index contract into a portable Knowledge
|
|
1198
|
+
* Shard. Every note retains the complete source envelope and record in metadata,
|
|
1199
|
+
* so the native note/link/SKOS/provenance projections are reversible.
|
|
1200
|
+
*/
|
|
1201
|
+
declare function aiwgFortemiIndexToKnowledgeShard(index: AiwgFortemiIndexExport, options?: AiwgKnowledgeShardOptions): Promise<Uint8Array>;
|
|
1202
|
+
/** Convert AIWG v2 into exact 2.0.0/full-v1 with mandatory loss evidence. */
|
|
1203
|
+
declare function aiwgFortemiIndexToKnowledgeShardWithReport(index: AiwgFortemiIndexExport, options?: Omit<AiwgKnowledgeShardOptions, 'includeNativeRichComponents'>): Promise<AiwgKnowledgeShardConversionResult>;
|
|
1204
|
+
/**
|
|
1205
|
+
* Recover the exact AIWG index envelope and records embedded by
|
|
1206
|
+
* {@link aiwgFortemiIndexToKnowledgeShard}.
|
|
1207
|
+
*/
|
|
1208
|
+
declare function aiwgFortemiIndexFromKnowledgeShard(bytes: Uint8Array): AiwgFortemiIndexExport;
|
|
1209
|
+
|
|
1210
|
+
export { type AiwgFortemiProvenanceEvent as $, type ImportResult as A, type BlobStore as B, AIWG_SCAN_REQUIRED_FIELDS as C, type AiwgChunkedIndexBuildOptions as D, type ExportOptions as E, type AiwgChunkedIndexBuildResult as F, type AiwgChunkedIndexDetailLoader as G, type AiwgChunkedIndexLoadOptions as H, type ImportOptions as I, type AiwgChunkedIndexLoader as J, type AiwgChunkedIndexProgress as K, type AiwgChunkedIndexProgressPhase as L, type AiwgChunkedIndexQueryOptions as M, type AiwgChunkedIndexQueryResult as N, type AiwgChunkedIndexValidationResult as O, type AiwgFortemiAttachmentReference as P, type AiwgFortemiBinarySource as Q, type AiwgFortemiChunk as R, type ShardAttachmentProjection as S, type AiwgFortemiChunkDetailRef as T, type AiwgFortemiChunkManifest as U, type AiwgFortemiChunkPart as V, type AiwgFortemiChunkPartRef as W, type AiwgFortemiIndexExport as X, type AiwgFortemiIndexExportSchemaVersion as Y, type AiwgFortemiProjectedRecord as Z, type AiwgFortemiProvenance as _, type ShardCollection as a, type ShardLayout as a$, type AiwgFortemiRecord as a0, type AiwgFortemiRecordEmbedding as a1, type AiwgFortemiRecordSchemaVersion as a2, type AiwgFortemiRecordSource as a3, type AiwgFortemiRecordType as a4, type AiwgFortemiRelationship as a5, type AiwgFortemiRelationshipDirection as a6, type AiwgFortemiSearchProjection as a7, type AiwgFortemiSkosConcept as a8, type AiwgFortemiSkosRelation as a9, type AiwgReviewAction as aA, type AiwgReviewDecision as aB, type AiwgReviewDecisionExport as aC, type AiwgReviewInput as aD, type AiwgStaticDuplicatePair as aE, type AiwgStaticEmbeddingRecord as aF, type AiwgStaticEmbeddingSet as aG, type AiwgStaticHybridQueryOptions as aH, type AiwgStaticSemanticQueryOptions as aI, type AiwgStaticSemanticResult as aJ, AllowlistTrustStore as aK, type BlobBackendKind as aL, type BlobStoreDiagnostics as aM, type BuildAiwgStaticEmbeddingSetOptions as aN, CURRENT_SHARD_VERSION as aO, type ConflictStrategy as aP, type CreateBlobStoreOptions as aQ, type ImportCounts as aR, type ImportProgress as aS, type ImportProgressPhase as aT, type KnowledgeShardProfile as aU, MemoryBlobStore as aV, SHARD_FORMAT as aW, SIGNATURE_ENTRY as aX, SIGNING_ENVELOPE_VERSION as aY, type ShardAuthorityStatus as aZ, type ShardClusterRef as a_, type AiwgFortemiSkosRelationType as aa, type AiwgHeadlessEmbeddingBackend as ab, type AiwgIndexController as ac, type AiwgIndexControllerListener as ad, type AiwgIndexControllerSnapshot as ae, type AiwgIndexGraphOptions as af, type AiwgIndexQueryMatch as ag, type AiwgIndexQueryOptions as ah, type AiwgIndexQueryRankedItem as ai, type AiwgIndexQueryResult as aj, type AiwgIndexQueryWeights as ak, type AiwgIndexValidationResult as al, type AiwgKnowledgeShardConversionResult as am, type AiwgKnowledgeShardOptions as an, type AiwgPrivacyClassification as ao, type AiwgPrivacyFilterOptions as ap, type AiwgProvenanceConfidence as aq, type AiwgRelationshipDirection as ar, type AiwgRelationshipEdgeSummary as as, type AiwgRelationshipNodeSummary as at, type AiwgRelationshipQueryOptions as au, type AiwgRelationshipSetOperation as av, type AiwgRelationshipSetOptions as aw, type AiwgRelationshipSetResult as ax, type AiwgRelationshipTraversalOptions as ay, type AiwgRelationshipTraversalResult as az, type ShardEmbeddingConfig as b, type ShardSignatureEnvelope as b0, type ShardSignatureVerdict as b1, type ShardSigner as b2, type ShardSigningPayload as b3, type ShardTrustStore as b4, type SignShardInput as b5, type TrustedKey as b6, type VerifyShardSignatureInput as b7, aiwgFortemiIndexFromKnowledgeShard as b8, aiwgFortemiIndexToCommunityGraph as b9, validateAiwgStaticEmbeddingSet as bA, verifyShardSignature as bB, aiwgFortemiIndexToKnowledgeShard as ba, aiwgFortemiIndexToKnowledgeShardWithReport as bb, assertAiwgFortemiChunkManifest as bc, assertAiwgFortemiChunkPart as bd, assertAiwgFortemiIndexExport as be, assertAiwgStaticEmbeddingSet as bf, buildAiwgChunkedIndex as bg, buildAiwgStaticEmbeddingSet as bh, createAiwgFetchChunkLoader as bi, createAiwgFetchDetailLoader as bj, createAiwgIndexController as bk, createAiwgReviewDecisionExport as bl, createBlobStore as bm, createLazyBlobStore as bn, filterAiwgRecordsByPrivacy as bo, findAiwgStaticDuplicatePairs as bp, getAiwgFortemiFacets as bq, isShardSigningSupported as br, queryAiwgFortemiIndex as bs, queryAiwgHybridIndex as bt, queryAiwgSemanticIndex as bu, sidecarBlobDigests as bv, signShard as bw, validateAiwgFortemiChunkManifest as bx, validateAiwgFortemiChunkPart as by, validateAiwgFortemiIndexExport as bz, type ShardEmbedding as c, type ShardEmbeddingSet as d, type ShardEmbeddingSetMember as e, type ShardLink as f, type ShardNote as g, type ShardNoteSkosTag as h, type ShardProvenanceEdge as i, type ShardSkosConcept as j, type ShardSkosRelation as k, type ShardSkosScheme as l, type ShardTag as m, type ShardTemplate as n, type ShardManifest as o, type BlobReconcileOptions as p, type BlobReconcileResult as q, type BlobGcOptions as r, type BlobGcResult as s, type ShardBackend as t, type ShardOperation as u, type ShardComponent as v, type ShardLossEntry as w, type ShardCapabilityReport as x, type ShardProfileRegistryEntry as y, type ShardExportResult as z };
|