Skip to content

Commit f443cb6

Browse files
committed
Add terminal interactivity selector for CLI agent invocations and route interactive or headless execution accordingly
- in prompt view, hold state 'terminal interactivity': non-interactive | interactive. - terminal interactivity should be changed thorugh quick pick or shortcuts `alt+n` and `alt+i` - add missing translations to `apps/editor/src/i18n/translations/views/prompt/handlers/handle-select-terminal-interactivity.ts` - `apps/editor/src/views/prompt/backend/message-handlers/handle-invoke-agentic-cli.ts` should respect TERMINAL_INTERACTIVITY_STATE_KEY when deciding on execution mode - headless can still be in 'edit' so should use 'edit integrated terminal args' - the bug is that get_headless_args is never used - class names in this section should be more generic [Fragment] - in 'ask' mode, interactive/non-interactive toggler should be set as 'interactive' and in disabled state. ├── apps │ └── editor │ └── src │ ├── commands │ │ ├── code-at-cursor-command │ │ │ └── utils │ │ │ └── perform-code-at-cursor.ts │ │ └── generate-commit-message-commands │ │ └── actions │ │ └── run-generate-action.ts │ ├── constants │ │ └── state-keys.ts │ ├── features │ │ ├── agentic-search │ │ │ └── agentic-search.ts │ │ └── search-files │ │ └── search-modes │ │ └── perform-intelligent-search-mode.ts │ ├── i18n │ │ └── translations │ │ └── views │ │ └── prompt │ │ └── handlers │ │ ├── handle-select-edit-format-instructions.ts │ │ ├── handle-select-terminal-interactivity.ts │ │ └── index.ts │ ├── utils │ │ └── agentic-cli-invocation │ │ ├── agents │ │ │ ├── antigravity.ts │ │ │ ├── claude.ts │ │ │ ├── codex.ts │ │ │ ├── cursor.ts │ │ │ ├── devin.ts │ │ │ ├── grok.ts │ │ │ ├── index.ts │ │ │ └── opencode.ts │ │ ├── index.ts │ │ ├── invoke-agentic-cli.ts │ │ ├── types.ts │ │ └── utils │ │ ├── check-command-exists.ts │ │ ├── format-duration.ts │ │ ├── generate-diff-markdown.ts │ │ └── get-progress-dots.ts │ └── views │ └── prompt │ ├── backend │ │ ├── message-handlers │ │ │ ├── handle-get-edit-format.ts │ │ │ ├── handle-get-terminal-interactivity.ts │ │ │ ├── handle-invoke-agentic-cli.ts │ │ │ ├── handle-patch-repair.ts │ │ │ ├── handle-save-edit-format.ts │ │ │ ├── handle-save-terminal-interactivity.ts │ │ │ ├── handle-select-edit-format-instructions.ts │ │ │ ├── handle-select-terminal-interactivity.ts │ │ │ ├── handle-voice-input.ts │ │ │ └── index.ts │ │ └── prompt-view-provider.ts │ ├── frontend │ │ ├── Main │ │ │ ├── Main.tsx │ │ │ └── MainView │ │ │ └── MainView.tsx │ │ ├── i18n │ │ │ └── translations │ │ │ └── prompt-field.ts │ │ └── utils │ │ └── post-message.ts │ └── types │ └── messages.ts └── packages ├── shared │ └── src │ └── types │ ├── edit-format.ts │ ├── prompt-types.ts │ └── terminal-interactivity.ts └── ui └── src └── components └── editor └── common └── prompts └── PromptField ├── PromptField.stories.tsx ├── PromptField.tsx ├── components │ └── Footer │ ├── Footer.module.scss │ └── Footer.tsx ├── hooks │ └── use-keyboard-shortcuts.ts └── index.ts
1 parent a605192 commit f443cb6

28 files changed

Lines changed: 649 additions & 97 deletions

File tree

‎apps/editor/src/constants/state-keys.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export const DUPLICATE_WORKSPACE_CONTEXT_STATE_KEY =
3333
'duplicate-workspace-context'
3434

