@foxden-app/foxclaw 0.7.3 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/.env.example +22 -8
  2. package/CHANGELOG.md +134 -0
  3. package/README.md +21 -1
  4. package/README_EN.md +21 -1
  5. package/dist/antigravity/adapter.d.ts +18 -0
  6. package/dist/antigravity/adapter.js +394 -0
  7. package/dist/antigravity/auth.d.ts +126 -0
  8. package/dist/antigravity/auth.js +933 -0
  9. package/dist/antigravity/client.d.ts +32 -0
  10. package/dist/antigravity/client.js +244 -0
  11. package/dist/antigravity/controller.d.ts +101 -0
  12. package/dist/antigravity/controller.js +2007 -0
  13. package/dist/antigravity/conversations.d.ts +29 -0
  14. package/dist/antigravity/conversations.js +289 -0
  15. package/dist/antigravity/events.d.ts +102 -0
  16. package/dist/antigravity/events.js +143 -0
  17. package/dist/antigravity/runtime.d.ts +49 -0
  18. package/dist/antigravity/runtime.js +82 -0
  19. package/dist/antigravity/subagents.d.ts +66 -0
  20. package/dist/antigravity/subagents.js +459 -0
  21. package/dist/channels/telegram/telegram_channel_adapter.d.ts +10 -3
  22. package/dist/channels/telegram/telegram_channel_adapter.js +2 -1
  23. package/dist/channels/weixin/weixin_channel_adapter.d.ts +5 -1
  24. package/dist/codex_app/adapter.d.ts +20 -0
  25. package/dist/codex_app/adapter.js +213 -0
  26. package/dist/codex_app/client.d.ts +1 -1
  27. package/dist/codex_app/client.js +12 -0
  28. package/dist/config.d.ts +14 -0
  29. package/dist/config.js +65 -16
  30. package/dist/controller/controller.d.ts +12 -5
  31. package/dist/controller/controller.js +109 -8
  32. package/dist/core/attachments.d.ts +11 -0
  33. package/dist/core/attachments.js +56 -0
  34. package/dist/core/engine_spi.d.ts +77 -0
  35. package/dist/core/engine_spi.js +1 -0
  36. package/dist/core/orchestrator.d.ts +106 -0
  37. package/dist/core/orchestrator.js +1556 -0
  38. package/dist/core/stream_preview.d.ts +29 -0
  39. package/dist/core/stream_preview.js +146 -0
  40. package/dist/core/turn_queue.d.ts +19 -0
  41. package/dist/core/turn_queue.js +41 -0
  42. package/dist/i18n.d.ts +6 -0
  43. package/dist/i18n.js +49 -0
  44. package/dist/main.js +375 -446
  45. package/dist/opencode/adapter.d.ts +11 -0
  46. package/dist/opencode/adapter.js +169 -0
  47. package/dist/opencode/controller.js +2 -2
  48. package/dist/store/database.d.ts +44 -0
  49. package/dist/store/database.js +275 -43
  50. package/dist/store/token_usage.d.ts +23 -0
  51. package/dist/store/token_usage.js +61 -0
  52. package/dist/telegram/api.d.ts +1 -0
  53. package/dist/telegram/api.js +80 -3
  54. package/dist/telegram/bot_home.js +5 -4
  55. package/dist/telegram/gateway.d.ts +4 -0
  56. package/dist/telegram/gateway.js +11 -0
  57. package/dist/types.d.ts +3 -0
  58. package/dist/update.d.ts +6 -0
  59. package/dist/update.js +95 -7
  60. package/dist/voice/tts.js +4 -2
  61. package/docs/devlogs//346/212/200/346/234/257/351/200/232/350/256/257/02./347/273/237/344/270/200/351/200/232/351/201/223/350/260/203/345/272/246/345/231/250/344/270/216/345/217/257/346/217/222/346/213/224/345/274/225/346/223/216SPI/357/274/232FoxClaw/344/273/216/345/215/225/344/275/223/350/265/260/345/220/221/345/244/232Agent/345/272/225/345/272/247.md +192 -0
  62. package/docs/devlogs//347/254/254/344/270/200/344/272/272/347/247/260/347/211/210/02./347/257/207/344/272/214_/345/275/223/344/270/200/344/270/252/346/241/245/346/216/245/345/231/250/345/274/200/345/247/213/345/255/246/344/274/232/345/220/254/346/207/202/346/211/200/346/234/211Agent.md +45 -0
  63. package/package.json +2 -2
