import type { ClientContext } from '@deepseek-ai/dsh-client-runtime/client' import { DESKTOP_QUERY, MOBILE_QUERY } from './platform/breakpoints.ts' /** * Debug badge — ?mobile-nav-debug=1 * Renders a live state overlay (URL, viewport, media queries, shell chrome, * aionui columns, genui cards, captured errors) so a phone-side repro can be * diagnosed without guessing. No-op unless the query param is present. */ /** * Combo id segment identifying this plugin's own bundle inside the host's * plugin route (`/plugins/??/client.js,…&rev=<12 hex>`). The leading `?` or * `,` is a boundary so a scoped fork (`@someone/dsh-web-mobile`) cannot match. */ const BUNDLE_ID = /[?,]dsh-web-mobile\/client\.js/ /** * Revision from a plugin bundle URL, or null when it carries none. * The host mints it per build (`dsh-client-modules` HASH_REVISION_LENGTH = 12) * and stamps the same value on the URL it actually serves, so it answers * "which build is this page running" with no build-time injection. */ export function parseBundleRev(url: string | null | undefined): string | null { if (typeof url !== 'string' || url === '') return null try { const rev = new URL(url, 'http://x').searchParams.get('rev') return rev === null || rev === '' ? null : rev } catch { return null } } /** * Revision of the bundle the host served this plugin's code from, read off the * head element the host injected for it, or null when that element is absent. * * The host injects an application-batch combo as * `` * and the browser fetches exactly that URL (verified against * `performance.getEntriesByType('resource')`), so the `rev` here IS the running * build's revision. The bundle id — not "the first rev in head" — selects our * row: the only `