3535
export const EDIT_FORMAT_STATE_KEY = 'edit-format'
36+
export const TERMINAL_INTERACTIVITY_STATE_KEY = 'terminal-interactivity'
3637
export const WEB_TARGET_STATE_KEY = 'web-target'
3738
export const API_TARGET_STATE_KEY = 'api-target'
3839
export const CLI_TARGET_STATE_KEY = 'cli-target'
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
export const translations = {
2+
'views.prompt.handlers.handle-select-terminal-interactivity.items.interactive':
3+
{
4+
en: 'Interactive',
5+
pl: 'Interaktywny',
6+
'zh-cn': '交互式',
7+
ja: 'インタラクティブ',
8+
'zh-tw': '互動式',
9+
de: 'Interaktiv',
10+
es: 'Interactivo',
11+
fr: 'Interactif',
12+
'pt-br': 'Interativo',
13+
ru: 'Интерактивный',
14+
ko: '대화형',
15+
it: 'Interattivo',
16+
tr: 'Etkileşimli',
17+
cs: 'Interaktivní',
18+
hu: 'Interaktív',
19+
bg: 'Интерактивен'
20+
},
21+
'views.prompt.handlers.handle-select-terminal-interactivity.items.interactive.description':
22+
{
23+
en: "Agent session runs in the terminal and edits are applied once it's closed.",
24+
pl: 'Sesja agenta działa w terminalu, a edycje są stosowane po jego zamknięciu.',
25+
'zh-cn': '代理会话在终端中运行,关闭后应用编辑。',
26+
ja: 'エージェントセッションはターミナルで実行され、閉じられると編集が適用されます。',
27+
'zh-tw': '代理會話在終端機中運行,關閉後套用編輯。',
28+
de: 'Die Agent-Sitzung läuft im Terminal und Bearbeitungen werden angewendet, sobald sie geschlossen wird.',
29+
es: 'La sesión del agente se ejecuta en la terminal y las ediciones se aplican una vez que se cierra.',
30+
fr: "La session de l'agent s'exécute dans le terminal et les modifications sont appliquées une fois fermée.",
31+
'pt-br':
32+
'A sessão do agente é executada no terminal e as edições são aplicadas assim que é fechada.',
33+
ru: 'Сеанс агента выполняется в терминале, и правки применяются после его закрытия.',
34+
ko: '에이전트 세션은 터미널에서 실행되며 닫힌 후 편집 사항이 적용됩니다.',
35+
it: "La sessione dell'agente viene eseguita nel terminale e le modifiche vengono applicate una volta chiusa.",
36+
tr: 'Aracı oturumu terminalde çalışır ve düzenlemeler kapatıldığında uygulanır.',
37+
cs: 'Relace agenta běží v terminálu a úpravy se aplikují po jejím uzavření.',
38+
hu: 'Az ügynök munkamenete a terminálban fut, és a szerkesztések a bezárás után kerülnek alkalmazásra.',
39+
bg: 'Сесията на агента се изпълнява в терминала и редакциите се прилагат след затварянето й.'
40+
},
41+
'views.prompt.handlers.handle-select-terminal-interactivity.items.non-interactive':
42+
{
43+
en: 'Non-interactive',
44+
pl: 'Nieinteraktywny',
45+
'zh-cn': '非交互式',
46+
ja: '非インタラクティブ',
47+
'zh-tw': '非互動式',
48+
de: 'Nicht-interaktiv',
49+
es: 'No interactivo',
50+
fr: 'Non-interactif',
51+
'pt-br': 'Não interativo',
52+
ru: 'Неинтерактивный',
53+
ko: '비대화형',
54+
it: 'Non interattivo',
55+
tr: 'Etkileşimsiz',
56+
cs: 'Neinteraktivní',
57+
hu: 'Nem interaktív',
58+
bg: 'Неинтерактивен'
59+
},
60+
'views.prompt.handlers.handle-select-terminal-interactivity.items.non-interactive.description':
61+
{
62+
en: 'Agent is invoked headlessly and edits are applied immediately.',
63+
pl: 'Agent jest wywoływany w tle, a edycje są stosowane natychmiast.',
64+
'zh-cn': '代理以无头模式调用,编辑会立即应用。',
65+
ja: 'エージェントはヘッドレスで呼び出され、編集はすぐに適用されます。',
66+
'zh-tw': '代理以無頭模式呼叫,編輯會立即套用。',
67+
de: 'Der Agent wird im Headless-Modus aufgerufen und Bearbeitungen werden sofort angewendet.',
68+
es: 'El agente se invoca en modo headless y las ediciones se aplican inmediatamente.',
69+
fr: "L'agent est invoqué en mode headless et les modifications sont appliquées immédiatement.",
70+
'pt-br':
71+
'O agente é invocado em modo headless e as edições são aplicadas imediatamente.',
72+
ru: 'Агент вызывается в фоновом (headless) режиме, и правки применяются немедленно.',
73+
ko: '에이전트가 헤드리스 모드로 호출되며 편집 사항이 즉시 적용됩니다.',
74+
it: "L'agente viene richiamato in modalità headless e le modifiche vengono applicate immediatamente.",
75+
tr: 'Aracı arka planda çağrılır ve düzenlemeler anında uygulanır.',
76+
cs: 'Agent je spuštěn na pozadí a úpravy se aplikují okamžitě.',
77+
hu: 'Az ügynök háttérfolyamatként indul el, és a módosítások azonnal alkalmazásra kerülnek.',
78+
bg: 'Агентът се извиква във фонов режим и редакциите се прилагат незабавно.'
79+
},
80+
'views.prompt.handlers.handle-select-terminal-interactivity.placeholder': {
81+
en: 'Select terminal interactivity',
82+
pl: 'Wybierz interaktywność terminala',
83+
'zh-cn': '选择终端交互性',
84+
ja: 'ターミナルの対話性を選択',
85+
'zh-tw': '選擇終端互動性',
86+
de: 'Terminal-Interaktivität auswählen',
87+
es: 'Seleccionar interactividad de la terminal',
88+
fr: "Sélectionner l'interactivité du terminal",
89+
'pt-br': 'Selecionar interatividade do terminal',
90+
ru: 'Выберите интерактивность терминала',
91+
ko: '터미널 상호 작용 선택',
92+
it: 'Seleziona interattività del terminale',
93+
tr: 'Terminal etkileşimini seçin',
94+
cs: 'Vyberte interaktivitu terminálu',
95+
hu: 'Terminál interaktivitás kiválasztása',
96+
bg: 'Изберете интерактивност на терминала'
97+
},
98+
'views.prompt.handlers.handle-select-terminal-interactivity.title': {
99+
en: 'Terminal Interactivity',
100+
pl: 'Interaktywność terminala',
101+
'zh-cn': '终端交互性',
102+
ja: 'ターミナルの対話性',
103+
'zh-tw': '終端互動性',
104+
de: 'Terminal-Interaktivität',
105+
es: 'Interactividad de la terminal',
106+
fr: 'Interactivité du terminal',
107+
'pt-br': 'Interatividade do terminal',
108+
ru: 'Интерактивность терминала',
109+
ko: '터미널 상호 작용',
110+
it: 'Interattività del terminale',
111+
tr: 'Terminal Etkileşimi',
112+
cs: 'Interaktivita terminálu',
113+
hu: 'Terminál interaktivitás',
114+
bg: 'Интерактивност на терминала'
115+
}
116+
} as const

