@anuma/sdk 1.1.3 → 1.1.4

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.
@@ -3969,6 +3969,7 @@ function rankVaultMemories(_query, queryEmbedding, items, options) {
3969
3969
  updatedAt: item.updatedAt,
3970
3970
  createdAt: item.createdAt,
3971
3971
  eventTimeStart: item.eventTimeStart,
3972
+ sourceChunkIds: item.sourceChunkIds,
3972
3973
  eventTimeEnd: item.eventTimeEnd,
3973
3974
  eventTimeKind: item.eventTimeKind,
3974
3975
  similarity: cosineSimilarity(queryEmbedding, item.embedding)
@@ -4010,7 +4011,8 @@ function rankVaultMemories(_query, queryEmbedding, items, options) {
4010
4011
  content: r.content,
4011
4012
  similarity: r.similarity,
4012
4013
  createdAt: item?.createdAt ?? item?.updatedAt,
4013
- updatedAt: item?.updatedAt
4014
+ updatedAt: item?.updatedAt,
4015
+ sourceChunkIds: item?.sourceChunkIds
4014
4016
  };
4015
4017
  });
4016
4018
  }
@@ -4049,6 +4051,7 @@ function rankFusedVaultMemories(query, queryEmbedding, items, options) {
4049
4051
  createdAt: item.createdAt ?? item.updatedAt,
4050
4052
  updatedAt: item.updatedAt,
4051
4053
  eventTimeStart: item.eventTimeStart,
4054
+ sourceChunkIds: item.sourceChunkIds,
4052
4055
  eventTimeEnd: item.eventTimeEnd,
4053
4056
  eventTimeKind: item.eventTimeKind
4054
4057
  });
@@ -4091,7 +4094,8 @@ function rankFusedVaultMemories(query, queryEmbedding, items, options) {
4091
4094
  content: it.content,
4092
4095
  similarity: (fused.get(id) ?? 0) * boostFor(id),
4093
4096
  createdAt: it.createdAt ?? it.updatedAt,
4094
- updatedAt: it.updatedAt
4097
+ updatedAt: it.updatedAt,
4098
+ sourceChunkIds: it.sourceChunkIds
4095
4099
  });
4096
4100
  seen.add(id);
4097
4101
  }
@@ -4129,13 +4133,7 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
4129
4133
  combined = headSlice.map((r) => {
4130
4134
  const v2 = v2ScoreById.get(r.uniqueId) ?? 0;
4131
4135
  const ce = ceScoreById.get(r.uniqueId) ?? 0;
4132
- return {
4133
- uniqueId: r.uniqueId,
4134
- content: r.content,
4135
- similarity: v2 * (1 + ceWeight * ce),
4136
- createdAt: r.createdAt,
4137
- updatedAt: r.updatedAt
4138
- };
4136
+ return { ...r, similarity: v2 * (1 + ceWeight * ce) };
4139
4137
  });
4140
4138
  combined.sort((a, b) => b.similarity - a.similarity);
4141
4139
  } catch (err) {
@@ -4168,7 +4166,8 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
4168
4166
  content: it.content,
4169
4167
  similarity: fused.get(id) ?? 0,
4170
4168
  createdAt: it.createdAt ?? it.updatedAt,
4171
- updatedAt: it.updatedAt
4169
+ updatedAt: it.updatedAt,
4170
+ sourceChunkIds: it.sourceChunkIds
4172
4171
  });
4173
4172
  seen.add(id);
4174
4173
  }
@@ -4198,6 +4197,7 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
4198
4197
  createdAt: orig?.createdAt,
4199
4198
  updatedAt: orig?.updatedAt,
4200
4199
  eventTimeStart: orig?.eventTimeStart,
4200
+ sourceChunkIds: orig?.sourceChunkIds,
4201
4201
  eventTimeEnd: orig?.eventTimeEnd,
4202
4202
  eventTimeKind: orig?.eventTimeKind
4203
4203
  };
@@ -4261,6 +4261,7 @@ async function rankComposite(originalQuery, originalQueryEmbedding, subQueries,
4261
4261
  createdAt: item.createdAt ?? item.updatedAt,
4262
4262
  updatedAt: item.updatedAt,
4263
4263
  eventTimeStart: item.eventTimeStart,
4264
+ sourceChunkIds: item.sourceChunkIds,
4264
4265
  eventTimeEnd: item.eventTimeEnd,
4265
4266
  eventTimeKind: item.eventTimeKind
4266
4267
  };
@@ -4281,6 +4282,7 @@ async function rankComposite(originalQuery, originalQueryEmbedding, subQueries,
4281
4282
  createdAt: item.createdAt ?? item.updatedAt,
4282
4283
  updatedAt: item.updatedAt,
4283
4284
  eventTimeStart: item.eventTimeStart,
4285
+ sourceChunkIds: item.sourceChunkIds,
4284
4286
  eventTimeEnd: item.eventTimeEnd,
4285
4287
  eventTimeKind: item.eventTimeKind
4286
4288
  });
@@ -4332,6 +4334,7 @@ async function rankComposite(originalQuery, originalQueryEmbedding, subQueries,
4332
4334
  createdAt: orig?.createdAt,
4333
4335
  updatedAt: orig?.updatedAt,
4334
4336
  eventTimeStart: orig?.eventTimeStart,
4337
+ sourceChunkIds: orig?.sourceChunkIds,
4335
4338
  eventTimeEnd: orig?.eventTimeEnd,
4336
4339
  eventTimeKind: orig?.eventTimeKind
4337
4340
  };
@@ -4473,6 +4476,7 @@ async function searchVaultMemoriesWithSize(query, vaultCtx, embeddingOptions, ca
4473
4476
  updatedAt: m.updatedAt,
4474
4477
  proofCount: m.proofCount,
4475
4478
  eventTimeStart: m.eventTimeStart,
4479
+ sourceChunkIds: m.sourceChunkIds,
4476
4480
  eventTimeEnd: m.eventTimeEnd,
4477
4481
  eventTimeKind: normalizeEventTimeKind(m.eventTimeKind)
4478
4482
  }));
@@ -4663,7 +4667,7 @@ function createMemoryVaultSearchTool(vaultCtx, embeddingOptions, cache, searchOp
4663
4667
  legacy.map((r) => ({ id: r.uniqueId, content: r.content, score: r.similarity }))
4664
4668
  );
4665
4669
  }
