Changesets · Branches · Tags · Compare
| Changeset | 40a1f2267a417e7aeaf3e7ccbdc8c6a5fecbc7a537a9aa7faf566e7d87e550ab |
|---|---|
| Author | Nate Sesti <33237525+sestinj@users.noreply.github.com> · 2025-07-04 17:47 -07:00 |
| Committer | GitHub <noreply@github.com> · 2025-07-04 17:47 -07:00 |
| Parents | abc6d87d99a5, d39ecffeeaed |
12 files changed
modified core/context/providers/_context-providers.vitest.ts +1 −0
| @@ -50,6 +50,7 @@ | ||
| 50 | 50 | llm: config.modelsByRole.chat[0], |
| 51 | 51 | reranker: config.selectedModelByRole.rerank, |
| 52 | 52 | selectedCode: [], |
| 53 | + isInAgentMode: true, | |
| 53 | 54 | }; |
| 54 | 55 | } |
| 55 | 56 |
modified core/context/retrieval/retrieval.ts +10 −5
| @@ -79,14 +79,19 @@ | ||
| 79 | 79 | |
| 80 | 80 | if (results.length === 0) { |
| 81 | 81 | if (extras.config.disableIndexing) { |
| 82 | - void extras.ide.showToast("warning", "No results found."); | |
| 83 | - return []; | |
| 84 | - } else { | |
| 85 | 82 | void extras.ide.showToast( |
| 86 | 83 | "warning", |
| 87 | - "No results found. If you think this is an error, re-index your codebase.", | |
| 84 | + "No results found (Indexing disabled).", | |
| 88 | 85 | ); |
| 89 | - // TODO - add "re-index" option to warning message which clears and reindexes codebase | |
| 86 | + return []; | |
| 87 | + } | |
| 88 | + if (extras.isInAgentMode) { | |
| 89 | + return [ | |
| 90 | + { | |
| 91 | + ...INSTRUCTIONS_BASE_ITEM, | |
| 92 | + content: "No results were found. Try using other tools.", | |
| 93 | + }, | |
| 94 | + ]; | |
| 90 | 95 | } |
| 91 | 96 | return []; |
| 92 | 97 | } |
modified core/core.ts +2 −0
| @@ -1071,6 +1071,7 @@ | ||
| 1071 | 1071 | query: string; |
| 1072 | 1072 | fullInput: string; |
| 1073 | 1073 | selectedCode: RangeInFile[]; |
| 1074 | + isInAgentMode: boolean; | |
| 1074 | 1075 | }>, |
| 1075 | 1076 | ) => { |
| 1076 | 1077 | const { config } = await this.configHandler.loadConfig(); |
| @@ -1115,6 +1116,7 @@ | ||
| 1115 | 1116 | reranker: config.selectedModelByRole.rerank, |
| 1116 | 1117 | fetch: (url, init) => |
| 1117 | 1118 | fetchwithRequestOptions(url, init, config.requestOptions), |
| 1119 | + isInAgentMode: msg.data.isInAgentMode, | |
| 1118 | 1120 | }); |
| 1119 | 1121 | |
| 1120 | 1122 | void Telemetry.capture( |
modified core/index.d.ts +1 −0
| @@ -187,6 +187,7 @@ | ||
| 187 | 187 | ide: IDE; |
| 188 | 188 | selectedCode: RangeInFile[]; |
| 189 | 189 | fetch: FetchFunction; |
| 190 | + isInAgentMode: boolean; | |
| 190 | 191 | } |
| 191 | 192 | |
| 192 | 193 | export interface LoadSubmenuItemsArgs { |
modified core/protocol/core.ts +1 −0
| @@ -116,6 +116,7 @@ | ||
| 116 | 116 | query: string; |
| 117 | 117 | fullInput: string; |
| 118 | 118 | selectedCode: RangeInFile[]; |
| 119 | + isInAgentMode: boolean; | |
| 119 | 120 | }, |
| 120 | 121 | ContextItemWithId[], |
| 121 | 122 | ]; |
modified core/tools/implementations/codebaseTool.ts +1 −0
| @@ -23,6 +23,7 @@ | ||
| 23 | 23 | ide: extras.ide, |
| 24 | 24 | selectedCode: [] as RangeInFile[], |
| 25 | 25 | fetch: extras.fetch, |
| 26 | + isInAgentMode: true, // always true in tool call | |
| 26 | 27 | }; |
| 27 | 28 | |
| 28 | 29 | // Use the existing retrieval function to get context items |
modified extensions/vscode/src/quickEdit/ContextProvidersQuickPick.ts +1 −0
| @@ -48,6 +48,7 @@ | ||
| 48 | 48 | selectedCode: [], |
| 49 | 49 | fetch: (url, init) => |
| 50 | 50 | fetchwithRequestOptions(url, init, config.requestOptions), |
| 51 | + isInAgentMode: false, | |
| 51 | 52 | }); |
| 52 | 53 | }) || [], |
| 53 | 54 | ) |
modified gui/src/components/mainInput/AtMentionDropdown/index.tsx +5 −0
| @@ -25,6 +25,7 @@ | ||
| 25 | 25 | vscQuickInputBackground, |
| 26 | 26 | } from "../.."; |
| 27 | 27 | import { IdeMessengerContext } from "../../../context/IdeMessenger"; |
| 28 | +import { useAppSelector } from "../../../redux/hooks"; | |
| 28 | 29 | import { setDialogMessage, setShowDialog } from "../../../redux/slices/uiSlice"; |
| 29 | 30 | import { fontSize } from "../../../util"; |
| 30 | 31 | import FileIcon from "../../FileIcon"; |
| @@ -159,6 +160,9 @@ | ||
| 159 | 160 | const dispatch = useDispatch(); |
| 160 | 161 | |
| 161 | 162 | const ideMessenger = useContext(IdeMessengerContext); |
| 163 | + const isInAgentMode = useAppSelector( | |
| 164 | + (store) => store.session.mode === "agent", | |
| 165 | + ); | |
| 162 | 166 | |
| 163 | 167 | const [selectedIndex, setSelectedIndex] = useState(0); |
| 164 | 168 | |
| @@ -187,6 +191,7 @@ | ||
| 187 | 191 | query, |
| 188 | 192 | fullInput: "", |
| 189 | 193 | selectedCode, |
| 194 | + isInAgentMode, | |
| 190 | 195 | }, |
| 191 | 196 | ); |
| 192 | 197 |
modified gui/src/components/mainInput/TipTapEditor/utils/renderPromptv1.ts +1 −0
| @@ -26,6 +26,7 @@ | ||
| 26 | 26 | name, |
| 27 | 27 | query: "", |
| 28 | 28 | selectedCode, |
| 29 | + isInAgentMode: false, | |
| 29 | 30 | }); |
| 30 | 31 | if (response.status === "success") { |
| 31 | 32 | return response.content.map((item) => item.content).join("\n\n"); |
modified gui/src/components/mainInput/TipTapEditor/utils/resolveEditorContent.ts +11 −0
| @@ -12,6 +12,7 @@ | ||
| 12 | 12 | import { stripImages } from "core/util/messageContent"; |
| 13 | 13 | import { IIdeMessenger } from "../../../../context/IdeMessenger"; |
| 14 | 14 | import { setIsGatheringContext } from "../../../../redux/slices/sessionSlice"; |
| 15 | +import { RootState } from "../../../../redux/store"; | |
| 15 | 16 | import { processEditorContent } from "./processEditorContent"; |
| 16 | 17 | import { renderSlashCommandPrompt } from "./renderSlashCommand"; |
| 17 | 18 | import { GetContextRequest } from "./types"; |
| @@ -23,6 +24,7 @@ | ||
| 23 | 24 | defaultContextProviders: DefaultContextProvider[]; |
| 24 | 25 | availableSlashCommands: SlashCommandDescWithSource[]; |
| 25 | 26 | dispatch: Dispatch; |
| 27 | + getState: () => RootState; | |
| 26 | 28 | } |
| 27 | 29 | |
| 28 | 30 | interface ResolveEditorContentOutput { |
| @@ -48,6 +50,7 @@ | ||
| 48 | 50 | defaultContextProviders, |
| 49 | 51 | availableSlashCommands, |
| 50 | 52 | dispatch, |
| 53 | + getState, | |
| 51 | 54 | }: ResolveEditorContentInput): Promise<ResolveEditorContentOutput> { |
| 52 | 55 | const { |
| 53 | 56 | parts, |
| @@ -87,6 +90,7 @@ | ||
| 87 | 90 | defaultContextProviders, |
| 88 | 91 | parts: slashedParts, |
| 89 | 92 | selectedCode, |
| 93 | + getState, | |
| 90 | 94 | }); |
| 91 | 95 | |
| 92 | 96 | if (shouldGatherContext) { |
| @@ -111,6 +115,7 @@ | ||
| 111 | 115 | defaultContextProviders, |
| 112 | 116 | parts, |
| 113 | 117 | selectedCode, |
| 118 | + getState, | |
| 114 | 119 | }: { |
| 115 | 120 | contextRequests: GetContextRequest[]; |
| 116 | 121 | modifiers: InputModifiers; |
| @@ -118,6 +123,7 @@ | ||
| 118 | 123 | defaultContextProviders: DefaultContextProvider[]; |
| 119 | 124 | parts: MessagePart[]; |
| 120 | 125 | selectedCode: RangeInFile[]; |
| 126 | + getState: () => RootState; | |
| 121 | 127 | }): Promise<ContextItemWithId[]> { |
| 122 | 128 | const defaultRequests: GetContextRequest[] = defaultContextProviders.map( |
| 123 | 129 | (def) => ({ |
| @@ -139,6 +145,8 @@ | ||
| 139 | 145 | ); |
| 140 | 146 | let contextItems: ContextItemWithId[] = []; |
| 141 | 147 | |
| 148 | + const isInAgentMode = getState().session.mode === "agent"; | |
| 149 | + | |
| 142 | 150 | // Process context item attributes |
| 143 | 151 | for (const item of deduplicatedInputs) { |
| 144 | 152 | const result = await ideMessenger.request("context/getContextItems", { |
| @@ -146,6 +154,7 @@ | ||
| 146 | 154 | query: item.query ?? "", |
| 147 | 155 | fullInput: stripImages(parts), |
| 148 | 156 | selectedCode, |
| 157 | + isInAgentMode, | |
| 149 | 158 | }); |
| 150 | 159 | if (result.status === "success") { |
| 151 | 160 | contextItems.push(...result.content); |
| @@ -162,6 +171,7 @@ | ||
| 162 | 171 | query: "", |
| 163 | 172 | fullInput: stripImages(parts), |
| 164 | 173 | selectedCode, |
| 174 | + isInAgentMode, | |
| 165 | 175 | }); |
| 166 | 176 | |
| 167 | 177 | if (result.status === "success") { |
| @@ -181,6 +191,7 @@ | ||
| 181 | 191 | query: "non-mention-usage", |
| 182 | 192 | fullInput: "", |
| 183 | 193 | selectedCode: [], |
| 194 | + isInAgentMode, | |
| 184 | 195 | }, |
| 185 | 196 | ); |
| 186 | 197 | if (currentFileResponse.status === "success") { |
modified gui/src/redux/thunks/edit.ts +3 −1
| @@ -35,10 +35,11 @@ | ||
| 35 | 35 | ThunkApiType |
| 36 | 36 | >( |
| 37 | 37 | "edit/streamResponse", |
| 38 | - async ({ editorState, codeToEdit }, { dispatch, extra }) => { | |
| 38 | + async ({ editorState, codeToEdit }, { dispatch, extra, getState }) => { | |
| 39 | 39 | await dispatch( |
| 40 | 40 | streamThunkWrapper(async () => { |
| 41 | 41 | dispatch(setActive()); |
| 42 | + | |
| 42 | 43 | const { selectedContextItems, content } = await resolveEditorContent({ |
| 43 | 44 | editorState, |
| 44 | 45 | modifiers: { |
| @@ -49,6 +50,7 @@ | ||
| 49 | 50 | defaultContextProviders: [], |
| 50 | 51 | availableSlashCommands: [], |
| 51 | 52 | dispatch, |
| 53 | + getState, | |
| 52 | 54 | }); |
| 53 | 55 | |
| 54 | 56 | const prompt = [ |
modified gui/src/redux/thunks/streamResponse.ts +1 −0
| @@ -64,6 +64,7 @@ | ||
| 64 | 64 | defaultContextProviders, |
| 65 | 65 | availableSlashCommands: state.config.config.slashCommands, |
| 66 | 66 | dispatch, |
| 67 | + getState, | |
| 67 | 68 | }); |
| 68 | 69 | |
| 69 | 70 | // symbols for both context items AND selected codeblocks |