package/.env.example CHANGED
@@ -1,11 +1,12 @@
1
- # Required for new installs: one or more bot tokens for this host.
2
- # Comma-separated bot tokens. By default, each bot gets an independent Codex runtime/auth selection.
3
- # Homes use ~/.foxclaw/codex/telegram/@TelegramUsername/home (old numeric paths remain as links).
4
- TG_BOT_TOKENS=<telegram_bot_token>
5
- # Backward-compatible single-runtime setup.
6
- # In TG_BOT_TOKENS mode, if this exact token is also present in TG_BOT_TOKENS,
7
- # that bot uses the default terminal CODEX_HOME/auth instead of an isolated home.
8
- # TG_BOT_TOKEN=<telegram_bot_token>
1
+ # Required: one or more Telegram bot tokens for Codex execution.
2
+ # Comma-separated bot tokens. The 1st bot shares the default terminal CODEX_HOME (~/.codex).
3
+ # Additional bots receive independent isolated homes (~/.foxclaw/codex/telegram/@TelegramUsername/home).
4
+ CODEX_BOT_TOKENS=<codex_telegram_bot_token>
5
+
6
+ # Optional: one or more Telegram bot tokens for Google Antigravity execution.
7
+ # Comma-separated bot tokens. The 1st bot shares the default Antigravity home (~/.gemini/antigravity-cli).
8
+ # Additional bots receive independent isolated homes (~/.foxclaw/antigravity/telegram/@TelegramUsername/home).
9
+ # ANTIGRAVITY_BOT_TOKENS=<antigravity_telegram_bot_token>
9
10
 
10
11
  # Required: only this Telegram user can control the bridge
11
12
  TG_ALLOWED_USER_ID=<telegram_user_id>
@@ -72,6 +73,19 @@ CODEX_CLI_BIN=/absolute/path/to/codex
72
73
  # OPENCODE_SERVER_STATE_PATH=
73
74
  # OPENCODE_SERVER_LOG_PATH=
74
75
 
76
+ # Optional Google Antigravity (AGY) bridge. This starts independent Telegram bot(s)
77
+ # alongside existing Codex/OpenCode runtimes; never reuse a TG_BOT_TOKEN here.
78
+ # FoxClaw communicates with `agy` via stdio stream-json and supports multi-account
79
+ # rotation from ~/.gemini/antigravity-cli/antigravity-oauth-token_*.
80
+ # Multi-bot mode: comma-separated bot tokens. The default/first bot shares the terminal's
81
+ # ~/.gemini/antigravity-cli home, while additional bots get isolated ~/.foxclaw/antigravity/telegram/@bot/home.
82
+ # ANTIGRAVITY_BOT_TOKENS=<bot_token_1>,<bot_token_2>
83
+ # Single-bot backward compatibility:
84
+ # ANTIGRAVITY_BOT_TOKEN=<different_telegram_bot_token>
85
+ # ANTIGRAVITY_CLI_BIN=/absolute/path/to/agy
86
+ # ANTIGRAVITY_AUTH_DIR=~/.gemini/antigravity-cli
87
+ # ANTIGRAVITY_DEFAULT_MODEL=gemini-3.8-flash-high
88
+
75
89
  # Optional cross-node Codex auth sync.
76
90
  # Disabled by default. When enabled, FoxClaw uses Telegram Bot-to-Bot private
77
91
  # messages to move encrypted auth bundles between nodes. Enable Bot-to-Bot
package/CHANGELOG.md CHANGED
@@ -2,6 +2,140 @@
2
2
 
3
3
  All notable FoxClaw changes are listed here. Each release note is bilingual so GitHub Releases and the npm package are useful to both Chinese and English readers.
4
4
 
