@equationalapplications/core-llm-wiki 4.1.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
@@ -52,6 +52,20 @@ interface ReadOptions {
52
52
  */
53
53
  preFilterLimit?: number | null;
54
54
  hybridWeight?: number;
55
+ /**
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.
60
+ */
61
+ tierWeights?: Record<string, number>;
62
+ /**
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.
67
+ */
68
+ includeZeroWeightEntities?: boolean;
55
69
  }
56
70
  interface WikiFact {
57
71
  id: string;
@@ -274,6 +288,12 @@ interface MemoryBundle {
274
288
  facts: WikiFact[];
275
289
  tasks: WikiTask[];
276
290
  events: WikiEvent[];
291
+ factScores?: Record<string, number>;
292
+ metadata?: {
293
+ query: string;
294
+ entityIds: string[];
295
+ tierWeights?: Record<string, number>;
296
+ };
277
297
  }
278
298
  interface MemoryDump {
279
299
  generatedAt: number;
@@ -405,7 +425,12 @@ declare class WikiMemory {
405
425
  tasks: number;
406
426
  events: number;
407
427
  }>;
408
- 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;
409
434
  /**
410
435
  * Stable tie-break sort: score desc → access_count desc → updated_at desc → id asc.
411
436
  */
@@ -415,6 +440,15 @@ declare class WikiMemory {
415
440
  * Negative return means "a ranks ahead of b" for descending score order.
416
441
  */
417
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;
418
452
  /**
419
453
  * Strip potentially sensitive data from ranker errors before exposing to host callbacks.
420
454
  * Preserves error type for debugging but removes message/stack that may contain credentials.
package/dist/index.d.ts CHANGED
@@ -52,6 +52,20 @@ interface ReadOptions {
52
52
  */
53
53
  preFilterLimit?: number | null;
54
54
  hybridWeight?: number;
55
+ /**
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.
60
+ */
61
+ tierWeights?: Record<string, number>;
62
+ /**
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.
67
+ */
68
+ includeZeroWeightEntities?: boolean;
55
69
  }
56
70
  interface WikiFact {
57
71
  id: string;
@@ -274,6 +288,12 @@ interface MemoryBundle {
274
288
  facts: WikiFact[];
275
289
  tasks: WikiTask[];
276
290
  events: WikiEvent[];
291
+ factScores?: Record<string, number>;
292
+ metadata?: {
293
+ query: string;
294
+ entityIds: string[];
295
+ tierWeights?: Record<string, number>;
296
+ };
277
297
  }
278
298
  interface MemoryDump {
279
299
  generatedAt: number;
@@ -405,7 +425,12 @@ declare class WikiMemory {
405
425
  tasks: number;
406
426
  events: number;
407
427
  }>;
408
- 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;
409
434
  /**
410
435
  * Stable tie-break sort: score desc → access_count desc → updated_at desc → id asc.
411
436
  */
@@ -415,6 +440,15 @@ declare class WikiMemory {
415
440
  * Negative return means "a ranks ahead of b" for descending score order.
416
441
  */
417
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;
418
452
  /**
419
453
  * Strip potentially sensitive data from ranker errors before exposing to host callbacks.
420
454
  * Preserves error type for debugging but removes message/stack that may contain credentials.