@equationalapplications/core-llm-wiki 4.19.0 → 4.20.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/README.md +25 -0
- package/dist/{chunk-3GMXRLKU.mjs → chunk-HKB5FEJG.mjs} +80 -26
- package/dist/chunk-HKB5FEJG.mjs.map +1 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +129 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +53 -9
- package/dist/index.mjs.map +1 -1
- package/dist/{testing-DP3lus54.d.mts → testing-BVN_g414.d.mts} +23 -1
- package/dist/{testing-DP3lus54.d.ts → testing-BVN_g414.d.ts} +23 -1
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +1 -1
- package/package.json +2 -2
- package/dist/chunk-3GMXRLKU.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -846,6 +846,31 @@ const adapter: SQLiteAdapter = {
|
|
|
846
846
|
};
|
|
847
847
|
```
|
|
848
848
|
|
|
849
|
+
## Concurrency
|
|
850
|
+
|
|
851
|
+
All write APIs are safe to call from concurrent async contexts. Transactions are
|
|
852
|
+
serialized internally on the single database connection — you never need to know that
|
|
853
|
+
SQLite forbids nested `BEGIN`, and you never need to throttle callers yourself.
|
|
854
|
+
|
|
855
|
+
- One connection per database file per process is the supported topology.
|
|
856
|
+
- Non-transactional reads are **not** serialized, so read latency is unaffected.
|
|
857
|
+
- Inside a transaction callback, use only the provided `tx` handle — never the outer
|
|
858
|
+
database handle. Using the outer handle deadlocks; opening a nested transaction throws.
|
|
859
|
+
|
|
860
|
+
### `WikiTransactionError`
|
|
861
|
+
|
|
862
|
+
Thrown when a SQLite driver error escapes a transaction (nested `BEGIN`,
|
|
863
|
+
`SQLITE_BUSY`, constraint violation). Stable `instanceof` target for observability:
|
|
864
|
+
|
|
865
|
+
- `error.cause` — the original driver error (the chain bottoms out here, not at a
|
|
866
|
+
rollback red herring).
|
|
867
|
+
- `error.sqliteErrorCode` — best-effort SQLite code (e.g. `'SQLITE_BUSY'`), present
|
|
868
|
+
when it can be parsed. Group on this in Sentry/Datadog instead of inspecting
|
|
869
|
+
`error.cause` recursively.
|
|
870
|
+
|
|
871
|
+
Domain errors thrown from your own callback logic (validation, `WikiBusyError`)
|
|
872
|
+
pass through unwrapped with their original type intact.
|
|
873
|
+
|
|
849
874
|
## How It Works
|
|
850
875
|
|
|
851
876
|
```mermaid
|
|
@@ -8,6 +8,83 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
|
|
|
8
8
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
9
9
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
10
10
|
|
|
11
|
+
// src/db/sqliteCodes.ts
|
|
12
|
+
var SQLITE_RESULT_CODE_NAMES = {
|
|
13
|
+
1: "SQLITE_ERROR",
|
|
14
|
+
2: "SQLITE_INTERNAL",
|
|
15
|
+
3: "SQLITE_PERM",
|
|
16
|
+
4: "SQLITE_ABORT",
|
|
17
|
+
5: "SQLITE_BUSY",
|
|
18
|
+
6: "SQLITE_LOCKED",
|
|
19
|
+
7: "SQLITE_NOMEM",
|
|
20
|
+
8: "SQLITE_READONLY",
|
|
21
|
+
9: "SQLITE_INTERRUPT",
|
|
22
|
+
10: "SQLITE_IOERR",
|
|
23
|
+
11: "SQLITE_CORRUPT",
|
|
24
|
+
12: "SQLITE_NOTFOUND",
|
|
25
|
+
13: "SQLITE_FULL",
|
|
26
|
+
14: "SQLITE_CANTOPEN",
|
|
27
|
+
15: "SQLITE_PROTOCOL",
|
|
28
|
+
16: "SQLITE_EMPTY",
|
|
29
|
+
17: "SQLITE_SCHEMA",
|
|
30
|
+
18: "SQLITE_TOOBIG",
|
|
31
|
+
19: "SQLITE_CONSTRAINT",
|
|
32
|
+
20: "SQLITE_MISMATCH",
|
|
33
|
+
21: "SQLITE_MISUSE",
|
|
34
|
+
22: "SQLITE_NOLFS",
|
|
35
|
+
23: "SQLITE_AUTH",
|
|
36
|
+
24: "SQLITE_FORMAT",
|
|
37
|
+
25: "SQLITE_RANGE",
|
|
38
|
+
26: "SQLITE_NOTADB",
|
|
39
|
+
27: "SQLITE_NOTICE",
|
|
40
|
+
28: "SQLITE_WARNING",
|
|
41
|
+
100: "SQLITE_ROW",
|
|
42
|
+
101: "SQLITE_DONE"
|
|
43
|
+
};
|
|
44
|
+
function nameForSqliteResultCode(n) {
|
|
45
|
+
return SQLITE_RESULT_CODE_NAMES[n] ?? `SQLITE_${n}`;
|
|
46
|
+
}
|
|
47
|
+
function extractSqliteCode(err) {
|
|
48
|
+
if (typeof err !== "object" || err === null) return void 0;
|
|
49
|
+
const { code, message } = err;
|
|
50
|
+
if (typeof code === "string" && code.startsWith("SQLITE_")) return code;
|
|
51
|
+
if (typeof message === "string") {
|
|
52
|
+
const m = /^Error code (\d+):/.exec(message);
|
|
53
|
+
if (m) return nameForSqliteResultCode(Number(m[1]));
|
|
54
|
+
}
|
|
55
|
+
return void 0;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// src/types.ts
|
|
59
|
+
var WikiBusyError = class extends Error {
|
|
60
|
+
constructor(operation, entityId) {
|
|
61
|
+
super(`${operation} already running for entity ${entityId}`);
|
|
62
|
+
this.name = "WikiBusyError";
|
|
63
|
+
this.operation = operation;
|
|
64
|
+
this.entityId = entityId;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
var WikiTransactionError = class extends Error {
|
|
68
|
+
constructor(message, options) {
|
|
69
|
+
super(message, options);
|
|
70
|
+
this.name = "WikiTransactionError";
|
|
71
|
+
this.sqliteErrorCode = extractSqliteCode(options.cause);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
var PrunePartialFailureError = class extends Error {
|
|
75
|
+
constructor(deleted, failedAt, remaining, cause, deletedTasks = 0, deletedEvents = 0) {
|
|
76
|
+
super(`Prune partially failed: deleted ${deleted}, failed at ${failedAt}, ${remaining} remaining`);
|
|
77
|
+
this.name = "PrunePartialFailureError";
|
|
78
|
+
this.deleted = deleted;
|
|
79
|
+
this.failedAt = failedAt;
|
|
80
|
+
this.remaining = remaining;
|
|
81
|
+
this.deletedTasks = deletedTasks;
|
|
82
|
+
this.deletedEvents = deletedEvents;
|
|
83
|
+
this.cause = cause;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
var HOOK_TIMEOUT_MARKER = /* @__PURE__ */ Symbol("WikiMemoryHookTimeout");
|
|
87
|
+
|
|
11
88
|
// src/utils/ids.ts
|
|
12
89
|
var _injectedGetRandomValues = null;
|
|
13
90
|
function configureRandomSource(fn) {
|
|
@@ -278,29 +355,6 @@ _SearchService.MAX_VECTOR_CACHE_ENTITIES = 16;
|
|
|
278
355
|
_SearchService.MAX_VECTOR_CACHE_FACTS_PER_ENTITY = 500;
|
|
279
356
|
var SearchService = _SearchService;
|
|
280
357
|
|
|
281
|
-
// src/types.ts
|
|
282
|
-
var WikiBusyError = class extends Error {
|
|
283
|
-
constructor(operation, entityId) {
|
|
284
|
-
super(`${operation} already running for entity ${entityId}`);
|
|
285
|
-
this.name = "WikiBusyError";
|
|
286
|
-
this.operation = operation;
|
|
287
|
-
this.entityId = entityId;
|
|
288
|
-
}
|
|
289
|
-
};
|
|
290
|
-
var PrunePartialFailureError = class extends Error {
|
|
291
|
-
constructor(deleted, failedAt, remaining, cause, deletedTasks = 0, deletedEvents = 0) {
|
|
292
|
-
super(`Prune partially failed: deleted ${deleted}, failed at ${failedAt}, ${remaining} remaining`);
|
|
293
|
-
this.name = "PrunePartialFailureError";
|
|
294
|
-
this.deleted = deleted;
|
|
295
|
-
this.failedAt = failedAt;
|
|
296
|
-
this.remaining = remaining;
|
|
297
|
-
this.deletedTasks = deletedTasks;
|
|
298
|
-
this.deletedEvents = deletedEvents;
|
|
299
|
-
this.cause = cause;
|
|
300
|
-
}
|
|
301
|
-
};
|
|
302
|
-
var HOOK_TIMEOUT_MARKER = /* @__PURE__ */ Symbol("WikiMemoryHookTimeout");
|
|
303
|
-
|
|
304
358
|
// src/services/JobManager.ts
|
|
305
359
|
var JobManager = class {
|
|
306
360
|
constructor(prefix) {
|
|
@@ -2991,6 +3045,6 @@ var WriteService = class {
|
|
|
2991
3045
|
}
|
|
2992
3046
|
};
|
|
2993
3047
|
|
|
2994
|
-
export { BaseRepository, EmbeddingService, HOOK_TIMEOUT_MARKER, ImportExportService, IngestionService, JobManager, MaintenanceService, MetadataRepository, PromptService, PrunePartialFailureError, RetrievalService, SearchService, WikiBusyError, WriteService, __privateAdd, __privateGet, __privateSet, configureRandomSource, emptyManifest, entitySummaryMetaKey, generateId, normalizeSourceHash, normalizeSourceRef, normalizeTitleKey, parseEmbedding, resolveEdgeDefinition, resolveNodeType, validateInlineEdges };
|
|
2995
|
-
//# sourceMappingURL=chunk-
|
|
2996
|
-
//# sourceMappingURL=chunk-
|
|
3048
|
+
export { BaseRepository, EmbeddingService, HOOK_TIMEOUT_MARKER, ImportExportService, IngestionService, JobManager, MaintenanceService, MetadataRepository, PromptService, PrunePartialFailureError, RetrievalService, SearchService, WikiBusyError, WikiTransactionError, WriteService, __privateAdd, __privateGet, __privateSet, configureRandomSource, emptyManifest, entitySummaryMetaKey, extractSqliteCode, generateId, normalizeSourceHash, normalizeSourceRef, normalizeTitleKey, parseEmbedding, resolveEdgeDefinition, resolveNodeType, validateInlineEdges };
|
|
3049
|
+
//# sourceMappingURL=chunk-HKB5FEJG.mjs.map
|
|
3050
|
+
//# sourceMappingURL=chunk-HKB5FEJG.mjs.map
|