@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/dist/index.d.mts CHANGED
@@ -26,6 +26,16 @@ declare function parseOkfBundle(entityId: string, files: OkfFile[], options?: Ok
26
26
 
27
27
  declare function parseEmbedding(blob: Uint8Array | null | undefined, text: string | null | undefined): Float32Array | null;
28
28
 
29
+ type GetRandomValues = (bytes: Uint8Array) => void;
30
+ /**
31
+ * Inject a platform-specific `getRandomValues` implementation.
32
+ * Call this once at module load time from the platform adapter
33
+ * (e.g. expo-crypto's getRandomValues) when the global `crypto` API is
34
+ * absent — Hermes / React Native being the primary case.
35
+ * Pass `null` to clear a previously injected source.
36
+ */
37
+ declare function configureRandomSource(fn: GetRandomValues | null): void;
38
+
29
39
  interface LibrarianOptions {
30
40
  /** If provided, replaces the default Librarian system instructions. */
31
41
  systemPrompt?: string;
@@ -50,4 +60,4 @@ declare function mapLibrarianOptionsToReadOptions(options: LibrarianOptions): Pi
50
60
 
51
61
  declare function createWiki(db: SQLiteAdapter, options: WikiOptions): WikiMemory;
52
62
 
53
- export { DEFAULT_LIBRARIAN_SYNTHESIS_PROMPT, FormatContextOptions, FormattedMemoryDump, GraphNeighborhood, type LibrarianOptions, type LibrarianPromptVariables, MemoryBundle, MemoryDump, type OkfImportOptions, ReadOptions, SQLiteAdapter, WikiMemory, WikiOptions, createWiki, formatContext, formatGraphContext, formatMemoryDump, formatOkfBundle, hydrateLibrarianPrompt, mapLibrarianOptionsToReadOptions, parseEmbedding, parseOkfBundle, validateLibrarianPromptTemplate };
63
+ export { DEFAULT_LIBRARIAN_SYNTHESIS_PROMPT, FormatContextOptions, FormattedMemoryDump, GraphNeighborhood, type LibrarianOptions, type LibrarianPromptVariables, MemoryBundle, MemoryDump, type OkfImportOptions, ReadOptions, SQLiteAdapter, WikiMemory, WikiOptions, configureRandomSource, createWiki, formatContext, formatGraphContext, formatMemoryDump, formatOkfBundle, hydrateLibrarianPrompt, mapLibrarianOptionsToReadOptions, parseEmbedding, parseOkfBundle, validateLibrarianPromptTemplate };
package/dist/index.d.ts CHANGED
@@ -26,6 +26,16 @@ declare function parseOkfBundle(entityId: string, files: OkfFile[], options?: Ok
26
26
 
27
27
  declare function parseEmbedding(blob: Uint8Array | null | undefined, text: string | null | undefined): Float32Array | null;
28
28
 
29
+ type GetRandomValues = (bytes: Uint8Array) => void;
30
+ /**
31
+ * Inject a platform-specific `getRandomValues` implementation.
32
+ * Call this once at module load time from the platform adapter
33
+ * (e.g. expo-crypto's getRandomValues) when the global `crypto` API is
34
+ * absent — Hermes / React Native being the primary case.
35
+ * Pass `null` to clear a previously injected source.
36
+ */
37
+ declare function configureRandomSource(fn: GetRandomValues | null): void;
38
+
29
39
  interface LibrarianOptions {
30
40
  /** If provided, replaces the default Librarian system instructions. */
31
41
  systemPrompt?: string;
@@ -50,4 +60,4 @@ declare function mapLibrarianOptionsToReadOptions(options: LibrarianOptions): Pi
50
60
 
51
61
  declare function createWiki(db: SQLiteAdapter, options: WikiOptions): WikiMemory;
52
62
 
53
- export { DEFAULT_LIBRARIAN_SYNTHESIS_PROMPT, FormatContextOptions, FormattedMemoryDump, GraphNeighborhood, type LibrarianOptions, type LibrarianPromptVariables, MemoryBundle, MemoryDump, type OkfImportOptions, ReadOptions, SQLiteAdapter, WikiMemory, WikiOptions, createWiki, formatContext, formatGraphContext, formatMemoryDump, formatOkfBundle, hydrateLibrarianPrompt, mapLibrarianOptionsToReadOptions, parseEmbedding, parseOkfBundle, validateLibrarianPromptTemplate };
63
+ export { DEFAULT_LIBRARIAN_SYNTHESIS_PROMPT, FormatContextOptions, FormattedMemoryDump, GraphNeighborhood, type LibrarianOptions, type LibrarianPromptVariables, MemoryBundle, MemoryDump, type OkfImportOptions, ReadOptions, SQLiteAdapter, WikiMemory, WikiOptions, configureRandomSource, createWiki, formatContext, formatGraphContext, formatMemoryDump, formatOkfBundle, hydrateLibrarianPrompt, mapLibrarianOptionsToReadOptions, parseEmbedding, parseOkfBundle, validateLibrarianPromptTemplate };
package/dist/index.js CHANGED
@@ -983,6 +983,10 @@ var EntryRepository = class extends BaseRepository {
983
983
  };
984
984
 
985
985
  // src/utils/ids.ts
986
+ var _injectedGetRandomValues = null;
987
+ function configureRandomSource(fn) {
988
+ _injectedGetRandomValues = fn;
989
+ }
986
990
  function generateId(prefix = "") {
987
991
  if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
988
992
  return prefix + crypto.randomUUID().replace(/-/g, "").substring(0, 24);
@@ -992,8 +996,13 @@ function generateId(prefix = "") {
992
996
  crypto.getRandomValues(bytes);
993
997
  return prefix + Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("").substring(0, 24);
994
998
  }
999
+ if (_injectedGetRandomValues) {
1000
+ const bytes = new Uint8Array(16);
1001
+ _injectedGetRandomValues(bytes);
1002
+ return prefix + Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("").substring(0, 24);
1003
+ }
995
1004
  throw new Error(
996
- "generateId: no cryptographically secure random source available (crypto.randomUUID and crypto.getRandomValues are both missing)."
1005
+ "generateId: no cryptographically secure random source available (crypto.randomUUID and crypto.getRandomValues are both missing, and no configureRandomSource() injection was provided)."
997
1006
  );
998
1007
  }
999
1008
 
@@ -5563,6 +5572,7 @@ exports.PromptService = PromptService;
5563
5572
  exports.PrunePartialFailureError = PrunePartialFailureError;
5564
5573
  exports.WikiBusyError = WikiBusyError;
5565
5574
  exports.WikiMemory = WikiMemory;
5575
+ exports.configureRandomSource = configureRandomSource;
5566
5576
  exports.createWiki = createWiki;
5567
5577
  exports.formatContext = formatContext;
5568
5578
  exports.formatGraphContext = formatGraphContext;