@equationalapplications/expo-llm-wiki 2.2.0 → 2.3.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 +122 -12
- package/dist/{WikiMemory-CjlQ68X0.d.mts → WikiMemory-ChQmVyvA.d.mts} +13 -1
- package/dist/{WikiMemory-CjlQ68X0.d.ts → WikiMemory-ChQmVyvA.d.ts} +13 -1
- package/dist/index.d.mts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +324 -39
- package/dist/index.mjs +323 -39
- package/dist/react/index.d.mts +30 -3
- package/dist/react/index.d.ts +30 -3
- package/dist/react/index.js +57 -3
- package/dist/react/index.mjs +56 -3
- package/package.json +1 -1
package/dist/react/index.mjs
CHANGED
|
@@ -101,7 +101,7 @@ function useWikiMaintenance() {
|
|
|
101
101
|
setLastResult(null);
|
|
102
102
|
try {
|
|
103
103
|
await wikiRef.current.runLibrarian(entityId);
|
|
104
|
-
setLastResult(void 0);
|
|
104
|
+
setLastResult({ operation: "librarian", result: void 0 });
|
|
105
105
|
} catch (e) {
|
|
106
106
|
const err = e instanceof Error ? e : new Error(String(e));
|
|
107
107
|
setError(err);
|
|
@@ -118,7 +118,7 @@ function useWikiMaintenance() {
|
|
|
118
118
|
setLastResult(null);
|
|
119
119
|
try {
|
|
120
120
|
await wikiRef.current.runHeal(entityId);
|
|
121
|
-
setLastResult(void 0);
|
|
121
|
+
setLastResult({ operation: "heal", result: void 0 });
|
|
122
122
|
} catch (e) {
|
|
123
123
|
const err = e instanceof Error ? e : new Error(String(e));
|
|
124
124
|
setError(err);
|
|
@@ -128,7 +128,28 @@ function useWikiMaintenance() {
|
|
|
128
128
|
if (pendingCount.current === 0) setIsPending(false);
|
|
129
129
|
}
|
|
130
130
|
}, []);
|
|
131
|
-
|
|
131
|
+
const runPrune = useCallback3(
|
|
132
|
+
async (entityId, options) => {
|
|
133
|
+
setError(null);
|
|
134
|
+
pendingCount.current += 1;
|
|
135
|
+
setIsPending(true);
|
|
136
|
+
setLastResult(null);
|
|
137
|
+
try {
|
|
138
|
+
const result = await wikiRef.current.runPrune(entityId, options);
|
|
139
|
+
setLastResult({ operation: "prune", result });
|
|
140
|
+
return result;
|
|
141
|
+
} catch (e) {
|
|
142
|
+
const err = e instanceof Error ? e : new Error(String(e));
|
|
143
|
+
setError(err);
|
|
144
|
+
throw err;
|
|
145
|
+
} finally {
|
|
146
|
+
pendingCount.current -= 1;
|
|
147
|
+
if (pendingCount.current === 0) setIsPending(false);
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
[]
|
|
151
|
+
);
|
|
152
|
+
return { runLibrarian, runHeal, runPrune, lastResult, isPending, error };
|
|
132
153
|
}
|
|
133
154
|
|
|
134
155
|
// src/react/useWikiIngest.ts
|
|
@@ -214,12 +235,44 @@ function useWikiExport() {
|
|
|
214
235
|
}, []);
|
|
215
236
|
return { execute, lastResult, isPending, error };
|
|
216
237
|
}
|
|
238
|
+
|
|
239
|
+
// src/react/useWikiHasChanged.ts
|
|
240
|
+
import { useState as useState7, useCallback as useCallback7, useRef as useRef7 } from "react";
|
|
241
|
+
function useWikiHasChanged() {
|
|
242
|
+
const wiki = useWiki();
|
|
243
|
+
const wikiRef = useRef7(wiki);
|
|
244
|
+
wikiRef.current = wiki;
|
|
245
|
+
const [isPending, setIsPending] = useState7(false);
|
|
246
|
+
const [error, setError] = useState7(null);
|
|
247
|
+
const [lastResult, setLastResult] = useState7(null);
|
|
248
|
+
const execute = useCallback7(
|
|
249
|
+
async (entityId, sourceRef, sourceHash) => {
|
|
250
|
+
setError(null);
|
|
251
|
+
setIsPending(true);
|
|
252
|
+
setLastResult(null);
|
|
253
|
+
try {
|
|
254
|
+
const result = await wikiRef.current.hasChanged(entityId, sourceRef, sourceHash);
|
|
255
|
+
setLastResult(result);
|
|
256
|
+
return result;
|
|
257
|
+
} catch (e) {
|
|
258
|
+
const err = e instanceof Error ? e : new Error(String(e));
|
|
259
|
+
setError(err);
|
|
260
|
+
throw err;
|
|
261
|
+
} finally {
|
|
262
|
+
setIsPending(false);
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
[]
|
|
266
|
+
);
|
|
267
|
+
return { execute, lastResult, isPending, error };
|
|
268
|
+
}
|
|
217
269
|
export {
|
|
218
270
|
WikiProvider,
|
|
219
271
|
useMemoryRead,
|
|
220
272
|
useWiki,
|
|
221
273
|
useWikiExport,
|
|
222
274
|
useWikiForget,
|
|
275
|
+
useWikiHasChanged,
|
|
223
276
|
useWikiIngest,
|
|
224
277
|
useWikiMaintenance,
|
|
225
278
|
useWikiWrite
|
package/package.json
CHANGED