5
+ ## 0.11.0 - 2026-09-30
6
+
7
+ ### 中文
8
+ - **多后端 Telegram Bot 变量重构与后端原生隔离**:
9
+ - 弃用原有的 `TG_BOT_TOKEN`/`TG_BOT_TOKENS`,引入面向具体执行后端的 `CODEX_BOT_TOKENS` 与 `ANTIGRAVITY_BOT_TOKENS`。
10
+ - 每类后端的首个 Bot 默认与本地终端 CLI 共享主目录(Codex 共享 `~/.codex`,Antigravity 共享 `~/.gemini/antigravity-cli`),后续实例自动创建隔离主目录。
11
+ - 隔离目录路径统一升级为人类可读格式(如 `@WallianBot`、`@waxiaosheBot`),彻底告别原有的裸数字 ID 目录。
12
+ - **作用域会话继承与迁移容错增强**:
13
+ - 修复多 Bot 模式下旧未命名空间会话因历史脏数据导致无法自动迁移的问题;加入 `updated_at` 时间戳比对,自动无缝承接最新正在执行的任务线程。
14
+ - 增强 `scope_backend_bindings` 的自动迁移与跨引擎会话保持能力。
15
+ - **网络鲁棒性与服务重启自愈**:
16
+ - 强化 Telegram 长轮询与分片投递在网络断连、代理抖动时的自动恢复机制。
17
+ - 修复服务重启后活跃任务的断点自动续跑逻辑。
18
+
19
+ ### English
20
+ - **Backend-Centric Bot Variables & Native Home Isolation**:
21
+ - Deprecated legacy `TG_BOT_TOKEN`/`TG_BOT_TOKENS` in favor of backend-specific `CODEX_BOT_TOKENS` and `ANTIGRAVITY_BOT_TOKENS`.
22
+ - The first bot of each backend type shares the default terminal CLI home (`~/.codex` for Codex, `~/.gemini/antigravity-cli` for Antigravity), while additional bots receive fully isolated homes.
23
+ - Isolated directories are now standardized to human-readable Telegram usernames (e.g. `@WallianBot`, `@waxiaosheBot`).
24
+ - **Resilient Scope Migration & Session Inheritance**:
25
+ - Resolved scope migration conflicts where stale historical records blocked recent unnamespaced turns from being adopted under multi-bot mode.
26
+ - Added timestamp-based migration for `chat_bindings` and `scope_backend_bindings` to ensure seamless continuation of active sessions across restarts.
27
+ - **Network Resilience & Service Auto-Recovery**:
28
+ - Enhanced polling and chunk delivery retry mechanisms during transient network resets and proxy timeouts.
29
+
30
+ ## 0.10.0 - 2026-09-27
31
+
32
+ ### 中文
33
+ - **Antigravity 多 Bot 原生隔离与同机共存**:
34
+ - 支持通过 `ANTIGRAVITY_BOT_TOKENS` 启动多个独立 Telegram Bot,每个 Bot 自动拥有完全隔离的工作空间目录(`~/.gemini/antigravity-cli/telegram_bots/<bot-id>/`),独立记忆会话历史与进程状态,彻底杜绝多 Bot 互相踩踏与符号链接覆盖冲突。
35
+ - 默认主 Bot 保持与终端默认环境无缝衔接,终端与 Telegram 会话可相互无缝接手。
36
+ - **Telegram 执行小结折叠增强与长任务防穿透分片**:
37
+ - 任务执行小结加入精准耗时换算(秒/分/小时)与全维度 Token 消耗细分(总计、输入、输出、缓存,自动换算 K/M/G 单位)。
38
+ - 完整保留普通任务中全部十几个阶段小节(≤ 25 项调用完整保留无损呈现,展开可回溯全流程),超大规模任务(> 25 项)智能首尾收敛折叠。
39
+ - 新增 `combineSummaryAndResponse` 彻底杜绝超长任务分片切断折叠块导致工具调用裸露冠在最终答复上方的问题。
40
+ - **全后端 `/update` 一键联动自升级**:
41
+ - 无论处于 Codex 还是 Antigravity 运行模式,均可直接发送 `/update` 触发全链路升级。
42
+ - 自动联动升级 Antigravity CLI(`agy update`)、Codex CLI(`pnpm add -g @openai/codex`)以及 FoxClaw 自身,并自动平滑重载服务。
43
+
44
+ ### English
45
+ - **Native Multi-Bot Isolation for Antigravity**:
46
+ - Supports multiple concurrent Telegram bot instances via `ANTIGRAVITY_BOT_TOKENS` with fully isolated runtime homes (`~/.gemini/antigravity-cli/telegram_bots/<bot-id>/`), eliminating directory collision and symlink overwrites while keeping the primary bot synchronized with the local terminal environment.
47
+ - **Enhanced Collapsible Execution Summary & Leak-Proof Chunking**:
48
+ - Execution summaries now include precise elapsed durations and four-dimensional token metrics (Total, Input, Output, Cached).
49
+ - Preserves all intermediate step summaries (up to 25 items) inside expandable folds for complete visibility, while gracefully bounding massive tool runs (> 25 items).
50
+ - New `combineSummaryAndResponse` eliminates blockquote tearing across Telegram chunk boundaries, preventing uncollapsed tool items from spilling onto the final answer.
51
+ - **Universal `/update` with Full Backend Synchronization**:
52
+ - `/update` is now available across all engine modes (Codex & Antigravity), seamlessly updating FoxClaw, the Antigravity CLI (`agy update`), and Codex CLI in one step.
53
+
54
+ ## 0.9.0 - 2026-09-26
55
+
56
+ ### 中文
57
+ - **统一多后端运行环境热切换**:
58
+ - 前端控制面板支持 `Codex`、`Google Antigravity (AGY)`、`OpenCode` 无缝平滑热切换,会话状态与配置自动记忆绑定。
59
+ - 支持多 Bot 隔离实例下各 Bot 独立选择和切换后端,互不干扰。
60
+ - **全端功能体验对齐原版 Codex 标准**:
61
+ - `/auth` 面板向原版 Codex 规范完全看齐,支持设备登录、授权检测、自动轮换与暂停/修复功能。
62
+ - `/threads` 会话面板对齐原版 Codex 功能按钮(会话切换、历史归档、工作目录配置等)。
63
+ - **交互面板智能收拢与过期自动清理**:
64
+ - 设置类与状态类面板展示超过 5 分钟自动静默清理,保持聊天面板干净整洁。
65
+ - 任务执行过程实时动态刷新(轮次、工具调用次数、耗时),完成后自动收拢折叠为小结引用块。
66
+ - **自更新体系全面支持 Antigravity CLI 同步升级**:
67
+ - `/update` 命令与集群自动更新联动同步执行 `agy update`,确保 FoxClaw、Codex 与 Antigravity CLI 全技术栈同步保持最新。
68
+ - **全局 Token 统计与即时观测(常态化持久化)**:
69
+ - `/status` 状态面板常态化显示全后端累积 Token 用量,格式化为人类友好单位(`总计 X.XXG (输入 X.XXG, 输出 XX.XXM, 缓存 X.XXG)`)。
70
+ - 底层基于 SQLite 持久化记录,无需每次耗时扫盘,日常实时累加,想看直接秒出。
71
+
72
+ ### English
73
+ - **Unified Multi-Backend Hot-Switching**:
74
+ - Seamlessly switch between `Codex`, `Google Antigravity (AGY)`, and `OpenCode` from the Telegram UI with per-backend state and setting persistence.
75
+ - Multi-bot isolated setups support independent backend switching for each bot instance.
76
+ - **Full UX Alignment with Codex Conventions**:
77
+ - `/auth` and `/threads` menus redesigned to match the established Codex interaction standards (device login, candidate repair, session archival).
78
+ - **Auto-Cleanup & Expired Panel Pruning**:
79
+ - Transient setup and status panels are automatically removed after 5 minutes to keep chat history clean.
80
+ - Live execution displays dynamic progress counters and collapses into expandable summaries upon completion.
81
+ - **Synchronous Antigravity CLI Self-Updates**:
82
+ - `/update` seamlessly upgrades the `agy` CLI alongside FoxClaw and Codex.
83
+ - **Persistent Global Token Usage Metrics in `/status`**:
84
+ - Displays cumulative token metrics formatted in metric units (`Total X.XXG (Input X.XXG, Output XX.XXM, Cached X.XXG)`).
85
+ - Persisted continuously in SQLite for instant on-demand status reporting without filesystem latency.
86
+
87
+ ## 0.8.0 - 2026-09-24
88
+
89
+ ### 中文
90
+ - **统一通道调度器(UnifiedChannelOrchestrator)**:架构级重构,将与通道与引擎无关的通用交互全数下沉。集成 Turn 抢占与并发排队(`TurnQueue`)、700ms 智能节流流式编辑预览(`StreamPreviewController`)、工具调用动态折叠(`<blockquote expandable>`)、长消息 4000 字符安全分块(`chunkTelegramMessage`)、活跃态 Typing 维持,以及跨重启崩溃自愈恢复。
91
+ - **可插拔引擎服务提供者接口(IEngineAdapter SPI)**:定义面向多 Agent 的标准接口,涵盖执行、中断、状态汇报、交互键盘分发与模型参数控制,新增 Agent 接入成本降低 85%。
92
+ - **Google Antigravity (`agy`) 引擎深度接入与适配器**:
93
+ - 独立 Telegram 机器人接入,支持与既有 Codex / OpenCode 并行运行。
94
+ - **Token 预检与静默刷新(Token Preflight)**:执行前智能计算 OAuth Access Token 有效期,临期自动静默刷新,防止长任务因凭据过期中断。
95
+ - **Google 503 容量饱和指数退避重试**:遇到瞬时 `503 Service Unavailable` 或 `MODEL_CAPACITY_EXHAUSTED` 时,自动进行 1s、2s、4s 指数退避重试。
96
+ - **配额超限自动冷却轮换(Quota Cooldown Rotation)**:遭遇真实 ResourceExhausted 限额时,自动将当前账号标记冷却并轮换至候选池下一可用账号继续执行。
97
+ - **Boost 模式支持**:支持通过 `/boost` 开启或引导深度推理与多角度验证。
98
+ - **5h/7d 配额真实语义可观测性重构**:
99
+ - 彻底厘清 Google CloudCode PA 配额窗口语义,去除时间倒计时混淆,全面规范为 `100%|80%|account` 格式的百分比 Badge。
100
+ - 在 `/auth` 候选切换按钮、`/status` 面板与 `/setup` 概览中完整呈现 5 小时突发额度与 7 天长期额度。
101
+ - **OpenCode 适配器加固**:适配器流式 Delta 空安全增强,统一纳入调度器生命周期管理。
102
+ - **架构代码精简与全量测试**:`AntigravityBridgeCore` 样板代码精简 83%,全仓库 449 个自动化测试 100% 通过。
103
+
104
+ ### English
105
+ - **UnifiedChannelOrchestrator**: Major architecture refactoring decoupling channel orchestration from underlying AI engines. Centralizes turn queueing (`TurnQueue`), 700ms throttled streaming previews (`StreamPreviewController`), collapsible tool blocks (`<blockquote expandable>`), safe 4000-char message chunking (`chunkTelegramMessage`), typing indicators, and crash recovery across daemon restarts.
106
+ - **Pluggable Engine SPI (`IEngineAdapter`)**: Standardized interface for multi-agent execution, cancellation, status summaries, inline keyboard actions, and model/effort switching, reducing new engine onboarding cost by 85%.
107
+ - **Google Antigravity (`agy`) Engine Integration & Adapter**:
108
+ - Independent Telegram bot support running concurrently alongside Codex and OpenCode.
109
+ - **Token Preflight & Silent Refresh**: Proactively calculates OAuth access token TTL before turn execution, silently refreshing when under 5 minutes to prevent expired token aborts during long runs.
110
+ - **Google 503 Capacity Exponential Backoff**: Automatically executes 1s, 2s, 4s exponential backoff retries upon encountering transient `503 Service Unavailable` or `MODEL_CAPACITY_EXHAUSTED`.
111
+ - **Quota Cooldown Rotation**: Automatically cools down and rotates to the next available Google OAuth candidate upon hitting true ResourceExhausted limits.
112
+ - **Boost Mode**: Supported `/boost` to guide or inject deep reasoning effort.
113
+ - **5h/7d Quota Metric & Observability Redesign**:
114
+ - Clarified Google CloudCode PA quota window semantics from ambiguous countdowns to explicit percentage badges: `100%|80%|account`.
115
+ - Fully exposed 5h burst and 7d long-term quota percentages across `/auth` candidate buttons, `/status`, and `/setup` panels.
116
+ - **OpenCode Adapter Hardening**: Stream delta null-safety hardening and unified engine lifecycle management.
117
+ - **Refactoring Quality & Test Coverage**: Eliminated 83% boilerplate in `AntigravityBridgeCore` with 100% pass rate across all 449 automated tests.
118
+
119
+ ## 0.7.4 - 2026-09-24
120
+
121
+ ### 中文
122
+ - 新增 Google Antigravity (`agy`) 引擎支持:通过 `ANTIGRAVITY_BOT_TOKEN` 接入独立的 Telegram 机器人,与既有 Codex / OpenCode 并行运行。
123
+ - 会话管理与既有 Thread 选定:支持 `/threads` 查询 Antigravity 历史会话(读取 `conversation_summaries.db`),支持 `/open <编号|ID>` 选定并绑定既有会话上下文,支持 `/new [目录]` 开启新会话。
124
+ - 交互式控制面板:支持 `/setup` 统一管理与查看当前模型、思考深度(Effort)、活跃账号池、绑定会话与工作目录,支持内联按钮原地切换与刷新。
125
+ - 富文本流式渲染与消息折叠:支持 Markdown 富文本转译、700ms 节流编辑流式输出、工具执行过程折叠收起(`<blockquote expandable>`)、长消息自动按 Telegram 限制分段(`chunkTelegramMessage`),以及执行期间定期维持 Typing 状态。
126
+ - 支持 Antigravity 多账号池管理:扫描 `~/.gemini/antigravity-cli/antigravity-oauth-token_*` 候选池,免网络即时从 `id_token` 解码 Google 账号邮箱,支持 `/auth` 面板切换;遇到 429 或配额超限(ResourceExhausted)时自动轮换下一个可用账号并重试。
127
+ - 支持 `/models` 切换 Gemini 3.8/3.7/3.1、Claude 等模型,支持 `/effort` 设置思考深度,支持 `/interrupt` 实时中断任务。
128
+ - `foxclaw doctor` 增加 Antigravity CLI、独立 Token 与凭据检测。
129
+
130
+ ### English
131
+ - Added Google Antigravity (`agy`) engine support: run an independent Telegram bot alongside Codex/OpenCode via `ANTIGRAVITY_BOT_TOKEN`.
132
+ - Thread and Conversation Management: supported `/threads` to browse historical Antigravity conversations (via `conversation_summaries.db`), `/open <num|id>` to bind to an existing thread context, and `/new [dir]` to start a fresh conversation.
133
+ - Interactive Control Panel: supported `/setup` to inspect and configure the current model, reasoning effort, active account, bound thread, and directory via in-place inline keyboards.
134
+ - Rich Streaming and Tool Folding: supported safe rich Markdown rendering, 700ms throttled streaming edits, tool execution folding (`<blockquote expandable>`), automated multi-chunk message splitting (`chunkTelegramMessage`), and active Telegram typing loop.
135
+ - Added Antigravity multi-account candidate pool management: scans `~/.gemini/antigravity-cli/antigravity-oauth-token_*`, extracts Google account email directly from `id_token` JWT payload without network calls, provides `/auth` switching panel, and automatically rotates to the next available account upon 429 / ResourceExhausted errors.
136
+ - Supported `/models` to switch models (Gemini 3.8/3.7/3.1, Claude Sonnet, etc.), `/effort` for reasoning effort, and `/interrupt` to cancel running turns.
137
+ - Extended `foxclaw doctor` with Antigravity CLI availability, dedicated bot token, and OAuth token checks.
138
+
5
139
  ## 0.7.3 - 2026-09-05
