Skip to content

fix(delegate): configurable fleet-inspector shortcut + move default off ctrl+alt+f (#412) - #414

Merged
ranxianglei merged 1 commit into
masterfrom
2026-09-13_fleet-shortcut-config
Sep 13, 2026
Merged

ranxianglei merged 1 commit into
masterfrom
2026-09-13_fleet-shortcut-config

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Problem

With both billion-context-pi (ACP) and pi-subagents installed, Pi prints an orange warning every startup:

Extension shortcut conflict: 'ctrl+alt+f' registered by both billion-context-pi and pi-subagents. Using pi-subagents.

Both extensions unconditionally hard-code ctrl+alt+f. Pi's loader (getShortcuts()) only warns on cross-extension conflicts and lets the later-loaded binding silently win — no dedup, no user override. So one of the two fleet inspectors can't be opened from the keyboard.

Same conflict reported on the other side: nicobailon/pi-subagents#2196

Fix

Make ACP's fleet-inspector key configurable and move its default off the collision:

  • New acp.json option delegate.fleetShortcut (any Pi key id); empty string "" disables registration.
  • Default ctrl+alt+f → ctrl+alt+d: the inspector is already reachable via /acp-fleet, while pi-subagents' status bar advertises Ctrl+Alt+F Fleet (muscle memory lives there), so ACP yields. Matches the reporter's local workaround.
  • TUI widget hint now renders the effective key dynamically (formatShortcutLabel, mirroring pi-subagents casing) instead of a hard-coded string.
  • Non-string values fall back to the default with a logged warning (never fail startup).

Files: src/config.ts (DEFAULT_FLEET_SHORTCUT / resolveFleetShortcut / DelegatePolicy), src/index.ts (register per policy at session_start), src/fleet-widget.ts (dynamic hint), tests/fleet-shortcut.test.ts (new), CONFIGURATION.md (+zh-CN), CHANGELOG.md.

Verification

  • npm run typecheck → clean
  • npm test → 703 tests, 700 pass, 0 fail, 3 skipped (incl. 7 new)
  • npm run build → clean; @earendil-works/pi-tui import is type-only (erased, no runtime dep)

One decision point

The new default ctrl+alt+d resolves the collision without touching pi-subagents and is fully overridable via delegate.fleetShortcut (or "" to disable). If you'd prefer ACP keeps ctrl+alt+f and pi-subagents yields instead, say so and I'll flip it.

Fixes #412

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

Reviewed PR #414 (single commit 8c18d24, based on current master a8dfb49). Checked out the head locally and ran the full gate independently.

Verification (fresh run)

  • npm run typecheck → clean (exit 0)
  • npm run build → clean; the new @earendil-works/pi-tui import is type-only (import type { KeyId }), erased at bundle time — zero runtime deps preserved
  • npm test → 703 tests, 700 pass, 0 fail, 3 skipped; the 7 new tests/fleet-shortcut.test.ts cases all green (default value / unset→default / boolean shorthand / custom honored / "" disables / non-string fallback / formatShortcutLabel)

Diff cleanliness — clean. All 7 changed files are on-topic (src/config.ts, src/index.ts, src/fleet-widget.ts, new test, CONFIGURATION.md en/zh, CHANGELOG.md). No version bump, no lockfile churn (correct for a content commit), no stray/generated files. Base is current master — no rebase needed.

Correctness — read each change in context:

  • resolveFleetShortcut (src/config.ts:325) follows the existing warn-and-fallback pattern: a string passes through verbatim ("" = disable), a non-string → logged warning + default, undefined → default silently. Consistent with resolveMaxDepth.
  • The policy is resolved once (const delegatePolicy = resolveDelegate(...)) and the registration is triple-gated: enabled && typeof pi.registerShortcut === "function" && fleetShortcut !== "" (src/index.ts:211–217); the widget receives the same resolved value (src/index.ts:235).
  • I verified the "an invalid value never fails startup" doc claim against Pi's actual registerShortcut implementation: it only does extension.shortcuts.set(shortcut, …) with no key-id validation, so a bogus string registers a never-matching binding rather than throwing. The as KeyId cast is therefore runtime-harmless (and it's not as any).
  • formatShortcutLabel title-cases modifiers + uppercases single keys (ctrl+alt+d → Ctrl+Alt+D), matching pi-subagents casing; the module-level shortcut state is reset in both setContext and dispose.

