agent-fleet/openspec/changes/agent-fleet-platform/specs/agent-adapter/spec.md
Zer4tul aabd52ed52 init: OpenSpec project scaffolding with proposal, design, specs, tasks
- 7 capabilities: agent-registry, task-router, receipt-protocol,
  forgejo-integration, matrix-chatops, agent-adapter, orchestrator-core
- Tech stack: Rust + axum + zigbuild (single binary)
- Forgejo as task source of truth
- Matrix as real-time ChatOps layer
- Adapter pattern for multi-agent type support
2026-05-11 14:37:43 +08:00

41 lines
1.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## ADDED Requirements
### Requirement: Unified adapter interface
系统 SHALL 定义统一的 Agent Adapter 接口,所有类型的 Agent 通过实现该接口接入编排系统。
Adapter 接口 SHALL 至少包含:
- `register()` — 注册到 Registry
- `heartbeat()` — 发送心跳
- `execute(task)` — 接收并执行任务
- `submit_receipt(receipt)` — 提交 receipt
- `deregister()` — 注销
#### Scenario: Claude Code adapter implementation
- **WHEN** 使用 Claude Code adapter
- **THEN** `execute(task)` SHALL 将任务 prompt 注入 `claude -p --output-format json`,在工作目录中执行,解析输出为 receipt
#### Scenario: Codex CLI adapter implementation
- **WHEN** 使用 Codex adapter
- **THEN** `execute(task)` SHALL 使用 `codex exec --json` 执行任务,解析输出为 receipt
#### Scenario: OpenClaw adapter implementation
- **WHEN** 使用 OpenClaw adapter
- **THEN** `execute(task)` SHALL 通过 OpenClaw gateway API 或 CLI 触发 agent 执行
#### Scenario: ACP-compatible agent adapter
- **WHEN** 使用 ACP adapter
- **THEN** `execute(task)` SHALL 通过 ACP 协议启动 agent session传递任务 prompt收集输出
### Requirement: Adapter configuration
每个 Agent 实例 SHALL 通过配置文件指定 adapter 类型、连接参数、工作目录、环境变量。
#### Scenario: Configuration file format
- **WHEN** Agent 实例配置为 Claude Code 类型
- **THEN** 配置文件 SHALL 包含:`{adapter: "claude-code", work_dir: "/path/to/repo", model: "sonnet", max_concurrency: 2, capabilities: ["code:typescript", "review"]}`
### Requirement: Adapter health check
Adapter SHALL 提供健康检查能力:检查底层 Agent 是否可用CLI 是否安装、API 是否可达)。
#### Scenario: Claude Code CLI not found
- **WHEN** Claude Code adapter 初始化时检测到 `claude` CLI 未安装
- **THEN** Adapter SHALL 返回健康检查失败Agent 注册 SHALL 被拒绝