Phase 2 Testing: AgentRegistry + Mock Adapter #236

Closed
opened 2026-04-29 04:33:33 +00:00 by xiaoju · 0 comments
Owner

验证目标

AgentRegistry 从 nerve.yaml 读取 agents 配置,按名字返回 AgentFn。Echo adapter 用于测试。

前置条件

Phase 1 (#235) 完成。在 packages/daemon 中工作。

测试步骤

  • Step 1: AgentRegistry 创建

    const registry = createAgentRegistry(config.agents);
    const agentFn = registry.get("developer");
    

    预期: 返回 AgentFn,不返回 null

  • Step 2: 不存在的 agent 报错

    registry.get("nonexistent");
    

    预期: throw Error,消息包含 agent name

  • Step 3: Echo adapter 工作

    const fn = registry.get("test-agent"); // type: echo
    const result = await fn("hello world", context);
    

    预期: result === "hello world"

  • Step 4: 多个 agent 独立配置
    预期: registry.get("developer") 和 registry.get("ops") 返回不同 AgentFn 实例

  • Step 5: AbortSignal 在 context 中可访问
    预期: echo adapter 接收到 context.signal

验证完成标准

所有 checkbox 打勾 | pnpm test 通过

Ref: #234

## 验证目标 AgentRegistry 从 nerve.yaml 读取 agents 配置,按名字返回 AgentFn。Echo adapter 用于测试。 ## 前置条件 Phase 1 (#235) 完成。在 `packages/daemon` 中工作。 ## 测试步骤 - [ ] **Step 1: AgentRegistry 创建** ```ts const registry = createAgentRegistry(config.agents); const agentFn = registry.get("developer"); ``` **预期:** 返回 AgentFn,不返回 null - [ ] **Step 2: 不存在的 agent 报错** ```ts registry.get("nonexistent"); ``` **预期:** throw Error,消息包含 agent name - [ ] **Step 3: Echo adapter 工作** ```ts const fn = registry.get("test-agent"); // type: echo const result = await fn("hello world", context); ``` **预期:** result === "hello world" - [ ] **Step 4: 多个 agent 独立配置** **预期:** registry.get("developer") 和 registry.get("ops") 返回不同 AgentFn 实例 - [ ] **Step 5: AbortSignal 在 context 中可访问** **预期:** echo adapter 接收到 context.signal ## 验证完成标准 ✅ 所有 checkbox 打勾 | ✅ `pnpm test` 通过 Ref: #234
This repo is archived. You cannot comment on issues.
No Label
1 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/nerve#236