diff --git a/src/toad/acp/agent_controller.py b/src/toad/acp/agent_controller.py index 91057609d..bee74363d 100644 --- a/src/toad/acp/agent_controller.py +++ b/src/toad/acp/agent_controller.py @@ -21,6 +21,7 @@ ) from agent_comms.acp_failure import ACPFailure, RequestFailure from agent_comms.coordination_errors import Refused +from agent_comms.runtime import RuntimeConnection, socket_path from agent_comms.transcripts import TranscriptReadIdentity from agent_comms.ui_model.delivery import DeliveryView from agent_comms.ui_model.observation import ReadDeliveryOverview @@ -390,10 +391,6 @@ async def _cancel_prompt(self, authority: ClientSessionRequest): async def request_owner(self, method: str, **params: JsonValue): if self.coordination is None: raise ValueError("This action requires an agent-comms thread.") - from agent_comms.runtime import RuntimeProxy, socket_path - - from toad.owner_preparation import OwnerRequestContext - coordination = self.coordination authority = ClientSessionRequest(self.agent, self.agent.session_id) self.require_owner(coordination, authority) @@ -403,8 +400,8 @@ def resolve(): owner = comms.registry.require(coordination.thread.name) if owner.incarnation != coordination.thread: raise ValueError("The owner incarnation changed while preparing the request.") - return RuntimeProxy( - OwnerRequestContext(comms), owner.name, socket_path(comms.root, owner.require_process().pid) + return RuntimeConnection( + comms, owner.incarnation, socket_path(comms.root, owner.require_process().pid) ) proxy = await asyncio.to_thread(resolve) diff --git a/src/toad/core/context_inspection.py b/src/toad/core/context_inspection.py index bda453d71..bdbcee116 100644 --- a/src/toad/core/context_inspection.py +++ b/src/toad/core/context_inspection.py @@ -15,7 +15,7 @@ from agent_comms.field_codec import FieldCodec from agent_comms.importing import ImportedSessionMetadata from metaclass_registry.mro_dispatch import handles -from agent_comms.native_turn_context import NativeContextData +from agent_comms.pi_payloads import NativeContextData from agent_comms.pi_payloads import PiMessage from agent_comms.presentation import ReadState from agent_comms.registry_document import RegistryEntry @@ -539,7 +539,7 @@ def read( page = comms.contexts.page(owner, comms.registry, cursor=cursor, previous=previous) annotations = WorkingMemoryAnnotations.for_context( - comms.root / "coordination.sqlite3", + comms.registry.store.coordinator_reader, tuple(resource.value for resource in page.resources), JevClassifier.version()) imported = ImportedSessionMetadata.sources_for_owner(comms.registry, thread) inspection_type = ThreadInspectionSource().project_value(entry.status) @@ -622,7 +622,7 @@ async def _request(self, action: str, **parameters: JsonValue | tuple[int, ...]) if owner.incarnation != self.owner.incarnation: raise ValueError("Selected context thread incarnation changed") process = owner.require_process() - connection = RuntimeConnection(self.service, owner.name, socket_path(self.service.root, process.pid)) + connection = RuntimeConnection(self.service, owner.incarnation, socket_path(self.service.root, process.pid)) try: return await connection.request(action, **parameters) finally: diff --git a/src/toad/owner_preparation.py b/src/toad/owner_preparation.py index 559d689f2..6e1e41886 100644 --- a/src/toad/owner_preparation.py +++ b/src/toad/owner_preparation.py @@ -62,18 +62,6 @@ def from_binding(cls, binding: ThreadOwnerBinding) -> OwnerPlan: return cls().project_value(binding) -@dataclass(frozen=True, slots=True) -class OwnerRequestContext: - """Supply the core proxy's service contract without capturing a UI widget. - - The proxy still resolves and validates the live owner before sending. This - object supplies only the revision-aware reader, never cached goal/delivery - state or an alternative authority for request routing. - """ - - _comms: Comms - - def read_thread_presentation(comms: Comms, name: str) -> ThreadPresentation: """Read the existing core presentation on a worker, without UI dependencies.""" return comms.views.thread_presentations((name,)).read(name)