Skip to content

Commit 3d2a608

Browse files
committed
Skip initial prompt in agentic search when query is provided
- agentic search run from panel view, should not show the user the query, unles instructions are empty, then let them enter them └── apps └── editor ├── package.json └── src ├── commands │ └── agentic-search-command │ ├── agentic-search-command.ts │ └── index.ts ├── constants │ └── state-keys.ts ├── extension.ts ├── features │ └── agentic-search │ ├── agentic-search-state.ts │ ├── agentic-search.ts │ ├── index.ts │ └── utils │ ├── build-agent-prompt.ts │ ├── index.ts │ └── prompt-for-search-term.ts ├── utils │ └── agentic-cli-invocation │ ├── agents │ │ ├── antigravity.ts │ │ ├── claude.ts │ │ ├── codex.ts │ │ ├── cursor.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-agentic-search.ts │ └── prompt-view-provider.ts ├── frontend │ ├── Main │ │ ├── Main.tsx │ │ └── MainView │ │ ├── MainView.tsx │ │ ├── components │ │ │ └── PromptAttachments │ │ │ ├── PromptAttachments.tsx │ │ │ └── index.ts │ │ └── hooks │ │ └── use-keyboard-shortcuts.ts │ ├── Prompt.tsx │ ├── hooks │ │ └── use-prompt │ │ └── use-prompt.ts │ └── i18n │ └── translations │ └── selected-files.ts └── types └── messages.ts
1 parent bcae8db commit 3d2a608

2 files changed

Lines changed: 23 additions & 11 deletions

File tree

‎apps/editor/src/features/agentic-search/agentic-search.ts‎

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export const agentic_search = async (params: {
2424
websocket_manager: WebSocketManager
2525
query: string
2626
current_instructions: string
27+
skip_prompt_if_not_empty?: boolean
2728
}): Promise<
2829
| { selected_paths: string[]; matched_paths: string[]; title: string }
2930
| undefined
@@ -43,6 +44,7 @@ export const agentic_search = async (params: {
4344
}
4445

4546
let query = params.query
47+
let first_run = true
4648

4749
while (true) {
4850
const config = vscode.workspace.getConfiguration('codeWebChat')
@@ -60,19 +62,28 @@ export const agentic_search = async (params: {
6062
invocation_count,
6163
build_prompt: async () => {
6264
while (true) {
63-
const query_result = await prompt_for_search_term(query, {
64-
show_back_button: true
65-
})
65+
if (
66+
first_run &&
67+
params.skip_prompt_if_not_empty &&
68+
query.trim() !== ''
69+
) {
70+
first_run = false
71+
} else {
72+
const query_result = await prompt_for_search_term(query, {
73+
show_back_button: true
74+
})
6675

67-
if (query_result.back) {
68-
return 'back'
69-
}
76+
if (query_result.back) {
77+
return 'back'
78+
}
7079

71-
if (query_result.value === undefined) {
72-
return undefined
73-
}
80+
if (query_result.value === undefined) {
81+
return undefined
82+
}
7483

75-
query = query_result.value
84+
query = query_result.value
85+
}
86+
first_run = false
7687

7788
if (query.trim() == '') {
7889
continue

‎apps/editor/src/views/prompt/backend/message-handlers/handle-agentic-search.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ export const handle_agentic_search = async (
3737
extension_context: prompt_view_provider.extension_context,
3838
websocket_manager: prompt_view_provider.websocket_server_instance,
3939
query: initial_query,
40-
current_instructions
40+
current_instructions,
41+
skip_prompt_if_not_empty: true
4142
})
4243

4344
if (!result || result === 'back') return

0 commit comments

Comments
 (0)