fix(supervisor): expand bounded source aliases

This commit is contained in:
mesalogo
2026-10-07 17:15:00 +08:00
parent 425accf49d
commit e0607a153f
2 changed files with 10 additions and 7 deletions
+4 -4
View File
@@ -137,11 +137,11 @@ function validateReferences(
for (const item of [...output.events, ...output.entities, ...output.entityChanges, ...output.relations]) {
item.sourceReferenceIds = [...new Set(item.sourceReferenceIds.map(id => {
if (evidenceIds.has(id)) return id
// Providers also copy the supplied locator.source. Resolve it only when this
// node contains exactly one fragment of that source, never to an entire message.
// Providers may copy the supplied locator.source. Expand it to the matching
// bounded fragments so a multi-fragment source never becomes an unbounded citation.
const matches = evidence.filter(source => source.locator?.source === id)
return matches.length === 1 ? matches[0]!.id : id
}))]
return matches.length ? matches.map(source => source.id) : [id]
}).flat())]
}
const references = [
...output.events.flatMap((item) => item.sourceReferenceIds),