Files
confidence-engine/lib/map/investigation-map-adapter.js

60 lines
3.0 KiB
JavaScript

/**
* ┌─────────────────────────────────────────────────────────────────────┐
* │ INVESTIGATION MAP — UX PLACEHOLDER ADAPTER │
* │ │
* │ This adapter drives a minimal mock to validate UX placement, │
* │ spacing, status appearance, responsive behaviour, and state │
* │ change across turns. │
* │ │
* │ The topic names below are mock-only placeholders. They are NOT │
* │ part of the reasoning contract and do NOT imply the final map │
* │ structure — which may be hierarchical, grouped, branching, or │
* │ something else entirely. │
* │ │
* │ The UI will eventually consume real reasoning output once that │
* │ design stabilises. │
* └─────────────────────────────────────────────────────────────────────┘
*/
/** @type {Array<{ title: string }>} — mock-only placeholder names */
const TOPICS = [
{ title: "Starting point" },
{ title: "What is known" },
{ title: "Current focus" },
{ title: "Questions still open" },
{ title: "Possible explanations" },
];
/**
* Status progression per turn index.
* The reasoning engine will eventually determine these values.
*
* With N placeholder topics we have N-1 progressive states (indices 0 to N-2).
* Beyond that the map stabilises: all topics established except the last one current.
*/
const PROGRESSION = [
// Turn 0 — initial analysis just started
["established", "current", "unknown", "unknown", "unknown"],
// Turn 1 — first question answered
["established", "established", "current", "unknown", "unknown"],
// Turn 2 — second question answered
["established", "established", "established", "current", "unknown"],
// Turn 3+ — third answer and beyond (all topics resolved, last in progress)
["established", "established", "established", "established", "current"],
];
/**
* Get investigation map topics for a given turn index.
* @param {number} turnIndex - Zero-based turn number (0 = initial analysis).
* @returns {{ title: string, status: 'established' | 'current' | 'unknown' }[]}
*/
export function getInvestigationMapTopics(turnIndex) {
// Clamp to last progression entry so the map stabilises when all topics are covered
const idx = Math.min(Math.max(turnIndex, 0), PROGRESSION.length - 1);
return TOPICS.map((topic, i) => ({
title: topic.title,
status: PROGRESSION[idx][i],
}));
}
export default getInvestigationMapTopics;