Skip to content

添加可选的代理引擎 / 无 API 密钥模式,同时保留旧有的 API 密钥工作流。#683

Open
Flowershangfromthebranches wants to merge 4 commits into
666ghj:mainfrom
Flowershangfromthebranches:codex/full-agent-engine-refactor
Open

添加可选的代理引擎 / 无 API 密钥模式,同时保留旧有的 API 密钥工作流。#683
Flowershangfromthebranches wants to merge 4 commits into
666ghj:mainfrom
Flowershangfromthebranches:codex/full-agent-engine-refactor

Conversation

@Flowershangfromthebranches

Copy link
Copy Markdown

此 PR 为不想提供模型 API 密钥的 MiroFish 用户添加了可选的代理驱动执行路径。

要点:

  • 添加 AgentRuntime / LLMProvider 抽象。
  • 添加带有 Graphiti + Neo4j 支持的 GraphProvider 抽象。
  • 为桌面代理(例如 Codex、Claude Code、Cursor、Qoder 和 opencode)添加 agent_queue 模式。
  • 添加 MCP 工具和 CLI 命令以实现完整的运行生命周期。
  • 添加具有显式模拟设置(例如 rounds 和 round_unit)的分阶段工作流程模式。
  • 保留 OpenAI 兼容和 Zep 路径作为传统兼容性提供程序。
  • 不供应 Graphiti 源; Graphiti 作为 Python 依赖项安装。
  • Docker 是可选的; Neo4j 可以是本地、Neo4j Desktop、Homebrew、远程或 Docker。

验证运行:

  • uv 运行 pytest -q
  • bash 脚本/smoke_agent_queue_full.sh
  • bash 脚本/smoke_agent_queue_staged.sh
  • bash 脚本/smoke_mcp_full.sh
  • python 脚本/check_provider_boundaries.py

这是为了添加无 API 密钥代理模式,而不是删除现有的 API 密钥工作流程。
无 API key 用户:
桌面 agent -> MCP/CLI -> agent_queue -> 外部 agent 写 response -> MiroFish 继续运行

有 API key 用户:
原 API/legacy provider -> openai_compatible / zep -> 原交互路径

已在trae上试运行,功能完整

When profiles.json lacks agent_id/user_id fields, the backend and Web
Console would fall back to empty strings or "unknown", breaking agent
routing and dropdown rendering.

Add _resolve_agent_id() (Python) and _resolveId() (JS) implementing a
unified fallback chain: agent_id → user_id → name slug → positional
agent_N. Applied consistently across list_agents, get_agent,
send_questionnaire, _simulation_round_structured_input, _profiles_summary,
and Web Console embedded data normalization.

Web Console now refreshes the dropdown from the API when online
(authoritative backend IDs), with normalized embedded profiles as
offline fallback.

Add 12 new tests covering: resolve logic, list_agents/get_agent/ask_agent
fallback IDs, and Web Console HTML generation (no "unknown" values,
embedded profiles carry agent_id).

98 passed, 0 failed. Provider boundary check passed.

🤖 Generated with [Qoder][https://qoder.com]
_resolve_agent_id() produced identical slugs for same-named profiles
(e.g. two "Baidu" → both "baidu"), causing dropdown selection to
always hit the first match. Add _resolve_all_agent_ids() which runs
the same base resolution but appends _2, _3, … suffixes on collision,
guaranteeing every ID in the returned list is unique.

Applied across all call sites: list_agents, get_agent,
send_questionnaire, _simulation_round_structured_input,
_profiles_summary, and Web Console embedded data. JS template
mirrors the same dedup logic client-side.

105 passed, 0 failed. Provider boundary check passed.

🤖 Generated with [Qoder][https://qoder.com]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant