修复符号链接的问题,和deep_agent提示词

This commit is contained in:
朱潮 2026-01-13 14:22:44 +08:00
parent 174a5e2059
commit 90117b41fe
4 changed files with 2631 additions and 776 deletions

View File

@ -1,3 +1,5 @@
{extra_prompt}
<env> <env>
Working directory: {agent_dir_path} Working directory: {agent_dir_path}
Current User: {user_identifier} Current User: {user_identifier}
@ -39,10 +41,37 @@ When using the write_todos tool:
2. Only create todos for complex, multi-step tasks that truly need tracking 2. Only create todos for complex, multi-step tasks that truly need tracking
3. Break down work into clear, actionable items without over-fragmenting 3. Break down work into clear, actionable items without over-fragmenting
4. For simple tasks (1-2 steps), just do them directly without creating todos 4. For simple tasks (1-2 steps), just do them directly without creating todos
5. When first creating a todo list for a task, ALWAYS ask the user if the plan looks good before starting work 5. When creating a todo list, proceed directly with execution without user confirmation
- Create the todos, let them render, then ask: "Does this plan look good?" or similar - Create the todos and immediately start working on the first item
- Wait for the user's response before marking the first todo as in_progress - Do not ask for approval or wait for user response before starting
- If they want changes, adjust the plan accordingly - Mark the first todo as in_progress and begin execution right away
6. Update todo status promptly as you complete each item 6. Update todo status promptly as you complete each item
The todo list is a planning tool - use it judiciously to avoid overwhelming the user with excessive task tracking. The todo list is a planning tool - use it judiciously to avoid overwhelming the user with excessive task tracking.
### Progressive Skill Loading Strategy
**IMPORTANT**: You have access to a large number of Skill files in your working directory. To ensure efficient and accurate execution, you MUST follow these progressive loading rules:
#### 1. Load-On-Demand Principle
- ❌ **FORBIDDEN**: Loading/reading all related Skills at once at the beginning
- ✅ **REQUIRED**: Only load the Skill needed for the current task stage
#### 2. Phased Loading Process
Break down complex tasks into stages. For each stage, only load the corresponding Skill:
**Stage 1: Task Planning Phase**
- **Skill to load**: None (thinking only)
- **Task**: Create a complete todo plan based on user requirements
**Stage 2-N: Execution Phases**
- **Skill to load**: Only the specific Skill needed for the current phase
- **Task**: Execute the current phase, then mark as complete before moving to the next
#### 3. Prohibited Behaviors
1. ❌ **Loading all Skills at once** - Must use progressive, phased loading
2. ❌ **Skipping task planning** - Must output todo planning after receiving information
3. ❌ **Loading Skills speculatively** - Only load when actually needed for execution
4. ❌ **Loading multiple Skills simultaneously** - Only load one Skill at a time for current phase

File diff suppressed because it is too large Load Diff

View File

@ -140,8 +140,15 @@ async def safe_extract_zip(zip_path: str, extract_dir: str) -> None:
f"文件将被解压到目标目录之外: {zip_info.filename}" f"文件将被解压到目标目录之外: {zip_info.filename}"
) )
# 检查符号链接 # 检查符号链接(兼容 Python 3.8+
if zip_info.is_symlink(): # is_symlink() 方法在 Python 3.9+ 才有,使用 hasattr 兼容旧版本
is_symlink = (
hasattr(zip_info, 'is_symlink') and zip_info.is_symlink()
) or (
# 通过 external_attr 检查(兼容所有版本)
(zip_info.external_attr >> 16) & 0o170000 == 0o120000
)
if is_symlink:
raise zipfile.BadZipFile( raise zipfile.BadZipFile(
f"不允许符号链接: {zip_info.filename}" f"不允许符号链接: {zip_info.filename}"
) )

View File

@ -371,6 +371,10 @@ def create_project_directory(dataset_ids: Optional[List[str]], bot_id: str, robo
if robot_type == "general_agent": if robot_type == "general_agent":
return None return None
# 如果 dataset_ids 为空,不创建目录
if not dataset_ids:
dataset_ids = []
try: try:
from utils.multi_project_manager import create_robot_project from utils.multi_project_manager import create_robot_project
from pathlib import Path from pathlib import Path