diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx index e69de418cd3ee..a16f3d2da3f34 100644 --- a/apps/web/src/components/ChatView.tsx +++ b/apps/web/src/components/ChatView.tsx @@ -307,6 +307,8 @@ import { ChatHeader } from "./chat/ChatHeader"; import { useSideChat } from "./chat/useSideChat"; import { useRemoteOpenState } from "~/remoteOpen"; import { shouldShowOpenInPicker } from "./chat/OpenInPicker.logic"; +import { isDesktopWslTarget } from "../connection/desktopLocal"; +import { useEnvironmentPresentation } from "../state/presentation"; import { useOpenFavoriteEditorShortcut } from "./chat/OpenInPickerShortcut"; import { PanelLayoutControls, @@ -1699,12 +1701,14 @@ export default function ChatView(props: ChatViewProps) { useAtomValue(serverEnvironment.configValueAtom(openInEnvironmentId))?.availableEditors ?? []; const hostEnvironmentId = useAtomValue(hostEnvironmentIdAtom); const remoteOpenState = useRemoteOpenState(openInEnvironmentId); + const openInTarget = useEnvironmentPresentation(openInEnvironmentId).presentation?.entry.target; const showOpenInPicker = shouldShowOpenInPicker({ activeProjectName: activeProject?.title, activeThreadEnvironmentId: openInEnvironmentId, primaryEnvironmentId: primaryEnvironment?.environmentId ?? null, hostEnvironmentId, remoteOpenMode: remoteOpenState.mode, + isDesktopWslBackend: isDesktopWslTarget(openInTarget), }); useOpenFavoriteEditorShortcut({ enabled: showOpenInPicker && !backgroundThread, diff --git a/apps/web/src/components/chat/OpenInPicker.logic.test.ts b/apps/web/src/components/chat/OpenInPicker.logic.test.ts index 10595e2f8cdbe..e69cbb1db2fd5 100644 --- a/apps/web/src/components/chat/OpenInPicker.logic.test.ts +++ b/apps/web/src/components/chat/OpenInPicker.logic.test.ts @@ -19,8 +19,22 @@ describe("shouldShowOpenInPicker", () => { primaryEnvironmentId, hostEnvironmentId, remoteOpenMode: "local-exec", + isDesktopWslBackend: false, }), ).toBe(visible); } }); + + it("shows a desktop-managed WSL backend that runs editors itself", () => { + expect( + shouldShowOpenInPicker({ + activeProjectName: "Project", + activeThreadEnvironmentId: EnvironmentId.make("wsl-secondary"), + primaryEnvironmentId: EnvironmentId.make("primary"), + hostEnvironmentId: null, + remoteOpenMode: "local-exec", + isDesktopWslBackend: true, + }), + ).toBe(true); + }); }); diff --git a/apps/web/src/components/chat/OpenInPicker.logic.ts b/apps/web/src/components/chat/OpenInPicker.logic.ts index 5978a5986030a..646ffa56976a1 100644 --- a/apps/web/src/components/chat/OpenInPicker.logic.ts +++ b/apps/web/src/components/chat/OpenInPicker.logic.ts @@ -8,6 +8,7 @@ export function shouldShowOpenInPicker(input: { readonly primaryEnvironmentId: EnvironmentId | null; readonly hostEnvironmentId: string | null; readonly remoteOpenMode: RemoteOpenMode; + readonly isDesktopWslBackend: boolean; }): boolean { if (!input.activeProjectName) return false; if ( @@ -16,5 +17,7 @@ export function shouldShowOpenInPicker(input: { ) { return true; } + // Desktop-managed WSL backends run on this machine and reach Windows editors through interop. + if (input.isDesktopWslBackend) return true; return input.remoteOpenMode !== "local-exec"; } diff --git a/apps/web/src/connection/desktopLocal.ts b/apps/web/src/connection/desktopLocal.ts index eb46a09ab3ac6..be420a0112b90 100644 --- a/apps/web/src/connection/desktopLocal.ts +++ b/apps/web/src/connection/desktopLocal.ts @@ -26,6 +26,10 @@ export function desktopLocalBackendId(target: ConnectionTarget): string | null { : null; } +export function isDesktopWslTarget(target: ConnectionTarget | undefined): boolean { + return target !== undefined && (desktopLocalBackendId(target)?.startsWith("wsl:") ?? false); +} + export type DesktopSecondaryBootstrapsRead = | { readonly _tag: "Success";