4666
- const { recall: recall2 } = await import("./recall-GJ6RNZMF.mjs");
4670
+ const { recall: recall2 } = await import("./recall-U6SVHL5Q.mjs");
4667
4671
  const result = await recall2(
4668
4672
  query,
4669
4673
  { vaultCtx, embeddingOptions, vaultCache: cache },
@@ -5131,7 +5135,31 @@ async function recall(query, ctx, options = {}) {
5131
5135
  m.scoreBreakdown.fused = r.similarity;
5132
5136
  byId.set(key, m);
5133
5137
  }
5134
- const memories = [...byId.values()].sort((a, b) => b.score - a.score).slice(0, limit);
5138
+ const ordered = [...byId.values()].sort((a, b) => b.score - a.score);
5139
+ const selectWith = (suppressed2) => {
5140
+ const out = [];
5141
+ for (const m of ordered) {
5142
+ if (out.length >= limit) break;
5143
+ if (m.kind === "chunk" && m.messageId && suppressed2.has(m.messageId)) continue;
5144
+ out.push(m);
5145
+ }
5146
+ return out;
5147
+ };
5148
+ const provenanceOf = (selected) => {
5149
+ const s = /* @__PURE__ */ new Set();
5150
+ for (const m of selected) {
5151
+ if (m.kind === "fact" && m.sourceChunkIds) for (const id of m.sourceChunkIds) s.add(id);
5152
+ }
5153
+ return s;
5154
+ };
5155
+ let suppressed = /* @__PURE__ */ new Set();
5156
+ let memories = selectWith(suppressed);
5157
+ for (let i = 0; i < ordered.length; i++) {
5158
+ const next = provenanceOf(memories);
5159
+ if (next.size === suppressed.size && [...next].every((id) => suppressed.has(id))) break;
5160
+ suppressed = next;
5161
+ memories = selectWith(suppressed);
5162
+ }
5135
5163
  return {
5136
5164
  memories,
5137
5165
  usedBudget,
@@ -5152,6 +5180,7 @@ function toFactMemory(r) {
5152
5180
  ...r.eventTimeStart !== void 0 && { eventTimeStart: r.eventTimeStart },
5153
5181
  ...r.eventTimeEnd !== void 0 && { eventTimeEnd: r.eventTimeEnd },
5154
5182
  ...r.eventTimeKind !== void 0 && { eventTimeKind: r.eventTimeKind },
5183
+ ...r.sourceChunkIds !== void 0 && r.sourceChunkIds !== null && { sourceChunkIds: r.sourceChunkIds },
5155
5184
  // r.similarity from searchVaultMemoriesWithSize is the fused score
5156
5185
  // (cosine + BM25 + RRF + recency + proof) when useFusion=true (the
5157
5186
  // default) and pure cosine when useFusion=false. The breakdown
@@ -5546,7 +5546,31 @@ async function recall(query, ctx, options = {}) {
5546
5546
  m.scoreBreakdown.fused = r.similarity;
5547
5547
  byId.set(key, m);
5548
5548
  }
5549
- const memories = [...byId.values()].sort((a, b) => b.score - a.score).slice(0, limit);
5549
+ const ordered = [...byId.values()].sort((a, b) => b.score - a.score);
5550
+ const selectWith = (suppressed2) => {
5551
+ const out = [];
5552
+ for (const m of ordered) {
5553
+ if (out.length >= limit) break;
5554
+ if (m.kind === "chunk" && m.messageId && suppressed2.has(m.messageId)) continue;
5555
+ out.push(m);
5556
+ }
5557
+ return out;
5558
+ };
5559
+ const provenanceOf = (selected) => {
5560
+ const s = /* @__PURE__ */ new Set();
5561
+ for (const m of selected) {
5562
+ if (m.kind === "fact" && m.sourceChunkIds) for (const id of m.sourceChunkIds) s.add(id);
5563
+ }
5564
+ return s;
5565
+ };
5566
+ let suppressed = /* @__PURE__ */ new Set();
5567
+ let memories = selectWith(suppressed);
5568
+ for (let i = 0; i < ordered.length; i++) {
5569
+ const next = provenanceOf(memories);
5570
+ if (next.size === suppressed.size && [...next].every((id) => suppressed.has(id))) break;
5571
+ suppressed = next;
5572
+ memories = selectWith(suppressed);
5573
+ }
5550
5574
  return {
5551
5575
  memories,
5552
5576
  usedBudget,
@@ -5567,6 +5591,7 @@ function toFactMemory(r) {
5567
5591
  ...r.eventTimeStart !== void 0 && { eventTimeStart: r.eventTimeStart },
5568
5592
  ...r.eventTimeEnd !== void 0 && { eventTimeEnd: r.eventTimeEnd },
5569
5593
  ...r.eventTimeKind !== void 0 && { eventTimeKind: r.eventTimeKind },
5594
+ ...r.sourceChunkIds !== void 0 && r.sourceChunkIds !== null && { sourceChunkIds: r.sourceChunkIds },
5570
5595
  // r.similarity from searchVaultMemoriesWithSize is the fused score
5571
5596
  // (cosine + BM25 + RRF + recency + proof) when useFusion=true (the
5572
5597
  // default) and pure cosine when useFusion=false. The breakdown
@@ -5681,6 +5706,7 @@ function rankVaultMemories(_query, queryEmbedding, items, options) {
5681
5706
  updatedAt: item.updatedAt,
5682
5707
  createdAt: item.createdAt,
5683
5708
  eventTimeStart: item.eventTimeStart,
5709
+ sourceChunkIds: item.sourceChunkIds,
5684
5710
  eventTimeEnd: item.eventTimeEnd,
5685
5711
  eventTimeKind: item.eventTimeKind,
5686
5712
  similarity: cosineSimilarity(queryEmbedding, item.embedding)
@@ -5722,7 +5748,8 @@ function rankVaultMemories(_query, queryEmbedding, items, options) {
5722
5748
  content: r.content,
5723
5749
  similarity: r.similarity,
5724
5750
  createdAt: item?.createdAt ?? item?.updatedAt,
5725
- updatedAt: item?.updatedAt
5751
+ updatedAt: item?.updatedAt,
5752
+ sourceChunkIds: item?.sourceChunkIds
5726
5753
  };
5727
5754
  });
5728
5755
  }
@@ -5761,6 +5788,7 @@ function rankFusedVaultMemories(query, queryEmbedding, items, options) {
5761
5788
  createdAt: item.createdAt ?? item.updatedAt,
5762
5789
  updatedAt: item.updatedAt,
5763
5790
  eventTimeStart: item.eventTimeStart,
5791
+ sourceChunkIds: item.sourceChunkIds,
5764
5792
  eventTimeEnd: item.eventTimeEnd,
5765
5793
  eventTimeKind: item.eventTimeKind
5766
5794
  });
@@ -5803,7 +5831,8 @@ function rankFusedVaultMemories(query, queryEmbedding, items, options) {
5803
5831
  content: it.content,
5804
5832
  similarity: (fused.get(id) ?? 0) * boostFor(id),
5805
5833
  createdAt: it.createdAt ?? it.updatedAt,
5806
- updatedAt: it.updatedAt
5834
+ updatedAt: it.updatedAt,
5835
+ sourceChunkIds: it.sourceChunkIds
5807
5836
  });
5808
5837
  seen.add(id);
5809
5838
  }
@@ -5841,13 +5870,7 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
5841
5870
  combined = headSlice.map((r) => {
5842
5871
  const v2 = v2ScoreById.get(r.uniqueId) ?? 0;
5843
5872
  const ce = ceScoreById.get(r.uniqueId) ?? 0;
5844
- return {
5845
- uniqueId: r.uniqueId,
5846
- content: r.content,
5847
- similarity: v2 * (1 + ceWeight * ce),
5848
- createdAt: r.createdAt,
5849
- updatedAt: r.updatedAt
5850
- };
5873
+ return { ...r, similarity: v2 * (1 + ceWeight * ce) };
5851
5874
  });
5852
5875
  combined.sort((a, b) => b.similarity - a.similarity);