6
140
 
7
141
  ### 中文
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  **狸爪:一个更适配编程需求的移动端 Codex 控制器。**
6
6
 
7
- FoxClaw(狸爪)的目标很直接:让你用手机控制本机的 Codex 或 OpenCode,把移动端变成一个真正能用的 web coding 入口。Telegram 或微信负责交互,`codex app-server` / `opencode serve` 负责本地执行;你发任务、看进度、批审批、切线程,Agent 在电脑上继续写代码。
7
+ FoxClaw(狸爪)的目标很直接:让你用手机控制本机的 Codex、OpenCode 或 Antigravity (AGY),把移动端变成一个真正能用的 web coding 入口。Telegram 或微信负责交互,`codex app-server` / `opencode serve` / `agy` 负责本地执行;你发任务、看进度、批审批、切线程,Agent 在电脑上继续写代码。
8
8
 
9
9
  这适合你离开办公桌去吃饭、在旅途中、在跑步机上,或者陪小孩逛公园的时候继续工作。人可以离开电脑,Codex 不必停;它会把关键进展、错误、审批请求和最终结果同步回手机。
10
10
 
@@ -136,6 +136,26 @@ OpenCode Bot 保留与 Codex Bot 相同的主要操作习惯:直接发消息
136
136
 
137
137
  OpenCode 自身的 Provider 登录仍在本机终端完成,例如 `opencode auth`。运行 `foxclaw doctor` 会在配置了 OpenCode Bot 时额外检查 OpenCode CLI 和 token 隔离。
