Accept Scattermind action thread fallbacks
This commit is contained in:
@@ -937,6 +937,42 @@ function optionsFromBuildOrderText(text = '', sourceSection = 'concept-map.lense
|
||||
}).filter(item => item.action);
|
||||
}
|
||||
|
||||
function laneFromActionThread(text = '') {
|
||||
if (/\b(probably noise|set aside|park|parking lot|do not build|don't build|not worth|distraction)\b/i.test(text)) return 'park';
|
||||
if (/\b(defer|not yet|later|hold for later|after proof|wait until)\b/i.test(text)) return 'defer';
|
||||
if (/^(manual|start|ship|build|show|turn one)\b/i.test(text)) return 'do-first';
|
||||
if (/\b(test|validate|proof|ask|interview|observe|learn|evidence|signal)\b/i.test(text)) return 'validate-next';
|
||||
return '';
|
||||
}
|
||||
|
||||
function optionsFromActionThreads(items = [], sourceSection = 'concept-map.threadsToHold', sourceTitle = 'Action thread') {
|
||||
if (!Array.isArray(items)) return [];
|
||||
return items.slice(0, 8).map((item, index) => {
|
||||
const raw = typeof item === 'string' || typeof item === 'number' ? String(item) : '';
|
||||
const objectItem = objectFrom(item);
|
||||
const text = cleanMultiline(raw || objectItem.text || objectItem.content || objectItem.thread || objectItem.action || objectItem.title || '', 420);
|
||||
const lane = laneFromActionThread(text);
|
||||
return {
|
||||
id: `action-thread-${index + 1}`,
|
||||
action: titleFromBuildOrderFragment(text),
|
||||
why: text,
|
||||
evidence: /\b(evidence|signal|proof|test|validate|ask|observe)\b/i.test(text)
|
||||
? text
|
||||
: 'What smallest real-world signal would prove this action deserves the active build slot?',
|
||||
suggestedLane: lane,
|
||||
rankerHints: lane === 'do-first'
|
||||
? { value: 8, effort: 2, confidence: 7, urgency: 7, risk: 2 }
|
||||
: lane === 'validate-next'
|
||||
? { value: 7, effort: 3, confidence: 6, urgency: 5, risk: 3 }
|
||||
: undefined,
|
||||
sourceSection,
|
||||
sourceItemId: `${sourceSection}#${index + 1}`,
|
||||
sourceTitle: cleanText(objectItem.sourceTitle || objectItem.source_title || sourceTitle, 140),
|
||||
sourceExcerpt: text,
|
||||
};
|
||||
}).filter(item => item.action);
|
||||
}
|
||||
|
||||
function optionsFromBody(body = {}) {
|
||||
const envelope = bridgeEnvelopeFrom(body);
|
||||
const featureSet = featureSetFrom(body);
|
||||
@@ -1037,6 +1073,12 @@ function optionsFromBody(body = {}) {
|
||||
);
|
||||
const buildOrderOptions = optionsFromBuildOrderText(buildOrderText, 'concept-map.lenses.channel', buildOrderSourceTitle);
|
||||
if (buildOrderOptions.length) return normalizeCandidateGroup([{ items: buildOrderOptions, sourceSection: 'concept-map.lenses.channel' }]);
|
||||
const actionThreadOptions = optionsFromActionThreads(
|
||||
body.threads_to_hold || body.threadsToHold || body.actionThreads || body.action_threads || conceptMap.threads_to_hold || conceptMap.threadsToHold || conceptMap.actionThreads || conceptMap.action_threads,
|
||||
conceptMap.threads_to_hold || conceptMap.threadsToHold || conceptMap.actionThreads || conceptMap.action_threads ? 'concept-map.threadsToHold' : 'threadsToHold',
|
||||
'Thread to hold'
|
||||
);
|
||||
if (actionThreadOptions.length >= 2) return normalizeCandidateGroup([{ items: actionThreadOptions, sourceSection: 'concept-map.threadsToHold' }]);
|
||||
if (Array.isArray(body.options)) {
|
||||
return normalizeOptionIds(body.options.slice(0, 24).map((item, index) => normalizeFeatureOption(item, index, 'option', 'options')).filter(item => item.title));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user