fix(terminal): preserve OpenCode Ctrl+Enter on Windows (#33149)

OpenCode Ctrl+Enter sends CSI-u on local Windows ConPTY so it inserts a newline instead of submitting (as on other platforms). Fixes #25372.
This commit is contained in:
Pr1p
2026-10-24 18:59:57 -07:00
committed by GitHub
parent ec559c28fb
commit a289c98f24
3 changed files with 10 additions and 8 deletions
@@ -41,7 +41,7 @@ describe('hasCtrlEnterCsiUAuthorityForPane', () => {
)
it('authorizes only trusted Ctrl+Enter CSI-u consumers', () => {
for (const agent of ['droid', 'grok'] as const) {
for (const agent of ['droid', 'grok', 'opencode'] as const) {
expect(
hasCtrlEnterCsiUAuthorityForPane(
{
+6
View File
@@ -62,3 +62,9 @@ export type TuiAgentConfig = {
/** Ctrl+Enter encoding for agents that consume CSI-u without active kitty flags. */
ctrlEnterEncoding?: 'csi-u'
}
/** Authoring form: `launchCmd` and `expectedProcess` default to `detectCmd` (true for most agents). */
export type TuiAgentConfigSource = Omit<TuiAgentConfig, 'launchCmd' | 'expectedProcess'> & {
launchCmd?: string
expectedProcess?: string
}
+3 -7
View File
@@ -1,6 +1,6 @@
import type { TuiAgent } from './tui-agent'
import { getOrcaCliCommandNameForPlatform } from './orca-cli-command-name'
import type { TuiAgentConfig } from './tui-agent-config-types'
import type { TuiAgentConfig, TuiAgentConfigSource } from './tui-agent-config-types'
export type {
AgentPromptInjectionMode,
@@ -10,12 +10,6 @@ export type {
TuiAgentDetectionRuntime
} from './tui-agent-config-types'
/** Authoring form: `launchCmd` and `expectedProcess` default to `detectCmd` (true for most agents). */
type TuiAgentConfigSource = Omit<TuiAgentConfig, 'launchCmd' | 'expectedProcess'> & {
launchCmd?: string
expectedProcess?: string
}
function resolveTuiAgentConfig(source: TuiAgentConfigSource): TuiAgentConfig {
return {
...source,
@@ -103,6 +97,8 @@ const TUI_AGENT_CONFIG_SOURCE: Record<TuiAgent, TuiAgentConfigSource> = {
// was pasted blind, mid-startup (#22479). The signal itself fired every time in
// those runs, so the budget was the problem, not a dropped escape.
draftPasteReadyTimeoutMs: 20_000,
// Why: OpenCode decodes CSI-u Ctrl+Enter without local ConPTY kitty negotiation (#25372).
ctrlEnterEncoding: 'csi-u',
composerReadyCaptures: [
'opencode-1-18-32-timed-boot-slow',
'opencode-1-18-32-timed-boot-hidden-pane',