138
138
 
139
+ ### Antigravity (AGY) 独立 Bot
140
+
141
+ 如果你使用 Google Antigravity,只需在 `@BotFather` 处再创建一个独立 Bot,并在 `~/.foxclaw/.env` 中配置:
142
+
143
+ ```dotenv
144
+ ANTIGRAVITY_BOT_TOKEN=8308303236:AAFZ32Pus2wrzpRq7-Bp2JQMt7lsrt5kKpo
145
+ # 可选;默认为 PATH 中的 agy
146
+ ANTIGRAVITY_CLI_BIN=/home/wuya/.gemini/antigravity-cli/bin/agy
147
+ # 可选;默认 gemini-3.8-flash-high
148
+ ANTIGRAVITY_DEFAULT_MODEL=gemini-3.8-flash-high
149
+ ```
150
+
151
+ Antigravity Bot 保留与 Codex / OpenCode 对齐的高频操作习惯:
152
+ - **消息交互与流式思考**:直接向机器人发送文本或任务,支持 700ms 节流流式输出与思考过程实时显示。
153
+ - **消息折叠与工具进度**:执行过程中的工具调用与历史执行细节自动通过 Telegram 可折叠引用块(`<blockquote expandable>`)折叠收起,避免刷屏;输出超长文本自动按限制无损分段。
154
+ - **`/setup` 控制面板**:在同一消息内通过内联按钮原地切换模型、思考深度(Effort)、账号与会话。
155
+ - **`/threads` 与 `/open <编号|ID>`**:直接读取 `conversation_summaries.db` 列出近期历史会话并选定绑定,无缝继续上下文;发送 `/new [目录]` 开启全新会话。
156
+ - **`/auth` 多账号管理与自动轮换**:自动扫描 `antigravity-oauth-token_*` 候选池并即时解码 Google 邮箱,支持手动切换;遇到 429 或配额限制自动轮换下一个账号并重试任务。
157
+ - **`/models` 与 `/effort`**:切换 Gemini 3.8/3.7/3.1、Claude Sonnet、Claude Opus 等模型与推理深度。
158
+
139
159
  ## 多账号切换
