Commit Graph

290 Commits

Author SHA1 Message Date
朱潮
05744cb9f4 批量保存聊天记录 2026-01-19 09:44:57 +08:00
朱潮
3b438d8ab7 优化输出 2026-01-18 22:04:36 +08:00
朱潮
f9ba3c8e51 添加聊天记录查询 2026-01-18 12:29:20 +08:00
朱潮
fa3e30cc07 docker file 2026-01-18 10:27:14 +08:00
朱潮
de3d5f6bf1 修改docker-compsoe 2026-01-18 10:10:34 +08:00
朱潮
20d5e96986 feat: 添加 PostgreSQL 支持用于 checkpoint 存储
- 添加 postgres:16-alpine 服务配置
- 配置 CHECKPOINT_DB_URL 环境变量
- 添加服务依赖和健康检查

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 00:32:23 +08:00
朱潮
723b249e42 增加2个系统级别的skill 2026-01-16 23:05:30 +08:00
朱潮
90117b41fe 修复符号链接的问题,和deep_agent提示词 2026-01-13 14:22:44 +08:00
朱潮
174a5e2059 deep_agent支持 checkpoint 2026-01-11 00:08:19 +08:00
朱潮
b93c40d5a5 merge 2026-01-08 23:10:09 +08:00
朱潮
d45079ca55 feat: 将system_prompt解析从markdown代码块改为XML标签格式
- agent_config.py: enable_thinking判断从 ```guideline 改为 <guidelines>
- fastapi_utils.py:
  - preamble解析从 ```preamble``` 改为 <preamble>
  - guidelines/tools/scenarios/terms 块解析从 markdown 格式改为 XML 标签格式
  - 移除不再使用的 parse_guidelines_text 函数

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 22:56:43 +08:00
朱潮
5a4aee91ab merge 2026-01-08 22:28:10 +08:00
朱潮
43ca06f591 修复system_prompt 2026-01-08 22:24:58 +08:00
朱潮
c1bf679166 enable_thinking 2026-01-08 18:03:21 +08:00
朱潮
37958291ae Merge branch 'rag_receive_top_k' 2026-01-08 17:28:59 +08:00
朱潮
fc5c1adaaa feat(mcp): add top_k optional parameter to RAG retrieve tool 2026-01-08 17:27:35 +08:00
朱潮
68a4578554 feat(skills): add skill deletion endpoint
- Add DELETE /api/v1/skill/remove endpoint
- Add validate_skill_name() for path traversal protection
- Include path normalization and security checks
- Prevent deletion of official skills (user skills only)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-07 21:34:16 +08:00
朱潮
ac8782e1a7 docs(solutions): add SSE error handling solution documentation
Add comprehensive documentation for the SSE stream termination fix:
- Problem analysis and root cause
- Step-by-step solution with code examples
- Security considerations (__debug__ vulnerability)
- Code simplification recommendations
- Prevention strategies and best practices
- Testing and monitoring guidelines

Location: docs/solutions/runtime-errors/sse-mcp-tool-error-handling.md

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-07 20:25:50 +08:00
朱潮
b8e57b2f51 feat(skills): add security hardening to skill upload endpoint
- Add ZipSlip path traversal protection (validate all file paths)
- Add file size limits (50MB upload, 500MB extracted)
- Add zip bomb protection (max 100:1 compression ratio, 1000 entries)
- Add async I/O using aiofiles to avoid blocking event loop
- Add bot_id validation to prevent path traversal attacks
- Add proper error cleanup on upload failures

Security improvements:
- P1-001: ZipSlip path traversal防护
- P1-004: File size limits (50MB)
- P1-005: Zip bomb防护 (compression ratio check)
- P1-008: Async I/O improvements

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-07 20:25:37 +08:00
朱潮
b3303ef8e6 refactor(sse): simplify error handling and remove __debug__ security issue
- Remove __debug__ conditional that exposed tracebacks in production
- Simplify error response structure to {"error": str(e)}
- Remove redundant exception handling in init_agent()
- Remove unnecessary traceback logging
- Reduce code from ~30 lines to ~10 lines

Fixes security vulnerability where __debug__ is always True
unless Python runs with -O flag, causing full tracebacks
to be sent to clients in production.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-07 20:24:30 +08:00
朱潮
342932030f feat(skills): add skill management API module
- Create new skill_manager.py with list and upload endpoints
- Add GET /api/v1/skill/list to retrieve official and user skills
- Add POST /api/v1/skill/upload for skill file upload
- Parse SKILL.md frontmatter to extract name and description
- Move skill upload endpoint from files.py to skill_manager.py
- Add SKILLS_DIR configuration to settings.py
- Register skill_manager router in fastapi_app.py

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-07 19:45:04 +08:00
朱潮
8a85e9025e fix(sse): properly handle MCP tool errors and send error responses to client
- Enhance exception handling in agent_task() to capture and send structured error messages via SSE stream
- Add [DONE] marker to outer exception handler to ensure proper stream termination
- Improve MCP tool loading error handling in init_agent() to prevent cascading failures
- Add detailed error logging with traceback for debugging

Fixes RemoteProtocolError that occurred when MCP tool calls failed,
which previously caused incomplete chunked read errors and connection drops.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-07 19:24:28 +08:00
朱潮
f74f09c191 fix(skills): improve skill extraction and handling logic
- Refactor _extract_skills_to_robot to accept bot_id instead of robot_dir
  - Add multi-directory skill search with priority order
  - Switch from zip extraction to direct directory copying
  - Add rag-retrieve skill directory
2026-01-07 14:56:10 +08:00
朱潮
92c82c24a4 feat(skills): add skill file upload API endpoint
Add new POST endpoint /api/v1/skills/upload for uploading skill zip files.
The endpoint:
- Accepts zip files with bot_id parameter
- Validates file format (must be .zip)
- Saves zip to projects/uploads/{bot_id}/skill_zip/
- Automatically extracts to projects/uploads/{bot_id}/skills/{skill_name}/
- Returns success response with file and extract paths

This enables programmatic skill deployment for specific bots.
2026-01-07 14:47:25 +08:00
朱潮
1233bdda0c ♻️ refactor(deep-agent): customize agent memory middleware path display
- Change workspace_root from ~/.deepagents/{bot_id} to projects/robot/{bot_id}
- Refactor CustomSkillsMiddleware to support user and project skills separately
- Update skill path formatting for better visibility in system prompts
- Remove unused symlink_utils module and related setup code
- Clean up imports in fastapi_app.py and utils/__init__.py
2026-01-07 12:05:40 +08:00
朱潮
8bb8c3fbc8 add scripts/ 2026-01-04 17:19:03 +08:00
朱潮
e7f6378f6b system_prompt_deep_agent 2026-01-04 16:45:24 +08:00
朱潮
96f5079bf9 📝 docs(deep-agent): remove directory access restriction from system prompt
Remove the CRITICAL section about directory access restrictions.
Path handling guidance is still maintained.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 21:02:34 +08:00
朱潮
8c67630bbd ♻️ refactor(deep-agent): customize agent memory middleware path display
Override AgentMemoryMiddleware to simplify agent directory display.
The CustomAgentMemoryMiddleware shows "." instead of full path.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 21:00:49 +08:00
朱潮
a6f166d51e refactor: simplify path displays and remove sensitive config data
- Add CustomSkillsMiddleware to show ./skills instead of full paths
- Enable virtual_mode for FilesystemBackend in local mode
- Display "." instead of ~/.deepagents/{bot_id} in system prompt
- Remove backend_host and masterkey from robot project config

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 20:30:44 +08:00
朱潮
7c9e270a66 feat(deep-agent): add custom workspace_root support for shell commands
- Add create_custom_cli_agent function to support custom workspace_root
- Set shell workspace to ~/.deepagents/{bot_id} for deep_agent type
- Pass system_prompt to create_custom_cli_agent for proper context
- Fix duplicate <env> tag in system_prompt_deep_agent.md

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 18:18:38 +08:00
朱潮
49a0447f9f 🔧 chore(deep-agent): disable shell feature by default
Set enable_shell=False to disable shell command execution capabilities
in the deep agent for security reasons.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 16:59:33 +08:00
朱潮
fbbf0c0653 fix(file-manager): fix create-folder API to accept JSON request body
The create_folder endpoint was incorrectly defined to accept query
parameters instead of JSON request body, causing 400 errors when
called from the frontend.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 16:52:07 +08:00
朱潮
306cebd8f1 refactor(project-manager): simplify project path resolution logic
- Remove complex symlink resolution in _get_robot_dir
- Simplify skills source directory path calculation
- Remove project_path parameter from create_project_directory call

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 16:27:46 +08:00
朱潮
78c413f4ea feat(robot): add default rag-retrieve skill for catalog/deep agents
When skills parameter is empty or None and robot_type is
catalog_agent or deep_agent, automatically load rag-retrieve skill.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 13:42:24 +08:00
朱潮
766b9becda feat(deep-agent): add skills support and improve project structure
- Add skills parameter to ChatRequest for skill file processing
- Extract and unzip skill files to robot project skills directory
- Add robot_config.json with bot_id and environment variables
- Update symlink setup to skip if ~/.deepagents already exists
- Enhance system prompt with directory access restrictions
- Refactor _get_robot_dir to handle symlink paths correctly

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 13:21:58 +08:00
朱潮
c808517f02 fix(file-manager): preserve project/prompt prefix in nested directories
修复文件管理 API 中路径计算问题。当点击第三级目录时,由于
PROJECTS_DIR 是相对路径而 item 是绝对路径,导致 relative_to()
失败返回绝对路径,从而使前端丢失前缀。

使用 PROJECTS_DIR.resolve() 作为基准确保正确计算相对路径。

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 09:37:54 +08:00
朱潮
e00f99c5c5 catalog_agent 转换为deep_agent 2025-12-30 19:35:31 +08:00
朱潮
0ea3009910 add libpq-dev 2025-12-24 21:26:34 +08:00
朱潮
03925bb075 add requirements 2025-12-24 20:58:37 +08:00
朱潮
0e6b2f1511 add CHECKPOINT_DB_URL 2025-12-24 20:43:10 +08:00
朱潮
7a21df05a3 add PROFILE env 2025-12-24 12:51:12 +08:00
朱潮
b86a8364e9 db 2025-12-24 11:05:10 +08:00
朱潮
e117f1ee07 新增checkpoint清理机制 2025-12-24 00:12:01 +08:00
朱潮
bf11975183 修改balance资源配置 2025-12-23 23:11:24 +08:00
朱潮
06102559ef add SUMMARIZATION_MESSAGES_TO_KEEP 2025-12-23 22:31:26 +08:00
朱潮
9162b4258d update init agent 2025-12-23 22:26:59 +08:00
朱潮
d8dc973b95 sqlite pool and change agent cache to tools cache 2025-12-23 22:18:18 +08:00
朱潮
09a9c8be93 add MCP_HTTP_TIMEOUT and try catch 2025-12-23 20:13:46 +08:00
朱潮
06c7db26d4 set default profile low_memory 2025-12-23 19:20:43 +08:00