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.
@@ -1,68 +1,68 @@
1
- /**
2
- * Bilingual dictionaries for the `wslWorkspace` locale namespace. Product copy
3
- * is Chinese; English is the parallel export for the standalone bundle.
4
- */
5
-
6
- /**
7
- * The `wslWorkspace` translations (Chinese, the primary product copy).
8
- */
9
- export const zh: Record<string, string> = {
10
- 'action.add': 'WSL 工作区',
11
- 'action.title': '添加 WSL 工作区…',
12
-
13
- 'dialog.title': '添加 WSL 工作区',
14
- 'dialog.distro': '发行版',
15
- 'dialog.path': '路径',
16
- 'dialog.pathPlaceholder': '/home/',
17
- 'dialog.username': '用户名',
18
- 'dialog.usernamePlaceholder': '留空则使用发行版默认用户',
19
- 'dialog.loading': '正在加载…',
20
- 'dialog.browseEmpty': '此目录没有子文件夹',
21
- 'dialog.upLevel': '..(返回上级)',
22
- 'dialog.browse': '浏览',
23
- 'dialog.check': '检查',
24
- 'dialog.confirm': '创建并打开',
25
- 'dialog.cancel': '取消',
26
- 'dialog.retry': '重试',
27
-
28
- 'error.loadDistros': '无法获取 WSL 发行版列表,请确认已安装 WSL 且插件宿主端可用',
29
- 'error.rateLimited': '操作过于频繁,请稍后重试',
30
- 'error.loadDir': '无法浏览该目录',
31
- 'error.presetMissing': '未找到健康的 wsl preset,请确认插件宿主端已安装并配置该 preset',
32
- 'error.invalidPath': '请输入以 / 开头的 Linux 绝对路径',
33
- 'error.invalidUsername': '用户名无效:需以字母或下划线开头,仅含字母、数字、_、.、-',
34
- 'error.pathNotFound': '该路径不存在或是文件,请选择一个文件夹',
35
- 'error.createFailed': '创建工作区失败',
36
- }
37
-
38
- /**
39
- * The `wslWorkspace` translations (English).
40
- */
41
- export const en: Record<string, string> = {
42
- 'action.add': 'WSL Workspace',
43
- 'action.title': 'Add WSL workspace…',
44
-
45
- 'dialog.title': 'Add WSL workspace',
46
- 'dialog.distro': 'Distro',
47
- 'dialog.path': 'Path',
48
- 'dialog.pathPlaceholder': '/home/',
49
- 'dialog.username': 'Username',
50
- 'dialog.usernamePlaceholder': 'Leave empty to use the distro default user',
51
- 'dialog.loading': 'Loading…',
52
- 'dialog.browseEmpty': 'No subdirectories here',
53
- 'dialog.upLevel': '.. (up)',
54
- 'dialog.browse': 'Browse',
55
- 'dialog.check': 'Check',
56
- 'dialog.confirm': 'Create & open',
57
- 'dialog.cancel': 'Cancel',
58
- 'dialog.retry': 'Retry',
59
-
60
- 'error.loadDistros': 'Could not list WSL distros; confirm WSL is installed and the plugin host side is reachable',
61
- 'error.rateLimited': 'Too many attempts; retry in a moment',
62
- 'error.loadDir': 'Could not browse this directory',
63
- 'error.presetMissing': 'No healthy "wsl" preset found; confirm the plugin host side installed and configured it',
64
- 'error.invalidPath': 'Enter an absolute Linux path starting with /',
65
- 'error.invalidUsername': 'Invalid username: start with a letter or underscore; only letters, digits, _ . -',
66
- 'error.pathNotFound': 'The path does not exist or is a file; choose a folder',
67
- 'error.createFailed': 'Failed to create the workspace',
68
- }
1
+ /**
2
+ * Bilingual dictionaries for the `wslWorkspace` locale namespace. Product copy
3
+ * is Chinese; English is the parallel export for the standalone bundle.
4
+ */
5
+
6
+ /**
7
+ * The `wslWorkspace` translations (Chinese, the primary product copy).
8
+ */
9
+ export const zh: Record<string, string> = {
10
+ 'action.add': 'WSL 工作区',
11
+ 'action.title': '添加 WSL 工作区…',
12
+
13
+ 'dialog.title': '添加 WSL 工作区',
14
+ 'dialog.distro': '发行版',
15
+ 'dialog.path': '路径',
16
+ 'dialog.pathPlaceholder': '/home/',
17
+ 'dialog.username': '用户名',
18
+ 'dialog.usernamePlaceholder': '留空则使用发行版默认用户',
19
+ 'dialog.loading': '正在加载…',
20
+ 'dialog.browseEmpty': '此目录没有子文件夹',
21
+ 'dialog.upLevel': '..(返回上级)',
22
+ 'dialog.browse': '浏览',
23
+ 'dialog.check': '检查',
24
+ 'dialog.confirm': '创建并打开',
25
+ 'dialog.cancel': '取消',
26
+ 'dialog.retry': '重试',
27
+
28
+ 'error.loadDistros': '无法获取 WSL 发行版列表,请确认已安装 WSL 且插件宿主端可用',
29
+ 'error.rateLimited': '操作过于频繁,请稍后重试',
30
+ 'error.loadDir': '无法浏览该目录',
31
+ 'error.presetMissing': '未找到健康的 wsl preset,请确认插件宿主端已安装并配置该 preset',
32
+ 'error.invalidPath': '请输入以 / 开头的 Linux 绝对路径',
33
+ 'error.invalidUsername': '用户名无效:需以字母或下划线开头,仅含字母、数字、_、.、-',
34
+ 'error.pathNotFound': '该路径不存在或是文件,请选择一个文件夹',
35
+ 'error.createFailed': '创建工作区失败',
36
+ }
37
+
38
+ /**
39
+ * The `wslWorkspace` translations (English).
40
+ */
41
+ export const en: Record<string, string> = {
42
+ 'action.add': 'WSL Workspace',
43
+ 'action.title': 'Add WSL workspace…',
44
+
45
+ 'dialog.title': 'Add WSL workspace',
46
+ 'dialog.distro': 'Distro',
47
+ 'dialog.path': 'Path',
48
+ 'dialog.pathPlaceholder': '/home/',
49
+ 'dialog.username': 'Username',
50
+ 'dialog.usernamePlaceholder': 'Leave empty to use the distro default user',
51
+ 'dialog.loading': 'Loading…',
52
+ 'dialog.browseEmpty': 'No subdirectories here',
53
+ 'dialog.upLevel': '.. (up)',
54
+ 'dialog.browse': 'Browse',
55
+ 'dialog.check': 'Check',
56
+ 'dialog.confirm': 'Create & open',
57
+ 'dialog.cancel': 'Cancel',
58
+ 'dialog.retry': 'Retry',
59
+
60
+ 'error.loadDistros': 'Could not list WSL distros; confirm WSL is installed and the plugin host side is reachable',
61
+ 'error.rateLimited': 'Too many attempts; retry in a moment',
62
+ 'error.loadDir': 'Could not browse this directory',
63
+ 'error.presetMissing': 'No healthy "wsl" preset found; confirm the plugin host side installed and configured it',
64
+ 'error.invalidPath': 'Enter an absolute Linux path starting with /',
65
+ 'error.invalidUsername': 'Invalid username: start with a letter or underscore; only letters, digits, _ . -',
66
+ 'error.pathNotFound': 'The path does not exist or is a file; choose a folder',
67
+ 'error.createFailed': 'Failed to create the workspace',
68
+ }
@@ -11,7 +11,11 @@
11
11
  * This provider mirrors the host's discovery rules for WSL UNC session
