- 进程终止:Windows 用 CTRL_BREAK + taskkill /F /T 替代不存在的 killpg/SIGKILL, 超时/取消全路径有界;_is_pid_alive 改 ctypes(原 os.kill(pid,0) 在 Windows 会真杀进程); reader 任务 finally 收口,消除 Task was destroyed but it is pending / unclosed transport - 子智能体调度链:_run_coro 超时 60s + 失败 cancel/close 防幽灵协程;create 改先调度后提交、 失败回滚;state 归属守卫 + 新建 120s 宽限期防误标已终止;_ensure_event_loop 加锁; 子智能体 todo 改 per-agent 隔离存储,不再串到主智能体前端 - 子智能体执行环境(execution_env_text.py):创建/切换/恢复三时点注入环境说明, Windows 下 sandbox=WSL2 bash、direct=cmd;inject_notification 纯通知不触发新一轮工作, tool 序列中延迟到安全点 flush;传统子智能体按既定语义不通知 - 编码:git 侧边栏 subprocess 显式 utf-8 + errors=replace(修中文 Windows GBK _readerthread 崩溃导致侧边栏空白);check_environment/install_package 用 self.python_cmd - 安全/路径:permission.py Windows deny 列表生效 + 驱动器根拦截;路径比较统一 normcase; /tmp 白名单平台分流;正斜杠判断归一化;os-release 平台守卫;PowerShell -ExecutionPolicy Bypass - 稳定性:任务事件轮询持锁快照(修 deque mutated during iteration); 原子写新增 replace_with_retry(修 WinError 5/32 瞬时持锁); 共享文件兜底链 symlink→os.link 硬链接→copy2 - 部署:新增 _bootstrap.bat / setup.bat / start.bat Windows 启动脚本
45 lines
1.4 KiB
Batchfile
45 lines
1.4 KiB
Batchfile
@echo off
|
||
rem 启动入口(Windows 版 start.sh):
|
||
rem 1. 确保 Python venv 与依赖就绪(缺失才安装)
|
||
rem 2. 确保 Node 依赖就绪(缺失才安装)
|
||
rem 3. 若没有 .env(首次启动),自动运行配置向导
|
||
rem 4. 启动 python -m server.app
|
||
rem
|
||
rem 端口/监听地址/模式等由 .env 决定(见 config/server.py、config/paths.py)。
|
||
rem 透传的命令行参数会传给 server.app(如 --port / --path / --thinking-mode)。
|
||
rem
|
||
rem 用法:
|
||
rem start.bat 正常启动(首次会自动初始化)
|
||
rem start.bat --thinking-mode 透传参数给 server.app
|
||
|
||
rem 控制台切到 UTF-8,保证中文提示与日志正常显示。
|
||
chcp 65001 >nul
|
||
setlocal
|
||
|
||
set "ROOT=%~dp0"
|
||
if "%ROOT:~-1%"=="\" set "ROOT=%ROOT:~0,-1%"
|
||
set "VENV_PY=%ROOT%\.venv\Scripts\python.exe"
|
||
|
||
call "%ROOT%\_bootstrap.bat" ensure_python_env
|
||
if errorlevel 1 exit /b 1
|
||
call "%ROOT%\_bootstrap.bat" ensure_node_env
|
||
if errorlevel 1 exit /b 1
|
||
|
||
call "%ROOT%\_bootstrap.bat" has_env_file
|
||
if not errorlevel 1 goto :start_server
|
||
|
||
echo.
|
||
echo [start] 未检测到 .env,进入首次初始化向导...
|
||
"%VENV_PY%" -m scripts.setup
|
||
call "%ROOT%\_bootstrap.bat" has_env_file
|
||
if not errorlevel 1 goto :start_server
|
||
echo [start] 初始化未完成(未生成 .env),已退出。 1>&2
|
||
exit /b 1
|
||
|
||
:start_server
|
||
echo.
|
||
echo [start] 启动 Web 服务...
|
||
cd /d "%ROOT%"
|
||
"%VENV_PY%" -m server.app %*
|
||
exit /b %errorlevel%
|