- NrfDevAgent(nrf-dev):nRF54L15 低功耗 BLE 固件专项,注入 Zephyr/NCS 约束 - Esp32DevAgent(esp32-dev):ESP32S3 毫米波+语音适老辅助固件专项 - MarketSportAgent(market-sport):运动健康市场洞察专项 - MarketElderAgent(market-elder):适老辅助市场洞察专项 - MarketSafetyAgent(market-safety):边缘 AI 安全市场洞察专项 - executor._make_agent() 新增 5 个 role 路由分支 - tests/test_hardware_agents.py:4 个测试(全通过) - tests/test_market_specialist_agents.py:4 个测试(全通过) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
54 lines
1.6 KiB
Python
54 lines
1.6 KiB
Python
from __future__ import annotations
|
|
|
|
import pytest
|
|
from unittest.mock import MagicMock
|
|
|
|
from nmfs_agents.agents.nrf_dev import NrfDevAgent
|
|
from nmfs_agents.agents.esp32_dev import Esp32DevAgent
|
|
from nmfs_agents.config import AgentsConfig, ClaudeConfig
|
|
from nmfs_agents.core.queue import Task
|
|
from nmfs_agents.tools.project_memory import ProjectMemory
|
|
|
|
|
|
def _cfg():
|
|
cfg = MagicMock(spec=AgentsConfig)
|
|
cfg.projects = {}
|
|
cfg.claude = ClaudeConfig(model="claude-sonnet-4-6", api_key=None)
|
|
cfg.devices = {}
|
|
return cfg
|
|
|
|
|
|
def _task(role: str) -> Task:
|
|
return Task(
|
|
project="p", type="fix_bug", title="t",
|
|
priority=1, mode="auto", agent_role=role,
|
|
)
|
|
|
|
|
|
def test_nrf_dev_context_contains_platform_info():
|
|
agent = NrfDevAgent(_cfg())
|
|
ctx = agent._build_context(_task("nrf-dev"))
|
|
assert "nRF54L15" in ctx or "BLE" in ctx or "运动健康" in ctx
|
|
|
|
|
|
def test_esp32_dev_context_contains_platform_info():
|
|
agent = Esp32DevAgent(_cfg())
|
|
ctx = agent._build_context(_task("esp32-dev"))
|
|
assert "ESP32" in ctx or "mmWave" in ctx or "适老" in ctx
|
|
|
|
|
|
def test_executor_routes_nrf_dev(tmp_path):
|
|
from nmfs_agents.core.executor import _make_agent
|
|
|
|
mem = ProjectMemory(db_path=tmp_path / "m.db")
|
|
agent = _make_agent(_cfg(), _task("nrf-dev"), mem)
|
|
assert isinstance(agent, NrfDevAgent)
|
|
|
|
|
|
def test_executor_routes_esp32_dev(tmp_path):
|
|
from nmfs_agents.core.executor import _make_agent
|
|
|
|
mem = ProjectMemory(db_path=tmp_path / "m.db")
|
|
agent = _make_agent(_cfg(), _task("esp32-dev"), mem)
|
|
assert isinstance(agent, Esp32DevAgent)
|