@equationalapplications/core-llm-wiki 9.4.3 → 9.5.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/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { M as MemoryBundle, F as FormatContextOptions, G as GraphNeighborhood, a as MemoryDump, b as FormattedMemoryDump, O as OntologyMode, R as ReadOptions, S as SQLiteAdapter, W as WikiOptions, c as WikiMemory } from './testing-BVY5P6BS.mjs';
2
- export { C as CheckpointIncompleteError, d as ChunkFailure, e as ClassifierAnswer, f as ClassifierQuestion, g as ClassifyRequest, h as ClassifyResponse, D as DegradedRecord, i as DraftPage, E as EmbedFactResult, j as EmbedFailureKind, k as EmbeddingMarkerKind, l as EntityMaintenanceReport, m as EntityStatus, n as EraseReport, o as EraseStepError, p as ExtractedFact, q as ExtractedFactEdge, r as ExtractedFactWithOntology, s as ExtractedTask, t as ForgetParams, u as ForgetResult, v as GraphTraversalOptions, w as GroundingConfig, H as HEAL_BATCH_SIZE, x as HEAL_RECHECK_MS, y as HOOK_TIMEOUT_MARKER, z as HealResult, I as ImportDumpResult, A as IngestDocumentResult, L as LLMProvider, B as LibrarianConfig, J as LibrarianGateConfig, K as LockedMaintenanceJob, N as MaintenanceJob, P as MaintenanceStopReason, Q as MemoryDumpEntity, T as MigrationPolicy, U as ONTOLOGY_BACKFILL_BATCH_SIZE, V as ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS, X as ONTOLOGY_BACKFILL_RECHECK_MS, Y as OntologyBackfillResult, Z as OntologyConfig, _ as OntologyEdgeType, $ as OntologyManifest, a0 as OntologyNodeType, a1 as OntologyPromptContext, a2 as OntologyUpdates, a3 as PendingMaintenance, a4 as PendingMigrationWork, a5 as PendingSourceStatus, a6 as PromptOverrides, a7 as PromptService, a8 as PrunePartialFailureError, a9 as ReembedResult, aa as RememberInput, ab as RunPendingMaintenanceOptions, ac as RunPendingMaintenanceResult, ad as SourcePassage, ae as StoreSourceResult, af as StoredSource, ag as StoredSourceDump, ah as StoredSourceSummary, ai as SupersedeReplacement, aj as VectorRanker, ak as VectorRankerFallback, al as VectorRankerRankArgs, am as VectorRankerSemanticResult, an as WikiBusyError, ao as WikiBusyOperation, ap as WikiCheckpoint, aq as WikiConfig, ar as WikiDiagnostic, as as WikiDiagnosticCode, at as WikiDiagnosticDetail, au as WikiDiagnosticOperation, av as WikiDiagnosticSeverity, aw as WikiDiagnosticTrigger, ax as WikiDraftNotFound, ay as WikiDuplicateHashError, az as WikiEdge, aA as WikiEvent, aB as WikiExternalDeletionError, aC as WikiFact, aD as WikiGraphNodeOwnershipConflict, aE as WikiIngestEmptyError, aF as WikiInstructions, aG as WikiInvalidReadOptions, aH as WikiLintReport, aI as WikiMemoryTestAccess, aJ as WikiMigrationRequiredError, aK as WikiOutboxEvent, aL as WikiParseError, aM as WikiSearchUnavailableError, aN as WikiSourcePointer, aO as WikiSourceRefHashCollision, aP as WikiStrictOntologyViolation, aQ as WikiSupersedeError, aR as WikiSupersedeReason, aS as WikiTask, aT as WikiTransactionError, aU as isWikiSearchUnavailableError, aV as validateManifest } from './testing-BVY5P6BS.mjs';
1
+ import { M as MemoryBundle, F as FormatContextOptions, G as GraphNeighborhood, a as MemoryDump, b as FormattedMemoryDump, O as OntologyMode, R as ReadOptions, S as SQLiteAdapter, W as WikiOptions, c as WikiMemory } from './testing-CTCRwhs0.mjs';
2
+ export { C as CheckpointIncompleteError, d as ChunkFailure, e as ClassifierAnswer, f as ClassifierQuestion, g as ClassifyRequest, h as ClassifyResponse, D as DegradedRecord, i as DraftPage, E as EmbedFactResult, j as EmbedFailureKind, k as EmbeddingMarkerKind, l as EntityMaintenanceReport, m as EntityStatus, n as EraseReport, o as EraseStepError, p as ExtractedFact, q as ExtractedFactEdge, r as ExtractedFactWithOntology, s as ExtractedTask, t as ForgetParams, u as ForgetResult, v as GraphTraversalOptions, w as GroundingConfig, H as HEAL_BATCH_SIZE, x as HEAL_RECHECK_MS, y as HOOK_TIMEOUT_MARKER, z as HealResult, I as ImportDumpResult, A as IngestDocumentResult, L as LLMProvider, B as LibrarianConfig, J as LibrarianGateConfig, K as LockedMaintenanceJob, N as MaintenanceJob, P as MaintenanceStopReason, Q as MemoryDumpEntity, T as MigrationPolicy, U as ONTOLOGY_BACKFILL_BATCH_SIZE, V as ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS, X as ONTOLOGY_BACKFILL_RECHECK_MS, Y as OntologyBackfillResult, Z as OntologyConfig, _ as OntologyEdgeType, $ as OntologyManifest, a0 as OntologyNodeType, a1 as OntologyPromptContext, a2 as OntologyUpdates, a3 as PendingMaintenance, a4 as PendingMigrationWork, a5 as PendingSourceStatus, a6 as PromptOverrides, a7 as PromptService, a8 as PrunePartialFailureError, a9 as ReembedResult, aa as RememberInput, ab as RunPendingMaintenanceOptions, ac as RunPendingMaintenanceResult, ad as SourcePassage, ae as StoreSourceResult, af as StoredSource, ag as StoredSourceDump, ah as StoredSourceSummary, ai as SupersedeReplacement, aj as VectorRanker, ak as VectorRankerFallback, al as VectorRankerRankArgs, am as VectorRankerSemanticResult, an as WikiBusyError, ao as WikiBusyOperation, ap as WikiCheckpoint, aq as WikiConfig, ar as WikiDiagnostic, as as WikiDiagnosticCode, at as WikiDiagnosticDetail, au as WikiDiagnosticOperation, av as WikiDiagnosticSeverity, aw as WikiDiagnosticTrigger, ax as WikiDraftNotFound, ay as WikiDuplicateHashError, az as WikiEdge, aA as WikiEvent, aB as WikiExternalDeletionError, aC as WikiFact, aD as WikiGraphNodeOwnershipConflict, aE as WikiIngestEmptyError, aF as WikiInstructions, aG as WikiInvalidReadOptions, aH as WikiLintReport, aI as WikiMemoryTestAccess, aJ as WikiMigrationRequiredError, aK as WikiOutboxEvent, aL as WikiParseError, aM as WikiSearchUnavailableError, aN as WikiSourcePointer, aO as WikiSourceRefHashCollision, aP as WikiStrictOntologyViolation, aQ as WikiSupersedeError, aR as WikiSupersedeReason, aS as WikiTask, aT as WikiTransactionError, aU as isWikiSearchUnavailableError, aV as validateManifest } from './testing-CTCRwhs0.mjs';
3
3
  import { OkfFile } from '@equationalapplications/core-okf';
