| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- import type { SecretKey, GlobalStateKey, ConfigurationKey, ConfigurationValues } from "../exports/roo-code"
- export type { SecretKey, GlobalStateKey, ConfigurationKey, ConfigurationValues }
- /**
- * For convenience we'd like the `RooCodeAPI` to define `SecretKey` and `GlobalStateKey`,
- * but since it is a type definition file we can't export constants without some
- * annoyances. In order to achieve proper type safety without using constants as
- * in the type definition we use this clever Check<>Exhaustiveness pattern.
- * If you extend the `SecretKey` or `GlobalStateKey` types, you will need to
- * update the `SECRET_KEYS` and `GLOBAL_STATE_KEYS` arrays to include the new
- * keys or a type error will be thrown.
- */
- export const SECRET_KEYS = [
- "apiKey",
- "glamaApiKey",
- "openRouterApiKey",
- "awsAccessKey",
- "awsSecretKey",
- "awsSessionToken",
- "openAiApiKey",
- "geminiApiKey",
- "openAiNativeApiKey",
- "deepSeekApiKey",
- "mistralApiKey",
- "unboundApiKey",
- "requestyApiKey",
- ] as const
- type CheckSecretKeysExhaustiveness = Exclude<SecretKey, (typeof SECRET_KEYS)[number]> extends never ? true : false
- const _checkSecretKeysExhaustiveness: CheckSecretKeysExhaustiveness = true
- export const GLOBAL_STATE_KEYS = [
- "apiProvider",
- "apiModelId",
- "glamaModelId",
- "glamaModelInfo",
- "awsRegion",
- "awsUseCrossRegionInference",
- "awsProfile",
- "awsUseProfile",
- "awsCustomArn",
- "vertexKeyFile",
- "vertexJsonCredentials",
- "vertexProjectId",
- "vertexRegion",
- "lastShownAnnouncementId",
- "customInstructions",
- "alwaysAllowReadOnly",
- "alwaysAllowWrite",
- "alwaysAllowExecute",
- "alwaysAllowBrowser",
- "alwaysAllowMcp",
- "alwaysAllowModeSwitch",
- "alwaysAllowSubtasks",
- "taskHistory",
- "openAiBaseUrl",
- "openAiModelId",
- "openAiCustomModelInfo",
- "openAiUseAzure",
- "ollamaModelId",
- "ollamaBaseUrl",
- "lmStudioModelId",
- "lmStudioBaseUrl",
- "anthropicBaseUrl",
- "modelMaxThinkingTokens",
- "azureApiVersion",
- "openAiStreamingEnabled",
- "openRouterModelId",
- "openRouterModelInfo",
- "openRouterBaseUrl",
- "openRouterUseMiddleOutTransform",
- "allowedCommands",
- "soundEnabled",
- "soundVolume",
- "diffEnabled",
- "enableCheckpoints",
- "checkpointStorage",
- "browserViewportSize",
- "screenshotQuality",
- "remoteBrowserHost",
- "fuzzyMatchThreshold",
- "writeDelayMs",
- "terminalOutputLineLimit",
- "mcpEnabled",
- "enableMcpServerCreation",
- "alwaysApproveResubmit",
- "requestDelaySeconds",
- "rateLimitSeconds",
- "currentApiConfigName",
- "listApiConfigMeta",
- "vsCodeLmModelSelector",
- "mode",
- "modeApiConfigs",
- "customModePrompts",
- "customSupportPrompts",
- "enhancementApiConfigId",
- "experiments", // Map of experiment IDs to their enabled state.
- "autoApprovalEnabled",
- "enableCustomModeCreation", // Enable the ability for Roo to create custom modes.
- "customModes", // Array of custom modes.
- "unboundModelId",
- "requestyModelId",
- "requestyModelInfo",
- "unboundModelInfo",
- "modelTemperature",
- "modelMaxTokens",
- "mistralCodestralUrl",
- "maxOpenTabsContext",
- "browserToolEnabled",
- "lmStudioSpeculativeDecodingEnabled",
- "lmStudioDraftModelId",
- "telemetrySetting",
- "showRooIgnoredFiles",
- "remoteBrowserEnabled",
- ] as const
- type CheckGlobalStateKeysExhaustiveness =
- Exclude<GlobalStateKey, (typeof GLOBAL_STATE_KEYS)[number]> extends never ? true : false
- const _checkGlobalStateKeysExhaustiveness: CheckGlobalStateKeysExhaustiveness = true
- export const isSecretKey = (key: string): key is SecretKey => SECRET_KEYS.includes(key as SecretKey)
- export const isGlobalStateKey = (key: string): key is GlobalStateKey =>
- GLOBAL_STATE_KEYS.includes(key as GlobalStateKey)
|