feat(ui): RTO.31 ownership of focused contributions flows to scenario form
- Add focusedContributions state + appendFocusedContribution callback in ScenarioForm - Contributions persist through session lifecycle (save/restore/restart) - Pass onFocusedContribution and focusedContributions to ReasoningWorkspace - Call onFocusedContribution on successful deconstruct with full result shape - Test: contribution sequence, field preservation, same/different target coexistence
This commit is contained in:
@@ -840,6 +840,8 @@ export default function ReasoningWorkspace({
|
||||
onAnswerSubmit,
|
||||
lastSubmittedAnswer,
|
||||
onRestart,
|
||||
focusedContributions,
|
||||
onFocusedContribution,
|
||||
}) {
|
||||
const [investigationHistory, setInvestigationHistory] = useState([]);
|
||||
const turnCounter = useRef(0);
|
||||
@@ -869,9 +871,10 @@ export default function ReasoningWorkspace({
|
||||
selectedQuestion: result.selectedQuestion,
|
||||
summary: result.summary || propUnderstanding,
|
||||
updatedAt: new Date().toISOString(),
|
||||
focusedContributions,
|
||||
});
|
||||
}
|
||||
}, [updateStatus, result]);
|
||||
}, [updateStatus, result, focusedContributions]);
|
||||
|
||||
// Capture the current selected question at submit time (not from a stale ref)
|
||||
const capturePendingTurn = (selectedQuestion, answerText) => {
|
||||
@@ -1049,6 +1052,20 @@ export default function ReasoningWorkspace({
|
||||
|
||||
if (!data.success) throw new Error(data.error || "Deconstruction failed");
|
||||
|
||||
// Persist contribution to case-level owner (ScenarioForm)
|
||||
onFocusedContribution?.({
|
||||
targetNodeId,
|
||||
targetLabel: targetNode?.label || "",
|
||||
targetDescription: targetNode?.description || "",
|
||||
question: focused.question,
|
||||
answer: answerText,
|
||||
observations: data.observations,
|
||||
uncertainties: data.uncertainties,
|
||||
assumptions: data.assumptions,
|
||||
relationships: data.relationships,
|
||||
possibleFollowUpQuestions: data.possibleFollowUpQuestions,
|
||||
});
|
||||
|
||||
setProcessingStep("idle");
|
||||
setFocusedInvestigations((prev) => ({
|
||||
...prev,
|
||||
|
||||
Reference in New Issue
Block a user