dsh-wsl-workspace 0.3.2 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -0
- package/TESTING.md +11 -5
- package/lib/client.js +884 -764
- package/lib/client.js.map +1 -1
- package/lib/fs.js +193 -188
- package/lib/fs.js.map +1 -1
- package/lib/index.js +1001 -923
- package/lib/index.js.map +1 -1
- package/lib/shell.js +95 -58
- package/lib/shell.js.map +1 -1
- package/lib/{wsl-C5_mxGPM.js → wsl-6VcgOvF9.js} +24 -17
- package/lib/wsl-6VcgOvF9.js.map +1 -0
- package/lib/{wsl-credentials-BI4v5TNZ.js → wsl-credentials-B6wIXsKt.js} +7 -14
- package/lib/wsl-credentials-B6wIXsKt.js.map +1 -0
- package/package.json +19 -1
- package/src/client/index.ts +149 -24
- package/src/client/locales.ts +68 -68
- package/src/host/wsl-skills.ts +113 -9
- package/lib/wsl-C5_mxGPM.js.map +0 -1
- package/lib/wsl-credentials-BI4v5TNZ.js.map +0 -1
package/lib/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","names":["listDistrosApi","listDirApi","checkApi","registerWindowsApi","setWorkspaceUserApi","listWorkspacesApi"],"sources":["../src/client/api.ts","../src/shared/paths.ts","../src/client/AddWslWorkspace.tsx","../src/client/styles.ts","../src/client/locales.ts","../src/client/index.ts"],"sourcesContent":["/**\r\n * Thin fetch client for the Host plugin route. The browser calls\r\n * POST /wsl-workspace/api with a `{ method, params }` envelope and the Host\r\n * answers `{ ok: true, value }` or `{ ok: false, error }`.\r\n */\r\n\r\n/** Relative route the Host half registers (same-origin with the web server). */\r\nconst ENDPOINT = '/wsl-workspace/api'\r\n\r\n/** One directory entry as the Host lists it. */\r\nexport interface WslDirEntry {\r\n name: string\r\n kind: 'directory' | 'file' | 'other'\r\n}\r\n\r\n/** One directory level plus its breadcrumb ancestry. */\r\nexport interface WslDirListing {\r\n /** The listed absolute Linux path. */\r\n path: string\r\n /** Parent Linux path, or null at the filesystem root. */\r\n parent: string | null\r\n /** The level's children (in name order; the client filters to directories). */\r\n entries: WslDirEntry[]\r\n}\r\n\r\n/** Existence/directory check result for one Linux path. */\r\nexport interface WslPathCheck {\r\n exists: boolean\r\n isDirectory: boolean\r\n}\r\n\r\n/** Wire envelope the Host route answers with. */\r\ntype Envelope<T> = { ok: true; value: T } | { ok: false; error: string }\r\n\r\n/** Human text for an unknown rejection, reusing the repository's idiom. */\r\nfunction errorMessage(value: unknown): string {\r\n return value instanceof Error ? value.message : String(value)\r\n}\r\n\r\n/**\r\n * Perform one POST call and unwrap the envelope.\r\n * @param method - the Host method name.\r\n * @param params - the method payload.\r\n * @returns the unwrapped value, or throws an Error on network or `ok:false`.\r\n */\r\nasync function call<T>(method: string, params: Record<string, unknown> = {}): Promise<T> {\r\n let response: Response\r\n try {\r\n response = await fetch(ENDPOINT, {\r\n method: 'POST',\r\n headers: { 'content-type': 'application/json' },\r\n body: JSON.stringify({ method, params }),\r\n })\r\n } catch (error) {\r\n // The transport refused before answering (offline, origin mismatch, 404).\r\n throw new Error(`wsl-workspace request failed: ${errorMessage(error)}`)\r\n }\r\n let envelope: Envelope<T>\r\n try {\r\n envelope = (await response.json()) as Envelope<T>\r\n } catch {\r\n // A non-JSON body means a proxy/loader answered instead of the Host route.\r\n throw new Error(`wsl-workspace answered non-JSON (${response.status})`)\r\n }\r\n if (!envelope.ok) throw new Error(envelope.error)\r\n return envelope.value\r\n}\r\n\r\n/**\r\n * List the WSL distros installed on the host.\r\n * @returns distro names in registry order.\r\n */\r\nexport async function listDistros(): Promise<string[]> {\r\n return call<string[]>('listDistros', {})\r\n}\r\n\r\n/**\r\n * List one directory level inside a distro.\r\n * @param distro - distro name.\r\n * @param path - absolute Linux directory to list.\r\n * @returns the level's listing with ancestry.\r\n */\r\nexport async function listDir(distro: string, path: string): Promise<WslDirListing> {\r\n return call<WslDirListing>('listDir', { distro, path })\r\n}\r\n\r\n/**\r\n * Check whether a Linux path exists and is a directory.\r\n * @param distro - distro name.\r\n * @param path - absolute Linux path.\r\n * @returns existence and directory facts.\r\n */\r\nexport async function check(distro: string, path: string): Promise<WslPathCheck> {\r\n return call<WslPathCheck>('check', { distro, path })\r\n}\r\n\r\n/**\r\n * Store (or clear, with an empty string) the username of one WSL workspace.\r\n * @param path - the workspace UNC path.\r\n * @param username - the Linux username; empty string clears the stored value.\r\n */\r\nexport async function setWorkspaceUser(path: string, username: string): Promise<void> {\r\n return call<void>('setUser', { path, username })\r\n}\r\n\r\n/**\r\n * Register a `/mnt/<drive>` WSL workspace under its Windows drive path,\r\n * recording the distro (and optional username) for the session env.\r\n * @param linuxPath - the `/mnt/<drive>/…` Linux path.\r\n * @param distro - the WSL distribution the workspace belongs to.\r\n * @param username - optional Linux username.\r\n */\r\nexport async function registerWindows(linuxPath: string, distro: string, username: string): Promise<void> {\r\n return call<void>('registerWindows', { linuxPath, distro, username })\r\n}\r\n\r\n/**\r\n * List every registered WSL workspace key (canonical UNC and Windows drive\r\n * spellings). The client uses the drive keys to recognize `/mnt` workspaces\r\n * across page reloads.\r\n */\r\nexport async function listWorkspaces(): Promise<string[]> {\r\n return call<string[]>('listWorkspaces', {})\r\n}\r\n","/**\r\n * WSL path helpers shared by the client and host halves. Pure and\r\n * dependency-free so both planes can import them without a runtime edge.\r\n */\r\n\r\n/** WSL2 default loopback bridge host: `\\\\wsl.localhost\\<distro>\\...`. */\r\nconst WSL_LOCALHOST_HOST = 'wsl.localhost'\r\n/** Legacy WSL interop host: `\\\\wsl$\\<distro>\\...`. */\r\nconst WSL_LEGACY_HOST = 'wsl$'\r\n\r\n/** The two UNC hosts WSL exposes a distribution's filesystem under. */\r\nconst UNC_HOSTS = [WSL_LOCALHOST_HOST, WSL_LEGACY_HOST]\r\n\r\n/** One WSL workspace coordinate parsed out of a UNC path. */\r\nexport interface WslUncTarget {\r\n /** Distro name (e.g. `Ubuntu`) as `wsl -l -q` reports it. */\r\n readonly distro: string\r\n /** Normalized absolute Linux path (leading `/`; no trailing slash except root). */\r\n readonly linuxPath: string\r\n}\r\n\r\n/**\r\n * Parse a WSL UNC path into its distro and Linux path. Accepts the WSL2\r\n * `\\\\wsl.localhost\\<distro>\\<linux>` form, the legacy `\\\\wsl$\\<distro>\\<linux>`\r\n * interop form, and forward-slash spellings of either.\r\n * @param raw - candidate absolute path.\r\n * @returns the parsed target, or null when the path is not a WSL UNC.\r\n */\r\nexport function parseWslUnc(raw: string): WslUncTarget | null {\r\n const normalized = raw.replace(/\\\\/g, '/').replace(/\\/\\/+/g, '//')\r\n if (!normalized.startsWith('//')) return null\r\n const segments = normalized.slice(2).split('/')\r\n const host = (segments[0] ?? '').toLowerCase()\r\n if (!UNC_HOSTS.includes(host)) return null\r\n const distro = segments[1] ?? ''\r\n if (distro === '') return null\r\n const rest = segments.slice(2).filter(segment => segment.length > 0)\r\n return { distro, linuxPath: `/${rest.join('/')}` }\r\n}\r\n\r\n/**\r\n * Whether a path resolves into a WSL distro through either UNC form.\r\n * @param raw - candidate absolute path.\r\n * @returns whether the path parses as a WSL UNC.\r\n */\r\nexport function isWslUnc(raw: string): boolean {\r\n return parseWslUnc(raw) !== null\r\n}\r\n\r\n/**\r\n * Translate a WSL UNC path to the absolute Linux path a process inside the\r\n * distribution can open. Throws on non-WSL input: callers rely on this\r\n * conversion to hand paths to the Linux world, so a silent pass-through\r\n * would hand a Windows path to bash.\r\n * @param uncPath - a path {@link parseWslUnc} accepts.\r\n * @returns the absolute Linux path.\r\n */\r\nexport function uncToLinux(uncPath: string): string {\r\n const parts = parseWslUnc(uncPath)\r\n if (parts === null) {\r\n throw new Error(`wsl-workspace: \"${uncPath}\" is not a WSL UNC path`)\r\n }\r\n return parts.linuxPath\r\n}\r\n\r\n/**\r\n * Normalize a Linux absolute path for the Host: collapse repeated slashes and\r\n * strip a trailing slash (root becomes `/`).\r\n * @param path - absolute Linux path.\r\n * @returns the normalized path.\r\n */\r\nexport function normalizeLinuxPath(path: string): string {\r\n const collapsed = path.replace(/\\/+/g, '/')\r\n return collapsed === '/' ? '/' : collapsed.replace(/\\/$/, '')\r\n}\r\n\r\n/**\r\n * Whether a path is an absolute, non-empty Linux path.\r\n * @param path - candidate.\r\n * @returns whether it starts with `/` and contains no NUL.\r\n */\r\nexport function isAbsoluteLinuxPath(path: string): boolean {\r\n return path.startsWith('/') && !path.includes('\\0')\r\n}\r\n\r\n/**\r\n * Join a distro and a Linux absolute path into the WSL2 UNC form used as the\r\n * workspace identity (`\\\\wsl.localhost\\<distro>\\<linux>`, backslash segments).\r\n * @param distro - distro name.\r\n * @param linuxPath - absolute Linux path (leading `/`).\r\n * @returns the UNC path.\r\n */\r\nexport function joinUnc(distro: string, linuxPath: string): string {\r\n if (!isAbsoluteLinuxPath(linuxPath)) {\r\n throw new Error(`wsl-workspace: cannot map a non-absolute Linux path \"${linuxPath}\" to UNC`)\r\n }\r\n // Defense in depth: a distribution name with separators or dot-dirs would\r\n // escape the `\\\\wsl.localhost\\` share structure (the host route validates\r\n // wire-supplied names too; every other caller passes through here).\r\n if (distro === '' || distro === '.' || distro === '..' || /[\\\\/]/.test(distro)) {\r\n throw new Error(`wsl-workspace: invalid distribution name \"${distro}\"`)\r\n }\r\n const normalized = linuxPath.replace(/\\/+/g, '/').replace(/\\/$/, '')\r\n const withoutLeading = normalized.startsWith('/') ? normalized.slice(1) : normalized\r\n const windowsSegments = withoutLeading.replace(/\\//g, '\\\\')\r\n const suffix = windowsSegments === '' ? '' : `\\\\${windowsSegments}`\r\n return `\\\\\\\\wsl.localhost\\\\${distro}${suffix}`\r\n}\r\n\r\n/**\r\n * Translate a Windows drive path to the drvfs mount path WSL distributions\r\n * conventionally expose it at (`C:\\foo` → `/mnt/c/foo`). Only single-letter\r\n * drives under `/mnt` are mapped; custom mount points are out of scope.\r\n * @param path - the candidate Windows path.\r\n * @returns the `/mnt/<drive>/…` path, or `null` for non-drive paths.\r\n */\r\nexport function windowsToMntPath(path: string): string | null {\r\n const match = /^([A-Za-z]):[\\\\/](.*)$/.exec(path)\r\n if (match === null) return null\r\n const rest = (match[2] ?? '').replace(/\\\\/g, '/').replace(/\\/+/g, '/').replace(/\\/$/, '')\r\n return `/mnt/${(match[1] ?? '').toLowerCase()}${rest === '' ? '' : `/${rest}`}`\r\n}\r\n\r\n/**\r\n * Translate a `/mnt/<drive>/…` path back to its Windows drive path.\r\n * @param linuxPath - the candidate Linux path.\r\n * @returns the `X:\\…` drive path, or `null` when the path is not a drvfs mount.\r\n */\r\nexport function mntToWindowsPath(linuxPath: string): string | null {\r\n const match = /^\\/mnt\\/([a-zA-Z])(?:\\/(.*))?$/.exec(linuxPath)\r\n if (match === null) return null\r\n const rest = (match[2] ?? '').replace(/\\//g, '\\\\')\r\n return `${(match[1] ?? '').toUpperCase()}:\\\\${rest}`\r\n}\r\n\r\n/**\r\n * Canonical Windows drive path for store keys and cross-realm identity:\r\n * separators unified to `\\`, trailing separator stripped, and the WHOLE path\r\n * lowercased — Windows paths compare case-insensitively, and the workspace\r\n * registry may realpath a different casing than the caller spelled (8.3 or\r\n * on-disk casing), so the store key must collide across casings.\r\n * @param path - candidate Windows drive path.\r\n * @returns the canonical form, or `null` when not drive-shaped.\r\n */\r\nexport function canonicalWindowsPath(path: string): string | null {\r\n const match = /^([A-Za-z]):[\\\\/](.*)$/.exec(path)\r\n if (match === null) return null\r\n const rest = (match[2] ?? '').replace(/[\\\\/]+/g, '\\\\').replace(/\\\\$/, '').toLowerCase()\r\n return `${(match[1] ?? '').toLowerCase()}:\\\\${rest}`\r\n}\r\n\r\n/**\r\n * True when a value is a Windows-shaped path (drive or UNC), which is how\r\n * the shell executor decides the WSLENV `/p` translation flag: only Windows\r\n * path values need translation when they cross into the Linux process.\r\n * @param value - the environment value to classify.\r\n * @returns whether the value looks like a Windows path.\r\n */\r\nexport function isWindowsPathShaped(value: string): boolean {\r\n return /^[A-Za-z]:[\\\\/]/.test(value) || value.startsWith('\\\\\\\\')\r\n}\r\n\r\n/** Linux username shape for `wsl.exe -u`: starts with a letter or underscore, then letters/digits/`_`/`.`/`-` (max 64). */\r\nconst WSL_USERNAME_PATTERN = /^[A-Za-z_][A-Za-z0-9_.-]{0,63}$/\r\n\r\n/**\r\n * Whether a value is a safe Linux username for `wsl.exe -u`. The check is\r\n * strict on purpose: a value starting with `-` could be parsed as a wsl.exe\r\n * option instead of a username.\r\n * @param value - candidate username.\r\n * @returns whether it matches the Linux username shape.\r\n */\r\nexport function isValidWslUsername(value: string): boolean {\r\n return WSL_USERNAME_PATTERN.test(value)\r\n}\r\n","/**\r\n * Sidebar footer action that opens the \"Add WSL workspace\" dialog. In the\r\n * wide sidebar it renders a labeled row; in the 56px rail it collapses to a\r\n * 36px icon button (both honor the shell's `{ wide }` owner share).\r\n *\r\n * Registration omits the typed `locale:` seat (the `wslWorkspace` namespace is\r\n * not merged into `LocaleNamespaceMap`), so the injected face carries the\r\n * bound translate function instead.\r\n */\r\n\r\nimport type * as React from 'react'\r\nimport { useEffect, useRef, useState, type UIEventHandler } from 'react'\r\nimport { isAbsoluteLinuxPath, isValidWslUsername, normalizeLinuxPath } from '../shared/paths.ts'\r\nimport type { WslDirListing, WslPathCheck } from './api.ts'\r\n\r\n/** Result-level shape of a browse/check/list call we surface uniformly. */\r\ninterface ApiCall<T> {\r\n value: T\r\n}\r\n\r\n/** The inject face: plain data + callbacks the dialog drives. */\r\nexport interface AddWslWorkspaceInjected {\r\n /**\r\n * Confirm the deployment exposes a healthy `wsl` preset.\r\n * @returns undefined when healthy, else a Chinese/English message to show.\r\n */\r\n checkPreset(): Promise<string | undefined>\r\n /** List the WSL distros installed on the host. */\r\n listDistros(): Promise<string[]>\r\n /** List one Linux directory level inside a distro. */\r\n listDir(distro: string, path: string): Promise<WslDirListing>\r\n /** Check a Linux path's existence/directory facts. */\r\n check(distro: string, path: string): Promise<WslPathCheck>\r\n /**\r\n * Register a WSL workspace and start a session in it. `/mnt/<drive>`\r\n * paths register under their Windows drive spelling (9P cannot serve\r\n * drvfs); ext4 paths register as `\\\\wsl.localhost\\<distro>\\...` UNC.\r\n * @param linuxPath - the absolute Linux workspace path.\r\n * @param username - optional Linux user for the session (empty = distro default).\r\n * @param distro - the WSL distribution the path belongs to.\r\n * @returns undefined on success, else a message to show.\r\n */\r\n createWorkspace(linuxPath: string, username: string, distro: string): Promise<string | undefined>\r\n /** Translate a `wslWorkspace` dictionary key (follows the DeepSeek Harness locale). */\r\n t: (key: string, params?: Record<string, unknown>) => string\r\n}\r\n\r\n/** Full component props: the owner share plus the injected face. */\r\nexport interface AddWslWorkspaceProps extends AddWslWorkspaceInjected {\r\n /** Whether the sidebar renders wide content (false = 56px rail). */\r\n wide: boolean\r\n}\r\n\r\n/**\r\n * Build the Linux child path one level below a parent, for the breadcrumb/\r\n * browse drill.\r\n * @param parent - the currently listed absolute path (`/` for root).\r\n * @param name - the child directory name.\r\n * @returns the child's absolute Linux path.\r\n */\r\nexport function dirChildPath(parent: string, name: string): string {\r\n return parent === '/' ? `/${name}` : `${parent}/${name}`\r\n}\r\n\r\n/** A tiny inline terminal glyph for the dialog's directory rows. */\r\nfunction WslGlyph({ size = 16 }: { size?: number }): React.ReactElement {\r\n return (\r\n <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\r\n <rect x=\"2.5\" y=\"4.5\" width=\"19\" height=\"15\" rx=\"2.5\" stroke=\"currentColor\" strokeWidth=\"1.6\" />\r\n <path d=\"M6 9l3.2 2.6L6 14\" stroke=\"currentColor\" strokeWidth=\"1.6\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\r\n <path d=\"M12 14h5\" stroke=\"currentColor\" strokeWidth=\"1.6\" strokeLinecap=\"round\" />\r\n </svg>\r\n )\r\n}\r\n\r\n/**\r\n * The \"Add WSL workspace…\" footer action and its dialog.\r\n * @param props - owner share + injected face.\r\n */\r\nexport function AddWslWorkspace({ wide, t, checkPreset, listDistros, listDir, check, createWorkspace }: AddWslWorkspaceProps): React.ReactElement | null {\r\n const [open, setOpen] = useState(false)\r\n const [opening, setOpening] = useState(false)\r\n const [distros, setDistros] = useState<string[]>([])\r\n const [distro, setDistro] = useState('')\r\n const [pathInput, setPathInput] = useState('/home/')\r\n const [username, setUsername] = useState('')\r\n const [listing, setListing] = useState<WslDirListing | null>(null)\r\n const [browsePath, setBrowsePath] = useState('/')\r\n const [browsing, setBrowsing] = useState(false)\r\n const [error, setError] = useState<string | null>(null)\r\n const [busy, setBusy] = useState(false)\r\n // Monotone browse-request sequence: stale responses for a superseded browse are dropped.\r\n const browseSeq = useRef(0)\r\n\r\n const refreshBrowse = async (root: string, targetDistro: string): Promise<void> => {\r\n const seq = ++browseSeq.current\r\n setBrowsing(true)\r\n setBrowsePath(root)\r\n try {\r\n const value = await listDir(targetDistro, root)\r\n if (seq === browseSeq.current) setListing(value)\r\n } catch {\r\n // A failed browse (permission, missing dir) is non-fatal: keep old listing.\r\n if (seq === browseSeq.current) {\r\n setListing(null)\r\n setError((previous) => previous ?? t('error.loadDir'))\r\n }\r\n } finally {\r\n if (seq === browseSeq.current) setBrowsing(false)\r\n }\r\n }\r\n\r\n useEffect(() => {\r\n if (!open) return\r\n let cancelled = false\r\n setError(null)\r\n setOpening(true)\r\n void (async () => {\r\n let presetIssue: string | undefined\r\n try {\r\n presetIssue = await checkPreset()\r\n } catch {\r\n presetIssue = t('error.loadDistros')\r\n }\r\n let names: string[]\r\n try {\r\n names = await listDistros()\r\n } catch {\r\n if (cancelled) return\r\n setOpening(false)\r\n setError(t('error.loadDistros'))\r\n return\r\n }\r\n if (cancelled) return\r\n setDistros(names)\r\n const first = names[0] ?? ''\r\n setDistro(first)\r\n // The default browse root walks from `/`; the input defaults to `/home/`.\r\n setBrowsing(true)\r\n setOpening(false)\r\n if (presetIssue !== undefined) setError(presetIssue)\r\n if (first !== '') void refreshBrowse('/', first)\r\n })()\r\n return () => { cancelled = true }\r\n // eslint-disable-next-line react-hooks/exhaustive-deps -- run once per open against current t.\r\n }, [open])\r\n\r\n useEffect(() => {\r\n if (!open) return\r\n const onKey = (event: KeyboardEvent): void => {\r\n if (event.key === 'Escape' && !busy) setOpen(false)\r\n }\r\n window.addEventListener('keydown', onKey)\r\n return () => window.removeEventListener('keydown', onKey)\r\n }, [open, busy])\r\n\r\n if (!open) {\r\n // A W-letter action beside Settings at the sidebar foot; the title\r\n // carries the label in both wide and rail states.\r\n return (\r\n <button\r\n type=\"button\"\r\n className={wide ? 'dww-action dww-action--wide' : 'dww-action dww-action--rail'}\r\n title={t('action.title')}\r\n aria-label={t('action.title')}\r\n onClick={() => setOpen(true)}\r\n >\r\n <span className=\"dww-letter\" aria-hidden=\"true\">W</span>\r\n </button>\r\n )\r\n }\r\n\r\n const onDrill = (name: string): void => {\r\n const next = dirChildPath(listing?.path ?? browsePath, name)\r\n setPathInput(next)\r\n void refreshBrowse(next, distro)\r\n }\r\n\r\n const onUp = (): void => {\r\n const parent = listing?.parent ?? null\r\n if (parent === null) return\r\n setPathInput(parent)\r\n void refreshBrowse(parent, distro)\r\n }\r\n\r\n const onDistroChange = (value: string): void => {\r\n setDistro(value)\r\n void refreshBrowse(browsePath, value)\r\n }\r\n\r\n const onCheck = async (): Promise<void> => {\r\n const path = normalizeLinuxPath(pathInput)\r\n setError(null)\r\n if (!isAbsoluteLinuxPath(path) || path === '/') {\r\n setError(t('error.invalidPath'))\r\n return\r\n }\r\n let facts: WslPathCheck\r\n try {\r\n facts = await check(distro, path)\r\n } catch {\r\n setError(t('error.pathNotFound'))\r\n return\r\n }\r\n if (!facts.exists || !facts.isDirectory) {\r\n setError(t('error.pathNotFound'))\r\n return\r\n }\r\n void refreshBrowse(path, distro)\r\n }\r\n\r\n const onConfirm = async (): Promise<void> => {\r\n const path = normalizeLinuxPath(pathInput)\r\n setError(null)\r\n if (!isAbsoluteLinuxPath(path) || path === '/') {\r\n // A workspace at the distribution root would make every session start\r\n // at `/`; the check flow rejects it and confirm must agree.\r\n setError(t('error.invalidPath'))\r\n return\r\n }\r\n const user = username.trim()\r\n if (user !== '' && !isValidWslUsername(user)) {\r\n setError(t('error.invalidUsername'))\r\n return\r\n }\r\n setBusy(true)\r\n try {\r\n let facts: WslPathCheck\r\n try {\r\n facts = await check(distro, path)\r\n } catch {\r\n setError(t('error.pathNotFound'))\r\n return\r\n }\r\n if (!facts.exists || !facts.isDirectory) {\r\n setError(t('error.pathNotFound'))\r\n return\r\n }\r\n const failure = await createWorkspace(path, user, distro)\r\n if (failure !== undefined) {\r\n setError(failure)\r\n return\r\n }\r\n setOpen(false)\r\n } finally {\r\n setBusy(false)\r\n }\r\n }\r\n\r\n const children = (listing?.entries.filter(entry => entry.kind === 'directory') ?? []).map(entry => entry.name)\r\n const maskClick = (): void => { if (!busy) setOpen(false) }\r\n const listScroll: UIEventHandler<HTMLDivElement> = () => { /* scroll container handles overflow */ }\r\n\r\n return (\r\n <div className=\"dww-overlay\">\r\n <div className=\"dww-overlay-mask\" onClick={maskClick} />\r\n <div className=\"dww-card\" role=\"dialog\" aria-modal=\"true\" aria-label={t('dialog.title')}>\r\n <div className=\"dww-header\">\r\n <h2 className=\"dww-title\">{t('dialog.title')}</h2>\r\n <button type=\"button\" className=\"dww-close\" aria-label={t('dialog.cancel')} onClick={maskClick}>\r\n ✕\r\n </button>\r\n </div>\r\n <div className=\"dww-body\">\r\n {error !== null ? (\r\n <div className=\"dww-error\">\r\n {error}\r\n <button type=\"button\" className=\"dww-retry\" onClick={() => setError(null)}>{t('dialog.retry')}</button>\r\n </div>\r\n ) : null}\r\n <div className=\"dww-field\">\r\n <label className=\"dww-field-label\" htmlFor=\"dww-distro\">{t('dialog.distro')}</label>\r\n <select\r\n id=\"dww-distro\"\r\n className=\"dww-select\"\r\n value={distro}\r\n disabled={opening || busy}\r\n onChange={event => onDistroChange(event.target.value)}\r\n >\r\n {distros.length === 0\r\n ? <option value=\"\">{opening ? t('dialog.loading') : ''}</option>\r\n : distros.map(name => <option key={name} value={name}>{name}</option>)}\r\n </select>\r\n </div>\r\n <div className=\"dww-field\">\r\n <label className=\"dww-field-label\" htmlFor=\"dww-path\">{t('dialog.path')}</label>\r\n <div className=\"dww-input-row\">\r\n <input\r\n id=\"dww-path\"\r\n className=\"dww-input\"\r\n value={pathInput}\r\n placeholder={t('dialog.pathPlaceholder')}\r\n disabled={opening || busy}\r\n onChange={event => setPathInput(event.target.value)}\r\n />\r\n <button type=\"button\" className=\"dww-check-btn\" disabled={opening || busy} onClick={() => void onCheck()}>\r\n {t('dialog.check')}\r\n </button>\r\n </div>\r\n </div>\r\n <div className=\"dww-field\">\r\n <label className=\"dww-field-label\" htmlFor=\"dww-username\">{t('dialog.username')}</label>\r\n <input\r\n id=\"dww-username\"\r\n className=\"dww-input\"\r\n value={username}\r\n placeholder={t('dialog.usernamePlaceholder')}\r\n disabled={opening || busy}\r\n autoComplete=\"off\"\r\n spellCheck={false}\r\n onChange={event => setUsername(event.target.value)}\r\n />\r\n </div>\r\n <div className=\"dww-feedback\">\r\n <div className=\"dww-breadcrumb\">{browsePath}</div>\r\n <div className=\"dww-dirlist\" onScroll={listScroll}>\r\n {browsing ? <div className=\"dww-dir-empty\">{t('dialog.loading')}</div> : (\r\n listing?.parent !== null && listing !== null\r\n ? (\r\n <button type=\"button\" className=\"dww-dir-row dww-dir-row--up\" onClick={onUp}>\r\n <WslGlyph size={14} />\r\n <span>{t('dialog.upLevel')}</span>\r\n </button>\r\n )\r\n : null\r\n )}\r\n {!browsing && (children.length === 0)\r\n ? <div className=\"dww-dir-empty\">{t('dialog.browseEmpty')}</div>\r\n : children.map(name => (\r\n <button type=\"button\" key={name} className=\"dww-dir-row\" onClick={() => onDrill(name)}>\r\n <WslGlyph size={14} />\r\n <span>{name}</span>\r\n </button>\r\n ))}\r\n </div>\r\n </div>\r\n </div>\r\n <div className=\"dww-actions\">\r\n <button type=\"button\" className=\"dww-btn\" disabled={busy} onClick={maskClick}>{t('dialog.cancel')}</button>\r\n <button type=\"button\" className=\"dww-btn dww-btn--primary\" disabled={busy || opening} onClick={() => void onConfirm()}>\r\n {busy ? t('dialog.loading') : t('dialog.confirm')}\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport type { ApiCall }\r\n","/**\n * Third-party stylesheet injection for the WSL workspace UI (the plugin\n * builds no CSS bundle, so styles are injected as one idempotent `<style>`).\n * Colors derive exclusively from the `--dsw-*` design tokens.\n */\n\nconst STYLE_TAG_DATA_ATTRIBUTE = 'data-plugin=\"dsh-wsl-workspace\"'\n\nconst STYLES = `\n/* Sidebar-foot icon action beside Settings (28px round in the wide sidebar,\n 36px round in the rail), matching the shell's icon-button language. */\n.dww-action {\n flex: none;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n border: none;\n border-radius: 50%;\n padding: 0;\n background: transparent;\n cursor: pointer;\n color: var(--dsw-alias-label-secondary);\n transition:\n background-color 120ms var(--dsw-ease-in-out, ease-in-out),\n color 120ms var(--dsw-ease-in-out, ease-in-out);\n}\n.dww-action:hover:not(:disabled) {\n background: var(--dsw-alias-interactive-bg-hover);\n color: var(--dsw-alias-label-secondary);\n}\n.dww-action:active:not(:disabled) {\n background: var(--dsw-alias-interactive-bg-pressed, var(--dsw-alias-interactive-bg-hover));\n}\n.dww-action:focus-visible {\n outline: 2px solid var(--dsw-alias-state-business-primary);\n outline-offset: 1px;\n}\n.dww-action:disabled { cursor: default; opacity: 0.6; }\n.dww-action--rail {\n width: 36px;\n height: 36px;\n color: var(--dsw-alias-label-primary);\n}\n.dww-action svg { flex: none; }\n\n/* The W letter mark of the sidebar action (sized for wide/rail buttons). */\n.dww-letter {\n font-size: 14px;\n font-weight: 600;\n line-height: 1;\n letter-spacing: 0.02em;\n user-select: none;\n}\n.dww-action--rail .dww-letter { font-size: 17px; }\n\n/* Full-viewport overlay + centered card (mirrors the platform Mask/Dialog). */\n.dww-overlay {\n position: fixed;\n inset: 0;\n z-index: 1000;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 24px;\n}\n.dww-overlay-mask {\n position: absolute;\n inset: 0;\n background: var(--dsw-alias-bg-mask-1);\n backdrop-filter: var(--dsw-mask-blur);\n}\n.dww-card {\n position: relative;\n z-index: 1;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n width: min(440px, 100%);\n max-height: min(640px, 90vh);\n padding: 0 0 20px;\n overflow: hidden;\n border: 1px solid var(--dsw-alias-border-inverted);\n border-radius: 16px;\n background: var(--dsw-alias-bg-layer-2);\n box-shadow: var(--dsw-shadow-lv3);\n font-family: var(--dsw-font-family);\n}\n.dww-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n padding: 18px 20px 12px;\n}\n.dww-title {\n margin: 0;\n font-size: 16px;\n line-height: 24px;\n font-weight: 500;\n color: var(--dsw-alias-label-primary);\n}\n.dww-close {\n flex: none;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n border: 0;\n border-radius: 8px;\n background: transparent;\n cursor: pointer;\n color: var(--dsw-alias-label-secondary);\n}\n.dww-close:hover { background: var(--dsw-alias-interactive-bg-hover); }\n.dww-body {\n display: flex;\n flex-direction: column;\n gap: 14px;\n min-width: 0;\n padding: 0 20px;\n overflow: auto;\n}\n.dww-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }\n.dww-field-label {\n font-size: 12px;\n line-height: 18px;\n color: var(--dsw-alias-label-secondary);\n}\n.dww-select {\n box-sizing: border-box;\n width: 100%;\n height: 36px;\n padding: 0 10px;\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 8px;\n background: var(--dsw-alias-bg-layer-3);\n color: var(--dsw-alias-label-primary);\n font-size: 14px;\n}\n.dww-input-row { display: flex; gap: 8px; align-items: center; }\n.dww-input {\n box-sizing: border-box;\n flex: 1;\n height: 36px;\n min-width: 0;\n padding: 0 10px;\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 8px;\n background: var(--dsw-alias-bg-layer-3);\n color: var(--dsw-alias-label-primary);\n font-size: 14px;\n}\n.dww-input:focus, .dww-select:focus {\n outline: none;\n border-color: var(--dsw-alias-state-business-primary);\n}\n.dww-check-btn {\n flex: none;\n height: 36px;\n padding: 0 12px;\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 8px;\n background: transparent;\n color: var(--dsw-alias-label-primary);\n cursor: pointer;\n font-size: 12px;\n}\n.dww-check-btn:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover); }\n.dww-check-btn:disabled { cursor: default; }\n\n/* Directory browse list. */\n.dww-dirlist {\n display: flex;\n flex-direction: column;\n gap: 2px;\n box-sizing: border-box;\n min-height: 120px;\n max-height: 200px;\n padding: 4px;\n overflow: auto;\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 8px;\n background: var(--dsw-alias-bg-layer-3);\n}\n.dww-breadcrumb {\n padding: 0 4px;\n font-size: 12px;\n line-height: 18px;\n color: var(--dsw-alias-label-tertiary);\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\n.dww-dir-row {\n display: flex;\n align-items: center;\n gap: 8px;\n height: 28px;\n padding: 0 8px;\n border: 0;\n border-radius: 6px;\n background: transparent;\n color: var(--dsw-alias-label-primary);\n cursor: pointer;\n font-size: 13px;\n text-align: left;\n}\n.dww-dir-row:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover); }\n.dww-dir-row:disabled { cursor: default; color: var(--dsw-alias-label-tertiary); }\n.dww-dir-row--up { color: var(--dsw-alias-label-secondary); }\n.dww-dir-row svg { flex: none; color: var(--dsw-alias-label-tertiary); }\n.dww-dir-empty {\n padding: 8px;\n font-size: 12px;\n line-height: 18px;\n color: var(--dsw-alias-label-tertiary);\n}\n\n/* Error strip. */\n.dww-error {\n box-sizing: border-box;\n width: 100%;\n padding: 8px 10px;\n border: 1px solid var(--dsw-alias-state-error-primary);\n border-radius: 8px;\n color: var(--dsw-alias-state-error-primary);\n font-size: 12px;\n line-height: 18px;\n}\n.dww-retry {\n margin-left: 6px;\n border: 0;\n background: transparent;\n color: var(--dsw-alias-state-business-primary);\n cursor: pointer;\n font-size: 12px;\n text-decoration: underline;\n}\n\n/* Dialog footer actions. */\n.dww-actions {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n gap: 8px;\n padding: 14px 20px 0;\n}\n.dww-btn {\n height: 36px;\n padding: 0 14px;\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 8px;\n background: transparent;\n color: var(--dsw-alias-label-primary);\n cursor: pointer;\n font-size: 14px;\n}\n.dww-btn:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover); }\n.dww-btn--primary {\n border-color: transparent;\n background: var(--dsw-alias-button-primary-fill);\n color: var(--dsw-alias-label-primary-foreground);\n}\n.dww-btn--primary:hover:not(:disabled) { background: var(--dsw-alias-button-primary-hover); }\n.dww-btn:disabled { cursor: default; opacity: 0.6; }\n`\n\n/**\n * Idempotently inject the plugin stylesheet. No-op when a tag with the\n * plugin's data attribute already exists.\n */\nexport function ensureStyles(): void {\n if (typeof document === 'undefined') return\n if (document.querySelector(`style[${STYLE_TAG_DATA_ATTRIBUTE}]`) !== null) return\n const style = document.createElement('style')\n style.setAttribute('data-plugin', 'dsh-wsl-workspace')\n style.textContent = STYLES\n document.head.appendChild(style)\n}\n","/**\n * Bilingual dictionaries for the `wslWorkspace` locale namespace. Product copy\n * is Chinese; English is the parallel export for the standalone bundle.\n */\n\n/**\n * The `wslWorkspace` translations (Chinese, the primary product copy).\n */\nexport const zh: Record<string, string> = {\n 'action.add': 'WSL 工作区',\n 'action.title': '添加 WSL 工作区…',\n\n 'dialog.title': '添加 WSL 工作区',\n 'dialog.distro': '发行版',\n 'dialog.path': '路径',\n 'dialog.pathPlaceholder': '/home/',\n 'dialog.username': '用户名',\n 'dialog.usernamePlaceholder': '留空则使用发行版默认用户',\n 'dialog.loading': '正在加载…',\n 'dialog.browseEmpty': '此目录没有子文件夹',\n 'dialog.upLevel': '..(返回上级)',\n 'dialog.browse': '浏览',\n 'dialog.check': '检查',\n 'dialog.confirm': '创建并打开',\n 'dialog.cancel': '取消',\n 'dialog.retry': '重试',\n\n 'error.loadDistros': '无法获取 WSL 发行版列表,请确认已安装 WSL 且插件宿主端可用',\n 'error.rateLimited': '操作过于频繁,请稍后重试',\n 'error.loadDir': '无法浏览该目录',\n 'error.presetMissing': '未找到健康的 wsl preset,请确认插件宿主端已安装并配置该 preset',\n 'error.invalidPath': '请输入以 / 开头的 Linux 绝对路径',\n 'error.invalidUsername': '用户名无效:需以字母或下划线开头,仅含字母、数字、_、.、-',\n 'error.pathNotFound': '该路径不存在或是文件,请选择一个文件夹',\n 'error.createFailed': '创建工作区失败',\n}\n\n/**\n * The `wslWorkspace` translations (English).\n */\nexport const en: Record<string, string> = {\n 'action.add': 'WSL Workspace',\n 'action.title': 'Add WSL workspace…',\n\n 'dialog.title': 'Add WSL workspace',\n 'dialog.distro': 'Distro',\n 'dialog.path': 'Path',\n 'dialog.pathPlaceholder': '/home/',\n 'dialog.username': 'Username',\n 'dialog.usernamePlaceholder': 'Leave empty to use the distro default user',\n 'dialog.loading': 'Loading…',\n 'dialog.browseEmpty': 'No subdirectories here',\n 'dialog.upLevel': '.. (up)',\n 'dialog.browse': 'Browse',\n 'dialog.check': 'Check',\n 'dialog.confirm': 'Create & open',\n 'dialog.cancel': 'Cancel',\n 'dialog.retry': 'Retry',\n\n 'error.loadDistros': 'Could not list WSL distros; confirm WSL is installed and the plugin host side is reachable',\n 'error.rateLimited': 'Too many attempts; retry in a moment',\n 'error.loadDir': 'Could not browse this directory',\n 'error.presetMissing': 'No healthy \"wsl\" preset found; confirm the plugin host side installed and configured it',\n 'error.invalidPath': 'Enter an absolute Linux path starting with /',\n 'error.invalidUsername': 'Invalid username: start with a letter or underscore; only letters, digits, _ . -',\n 'error.pathNotFound': 'The path does not exist or is a file; choose a folder',\n 'error.createFailed': 'Failed to create the workspace',\n}\n","/**\r\n * Browser half of dsh-wsl-workspace. Registers the \"Add WSL workspace…\"\r\n * action beside Settings at the sidebar foot (the official\r\n * `sidebar.footer.action` slot), and keeps every blank session whose\r\n * workspace is a WSL UNC path composed from the WSL VARIANT of the mode it\r\n * currently runs (`standard` → `wsl-standard`, PTC → `wsl-code`, …) — so the\r\n * WSL execution world composes with any mode instead of being a mode itself.\r\n *\r\n * The binding is a watching effect rather than a one-shot dialog action so\r\n * EVERY creation path (this dialog, the workspace row's New Session, the\r\n * hero picker) converges on the WSL-backed composition automatically.\r\n */\r\n\r\nimport type { ConnectionHandle } from '@deepseek-ai/dsh-api-remotes/client'\r\n// Type-only: pulls the locale plugin's Context merge (ctx.locale), the\r\n// runtime's ClientContext, and the ui-sidebar SlotMap merge (the\r\n// 'sidebar.footer.action' entry) into this program.\r\nimport type {} from '@deepseek-ai/dsh-client-locale/client'\r\nimport type {} from '@deepseek-ai/dsh-client-ui-sidebar/client'\r\nimport type { ClientContext } from '@deepseek-ai/dsh-client-runtime/client'\r\nimport { check as checkApi, listDir as listDirApi, listDistros as listDistrosApi, listWorkspaces as listWorkspacesApi, registerWindows as registerWindowsApi, setWorkspaceUser as setWorkspaceUserApi } from './api.ts'\r\nimport { AddWslWorkspace, type AddWslWorkspaceInjected } from './AddWslWorkspace.tsx'\r\nimport { ensureStyles } from './styles.ts'\r\nimport { zh, en } from './locales.ts'\r\nimport { canonicalWindowsPath, isWslUnc, joinUnc, mntToWindowsPath } from '../shared/paths.ts'\r\n\r\n/** Required services (cordis fiber inject). */\r\nexport const inject = ['slots', 'locale', 'connection', 'sessions', 'workspaces']\r\n\r\n/** The legacy standalone WSL preset id (folded into the mode variants). */\r\nconst LEGACY_WSL_PRESET_ID = 'wsl'\r\n\r\n/**\r\n * Minimal sessions-service face. The renderer-host ctx merge types\r\n * `ctx.sessions` as its own SessionStore; the service the runtime actually\r\n * registers under that key satisfies this narrower contract, so the cast is\r\n * the documented boundary for a third-party plugin.\r\n */\r\ninterface WslSessionsFace {\r\n list: {\r\n getSnapshot(): { ids: string[]; byId: Record<string, { blank: boolean; cwd?: string; agentPreset?: string }> }\r\n subscribe(fn: () => void): () => void\r\n }\r\n noteAgentPreset(sessionId: string, agentPreset: string): void\r\n}\r\n\r\n/** Minimal workspaces-service face (create + start-session only). */\r\ninterface WslWorkspacesFace {\r\n create(input: { path: string }): Promise<{ workspaceId: string }>\r\n startSession(workspaceId?: string): void\r\n}\r\n\r\n/**\r\n * Mount the sidebar action and the auto-binding effect.\r\n * @param ctx - the browser plugin context.\r\n */\r\nexport function apply(ctx: ClientContext): void {\r\n const { api } = ctx.get('connection') as ConnectionHandle\r\n const workspaces = ctx.get('workspaces') as unknown as WslWorkspacesFace\r\n const sessions = ctx.get('sessions') as unknown as WslSessionsFace\r\n\r\n ensureStyles()\r\n\r\n ctx.effect(\r\n () => ctx.locale.register('wslWorkspace' as never, { zh, en }),\r\n 'dsh-wsl-workspace: locale dictionaries',\r\n )\r\n\r\n // The injected translate function reads the live DeepSeek Harness locale,\r\n // so the dialog copy follows the app language setting automatically.\r\n const t = ctx.locale.bind('wslWorkspace' as never) as unknown as (key: string, params?: Record<string, unknown>) => string\r\n\r\n // Canonical Windows drive keys of every registered `/mnt/<drive>` workspace\r\n // (refreshed from the host store; see refreshRoster). A blank session whose\r\n // cwd is one of these binds to the WSL variant like a UNC-cwd session.\r\n let wslWindowsPaths = new Set<string>()\r\n\r\n const injected = (): AddWslWorkspaceInjected => ({\r\n t,\r\n checkPreset: async (): Promise<string | undefined> => {\r\n let roster\r\n try {\r\n const response = await api.agentPresets.list({})\r\n roster = response.result\r\n } catch (error) {\r\n return error instanceof Error ? error.message : String(error)\r\n }\r\n if (!roster.ok) return roster.error.message\r\n const healthy = roster.value.presets.find((entry: { id: string; broken?: string }) =>\r\n entry.id.startsWith('wsl-') && entry.broken === undefined)\r\n if (healthy === undefined) return t('error.presetMissing')\r\n return undefined\r\n },\r\n listDistros: () => listDistrosApi(),\r\n listDir: (distro, path) => listDirApi(distro, path),\r\n check: (distro, path) => checkApi(distro, path),\r\n createWorkspace: async (linuxPath, username, distro): Promise<string | undefined> => {\r\n try {\r\n const winPath = mntToWindowsPath(linuxPath)\r\n if (winPath !== null) {\r\n // `/mnt/<drive>` workspace: the workspace registry realpath/stats\r\n // the path and 9P cannot serve drvfs mounts, so register under the\r\n // drive spelling and store distro/username for the session env.\r\n // The browser binding below recognizes the drive cwd as WSL.\r\n const view = await workspaces.create({ path: winPath })\r\n await registerWindowsApi(linuxPath, distro, username)\r\n const canonical = canonicalWindowsPath(winPath)\r\n if (canonical !== null) wslWindowsPaths = new Set(wslWindowsPaths).add(canonical)\r\n workspaces.startSession(view.workspaceId)\r\n return undefined\r\n }\r\n const uncPath = joinUnc(distro, linuxPath)\r\n const view = await workspaces.create({ path: uncPath })\r\n await setWorkspaceUserApi(uncPath, username)\r\n workspaces.startSession(view.workspaceId)\r\n return undefined\r\n } catch (error) {\r\n return error instanceof Error ? error.message : String(error)\r\n }\r\n },\r\n })\r\n\r\n ctx.effect(\r\n () => ctx.slots.inject(\r\n 'sidebar.footer.action',\r\n () => ctx.slots.register(\r\n { name: 'sidebar.footer.action', id: 'wsl-workspace', inject: injected },\r\n AddWslWorkspace,\r\n ),\r\n ),\r\n 'dsh-wsl-workspace: sidebar footer action',\r\n )\r\n\r\n // Mode-variant binding: a blank session whose workspace is a WSL UNC path\r\n // is recomposed to the WSL variant of the mode it currently runs — plain\r\n // 标准 becomes `wsl-standard`, PTC becomes `wsl-code`, and so on — so the\r\n // WSL execution world composes with ANY mode instead of replacing it. The\r\n // host refuses non-blank sessions (agent-preset-locked), so the swap is\r\n // attempted at most a few times per session.\r\n ctx.effect(() => {\r\n const inFlight = new Set<string>()\r\n const attempts = new Map<string, number>()\r\n const MAX_ATTEMPTS = 3\r\n // Healthy `wsl-<mode>` variant ids plus the roster's default preset id\r\n // (what a session with no explicit choice gets). Refreshed periodically\r\n // so variants generated after this page loaded are picked up.\r\n let variants = new Set<string>()\r\n let defaultPreset: string | undefined\r\n const refreshRoster = (): void => {\r\n void api.agentPresets.list({}).then((response: {\r\n result: { ok: boolean; value: { presets: { id: string; broken?: string; isDefault?: boolean }[] } }\r\n }) => {\r\n const result = response.result\r\n if (!result.ok) return\r\n variants = new Set(result.value.presets\r\n .filter((entry: { id: string; broken?: string }) =>\r\n entry.broken === undefined && entry.id.startsWith('wsl-'))\r\n .map((entry: { id: string }) => entry.id))\r\n defaultPreset = result.value.presets.find(\r\n (entry: { id: string; isDefault?: boolean }) => entry.isDefault === true,\r\n )?.id\r\n }).catch(() => {\r\n // A failed roster read leaves the previous mapping; sessions stay on\r\n // their current composition until the next refresh.\r\n })\r\n }\r\n refreshRoster()\r\n const refreshWorkspaces = (): void => {\r\n void listWorkspacesApi().then((keys: string[]) => {\r\n const next = new Set<string>()\r\n for (const key of keys) {\r\n const canonical = canonicalWindowsPath(key)\r\n if (canonical !== null) next.add(canonical)\r\n }\r\n wslWindowsPaths = next\r\n }).catch(() => {\r\n // A failed store read leaves the previous set; sessions stay on\r\n // their current composition until the next refresh.\r\n })\r\n }\r\n refreshWorkspaces()\r\n const maybeBind = (): void => {\r\n const state = sessions.list.getSnapshot()\r\n for (const id of state.ids) {\r\n const summary = state.byId[id]\r\n if (summary === undefined || !summary.blank || summary.cwd === undefined) continue\r\n // A session belongs to the WSL world when its cwd is a WSL UNC path,\r\n // or a Windows drive path registered as a `/mnt/<drive>` workspace\r\n // (9P cannot serve drvfs, so those workspaces carry drive cwds).\r\n const canonical = canonicalWindowsPath(summary.cwd)\r\n const isWsl = isWslUnc(summary.cwd)\r\n || (canonical !== null && wslWindowsPaths.has(canonical))\r\n if (!isWsl) continue\r\n const current = summary.agentPreset\r\n if (current !== undefined && current.startsWith('wsl-')) continue\r\n // Legacy standalone `wsl` (now folded into the variants): remap it to\r\n // the default mode's variant, since the standalone preset no longer\r\n // exists in the roster.\r\n const base = current === LEGACY_WSL_PRESET_ID\r\n ? (defaultPreset ?? 'standard')\r\n : (current ?? defaultPreset)\r\n if (base === undefined || base === LEGACY_WSL_PRESET_ID || base.startsWith('wsl-')) continue\r\n const target = `wsl-${base.toLowerCase()}`\r\n if (!variants.has(target)) continue\r\n if (inFlight.has(id) || (attempts.get(id) ?? 0) >= MAX_ATTEMPTS) continue\r\n inFlight.add(id)\r\n void api.agentPresets.select({ sessionId: id, agentPreset: target })\r\n .then((response: { result: { ok: boolean } }) => {\r\n if (response.result.ok) sessions.noteAgentPreset(id, target)\r\n })\r\n .catch(() => {\r\n // A refused or aborted swap (session already produced output,\r\n // roster churn, reconnect) leaves the session on its current\r\n // composition; count the attempt so a stuck session stops\r\n // retrying after MAX_ATTEMPTS.\r\n attempts.set(id, (attempts.get(id) ?? 0) + 1)\r\n })\r\n .finally(() => {\r\n inFlight.delete(id)\r\n })\r\n }\r\n }\r\n maybeBind()\r\n const unsubscribe = sessions.list.subscribe(() => maybeBind())\r\n // Variants are generated at host boot; a page loaded before that would\r\n // never see them without a periodic refresh.\r\n const timer = window.setInterval(refreshRoster, 60_000)\r\n return () => {\r\n unsubscribe()\r\n window.clearInterval(timer)\r\n }\r\n }, 'dsh-wsl-workspace: WSL mode-variant binding')\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;EAOA,MAAM,WAAW;;EA4BjB,SAAS,aAAa,OAAwB;GAC5C,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;EAC9D;;;;;;;EAQA,eAAe,KAAQ,QAAgB,SAAkC,CAAC,GAAe;GACvF,IAAI;GACJ,IAAI;IACF,WAAW,MAAM,MAAM,UAAU;KAC/B,QAAQ;KACR,SAAS,EAAE,gBAAgB,mBAAmB;KAC9C,MAAM,KAAK,UAAU;MAAE;MAAQ;KAAO,CAAC;IACzC,CAAC;GACH,SAAS,OAAO;IAEd,MAAM,IAAI,MAAM,iCAAiC,aAAa,KAAK,GAAG;GACxE;GACA,IAAI;GACJ,IAAI;IACF,WAAY,MAAM,SAAS,KAAK;GAClC,QAAQ;IAEN,MAAM,IAAI,MAAM,oCAAoC,SAAS,OAAO,EAAE;GACxE;GACA,IAAI,CAAC,SAAS,IAAI,MAAM,IAAI,MAAM,SAAS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: Response","envelope: Envelope<T>","listDir","presetIssue: string | undefined","names: string[]","listDistros","facts: WslPathCheck","check","listScroll: UIEventHandler<HTMLDivElement>","zh: Record<string, string>","en: Record<string, string>","listDistrosApi","listDirApi","checkApi","view","registerWindowsApi","setWorkspaceUserApi","defaultPreset: string | undefined","listWorkspacesApi"],"sources":["../src/client/api.ts","../src/shared/paths.ts","../src/client/AddWslWorkspace.tsx","../src/client/styles.ts","../src/client/locales.ts","../src/client/index.ts"],"sourcesContent":["/**\r\n * Thin fetch client for the Host plugin route. The browser calls\r\n * POST /wsl-workspace/api with a `{ method, params }` envelope and the Host\r\n * answers `{ ok: true, value }` or `{ ok: false, error }`.\r\n */\r\n\r\n/** Relative route the Host half registers (same-origin with the web server). */\r\nconst ENDPOINT = '/wsl-workspace/api'\r\n\r\n/** One directory entry as the Host lists it. */\r\nexport interface WslDirEntry {\r\n name: string\r\n kind: 'directory' | 'file' | 'other'\r\n}\r\n\r\n/** One directory level plus its breadcrumb ancestry. */\r\nexport interface WslDirListing {\r\n /** The listed absolute Linux path. */\r\n path: string\r\n /** Parent Linux path, or null at the filesystem root. */\r\n parent: string | null\r\n /** The level's children (in name order; the client filters to directories). */\r\n entries: WslDirEntry[]\r\n}\r\n\r\n/** Existence/directory check result for one Linux path. */\r\nexport interface WslPathCheck {\r\n exists: boolean\r\n isDirectory: boolean\r\n}\r\n\r\n/** Wire envelope the Host route answers with. */\r\ntype Envelope<T> = { ok: true; value: T } | { ok: false; error: string }\r\n\r\n/** Human text for an unknown rejection, reusing the repository's idiom. */\r\nfunction errorMessage(value: unknown): string {\r\n return value instanceof Error ? value.message : String(value)\r\n}\r\n\r\n/**\r\n * Perform one POST call and unwrap the envelope.\r\n * @param method - the Host method name.\r\n * @param params - the method payload.\r\n * @returns the unwrapped value, or throws an Error on network or `ok:false`.\r\n */\r\nasync function call<T>(method: string, params: Record<string, unknown> = {}): Promise<T> {\r\n let response: Response\r\n try {\r\n response = await fetch(ENDPOINT, {\r\n method: 'POST',\r\n headers: { 'content-type': 'application/json' },\r\n body: JSON.stringify({ method, params }),\r\n })\r\n } catch (error) {\r\n // The transport refused before answering (offline, origin mismatch, 404).\r\n throw new Error(`wsl-workspace request failed: ${errorMessage(error)}`)\r\n }\r\n let envelope: Envelope<T>\r\n try {\r\n envelope = (await response.json()) as Envelope<T>\r\n } catch {\r\n // A non-JSON body means a proxy/loader answered instead of the Host route.\r\n throw new Error(`wsl-workspace answered non-JSON (${response.status})`)\r\n }\r\n if (!envelope.ok) throw new Error(envelope.error)\r\n return envelope.value\r\n}\r\n\r\n/**\r\n * List the WSL distros installed on the host.\r\n * @returns distro names in registry order.\r\n */\r\nexport async function listDistros(): Promise<string[]> {\r\n return call<string[]>('listDistros', {})\r\n}\r\n\r\n/**\r\n * List one directory level inside a distro.\r\n * @param distro - distro name.\r\n * @param path - absolute Linux directory to list.\r\n * @returns the level's listing with ancestry.\r\n */\r\nexport async function listDir(distro: string, path: string): Promise<WslDirListing> {\r\n return call<WslDirListing>('listDir', { distro, path })\r\n}\r\n\r\n/**\r\n * Check whether a Linux path exists and is a directory.\r\n * @param distro - distro name.\r\n * @param path - absolute Linux path.\r\n * @returns existence and directory facts.\r\n */\r\nexport async function check(distro: string, path: string): Promise<WslPathCheck> {\r\n return call<WslPathCheck>('check', { distro, path })\r\n}\r\n\r\n/**\r\n * Store (or clear, with an empty string) the username of one WSL workspace.\r\n * @param path - the workspace UNC path.\r\n * @param username - the Linux username; empty string clears the stored value.\r\n */\r\nexport async function setWorkspaceUser(path: string, username: string): Promise<void> {\r\n return call<void>('setUser', { path, username })\r\n}\r\n\r\n/**\r\n * Register a `/mnt/<drive>` WSL workspace under its Windows drive path,\r\n * recording the distro (and optional username) for the session env.\r\n * @param linuxPath - the `/mnt/<drive>/…` Linux path.\r\n * @param distro - the WSL distribution the workspace belongs to.\r\n * @param username - optional Linux username.\r\n */\r\nexport async function registerWindows(linuxPath: string, distro: string, username: string): Promise<void> {\r\n return call<void>('registerWindows', { linuxPath, distro, username })\r\n}\r\n\r\n/**\r\n * List every registered WSL workspace key (canonical UNC and Windows drive\r\n * spellings). The client uses the drive keys to recognize `/mnt` workspaces\r\n * across page reloads.\r\n */\r\nexport async function listWorkspaces(): Promise<string[]> {\r\n return call<string[]>('listWorkspaces', {})\r\n}\r\n","/**\r\n * WSL path helpers shared by the client and host halves. Pure and\r\n * dependency-free so both planes can import them without a runtime edge.\r\n */\r\n\r\n/** WSL2 default loopback bridge host: `\\\\wsl.localhost\\<distro>\\...`. */\r\nconst WSL_LOCALHOST_HOST = 'wsl.localhost'\r\n/** Legacy WSL interop host: `\\\\wsl$\\<distro>\\...`. */\r\nconst WSL_LEGACY_HOST = 'wsl$'\r\n\r\n/** The two UNC hosts WSL exposes a distribution's filesystem under. */\r\nconst UNC_HOSTS = [WSL_LOCALHOST_HOST, WSL_LEGACY_HOST]\r\n\r\n/** One WSL workspace coordinate parsed out of a UNC path. */\r\nexport interface WslUncTarget {\r\n /** Distro name (e.g. `Ubuntu`) as `wsl -l -q` reports it. */\r\n readonly distro: string\r\n /** Normalized absolute Linux path (leading `/`; no trailing slash except root). */\r\n readonly linuxPath: string\r\n}\r\n\r\n/**\r\n * Parse a WSL UNC path into its distro and Linux path. Accepts the WSL2\r\n * `\\\\wsl.localhost\\<distro>\\<linux>` form, the legacy `\\\\wsl$\\<distro>\\<linux>`\r\n * interop form, and forward-slash spellings of either.\r\n * @param raw - candidate absolute path.\r\n * @returns the parsed target, or null when the path is not a WSL UNC.\r\n */\r\nexport function parseWslUnc(raw: string): WslUncTarget | null {\r\n const normalized = raw.replace(/\\\\/g, '/').replace(/\\/\\/+/g, '//')\r\n if (!normalized.startsWith('//')) return null\r\n const segments = normalized.slice(2).split('/')\r\n const host = (segments[0] ?? '').toLowerCase()\r\n if (!UNC_HOSTS.includes(host)) return null\r\n const distro = segments[1] ?? ''\r\n if (distro === '') return null\r\n const rest = segments.slice(2).filter(segment => segment.length > 0)\r\n return { distro, linuxPath: `/${rest.join('/')}` }\r\n}\r\n\r\n/**\r\n * Whether a path resolves into a WSL distro through either UNC form.\r\n * @param raw - candidate absolute path.\r\n * @returns whether the path parses as a WSL UNC.\r\n */\r\nexport function isWslUnc(raw: string): boolean {\r\n return parseWslUnc(raw) !== null\r\n}\r\n\r\n/**\r\n * Translate a WSL UNC path to the absolute Linux path a process inside the\r\n * distribution can open. Throws on non-WSL input: callers rely on this\r\n * conversion to hand paths to the Linux world, so a silent pass-through\r\n * would hand a Windows path to bash.\r\n * @param uncPath - a path {@link parseWslUnc} accepts.\r\n * @returns the absolute Linux path.\r\n */\r\nexport function uncToLinux(uncPath: string): string {\r\n const parts = parseWslUnc(uncPath)\r\n if (parts === null) {\r\n throw new Error(`wsl-workspace: \"${uncPath}\" is not a WSL UNC path`)\r\n }\r\n return parts.linuxPath\r\n}\r\n\r\n/**\r\n * Normalize a Linux absolute path for the Host: collapse repeated slashes and\r\n * strip a trailing slash (root becomes `/`).\r\n * @param path - absolute Linux path.\r\n * @returns the normalized path.\r\n */\r\nexport function normalizeLinuxPath(path: string): string {\r\n const collapsed = path.replace(/\\/+/g, '/')\r\n return collapsed === '/' ? '/' : collapsed.replace(/\\/$/, '')\r\n}\r\n\r\n/**\r\n * Whether a path is an absolute, non-empty Linux path.\r\n * @param path - candidate.\r\n * @returns whether it starts with `/` and contains no NUL.\r\n */\r\nexport function isAbsoluteLinuxPath(path: string): boolean {\r\n return path.startsWith('/') && !path.includes('\\0')\r\n}\r\n\r\n/**\r\n * Join a distro and a Linux absolute path into the WSL2 UNC form used as the\r\n * workspace identity (`\\\\wsl.localhost\\<distro>\\<linux>`, backslash segments).\r\n * @param distro - distro name.\r\n * @param linuxPath - absolute Linux path (leading `/`).\r\n * @returns the UNC path.\r\n */\r\nexport function joinUnc(distro: string, linuxPath: string): string {\r\n if (!isAbsoluteLinuxPath(linuxPath)) {\r\n throw new Error(`wsl-workspace: cannot map a non-absolute Linux path \"${linuxPath}\" to UNC`)\r\n }\r\n // Defense in depth: a distribution name with separators or dot-dirs would\r\n // escape the `\\\\wsl.localhost\\` share structure (the host route validates\r\n // wire-supplied names too; every other caller passes through here).\r\n if (distro === '' || distro === '.' || distro === '..' || /[\\\\/]/.test(distro)) {\r\n throw new Error(`wsl-workspace: invalid distribution name \"${distro}\"`)\r\n }\r\n const normalized = linuxPath.replace(/\\/+/g, '/').replace(/\\/$/, '')\r\n const withoutLeading = normalized.startsWith('/') ? normalized.slice(1) : normalized\r\n const windowsSegments = withoutLeading.replace(/\\//g, '\\\\')\r\n const suffix = windowsSegments === '' ? '' : `\\\\${windowsSegments}`\r\n return `\\\\\\\\wsl.localhost\\\\${distro}${suffix}`\r\n}\r\n\r\n/**\r\n * Translate a Windows drive path to the drvfs mount path WSL distributions\r\n * conventionally expose it at (`C:\\foo` → `/mnt/c/foo`). Only single-letter\r\n * drives under `/mnt` are mapped; custom mount points are out of scope.\r\n * @param path - the candidate Windows path.\r\n * @returns the `/mnt/<drive>/…` path, or `null` for non-drive paths.\r\n */\r\nexport function windowsToMntPath(path: string): string | null {\r\n const match = /^([A-Za-z]):[\\\\/](.*)$/.exec(path)\r\n if (match === null) return null\r\n const rest = (match[2] ?? '').replace(/\\\\/g, '/').replace(/\\/+/g, '/').replace(/\\/$/, '')\r\n return `/mnt/${(match[1] ?? '').toLowerCase()}${rest === '' ? '' : `/${rest}`}`\r\n}\r\n\r\n/**\r\n * Translate a `/mnt/<drive>/…` path back to its Windows drive path.\r\n * @param linuxPath - the candidate Linux path.\r\n * @returns the `X:\\…` drive path, or `null` when the path is not a drvfs mount.\r\n */\r\nexport function mntToWindowsPath(linuxPath: string): string | null {\r\n const match = /^\\/mnt\\/([a-zA-Z])(?:\\/(.*))?$/.exec(linuxPath)\r\n if (match === null) return null\r\n const rest = (match[2] ?? '').replace(/\\//g, '\\\\')\r\n return `${(match[1] ?? '').toUpperCase()}:\\\\${rest}`\r\n}\r\n\r\n/**\r\n * Canonical Windows drive path for store keys and cross-realm identity:\r\n * separators unified to `\\`, trailing separator stripped, and the WHOLE path\r\n * lowercased — Windows paths compare case-insensitively, and the workspace\r\n * registry may realpath a different casing than the caller spelled (8.3 or\r\n * on-disk casing), so the store key must collide across casings.\r\n * @param path - candidate Windows drive path.\r\n * @returns the canonical form, or `null` when not drive-shaped.\r\n */\r\nexport function canonicalWindowsPath(path: string): string | null {\r\n const match = /^([A-Za-z]):[\\\\/](.*)$/.exec(path)\r\n if (match === null) return null\r\n const rest = (match[2] ?? '').replace(/[\\\\/]+/g, '\\\\').replace(/\\\\$/, '').toLowerCase()\r\n return `${(match[1] ?? '').toLowerCase()}:\\\\${rest}`\r\n}\r\n\r\n/**\r\n * True when a value is a Windows-shaped path (drive or UNC), which is how\r\n * the shell executor decides the WSLENV `/p` translation flag: only Windows\r\n * path values need translation when they cross into the Linux process.\r\n * @param value - the environment value to classify.\r\n * @returns whether the value looks like a Windows path.\r\n */\r\nexport function isWindowsPathShaped(value: string): boolean {\r\n return /^[A-Za-z]:[\\\\/]/.test(value) || value.startsWith('\\\\\\\\')\r\n}\r\n\r\n/** Linux username shape for `wsl.exe -u`: starts with a letter or underscore, then letters/digits/`_`/`.`/`-` (max 64). */\r\nconst WSL_USERNAME_PATTERN = /^[A-Za-z_][A-Za-z0-9_.-]{0,63}$/\r\n\r\n/**\r\n * Whether a value is a safe Linux username for `wsl.exe -u`. The check is\r\n * strict on purpose: a value starting with `-` could be parsed as a wsl.exe\r\n * option instead of a username.\r\n * @param value - candidate username.\r\n * @returns whether it matches the Linux username shape.\r\n */\r\nexport function isValidWslUsername(value: string): boolean {\r\n return WSL_USERNAME_PATTERN.test(value)\r\n}\r\n","/**\r\n * Sidebar footer action that opens the \"Add WSL workspace\" dialog. In the\r\n * wide sidebar it renders a labeled row; in the 56px rail it collapses to a\r\n * 36px icon button (both honor the shell's `{ wide }` owner share).\r\n *\r\n * Registration omits the typed `locale:` seat (the `wslWorkspace` namespace is\r\n * not merged into `LocaleNamespaceMap`), so the injected face carries the\r\n * bound translate function instead.\r\n */\r\n\r\nimport type * as React from 'react'\r\nimport { useEffect, useRef, useState, type UIEventHandler } from 'react'\r\nimport { isAbsoluteLinuxPath, isValidWslUsername, normalizeLinuxPath } from '../shared/paths.ts'\r\nimport type { WslDirListing, WslPathCheck } from './api.ts'\r\n\r\n/** Result-level shape of a browse/check/list call we surface uniformly. */\r\ninterface ApiCall<T> {\r\n value: T\r\n}\r\n\r\n/** The inject face: plain data + callbacks the dialog drives. */\r\nexport interface AddWslWorkspaceInjected {\r\n /**\r\n * Confirm the deployment exposes a healthy `wsl` preset.\r\n * @returns undefined when healthy, else a Chinese/English message to show.\r\n */\r\n checkPreset(): Promise<string | undefined>\r\n /** List the WSL distros installed on the host. */\r\n listDistros(): Promise<string[]>\r\n /** List one Linux directory level inside a distro. */\r\n listDir(distro: string, path: string): Promise<WslDirListing>\r\n /** Check a Linux path's existence/directory facts. */\r\n check(distro: string, path: string): Promise<WslPathCheck>\r\n /**\r\n * Register a WSL workspace and start a session in it. `/mnt/<drive>`\r\n * paths register under their Windows drive spelling (9P cannot serve\r\n * drvfs); ext4 paths register as `\\\\wsl.localhost\\<distro>\\...` UNC.\r\n * @param linuxPath - the absolute Linux workspace path.\r\n * @param username - optional Linux user for the session (empty = distro default).\r\n * @param distro - the WSL distribution the path belongs to.\r\n * @returns undefined on success, else a message to show.\r\n */\r\n createWorkspace(linuxPath: string, username: string, distro: string): Promise<string | undefined>\r\n /** Translate a `wslWorkspace` dictionary key (follows the DeepSeek Harness locale). */\r\n t: (key: string, params?: Record<string, unknown>) => string\r\n}\r\n\r\n/** Full component props: the owner share plus the injected face. */\r\nexport interface AddWslWorkspaceProps extends AddWslWorkspaceInjected {\r\n /** Whether the sidebar renders wide content (false = 56px rail). */\r\n wide: boolean\r\n}\r\n\r\n/**\r\n * Build the Linux child path one level below a parent, for the breadcrumb/\r\n * browse drill.\r\n * @param parent - the currently listed absolute path (`/` for root).\r\n * @param name - the child directory name.\r\n * @returns the child's absolute Linux path.\r\n */\r\nexport function dirChildPath(parent: string, name: string): string {\r\n return parent === '/' ? `/${name}` : `${parent}/${name}`\r\n}\r\n\r\n/** A tiny inline terminal glyph for the dialog's directory rows. */\r\nfunction WslGlyph({ size = 16 }: { size?: number }): React.ReactElement {\r\n return (\r\n <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\r\n <rect x=\"2.5\" y=\"4.5\" width=\"19\" height=\"15\" rx=\"2.5\" stroke=\"currentColor\" strokeWidth=\"1.6\" />\r\n <path d=\"M6 9l3.2 2.6L6 14\" stroke=\"currentColor\" strokeWidth=\"1.6\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\r\n <path d=\"M12 14h5\" stroke=\"currentColor\" strokeWidth=\"1.6\" strokeLinecap=\"round\" />\r\n </svg>\r\n )\r\n}\r\n\r\n/**\r\n * The \"Add WSL workspace…\" footer action and its dialog.\r\n * @param props - owner share + injected face.\r\n */\r\nexport function AddWslWorkspace({ wide, t, checkPreset, listDistros, listDir, check, createWorkspace }: AddWslWorkspaceProps): React.ReactElement | null {\r\n const [open, setOpen] = useState(false)\r\n const [opening, setOpening] = useState(false)\r\n const [distros, setDistros] = useState<string[]>([])\r\n const [distro, setDistro] = useState('')\r\n const [pathInput, setPathInput] = useState('/home/')\r\n const [username, setUsername] = useState('')\r\n const [listing, setListing] = useState<WslDirListing | null>(null)\r\n const [browsePath, setBrowsePath] = useState('/')\r\n const [browsing, setBrowsing] = useState(false)\r\n const [error, setError] = useState<string | null>(null)\r\n const [busy, setBusy] = useState(false)\r\n // Monotone browse-request sequence: stale responses for a superseded browse are dropped.\r\n const browseSeq = useRef(0)\r\n\r\n const refreshBrowse = async (root: string, targetDistro: string): Promise<void> => {\r\n const seq = ++browseSeq.current\r\n setBrowsing(true)\r\n setBrowsePath(root)\r\n try {\r\n const value = await listDir(targetDistro, root)\r\n if (seq === browseSeq.current) setListing(value)\r\n } catch {\r\n // A failed browse (permission, missing dir) is non-fatal: keep old listing.\r\n if (seq === browseSeq.current) {\r\n setListing(null)\r\n setError((previous) => previous ?? t('error.loadDir'))\r\n }\r\n } finally {\r\n if (seq === browseSeq.current) setBrowsing(false)\r\n }\r\n }\r\n\r\n useEffect(() => {\r\n if (!open) return\r\n let cancelled = false\r\n setError(null)\r\n setOpening(true)\r\n void (async () => {\r\n let presetIssue: string | undefined\r\n try {\r\n presetIssue = await checkPreset()\r\n } catch {\r\n presetIssue = t('error.loadDistros')\r\n }\r\n let names: string[]\r\n try {\r\n names = await listDistros()\r\n } catch {\r\n if (cancelled) return\r\n setOpening(false)\r\n setError(t('error.loadDistros'))\r\n return\r\n }\r\n if (cancelled) return\r\n setDistros(names)\r\n const first = names[0] ?? ''\r\n setDistro(first)\r\n // The default browse root walks from `/`; the input defaults to `/home/`.\r\n setBrowsing(true)\r\n setOpening(false)\r\n if (presetIssue !== undefined) setError(presetIssue)\r\n if (first !== '') void refreshBrowse('/', first)\r\n })()\r\n return () => { cancelled = true }\r\n // eslint-disable-next-line react-hooks/exhaustive-deps -- run once per open against current t.\r\n }, [open])\r\n\r\n useEffect(() => {\r\n if (!open) return\r\n const onKey = (event: KeyboardEvent): void => {\r\n if (event.key === 'Escape' && !busy) setOpen(false)\r\n }\r\n window.addEventListener('keydown', onKey)\r\n return () => window.removeEventListener('keydown', onKey)\r\n }, [open, busy])\r\n\r\n if (!open) {\r\n // A W-letter action beside Settings at the sidebar foot; the title\r\n // carries the label in both wide and rail states.\r\n return (\r\n <button\r\n type=\"button\"\r\n className={wide ? 'dww-action dww-action--wide' : 'dww-action dww-action--rail'}\r\n title={t('action.title')}\r\n aria-label={t('action.title')}\r\n onClick={() => setOpen(true)}\r\n >\r\n <span className=\"dww-letter\" aria-hidden=\"true\">W</span>\r\n </button>\r\n )\r\n }\r\n\r\n const onDrill = (name: string): void => {\r\n const next = dirChildPath(listing?.path ?? browsePath, name)\r\n setPathInput(next)\r\n void refreshBrowse(next, distro)\r\n }\r\n\r\n const onUp = (): void => {\r\n const parent = listing?.parent ?? null\r\n if (parent === null) return\r\n setPathInput(parent)\r\n void refreshBrowse(parent, distro)\r\n }\r\n\r\n const onDistroChange = (value: string): void => {\r\n setDistro(value)\r\n void refreshBrowse(browsePath, value)\r\n }\r\n\r\n const onCheck = async (): Promise<void> => {\r\n const path = normalizeLinuxPath(pathInput)\r\n setError(null)\r\n if (!isAbsoluteLinuxPath(path) || path === '/') {\r\n setError(t('error.invalidPath'))\r\n return\r\n }\r\n let facts: WslPathCheck\r\n try {\r\n facts = await check(distro, path)\r\n } catch {\r\n setError(t('error.pathNotFound'))\r\n return\r\n }\r\n if (!facts.exists || !facts.isDirectory) {\r\n setError(t('error.pathNotFound'))\r\n return\r\n }\r\n void refreshBrowse(path, distro)\r\n }\r\n\r\n const onConfirm = async (): Promise<void> => {\r\n const path = normalizeLinuxPath(pathInput)\r\n setError(null)\r\n if (!isAbsoluteLinuxPath(path) || path === '/') {\r\n // A workspace at the distribution root would make every session start\r\n // at `/`; the check flow rejects it and confirm must agree.\r\n setError(t('error.invalidPath'))\r\n return\r\n }\r\n const user = username.trim()\r\n if (user !== '' && !isValidWslUsername(user)) {\r\n setError(t('error.invalidUsername'))\r\n return\r\n }\r\n setBusy(true)\r\n try {\r\n let facts: WslPathCheck\r\n try {\r\n facts = await check(distro, path)\r\n } catch {\r\n setError(t('error.pathNotFound'))\r\n return\r\n }\r\n if (!facts.exists || !facts.isDirectory) {\r\n setError(t('error.pathNotFound'))\r\n return\r\n }\r\n const failure = await createWorkspace(path, user, distro)\r\n if (failure !== undefined) {\r\n setError(failure)\r\n return\r\n }\r\n setOpen(false)\r\n } finally {\r\n setBusy(false)\r\n }\r\n }\r\n\r\n const children = (listing?.entries.filter(entry => entry.kind === 'directory') ?? []).map(entry => entry.name)\r\n const maskClick = (): void => { if (!busy) setOpen(false) }\r\n const listScroll: UIEventHandler<HTMLDivElement> = () => { /* scroll container handles overflow */ }\r\n\r\n return (\r\n <div className=\"dww-overlay\">\r\n <div className=\"dww-overlay-mask\" onClick={maskClick} />\r\n <div className=\"dww-card\" role=\"dialog\" aria-modal=\"true\" aria-label={t('dialog.title')}>\r\n <div className=\"dww-header\">\r\n <h2 className=\"dww-title\">{t('dialog.title')}</h2>\r\n <button type=\"button\" className=\"dww-close\" aria-label={t('dialog.cancel')} onClick={maskClick}>\r\n ✕\r\n </button>\r\n </div>\r\n <div className=\"dww-body\">\r\n {error !== null ? (\r\n <div className=\"dww-error\">\r\n {error}\r\n <button type=\"button\" className=\"dww-retry\" onClick={() => setError(null)}>{t('dialog.retry')}</button>\r\n </div>\r\n ) : null}\r\n <div className=\"dww-field\">\r\n <label className=\"dww-field-label\" htmlFor=\"dww-distro\">{t('dialog.distro')}</label>\r\n <select\r\n id=\"dww-distro\"\r\n className=\"dww-select\"\r\n value={distro}\r\n disabled={opening || busy}\r\n onChange={event => onDistroChange(event.target.value)}\r\n >\r\n {distros.length === 0\r\n ? <option value=\"\">{opening ? t('dialog.loading') : ''}</option>\r\n : distros.map(name => <option key={name} value={name}>{name}</option>)}\r\n </select>\r\n </div>\r\n <div className=\"dww-field\">\r\n <label className=\"dww-field-label\" htmlFor=\"dww-path\">{t('dialog.path')}</label>\r\n <div className=\"dww-input-row\">\r\n <input\r\n id=\"dww-path\"\r\n className=\"dww-input\"\r\n value={pathInput}\r\n placeholder={t('dialog.pathPlaceholder')}\r\n disabled={opening || busy}\r\n onChange={event => setPathInput(event.target.value)}\r\n />\r\n <button type=\"button\" className=\"dww-check-btn\" disabled={opening || busy} onClick={() => void onCheck()}>\r\n {t('dialog.check')}\r\n </button>\r\n </div>\r\n </div>\r\n <div className=\"dww-field\">\r\n <label className=\"dww-field-label\" htmlFor=\"dww-username\">{t('dialog.username')}</label>\r\n <input\r\n id=\"dww-username\"\r\n className=\"dww-input\"\r\n value={username}\r\n placeholder={t('dialog.usernamePlaceholder')}\r\n disabled={opening || busy}\r\n autoComplete=\"off\"\r\n spellCheck={false}\r\n onChange={event => setUsername(event.target.value)}\r\n />\r\n </div>\r\n <div className=\"dww-feedback\">\r\n <div className=\"dww-breadcrumb\">{browsePath}</div>\r\n <div className=\"dww-dirlist\" onScroll={listScroll}>\r\n {browsing ? <div className=\"dww-dir-empty\">{t('dialog.loading')}</div> : (\r\n listing?.parent !== null && listing !== null\r\n ? (\r\n <button type=\"button\" className=\"dww-dir-row dww-dir-row--up\" onClick={onUp}>\r\n <WslGlyph size={14} />\r\n <span>{t('dialog.upLevel')}</span>\r\n </button>\r\n )\r\n : null\r\n )}\r\n {!browsing && (children.length === 0)\r\n ? <div className=\"dww-dir-empty\">{t('dialog.browseEmpty')}</div>\r\n : children.map(name => (\r\n <button type=\"button\" key={name} className=\"dww-dir-row\" onClick={() => onDrill(name)}>\r\n <WslGlyph size={14} />\r\n <span>{name}</span>\r\n </button>\r\n ))}\r\n </div>\r\n </div>\r\n </div>\r\n <div className=\"dww-actions\">\r\n <button type=\"button\" className=\"dww-btn\" disabled={busy} onClick={maskClick}>{t('dialog.cancel')}</button>\r\n <button type=\"button\" className=\"dww-btn dww-btn--primary\" disabled={busy || opening} onClick={() => void onConfirm()}>\r\n {busy ? t('dialog.loading') : t('dialog.confirm')}\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport type { ApiCall }\r\n","/**\n * Third-party stylesheet injection for the WSL workspace UI (the plugin\n * builds no CSS bundle, so styles are injected as one idempotent `<style>`).\n * Colors derive exclusively from the `--dsw-*` design tokens.\n */\n\nconst STYLE_TAG_DATA_ATTRIBUTE = 'data-plugin=\"dsh-wsl-workspace\"'\n\nconst STYLES = `\n/* Sidebar-foot icon action beside Settings (28px round in the wide sidebar,\n 36px round in the rail), matching the shell's icon-button language. */\n.dww-action {\n flex: none;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n border: none;\n border-radius: 50%;\n padding: 0;\n background: transparent;\n cursor: pointer;\n color: var(--dsw-alias-label-secondary);\n transition:\n background-color 120ms var(--dsw-ease-in-out, ease-in-out),\n color 120ms var(--dsw-ease-in-out, ease-in-out);\n}\n.dww-action:hover:not(:disabled) {\n background: var(--dsw-alias-interactive-bg-hover);\n color: var(--dsw-alias-label-secondary);\n}\n.dww-action:active:not(:disabled) {\n background: var(--dsw-alias-interactive-bg-pressed, var(--dsw-alias-interactive-bg-hover));\n}\n.dww-action:focus-visible {\n outline: 2px solid var(--dsw-alias-state-business-primary);\n outline-offset: 1px;\n}\n.dww-action:disabled { cursor: default; opacity: 0.6; }\n.dww-action--rail {\n width: 36px;\n height: 36px;\n color: var(--dsw-alias-label-primary);\n}\n.dww-action svg { flex: none; }\n\n/* The W letter mark of the sidebar action (sized for wide/rail buttons). */\n.dww-letter {\n font-size: 14px;\n font-weight: 600;\n line-height: 1;\n letter-spacing: 0.02em;\n user-select: none;\n}\n.dww-action--rail .dww-letter { font-size: 17px; }\n\n/* Full-viewport overlay + centered card (mirrors the platform Mask/Dialog). */\n.dww-overlay {\n position: fixed;\n inset: 0;\n z-index: 1000;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 24px;\n}\n.dww-overlay-mask {\n position: absolute;\n inset: 0;\n background: var(--dsw-alias-bg-mask-1);\n backdrop-filter: var(--dsw-mask-blur);\n}\n.dww-card {\n position: relative;\n z-index: 1;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n width: min(440px, 100%);\n max-height: min(640px, 90vh);\n padding: 0 0 20px;\n overflow: hidden;\n border: 1px solid var(--dsw-alias-border-inverted);\n border-radius: 16px;\n background: var(--dsw-alias-bg-layer-2);\n box-shadow: var(--dsw-shadow-lv3);\n font-family: var(--dsw-font-family);\n}\n.dww-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n padding: 18px 20px 12px;\n}\n.dww-title {\n margin: 0;\n font-size: 16px;\n line-height: 24px;\n font-weight: 500;\n color: var(--dsw-alias-label-primary);\n}\n.dww-close {\n flex: none;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n border: 0;\n border-radius: 8px;\n background: transparent;\n cursor: pointer;\n color: var(--dsw-alias-label-secondary);\n}\n.dww-close:hover { background: var(--dsw-alias-interactive-bg-hover); }\n.dww-body {\n display: flex;\n flex-direction: column;\n gap: 14px;\n min-width: 0;\n padding: 0 20px;\n overflow: auto;\n}\n.dww-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }\n.dww-field-label {\n font-size: 12px;\n line-height: 18px;\n color: var(--dsw-alias-label-secondary);\n}\n.dww-select {\n box-sizing: border-box;\n width: 100%;\n height: 36px;\n padding: 0 10px;\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 8px;\n background: var(--dsw-alias-bg-layer-3);\n color: var(--dsw-alias-label-primary);\n font-size: 14px;\n}\n.dww-input-row { display: flex; gap: 8px; align-items: center; }\n.dww-input {\n box-sizing: border-box;\n flex: 1;\n height: 36px;\n min-width: 0;\n padding: 0 10px;\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 8px;\n background: var(--dsw-alias-bg-layer-3);\n color: var(--dsw-alias-label-primary);\n font-size: 14px;\n}\n.dww-input:focus, .dww-select:focus {\n outline: none;\n border-color: var(--dsw-alias-state-business-primary);\n}\n.dww-check-btn {\n flex: none;\n height: 36px;\n padding: 0 12px;\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 8px;\n background: transparent;\n color: var(--dsw-alias-label-primary);\n cursor: pointer;\n font-size: 12px;\n}\n.dww-check-btn:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover); }\n.dww-check-btn:disabled { cursor: default; }\n\n/* Directory browse list. */\n.dww-dirlist {\n display: flex;\n flex-direction: column;\n gap: 2px;\n box-sizing: border-box;\n min-height: 120px;\n max-height: 200px;\n padding: 4px;\n overflow: auto;\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 8px;\n background: var(--dsw-alias-bg-layer-3);\n}\n.dww-breadcrumb {\n padding: 0 4px;\n font-size: 12px;\n line-height: 18px;\n color: var(--dsw-alias-label-tertiary);\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\n.dww-dir-row {\n display: flex;\n align-items: center;\n gap: 8px;\n height: 28px;\n padding: 0 8px;\n border: 0;\n border-radius: 6px;\n background: transparent;\n color: var(--dsw-alias-label-primary);\n cursor: pointer;\n font-size: 13px;\n text-align: left;\n}\n.dww-dir-row:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover); }\n.dww-dir-row:disabled { cursor: default; color: var(--dsw-alias-label-tertiary); }\n.dww-dir-row--up { color: var(--dsw-alias-label-secondary); }\n.dww-dir-row svg { flex: none; color: var(--dsw-alias-label-tertiary); }\n.dww-dir-empty {\n padding: 8px;\n font-size: 12px;\n line-height: 18px;\n color: var(--dsw-alias-label-tertiary);\n}\n\n/* Error strip. */\n.dww-error {\n box-sizing: border-box;\n width: 100%;\n padding: 8px 10px;\n border: 1px solid var(--dsw-alias-state-error-primary);\n border-radius: 8px;\n color: var(--dsw-alias-state-error-primary);\n font-size: 12px;\n line-height: 18px;\n}\n.dww-retry {\n margin-left: 6px;\n border: 0;\n background: transparent;\n color: var(--dsw-alias-state-business-primary);\n cursor: pointer;\n font-size: 12px;\n text-decoration: underline;\n}\n\n/* Dialog footer actions. */\n.dww-actions {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n gap: 8px;\n padding: 14px 20px 0;\n}\n.dww-btn {\n height: 36px;\n padding: 0 14px;\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 8px;\n background: transparent;\n color: var(--dsw-alias-label-primary);\n cursor: pointer;\n font-size: 14px;\n}\n.dww-btn:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover); }\n.dww-btn--primary {\n border-color: transparent;\n background: var(--dsw-alias-button-primary-fill);\n color: var(--dsw-alias-label-primary-foreground);\n}\n.dww-btn--primary:hover:not(:disabled) { background: var(--dsw-alias-button-primary-hover); }\n.dww-btn:disabled { cursor: default; opacity: 0.6; }\n`\n\n/**\n * Idempotently inject the plugin stylesheet. No-op when a tag with the\n * plugin's data attribute already exists.\n */\nexport function ensureStyles(): void {\n if (typeof document === 'undefined') return\n if (document.querySelector(`style[${STYLE_TAG_DATA_ATTRIBUTE}]`) !== null) return\n const style = document.createElement('style')\n style.setAttribute('data-plugin', 'dsh-wsl-workspace')\n style.textContent = STYLES\n document.head.appendChild(style)\n}\n","/**\r\n * Bilingual dictionaries for the `wslWorkspace` locale namespace. Product copy\r\n * is Chinese; English is the parallel export for the standalone bundle.\r\n */\r\n\r\n/**\r\n * The `wslWorkspace` translations (Chinese, the primary product copy).\r\n */\r\nexport const zh: Record<string, string> = {\r\n 'action.add': 'WSL 工作区',\r\n 'action.title': '添加 WSL 工作区…',\r\n\r\n 'dialog.title': '添加 WSL 工作区',\r\n 'dialog.distro': '发行版',\r\n 'dialog.path': '路径',\r\n 'dialog.pathPlaceholder': '/home/',\r\n 'dialog.username': '用户名',\r\n 'dialog.usernamePlaceholder': '留空则使用发行版默认用户',\r\n 'dialog.loading': '正在加载…',\r\n 'dialog.browseEmpty': '此目录没有子文件夹',\r\n 'dialog.upLevel': '..(返回上级)',\r\n 'dialog.browse': '浏览',\r\n 'dialog.check': '检查',\r\n 'dialog.confirm': '创建并打开',\r\n 'dialog.cancel': '取消',\r\n 'dialog.retry': '重试',\r\n\r\n 'error.loadDistros': '无法获取 WSL 发行版列表,请确认已安装 WSL 且插件宿主端可用',\r\n 'error.rateLimited': '操作过于频繁,请稍后重试',\r\n 'error.loadDir': '无法浏览该目录',\r\n 'error.presetMissing': '未找到健康的 wsl preset,请确认插件宿主端已安装并配置该 preset',\r\n 'error.invalidPath': '请输入以 / 开头的 Linux 绝对路径',\r\n 'error.invalidUsername': '用户名无效:需以字母或下划线开头,仅含字母、数字、_、.、-',\r\n 'error.pathNotFound': '该路径不存在或是文件,请选择一个文件夹',\r\n 'error.createFailed': '创建工作区失败',\r\n}\r\n\r\n/**\r\n * The `wslWorkspace` translations (English).\r\n */\r\nexport const en: Record<string, string> = {\r\n 'action.add': 'WSL Workspace',\r\n 'action.title': 'Add WSL workspace…',\r\n\r\n 'dialog.title': 'Add WSL workspace',\r\n 'dialog.distro': 'Distro',\r\n 'dialog.path': 'Path',\r\n 'dialog.pathPlaceholder': '/home/',\r\n 'dialog.username': 'Username',\r\n 'dialog.usernamePlaceholder': 'Leave empty to use the distro default user',\r\n 'dialog.loading': 'Loading…',\r\n 'dialog.browseEmpty': 'No subdirectories here',\r\n 'dialog.upLevel': '.. (up)',\r\n 'dialog.browse': 'Browse',\r\n 'dialog.check': 'Check',\r\n 'dialog.confirm': 'Create & open',\r\n 'dialog.cancel': 'Cancel',\r\n 'dialog.retry': 'Retry',\r\n\r\n 'error.loadDistros': 'Could not list WSL distros; confirm WSL is installed and the plugin host side is reachable',\r\n 'error.rateLimited': 'Too many attempts; retry in a moment',\r\n 'error.loadDir': 'Could not browse this directory',\r\n 'error.presetMissing': 'No healthy \"wsl\" preset found; confirm the plugin host side installed and configured it',\r\n 'error.invalidPath': 'Enter an absolute Linux path starting with /',\r\n 'error.invalidUsername': 'Invalid username: start with a letter or underscore; only letters, digits, _ . -',\r\n 'error.pathNotFound': 'The path does not exist or is a file; choose a folder',\r\n 'error.createFailed': 'Failed to create the workspace',\r\n}\r\n","/**\r\n * Browser half of dsh-wsl-workspace. Registers the \"Add WSL workspace…\"\r\n * action beside Settings at the sidebar foot (the official\r\n * `sidebar.footer.action` slot), and keeps every blank session whose\r\n * workspace is a WSL UNC path composed from the WSL VARIANT of the mode it\r\n * currently runs (`standard` → `wsl-standard`, PTC → `wsl-code`, …) — so the\r\n * WSL execution world composes with any mode instead of being a mode itself.\r\n *\r\n * The binding is a watching effect rather than a one-shot dialog action so\r\n * EVERY creation path (this dialog, the workspace row's New Session, the\r\n * hero picker) converges on the WSL-backed composition automatically.\r\n */\r\n\r\n// Type-only: pulls the locale plugin's Context merge (ctx.locale) and the\r\n// ui-sidebar SlotMap merge (the 'sidebar.footer.action' entry) into this\r\n// program. Version-dependent services (`remote`, `connection.api`,\r\n// `uiWorkspace`) are read dynamically via ctx.get() so both DSH v0.1.1-rc.2\r\n// and v0.1.2-rc.1+ can load this plugin.\r\nimport type {} from '@deepseek-ai/dsh-client-locale/client'\r\nimport type {} from '@deepseek-ai/dsh-client-ui-sidebar/client'\r\nimport type { ClientContext } from '@deepseek-ai/dsh-client-runtime/client'\r\nimport { check as checkApi, listDir as listDirApi, listDistros as listDistrosApi, listWorkspaces as listWorkspacesApi, registerWindows as registerWindowsApi, setWorkspaceUser as setWorkspaceUserApi } from './api.ts'\r\nimport { AddWslWorkspace, type AddWslWorkspaceInjected } from './AddWslWorkspace.tsx'\r\nimport { ensureStyles } from './styles.ts'\r\nimport { zh, en } from './locales.ts'\r\nimport { canonicalWindowsPath, isWslUnc, joinUnc, mntToWindowsPath } from '../shared/paths.ts'\r\n\r\n/** Required services (cordis fiber inject). */\r\nexport const inject = ['slots', 'locale', 'sessions', 'workspaces']\r\n\r\n/** The legacy standalone WSL preset id (folded into the mode variants). */\r\nconst LEGACY_WSL_PRESET_ID = 'wsl'\r\n\r\n/**\r\n * Minimal sessions-service face. The renderer-host ctx merge types\r\n * `ctx.sessions` as its own SessionStore; the service the runtime actually\r\n * registers under that key satisfies this narrower contract, so the cast is\r\n * the documented boundary for a third-party plugin.\r\n */\r\ninterface WslSessionsFace {\r\n list: {\r\n getSnapshot(): {\r\n ids: string[]\r\n byId: Record<string, {\r\n blank: boolean\r\n cwd?: string\r\n /** v0.1.1-rc.2 direct field */\r\n agentPreset?: string\r\n /** v0.1.2-rc.1+ projection value */\r\n projectionValues?: Readonly<{ agentPreset?: string | null }>\r\n }>\r\n }\r\n subscribe(fn: () => void): () => void\r\n }\r\n /** v0.1.1-rc.2 only — absent in v0.1.2-rc.1+ (projection auto-syncs). */\r\n noteAgentPreset?(sessionId: string, agentPreset: string): void\r\n}\r\n\r\n/** Minimal workspaces-service face (create only; startSession moved out in v0.1.2-rc.1+). */\r\ninterface WslWorkspacesFace {\r\n create(input: { path: string }): Promise<{ workspaceId: string }>\r\n /** v0.1.1-rc.2 only — removed in v0.1.2-rc.1+. */\r\n startSession?(workspaceId?: string): void\r\n}\r\n\r\n/** v0.1.2-rc.1+ only — replaces `workspaces.startSession`. */\r\ninterface WslUiWorkspaceFace {\r\n startSession(workspaceId?: string): void\r\n}\r\n\r\n/** v0.1.2-rc.1+ agentPresets 命名空间服务(经 ctx.get('remote.agentPresets') 动态取,免 inject、无 associate 陷阱)。 */\r\ninterface WslAgentPresetsNamespace {\r\n list(): Promise<{ ok: boolean; value?: { presets: { id: string; broken?: string; isDefault?: boolean }[] }; error?: { message: string } }>\r\n select(sessionId: string, presetId: string): Promise<{ ok: boolean }>\r\n}\r\n\r\n/** 旧版 connection 服务最小接口(v0.1.1-rc.2 及更早),api 属性承载远程调用。 */\r\ninterface WslLegacyConnection {\r\n api?: {\r\n agentPresets: {\r\n list(input: Record<string, never>): Promise<{ result: { ok: boolean; value?: { presets: { id: string; broken?: string; isDefault?: boolean }[] }; error?: { message: string } } }>\r\n select(input: { sessionId: string; agentPreset: string }): Promise<{ result: { ok: boolean } }>\r\n }\r\n }\r\n}\r\n/**\r\n * Mount the sidebar action and the auto-binding effect.\r\n * @param ctx - the browser plugin context.\r\n */\r\nexport function apply(ctx: ClientContext): void {\r\n const workspaces = ctx.get('workspaces') as unknown as WslWorkspacesFace\r\n const sessions = ctx.get('sessions') as unknown as WslSessionsFace\r\n // Version-dependent services are resolved ON USE - never through `inject`\r\n // (a release without the service would refuse to mount the plugin at all)\r\n // and never once at apply time. This plugin applies before the UI domain\r\n // that publishes `uiWorkspace` registers its service, so a one-shot read\r\n // caches `undefined` for the whole page life: on v0.1.2-rc.1+ that silently\r\n // disabled session creation (see resolveSessionStarter).\r\n const legacyApi = (): WslLegacyConnection['api'] =>\r\n (ctx.get('connection') as unknown as WslLegacyConnection | undefined)?.api\r\n const remoteAgentPresets = (): WslAgentPresetsNamespace | undefined =>\r\n ctx.get('remote.agentPresets') as unknown as WslAgentPresetsNamespace | undefined\r\n const uiWorkspaceService = (): WslUiWorkspaceFace | undefined =>\r\n ctx.get('uiWorkspace') as unknown as WslUiWorkspaceFace | undefined\r\n const hasNoteAgentPreset = typeof sessions.noteAgentPreset === 'function'\r\n\r\n /** Unified agent-preset list: new `remote.agentPresets` namespace (v0.1.2-rc.1+) or legacy `connection.api` (v0.1.1-rc.2). */\r\n const listAgentPresets = async (): Promise<{ ok: boolean; presets: { id: string; broken?: string; isDefault?: boolean }[]; error?: string }> => {\r\n const agentPresets = remoteAgentPresets()\r\n if (agentPresets !== undefined) {\r\n const r = await agentPresets.list()\r\n if (!r.ok) return { ok: false, presets: [], error: r.error?.message ?? 'list failed' }\r\n return { ok: true, presets: r.value?.presets ?? [] }\r\n }\r\n const api = legacyApi()\r\n if (api !== undefined) {\r\n const r = await api.agentPresets.list({})\r\n if (!r.result.ok) return { ok: false, presets: [], error: r.result.error?.message ?? 'list failed' }\r\n return { ok: true, presets: r.result.value?.presets ?? [] }\r\n }\r\n return { ok: false, presets: [], error: 'no remote api available' }\r\n }\r\n\r\n /** Unified agent-preset select: new `agentPresets.select(id, preset)` or legacy `connection.api.select({...})`. */\r\n const selectAgentPreset = async (sessionId: string, presetId: string): Promise<{ ok: boolean }> => {\r\n const agentPresets = remoteAgentPresets()\r\n if (agentPresets !== undefined) {\r\n return agentPresets.select(sessionId, presetId)\r\n }\r\n const api = legacyApi()\r\n if (api !== undefined) {\r\n const r = await api.agentPresets.select({ sessionId, agentPreset: presetId })\r\n return { ok: r.result.ok }\r\n }\r\n return { ok: false }\r\n }\r\n\r\n /**\r\n * Resolve how this release opens a session for a workspace - v0.1.2-rc.1+\r\n * exposes `uiWorkspace.startSession`, v0.1.1-rc.2 keeps it on `workspaces`.\r\n *\r\n * Resolved BEFORE the workspace is written. A release that offers neither\r\n * cannot open a session, and a silent fall-through would leave the workspace\r\n * behind with an empty `sessionIds` while the dialog still reports success;\r\n * failing here names the missing capability instead.\r\n * @returns the starter for the service this release actually exposes.\r\n * @throws Error naming both candidates when neither service is available.\r\n */\r\n const resolveSessionStarter = (): (workspaceId: string) => void | Promise<void> => {\r\n const ui = uiWorkspaceService()\r\n if (ui !== undefined) return (workspaceId) => { ui.startSession(workspaceId) }\r\n const legacyStart = workspaces.startSession\r\n if (typeof legacyStart === 'function') {\r\n return (workspaceId) => { Reflect.apply(legacyStart, workspaces, [workspaceId]) }\r\n }\r\n throw new Error(\r\n 'workspace session API unavailable: this DSH release exposes neither '\r\n + 'uiWorkspace.startSession nor workspaces.startSession',\r\n )\r\n }\r\n\r\n /** Read agent preset — v0.1.2-rc.1+ uses projectionValues; v0.1.1-rc.2 uses direct field. */\r\n const getAgentPreset = (summary: { agentPreset?: string; projectionValues?: { agentPreset?: string | null } }): string | undefined => {\r\n if (summary.projectionValues?.agentPreset !== undefined) {\r\n const v = summary.projectionValues.agentPreset\r\n return v === null ? undefined : v\r\n }\r\n return summary.agentPreset\r\n }\r\n\r\n /** Note preset change — v0.1.1-rc.2 calls noteAgentPreset; v0.1.2-rc.1+ is auto-synced via projection. */\r\n const noteAgentPresetCompat = (sessionId: string, presetId: string): void => {\r\n if (hasNoteAgentPreset && sessions.noteAgentPreset) {\r\n sessions.noteAgentPreset(sessionId, presetId)\r\n }\r\n }\r\n\r\n ensureStyles()\r\n\r\n ctx.effect(\r\n () => ctx.locale.register('wslWorkspace' as never, { zh, en }),\r\n 'dsh-wsl-workspace: locale dictionaries',\r\n )\r\n\r\n // The injected translate function reads the live DeepSeek Harness locale,\r\n // so the dialog copy follows the app language setting automatically.\r\n const t = ctx.locale.bind('wslWorkspace' as never) as unknown as (key: string, params?: Record<string, unknown>) => string\r\n\r\n // Canonical Windows drive keys of every registered `/mnt/<drive>` workspace\r\n // (refreshed from the host store; see refreshRoster). A blank session whose\r\n // cwd is one of these binds to the WSL variant like a UNC-cwd session.\r\n let wslWindowsPaths = new Set<string>()\r\n\r\n const injected = (): AddWslWorkspaceInjected => ({\r\n t,\r\n checkPreset: async (): Promise<string | undefined> => {\r\n let roster\r\n try {\r\n roster = await listAgentPresets()\r\n } catch (error) {\r\n return error instanceof Error ? error.message : String(error)\r\n }\r\n if (!roster.ok) return roster.error\r\n const healthy = roster.presets.find((entry: { id: string; broken?: string }) =>\r\n entry.id.startsWith('wsl-') && entry.broken === undefined)\r\n if (healthy === undefined) return t('error.presetMissing')\r\n return undefined\r\n },\r\n listDistros: () => listDistrosApi(),\r\n listDir: (distro, path) => listDirApi(distro, path),\r\n check: (distro, path) => checkApi(distro, path),\r\n createWorkspace: async (linuxPath, username, distro): Promise<string | undefined> => {\r\n try {\r\n // Before any write: without a session starter the workspace below\r\n // would be created and never opened.\r\n const startSession = resolveSessionStarter()\r\n const winPath = mntToWindowsPath(linuxPath)\r\n if (winPath !== null) {\r\n // `/mnt/<drive>` workspace: the workspace registry realpath/stats\r\n // the path and 9P cannot serve drvfs mounts, so register under the\r\n // drive spelling and store distro/username for the session env.\r\n // The browser binding below recognizes the drive cwd as WSL.\r\n const view = await workspaces.create({ path: winPath })\r\n await registerWindowsApi(linuxPath, distro, username)\r\n const canonical = canonicalWindowsPath(winPath)\r\n if (canonical !== null) wslWindowsPaths = new Set(wslWindowsPaths).add(canonical)\r\n await startSession(view.workspaceId)\r\n return undefined\r\n }\r\n const uncPath = joinUnc(distro, linuxPath)\r\n const view = await workspaces.create({ path: uncPath })\r\n await setWorkspaceUserApi(uncPath, username)\r\n await startSession(view.workspaceId)\r\n return undefined\r\n } catch (error) {\r\n return error instanceof Error ? error.message : String(error)\r\n }\r\n },\r\n })\r\n\r\n ctx.effect(\r\n () => ctx.slots.inject(\r\n 'sidebar.footer.action',\r\n () => ctx.slots.register(\r\n { name: 'sidebar.footer.action', id: 'wsl-workspace', inject: injected },\r\n AddWslWorkspace,\r\n ),\r\n ),\r\n 'dsh-wsl-workspace: sidebar footer action',\r\n )\r\n\r\n // Mode-variant binding: a blank session whose workspace is a WSL UNC path\r\n // is recomposed to the WSL variant of the mode it currently runs — plain\r\n // 标准 becomes `wsl-standard`, PTC becomes `wsl-code`, and so on — so the\r\n // WSL execution world composes with ANY mode instead of replacing it. The\r\n // host refuses non-blank sessions (agent-preset-locked), so the swap is\r\n // attempted at most a few times per session.\r\n ctx.effect(() => {\r\n const inFlight = new Set<string>()\r\n const attempts = new Map<string, number>()\r\n const MAX_ATTEMPTS = 3\r\n // Healthy `wsl-<mode>` variant ids plus the roster's default preset id\r\n // (what a session with no explicit choice gets). Refreshed periodically\r\n // so variants generated after this page loaded are picked up.\r\n let variants = new Set<string>()\r\n let defaultPreset: string | undefined\r\n const refreshRoster = (): void => {\r\n void listAgentPresets().then((result: {\r\n ok: boolean; presets: { id: string; broken?: string; isDefault?: boolean }[]\r\n }) => {\r\n if (!result.ok) return\r\n variants = new Set(result.presets\r\n .filter((entry: { id: string; broken?: string }) =>\r\n entry.broken === undefined && entry.id.startsWith('wsl-'))\r\n .map((entry: { id: string }) => entry.id))\r\n defaultPreset = result.presets.find(\r\n (entry: { id: string; isDefault?: boolean }) => entry.isDefault === true,\r\n )?.id\r\n // The roster is an INPUT to binding. It can land after the first pass\r\n // (and after apply()), and nothing else would re-run that pass: the\r\n // session store only emits when a session changes, so a blank session\r\n // that was already there would stay unbound until the user acted.\r\n maybeBind()\r\n }).catch(() => {\r\n // A failed roster read leaves the previous mapping; sessions stay on\r\n // their current composition until the next refresh.\r\n })\r\n }\r\n refreshRoster()\r\n const refreshWorkspaces = (): void => {\r\n void listWorkspacesApi().then((keys: string[]) => {\r\n const next = new Set<string>()\r\n for (const key of keys) {\r\n const canonical = canonicalWindowsPath(key)\r\n if (canonical !== null) next.add(canonical)\r\n }\r\n wslWindowsPaths = next\r\n // Same late-input rule as the roster: the `/mnt/<drive>` key set\r\n // decides binding for drive-cwd sessions.\r\n maybeBind()\r\n }).catch(() => {\r\n // A failed store read leaves the previous set; sessions stay on\r\n // their current composition until the next refresh.\r\n })\r\n }\r\n refreshWorkspaces()\r\n const maybeBind = (): void => {\r\n const state = sessions.list.getSnapshot()\r\n for (const id of state.ids) {\r\n const summary = state.byId[id]\r\n if (summary === undefined || !summary.blank || summary.cwd === undefined) continue\r\n // A session belongs to the WSL world when its cwd is a WSL UNC path,\r\n // or a Windows drive path registered as a `/mnt/<drive>` workspace\r\n // (9P cannot serve drvfs, so those workspaces carry drive cwds).\r\n const canonical = canonicalWindowsPath(summary.cwd)\r\n const isWsl = isWslUnc(summary.cwd)\r\n || (canonical !== null && wslWindowsPaths.has(canonical))\r\n if (!isWsl) continue\r\n const current = getAgentPreset(summary)\r\n if (current !== undefined && current.startsWith('wsl-')) continue\r\n // Legacy standalone `wsl` (now folded into the variants): remap it to\r\n // the default mode's variant, since the standalone preset no longer\r\n // exists in the roster.\r\n const base = current === LEGACY_WSL_PRESET_ID\r\n ? (defaultPreset ?? 'standard')\r\n : (current ?? defaultPreset)\r\n if (base === undefined || base === LEGACY_WSL_PRESET_ID || base.startsWith('wsl-')) continue\r\n const target = `wsl-${base.toLowerCase()}`\r\n if (!variants.has(target)) continue\r\n if (inFlight.has(id) || (attempts.get(id) ?? 0) >= MAX_ATTEMPTS) continue\r\n inFlight.add(id)\r\n void selectAgentPreset(id, target)\r\n .then((result: { ok: boolean }) => {\r\n if (result.ok) noteAgentPresetCompat(id, target)\r\n })\r\n .catch(() => {\r\n // A refused or aborted swap (session already produced output,\r\n // roster churn, reconnect) leaves the session on its current\r\n // composition; count the attempt so a stuck session stops\r\n // retrying after MAX_ATTEMPTS.\r\n attempts.set(id, (attempts.get(id) ?? 0) + 1)\r\n })\r\n .finally(() => {\r\n inFlight.delete(id)\r\n })\r\n }\r\n }\r\n maybeBind()\r\n const unsubscribe = sessions.list.subscribe(() => maybeBind())\r\n // Variants are generated at host boot; a page loaded before that would\r\n // never see them without a periodic refresh.\r\n const timer = window.setInterval(refreshRoster, 60_000)\r\n return () => {\r\n unsubscribe()\r\n window.clearInterval(timer)\r\n }\r\n }, 'dsh-wsl-workspace: WSL mode-variant binding')\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAM,WAAW;;AA4BjB,SAAS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