@equationalapplications/expo-llm-wiki 0.0.0-development → 2.0.2

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 CHANGED
@@ -1,5 +1,10 @@
1
1
  # expo-llm-wiki
2
2
 
3
+ [![GitHub Tag](https://img.shields.io/github/v/tag/equationalapplications/expo-llm-wiki?label=github%20tag)](https://github.com/equationalapplications/expo-llm-wiki/tags)
4
+ [![npm version](https://img.shields.io/npm/v/%40equationalapplications%2Fexpo-llm-wiki?label=npm)](https://www.npmjs.com/package/@equationalapplications/expo-llm-wiki)
5
+ [![npm downloads](https://img.shields.io/npm/dm/%40equationalapplications%2Fexpo-llm-wiki?label=downloads)](https://www.npmjs.com/package/@equationalapplications/expo-llm-wiki)
6
+ [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
7
+
3
8
  Offline-first, SQLite-backed memory for LLM apps built with Expo. Handles FTS5 search, episodic event logging, background fact extraction, and memory healing — bring your own LLM.
4
9
 
5
10
  ## Key Principles
@@ -135,7 +140,8 @@ const result = await wiki.ingestDocument('entity-123', {
135
140
  sourceRef: 'preferences.md', // stable identifier
136
141
  sourceHash: sha256(content), // for change detection
137
142
  documentChunk: content,
138
- maxChunkLength: 6000, // optional, character count
143
+ maxChunkLength: 12000, // optional, character count
144
+ chunkOverlap: 400, // optional, overlap in characters
139
145
  });
140
146
  // result: { truncated: boolean; chunks: number }
141
147
  // truncated: true if at least one hard-split was required (no sentence boundary)
@@ -257,3 +263,7 @@ All mutation hooks follow the same pattern (`TResult` is specific per hook):
257
263
  error: Error | null; // cleared on the next execute call
258
264
  }
259
265
  ```
266
+
267
+ ---
268
+
269
+ Made with ❤️ by Equational Applications LLC. [https://equationalapplications.com/](https://equationalapplications.com/)
@@ -9,6 +9,8 @@ interface WikiConfig {
9
9
  orphanAfterDays?: number | null;
10
10
  staleInferredAfterDays?: number | null;
11
11
  maxChunkLength?: number;
12
+ chunkOverlap?: number;
13
+ chunkConcurrency?: number;
12
14
  }
13
15
  interface WikiFact {
14
16
  id: string;
@@ -79,22 +81,54 @@ interface MemoryBundle {
79
81
  tasks: WikiTask[];
80
82
  events: WikiEvent[];
81
83
  }
84
+ interface MemoryDump {
85
+ generatedAt: number;
86
+ entities: Record<string, MemoryBundle>;
87
+ }
88
+ interface FormattedMemoryDump {
89
+ manifest: string;
90
+ files: Array<{
91
+ name: string;
92
+ content: string;
93
+ }>;
94
+ }
95
+ interface EntityStatus {
96
+ ingesting: boolean;
97
+ librarian: boolean;
98
+ heal: boolean;
99
+ }
100
+ declare class WikiBusyError extends Error {
101
+ readonly operation: 'ingest' | 'librarian' | 'heal';
102
+ readonly entityId: string;
103
+ constructor(operation: 'ingest' | 'librarian' | 'heal', entityId: string);
104
+ }
82
105
 
83
106
  declare class WikiMemory {
84
107
  private db;
85
108
  private prefix;
86
109
  private options;
87
110
  private activeMaintenanceJobs;
111
+ private activeIngestJobs;
112
+ private _librarianKey;
113
+ private _healKey;
114
+ private _warnCrossEntityCollision;
88
115
  constructor(db: SQLite.SQLiteDatabase, options: WikiOptions);
89
116
  setup(): Promise<void>;
90
117
  private formatSearchQuery;
91
118
  read(entityId: string, query: string): Promise<MemoryBundle>;
119
+ getMemoryBundle(entityId: string): Promise<MemoryBundle>;
92
120
  write(entityId: string, event: Omit<WikiEvent, 'id' | 'entity_id' | 'created_at'>): Promise<void>;
93
121
  private runLibrarianThenMaybeHeal;
94
122
  private _doRunLibrarian;
95
123
  private _doRunHeal;
96
124
  runLibrarian(entityId: string): Promise<void>;
97
125
  runHeal(entityId: string): Promise<void>;
126
+ getEntityStatus(entityId: string): EntityStatus;
127
+ private _getFullBundle;
128
+ exportDump(entityIds?: string[]): Promise<MemoryDump>;
129
+ importDump(dump: MemoryDump, opts?: {
130
+ merge?: boolean;
131
+ }): Promise<void>;
98
132
  forget(entityId: string, params: {
99
133
  entryId?: string;
100
134
  taskId?: string;
@@ -112,10 +146,12 @@ declare class WikiMemory {
112
146
  sourceHash: string;
113
147
  documentChunk: string;
114
148
  maxChunkLength?: number;
149
+ chunkOverlap?: number;
150
+ chunkConcurrency?: number;
115
151
  }): Promise<{
116
152
  truncated: boolean;
117
153
  chunks: number;
118
154
  }>;
119
155
  }
120
156
 
121
- export { type ExtractedFact as E, type LLMProvider as L, type MemoryBundle as M, type WikiOptions as W, WikiMemory as a, type ExtractedTask as b, type WikiCheckpoint as c, type WikiConfig as d, type WikiEvent as e, type WikiFact as f, type WikiTask as g };
157
+ export { type EntityStatus as E, type FormattedMemoryDump as F, type LLMProvider as L, type MemoryDump as M, type WikiOptions as W, WikiMemory as a, type ExtractedFact as b, type ExtractedTask as c, type MemoryBundle as d, WikiBusyError as e, type WikiCheckpoint as f, type WikiConfig as g, type WikiEvent as h, type WikiFact as i, type WikiTask as j };
@@ -9,6 +9,8 @@ interface WikiConfig {
9
9
  orphanAfterDays?: number | null;
10
10
  staleInferredAfterDays?: number | null;
11
11
  maxChunkLength?: number;
12
+ chunkOverlap?: number;
13
+ chunkConcurrency?: number;
12
14
  }
13
15
  interface WikiFact {
14
16
  id: string;
@@ -79,22 +81,54 @@ interface MemoryBundle {
79
81
  tasks: WikiTask[];
80
82
  events: WikiEvent[];
81
83
  }
84
+ interface MemoryDump {
85
+ generatedAt: number;
86
+ entities: Record<string, MemoryBundle>;
87
+ }
88
+ interface FormattedMemoryDump {
89
+ manifest: string;
90
+ files: Array<{
91
+ name: string;
92
+ content: string;
93
+ }>;
94
+ }
95
+ interface EntityStatus {
96
+ ingesting: boolean;
97
+ librarian: boolean;
98
+ heal: boolean;
99
+ }
100
+ declare class WikiBusyError extends Error {
101
+ readonly operation: 'ingest' | 'librarian' | 'heal';
102
+ readonly entityId: string;
103
+ constructor(operation: 'ingest' | 'librarian' | 'heal', entityId: string);
104
+ }
82
105
 
83
106
  declare class WikiMemory {
84
107
  private db;
85
108
  private prefix;
86
109
  private options;
87
110
  private activeMaintenanceJobs;
111
+ private activeIngestJobs;
112
+ private _librarianKey;
113
+ private _healKey;
114
+ private _warnCrossEntityCollision;
88
115
  constructor(db: SQLite.SQLiteDatabase, options: WikiOptions);
89
116
  setup(): Promise<void>;
90
117
  private formatSearchQuery;
91
118
  read(entityId: string, query: string): Promise<MemoryBundle>;
119
+ getMemoryBundle(entityId: string): Promise<MemoryBundle>;
92
120
  write(entityId: string, event: Omit<WikiEvent, 'id' | 'entity_id' | 'created_at'>): Promise<void>;
93
121
  private runLibrarianThenMaybeHeal;
94
122
  private _doRunLibrarian;
95
123
  private _doRunHeal;
96
124
  runLibrarian(entityId: string): Promise<void>;
97
125
  runHeal(entityId: string): Promise<void>;
126
+ getEntityStatus(entityId: string): EntityStatus;
127
+ private _getFullBundle;
128
+ exportDump(entityIds?: string[]): Promise<MemoryDump>;
129
+ importDump(dump: MemoryDump, opts?: {
130
+ merge?: boolean;
131
+ }): Promise<void>;
98
132
  forget(entityId: string, params: {
99
133
  entryId?: string;
100
134
  taskId?: string;
@@ -112,10 +146,12 @@ declare class WikiMemory {
112
146
  sourceHash: string;
113
147
  documentChunk: string;
114
148
  maxChunkLength?: number;
149
+ chunkOverlap?: number;
150
+ chunkConcurrency?: number;
115
151
  }): Promise<{
116
152
  truncated: boolean;
117
153
  chunks: number;
118
154
  }>;
119
155
  }
120
156
 
121
- export { type ExtractedFact as E, type LLMProvider as L, type MemoryBundle as M, type WikiOptions as W, WikiMemory as a, type ExtractedTask as b, type WikiCheckpoint as c, type WikiConfig as d, type WikiEvent as e, type WikiFact as f, type WikiTask as g };
157
+ export { type EntityStatus as E, type FormattedMemoryDump as F, type LLMProvider as L, type MemoryDump as M, type WikiOptions as W, WikiMemory as a, type ExtractedFact as b, type ExtractedTask as c, type MemoryBundle as d, WikiBusyError as e, type WikiCheckpoint as f, type WikiConfig as g, type WikiEvent as h, type WikiFact as i, type WikiTask as j };
package/dist/index.d.mts CHANGED
@@ -1,7 +1,9 @@
1
1
  import * as SQLite from 'expo-sqlite';
2
- import { W as WikiOptions, a as WikiMemory } from './WikiMemory-BI2Aizwv.mjs';
3
- export { E as ExtractedFact, b as ExtractedTask, L as LLMProvider, M as MemoryBundle, c as WikiCheckpoint, d as WikiConfig, e as WikiEvent, f as WikiFact, g as WikiTask } from './WikiMemory-BI2Aizwv.mjs';
2
+ import { M as MemoryDump, F as FormattedMemoryDump, W as WikiOptions, a as WikiMemory } from './WikiMemory-B54Gaa-K.mjs';
3
+ export { E as EntityStatus, b as ExtractedFact, c as ExtractedTask, L as LLMProvider, d as MemoryBundle, e as WikiBusyError, f as WikiCheckpoint, g as WikiConfig, h as WikiEvent, i as WikiFact, j as WikiTask } from './WikiMemory-B54Gaa-K.mjs';
4
+
5
+ declare function formatMemoryDump(dump: MemoryDump): FormattedMemoryDump;
4
6
 
5
7
  declare function createWiki(db: SQLite.SQLiteDatabase, options: WikiOptions): WikiMemory;
6
8
 
7
- export { WikiMemory, WikiOptions, createWiki };
9
+ export { FormattedMemoryDump, MemoryDump, WikiMemory, WikiOptions, createWiki, formatMemoryDump };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  import * as SQLite from 'expo-sqlite';
2
- import { W as WikiOptions, a as WikiMemory } from './WikiMemory-BI2Aizwv.js';
3
- export { E as ExtractedFact, b as ExtractedTask, L as LLMProvider, M as MemoryBundle, c as WikiCheckpoint, d as WikiConfig, e as WikiEvent, f as WikiFact, g as WikiTask } from './WikiMemory-BI2Aizwv.js';
2
+ import { M as MemoryDump, F as FormattedMemoryDump, W as WikiOptions, a as WikiMemory } from './WikiMemory-B54Gaa-K.js';
3
+ export { E as EntityStatus, b as ExtractedFact, c as ExtractedTask, L as LLMProvider, d as MemoryBundle, e as WikiBusyError, f as WikiCheckpoint, g as WikiConfig, h as WikiEvent, i as WikiFact, j as WikiTask } from './WikiMemory-B54Gaa-K.js';
4
+
5
+ declare function formatMemoryDump(dump: MemoryDump): FormattedMemoryDump;
4
6
 
5
7
  declare function createWiki(db: SQLite.SQLiteDatabase, options: WikiOptions): WikiMemory;
6
8
 
7
- export { WikiMemory, WikiOptions, createWiki };
9
+ export { FormattedMemoryDump, MemoryDump, WikiMemory, WikiOptions, createWiki, formatMemoryDump };