Implement JSONL RPC envelope for agent-orchestrator communication

未关闭
#688 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
35/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
rust

调研方向

Start by reading docs/runtime-taskd-rpc-spec.md and item 1.3 in cto-executive-system/plans/adf-architecture-improvements.md, then inspect the Claude stream-json and Codex agent communication paths. Done means the proposed envelope, idempotency, typed errors, state recovery, and graceful Codex fallback are implemented across the listed integrations.

由索引模型根据 Issue 内容生成。

描述

enhancement

Context

ADF currently communicates with agents via unstructured stdout/stderr pipes. This causes:

  • SIGPIPE kills when stderr pipe is dropped
  • Fragile text parsing for cost/session/status extraction
  • No message framing, idempotency, or error typing

Proposal

Implement a JSONL envelope protocol inspired by Piwork's taskd RPC spec (docs/runtime-taskd-rpc-spec.md).

Envelope Format

Agent -> Orchestrator (event):

{"type": "event", "event": "cost_update", "agent": "security-sentinel", "ts": "...", "payload": {...}}

Orchestrator -> Agent (command, future):

{"id": "req_01", "type": "pause", "payload": {"reason": "budget_exceeded"}}
Key Properties
  • Strict envelope: {type, event/id, payload} (payload required even if empty)
  • Idempotency: duplicate request IDs with same payload produce no duplicate effects
  • Typed error codes with retryable flag
  • State recovery: runtime_get_state equivalent after reconnect
Integration
  • For Claude agents: wrap --output-format stream-json events in ADF envelope
  • For Codex agents: gracefully degrade to unstructured mode
  • New agents: require envelope support as spawn prerequisite
Benefits
  • Foundation for cost tracking (#638), session persistence (#639), activity log (#641)
  • Eliminates SIGPIPE bug (structured framing detects incomplete messages)
  • Enables future Agent SDK migration

References

主要语言
Rust
星标
62
派生
5
平均合并
2 小时 27 分钟
30 天内合并 PR
1

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

terraphim/terraphim-ai 的其他 Issue

查看 terraphim/terraphim-ai 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。