12
12
  * workspaces: it starts at the session cwd's nearest `.git` ancestor (the
13
13
  * host's project-root rule; the cwd itself when no ancestor has a `.git`
14
- * marker), then walks that root (depth- and budget-bounded), collects every
14
+ * marker), then walks that root (depth- and budget-bounded). Directory
15
+ * symlinks are followed when the substrate resolves them and pruned safely
16
+ * when it does not — the `\\wsl.localhost` 9P share cannot resolve Linux
17
+ * symlink targets, so linked-in projects stay undiscoverable there today.
18
+ * The walk collects every
15
19
  * `.dsh/skills` and `.agents/skills` directory it finds — including nested
16
20
  * projects — and publishes their skills with the same
17
21
  * project ranks and sources the host uses, so precedence and duplicate
@@ -42,6 +46,10 @@ const MAX_SKILL_ROOTS = 64
42
46
  const MAX_VISITED_DIRECTORIES = 4096
43
47
  /** How many parent levels above the session cwd are searched for a `.git` project marker. */
44
48
  const MAX_ANCESTOR_WALK = 64
49
+ /** How long a completed lookup is served from cache before the next rescan. */
50
+ const CACHE_TTL_MS = 10_000
51
+ /** Maximum cached lookups (one entry per distinct scan root across sessions). */
52
+ const CACHE_MAX_ENTRIES = 32
45
53
 
