Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/toad/acp/agent.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import asyncio
from dataclasses import replace
from datetime import datetime
Expand All @@ -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
Expand Down Expand Up @@ -244,9 +244,9 @@
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(
Expand Down
6 changes: 3 additions & 3 deletions src/toad/agent_binding.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions src/toad/goal_interaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/toad/screens/goal_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/native/test_native_goal_owner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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"
Expand Down
8 changes: 4 additions & 4 deletions tests/support/goals.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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
5 changes: 2 additions & 3 deletions tests/textual/test_goal_owner_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@
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,
)
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
Expand All @@ -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,
Expand Down
Loading