From 0a89f05d07bd1fb5b6e553c603c0e5552f919f33 Mon Sep 17 00:00:00 2001 From: Bohdan Triapitsyn Date: Sat, 11 Jul 2026 10:48:20 +0300 Subject: [PATCH] feat: mark embedded session chat as desktop surface Adds a surface=desktop URL param to embedded session chat links Uses the surface override to classify embedded chat as desktop Covers the new URL parameter in tests --- .../src/components/layout/contextPanelEmbeddedChat.test.ts | 1 + .../ui/src/components/layout/contextPanelEmbeddedChat.ts | 1 + packages/ui/src/lib/device.ts | 6 +++--- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/ui/src/components/layout/contextPanelEmbeddedChat.test.ts b/packages/ui/src/components/layout/contextPanelEmbeddedChat.test.ts index ab609ed5..fafe4474 100644 --- a/packages/ui/src/components/layout/contextPanelEmbeddedChat.test.ts +++ b/packages/ui/src/components/layout/contextPanelEmbeddedChat.test.ts @@ -54,6 +54,7 @@ describe('embedded session chat URL', () => { const url = new URL(src); expect(url.searchParams.get('ocPanel')).toBe('session-chat'); + expect(url.searchParams.get('surface')).toBe('desktop'); expect(url.searchParams.get('themeMode')).toBe('system'); expect(url.searchParams.get('themeVariant')).toBe('dark'); expect(url.searchParams.get('lightThemeId')).toBe('custom-light'); diff --git a/packages/ui/src/components/layout/contextPanelEmbeddedChat.ts b/packages/ui/src/components/layout/contextPanelEmbeddedChat.ts index baf4d5be..ad7b4118 100644 --- a/packages/ui/src/components/layout/contextPanelEmbeddedChat.ts +++ b/packages/ui/src/components/layout/contextPanelEmbeddedChat.ts @@ -30,6 +30,7 @@ export const buildEmbeddedSessionChatURL = ( const url = new URL(window.location.pathname, window.location.origin); url.searchParams.set('ocPanel', 'session-chat'); + url.searchParams.set('surface', 'desktop'); url.searchParams.set('sessionId', sessionID); if (readOnly) { url.searchParams.set('readOnly', '1'); diff --git a/packages/ui/src/lib/device.ts b/packages/ui/src/lib/device.ts index dc58daa2..51e11b15 100644 --- a/packages/ui/src/lib/device.ts +++ b/packages/ui/src/lib/device.ts @@ -35,9 +35,9 @@ const DEFAULT_DEVICE_INFO: DeviceInfo = { hasTouchOnlyPointer: false, }; -const isEmbeddedSessionChat = (): boolean => { +const hasDesktopSurfaceOverride = (): boolean => { if (typeof window === 'undefined') return false; - return new URLSearchParams(window.location.search).get('ocPanel') === 'session-chat'; + return new URLSearchParams(window.location.search).get('surface') === 'desktop'; }; const getNavigatorDeviceHints = (maxTouchPoints: number) => { @@ -109,7 +109,7 @@ export function getDeviceInfo(): DeviceInfo { const noHover = hoverQuery?.matches ?? false; const maxTouchPoints = typeof navigator !== 'undefined' ? navigator.maxTouchPoints ?? 0 : 0; // Desktop panels are desktop surfaces even when their viewport is narrow. - const isDesktopShellRuntime = isDesktopShell() || isVSCodeRuntime() || isEmbeddedSessionChat(); + const isDesktopShellRuntime = isDesktopShell() || isVSCodeRuntime() || hasDesktopSurfaceOverride(); const { isExplicitTablet } = getNavigatorDeviceHints(maxTouchPoints); const hasTouchInput = prefersCoarsePointer || noHover || maxTouchPoints > 0;