140
160
 
141
161
  FoxClaw 的一大特色是自动多账号切换。当一个账号触发用量限制时,FoxClaw 会自动切换到下一个可用账号继续工作。
package/README_EN.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  **A mobile Codex controller built for real programming workflows.**
6
6
 
7
- FoxClaw turns your phone into a practical web coding cockpit for local Codex or OpenCode. Telegram or Weixin handles the chat interface, `codex app-server` / `opencode serve` handles local execution, and you can send tasks, inspect progress, approve actions, switch sessions, and keep working without opening a laptop.
7
+ FoxClaw turns your phone into a practical web coding cockpit for local Codex, OpenCode, or Antigravity (AGY). Telegram or Weixin handles the chat interface, `codex app-server` / `opencode serve` / `agy` handles local execution, and you can send tasks, inspect progress, approve actions, switch sessions, and keep working without opening a laptop.
8
8
 
9
9
  It is built for the moments when you leave your desk for lunch, commute, travel, use a treadmill, or take the kids to the park. You can step away from the keyboard while Codex keeps coding and sends progress, errors, approval requests, and final results back to your phone.
10
10
 
@@ -136,6 +136,26 @@ The OpenCode bot preserves the main Codex-bot habits: plain messages and attachm
136
136
 
137
137
  Provider authentication remains an OpenCode terminal operation, such as `opencode auth`. When an OpenCode bot is configured, `foxclaw doctor` also checks the OpenCode CLI and token isolation.
