Skip to content

Commit d429174

Browse files
committed
Include detailed configuration metadata in response history and disable patch repair features for agentic CLI responses
- in response preview (apply response), disable actions: preview, apply with patch repair, when response came from CLI agent - when restoring once applied from response history, these buttons are visible. Seems like 'is from agentic cli' is not properly restored/respected. - when requesting edits from API, in response preview, below the list of edited files we see details like provider and model used. Similar information should be shown when used CLI. - when requesting edits from chatbot, we should see in response preview, at the bottom, details, like we do in case of API and CLI - when re-applying response from history, recent web configuration is not shown - instead of 'recent X configuration' use 'X configuration details' ├── apps │ ├── browser │ │ └── src │ │ ├── background │ │ │ └── message-handler.ts │ │ ├── content-scripts │ │ │ └── send-prompt-content-script │ │ │ ├── send-prompt-content-script.ts │ │ │ └── utils │ │ │ ├── add-apply-response-button.ts │ │ │ └── session-state.ts │ │ └── types │ │ └── messages.ts │ └── editor │ └── src │ ├── commands │ │ ├── apply-response-command │ │ │ ├── apply-response-command.ts │ │ │ ├── response-processor │ │ │ │ ├── handlers │ │ │ │ │ └── patch-repair-handler.ts │ │ │ │ └── response-processor.ts │ │ │ └── utils │ │ │ ├── preview │ │ │ │ ├── build-history-files.ts │ │ │ │ ├── diff-utils.ts │ │ │ │ ├── file-preparer.ts │ │ │ │ ├── preview.ts │ │ │ │ └── workspace-listener.ts │ │ │ └── preview-handler.ts │ │ └── history-command │ │ └── actions │ │ └── restore-checkpoint.ts │ ├── constants │ │ └── agents.ts │ ├── services │ │ ├── websocket-manager.ts │ │ └── websocket-server-process.ts │ ├── types │ │ ├── cli-configuration.ts │ │ └── web-configuration.ts │ ├── utils │ │ ├── agentic-cli-invocation │ │ │ ├── agents │ │ │ │ └── index.ts │ │ │ ├── invoke-agentic-cli.ts │ │ │ └── types.ts │ │ └── cli-configuration-format-converters.ts │ └── views │ └── prompt │ ├── backend │ │ ├── message-handlers │ │ │ ├── handle-apply-response-from-history.ts │ │ │ ├── handle-autofill.ts │ │ │ ├── handle-invoke-agentic-cli.ts │ │ │ ├── handle-make-api-call.ts │ │ │ ├── handle-patch-repair.ts │ │ │ ├── handle-preview-generated-code.ts │ │ │ ├── handle-preview-web-configuration.ts │ │ │ ├── handle-response-preview.ts │ │ │ └── utils │ │ │ └── patch-repair-utils.ts │ │ └── prompt-view-provider.ts │ ├── frontend │ │ ├── Main │ │ │ └── MainView │ │ │ └── MainView.tsx │ │ ├── Prompt.tsx │ │ └── hooks │ │ ├── use-preview-manager.ts │ │ └── use-response-history.ts │ └── types │ └── messages.ts └── packages ├── shared │ └── src │ └── types │ ├── file-in-preview.ts │ ├── response-history-item.ts │ └── websocket-message.ts └── ui └── src └── components └── editor └── prompt-view ├── Configurations │ └── Configurations.tsx ├── ResponsePreview │ ├── ResponsePreview.module.scss │ ├── ResponsePreview.stories.tsx │ ├── ResponsePreview.tsx │ └── components │ └── FileItem │ ├── FileItem.module.scss │ └── FileItem.tsx ├── ResponsePreviewFooter │ └── ResponsePreviewFooter.tsx └── Responses ├── Responses.stories.tsx └── Responses.tsx
1 parent f6be9cb commit d429174

22 files changed

Lines changed: 284 additions & 90 deletions

File tree