46
54
  /** Kebab-case skill names, matching the host grammar. */
47
55
  const SKILL_NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/
@@ -191,11 +199,26 @@ async function discoverSkillRoots(distro: string, linuxRoot: string, io: WslSkil
191
199
  continue
192
200
  }
193
201
  for (const entry of entries) {
194
- if (!entry.isDirectory()) continue
195
202
  if (PRUNED_DIRECTORY_NAMES.has(entry.name)) continue
196
203
  if (entry.name.startsWith('.') && entry.name !== '.dsh' && entry.name !== '.agents') continue
197
204
  if (entry.name === '.dsh' || entry.name === '.agents') continue
198
- next.push([posix.join(dir, entry.name), depth + 1])
205
+ const childPath = posix.join(dir, entry.name)
206
+ if (entry.isDirectory()) {
207
+ next.push([childPath, depth + 1])
208
+ continue
209
+ }
210
+ if (entry.isSymbolicLink()) {
211
+ // A project may be linked into the workspace via a directory
212
+ // symlink; follow it when the target is a directory. Symlink
213
+ // cycles stay bounded: every hop increments the depth (capped by
214
+ // MAX_SCAN_DEPTH) and the walk as a whole by MAX_VISITED_DIRECTORIES.
215
+ try {
216
+ const target = await io.stat(joinUnc(distro, childPath))
217
+ if (target.isDirectory()) next.push([childPath, depth + 1])
218
+ } catch {
219
+ // Dangling symlink: nothing to traverse.
220
+ }
221
+ }
199
222
  }
200
223
  }
201
224
  frontier = next
@@ -263,19 +286,33 @@ async function readSkill(path: string, io: WslSkillIo, signal?: AbortSignal): Pr
263
286
  /**
264
287
  * Parse the frontmatter subset skill files use: `---` fenced YAML with
265
288
  * `name` / `description` / `whenToUse` / `user-invocable` /
266
- * `disable-model-invocation`. Host-incompatible files are skipped, matching
267
- * the shipped provider's leniency: a bad file must not fail the catalog.
289
+ * `disable-model-invocation`. Single-line scalars and block scalars
290
+ * (`|` literal, `>` folded) are understood; anything else is skipped,
291
+ * matching the shipped provider's leniency: a bad file must not fail
292
+ * the catalog.
268
293
  */
269
294
  function parseSkillFrontmatter(raw: string, path: string): ParsedSkill | undefined {
295
+ // Windows editors save UTF-8 with a BOM; a leading BOM must not make the
296
+ // opening `---` line unmatchable and silently drop the skill.
297
+ if (raw.charCodeAt(0) === 0xfeff) raw = raw.slice(1)
270
298
  const firstLineEnd = raw.indexOf('\n')
271
299
  if (firstLineEnd < 0) return undefined
272
300
  if (raw.slice(0, firstLineEnd).replace(/\r$/, '') !== '---') return undefined
273
301
  const start = firstLineEnd + 1
274
302
  const closing = findFrontmatterEnd(raw, start)
275
303
  if (closing === undefined) return undefined
304
+ const lines = raw.slice(start, closing).split('\n')
276
305
  const fields = new Map<string, string>()
277
- for (const line of raw.slice(start, closing).split('\n')) {
278
- const match = /^([A-Za-z0-9-]+):\s*(.*)$/.exec(line.replace(/\r$/, ''))
306
+ for (let index = 0; index < lines.length; index += 1) {
307
+ const line = (lines[index] ?? '').replace(/\r$/, '')
308
+ const block = /^([A-Za-z0-9-]+):\s*([|>])[+-]?\s*$/.exec(line)
309
+ if (block !== null) {
310
+ const value = parseBlockScalar(lines, index, block[2] === '>')
311
+ index = value.nextLineIndex
312
+ if (value.text !== '') fields.set(block[1] ?? '', value.text)
313
+ continue
314
+ }
315
+ const match = /^([A-Za-z0-9-]+):\s*(.*)$/.exec(line)
279
316
  if (match === null) continue
280
317
  const value = match[2]?.trim() ?? ''
281
318
  if (value !== '') fields.set(match[1] ?? '', unquote(value))
@@ -294,10 +331,48 @@ function parseSkillFrontmatter(raw: string, path: string): ParsedSkill | undefin
294
331
  modelInvocable: !frontmatterBoolean(fields, 'disable-model-invocation'),
295
332
  userInvocable: frontmatterBoolean(fields, 'user-invocable', true),
296
333
  },
297
- content: raw.slice(closing + 1).trim(),
334
+ // `findFrontmatterEnd` returns the index of the body's FIRST character
335
+ // (the newline after the closing `---` plus one), so slicing at `closing`
336
+ // is what keeps it: `closing + 1` dropped the body's first character and
337
+ // made the byte after the delimiter look like the body.
338
+ content: raw.slice(closing).trim(),
298
339
  }
299
340
  }
