Changesets · Branches · Tags · Compare
| Changeset | 7ecdd34674859875b7aad4a833add4187af8da55cda025adc9994d57cf6c087d |
|---|---|
| Author | uinstinct <61635505+uinstinct@users.noreply.github.com> · 2025-07-01 13:11 +05:30 |
| Committer | uinstinct <61635505+uinstinct@users.noreply.github.com> · 2025-07-01 13:11 +05:30 |
| Parents | 58de0f436bd6 |
9 files changed
modified core/context/retrieval/retrieval.ts +9 −6
| @@ -85,12 +85,15 @@ | ||
| 85 | 85 | ); |
| 86 | 86 | return []; |
| 87 | 87 | } |
| 88 | - return [ | |
| 89 | - { | |
| 90 | - ...INSTRUCTIONS_BASE_ITEM, | |
| 91 | - content: "No results were found. Try using other tools.", | |
| 92 | - }, | |
| 93 | - ]; | |
| 88 | + if (extras.isInAgentMode) { | |
| 89 | + return [ | |
| 90 | + { | |
| 91 | + ...INSTRUCTIONS_BASE_ITEM, | |
| 92 | + content: "No results were found. Try using other tools.", | |
| 93 | + }, | |
| 94 | + ]; | |
| 95 | + } | |
| 96 | + return []; | |
| 94 | 97 | } |
| 95 | 98 | |
| 96 | 99 | return [ |
modified core/core.ts +2 −0
| @@ -1021,6 +1021,7 @@ | ||
| 1021 | 1021 | query: string; |
| 1022 | 1022 | fullInput: string; |
| 1023 | 1023 | selectedCode: RangeInFile[]; |
| 1024 | + isInAgentMode: boolean; | |
| 1024 | 1025 | }>, |
| 1025 | 1026 | ) => { |
| 1026 | 1027 | const { config } = await this.configHandler.loadConfig(); |
| @@ -1068,6 +1069,7 @@ | ||
| 1068 | 1069 | reranker: config.selectedModelByRole.rerank, |
| 1069 | 1070 | fetch: (url, init) => |
| 1070 | 1071 | fetchwithRequestOptions(url, init, config.requestOptions), |
| 1072 | + isInAgentMode: msg.data.isInAgentMode, | |
| 1071 | 1073 | }); |
| 1072 | 1074 | |
| 1073 | 1075 | void Telemetry.capture( |
modified core/index.d.ts +1 −0
| @@ -186,6 +186,7 @@ | ||
| 186 | 186 | ide: IDE; |
| 187 | 187 | selectedCode: RangeInFile[]; |
| 188 | 188 | fetch: FetchFunction; |
| 189 | + isInAgentMode: boolean; | |
| 189 | 190 | } |
| 190 | 191 | |
| 191 | 192 | export interface LoadSubmenuItemsArgs { |
modified core/protocol/core.ts +1 −0
| @@ -109,6 +109,7 @@ | ||
| 109 | 109 | query: string; |
| 110 | 110 | fullInput: string; |
| 111 | 111 | selectedCode: RangeInFile[]; |
| 112 | + isInAgentMode: boolean; | |
| 112 | 113 | }, |
| 113 | 114 | ContextItemWithId[], |
| 114 | 115 | ]; |
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 +2 −1
| @@ -68,6 +68,7 @@ | ||
| 68 | 68 | defaultContextProviders, |
| 69 | 69 | availableSlashCommands: state.config.config.slashCommands, |
| 70 | 70 | dispatch, |
| 71 | + getState, | |
| 71 | 72 | }); |
| 72 | 73 | |
| 73 | 74 | // symbols for both context items AND selected codeblocks |
| @@ -77,7 +78,7 @@ | ||
| 77 | 78 | .map((item) => item.uri!.value), |
| 78 | 79 | ...selectedCode.map((rif) => rif.filepath), |
| 79 | 80 | ]; |
| 80 | - dispatch(updateFileSymbolsFromFiles(filesForSymbols)); | |
| 81 | + void dispatch(updateFileSymbolsFromFiles(filesForSymbols)); | |
| 81 | 82 | |
| 82 | 83 | dispatch( |
| 83 | 84 | updateHistoryItemAtIndex({ |