‎apps/browser/src/background/message-handler.ts‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,14 @@ const process_next_chat = async () => {
7171
client_id: current_chat_message.client_id,
7272
raw_instructions: current_chat_message.raw_instructions,
7373
inject_apply_response_button:
74-
current_chat_message.inject_apply_response_button
74+
current_chat_message.inject_apply_response_button,
75+
web_configuration_details: current_chat_message.chatbot
76+
? {
77+
chatbot: current_chat_message.chatbot,
78+
model: current_chat_message.model,
79+
reasoning_effort: current_chat_message.reasoning_effort
80+
}
81+
: undefined
7582
}
7683
})
7784

@@ -185,7 +192,8 @@ export const setup_message_listeners = () => {
185192
send_message_to_server({
186193
action: 'apply-response',
187194
client_id: message.client_id,
188-
raw_instructions: message.raw_instructions
195+
raw_instructions: message.raw_instructions,
196+
web_configuration_details: message.web_configuration_details
189197
} as ApplyResponseMessage)
190198
} else if (message.action === 'finished-responding') {
191199
if (sender.tab?.id && sender.tab.id === last_opened_tab_id) {

‎apps/browser/src/content-scripts/send-prompt-content-script/send-prompt-content-script.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,11 @@ const main = async () => {
202202
client_id: string
203203
raw_instructions?: string
204204
inject_apply_response_button?: boolean
205+
web_configuration_details?: {
206+
chatbot: string
207+
model?: string
208+
reasoning_effort?: string
209+
}
205210
}
206211

207212
if (!stored_data) {
@@ -250,7 +255,8 @@ const main = async () => {
250255
set_session_state({
251256
client_id: stored_data.client_id,
252257
raw_instructions: stored_data.raw_instructions,
253-
inject_button
258+
inject_button,
259+
web_configuration_details: stored_data.web_configuration_details
254260
})
255261
chatbot.setup_observer({
256262
client_id: stored_data.client_id,

‎apps/browser/src/content-scripts/send-prompt-content-script/utils/add-apply-response-button.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,14 @@ export function add_apply_response_button(params: {
3939

4040
let client_id = params.client_id
4141
let raw_instructions = params.raw_instructions
42+
let web_configuration_details = undefined
4243

4344
try {
4445
if (session_state) {
4546
if (session_state.client_id !== undefined) {
4647
client_id = session_state.client_id
4748
raw_instructions = session_state.raw_instructions
49+
web_configuration_details = session_state.web_configuration_details
4850
}
4951
}
5052
} catch (error) {
@@ -55,7 +57,8 @@ export function add_apply_response_button(params: {
5557
.sendMessage<Message>({
5658
action: 'apply-response',
5759
client_id,
58-
raw_instructions
60+
raw_instructions,
61+
web_configuration_details
5962
})
6063
.catch((e) => console.debug('Failed to send apply-response message', e))
6164
})

‎apps/browser/src/content-scripts/send-prompt-content-script/utils/session-state.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ export let session_state: {
22
client_id: string
33
raw_instructions?: string
44
inject_button?: boolean
5+
web_configuration_details?: {
6+
chatbot: string
7+
model?: string
8+
reasoning_effort?: string
9+
}
510
} | null = null
611

712
export const set_session_state = (state: typeof session_state) => {

‎apps/browser/src/types/messages.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ type ApplyResponseMessage = {
66
action: 'apply-response'
77
client_id: string
88
raw_instructions?: string
9+
web_configuration_details?: {
10+
chatbot: string
11+
model?: string
12+
reasoning_effort?: string
13+
}
914
}
1015

1116
type FinishedRespondingMessage = {

‎apps/editor/src/commands/apply-response-command/apply-response-command.ts‎

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,11 @@ export const apply_response_command = (params: {
230230
response,
231231
raw_instructions: args?.raw_instructions,
232232
created_at: Date.now(),
233-
recent_api_configuration: args?.recent_api_configuration,
234-
is_not_looked_at: true
233+
api_configuration_details: args?.api_configuration_details,
234+
cli_configuration_details: args?.cli_configuration_details,
235+
web_configuration_details: args?.web_configuration_details,
236+
is_not_looked_at: true,
237+
is_from_agentic_cli: args?.is_from_agentic_cli
235238
}
236239

237240
created_at_for_switch = new_item.created_at
@@ -367,7 +370,10 @@ export const apply_response_command = (params: {
367370
lines_added: total_lines_added,
368371
lines_removed: total_lines_removed,
369372
files: files_for_history,
370-
recent_api_configuration: args?.recent_api_configuration
373+
api_configuration_details: args?.api_configuration_details,
374+
cli_configuration_details: args?.cli_configuration_details,
375+
web_configuration_details: args?.web_configuration_details,
376+
is_from_agentic_cli: args?.is_from_agentic_cli
371377
}
372378

373379
history.push(new_item)
@@ -382,18 +388,21 @@ export const apply_response_command = (params: {
382388
const history_for_checkpoint = [
383389
...params.prompt_view_provider.response_history
384390
]
385-
const changes_accepted = await preview_handler({
386-
original_states: preview_data.original_states,
387-
chat_response: preview_data.response,
388-
prompt_view_provider: params.prompt_view_provider,
389-
workspace_provider: params.workspace_provider,
390-
extension_context: params.extension_context,
391-
original_editor_state: args?.original_editor_state,
392-
raw_instructions: args?.raw_instructions,
393-
created_at: created_at_for_preview,
394-
recent_api_configuration: args?.recent_api_configuration,
395-
is_code_at_cursor
396-
})
391+
const changes_accepted = await preview_handler({
392+
original_states: preview_data.original_states,
393+
chat_response: preview_data.response,
394+
prompt_view_provider: params.prompt_view_provider,
395+
workspace_provider: params.workspace_provider,
396+
extension_context: params.extension_context,
397+
original_editor_state: args?.original_editor_state,
398+
raw_instructions: args?.raw_instructions,
399+
created_at: created_at_for_preview,
400+
api_configuration_details: args?.api_configuration_details,
401+
cli_configuration_details: args?.cli_configuration_details,
402+
web_configuration_details: args?.web_configuration_details,
403+
is_code_at_cursor,
404+
is_from_agentic_cli: args?.is_from_agentic_cli
405+
})
397406

398407
if (changes_accepted) {
399408
params.prompt_view_api_calls_manager.cancel_all_requests()

‎apps/editor/src/commands/apply-response-command/response-processor/response-processor.ts‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ import * as fs from 'fs'
22
import * as path from 'path'
33
import * as vscode from 'vscode'
44
import { OriginalFileState } from '../types/original-file-state'
5-
import { RecentApiConfiguration } from '@shared/types/response-history-item'
5+
import {
6+
ApiConfigurationDetails,
7+
CliConfigurationDetails,
8+
WebConfigurationDetails
9+
} from '@shared/types/response-history-item'
610
import { handle_restore_preview } from './handlers/restore-preview-handler'
711
import {
812
FileItem,
@@ -58,7 +62,10 @@ export type ApplyResponseCommandArgs = {
5862
}
5963
files_with_content?: FileInPreview[]
6064
created_at?: number
61-
recent_api_configuration?: RecentApiConfiguration
65+
api_configuration_details?: ApiConfigurationDetails
66+
cli_configuration_details?: CliConfigurationDetails
67+
web_configuration_details?: WebConfigurationDetails
68+
is_from_agentic_cli?: boolean
6269
}
6370

6471
export const process_response = async (params: {

‎apps/editor/src/commands/apply-response-command/utils/preview-handler.ts‎

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ import * as path from 'path'
22
import * as vscode from 'vscode'
33
import { Logger } from '@shared/utils/logger'
44
import { OriginalFileState } from '../types/original-file-state'
5-
import { RecentApiConfiguration } from '@shared/types/response-history-item'
5+
import {
6+
ApiConfigurationDetails,
7+
CliConfigurationDetails,
8+
WebConfigurationDetails
9+
} from '@shared/types/response-history-item'
610
import { undo_files } from './file-operations'
711
import { preview } from './preview'
812
import { PromptViewProvider } from '@/views/prompt/backend/prompt-view-provider'
@@ -29,8 +33,11 @@ export const preview_handler = async (params: {
2933
}
3034
raw_instructions?: string
3135
created_at?: number
32-
recent_api_configuration?: RecentApiConfiguration
36+
api_configuration_details?: ApiConfigurationDetails
37+
cli_configuration_details?: CliConfigurationDetails
38+
web_configuration_details?: WebConfigurationDetails
3339
is_code_at_cursor?: boolean
40+
is_from_agentic_cli?: boolean
3441
}): Promise<boolean> => {
3542
let resolve_cleanup_promise: () => void
3643
ongoing_preview_cleanup_promise = new Promise((resolve) => {
@@ -45,8 +52,11 @@ export const preview_handler = async (params: {
4552
chat_response: params.chat_response,
4653
extension_context: params.extension_context,
4754
created_at: params.created_at,
48-
recent_api_configuration: params.recent_api_configuration,
49-
workspace_provider: params.workspace_provider
55+
api_configuration_details: params.api_configuration_details,
56+
cli_configuration_details: params.cli_configuration_details,
57+
web_configuration_details: params.web_configuration_details,
58+
workspace_provider: params.workspace_provider,
59+
is_from_agentic_cli: params.is_from_agentic_cli
5060
})
5161

5262
if (preview_result === null || preview_result.accepted_files.length === 0) {

‎apps/editor/src/commands/apply-response-command/utils/preview/preview.ts‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ import * as vscode from 'vscode'
22
import { t } from '@/i18n'
33
import { PromptViewProvider } from '@/views/prompt/backend/prompt-view-provider'
44
import { OriginalFileState } from '@/commands/apply-response-command/types/original-file-state'
5-
import { RecentApiConfiguration } from '@shared/types/response-history-item'
5+
import {
6+
ApiConfigurationDetails,
7+
CliConfigurationDetails,
8+
WebConfigurationDetails
9+
} from '@shared/types/response-history-item'
610
import { setup_workspace_listeners } from './workspace-listener'
711
import { prepare_files_from_original_states } from './file-preparer'
812
import { parse_response } from '../response-parser/response-parser'
@@ -23,8 +27,11 @@ export const preview = async (params: {
2327
chat_response: string
2428
extension_context: vscode.ExtensionContext
2529
created_at?: number
26-
recent_api_configuration?: RecentApiConfiguration
30+
api_configuration_details?: ApiConfigurationDetails
31+
cli_configuration_details?: CliConfigurationDetails
32+
web_configuration_details?: WebConfigurationDetails
2733
workspace_provider: WorkspaceProvider
34+
is_from_agentic_cli?: boolean
2835
}): Promise<{
2936
accepted_files: PreviewableFile[]
3037
rejected_states: OriginalFileState[]
@@ -128,7 +135,10 @@ export const preview = async (params: {
128135
items: items_for_preview,
129136
raw_instructions: params.raw_instructions,
130137
created_at: params.created_at,
131-
recent_api_configuration: params.recent_api_configuration
138+
api_configuration_details: params.api_configuration_details,
139+
cli_configuration_details: params.cli_configuration_details,
140+
web_configuration_details: params.web_configuration_details,
141+
is_from_agentic_cli: params.is_from_agentic_cli
132142
})
133143
}
134144

‎apps/editor/src/commands/history-command/actions/restore-checkpoint.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,10 @@ export const restore_checkpoint = async (params: {
555555
raw_instructions: item_to_preview.raw_instructions,
556556
files_with_content: item_to_preview.files,
557557
created_at: item_to_preview.created_at,
558-
recent_api_configuration: item_to_preview.recent_api_configuration
558+
api_configuration_details: item_to_preview.api_configuration_details,
559+
cli_configuration_details: item_to_preview.cli_configuration_details,
560+
web_configuration_details: item_to_preview.web_configuration_details,
561+
is_from_agentic_cli: item_to_preview.is_from_agentic_cli
559562
})
560563
}
561564
}

0 commit comments

Comments
 (0)