feat(brain): keep how each answer was made (records, tools, plan, thinking, tool calls)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -31,6 +31,9 @@ notes : Optional[object]
|
||||
screen : Optional[object]
|
||||
v2: the app's screen backend for the asker (screen_view.spec.md). None means the screenView
|
||||
tool is not offered.
|
||||
trace : Optional[list]
|
||||
v2: where the engine writes down how it made this answer (history.spec.md, "Traces"): the
|
||||
tools it was given, the plan, the model's thinking and each tool call. None records nothing.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -50,6 +53,22 @@ def reset() -> None:
|
||||
_state.schedule = None
|
||||
_state.notes = None
|
||||
_state.screen = None
|
||||
_state.trace = None
|
||||
|
||||
|
||||
def set_trace(steps: Optional[list]) -> None:
|
||||
_state.trace = steps
|
||||
|
||||
|
||||
def get_trace() -> Optional[list]:
|
||||
return getattr(_state, "trace", None)
|
||||
|
||||
|
||||
def trace(kind: str, **data) -> None:
|
||||
"""Add one step to this turn's trace, if one is kept."""
|
||||
steps = get_trace()
|
||||
if steps is not None:
|
||||
steps.append({"kind": kind, **data})
|
||||
|
||||
|
||||
def set_screen(backend) -> None:
|
||||
|
||||
Reference in New Issue
Block a user