@equationalapplications/core-llm-wiki 7.11.2 → 7.13.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 +22 -0
- package/dist/{chunk-522SCN2E.mjs → chunk-PCRYIUV5.mjs} +2299 -1408
- package/dist/chunk-PCRYIUV5.mjs.map +1 -0
- package/dist/index.d.mts +10 -3
- package/dist/index.d.ts +10 -3
- package/dist/index.js +5336 -4465
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +645 -669
- package/dist/index.mjs.map +1 -1
- package/dist/{testing-B0UtFCq1.d.mts → testing-CqsXv2_l.d.mts} +195 -23
- package/dist/{testing-B0UtFCq1.d.ts → testing-CqsXv2_l.d.ts} +195 -23
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +494 -35
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +1 -1
- package/package.json +3 -3
- package/dist/chunk-522SCN2E.mjs.map +0 -1
|
@@ -209,6 +209,10 @@ interface HealResult {
|
|
|
209
209
|
* cooldown", not "there is no more work" — it climbs back as the cooldown lapses
|
|
210
210
|
* and as new facts are written. A host loop terminates, but it converges to
|
|
211
211
|
* "corpus swept once this cooldown window", not to a drained queue.
|
|
212
|
+
*
|
|
213
|
+
* A pass that could not make progress (`searchUnavailable` or `budgetStop`
|
|
214
|
+
* set) leaves `remaining > 0`, so a convergence loop must also stop on those:
|
|
215
|
+
* `while (r.remaining > 0 && !r.searchUnavailable && !r.budgetStop)`.
|
|
212
216
|
*/
|
|
213
217
|
remaining: number;
|
|
214
218
|
/** Heal candidates inside the recheck cooldown. */
|
|
@@ -217,6 +221,12 @@ interface HealResult {
|
|
|
217
221
|
budgetStop?: {
|
|
218
222
|
requiredEstimate: number;
|
|
219
223
|
};
|
|
224
|
+
/**
|
|
225
|
+
* True when the LLM pass was skipped because keyword search is unavailable
|
|
226
|
+
* (heal anchors need it; spec #280). Candidates stay eligible and unattempted;
|
|
227
|
+
* retry after `syncSearchIndex()` restores keyword search.
|
|
228
|
+
*/
|
|
229
|
+
searchUnavailable?: true;
|
|
220
230
|
}
|
|
221
231
|
/**
|
|
222
232
|
* Opt-in evidence check for LLM-authored facts (spec §6). Default off: 7.x
|
|
@@ -324,6 +334,12 @@ interface WikiConfig {
|
|
|
324
334
|
* entries table, so memory stays flat at any size. The first `setup()` that
|
|
325
335
|
* attaches FTS5 to an existing database rebuilds the index in one
|
|
326
336
|
* transaction, holding the write lock for its whole duration.
|
|
337
|
+
* If FTS5 init fails under `'auto'`, `setup()` retries once after 250 ms and
|
|
338
|
+
* then completes with keyword search unavailable (queries throw
|
|
339
|
+
* `WikiSearchUnavailableError`); it never demotes to MiniSearch. MiniSearch
|
|
340
|
+
* is used only when pinned or when the SQLite build lacks FTS5/json1, and it
|
|
341
|
+
* holds all entry text in the JS heap: the measured ceiling is ~1M entries
|
|
342
|
+
* on a default Node heap (raise `--max-old-space-size` for larger stores).
|
|
327
343
|
* @default 'auto'
|
|
328
344
|
*/
|
|
329
345
|
indexStrategy?: 'fts5' | 'minisearch' | 'auto';
|
|
@@ -355,6 +371,27 @@ interface WikiConfig {
|
|
|
355
371
|
maintenance?: 'auto' | 'deferred';
|
|
356
372
|
/** `'auto'` mode only: also trigger the librarian when pending event text reaches ~this many tokens (chars/4). */
|
|
357
373
|
autoLibrarianTokenThreshold?: number;
|
|
374
|
+
/**
|
|
375
|
+
* Migration policy for setup().
|
|
376
|
+
* - `'allow'`: Run all migrations (default, preserves existing behavior)
|
|
377
|
+
* - `'refuse'`: Throw WikiMigrationRequiredError before any mutations
|
|
378
|
+
* - `'auto'`: Run the source_ref normalize if pending; throw if a schema migration is pending
|
|
379
|
+
* @default 'allow'
|
|
380
|
+
*/
|
|
381
|
+
migrations?: MigrationPolicy;
|
|
382
|
+
/**
|
|
383
|
+
* Wall-time budget (ms) for each keyword-index quantum: one per `setup()`
|
|
384
|
+
* (shared by the whole open — the deadline is captured when setup() starts)
|
|
385
|
+
* and one per no-arg `syncSearchIndex()`. Checked between chunk
|
|
386
|
+
* transactions, so one quantum can overrun it by up to two chunks. Ids a
|
|
387
|
+
* write stashed for the call (see `upsertGraph`) drain before the quantum
|
|
388
|
+
* and outside the budget. An index reset runs as one unchunked transaction and is
|
|
389
|
+
* not bounded by it either.
|
|
390
|
+
* Convergence of a large backlog or rebuild continues on later opens and
|
|
391
|
+
* `syncSearchIndex()` calls. Must be a positive finite number.
|
|
392
|
+
* @default 1500 (DEFAULT_SETUP_BUDGET_MS)
|
|
393
|
+
*/
|
|
394
|
+
setupBudgetMs?: number;
|
|
358
395
|
}
|
|
359
396
|
interface ReadOptions {
|
|
360
397
|
maxResults?: number;
|
|
@@ -1266,6 +1303,12 @@ interface EntityMaintenanceReport {
|
|
|
1266
1303
|
reembedded: boolean;
|
|
1267
1304
|
/** Set when a lock was held elsewhere; nothing ran for that job. */
|
|
1268
1305
|
busy?: MaintenanceJob[];
|
|
1306
|
+
/**
|
|
1307
|
+
* Set when keyword search is unavailable and the job could not run for this
|
|
1308
|
+
* entity (spec #280). Its watermark/checkpoint is kept; retry after
|
|
1309
|
+
* `syncSearchIndex()` restores keyword search.
|
|
1310
|
+
*/
|
|
1311
|
+
searchUnavailable?: MaintenanceJob[];
|
|
1269
1312
|
}
|
|
1270
1313
|
interface RunPendingMaintenanceResult {
|
|
1271
1314
|
perEntity: EntityMaintenanceReport[];
|
|
@@ -1276,6 +1319,33 @@ interface RunPendingMaintenanceResult {
|
|
|
1276
1319
|
remaining: number | null;
|
|
1277
1320
|
stoppedReason: MaintenanceStopReason;
|
|
1278
1321
|
}
|
|
1322
|
+
type MigrationPolicy = 'allow' | 'refuse' | 'auto';
|
|
1323
|
+
/** Work the migration gate found pending on an existing store. Watermarks are resume rowids (0 = not started). */
|
|
1324
|
+
type PendingMigrationWork = {
|
|
1325
|
+
type: 'schema_migration';
|
|
1326
|
+
fromVersion: number;
|
|
1327
|
+
toVersion: number;
|
|
1328
|
+
} | {
|
|
1329
|
+
type: 'source_ref_normalize';
|
|
1330
|
+
entriesWatermark: number;
|
|
1331
|
+
sourceRefIndexWatermark: number;
|
|
1332
|
+
};
|
|
1333
|
+
declare class WikiMigrationRequiredError extends Error {
|
|
1334
|
+
readonly code = "WIKI_MIGRATION_REQUIRED";
|
|
1335
|
+
readonly pendingWork: PendingMigrationWork;
|
|
1336
|
+
constructor(message: string, pendingWork: PendingMigrationWork);
|
|
1337
|
+
}
|
|
1338
|
+
/**
|
|
1339
|
+
* Thrown per keyword-search query while the keyword index is unavailable
|
|
1340
|
+
* (FTS5 init failed after its retry; spec #280 Change 4). Writes keep working
|
|
1341
|
+
* and the index converges once a later open or no-arg syncSearchIndex()
|
|
1342
|
+
* re-inits successfully. `cause` is the underlying init error.
|
|
1343
|
+
*/
|
|
1344
|
+
declare class WikiSearchUnavailableError extends Error {
|
|
1345
|
+
constructor(message?: string, cause?: unknown);
|
|
1346
|
+
}
|
|
1347
|
+
/** Proxy-safe `instanceof WikiSearchUnavailableError` (issue #96). */
|
|
1348
|
+
declare function isWikiSearchUnavailableError(err: unknown): boolean;
|
|
1279
1349
|
|
|
1280
1350
|
interface WikiOutboxEvent<T = unknown> {
|
|
1281
1351
|
id: string;
|
|
@@ -1395,6 +1465,8 @@ declare class EntryRepository extends BaseRepository {
|
|
|
1395
1465
|
private static readonly MINI_SEARCH_LIVE_WHERE;
|
|
1396
1466
|
private chunkSize;
|
|
1397
1467
|
constructor(db: SQLiteAdapter, prefix: string, outbox: OutboxRepository);
|
|
1468
|
+
/** Whether the entity has any non-deleted row (librarian gate: keyword ranking over zero facts is trivially empty). */
|
|
1469
|
+
hasLiveEntry(entityId: string, tx?: SQLiteAdapter): Promise<boolean>;
|
|
1398
1470
|
/**
|
|
1399
1471
|
* Fetch facts by IDs, optionally scoped to entity IDs.
|
|
1400
1472
|
* Returns facts in the order of the input IDs (first match wins).
|
|
@@ -1653,11 +1725,6 @@ declare class EntryRepository extends BaseRepository {
|
|
|
1653
1725
|
hasLegacySourceTypes(tx?: SQLiteAdapter): Promise<boolean>;
|
|
1654
1726
|
countLegacySourceTypes(tx?: SQLiteAdapter): Promise<number>;
|
|
1655
1727
|
findAllForReembed(entityId?: string, tx?: SQLiteAdapter): Promise<ReembedCandidateRow[]>;
|
|
1656
|
-
findRowsForSourceRefMigration(tx?: SQLiteAdapter): Promise<Array<{
|
|
1657
|
-
rowid: number;
|
|
1658
|
-
source_ref: string;
|
|
1659
|
-
}>>;
|
|
1660
|
-
updateSourceRefByRowid(rowid: number, sourceRef: string | null, tx: SQLiteAdapter): Promise<void>;
|
|
1661
1728
|
findLatestSourceHash(entityId: string, sourceRef: string, tx?: SQLiteAdapter): Promise<string | null>;
|
|
1662
1729
|
/**
|
|
1663
1730
|
* Batch version of {@link findLatestSourceHash}. Returns a Map covering every
|
|
@@ -1972,6 +2039,25 @@ interface IndexSearchResult {
|
|
|
1972
2039
|
*/
|
|
1973
2040
|
entity_id: string;
|
|
1974
2041
|
}
|
|
2042
|
+
/** One drain turn's shape (spec #280 Change 3 "drain interface"). */
|
|
2043
|
+
interface DrainOptions {
|
|
2044
|
+
/** `monotonicNow()` timestamp, checked between chunk transactions. Full mode only; default now + the strategy's budget. */
|
|
2045
|
+
deadline?: number;
|
|
2046
|
+
/**
|
|
2047
|
+
* `'ledger'` (write turns): `ids` to completion, then at most ONE foreign
|
|
2048
|
+
* chunk. `'full'` (setup(), no-arg syncSearchIndex()): `ids`, then the
|
|
2049
|
+
* ledger until the deadline, then rebuild work. Default `'full'`.
|
|
2050
|
+
*/
|
|
2051
|
+
mode?: 'ledger' | 'full';
|
|
2052
|
+
/**
|
|
2053
|
+
* The caller's own ledger ids: drained first, to completion, ≤500 per
|
|
2054
|
+
* transaction. Not deadline-bound: the cost is proportional to a write the
|
|
2055
|
+
* caller already made.
|
|
2056
|
+
*/
|
|
2057
|
+
ids?: readonly string[];
|
|
2058
|
+
/** With empty `ids` in ledger mode, the one foreign chunk is `fts_pending WHERE entity_id = ?`. */
|
|
2059
|
+
entityId?: string;
|
|
2060
|
+
}
|
|
1975
2061
|
/**
|
|
1976
2062
|
* Keyword-index abstraction. The strategy owns its own backing store
|
|
1977
2063
|
* (in-RAM MiniSearch vs on-disk FTS5) and is responsible for keeping it
|
|
@@ -2038,8 +2124,11 @@ interface IndexStrategy {
|
|
|
2038
2124
|
/**
|
|
2039
2125
|
* Create or verify the strategy's backing schema and run state changes.
|
|
2040
2126
|
* Called once by `createIndexStrategy`, before the strategy is installed.
|
|
2127
|
+
* `entriesExisted: false` marks a store `setup()` just created: FTS starts `live` with nothing to index.
|
|
2041
2128
|
*/
|
|
2042
|
-
init?(
|
|
2129
|
+
init?(opts?: {
|
|
2130
|
+
entriesExisted?: boolean;
|
|
2131
|
+
}): Promise<void>;
|
|
2043
2132
|
/**
|
|
2044
2133
|
* Apply every change recorded in the strategy's durable ledger, in bounded
|
|
2045
2134
|
* chunks. A strategy that implements this keeps itself consistent with
|
|
@@ -2048,9 +2137,7 @@ interface IndexStrategy {
|
|
|
2048
2137
|
* called from inside a `withTransactionAsync` callback; it opens its own
|
|
2049
2138
|
* transactions.
|
|
2050
2139
|
*/
|
|
2051
|
-
drain?(): Promise<void>;
|
|
2052
|
-
/** Rebuild entirely in SQL from the source tables; no rows pass through JS. */
|
|
2053
|
-
rebuildFromSource?(): Promise<void>;
|
|
2140
|
+
drain?(opts?: DrainOptions): Promise<void>;
|
|
2054
2141
|
}
|
|
2055
2142
|
|
|
2056
2143
|
interface ScoredRow {
|
|
@@ -2123,10 +2210,15 @@ declare class SearchService {
|
|
|
2123
2210
|
* service runs on an empty MiniSearch placeholder, as it always has.
|
|
2124
2211
|
*/
|
|
2125
2212
|
setIndexStrategy(strategy: IndexStrategy): void;
|
|
2213
|
+
/** False while the installed strategy is the degraded UnavailableIndexStrategy (spec #280 Change 4). */
|
|
2214
|
+
isKeywordAvailable(): boolean;
|
|
2215
|
+
/** True when the installed strategy drains a durable ledger (FTS5, or the degraded stand-in). */
|
|
2216
|
+
hasLedger(): boolean;
|
|
2126
2217
|
/**
|
|
2127
2218
|
* One serialized drain turn for strategies with a durable ledger. Like
|
|
2128
2219
|
* sync(), it never rejects: the keyword index is rebuildable, and a failed
|
|
2129
|
-
* drain leaves the ledger rows in place for the next turn.
|
|
2220
|
+
* drain leaves the ledger rows in place for the next turn. Resolves false
|
|
2221
|
+
* when the drain failed.
|
|
2130
2222
|
*/
|
|
2131
2223
|
private drainTurn;
|
|
2132
2224
|
/**
|
|
@@ -2136,8 +2228,17 @@ declare class SearchService {
|
|
|
2136
2228
|
* Rebuilds are serialized per instance and never reject: the keyword index
|
|
2137
2229
|
* is a rebuildable cache over SQLite, so degraded keyword search is the
|
|
2138
2230
|
* correct failure mode and killing the host process is not.
|
|
2231
|
+
*
|
|
2232
|
+
* With a ledger strategy, `sync()` runs one full quantum bounded by
|
|
2233
|
+
* `opts.deadline`; `sync(entityId)` is a write turn (ledger only).
|
|
2234
|
+
* `opts.ids` are the caller's touched ids: a ledger strategy drains them
|
|
2235
|
+
* first, to completion; MiniSearch ignores them and rebuilds the entity in
|
|
2236
|
+
* one scan.
|
|
2139
2237
|
*/
|
|
2140
|
-
sync(entityId?: string
|
|
2238
|
+
sync(entityId?: string, opts?: {
|
|
2239
|
+
deadline?: number;
|
|
2240
|
+
ids?: readonly string[];
|
|
2241
|
+
}): Promise<void>;
|
|
2141
2242
|
/**
|
|
2142
2243
|
* Re-indexes only `ids` for `entityId`: drops each from the index, then
|
|
2143
2244
|
* re-adds the ones still live in SQLite, so soft-deleted or missing ids end
|
|
@@ -2149,8 +2250,11 @@ declare class SearchService {
|
|
|
2149
2250
|
* — including on an empty `ids` list, which is a no-op only for an entity
|
|
2150
2251
|
* the index already tracks, and even then one that waits for rebuilds
|
|
2151
2252
|
* already queued on the chain.
|
|
2253
|
+
*
|
|
2254
|
+
* Resolves false only when a ledger drain failed: the caller's ids were not
|
|
2255
|
+
* applied (their ledger rows remain), so a caller holding them retries.
|
|
2152
2256
|
*/
|
|
2153
|
-
syncEntries(entityId: string, ids: Iterable<string>): Promise<
|
|
2257
|
+
syncEntries(entityId: string, ids: Iterable<string>): Promise<boolean>;
|
|
2154
2258
|
/**
|
|
2155
2259
|
* Forces the entity's next syncEntries to rebuild it in full. For writes core
|
|
2156
2260
|
* cannot index itself, such as upsertGraph inside a host transaction.
|
|
@@ -2161,8 +2265,11 @@ declare class SearchService {
|
|
|
2161
2265
|
* so only those entities are rebuilt. Each rebuild still takes its own turn
|
|
2162
2266
|
* on the sync chain, and like syncEntries this never rejects. With nothing
|
|
2163
2267
|
* stale it resolves at once, without waiting on work already on the chain.
|
|
2268
|
+
* Resolves false only when a ledger drain failed (see syncEntries).
|
|
2164
2269
|
*/
|
|
2165
|
-
syncStale(
|
|
2270
|
+
syncStale(opts?: {
|
|
2271
|
+
ids?: readonly string[];
|
|
2272
|
+
}): Promise<boolean>;
|
|
2166
2273
|
/**
|
|
2167
2274
|
* Clears the parsed vector cache. Useful for mid-loop flush guarantees
|
|
2168
2275
|
* or memory pressure evictions.
|
|
@@ -2754,7 +2861,8 @@ declare class IngestionService {
|
|
|
2754
2861
|
*
|
|
2755
2862
|
* @returns Counts: nodesWritten (validated nodes persisted), edgesWritten
|
|
2756
2863
|
* (manifest-valid edges persisted), superseded (prior facts soft-deleted
|
|
2757
|
-
* plus prior source-ref edges hard-deleted)
|
|
2864
|
+
* plus prior source-ref edges hard-deleted), and supersededFactIds (the
|
|
2865
|
+
* ids of those soft-deleted facts, for the caller's post-commit index sync).
|
|
2758
2866
|
*
|
|
2759
2867
|
* Node-ownership pre-flight (spec §3, REQ-GRAPH-01): the first statement
|
|
2760
2868
|
* is `assertGraphNodeOwnership(entityId, params.nodes, tx)`, which runs
|
|
@@ -2795,6 +2903,7 @@ declare class IngestionService {
|
|
|
2795
2903
|
nodesWritten: number;
|
|
2796
2904
|
edgesWritten: number;
|
|
2797
2905
|
superseded: number;
|
|
2906
|
+
supersededFactIds: string[];
|
|
2798
2907
|
}>;
|
|
2799
2908
|
/**
|
|
2800
2909
|
* Full supersession + ownership path: identical to the pre-issue-#92 behavior
|
|
@@ -3192,7 +3301,8 @@ declare class MaintenanceService {
|
|
|
3192
3301
|
*
|
|
3193
3302
|
* Bounded: at most `batchSize` candidates per pass (#67). Loop on
|
|
3194
3303
|
* `result.remaining > 0` for convergence — see {@link HealResult.remaining}
|
|
3195
|
-
* for what convergence means here
|
|
3304
|
+
* for what convergence means here, and for the no-progress flags
|
|
3305
|
+
* (`searchUnavailable`, `budgetStop`) a loop must also stop on.
|
|
3196
3306
|
*/
|
|
3197
3307
|
doRunHeal(entityId: string, options?: {
|
|
3198
3308
|
promptOverride?: string;
|
|
@@ -3368,6 +3478,7 @@ declare class WriteService {
|
|
|
3368
3478
|
* {@link write}) so a partial pass retries on the next write.
|
|
3369
3479
|
*/
|
|
3370
3480
|
private maybeRunHeal;
|
|
3481
|
+
private warnedSearchUnavailable;
|
|
3371
3482
|
private reportBackgroundFailure;
|
|
3372
3483
|
}
|
|
3373
3484
|
|
|
@@ -3457,7 +3568,52 @@ declare class WikiMemory {
|
|
|
3457
3568
|
* If `NODE_ENV` is not `"test"`, emits a single `console.warn` per instance (skipped when `process` is undefined).
|
|
3458
3569
|
*/
|
|
3459
3570
|
get __testAccess(): WikiMemoryTestAccess;
|
|
3460
|
-
|
|
3571
|
+
/** Max upsertGraph node ids held for their post-commit sync (spec #280 id threading). */
|
|
3572
|
+
static readonly UPSERT_ID_STASH_CAP = 10000;
|
|
3573
|
+
/**
|
|
3574
|
+
* upsertGraph node and superseded-fact ids per entity, awaiting syncSearchIndex(), each with the
|
|
3575
|
+
* generation of its latest stash. Ids leave the stash only once a drain
|
|
3576
|
+
* succeeded, so a failed drain retries them next call.
|
|
3577
|
+
*/
|
|
3578
|
+
private upsertIdStash;
|
|
3579
|
+
/** Total ids across upsertIdStash, kept in step so the cap check is O(1). */
|
|
3580
|
+
private upsertIdStashSize;
|
|
3581
|
+
/** Bumped per stashed id; a re-stash during an in-flight drain outlives that drain's drop. */
|
|
3582
|
+
private upsertIdStashGen;
|
|
3583
|
+
private stashUpsertIds;
|
|
3584
|
+
/** Snapshot of the stash (one entity, or all) with generations, without removing anything. */
|
|
3585
|
+
private peekStashedIds;
|
|
3586
|
+
/**
|
|
3587
|
+
* Removes a drained snapshot. An id re-stashed after the peek has a newer
|
|
3588
|
+
* generation and stays: the drain may have run before that write committed.
|
|
3589
|
+
*/
|
|
3590
|
+
private dropStashedIds;
|
|
3591
|
+
/** `config.setupBudgetMs` or the default, validated: a positive finite number. */
|
|
3592
|
+
private setupBudgetMs;
|
|
3593
|
+
private reinitSearch;
|
|
3594
|
+
/** Monotonic time before which a no-arg syncSearchIndex() skips the re-init (0 = no cooldown). */
|
|
3595
|
+
private reinitRetryAt;
|
|
3596
|
+
/** Consecutive failed re-inits; drives the exponential backoff. */
|
|
3597
|
+
private reinitFailures;
|
|
3598
|
+
/**
|
|
3599
|
+
* Opens the store: migration gate, DDL, schema migrations, then the stamped
|
|
3600
|
+
* source_ref normalize. Await it before any other call on this instance — the
|
|
3601
|
+
* normalize commits in chunks, so a sourceRef-keyed call (forget, upsertGraph,
|
|
3602
|
+
* hasChanged, ingest) issued before setup() resolves can see partially
|
|
3603
|
+
* normalized refs.
|
|
3604
|
+
*
|
|
3605
|
+
* Pass `{ migrations: 'refuse' }` from inside a writer lease: pending one-time
|
|
3606
|
+
* work then throws WikiMigrationRequiredError before any mutation, and the
|
|
3607
|
+
* host runs a plain `setup()` outside the lease.
|
|
3608
|
+
*
|
|
3609
|
+
* Keyword-index catch-up work is bounded by `config.setupBudgetMs`; anything
|
|
3610
|
+
* left converges on later opens and no-arg `syncSearchIndex()` calls. Not
|
|
3611
|
+
* bounded: an index reset (tokenizer change, re-attach after detach, a lost
|
|
3612
|
+
* or inconsistent index), which runs as one unchunked transaction.
|
|
3613
|
+
*/
|
|
3614
|
+
setup(opts?: {
|
|
3615
|
+
migrations?: MigrationPolicy;
|
|
3616
|
+
}): Promise<void>;
|
|
3461
3617
|
hasChanged(entityId: string, sourceRef: string, sourceHash: string): Promise<boolean>;
|
|
3462
3618
|
/**
|
|
3463
3619
|
* Batched overload.
|
|
@@ -3640,11 +3796,18 @@ declare class WikiMemory {
|
|
|
3640
3796
|
* commit, so without this the nodes stay out of keyword, hybrid and
|
|
3641
3797
|
* fallback retrieval until the entity's next core write.
|
|
3642
3798
|
*
|
|
3643
|
-
* With `entityId
|
|
3644
|
-
*
|
|
3645
|
-
*
|
|
3646
|
-
*
|
|
3647
|
-
*
|
|
3799
|
+
* With `entityId`: drains that entity's pending `upsertGraph` ids (its new
|
|
3800
|
+
* nodes and the facts they superseded) first, to completion, then at most
|
|
3801
|
+
* one more ledger chunk — so its new nodes are searchable, and the
|
|
3802
|
+
* superseded facts gone, when the call resolves, under any backlog. Without an
|
|
3803
|
+
* argument: drains every stashed `upsertGraph` id across entities first,
|
|
3804
|
+
* then runs one keyword-index quantum bounded by `config.setupBudgetMs`
|
|
3805
|
+
* (backlog drain, then rebuild work while the index is rebuilding). Hosts
|
|
3806
|
+
* with a long-lived process should call the no-arg form on their own
|
|
3807
|
+
* schedule: that is what converges a rebuilding index. While keyword search
|
|
3808
|
+
* is unavailable it first retries the index init; after a failed attempt it
|
|
3809
|
+
* waits at least 5 s, doubling per consecutive failure up to 5 min (longer
|
|
3810
|
+
* when an attempt is itself slow), before retrying again.
|
|
3648
3811
|
*
|
|
3649
3812
|
* Call only after the host's transaction commits: called inside it, the
|
|
3650
3813
|
* rebuild may index rows that later roll back, or miss them and clear the
|
|
@@ -3661,6 +3824,12 @@ declare class WikiMemory {
|
|
|
3661
3824
|
* @throws {TypeError} when `entityId` is given but is not a non-empty string.
|
|
3662
3825
|
*/
|
|
3663
3826
|
syncSearchIndex(entityId?: string): Promise<void>;
|
|
3827
|
+
/**
|
|
3828
|
+
* True when a sync applied the stashed ids. While keyword search is
|
|
3829
|
+
* unavailable the stand-in strategy's drain is a no-op that reports success,
|
|
3830
|
+
* so the ids stay stashed for the first sync after a re-init (#284 review).
|
|
3831
|
+
*/
|
|
3832
|
+
private syncDrained;
|
|
3664
3833
|
exportDump(entityIds?: string[]): Promise<MemoryDump>;
|
|
3665
3834
|
/** Entity summary prose persisted from an OKF profile ≥ 1 import; null when none stored. */
|
|
3666
3835
|
getEntitySummary(entityId: string): Promise<string | null>;
|
|
@@ -3726,7 +3895,10 @@ declare class WikiMemory {
|
|
|
3726
3895
|
* post-commit work (search sync, embedding, cache eviction). After the
|
|
3727
3896
|
* transaction commits, call `syncSearchIndex(entityId)` — or
|
|
3728
3897
|
* `syncSearchIndex()` after writing several entities in one transaction —
|
|
3729
|
-
* to make the new nodes keyword-searchable
|
|
3898
|
+
* to make the new nodes keyword-searchable: both forms drain this call's node ids
|
|
3899
|
+
* first, to completion, so the nodes are searchable under any backlog (up to
|
|
3900
|
+
* `WikiMemory.UPSERT_ID_STASH_CAP` pending ids; beyond that they converge with
|
|
3901
|
+
* the backlog). Embeddings still come from the maintenance
|
|
3730
3902
|
* sweep (`runLibrarian` / `runHeal` / `runOntologyBackfill` / `runPrune`,
|
|
3731
3903
|
* scoped via `listEntityIds`).
|
|
3732
3904
|
*
|
|
@@ -3887,4 +4059,4 @@ declare class WikiMemory {
|
|
|
3887
4059
|
setGeneratedByTask(taskId: string, entityId: string, actor: string): Promise<void>;
|
|
3888
4060
|
}
|
|
3889
4061
|
|
|
3890
|
-
export {
|
|
4062
|
+
export { PromptService as $, ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS as A, ONTOLOGY_BACKFILL_RECHECK_MS as B, type ChunkFailure as C, type DegradedRecord as D, type EmbedFactResult as E, type FormatContextOptions as F, type GraphNeighborhood as G, HEAL_BATCH_SIZE as H, type IngestDocumentResult as I, type OntologyBackfillResult as J, type OntologyConfig as K, type LLMProvider as L, type MemoryBundle as M, type OntologyEdgeType as N, ONTOLOGY_BACKFILL_BATCH_SIZE as O, type OntologyManifest as P, type OntologyMode as Q, type ReadOptions as R, type SQLiteAdapter as S, type OntologyNodeType as T, type OntologyPromptContext as U, type OntologyUpdates as V, type WikiOptions as W, type PendingMaintenance as X, type PendingMigrationWork as Y, type PendingSourceStatus as Z, type PromptOverrides as _, type MemoryDump as a, PrunePartialFailureError as a0, type ReembedResult as a1, type RunPendingMaintenanceOptions as a2, type RunPendingMaintenanceResult as a3, type SupersedeReplacement as a4, type VectorRanker as a5, type VectorRankerFallback as a6, type VectorRankerRankArgs as a7, type VectorRankerSemanticResult as a8, WikiBusyError as a9, WikiSupersedeError as aA, type WikiSupersedeReason as aB, type WikiTask as aC, WikiTransactionError as aD, isWikiSearchUnavailableError as aE, validateManifest as aF, EmbeddingService as aG, ImportExportService as aH, IngestionService as aI, JobManager as aJ, MaintenanceService as aK, RetrievalService as aL, SearchService as aM, WriteService as aN, type WikiBusyOperation as aa, type WikiCheckpoint as ab, type WikiConfig as ac, type WikiDiagnostic as ad, type WikiDiagnosticCode as ae, type WikiDiagnosticDetail as af, type WikiDiagnosticOperation as ag, type WikiDiagnosticSeverity as ah, type WikiDiagnosticTrigger as ai, WikiDraftNotFound as aj, WikiDuplicateHashError as ak, type WikiEdge as al, type WikiEvent as am, type WikiFact as an, WikiGraphNodeOwnershipConflict as ao, WikiIngestEmptyError as ap, type WikiInstructions as aq, WikiInvalidReadOptions as ar, type WikiLintReport as as, type WikiMemoryTestAccess as at, WikiMigrationRequiredError as au, type WikiOutboxEvent as av, WikiParseError as aw, WikiSearchUnavailableError as ax, WikiSourceRefHashCollision as ay, WikiStrictOntologyViolation as az, type FormattedMemoryDump as b, WikiMemory as c, type ClassifierAnswer as d, type ClassifierQuestion as e, type ClassifyRequest as f, type ClassifyResponse as g, type DraftPage as h, type EmbedFailureKind as i, type EmbeddingMarkerKind as j, type EntityMaintenanceReport as k, type EntityStatus as l, type ExtractedFact as m, type ExtractedFactEdge as n, type ExtractedFactWithOntology as o, type ExtractedTask as p, type GraphTraversalOptions as q, type GroundingConfig as r, HEAL_RECHECK_MS as s, HOOK_TIMEOUT_MARKER as t, type HealResult as u, type LibrarianConfig as v, type LibrarianGateConfig as w, type MaintenanceJob as x, type MaintenanceStopReason as y, type MigrationPolicy as z };
|