‎apps/editor/src/i18n/translations/views/prompt/handlers/index.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { translations as handle_invoke_agentic_cli } from './handle-invoke-agent
1212
import { translations as handle_save_completed_tasks } from './handle-save-completed-tasks'
1313
import { translations as handle_clear_completed_tasks } from './handle-clear-completed-tasks'
1414
import { translations as handle_show_accuracy_boost_info } from './handle-show-accuracy-boost-info'
15+
import { translations as handle_select_terminal_interactivity } from './handle-select-terminal-interactivity'
1516
export const translations = {
1617
...handle_delete_task,
1718
...handle_make_api_call,
@@ -26,5 +27,6 @@ export const translations = {
2627
...handle_invoke_agentic_cli,
2728
...handle_save_completed_tasks,
2829
...handle_clear_completed_tasks,
29-
...handle_show_accuracy_boost_info
30+
...handle_show_accuracy_boost_info,
31+
...handle_select_terminal_interactivity
3032
}

‎apps/editor/src/utils/agentic-cli-invocation/agents/antigravity.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ export const antigravity_agent: CodingAgent = {
1414
cmd: 'agy',
1515
is_installed: () => check_command_exists('agy'),
1616
get_documentation_url: () => AGENTS[agent_name].docs_url,
17-
get_isolated_dir_args: () => [
17+
get_headless_args: () => [
1818
'--output-format',
1919
'stream-json',
2020
'--dangerously-skip-permissions'
2121
],
22-
get_edit_integrated_terminal_args: () => [],
23-
get_ask_integrated_terminal_args: () => [],
22+
get_integrated_terminal_edit_args: () => [],
23+
get_integrated_terminal_ask_args: () => [],
2424
get_post_integrated_terminal_args: () => ['--continue'],
2525
parse_stream_line: (parsed, report_progress) => {
2626
if (parsed.event === 'step_update' && parsed.step_update) {

‎apps/editor/src/utils/agentic-cli-invocation/agents/claude.ts‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,17 @@ export const claude_agent: CodingAgent = {
3030
cmd: 'claude',
3131
is_installed: () => check_command_exists('claude'),
3232
get_documentation_url: () => AGENTS[agent_name].docs_url,
33-
get_isolated_dir_args: () => [
33+
get_headless_args: () => [
3434
'--print',
3535
'--output-format',
3636
'stream-json',
37+
'--verbose',
3738
'--include-partial-messages',
3839
'--permission-mode',
39-
'dontAsk'
40+
'acceptEdits'
4041
],
41-
get_edit_integrated_terminal_args: () => ['--permission-mode', 'acceptEdits'],
42-
get_ask_integrated_terminal_args: () => ['--permission-mode', 'dontAsk'],
42+
get_integrated_terminal_edit_args: () => ['--permission-mode', 'acceptEdits'],
43+
get_integrated_terminal_ask_args: () => ['--permission-mode', 'dontAsk'],
4344
parse_stream_line: (parsed, report_progress) => {
4445
if (parsed.type === 'stream_event' && parsed.event) {
4546
if (

‎apps/editor/src/utils/agentic-cli-invocation/agents/codex.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,20 @@ export const codex_agent: CodingAgent = {
1414
cmd: 'codex',
1515
is_installed: () => check_command_exists('codex'),
1616
get_documentation_url: () => AGENTS[agent_name].docs_url,
17-
get_isolated_dir_args: () => [
17+
get_headless_args: () => [
1818
'exec',
1919
'--json',
2020
'--sandbox',
2121
'workspace-write',
2222
'--skip-git-repo-check'
2323
],
24-
get_edit_integrated_terminal_args: () => [
24+
get_integrated_terminal_edit_args: () => [
2525
'exec',
2626
'--skip-git-repo-check',
2727
'--sandbox',
2828
'workspace-write'
2929
],
30-
get_ask_integrated_terminal_args: () => [
30+
get_integrated_terminal_ask_args: () => [
3131
'exec',
3232
'--skip-git-repo-check',
3333
'--sandbox',

‎apps/editor/src/utils/agentic-cli-invocation/agents/cursor.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ export const cursor_agent: CodingAgent = {
1414
cmd: 'agent',
1515
is_installed: () => check_command_exists('agent'),
1616
get_documentation_url: () => AGENTS[agent_name].docs_url,
17-
get_isolated_dir_args: () => ['--force', '--output-format', 'stream-json'],
18-
get_edit_integrated_terminal_args: () => ['--force'],
19-
get_ask_integrated_terminal_args: () => ['--force'],
17+
get_headless_args: () => ['--force', '--output-format', 'stream-json'],
18+
get_integrated_terminal_edit_args: () => ['--force'],
19+
get_integrated_terminal_ask_args: () => ['--force'],
2020
get_post_integrated_terminal_args: () => ['--continue', '--trust'],
2121
parse_stream_line: (parsed, report_progress) => {
2222
if (parsed.type === 'tool_call') {

‎apps/editor/src/utils/agentic-cli-invocation/agents/devin.ts‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,9 @@ export const devin_agent: CodingAgent = {
1010
cmd: 'devin',
1111
is_installed: () => check_command_exists('devin'),
1212
get_documentation_url: () => AGENTS[agent_name].docs_url,
13-
get_isolated_dir_args: () => [
14-
'--print',
15-
'--respect-workspace-trust',
16-
'false'
17-
],
18-
get_edit_integrated_terminal_args: () => [],
19-
get_ask_integrated_terminal_args: () => [],
13+
get_headless_args: () => ['--print', '--respect-workspace-trust', 'false'],
14+
get_integrated_terminal_edit_args: () => [],
15+
get_integrated_terminal_ask_args: () => [],
2016
get_prompt_file_args: (temp_prompt_path: string) => [
2117
'--prompt-file',
2218
temp_prompt_path

‎apps/editor/src/utils/agentic-cli-invocation/agents/grok.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const grok_agent: CodingAgent = {
1616
'--prompt-file',
1717
temp_prompt_path
1818
],
19-
get_isolated_dir_args: () => ['--yolo', '--output-format', 'streaming-json'],
19+
get_headless_args: () => ['--yolo', '--output-format', 'streaming-json'],
2020
// get_post_integrated_terminal_args: () => ['continue'], // Broken on their end
2121
parse_stream_line: (parsed, report_progress) => {
2222
if (parsed.type === 'tool_call' && parsed.tool) {

‎apps/editor/src/utils/agentic-cli-invocation/agents/opencode.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ export const opencode_agent: CodingAgent = {
1414
cmd: 'opencode',
1515
is_installed: () => check_command_exists('opencode'),
1616
get_documentation_url: () => AGENTS[agent_name].docs_url,
17-
get_isolated_dir_args: (params) => [
17+
get_headless_args: (params) => [
1818
'run',
1919
'--format',
2020
'json',
2121
'--auto',
2222
params.cwd
2323
],
24-
get_edit_integrated_terminal_args: (params) => ['run', '--auto', params.cwd],
25-
get_ask_integrated_terminal_args: (params) => ['run', '--auto', params.cwd],
24+
get_integrated_terminal_edit_args: (params) => ['run', '--auto', params.cwd],
25+
get_integrated_terminal_ask_args: (params) => ['run', '--auto', params.cwd],
2626
get_post_integrated_terminal_args: () => ['--continue'],
2727
parse_stream_line: (parsed, report_progress) => {
2828
let action_name = ''

0 commit comments

Comments
 (0)