@equationalapplications/core-llm-wiki 9.4.0 → 9.4.3

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.
@@ -4763,7 +4763,8 @@ declare class WikiMemory {
4763
4763
  /**
4764
4764
  * End `oldId`'s validity and link it to its replacement (spec §4.3). One
4765
4765
  * transaction. Throws `WikiSupersedeError` for missing, foreign, already
4766
- * superseded, already expired, immutable-document, or cyclic targets.
4766
+ * superseded, already expired, immutable-document, or cyclic targets, and
4767
+ * for an inverted or empty interval (`invalid_interval`).
4767
4768
  */
4768
4769
  supersede(entityId: string, oldId: string, replacement: SupersedeReplacement, options?: {
4769
4770
  validFrom?: number;
@@ -4763,7 +4763,8 @@ declare class WikiMemory {
4763
4763
  /**
4764
4764
  * End `oldId`'s validity and link it to its replacement (spec §4.3). One
4765
4765
  * transaction. Throws `WikiSupersedeError` for missing, foreign, already
4766
- * superseded, already expired, immutable-document, or cyclic targets.
4766
+ * superseded, already expired, immutable-document, or cyclic targets, and
4767
+ * for an inverted or empty interval (`invalid_interval`).
4767
4768
  */
4768
4769
  supersede(entityId: string, oldId: string, replacement: SupersedeReplacement, options?: {
4769
4770
  validFrom?: number;
@@ -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-C2HwksLd.mjs';
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-BVY5P6BS.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-C2HwksLd.js';
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-BVY5P6BS.js';
2
2
  import '@equationalapplications/core-okf';
package/dist/testing.js CHANGED
@@ -33,10 +33,13 @@ var SQLITE_RESULT_CODE_NAMES = {
33
33
  27: "SQLITE_NOTICE",
34
34
  28: "SQLITE_WARNING",
35
35
  // Extended result codes (https://sqlite.org/rescode.html#extended_result_code_list).
36
- // 2067 = SQLITE_CONSTRAINT_UNIQUE — raised when a UNIQUE index/PRIMARY KEY
37
- // rejects an INSERT/UPDATE; expo-sqlite reports this as a numeric "Error code N:"
38
- // prefix and we normalize it back to the symbolic name so callers can branch on
39
- // the same string the rest of the ecosystem uses.
36
+ // 2067 = SQLITE_CONSTRAINT_UNIQUE — a UNIQUE index rejecting an INSERT/UPDATE.
37
+ // better-sqlite3 / node:sqlite enable extended result codes and report it
38
+ // directly. expo-sqlite never emits it (as of expo-sqlite 58.0.14, per
39
+ // #403): it leaves extended result codes off
40
+ // and surfaces the same failure as the primary code 19 with the
41
+ // "UNIQUE constraint failed" message text, which `extractSqliteCode` below
42
+ // refines back to this name (#403).
40
43
  2067: "SQLITE_CONSTRAINT_UNIQUE",
41
44
  // 267 = SQLITE_CORRUPT_VTAB — a corrupt FTS5 shadow table (ftsCorruptionClass).
42
45
  267: "SQLITE_CORRUPT_VTAB",
@@ -52,7 +55,13 @@ function extractSqliteCode(err) {
52
55
  if (typeof code === "string" && code.startsWith("SQLITE_")) return code;
53
56
  if (typeof message === "string") {
54
57
  const m = /^Error code (\d+):/.exec(message);
55
- if (m) return nameForSqliteResultCode(Number(m[1]));
58
+ if (m) {
59
+ const n = Number(m[1]);
60
+ if (n === 19 && message.includes("UNIQUE constraint failed")) {
61
+ return nameForSqliteResultCode(2067);
62
+ }
63
+ return nameForSqliteResultCode(n);
64
+ }
56
65
  }
57
66
  return void 0;
58
67
  }
@@ -3635,6 +3644,8 @@ var TemporalService = class {
3635
3644
  if (repl.superseded_by != null) throw new WikiSupersedeError("already_superseded");
3636
3645
  const { predecessors } = await this.entryRepo.findSupersessionChainIds(entityId, oldId, HISTORY_MAX_DEPTH, tx);
3637
3646
  if (predecessors.some((r) => r.id === newId)) throw new WikiSupersedeError("cycle");
3647
+ const start = old.valid_from ?? old.created_at;
3648
+ if (t <= start) throw new WikiSupersedeError("invalid_interval");
3638
3649
  await this.entryRepo.setTemporal(oldId, entityId, { valid_to: t, superseded_by: newId, superseded_at: now }, tx);
3639
3650
  if (repl.valid_from == null) {
3640
3651
  await this.entryRepo.setTemporal(newId, entityId, { valid_from: t }, tx);