mirror of
https://github.com/jackwener/OpenCLI.git
synced 2026-09-14 18:25:42 +08:00
57534cf8b3
* docs: add daemon lifecycle redesign spec Replace the aggressive 5-minute idle timeout with a long-lived daemon model that stays running for hours, reducing restart overhead during development cycles. * docs: add daemon lifecycle redesign implementation plan 8-task TDD plan for replacing aggressive 5-minute idle timeout with long-lived daemon model (4h default, dual-condition exit). * feat(daemon): add DEFAULT_DAEMON_IDLE_TIMEOUT constant (4 hours) * feat(daemon): replace fixed 5min timeout with dual-condition idle manager (4h default) * feat(extension): reduce WS reconnect backoff cap from 60s to 5s * feat(daemon): improve CLI connection-waiting UX with progress messages and 200ms polling * feat(daemon): add opencli daemon status/stop/restart commands * test(daemon): add tests for daemon status/stop commands * fix(daemon): address code review issues — stale constant, restart robustness, timer cleanup, test coverage * docs: update daemon documentation for new lifecycle and CLI commands - troubleshooting.md: replace manual curl/pkill with `opencli daemon status/stop/restart` - browser-bridge.md (en/zh): add Daemon Lifecycle section - README.md: add `opencli daemon status` to Quick Start - README.zh-CN.md: add daemon management commands to tips
1.3 KiB
1.3 KiB
Browser Bridge 设置
⚠️ 重要: 浏览器命令复用你的 Chrome 登录会话。运行命令前必须在 Chrome 中登录目标网站。
OpenCLI 通过轻量级 Browser Bridge Chrome 扩展 + 微守护进程连接浏览器(零配置,自动启动)。
扩展安装
方法 1:下载预构建版本(推荐)
- 前往 GitHub Releases 页面 下载最新的
opencli-extension.zip。 - 解压后打开
chrome://extensions,启用开发者模式。 - 点击加载已解压的扩展程序,选择解压后的文件夹。
方法 2:加载源码(开发者)
- 打开
chrome://extensions,启用开发者模式。 - 点击加载已解压的扩展程序,选择仓库中的
extension/目录。
验证
opencli doctor # 检查扩展 + 守护进程连接
Daemon 生命周期
Daemon 在首次运行浏览器命令时自动启动,默认保持 4 小时。仅当 CLI 空闲超时且 Chrome 扩展未连接时才会退出。
opencli daemon status # 查看 daemon 状态(PID、运行时长、扩展连接、内存)
opencli daemon stop # 优雅关停
opencli daemon restart # 重启
通过 OPENCLI_DAEMON_TIMEOUT 环境变量覆盖超时时间(毫秒)。设为 0 则永不超时。