Merge remote-tracking branch 'origin/master' into feat/smoother-dialog-history
Project CI / AI game creator shell Rust crates (pull_request) Successful in 1m50s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 4m30s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 4m51s
Project CI / Backend tests (pull_request) Successful in 4m53s
Project CI / Frontend tests (pull_request) Successful in 2m33s
Project CI / AI game creator shell web tests (pull_request) Successful in 2m27s
Project CI / Native shell tests (pull_request) Successful in 5m47s
Project CI / Repository checks (pull_request) Successful in 3m4s
Project CI / AI game creator shell Rust crates (pull_request) Successful in 1m50s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 4m30s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 4m51s
Project CI / Backend tests (pull_request) Successful in 4m53s
Project CI / Frontend tests (pull_request) Successful in 2m33s
Project CI / AI game creator shell web tests (pull_request) Successful in 2m27s
Project CI / Native shell tests (pull_request) Successful in 5m47s
Project CI / Repository checks (pull_request) Successful in 3m4s
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
# 【ADR】退役AGC独立Agent Runtime与CLI执行面-2026-10-02
|
||||
|
||||
状态:已接受
|
||||
|
||||
## 背景
|
||||
|
||||
AGC(`apps/ai-game-creator-shell`)长期同时存在两套「Agent 执行」:正式对话面已经收敛到 DirectProject 单容器(Rust `agent/direct_*` + codex app-server),而 `src-tauri/src/agent/runtime_*`、`agent/prompt.rs`、`agent_native_tools.rs`、`collaboration.rs`、`delegation.rs`、`goal.rs`、`context_compaction.rs`、`isolated_agent.rs`、`tool_plan_handoff/` 这一整套自建 Runtime(runtime driver / protocol / tools / actions / state)仍在编译、测试、注册 Tauri 命令、并以 `project-supervisor` 身份承担自主构建与专业 Agent 编排。
|
||||
|
||||
这套 Runtime 的入口只剩历史沉淀:前端没有任何渲染或调用入口(`ProjectSupervisorView`、Supervisor 运行态面板与专业 Agent 对话已在 2026-09-22 前后退役),`resume/confirm/read_game_creator_agent_runtime*`、`chat_with_game_creator_agent`、`*_agent_goal`、`schedule_game_creator_agent_ready_tasks`、`start_game_creator_supervisor_runtime_task` 等命令没有现役调用方;真实链路只由 `scripts/agent-runtime-real-e2e.mjs`、`agent-runtime-steer-real-e2e.mjs`、`smoke-agent-run-local-provider.mjs`、`llm-transient-fault-proxy.mjs` 等专用 harness 与它自己的 Rust 测试覆盖。外部 Runner(`--agent-runner`)里也跟着背了一份项目 execution-owner、known-roots 和 `runner.status` / `runner.shutdown_if_idle` 的 CLI 面,但其中真正仍在服役的只有编辑器桥与 manifest relay。
|
||||
|
||||
保留它的代价持续存在:一个没有用户入口的执行栈要求每次改动都同步维护四类东西——Rust Runtime 内核与专属测试、Tauri 命令注册与 `scripts/check-config.mjs` 白名单、真实 e2e harness 与 CI 预热 job、以及多份权威文档里按「现役」描述的协议与预算。
|
||||
|
||||
## 决策
|
||||
|
||||
- 自建 Agent Runtime 执行面整体退役,按「从未存在」处理:实现、专属测试、Tauri 命令注册、构建期门禁条目、真实 e2e harness、CI job 与文档承诺一并删除,历史由 Git 保存,不保留 feature flag、双跑路径或墓碑注释。
|
||||
- Rust 删除范围:`agent/runtime_driver/`、`agent/runtime_protocol/`、`agent/runtime_tools/`、`agent/runtime_actions/`、`agent/runtime_state.rs`、`agent/runtime_adapter.rs`、`agent/prompt.rs`、`agent_native_tools.rs`、`collaboration.rs`、`delegation.rs`、`goal.rs`、`context_compaction.rs`、`isolated_agent.rs`、`provider_handoff.rs`、`provider_retry.rs`、`tool_plan_handoff/`、`user_input.rs` 及其 `src/tests/` 下的专属用例与 fixture;`agent/generation/` 只保留现役生成路径(画布 / 资源生成、prompt 上下文装载、pass artifact 落盘与 trace),`generation/run_lifecycle.rs`、`generation/role_briefs.rs`、`generation/tests.rs` 一并删除。
|
||||
- Tauri 命令退役:`control_agent_run`、`generate_local_game_draft`、`chat_with_game_creator_agent`、`chat_with_game_creator_role_agent(_stream)`、`start/read/edit/pause/resume/clear_game_creator_agent_goal`、`start_game_creator_supervisor_runtime_task`、`compact_game_creator_agent_runtime_context`、`cancel/retry/confirm_retry/confirm/reject_game_creator_agent_runtime_task`、`answer_game_creator_agent_runtime_user_input`、`read_game_creator_agent_runtime(s)`、`resume/confirm_resume_game_creator_agent_runtime_tasks`、`schedule_game_creator_agent_ready_tasks` 全部移出 `desktop.rs` 的 `generate_handler!` 与 `check-config.mjs` 白名单;`agent` 会话命令(`list/create/fork/set_active/archive_game_creator_agent_session`)继续保留。
|
||||
- CLI 退役:`--agent-run` / `--agent-enqueue` / `--agent-steer` / `--agent-resume` / `--agent-context-compact` / `--agent-goal-*` / `--agent-task` / `--agent-runner-status` / `--runner-shutdown-if-idle` 与其 CLI 解析、配置目录要求、测试一并删除;`CliCommand` 收敛为 `LlmStatus | EnvironmentCheck | PreviewServe`。`--agent-runner` 模式与 `--gui-owner-required` 保留。
|
||||
- 外部 Runner 收缩:`runner/project_owner.rs`、项目 execution-owner / known-roots 注册表、`runner.status`、read-only configure、跨启动 owner 认领与 `shutdown_if_idle` 的项目级语义全部删除;Runner 现在只剩编辑器桥 RPC(`*.editor.rpc` / `*.editor.ack` / `*.editor.mark_uncertain`)与 `runner.attach_gui_owner` + GUI owner 参与锁 / watchdog。`runner.rs` 顶部保留 `TODO(retire-runner)` 记录「等编辑器执行收进 GUI 进程后可整体退役」的规划。
|
||||
- 前端退役:删除 `agentRuntimeById` 状态与 `read_game_creator_agent_runtimes` / `resume_game_creator_agent_runtime_tasks` / `confirm_resume_game_creator_agent_runtime_tasks` 调用链、`features/agent-runtime/model.ts` 中只服务 Runtime 投影的归一化/合并/格式化函数、`app/types.ts` 的 `AgentRuntime*` / `AgentGoal*` / `GameCreatorAgentRuntimeUpdateEvent` 类型、`AgentStatusCard` 的 `runtime*` 字段与 `features/project-summary/agentPresentation.ts` 的 `projectAgentRuntimeSummaries` / `formatAgentCardRuntimeStatus`,以及 `onAgentRuntimeSummariesChange` / `activeProjectAgentRuntimeSummaries` 在 app-shell、WorkspaceLauncher、`view/project-development` 与 `App.tsx` 的透传。
|
||||
- harness 与 CI 退役:删除 `apps/ai-game-creator-shell/scripts/agent-runtime-real-e2e/`、`agent-runtime-real-e2e.mjs`、`agent-runtime-steer-real-e2e.mjs`、`smoke-agent-run-local-provider.mjs`、`llm-transient-fault-proxy.mjs` 与 `tests/llmTransientFaultProxy.test.ts`;`scripts/check-native-shells.mjs` 去掉 `agc-rust-smoke` 分组,`.gitea/workflows/project-ci.yml` 去掉 `ai-game-creator-shell-rust-smoke` job,root / App `package.json` 去掉全部 `agent-*` / `agent-runtime:*` / `agent-run:smoke` 脚本,缓存维护脚本同步去掉对应 job 名。
|
||||
|
||||
## 备选方案与取舍
|
||||
|
||||
1. **只删前端入口,保留 Rust Runtime 与命令**:命令与 Runtime 内核继续编译、测试、进白名单,等于把「没有用户入口的执行栈」永久固化,正是本次要消除的成本。
|
||||
2. **保留 Runtime 作为「本地 CLI 能力」**:`--agent-*` 与 `runner.status` 只服务真实 e2e harness,没有产品路径;保留它就要继续维护 harness、CI job 和缓存预热,收益为零。
|
||||
3. **保留兼容别名或 feature flag**:没有现役调用方、公开契约或持久化数据需要兼容,兼容层只会把死词汇表留在解析与注册层。
|
||||
4. **连带退役编辑器桥与 `--agent-runner`**:编辑器 RPC、回执确认、不确定执行 fence 与 Windows 作业对象隔离目前仍依赖独立进程托管,一次性搬进 GUI 是独立的较大重构(见 `runner.rs` 的 `TODO(retire-runner)`),不在本次范围。
|
||||
|
||||
## 影响
|
||||
|
||||
- 产品可见行为不变:正式对话、资源工作台、生成与编辑器链路本来就不经过自建 Runtime;删除后项目运行态由 DirectProject 自己的订阅与缓存(`projectResourceLiveUpdateModel` 等)持有,专业 Agent 状态卡片只从 manifest + run trace 推导。
|
||||
- AGC Rust crate 的编译面与测试面显著缩小(删除 140 个源文件),`cargo check` / 分片测试不再需要 Runtime fixture、Goal sidecar、Supervisor 协作与 tool-plan handoff 用例。
|
||||
- 术语收敛:「Runtime」在 AGC 里此后指 DirectProject / codex app-server 执行面,「Supervisor」不再是正式运行身份;后续文档与注释不得再按现役描述自建 Runtime。
|
||||
- 新增门禁边界:`scripts/check-config.mjs` 的 native-only 白名单不得再收留已删命令;退役概念不新增守卫测试或字符串钉桩,防止回归依靠「没有解析层 / 没有注册」的架构边界。
|
||||
- 保留项:AGC 会话命令、项目权限策略词汇表、DirectProject 的 `enqueue_direct_codex_turn` / `cancel_direct_codex_turn` 链路、编辑器桥(`runner.attach_gui_owner`、participant lock、watchdog)与 `--agent-runner` 模式均不受影响。
|
||||
|
||||
## 验证
|
||||
|
||||
- `cd apps/ai-game-creator-shell/src-tauri && cargo check --tests --bin genarrative-ai-game-creator-shell`、`cargo test --bin genarrative-ai-game-creator-shell runner::`。
|
||||
- `cd apps/ai-game-creator-shell && node scripts/check-config.mjs`、`npx tsc -p tsconfig.json --noEmit`。
|
||||
- `npx vitest run apps/ai-game-creator-shell/tests/appSurface.test.ts` 与 `npx vitest run scripts/project-ci-workflow.test.ts`。
|
||||
- `git diff --check`、`npm run check:encoding`。
|
||||
Reference in New Issue
Block a user