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
9 changes: 3 additions & 6 deletions src/toad/acp/agent_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions src/toad/core/context_inspection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down
12 changes: 0 additions & 12 deletions src/toad/owner_preparation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Loading