Skip to content

feat: 落地 Agent 三模式与审批流水线 - #27

Merged
SATA260 merged 21 commits into
mainfrom
feat/agent-modes
Sep 14, 2026
Merged

SATA260 merged 21 commits into
mainfrom
feat/agent-modes

Conversation

@SATA260

@SATA260 SATA260 commented Sep 14, 2026

Copy link
Copy Markdown
Owner

Summary

  • 三个内置 Agent(ask / plan / agent)共用全量工具表,mode 只冻可执行 Names 与一条 developer 模式规则。
  • 审批改成流水线:工具默认 + 参数校验 → 本 Agent Names → Agent Effects 表 → manual / auto / yolo。目录外必须 ask,Agent 表和 yolo 都不能抬成 allow。
  • auto 开单后由独立复审模型填单,失败则升级给人。前端拆成工作模式与审批两个菜单。

Closes #20

Test plan

  • cd server && go test ./...
  • pnpm test:client
  • ask 只能只读问答;plan 只能写 .cursor/*.md
  • agent + manual:写文件开审批;拒绝或单个工具失败不打死 Run
  • agent + yolo:工作区内写文件直接执行,目录外仍要审批
  • agent + auto:复审失败时升级成人工审批

SATA260 and others added 18 commits September 12, 2026 22:39
- 在 `coordinator.go` 中实现了 Agent 状态的创建、会话标记、作业投递、步骤领取、状态加载、事实追加、步骤提交、取消请求和活跃恢复等功能。
- 删除了 `map.go` 文件,移除了不再使用的映射函数。
- 更新 `memory_index.go` 和 `worker.go`,优化了索引压缩和作业执行逻辑。
- 在 `persist.go` 中简化了数据库操作,移除了冗余的事件发布逻辑。
- 新增了测试文件 `fixture_test.go`,为 API 和运行时提供了基础测试框架。

相关功能尚待完善,包括数据库写入和事件发布的完整实现。后续将继续优化和扩展功能。
- 新增 `coordinator_test.go` 和 `runtime_more_test.go` 文件,包含对 Agent 状态管理功能的全面测试。
- 在 `coordinator.go` 中实现了 Agent 状态的创建、会话标记、步骤领取等功能,并优化了状态加载逻辑。
- 更新 `worker.go`,增强了作业执行和取消请求的处理。
- 在 `map.go` 中添加了数据库映射函数,简化了数据操作。

相关功能的测试用例确保了 Agent 的稳定性和可靠性,后续将继续扩展功能和测试覆盖率。
- 在 `index.ts` 中新增 `isRecoverableRun` 和 `RECOVERABLE_RUN_STATUSES`,以支持可恢复运行状态的管理。
- 在 `client.ts` 中实现 `getRun` 和 `continueRun` 方法,允许获取和继续运行。
- 更新 `types.ts`,定义 `Run` 接口及相关状态,增强类型安全。
- 在 `chat-page.tsx` 和 `session-sidebar.tsx` 中添加恢复按钮,提升用户交互体验。
- 在 `use-session-timeline.ts` 中实现恢复逻辑,支持自动检测可恢复的运行状态。

这些改进提升了系统的稳定性和用户体验,后续将继续优化相关功能。
- 修改 `package.json` 中的开发脚本,使用 `concurrently` 同时启动 API 和 Web 服务,提升开发效率。
- 在 `pnpm-lock.yaml` 中添加 `concurrently` 作为开发依赖,确保环境一致性。
- 更新 `README.md`,明确一条命令同时启动 API 和 Web 的使用说明。
- 在 `core` 包中新增审批相关功能,包括 `listApprovals` 和 `getApproval` 方法,增强审批管理。
- 在 `chat` 相关模块中添加审批处理逻辑,支持审批记录的应用与决策。

这些改进提升了开发体验和审批功能的可用性,后续将继续优化相关功能。
- 在 `conversation-timeline.tsx` 中实现用户消息的编辑功能,允许用户修改排队中的消息内容。
- 在 `router.go` 中新增 PATCH 路由以支持消息更新。
- 在 `message.go` 中实现 `UpdateMessage` 方法,处理消息内容的更新逻辑。
- 添加 `message_update_test.go` 测试文件,验证只有排队中的消息可以被编辑,并确保其他状态的消息编辑请求被拒绝。
- 更新数据库查询以支持消息内容的更新。

这些改进增强了用户交互体验,后续将继续优化消息管理功能。
- 在 `architecture.md` 中更新了关于同一会话的活动运行管理逻辑,确保在已有活动时返回 409 错误。
- 在 `core` 包中新增 `joinQueuedTexts` 函数,处理待发送文本的合并逻辑。
- 更新 `package.json` 中的测试脚本,添加对 `queue.test.ts` 的支持。
- 在 `chat` 模块中移除不再使用的 `updateMessage` 方法,简化代码。
- 新增 `queue.test.ts` 测试文件,验证 `joinQueuedTexts` 函数的正确性。
- 在 `ui` 组件中调整了文本样式,提升用户界面的可读性。

这些改进提升了消息处理的灵活性和用户体验,后续将继续优化相关功能。
- 在 `client.ts` 中新增 `archiveSession` 方法,支持归档会话。
- 在 `session-sidebar.tsx` 中添加删除按钮,允许用户删除会话并确认操作。
- 更新 `use-session-list.ts` 中的 `removeSession` 方法,处理会话删除逻辑并刷新会话列表。
- 在 `chat-page.tsx` 中实现会话删除后的处理逻辑,确保用户体验流畅。

这些改进增强了会话管理功能,提升了用户交互体验。
创建会话时在 Handler 冻结 workspace_id,Git 带 session_id 时用该目录;未设 DB_DSN 时 SQLite 写仓根 data/。

Co-authored-by: Cursor <cursoragent@cursor.com>
把 read/write/edit/ls/grep/find/bash/powershell 和 plan_* 接到 Ports,Inspect 拦目录外路径;工作区写入 Current working directory。

Co-authored-by: Cursor <cursoragent@cursor.com>
三个内置 Agent 共用全量工具表,mode 只冻可执行 Names 与模式规则;目录外路径必须审批,yolo 也不能抬成放行。

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: d1eeb76a-8838-4ff5-acaf-26864b42a4b6


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@SATA260 SATA260 changed the title Feat/agent modes feat: 落地 Agent 三模式与审批流水线 Sep 14, 2026
Co-authored-by: Cursor <cursoragent@cursor.com>
## Summary
- 更新 `callToolsBatch` 方法以支持在自动审批模式下先进行复审,复审通过后直接执行工具,未通过则等待人工审批。
- 添加 `reviewThenDispatch` 函数以处理复审逻辑,确保在自动模式下的工具事件不会提前触发。
- 修改相关测试用例以验证新的自动审批逻辑和工具事件的正确性。

## Test plan
- [ ] 运行所有单元测试以确保新逻辑的正确性。
- [ ] 验证在自动审批模式下,工具事件的触发顺序符合预期。

Closes #26
## Summary
- 新增 `TestReviewerPromptStatesCriteria` 测试用例,验证复审提示中包含的状态信息。
- 更新 `reviewerPrompt` 函数,详细描述审核标准和输出格式,确保提示内容更清晰。

## Test plan
- [ ] 运行所有单元测试以验证新测试用例的正确性。
- [ ] 确保 `reviewerPrompt` 输出符合预期的审核标准和格式。
@SATA260
SATA260 merged commit ea21f84 into main Sep 14, 2026
3 checks passed
@SATA260
SATA260 deleted the feat/agent-modes branch September 17, 2026 07:21
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.

[Module] Agent 三工作模式与四层逐级审批流水线

1 participant