feat(config,tui): expose system_prompt + fix VSCode keyboard layout (#55)#189
Open
quangdang46 wants to merge 1 commit into
Open
feat(config,tui): expose system_prompt + fix VSCode keyboard layout (#55)#189quangdang46 wants to merge 1 commit into
quangdang46 wants to merge 1 commit into
Conversation
Two unrelated quality-of-life fixes upstream PR #55 bundled together: 1. **Config: provider.system_prompt = Option<String>** - Add a new `system_prompt` field on ProviderConfig (in crates/jcode-config-types) so users can pin a custom default system prompt in ~/.jcode/config.toml or a project-local config. - In Agent::new, initialize `system_prompt_override` from `crate::config::config().provider.system_prompt.clone()` instead of unconditionally `None`. Existing /system overrides still take precedence within a session. 2. **TUI: disable keyboard enhancement on VSCode-family terminals** - Add SystemProfile::is_vscode_terminal() returning true when the detected terminal is "vscode" (covers VSCode, VSCodium, Cursor, Windsurf integrated terminals — they all identify as "vscode" via TERM_PROGRAM). - In tui_policy_for(), force enable_keyboard_enhancement = false when the host is VSCode. Crossterm's enhancement layer reconstructs shifted characters using a hardcoded US layout, so non-US layouts (e.g. Finnish Shift+7 = '/' was rendered as '&') were broken inside the VSCode integrated terminal. Test `test_tui_policy_disables_keyboard_enhancement_on_vscode_terminal` asserts the policy flips for a vscode-typed SystemProfile and that unrelated knobs (enable_focus_change) are not globally crippled. Ports upstream PR 1jehuang#55. Closes #55
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.
What
Two unrelated quality-of-life fixes upstream PR #55 bundled together:
1. Config —
provider.system_prompt = Option<String>Add a new
system_promptfield onProviderConfigso users can pin a custom default system prompt in~/.jcode/config.toml(or a project-local config). When set, every new agent session is initialized with this string assystem_prompt_override.2. TUI — disable keyboard enhancement on VSCode-family terminals
Crossterm's keyboard enhancement reconstructs shifted characters using a hardcoded US layout. Non-US keyboards (e.g. Finnish
Shift+7 = /) end up rendering as the wrong character (&) inside the VSCode integrated terminal because xterm.js has already done the layout translation upstream.This addresses issue #55: #55
Changes
system_prompt: Option<String>toProviderConfig, plus defaultNone.Agent::newinitializessystem_prompt_overridefrom the new config field instead of alwaysNone.SystemProfile::is_vscode_terminal(). Intui_policy_for, forceenable_keyboard_enhancement = falsewhen host is VSCode (covers VSCode, VSCodium, Cursor, Windsurf integrated terminals — they all identify as "vscode" viaTERM_PROGRAM).test_tui_policy_disables_keyboard_enhancement_on_vscode_terminalasserts the policy flips for a vscode-typedSystemProfileand that unrelated knobs are not globally crippled.Tests
Notes
Ports upstream PR 1jehuang#55.