5853
5876
  } catch (err) {
@@ -5880,7 +5903,8 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
5880
5903
  content: it.content,
5881
5904
  similarity: fused.get(id) ?? 0,
5882
5905
  createdAt: it.createdAt ?? it.updatedAt,
5883
- updatedAt: it.updatedAt
5906
+ updatedAt: it.updatedAt,
5907
+ sourceChunkIds: it.sourceChunkIds
5884
5908
  });
5885
5909
  seen.add(id);
5886
5910
  }
@@ -5910,6 +5934,7 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
5910
5934
  createdAt: orig?.createdAt,
5911
5935
  updatedAt: orig?.updatedAt,
5912
5936
  eventTimeStart: orig?.eventTimeStart,
5937
+ sourceChunkIds: orig?.sourceChunkIds,
5913
5938
  eventTimeEnd: orig?.eventTimeEnd,
5914
5939
  eventTimeKind: orig?.eventTimeKind
5915
5940
  };
@@ -5973,6 +5998,7 @@ async function rankComposite(originalQuery, originalQueryEmbedding, subQueries,
5973
5998
  createdAt: item.createdAt ?? item.updatedAt,
5974
5999
  updatedAt: item.updatedAt,
5975
6000
  eventTimeStart: item.eventTimeStart,
6001
+ sourceChunkIds: item.sourceChunkIds,
5976
6002
  eventTimeEnd: item.eventTimeEnd,
5977
6003
  eventTimeKind: item.eventTimeKind
5978
6004
  };
@@ -5993,6 +6019,7 @@ async function rankComposite(originalQuery, originalQueryEmbedding, subQueries,
5993
6019
  createdAt: item.createdAt ?? item.updatedAt,
5994
6020
  updatedAt: item.updatedAt,
5995
6021
  eventTimeStart: item.eventTimeStart,
6022
+ sourceChunkIds: item.sourceChunkIds,
5996
6023
  eventTimeEnd: item.eventTimeEnd,
5997
6024
  eventTimeKind: item.eventTimeKind
5998
6025
  });
@@ -6044,6 +6071,7 @@ async function rankComposite(originalQuery, originalQueryEmbedding, subQueries,
6044
6071
  createdAt: orig?.createdAt,
6045
6072
  updatedAt: orig?.updatedAt,
6046
6073
  eventTimeStart: orig?.eventTimeStart,
6074
+ sourceChunkIds: orig?.sourceChunkIds,
6047
6075
  eventTimeEnd: orig?.eventTimeEnd,
6048
6076
  eventTimeKind: orig?.eventTimeKind
6049
6077
  };
@@ -6185,6 +6213,7 @@ async function searchVaultMemoriesWithSize(query, vaultCtx, embeddingOptions, ca
6185
6213
  updatedAt: m.updatedAt,
6186
6214
  proofCount: m.proofCount,
6187
6215
  eventTimeStart: m.eventTimeStart,
6216
+ sourceChunkIds: m.sourceChunkIds,
6188
6217
  eventTimeEnd: m.eventTimeEnd,
6189
6218
  eventTimeKind: normalizeEventTimeKind(m.eventTimeKind)
6190
6219
  }));
@@ -4848,6 +4848,9 @@ interface VaultSearchResult {
4848
4848
  eventTimeStart?: number | null;
4849
4849
  eventTimeEnd?: number | null;
4850
4850
  eventTimeKind?: "point" | "range" | "ongoing" | null;
4851
+ /** Message ids this fact was extracted from (provenance). recall() uses
4852
+ * these to suppress the originating chunk in the chunk lane. */
4853
+ sourceChunkIds?: string[] | null;
4851
4854
  }
4852
4855
  /**
4853
4856
  * Search vault memories by semantic similarity. Returns structured results
@@ -4848,6 +4848,9 @@ interface VaultSearchResult {
4848
4848
  eventTimeStart?: number | null;
4849
4849
  eventTimeEnd?: number | null;
4850
4850
  eventTimeKind?: "point" | "range" | "ongoing" | null;
4851
+ /** Message ids this fact was extracted from (provenance). recall() uses
4852
+ * these to suppress the originating chunk in the chunk lane. */
4853
+ sourceChunkIds?: string[] | null;
4851
4854
  }
