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
16 changes: 9 additions & 7 deletions src/agent_comms/acp_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,19 @@ def needs_refresh(self) -> bool:
return True


@dataclass(frozen=True)
class UnavailableCursorObservation(StaleCursorObservation):
class UnavailableExtensionStatus:
"""An ACP extension status that reports unavailable."""

@property
def status(self) -> str:
return "unavailable"


@dataclass(frozen=True)
class UnavailableCursorObservation(UnavailableExtensionStatus, StaleCursorObservation):
pass


@dataclass(frozen=True)
class EmptyCursorObservation(StaleCursorObservation):
@property
Expand Down Expand Up @@ -322,11 +328,7 @@ def feedback(self, supported: bool) -> str:


@dataclass(frozen=True)
class UnavailableQueueProjection(QueueProjection):
@property
def status(self) -> str:
return "unavailable"

class UnavailableQueueProjection(UnavailableExtensionStatus, QueueProjection):
def feedback(self, supported: bool) -> str:
return "Remote queue unavailable (input status unchanged)"

Expand Down
18 changes: 9 additions & 9 deletions src/agent_comms/cli_bridges/claude_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ def tally(self, ledger: SessionLedger) -> None:
"""What this record adds to the session's ledger; most records add nothing."""


class AssistantBlock(TaggedWire, ABC, affix="", declared_name=None):
class AssistantBlock(TaggedWire, affix="", declared_name=None):

@classmethod
def undeclared_tag(cls, tag: str) -> str:
Expand Down Expand Up @@ -877,7 +877,7 @@ def subagent_progress(self) -> tuple[SubagentProgress, ...]:
for progress in block.subagent_progress(self))


class ResultPart(TaggedWire, ABC, affix=""):
class ResultPart(TaggedWire, affix=""):

@abstractmethod
def result_text(self) -> str: ...
Expand All @@ -902,7 +902,7 @@ class KindHeader(WireHeader):
type: str = Field(alias='kind')


class PromptOrigin(TaggedWire, ABC, affix=""):
class PromptOrigin(TaggedWire, affix=""):
"""Who wrote a prompt. Only a person's prompt is shown live as input;
another agent's message is conversation history the live view hides."""
header = KindHeader
Expand All @@ -928,7 +928,7 @@ def delivered(self, text: str) -> tuple[MessageReference, ...]:
return ()


class Prompting(PromptOrigin, ABC, declared_name=None):
class Prompting(PromptOrigin, declared_name=None):
"""An origin whose text is a request to the model."""

def request(self, text: str) -> str:
Expand Down Expand Up @@ -1008,7 +1008,7 @@ def delivered(self) -> tuple[MessageReference, ...]:
return self.origin.delivered(self.prompt_text())


class UserBlock(TaggedWire, ABC, affix=""):
class UserBlock(TaggedWire, affix=""):

def ends_turn(self) -> bool:
return False
Expand Down Expand Up @@ -1188,7 +1188,7 @@ def text(self) -> str:
return '\n'.join(text for block in self.content if (text := block.prompt_text()))


class PromptRecord(ClaudeRecord, TimedRecord, ABC, declared_name=None):
class PromptRecord(ClaudeRecord, TimedRecord, declared_name=None):
"""The first prompt after retirement owns the turn; promptId may be reused."""

promptId: NativeTurnId
Expand Down Expand Up @@ -1270,7 +1270,7 @@ class SubtypeHeader(WireHeader):
type: str = Field(alias='subtype')


class SystemEvent(TaggedWire, ABC, affix=""):
class SystemEvent(TaggedWire, affix=""):
header = SubtypeHeader

@classmethod
Expand Down Expand Up @@ -1413,7 +1413,7 @@ def ends_turn(self) -> bool:
return self.subtype.ends_turn()


class MetadataRecord(ClaudeRecord, ABC, declared_name=None):
class MetadataRecord(ClaudeRecord, declared_name=None):
pass


Expand All @@ -1425,7 +1425,7 @@ class DataFlowRecords(MetadataRecord, declared_name="data-flow-records"):
"""The harness's own record of which tools moved data; no model input or turn boundary."""


class AttachmentPayload(OpenWire, ABC, affix=""):
class AttachmentPayload(OpenWire, affix=""):

@abstractmethod
def updates(self, record: TimedRecord, session: ClaudeSession) -> tuple[RuntimeUpdate, ...]: ...
Expand Down
2 changes: 1 addition & 1 deletion src/agent_comms/cli_bridges/claude_transcript.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ class LedgerFields(WatchReportFields):
ledger: PrintLedgerId