4
4
 
5
5
  /**
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { M as MemoryBundle, F as FormatContextOptions, G as GraphNeighborhood, a as MemoryDump, b as FormattedMemoryDump, O as OntologyMode, R as ReadOptions, S as SQLiteAdapter, W as WikiOptions, c as WikiMemory } from './testing-BVY5P6BS.js';
2
- export { C as CheckpointIncompleteError, d as ChunkFailure, e as ClassifierAnswer, f as ClassifierQuestion, g as ClassifyRequest, h as ClassifyResponse, D as DegradedRecord, i as DraftPage, E as EmbedFactResult, j as EmbedFailureKind, k as EmbeddingMarkerKind, l as EntityMaintenanceReport, m as EntityStatus, n as EraseReport, o as EraseStepError, p as ExtractedFact, q as ExtractedFactEdge, r as ExtractedFactWithOntology, s as ExtractedTask, t as ForgetParams, u as ForgetResult, v as GraphTraversalOptions, w as GroundingConfig, H as HEAL_BATCH_SIZE, x as HEAL_RECHECK_MS, y as HOOK_TIMEOUT_MARKER, z as HealResult, I as ImportDumpResult, A as IngestDocumentResult, L as LLMProvider, B as LibrarianConfig, J as LibrarianGateConfig, K as LockedMaintenanceJob, N as MaintenanceJob, P as MaintenanceStopReason, Q as MemoryDumpEntity, T as MigrationPolicy, U as ONTOLOGY_BACKFILL_BATCH_SIZE, V as ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS, X as ONTOLOGY_BACKFILL_RECHECK_MS, Y as OntologyBackfillResult, Z as OntologyConfig, _ as OntologyEdgeType, $ as OntologyManifest, a0 as OntologyNodeType, a1 as OntologyPromptContext, a2 as OntologyUpdates, a3 as PendingMaintenance, a4 as PendingMigrationWork, a5 as PendingSourceStatus, a6 as PromptOverrides, a7 as PromptService, a8 as PrunePartialFailureError, a9 as ReembedResult, aa as RememberInput, ab as RunPendingMaintenanceOptions, ac as RunPendingMaintenanceResult, ad as SourcePassage, ae as StoreSourceResult, af as StoredSource, ag as StoredSourceDump, ah as StoredSourceSummary, ai as SupersedeReplacement, aj as VectorRanker, ak as VectorRankerFallback, al as VectorRankerRankArgs, am as VectorRankerSemanticResult, an as WikiBusyError, ao as WikiBusyOperation, ap as WikiCheckpoint, aq as WikiConfig, ar as WikiDiagnostic, as as WikiDiagnosticCode, at as WikiDiagnosticDetail, au as WikiDiagnosticOperation, av as WikiDiagnosticSeverity, aw as WikiDiagnosticTrigger, ax as WikiDraftNotFound, ay as WikiDuplicateHashError, az as WikiEdge, aA as WikiEvent, aB as WikiExternalDeletionError, aC as WikiFact, aD as WikiGraphNodeOwnershipConflict, aE as WikiIngestEmptyError, aF as WikiInstructions, aG as WikiInvalidReadOptions, aH as WikiLintReport, aI as WikiMemoryTestAccess, aJ as WikiMigrationRequiredError, aK as WikiOutboxEvent, aL as WikiParseError, aM as WikiSearchUnavailableError, aN as WikiSourcePointer, aO as WikiSourceRefHashCollision, aP as WikiStrictOntologyViolation, aQ as WikiSupersedeError, aR as WikiSupersedeReason, aS as WikiTask, aT as WikiTransactionError, aU as isWikiSearchUnavailableError, aV as validateManifest } from './testing-BVY5P6BS.js';
1
+ import { M as MemoryBundle, F as FormatContextOptions, G as GraphNeighborhood, a as MemoryDump, b as FormattedMemoryDump, O as OntologyMode, R as ReadOptions, S as SQLiteAdapter, W as WikiOptions, c as WikiMemory } from './testing-CTCRwhs0.js';
2
+ export { C as CheckpointIncompleteError, d as ChunkFailure, e as ClassifierAnswer, f as ClassifierQuestion, g as ClassifyRequest, h as ClassifyResponse, D as DegradedRecord, i as DraftPage, E as EmbedFactResult, j as EmbedFailureKind, k as EmbeddingMarkerKind, l as EntityMaintenanceReport, m as EntityStatus, n as EraseReport, o as EraseStepError, p as ExtractedFact, q as ExtractedFactEdge, r as ExtractedFactWithOntology, s as ExtractedTask, t as ForgetParams, u as ForgetResult, v as GraphTraversalOptions, w as GroundingConfig, H as HEAL_BATCH_SIZE, x as HEAL_RECHECK_MS, y as HOOK_TIMEOUT_MARKER, z as HealResult, I as ImportDumpResult, A as IngestDocumentResult, L as LLMProvider, B as LibrarianConfig, J as LibrarianGateConfig, K as LockedMaintenanceJob, N as MaintenanceJob, P as MaintenanceStopReason, Q as MemoryDumpEntity, T as MigrationPolicy, U as ONTOLOGY_BACKFILL_BATCH_SIZE, V as ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS, X as ONTOLOGY_BACKFILL_RECHECK_MS, Y as OntologyBackfillResult, Z as OntologyConfig, _ as OntologyEdgeType, $ as OntologyManifest, a0 as OntologyNodeType, a1 as OntologyPromptContext, a2 as OntologyUpdates, a3 as PendingMaintenance, a4 as PendingMigrationWork, a5 as PendingSourceStatus, a6 as PromptOverrides, a7 as PromptService, a8 as PrunePartialFailureError, a9 as ReembedResult, aa as RememberInput, ab as RunPendingMaintenanceOptions, ac as RunPendingMaintenanceResult, ad as SourcePassage, ae as StoreSourceResult, af as StoredSource, ag as StoredSourceDump, ah as StoredSourceSummary, ai as SupersedeReplacement, aj as VectorRanker, ak as VectorRankerFallback, al as VectorRankerRankArgs, am as VectorRankerSemanticResult, an as WikiBusyError, ao as WikiBusyOperation, ap as WikiCheckpoint, aq as WikiConfig, ar as WikiDiagnostic, as as WikiDiagnosticCode, at as WikiDiagnosticDetail, au as WikiDiagnosticOperation, av as WikiDiagnosticSeverity, aw as WikiDiagnosticTrigger, ax as WikiDraftNotFound, ay as WikiDuplicateHashError, az as WikiEdge, aA as WikiEvent, aB as WikiExternalDeletionError, aC as WikiFact, aD as WikiGraphNodeOwnershipConflict, aE as WikiIngestEmptyError, aF as WikiInstructions, aG as WikiInvalidReadOptions, aH as WikiLintReport, aI as WikiMemoryTestAccess, aJ as WikiMigrationRequiredError, aK as WikiOutboxEvent, aL as WikiParseError, aM as WikiSearchUnavailableError, aN as WikiSourcePointer, aO as WikiSourceRefHashCollision, aP as WikiStrictOntologyViolation, aQ as WikiSupersedeError, aR as WikiSupersedeReason, aS as WikiTask, aT as WikiTransactionError, aU as isWikiSearchUnavailableError, aV as validateManifest } from './testing-CTCRwhs0.js';
3
3
  import { OkfFile } from '@equationalapplications/core-okf';
4
4
 
5
5
  /**
package/dist/index.js CHANGED
@@ -248,10 +248,9 @@ var SQLITE_RESULT_CODE_NAMES = {
248
248
  // 2067 = SQLITE_CONSTRAINT_UNIQUE — a UNIQUE index rejecting an INSERT/UPDATE.
249
249
  // better-sqlite3 / node:sqlite enable extended result codes and report it
250
250
  // directly. expo-sqlite never emits it (as of expo-sqlite 58.0.14, per
251
- // #403): it leaves extended result codes off
252
- // and surfaces the same failure as the primary code 19 with the
253
- // "UNIQUE constraint failed" message text, which `extractSqliteCode` below
254
- // refines back to this name (#403).
251
+ // #403): it leaves extended result codes off and surfaces the same failure
252
+ // as the primary code 19 with the "UNIQUE constraint failed" message text,
253
+ // which `extractSqliteCode` below refines back to this name (#403).
255
254
  2067: "SQLITE_CONSTRAINT_UNIQUE",
256
255
  // 267 = SQLITE_CORRUPT_VTAB — a corrupt FTS5 shadow table (ftsCorruptionClass).
257
256
  267: "SQLITE_CORRUPT_VTAB",
@@ -2527,6 +2526,59 @@ var _EntryRepository = class _EntryRepository extends BaseRepository {
2527
2526
  }
2528
2527
  return result.changes;
2529
2528
  }
2529
+ /**
2530
+ * IDs of the entity's entries whose source_pointer names the event id.
2531
+ * `includeDeleted = true` returns live + tombstoned rows (the forget
2532
+ * enumeration superset for index sync and the ledger backstop).
2533
+ */
2534
+ async findIdsByPointerEvent(entityId, eventId, tx, includeDeleted = false) {
2535
+ const executor = this.getExecutor(tx);
2536
+ let sql = `SELECT id FROM ${this.prefix}entries WHERE entity_id = ? AND ${_EntryRepository.POINTER_EVENT_MATCH_SQL}`;
2537
+ const args = [entityId, eventId];
2538
+ if (!includeDeleted) sql += ` AND deleted_at IS NULL`;
2539
+ const rows = await executor.getAllAsync(sql, args);
2540
+ return rows.map((r) => r.id);
2541
+ }
2542
+ /** Live-row count for the event id — dry-run only (a real call is idempotent over tombstones). */
2543
+ async countLiveByPointerEvent(entityId, eventId, tx) {
2544
+ const executor = this.getExecutor(tx);
2545
+ const row = await executor.getFirstAsync(
2546
+ `SELECT COUNT(*) AS n FROM ${this.prefix}entries WHERE entity_id = ? AND deleted_at IS NULL AND ${_EntryRepository.POINTER_EVENT_MATCH_SQL}`,
2547
+ [entityId, eventId]
2548
+ );
2549
+ return row?.n ?? 0;
2550
+ }
2551
+ /**
2552
+ * Soft-delete the entity's entries whose source_pointer names the event id,
2553
+ * within a transaction. Stages a DELETE outbox entry for each row that
2554
+ * changed, in the same transaction (parity with softDeleteBySource — synced
2555
+ * replicas learn of the tombstones through the outbox). The `deleted_at
2556
+ * IS NULL` guard makes the call idempotent: already-tombstoned rows are
2557
+ * no-op hits and are not counted. `tx` is REQUIRED.
2558
+ * Returns the number of rows deleted.
2559
+ */
2560
+ async softDeleteByPointerEvent(entityId, eventId, tx) {
2561
+ const executor = this.getExecutor(tx);
2562
+ const now = Date.now();
2563
+ const idsToDelete = await executor.getAllAsync(
2564
+ `SELECT id FROM ${this.prefix}entries WHERE entity_id = ? AND deleted_at IS NULL AND ${_EntryRepository.POINTER_EVENT_MATCH_SQL}`,
2565
+ [entityId, eventId]
2566
+ );
2567
+ const result = await executor.runAsync(
2568
+ `UPDATE ${this.prefix}entries SET deleted_at = ?, updated_at = ? WHERE entity_id = ? AND deleted_at IS NULL AND ${_EntryRepository.POINTER_EVENT_MATCH_SQL}`,
2569
+ [now, now, entityId, eventId]
2570
+ );
2571
+ for (const row of idsToDelete) {
2572
+ await this.outbox.push({
2573
+ entityId,
2574
+ tableName: "entries",
2575
+ recordId: row.id,
2576
+ operation: "DELETE",
2577
+ payload: { id: row.id, entity_id: entityId, deleted_at: now }
2578
+ }, tx);
2579
+ }
2580
+ return result.changes;
2581
+ }
2530
2582
  /**
2531
2583
  * Fetch IDs + entity_ids of soft-deleted rows older than cutoff for a given entity.
2532
2584
  * Used by runPrune().
@@ -3551,6 +3603,18 @@ var _EntryRepository = class _EntryRepository extends BaseRepository {
3551
3603
  */
