diff --git a/packages/types/npm/package.json b/packages/types/npm/package.json index 35e01d4ef7..b2be718cf6 100644 --- a/packages/types/npm/package.json +++ b/packages/types/npm/package.json @@ -1,6 +1,6 @@ { "name": "@roo-code/types", - "version": "1.45.0", + "version": "1.46.0", "description": "TypeScript type definitions for Roo Code.", "publishConfig": { "access": "public", diff --git a/packages/types/src/cloud.ts b/packages/types/src/cloud.ts deleted file mode 100644 index be9a039d43..0000000000 --- a/packages/types/src/cloud.ts +++ /dev/null @@ -1,158 +0,0 @@ -import { z } from "zod" - -import { globalSettingsSchema } from "./global-settings.js" -import { mcpMarketplaceItemSchema } from "./marketplace.js" -import { discriminatedProviderSettingsWithIdSchema } from "./provider-settings.js" - -/** - * CloudUserInfo - */ - -export interface CloudUserInfo { - id?: string - name?: string - email?: string - picture?: string - organizationId?: string - organizationName?: string - organizationRole?: string - organizationImageUrl?: string - extensionBridgeEnabled?: boolean -} - -/** - * CloudOrganization Types - */ - -export interface CloudOrganization { - id: string - name: string - slug?: string - image_url?: string - has_image?: boolean - created_at?: number - updated_at?: number -} - -export interface CloudOrganizationMembership { - id: string - organization: CloudOrganization - role: string - permissions?: string[] - created_at?: number - updated_at?: number -} - -/** - * OrganizationAllowList - */ - -export const organizationAllowListSchema = z.object({ - allowAll: z.boolean(), - providers: z.record( - z.object({ - allowAll: z.boolean(), - models: z.array(z.string()).optional(), - }), - ), -}) - -export type OrganizationAllowList = z.infer - -/** - * OrganizationDefaultSettings - */ - -export const organizationDefaultSettingsSchema = globalSettingsSchema - .pick({ - enableCheckpoints: true, - fuzzyMatchThreshold: true, - maxOpenTabsContext: true, - maxReadFileLine: true, - maxWorkspaceFiles: true, - showRooIgnoredFiles: true, - terminalCommandDelay: true, - terminalCompressProgressBar: true, - terminalOutputLineLimit: true, - terminalShellIntegrationDisabled: true, - terminalShellIntegrationTimeout: true, - terminalZshClearEolMark: true, - }) - // Add stronger validations for some fields. - .merge( - z.object({ - maxOpenTabsContext: z.number().int().nonnegative().optional(), - maxReadFileLine: z.number().int().gte(-1).optional(), - maxWorkspaceFiles: z.number().int().nonnegative().optional(), - terminalCommandDelay: z.number().int().nonnegative().optional(), - terminalOutputLineLimit: z.number().int().nonnegative().optional(), - terminalShellIntegrationTimeout: z.number().int().nonnegative().optional(), - }), - ) - -export type OrganizationDefaultSettings = z.infer - -/** - * OrganizationCloudSettings - */ - -export const organizationCloudSettingsSchema = z.object({ - recordTaskMessages: z.boolean().optional(), - enableTaskSharing: z.boolean().optional(), - taskShareExpirationDays: z.number().int().positive().optional(), - allowMembersViewAllTasks: z.boolean().optional(), -}) - -export type OrganizationCloudSettings = z.infer - -/** - * Organization Settings - */ - -export const organizationSettingsSchema = z.object({ - version: z.number(), - cloudSettings: organizationCloudSettingsSchema.optional(), - defaultSettings: organizationDefaultSettingsSchema, - allowList: organizationAllowListSchema, - hiddenMcps: z.array(z.string()).optional(), - hideMarketplaceMcps: z.boolean().optional(), - mcps: z.array(mcpMarketplaceItemSchema).optional(), - providerProfiles: z.record(z.string(), discriminatedProviderSettingsWithIdSchema).optional(), -}) - -export type OrganizationSettings = z.infer - -/** - * Constants - */ - -export const ORGANIZATION_ALLOW_ALL: OrganizationAllowList = { - allowAll: true, - providers: {}, -} as const - -export const ORGANIZATION_DEFAULT: OrganizationSettings = { - version: 0, - cloudSettings: { - recordTaskMessages: true, - enableTaskSharing: true, - taskShareExpirationDays: 30, - allowMembersViewAllTasks: true, - }, - defaultSettings: {}, - allowList: ORGANIZATION_ALLOW_ALL, -} as const - -/** - * Share Types - */ - -export const shareResponseSchema = z.object({ - success: z.boolean(), - shareUrl: z.string().optional(), - error: z.string().optional(), - isNewShare: z.boolean().optional(), - manageUrl: z.string().optional(), -}) - -export type ShareResponse = z.infer diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts index dcbb1c4f54..c65d070086 100644 --- a/packages/types/src/index.ts +++ b/packages/types/src/index.ts @@ -1,5 +1,4 @@ export * from "./api.js" -export * from "./cloud.js" export * from "./codebase-index.js" export * from "./events.js" export * from "./experiment.js" @@ -13,7 +12,6 @@ export * from "./message.js" export * from "./mode.js" export * from "./model.js" export * from "./provider-settings.js" -export * from "./sharing.js" export * from "./task.js" export * from "./todo.js" export * from "./telemetry.js" diff --git a/packages/types/src/sharing.ts b/packages/types/src/sharing.ts deleted file mode 100644 index f295798032..0000000000 --- a/packages/types/src/sharing.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Types related to task sharing functionality - */ - -/** - * Visibility options for sharing tasks - */ -export type ShareVisibility = "organization" | "public" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0bc3f93bcb..300c757b23 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -563,8 +563,8 @@ importers: specifier: ^1.14.0 version: 1.14.0(typescript@5.8.3) '@roo-code/cloud': - specifier: ^0.11.0 - version: 0.11.0 + specifier: ^0.13.0 + version: 0.13.0 '@roo-code/ipc': specifier: workspace:^ version: link:../packages/ipc @@ -896,6 +896,9 @@ importers: '@radix-ui/react-tooltip': specifier: ^1.1.8 version: 1.2.6(@types/react-dom@18.3.7(@types/react@18.3.23))(@types/react@18.3.23)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@roo-code/cloud': + specifier: ^0.13.0 + version: 0.13.0 '@roo-code/types': specifier: workspace:^ version: link:../packages/types @@ -3065,8 +3068,8 @@ packages: cpu: [x64] os: [win32] - '@roo-code/cloud@0.11.0': - resolution: {integrity: sha512-ZT3gBRNHI0HGmn5bMxdyhMxJVrp/7l7jcx/lDRl+xjeCP3KmJshzFKlfjdSGDtOoztnNj65hSbs/WiTS2wUodQ==} + '@roo-code/cloud@0.13.0': + resolution: {integrity: sha512-pIrfMpuHSk3LPMG3SLmsfr/IYvL5x0k0iUXQ51dgZ2fP7TlzWg2erxclNl79O7pRMDYFnA/8YoQTAnv1N8VXnQ==} '@roo-code/types@1.45.0': resolution: {integrity: sha512-+rFJ9HcukDl59X9pI6lgZDtJHtKqHg6BIdS4LG759X+5MV7wvlNb4S+bQ3qKqIlBsQhH17bzIJCfsWZwjwxecw==} @@ -12234,7 +12237,7 @@ snapshots: '@rollup/rollup-win32-x64-msvc@4.40.2': optional: true - '@roo-code/cloud@0.11.0': + '@roo-code/cloud@0.13.0': dependencies: '@roo-code/types': 1.45.0 ioredis: 5.6.1 diff --git a/scripts/link-packages.js b/scripts/link-packages.js index 6d8b33f6de..1673fd5dac 100755 --- a/scripts/link-packages.js +++ b/scripts/link-packages.js @@ -14,6 +14,13 @@ const config = { npmPath: "npm", watchCommand: "pnpm build:development:watch", }, + { + name: "@roo-code/cloud", + sourcePath: "../Roo-Code-Cloud/packages/sdk", + targetPath: "webview-ui/node_modules/@roo-code/cloud", + npmPath: "npm", + watchCommand: "pnpm build:development:watch", + }, ], } diff --git a/src/core/webview/ClineProvider.ts b/src/core/webview/ClineProvider.ts index e6817e1825..81c0a562c7 100644 --- a/src/core/webview/ClineProvider.ts +++ b/src/core/webview/ClineProvider.ts @@ -24,17 +24,15 @@ import { type TerminalActionId, type TerminalActionPromptType, type HistoryItem, - type CloudUserInfo, RooCodeEventName, requestyDefaultModelId, openRouterDefaultModelId, glamaDefaultModelId, - ORGANIZATION_ALLOW_ALL, DEFAULT_TERMINAL_OUTPUT_CHARACTER_LIMIT, DEFAULT_WRITE_DELAY_MS, } from "@roo-code/types" import { TelemetryService } from "@roo-code/telemetry" -import { CloudService, getRooCodeApiUrl } from "@roo-code/cloud" +import { type CloudUserInfo, CloudService, ORGANIZATION_ALLOW_ALL, getRooCodeApiUrl } from "@roo-code/cloud" import { Package } from "../../shared/package" import { findLast } from "../../shared/array" diff --git a/src/core/webview/__tests__/ClineProvider.spec.ts b/src/core/webview/__tests__/ClineProvider.spec.ts index eeae44451d..29df1e4a2e 100644 --- a/src/core/webview/__tests__/ClineProvider.spec.ts +++ b/src/core/webview/__tests__/ClineProvider.spec.ts @@ -4,8 +4,9 @@ import Anthropic from "@anthropic-ai/sdk" import * as vscode from "vscode" import axios from "axios" -import { type ProviderSettingsEntry, type ClineMessage, ORGANIZATION_ALLOW_ALL } from "@roo-code/types" +import { type ProviderSettingsEntry, type ClineMessage } from "@roo-code/types" import { TelemetryService } from "@roo-code/telemetry" +import { ORGANIZATION_ALLOW_ALL } from "@roo-code/cloud" import { ExtensionMessage, ExtensionState } from "../../../shared/ExtensionMessage" import { defaultModeSlug } from "../../../shared/modes" @@ -17,11 +18,9 @@ import { safeWriteJson } from "../../../utils/safeWriteJson" import { ClineProvider } from "../ClineProvider" -// Mock setup must come before imports +// Mock setup must come before imports. vi.mock("../../prompts/sections/custom-instructions") -vi.mock("vscode") - vi.mock("p-wait-for", () => ({ __esModule: true, default: vi.fn().mockResolvedValue(undefined), @@ -95,7 +94,7 @@ vi.mock("../../../services/browser/browserDiscovery", () => ({ testBrowserConnection: vi.fn(), })) -// Remove duplicate mock - it's already defined below +// Remove duplicate mock - it's already defined below. const mockAddCustomInstructions = vi.fn().mockResolvedValue("Combined instructions") @@ -228,7 +227,6 @@ vi.mock("../../../integrations/misc/extract-text", () => ({ }), })) -// Mock getModels for router model tests vi.mock("../../../api/providers/fetchers/modelCache", () => ({ getModels: vi.fn().mockResolvedValue({}), flushModels: vi.fn(), @@ -324,6 +322,10 @@ vi.mock("@roo-code/cloud", () => ({ }, }, getRooCodeApiUrl: vi.fn().mockReturnValue("https://app.roocode.com"), + ORGANIZATION_ALLOW_ALL: { + allowAll: true, + providers: {}, + }, })) afterAll(() => { diff --git a/src/core/webview/__tests__/ClineProvider.sticky-mode.spec.ts b/src/core/webview/__tests__/ClineProvider.sticky-mode.spec.ts index e55e0910ab..99285bb68e 100644 --- a/src/core/webview/__tests__/ClineProvider.sticky-mode.spec.ts +++ b/src/core/webview/__tests__/ClineProvider.sticky-mode.spec.ts @@ -7,7 +7,6 @@ import { ContextProxy } from "../../config/ContextProxy" import { Task } from "../../task/Task" import type { HistoryItem, ProviderName } from "@roo-code/types" -// Mock setup vi.mock("vscode", () => ({ ExtensionContext: vi.fn(), OutputChannel: vi.fn(), @@ -54,7 +53,8 @@ vi.mock("vscode", () => ({ }, version: "1.85.0", })) -// Create a counter for unique task IDs + +// Create a counter for unique task IDs. let taskIdCounter = 0 vi.mock("../../task/Task", () => ({ @@ -75,8 +75,11 @@ vi.mock("../../task/Task", () => ({ parentTask: options.parentTask, })), })) + vi.mock("../../prompts/sections/custom-instructions") + vi.mock("../../../utils/safeWriteJson") + vi.mock("../../../api", () => ({ buildApiHandler: vi.fn().mockReturnValue({ getModel: vi.fn().mockReturnValue({ @@ -85,12 +88,14 @@ vi.mock("../../../api", () => ({ }), }), })) + vi.mock("../../../integrations/workspace/WorkspaceTracker", () => ({ default: vi.fn().mockImplementation(() => ({ initializeFilePaths: vi.fn(), dispose: vi.fn(), })), })) + vi.mock("../../diff/strategies/multi-search-replace", () => ({ MultiSearchReplaceDiffStrategy: vi.fn().mockImplementation(() => ({ getToolDescription: () => "test", @@ -98,6 +103,7 @@ vi.mock("../../diff/strategies/multi-search-replace", () => ({ applyDiff: vi.fn(), })), })) + vi.mock("@roo-code/cloud", () => ({ CloudService: { hasInstance: vi.fn().mockReturnValue(true), @@ -108,7 +114,12 @@ vi.mock("@roo-code/cloud", () => ({ }, }, getRooCodeApiUrl: vi.fn().mockReturnValue("https://app.roocode.com"), + ORGANIZATION_ALLOW_ALL: { + allowAll: true, + providers: {}, + }, })) + vi.mock("../../../shared/modes", () => ({ modes: [ { @@ -132,20 +143,25 @@ vi.mock("../../../shared/modes", () => ({ }), defaultModeSlug: "code", })) + vi.mock("../../prompts/system", () => ({ SYSTEM_PROMPT: vi.fn().mockResolvedValue("mocked system prompt"), codeMode: "code", })) + vi.mock("../../../api/providers/fetchers/modelCache", () => ({ getModels: vi.fn().mockResolvedValue({}), flushModels: vi.fn(), })) + vi.mock("../../../integrations/misc/extract-text", () => ({ extractTextFromFile: vi.fn().mockResolvedValue("Mock file content"), })) + vi.mock("p-wait-for", () => ({ default: vi.fn().mockImplementation(async () => Promise.resolve()), })) + vi.mock("fs/promises", () => ({ mkdir: vi.fn().mockResolvedValue(undefined), writeFile: vi.fn().mockResolvedValue(undefined), @@ -153,6 +169,7 @@ vi.mock("fs/promises", () => ({ unlink: vi.fn().mockResolvedValue(undefined), rmdir: vi.fn().mockResolvedValue(undefined), })) + vi.mock("@roo-code/telemetry", () => ({ TelemetryService: { hasInstance: vi.fn().mockReturnValue(true), diff --git a/src/package.json b/src/package.json index 226a73602a..dfe4231f01 100644 --- a/src/package.json +++ b/src/package.json @@ -427,7 +427,7 @@ "@mistralai/mistralai": "^1.3.6", "@modelcontextprotocol/sdk": "^1.9.0", "@qdrant/js-client-rest": "^1.14.0", - "@roo-code/cloud": "^0.11.0", + "@roo-code/cloud": "^0.13.0", "@roo-code/ipc": "workspace:^", "@roo-code/telemetry": "workspace:^", "@roo-code/types": "workspace:^", diff --git a/src/services/marketplace/MarketplaceManager.ts b/src/services/marketplace/MarketplaceManager.ts index 800eba62e0..0227cdb79d 100644 --- a/src/services/marketplace/MarketplaceManager.ts +++ b/src/services/marketplace/MarketplaceManager.ts @@ -4,9 +4,9 @@ import * as path from "path" import * as vscode from "vscode" import * as yaml from "yaml" -import type { MarketplaceItem, MarketplaceItemType, McpMarketplaceItem, OrganizationSettings } from "@roo-code/types" +import type { MarketplaceItem, MarketplaceItemType, McpMarketplaceItem } from "@roo-code/types" import { TelemetryService } from "@roo-code/telemetry" -import { CloudService } from "@roo-code/cloud" +import { type OrganizationSettings, CloudService } from "@roo-code/cloud" import { GlobalFileNames } from "../../shared/globalFileNames" import { ensureSettingsDirectoryExists } from "../../utils/globalContext" diff --git a/src/shared/ExtensionMessage.ts b/src/shared/ExtensionMessage.ts index f9ac305e07..ebdc137432 100644 --- a/src/shared/ExtensionMessage.ts +++ b/src/shared/ExtensionMessage.ts @@ -7,17 +7,15 @@ import type { TelemetrySetting, Experiments, ClineMessage, - OrganizationAllowList, - CloudUserInfo, - ShareVisibility, + MarketplaceItem, } from "@roo-code/types" +import type { CloudUserInfo, OrganizationAllowList, ShareVisibility } from "@roo-code/cloud" import { GitCommit } from "../utils/git" import { McpServer } from "./mcp" import { Mode } from "./modes" import { ModelRecord, RouterModels } from "./api" -import type { MarketplaceItem } from "@roo-code/types" // Command interface for frontend/backend communication export interface Command { diff --git a/src/shared/ProfileValidator.ts b/src/shared/ProfileValidator.ts index 5a7c1da8bd..afdf1b5232 100644 --- a/src/shared/ProfileValidator.ts +++ b/src/shared/ProfileValidator.ts @@ -1,4 +1,5 @@ -import { OrganizationAllowList, ProviderSettings } from "@roo-code/types" +import type { ProviderSettings } from "@roo-code/types" +import type { OrganizationAllowList } from "@roo-code/cloud" export class ProfileValidator { public static isProfileAllowed(profile: ProviderSettings, allowList: OrganizationAllowList): boolean { diff --git a/src/shared/WebviewMessage.ts b/src/shared/WebviewMessage.ts index 2d94896bf5..d59ccd556c 100644 --- a/src/shared/WebviewMessage.ts +++ b/src/shared/WebviewMessage.ts @@ -1,14 +1,14 @@ import { z } from "zod" -import type { - ProviderSettings, - PromptComponent, - ModeConfig, - InstallMarketplaceItemOptions, - MarketplaceItem, - ShareVisibility, +import { + type ProviderSettings, + type PromptComponent, + type ModeConfig, + type InstallMarketplaceItemOptions, + type MarketplaceItem, + marketplaceItemSchema, } from "@roo-code/types" -import { marketplaceItemSchema } from "@roo-code/types" +import type { ShareVisibility } from "@roo-code/cloud" import { Mode } from "./modes" diff --git a/src/shared/__tests__/ProfileValidator.spec.ts b/src/shared/__tests__/ProfileValidator.spec.ts index f606fdce99..0129f8fc20 100644 --- a/src/shared/__tests__/ProfileValidator.spec.ts +++ b/src/shared/__tests__/ProfileValidator.spec.ts @@ -1,6 +1,7 @@ // npx vitest run src/shared/__tests__/ProfileValidator.spec.ts -import { OrganizationAllowList, ProviderSettings } from "@roo-code/types" +import { type ProviderSettings } from "@roo-code/types" +import { type OrganizationAllowList } from "@roo-code/cloud" import { ProfileValidator } from "../ProfileValidator" diff --git a/src/utils/remoteControl.ts b/src/utils/remoteControl.ts index f003b522d1..e645ce7219 100644 --- a/src/utils/remoteControl.ts +++ b/src/utils/remoteControl.ts @@ -1,4 +1,4 @@ -import type { CloudUserInfo } from "@roo-code/types" +import type { CloudUserInfo } from "@roo-code/cloud" /** * Determines if remote control features should be enabled diff --git a/webview-ui/package.json b/webview-ui/package.json index 681aca126d..e37f75a27c 100644 --- a/webview-ui/package.json +++ b/webview-ui/package.json @@ -29,6 +29,7 @@ "@radix-ui/react-slider": "^1.2.3", "@radix-ui/react-slot": "^1.1.2", "@radix-ui/react-tooltip": "^1.1.8", + "@roo-code/cloud": "^0.13.0", "@roo-code/types": "workspace:^", "@tailwindcss/vite": "^4.0.0", "@tanstack/react-query": "^5.68.0", diff --git a/webview-ui/src/__mocks__/vscode.ts b/webview-ui/src/__mocks__/vscode.ts new file mode 100644 index 0000000000..252b20e08c --- /dev/null +++ b/webview-ui/src/__mocks__/vscode.ts @@ -0,0 +1,18 @@ +/** + * Minimal mock for the vscode module. + * Used in tests to prevent module resolution errors. + * The actual vscode API is only available in VS Code extension contexts. + */ + +export const window = { + showInformationMessage: vi.fn(), + showErrorMessage: vi.fn(), +} + +export const env = { + openExternal: vi.fn(), +} + +export const Uri = { + parse: vi.fn((uri: string) => ({ toString: () => uri })), +} diff --git a/webview-ui/src/components/account/AccountView.tsx b/webview-ui/src/components/account/AccountView.tsx index f01aec9377..86239b1593 100644 --- a/webview-ui/src/components/account/AccountView.tsx +++ b/webview-ui/src/components/account/AccountView.tsx @@ -1,8 +1,8 @@ import { useEffect, useRef } from "react" import { VSCodeButton } from "@vscode/webview-ui-toolkit/react" -import type { CloudUserInfo } from "@roo-code/types" import { TelemetryEventName } from "@roo-code/types" +import type { CloudUserInfo } from "@roo-code/cloud" import { useAppTranslation } from "@src/i18n/TranslationContext" import { useExtensionState } from "@src/context/ExtensionStateContext" diff --git a/webview-ui/src/components/chat/ShareButton.tsx b/webview-ui/src/components/chat/ShareButton.tsx index 04cb1e2b38..ae8e1d99b7 100644 --- a/webview-ui/src/components/chat/ShareButton.tsx +++ b/webview-ui/src/components/chat/ShareButton.tsx @@ -2,8 +2,8 @@ import { useState, useEffect, useRef } from "react" import { useTranslation } from "react-i18next" import { SquareArrowOutUpRightIcon } from "lucide-react" -import type { HistoryItem, ShareVisibility } from "@roo-code/types" -import { TelemetryEventName } from "@roo-code/types" +import { type HistoryItem, TelemetryEventName } from "@roo-code/types" +import type { ShareVisibility } from "@roo-code/cloud" import { vscode } from "@/utils/vscode" import { telemetryClient } from "@/utils/TelemetryClient" diff --git a/webview-ui/src/components/settings/ApiConfigManager.tsx b/webview-ui/src/components/settings/ApiConfigManager.tsx index e737678c01..ecb2c39bdc 100644 --- a/webview-ui/src/components/settings/ApiConfigManager.tsx +++ b/webview-ui/src/components/settings/ApiConfigManager.tsx @@ -2,11 +2,20 @@ import { memo, useEffect, useRef, useState } from "react" import { VSCodeTextField } from "@vscode/webview-ui-toolkit/react" import { AlertTriangle } from "lucide-react" -import type { ProviderSettingsEntry, OrganizationAllowList } from "@roo-code/types" +import type { ProviderSettingsEntry } from "@roo-code/types" +import type { OrganizationAllowList } from "@roo-code/cloud" import { useAppTranslation } from "@/i18n/TranslationContext" -import { Button, Input, Dialog, DialogContent, DialogTitle, StandardTooltip, SearchableSelect } from "@/components/ui" -import type { SearchableSelectOption } from "@/components/ui" +import { + type SearchableSelectOption, + Button, + Input, + Dialog, + DialogContent, + DialogTitle, + StandardTooltip, + SearchableSelect, +} from "@/components/ui" interface ApiConfigManagerProps { currentApiConfigName?: string diff --git a/webview-ui/src/components/settings/ModelPicker.tsx b/webview-ui/src/components/settings/ModelPicker.tsx index a5a3fb6ef3..b8c89dd35f 100644 --- a/webview-ui/src/components/settings/ModelPicker.tsx +++ b/webview-ui/src/components/settings/ModelPicker.tsx @@ -3,7 +3,8 @@ import { VSCodeLink } from "@vscode/webview-ui-toolkit/react" import { Trans } from "react-i18next" import { ChevronsUpDown, Check, X } from "lucide-react" -import type { ProviderSettings, ModelInfo, OrganizationAllowList } from "@roo-code/types" +import type { ProviderSettings, ModelInfo } from "@roo-code/types" +import type { OrganizationAllowList } from "@roo-code/cloud" import { useAppTranslation } from "@src/i18n/TranslationContext" import { useSelectedModel } from "@/components/ui/hooks/useSelectedModel" @@ -194,7 +195,9 @@ export const ModelPicker = ({ value={model} onSelect={onSelect} data-testid={`model-option-${model}`}> -{model} + + {model} + , diff --git a/webview-ui/src/context/ExtensionStateContext.tsx b/webview-ui/src/context/ExtensionStateContext.tsx index 12f13bdf55..0413a82d24 100644 --- a/webview-ui/src/context/ExtensionStateContext.tsx +++ b/webview-ui/src/context/ExtensionStateContext.tsx @@ -6,9 +6,8 @@ import { type CustomModePrompts, type ModeConfig, type ExperimentId, - type OrganizationAllowList, - ORGANIZATION_ALLOW_ALL, } from "@roo-code/types" +import { type OrganizationAllowList, ORGANIZATION_ALLOW_ALL } from "@roo-code/cloud" import { ExtensionMessage, ExtensionState, MarketplaceInstalledMetadata, Command } from "@roo/ExtensionMessage" import { findLastIndex } from "@roo/array" diff --git a/webview-ui/src/utils/__tests__/validate.test.ts b/webview-ui/src/utils/__tests__/validate.test.ts index 9e693544b9..e76672df97 100644 --- a/webview-ui/src/utils/__tests__/validate.test.ts +++ b/webview-ui/src/utils/__tests__/validate.test.ts @@ -1,4 +1,6 @@ -import { ProviderSettings, OrganizationAllowList } from "@roo-code/types" +import type { ProviderSettings } from "@roo-code/types" +import type { OrganizationAllowList } from "@roo-code/cloud" + import { RouterModels } from "@roo/api" import { getModelValidationError, validateApiConfigurationExcludingModelErrors } from "../validate" diff --git a/webview-ui/src/utils/validate.ts b/webview-ui/src/utils/validate.ts index 70caf187f0..002f42055b 100644 --- a/webview-ui/src/utils/validate.ts +++ b/webview-ui/src/utils/validate.ts @@ -1,6 +1,7 @@ import i18next from "i18next" -import type { ProviderSettings, OrganizationAllowList } from "@roo-code/types" +import type { ProviderSettings } from "@roo-code/types" +import type { OrganizationAllowList } from "@roo-code/cloud" import { isRouterName, RouterModels } from "@roo/api" diff --git a/webview-ui/vite.config.ts b/webview-ui/vite.config.ts index 0579344a22..08284d9935 100644 --- a/webview-ui/vite.config.ts +++ b/webview-ui/vite.config.ts @@ -100,6 +100,7 @@ export default defineConfig(({ mode }) => { // Ensure source maps are properly included in the build minify: mode === "production" ? "esbuild" : false, rollupOptions: { + external: ["vscode"], output: { entryFileNames: `assets/[name].js`, chunkFileNames: (chunkInfo) => { diff --git a/webview-ui/vitest.config.ts b/webview-ui/vitest.config.ts index b9455584bf..80f3f49cf6 100644 --- a/webview-ui/vitest.config.ts +++ b/webview-ui/vitest.config.ts @@ -16,6 +16,9 @@ export default defineConfig({ "@": path.resolve(__dirname, "./src"), "@src": path.resolve(__dirname, "./src"), "@roo": path.resolve(__dirname, "../src/shared"), + // Mock the vscode module for tests since it's not available outside + // VS Code extension context. + vscode: path.resolve(__dirname, "./src/__mocks__/vscode.ts"), }, }, })