@foxden-app/foxclaw 0.5.38 → 0.5.39

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/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
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.5.39 - 2026-06-17
6
+
7
+ ### 中文
8
+ - `/update` 被运行时活动或 auth 同步挡住时,Telegram 现在会用 RichMessage 展示具体阻塞清单,包括活跃 runtime、远端 auth 候选导入队列、最近收到时间、最近失败候选和失败原因。
9
+ - 阻塞提示明确说明“远端 auth 候选导入队列”不等于本机 auth 文件数量,方便识别其他节点残留旧 team 账号或删除广播未同步的问题。
10
+
11
+ ### English
12
+ - `/update` now reports concrete blockers as a Telegram RichMessage when runtime work or auth sync prevents a chat-driven update, including active runtimes, remote auth import backlog, last receive time, recent failed candidate, and failure reason.
13
+ - The blocked-update message clarifies that remote auth candidate imports are not the same as local auth file count, making stale team accounts or missed delete broadcasts on another node easier to diagnose.
14
+
5
15
  ## 0.5.38 - 2026-06-17
6
16
 
7
17
  ### 中文
@@ -288,6 +288,9 @@ export declare class BridgeSessionCore {
288
288
  private handleAuthReloadCommand;
289
289
  private canRunGlobalAuthRefresh;
290
290
  private handleSelfUpdateCommand;
291
+ private formatSelfUpdateBlockedMessage;
292
+ private collectSelfUpdateBlockers;
293
+ private readServiceStatusForUpdateBlockers;
291
294
  private scheduleSelfUpdateStatusPoll;
292
295
  private clearSelfUpdateStatusPoll;
293
296
  private pollSelfUpdateStatus;
@@ -4343,7 +4343,7 @@ export class BridgeSessionCore {
4343
4343
  return;
4344
4344
  }
4345
4345
  if (!this.isIdleForServiceUpdate() || this.store.countPendingApprovals() > 0 || this.store.countPendingUserInputs() > 0 || (this.coordinator?.canSelfUpdate && !this.coordinator.canSelfUpdate())) {
4346
- await this.sendMessage(scopeId, t(locale, 'update_blocked_active'));
4346
+ await this.sendRichInternalMessage(scopeId, '/update', await this.formatSelfUpdateBlockedMessage(locale));
4347
4347
  return;
4348
4348
  }
4349
4349
  const status = await this.selfUpdater.readStatus();
@@ -4365,6 +4365,140 @@ export class BridgeSessionCore {
4365
4365
  await this.sendMessage(scopeId, t(locale, 'update_failed', { error: formatUserError(error) }));
4366
4366
  }
4367
4367
  }