Duplicate screening — searched open/closed issues & PRs for the fleet-shortcut / pi-subagents conflict: no duplicate. The PR correctly carries Fixes #412 (the originating bug report); the nicobailon/pi-subagents#2196 cross-ref is noted.

Decision point — my recommendation: keep the default at ctrl+alt+d (ACP yields ctrl+alt+f). Rationale: the inspector is already reachable via /acp-fleet regardless, pi-subagents' status bar permanently advertises Ctrl+Alt+F Fleet (muscle memory lives there), and it matches the reporter's working local patch — so co-installed setups drop the orange warning with zero config. It stays fully reversible per-user via delegate.fleetShortcut (or "" to disable). If you'd rather flip it (ACP keeps ctrl+alt+f, ask pi-subagents to yield), say so and I'll flip the constant — but the current direction is the lower-friction option, so I'd merge as-is.

One non-blocking FYI (pre-existing, not introduced here): on a host that lacks pi.registerShortcut (older/embedded Pi), the widget hint still prints the key even though no binding was actually registered. /acp-fleet in the same line always works, so it's purely cosmetic; the old hard-coded string had the identical property. Not worth churning this focused PR.

结论(中文一句话): 独立复核了 PR #414 —— typecheck/build/全量测试(703 例)全绿、diff 干净(仅 7 个相关文件,无版本/锁文件改动)、配置解析与注册逻辑正确且已对照 Pi 源码确认「非法键不会导致启动失败」、无重复项;建议按当前默认键 ctrl+alt+d(ACP 让位)合并,可经 delegate.fleetShortcut 覆盖,可以合并。

…ff ctrl+alt+f (#412)

Add delegate.fleetShortcut (acp.json) so the acp_delegate fleet-inspector TUI key can be configured or disabled (empty string). Default moved ctrl+alt+f -> ctrl+alt+d to stop colliding with pi-subagents' hard-coded ctrl+alt+f (Pi loader cannot dedupe/override cross-extension shortcut conflicts). fleet-widget hint now renders the effective key dynamically.
@ranxianglei
ranxianglei force-pushed the 2026-09-13_fleet-shortcut-config branch from 8c18d24 to edc7d2f Compare September 13, 2026 07:25
@github-actions

Copy link
Copy Markdown
Contributor

📦 Built Extension Artifact

Branch: 2026-09-13_fleet-shortcut-config (edc7d2f)

Option A — Install from npm PR tag (recommended)

pi install npm:billion-context-pi@pr-414

Each push to this PR publishes a new version under the pr-414 npm tag.

Option B — Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pi-pr414.tgz
pi install ./package

This comment is automatically updated on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

Conflict with master is resolved — the branch is now rebased onto 3b2ddfe (docs #409 / prompt-pack / host Prime-fork fix) as single commit edc7d2f, pushed with --force-with-lease.

Two conflicts, both mechanical:

  1. src/index.ts import block — master's host fork-fix (宿主多会话支持(二):回合边界判定统一 + 子会话状态继承(#317 遗留) #364) moved CONFIG_DIR_NAME to the local ./config-dir.js fallback (the module contract requires that file to stay the only value import from the pi package). Kept master's line, and added this PR's KeyId import as type-only (import type { KeyId } from "@earendil-works/pi-tui"), which is erased at runtime so the contract holds.
  2. CHANGELOG.md — both sides had added fresh Unreleased entries; kept all of them, with the Extension shortcut conflict: ctrl+alt+f hard-coded in both billion-context-pi (ACP) and pi-subagents #412 entry on top.

Verified after the rebase: typecheck clean, node --test test/*.test.js 703/703, build OK.

@ranxianglei
ranxianglei merged commit 0ebecee into master Sep 13, 2026
9 checks passed
HangxiangMa pushed a commit to HangxiangMa/billion-context-pi that referenced this pull request Sep 21, 2026
…shortcut-config

fix(delegate): configurable fleet-inspector shortcut + move default off ctrl+alt+f (ranxianglei#412)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extension shortcut conflict: ctrl+alt+f hard-coded in both billion-context-pi (ACP) and pi-subagents

1 participant