@equationalapplications/core-llm-wiki 9.4.2 → 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-TJYITTAO.mjs → chunk-ZVVZACYI.mjs} +36 -12
- 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 +101 -11
- 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 +34 -10
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +1 -1
- package/package.json +2 -2
- package/dist/chunk-TJYITTAO.mjs.map +0 -1
|
@@ -39,10 +39,12 @@ var SQLITE_RESULT_CODE_NAMES = {
|
|
|
39
39
|
27: "SQLITE_NOTICE",
|
|
40
40
|
28: "SQLITE_WARNING",
|
|
41
41
|
// Extended result codes (https://sqlite.org/rescode.html#extended_result_code_list).
|
|
42
|
-
// 2067 = SQLITE_CONSTRAINT_UNIQUE —
|
|
43
|
-
//
|
|
44
|
-
//
|
|
45
|
-
//
|
|
42
|
+
// 2067 = SQLITE_CONSTRAINT_UNIQUE — a UNIQUE index rejecting an INSERT/UPDATE.
|
|
43
|
+
// better-sqlite3 / node:sqlite enable extended result codes and report it
|
|
44
|
+
// directly. expo-sqlite never emits it (as of expo-sqlite 58.0.14, per
|
|
45
|
+
// #403): it leaves extended result codes off and surfaces the same failure
|
|
46
|
+
// as the primary code 19 with the "UNIQUE constraint failed" message text,
|
|
47
|
+
// which `extractSqliteCode` below refines back to this name (#403).
|
|
46
48
|
2067: "SQLITE_CONSTRAINT_UNIQUE",
|
|
47
49
|
// 267 = SQLITE_CORRUPT_VTAB — a corrupt FTS5 shadow table (ftsCorruptionClass).
|
|
48
50
|
267: "SQLITE_CORRUPT_VTAB",
|
|
@@ -58,7 +60,13 @@ function extractSqliteCode(err) {
|
|
|
58
60
|
if (typeof code === "string" && code.startsWith("SQLITE_")) return code;
|
|
59
61
|
if (typeof message === "string") {
|
|
60
62
|
const m = /^Error code (\d+):/.exec(message);
|
|
61
|
-
if (m)
|
|
63
|
+
if (m) {
|
|
64
|
+
const n = Number(m[1]);
|
|
65
|
+
if (n === 19 && message.includes("UNIQUE constraint failed")) {
|
|
66
|
+
return nameForSqliteResultCode(2067);
|
|
67
|
+
}
|
|
68
|
+
return nameForSqliteResultCode(n);
|
|
69
|
+
}
|
|
62
70
|
}
|
|
63
71
|
return void 0;
|
|
64
72
|
}
|
|
@@ -7159,15 +7167,21 @@ DROP TRIGGER IF EXISTS ${ad};`);
|
|
|
7159
7167
|
}
|
|
7160
7168
|
}
|
|
7161
7169
|
async forget(entityId, params, opts) {
|
|
7162
|
-
if (params.clearAll && (params.entryId !== void 0 || params.taskId !== void 0 || params.sourceRef !== void 0 || params.sourceHash !== void 0)) {
|
|
7163
|
-
throw new Error("forget() clearAll is mutually exclusive with entryId, taskId, sourceRef, and
|
|
7170
|
+
if (params.clearAll && (params.entryId !== void 0 || params.taskId !== void 0 || params.sourceRef !== void 0 || params.sourceHash !== void 0 || params.eventId !== void 0)) {
|
|
7171
|
+
throw new Error("forget() clearAll is mutually exclusive with entryId, taskId, sourceRef, sourceHash, and eventId");
|
|
7164
7172
|
}
|
|
7165
7173
|
if (params.includeEvents && !params.clearAll) {
|
|
7166
7174
|
throw new Error("forget() includeEvents requires clearAll: true");
|
|
7167
7175
|
}
|
|
7168
|
-
if (params.includeChain && (params.entryId === void 0 || params.clearAll || params.taskId !== void 0 || params.sourceRef !== void 0 || params.sourceHash !== void 0)) {
|
|
7176
|
+
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)) {
|
|
7169
7177
|
throw new Error("forget() includeChain composes only with entryId");
|
|
7170
7178
|
}
|
|
7179
|
+
if (params.eventId !== void 0 && (params.entryId !== void 0 || params.taskId !== void 0 || params.sourceRef !== void 0 || params.sourceHash !== void 0)) {
|
|
7180
|
+
throw new Error("forget() eventId is mutually exclusive with entryId, taskId, sourceRef, and sourceHash");
|
|
7181
|
+
}
|
|
7182
|
+
if (params.eventId !== void 0 && (typeof params.eventId !== "string" || params.eventId === "")) {
|
|
7183
|
+
throw new Error("Invalid eventId");
|
|
7184
|
+
}
|
|
7171
7185
|
if (opts?.dryRun === true) {
|
|
7172
7186
|
return this.forgetDryRun(entityId, params);
|
|
7173
7187
|
}
|
|
@@ -7235,14 +7249,19 @@ DROP TRIGGER IF EXISTS ${ad};`);
|
|
|
7235
7249
|
if (sourceRef || sourceHash) {
|
|
7236
7250
|
for (const id of await this.entryRepo.findIdsBySource(entityId, sourceRef, sourceHash, tx, true)) deletedEntryIds.push(id);
|
|
7237
7251
|
}
|
|
7252
|
+
if (params.eventId !== void 0) {
|
|
7253
|
+
for (const id of await this.entryRepo.findIdsByPointerEvent(entityId, params.eventId, tx, true)) deletedEntryIds.push(id);
|
|
7254
|
+
}
|
|
7238
7255
|
const entryPromise = params.entryId ? this.entryRepo.softDelete(params.entryId, entityId, tx).then((r) => r.changes > 0) : null;
|
|
7239
7256
|
const taskDeletedPromise = params.taskId ? this.taskRepo.softDeleteById(params.taskId, entityId, tx).then((r) => r.changes > 0) : null;
|
|
7240
7257
|
const refPromise = sourceRef || sourceHash ? this.entryRepo.softDeleteBySource(entityId, tx, sourceRef, sourceHash) : null;
|
|
7258
|
+
const pointerPromise = params.eventId !== void 0 ? this.entryRepo.softDeleteByPointerEvent(entityId, params.eventId, tx) : null;
|
|
7241
7259
|
const sourceRefIndexPromise = touchSourceRefIndex && sourceRef ? this.sourceRefIndexRepo.softDeleteByEntityAndSourceRef(entityId, sourceRef, tx).then(() => void 0) : null;
|
|
7242
|
-
const [entryResult, taskResult, refResult] = await Promise.all([
|
|
7260
|
+
const [entryResult, taskResult, refResult, pointerResult] = await Promise.all([
|
|
7243
7261
|
entryPromise ?? Promise.resolve(false),
|
|
7244
7262
|
taskDeletedPromise ?? Promise.resolve(false),
|
|
7245
7263
|
refPromise ?? Promise.resolve(0),
|
|
7264
|
+
pointerPromise ?? Promise.resolve(0),
|
|
7246
7265
|
sourceRefIndexPromise ?? Promise.resolve(void 0)
|
|
7247
7266
|
]);
|
|
7248
7267
|
if (entryResult) deletedEntries++;
|
|
@@ -7251,6 +7270,7 @@ DROP TRIGGER IF EXISTS ${ad};`);
|
|
|
7251
7270
|
}
|
|
7252
7271
|
if (taskResult) deletedTasks++;
|
|
7253
7272
|
deletedEntries += refResult;
|
|
7273
|
+
deletedEntries += pointerResult;
|
|
7254
7274
|
}
|
|
7255
7275
|
if (ledgerOn && this.vectorRemoval?.gate() === "hook" && deletedEntryIds.length > 0) {
|
|
7256
7276
|
await this.vectorRemovalRepo?.backstopEnqueue(entityId, Array.from(new Set(deletedEntryIds)), now, tx);
|
|
@@ -7396,7 +7416,7 @@ DROP TRIGGER IF EXISTS ${ad};`);
|
|
|
7396
7416
|
return out;
|
|
7397
7417
|
}
|
|
7398
7418
|
if (params.entryId !== void 0 || params.taskId !== void 0) {
|
|
7399
|
-
throw new Error("forget({ dryRun: true }) does not support entryId/taskId selectors (entryId is accepted only with includeChain); use sourceRef/sourceHash or clearAll");
|
|
7419
|
+
throw new Error("forget({ dryRun: true }) does not support entryId/taskId selectors (entryId is accepted only with includeChain); use sourceRef/sourceHash, eventId, or clearAll");
|
|
7400
7420
|
}
|
|
7401
7421
|
if (params.clearAll) {
|
|
7402
7422
|
const entries2 = await this.entryRepo.countLiveByEntityId(entityId);
|
|
@@ -7407,6 +7427,10 @@ DROP TRIGGER IF EXISTS ${ad};`);
|
|
|
7407
7427
|
}
|
|
7408
7428
|
return { deleted: { entries: entries2, tasks }, metadataReset: true };
|
|
7409
7429
|
}
|
|
7430
|
+
if (params.eventId !== void 0) {
|
|
7431
|
+
const entries2 = await this.entryRepo.countLiveByPointerEvent(entityId, params.eventId);
|
|
7432
|
+
return { deleted: { entries: entries2, tasks: 0 } };
|
|
7433
|
+
}
|
|
7410
7434
|
const sourceRef = params.sourceRef !== void 0 ? normalizeSourceRef(params.sourceRef) : null;
|
|
7411
7435
|
if (params.sourceRef !== void 0 && !sourceRef) throw new Error("Invalid sourceRef");
|
|
7412
7436
|
const sourceHash = params.sourceHash !== void 0 ? normalizeSourceHash(params.sourceHash) : null;
|
|
@@ -10697,5 +10721,5 @@ var WriteService = class {
|
|
|
10697
10721
|
};
|
|
10698
10722
|
|
|
10699
10723
|
export { BaseRepository, CURRENT_SCHEMA_VERSION, CheckpointIncompleteError, DEFAULT_CHUNK_OVERLAP, DEFAULT_MAX_CHUNK_LENGTH, DEFAULT_MAX_EMBED_CHARS, DiagnosticBuffer, EMBED_CHARS_CEILING, EdgeRepository, EmbeddingService, EraseStepError, FTS5_DRAIN_CHUNK, FTS5_REBUILD_SNAPSHOT_KEY, FTS5_REBUILD_WM_KEY, FTS5_RECLAIM_MERGE_PAGES, FTS5_RETIRED_COUNTER_KEY, FTS5_RETIRED_TABLES_KEY, FTS5_STATE_KEY, FTS5_SWEEP_CURSOR_KEY, HEAL_ANCHORS_PER_CANDIDATE, HEAL_BATCH_SIZE, HEAL_MAX_FACT_BODY_CHARS_L3, HEAL_MAX_TASKS, HEAL_RECHECK_MS, HOOK_TIMEOUT_MARKER, ImportExportService, IngestionService, JobManager, MAX_EMBED_ATTEMPTS, MIGRATIONS, MaintenanceService, MetadataRepository, ONTOLOGY_BACKFILL_BATCH_SIZE, ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS, ONTOLOGY_BACKFILL_RECHECK_MS, ONTOLOGY_BACKFILL_SYSTEM_PROMPT, PromptService, PrunePartialFailureError, RetrievalService, SearchService, SourceStoreService, TemporalService, UnavailableIndexStrategy, UsageMeter, VectorRemovalRepository, VectorRemovalService, WikiBusyError, WikiDraftNotFound, WikiDuplicateHashError, WikiExternalDeletionError, WikiGraphNodeOwnershipConflict, WikiIngestEmptyError, WikiInvalidReadOptions, WikiMigrationRequiredError, WikiParseError, WikiSearchUnavailableError, WikiSourceRefHashCollision, WikiStrictOntologyViolation, WikiSupersedeError, WikiTransactionError, WriteService, __privateAdd, __privateGet, __privateSet, assertEntityId, assertEpochMs, chunkText, configureRandomSource, createLegacySourceTypeIndex, createdAtValue, detectSchemaVersion, drainChunkSql, drainHiSql, edgeTripleAllowed, emitDiagnostic, emptyManifest, entityDrainChunkSql, entityDrainHiSql, entitySummaryMetaKey, extractSqliteCode, factTokenCost, fts5LedgerDropSql, fts5PendingIndexesDdl, fts5TablesDdl, fts5TriggerNames, fts5TriggersDdl, generateId, idDrainChunkSql, idReindexChunkSql, isLiveAt, isRetiredTableName, isUsableDate, isWikiSearchUnavailableError, liveAtSql, normalizeSourceHash, normalizeSourceRef, normalizeTitleKey, packFactsByBudget, parseEmbedding, parseJsonArray, parseJsonObject, parseStoredSourcePointer, passageFtsTablesDdl, passageFtsTriggerNames, passageFtsTriggersDdl, probePendingWork, readRebuildProgress, reanchorRebuildFingerprint, resolveEdgeDefinitions, resolveGrounding, resolveLibrarianStrategy, resolveNodeType, retiredTableName, runSourceRefNormalize, safeSlice, serializeSourcePointer, setupDatabase, sweepChunkSql, sweepHiSql, typeSatisfies, validateInlineEdges, validateManifest, validateSourcePointerValue, warnChangedDefaultsOnce, windowChunkSql, windowHiSql, writeNormalizeStamp, writeRebuildStart };
|
|
10700
|
-
//# sourceMappingURL=chunk-
|
|
10701
|
-
//# sourceMappingURL=chunk-
|
|
10724
|
+
//# sourceMappingURL=chunk-ZVVZACYI.mjs.map
|
|
10725
|
+
//# sourceMappingURL=chunk-ZVVZACYI.mjs.map
|