@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/{chunk-TRLMWC5G.mjs → chunk-ZVVZACYI.mjs} +26 -11
- package/dist/chunk-ZVVZACYI.mjs.map +1 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +91 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +69 -3
- package/dist/index.mjs.map +1 -1
- package/dist/{testing-BVY5P6BS.d.mts → testing-CTCRwhs0.d.mts} +39 -2
- package/dist/{testing-BVY5P6BS.d.ts → testing-CTCRwhs0.d.ts} +39 -2
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +24 -9
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +1 -1
- package/package.json +2 -2
- package/dist/chunk-TRLMWC5G.mjs.map +0 -1
|
@@ -1300,12 +1300,21 @@ interface ForgetParams {
|
|
|
1300
1300
|
* predecessor and successor reached by walking `superseded_by` links, capped
|
|
1301
1301
|
* at 100 per direction). The walk is NOT the connected component: with
|
|
1302
1302
|
* fan-in A→C←B, forgetting A reaches C but not B. The forward walk deletes
|
|
1303
|
-
* the live current fact. Does not compose with other selectors
|
|
1303
|
+
* the live current fact. Does not compose with other selectors (including
|
|
1304
|
+
* `eventId`).
|
|
1304
1305
|
*/
|
|
1305
1306
|
includeChain?: boolean;
|
|
1306
1307
|
taskId?: string;
|
|
1307
1308
|
sourceRef?: string;
|
|
1308
1309
|
sourceHash?: string;
|
|
1310
|
+
/**
|
|
1311
|
+
* Soft-delete every librarian fact whose `source_pointer` names this event
|
|
1312
|
+
* id (entity-scoped; exact match, no normalization — event ids are
|
|
1313
|
+
* engine-generated). Mutually exclusive with every other selector;
|
|
1314
|
+
* `clearAll` excludes it. Removal reports through the return value and the
|
|
1315
|
+
* per-row outbox DELETE events. See `specs/forget-by-event-id/` (issue #386).
|
|
1316
|
+
*/
|
|
1317
|
+
eventId?: string;
|
|
1309
1318
|
/** Soft-delete every fact and task of the entity, delete its edges, and delete its source-ref index rows. */
|
|
1310
1319
|
clearAll?: boolean;
|
|
1311
1320
|
/**
|
|
@@ -1835,6 +1844,33 @@ declare class EntryRepository extends BaseRepository {
|
|
|
1835
1844
|
* Returns the number of rows deleted.
|
|
1836
1845
|
*/
|
|
1837
1846
|
softDeleteBySource(entityId: string, tx: SQLiteAdapter, sourceRef?: string | null, sourceHash?: string | null): Promise<number>;
|
|
1847
|
+
/**
|
|
1848
|
+
* Shared JSON match predicate for source_pointer event ids
|
|
1849
|
+
* (specs/forget-by-event-id §D1). Every JSON call sits under the single
|
|
1850
|
+
* `json_valid` guard: unguarded JSON functions RAISE on malformed text, and
|
|
1851
|
+
* three-valued logic forces evaluation of AND operands after a NULL-guarded
|
|
1852
|
+
* term — a two-term form is only as safe as the planner's term-splitting.
|
|
1853
|
+
* The tombstone guard (`deleted_at IS NULL`) is added per-method.
|
|
1854
|
+
*/
|
|
1855
|
+
static readonly POINTER_EVENT_MATCH_SQL = "CASE WHEN json_valid(source_pointer)\n THEN json_type(source_pointer, '$.event_id') = 'text'\n AND json_extract(source_pointer, '$.event_id') = ?\n ELSE 0 END";
|
|
1856
|
+
/**
|
|
1857
|
+
* IDs of the entity's entries whose source_pointer names the event id.
|
|
1858
|
+
* `includeDeleted = true` returns live + tombstoned rows (the forget
|
|
1859
|
+
* enumeration superset for index sync and the ledger backstop).
|
|
1860
|
+
*/
|
|
1861
|
+
findIdsByPointerEvent(entityId: string, eventId: string, tx?: SQLiteAdapter, includeDeleted?: boolean): Promise<string[]>;
|
|
1862
|
+
/** Live-row count for the event id — dry-run only (a real call is idempotent over tombstones). */
|
|
1863
|
+
countLiveByPointerEvent(entityId: string, eventId: string, tx?: SQLiteAdapter): Promise<number>;
|
|
1864
|
+
/**
|
|
1865
|
+
* Soft-delete the entity's entries whose source_pointer names the event id,
|
|
1866
|
+
* within a transaction. Stages a DELETE outbox entry for each row that
|
|
1867
|
+
* changed, in the same transaction (parity with softDeleteBySource — synced
|
|
1868
|
+
* replicas learn of the tombstones through the outbox). The `deleted_at
|
|
1869
|
+
* IS NULL` guard makes the call idempotent: already-tombstoned rows are
|
|
1870
|
+
* no-op hits and are not counted. `tx` is REQUIRED.
|
|
1871
|
+
* Returns the number of rows deleted.
|
|
1872
|
+
*/
|
|
1873
|
+
softDeleteByPointerEvent(entityId: string, eventId: string, tx: SQLiteAdapter): Promise<number>;
|
|
1838
1874
|
/**
|
|
1839
1875
|
* Fetch IDs + entity_ids of soft-deleted rows older than cutoff for a given entity.
|
|
1840
1876
|
* Used by runPrune().
|
|
@@ -4732,7 +4768,8 @@ declare class WikiMemory {
|
|
|
4732
4768
|
merge?: boolean;
|
|
4733
4769
|
}): Promise<ImportDumpResult>;
|
|
4734
4770
|
/**
|
|
4735
|
-
* Soft-delete facts and tasks by id, by source,
|
|
4771
|
+
* Soft-delete facts and tasks by id, by source, by source-pointer event id,
|
|
4772
|
+
* or all of them (`clearAll`).
|
|
4736
4773
|
* `clearAll` also deletes the entity's edges and its source-ref index rows.
|
|
4737
4774
|
* Add `includeEvents: true` to `clearAll` to hard-delete every event too,
|
|
4738
4775
|
* read or not, and reset the librarian's position: without it a later
|
|
@@ -1300,12 +1300,21 @@ interface ForgetParams {
|
|
|
1300
1300
|
* predecessor and successor reached by walking `superseded_by` links, capped
|
|
1301
1301
|
* at 100 per direction). The walk is NOT the connected component: with
|
|
1302
1302
|
* fan-in A→C←B, forgetting A reaches C but not B. The forward walk deletes
|
|
1303
|
-
* the live current fact. Does not compose with other selectors
|
|
1303
|
+
* the live current fact. Does not compose with other selectors (including
|
|
1304
|
+
* `eventId`).
|
|
1304
1305
|
*/
|
|
1305
1306
|
includeChain?: boolean;
|
|
1306
1307
|
taskId?: string;
|
|
1307
1308
|
sourceRef?: string;
|
|
1308
1309
|
sourceHash?: string;
|
|
1310
|
+
/**
|
|
1311
|
+
* Soft-delete every librarian fact whose `source_pointer` names this event
|
|
1312
|
+
* id (entity-scoped; exact match, no normalization — event ids are
|
|
1313
|
+
* engine-generated). Mutually exclusive with every other selector;
|
|
1314
|
+
* `clearAll` excludes it. Removal reports through the return value and the
|
|
1315
|
+
* per-row outbox DELETE events. See `specs/forget-by-event-id/` (issue #386).
|
|
1316
|
+
*/
|
|
1317
|
+
eventId?: string;
|
|
1309
1318
|
/** Soft-delete every fact and task of the entity, delete its edges, and delete its source-ref index rows. */
|
|
1310
1319
|
clearAll?: boolean;
|
|
1311
1320
|
/**
|
|
@@ -1835,6 +1844,33 @@ declare class EntryRepository extends BaseRepository {
|
|
|
1835
1844
|
* Returns the number of rows deleted.
|
|
1836
1845
|
*/
|
|
1837
1846
|
softDeleteBySource(entityId: string, tx: SQLiteAdapter, sourceRef?: string | null, sourceHash?: string | null): Promise<number>;
|
|
1847
|
+
/**
|
|
1848
|
+
* Shared JSON match predicate for source_pointer event ids
|
|
1849
|
+
* (specs/forget-by-event-id §D1). Every JSON call sits under the single
|
|
1850
|
+
* `json_valid` guard: unguarded JSON functions RAISE on malformed text, and
|
|
1851
|
+
* three-valued logic forces evaluation of AND operands after a NULL-guarded
|
|
1852
|
+
* term — a two-term form is only as safe as the planner's term-splitting.
|
|
1853
|
+
* The tombstone guard (`deleted_at IS NULL`) is added per-method.
|
|
1854
|
+
*/
|
|
1855
|
+
static readonly POINTER_EVENT_MATCH_SQL = "CASE WHEN json_valid(source_pointer)\n THEN json_type(source_pointer, '$.event_id') = 'text'\n AND json_extract(source_pointer, '$.event_id') = ?\n ELSE 0 END";
|
|
1856
|
+
/**
|
|
1857
|
+
* IDs of the entity's entries whose source_pointer names the event id.
|
|
1858
|
+
* `includeDeleted = true` returns live + tombstoned rows (the forget
|
|
1859
|
+
* enumeration superset for index sync and the ledger backstop).
|
|
1860
|
+
*/
|
|
1861
|
+
findIdsByPointerEvent(entityId: string, eventId: string, tx?: SQLiteAdapter, includeDeleted?: boolean): Promise<string[]>;
|
|
1862
|
+
/** Live-row count for the event id — dry-run only (a real call is idempotent over tombstones). */
|
|
1863
|
+
countLiveByPointerEvent(entityId: string, eventId: string, tx?: SQLiteAdapter): Promise<number>;
|
|
1864
|
+
/**
|
|
1865
|
+
* Soft-delete the entity's entries whose source_pointer names the event id,
|
|
1866
|
+
* within a transaction. Stages a DELETE outbox entry for each row that
|
|
1867
|
+
* changed, in the same transaction (parity with softDeleteBySource — synced
|
|
1868
|
+
* replicas learn of the tombstones through the outbox). The `deleted_at
|
|
1869
|
+
* IS NULL` guard makes the call idempotent: already-tombstoned rows are
|
|
1870
|
+
* no-op hits and are not counted. `tx` is REQUIRED.
|
|
1871
|
+
* Returns the number of rows deleted.
|
|
1872
|
+
*/
|
|
1873
|
+
softDeleteByPointerEvent(entityId: string, eventId: string, tx: SQLiteAdapter): Promise<number>;
|
|
1838
1874
|
/**
|
|
1839
1875
|
* Fetch IDs + entity_ids of soft-deleted rows older than cutoff for a given entity.
|
|
1840
1876
|
* Used by runPrune().
|
|
@@ -4732,7 +4768,8 @@ declare class WikiMemory {
|
|
|
4732
4768
|
merge?: boolean;
|
|
4733
4769
|
}): Promise<ImportDumpResult>;
|
|
4734
4770
|
/**
|
|
4735
|
-
* Soft-delete facts and tasks by id, by source,
|
|
4771
|
+
* Soft-delete facts and tasks by id, by source, by source-pointer event id,
|
|
4772
|
+
* or all of them (`clearAll`).
|
|
4736
4773
|
* `clearAll` also deletes the entity's edges and its source-ref index rows.
|
|
4737
4774
|
* Add `includeEvents: true` to `clearAll` to hard-delete every event too,
|
|
4738
4775
|
* read or not, and reset the librarian's position: without it a later
|
package/dist/testing.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { aW as EmbeddingService, aX as ImportExportService, aY as IngestionService, aZ as JobManager, aZ as JobManagerType, a_ as MaintenanceService, a$ as RetrievalService, b0 as SearchService, b0 as SearchServiceType, aI as WikiMemoryTestAccess, b1 as WriteService } from './testing-
|
|
1
|
+
export { aW as EmbeddingService, aX as ImportExportService, aY as IngestionService, aZ as JobManager, aZ as JobManagerType, a_ as MaintenanceService, a$ as RetrievalService, b0 as SearchService, b0 as SearchServiceType, aI as WikiMemoryTestAccess, b1 as WriteService } from './testing-CTCRwhs0.mjs';
|
|
2
2
|
import '@equationalapplications/core-okf';
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { aW as EmbeddingService, aX as ImportExportService, aY as IngestionService, aZ as JobManager, aZ as JobManagerType, a_ as MaintenanceService, a$ as RetrievalService, b0 as SearchService, b0 as SearchServiceType, aI as WikiMemoryTestAccess, b1 as WriteService } from './testing-
|
|
1
|
+
export { aW as EmbeddingService, aX as ImportExportService, aY as IngestionService, aZ as JobManager, aZ as JobManagerType, a_ as MaintenanceService, a$ as RetrievalService, b0 as SearchService, b0 as SearchServiceType, aI as WikiMemoryTestAccess, b1 as WriteService } from './testing-CTCRwhs0.js';
|
|
2
2
|
import '@equationalapplications/core-okf';
|
package/dist/testing.js
CHANGED
|
@@ -36,10 +36,9 @@ var SQLITE_RESULT_CODE_NAMES = {
|
|
|
36
36
|
// 2067 = SQLITE_CONSTRAINT_UNIQUE — a UNIQUE index rejecting an INSERT/UPDATE.
|
|
37
37
|
// better-sqlite3 / node:sqlite enable extended result codes and report it
|
|
38
38
|
// directly. expo-sqlite never emits it (as of expo-sqlite 58.0.14, per
|
|
39
|
-
// #403): it leaves extended result codes off
|
|
40
|
-
//
|
|
41
|
-
//
|
|
42
|
-
// refines back to this name (#403).
|
|
39
|
+
// #403): it leaves extended result codes off and surfaces the same failure
|
|
40
|
+
// as the primary code 19 with the "UNIQUE constraint failed" message text,
|
|
41
|
+
// which `extractSqliteCode` below refines back to this name (#403).
|
|
43
42
|
2067: "SQLITE_CONSTRAINT_UNIQUE",
|
|
44
43
|
// 267 = SQLITE_CORRUPT_VTAB — a corrupt FTS5 shadow table (ftsCorruptionClass).
|
|
45
44
|
267: "SQLITE_CORRUPT_VTAB",
|
|
@@ -6069,15 +6068,21 @@ DROP TRIGGER IF EXISTS ${ad};`);
|
|
|
6069
6068
|
}
|
|
6070
6069
|
}
|
|
6071
6070
|
async forget(entityId, params, opts) {
|
|
6072
|
-
if (params.clearAll && (params.entryId !== void 0 || params.taskId !== void 0 || params.sourceRef !== void 0 || params.sourceHash !== void 0)) {
|
|
6073
|
-
throw new Error("forget() clearAll is mutually exclusive with entryId, taskId, sourceRef, and
|
|
6071
|
+
if (params.clearAll && (params.entryId !== void 0 || params.taskId !== void 0 || params.sourceRef !== void 0 || params.sourceHash !== void 0 || params.eventId !== void 0)) {
|
|
6072
|
+
throw new Error("forget() clearAll is mutually exclusive with entryId, taskId, sourceRef, sourceHash, and eventId");
|
|
6074
6073
|
}
|
|
6075
6074
|
if (params.includeEvents && !params.clearAll) {
|
|
6076
6075
|
throw new Error("forget() includeEvents requires clearAll: true");
|
|
6077
6076
|
}
|
|
6078
|
-
if (params.includeChain && (params.entryId === void 0 || params.clearAll || params.taskId !== void 0 || params.sourceRef !== void 0 || params.sourceHash !== void 0)) {
|
|
6077
|
+
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)) {
|
|
6079
6078
|
throw new Error("forget() includeChain composes only with entryId");
|
|
6080
6079
|
}
|
|
6080
|
+
if (params.eventId !== void 0 && (params.entryId !== void 0 || params.taskId !== void 0 || params.sourceRef !== void 0 || params.sourceHash !== void 0)) {
|
|
6081
|
+
throw new Error("forget() eventId is mutually exclusive with entryId, taskId, sourceRef, and sourceHash");
|
|
6082
|
+
}
|
|
6083
|
+
if (params.eventId !== void 0 && (typeof params.eventId !== "string" || params.eventId === "")) {
|
|
6084
|
+
throw new Error("Invalid eventId");
|
|
6085
|
+
}
|
|
6081
6086
|
if (opts?.dryRun === true) {
|
|
6082
6087
|
return this.forgetDryRun(entityId, params);
|
|
6083
6088
|
}
|
|
@@ -6145,14 +6150,19 @@ DROP TRIGGER IF EXISTS ${ad};`);
|
|
|
6145
6150
|
if (sourceRef || sourceHash) {
|
|
6146
6151
|
for (const id of await this.entryRepo.findIdsBySource(entityId, sourceRef, sourceHash, tx, true)) deletedEntryIds.push(id);
|
|
6147
6152
|
}
|
|
6153
|
+
if (params.eventId !== void 0) {
|
|
6154
|
+
for (const id of await this.entryRepo.findIdsByPointerEvent(entityId, params.eventId, tx, true)) deletedEntryIds.push(id);
|
|
6155
|
+
}
|
|
6148
6156
|
const entryPromise = params.entryId ? this.entryRepo.softDelete(params.entryId, entityId, tx).then((r) => r.changes > 0) : null;
|
|
6149
6157
|
const taskDeletedPromise = params.taskId ? this.taskRepo.softDeleteById(params.taskId, entityId, tx).then((r) => r.changes > 0) : null;
|
|
6150
6158
|
const refPromise = sourceRef || sourceHash ? this.entryRepo.softDeleteBySource(entityId, tx, sourceRef, sourceHash) : null;
|
|
6159
|
+
const pointerPromise = params.eventId !== void 0 ? this.entryRepo.softDeleteByPointerEvent(entityId, params.eventId, tx) : null;
|
|
6151
6160
|
const sourceRefIndexPromise = touchSourceRefIndex && sourceRef ? this.sourceRefIndexRepo.softDeleteByEntityAndSourceRef(entityId, sourceRef, tx).then(() => void 0) : null;
|
|
6152
|
-
const [entryResult, taskResult, refResult] = await Promise.all([
|
|
6161
|
+
const [entryResult, taskResult, refResult, pointerResult] = await Promise.all([
|
|
6153
6162
|
entryPromise ?? Promise.resolve(false),
|
|
6154
6163
|
taskDeletedPromise ?? Promise.resolve(false),
|
|
6155
6164
|
refPromise ?? Promise.resolve(0),
|
|
6165
|
+
pointerPromise ?? Promise.resolve(0),
|
|
6156
6166
|
sourceRefIndexPromise ?? Promise.resolve(void 0)
|
|
6157
6167
|
]);
|
|
6158
6168
|
if (entryResult) deletedEntries++;
|
|
@@ -6161,6 +6171,7 @@ DROP TRIGGER IF EXISTS ${ad};`);
|
|
|
6161
6171
|
}
|
|
6162
6172
|
if (taskResult) deletedTasks++;
|
|
6163
6173
|
deletedEntries += refResult;
|
|
6174
|
+
deletedEntries += pointerResult;
|
|
6164
6175
|
}
|
|
6165
6176
|
if (ledgerOn && this.vectorRemoval?.gate() === "hook" && deletedEntryIds.length > 0) {
|
|
6166
6177
|
await this.vectorRemovalRepo?.backstopEnqueue(entityId, Array.from(new Set(deletedEntryIds)), now, tx);
|
|
@@ -6306,7 +6317,7 @@ DROP TRIGGER IF EXISTS ${ad};`);
|
|
|
6306
6317
|
return out;
|
|
6307
6318
|
}
|
|
6308
6319
|
if (params.entryId !== void 0 || params.taskId !== void 0) {
|
|
6309
|
-
throw new Error("forget({ dryRun: true }) does not support entryId/taskId selectors (entryId is accepted only with includeChain); use sourceRef/sourceHash or clearAll");
|
|
6320
|
+
throw new Error("forget({ dryRun: true }) does not support entryId/taskId selectors (entryId is accepted only with includeChain); use sourceRef/sourceHash, eventId, or clearAll");
|
|
6310
6321
|
}
|
|
6311
6322
|
if (params.clearAll) {
|
|
6312
6323
|
const entries2 = await this.entryRepo.countLiveByEntityId(entityId);
|
|
@@ -6317,6 +6328,10 @@ DROP TRIGGER IF EXISTS ${ad};`);
|
|
|
6317
6328
|
}
|
|
6318
6329
|
return { deleted: { entries: entries2, tasks }, metadataReset: true };
|
|
6319
6330
|
}
|
|
6331
|
+
if (params.eventId !== void 0) {
|
|
6332
|
+
const entries2 = await this.entryRepo.countLiveByPointerEvent(entityId, params.eventId);
|
|
6333
|
+
return { deleted: { entries: entries2, tasks: 0 } };
|
|
6334
|
+
}
|
|
6320
6335
|
const sourceRef = params.sourceRef !== void 0 ? normalizeSourceRef(params.sourceRef) : null;
|
|
6321
6336
|
if (params.sourceRef !== void 0 && !sourceRef) throw new Error("Invalid sourceRef");
|
|
6322
6337
|
const sourceHash = params.sourceHash !== void 0 ? normalizeSourceHash(params.sourceHash) : null;
|