@equationalapplications/core-llm-wiki 8.1.0 → 8.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.
@@ -778,9 +778,11 @@ interface VectorRanker {
778
778
  * Called after a fact's embedding is successfully persisted to embedding_blob (or cleared).
779
779
  * Hosts use this to keep sqlite-vec / external indexes consistent with SQLite as source of truth.
780
780
  *
781
- * On deletion paths (forget, prune, hard-delete), core awaits this hook to ensure ANN cleanup
782
- * completes before the deletion call resolves (GDPR compliance). Hook failures or timeouts on
783
- * those paths reject the deletion call.
781
+ * On forget and prune, core awaits this hook with `vector: null` after the delete commits, and
782
+ * a failure or timeout rejects the call. Cleanup is not yet durable: the loop stops at the
783
+ * first failing id, a retry re-sends ids already removed (make deletes idempotent), and a crash
784
+ * after commit loses the pending calls. Heal, re-ingest and replace-mode import only report
785
+ * failures (`hook_failed`). See the "Deleting data" guide.
784
786
  *
785
787
  * Treat `vector` as readonly — core provides a defensive copy, but adapters MUST NOT mutate.
786
788
  *
@@ -802,7 +804,7 @@ type WikiDiagnosticSeverity = 'info' | 'warn' | 'error';
802
804
  * Closed for this release series, but new codes are added in minor versions:
803
805
  * hosts must tolerate codes they do not recognize.
804
806
  */
805
- 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';
807
+ 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';
806
808
  /** The service run that emitted the diagnostic. */
807
809
  type WikiDiagnosticOperation = 'ingest' | 'upsertGraph' | 'librarian' | 'heal' | 'ontologyBackfill' | 'reembed' | 'importDump' | 'write' | 'supersede' | 'remember' | 'read' | 'prune';
808
810
  /** `'auto'` when a write threshold started the run (auto-librarian / auto-heal); `'call'` when the host did. */
@@ -937,6 +939,14 @@ interface MemoryBundle {
937
939
  edges?: WikiEdge[];
938
940
  /** Entity summary prose for OKF profile ≥ 1 round-trip. Omitted = no summary (Clanker default). */
939
941
  summary?: string;
942
+ /**
943
+ * The source store's librarian position. Set by export only; the importer
944
+ * trusts events at or before it as consolidated at the source.
945
+ */
946
+ librarian_watermark?: {
947
+ at: number;
948
+ id: string;
949
+ };
940
950
  factScores?: Record<string, number>;
941
951
  metadata?: {
942
952
  query: string;
@@ -1089,6 +1099,30 @@ declare class WikiTransactionError extends Error {
1089
1099
  cause: unknown;
1090
1100
  });
1091
1101
  }
1102
+ /** Selectors for {@link WikiMemory.forget}. `clearAll` excludes the other selectors. */
1103
+ interface ForgetParams {
1104
+ entryId?: string;
1105
+ taskId?: string;
1106
+ sourceRef?: string;
1107
+ sourceHash?: string;
1108
+ /** Soft-delete every fact and task of the entity, delete its edges, and delete its source-ref index rows. */
1109
+ clearAll?: boolean;
1110
+ /**
1111
+ * With `clearAll: true` only: also hard-delete every event of the entity,
1112
+ * read by the librarian or not, and reset the librarian's position. Without
1113
+ * it, events stay and a later maintenance run can read them into facts again.
1114
+ */
1115
+ includeEvents?: boolean;
1116
+ }
1117
+ /** Result of {@link WikiMemory.forget}. `deleted.events` is present only with `includeEvents`. */
1118
+ interface ForgetResult {
1119
+ deleted: {
1120
+ entries: number;
1121
+ tasks: number;
1122
+ events?: number;
1123
+ };
1124
+ metadataReset?: boolean;
1125
+ }
1092
1126
  declare class PrunePartialFailureError extends Error {
1093
1127
  readonly deleted: number;
1094
1128
  readonly failedAt: string;
@@ -1938,6 +1972,12 @@ declare class SourceRefIndexRepository extends BaseRepository {
1938
1972
  * backfill (the colon separator keeps the two ID spaces disjoint).
1939
1973
  */
1940
1974
  upsert(entityId: string, sourceHash: string, sourceRef: string, tx: SQLiteAdapter): Promise<void>;
1975
+ /**
1976
+ * Hard-delete every row of the entity, live or soft-deleted (forget clearAll,
1977
+ * spec import-followups §6 rev 4). Nothing reads a soft-deleted row and
1978
+ * runPrune never sweeps this table, so a wipe leaves no tombstones.
1979
+ */
1980
+ deleteByEntityId(entityId: string, tx: SQLiteAdapter): Promise<number>;
1941
1981
  /**
1942
1982
  * Idempotent soft-delete of the live row for (entity_id, source_ref).
1943
1983
  * Called at the start of every ingestDocument to remove the prior run's
@@ -3046,6 +3086,10 @@ declare class EventRepository extends BaseRepository {
3046
3086
  * Defaults to a limit of 50.
3047
3087
  */
3048
3088
  getRecentForEntities(entityIds: string[], limit?: number): Promise<WikiEvent[]>;
3089
+ /** Hard-delete every event of the entity, read or not (requested wipe, spec import-followups §6). */
3090
+ deleteByEntityId(entityId: string, tx: SQLiteAdapter): Promise<{
3091
+ changes: number;
3092
+ }>;
3049
3093
  /**
3050
3094
  * Delete events for an entity that were created at or before the given cutoff timestamp.
3051
3095
  * Returns the number of deleted rows.
@@ -3213,7 +3257,8 @@ declare class MaintenanceService {
3213
3257
  private embeddingService;
3214
3258
  private ontologyService?;
3215
3259
  private promptService;
3216
- constructor(db: SQLiteAdapter, prefix: string, options: WikiOptions, entryRepo: EntryRepository, sourceRefIndexRepo: SourceRefIndexRepository, taskRepo: TaskRepository, eventRepo: EventRepository, metadataRepo: MetadataRepository, searchService: SearchService, jobManager: JobManager, embeddingService: EmbeddingService, promptService?: PromptService, ontologyService?: OntologyService | undefined);
3260
+ constructor(db: SQLiteAdapter, prefix: string, options: WikiOptions, entryRepo: EntryRepository, sourceRefIndexRepo: SourceRefIndexRepository, taskRepo: TaskRepository, eventRepo: EventRepository, metadataRepo: MetadataRepository, searchService: SearchService, jobManager: JobManager, embeddingService: EmbeddingService, promptService?: PromptService, ontologyService?: OntologyService | undefined, edgeRepo?: EdgeRepository);
3261
+ private edgeRepo;
3217
3262
  runPrune(entityId: string, options?: {
3218
3263
  retainSoftDeletedFor?: number | null;
3219
3264
  retainEventsFor?: number | null;
@@ -3262,21 +3307,9 @@ declare class MaintenanceService {
3262
3307
  force?: boolean;
3263
3308
  skipExisting?: boolean;
3264
3309
  }): Promise<ReembedResult>;
3265
- forget(entityId: string, params: {
3266
- entryId?: string;
3267
- taskId?: string;
3268
- sourceRef?: string;
3269
- sourceHash?: string;
3270
- clearAll?: boolean;
3271
- }, opts?: {
3310
+ forget(entityId: string, params: ForgetParams, opts?: {
3272
3311
  dryRun?: boolean;
3273
- }): Promise<{
3274
- deleted: {
3275
- entries: number;
3276
- tasks: number;
3277
- };
3278
- metadataReset?: boolean;
3279
- }>;
3312
+ }): Promise<ForgetResult>;
3280
3313
  /**
3281
3314
  * Whether forget() should soft-delete in source_ref_index (#316,
3282
3315
  * specs/forget-pre-v9 §3.1). Normally true: setup()'s DDL creates the table.
@@ -3919,21 +3952,19 @@ declare class WikiMemory {
3919
3952
  importDump(dump: MemoryDump, opts?: {
3920
3953
  merge?: boolean;
3921
3954
  }): Promise<void>;
3922
- forget(entityId: string, params: {
3923
- entryId?: string;
3924
- taskId?: string;
3925
- sourceRef?: string;
3926
- sourceHash?: string;
3927
- clearAll?: boolean;
3928
- }, opts?: {
3955
+ /**
3956
+ * Soft-delete facts and tasks by id, by source, or all of them (`clearAll`).
3957
+ * `clearAll` also deletes the entity's edges and its source-ref index rows.
3958
+ * Add `includeEvents: true` to `clearAll` to hard-delete every event too,
3959
+ * read or not, and reset the librarian's position: without it a later
3960
+ * maintenance run can read the events into facts again. `runPrune()` then
3961
+ * hard-deletes the soft-deleted rows once they are older than
3962
+ * `retainSoftDeletedFor` (7 days by default; pass 0 to remove them now).
3963
+ * `dryRun` previews the counts.
3964
+ */
3965
+ forget(entityId: string, params: ForgetParams, opts?: {
3929
3966
  dryRun?: boolean;
3930
- }): Promise<{
3931
- deleted: {
3932
- entries: number;
3933
- tasks: number;
3934
- };
3935
- metadataReset?: boolean;
3936
- }>;
3967
+ }): Promise<ForgetResult>;
3937
3968
  /**
3938
3969
  * End `oldId`'s validity and link it to its replacement (spec §4.3). One
3939
3970
  * transaction. Throws `WikiSupersedeError` for missing, foreign, already
@@ -4157,5 +4188,5 @@ declare class WikiMemory {
4157
4188
  setGeneratedByTask(taskId: string, entityId: string, actor: string): Promise<void>;
4158
4189
  }
4159
4190
 
4160
- export { PromptService as $, ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS as A, ONTOLOGY_BACKFILL_RECHECK_MS as B, HEAL_BATCH_SIZE as H, ONTOLOGY_BACKFILL_BATCH_SIZE as O, PrunePartialFailureError as a0, WikiStrictOntologyViolation as aA, WikiSupersedeError as aB, WikiTransactionError as aE, isWikiSearchUnavailableError as aF, validateManifest as aG, EmbeddingService as aH, ImportExportService as aI, IngestionService as aJ, JobManager as aK, MaintenanceService as aL, RetrievalService as aM, SearchService as aN, WriteService as aO, WikiBusyError as aa, WikiDraftNotFound as ak, WikiDuplicateHashError as al, WikiGraphNodeOwnershipConflict as ap, WikiIngestEmptyError as aq, WikiInvalidReadOptions as as, WikiMigrationRequiredError as av, WikiParseError as ax, WikiSearchUnavailableError as ay, WikiSourceRefHashCollision as az, WikiMemory as c, HEAL_RECHECK_MS as s, HOOK_TIMEOUT_MARKER as t };
4161
- export type { ChunkFailure as C, DegradedRecord as D, EmbedFactResult as E, FormatContextOptions as F, GraphNeighborhood as G, IngestDocumentResult as I, OntologyBackfillResult as J, OntologyConfig as K, LLMProvider as L, MemoryBundle as M, OntologyEdgeType as N, OntologyManifest as P, OntologyMode as Q, ReadOptions as R, SQLiteAdapter as S, OntologyNodeType as T, OntologyPromptContext as U, OntologyUpdates as V, WikiOptions as W, PendingMaintenance as X, PendingMigrationWork as Y, PendingSourceStatus as Z, PromptOverrides as _, MemoryDump as a, ReembedResult as a1, RememberInput as a2, RunPendingMaintenanceOptions as a3, RunPendingMaintenanceResult as a4, SupersedeReplacement as a5, VectorRanker as a6, VectorRankerFallback as a7, VectorRankerRankArgs as a8, VectorRankerSemanticResult as a9, WikiSupersedeReason as aC, WikiTask as aD, WikiBusyOperation as ab, WikiCheckpoint as ac, WikiConfig as ad, WikiDiagnostic as ae, WikiDiagnosticCode as af, WikiDiagnosticDetail as ag, WikiDiagnosticOperation as ah, WikiDiagnosticSeverity as ai, WikiDiagnosticTrigger as aj, WikiEdge as am, WikiEvent as an, WikiFact as ao, WikiInstructions as ar, WikiLintReport as at, WikiMemoryTestAccess as au, WikiOutboxEvent as aw, FormattedMemoryDump as b, ClassifierAnswer as d, ClassifierQuestion as e, ClassifyRequest as f, ClassifyResponse as g, DraftPage as h, EmbedFailureKind as i, EmbeddingMarkerKind as j, EntityMaintenanceReport as k, EntityStatus as l, ExtractedFact as m, ExtractedFactEdge as n, ExtractedFactWithOntology as o, ExtractedTask as p, GraphTraversalOptions as q, GroundingConfig as r, HealResult as u, LibrarianConfig as v, LibrarianGateConfig as w, MaintenanceJob as x, MaintenanceStopReason as y, MigrationPolicy as z };
4191
+ export { HEAL_BATCH_SIZE as H, ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS as J, ONTOLOGY_BACKFILL_RECHECK_MS as K, ONTOLOGY_BACKFILL_BATCH_SIZE as O, PromptService as a1, PrunePartialFailureError as a2, WikiSearchUnavailableError as aA, WikiSourceRefHashCollision as aB, WikiStrictOntologyViolation as aC, WikiSupersedeError as aD, WikiTransactionError as aG, isWikiSearchUnavailableError as aH, validateManifest as aI, EmbeddingService as aJ, ImportExportService as aK, IngestionService as aL, JobManager as aM, MaintenanceService as aN, RetrievalService as aO, SearchService as aP, WriteService as aQ, WikiBusyError as ac, WikiDraftNotFound as am, WikiDuplicateHashError as an, WikiGraphNodeOwnershipConflict as ar, WikiIngestEmptyError as as, WikiInvalidReadOptions as au, WikiMigrationRequiredError as ax, WikiParseError as az, WikiMemory as c, HEAL_RECHECK_MS as u, HOOK_TIMEOUT_MARKER as v };
4192
+ export type { PendingSourceStatus as $, MaintenanceStopReason as A, MigrationPolicy as B, ChunkFailure as C, DegradedRecord as D, EmbedFactResult as E, FormatContextOptions as F, GraphNeighborhood as G, IngestDocumentResult as I, LLMProvider as L, MemoryBundle as M, OntologyBackfillResult as N, OntologyConfig as P, OntologyEdgeType as Q, ReadOptions as R, SQLiteAdapter as S, OntologyManifest as T, OntologyMode as U, OntologyNodeType as V, WikiOptions as W, OntologyPromptContext as X, OntologyUpdates as Y, PendingMaintenance as Z, PendingMigrationWork as _, MemoryDump as a, PromptOverrides as a0, ReembedResult as a3, RememberInput as a4, RunPendingMaintenanceOptions as a5, RunPendingMaintenanceResult as a6, SupersedeReplacement as a7, VectorRanker as a8, VectorRankerFallback as a9, WikiSupersedeReason as aE, WikiTask as aF, VectorRankerRankArgs as aa, VectorRankerSemanticResult as ab, WikiBusyOperation as ad, WikiCheckpoint as ae, WikiConfig as af, WikiDiagnostic as ag, WikiDiagnosticCode as ah, WikiDiagnosticDetail as ai, WikiDiagnosticOperation as aj, WikiDiagnosticSeverity as ak, WikiDiagnosticTrigger as al, WikiEdge as ao, WikiEvent as ap, WikiFact as aq, WikiInstructions as at, WikiLintReport as av, WikiMemoryTestAccess as aw, WikiOutboxEvent as ay, FormattedMemoryDump as b, ClassifierAnswer as d, ClassifierQuestion as e, ClassifyRequest as f, ClassifyResponse as g, DraftPage as h, EmbedFailureKind as i, EmbeddingMarkerKind as j, EntityMaintenanceReport as k, EntityStatus as l, ExtractedFact as m, ExtractedFactEdge as n, ExtractedFactWithOntology as o, ExtractedTask as p, ForgetParams as q, ForgetResult as r, GraphTraversalOptions as s, GroundingConfig as t, HealResult as w, LibrarianConfig as x, LibrarianGateConfig as y, MaintenanceJob as z };
@@ -778,9 +778,11 @@ interface VectorRanker {
778
778
  * Called after a fact's embedding is successfully persisted to embedding_blob (or cleared).
779
779
  * Hosts use this to keep sqlite-vec / external indexes consistent with SQLite as source of truth.
780
780
  *
781
- * On deletion paths (forget, prune, hard-delete), core awaits this hook to ensure ANN cleanup
782
- * completes before the deletion call resolves (GDPR compliance). Hook failures or timeouts on
783
- * those paths reject the deletion call.
781
+ * On forget and prune, core awaits this hook with `vector: null` after the delete commits, and
782
+ * a failure or timeout rejects the call. Cleanup is not yet durable: the loop stops at the
783
+ * first failing id, a retry re-sends ids already removed (make deletes idempotent), and a crash
784
+ * after commit loses the pending calls. Heal, re-ingest and replace-mode import only report
785
+ * failures (`hook_failed`). See the "Deleting data" guide.
784
786
  *
785
787
  * Treat `vector` as readonly — core provides a defensive copy, but adapters MUST NOT mutate.
786
788
  *
@@ -802,7 +804,7 @@ type WikiDiagnosticSeverity = 'info' | 'warn' | 'error';
802
804
  * Closed for this release series, but new codes are added in minor versions:
803
805
  * hosts must tolerate codes they do not recognize.
804
806
  */
805
- 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';
807
+ 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';
806
808
  /** The service run that emitted the diagnostic. */
807
809
  type WikiDiagnosticOperation = 'ingest' | 'upsertGraph' | 'librarian' | 'heal' | 'ontologyBackfill' | 'reembed' | 'importDump' | 'write' | 'supersede' | 'remember' | 'read' | 'prune';
808
810
  /** `'auto'` when a write threshold started the run (auto-librarian / auto-heal); `'call'` when the host did. */
@@ -937,6 +939,14 @@ interface MemoryBundle {
937
939
  edges?: WikiEdge[];
938
940
  /** Entity summary prose for OKF profile ≥ 1 round-trip. Omitted = no summary (Clanker default). */
939
941
  summary?: string;
942
+ /**
943
+ * The source store's librarian position. Set by export only; the importer
944
+ * trusts events at or before it as consolidated at the source.
945
+ */
946
+ librarian_watermark?: {
947
+ at: number;
948
+ id: string;
949
+ };
940
950
  factScores?: Record<string, number>;
941
951
  metadata?: {
942
952
  query: string;
@@ -1089,6 +1099,30 @@ declare class WikiTransactionError extends Error {
1089
1099
  cause: unknown;
1090
1100
  });
1091
1101
  }
1102
+ /** Selectors for {@link WikiMemory.forget}. `clearAll` excludes the other selectors. */
1103
+ interface ForgetParams {
1104
+ entryId?: string;
1105
+ taskId?: string;
1106
+ sourceRef?: string;
1107
+ sourceHash?: string;
1108
+ /** Soft-delete every fact and task of the entity, delete its edges, and delete its source-ref index rows. */
1109
+ clearAll?: boolean;
1110
+ /**
1111
+ * With `clearAll: true` only: also hard-delete every event of the entity,
1112
+ * read by the librarian or not, and reset the librarian's position. Without
1113
+ * it, events stay and a later maintenance run can read them into facts again.
1114
+ */
1115
+ includeEvents?: boolean;
1116
+ }
1117
+ /** Result of {@link WikiMemory.forget}. `deleted.events` is present only with `includeEvents`. */
1118
+ interface ForgetResult {
1119
+ deleted: {
1120
+ entries: number;
1121
+ tasks: number;
1122
+ events?: number;
1123
+ };
1124
+ metadataReset?: boolean;
1125
+ }
1092
1126
  declare class PrunePartialFailureError extends Error {
1093
1127
  readonly deleted: number;
1094
1128
  readonly failedAt: string;
@@ -1938,6 +1972,12 @@ declare class SourceRefIndexRepository extends BaseRepository {
1938
1972
  * backfill (the colon separator keeps the two ID spaces disjoint).
1939
1973
  */
1940
1974
  upsert(entityId: string, sourceHash: string, sourceRef: string, tx: SQLiteAdapter): Promise<void>;
1975
+ /**
1976
+ * Hard-delete every row of the entity, live or soft-deleted (forget clearAll,
1977
+ * spec import-followups §6 rev 4). Nothing reads a soft-deleted row and
1978
+ * runPrune never sweeps this table, so a wipe leaves no tombstones.
1979
+ */
1980
+ deleteByEntityId(entityId: string, tx: SQLiteAdapter): Promise<number>;
1941
1981
  /**
1942
1982
  * Idempotent soft-delete of the live row for (entity_id, source_ref).
1943
1983
  * Called at the start of every ingestDocument to remove the prior run's
@@ -3046,6 +3086,10 @@ declare class EventRepository extends BaseRepository {
3046
3086
  * Defaults to a limit of 50.
3047
3087
  */
3048
3088
  getRecentForEntities(entityIds: string[], limit?: number): Promise<WikiEvent[]>;
3089
+ /** Hard-delete every event of the entity, read or not (requested wipe, spec import-followups §6). */
3090
+ deleteByEntityId(entityId: string, tx: SQLiteAdapter): Promise<{
3091
+ changes: number;
3092
+ }>;
3049
3093
  /**
3050
3094
  * Delete events for an entity that were created at or before the given cutoff timestamp.
3051
3095
  * Returns the number of deleted rows.
@@ -3213,7 +3257,8 @@ declare class MaintenanceService {
3213
3257
  private embeddingService;
3214
3258
  private ontologyService?;
3215
3259
  private promptService;
3216
- constructor(db: SQLiteAdapter, prefix: string, options: WikiOptions, entryRepo: EntryRepository, sourceRefIndexRepo: SourceRefIndexRepository, taskRepo: TaskRepository, eventRepo: EventRepository, metadataRepo: MetadataRepository, searchService: SearchService, jobManager: JobManager, embeddingService: EmbeddingService, promptService?: PromptService, ontologyService?: OntologyService | undefined);
3260
+ constructor(db: SQLiteAdapter, prefix: string, options: WikiOptions, entryRepo: EntryRepository, sourceRefIndexRepo: SourceRefIndexRepository, taskRepo: TaskRepository, eventRepo: EventRepository, metadataRepo: MetadataRepository, searchService: SearchService, jobManager: JobManager, embeddingService: EmbeddingService, promptService?: PromptService, ontologyService?: OntologyService | undefined, edgeRepo?: EdgeRepository);
3261
+ private edgeRepo;
3217
3262
  runPrune(entityId: string, options?: {
3218
3263
  retainSoftDeletedFor?: number | null;
3219
3264
  retainEventsFor?: number | null;
@@ -3262,21 +3307,9 @@ declare class MaintenanceService {
3262
3307
  force?: boolean;
3263
3308
  skipExisting?: boolean;
3264
3309
  }): Promise<ReembedResult>;
3265
- forget(entityId: string, params: {
3266
- entryId?: string;
3267
- taskId?: string;
3268
- sourceRef?: string;
3269
- sourceHash?: string;
3270
- clearAll?: boolean;
3271
- }, opts?: {
3310
+ forget(entityId: string, params: ForgetParams, opts?: {
3272
3311
  dryRun?: boolean;
3273
- }): Promise<{
3274
- deleted: {
3275
- entries: number;
3276
- tasks: number;
3277
- };
3278
- metadataReset?: boolean;
3279
- }>;
3312
+ }): Promise<ForgetResult>;
3280
3313
  /**
3281
3314
  * Whether forget() should soft-delete in source_ref_index (#316,
3282
3315
  * specs/forget-pre-v9 §3.1). Normally true: setup()'s DDL creates the table.
@@ -3919,21 +3952,19 @@ declare class WikiMemory {
3919
3952
  importDump(dump: MemoryDump, opts?: {
3920
3953
  merge?: boolean;
3921
3954
  }): Promise<void>;
3922
- forget(entityId: string, params: {
3923
- entryId?: string;
3924
- taskId?: string;
3925
- sourceRef?: string;
3926
- sourceHash?: string;
3927
- clearAll?: boolean;
3928
- }, opts?: {
3955
+ /**
3956
+ * Soft-delete facts and tasks by id, by source, or all of them (`clearAll`).
3957
+ * `clearAll` also deletes the entity's edges and its source-ref index rows.
3958
+ * Add `includeEvents: true` to `clearAll` to hard-delete every event too,
3959
+ * read or not, and reset the librarian's position: without it a later
3960
+ * maintenance run can read the events into facts again. `runPrune()` then
3961
+ * hard-deletes the soft-deleted rows once they are older than
3962
+ * `retainSoftDeletedFor` (7 days by default; pass 0 to remove them now).
3963
+ * `dryRun` previews the counts.
3964
+ */
3965
+ forget(entityId: string, params: ForgetParams, opts?: {
3929
3966
  dryRun?: boolean;
3930
- }): Promise<{
3931
- deleted: {
3932
- entries: number;
3933
- tasks: number;
3934
- };
3935
- metadataReset?: boolean;
3936
- }>;
3967
+ }): Promise<ForgetResult>;
3937
3968
  /**
3938
3969
  * End `oldId`'s validity and link it to its replacement (spec §4.3). One
3939
3970
  * transaction. Throws `WikiSupersedeError` for missing, foreign, already
@@ -4157,5 +4188,5 @@ declare class WikiMemory {
4157
4188
  setGeneratedByTask(taskId: string, entityId: string, actor: string): Promise<void>;
4158
4189
  }
4159
4190
 
4160
- export { PromptService as $, ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS as A, ONTOLOGY_BACKFILL_RECHECK_MS as B, HEAL_BATCH_SIZE as H, ONTOLOGY_BACKFILL_BATCH_SIZE as O, PrunePartialFailureError as a0, WikiStrictOntologyViolation as aA, WikiSupersedeError as aB, WikiTransactionError as aE, isWikiSearchUnavailableError as aF, validateManifest as aG, EmbeddingService as aH, ImportExportService as aI, IngestionService as aJ, JobManager as aK, MaintenanceService as aL, RetrievalService as aM, SearchService as aN, WriteService as aO, WikiBusyError as aa, WikiDraftNotFound as ak, WikiDuplicateHashError as al, WikiGraphNodeOwnershipConflict as ap, WikiIngestEmptyError as aq, WikiInvalidReadOptions as as, WikiMigrationRequiredError as av, WikiParseError as ax, WikiSearchUnavailableError as ay, WikiSourceRefHashCollision as az, WikiMemory as c, HEAL_RECHECK_MS as s, HOOK_TIMEOUT_MARKER as t };
4161
- export type { ChunkFailure as C, DegradedRecord as D, EmbedFactResult as E, FormatContextOptions as F, GraphNeighborhood as G, IngestDocumentResult as I, OntologyBackfillResult as J, OntologyConfig as K, LLMProvider as L, MemoryBundle as M, OntologyEdgeType as N, OntologyManifest as P, OntologyMode as Q, ReadOptions as R, SQLiteAdapter as S, OntologyNodeType as T, OntologyPromptContext as U, OntologyUpdates as V, WikiOptions as W, PendingMaintenance as X, PendingMigrationWork as Y, PendingSourceStatus as Z, PromptOverrides as _, MemoryDump as a, ReembedResult as a1, RememberInput as a2, RunPendingMaintenanceOptions as a3, RunPendingMaintenanceResult as a4, SupersedeReplacement as a5, VectorRanker as a6, VectorRankerFallback as a7, VectorRankerRankArgs as a8, VectorRankerSemanticResult as a9, WikiSupersedeReason as aC, WikiTask as aD, WikiBusyOperation as ab, WikiCheckpoint as ac, WikiConfig as ad, WikiDiagnostic as ae, WikiDiagnosticCode as af, WikiDiagnosticDetail as ag, WikiDiagnosticOperation as ah, WikiDiagnosticSeverity as ai, WikiDiagnosticTrigger as aj, WikiEdge as am, WikiEvent as an, WikiFact as ao, WikiInstructions as ar, WikiLintReport as at, WikiMemoryTestAccess as au, WikiOutboxEvent as aw, FormattedMemoryDump as b, ClassifierAnswer as d, ClassifierQuestion as e, ClassifyRequest as f, ClassifyResponse as g, DraftPage as h, EmbedFailureKind as i, EmbeddingMarkerKind as j, EntityMaintenanceReport as k, EntityStatus as l, ExtractedFact as m, ExtractedFactEdge as n, ExtractedFactWithOntology as o, ExtractedTask as p, GraphTraversalOptions as q, GroundingConfig as r, HealResult as u, LibrarianConfig as v, LibrarianGateConfig as w, MaintenanceJob as x, MaintenanceStopReason as y, MigrationPolicy as z };
4191
+ export { HEAL_BATCH_SIZE as H, ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS as J, ONTOLOGY_BACKFILL_RECHECK_MS as K, ONTOLOGY_BACKFILL_BATCH_SIZE as O, PromptService as a1, PrunePartialFailureError as a2, WikiSearchUnavailableError as aA, WikiSourceRefHashCollision as aB, WikiStrictOntologyViolation as aC, WikiSupersedeError as aD, WikiTransactionError as aG, isWikiSearchUnavailableError as aH, validateManifest as aI, EmbeddingService as aJ, ImportExportService as aK, IngestionService as aL, JobManager as aM, MaintenanceService as aN, RetrievalService as aO, SearchService as aP, WriteService as aQ, WikiBusyError as ac, WikiDraftNotFound as am, WikiDuplicateHashError as an, WikiGraphNodeOwnershipConflict as ar, WikiIngestEmptyError as as, WikiInvalidReadOptions as au, WikiMigrationRequiredError as ax, WikiParseError as az, WikiMemory as c, HEAL_RECHECK_MS as u, HOOK_TIMEOUT_MARKER as v };
4192
+ export type { PendingSourceStatus as $, MaintenanceStopReason as A, MigrationPolicy as B, ChunkFailure as C, DegradedRecord as D, EmbedFactResult as E, FormatContextOptions as F, GraphNeighborhood as G, IngestDocumentResult as I, LLMProvider as L, MemoryBundle as M, OntologyBackfillResult as N, OntologyConfig as P, OntologyEdgeType as Q, ReadOptions as R, SQLiteAdapter as S, OntologyManifest as T, OntologyMode as U, OntologyNodeType as V, WikiOptions as W, OntologyPromptContext as X, OntologyUpdates as Y, PendingMaintenance as Z, PendingMigrationWork as _, MemoryDump as a, PromptOverrides as a0, ReembedResult as a3, RememberInput as a4, RunPendingMaintenanceOptions as a5, RunPendingMaintenanceResult as a6, SupersedeReplacement as a7, VectorRanker as a8, VectorRankerFallback as a9, WikiSupersedeReason as aE, WikiTask as aF, VectorRankerRankArgs as aa, VectorRankerSemanticResult as ab, WikiBusyOperation as ad, WikiCheckpoint as ae, WikiConfig as af, WikiDiagnostic as ag, WikiDiagnosticCode as ah, WikiDiagnosticDetail as ai, WikiDiagnosticOperation as aj, WikiDiagnosticSeverity as ak, WikiDiagnosticTrigger as al, WikiEdge as ao, WikiEvent as ap, WikiFact as aq, WikiInstructions as at, WikiLintReport as av, WikiMemoryTestAccess as aw, WikiOutboxEvent as ay, FormattedMemoryDump as b, ClassifierAnswer as d, ClassifierQuestion as e, ClassifyRequest as f, ClassifyResponse as g, DraftPage as h, EmbedFailureKind as i, EmbeddingMarkerKind as j, EntityMaintenanceReport as k, EntityStatus as l, ExtractedFact as m, ExtractedFactEdge as n, ExtractedFactWithOntology as o, ExtractedTask as p, ForgetParams as q, ForgetResult as r, GraphTraversalOptions as s, GroundingConfig as t, HealResult as w, LibrarianConfig as x, LibrarianGateConfig as y, MaintenanceJob as z };
@@ -1,2 +1,2 @@
1
- export { aH as EmbeddingService, aI as ImportExportService, aJ as IngestionService, aK as JobManager, aK as JobManagerType, aL as MaintenanceService, aM as RetrievalService, aN as SearchService, aN as SearchServiceType, au as WikiMemoryTestAccess, aO as WriteService } from './testing-CG8Hw5Ph.mjs';
1
+ export { aJ as EmbeddingService, aK as ImportExportService, aL as IngestionService, aM as JobManager, aM as JobManagerType, aN as MaintenanceService, aO as RetrievalService, aP as SearchService, aP as SearchServiceType, aw as WikiMemoryTestAccess, aQ as WriteService } from './testing-BT5qSnGB.mjs';
2
2
  import '@equationalapplications/core-okf';
package/dist/testing.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { aH as EmbeddingService, aI as ImportExportService, aJ as IngestionService, aK as JobManager, aK as JobManagerType, aL as MaintenanceService, aM as RetrievalService, aN as SearchService, aN as SearchServiceType, au as WikiMemoryTestAccess, aO as WriteService } from './testing-CG8Hw5Ph.js';
1
+ export { aJ as EmbeddingService, aK as ImportExportService, aL as IngestionService, aM as JobManager, aM as JobManagerType, aN as MaintenanceService, aO as RetrievalService, aP as SearchService, aP as SearchServiceType, aw as WikiMemoryTestAccess, aQ as WriteService } from './testing-BT5qSnGB.js';
2
2
  import '@equationalapplications/core-okf';