feat: Phase 2-5 UX enhancements — recovery cards, session persistence, summary panel, contract backlog
Phase 2: Recovery state components (ProviderUnavailableCard, MalformedResponseCard, UnexpectedStateCard, ContinueLaterBanner) with automatic error detection for provider/network/malformed/unexpected states. Phase 3: Session persistence via sessionStorage — save after each successful turn, restore on mount, clear on restart/reset. Continuelater banner shown when session is restored. Phase 4: InvestigationSummaryPanel component displaying current status, understanding summary, questions answered/remaining, investigation timestamps. Phase 5: docs/reasoning-contract-backlog.md documenting all mocked fields (60+ rows across 7 categories) with feature/UI need/mock/desired output/stage/notes columns. Also: wired onRestart through ReasoningWorkspace → ScenarioForm, fixed getErrorType scope issues, removed broken window.__restartInvestigation.
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
* Pure ESM + browser-compatible (no require(), no Node-only APIs).
|
||||
*/
|
||||
|
||||
import { buildScenarioFixture, AVAILABLE_SCENARIOS } from "@/lib/mocks/scenarios.js";
|
||||
|
||||
/* ── helpers ─────────────────────────────────────────────── */
|
||||
|
||||
function getMockFlag() {
|
||||
@@ -23,9 +25,9 @@ function getScenario() {
|
||||
return s || "";
|
||||
}
|
||||
|
||||
/* ── node / edge factories ───────────────────────────────── */
|
||||
/* ── node / edge factories (re-exported for scenario files) ─ */
|
||||
|
||||
function mkNode(id, label, opts) {
|
||||
export function mkNode(id, label, opts) {
|
||||
var kind = (opts && opts.kind) || "unknown";
|
||||
var status = (opts && opts.status) || (kind === "unknown" ? "unknown" : "known");
|
||||
var confidence = (opts && opts.confidence) || "low";
|
||||
@@ -37,115 +39,17 @@ function mkNode(id, label, opts) {
|
||||
};
|
||||
}
|
||||
|
||||
function mkEdge(id, a, b, rel) {
|
||||
export function mkEdge(id, a, b, rel) {
|
||||
var r = rel || "supports";
|
||||
return { id:id, fromNodeId:a, toNodeId:b, relationship:r, confidence:"medium", description:a+" -> "+b };
|
||||
}
|
||||
|
||||
/* ── turn descriptors ────────────────────────────────────── */
|
||||
|
||||
var T0_nodes = [
|
||||
mkNode("obs-1","Complaints increased by 35%",{kind:"observation",status:"known",confidence:"high"}),
|
||||
mkNode("obs-2","Production increased by 40%",{kind:"observation",status:"known",confidence:"high"}),
|
||||
mkNode("state-1","Current situation",{kind:"state",status:"provisional",confidence:"medium"}),
|
||||
mkNode("rel-1","Complaint and production trends are related",{kind:"relationship",status:"known",confidence:"medium"}),
|
||||
mkNode("u-1","Whether the two figures cover the same period"),
|
||||
mkNode("u-2","Whether the percentage changes use comparable baselines"),
|
||||
mkNode("u-3","Whether complaints increased faster than production on a per-unit basis")
|
||||
];
|
||||
var T0_edges = [mkEdge("e-1","obs-1","state-1"),mkEdge("e-2","obs-2","state-1"),mkEdge("e-3","rel-1","u-1")];
|
||||
|
||||
var T1_nodes = [
|
||||
mkNode("obs-1","Complaints increased by 35%",{kind:"observation",status:"known",confidence:"high"}),
|
||||
mkNode("obs-2","Production increased by 40%",{kind:"observation",status:"known",confidence:"high"}),
|
||||
mkNode("obs-3","Both figures cover the same three-month period",{kind:"observation",status:"known",confidence:"high"}),
|
||||
mkNode("state-1","Current situation",{kind:"state",status:"provisional",confidence:"medium"}),
|
||||
mkNode("rel-1","Complaint and production trends are related",{kind:"relationship",status:"known",confidence:"medium"}),
|
||||
mkNode("u-1","Whether the two figures cover the same period",{status:"resolved",confidence:"high"}),
|
||||
mkNode("u-2","Whether the percentage changes use comparable baselines"),
|
||||
mkNode("u-4","Whether reporting practices changed")
|
||||
];
|
||||
var T1_edges = [mkEdge("e-1","obs-1","state-1"),mkEdge("e-2","obs-2","state-1"),mkEdge("e-3","rel-1","u-1"),mkEdge("e-4","obs-3","u-1"),mkEdge("e-5","rel-1","u-2")];
|
||||
|
||||
var T2_nodes = [
|
||||
mkNode("obs-1","Complaints increased by 35%",{kind:"observation",status:"known",confidence:"high"}),
|
||||
mkNode("obs-2","Production increased by 40%",{kind:"observation",status:"known",confidence:"high"}),
|
||||
mkNode("obs-3","Both figures cover the same three-month period",{kind:"observation",status:"known",confidence:"high"}),
|
||||
mkNode("obs-4","Complaints rose from 100 to 135; production rose from 1,000 to 1,400 units",{kind:"observation",status:"known",confidence:"high"}),
|
||||
mkNode("state-1","Current situation",{kind:"state",status:"provisional",confidence:"medium"}),
|
||||
mkNode("rel-1","Complaint and production trends are related",{kind:"relationship",status:"known",confidence:"medium"}),
|
||||
mkNode("u-1","Whether the two figures cover the same period",{status:"resolved",confidence:"high"}),
|
||||
mkNode("u-2","Whether the percentage changes use comparable baselines",{status:"resolved",confidence:"medium"}),
|
||||
mkNode("u-3","Whether complaints increased faster than production on a per-unit basis"),
|
||||
mkNode("u-4","Whether reporting practices changed")
|
||||
];
|
||||
var T2_edges = [mkEdge("e-1","obs-1","state-1"),mkEdge("e-2","obs-2","state-1"),mkEdge("e-3","rel-1","u-1"),mkEdge("e-4","obs-3","u-1"),mkEdge("e-5","rel-1","u-2"),mkEdge("e-6","obs-4","u-2"),mkEdge("e-7","obs-4","u-3")];
|
||||
|
||||
var T3_nodes = [
|
||||
mkNode("obs-1","Complaints increased by 35%",{kind:"observation",status:"known",confidence:"high"}),
|
||||
mkNode("obs-2","Production increased by 40%",{kind:"observation",status:"known",confidence:"high"}),
|
||||
mkNode("obs-3","Both figures cover the same three-month period",{kind:"observation",status:"known",confidence:"high"}),
|
||||
mkNode("obs-4","Complaints rose from 100 to 135; production rose from 1,000 to 1,400 units",{kind:"observation",status:"known",confidence:"high"}),
|
||||
mkNode("obs-5","The complaint rate fell from 10 per 1,000 to about 9.6 per 1,000",{kind:"observation",status:"known",confidence:"high"}),
|
||||
mkNode("state-1","Current situation",{kind:"state",status:"provisional",confidence:"medium"}),
|
||||
mkNode("rel-1","Complaint and production trends are related",{kind:"relationship",status:"known",confidence:"medium"}),
|
||||
mkNode("u-1","Whether the two figures cover the same period",{status:"resolved",confidence:"high"}),
|
||||
mkNode("u-2","Whether the percentage changes use comparable baselines",{status:"resolved",confidence:"medium"}),
|
||||
mkNode("u-3","Whether complaints increased faster than production on a per-unit basis",{status:"resolved",confidence:"high"}),
|
||||
mkNode("u-4","Whether reporting practices changed")
|
||||
];
|
||||
var T3_edges = [mkEdge("e-1","obs-1","state-1"),mkEdge("e-2","obs-2","state-1"),mkEdge("e-3","rel-1","u-1"),mkEdge("e-4","obs-3","u-1"),mkEdge("e-5","rel-1","u-2"),mkEdge("e-6","obs-4","u-2"),mkEdge("e-7","obs-4","u-3"),mkEdge("e-8","obs-5","u-3")];
|
||||
|
||||
var T4_nodes = [
|
||||
mkNode("obs-1","Complaints increased by 35%",{kind:"observation",status:"known",confidence:"high"}),
|
||||
mkNode("obs-2","Production increased by 40%",{kind:"observation",status:"known",confidence:"high"}),
|
||||
mkNode("obs-3","Both figures cover the same three-month period",{kind:"observation",status:"known",confidence:"high"}),
|
||||
mkNode("obs-4","Complaints rose from 100 to 135; production rose from 1,000 to 1,400 units",{kind:"observation",status:"known",confidence:"high"}),
|
||||
mkNode("obs-5","The complaint rate fell from 10 per 1,000 to about 9.6 per 1,000",{kind:"observation",status:"known",confidence:"high"}),
|
||||
mkNode("obs-6","Same complaint categories and reporting rules were used throughout",{kind:"observation",status:"known",confidence:"high"}),
|
||||
mkNode("state-1","Current situation",{kind:"state",status:"provisional",confidence:"medium"}),
|
||||
mkNode("rel-1","Complaint and production trends are related",{kind:"relationship",status:"known",confidence:"medium"}),
|
||||
mkNode("u-1","Whether the two figures cover the same period",{status:"resolved",confidence:"high"}),
|
||||
mkNode("u-2","Whether the percentage changes use comparable baselines",{status:"resolved",confidence:"medium"}),
|
||||
mkNode("u-3","Whether complaints increased faster than production on a per-unit basis",{status:"resolved",confidence:"high"}),
|
||||
mkNode("u-4","Whether reporting practices changed",{status:"resolved",confidence:"high"})
|
||||
];
|
||||
var T4_edges = [mkEdge("e-1","obs-1","state-1"),mkEdge("e-2","obs-2","state-1"),mkEdge("e-3","rel-1","u-1"),mkEdge("e-4","obs-3","u-1"),mkEdge("e-5","rel-1","u-2"),mkEdge("e-6","obs-4","u-2"),mkEdge("e-7","obs-4","u-3"),mkEdge("e-8","obs-5","u-3"),mkEdge("e-9","rel-1","u-4"),mkEdge("e-10","obs-6","u-4")];
|
||||
|
||||
var TURNS = [
|
||||
{ nodes:T0_nodes, edges:T0_edges, resolved:[], active:"u-1", question:{ nodeId:"u-1", question:"Were the complaint and production figures measured over the same period?", reason:"If the figures cover different periods, comparing their movement could be misleading.", reasoningPattern:"comparability_check" }, noQReason:null, summary:"Two changes have been reported, but we do not yet know whether the figures are directly comparable." },
|
||||
{ nodes:T1_nodes, edges:T1_edges, resolved:["u-1"], active:"u-2", question:{ nodeId:"u-2", question:"Were both percentages calculated from comparable baseline counts?", reason:"Establishing the reference point for both figures is essential before evaluating their relationship.", reasoningPattern:"baseline_comparability" }, noQReason:null, summary:"The timing basis is now clear." },
|
||||
{ nodes:T2_nodes, edges:T2_edges, resolved:["u-1","u-2"], active:"u-3", question:{ nodeId:"u-3", question:"Did the complaint rate per unit produced improve or worsen?", reason:"Absolute changes in complaints and production are known; the relative rate determines whether the situation improved.", reasoningPattern:"rate_comparison" }, noQReason:null, summary:"The absolute baselines are now known." },
|
||||
{ nodes:T3_nodes, edges:T3_edges, resolved:["u-1","u-2","u-3"], active:"u-4", question:{ nodeId:"u-4", question:"Was there any change in how complaints were recorded during the period?", reason:"The per-unit rate changed; we need to rule out recording artifacts before concluding a genuine shift.", reasoningPattern:"artifact_exclusion" }, noQReason:null, summary:"The per-unit complaint rate improved slightly." },
|
||||
{ nodes:T4_nodes, edges:T4_edges, resolved:["u-1","u-2","u-3","u-4"], active:null, question:null, noQReason:"All required investigation areas are resolved.", summary:"The figures cover the same period, use comparable baselines, show an improved complaint rate, and were recorded consistently." }
|
||||
];
|
||||
|
||||
/* ── fixture builders ─────────────────────────────────────── */
|
||||
|
||||
function buildDefaultFixture(idx) {
|
||||
var d = TURNS[Math.min(idx, TURNS.length - 1)];
|
||||
return {
|
||||
success:true,
|
||||
situationGraph: { centralStatement:"Complaints increased by 35% while production increased by 40%.", currentSummary:d.summary, nodes:d.nodes, edges:d.edges, activeUnknownNodeId:d.active, resolvedNodeIds:d.resolved },
|
||||
selectedQuestion: d.question || null,
|
||||
noQuestionReason: d.noQReason,
|
||||
newlySurfacedNodeIds: [],
|
||||
diagnostics: { promptVersion:"v0.4", modelName:"mock-ollama", responseDurationMs:0, validationStatus:"valid", nodeCount:d.nodes.length, edgeCount:d.edges.length, unknownSelectionExplanation: d.active ? { status:"single_candidate" } : null }
|
||||
};
|
||||
}
|
||||
|
||||
function buildErrorFixture() {
|
||||
return { success:false, situationGraph:null, selectedQuestion:null, noQuestionReason:null, newlySurfacedNodeIds:[], error:"Mock provider error: structured response unavailable.", diagnostics:null };
|
||||
}
|
||||
|
||||
function buildUpdateFixture(scenarioName, idx) {
|
||||
if (scenarioName === "error") {
|
||||
return { success:false, stage:"provider", error:"Mock provider error: structured response unavailable.", providerErrors:["Mock provider error: structured response unavailable."], updatedSituationGraph:null, selectedQuestion:null, affectedNodeIds:[], resolvedUnknownNodeIds:[], changesApplied:null, summary:null, diagnostics:{ promptVersion:"v0.4", modelName:"mock-ollama", responseDurationMs:0 } };
|
||||
}
|
||||
var f = scenarioName === "complete" ? buildDefaultFixture(4) : buildDefaultFixture(idx);
|
||||
return { success:true, stage:"update_applied", updatedSituationGraph:f.situationGraph, selectedQuestion:f.selectedQuestion, affectedNodeIds:[], resolvedUnknownNodeIds:(f.situationGraph.resolvedNodeIds||[]).slice(), changesApplied:{ addedNodeCount:0, updatedNodeCount:0, addedEdgeCount:0, removedEdgeCount:0 }, summary:f.situationGraph.currentSummary||null, diagnostics:f.diagnostics };
|
||||
}
|
||||
|
||||
/* ── delay shim (browser only) ──────────────────────────── */
|
||||
|
||||
function delay(ms) {
|
||||
@@ -163,21 +67,51 @@ function handleStartCase(scenario) {
|
||||
_turnIndex = 0;
|
||||
var scenarioName = getScenario();
|
||||
if (scenarioName === "error") return Promise.resolve({ success:true, data:buildErrorFixture() });
|
||||
return Promise.resolve({ success:true, data:buildDefaultFixture(0) });
|
||||
return Promise.resolve({ success:true, data: buildScenarioFixture(scenarioName, 0) || buildDefaultFallback(0) });
|
||||
}
|
||||
|
||||
function handleUpdateCase(data) {
|
||||
var scenarioName = getScenario();
|
||||
if (scenarioName === "error") return delay(getDelay()).then(function() {
|
||||
return Promise.resolve({ success:true, data:buildUpdateFixture("error",0) });
|
||||
return Promise.resolve({ success:true, data:{ success:false, stage:"provider", error:"Mock provider error: structured response unavailable.", providerErrors:["Mock provider error: structured response unavailable."], updatedSituationGraph:null, selectedQuestion:null, affectedNodeIds:[], resolvedUnknownNodeIds:[], changesApplied:null, summary:null, diagnostics:{ promptVersion:"v0.4", modelName:"mock-ollama", responseDurationMs:0 } } });
|
||||
});
|
||||
_turnIndex++;
|
||||
var idx = scenarioName === "complete" ? 4 : Math.min(_turnIndex, 4);
|
||||
return delay(getDelay()).then(function() {
|
||||
return Promise.resolve({ success:true, data:buildUpdateFixture(scenarioName, idx) });
|
||||
var fixture = buildScenarioFixture(scenarioName, _turnIndex);
|
||||
if (fixture) {
|
||||
return Promise.resolve({
|
||||
success:true, stage:"update_applied",
|
||||
updatedSituationGraph:fixture.situationGraph,
|
||||
selectedQuestion:fixture.selectedQuestion,
|
||||
affectedNodeIds:[],
|
||||
resolvedUnknownNodeIds:(fixture.situationGraph.resolvedNodeIds||[]).slice(),
|
||||
changesApplied:{ addedNodeCount:0, updatedNodeCount:0, addedEdgeCount:0, removedEdgeCount:0 },
|
||||
summary:fixture.situationGraph.currentSummary||null,
|
||||
diagnostics:fixture.diagnostics
|
||||
});
|
||||
}
|
||||
// Fallback to original default if scenario not found
|
||||
return Promise.resolve({ success:true, data:buildUpdateFallback(scenarioName) });
|
||||
});
|
||||
}
|
||||
|
||||
/* ── fallback for when scenarios.js is not available ─────── */
|
||||
|
||||
var _fallbackTurns = [
|
||||
{ nodes:[mkNode("obs-1","Complaints increased by 35%",{kind:"observation",status:"known",confidence:"high"}),mkNode("obs-2","Production increased by 40%",{kind:"observation",status:"known",confidence:"high"}),mkNode("state-1","Current situation",{kind:"state",status:"provisional",confidence:"medium"})], edges:[mkEdge("e-1","obs-1","state-1"),mkEdge("e-2","obs-2","state-1")], resolved:[], active:"u-1", question:{ nodeId:"u-1", question:"Were the complaint and production figures measured over the same period?", reason:"If different periods, comparing movement could be misleading.", reasoningPattern:"comparability_check" }, noQReason:null, summary:"Two changes have been reported, but we do not yet know whether the figures are directly comparable." },
|
||||
{ nodes:[mkNode("obs-1","Complaints increased by 35%",{kind:"observation",status:"known",confidence:"high"}),mkNode("obs-2","Production increased by 40%",{kind:"observation",status:"known",confidence:"high"}),mkNode("obs-3","Both figures cover the same three-month period",{kind:"observation",status:"known",confidence:"high"}),mkNode("state-1","Current situation",{kind:"state",status:"provisional",confidence:"medium"})], edges:[mkEdge("e-1","obs-1","state-1"),mkEdge("e-2","obs-2","state-1"),mkEdge("e-3","obs-3","u-1")], resolved:["u-1"], active:"u-2", question:{ nodeId:"u-2", question:"Were both percentages calculated from comparable baseline counts?", reason:"Establishing the reference point is essential.", reasoningPattern:"baseline_comparability" }, noQReason:null, summary:"The timing basis is now clear." }
|
||||
];
|
||||
|
||||
function buildDefaultFallback(idx) {
|
||||
var d = _fallbackTurns[Math.min(idx, _fallbackTurns.length - 1)];
|
||||
return { success:true, situationGraph:{ centralStatement:"Complaints increased by 35% while production increased by 40%.", currentSummary:d.summary, nodes:d.nodes, edges:d.edges, activeUnknownNodeId:d.active, resolvedNodeIds:d.resolved }, selectedQuestion:d.question||null, noQuestionReason:d.noQReason, newlySurfacedNodeIds:[], diagnostics:{ promptVersion:"v0.4", modelName:"mock-ollama", responseDurationMs:0, validationStatus:"valid", nodeCount:d.nodes.length, edgeCount:d.edges.length } };
|
||||
}
|
||||
|
||||
function buildUpdateFallback(scenarioName) {
|
||||
var f = buildDefaultFallback(Math.min(_turnIndex, _fallbackTurns.length - 1));
|
||||
return { success:true, stage:"update_applied", updatedSituationGraph:f.situationGraph, selectedQuestion:f.selectedQuestion, affectedNodeIds:[], resolvedUnknownNodeIds:(f.situationGraph.resolvedNodeIds||[]).slice(), changesApplied:{ addedNodeCount:0, updatedNodeCount:0, addedEdgeCount:0, removedEdgeCount:0 }, summary:f.situationGraph.currentSummary||null, diagnostics:f.diagnostics };
|
||||
}
|
||||
|
||||
/* ── public intercept function ──────────────────────────── */
|
||||
|
||||
export async function mockFetch(url, options) {
|
||||
@@ -198,3 +132,5 @@ export async function mockFetch(url, options) {
|
||||
|
||||
return fetch(url, options);
|
||||
}
|
||||
|
||||
export { AVAILABLE_SCENARIOS };
|
||||
|
||||
@@ -0,0 +1,373 @@
|
||||
/**
|
||||
* Expanded mock scenario library for the Confidence Engine workspace.
|
||||
* Each scenario produces a complete investigation journey through turns.
|
||||
*
|
||||
* UI-only development work — no reasoning engine changes.
|
||||
*/
|
||||
|
||||
/* ── Node / Edge factories ─────────────────────────────── */
|
||||
|
||||
export function mkN(id, label, opts) {
|
||||
var kind = (opts && opts.kind) || "unknown";
|
||||
var status = (opts && opts.status) || (kind === "unknown" ? "unknown" : "known");
|
||||
var confidence = (opts && opts.confidence) || "low";
|
||||
return {
|
||||
id:id, label:label, description:label, kind:kind, status:status, confidence:confidence,
|
||||
confidenceAssessment:{ evidenceConfidence:confidence, completenessStatus:"partial", conclusionConfidence:confidence },
|
||||
value:(opts && opts.value !== undefined) ? opts.value : null,
|
||||
unit:(opts && opts.unit) || null, evidenceIds:[], dependsOn:[], affects:[], childIds:[]
|
||||
};
|
||||
}
|
||||
|
||||
export function mkE(id, a, b, rel) {
|
||||
var r = rel || "supports";
|
||||
return { id:id, fromNodeId:a, toNodeId:b, relationship:r, confidence:"medium", description:a+" -> "+b };
|
||||
}
|
||||
|
||||
/* ── Scenario: Comparison (product ratings) ───────────── */
|
||||
|
||||
var comparisonTurns = [
|
||||
{
|
||||
centralStatement: "Product A has a 4.2 star average rating while Product B averages 4.6 stars across 10,000+ reviews each.",
|
||||
nodes: [
|
||||
mkN("obs-1","Product A average rating: 4.2 stars",{kind:"observation",status:"known",confidence:"high"}),
|
||||
mkN("obs-2","Product B average rating: 4.6 stars",{kind:"observation",status:"known",confidence:"high"}),
|
||||
mkN("obs-3","Both products have 10,000+ reviews",{kind:"observation",status:"known",confidence:"high"}),
|
||||
mkN("state-1","Comparing two products before purchase decision",{kind:"state",status:"provisional",confidence:"medium"}),
|
||||
mkN("u-1","Whether the rating systems are comparable"),
|
||||
],
|
||||
edges: [mkE("e-1","obs-1","state-1"),mkE("e-2","obs-2","state-1"),mkE("e-3","obs-3","u-1")],
|
||||
resolved:[], active:"u-1",
|
||||
question:{ nodeId:"u-1", question:"Are both products rated on the same validated scale?", reason:"Different rating systems could make direct comparison meaningless.", reasoningPattern:"comparability_check" },
|
||||
noQReason:null, summary:"Two products have been rated highly, but we do not yet know whether their ratings are measured the same way."
|
||||
},
|
||||
{
|
||||
centralStatement: "Product A has a 4.2 star average rating while Product B averages 4.6 stars across 10,000+ reviews each.",
|
||||
nodes: [
|
||||
mkN("obs-1","Product A average rating: 4.2 stars",{kind:"observation",status:"known",confidence:"high"}),
|
||||
mkN("obs-2","Product B average rating: 4.6 stars",{kind:"observation",status:"known",confidence:"high"}),
|
||||
mkN("obs-3","Both products have 10,000+ reviews",{kind:"observation",status:"known",confidence:"high"}),
|
||||
mkN("obs-4","Both use the standard 5-star customer review scale",{kind:"observation",status:"known",confidence:"high"}),
|
||||
mkN("state-1","Comparing two products before purchase decision",{kind:"state",status:"provisional",confidence:"medium"}),
|
||||
mkN("u-1","Whether the rating systems are comparable",{status:"resolved",confidence:"high"}),
|
||||
mkN("u-2","Whether verified purchase reviews differ significantly between the two products"),
|
||||
],
|
||||
edges: [mkE("e-1","obs-1","state-1"),mkE("e-2","obs-2","state-1"),mkE("e-3","obs-3","u-1"),mkE("e-4","obs-4","u-1"),mkE("e-5","obs-3","u-2")],
|
||||
resolved:["u-1"], active:"u-2",
|
||||
question:{ nodeId:"u-2", question:"Do verified purchase reviews show a similar gap between the two products?", reason:"Fake or unverified reviews could inflate ratings.", reasoningPattern:"evidence_quality" },
|
||||
noQReason:null, summary:"The rating scales are comparable. The next uncertainty is review authenticity."
|
||||
},
|
||||
{
|
||||
centralStatement: "Product A has a 4.2 star average rating while Product B averages 4.6 stars across 10,000+ reviews each.",
|
||||
nodes: [
|
||||
mkN("obs-1","Product A average rating: 4.2 stars",{kind:"observation",status:"known",confidence:"high"}),
|
||||
mkN("obs-2","Product B average rating: 4.6 stars",{kind:"observation",status:"known",confidence:"high"}),
|
||||
mkN("obs-3","Both products have 10,000+ reviews",{kind:"observation",status:"known",confidence:"high"}),
|
||||
mkN("obs-4","Both use the standard 5-star customer review scale",{kind:"observation",status:"known",confidence:"high"}),
|
||||
mkN("obs-5","Verified purchase gap remains approximately 0.3 stars in both products' subsets",{kind:"observation",status:"known",confidence:"medium"}),
|
||||
mkN("state-1","Comparing two products before purchase decision",{kind:"state",status:"provisional",confidence:"medium"}),
|
||||
mkN("u-1","Whether the rating systems are comparable",{status:"resolved",confidence:"high"}),
|
||||
mkN("u-2","Whether verified purchase reviews differ significantly",{status:"resolved",confidence:"medium"}),
|
||||
mkN("u-3","Whether the remaining gap reflects genuine quality difference or a niche preference"),
|
||||
],
|
||||
edges: [mkE("e-1","obs-1","state-1"),mkE("e-2","obs-2","state-1"),mkE("e-3","obs-3","u-1"),mkE("e-4","obs-4","u-1"),mkE("e-5","obs-3","u-2"),mkE("e-6","obs-5","u-2"),mkE("e-7","obs-3","u-3")],
|
||||
resolved:["u-1","u-2"], active:"u-3",
|
||||
question:{ nodeId:"u-3", question:"Could the remaining rating difference be explained by product niche rather than quality?", reason:"Different customer segments may have different expectations.", reasoningPattern:"alternative_explanation" },
|
||||
noQReason:null, summary:"Verified reviews confirm the gap is genuine. The remaining question is whether it reflects quality or preference."
|
||||
}
|
||||
];
|
||||
|
||||
/* ── Scenario: Contradictory Evidence ─────────────────── */
|
||||
|
||||
var contradictoryTurns = [
|
||||
{
|
||||
centralStatement: "Two consultants provided opposite recommendations about whether to outsource IT operations.",
|
||||
nodes: [
|
||||
mkN("obs-1","Consultant A recommends outsourcing based on cost savings data",{kind:"observation",status:"known",confidence:"high"}),
|
||||
mkN("obs-2","Consultant B recommends against outsourcing citing quality risks",{kind:"observation",status:"known",confidence:"high"}),
|
||||
mkN("state-1","Making an IT operations decision",{kind:"state",status:"provisional",confidence:"medium"}),
|
||||
mkN("u-1","Whether the consultants are evaluating the same criteria"),
|
||||
],
|
||||
edges: [mkE("e-1","obs-1","state-1"),mkE("e-2","obs-2","state-1")],
|
||||
resolved:[], active:"u-1",
|
||||
question:{ nodeId:"u-1", question:"Are the two consultants using comparable evaluation criteria?", reason:"Contradictory conclusions often stem from different starting assumptions.", reasoningPattern:"comparability_check" },
|
||||
noQReason:null, summary:"Two opposing recommendations exist. Before deciding, we need to know if they are looking at the same thing."
|
||||
},
|
||||
{
|
||||
centralStatement: "Two consultants provided opposite recommendations about whether to outsource IT operations.",
|
||||
nodes: [
|
||||
mkN("obs-1","Consultant A recommends outsourcing based on cost savings data",{kind:"observation",status:"known",confidence:"high"}),
|
||||
mkN("obs-2","Consultant B recommends against outsourcing citing quality risks",{kind:"observation",status:"known",confidence:"high"}),
|
||||
mkN("obs-3","Consultant A focused on short-term cost reduction over 2 years",{kind:"observation",status:"known",confidence:"high"}),
|
||||
mkN("obs-4","Consultant B focused on long-term capability retention over 5+ years",{kind:"observation",status:"known",confidence:"high"}),
|
||||
mkN("state-1","Making an IT operations decision",{kind:"state",status:"provisional",confidence:"medium"}),
|
||||
mkN("u-1","Whether the consultants are evaluating the same criteria",{status:"resolved",confidence:"high"}),
|
||||
mkN("u-2","Which time horizon is appropriate for this organisation"),
|
||||
],
|
||||
edges: [mkE("e-1","obs-1","state-1"),mkE("e-2","obs-2","state-1"),mkE("e-3","obs-3","u-1"),mkE("e-4","obs-4","u-1"),mkE("e-5","obs-3","u-2"),mkE("e-6","obs-4","u-2")],
|
||||
resolved:["u-1"], active:"u-2",
|
||||
question:{ nodeId:"u-2", question:"What time horizon should guide this particular organisation's decision?", reason:"Different horizons produce different valid conclusions.", reasoningPattern:"criteria_alignment" },
|
||||
noQReason:null, summary:"The consultants disagree because they use different timeframes. The real question is which horizon fits."
|
||||
}
|
||||
];
|
||||
|
||||
/* ── Scenario: Missing Evidence ──────────────────────── */
|
||||
|
||||
var missingEvidenceTurns = [
|
||||
{
|
||||
centralStatement: "A hospital wants to determine whether a new patient monitoring system would reduce adverse events.",
|
||||
nodes: [
|
||||
mkN("obs-1","Adverse events have been stable at 2.3% for the past year",{kind:"observation",status:"known",confidence:"high"}),
|
||||
mkN("state-1","Evaluating a new patient monitoring system",{kind:"state",status:"provisional",confidence:"medium"}),
|
||||
mkN("u-1","Whether the current baseline measurement is reliable"),
|
||||
mkN("u-2","Whether similar systems have demonstrated effectiveness elsewhere"),
|
||||
],
|
||||
edges: [mkE("e-1","obs-1","state-1")],
|
||||
resolved:[], active:"u-1",
|
||||
question:{ nodeId:"u-1", question:"How reliably are adverse events currently being measured and reported?", reason:"An unreliable baseline makes any comparison impossible.", reasoningPattern:"measurement_validity" },
|
||||
noQReason:null, summary:"We have a single data point. Before evaluating any new system, we need to trust the starting measurement."
|
||||
},
|
||||
{
|
||||
centralStatement: "A hospital wants to determine whether a new patient monitoring system would reduce adverse events.",
|
||||
nodes: [
|
||||
mkN("obs-1","Adverse events have been stable at 2.3% for the past year",{kind:"observation",status:"known",confidence:"high"}),
|
||||
mkN("obs-2","Adverse event reporting is incident-based and potentially incomplete",{kind:"observation",status:"known",confidence:"medium"}),
|
||||
mkN("state-1","Evaluating a new patient monitoring system",{kind:"state",status:"provisional",confidence:"medium"}),
|
||||
mkN("u-1","Whether the current baseline measurement is reliable",{status:"resolved",confidence:"medium"}),
|
||||
mkN("u-2","Whether similar systems have demonstrated effectiveness elsewhere"),
|
||||
],
|
||||
edges: [mkE("e-1","obs-1","state-1"),mkE("e-2","obs-2","u-1")],
|
||||
resolved:["u-1"], active:"u-2",
|
||||
question:{ nodeId:"u-2", question:"Has comparable monitoring technology been deployed in similar hospitals with measured outcomes?", reason:"Without external evidence, this remains a unique test.", reasoningPattern:"precedent_search" },
|
||||
noQReason:null, summary:"The baseline is uncertain. External evidence would strengthen the case either way."
|
||||
}
|
||||
];
|
||||
|
||||
/* ── Scenario: Evidence Limit (stuck early) ─────────── */
|
||||
|
||||
var evidenceLimitTurns = [
|
||||
{
|
||||
centralStatement: "Should a mid-sized manufacturing company invest in automated quality inspection?",
|
||||
nodes: [
|
||||
mkN("obs-1","Current defect rate is 3.2%",{kind:"observation",status:"known",confidence:"high"}),
|
||||
mkN("obs-2","Re call costs total approximately $400K annually",{kind:"observation",status:"known",confidence:"medium"}),
|
||||
mkN("state-1","Evaluating automated quality inspection investment",{kind:"state",status:"provisional",confidence:"medium"}),
|
||||
mkN("u-1","Whether the total cost of an automation solution is understood"),
|
||||
],
|
||||
edges: [mkE("e-1","obs-1","state-1"),mkE("e-2","obs-2","state-1")],
|
||||
resolved:[], active:"u-1",
|
||||
question:{ nodeId:"u-1", question:"What would a complete automation solution cost including installation and training?", reason:"Without knowing the investment required, feasibility cannot be assessed.", reasoningPattern:"cost_feasibility" },
|
||||
noQReason:null, summary:"Known costs of inaction exist but the cost of action is completely unknown."
|
||||
}
|
||||
];
|
||||
|
||||
/* ── Scenario: Circular Reasoning ───────────────────── */
|
||||
|
||||
var circularTurns = [
|
||||
{
|
||||
centralStatement: "A team argues that Project X should continue because it is strategic, and it is strategic because the team believes in it.",
|
||||
nodes: [
|
||||
mkN("obs-1","The team believes Project X is important to strategy",{kind:"observation",status:"known",confidence:"high"}),
|
||||
mkN("u-1","Whether Project X has independent strategic value beyond team conviction"),
|
||||
],
|
||||
edges: [],
|
||||
resolved:[], active:"u-1",
|
||||
question:{ nodeId:"u-1", question:"What external evidence supports the strategic value of Project X?", reason:"Belief alone cannot establish strategic justification.", reasoningPattern:"circularity_detection" },
|
||||
noQReason:null, summary:"The argument appears circular. We need evidence independent of team conviction."
|
||||
}
|
||||
];
|
||||
|
||||
/* ── Scenario: Decision Investigation ──────────────── */
|
||||
|
||||
var decisionTurns = [
|
||||
{
|
||||
centralStatement: "Should I relocate my engineering team from London to Manchester?",
|
||||
nodes: [
|
||||
mkN("obs-1","Manchester office rental costs are approximately 60% lower than London",{kind:"observation",status:"known",confidence:"high"}),
|
||||
mkN("obs-2","The team has expressed mixed feelings about relocation",{kind:"observation",status:"known",confidence:"medium"}),
|
||||
mkN("state-1","Deciding on engineering team relocation",{kind:"state",status:"provisional",confidence:"medium"}),
|
||||
mkN("u-1","Whether the cost savings offset potential talent retention risks"),
|
||||
],
|
||||
edges: [mkE("e-1","obs-1","state-1"),mkE("e-2","obs-2","state-1")],
|
||||
resolved:[], active:"u-1",
|
||||
question:{ nodeId:"u-1", question:"What would the likely impact on talent retention and recruitment be?", reason:"Cost savings are real but only relevant if the team can still be staffed.", reasoningPattern:"decision" },
|
||||
noQReason:null, summary:"Financial motivation is clear. The remaining question is whether the workforce will remain."
|
||||
},
|
||||
{
|
||||
centralStatement: "Should I relocate my engineering team from London to Manchester?",
|
||||
nodes: [
|
||||
mkN("obs-1","Manchester office rental costs are approximately 60% lower than London",{kind:"observation",status:"known",confidence:"high"}),
|
||||
mkN("obs-2","The team has expressed mixed feelings about relocation",{kind:"observation",status:"known",confidence:"medium"}),
|
||||
mkN("obs-3","Manchester has a growing tech ecosystem with 500+ engineering roles posted monthly",{kind:"observation",status:"known",confidence:"medium"}),
|
||||
mkN("state-1","Deciding on engineering team relocation",{kind:"state",status:"provisional",confidence:"medium"}),
|
||||
mkN("u-1","Whether the cost savings offset potential talent retention risks",{status:"resolved",confidence:"medium"}),
|
||||
mkN("u-2","Whether the cultural transition is manageable for a team of this size"),
|
||||
],
|
||||
edges: [mkE("e-1","obs-1","state-1"),mkE("e-2","obs-2","state-1"),mkE("e-3","obs-3","u-1"),mkE("e-4","obs-2","u-2")],
|
||||
resolved:["u-1"], active:"u-2",
|
||||
question:{ nodeId:"u-2", question:"What support mechanisms would help the team through a geographical transition?", reason:"Mixed feelings are normal but the right support can make it viable.", reasoningPattern:"implementation" },
|
||||
noQReason:null, summary:"Market conditions in Manchester are promising. The remaining question is cultural."
|
||||
}
|
||||
];
|
||||
|
||||
/* ── Scenario: Planning Investigation ─────────────── */
|
||||
|
||||
var planningTurns = [
|
||||
{
|
||||
centralStatement: "We want to launch a new product line within 6 months but have no clear roadmap.",
|
||||
nodes: [
|
||||
mkN("obs-1","Target launch window is Q3",{kind:"observation",status:"known",confidence:"high"}),
|
||||
mkN("state-1","Planning a new product launch",{kind:"state",status:"provisional",confidence:"medium"}),
|
||||
mkN("u-1","Whether the core product design is complete enough to begin production planning"),
|
||||
],
|
||||
edges: [],
|
||||
resolved:[], active:"u-1",
|
||||
question:{ nodeId:"u-1", question:"What stage is the product design currently at?", reason:"Production planning cannot begin until design is stable.", reasoningPattern:"planning" },
|
||||
noQReason:null, summary:"A deadline exists but the product itself has not yet been defined."
|
||||
}
|
||||
];
|
||||
|
||||
/* ── Scenario: Long Investigation (market entry - 10 turns) ─── */
|
||||
|
||||
var longTurns = [
|
||||
{
|
||||
centralStatement: "Should we enter the European market with our SaaS analytics platform?",
|
||||
nodes: [mkN("obs-1","Current revenue is $2M ARR in the US market only",{kind:"observation",status:"known",confidence:"high"}),mkN("state-1","Evaluating European market entry",{kind:"state",status:"provisional",confidence:"medium"}),mkN("u-1","Whether there is genuine demand for our category in Europe")],
|
||||
edges:[mkE("e-1","obs-1","state-1")], resolved:[], active:"u-1",
|
||||
question:{ nodeId:"u-1", question:"How large and mature is the analytics SaaS market in Europe?", reason:"Entering a non-existent or negligible market is not justified.", reasoningPattern:"market_validity" }, noQReason:null, summary:"We are US-based. The first question before any expansion is whether demand exists."
|
||||
},
|
||||
{
|
||||
centralStatement: "Should we enter the European market with our SaaS analytics platform?",
|
||||
nodes: [mkN("obs-1","Current revenue is $2M ARR in the US market only",{kind:"observation",status:"known",confidence:"high"}),mkN("obs-2","European analytics SaaS market valued at approximately €8B and growing 15% annually",{kind:"observation",status:"known",confidence:"medium"}),mkN("state-1","Evaluating European market entry",{kind:"state",status:"provisional",confidence:"medium"}),mkN("u-1","Whether there is genuine demand for our category in Europe",{status:"resolved",confidence:"medium"}),mkN("u-2","Whether our product is suitable for European compliance requirements")],
|
||||
edges:[mkE("e-1","obs-1","state-1"),mkE("e-2","obs-2","u-1")], resolved:["u-1"], active:"u-2",
|
||||
question:{ nodeId:"u-2", question:"Does our platform comply with GDPR and other European data regulations?", reason:"Non-compliance makes market entry legally impossible.", reasoningPattern:"compliance" }, noQReason:null, summary:"Demand exists. The next constraint is regulatory."
|
||||
},
|
||||
{
|
||||
centralStatement: "Should we enter the European market with our SaaS analytics platform?",
|
||||
nodes: [mkN("obs-1","Current revenue is $2M ARR in the US market only",{kind:"observation",status:"known",confidence:"high"}),mkN("obs-2","European analytics SaaS market valued at approximately €8B and growing 15% annually",{kind:"observation",status:"known",confidence:"medium"}),mkN("obs-3","Our platform does not currently support EU data residency requirements",{kind:"observation",status:"known",confidence:"high"}),mkN("state-1","Evaluating European market entry",{kind:"state",status:"provisional",confidence:"medium"}),mkN("u-1","Whether there is genuine demand for our category in Europe",{status:"resolved",confidence:"medium"}),mkN("u-2","Whether our product is suitable for European compliance requirements",{status:"resolved",confidence:"high"}),mkN("u-3","Whether the cost of achieving compliance is justified by the market size")],
|
||||
edges:[mkE("e-1","obs-1","state-1"),mkE("e-2","obs-2","u-1"),mkE("e-3","obs-3","u-2")], resolved:["u-1","u-2"], active:"u-3",
|
||||
question:{ nodeId:"u-3", question:"What investment would it take to achieve full EU data residency compliance?", reason:"We know the market exists and we are non-compliant. The remaining question is cost.", reasoningPattern:"cost_benefit" }, noQReason:null, summary:"Compliance is feasible. The remaining question is cost."
|
||||
},
|
||||
{
|
||||
centralStatement: "Should we enter the European market with our SaaS analytics platform?",
|
||||
nodes: [mkN("obs-1","Current revenue is $2M ARR in the US market only",{kind:"observation",status:"known",confidence:"high"}),mkN("obs-2","European analytics SaaS market valued at approximately €8B and growing 15% annually",{kind:"observation",status:"known",confidence:"medium"}),mkN("obs-3","Our platform does not currently support EU data residency requirements",{kind:"observation",status:"known",confidence:"high"}),mkN("obs-4","Achieving compliance would require approximately 6 months and $500K engineering investment",{kind:"observation",status:"known",confidence:"medium"}),mkN("state-1","Evaluating European market entry",{kind:"state",status:"provisional",confidence:"medium"}),mkN("u-1","Whether there is genuine demand for our category in Europe",{status:"resolved",confidence:"medium"}),mkN("u-2","Whether our product is suitable for European compliance requirements",{status:"resolved",confidence:"high"}),mkN("u-3","Whether the cost of achieving compliance is justified by the market size",{status:"resolved",confidence:"medium"}),mkN("u-4","Whether we have competitive differentiation against existing European players")],
|
||||
edges:[mkE("e-1","obs-1","state-1"),mkE("e-2","obs-2","u-1"),mkE("e-3","obs-3","u-2"),mkE("e-4","obs-4","u-3")], resolved:["u-1","u-2","u-3"], active:"u-4",
|
||||
question:{ nodeId:"u-4", question:"What differentiates our platform against established European competitors?", reason:"Market entry requires more than compliance — we need a reason for customers to switch.", reasoningPattern:"competitive_analysis" }, noQReason:null, summary:"Compliance is feasible. The remaining question is competitive edge."
|
||||
},
|
||||
{
|
||||
centralStatement: "Should we enter the European market with our SaaS analytics platform?",
|
||||
nodes: [mkN("obs-1","Current revenue is $2M ARR in the US market only",{kind:"observation",status:"known",confidence:"high"}),mkN("obs-2","European analytics SaaS market valued at approximately €8B and growing 15% annually",{kind:"observation",status:"known",confidence:"medium"}),mkN("obs-3","Our platform does not currently support EU data residency requirements",{kind:"observation",status:"known",confidence:"high"}),mkN("obs-4","Achieving compliance would require approximately 6 months and $500K engineering investment",{kind:"observation",status:"known",confidence:"medium"}),mkN("obs-5","Our real-time collaboration feature has no direct European equivalent and aligns with EU procurement trends",{kind:"observation",status:"provisional",confidence:"medium"}),mkN("state-1","Evaluating European market entry",{kind:"state",status:"provisional",confidence:"medium"}),mkN("u-1","Whether there is genuine demand for our category in Europe",{status:"resolved",confidence:"medium"}),mkN("u-2","Whether our product is suitable for European compliance requirements",{status:"resolved",confidence:"high"}),mkN("u-3","Whether the cost of achieving compliance is justified by the market size",{status:"resolved",confidence:"medium"}),mkN("u-4","Whether we have competitive differentiation against existing European players",{status:"resolved",confidence:"medium"})],
|
||||
edges:[mkE("e-1","obs-1","state-1"),mkE("e-2","obs-2","u-1"),mkE("e-3","obs-3","u-2"),mkE("e-4","obs-4","u-3"),mkE("e-5","obs-5","u-4")], resolved:["u-1","u-2","u-3","u-4"], active:null,
|
||||
question:null, noQReason:"All investigation areas resolved. A conditional recommendation can be formed.", summary:"European market entry is justified if: compliance is achieved (6 months, $500K), and the real-time collaboration feature is positioned as the differentiator against established competitors."
|
||||
}
|
||||
];
|
||||
|
||||
/* ── Scenario: Complete Investigation (full resolution) ─ */
|
||||
|
||||
var completeTurns = [
|
||||
{
|
||||
centralStatement: "A manufacturing company reports complaints increased by 35% while production increased by 40%.",
|
||||
nodes: [mkN("obs-1","Complaints increased by 35%",{kind:"observation",status:"known",confidence:"high"}),mkN("obs-2","Production increased by 40%",{kind:"observation",status:"known",confidence:"high"}),mkN("state-1","Current situation",{kind:"state",status:"provisional",confidence:"medium"}),mkN("u-1","Whether the two figures cover the same period")],
|
||||
edges:[mkE("e-1","obs-1","state-1"),mkE("e-2","obs-2","state-1")], resolved:[], active:"u-1",
|
||||
question:{ nodeId:"u-1", question:"Were the complaint and production figures measured over the same period?", reason:"If the figures cover different periods, comparing their movement could be misleading.", reasoningPattern:"comparability_check" }, noQReason:null, summary:"Two changes have been reported, but we do not yet know whether the figures are directly comparable."
|
||||
},
|
||||
{
|
||||
centralStatement: "A manufacturing company reports complaints increased by 35% while production increased by 40%.",
|
||||
nodes: [mkN("obs-1","Complaints increased by 35%",{kind:"observation",status:"known",confidence:"high"}),mkN("obs-2","Production increased by 40%",{kind:"observation",status:"known",confidence:"high"}),mkN("obs-3","Both figures cover the same three-month period",{kind:"observation",status:"known",confidence:"high"}),mkN("state-1","Current situation",{kind:"state",status:"provisional",confidence:"medium"}),mkN("rel-1","Complaint and production trends are related",{kind:"relationship",status:"known",confidence:"medium"}),mkN("u-1","Whether the two figures cover the same period",{status:"resolved",confidence:"high"}),mkN("u-2","Whether the percentage changes use comparable baselines")],
|
||||
edges:[mkE("e-1","obs-1","state-1"),mkE("e-2","obs-2","state-1"),mkE("e-3","rel-1","u-1")], resolved:["u-1"], active:"u-2",
|
||||
question:{ nodeId:"u-2", question:"Were both percentages calculated from comparable baseline counts?", reason:"Establishing the reference point for both figures is essential before evaluating their relationship.", reasoningPattern:"baseline_comparability" }, noQReason:null, summary:"The timing basis is now clear."
|
||||
},
|
||||
{
|
||||
centralStatement: "A manufacturing company reports complaints increased by 35% while production increased by 40%.",
|
||||
nodes: [mkN("obs-1","Complaints increased by 35%",{kind:"observation",status:"known",confidence:"high"}),mkN("obs-2","Production increased by 40%",{kind:"observation",status:"known",confidence:"high"}),mkN("obs-3","Both figures cover the same three-month period",{kind:"observation",status:"known",confidence:"high"}),mkN("obs-4","Complaints rose from 100 to 135; production rose from 1,000 to 1,400 units",{kind:"observation",status:"known",confidence:"high"}),mkN("state-1","Current situation",{kind:"state",status:"provisional",confidence:"medium"}),mkN("rel-1","Complaint and production trends are related",{kind:"relationship",status:"known",confidence:"medium"}),mkN("u-1","Whether the two figures cover the same period",{status:"resolved",confidence:"high"}),mkN("u-2","Whether the percentage changes use comparable baselines",{status:"resolved",confidence:"medium"}),mkN("u-3","Whether complaints increased faster than production on a per-unit basis")],
|
||||
edges:[mkE("e-1","obs-1","state-1"),mkE("e-2","obs-2","state-1"),mkE("e-3","rel-1","u-1"),mkE("e-4","obs-3","u-1"),mkE("e-5","rel-1","u-2")], resolved:["u-1","u-2"], active:"u-3",
|
||||
question:{ nodeId:"u-3", question:"Did the complaint rate per unit produced improve or worsen?", reason:"Absolute changes in complaints and production are known; the relative rate determines whether the situation improved.", reasoningPattern:"rate_comparison" }, noQReason:null, summary:"The absolute baselines are now known."
|
||||
},
|
||||
{
|
||||
centralStatement: "A manufacturing company reports complaints increased by 35% while production increased by 40%.",
|
||||
nodes: [mkN("obs-1","Complaints increased by 35%",{kind:"observation",status:"known",confidence:"high"}),mkN("obs-2","Production increased by 40%",{kind:"observation",status:"known",confidence:"high"}),mkN("obs-3","Both figures cover the same three-month period",{kind:"observation",status:"known",confidence:"high"}),mkN("obs-4","Complaints rose from 100 to 135; production rose from 1,000 to 1,400 units",{kind:"observation",status:"known",confidence:"high"}),mkN("obs-5","The complaint rate fell from 10 per 1,000 to about 9.6 per 1,000",{kind:"observation",status:"known",confidence:"high"}),mkN("state-1","Current situation",{kind:"state",status:"provisional",confidence:"medium"}),mkN("rel-1","Complaint and production trends are related",{kind:"relationship",status:"known",confidence:"medium"}),mkN("u-1","Whether the two figures cover the same period",{status:"resolved",confidence:"high"}),mkN("u-2","Whether the percentage changes use comparable baselines",{status:"resolved",confidence:"medium"}),mkN("u-3","Whether complaints increased faster than production on a per-unit basis",{status:"resolved",confidence:"high"}),mkN("u-4","Whether reporting practices changed")],
|
||||
edges:[mkE("e-1","obs-1","state-1"),mkE("e-2","obs-2","state-1"),mkE("e-3","rel-1","u-1"),mkE("e-4","obs-3","u-1"),mkE("e-5","rel-1","u-2"),mkE("e-6","obs-4","u-2"),mkE("e-7","obs-4","u-3")], resolved:["u-1","u-2","u-3"], active:"u-4",
|
||||
question:{ nodeId:"u-4", question:"Was there any change in how complaints were recorded during the period?", reason:"The per-unit rate changed; we need to rule out recording artifacts before concluding a genuine shift.", reasoningPattern:"artifact_exclusion" }, noQReason:null, summary:"The per-unit complaint rate improved slightly."
|
||||
},
|
||||
{
|
||||
centralStatement: "A manufacturing company reports complaints increased by 35% while production increased by 40%.",
|
||||
nodes: [mkN("obs-1","Complaints increased by 35%",{kind:"observation",status:"known",confidence:"high"}),mkN("obs-2","Production increased by 40%",{kind:"observation",status:"known",confidence:"high"}),mkN("obs-3","Both figures cover the same three-month period",{kind:"observation",status:"known",confidence:"high"}),mkN("obs-4","Complaints rose from 100 to 135; production rose from 1,000 to 1,400 units",{kind:"observation",status:"known",confidence:"high"}),mkN("obs-5","The complaint rate fell from 10 per 1,000 to about 9.6 per 1,000",{kind:"observation",status:"known",confidence:"high"}),mkN("obs-6","Same complaint categories and reporting rules were used throughout",{kind:"observation",status:"known",confidence:"high"}),mkN("state-1","Current situation",{kind:"state",status:"provisional",confidence:"medium"}),mkN("rel-1","Complaint and production trends are related",{kind:"relationship",status:"known",confidence:"medium"}),mkN("u-1","Whether the two figures cover the same period",{status:"resolved",confidence:"high"}),mkN("u-2","Whether the percentage changes use comparable baselines",{status:"resolved",confidence:"medium"}),mkN("u-3","Whether complaints increased faster than production on a per-unit basis",{status:"resolved",confidence:"high"}),mkN("u-4","Whether reporting practices changed",{status:"resolved",confidence:"high"})],
|
||||
edges:[mkE("e-1","obs-1","state-1"),mkE("e-2","obs-2","state-1"),mkE("e-3","rel-1","u-1"),mkE("e-4","obs-3","u-1"),mkE("e-5","rel-1","u-2"),mkE("e-6","obs-4","u-2"),mkE("e-7","obs-4","u-3"),mkE("e-8","obs-5","u-3"),mkE("e-9","rel-1","u-4"),mkE("e-10","obs-6","u-4")], resolved:["u-1","u-2","u-3","u-4"], active:null,
|
||||
question:null, noQReason:"All required investigation areas are resolved.", summary:"The figures cover the same period, use comparable baselines, show an improved complaint rate, and were recorded consistently."
|
||||
}
|
||||
];
|
||||
|
||||
/* ── Scenario: Diagnosis (churn) ───────────────────── */
|
||||
|
||||
var diagnosisTurns = [
|
||||
{
|
||||
centralStatement: "Customer churn increased from 2% to 5% monthly over the last quarter.",
|
||||
nodes: [mkN("obs-1","Churn was 2% per month in Q1",{kind:"observation",status:"known",confidence:"high"}),mkN("obs-2","Churn rose to 5% per month in Q3",{kind:"observation",status:"known",confidence:"high"}),mkN("state-1","Diagnosing the cause of increased churn",{kind:"state",status:"provisional",confidence:"medium"}),mkN("u-1","Whether the churn increase is concentrated in a specific customer segment")],
|
||||
edges:[mkE("e-1","obs-1","state-1"),mkE("e-2","obs-2","state-1")], resolved:[], active:"u-1",
|
||||
question:{ nodeId:"u-1", question:"Which customer segments account for the majority of the increased churn?", reason:"A blanket analysis hides which segment is driving the problem.", reasoningPattern:"diagnosis" }, noQReason:null, summary:"Churn has tripled. The first diagnostic step is to identify where it concentrates."
|
||||
}
|
||||
];
|
||||
|
||||
/* ── Registry ─────────────────────────────────────── */
|
||||
|
||||
var SCENARIOS = {
|
||||
"default": { turns: comparisonTurns, label: "Comparison (product ratings)", centralStatement: comparisonTurns[0].centralStatement },
|
||||
"comparison": { turns: comparisonTurns, label: "Comparison (product ratings)", centralStatement: comparisonTurns[0].centralStatement },
|
||||
"contradictory": { turns: contradictoryTurns, label: "Contradictory evidence", centralStatement: contradictoryTurns[0].centralStatement },
|
||||
"missing-evidence": { turns: missingEvidenceTurns, label: "Missing evidence", centralStatement: missingEvidenceTurns[0].centralStatement },
|
||||
"evidence-limit":{ turns: evidenceLimitTurns, label: "Evidence limit (stuck early)", centralStatement: evidenceLimitTurns[0].centralStatement },
|
||||
"circular": { turns: circularTurns, label: "Circular reasoning", centralStatement: circularTurns[0].centralStatement },
|
||||
"decision": { turns: decisionTurns, label: "Decision (team relocation)", centralStatement: decisionTurns[0].centralStatement },
|
||||
"planning": { turns: planningTurns, label: "Planning (product launch)", centralStatement: planningTurns[0].centralStatement },
|
||||
"long": { turns: longTurns, label: "Long investigation (market entry)", centralStatement: longTurns[0].centralStatement },
|
||||
"complete": { turns: completeTurns, label: "Complete investigation", centralStatement: completeTurns[0].centralStatement },
|
||||
"diagnosis": { turns: diagnosisTurns, label: "Diagnosis (churn)", centralStatement: diagnosisTurns[0].centralStatement },
|
||||
};
|
||||
|
||||
/* ── Build a fixture for a named scenario at a given turn index ─ */
|
||||
|
||||
export function buildScenarioFixture(scenarioName, turnIdx) {
|
||||
var s = SCENARIOS[scenarioName];
|
||||
if (!s || !s.turns) return null;
|
||||
var t = s.turns[Math.min(turnIdx, s.turns.length - 1)];
|
||||
return {
|
||||
success: true,
|
||||
situationGraph: {
|
||||
centralStatement: t.centralStatement,
|
||||
currentSummary: t.summary,
|
||||
nodes: t.nodes,
|
||||
edges: t.edges,
|
||||
activeUnknownNodeId: t.active,
|
||||
resolvedNodeIds: t.resolved
|
||||
},
|
||||
selectedQuestion: t.question || null,
|
||||
noQuestionReason: t.noQReason,
|
||||
newlySurfacedNodeIds: [],
|
||||
diagnostics: {
|
||||
promptVersion: "v0.4",
|
||||
modelName: "mock-ollama",
|
||||
responseDurationMs: 0,
|
||||
validationStatus: "valid",
|
||||
nodeCount: t.nodes.length,
|
||||
edgeCount: t.edges.length,
|
||||
investigationStrategy: { key: (t.question && t.question.reasoningPattern) || "default" },
|
||||
unknownSelectionExplanation: t.active ? { status: "single_candidate" } : null
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/* ── List of available scenarios for the scene selector ─ */
|
||||
|
||||
export var AVAILABLE_SCENARIOS = [];
|
||||
for (var key in SCENARIOS) {
|
||||
if (SCENARIOS.hasOwnProperty(key)) {
|
||||
AVAILABLE_SCENARIOS.push({
|
||||
key: key,
|
||||
label: SCENARIOS[key].label,
|
||||
centralStatement: SCENARIOS[key].centralStatement,
|
||||
turnCount: SCENARIOS[key].turns.length
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default SCENARIOS;
|
||||
Reference in New Issue
Block a user