class WatchReport(WatchReportFields, TaggedWire, ABC, affix="", declared_name=None):
class WatchReport(WatchReportFields, TaggedWire, affix="", declared_name=None):
"""What a watch client says up its socket besides its transcript: the messages it may have
shown. A reference is written to the client's ledger before its event is printed, so the
ledger can only overstate what was shown; a message missing from it was never printed."""
Expand Down
2 changes: 1 addition & 1 deletion src/agent_comms/cli_bridges/cli_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def __get_pydantic_core_schema__(
return handler(family.declared_union())


class OpenWire(TaggedWire, ABC, declared_name=None):
class OpenWire(TaggedWire, declared_name=None):
"""A family whose source adds kinds freely: a tag it does not declare decodes as its
member tagged 'foreign', which carries no conversation."""

Expand Down
16 changes: 8 additions & 8 deletions src/agent_comms/cli_bridges/codex_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
from agent_comms.transport.tool_declaration import ToolDeclaration


class UserInput(TaggedWire, ABC, affix=""):
class UserInput(TaggedWire, affix=""):

@property
@abstractmethod
Expand Down Expand Up @@ -258,7 +258,7 @@ class ResumeThread(RequestParams):
excludeTurns: bool = True


class ThreadStatus(TaggedWire, ABC, affix=""):
class ThreadStatus(TaggedWire, affix=""):
"""What Codex says its thread is doing; the bridge reports it on attaching."""

def update(self) -> RuntimeUpdate:
Expand Down Expand Up @@ -378,7 +378,7 @@ def route(self, connection: RpcReplyTarget) -> None:
RPC_RESPONSE = WireModel.adapter(RpcSuccess | RpcRequestFailure | RpcConnectionFailure | RpcNotification)


class Item(TaggedWire, ABC, affix=""):
class Item(TaggedWire, affix=""):
wire_tag: ClassVar[str]

@classmethod
Expand Down Expand Up @@ -471,7 +471,7 @@ def completed(
return self.clientId.completed(self, turn_id, events)


class ToolItem(ToolCallItem, Item, ABC):
class ToolItem(ToolCallItem, Item):
def accumulator(self, started_at: EventTime) -> ToolDraft:
return ToolDraft(started_at, (self.call.started(self.id, started_at.recorded_at('Codex tool start')),))

Expand Down Expand Up @@ -531,7 +531,7 @@ def succeeded(self) -> bool:
return self.status == 'completed' and self.exitCode == 0


class ToolContentPart(TaggedWire, ABC, affix=""):
class ToolContentPart(TaggedWire, affix=""):

@property
@abstractmethod
Expand Down Expand Up @@ -733,7 +733,7 @@ def phase(self) -> TurnPhase:
return ToolRunningPhase(tools=((self.call_id, f'Searching: {self.query}'),))


class PatchChange(TaggedWire, ABC, affix=""):
class PatchChange(TaggedWire, affix=""):

@abstractmethod
def patch(self, path: str, content: str) -> ToolDiff | NoToolDiff: ...
Expand Down Expand Up @@ -936,7 +936,7 @@ def apply(self, stream: ItemStream) -> RuntimeUpdate:
return self.turn.finished()


class ItemNotification(TranscriptNotification, ABC):
class ItemNotification(TranscriptNotification):
turnId: str

@property
Expand All @@ -963,7 +963,7 @@ def apply(self, stream: ItemStream) -> RuntimeUpdate:
completedAtMs=self.completedAtMs).publication()


class TextDelta(ItemNotification, ABC, declared_name=None):
class TextDelta(ItemNotification, declared_name=None):
item_id: NativeItemId = Field(alias='itemId')
delta: str
def section(self) -> int:
Expand Down
7 changes: 3 additions & 4 deletions src/agent_comms/cli_bridges/codex_records.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import hashlib
import json
from abc import ABC
from dataclasses import (
dataclass,
field,
Expand Down Expand Up @@ -90,7 +89,7 @@ def role(cls, value: dict) -> dict:
return {'type': '/'.join(part for part in (value.get('type'), value.get('role')) if part)}


class RolloutItem(OpenWire, ABC, affix=""):
class RolloutItem(OpenWire, affix=""):
header = RolloutItemHeader

def updates(self, state: RolloutState, position: int, timestamp: float) -> tuple[RuntimeUpdate, ...]:
Expand All @@ -107,7 +106,7 @@ class ForeignItem(RolloutItem, declared_name='foreign'):
"""Reasoning, searches and other items that are not portable conversation."""


class MessageItem(RolloutItem, ABC, declared_name=None):
class MessageItem(RolloutItem, declared_name=None):
content: list[ContentPart]

@field_validator('content', mode='before')
Expand Down Expand Up @@ -135,7 +134,7 @@ def updates(self, state: RolloutState, position: int, timestamp: float) -> tuple
return (HiddenItem((AssistantTranscript(self.text, position=position, timestamp=timestamp),)),)


class InstructionMessage(MessageItem, ABC, declared_name=None):
class InstructionMessage(MessageItem, declared_name=None):
"""Instructions the source session ran under: kept as references to their bytes, never as
messages, because they were that session's instructions and are not this thread's."""

Expand Down
14 changes: 7 additions & 7 deletions src/agent_comms/cli_bridges/opencode_parts.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from __future__ import annotations

import builtins
from abc import ABC, abstractmethod
from abc import abstractmethod
from typing import ClassVar, Literal

from pydantic import ConfigDict, Field, JsonValue, model_validator
Expand Down Expand Up @@ -63,7 +63,7 @@ def summary(cls, value: dict) -> dict:
return {'type': value.get('role')}


class MessageInfo(TaggedWire, ABC, affix=""):
class MessageInfo(TaggedWire, affix=""):
header = RoleHeader
id: str
sessionID: str
Expand Down Expand Up @@ -109,7 +109,7 @@ def present(self, part: Part) -> tuple[RuntimeUpdate, ...]:
return (*part.present(self), *part.summarized())


class Part(TaggedWire, ABC, affix=""):
class Part(TaggedWire, affix=""):
id: NativeItemId
sessionID: str
messageID: str
Expand Down Expand Up @@ -137,7 +137,7 @@ class PartTime(WireModel):
end: int | float | None = None


class TextualPart(Part, ABC, declared_name=None):
class TextualPart(Part, declared_name=None):
text: str
time: PartTime | None = None
event_type: ClassVar[builtins.type[LiveTextTranscript]]
Expand Down Expand Up @@ -190,7 +190,7 @@ class StatusHeader(WireHeader):
type: str = Field(alias='status')


class ToolState(TaggedWire, ABC, affix=""):
class ToolState(TaggedWire, affix=""):
header = StatusHeader
input: ToolArguments
def is_finished(self) -> bool:
Expand Down Expand Up @@ -229,7 +229,7 @@ class EndedPartTime(PartTime):
end: int | float = Field(...)


class EndedTool(ToolState, ABC):
class EndedTool(ToolState):
time: EndedPartTime
ok: ClassVar[bool]
def is_finished(self) -> bool:
Expand Down Expand Up @@ -277,7 +277,7 @@ def present(self, message: AssistantMessage) -> tuple[RuntimeUpdate, ...]:
return self.state.present(self, message)


class StructuralPart(Part, ABC, declared_name=None):
class StructuralPart(Part, declared_name=None):
"""Native bookkeeping and input attachments are not assistant transcript items."""
def present(self, message: AssistantMessage) -> tuple[RuntimeUpdate, ...]:
return ()
Expand Down
4 changes: 2 additions & 2 deletions src/agent_comms/cli_bridges/opencode_protocol.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""OpenCode's session events drive both input confirmation and live output."""
from __future__ import annotations

from abc import ABC, abstractmethod
from abc import abstractmethod
from collections.abc import Iterable, Iterator
from itertools import takewhile
from typing import TYPE_CHECKING, ClassVar, Literal
Expand Down Expand Up @@ -88,7 +88,7 @@ class SessionError(WireModel):
error: NativeError | None = None


class SessionStatus(TaggedWire, ABC, affix=""):
class SessionStatus(TaggedWire, affix=""):

@abstractmethod
def publication(self) -> RuntimeUpdate: ...
Expand Down
2 changes: 1 addition & 1 deletion src/agent_comms/cli_bridges/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -1633,7 +1633,7 @@ class DirectDeliveryBridge(TranscriptBridge[BridgeOptions]):
"""A message reference on our wire lines, in the one spelling FieldCodec gives it."""


class MonitorFrame(TaggedWire, ABC, affix=""):
class MonitorFrame(TaggedWire, affix=""):
"""Our line protocol inside the harness's task-notification envelope."""
async def confirm(
self, bridge: TranscriptConfirmsDelivery, record: ObservedMonitor,
Expand Down
15 changes: 10 additions & 5 deletions src/agent_comms/execution/child_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -699,20 +699,25 @@ def from_returncode(cls, code: int) -> ChildOutcome:


@dataclass(frozen=True)
class ExitedOutcome(ChildOutcome):
class ExitCodeSummary:
"""A process exit outcome carrying its integer exit code and summary."""

code: int

@property
def summary(self) -> str:
return f"exited with code {self.code}"


@dataclass(frozen=True)
class ExitedOutcome(ExitCodeSummary, ChildOutcome):
def printed_count(self, stdout: bytes) -> CheckPrinted:
return CheckPrinted.decoded(stdout)

def report_stopped(self, report: Callable[[], None], stop_exits: frozenset[int]) -> None:
if self.code in stop_exits:
report()

@property
def summary(self) -> str:
return f"exited with code {self.code}"

@property
def successful(self) -> bool:
return self.code == 0
Expand Down
Loading
Loading