300
341
 
342
+ /**
343
+ * Collect a YAML block scalar (`key: |` literal or `key: >` folded) starting
344
+ * at `startIndex`'s following lines. The block runs until the first
345
+ * non-indented, non-blank line; its common indentation is stripped.
346
+ * @returns the scalar text and the index of the last consumed line.
347
+ */
348
+ function parseBlockScalar(
349
+ lines: string[],
350
+ startIndex: number,
351
+ folded: boolean,
352
+ ): { text: string; nextLineIndex: number } {
353
+ const collected: string[] = []
354
+ let indent: string | undefined
355
+ let index = startIndex
356
+ while (index + 1 < lines.length) {
357
+ index += 1
358
+ const next = (lines[index] ?? '').replace(/\r$/, '')
359
+ if (next.trim() === '') {
360
+ collected.push('')
361
+ continue
362
+ }
363
+ const indented = /^([ \t]+)(.*)$/.exec(next)
364
+ if (indented === null) {
365
+ index -= 1
366
+ break
367
+ }
368
+ indent ??= indented[1]
369
+ collected.push(indented[1]?.startsWith(indent) === true ? indented[2] : indented[1].replace(/^[ \t]+/, '') + indented[2])
370
+ }
371
+ while (collected.length > 0 && collected[collected.length - 1] === '') collected.pop()
372
+ const text = (folded ? collected.filter(line => line !== '').join(' ') : collected.join('\n')).trim()
373
+ return { text, nextLineIndex: index }
374
+ }
375
+
301
376
  /** Locate the closing `---` line of a frontmatter block. */