4852
4855
  /**
4853
4856
  * Search vault memories by semantic similarity. Returns structured results
@@ -79,7 +79,7 @@ import {
79
79
  updateVaultMemoryOp,
80
80
  upsertMessageOp,
81
81
  useEncryption
82
- } from "./chunk-3RXNQBS3.mjs";
82
+ } from "./chunk-RYLI53HN.mjs";
83
83
  import {
84
84
  PII_PATTERNS,
85
85
  PiiRedactor,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  recall
3
- } from "./chunk-3RXNQBS3.mjs";
3
+ } from "./chunk-RYLI53HN.mjs";
4
4
  import "./chunk-DFVCS3QQ.mjs";
5
5
  import "./chunk-GYKJOWEO.mjs";
6
6
  export {
@@ -4300,6 +4300,7 @@ function rankVaultMemories(_query, queryEmbedding, items, options) {
4300
4300
  updatedAt: item.updatedAt,
4301
4301
  createdAt: item.createdAt,
4302
4302
  eventTimeStart: item.eventTimeStart,
4303
+ sourceChunkIds: item.sourceChunkIds,
4303
4304
  eventTimeEnd: item.eventTimeEnd,
4304
4305
  eventTimeKind: item.eventTimeKind,
4305
4306
  similarity: cosineSimilarity(queryEmbedding, item.embedding)
@@ -4341,7 +4342,8 @@ function rankVaultMemories(_query, queryEmbedding, items, options) {
4341
4342
  content: r.content,
4342
4343
  similarity: r.similarity,
4343
4344
  createdAt: item?.createdAt ?? item?.updatedAt,
4344
- updatedAt: item?.updatedAt
4345
+ updatedAt: item?.updatedAt,
4346
+ sourceChunkIds: item?.sourceChunkIds
4345
4347
  };
4346
4348
  });
4347
4349
  }
@@ -4380,6 +4382,7 @@ function rankFusedVaultMemories(query, queryEmbedding, items, options) {
4380
4382
  createdAt: item.createdAt ?? item.updatedAt,
4381
4383
  updatedAt: item.updatedAt,
4382
4384
  eventTimeStart: item.eventTimeStart,
4385
+ sourceChunkIds: item.sourceChunkIds,
4383
4386
  eventTimeEnd: item.eventTimeEnd,
4384
4387
  eventTimeKind: item.eventTimeKind
4385
4388
  });
@@ -4422,7 +4425,8 @@ function rankFusedVaultMemories(query, queryEmbedding, items, options) {
4422
4425
  content: it.content,
4423
4426
  similarity: (fused.get(id) ?? 0) * boostFor(id),
4424
4427
  createdAt: it.createdAt ?? it.updatedAt,
4425
- updatedAt: it.updatedAt
4428
+ updatedAt: it.updatedAt,
4429
+ sourceChunkIds: it.sourceChunkIds
4426
4430
  });
4427
4431
  seen.add(id);
4428
4432
  }
@@ -4460,13 +4464,7 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
4460
4464
  combined = headSlice.map((r) => {
4461
4465
  const v2 = v2ScoreById.get(r.uniqueId) ?? 0;
4462
4466
  const ce = ceScoreById.get(r.uniqueId) ?? 0;
4463
- return {
4464
- uniqueId: r.uniqueId,
4465
- content: r.content,
4466
- similarity: v2 * (1 + ceWeight * ce),
4467
- createdAt: r.createdAt,
4468
- updatedAt: r.updatedAt
4469
- };
4467
+ return { ...r, similarity: v2 * (1 + ceWeight * ce) };
4470
4468
  });
4471
4469
  combined.sort((a, b) => b.similarity - a.similarity);
4472
4470
  } catch (err) {
@@ -4499,7 +4497,8 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
4499
4497
  content: it.content,
4500
4498
  similarity: fused.get(id) ?? 0,
4501
4499
  createdAt: it.createdAt ?? it.updatedAt,
4502
- updatedAt: it.updatedAt
4500
+ updatedAt: it.updatedAt,
4501
+ sourceChunkIds: it.sourceChunkIds
4503
4502
  });
4504
4503
  seen.add(id);
4505
4504
  }
@@ -4529,6 +4528,7 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
4529
4528
  createdAt: orig?.createdAt,
4530
4529
  updatedAt: orig?.updatedAt,
4531
4530
  eventTimeStart: orig?.eventTimeStart,
4531
+ sourceChunkIds: orig?.sourceChunkIds,
4532
4532
  eventTimeEnd: orig?.eventTimeEnd,
4533
4533
  eventTimeKind: orig?.eventTimeKind
4534
4534
  };
@@ -4592,6 +4592,7 @@ async function rankComposite(originalQuery, originalQueryEmbedding, subQueries,
4592
4592
  createdAt: item.createdAt ?? item.updatedAt,
4593
4593
  updatedAt: item.updatedAt,
4594
4594
  eventTimeStart: item.eventTimeStart,
4595
+ sourceChunkIds: item.sourceChunkIds,
4595
4596
  eventTimeEnd: item.eventTimeEnd,
4596
4597
  eventTimeKind: item.eventTimeKind
4597
4598
  };
@@ -4612,6 +4613,7 @@ async function rankComposite(originalQuery, originalQueryEmbedding, subQueries,
4612
4613
  createdAt: item.createdAt ?? item.updatedAt,
4613
4614
  updatedAt: item.updatedAt,
4614
4615
  eventTimeStart: item.eventTimeStart,
4616
+ sourceChunkIds: item.sourceChunkIds,
4615
4617
  eventTimeEnd: item.eventTimeEnd,
4616
4618
  eventTimeKind: item.eventTimeKind
4617
4619
  });
@@ -4663,6 +4665,7 @@ async function rankComposite(originalQuery, originalQueryEmbedding, subQueries,
4663
4665
  createdAt: orig?.createdAt,
4664
4666
  updatedAt: orig?.updatedAt,
4665
4667
  eventTimeStart: orig?.eventTimeStart,
4668
+ sourceChunkIds: orig?.sourceChunkIds,
4666
4669
  eventTimeEnd: orig?.eventTimeEnd,
4667
4670
  eventTimeKind: orig?.eventTimeKind
4668
4671
  };
@@ -4804,6 +4807,7 @@ async function searchVaultMemoriesWithSize(query, vaultCtx, embeddingOptions, ca
4804
4807
  updatedAt: m.updatedAt,
4805
4808
  proofCount: m.proofCount,
4806
4809
  eventTimeStart: m.eventTimeStart,
4810
+ sourceChunkIds: m.sourceChunkIds,
4807
4811
  eventTimeEnd: m.eventTimeEnd,
4808
4812
  eventTimeKind: normalizeEventTimeKind(m.eventTimeKind)
4809
4813
  }));
@@ -4994,7 +4998,7 @@ function createMemoryVaultSearchTool(vaultCtx, embeddingOptions, cache, searchOp
4994
4998
  legacy.map((r) => ({ id: r.uniqueId, content: r.content, score: r.similarity }))
4995
4999
  );
4996
5000
  }
4997
- const { recall: recall2 } = await import("./recall-NQ6ANFYN.mjs");
5001
+ const { recall: recall2 } = await import("./recall-6AQ4WFJO.mjs");
4998
5002
  const result = await recall2(
4999
5003
  query,
5000
5004
  { vaultCtx, embeddingOptions, vaultCache: cache },
@@ -5462,7 +5466,31 @@ async function recall(query, ctx, options = {}) {
5462
5466
  m.scoreBreakdown.fused = r.similarity;
5463
5467
  byId.set(key, m);
5464
5468
  }
5465
- const memories = [...byId.values()].sort((a, b) => b.score - a.score).slice(0, limit);
5469
+ const ordered = [...byId.values()].sort((a, b) => b.score - a.score);
5470
+ const selectWith = (suppressed2) => {
5471
+ const out = [];
5472
+ for (const m of ordered) {
5473
+ if (out.length >= limit) break;
5474
+ if (m.kind === "chunk" && m.messageId && suppressed2.has(m.messageId)) continue;
5475
+ out.push(m);
5476
+ }
5477
+ return out;
5478
+ };
5479
+ const provenanceOf = (selected) => {
5480
+ const s = /* @__PURE__ */ new Set();
5481
+ for (const m of selected) {
5482
+ if (m.kind === "fact" && m.sourceChunkIds) for (const id of m.sourceChunkIds) s.add(id);
5483
+ }
5484
+ return s;
5485
+ };
5486
+ let suppressed = /* @__PURE__ */ new Set();
5487
+ let memories = selectWith(suppressed);
5488
+ for (let i = 0; i < ordered.length; i++) {
5489
+ const next = provenanceOf(memories);
5490
+ if (next.size === suppressed.size && [...next].every((id) => suppressed.has(id))) break;
5491
+ suppressed = next;
5492
+ memories = selectWith(suppressed);
5493
+ }
5466
5494
  return {
5467
5495
  memories,
5468
5496
  usedBudget,
@@ -5483,6 +5511,7 @@ function toFactMemory(r) {
5483
5511
  ...r.eventTimeStart !== void 0 && { eventTimeStart: r.eventTimeStart },
5484
5512
  ...r.eventTimeEnd !== void 0 && { eventTimeEnd: r.eventTimeEnd },
5485
5513
  ...r.eventTimeKind !== void 0 && { eventTimeKind: r.eventTimeKind },
5514
+ ...r.sourceChunkIds !== void 0 && r.sourceChunkIds !== null && { sourceChunkIds: r.sourceChunkIds },
5486
5515
  // r.similarity from searchVaultMemoriesWithSize is the fused score
5487
5516
  // (cosine + BM25 + RRF + recency + proof) when useFusion=true (the
5488
5517
  // default) and pure cosine when useFusion=false. The breakdown
@@ -5877,7 +5877,31 @@ async function recall(query, ctx, options = {}) {
5877
5877
  m.scoreBreakdown.fused = r.similarity;
5878
5878
  byId.set(key, m);
5879
5879
  }
5880
- const memories = [...byId.values()].sort((a, b) => b.score - a.score).slice(0, limit);
5880
+ const ordered = [...byId.values()].sort((a, b) => b.score - a.score);
5881
+ const selectWith = (suppressed2) => {
5882
+ const out = [];
5883
+ for (const m of ordered) {
5884
+ if (out.length >= limit) break;
5885
+ if (m.kind === "chunk" && m.messageId && suppressed2.has(m.messageId)) continue;
5886
+ out.push(m);
5887
+ }
5888
+ return out;
5889
+ };
5890
+ const provenanceOf = (selected) => {
5891
+ const s = /* @__PURE__ */ new Set();
5892
+ for (const m of selected) {
5893
+ if (m.kind === "fact" && m.sourceChunkIds) for (const id of m.sourceChunkIds) s.add(id);
5894
+ }
5895
+ return s;
5896
+ };
5897
+ let suppressed = /* @__PURE__ */ new Set();
5898
+ let memories = selectWith(suppressed);
5899
+ for (let i = 0; i < ordered.length; i++) {
5900
+ const next = provenanceOf(memories);
5901
+ if (next.size === suppressed.size && [...next].every((id) => suppressed.has(id))) break;
5902
+ suppressed = next;
5903
+ memories = selectWith(suppressed);
5904
+ }
5881
5905
  return {
5882
5906
  memories,
5883
5907
  usedBudget,
@@ -5898,6 +5922,7 @@ function toFactMemory(r) {
5898
5922
  ...r.eventTimeStart !== void 0 && { eventTimeStart: r.eventTimeStart },
5899
5923
  ...r.eventTimeEnd !== void 0 && { eventTimeEnd: r.eventTimeEnd },
5900
5924
  ...r.eventTimeKind !== void 0 && { eventTimeKind: r.eventTimeKind },
5925
+ ...r.sourceChunkIds !== void 0 && r.sourceChunkIds !== null && { sourceChunkIds: r.sourceChunkIds },
5901
5926
  // r.similarity from searchVaultMemoriesWithSize is the fused score
5902
5927
  // (cosine + BM25 + RRF + recency + proof) when useFusion=true (the
5903
5928
  // default) and pure cosine when useFusion=false. The breakdown
@@ -6012,6 +6037,7 @@ function rankVaultMemories(_query, queryEmbedding, items, options) {
6012
6037
  updatedAt: item.updatedAt,
6013
6038
  createdAt: item.createdAt,
6014
6039
  eventTimeStart: item.eventTimeStart,
6040
+ sourceChunkIds: item.sourceChunkIds,
6015
6041
  eventTimeEnd: item.eventTimeEnd,
6016
6042
  eventTimeKind: item.eventTimeKind,
6017
6043
  similarity: cosineSimilarity(queryEmbedding, item.embedding)
@@ -6053,7 +6079,8 @@ function rankVaultMemories(_query, queryEmbedding, items, options) {
6053
6079
  content: r.content,
6054
6080
  similarity: r.similarity,
6055
6081
  createdAt: item?.createdAt ?? item?.updatedAt,
6056
- updatedAt: item?.updatedAt
6082
+ updatedAt: item?.updatedAt,
6083
+ sourceChunkIds: item?.sourceChunkIds
6057
6084
  };
6058
6085
  });
6059
6086
  }
@@ -6092,6 +6119,7 @@ function rankFusedVaultMemories(query, queryEmbedding, items, options) {
6092
6119
  createdAt: item.createdAt ?? item.updatedAt,
6093
6120
  updatedAt: item.updatedAt,
6094
6121
  eventTimeStart: item.eventTimeStart,
6122
+ sourceChunkIds: item.sourceChunkIds,
6095
6123
  eventTimeEnd: item.eventTimeEnd,
6096
6124
  eventTimeKind: item.eventTimeKind
6097
6125
  });
@@ -6134,7 +6162,8 @@ function rankFusedVaultMemories(query, queryEmbedding, items, options) {
6134
6162
  content: it.content,
6135
6163
  similarity: (fused.get(id) ?? 0) * boostFor(id),
6136
6164
  createdAt: it.createdAt ?? it.updatedAt,
6137
- updatedAt: it.updatedAt
6165
+ updatedAt: it.updatedAt,
6166
+ sourceChunkIds: it.sourceChunkIds
6138
6167
  });
6139
6168
  seen.add(id);
6140
6169
  }
@@ -6172,13 +6201,7 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
6172
6201
  combined = headSlice.map((r) => {
6173
6202
  const v2 = v2ScoreById.get(r.uniqueId) ?? 0;
6174
6203
  const ce = ceScoreById.get(r.uniqueId) ?? 0;
6175
- return {
6176
- uniqueId: r.uniqueId,
6177
- content: r.content,
6178
- similarity: v2 * (1 + ceWeight * ce),
6179
- createdAt: r.createdAt,
6180
- updatedAt: r.updatedAt
6181
- };
6204
+ return { ...r, similarity: v2 * (1 + ceWeight * ce) };
6182
6205
  });
6183
6206
  combined.sort((a, b) => b.similarity - a.similarity);
6184
6207
  } catch (err) {
@@ -6211,7 +6234,8 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
6211
6234
  content: it.content,
6212
6235
  similarity: fused.get(id) ?? 0,
6213
6236
  createdAt: it.createdAt ?? it.updatedAt,
6214
- updatedAt: it.updatedAt
6237
+ updatedAt: it.updatedAt,
6238
+ sourceChunkIds: it.sourceChunkIds
6215
6239
  });
6216
6240
  seen.add(id);
6217
6241
  }
@@ -6241,6 +6265,7 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
6241
6265
  createdAt: orig?.createdAt,
6242
6266
  updatedAt: orig?.updatedAt,
6243
6267
  eventTimeStart: orig?.eventTimeStart,
6268
+ sourceChunkIds: orig?.sourceChunkIds,
6244
6269
  eventTimeEnd: orig?.eventTimeEnd,
6245
6270
  eventTimeKind: orig?.eventTimeKind
6246
6271
  };
@@ -6304,6 +6329,7 @@ async function rankComposite(originalQuery, originalQueryEmbedding, subQueries,
6304
6329
  createdAt: item.createdAt ?? item.updatedAt,
6305
6330
  updatedAt: item.updatedAt,
6306
6331
  eventTimeStart: item.eventTimeStart,
6332
+ sourceChunkIds: item.sourceChunkIds,
6307
6333
  eventTimeEnd: item.eventTimeEnd,
6308
6334
  eventTimeKind: item.eventTimeKind
6309
6335
  };
@@ -6324,6 +6350,7 @@ async function rankComposite(originalQuery, originalQueryEmbedding, subQueries,
6324
6350
  createdAt: item.createdAt ?? item.updatedAt,
6325
6351
  updatedAt: item.updatedAt,
6326
6352
  eventTimeStart: item.eventTimeStart,
6353
+ sourceChunkIds: item.sourceChunkIds,
6327
6354
  eventTimeEnd: item.eventTimeEnd,
6328
6355
  eventTimeKind: item.eventTimeKind
6329
6356
  });
@@ -6375,6 +6402,7 @@ async function rankComposite(originalQuery, originalQueryEmbedding, subQueries,
6375
6402
  createdAt: orig?.createdAt,
6376
6403
  updatedAt: orig?.updatedAt,
6377
6404
  eventTimeStart: orig?.eventTimeStart,
6405
+ sourceChunkIds: orig?.sourceChunkIds,
6378
6406
  eventTimeEnd: orig?.eventTimeEnd,
6379
6407
  eventTimeKind: orig?.eventTimeKind
6380
6408
  };
@@ -6516,6 +6544,7 @@ async function searchVaultMemoriesWithSize(query, vaultCtx, embeddingOptions, ca
6516
6544
  updatedAt: m.updatedAt,
6517
6545
  proofCount: m.proofCount,
6518
6546
  eventTimeStart: m.eventTimeStart,
6547
+ sourceChunkIds: m.sourceChunkIds,
6519
6548
  eventTimeEnd: m.eventTimeEnd,
6520
6549
  eventTimeKind: normalizeEventTimeKind(m.eventTimeKind)
6521
6550
  }));
@@ -5979,6 +5979,9 @@ interface VaultSearchResult {
5979
5979
  eventTimeStart?: number | null;
5980
5980
  eventTimeEnd?: number | null;
5981
5981
  eventTimeKind?: "point" | "range" | "ongoing" | null;
5982
+ /** Message ids this fact was extracted from (provenance). recall() uses
5983
+ * these to suppress the originating chunk in the chunk lane. */
5984
+ sourceChunkIds?: string[] | null;
5982
5985
  }
5983
5986
  /**
5984
5987
  * Search vault memories by semantic similarity. Returns structured results
@@ -5979,6 +5979,9 @@ interface VaultSearchResult {
5979
5979
  eventTimeStart?: number | null;
5980
5980
  eventTimeEnd?: number | null;
5981
5981
  eventTimeKind?: "point" | "range" | "ongoing" | null;
5982
+ /** Message ids this fact was extracted from (provenance). recall() uses
5983
+ * these to suppress the originating chunk in the chunk lane. */
5984
+ sourceChunkIds?: string[] | null;
5982
5985
  }
5983
5986
  /**
5984
5987
  * Search vault memories by semantic similarity. Returns structured results
@@ -121,7 +121,7 @@ import {
121
121
  updateVaultMemoryEmbeddingOp,
122
122
  updateVaultMemoryOp,
123
123
  useEncryption
124
- } from "./chunk-IMUF4U55.mjs";
124
+ } from "./chunk-DVGJ5NBT.mjs";
125
125
  import {
126
126
  PiiRedactor,
127
127
  createStreamingDeAnonymizer,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  recall
3
- } from "./chunk-IMUF4U55.mjs";
3
+ } from "./chunk-DVGJ5NBT.mjs";
4
4
  import "./chunk-DFVCS3QQ.mjs";
5
5
  import "./chunk-GYKJOWEO.mjs";
6
6
  export {
@@ -18127,6 +18127,7 @@ function rankVaultMemories(_query, queryEmbedding, items, options) {
18127
18127
  updatedAt: item.updatedAt,
18128
18128
  createdAt: item.createdAt,
18129
18129
  eventTimeStart: item.eventTimeStart,
18130
+ sourceChunkIds: item.sourceChunkIds,
18130
18131
  eventTimeEnd: item.eventTimeEnd,
18131
18132
  eventTimeKind: item.eventTimeKind,
18132
18133
  similarity: cosineSimilarity(queryEmbedding, item.embedding)
@@ -18168,7 +18169,8 @@ function rankVaultMemories(_query, queryEmbedding, items, options) {
18168
18169
  content: r.content,
18169
18170
  similarity: r.similarity,
18170
18171
  createdAt: item?.createdAt ?? item?.updatedAt,
18171
- updatedAt: item?.updatedAt
18172
+ updatedAt: item?.updatedAt,
18173
+ sourceChunkIds: item?.sourceChunkIds
18172
18174
  };
18173
18175
  });
18174
18176
  }
@@ -18207,6 +18209,7 @@ function rankFusedVaultMemories(query, queryEmbedding, items, options) {
18207
18209
  createdAt: item.createdAt ?? item.updatedAt,
18208
18210
  updatedAt: item.updatedAt,
18209
18211
  eventTimeStart: item.eventTimeStart,
18212
+ sourceChunkIds: item.sourceChunkIds,
18210
18213
  eventTimeEnd: item.eventTimeEnd,
18211
18214
  eventTimeKind: item.eventTimeKind
18212
18215
  });
@@ -18249,7 +18252,8 @@ function rankFusedVaultMemories(query, queryEmbedding, items, options) {
18249
18252
  content: it.content,
18250
18253
  similarity: (fused.get(id) ?? 0) * boostFor(id),
18251
18254
  createdAt: it.createdAt ?? it.updatedAt,
18252
- updatedAt: it.updatedAt
18255
+ updatedAt: it.updatedAt,
18256
+ sourceChunkIds: it.sourceChunkIds
18253
18257
  });
18254
18258
  seen.add(id);
18255
18259
  }
@@ -18287,13 +18291,7 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
18287
18291
  combined = headSlice.map((r) => {
18288
18292
  const v2 = v2ScoreById.get(r.uniqueId) ?? 0;
18289
18293
  const ce = ceScoreById.get(r.uniqueId) ?? 0;
18290
- return {
18291
- uniqueId: r.uniqueId,
18292
- content: r.content,
18293
- similarity: v2 * (1 + ceWeight * ce),
18294
- createdAt: r.createdAt,
18295
- updatedAt: r.updatedAt
18296
- };
18294
+ return { ...r, similarity: v2 * (1 + ceWeight * ce) };
18297
18295
  });
18298
18296
  combined.sort((a, b) => b.similarity - a.similarity);
18299
18297
  } catch (err) {
@@ -18326,7 +18324,8 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
18326
18324
  content: it.content,
18327
18325
  similarity: fused.get(id) ?? 0,
18328
18326
  createdAt: it.createdAt ?? it.updatedAt,
18329
- updatedAt: it.updatedAt
18327
+ updatedAt: it.updatedAt,
18328
+ sourceChunkIds: it.sourceChunkIds
18330
18329
  });
18331
18330
  seen.add(id);
18332
18331
  }
@@ -18356,6 +18355,7 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
18356
18355
  createdAt: orig?.createdAt,
18357
18356
  updatedAt: orig?.updatedAt,
18358
18357
  eventTimeStart: orig?.eventTimeStart,
18358
+ sourceChunkIds: orig?.sourceChunkIds,
18359
18359
  eventTimeEnd: orig?.eventTimeEnd,
18360
18360
  eventTimeKind: orig?.eventTimeKind
18361
18361
  };
@@ -18419,6 +18419,7 @@ async function rankComposite(originalQuery, originalQueryEmbedding, subQueries,
18419
18419
  createdAt: item.createdAt ?? item.updatedAt,
18420
18420
  updatedAt: item.updatedAt,
18421
18421
  eventTimeStart: item.eventTimeStart,
18422
+ sourceChunkIds: item.sourceChunkIds,
18422
18423
  eventTimeEnd: item.eventTimeEnd,
18423
18424
  eventTimeKind: item.eventTimeKind
18424
18425
  };
@@ -18439,6 +18440,7 @@ async function rankComposite(originalQuery, originalQueryEmbedding, subQueries,
18439
18440
  createdAt: item.createdAt ?? item.updatedAt,
18440
18441
  updatedAt: item.updatedAt,
18441
18442
  eventTimeStart: item.eventTimeStart,
18443
+ sourceChunkIds: item.sourceChunkIds,
18442
18444
  eventTimeEnd: item.eventTimeEnd,
18443
18445
  eventTimeKind: item.eventTimeKind
18444
18446
  });
@@ -18490,6 +18492,7 @@ async function rankComposite(originalQuery, originalQueryEmbedding, subQueries,
18490
18492
  createdAt: orig?.createdAt,
18491
18493
  updatedAt: orig?.updatedAt,
18492
18494
  eventTimeStart: orig?.eventTimeStart,
18495
+ sourceChunkIds: orig?.sourceChunkIds,
18493
18496
  eventTimeEnd: orig?.eventTimeEnd,
18494
18497
  eventTimeKind: orig?.eventTimeKind
18495
18498
  };
@@ -18631,6 +18634,7 @@ async function searchVaultMemoriesWithSize(query, vaultCtx, embeddingOptions, ca
18631
18634
  updatedAt: m.updatedAt,
18632
18635
  proofCount: m.proofCount,
18633
18636
  eventTimeStart: m.eventTimeStart,
18637
+ sourceChunkIds: m.sourceChunkIds,
18634
18638
  eventTimeEnd: m.eventTimeEnd,
18635
18639
  eventTimeKind: normalizeEventTimeKind(m.eventTimeKind)
18636
18640
  }));
@@ -18821,7 +18825,7 @@ function createMemoryVaultSearchTool(vaultCtx, embeddingOptions, cache, searchOp
18821
18825
  legacy.map((r) => ({ id: r.uniqueId, content: r.content, score: r.similarity }))
18822
18826
  );
18823
18827
  }
18824
- const { recall: recall2 } = await import("./recall-LFYTTIIY.mjs");
18828
+ const { recall: recall2 } = await import("./recall-2XUT7CCN.mjs");
18825
18829
  const result = await recall2(
18826
18830
  query,
18827
18831
  { vaultCtx, embeddingOptions, vaultCache: cache },
@@ -19289,7 +19293,31 @@ async function recall(query, ctx, options = {}) {
19289
19293
  m.scoreBreakdown.fused = r.similarity;
19290
19294
  byId.set(key, m);
19291
19295
  }
19292
- const memories = [...byId.values()].sort((a, b) => b.score - a.score).slice(0, limit);
19296
+ const ordered = [...byId.values()].sort((a, b) => b.score - a.score);
19297
+ const selectWith = (suppressed2) => {
19298
+ const out = [];
19299
+ for (const m of ordered) {
19300
+ if (out.length >= limit) break;
19301
+ if (m.kind === "chunk" && m.messageId && suppressed2.has(m.messageId)) continue;
19302
+ out.push(m);
19303
+ }
19304
+ return out;
19305
+ };
19306
+ const provenanceOf = (selected) => {
19307
+ const s = /* @__PURE__ */ new Set();
19308
+ for (const m of selected) {
19309
+ if (m.kind === "fact" && m.sourceChunkIds) for (const id of m.sourceChunkIds) s.add(id);
19310
+ }
19311
+ return s;
19312
+ };
19313
+ let suppressed = /* @__PURE__ */ new Set();
19314
+ let memories = selectWith(suppressed);
19315
+ for (let i = 0; i < ordered.length; i++) {
19316
+ const next = provenanceOf(memories);
19317
+ if (next.size === suppressed.size && [...next].every((id) => suppressed.has(id))) break;
19318
+ suppressed = next;
19319
+ memories = selectWith(suppressed);
19320
+ }
19293
19321
  return {
19294
19322
  memories,
19295
19323
  usedBudget,
@@ -19310,6 +19338,7 @@ function toFactMemory(r) {
19310
19338
  ...r.eventTimeStart !== void 0 && { eventTimeStart: r.eventTimeStart },
19311
19339
  ...r.eventTimeEnd !== void 0 && { eventTimeEnd: r.eventTimeEnd },
19312
19340
  ...r.eventTimeKind !== void 0 && { eventTimeKind: r.eventTimeKind },
19341
+ ...r.sourceChunkIds !== void 0 && r.sourceChunkIds !== null && { sourceChunkIds: r.sourceChunkIds },
19313
19342
  // r.similarity from searchVaultMemoriesWithSize is the fused score
19314
19343
  // (cosine + BM25 + RRF + recency + proof) when useFusion=true (the
19315
19344
  // default) and pure cosine when useFusion=false. The breakdown
@@ -19682,7 +19682,31 @@ async function recall(query, ctx, options = {}) {
19682
19682
  m.scoreBreakdown.fused = r.similarity;
19683
19683
  byId.set(key, m);
19684
19684
  }
19685
- const memories = [...byId.values()].sort((a, b) => b.score - a.score).slice(0, limit);
19685
+ const ordered = [...byId.values()].sort((a, b) => b.score - a.score);
19686
+ const selectWith = (suppressed2) => {
19687
+ const out = [];
19688
+ for (const m of ordered) {
19689
+ if (out.length >= limit) break;
19690
+ if (m.kind === "chunk" && m.messageId && suppressed2.has(m.messageId)) continue;
19691
+ out.push(m);
19692
+ }
19693
+ return out;
19694
+ };
19695
+ const provenanceOf = (selected) => {
19696
+ const s = /* @__PURE__ */ new Set();
19697
+ for (const m of selected) {
19698
+ if (m.kind === "fact" && m.sourceChunkIds) for (const id of m.sourceChunkIds) s.add(id);
19699
+ }
19700
+ return s;
19701
+ };
19702
+ let suppressed = /* @__PURE__ */ new Set();
19703
+ let memories = selectWith(suppressed);
19704
+ for (let i = 0; i < ordered.length; i++) {
19705
+ const next = provenanceOf(memories);
19706
+ if (next.size === suppressed.size && [...next].every((id) => suppressed.has(id))) break;
19707
+ suppressed = next;
19708
+ memories = selectWith(suppressed);
19709
+ }
19686
19710
  return {
19687
19711
  memories,
19688
19712
  usedBudget,
@@ -19703,6 +19727,7 @@ function toFactMemory(r) {
19703
19727
  ...r.eventTimeStart !== void 0 && { eventTimeStart: r.eventTimeStart },
19704
19728
  ...r.eventTimeEnd !== void 0 && { eventTimeEnd: r.eventTimeEnd },
19705
19729
  ...r.eventTimeKind !== void 0 && { eventTimeKind: r.eventTimeKind },
19730
+ ...r.sourceChunkIds !== void 0 && r.sourceChunkIds !== null && { sourceChunkIds: r.sourceChunkIds },
19706
19731
  // r.similarity from searchVaultMemoriesWithSize is the fused score
19707
19732
  // (cosine + BM25 + RRF + recency + proof) when useFusion=true (the
19708
19733
  // default) and pure cosine when useFusion=false. The breakdown
@@ -19817,6 +19842,7 @@ function rankVaultMemories(_query, queryEmbedding, items, options) {
19817
19842
  updatedAt: item.updatedAt,
19818
19843
  createdAt: item.createdAt,
19819
19844
  eventTimeStart: item.eventTimeStart,
19845
+ sourceChunkIds: item.sourceChunkIds,
19820
19846
  eventTimeEnd: item.eventTimeEnd,
19821
19847
  eventTimeKind: item.eventTimeKind,
19822
19848
  similarity: cosineSimilarity(queryEmbedding, item.embedding)
@@ -19858,7 +19884,8 @@ function rankVaultMemories(_query, queryEmbedding, items, options) {
19858
19884
  content: r.content,
19859
19885
  similarity: r.similarity,
19860
19886
  createdAt: item?.createdAt ?? item?.updatedAt,
19861
- updatedAt: item?.updatedAt
19887
+ updatedAt: item?.updatedAt,
19888
+ sourceChunkIds: item?.sourceChunkIds
19862
19889
  };
19863
19890
  });
19864
19891
  }
@@ -19897,6 +19924,7 @@ function rankFusedVaultMemories(query, queryEmbedding, items, options) {
19897
19924
  createdAt: item.createdAt ?? item.updatedAt,
19898
19925
  updatedAt: item.updatedAt,
19899
19926
  eventTimeStart: item.eventTimeStart,
19927
+ sourceChunkIds: item.sourceChunkIds,
19900
19928
  eventTimeEnd: item.eventTimeEnd,
19901
19929
  eventTimeKind: item.eventTimeKind
19902
19930
  });
@@ -19939,7 +19967,8 @@ function rankFusedVaultMemories(query, queryEmbedding, items, options) {
19939
19967
  content: it.content,
19940
19968
  similarity: (fused.get(id) ?? 0) * boostFor(id),
19941
19969
  createdAt: it.createdAt ?? it.updatedAt,
19942
- updatedAt: it.updatedAt
19970
+ updatedAt: it.updatedAt,
19971
+ sourceChunkIds: it.sourceChunkIds
19943
19972
  });
19944
19973
  seen.add(id);
19945
19974
  }
@@ -19977,13 +20006,7 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
19977
20006
  combined = headSlice.map((r) => {
19978
20007
  const v2 = v2ScoreById.get(r.uniqueId) ?? 0;
19979
20008
  const ce = ceScoreById.get(r.uniqueId) ?? 0;
19980
- return {
19981
- uniqueId: r.uniqueId,
19982
- content: r.content,
19983
- similarity: v2 * (1 + ceWeight * ce),
19984
- createdAt: r.createdAt,
19985
- updatedAt: r.updatedAt
19986
- };
20009
+ return { ...r, similarity: v2 * (1 + ceWeight * ce) };
19987
20010
  });
19988
20011
  combined.sort((a, b) => b.similarity - a.similarity);
19989
20012
  } catch (err) {
@@ -20016,7 +20039,8 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
20016
20039
  content: it.content,
20017
20040
  similarity: fused.get(id) ?? 0,
20018
20041
  createdAt: it.createdAt ?? it.updatedAt,
20019
- updatedAt: it.updatedAt
20042
+ updatedAt: it.updatedAt,
20043
+ sourceChunkIds: it.sourceChunkIds
20020
20044
  });
20021
20045
  seen.add(id);
20022
20046
  }
@@ -20046,6 +20070,7 @@ async function rankFusedVaultMemoriesAsync(query, queryEmbedding, items, options
20046
20070
  createdAt: orig?.createdAt,
20047
20071
  updatedAt: orig?.updatedAt,
20048
20072
  eventTimeStart: orig?.eventTimeStart,
20073
+ sourceChunkIds: orig?.sourceChunkIds,
20049
20074
  eventTimeEnd: orig?.eventTimeEnd,
20050
20075
  eventTimeKind: orig?.eventTimeKind
20051
20076
  };
@@ -20109,6 +20134,7 @@ async function rankComposite(originalQuery, originalQueryEmbedding, subQueries,
20109
20134
  createdAt: item.createdAt ?? item.updatedAt,
20110
20135
  updatedAt: item.updatedAt,
20111
20136
  eventTimeStart: item.eventTimeStart,
20137
+ sourceChunkIds: item.sourceChunkIds,
20112
20138
  eventTimeEnd: item.eventTimeEnd,
20113
20139
  eventTimeKind: item.eventTimeKind
20114
20140
  };
@@ -20129,6 +20155,7 @@ async function rankComposite(originalQuery, originalQueryEmbedding, subQueries,
20129
20155
  createdAt: item.createdAt ?? item.updatedAt,
20130
20156
  updatedAt: item.updatedAt,
20131
20157
  eventTimeStart: item.eventTimeStart,
20158
+ sourceChunkIds: item.sourceChunkIds,
20132
20159
  eventTimeEnd: item.eventTimeEnd,
20133
20160
  eventTimeKind: item.eventTimeKind
20134
20161
  });
@@ -20180,6 +20207,7 @@ async function rankComposite(originalQuery, originalQueryEmbedding, subQueries,
20180
20207
  createdAt: orig?.createdAt,
20181
20208
  updatedAt: orig?.updatedAt,
20182
20209
  eventTimeStart: orig?.eventTimeStart,
20210
+ sourceChunkIds: orig?.sourceChunkIds,
20183
20211
  eventTimeEnd: orig?.eventTimeEnd,
20184
20212
  eventTimeKind: orig?.eventTimeKind
20185
20213
  };
@@ -20321,6 +20349,7 @@ async function searchVaultMemoriesWithSize(query, vaultCtx, embeddingOptions, ca
20321
20349
  updatedAt: m.updatedAt,
20322
20350
  proofCount: m.proofCount,
20323
20351
  eventTimeStart: m.eventTimeStart,
20352
+ sourceChunkIds: m.sourceChunkIds,
20324
20353
  eventTimeEnd: m.eventTimeEnd,
20325
20354
  eventTimeKind: normalizeEventTimeKind(m.eventTimeKind)
20326
20355
  }));
@@ -5419,6 +5419,9 @@ interface VaultSearchResult {
5419
5419
  eventTimeStart?: number | null;
5420
5420
  eventTimeEnd?: number | null;
5421
5421
  eventTimeKind?: "point" | "range" | "ongoing" | null;
5422
+ /** Message ids this fact was extracted from (provenance). recall() uses
5423
+ * these to suppress the originating chunk in the chunk lane. */
5424
+ sourceChunkIds?: string[] | null;
5422
5425
  }
5423
5426
  /**
5424
5427
  * Search vault memories by semantic similarity. Returns structured results
@@ -5419,6 +5419,9 @@ interface VaultSearchResult {
5419
5419
  eventTimeStart?: number | null;
5420
5420
  eventTimeEnd?: number | null;
5421
5421
  eventTimeKind?: "point" | "range" | "ongoing" | null;
5422
+ /** Message ids this fact was extracted from (provenance). recall() uses
5423
+ * these to suppress the originating chunk in the chunk lane. */
5424
+ sourceChunkIds?: string[] | null;
5422
5425
  }
5423
5426
  /**
5424
5427
  * Search vault memories by semantic similarity. Returns structured results
@@ -95,7 +95,7 @@ import {
95
95
  updateVaultMemoryEmbeddingOp,
96
96
  updateVaultMemoryOp,
97
97
  upsertMessageOp
98
- } from "./chunk-G3DC7QBH.mjs";
98
+ } from "./chunk-RCNBXNOI.mjs";
99
99
  import {
100
100
  createStreamingDeAnonymizer,
101
101
  resolvePiiRedactor
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  recall
3
- } from "./chunk-G3DC7QBH.mjs";
3
+ } from "./chunk-RCNBXNOI.mjs";
4
4
  import "./chunk-RCCKRTBI.mjs";
5
5
  import "./chunk-FMGZTVXQ.mjs";
6
6
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anuma/sdk",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",