3552
3604
  _EntryRepository.MINI_SEARCH_COLUMNS = "id, entity_id, title, body, tags";
3553
3605
  _EntryRepository.MINI_SEARCH_LIVE_WHERE = "WHERE deleted_at IS NULL";
3606
+ /**
3607
+ * Shared JSON match predicate for source_pointer event ids
3608
+ * (specs/forget-by-event-id §D1). Every JSON call sits under the single
3609
+ * `json_valid` guard: unguarded JSON functions RAISE on malformed text, and
3610
+ * three-valued logic forces evaluation of AND operands after a NULL-guarded
3611
+ * term — a two-term form is only as safe as the planner's term-splitting.
3612
+ * The tombstone guard (`deleted_at IS NULL`) is added per-method.
3613
+ */
3614
+ _EntryRepository.POINTER_EVENT_MATCH_SQL = `CASE WHEN json_valid(source_pointer)
3615
+ THEN json_type(source_pointer, '$.event_id') = 'text'
3616
+ AND json_extract(source_pointer, '$.event_id') = ?
3617
+ ELSE 0 END`;
3554
3618
  var EntryRepository = _EntryRepository;
3555
3619
 
3556
3620
  // src/utils/ids.ts
@@ -10894,15 +10958,21 @@ DROP TRIGGER IF EXISTS ${ad};`);
10894
10958
  }
10895
10959
  }
10896
10960
  async forget(entityId, params, opts) {
10897
- if (params.clearAll && (params.entryId !== void 0 || params.taskId !== void 0 || params.sourceRef !== void 0 || params.sourceHash !== void 0)) {
10898
- throw new Error("forget() clearAll is mutually exclusive with entryId, taskId, sourceRef, and sourceHash");
10961
+ if (params.clearAll && (params.entryId !== void 0 || params.taskId !== void 0 || params.sourceRef !== void 0 || params.sourceHash !== void 0 || params.eventId !== void 0)) {
10962
+ throw new Error("forget() clearAll is mutually exclusive with entryId, taskId, sourceRef, sourceHash, and eventId");
10899
10963
  }
10900
10964
  if (params.includeEvents && !params.clearAll) {
10901
10965
  throw new Error("forget() includeEvents requires clearAll: true");
10902
10966
  }
10903
- if (params.includeChain && (params.entryId === void 0 || params.clearAll || params.taskId !== void 0 || params.sourceRef !== void 0 || params.sourceHash !== void 0)) {
10967
+ if (params.includeChain && (params.entryId === void 0 || params.clearAll || params.taskId !== void 0 || params.sourceRef !== void 0 || params.sourceHash !== void 0 || params.eventId !== void 0)) {
10904
10968
  throw new Error("forget() includeChain composes only with entryId");
10905
10969
  }
10970
+ if (params.eventId !== void 0 && (params.entryId !== void 0 || params.taskId !== void 0 || params.sourceRef !== void 0 || params.sourceHash !== void 0)) {
10971
+ throw new Error("forget() eventId is mutually exclusive with entryId, taskId, sourceRef, and sourceHash");
10972
+ }
10973
+ if (params.eventId !== void 0 && (typeof params.eventId !== "string" || params.eventId === "")) {
10974
+ throw new Error("Invalid eventId");
10975
+ }
10906
10976
  if (opts?.dryRun === true) {
10907
10977
  return this.forgetDryRun(entityId, params);
10908
10978
  }
@@ -10970,14 +11040,19 @@ DROP TRIGGER IF EXISTS ${ad};`);
10970
11040
  if (sourceRef || sourceHash) {
10971
11041
  for (const id of await this.entryRepo.findIdsBySource(entityId, sourceRef, sourceHash, tx, true)) deletedEntryIds.push(id);
10972
11042
  }