302
377
  function findFrontmatterEnd(raw: string, start: number): number | undefined {
303
378
  let lineStart = start
@@ -346,15 +421,24 @@ function frontmatterBoolean(fields: Map<string, string>, key: string, dflt = fal
346
421
  /**
347
422
  * The WSL workspace skill provider. Registered on the host's `ctx.skills`
348
423
  * registry; serves only lookups whose cwd is a WSL UNC workspace path.
424
+ *
425
+ * Completed `list()` lookups are cached per scan root for CACHE_TTL_MS so
426
+ * repeated catalog builds over the slow 9P share do not rescan the tree;
427
+ * `get()` always re-reads the skill file so body edits are picked up
428
+ * immediately. `control.invalidate` remains reserved for host-driven
429
+ * invalidation; the provider self-invalidates through the TTL.
349
430
  */
350
431
  export class WslSkillsProvider {
351
432
  readonly name = 'wsl-workspace'
352
433
  private readonly control: WslSkillProviderControl
353
434
  private readonly io: WslSkillIo
435
+ private readonly now: () => number
436
+ private readonly cache = new Map<string, { expiresAt: number; candidates: WslSkillCandidate[] }>()
354
437
 
355
- constructor(control: WslSkillProviderControl, io: WslSkillIo = nodeSkillIo) {
438
+ constructor(control: WslSkillProviderControl, io: WslSkillIo = nodeSkillIo, now: () => number = Date.now) {
356
439
  this.control = control
357
440
  this.io = io
441
+ this.now = now
358
442
  }
359
443
 
360
444
  /**
@@ -375,14 +459,28 @@ export class WslSkillsProvider {
375
459
  // Without a `.git` ancestor the session cwd itself is the scan root (the
376
460
  // issue #10 workspace layout).
377
461
  const scanRoot = (await nearestGitAncestor(unc.distro, unc.linuxPath, this.io)) ?? unc.linuxPath
462
+ const cacheKey = `${unc.distro}\u0000${scanRoot}`
463
+ const cached = this.cache.get(cacheKey)
464
+ if (cached !== undefined && cached.expiresAt > this.now()) {
465
+ this.cache.delete(cacheKey)
466
+ this.cache.set(cacheKey, cached)
467
+ return [...cached.candidates]
468
+ }
378
469
  const roots = await discoverSkillRoots(unc.distro, scanRoot, this.io)
379
470
  const candidates: WslSkillCandidate[] = []
471
+ const seenSkills = new Set<string>()
380
472
  for (const root of roots) {
381
473
  const entries = await listSkillEntries(root, this.io)
382
474
  for (const entry of entries) {
383
475
  options.signal?.throwIfAborted()
384
476
  const parsed = await readSkill(entry.path, this.io, options.signal)
385
477
  if (parsed === undefined) continue
478
+ // A project reachable through both its real path and a directory
479
+ // symlink yields aliasing roots whose locators differ; publish each
480
+ // distinct (name, body) once so the catalog shows no duplicates.
481
+ const fingerprint = `${parsed.name}\u0000${parsed.content}`
482
+ if (seenSkills.has(fingerprint)) continue
483
+ seenSkills.add(fingerprint)
386
484
  candidates.push({
387
485
  name: parsed.name,
388
486
  description: parsed.description,
@@ -401,6 +499,12 @@ export class WslSkillsProvider {
401
499
  })
402
500
  }
403
501
  }
502
+ this.cache.set(cacheKey, { expiresAt: this.now() + CACHE_TTL_MS, candidates })
503
+ while (this.cache.size > CACHE_MAX_ENTRIES) {
504
+ const oldest = this.cache.keys().next().value
505
+ if (oldest === undefined) break
506
+ this.cache.delete(oldest)
507
+ }
404
508
  return candidates
405
509
  }
406
510
 
@@ -1 +0,0 @@
1
- {"version":3,"file":"wsl-C5_mxGPM.js","names":[],"sources":["../src/shared/paths.ts","../src/shared/wsl.ts"],"sourcesContent":["/**\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","/**\n * WSL discovery helpers (host side): enumerate installed distributions\n * through `wsl.exe -l -q` and read the default distribution from the Lxss\n * registry key. `wsl.exe` output is UTF-16LE on most builds, so decoding\n * sniffs for NUL bytes before choosing an encoding.\n * @module dsh-wsl-workspace/shared/wsl\n */\n\nimport { execFile, execFileSync } from 'node:child_process'\nimport { promisify } from 'node:util'\n\nconst execFileAsync = promisify(execFile)\n\n/** Executable timeout for the short discovery calls. */\nconst DISCOVERY_TIMEOUT_MS = 10_000\n\nconst LXSS_KEY = 'HKCU\\\\Software\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Lxss'\n\n/** Human text for an unknown rejection. */\nfunction messageOf(value: unknown): string {\n return value instanceof Error ? value.message : String(value)\n}\n\n/**\n * Decode `wsl.exe -l -q` output. Newer builds emit UTF-8; most emit UTF-16LE\n * with NUL bytes interleaved — the NUL probe picks the right one.\n * @param buffer - the raw captured output.\n * @returns the decoded text.\n */\nexport function decodeWslOutput(buffer: Buffer): string {\n return buffer.includes(0) ? buffer.toString('utf16le') : buffer.toString('utf8')\n}\n\n/**\n * List installed WSL distributions in `wsl.exe` order.\n * @param wslPath - the `wsl.exe` executable (absolute or PATH name).\n * @returns distribution names, blank lines dropped.\n */\nexport async function listDistros(wslPath = 'wsl.exe'): Promise<string[]> {\n let stdout: Buffer\n try {\n const result = await execFileAsync(wslPath, ['-l', '-q'], { encoding: 'buffer', timeout: DISCOVERY_TIMEOUT_MS })\n stdout = result.stdout as Buffer\n } catch (error) {\n throw new Error(`wsl-workspace: cannot list WSL distributions (${messageOf(error)}); is WSL installed?`)\n }\n return decodeWslOutput(stdout)\n .split(/\\r?\\n/)\n .map(line => line.trim())\n .filter(line => line.length > 0)\n}\n\n/**\n * Read the user's default distribution from the Lxss registry. Non-fatal:\n * returns `undefined` when the value is absent or unreadable (the caller\n * falls back to list order).\n * @returns the default distribution name, or `undefined`.\n */\nexport async function defaultDistro(): Promise<string | undefined> {\n try {\n const value = await execFileAsync('reg.exe', ['query', LXSS_KEY, '/v', 'DefaultDistribution'], {\n timeout: DISCOVERY_TIMEOUT_MS,\n })\n const guid = /DefaultDistribution\\s+REG_SZ\\s+(\\{[0-9a-fA-F-]+\\})/i.exec(value.stdout)?.[1]\n if (guid === undefined) return undefined\n const name = await execFileAsync('reg.exe', ['query', `${LXSS_KEY}\\\\${guid}`, '/v', 'DistributionName'], {\n timeout: DISCOVERY_TIMEOUT_MS,\n })\n const distro = /DistributionName\\s+REG_SZ\\s+(.+)/i.exec(name.stdout)?.[1]?.trim()\n return distro === undefined || distro === '' ? undefined : distro\n } catch {\n return undefined\n }\n}\n\n/** Module-level cache for {@link defaultDistroSync} (one registry read per process). */\nlet syncDefaultResolved = false\nlet syncDefault: string | undefined\n\n/**\n * Synchronous variant of {@link defaultDistro} for executors that must\n * resolve a distribution inside a synchronous plan step. Cached after the\n * first read; non-fatal (returns `undefined` when the registry is\n * unreadable, letting the caller fail loud with its own message).\n * @returns the default distribution name, or `undefined`.\n */\nexport function defaultDistroSync(): string | undefined {\n if (syncDefaultResolved) return syncDefault\n syncDefaultResolved = true\n try {\n const value = execFileSync('reg.exe', ['query', LXSS_KEY, '/v', 'DefaultDistribution'], {\n timeout: DISCOVERY_TIMEOUT_MS,\n })\n const guid = /DefaultDistribution\\s+REG_SZ\\s+(\\{[0-9a-fA-F-]+\\})/i.exec(String(value))?.[1]\n if (guid === undefined) return undefined\n const name = execFileSync('reg.exe', ['query', `${LXSS_KEY}\\\\${guid}`, '/v', 'DistributionName'], {\n timeout: DISCOVERY_TIMEOUT_MS,\n })\n const distro = /DistributionName\\s+REG_SZ\\s+(.+)/i.exec(String(name))?.[1]?.trim()\n syncDefault = distro === undefined || distro === '' ? undefined : distro\n } catch {\n syncDefault = undefined\n }\n return syncDefault\n}\n"],"mappings":";;;;AAWA,MAAM,YAAY,CAAC,iBAAoB,MAAe;;;;;;;;AAiBtD,SAAgB,YAAY,KAAkC;CAC5D,MAAM,aAAa,IAAI,QAAQ,OAAO,GAAG,CAAC,CAAC,QAAQ,UAAU,IAAI;CACjE,IAAI,CAAC,WAAW,WAAW,IAAI,GAAG,OAAO;CACzC,MAAM,WAAW,WAAW,MAAM,CAAC,CAAC,CAAC,MAAM,GAAG;CAC9C,MAAM,QAAQ,SAAS,MAAM,GAAA,CAAI,YAAY;CAC7C,IAAI,CAAC,UAAU,SAAS,IAAI,GAAG,OAAO;CACtC,MAAM,SAAS,SAAS,MAAM;CAC9B,IAAI,WAAW,IAAI,OAAO;CAE1B,OAAO;EAAE;EAAQ,WAAW,IADf,SAAS,MAAM,CAAC,CAAC,CAAC,QAAO,YAAW,QAAQ,SAAS,CAC/B,CAAC,CAAC,KAAK,GAAG;CAAI;AACnD;;;;;;;AAiCA,SAAgB,mBAAmB,MAAsB;CACvD,MAAM,YAAY,KAAK,QAAQ,QAAQ,GAAG;CAC1C,OAAO,cAAc,MAAM,MAAM,UAAU,QAAQ,OAAO,EAAE;AAC9D;;;;;;AAOA,SAAgB,oBAAoB,MAAuB;CACzD,OAAO,KAAK,WAAW,GAAG,KAAK,CAAC,KAAK,SAAS,IAAI;AACpD;;;;;;;;AASA,SAAgB,QAAQ,QAAgB,WAA2B;CACjE,IAAI,CAAC,oBAAoB,SAAS,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,qBACX,CAAC;EACD,MAAM,SAAS,oCAAoC,KAAK,KAAK,MAAM,CAAC,GAAG,EAAE,EAAE,KAAK;EAChF,OAAO,WAAW,KAAA,KAAa,WAAW,KAAK,KAAA,IAAY;CAC7D,QAAQ;EACN;CACF;AACF;;AAGA,IAAI,sBAAsB;AAC1B,IAAI;;;;;;;;AASJ,SAAgB,oBAAwC;CACtD,IAAI,qBAAqB,OAAO;CAChC,sBAAsB;CACtB,IAAI;EACF,MAAM,QAAQ,aAAa,WAAW;GAAC;GAAS;GAAU;GAAM;EAAqB,GAAG,EACtF,SAAS,qBACX,CAAC;EACD,MAAM,OAAO,sDAAsD,KAAK,OAAO,KAAK,CAAC,CAAC,GAAG;EACzF,IAAI,SAAS,KAAA,GAAW,OAAO,KAAA;EAC/B,MAAM,OAAO,aAAa,WAAW;GAAC;GAAS,GAAG,SAAS,IAAI;GAAQ;GAAM;EAAkB,GAAG,EAChG,SAAS,qBACX,CAAC;EACD,MAAM,SAAS,oCAAoC,KAAK,OAAO,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,KAAK;EACjF,cAAc,WAAW,KAAA,KAAa,WAAW,KAAK,KAAA,IAAY;CACpE,QAAQ;EACN,cAAc,KAAA;CAChB;CACA,OAAO;AACT"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"wsl-credentials-BI4v5TNZ.js","names":[],"sources":["../src/shared/wsl-credentials.ts"],"sourcesContent":["/**\r\n * Per-workspace WSL credentials (host side only). The dialog stores the\r\n * optional Linux username of a WSL workspace under the harness home; the\r\n * per-session env contributor and the WSL shell executor read it back so\r\n * `wsl.exe -u <username>` can run commands as that user. Keys are canonical\r\n * UNC workspace paths. This module touches node builtins, so the browser\r\n * half never imports it.\r\n * @module dsh-wsl-workspace/shared/wsl-credentials\r\n */\r\n\r\nimport { mkdirSync, readFileSync, writeFileSync } from 'node:fs'\r\nimport { homedir } from 'node:os'\r\nimport { dirname, join } from 'node:path'\r\nimport { canonicalWindowsPath, isValidWslUsername, joinUnc, parseWslUnc } from './paths.ts'\r\n\r\n/** One workspace's stored credentials. */\r\ninterface WorkspaceEntry {\r\n /** The Linux user bash runs as inside the distribution (absent = distro default). */\r\n username?: string\r\n /**\r\n * The WSL distribution of a Windows-drive workspace (`/mnt/<drive>` path).\r\n * 9P cannot serve drvfs mounts, so such workspaces register under their\r\n * Windows drive path; this entry is what the per-session env contributor\r\n * uses to hand a distro to the shell executor.\r\n */\r\n distro?: string\r\n}\r\n\r\n/** The stored form: canonical UNC or Windows drive workspace path → credentials. */\r\ntype WorkspaceStore = Record<string, WorkspaceEntry>\r\n\r\n/** The store file lives under the harness home so both host halves share it. */\r\nfunction storePath(): string {\r\n const dshHome = process.env.DSH_HOME ?? join(homedir(), '.dsh')\r\n return join(dshHome, 'wsl-workspaces.json')\r\n}\r\n\r\n/** Read the store; a missing or corrupt file reads as empty (never throws). */\r\nfunction readStore(): WorkspaceStore {\r\n try {\r\n const parsed: unknown = JSON.parse(readFileSync(storePath(), 'utf8'))\r\n if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) return {}\r\n return parsed as WorkspaceStore\r\n } catch {\r\n return {}\r\n }\r\n}\r\n\r\n/**\r\n * Canonicalize any accepted WSL UNC spelling into the store's key form.\r\n * @param path - candidate workspace path (either UNC host form).\r\n * @returns the canonical UNC path, or null when the path is not a WSL UNC.\r\n */\r\nexport function canonicalWslUnc(path: string): string | null {\r\n const parsed = parseWslUnc(path)\r\n return parsed === null ? null : joinUnc(parsed.distro, parsed.linuxPath)\r\n}\r\n\r\n/**\r\n * Read the stored username for a WSL workspace.\r\n * @param uncPath - the workspace path (any accepted WSL UNC spelling).\r\n * @returns the username, or undefined when none is stored.\r\n */\r\nexport function getWorkspaceUsername(uncPath: string): string | undefined {\r\n const key = canonicalWslUnc(uncPath)\r\n if (key === null) return undefined\r\n const username = readStore()[key]?.username\r\n return username === undefined || username === '' ? undefined : username\r\n}\r\n\r\n/**\r\n * Store (or clear) the username of a WSL workspace.\r\n * @param uncPath - the workspace path (any accepted WSL UNC spelling).\r\n * @param username - the username; empty or undefined clears the stored value.\r\n */\r\nexport function setWorkspaceUsername(uncPath: string, username: string | undefined): void {\r\n const key = canonicalWslUnc(uncPath)\r\n if (key === null) throw new Error('wsl-workspace: workspace path is not a WSL UNC path')\r\n const store = readStore()\r\n if (username === undefined || username.trim() === '') {\r\n delete store[key]\r\n } else {\r\n const trimmed = username.trim()\r\n if (!isValidWslUsername(trimmed)) {\r\n throw new Error('wsl-workspace: username must match the Linux username pattern [A-Za-z_][A-Za-z0-9_.-]*')\r\n }\r\n store[key] = { username: trimmed }\r\n }\r\n const path = storePath()\r\n mkdirSync(dirname(path), { recursive: true })\r\n writeFileSync(path, JSON.stringify(store, null, 2) + '\\n', 'utf8')\r\n}\r\n\r\n/**\r\n * Register the WSL distribution (and optional Linux username) of a\r\n * Windows-drive workspace (`/mnt/<drive>` path). Keys are canonical Windows\r\n * drive paths; the per-session env contributor reads the entry back so\r\n * `wsl.exe -d <distro>` can run when the session cwd is a drive path.\r\n * @param winPath - the Windows drive path (any spelling).\r\n * @param distro - the WSL distribution the workspace belongs to.\r\n * @param username - optional Linux username (distro default when absent).\r\n */\r\nexport function registerWindowsWorkspace(winPath: string, distro: string, username: string | undefined): void {\r\n const key = canonicalWindowsPath(winPath)\r\n if (key === null) throw new Error('wsl-workspace: workspace path is not a Windows drive path')\r\n const entry: WorkspaceEntry = { distro }\r\n if (username !== undefined && username.trim() !== '') {\r\n const trimmed = username.trim()\r\n if (!isValidWslUsername(trimmed)) {\r\n throw new Error('wsl-workspace: username must match the Linux username pattern [A-Za-z_][A-Za-z0-9_.-]*')\r\n }\r\n entry.username = trimmed\r\n }\r\n const store = readStore()\r\n store[key] = entry\r\n const path = storePath()\r\n mkdirSync(dirname(path), { recursive: true })\r\n writeFileSync(path, JSON.stringify(store, null, 2) + '\\n', 'utf8')\r\n}\r\n\r\n/**\r\n * Read the stored credentials of a Windows-drive workspace.\r\n * @param winPath - the Windows drive path (any spelling).\r\n * @returns the stored entry, or undefined when none is registered.\r\n */\r\nexport function getWindowsWorkspace(winPath: string): WorkspaceEntry | undefined {\r\n const key = canonicalWindowsPath(winPath)\r\n if (key === null) return undefined\r\n return readStore()[key]\r\n}\r\n\r\n/** Every stored workspace key (canonical UNC and Windows drive paths). */\r\nexport function listWorkspaceKeys(): string[] {\r\n return Object.keys(readStore())\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;AAgCA,SAAS,YAAoB;CAE3B,OAAO,KADS,QAAQ,IAAI,YAAY,KAAK,QAAQ,GAAG,MAAM,GACzC,qBAAqB;AAC5C;;AAGA,SAAS,YAA4B;CACnC,IAAI;EACF,MAAM,SAAkB,KAAK,MAAM,aAAa,UAAU,GAAG,MAAM,CAAC;EACpE,IAAI,WAAW,QAAQ,OAAO,WAAW,YAAY,MAAM,QAAQ,MAAM,GAAG,OAAO,CAAC;EACpF,OAAO;CACT,QAAQ;EACN,OAAO,CAAC;CACV;AACF;;;;;;AAOA,SAAgB,gBAAgB,MAA6B;CAC3D,MAAM,SAAS,YAAY,IAAI;CAC/B,OAAO,WAAW,OAAO,OAAO,QAAQ,OAAO,QAAQ,OAAO,SAAS;AACzE;;;;;;AAOA,SAAgB,qBAAqB,SAAqC;CACxE,MAAM,MAAM,gBAAgB,OAAO;CACnC,IAAI,QAAQ,MAAM,OAAO,KAAA;CACzB,MAAM,WAAW,UAAU,CAAC,CAAC,IAAI,EAAE;CACnC,OAAO,aAAa,KAAA,KAAa,aAAa,KAAK,KAAA,IAAY;AACjE;;;;;;AAOA,SAAgB,qBAAqB,SAAiB,UAAoC;CACxF,MAAM,MAAM,gBAAgB,OAAO;CACnC,IAAI,QAAQ,MAAM,MAAM,IAAI,MAAM,qDAAqD;CACvF,MAAM,QAAQ,UAAU;CACxB,IAAI,aAAa,KAAA,KAAa,SAAS,KAAK,MAAM,IAChD,OAAO,MAAM;MACR;EACL,MAAM,UAAU,SAAS,KAAK;EAC9B,IAAI,CAAC,mBAAmB,OAA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