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
feat: support using tui when using dmg
huanggawa1e63db1eadf9
diff --git a/jiuwenswarm/channels/desktop/desktop_app.py b/jiuwenswarm/channels/desktop/desktop_app.pyindex 4037ff485e..98df0e21d3 100644--- a/jiuwenswarm/channels/desktop/desktop_app.py+++ b/jiuwenswarm/channels/desktop/desktop_app.py@@ -777,12 +777,40 @@ def _parse_args() -> argparse.Namespace:return parser.parse_args()+def _setup_tui_path() -> None:+ """Auto-add jiuwenswarm-tui to PATH via ~/.zshrc on macOS."""+ if sys.platform != "darwin" or not getattr(sys, "frozen", False):+ return+ tui_binary = Path(sys.executable).parent / "jiuwenswarm-tui"+ if not tui_binary.is_file():+ return+ # Prefer /Applications path over /Volumes (DMG mount) path+ tui_dir = str(tui_binary.parent)+ apps_dir = "/Applications/JiuwenSwarm.app/Contents/MacOS"+ if Path(apps_dir).is_dir():+ tui_dir = apps_dir+ marker = "JiuwenSwarm.app/Contents/MacOS"+ zshrc = Path.home() / ".zshrc"+ try:+ existing = zshrc.read_text(encoding="utf-8") if zshrc.exists() else ""+ if marker in existing:+ return+ with open(zshrc, "a", encoding="utf-8") as f:+ f.write(f"\n# Added by JiuwenSwarm - jiuwenswarm-tui CLI\n")+ f.write(f'export PATH="{tui_dir}:$PATH"\n')+ logger.info("[desktop] added TUI to PATH in ~/.zshrc")+ except OSError as exc:+ logger.warning("[desktop] failed to update ~/.zshrc: %s", exc)++def main() -> None:args = _parse_args()if getattr(args, "desktop_install_update", False):_launch_windows_installer_helper(args.installer_path, args.app_executable, args.parent_pid)return+ _setup_tui_path()+runtime = DesktopRuntime(frontend_host=FRONTEND_HOST,frontend_port=FRONTEND_PORT,diff --git a/scripts/build-macos.sh b/scripts/build-macos.shindex 70ab5ef6c6..1738f28afd 100644--- a/scripts/build-macos.sh+++ b/scripts/build-macos.sh@@ -13,17 +13,39 @@ DMG_PATH="$PROJECT_ROOT/dist/JiuwenSwarm-$VERSION.dmg"printf '=== JiuwenSwarm macOS package build ===\n'printf 'Project root: %s\n\n' "$PROJECT_ROOT"-printf '[1/4] Install Python dependencies (uv sync --extra dev)...\n'+printf '[1/5] Install Python dependencies (uv sync --extra dev)...\n'uv sync --extra dev-printf '\n[2/4] Build frontend (jiuwenswarm/channels/web/frontend)...\n'+printf '\n[2/5] Build frontend (jiuwenswarm/channels/web/frontend)...\n'rm -rf "$PROJECT_ROOT/jiuwenswarm/web/dist"pushd "$PROJECT_ROOT/jiuwenswarm/channels/web/frontend" >/dev/nullnpm installnpm run buildpopd >/dev/null-printf '\n[3/4] Build macOS app bundle with PyInstaller...\n'+TUI_BINARY=""+printf '\n[3/5] Build TUI native binary (Bun)...\n'+if command -v bun &>/dev/null; then+ pushd "$PROJECT_ROOT/jiuwenswarm/channels/tui/frontend" >/dev/null+ bun install+ popd >/dev/null+ TUI_BINARY="$(uv run python scripts/build_tui.py --target current | tail -n1)"+ if [[ -z "$TUI_BINARY" ]]; then+ printf 'Warning: TUI build produced no output, skipping TUI.\n'+ TUI_BINARY=""+ else+ TUI_BINARY="$PROJECT_ROOT/$TUI_BINARY"+ if [[ ! -f "$TUI_BINARY" ]]; then+ printf 'Warning: TUI binary not found at %s, skipping TUI.\n' "$TUI_BINARY"+ TUI_BINARY=""+ fi+ fi+else+ printf 'Warning: bun not found, skipping TUI build.\n'+ printf 'Install bun: curl -fsSL https://bun.sh/install | bash\n'+fi++printf '\n[4/5] Build macOS app bundle with PyInstaller...\n'uv run pyinstaller scripts/jiuwenswarm.spec --noconfirmif [[ ! -d "$APP_PATH" ]]; then@@ -31,7 +53,13 @@ if [[ ! -d "$APP_PATH" ]]; thenexit 1fi-printf '\n[4/4] Create DMG...\n'+if [[ -n "$TUI_BINARY" && -f "$TUI_BINARY" ]]; then+ printf 'Copying TUI binary into app bundle...\n'+ cp "$TUI_BINARY" "$APP_PATH/Contents/MacOS/jiuwenswarm-tui"+ chmod +x "$APP_PATH/Contents/MacOS/jiuwenswarm-tui"+fi++printf '\n[5/5] Create DMG...\n'rm -rf "$DMG_ROOT"mkdir -p "$DMG_ROOT"cp -R "$APP_PATH" "$DMG_ROOT/"