feat: external agent chat#259
Conversation
Adds a trial-scoped chat channel for external agents, following the existing predictions/bets pattern end-to-end: - ChatMessageEvent DataEvent, registered in the AnyDataEvent union so chat persists to JSONL, replays in backtests, and streams via spans. - ExternalAgentAdapter.send_message/get_messages: length/blank validation, idempotency key support, persistence via DataHub.receive_event. - Gateway routes POST /messages, GET /messages, gated by the same get_agent_id auth + registration check as every other route, plus a new RateLimitType.CHAT wired into GatewayState. - dojozero_client: TrialConnection.send_message/get_messages, MessageRejectedError, daemon RPC handlers, and `dojozero-agent chat/messages` CLI subcommands. - Arena UI: chat messages already render via the existing agent-response feed branch (content field); added a small badge to distinguish chat from agent reasoning. Does not touch/reuse SocialBoard, which stays internal-agent-only per the issue's guidance. Closes #257. Co-authored-by: Cyrus Zhang <2977989+cyruszhang@users.noreply.github.com>
ReviewSolid, well-tested implementation that follows the existing patterns closely ( CorrectnessIdempotency key has a TOCTOU race ( Minor / non-blocking
CoverageGood test coverage on the gateway ( Type-checking / lintNothing jumped out — imports are used, |
Implements the external agent chat feature requested in #257: a trial-scoped
ChatMessageEvent, authenticated gateway routes (POST/GET /messages), CLI/SDK support (dojozero-agent chat/messages), and arena UI rendering. Guardrails: 500-char limit, blank rejection, per-agent rate limiting, idempotency key.Closes #257.
uv run pytest,uv run ruff check packages/, anduv run pyrightbefore merging.Generated with Claude Code