11043
+ if (params.eventId !== void 0) {
11044
+ for (const id of await this.entryRepo.findIdsByPointerEvent(entityId, params.eventId, tx, true)) deletedEntryIds.push(id);
11045
+ }
10973
11046
  const entryPromise = params.entryId ? this.entryRepo.softDelete(params.entryId, entityId, tx).then((r) => r.changes > 0) : null;
10974
11047
  const taskDeletedPromise = params.taskId ? this.taskRepo.softDeleteById(params.taskId, entityId, tx).then((r) => r.changes > 0) : null;
10975
11048
  const refPromise = sourceRef || sourceHash ? this.entryRepo.softDeleteBySource(entityId, tx, sourceRef, sourceHash) : null;
11049
+ const pointerPromise = params.eventId !== void 0 ? this.entryRepo.softDeleteByPointerEvent(entityId, params.eventId, tx) : null;
10976
11050
  const sourceRefIndexPromise = touchSourceRefIndex && sourceRef ? this.sourceRefIndexRepo.softDeleteByEntityAndSourceRef(entityId, sourceRef, tx).then(() => void 0) : null;
10977
- const [entryResult, taskResult, refResult] = await Promise.all([
11051
+ const [entryResult, taskResult, refResult, pointerResult] = await Promise.all([
10978
11052
  entryPromise ?? Promise.resolve(false),
10979
11053
  taskDeletedPromise ?? Promise.resolve(false),
10980
11054
  refPromise ?? Promise.resolve(0),
11055
+ pointerPromise ?? Promise.resolve(0),
10981
11056
  sourceRefIndexPromise ?? Promise.resolve(void 0)
10982
11057
  ]);
10983
11058
  if (entryResult) deletedEntries++;
@@ -10986,6 +11061,7 @@ DROP TRIGGER IF EXISTS ${ad};`);
10986
11061
  }
10987
11062
  if (taskResult) deletedTasks++;
10988
11063
  deletedEntries += refResult;
11064
+ deletedEntries += pointerResult;
10989
11065
  }
10990
11066
  if (ledgerOn && this.vectorRemoval?.gate() === "hook" && deletedEntryIds.length > 0) {
10991
11067
  await this.vectorRemovalRepo?.backstopEnqueue(entityId, Array.from(new Set(deletedEntryIds)), now, tx);
@@ -11131,7 +11207,7 @@ DROP TRIGGER IF EXISTS ${ad};`);
11131
11207
  return out;
11132
11208
  }
