Preserve Scattermind source excerpts in rank handoff
This commit is contained in:
@@ -687,6 +687,9 @@ function normalizeFeatureOption(item, index, fallbackId = 'feature', defaultSour
|
||||
const rawLane = cleanText(raw.lane || '', 40);
|
||||
const laneLooksLikeHint = Boolean(normalizeLaneHint(rawLane));
|
||||
const sourceSection = cleanText(raw.sourceSection || raw.section || raw.origin || (!laneLooksLikeHint ? rawLane : '') || defaultSourceSection, 80);
|
||||
const sourceId = cleanText(raw.sourceId || raw.sourceArtifactId || raw.sourceItemId || raw.traceId || raw.id || '', 120);
|
||||
const sourceTitle = cleanText(raw.sourceTitle || raw.sourceHeading || raw.lensTitle || raw.heading || '', 140);
|
||||
const sourceQuote = cleanMultiline(raw.sourceQuote || raw.sourceExcerpt || raw.evidenceQuote || raw.quote || raw.originalText || raw.rawText || '', 420);
|
||||
const recommendedLane = cleanText(raw.recommendedLane || raw.laneHint || raw.suggestedLane || (laneLooksLikeHint ? rawLane : '') || defaultRecommendedLane || '', 40).toLowerCase();
|
||||
const descriptionParts = [
|
||||
raw.description || raw.brief || '',
|
||||
@@ -705,8 +708,10 @@ function normalizeFeatureOption(item, index, fallbackId = 'feature', defaultSour
|
||||
description: cleanText(descriptionParts.join(' '), 760),
|
||||
factors: { userValue, evidenceNeeded, risk, nextStep, successSignal, killSignal, proofSteps, dependencies, recommendedLane, metricHints: cleanMetricHints(raw) },
|
||||
provenance: {
|
||||
sourceId: cleanText(raw.sourceId || raw.sourceArtifactId || raw.id || '', 120),
|
||||
sourceId,
|
||||
sourceSection,
|
||||
sourceTitle,
|
||||
sourceQuote,
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -1110,6 +1115,8 @@ function compactBuildItems(items = []) {
|
||||
concern: item.concern,
|
||||
sourceSection: item.provenance?.sourceSection || '',
|
||||
sourceId: item.provenance?.sourceId || '',
|
||||
sourceTitle: item.provenance?.sourceTitle || '',
|
||||
sourceQuote: item.provenance?.sourceQuote || '',
|
||||
laneSource: item.lane?.source || 'ranked',
|
||||
score: item.metrics?.score ?? null,
|
||||
confidence: item.metrics?.confidence ?? null,
|
||||
@@ -1133,6 +1140,8 @@ function createHandoffContract({ ranked, provenance, decisionContext }) {
|
||||
lane: item.lane?.id || 'defer',
|
||||
sourceSection: item.provenance?.sourceSection || '',
|
||||
sourceId: item.provenance?.sourceId || '',
|
||||
sourceTitle: item.provenance?.sourceTitle || '',
|
||||
sourceQuote: item.provenance?.sourceQuote || '',
|
||||
originalId: item.provenance?.originalId || '',
|
||||
idNormalized: Boolean(item.provenance?.idNormalized),
|
||||
evidenceNeeded: item.factors?.evidenceNeeded || '',
|
||||
|
||||
Reference in New Issue
Block a user