@equationalapplications/core-llm-wiki 7.8.0 → 7.9.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.
@@ -2023,6 +2023,13 @@ declare class SearchService {
2023
2023
  * cannot index itself, such as upsertGraph inside a host transaction.
2024
2024
  */
2025
2025
  markStale(entityId: string): void;
2026
+ /**
2027
+ * Runs syncEntries(id, []) for each entity marked stale when this is called,
2028
+ * so only those entities are rebuilt. Each rebuild still takes its own turn
2029
+ * on the sync chain, and like syncEntries this never rejects. With nothing
2030
+ * stale it resolves at once, without waiting on work already on the chain.
2031
+ */
2032
+ syncStale(): Promise<void>;
2026
2033
  /**
2027
2034
  * Clears the parsed vector cache. Useful for mid-loop flush guarantees
2028
2035
  * or memory pressure evictions.
@@ -3486,6 +3493,28 @@ declare class WikiMemory {
3486
3493
  getEntityStatus(entityId: string): EntityStatus;
3487
3494
  subscribeEntityStatus(entityId: string, callback: (status: EntityStatus) => void): () => void;
3488
3495
  clearVectorCache(): void;
3496
+ /**
3497
+ * Brings the keyword search index up to date with SQLite after a host
3498
+ * transaction that used `upsertGraph` has committed. Core never sees that
3499
+ * commit, so without this the nodes stay out of keyword, hybrid and
3500
+ * fallback retrieval until the entity's next core write.
3501
+ *
3502
+ * With `entityId`, rebuilds that entity if it is stale or has never been
3503
+ * indexed; otherwise it is a no-op that still waits for rebuilds already
3504
+ * queued. Without an argument, rebuilds every entity currently marked
3505
+ * stale; when none is, it resolves immediately and does not wait for rebuilds
3506
+ * already queued.
3507
+ *
3508
+ * Call only after the host's transaction commits: called inside it, the
3509
+ * rebuild may index rows that later roll back, or miss them and clear the
3510
+ * stale flag anyway. Serialized with core's internal index syncs and takes
3511
+ * no maintenance lock. Never rejects for a valid `entityId` — on failure the
3512
+ * entity stays stale and the next call retries it. Does not compute
3513
+ * embeddings; that remains the maintenance sweep's job.
3514
+ *
3515
+ * @throws {TypeError} when `entityId` is given but is not a non-empty string.
3516
+ */
3517
+ syncSearchIndex(entityId?: string): Promise<void>;
3489
3518
  exportDump(entityIds?: string[]): Promise<MemoryDump>;
3490
3519
  /** Entity summary prose persisted from an OKF profile ≥ 1 import; null when none stored. */
3491
3520
  getEntitySummary(entityId: string): Promise<string | null>;
@@ -3548,9 +3577,11 @@ declare class WikiMemory {
3548
3577
  * MUST be called from inside an open `db.withTransactionAsync` callback —
3549
3578
  * the third argument is the caller's `tx`. The method does not open a
3550
3579
  * nested transaction, does not acquire any lock, and does not perform
3551
- * post-commit work (search sync, embedding, cache eviction). Hosts that
3552
- * want embeddings synced should drive the existing maintenance sweep
3553
- * (`runLibrarian` / `runHeal` / `runOntologyBackfill` / `runPrune`,
3580
+ * post-commit work (search sync, embedding, cache eviction). After the
3581
+ * transaction commits, call `syncSearchIndex(entityId)` — or
3582
+ * `syncSearchIndex()` after writing several entities in one transaction —
3583
+ * to make the new nodes keyword-searchable. Embeddings still come from the maintenance
3584
+ * sweep (`runLibrarian` / `runHeal` / `runOntologyBackfill` / `runPrune`,
3554
3585
  * scoped via `listEntityIds`).
3555
3586
  *
3556
3587
  * Contract (full pre-flight validation lives inside
@@ -2023,6 +2023,13 @@ declare class SearchService {
2023
2023
  * cannot index itself, such as upsertGraph inside a host transaction.
2024
2024
  */
2025
2025
  markStale(entityId: string): void;
2026
+ /**
2027
+ * Runs syncEntries(id, []) for each entity marked stale when this is called,
2028
+ * so only those entities are rebuilt. Each rebuild still takes its own turn
2029
+ * on the sync chain, and like syncEntries this never rejects. With nothing
2030
+ * stale it resolves at once, without waiting on work already on the chain.
2031
+ */
2032
+ syncStale(): Promise<void>;
2026
2033
  /**
2027
2034
  * Clears the parsed vector cache. Useful for mid-loop flush guarantees
2028
2035
  * or memory pressure evictions.
@@ -3486,6 +3493,28 @@ declare class WikiMemory {
3486
3493
  getEntityStatus(entityId: string): EntityStatus;
3487
3494
  subscribeEntityStatus(entityId: string, callback: (status: EntityStatus) => void): () => void;
3488
3495
  clearVectorCache(): void;
3496
+ /**
3497
+ * Brings the keyword search index up to date with SQLite after a host
3498
+ * transaction that used `upsertGraph` has committed. Core never sees that
3499
+ * commit, so without this the nodes stay out of keyword, hybrid and
3500
+ * fallback retrieval until the entity's next core write.
3501
+ *
3502
+ * With `entityId`, rebuilds that entity if it is stale or has never been
3503
+ * indexed; otherwise it is a no-op that still waits for rebuilds already
3504
+ * queued. Without an argument, rebuilds every entity currently marked
3505
+ * stale; when none is, it resolves immediately and does not wait for rebuilds
3506
+ * already queued.
3507
+ *
3508
+ * Call only after the host's transaction commits: called inside it, the
3509
+ * rebuild may index rows that later roll back, or miss them and clear the
3510
+ * stale flag anyway. Serialized with core's internal index syncs and takes
3511
+ * no maintenance lock. Never rejects for a valid `entityId` — on failure the
3512
+ * entity stays stale and the next call retries it. Does not compute
3513
+ * embeddings; that remains the maintenance sweep's job.
3514
+ *
3515
+ * @throws {TypeError} when `entityId` is given but is not a non-empty string.
3516
+ */
3517
+ syncSearchIndex(entityId?: string): Promise<void>;
3489
3518
  exportDump(entityIds?: string[]): Promise<MemoryDump>;
3490
3519
  /** Entity summary prose persisted from an OKF profile ≥ 1 import; null when none stored. */
3491
3520
  getEntitySummary(entityId: string): Promise<string | null>;
@@ -3548,9 +3577,11 @@ declare class WikiMemory {
3548
3577
  * MUST be called from inside an open `db.withTransactionAsync` callback —
3549
3578
  * the third argument is the caller's `tx`. The method does not open a
3550
3579
  * nested transaction, does not acquire any lock, and does not perform
3551
- * post-commit work (search sync, embedding, cache eviction). Hosts that
3552
- * want embeddings synced should drive the existing maintenance sweep
3553
- * (`runLibrarian` / `runHeal` / `runOntologyBackfill` / `runPrune`,
3580
+ * post-commit work (search sync, embedding, cache eviction). After the
3581
+ * transaction commits, call `syncSearchIndex(entityId)` — or
3582
+ * `syncSearchIndex()` after writing several entities in one transaction —
3583
+ * to make the new nodes keyword-searchable. Embeddings still come from the maintenance
3584
+ * sweep (`runLibrarian` / `runHeal` / `runOntologyBackfill` / `runPrune`,
3554
3585
  * scoped via `listEntityIds`).
3555
3586
  *
3556
3587
  * Contract (full pre-flight validation lives inside
@@ -1,3 +1,3 @@
1
- export { aB as EmbeddingService, aC as ImportExportService, aD as IngestionService, aE as JobManager, aE as JobManagerType, aF as MaintenanceService, aG as RetrievalService, aH as SearchService, aH as SearchServiceType, ar as WikiMemoryTestAccess, aI as WriteService } from './testing-CWZaXKLj.mjs';
1
+ export { aB as EmbeddingService, aC as ImportExportService, aD as IngestionService, aE as JobManager, aE as JobManagerType, aF as MaintenanceService, aG as RetrievalService, aH as SearchService, aH as SearchServiceType, ar as WikiMemoryTestAccess, aI as WriteService } from './testing-Kb1uVj1E.mjs';
2
2
  import '@equationalapplications/core-okf';
3
3
  import 'minisearch';
package/dist/testing.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { aB as EmbeddingService, aC as ImportExportService, aD as IngestionService, aE as JobManager, aE as JobManagerType, aF as MaintenanceService, aG as RetrievalService, aH as SearchService, aH as SearchServiceType, ar as WikiMemoryTestAccess, aI as WriteService } from './testing-CWZaXKLj.js';
1
+ export { aB as EmbeddingService, aC as ImportExportService, aD as IngestionService, aE as JobManager, aE as JobManagerType, aF as MaintenanceService, aG as RetrievalService, aH as SearchService, aH as SearchServiceType, ar as WikiMemoryTestAccess, aI as WriteService } from './testing-Kb1uVj1E.js';
2
2
  import '@equationalapplications/core-okf';
3
3
  import 'minisearch';
package/dist/testing.js CHANGED
@@ -5558,6 +5558,16 @@ var _SearchService = class _SearchService {
5558
5558
  this.staleEntities.add(entityId);
5559
5559
  this.staleEpochs.set(entityId, (this.staleEpochs.get(entityId) ?? 0) + 1);
5560
5560
  }
5561
+ /**
5562
+ * Runs syncEntries(id, []) for each entity marked stale when this is called,
5563
+ * so only those entities are rebuilt. Each rebuild still takes its own turn
5564
+ * on the sync chain, and like syncEntries this never rejects. With nothing
5565
+ * stale it resolves at once, without waiting on work already on the chain.
5566
+ */
5567
+ async syncStale() {
5568
+ const ids = [...this.staleEntities];
5569
+ await Promise.all(ids.map((id) => this.syncEntries(id, [])));
5570
+ }
5561
5571
  /**
5562
5572
  * Clears the parsed vector cache. Useful for mid-loop flush guarantees
5563
5573
  * or memory pressure evictions.