Skip to content

Commit 1f1b040

Browse files
committed
Add agentic search mode for workspace actions using external CLI tools
- when run from workspace's action button (only from there), place below 'intelligent' option: 'agent' (desc: Run CLI non-interactively), when selected do nothing - let's work on Agent search mode: once clicked, if in multi-root folder workspace, let user select workspace, then list available agents e.g. user has antigravity if 'agy' is in path - remember last selected root-folder of the workspace (if many such) - once an agent is selected, ask the user for the query, then submit. Process response similarly to `apps/editor/src/commands/select-clipboard-paths-command.ts` - do you call agy according to [Website]? - checbox state on agentic results should follow the actual selection in the context (those selected are selected in the quick pick, those not selected are not selected there) - preserve agent query - allow searching in results for agent search - add correct 'back' flow for agent search - in agentic search, on the input's title bar say 'Agentic Search', instead of 'Intelligent Search' - in description, when you say sth like 'agy -p', place full command you use for greter visibility - instead of aider we use codex, finish changes - add support for claude code - capitalize antigravity - don't use descriptions (hide the command from user's sight) - upon cancellation, should not show "No files found containing this phrase." - as agent work, tool calls made should appear in notification [Website] - as agent works, we want to stream more readable progress updates [Website] - in agentic search, skip 'Searching...:' prefix. Should immediately say Running: - select one of available agent before selecting eventual root-folder - limit the progress tool call lines to 60 characters └── apps └── editor ├── package.json └── src ├── commands │ ├── search-files-commands │ │ ├── index.ts │ │ ├── search-files-commands.ts │ │ └── utils │ │ ├── get-target-folder-path.ts │ │ └── prompt-for-provided-results.ts │ └── select-clipboard-paths-command.ts ├── constants │ ├── instructions.ts │ └── state-keys.ts ├── extension.ts ├── features │ └── search-files │ ├── index.ts │ ├── search-files.ts │ ├── search-modes │ │ ├── perform-agent-search-mode.ts │ │ ├── perform-intelligent-search-mode.ts │ │ ├── perform-keywords-search-mode.ts │ │ └── perform-phrase-search-mode.ts │ └── utils │ ├── analyze-files.ts │ ├── check-matches-condition.ts │ ├── create-search-regex.ts │ ├── group-quick-pick-items.ts │ ├── handle-parent-folder-result.ts │ ├── map-files-to-quick-pick-items.ts │ ├── prompt-for-config.ts │ ├── prompt-for-intelligent-search-results.ts │ ├── prompt-for-keywords-match-mode.ts │ ├── prompt-for-keywords-target.ts │ ├── prompt-for-search-mode.ts │ ├── prompt-for-search-results.ts │ ├── prompt-for-search-term.ts │ ├── prompt-for-shrink-mode.ts │ ├── search-files-by-intelligent.ts │ ├── search-files-by-keywords.ts │ ├── search-files-by-phrase.ts │ └── show-search-results-quick-pick.ts ├── i18n │ └── translations │ ├── commands │ │ └── search-files.ts │ └── features │ └── search-files.ts └── utils └── git-repository-utils.ts
1 parent 90b7c3b commit 1f1b040

9 files changed

Lines changed: 761 additions & 63 deletions

File tree

‎apps/editor/package.json‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,12 @@
343343
"category": "Code Web Chat",
344344
"icon": "$(search)"
345345
},
346+
{
347+
"command": "codeWebChat.searchFilesWorkspaceAction",
348+
"title": "%codeWebChat.searchFiles.title%",
349+
"category": "Code Web Chat",
350+
"icon": "$(search)"
351+
},
346352
{
347353
"command": "codeWebChat.searchSelectedFiles",
348354
"title": "%codeWebChat.searchSelectedFiles.title%",
@@ -576,6 +582,10 @@
576582
"command": "codeWebChat.generateCommitMessage",
577583
"when": "false"
578584
},
585+
{
586+
"command": "codeWebChat.searchFilesWorkspaceAction",
587+
"when": "false"
588+
},
579589
{
580590
"command": "codeWebChat.searchFilesFromDirectory",
581591
"when": "false"
@@ -676,7 +686,7 @@
676686
"group": "navigation@2"
677687
},
678688
{
679-
"command": "codeWebChat.searchFiles",
689+
"command": "codeWebChat.searchFilesWorkspaceAction",
680690
"when": "view == codeWebChatViewWorkspace",
681691
"group": "navigation@5"
682692
},

