agent-Specialization/agentskills/agent-build-standard/references/repo-guidelines.md
JOJO 07be7a1061 feat: gracefully stop tool execution on user request
- Remove direct task.cancel() calls, use stop flag instead
- Monitor stop flag every 100ms during tool execution
- Cancel tool task immediately when stop flag is detected
- Return "命令执行被用户取消" as tool result with role=tool
- Save cancellation result to conversation history
- Prevent abrupt task termination, allow graceful shutdown

Changes:
- server/socket_handlers.py: Comment out pending_task.cancel()
- server/tasks.py: Comment out entry['task'].cancel()
- server/chat_flow_tool_loop.py: Add stop flag monitoring loop

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-08 03:50:34 +08:00

760 B
Raw Blame History

项目规范(摘要)

结构与职责

  • main.py 启动 CLI agentweb_server.py 提供 Web UI
  • core/ 负责终端编排,尽量保持 I/O 轻量
  • modules/ 放可复用能力,优先扩展这里
  • utils/ 放 API 客户端与日志工具,优先复用
  • test/ 放集成测试脚本与辅助工具

代码风格

  • Python 3.11+4 空格缩进snake_case
  • 需要类型标注与简短双语 docstring
  • 日志统一使用 utils.logger.setup_logger

前端注意

  • static/src/components/chat/monitor 为虚拟显示器动画层
  • 新场景需对齐 MonitorDirector 与 monitor store

测试建议

  • 优先 pytest,文件名为 test/test_<feature>.py
  • 涉及网络请使用 test/api_interceptor_server.py 代理