JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.
Python
fix(jiuwenswarm): exe版本cmd/git 弹窗问题修复& agent-data错误显示问题
ray_lea8f1fbba44ed
diff --git a/jiuwenclaw/app.py b/jiuwenclaw/app.pyindex 25e5554370..9a3d4b3c2e 100644--- a/jiuwenclaw/app.py+++ b/jiuwenclaw/app.py@@ -8,7 +8,6 @@ Supports ``--dotenv <path>`` for multi-instance isolation."""from __future__ import annotations-import osimport subprocessimport sysimport time@@ -91,8 +90,6 @@ def main() -> None:gateway_cmd.extend(["--dotenv", str(dotenv_path)])_popen_kwargs: dict = {}- if os.name == "nt":- _popen_kwargs["creationflags"] = getattr(subprocess, "CREATE_NO_WINDOW", 0)agent = subprocess.Popen(agent_cmd, **_popen_kwargs)gateway = Nonediff --git a/jiuwenclaw/channels/web/frontend/src/components/AgentPanel/index.tsx b/jiuwenclaw/channels/web/frontend/src/components/AgentPanel/index.tsxindex 42377a771a..6a28d0381a 100644--- a/jiuwenclaw/channels/web/frontend/src/components/AgentPanel/index.tsx+++ b/jiuwenclaw/channels/web/frontend/src/components/AgentPanel/index.tsx@@ -181,6 +181,7 @@ export function AgentPanel({ sessionId: _sessionId }: AgentPanelProps) {const [expandedKeys, setExpandedKeys] = useState<Set<string>>(() => new Set<string>([ROOT_FOLDER_KEY]),);+ const [hasRebuiltOnce, setHasRebuiltOnce] = useState(false);const loadFolderData = async (options?: { rebuildBeforeFetch?: boolean }) => {const shouldRebuild = Boolean(options?.rebuildBeforeFetch);@@ -239,8 +240,15 @@ export function AgentPanel({ sessionId: _sessionId }: AgentPanelProps) {};useEffect(() => {- void loadFolderData();- }, []);+ // 首次进入时自动 rebuild,确保 agent-data.json 与实际安装的技能同步+ // 后续进入直接读取,避免每次都触发重建+ if (!hasRebuiltOnce) {+ setHasRebuiltOnce(true);+ void loadFolderData({ rebuildBeforeFetch: true });+ } else {+ void loadFolderData();+ }+ }, [hasRebuiltOnce]);const handleRefresh = () => {setRefreshing(true);diff --git a/scripts/jiuwenclaw_exe_entry.py b/scripts/jiuwenclaw_exe_entry.pyindex f87e297008..f2e4913c94 100644--- a/scripts/jiuwenclaw_exe_entry.py+++ b/scripts/jiuwenclaw_exe_entry.py@@ -18,6 +18,24 @@ if getattr(sys, "frozen", False):except OSError:pass+ # Windows: 防止 subprocess 弹出控制台窗口(console=False 编译时 git 等命令会弹出黑框)+ # Monkey-patch asyncio.create_subprocess_exec,自动添加 CREATE_NO_WINDOW 标志+ if os.name == "nt":+ import asyncio+ import subprocess++ _original_create_subprocess_exec = asyncio.create_subprocess_exec++ def _patched_create_subprocess_exec(*args, creationflags=0, **kwargs):+ # 合并 CREATE_NO_WINDOW,不覆盖用户指定的其他标志+ return _original_create_subprocess_exec(+ *args,+ creationflags=creationflags | subprocess.CREATE_NO_WINDOW,+ **kwargs,+ )++ asyncio.create_subprocess_exec = _patched_create_subprocess_exec+_DESKTOP_RUN_AGENT = "--desktop-run-agent"_DESKTOP_RUN_GATEWAY = "--desktop-run-gateway"