- protocol.py: pydantic models for all AICC message types (envelope, session_init, tool_call, tool_result, event, error, heartbeat) - bridge.py: Bridge with @bridge.tool registration, capability checks, session management, serve_forever - client.py: AICCClient with single background reader (safe on concurrent transports like WebSocket), call_tool, events, manifest - tool.py: @tool decorator with schema generation from type hints - schema.py: JSON Schema generation (str/int/float/bool, list, dict, Optional, pydantic models) - transport: Transport protocol, InProcessTransport, WebSocket client+server - tests: 12 passing (integration, schema, websocket roundtrip) - examples: bridge_minimal.py + agent_minimal.py (verified end-to-end)
21 lines
585 B
Python
21 lines
585 B
Python
"""Transport interface for AICC message passing."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Any, Protocol, runtime_checkable
|
|
|
|
|
|
@runtime_checkable
|
|
class Transport(Protocol):
|
|
"""Pluggable transport for AICC messages.
|
|
|
|
Implementations:
|
|
- aicc.transport.in_process.InProcessTransport
|
|
- aicc.transport.websocket.WebSocketClientTransport / WebSocketServer
|
|
"""
|
|
|
|
async def connect(self) -> None: ...
|
|
async def close(self) -> None: ...
|
|
async def send(self, message: dict[str, Any]) -> None: ...
|
|
async def receive(self) -> dict[str, Any]: ...
|