@equationalapplications/core-llm-wiki 4.2.0 → 4.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/dist/index.d.mts CHANGED
@@ -53,16 +53,17 @@ interface ReadOptions {
53
53
  preFilterLimit?: number | null;
54
54
  hybridWeight?: number;
55
55
  /**
56
- * (Reserved for Phase 2+ multi-entity weighted retrieval)
57
- * entity_id -> score multiplier. Missing entries default to 1.0.
58
- * Currently ignored by WikiMemory.read(); planned for implementation in Phase 2.
56
+ * Per-entity score multiplier for multi-entity reads. Missing entries default to 1.0.
57
+ * Entities with weight 0 are skipped during scored retrieval unless
58
+ * `includeZeroWeightEntities` is true; in that case they rank below all finite scores.
59
+ * Only meaningful when `entityId` is an array; ignored for single-string calls.
59
60
  */
60
61
  tierWeights?: Record<string, number>;
61
62
  /**
62
- * (Reserved for Phase 2+ multi-entity weighted retrieval)
63
- * false/default -> skip zero-weight entities during scored retrieval.
64
- * true -> retrieve zero-weight entities and let them fill only if the pool is small.
65
- * Currently ignored by WikiMemory.read(); planned for implementation in Phase 2.
63
+ * When true, entities with a tier weight of 0 are included in scored retrieval
64
+ * as bottom fillers (ranked below every finite-scored candidate).
65
+ * When false (default), zero-weight entities are skipped entirely.
66
+ * Only meaningful when `entityId` is an array; ignored for single-string calls.
66
67
  */
67
68
  includeZeroWeightEntities?: boolean;
68
69
  }
@@ -424,7 +425,12 @@ declare class WikiMemory {
424
425
  tasks: number;
425
426
  events: number;
426
427
  }>;
427
- read(entityId: string, query: string, options?: ReadOptions): Promise<MemoryBundle>;
428
+ read(entityId: string | string[], query: string, options?: ReadOptions): Promise<MemoryBundle>;
429
+ /**
430
+ * Returns entity IDs that will participate in scored retrieval.
431
+ * Excludes zero-weight entities unless includeZeroWeightEntities is true.
432
+ */
433
+ private _filterScoredEntities;
428
434
  /**
429
435
  * Stable tie-break sort: score desc → access_count desc → updated_at desc → id asc.
430
436
  */
@@ -434,6 +440,15 @@ declare class WikiMemory {
434
440
  * Negative return means "a ranks ahead of b" for descending score order.
435
441
  */
436
442
  private _compareScoredRows;
443
+ /**
444
+ * Build SQL IN clause with placeholders for multiple entity IDs.
445
+ */
446
+ private _entityInClause;
447
+ /**
448
+ * Hydrate full facts by ID. Pass scopedEntityIds to restrict to requested namespaces in SQL
449
+ * (defense-in-depth against a rogue VectorRanker returning cross-entity IDs).
450
+ */
451
+ private _hydrateFactsByIds;
437
452
  /**
438
453
  * Strip potentially sensitive data from ranker errors before exposing to host callbacks.
439
454
  * Preserves error type for debugging but removes message/stack that may contain credentials.
package/dist/index.d.ts CHANGED
@@ -53,16 +53,17 @@ interface ReadOptions {
53
53
  preFilterLimit?: number | null;
54
54
  hybridWeight?: number;
55
55
  /**
56
- * (Reserved for Phase 2+ multi-entity weighted retrieval)
57
- * entity_id -> score multiplier. Missing entries default to 1.0.
58
- * Currently ignored by WikiMemory.read(); planned for implementation in Phase 2.
56
+ * Per-entity score multiplier for multi-entity reads. Missing entries default to 1.0.
57
+ * Entities with weight 0 are skipped during scored retrieval unless
58
+ * `includeZeroWeightEntities` is true; in that case they rank below all finite scores.
59
+ * Only meaningful when `entityId` is an array; ignored for single-string calls.
59
60
  */
60
61
  tierWeights?: Record<string, number>;
61
62
  /**
62
- * (Reserved for Phase 2+ multi-entity weighted retrieval)
63
- * false/default -> skip zero-weight entities during scored retrieval.
64
- * true -> retrieve zero-weight entities and let them fill only if the pool is small.
65
- * Currently ignored by WikiMemory.read(); planned for implementation in Phase 2.
63
+ * When true, entities with a tier weight of 0 are included in scored retrieval
64
+ * as bottom fillers (ranked below every finite-scored candidate).
65
+ * When false (default), zero-weight entities are skipped entirely.
66
+ * Only meaningful when `entityId` is an array; ignored for single-string calls.
66
67
  */
67
68
  includeZeroWeightEntities?: boolean;
68
69
  }
@@ -424,7 +425,12 @@ declare class WikiMemory {
424
425
  tasks: number;
425
426
  events: number;
426
427
  }>;
427
- read(entityId: string, query: string, options?: ReadOptions): Promise<MemoryBundle>;
428
+ read(entityId: string | string[], query: string, options?: ReadOptions): Promise<MemoryBundle>;
429
+ /**
430
+ * Returns entity IDs that will participate in scored retrieval.
431
+ * Excludes zero-weight entities unless includeZeroWeightEntities is true.
432
+ */
433
+ private _filterScoredEntities;
428
434
  /**
429
435
  * Stable tie-break sort: score desc → access_count desc → updated_at desc → id asc.
430
436
  */
@@ -434,6 +440,15 @@ declare class WikiMemory {
434
440
  * Negative return means "a ranks ahead of b" for descending score order.
435
441
  */
436
442
  private _compareScoredRows;
443
+ /**
444
+ * Build SQL IN clause with placeholders for multiple entity IDs.
445
+ */
446
+ private _entityInClause;
447
+ /**
448
+ * Hydrate full facts by ID. Pass scopedEntityIds to restrict to requested namespaces in SQL
449
+ * (defense-in-depth against a rogue VectorRanker returning cross-entity IDs).
450
+ */
451
+ private _hydrateFactsByIds;
437
452
  /**
438
453
  * Strip potentially sensitive data from ranker errors before exposing to host callbacks.
439
454
  * Preserves error type for debugging but removes message/stack that may contain credentials.