@foxden-app/foxclaw 0.5.19 → 0.5.21
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.
- package/.env.example +4 -0
- package/CHANGELOG.md +26 -0
- package/README.md +1 -1
- package/dist/auth/cross_node_sync.d.ts +55 -0
- package/dist/auth/cross_node_sync.js +199 -2
- package/dist/config.d.ts +2 -0
- package/dist/config.js +2 -0
- package/dist/controller/controller.d.ts +7 -1
- package/dist/controller/controller.js +277 -82
- package/dist/i18n.d.ts +28 -0
- package/dist/i18n.js +28 -0
- package/dist/main.js +141 -7
- package/dist/store/database.d.ts +9 -0
- package/dist/store/database.js +87 -0
- package/docs/cross-node-auth-sync.md +5 -1
- package/docs/user-manual.md +4 -1
- package/docs/zh/cross-node-auth-sync.md +5 -1
- package/docs/zh/user-manual.md +4 -1
- package/package.json +1 -1
package/docs/user-manual.md
CHANGED
|
@@ -425,7 +425,7 @@ OpenAI does not publish a fixed ChatGPT refresh-token lifetime or an old-token r
|
|
|
425
425
|
|
|
426
426
|
### 6.4 Cross-Node Auth Sync
|
|
427
427
|
|
|
428
|
-
Cross-node auth sync is disabled by default. It is for multiple machines you control that share the same legally owned ChatGPT auth candidate pool, so a token refreshed by Codex on one node can be copied to the others. v1 uses Telegram Bot-to-Bot private messages to carry encrypted files, so it does not require public IPs or FRP. The recommended default is one contact bot per node; other bots on the same node keep using local auth mirroring. In multi-bot mode, the default contact is the first token in `TG_BOT_TOKENS`. The contact bot private chat reports send, receive, queue, import, failure, recovery-query, and manual-intervention states; refresh/send/import bursts are grouped into summaries, while recovery and manual-intervention notices remain explicit. Per-candidate validation failures are shown as candidate failures instead of overwriting the sync-system last error. Recent bot-to-bot traffic is also kept in an event ring so `/auth sync events [filter]` and `/auth sync trace <requestId>` can explain a specific candidate, peer, or request.
|
|
428
|
+
Cross-node auth sync is disabled by default. It is for multiple machines you control that share the same legally owned ChatGPT auth candidate pool, so a token refreshed by Codex on one node can be copied to the others. v1 uses Telegram Bot-to-Bot private messages to carry encrypted files, so it does not require public IPs or FRP. The recommended default is one contact bot per node; other bots on the same node keep using local auth mirroring. In multi-bot mode, the default contact is the first token in `TG_BOT_TOKENS`. The contact bot private chat reports send, receive, queue, import, failure, recovery-query, and manual-intervention states; refresh/send/import bursts are grouped into summaries, while recovery and manual-intervention notices remain explicit. Remote import validation temporarily restarts the local Codex app-server; FoxClaw marks that window non-idle, and ordinary messages received during it get a short retry notice instead of running against a restarting bridge. Per-candidate validation failures are shown as candidate failures instead of overwriting the sync-system last error. Recent bot-to-bot traffic is also kept in an event ring so `/auth sync events [filter]` and `/auth sync trace <requestId>` can explain a specific candidate, peer, or request.
|
|
429
429
|
|
|
430
430
|
For the full design, safety boundaries, `.env` examples, and troubleshooting, read the [Cross-Node Auth Sync Setup Guide](./cross-node-auth-sync.md).
|
|
431
431
|
|
|
@@ -448,6 +448,8 @@ AUTH_SYNC_PEERS=@other_node_bot,@third_node_bot
|
|
|
448
448
|
AUTH_SYNC_CLUSTER_ID=my-codex-auth-pool
|
|
449
449
|
# Optional; FoxClaw generates and persists a local node id when omitted.
|
|
450
450
|
AUTH_SYNC_NODE_ID=workstation-a
|
|
451
|
+
# Optional resource-rich mode: auto-delete unrecoverable candidates across peers.
|
|
452
|
+
AUTH_AUTO_DELETE_NEEDS_REPAIR=false
|
|
451
453
|
```
|
|
452
454
|
|
|
453
455
|
Safety boundaries:
|
|
@@ -457,6 +459,7 @@ Safety boundaries:
|
|
|
457
459
|
- Remote imports wait for global local idleness, temporarily switch to the candidate for app-server usage validation, and only then write the candidate.
|
|
458
460
|
- A same-name candidate known to belong to a different account id, or to a different identifiable ChatGPT user/email under the same account, is never overwritten.
|
|
459
461
|
- Cross-node recovery only pulls an already-held valid peer copy and does not rotate refresh tokens during recovery. If no peer has a usable copy, it stops and asks you to maintain auth manually. The background 9-day proactive refresh separately requests the cross-node refresh lease and skips that cycle if the lease is not granted.
|
|
462
|
+
- When `AUTH_AUTO_DELETE_NEEDS_REPAIR=true` is enabled, or the same option is turned on in `/config`, unrecoverable candidates are deleted and propagated to peers with a delete tombstone. Private notifications collapse to an auth-pool summary: total seen, alive, and invalid-deleted.
|
|
460
463
|
|
|
461
464
|
Dual-active behavior:
|
|
462
465
|
|
|
@@ -92,6 +92,7 @@ AUTH_SYNC_KEY=<至少32字节的共享密钥>
|
|
|
92
92
|
AUTH_SYNC_CLUSTER_ID=my-codex-auth-pool
|
|
93
93
|
AUTH_SYNC_NODE_ID=workstation-a
|
|
94
94
|
AUTH_SYNC_PEERS=@foxclaw_node_b_bot
|
|
95
|
+
AUTH_AUTO_DELETE_NEEDS_REPAIR=false
|
|
95
96
|
```
|
|
96
97
|
|
|
97
98
|
节点 B:
|
|
@@ -103,6 +104,7 @@ AUTH_SYNC_KEY=<至少32字节的共享密钥>
|
|
|
103
104
|
AUTH_SYNC_CLUSTER_ID=my-codex-auth-pool
|
|
104
105
|
AUTH_SYNC_NODE_ID=workstation-b
|
|
105
106
|
AUTH_SYNC_PEERS=@foxclaw_node_a_bot
|
|
107
|
+
AUTH_AUTO_DELETE_NEEDS_REPAIR=false
|
|
106
108
|
```
|
|
107
109
|
|
|
108
110
|
多节点时,`AUTH_SYNC_PEERS` 用英文逗号分隔:
|
|
@@ -166,7 +168,9 @@ auth sync 测试完成:已发送 1,收到回应 1。
|
|
|
166
168
|
|
|
167
169
|
注意:`/auth sync push all` 的“已发送”只代表本节点把加密包发给 Telegram 成功,不代表对端已经写盘。对端只有在全局空闲、usage 验证通过、同名候选 account id 一致且 ChatGPT 用户/邮箱身份兼容,并且远端 `last_refresh` 比本地更新时才会覆盖文件。如果本地已经是相同或更新版本,文件不会变化,`最近导入` 也可能保持为空。
|
|
168
170
|
|
|
169
|
-
启用跨节点同步后,联系人 bot 的私聊会收到节点级通知:本机 auth 更新并开始发往哪些 peer、收到远端包后是排队还是立即验证、导入成功/跳过/失败原因、auth 恢复时正在查询哪些 peer、peer 回应了什么,以及所有 peer
|
|
171
|
+
启用跨节点同步后,联系人 bot 的私聊会收到节点级通知:本机 auth 更新并开始发往哪些 peer、收到远端包后是排队还是立即验证、导入成功/跳过/失败原因、auth 恢复时正在查询哪些 peer、peer 回应了什么,以及所有 peer 都无法提供可用副本时的人工介入提示。刷新、发送、导入密集发生时会合并成简短汇总,避免一个候选更新拆成开始、收到、镜像写入和完成多条消息;恢复和人工介入提示仍会明确发出。远端导入验证会临时重启本机 Codex app-server;这段窗口里 FoxClaw 会把 runtime 视为非空闲,并让普通消息稍后重发,而不是送进正在重启的 bridge。通知不会包含 auth 内容、token 或同步密文。
|
|
172
|
+
|
|
173
|
+
如果这是资源富裕的账号池、不关心单个候选如何维护,可以启用 `AUTH_AUTO_DELETE_NEEDS_REPAIR=true`,或用 `/config auth_auto_delete on` 运行时打开。无法恢复、原本会标记为需要修复的候选会直接本地删除,并向 peer 发送删除 tombstone;候选级同步/删除消息会压缩成 auth 池摘要。
|
|
170
174
|
|
|
171
175
|
从 0.5.2 起,`/auth sync status` 会把同步系统级 `最近错误` 和单个 auth 的 `候选失败` 分开显示。比如某个远端候选返回 `token_invalidated` 或 access token 过期时,只会记录到该候选名下面;当前 `auth.json` 是否健康仍以当前 auth 的 usage 验证为准。`local candidate is already newer or equal` 属于正常跳过,不会记为错误。
|
|
172
176
|
|
package/docs/zh/user-manual.md
CHANGED
|
@@ -425,7 +425,7 @@ OpenAI 没有公开 ChatGPT refresh token 的固定有效期或旧 token 重放
|
|
|
425
425
|
|
|
426
426
|
### 6.4 跨节点 auth 同步
|
|
427
427
|
|
|
428
|
-
跨节点 auth 同步默认关闭。它适合你在多台自己控制的机器上使用同一组合法 ChatGPT 账号候选,并希望某台机器上 Codex 自动刷新出的新 token 能同步到其他机器。v1 使用 Telegram Bot-to-Bot 私聊传输加密文件,不需要公网 IP 或 FRP。推荐每台机器选择一个联系人 bot;同一节点内其他 bot 继续使用本机 auth 镜像。多 bot 模式下,默认联系人是 `TG_BOT_TOKENS` 的第一个 token。联系人 bot
|
|
428
|
+
跨节点 auth 同步默认关闭。它适合你在多台自己控制的机器上使用同一组合法 ChatGPT 账号候选,并希望某台机器上 Codex 自动刷新出的新 token 能同步到其他机器。v1 使用 Telegram Bot-to-Bot 私聊传输加密文件,不需要公网 IP 或 FRP。推荐每台机器选择一个联系人 bot;同一节点内其他 bot 继续使用本机 auth 镜像。多 bot 模式下,默认联系人是 `TG_BOT_TOKENS` 的第一个 token。联系人 bot 的私聊会报告发送、接收、排队、导入、失败、恢复查询和人工介入提示;刷新、发送、导入密集发生时会合并成汇总,恢复和人工介入提示仍会明确发出。远端导入验证会临时重启本机 Codex app-server;FoxClaw 会把这段窗口标记为非空闲,期间收到的普通消息会收到稍后重发提示,不再进入正在重启的 bridge。单个候选验证失败会作为“候选失败”显示,不会覆盖同步系统级最近错误。最近 bot-to-bot 通讯会保存在事件环里,可用 `/auth sync events [过滤]` 和 `/auth sync trace <requestId>` 追查某个候选、peer 或请求。
|
|
429
429
|
|
|
430
430
|
完整设计、安全边界、`.env` 示例和排查步骤见 [跨节点 auth 同步配置指南](./cross-node-auth-sync.md)。
|
|
431
431
|
|
|
@@ -448,6 +448,8 @@ AUTH_SYNC_PEERS=@other_node_bot,@third_node_bot
|
|
|
448
448
|
AUTH_SYNC_CLUSTER_ID=my-codex-auth-pool
|
|
449
449
|
# 可选;不填时 FoxClaw 会生成并持久化本机 node id
|
|
450
450
|
AUTH_SYNC_NODE_ID=workstation-a
|
|
451
|
+
# 可选;资源富裕模式下自动跨节点剔除无法恢复的候选
|
|
452
|
+
AUTH_AUTO_DELETE_NEEDS_REPAIR=false
|
|
451
453
|
```
|
|
452
454
|
|
|
453
455
|
安全边界:
|
|
@@ -457,6 +459,7 @@ AUTH_SYNC_NODE_ID=workstation-a
|
|
|
457
459
|
- 远端导入必须等本机全局空闲,再临时切换到待验证 auth、重启 app-server、读取 usage 验证成功后才写入候选。
|
|
458
460
|
- 同名候选如果已知属于不同 account id,或属于同一 account 下不同的可识别 ChatGPT 用户/邮箱,永远拒绝覆盖。
|
|
459
461
|
- 跨节点恢复只拉取 peer 已持有的有效副本,不会在恢复过程中直接轮换 refresh token;找不到有效副本时会停止,提示你人工维护授权。后台 9 天主动刷新会单独申请跨节点刷新锁,拿不到锁就跳过本轮。
|
|
462
|
+
- 如果开启 `AUTH_AUTO_DELETE_NEEDS_REPAIR=true` 或在 `/config` 中打开自动剔除,无法恢复的候选会直接删除并向 peer 传播删除 tombstone;私聊通知会压缩为 auth 池摘要:历史总数、存活数、因失效剔除数。
|
|
460
463
|
|
|
461
464
|
双主动流程:
|
|
462
465
|
|