@equationalapplications/core-llm-wiki 4.17.0 → 4.17.1
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 +20 -0
- package/dist/{chunk-M74FCWLB.mjs → chunk-AV2ZNKEA.mjs} +27 -18
- package/dist/chunk-AV2ZNKEA.mjs.map +1 -0
- package/dist/index.d.mts +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/dist/testing.js +1 -3
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +1 -1
- package/package.json +2 -2
- package/dist/chunk-M74FCWLB.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -731,6 +731,26 @@ const finalPrompt = hydrateLibrarianPrompt(template, {
|
|
|
731
731
|
});
|
|
732
732
|
```
|
|
733
733
|
|
|
734
|
+
## Platform Random Source
|
|
735
|
+
|
|
736
|
+
Wiki record IDs must be cryptographically random. The core engine resolves a random source in this order:
|
|
737
|
+
|
|
738
|
+
1. `crypto.randomUUID()` (Web / Node 19+)
|
|
739
|
+
2. `crypto.getRandomValues()` (Web / Node / polyfilled global)
|
|
740
|
+
3. A source injected via `configureRandomSource()` (e.g. `expo-crypto` on Hermes/React Native)
|
|
741
|
+
|
|
742
|
+
Web and Node are unchanged — global `crypto` wins when present. React Native / Hermes typically has no `crypto` global; use a platform package or inject your own implementation:
|
|
743
|
+
|
|
744
|
+
```typescript
|
|
745
|
+
import { configureRandomSource } from '@equationalapplications/core-llm-wiki';
|
|
746
|
+
import { getRandomValues } from 'expo-crypto';
|
|
747
|
+
|
|
748
|
+
// Call once at module load, before any wiki writes
|
|
749
|
+
configureRandomSource(getRandomValues);
|
|
750
|
+
```
|
|
751
|
+
|
|
752
|
+
`@equationalapplications/expo-llm-wiki` does this automatically on import (main entry and `/factory` subpath). If you use `@equationalapplications/core-llm-wiki` directly on React Native without the expo package, you must call `configureRandomSource()` yourself or polyfill `globalThis.crypto.getRandomValues`.
|
|
753
|
+
|
|
734
754
|
## Adapter Interface
|
|
735
755
|
|
|
736
756
|
Implement `SQLiteAdapter` to use your platform's SQLite driver:
|
|
@@ -8,6 +8,30 @@ 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/utils/ids.ts
|
|
12
|
+
var _injectedGetRandomValues = null;
|
|
13
|
+
function configureRandomSource(fn) {
|
|
14
|
+
_injectedGetRandomValues = fn;
|
|
15
|
+
}
|
|
16
|
+
function generateId(prefix = "") {
|
|
17
|
+
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
18
|
+
return prefix + crypto.randomUUID().replace(/-/g, "").substring(0, 24);
|
|
19
|
+
}
|
|
20
|
+
if (typeof crypto !== "undefined" && typeof crypto.getRandomValues === "function") {
|
|
21
|
+
const bytes = new Uint8Array(16);
|
|
22
|
+
crypto.getRandomValues(bytes);
|
|
23
|
+
return prefix + Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("").substring(0, 24);
|
|
24
|
+
}
|
|
25
|
+
if (_injectedGetRandomValues) {
|
|
26
|
+
const bytes = new Uint8Array(16);
|
|
27
|
+
_injectedGetRandomValues(bytes);
|
|
28
|
+
return prefix + Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("").substring(0, 24);
|
|
29
|
+
}
|
|
30
|
+
throw new Error(
|
|
31
|
+
"generateId: no cryptographically secure random source available (crypto.randomUUID and crypto.getRandomValues are both missing, and no configureRandomSource() injection was provided)."
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
11
35
|
// src/utils/embedding.ts
|
|
12
36
|
function parseEmbedding(blob, text) {
|
|
13
37
|
if (blob && blob.byteLength > 0) {
|
|
@@ -984,21 +1008,6 @@ function validateInlineEdges(sourceType, _targetType, edges, manifest) {
|
|
|
984
1008
|
return valid;
|
|
985
1009
|
}
|
|
986
1010
|
|
|
987
|
-
// src/utils/ids.ts
|
|
988
|
-
function generateId(prefix = "") {
|
|
989
|
-
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
990
|
-
return prefix + crypto.randomUUID().replace(/-/g, "").substring(0, 24);
|
|
991
|
-
}
|
|
992
|
-
if (typeof crypto !== "undefined" && typeof crypto.getRandomValues === "function") {
|
|
993
|
-
const bytes = new Uint8Array(16);
|
|
994
|
-
crypto.getRandomValues(bytes);
|
|
995
|
-
return prefix + Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("").substring(0, 24);
|
|
996
|
-
}
|
|
997
|
-
throw new Error(
|
|
998
|
-
"generateId: no cryptographically secure random source available (crypto.randomUUID and crypto.getRandomValues are both missing)."
|
|
999
|
-
);
|
|
1000
|
-
}
|
|
1001
|
-
|
|
1002
1011
|
// src/services/IngestionService.ts
|
|
1003
1012
|
var IngestionService = class {
|
|
1004
1013
|
constructor(db, prefix, options, entryRepo, searchService, jobManager, embeddingService, promptService, ontologyService) {
|
|
@@ -2806,6 +2815,6 @@ var WriteService = class {
|
|
|
2806
2815
|
}
|
|
2807
2816
|
};
|
|
2808
2817
|
|
|
2809
|
-
export { EmbeddingService, HOOK_TIMEOUT_MARKER, ImportExportService, IngestionService, JobManager, MaintenanceService, PromptService, PrunePartialFailureError, RetrievalService, SearchService, WikiBusyError, WriteService, __privateAdd, __privateGet, __privateSet, emptyManifest, generateId, mergeOntologyUpdates, normalizeSourceHash, normalizeSourceRef, normalizeTitleKey, parseEmbedding, resolveEdgeDefinition, resolveNodeType, validateInlineEdges, validateManifest };
|
|
2810
|
-
//# sourceMappingURL=chunk-
|
|
2811
|
-
//# sourceMappingURL=chunk-
|
|
2818
|
+
export { EmbeddingService, HOOK_TIMEOUT_MARKER, ImportExportService, IngestionService, JobManager, MaintenanceService, PromptService, PrunePartialFailureError, RetrievalService, SearchService, WikiBusyError, WriteService, __privateAdd, __privateGet, __privateSet, configureRandomSource, emptyManifest, generateId, mergeOntologyUpdates, normalizeSourceHash, normalizeSourceRef, normalizeTitleKey, parseEmbedding, resolveEdgeDefinition, resolveNodeType, validateInlineEdges, validateManifest };
|
|
2819
|
+
//# sourceMappingURL=chunk-AV2ZNKEA.mjs.map
|
|
2820
|
+
//# sourceMappingURL=chunk-AV2ZNKEA.mjs.map
|