138
138
 
139
+ ### Antigravity (AGY) Dedicated Bot
140
+
141
+ If you use Google Antigravity, create an independent bot with `@BotFather` and configure:
142
+
143
+ ```dotenv
144
+ ANTIGRAVITY_BOT_TOKEN=8308303236:AAFZ32Pus2wrzpRq7-Bp2JQMt7lsrt5kKpo
145
+ # Optional; defaults to PATH lookup
146
+ ANTIGRAVITY_CLI_BIN=/home/wuya/.gemini/antigravity-cli/bin/agy
147
+ # Optional; default gemini-3.8-flash-high
148
+ ANTIGRAVITY_DEFAULT_MODEL=gemini-3.8-flash-high
149
+ ```
150
+
151
+ The Antigravity Bot preserves the same intuitive workflows as Codex and OpenCode:
152
+ - **Interactive Messaging & Streaming**: Send prompts directly to the bot, with 700ms throttled streaming output and live reasoning progress.
153
+ - **Message Folding & Progress Details**: Tool calls and execution traces are neatly folded using Telegram expandable blockquotes (`<blockquote expandable>`), keeping conversations clean; long responses are automatically split without truncation (`chunkTelegramMessage`).
154
+ - **`/setup` Control Panel**: In-place inline keyboard to view and switch models, reasoning effort, active accounts, and bound conversation.
155
+ - **`/threads` & `/open <number|id>`**: Directly reads `conversation_summaries.db` to list recent sessions and bind to existing thread contexts; use `/new [dir]` to start a fresh conversation.
156
+ - **`/auth` Multi-Account Management**: Automatically scans `antigravity-oauth-token_*` candidate tokens and decodes Google emails from JWT payloads; automatically rotates to the next account on 429 or quota limit errors.
157
+ - **`/models` & `/effort`**: Switch between Gemini 3.8/3.7/3.1, Claude Sonnet/Opus, and adjust reasoning effort.
158
+
139
159
  ## Multi-Account Rotation