‎apps/editor/src/commands/search-files-commands/search-files-commands.ts‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ export const search_files_commands = (
111111
provided_files?: { path: string; checked: boolean }[]
112112
is_search_in_selected?: boolean
113113
folder_path?: string
114+
is_workspace_action?: boolean
114115
}
115116
) => {
116117
if (options?.provided_files) {
@@ -222,7 +223,8 @@ export const search_files_commands = (
222223
workspace_provider,
223224
extension_context,
224225
websocket_manager,
225-
folder_path
226+
folder_path,
227+
is_workspace_action: options?.is_workspace_action
226228
})
227229

228230
if (!result || result == 'back') return
@@ -295,6 +297,7 @@ export const search_files_commands = (
295297
provided_files?: { path: string; checked: boolean }[]
296298
is_search_in_selected?: boolean
297299
folder_path?: string
300+
is_workspace_action?: boolean
298301
}
299302
) => {
300303
let actual_options = options
@@ -303,13 +306,17 @@ export const search_files_commands = (
303306
!item.resourceUri &&
304307
(item.provided_files !== undefined ||
305308
item.is_search_in_selected !== undefined ||
306-
item.folder_path !== undefined)
309+
item.folder_path !== undefined ||
310+
item.is_workspace_action !== undefined)
307311
) {
308312
actual_options = item
309313
}
310314
return search_handler(undefined, actual_options)
311315
}
312316
),
317+
vscode.commands.registerCommand('codeWebChat.searchFilesWorkspaceAction', () =>
318+
search_handler(undefined, { is_workspace_action: true })
319+
),
313320
vscode.commands.registerCommand('codeWebChat.searchSelectedFiles', () =>
314321
search_selected_files_handler()
315322
),

‎apps/editor/src/constants/instructions.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,5 @@ These files contain the core greeting logic and module exports.`
8383

8484
export const voice_input_instructions =
8585
'Respond with a transcription of the following audio recording or text "INAUDIBLE", and nothing else.'
86+
87+
export const agentic_file_search_instructions = `In the project, find the complete set of primary and structural file paths relevant to the query, and output strictly as a bulleted list of file paths without explanations or any other text (e.g., - path/to/file.ext).`

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,15 @@ export const LAST_SEARCH_FILES_FILENAME_MATCH_MODE_STATE_KEY =
7676
'last-search-files-filename-match-mode'
7777
export const LAST_SEARCH_FILES_INTELLIGENT_QUERY_STATE_KEY =
7878
'last-search-files-intelligent-query'
79+
export const LAST_SEARCH_FILES_AGENT_QUERY_STATE_KEY =
80+
'last-search-files-agent-query'
7981

8082
export const LAST_SEARCH_FILES_FOR_CONTEXT_MODE_STATE_KEY =
8183
'last-search-files-for-context-mode'
8284

85+
export const LAST_SELECTED_WORKSPACE_IN_AGENT_SEARCH_STATE_KEY =
86+
'last-selected-workspace-in-agent-search'
87+
8388
export const LAST_INTELLIGENT_FILE_SEARCH_SHRINK_STATE_KEY =
8489
'last-intelligent-file-search-shrink'
8590

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { prompt_for_search_mode } from './utils/prompt-for-search-mode'
66
import { perform_phrase_search_mode } from './search-modes/perform-phrase-search-mode'
77
import { perform_keywords_search_mode } from './search-modes/perform-keywords-search-mode'
88
import { perform_intelligent_search_mode } from './search-modes/perform-intelligent-search-mode'
9+
import { perform_agent_search_mode } from './search-modes/perform-agent-search-mode'
910
import { Logger } from '@shared/utils/logger'
1011
import { WebSocketManager } from '@/services/websocket-manager'
1112

@@ -18,14 +19,15 @@ export const search_files = async (params: {
1819
is_sub_search?: boolean
1920
is_search_in_selected?: boolean
2021
folder_path?: string
22+
is_workspace_action?: boolean
2123
}): Promise<
2224
| { selected_paths: string[]; matched_paths: string[]; title: string }
2325
| undefined
2426
| 'back'
2527
> => {
2628
let initial_search_mode =
2729
params.extension_context.workspaceState.get<
28-
'phrase' | 'keywords' | 'intelligent'
30+
'phrase' | 'keywords' | 'intelligent' | 'agent'
2931
>(LAST_SEARCH_FILES_FOR_CONTEXT_MODE_STATE_KEY) || 'phrase'
3032

3133
let _resolved_files: string[] | undefined
@@ -53,7 +55,8 @@ export const search_files = async (params: {
5355
try {
5456
const mode_result = await prompt_for_search_mode(
5557
initial_search_mode,
56-
params.show_back_button
58+
params.show_back_button,
59+
params.is_workspace_action
5760
)
5861

5962
if (mode_result == 'back') return 'back'
@@ -97,6 +100,14 @@ export const search_files = async (params: {
97100
is_search_in_selected: params.is_search_in_selected,
98101
folder_path: params.folder_path
99102
})
103+
} else if (search_mode == 'agent') {
104+
flow_result = await perform_agent_search_mode({
105+
workspace_provider: params.workspace_provider,
106+
extension_context: params.extension_context,
107+
show_back_button: params.show_back_button,
108+
search_in_results,
109+
is_search_in_selected: params.is_search_in_selected
110+
})
100111
}
101112

102113
if (flow_result === 'back') {

0 commit comments

Comments
 (0)