@equationalapplications/core-llm-wiki 9.2.0 → 9.3.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/dist/{chunk-E3JCZMJL.mjs → chunk-H436I7OM.mjs} +964 -386
- package/dist/chunk-H436I7OM.mjs.map +1 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +846 -156
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +142 -32
- package/dist/index.mjs.map +1 -1
- package/dist/{testing-BQScWWSA.d.mts → testing-DsD-idCv.d.mts} +218 -19
- package/dist/{testing-BQScWWSA.d.ts → testing-DsD-idCv.d.ts} +218 -19
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +675 -136
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +1 -1
- package/package.json +2 -2
- package/dist/chunk-E3JCZMJL.mjs.map +0 -1
|
@@ -862,9 +862,9 @@ type WikiDiagnosticSeverity = 'info' | 'warn' | 'error';
|
|
|
862
862
|
* Closed for this release series, but new codes are added in minor versions:
|
|
863
863
|
* hosts must tolerate codes they do not recognize.
|
|
864
864
|
*/
|
|
865
|
-
type WikiDiagnosticCode = 'ingest_chunk_failed' | 'fact_rejected' | 'task_rejected' | 'fact_deduplicated' | 'edge_dropped' | 'embedding_failed' | 'hook_failed' | 'background_job_failed' | 'heal_skipped' | 'grounding_missing' | 'grounding_failed' | 'classification_low_confidence' | 'classification_invalid' | 'llm_usage' | 'librarian_gate' | 'librarian_op_rejected' | 'contradicts_document' | 'resolve_failed' | 'read_budget' | 'event_retention_held' | 'event_created_at_clamped' | 'event_created_at_restamped' | 'external_deletion_pending' | 'external_deletion_discarded' | 'guidance_too_long' | 'guidance_resolver_failed' | 'source_pointer_unresolved' | 'source_pointer_invalid' | 'source_store_source_too_large' | 'source_store_budget_exceeded' | 'source_store_hash_mismatch' | 'source_store_duplicate_hash' | 'source_store_text_not_storable';
|
|
865
|
+
type WikiDiagnosticCode = 'ingest_chunk_failed' | 'fact_rejected' | 'task_rejected' | 'fact_deduplicated' | 'edge_dropped' | 'embedding_failed' | 'hook_failed' | 'background_job_failed' | 'heal_skipped' | 'grounding_missing' | 'grounding_failed' | 'classification_low_confidence' | 'classification_invalid' | 'llm_usage' | 'librarian_gate' | 'librarian_op_rejected' | 'contradicts_document' | 'resolve_failed' | 'read_budget' | 'event_retention_held' | 'prune_checkpoint_incomplete' | 'erase_secure_delete_off' | 'erase_entity_skipped' | 'erase_retired_vtab_undroppable' | 'erase_retired_remaining' | 'erase_tombstones_remaining' | 'erase_retired_read_failed' | 'erase_registry_sweep_skipped' | 'import_tombstone_skipped' | 'event_created_at_clamped' | 'event_created_at_restamped' | 'external_deletion_pending' | 'external_deletion_discarded' | 'guidance_too_long' | 'guidance_resolver_failed' | 'source_pointer_unresolved' | 'source_pointer_invalid' | 'source_store_source_too_large' | 'source_store_budget_exceeded' | 'source_store_hash_mismatch' | 'source_store_duplicate_hash' | 'source_store_text_not_storable';
|
|
866
866
|
/** The service run that emitted the diagnostic. */
|
|
867
|
-
type WikiDiagnosticOperation = 'ingest' | 'upsertGraph' | 'librarian' | 'heal' | 'ontologyBackfill' | 'reembed' | 'importDump' | 'write' | 'supersede' | 'remember' | 'read' | 'prune' | 'externalDeletion' | 'sourceStore';
|
|
867
|
+
type WikiDiagnosticOperation = 'ingest' | 'upsertGraph' | 'librarian' | 'heal' | 'ontologyBackfill' | 'reembed' | 'importDump' | 'write' | 'supersede' | 'remember' | 'read' | 'prune' | 'externalDeletion' | 'sourceStore' | 'erase';
|
|
868
868
|
/** `'auto'` when a write threshold started the run (auto-librarian / auto-heal); `'call'` when the host did. */
|
|
869
869
|
type WikiDiagnosticTrigger = 'call' | 'auto';
|
|
870
870
|
/** Identifiers only — never titles, bodies, quotes, LLM output, provider messages, or hashes of content. */
|
|
@@ -911,6 +911,8 @@ interface WikiDiagnosticDetail {
|
|
|
911
911
|
guidanceLength?: number;
|
|
912
912
|
/** guidance_too_long only: which configured value was refused. */
|
|
913
913
|
guidanceSource?: 'per_entity' | 'default';
|
|
914
|
+
/** `erase_retired_remaining` only: retired FTS table names still present after reclamation. */
|
|
915
|
+
tables?: string[];
|
|
914
916
|
}
|
|
915
917
|
interface WikiDiagnostic {
|
|
916
918
|
code: WikiDiagnosticCode;
|
|
@@ -1162,8 +1164,12 @@ interface EntityStatus {
|
|
|
1162
1164
|
* and `'forget'` were added in v3.0. `'ontologyBackfill'` was added afterward.
|
|
1163
1165
|
* Exhaustive `switch` / narrowing on this type must be updated (or given a
|
|
1164
1166
|
* `default` arm) to compile without errors.
|
|
1167
|
+
*
|
|
1168
|
+
* `'erase'` was added by a MINOR release (forget-erasure spec §2, ruling F).
|
|
1169
|
+
* Exhaustive switches over this type must add a `default` arm; widening this
|
|
1170
|
+
* union rides the MINOR by policy and does not recur as a breaking change.
|
|
1165
1171
|
*/
|
|
1166
|
-
type WikiBusyOperation = 'ingest' | 'librarian' | 'heal' | 'prune' | 'reembed' | 'import' | 'forget' | 'ontologyBackfill' | 'store';
|
|
1172
|
+
type WikiBusyOperation = 'ingest' | 'librarian' | 'heal' | 'prune' | 'reembed' | 'import' | 'forget' | 'ontologyBackfill' | 'store' | 'erase';
|
|
1167
1173
|
/**
|
|
1168
1174
|
* Thrown when a background mutator is already running for the requested entity.
|
|
1169
1175
|
*/
|
|
@@ -1287,6 +1293,14 @@ declare class WikiTransactionError extends Error {
|
|
|
1287
1293
|
/** Selectors for {@link WikiMemory.forget}. `clearAll` excludes the other selectors. */
|
|
1288
1294
|
interface ForgetParams {
|
|
1289
1295
|
entryId?: string;
|
|
1296
|
+
/**
|
|
1297
|
+
* With `entryId` only: also forget the entry's supersession chain (every
|
|
1298
|
+
* predecessor and successor reached by walking `superseded_by` links, capped
|
|
1299
|
+
* at 100 per direction). The walk is NOT the connected component: with
|
|
1300
|
+
* fan-in A→C←B, forgetting A reaches C but not B. The forward walk deletes
|
|
1301
|
+
* the live current fact. Does not compose with other selectors.
|
|
1302
|
+
*/
|
|
1303
|
+
includeChain?: boolean;
|
|
1290
1304
|
taskId?: string;
|
|
1291
1305
|
sourceRef?: string;
|
|
1292
1306
|
sourceHash?: string;
|
|
@@ -1307,6 +1321,12 @@ interface ForgetResult {
|
|
|
1307
1321
|
events?: number;
|
|
1308
1322
|
};
|
|
1309
1323
|
metadataReset?: boolean;
|
|
1324
|
+
/** With `includeChain`: the chain ids forgotten alongside `entryId` (excludes `entryId`). */
|
|
1325
|
+
chainEntryIds?: string[];
|
|
1326
|
+
/** With `includeChain`: true when the walk hit the depth cap and the chain was cut short. */
|
|
1327
|
+
truncated?: boolean;
|
|
1328
|
+
/** Present with `truncated`: the depth-cap notice. */
|
|
1329
|
+
notice?: string;
|
|
1310
1330
|
}
|
|
1311
1331
|
/**
|
|
1312
1332
|
* Thrown by `runPrune()` after it has finished its other work, when the host's
|
|
@@ -1791,6 +1811,7 @@ declare class EntryRepository extends BaseRepository {
|
|
|
1791
1811
|
id: string;
|
|
1792
1812
|
entity_id: string;
|
|
1793
1813
|
updated_at: number;
|
|
1814
|
+
deleted_at: number | null;
|
|
1794
1815
|
}>>;
|
|
1795
1816
|
findIdById(id: string, entityId: string, tx?: SQLiteAdapter): Promise<string | null>;
|
|
1796
1817
|
findIdsBySource(entityId: string, sourceRef: string | null, sourceHash: string | null, tx?: SQLiteAdapter, includeDeleted?: boolean): Promise<string[]>;
|
|
@@ -1816,7 +1837,9 @@ declare class EntryRepository extends BaseRepository {
|
|
|
1816
1837
|
* Fetch IDs + entity_ids of soft-deleted rows older than cutoff for a given entity.
|
|
1817
1838
|
* Used by runPrune().
|
|
1818
1839
|
*/
|
|
1819
|
-
getPrunableMetadata(entityId: string, cutoff: number, tx?: SQLiteAdapter
|
|
1840
|
+
getPrunableMetadata(entityId: string, cutoff: number, tx?: SQLiteAdapter, opts?: {
|
|
1841
|
+
noCutoff?: boolean;
|
|
1842
|
+
}): Promise<Array<{
|
|
1820
1843
|
id: string;
|
|
1821
1844
|
entity_id: string;
|
|
1822
1845
|
}>>;
|
|
@@ -1824,7 +1847,9 @@ declare class EntryRepository extends BaseRepository {
|
|
|
1824
1847
|
* Fetch all non-deleted entries for an entity, ordered by updated_at DESC.
|
|
1825
1848
|
* Used by _getFullBundle().
|
|
1826
1849
|
*/
|
|
1827
|
-
findAllByEntityId(entityId: string, tx?: SQLiteAdapter
|
|
1850
|
+
findAllByEntityId(entityId: string, tx?: SQLiteAdapter, opts?: {
|
|
1851
|
+
includeDeleted?: boolean;
|
|
1852
|
+
}): Promise<WikiFact[]>;
|
|
1828
1853
|
/**
|
|
1829
1854
|
* Fetch live, mutable entries for an entity — everything heal is allowed to
|
|
1830
1855
|
* downgrade or delete — oldest first, capped at `limit`, skipping anything
|
|
@@ -1866,7 +1891,9 @@ declare class EntryRepository extends BaseRepository {
|
|
|
1866
1891
|
* Fetch all non-deleted entries for an entity with embedding blobs preserved.
|
|
1867
1892
|
* Used by ImportExportService for export/import round-tripping.
|
|
1868
1893
|
*/
|
|
1869
|
-
findAllByEntityIdWithBlobs(entityId: string, tx?: SQLiteAdapter
|
|
1894
|
+
findAllByEntityIdWithBlobs(entityId: string, tx?: SQLiteAdapter, opts?: {
|
|
1895
|
+
includeDeleted?: boolean;
|
|
1896
|
+
}): Promise<WikiFact[]>;
|
|
1870
1897
|
/**
|
|
1871
1898
|
* Count non-deleted entries for the given entities whose embedding_blob dimension
|
|
1872
1899
|
* doesn't match queryVecLength. Used by read() to detect model-switch mismatches.
|
|
@@ -1891,6 +1918,7 @@ declare class EntryRepository extends BaseRepository {
|
|
|
1891
1918
|
bulkDeletePruned(entityId: string, cutoff: number, ids: string[], tx: SQLiteAdapter, opts?: {
|
|
1892
1919
|
keepUnconfirmedRemovals?: boolean;
|
|
1893
1920
|
deletedIds?: string[];
|
|
1921
|
+
noCutoff?: boolean;
|
|
1894
1922
|
}): Promise<number>;
|
|
1895
1923
|
/**
|
|
1896
1924
|
* Mark orphaned entries (never accessed, old) as deleted.
|
|
@@ -1928,9 +1956,25 @@ declare class EntryRepository extends BaseRepository {
|
|
|
1928
1956
|
* entries_temporal_idx.
|
|
1929
1957
|
*/
|
|
1930
1958
|
findNonLiveIdsByEntityIds(entityIds: readonly string[], mode: LiveMode, t: number, tx?: SQLiteAdapter): Promise<Set<string>>;
|
|
1959
|
+
/**
|
|
1960
|
+
* Depth-aware supersession walk for chain forget (spec forget-erasure §3).
|
|
1961
|
+
* Probes `maxDepth + 1` levels so a chain longer than the cap is detectable;
|
|
1962
|
+
* the returned ids are capped to `maxDepth` per direction (successors nearest first; predecessors are returned farthest-first).
|
|
1963
|
+
* No `deleted_at` filter: soft-deleted links still carry the chain.
|
|
1964
|
+
*/
|
|
1965
|
+
findSupersessionChainWalk(entityId: string, factId: string, maxDepth: number, tx?: SQLiteAdapter): Promise<{
|
|
1966
|
+
ids: string[];
|
|
1967
|
+
truncated: boolean;
|
|
1968
|
+
}>;
|
|
1931
1969
|
findSupersessionChainIds(entityId: string, factId: string, maxDepth: number, tx?: SQLiteAdapter): Promise<{
|
|
1932
|
-
predecessors:
|
|
1933
|
-
|
|
1970
|
+
predecessors: Array<{
|
|
1971
|
+
id: string;
|
|
1972
|
+
depth: number;
|
|
1973
|
+
}>;
|
|
1974
|
+
successors: Array<{
|
|
1975
|
+
id: string;
|
|
1976
|
+
depth: number;
|
|
1977
|
+
}>;
|
|
1934
1978
|
}>;
|
|
1935
1979
|
findExpiredIds(entityId: string, cutoff: number, tx?: SQLiteAdapter): Promise<string[]>;
|
|
1936
1980
|
/**
|
|
@@ -2214,6 +2258,10 @@ type LibrarianWatermark = {
|
|
|
2214
2258
|
at: number;
|
|
2215
2259
|
id: string;
|
|
2216
2260
|
};
|
|
2261
|
+
/** A `wal_checkpoint(TRUNCATE)` that did not fully drain the WAL (erase step 5/8). */
|
|
2262
|
+
declare class CheckpointIncompleteError extends Error {
|
|
2263
|
+
readonly code = "erase_checkpoint_incomplete";
|
|
2264
|
+
}
|
|
2217
2265
|
declare class MetadataRepository extends BaseRepository {
|
|
2218
2266
|
getCheckpoint(entityId: string, tx: SQLiteAdapter): Promise<{
|
|
2219
2267
|
memory?: number;
|
|
@@ -2241,6 +2289,12 @@ declare class MetadataRepository extends BaseRepository {
|
|
|
2241
2289
|
clearDimensionMismatch(tx: SQLiteAdapter): Promise<void>;
|
|
2242
2290
|
tableExists(tableName: string, tx?: SQLiteAdapter): Promise<boolean>;
|
|
2243
2291
|
getTableDdl(tableName: string, tx?: SQLiteAdapter): Promise<string | null>;
|
|
2292
|
+
/**
|
|
2293
|
+
* `PRAGMA wal_checkpoint(TRUNCATE)`, verified: `busy !== 0` or
|
|
2294
|
+
* `log !== checkpointed` means frames survive in the WAL, so a deleted
|
|
2295
|
+
* row's bytes may still be on disk. Non-WAL reports (0,-1,-1) = complete.
|
|
2296
|
+
*/
|
|
2297
|
+
checkpointTruncateVerified(): Promise<void>;
|
|
2244
2298
|
vacuum(): Promise<void>;
|
|
2245
2299
|
/**
|
|
2246
2300
|
* Returns the set of distinct `entity_id` values across entries/tasks/events.
|
|
@@ -2250,8 +2304,16 @@ declare class MetadataRepository extends BaseRepository {
|
|
|
2250
2304
|
* soft-deleted, so the host's maintenance sweep can visit such
|
|
2251
2305
|
* "decommissioned-scope" namespaces and reap the soft-deleted rows. Sorting
|
|
2252
2306
|
* is `entity_id COLLATE BINARY` for stable, locale-independent ordering.
|
|
2253
|
-
|
|
2254
|
-
|
|
2307
|
+
*
|
|
2308
|
+
* With `opts.softDeletedAtOrBefore` the walk is narrowed to entities holding
|
|
2309
|
+
* at least one soft-deleted entry or task with `deleted_at` at or before
|
|
2310
|
+
* that cutoff (erase's hard-delete walk, forget-erasure spec §2). Without
|
|
2311
|
+
* the option the host-facing semantics above are unchanged.
|
|
2312
|
+
*/
|
|
2313
|
+
getDistinctEntityIds(tx?: SQLiteAdapter, opts?: {
|
|
2314
|
+
softDeletedAtOrBefore?: number;
|
|
2315
|
+
softDeletedAll?: boolean;
|
|
2316
|
+
}): Promise<string[]>;
|
|
2255
2317
|
getManifest(entityId: string, tx?: SQLiteAdapter): Promise<{
|
|
2256
2318
|
mode: OntologyMode;
|
|
2257
2319
|
manifest: OntologyManifest;
|
|
@@ -2590,6 +2652,24 @@ declare class SearchService {
|
|
|
2590
2652
|
* pass). Serialized on the sync chain; never rejects, like sync().
|
|
2591
2653
|
*/
|
|
2592
2654
|
syncPassages(db: SQLiteAdapter, prefix: string, entityId?: string, deadline?: number): Promise<void>;
|
|
2655
|
+
/** Run `fn` on the sync chain; the caller sees its rejection, the chain never rejects. */
|
|
2656
|
+
private chainSurfaced;
|
|
2657
|
+
/** True when the active strategy has both strict erase drains (FTS5); false for MiniSearch / Unavailable. */
|
|
2658
|
+
hasStrictDrain(): boolean;
|
|
2659
|
+
/** Erase step 3: chained passage drain, no deadline, errors surfaced. */
|
|
2660
|
+
drainPassagesSurfaced(): Promise<void>;
|
|
2661
|
+
/** Erase step 4: listed retired FTS tables (empty for strategies without any). */
|
|
2662
|
+
retiredTables(): Promise<string[]>;
|
|
2663
|
+
/** True when the active strategy can DROP retired tables (FTS5); false for MiniSearch / Unavailable. */
|
|
2664
|
+
canReclaimRetired(): boolean;
|
|
2665
|
+
/** Erase step 3: store-wide entries-side fts_pending drain on the sync chain, no deadline, errors surfaced. */
|
|
2666
|
+
drainEntriesLedgerSurfaced(): Promise<void>;
|
|
2667
|
+
/** Erase step 4: reclaim retired tables to completion; errors surfaced. */
|
|
2668
|
+
reclaimRetiredSurfaced(): Promise<void>;
|
|
2669
|
+
/** Erase step 7: FTS optimize on every FTS table that exists. */
|
|
2670
|
+
optimizeSurfaced(): Promise<void>;
|
|
2671
|
+
/** `erase({ rebuild: true })` wiring point; the orchestration (T6) calls it. */
|
|
2672
|
+
rebuildSurfaced(): Promise<void>;
|
|
2593
2673
|
/**
|
|
2594
2674
|
* Stored-source passage search for ONE entity (spec source-store section 7:
|
|
2595
2675
|
* ranking and caps are per entity). Rides the active strategy; a strategy
|
|
@@ -2625,7 +2705,7 @@ declare class SearchService {
|
|
|
2625
2705
|
private _compareSearchResults;
|
|
2626
2706
|
}
|
|
2627
2707
|
|
|
2628
|
-
type OperationType = 'prune' | 'librarian' | 'heal' | 'ingest' | 'reembed' | 'global_reembed' | 'import' | 'global_import' | 'forget' | 'ontologyBackfill' | 'store';
|
|
2708
|
+
type OperationType = 'prune' | 'librarian' | 'heal' | 'ingest' | 'reembed' | 'global_reembed' | 'import' | 'global_import' | 'forget' | 'ontologyBackfill' | 'store' | 'erase';
|
|
2629
2709
|
declare class JobManager {
|
|
2630
2710
|
private prefix;
|
|
2631
2711
|
private activeMaintenanceJobs;
|
|
@@ -2673,6 +2753,7 @@ declare class JobManager {
|
|
|
2673
2753
|
private _pruneKey;
|
|
2674
2754
|
private _reembedKey;
|
|
2675
2755
|
private _globalReembedKey;
|
|
2756
|
+
private _eraseKey;
|
|
2676
2757
|
private _importKey;
|
|
2677
2758
|
private _globalImportKey;
|
|
2678
2759
|
private _forgetKey;
|
|
@@ -2682,7 +2763,7 @@ declare class JobManager {
|
|
|
2682
2763
|
private _ontologyBackfillKey;
|
|
2683
2764
|
/**
|
|
2684
2765
|
* Lookup table for acquireLock/releaseLock's dynamic-dispatch branch.
|
|
2685
|
-
* Excludes 'ingest' | 'global_reembed' | 'global_import', which those
|
|
2766
|
+
* Excludes 'ingest' | 'global_reembed' | 'global_import' | 'erase', which those
|
|
2686
2767
|
* methods already handle via explicit if/else branches before reaching
|
|
2687
2768
|
* this table.
|
|
2688
2769
|
*/
|
|
@@ -2710,7 +2791,12 @@ declare class JobManager {
|
|
|
2710
2791
|
private _addIngestJob;
|
|
2711
2792
|
private _removeIngestJob;
|
|
2712
2793
|
private _isIngestActiveFor;
|
|
2713
|
-
|
|
2794
|
+
/**
|
|
2795
|
+
* `owner` is the fourth parameter (the third, `sourceRef`, is ingest-only).
|
|
2796
|
+
* `'erase'` marks the erase() pipeline's own per-entity prune, the only
|
|
2797
|
+
* operation exempt from the universal erase pre-check below.
|
|
2798
|
+
*/
|
|
2799
|
+
acquireLock(operation: OperationType, entityId: string, sourceRef?: string, owner?: 'host' | 'erase'): void;
|
|
2714
2800
|
releaseLock(operation: OperationType, entityId: string, sourceRef?: string): void;
|
|
2715
2801
|
/**
|
|
2716
2802
|
* Returns true if acquireLock(operation, entityId) would throw WikiBusyError.
|
|
@@ -3476,6 +3562,7 @@ declare class TaskRepository extends BaseRepository {
|
|
|
3476
3562
|
id: string;
|
|
3477
3563
|
entity_id: string;
|
|
3478
3564
|
updated_at: number;
|
|
3565
|
+
deleted_at: number | null;
|
|
3479
3566
|
}>>;
|
|
3480
3567
|
/**
|
|
3481
3568
|
* Upsert a WikiTask within the provided transaction.
|
|
@@ -3501,12 +3588,16 @@ declare class TaskRepository extends BaseRepository {
|
|
|
3501
3588
|
* Fetch all non-deleted tasks for an entity, ordered by priority DESC, created_at ASC.
|
|
3502
3589
|
* Used by _getFullBundle().
|
|
3503
3590
|
*/
|
|
3504
|
-
findAllByEntityId(entityId: string, tx?: SQLiteAdapter
|
|
3591
|
+
findAllByEntityId(entityId: string, tx?: SQLiteAdapter, opts?: {
|
|
3592
|
+
includeDeleted?: boolean;
|
|
3593
|
+
}): Promise<WikiTask[]>;
|
|
3505
3594
|
/**
|
|
3506
3595
|
* Bulk delete pruned tasks (already soft-deleted) by cutoff date.
|
|
3507
3596
|
* Used by runPrune(). Returns number of deleted rows.
|
|
3508
3597
|
*/
|
|
3509
|
-
bulkDeletePruned(entityId: string, cutoff: number, tx: SQLiteAdapter
|
|
3598
|
+
bulkDeletePruned(entityId: string, cutoff: number, tx: SQLiteAdapter, opts?: {
|
|
3599
|
+
noCutoff?: boolean;
|
|
3600
|
+
}): Promise<number>;
|
|
3510
3601
|
/**
|
|
3511
3602
|
* Soft-delete a task by ID within a transaction.
|
|
3512
3603
|
* Stages a DELETE outbox entry in the same transaction.
|
|
@@ -3710,6 +3801,48 @@ declare const ONTOLOGY_BACKFILL_RECHECK_MS: number;
|
|
|
3710
3801
|
declare const HEAL_BATCH_SIZE = 25;
|
|
3711
3802
|
/** Cooldown before an already-healed fact is offered again. Matches ontology backfill. */
|
|
3712
3803
|
declare const HEAL_RECHECK_MS: number;
|
|
3804
|
+
/** Report of the erase core (steps 0/1/1b); T6 extends it with the file steps. */
|
|
3805
|
+
interface EraseReport {
|
|
3806
|
+
/** True only when every step ran and the pragma read back ON. */
|
|
3807
|
+
verified: boolean;
|
|
3808
|
+
/** `PRAGMA secure_delete` as read back on the connection (1 = ON). */
|
|
3809
|
+
secureDelete: number | null;
|
|
3810
|
+
sqliteVersion: string;
|
|
3811
|
+
/** Entities step 1 enumerated. */
|
|
3812
|
+
entities: string[];
|
|
3813
|
+
/** External-removal holds, per entity (event-retention holds cannot arise: events are kept). */
|
|
3814
|
+
holds: Array<{
|
|
3815
|
+
entityId: string;
|
|
3816
|
+
deleted: number;
|
|
3817
|
+
deletedTasks: number;
|
|
3818
|
+
failedAt: string;
|
|
3819
|
+
remaining: number;
|
|
3820
|
+
}>;
|
|
3821
|
+
/** Entities skipped because their per-entity prune lock was busy. */
|
|
3822
|
+
skipped: string[];
|
|
3823
|
+
/** Superset of the hard-deleted entry ids, for the step-6 index sync (containment, not equality). */
|
|
3824
|
+
syncedIds: string[];
|
|
3825
|
+
registrySweep: {
|
|
3826
|
+
skipped: boolean;
|
|
3827
|
+
deleted: number;
|
|
3828
|
+
};
|
|
3829
|
+
/** Retired FTS tables left listed (module-less runtime): shadow tables emptied, DROP deferred to an FTS5-capable open. */
|
|
3830
|
+
retiredUndroppable: string[];
|
|
3831
|
+
failedStep: 'secure_delete' | 'vacuum' | 'checkpoint' | 'prune' | 'registry_sweep' | 'passage_drain' | 'retired_reclaim' | 'index_sync' | 'optimize' | 'rebuild' | 'tombstone_gate' | null;
|
|
3832
|
+
/** JS runtime the erase ran on (no overclaiming: this is not a storage-layer guarantee). */
|
|
3833
|
+
runtime: string;
|
|
3834
|
+
/** Every step's outcome, in execution order; a failed step is last. `partial` = ran with skipped entities or holds, or was skipped by design (`registry_sweep` on a pre-v9 store; `tombstone_gate` when holds/skips already account for surviving rows). */
|
|
3835
|
+
steps: Array<{
|
|
3836
|
+
step: string;
|
|
3837
|
+
outcome: 'ok' | 'partial' | 'failed';
|
|
3838
|
+
}>;
|
|
3839
|
+
}
|
|
3840
|
+
/** A failed erase step: carries the partial report (`verified: false`). */
|
|
3841
|
+
declare class EraseStepError extends Error {
|
|
3842
|
+
readonly code: string;
|
|
3843
|
+
readonly report: EraseReport;
|
|
3844
|
+
constructor(code: string, message: string, report: EraseReport, cause?: unknown);
|
|
3845
|
+
}
|
|
3713
3846
|
declare class MaintenanceService {
|
|
3714
3847
|
private db;
|
|
3715
3848
|
private prefix;
|
|
@@ -3732,11 +3865,52 @@ declare class MaintenanceService {
|
|
|
3732
3865
|
retainSoftDeletedFor?: number | null;
|
|
3733
3866
|
retainEventsFor?: number | null;
|
|
3734
3867
|
vacuum?: boolean;
|
|
3868
|
+
syncedIds?: string[];
|
|
3735
3869
|
}): Promise<{
|
|
3736
3870
|
entries: number;
|
|
3737
3871
|
tasks: number;
|
|
3738
3872
|
events: number;
|
|
3739
3873
|
}>;
|
|
3874
|
+
/**
|
|
3875
|
+
* Shared prune body. `owner: 'erase'` lets erase()'s own per-entity prune
|
|
3876
|
+
* through the universal erase fence in JobManager; the public `runPrune`
|
|
3877
|
+
* always passes `'host'`.
|
|
3878
|
+
*/
|
|
3879
|
+
private _runPrune;
|
|
3880
|
+
/** Shared by runPrune and erase step 5. */
|
|
3881
|
+
private _wrappedVacuum;
|
|
3882
|
+
/**
|
|
3883
|
+
* Erase core (forget-erasure spec §2, steps 0 / 1 / 1b). Thin entry: T6
|
|
3884
|
+
* completes the pipeline (FTS, VACUUM, checkpoint, sync). Never reports a
|
|
3885
|
+
* success it cannot verify: a failed step throws {@link EraseStepError}
|
|
3886
|
+
* carrying the partial report with `verified: false`.
|
|
3887
|
+
*/
|
|
3888
|
+
erase(opts?: {
|
|
3889
|
+
rebuild?: boolean;
|
|
3890
|
+
}): Promise<EraseReport>;
|
|
3891
|
+
/**
|
|
3892
|
+
* Step 3: chained, surfaced drains (no deadline). Entries-ledger failures are
|
|
3893
|
+
* the entries/index-sync step (`index_sync`); passage failures `passage_drain`.
|
|
3894
|
+
* N2 guard (probe lives here, strategy-agnostic): a strategy without the strict
|
|
3895
|
+
* drains (Unavailable / MiniSearch) cannot drain, so rows in either FTS ledger
|
|
3896
|
+
* mean text was never drained -> the step fails and erasure is unverified.
|
|
3897
|
+
* Absent or empty ledgers proceed.
|
|
3898
|
+
*/
|
|
3899
|
+
_eraseDrainPassages(report: EraseReport): Promise<void>;
|
|
3900
|
+
/**
|
|
3901
|
+
* Step 4 (and its re-run after step 6): reclaim retired FTS tables to
|
|
3902
|
+
* completion. A module-less runtime cannot DROP a virtual table, so each
|
|
3903
|
+
* retired table's shadow tables are emptied under the pragma and the name
|
|
3904
|
+
* stays listed; a later FTS5-capable open's step 4 completes the DROP.
|
|
3905
|
+
*/
|
|
3906
|
+
_eraseReclaimRetired(report: EraseReport): Promise<void>;
|
|
3907
|
+
/** Retired list straight from metadata (same key Fts5IndexStrategy maintains), independent of the active strategy. */
|
|
3908
|
+
private _retiredList;
|
|
3909
|
+
private sourceTableExists;
|
|
3910
|
+
/** Step 6 sync: `syncEntries` resolving false means the ledger drain failed — a failed step. */
|
|
3911
|
+
_eraseSyncEntries(entityId: string, ids: string[], report: EraseReport): Promise<void>;
|
|
3912
|
+
/** Step 7: FTS optimize on both FTS tables, after syncEntries. */
|
|
3913
|
+
_eraseOptimize(report: EraseReport): Promise<void>;
|
|
3740
3914
|
runLibrarian(entityId: string, options?: {
|
|
3741
3915
|
promptOverride?: string;
|
|
3742
3916
|
}): Promise<void>;
|
|
@@ -3993,7 +4167,9 @@ declare class ImportExportService {
|
|
|
3993
4167
|
constructor(db: SQLiteAdapter, entryRepo: EntryRepository, taskRepo: TaskRepository, eventRepo: EventRepository, edgeRepo: EdgeRepository, metadataRepo: MetadataRepository, searchService: SearchService, jobManager: JobManager, embeddingService: EmbeddingService, options?: Pick<WikiOptions, 'onDiagnostic' | 'forceDeleteIgnoreRankerHook' | 'config'>, vectorRemoval?: VectorRemovalService | undefined,
|
|
3994
4168
|
/** Table prefix for the source store; undefined (unit-test mocks) means no store access. */
|
|
3995
4169
|
prefix?: string | undefined);
|
|
3996
|
-
exportDump(entityIds?: string[]
|
|
4170
|
+
exportDump(entityIds?: string[], opts?: {
|
|
4171
|
+
includeForgotten?: boolean;
|
|
4172
|
+
}): Promise<MemoryDump>;
|
|
3997
4173
|
importDump(dump: MemoryDump, opts?: {
|
|
3998
4174
|
merge?: boolean;
|
|
3999
4175
|
}): Promise<ImportDumpResult>;
|
|
@@ -4011,6 +4187,7 @@ declare class ImportExportService {
|
|
|
4011
4187
|
getFullBundle(entityId: string, opts?: {
|
|
4012
4188
|
maxEvents?: number;
|
|
4013
4189
|
includeBlobs?: boolean;
|
|
4190
|
+
includeForgotten?: boolean;
|
|
4014
4191
|
}): Promise<MemoryBundle>;
|
|
4015
4192
|
/** Single-entity import transaction + post-processing; package-internal hook for tests. */
|
|
4016
4193
|
doImportEntity(entityId: string, bundle: MemoryDumpEntity, merge: boolean): Promise<ImportDumpResult['skippedSources']>;
|
|
@@ -4376,6 +4553,15 @@ declare class WikiMemory {
|
|
|
4376
4553
|
listEntityIds(options?: {
|
|
4377
4554
|
prefix?: string;
|
|
4378
4555
|
}): Promise<string[]>;
|
|
4556
|
+
/**
|
|
4557
|
+
* Erase everything soft-deleted, store-wide, and verify it (forget-erasure
|
|
4558
|
+
* spec §2). Throws `EraseStepError` (partial report, `verified: false`) when
|
|
4559
|
+
* a step fails; skipped entities report `verified: false`.
|
|
4560
|
+
* `{ rebuild: true }` additionally restarts the FTS rebuild.
|
|
4561
|
+
*/
|
|
4562
|
+
erase(options?: {
|
|
4563
|
+
rebuild?: boolean;
|
|
4564
|
+
}): Promise<EraseReport>;
|
|
4379
4565
|
runPrune(entityId: string, options?: {
|
|
4380
4566
|
retainSoftDeletedFor?: number | null;
|
|
4381
4567
|
retainEventsFor?: number | null;
|
|
@@ -4504,7 +4690,20 @@ declare class WikiMemory {
|
|
|
4504
4690
|
* so the ids stay stashed for the first sync after a re-init (#284 review).
|
|
4505
4691
|
*/
|
|
4506
4692
|
private syncDrained;
|
|
4507
|
-
exportDump(entityIds?: string[]
|
|
4693
|
+
exportDump(entityIds?: string[], opts?: {
|
|
4694
|
+
includeForgotten?: boolean;
|
|
4695
|
+
}): Promise<MemoryDump>;
|
|
4696
|
+
/**
|
|
4697
|
+
* The retention windows `runPrune()` uses when the host runs it (shipped
|
|
4698
|
+
* defaults plus host overrides), for GDPR disclosure. Nothing prunes
|
|
4699
|
+
* automatically; `erase()` ignores `retainSoftDeletedFor`. Days; `null`
|
|
4700
|
+
* means "keep forever". Read-only.
|
|
4701
|
+
*/
|
|
4702
|
+
getRetentionPolicy(): {
|
|
4703
|
+
retainSoftDeletedFor: number;
|
|
4704
|
+
retainEventsFor: number | null;
|
|
4705
|
+
pruneSupersededAfter: number | null;
|
|
4706
|
+
};
|
|
4508
4707
|
/** Entity summary prose persisted from an OKF profile ≥ 1 import; null when none stored. */
|
|
4509
4708
|
getEntitySummary(entityId: string): Promise<string | null>;
|
|
4510
4709
|
importDump(dump: MemoryDump, opts?: {
|
|
@@ -4765,5 +4964,5 @@ declare class WikiMemory {
|
|
|
4765
4964
|
setGeneratedByTask(taskId: string, entityId: string, actor: string): Promise<void>;
|
|
4766
4965
|
}
|
|
4767
4966
|
|
|
4768
|
-
export { HEAL_BATCH_SIZE as H, ONTOLOGY_BACKFILL_BATCH_SIZE as
|
|
4769
|
-
export type {
|
|
4967
|
+
export { CheckpointIncompleteError as C, HEAL_BATCH_SIZE as H, ONTOLOGY_BACKFILL_BATCH_SIZE as U, ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS as V, ONTOLOGY_BACKFILL_RECHECK_MS as X, RetrievalService as a$, PromptService as a7, PrunePartialFailureError as a8, WikiExternalDeletionError as aB, WikiGraphNodeOwnershipConflict as aD, WikiIngestEmptyError as aE, WikiInvalidReadOptions as aG, WikiMigrationRequiredError as aJ, WikiParseError as aL, WikiSearchUnavailableError as aM, WikiSourceRefHashCollision as aO, WikiStrictOntologyViolation as aP, WikiSupersedeError as aQ, WikiTransactionError as aT, isWikiSearchUnavailableError as aU, validateManifest as aV, EmbeddingService as aW, ImportExportService as aX, IngestionService as aY, JobManager as aZ, MaintenanceService as a_, WikiBusyError as an, WikiDraftNotFound as ax, WikiDuplicateHashError as ay, SearchService as b0, WriteService as b1, WikiMemory as c, EraseStepError as o, HEAL_RECHECK_MS as x, HOOK_TIMEOUT_MARKER as y };
|
|
4968
|
+
export type { OntologyManifest as $, IngestDocumentResult as A, LibrarianConfig as B, DegradedRecord as D, EmbedFactResult as E, FormatContextOptions as F, GraphNeighborhood as G, ImportDumpResult as I, LibrarianGateConfig as J, LockedMaintenanceJob as K, LLMProvider as L, MemoryBundle as M, MaintenanceJob as N, OntologyMode as O, MaintenanceStopReason as P, MemoryDumpEntity as Q, ReadOptions as R, SQLiteAdapter as S, MigrationPolicy as T, WikiOptions as W, OntologyBackfillResult as Y, OntologyConfig as Z, OntologyEdgeType as _, MemoryDump as a, OntologyNodeType as a0, OntologyPromptContext as a1, OntologyUpdates as a2, PendingMaintenance as a3, PendingMigrationWork as a4, PendingSourceStatus as a5, PromptOverrides as a6, ReembedResult as a9, WikiEvent as aA, WikiFact as aC, WikiInstructions as aF, WikiLintReport as aH, WikiMemoryTestAccess as aI, WikiOutboxEvent as aK, WikiSourcePointer as aN, WikiSupersedeReason as aR, WikiTask as aS, RememberInput as aa, RunPendingMaintenanceOptions as ab, RunPendingMaintenanceResult as ac, SourcePassage as ad, StoreSourceResult as ae, StoredSource as af, StoredSourceDump as ag, StoredSourceSummary as ah, SupersedeReplacement as ai, VectorRanker as aj, VectorRankerFallback as ak, VectorRankerRankArgs as al, VectorRankerSemanticResult as am, WikiBusyOperation as ao, WikiCheckpoint as ap, WikiConfig as aq, WikiDiagnostic as ar, WikiDiagnosticCode as as, WikiDiagnosticDetail as at, WikiDiagnosticOperation as au, WikiDiagnosticSeverity as av, WikiDiagnosticTrigger as aw, WikiEdge as az, FormattedMemoryDump as b, ChunkFailure as d, ClassifierAnswer as e, ClassifierQuestion as f, ClassifyRequest as g, ClassifyResponse as h, DraftPage as i, EmbedFailureKind as j, EmbeddingMarkerKind as k, EntityMaintenanceReport as l, EntityStatus as m, EraseReport as n, ExtractedFact as p, ExtractedFactEdge as q, ExtractedFactWithOntology as r, ExtractedTask as s, ForgetParams as t, ForgetResult as u, GraphTraversalOptions as v, GroundingConfig as w, HealResult as z };
|