4368
+ async formatSelfUpdateBlockedMessage(locale) {
4369
+ const blockers = await this.collectSelfUpdateBlockers(locale);
4370
+ if (locale === 'zh') {
4371
+ return [
4372
+ '现在不能从 Telegram 里升级 FoxClaw,因为后台仍有活动:',
4373
+ '',
4374
+ ...(blockers.length > 0 ? blockers.map((blocker) => `- ${blocker}`) : [`- ${t(locale, 'update_blocked_active')}`]),
4375
+ '',
4376
+ '说明:远端 auth 候选导入队列不等于本机 auth 文件数量;它可能来自其他节点还没清理或没收到删除广播的旧 team 账号。',
4377
+ '处理:普通 Codex 回复可用 /interrupt;auth 同步队列请等待消化,或在远端清理旧候选后补发删除/安全同步。终端 foxclaw update 不受这个聊天保护限制。',
4378
+ ].join('\n');
4379
+ }
4380
+ return [
4381
+ 'FoxClaw cannot be updated from Telegram because background work is still active:',
4382
+ '',
4383
+ ...(blockers.length > 0 ? blockers.map((blocker) => `- ${blocker}`) : [`- ${t(locale, 'update_blocked_active')}`]),
4384
+ '',
4385
+ 'Note: remote auth import backlog is not the same as the number of local auth files; it can come from stale team accounts on another node.',
4386
+ 'Action: use /interrupt for normal Codex turns; let auth sync drain, or clean the remote stale candidates and resend delete/safe-sync events. Terminal foxclaw update bypasses this chat guard.',
4387
+ ].join('\n');
4388
+ }
4389
+ async collectSelfUpdateBlockers(locale) {
4390
+ const blockers = [];
4391
+ const pendingApprovals = this.pendingApprovalMessages.size + this.store.countPendingApprovals();
4392
+ const pendingUserInputs = this.pendingUserInputs.size + this.store.countPendingUserInputs();
4393
+ const localLabels = locale === 'zh'
4394
+ ? {
4395
+ activeTurns: '当前 runtime 活跃回复',
4396
+ approvals: '待处理审批',
4397
+ userInputs: '待回答问题',
4398
+ mcp: '待处理 MCP 交互',
4399
+ logins: '登录流程',
4400
+ rotation: 'auth 自动轮换',
4401
+ refreshAll: 'auth 全量刷新',
4402
+ validation: '远端 auth 校验',
4403
+ turnStart: '回复启动中',
4404
+ otherRuntime: '其他 runtime 活跃',
4405
+ weixin: '微信 runtime 活跃回复',
4406
+ authQueue: '远端 auth 候选导入队列',
4407
+ received: '最近收到',
4408
+ imported: '最近导入',
4409
+ failed: '最近失败',
4410
+ lease: 'auth 同步租约',
4411
+ error: 'auth 同步错误',
4412
+ coordinator: '服务协调器报告仍忙',
4413
+ }
4414
+ : {
4415
+ activeTurns: 'Current runtime active turns',
4416
+ approvals: 'Pending approvals',
4417
+ userInputs: 'Pending questions',
4418
+ mcp: 'Pending MCP interactions',
4419
+ logins: 'Login flows',
4420
+ rotation: 'Auth rotation',
4421
+ refreshAll: 'Auth refresh-all',
4422
+ validation: 'Remote auth validation',
4423
+ turnStart: 'Turn startup',
4424
+ otherRuntime: 'Other runtime active turns',
4425
+ weixin: 'Weixin runtime active turns',
4426
+ authQueue: 'Remote auth candidate import queue',
4427
+ received: 'last received',
4428
+ imported: 'last imported',
4429
+ failed: 'recent failure',
4430
+ lease: 'Auth sync lease',
4431
+ error: 'Auth sync error',
4432
+ coordinator: 'Service coordinator reports busy',
4433
+ };
4434
+ if (this.activeTurns.size > 0)
4435
+ blockers.push(`${localLabels.activeTurns}: ${this.activeTurns.size}`);
4436
+ if (pendingApprovals > 0)
4437
+ blockers.push(`${localLabels.approvals}: ${pendingApprovals}`);
4438
+ if (pendingUserInputs > 0)
4439
+ blockers.push(`${localLabels.userInputs}: ${pendingUserInputs}`);
4440
+ if (this.pendingMcpElicitations.size > 0)
4441
+ blockers.push(`${localLabels.mcp}: ${this.pendingMcpElicitations.size}`);
4442
+ if (this.pendingLoginsByScope.size > 0)
4443
+ blockers.push(`${localLabels.logins}: ${this.pendingLoginsByScope.size}`);
4444
+ if (this.authRotationInProgress)
4445
+ blockers.push(localLabels.rotation);
4446
+ if (this.authRefreshAllInProgress)
4447
+ blockers.push(localLabels.refreshAll);
4448
+ if (this.externalAuthValidationInProgress)
4449
+ blockers.push(localLabels.validation);
4450
+ if (this.turnStartInProgress > 0)
4451
+ blockers.push(`${localLabels.turnStart}: ${this.turnStartInProgress}`);
4452
+ const serviceStatus = await this.readServiceStatusForUpdateBlockers();
4453
+ if (serviceStatus) {
4454
+ const activeBots = serviceStatus.bots
4455
+ .filter((runtime) => runtime.activeTurns > 0)
4456
+ .map((runtime) => `${runtime.username ? `@${runtime.username}` : runtime.id} ${runtime.activeTurns}`);
4457
+ if (activeBots.length > 0) {
4458
+ blockers.push(`${localLabels.otherRuntime}: ${activeBots.join(', ')}`);
4459
+ }
4460
+ if ((serviceStatus.weixinRuntime?.activeTurns ?? 0) > 0) {
4461
+ blockers.push(`${localLabels.weixin}: ${serviceStatus.weixinRuntime.activeTurns}`);
4462
+ }
4463
+ const authSync = serviceStatus.authSync;
4464
+ if (authSync?.enabled) {
4465
+ if (authSync.pendingImports > 0) {
4466
+ const details = [
4467
+ authSync.lastReceivedAt ? `${localLabels.received} ${authSync.lastReceivedAt}` : null,
4468
+ authSync.lastImportedAt ? `${localLabels.imported} ${authSync.lastImportCandidate ?? authSync.lastImportedAt}` : null,
4469
+ ].filter(Boolean);
4470
+ blockers.push(`${localLabels.authQueue}: ${authSync.pendingImports}${details.length > 0 ? ` (${details.join('; ')})` : ''}`);
4471
+ }
4472
+ const latestFailure = authSync.candidateFailures?.[0] ?? null;
4473
+ if (latestFailure) {
4474
+ const source = latestFailure.sourceLabel ?? latestFailure.peer ?? latestFailure.sourceNodeId;
4475
+ blockers.push(`${localLabels.failed}: ${latestFailure.candidateName}: ${latestFailure.reason}${source ? ` (${source})` : ''}`);
4476
+ }
4477
+ if (authSync.activeLeaseId)
4478
+ blockers.push(`${localLabels.lease}: ${authSync.activeLeaseId}`);
4479
+ if (authSync.lastError)
4480
+ blockers.push(`${localLabels.error}: ${authSync.lastError}`);
4481
+ }
4482
+ }
4483
+ else if (this.coordinator?.canSelfUpdate && !this.coordinator.canSelfUpdate()) {
4484
+ blockers.push(localLabels.coordinator);
4485
+ }
4486
+ if (blockers.length === 0 && this.coordinator?.canSelfUpdate && !this.coordinator.canSelfUpdate()) {
4487
+ blockers.push(localLabels.coordinator);
4488
+ }
4489
+ return blockers;
4490
+ }
4491
+ async readServiceStatusForUpdateBlockers() {
4492
+ if (!this.coordinator?.getServiceStatus)
4493
+ return null;
4494
+ try {
4495
+ return await this.coordinator.getServiceStatus();
4496
+ }
4497
+ catch (error) {
4498
+ this.logger.warn('self_update.service_status_failed', { error: toErrorMeta(error) });
4499
+ return null;
4500
+ }
4501
+ }
4368
4502
  scheduleSelfUpdateStatusPoll(delay = SELF_UPDATE_STATUS_POLL_MS) {
4369
4503
  if (!this.selfUpdater || this.selfUpdatePollTimer) {
4370
4504
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foxden-app/foxclaw",
3
- "version": "0.5.38",
3
+ "version": "0.5.39",
4
4
  "description": "Foxden local execution claw for controlling Codex from trusted chat interfaces.",
5
5
  "type": "module",
6
6
  "main": "dist/main.js",