diff --git a/src/toad/acp/agent.py b/src/toad/acp/agent.py index a2853bb31..db02cf442 100644 --- a/src/toad/acp/agent.py +++ b/src/toad/acp/agent.py @@ -14,7 +14,7 @@ from agent_comms.goal_actions import GoalAction from agent_comms.goal_presentation import GoalSnapshot, IdleGoalExecution from agent_comms.goals import Goal, GoalDeclaration, NoGoal -from agent_comms.runtime_requests import GoalHistoryReply +from agent_comms.goal_history import RecordedGoalHistory from agent_comms.ui_model.observation import ReadOwnerGoal from toad import paths @@ -244,9 +244,9 @@ async def get_goal_snapshot(self) -> GoalSnapshot: consumer.dispatch_sync(fact) return snapshot - async def get_goal_history(self, goal_id: str) -> GoalHistoryReply: + async def get_goal_history(self, goal_id: str) -> RecordedGoalHistory: result = await self.controller.request_owner("goal_history", goal_id=goal_id) - return FieldCodec.decode(GoalHistoryReply, result) + return FieldCodec.decode(RecordedGoalHistory, result) async def edit_goal(self, goal: Goal, text: str) -> Goal: result = await self.controller.request_owner( diff --git a/src/toad/agent_binding.py b/src/toad/agent_binding.py index 29a7a33a7..1b8989060 100644 --- a/src/toad/agent_binding.py +++ b/src/toad/agent_binding.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING from agent_comms.thread_presentation import ThreadPresentation -from agent_comms.runtime_requests import GoalHistoryReply +from agent_comms.goal_history import RecordedGoalHistory from textual.content import Content from toad.acp.agent_configuration import AgentConfiguration @@ -170,8 +170,8 @@ def accepts_failed_input(self, message: CoreEventMessage) -> bool: def send_now(self, owner: ConversationSubmissions) -> None: """No remote queue is bound.""" - async def get_goal_history(self, goal_id: str) -> GoalHistoryReply: - return GoalHistoryReply.empty() + async def get_goal_history(self, goal_id: str) -> RecordedGoalHistory: + return RecordedGoalHistory.empty() async def update_goal(self, action: type[GoalAction], text: str): raise ValueError("Persistent goals require an agent-comms session") diff --git a/src/toad/goal_interaction.py b/src/toad/goal_interaction.py index f3b560757..25838a437 100644 --- a/src/toad/goal_interaction.py +++ b/src/toad/goal_interaction.py @@ -8,7 +8,7 @@ from agent_comms.declared_family import DeclaredFamily from agent_comms.goal_actions import ClearGoalAction, GoalAction from agent_comms.goal_presentation import ControlledExecution, GoalExecution -from agent_comms.runtime_requests import GoalHistoryReply +from agent_comms.goal_history import RecordedGoalHistory if TYPE_CHECKING: from toad.widgets.conversation import Conversation @@ -46,7 +46,7 @@ async def apply(cls, session: GoalSession) -> None: from toad.screens.goal_details import GoalDetails view = session.view goal, agent = view.goal_display.snapshot.require(), view.agent_binding - history: GoalHistoryReply = await agent.get_goal_history(goal.id) + history: RecordedGoalHistory = await agent.get_goal_history(goal.id) if not session.owns(agent): return details = GoalDetails(session, history=history) diff --git a/src/toad/screens/goal_details.py b/src/toad/screens/goal_details.py index 2dc808c81..905851b41 100644 --- a/src/toad/screens/goal_details.py +++ b/src/toad/screens/goal_details.py @@ -4,7 +4,7 @@ from datetime import datetime -from agent_comms.runtime_requests import GoalHistoryReply +from agent_comms.goal_history import RecordedGoalHistory from textual.app import ComposeResult from textual.containers import Vertical, VerticalScroll from toad.screens.modal import DismissibleScreen @@ -30,7 +30,7 @@ class GoalDetails(CoreEventReceiver, ProjectPathOwner, DismissibleScreen[None]): GoalDetails Button { dock: bottom; margin-top: 1; } """ - def __init__(self, source: GoalSession, *, history: GoalHistoryReply): + def __init__(self, source: GoalSession, *, history: RecordedGoalHistory): super().__init__() self.source = source self.history = history.history diff --git a/tests/native/test_native_goal_owner.py b/tests/native/test_native_goal_owner.py index 122974c2d..8fc1016d1 100644 --- a/tests/native/test_native_goal_owner.py +++ b/tests/native/test_native_goal_owner.py @@ -2,7 +2,7 @@ import pytest from agent_comms.goal_actions import SetGoalAction -from agent_comms.runtime_requests import GoalHistoryReply +from agent_comms.goal_history import RecordedGoalHistory from support.native import native_session @@ -28,7 +28,7 @@ async def test_editing_a_goal_keeps_its_identity_and_refuses_a_stale_edit(worksp assert comms.registry.require(session).goal == changed with pytest.raises(ValueError): await agent.edit_goal(first, "Stale overwrite") - history: GoalHistoryReply = await agent.get_goal_history(changed.id) + history: RecordedGoalHistory = await agent.get_goal_history(changed.id) assert any(entry.after.shows_document and entry.after.require().text == "First objective" for entry in history.history) assert any(entry.before.shows_document and entry.before.require().text == "First objective" diff --git a/tests/support/goals.py b/tests/support/goals.py index 99237058d..62923fe8c 100644 --- a/tests/support/goals.py +++ b/tests/support/goals.py @@ -10,7 +10,7 @@ from agent_comms.goal_states import ActiveGoal from agent_comms.goals import Goal, GoalDeclaration from agent_comms.registry_document import RegistrySnapshot -from agent_comms.runtime_requests import GoalHistoryReply +from agent_comms.goal_history import RecordedGoalHistory from agent_comms.threads import Thread from toad.acp.agent import Agent @@ -38,7 +38,7 @@ class ScriptedGoalOwner(Agent): receives a canned active/runnable reply; this fixture does not implement Core's transitions. """ - def __init__(self, *args, goal: GoalDeclaration, execution: GoalExecution, history: GoalHistoryReply, + def __init__(self, *args, goal: GoalDeclaration, execution: GoalExecution, history: RecordedGoalHistory, **kwargs): super().__init__(*args, **kwargs) self.goal, self.execution, self.history = goal, execution, history @@ -48,7 +48,7 @@ def __init__(self, *args, goal: GoalDeclaration, execution: GoalExecution, histo @classmethod def owning(cls, app: ToadApp, goal: GoalDeclaration, execution: GoalExecution, *, - history: GoalHistoryReply = GoalHistoryReply.empty()) -> ScriptedGoalOwner: + history: RecordedGoalHistory = RecordedGoalHistory.empty()) -> ScriptedGoalOwner: """The goal owner of ``app``, built through the app's own Agent constructor.""" return AppAgents(app).agent(cls, AgentDefinition("goal-owner", "goal-owner", {"*": "true"}), "goal-owner", goal=goal, execution=execution, history=history) @@ -69,6 +69,6 @@ async def edit_goal(self, expected, text): self.goal = replace(self.goal, text=text, revision=self.goal.revision + 1) return self.goal - async def get_goal_history(self, goal_id: str) -> GoalHistoryReply: + async def get_goal_history(self, goal_id: str) -> RecordedGoalHistory: assert goal_id == self.goal.id return self.history diff --git a/tests/textual/test_goal_owner_views.py b/tests/textual/test_goal_owner_views.py index fcbdd615b..18a78e60c 100644 --- a/tests/textual/test_goal_owner_views.py +++ b/tests/textual/test_goal_owner_views.py @@ -7,7 +7,7 @@ from agent_comms.field_codec import TurnId from agent_comms.goal_failure_observation import FailedTurnEvidence from agent_comms.goal_history import ( - RecordedGoalRevision, BaselineRevision, TransitionRevision, ObservedGapRevision, + RecordedGoalHistory, RecordedGoalRevision, BaselineRevision, TransitionRevision, ObservedGapRevision, ) from agent_comms.goal_presentation import ( GoalWaitTarget, IdleGoalExecution, PausedExecution, RunnableExecution, StandbyExecution, @@ -15,7 +15,6 @@ from agent_comms.goal_states import PausedGoal from agent_comms.goals import NoGoal from agent_comms.repo import Checkout -from agent_comms.runtime_requests import GoalHistoryReply from agent_comms.thread_identity import RecordedThreadIncarnation from agent_comms.turn_failure import NativeChildSignaled from textual.widgets import Button, Static @@ -36,7 +35,7 @@ def goal_owner(workspace, app): execution = StandbyExecution(goal.id, (GoalWaitTarget(RecordedThreadIncarnation("peer", 1.0)),), ()) baseline = replace(goal, text="HISTORICAL_OBJECTIVE", revision=1) transitioned = replace(goal, revision=2) - history = GoalHistoryReply(( + history = RecordedGoalHistory(( RecordedGoalRevision(sequence=1, kind=BaselineRevision, observed_at=1000.0, before=NoGoal(), after=baseline), RecordedGoalRevision(sequence=2, kind=TransitionRevision, observed_at=1001.0,