add to JSON config loading and functionize tool arrays
This commit is contained in:
parent
d6fa887da2
commit
c5028e1d1d
2 changed files with 9 additions and 7 deletions
|
|
@ -62,7 +62,7 @@ import {
|
|||
} from "../util/paths";
|
||||
import { localPathToUri } from "../util/pathToUri";
|
||||
|
||||
import { baseToolDefinitions } from "../tools";
|
||||
import { getToolsForIde } from "../tools";
|
||||
import { resolveRelativePathInDir } from "../util/ideUtils";
|
||||
import { modifyAnyConfigWithSharedConfig } from "./sharedConfig";
|
||||
import {
|
||||
|
|
@ -525,7 +525,7 @@ async function intermediateToFinalConfig({
|
|||
const continueConfig: ContinueConfig = {
|
||||
...config,
|
||||
contextProviders,
|
||||
tools: [...baseToolDefinitions],
|
||||
tools: await getToolsForIde(ide),
|
||||
mcpServerStatuses: [],
|
||||
slashCommands: [],
|
||||
modelsByRole: {
|
||||
|
|
|
|||
|
|
@ -17,10 +17,12 @@ import { viewDiffTool } from "./definitions/viewDiff";
|
|||
import { viewRepoMapTool } from "./definitions/viewRepoMap";
|
||||
import { viewSubdirectoryTool } from "./definitions/viewSubdirectory";
|
||||
|
||||
// missing support for remote os calls: https://github.com/microsoft/vscode/issues/252269
|
||||
export const localOnlyToolDefinitions = [grepSearchTool];
|
||||
// I'm writing these as functions because we've messed up 3 TIMES by pushing to const, causing duplicate tool definitions on subsequent config loads.
|
||||
|
||||
export const baseToolDefinitions = [
|
||||
// missing support for remote os calls: https://github.com/microsoft/vscode/issues/252269
|
||||
const getLocalOnlyToolDefinitions = () => [grepSearchTool];
|
||||
|
||||
const getBaseToolDefinitions = () => [
|
||||
readFileTool,
|
||||
createNewFileTool,
|
||||
runTerminalCommandTool,
|
||||
|
|
@ -49,5 +51,5 @@ export const getConfigDependentToolDefinitions = (
|
|||
|
||||
export const getToolsForIde = async (ide: IDE) =>
|
||||
(await ide.isWorkspaceRemote())
|
||||
? [...baseToolDefinitions]
|
||||
: [...baseToolDefinitions, ...localOnlyToolDefinitions];
|
||||
? getBaseToolDefinitions()
|
||||
: [...getBaseToolDefinitions(), ...getLocalOnlyToolDefinitions()];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue