feat(cli): give the /btw panel a dedicated input editor - #3640
Conversation
🦋 Changeset detectedLatest commit: 9818178 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9818178f28
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| // used to when it doubled as the panel's input. | ||
| editor.connectedAbove = true; | ||
| this.host.state.btwPanelContainer.addChild(editor); | ||
| this.host.state.ui.setFocus(editor); |
There was a problem hiding this comment.
Restore focus to the /btw editor after modal dialogs
When /btw is opened while the main agent is still running and that agent raises an approval or question dialog, closing the dialog calls KimiTUI.restoreEditor(), which always focuses state.editor (kimi-tui.ts:3764-3768) instead of this dedicated editor. The panel remains visible, but subsequent typing and Enter now go through the main send path because this commit also removed the old /btw interception, so the user's intended follow-up can be queued or sent to the wrong agent. Modal restoration needs to return focus to the active panel editor when one exists.
Useful? React with 👍 / 👎.
|
Closing: product focus moved to the desktop /btw panel (kimi-code-app). The TUI-side dedicated input may be revisited later. |
|
Closing: product focus moved to the desktop /btw panel (kimi-code-app). The TUI-side dedicated input may be revisited later. |
Related Issue
Stacks on #3619 (which stacks on #3613). This PR is the follow-up that gives the /btw panel its own input box; base is set to
feat/btw-image-supportbecause the media path added there (prepareBtwPrompt/trackBtwDispatch, plus the daemon-sideReadMediaFilewhitelist) is exactly what the dedicated editor reuses for pasted images.Problem
The /btw panel had no input of its own: it visually borrowed the main editor (
connectedAbovestitching) and intercepted the main send path (sendUserInput) to reroute keystrokes to the side agent. That coupling meant the panel inherited every main-input semantic (queue, steer, bash mode, …) through a fragile interception layer, and pasted images only worked because the shared editor happened to write into the same buffer.What changed
Design decisions
feat/btw-image-support(feat(cli): send pasted images to the /btw side agent #3619) and based this PR on it. The dedicated editor's image support is a thin reuse of feat(cli): send pasted images to the /btw side agent #3619'sprepareBtwPrompt(placeholder → imageStore → daemon file-ref parts at submit); going self-contained would mean duplicating that media chain.btwPanelContainerdirectly under the panel withconnectedAbove = true, so the panel stitches onto its own editor exactly the way it used to stitch onto the main one. The main editor simply reverts to its plain rounded top border — input and visuals are now fully decoupled.CustomEditorclass as the main input, but wired with only what a side panel needs:imageStoreplaceholder → ingestion →prepareBtwPromptexpansion path as the main editor), inline-skill token extraction on submit (existing follow-up behavior), Esc close, ↑↓ panel scroll, Ctrl+C cancel/close.disableBashModeoption onCustomEditor— a leading!stays literal text), no slash-command/@-mention autocomplete provider, no Ctrl+B/T/P/N bindings, no input history. Placeholder hint stays in the panel body ("Ready for a side question…") and the border hint ("Esc close · ↑↓ scroll") rather than inventing an editor placeholder concept.clear()on session reset) returns focus to the main editor.By file
components/editor/custom-editor.ts— newdisableBashModeoption guarding both!-mode entry paths (typed and pasted).controllers/btw-panel.ts—open()now constructs and wires a dedicatedCustomEditor;sendUserInputinterception is deleted, replaced by the editor's ownonSubmit(busy → restore draft + transient notice; idle →panel.submitwith inline-skill extraction); mount/close/clear manage the editor and focus.controllers/editor-keyboard.ts—handleClipboardImagePastebecame publicpasteClipboardImage(target)so both editors share one paste/ingestion path and oneimageStore.kimi-tui.ts— removed the twobtwPanelController.sendUserInputinterception calls fromsendNormalUserInput/sendInlineSkillUserInput; addedpasteImageIntoEditor(BtwPanelHost) delegating to the shared paste path.Checklist
/approve).gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.