fix(terminal-browser): エージェントが開いたときはペインのフォーカスを奪わない - #526
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
症状
エージェントが
terminal-browser open --split rightで裏に 1 枚開くたびに、ユーザーの入力先がブラウザのペインへ飛ぶ。打っている最中に持っていかれる。原因
terminal-browser の herdr 連携が split に
--focusを決め打ちで渡している。分割の後は全部明示的な pane id で動いている (
pane swap --pane newPaneId、pane run newPaneId) ので、--focusを外しても後続は壊れない。直し方
cli/dist/main.jsにsubstituteInPlaceを当てて、環境変数で切り替えられるようにした。判断は bin ラッパー側。見分けは stdout が端末かどうか。エージェントはパイプ越しに叩くのでここで分かれる。
TERMINAL_BROWSER_FOCUS=1を置けば常に移る。cli/dist/main.jsは .app の外なので、同梱 Electron の署名には影響しない (ビルド後にcodesign -vが通ることを確認済み)。cmux 側にも"--focus"があるが別のリテラルなので巻き込まない (--replace-failで一致は 1 箇所)。確認
実機で、パイプ越しに
open --split rightを実行 → 開いた後もフォーカスは元のw1:p3H/ タブw1:t33のままだった。