11133
11209
  if (params.entryId !== void 0 || params.taskId !== void 0) {
11134
- throw new Error("forget({ dryRun: true }) does not support entryId/taskId selectors (entryId is accepted only with includeChain); use sourceRef/sourceHash or clearAll");
11210
+ throw new Error("forget({ dryRun: true }) does not support entryId/taskId selectors (entryId is accepted only with includeChain); use sourceRef/sourceHash, eventId, or clearAll");
11135
11211
  }
11136
11212
  if (params.clearAll) {
11137
11213
  const entries2 = await this.entryRepo.countLiveByEntityId(entityId);
@@ -11142,6 +11218,10 @@ DROP TRIGGER IF EXISTS ${ad};`);
11142
11218
  }
11143
11219
  return { deleted: { entries: entries2, tasks }, metadataReset: true };
11144
11220
  }
11221
+ if (params.eventId !== void 0) {
11222
+ const entries2 = await this.entryRepo.countLiveByPointerEvent(entityId, params.eventId);
11223
+ return { deleted: { entries: entries2, tasks: 0 } };
11224
+ }
11145
11225
  const sourceRef = params.sourceRef !== void 0 ? normalizeSourceRef(params.sourceRef) : null;
11146
11226
  if (params.sourceRef !== void 0 && !sourceRef) throw new Error("Invalid sourceRef");
11147
11227
  const sourceHash = params.sourceHash !== void 0 ? normalizeSourceHash(params.sourceHash) : null;
@@ -15687,7 +15767,8 @@ var WikiMemory = class {
15687
15767
  }
15688
15768
  }
15689
15769
  /**
15690
- * Soft-delete facts and tasks by id, by source, or all of them (`clearAll`).
15770
+ * Soft-delete facts and tasks by id, by source, by source-pointer event id,
15771
+ * or all of them (`clearAll`).
15691
15772
  * `clearAll` also deletes the entity's edges and its source-ref index rows.
15692
15773
  * Add `includeEvents: true` to `clearAll` to hard-delete every event too,
15693
15774
  * read or not, and reset the librarian's position: without it a later