140
160
 
141
161
  A key FoxClaw feature is automatic multi-account switching. When one account's usage limit is triggered, FoxClaw automatically switches to the next available account and continues working.
@@ -0,0 +1,18 @@
1
+ import type { IEngineAdapter, EngineModel, EngineTurnRequest, EngineTurnExecution, EngineTurnErrorContext } from '../core/engine_spi.js';
2
+ import { type AntigravityAppClient } from './client.js';
3
+ import type { AntigravityAuthManager } from './auth.js';
4
+ import type { Logger } from '../logger.js';
5
+ export declare class AntigravityEngineAdapter implements IEngineAdapter {
6
+ readonly id = "antigravity";
7
+ readonly name = "Google Antigravity (AGY)";
8
+ private readonly client;
9
+ private readonly defaultModel;
10
+ private readonly auth;
11
+ private readonly logger;
12
+ private readonly baseDir;
13
+ constructor(client: AntigravityAppClient, defaultModel?: string, auth?: AntigravityAuthManager, logger?: Logger, baseDir?: string);
14
+ listModels(): Promise<EngineModel[]>;
15
+ executeTurn(request: EngineTurnRequest): EngineTurnExecution;
16
+ preflightTurn(_request: EngineTurnRequest): Promise<void>;
17
+ handleTurnError(ctx: EngineTurnErrorContext): Promise<boolean>;
18
+ }