dsh-plugin-wsl-env 0.29.0 → 0.29.1

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.
Files changed (78) hide show
  1. package/CHANGELOG.md +342 -0
  2. package/CONTRIBUTING.md +68 -12
  3. package/CONTRIBUTING.zh.md +34 -4
  4. package/README.md +1 -1
  5. package/agent/native/linux-aarch64/dsh-wsl-agent +0 -0
  6. package/agent/native/linux-x86_64/dsh-wsl-agent +0 -0
  7. package/agent/wsl-agent.sh +15 -4
  8. package/client.js +454 -110
  9. package/cordis.patch.yml +28 -7
  10. package/docs/AGENT-PROTOCOL-V7.md +4 -2
  11. package/docs/ARCHITECTURE.md +3 -1
  12. package/docs/ARCHITECTURE.zh.md +3 -1
  13. package/docs/COMPATIBILITY.md +1 -1
  14. package/docs/COMPATIBILITY.zh.md +1 -1
  15. package/docs/CONFIGURATION.md +19 -7
  16. package/docs/CONFIGURATION.zh.md +13 -5
  17. package/docs/DIAGNOSTICS.md +31 -5
  18. package/docs/DIAGNOSTICS.zh.md +22 -5
  19. package/docs/LIMITATIONS.md +65 -6
  20. package/docs/LIMITATIONS.zh.md +51 -6
  21. package/docs/PERFORMANCE.md +29 -1
  22. package/docs/PERFORMANCE.zh.md +23 -1
  23. package/docs/QUICKSTART.md +1 -1
  24. package/docs/QUICKSTART.zh.md +1 -1
  25. package/docs/README.zh.md +1 -1
  26. package/docs/RELEASING.md +29 -6
  27. package/docs/RELEASING.zh.md +9 -0
  28. package/docs/adr/0002-native-agent.md +50 -2
  29. package/lib/agent-confined.js +15 -4
  30. package/lib/agent-errors.d.ts +16 -0
  31. package/lib/agent-errors.js +19 -0
  32. package/lib/agent-exec.d.ts +8 -1
  33. package/lib/agent-exec.js +2 -1
  34. package/lib/agent-shared.d.ts +85 -2
  35. package/lib/agent-shared.js +167 -38
  36. package/lib/agent.d.ts +60 -6
  37. package/lib/agent.js +177 -28
  38. package/lib/auto-preset.js +7 -2
  39. package/lib/doctor-live.d.ts +36 -7
  40. package/lib/doctor-live.js +61 -12
  41. package/lib/doctor-process.d.ts +68 -0
  42. package/lib/doctor-process.js +139 -0
  43. package/lib/doctor-report.js +11 -109
  44. package/lib/fs-substrate.js +3 -3
  45. package/lib/fsio-agent.d.ts +57 -6
  46. package/lib/fsio-agent.js +168 -75
  47. package/lib/git-exec.d.ts +7 -1
  48. package/lib/git-exec.js +14 -2
  49. package/lib/native-agent.d.ts +25 -4
  50. package/lib/native-agent.js +52 -9
  51. package/lib/picker.d.ts +2 -1
  52. package/lib/picker.js +30 -13
  53. package/lib/plugin-update.js +18 -14
  54. package/lib/provider-common.d.ts +112 -0
  55. package/lib/provider-common.js +171 -0
  56. package/lib/sandbox-core.js +52 -13
  57. package/lib/search-exec.d.ts +6 -0
  58. package/lib/search-exec.js +10 -2
  59. package/lib/session-runtime.d.ts +46 -1
  60. package/lib/session-runtime.js +57 -7
  61. package/lib/session-scope.d.ts +22 -1
  62. package/lib/session-scope.js +33 -7
  63. package/lib/shell-env.js +125 -12
  64. package/lib/socket-isolation.d.ts +12 -4
  65. package/lib/socket-isolation.js +27 -10
  66. package/lib/status.js +53 -4
  67. package/lib/subprocess.js +3 -3
  68. package/lib/terminal-activity.js +6 -9
  69. package/lib/wsl-doctor-command.js +36 -80
  70. package/lib/wsl-filesystem.d.ts +9 -4
  71. package/lib/wsl-filesystem.js +26 -10
  72. package/lib/wsl-shell.d.ts +27 -17
  73. package/lib/wsl-shell.js +83 -24
  74. package/lib/wsl.d.ts +3 -1
  75. package/lib/wsl.js +82 -7
  76. package/package.json +5 -4
  77. package/scripts/bootstrap.sh +36 -12
  78. package/scripts/doctor.mjs +514 -201
package/lib/wsl.js CHANGED
@@ -155,19 +155,92 @@ export async function defaultDistro(options = {}) {
155
155
  }
156
156
  return first;
157
157
  }
158
+ /**
159
+ * Successful probe answers shared by every caller in this process, keyed by
160
+ * `(wslPath, distro)`. A distro's home and login shell do not change while DSH
161
+ * runs, and six call sites used to spend a `wsl.exe` round trip each on the
162
+ * same two questions. Only success is remembered: a failed probe stays
163
+ * retryable, as the shell executor's own contract requires.
164
+ */
165
+ const homeProbes = new Map();
166
+ const shellProbes = new Map();
167
+ /** Key for both probe caches; the `wslPath` is part of it so overrides do not alias. */
168
+ function probeKey(wslPath, distro) {
169
+ return `${wslPath}\u0000${distro}`;
170
+ }
171
+ /**
172
+ * Reject with the caller's own abort reason without settling the shared probe:
173
+ * one caller cancelling must not turn another caller's answer into a failure.
174
+ *
175
+ * @param pending - the shared probe.
176
+ * @param signal - the caller's lifetime.
177
+ * @returns the probe's answer, or a rejection when the caller aborts first.
178
+ */
179
+ function raceProbeAbort(pending, signal) {
180
+ if (signal === undefined)
181
+ return pending;
182
+ return new Promise((resolvePromise, rejectPromise) => {
183
+ if (signal.aborted) {
184
+ rejectPromise(signal.reason ?? new Error("aborted"));
185
+ return;
186
+ }
187
+ const onAbort = () => {
188
+ rejectPromise(signal.reason ?? new Error("aborted"));
189
+ };
190
+ signal.addEventListener("abort", onAbort, { once: true });
191
+ pending.then((value) => {
192
+ signal.removeEventListener("abort", onAbort);
193
+ resolvePromise(value);
194
+ }, (error) => {
195
+ signal.removeEventListener("abort", onAbort);
196
+ rejectPromise(error);
197
+ });
198
+ });
199
+ }
200
+ /**
201
+ * Run one probe through a process-level cache with single-flight: concurrent
202
+ * callers share the in-flight `wsl.exe` call, and a settled answer is kept only
203
+ * when `keep` says so.
204
+ *
205
+ * @param cache - the probe's cache.
206
+ * @param key - the distro/transport key.
207
+ * @param probe - starts the probe when no one else has.
208
+ * @param keep - whether a settled answer is worth remembering.
209
+ * @param signal - the caller's lifetime.
210
+ * @returns the probe's answer.
211
+ */
212
+ function sharedProbe(cache, key, probe, keep, signal) {
213
+ let pending = cache.get(key);
214
+ if (pending === undefined) {
215
+ pending = probe();
216
+ cache.set(key, pending);
217
+ pending.then((value) => {
218
+ if (!keep(value))
219
+ cache.delete(key);
220
+ }, () => {
221
+ cache.delete(key);
222
+ });
223
+ }
224
+ return raceProbeAbort(pending, signal);
225
+ }
226
+ /** Test hook: forget the shared home and shell probes. */
227
+ export function resetWslProbeCacheForTests() {
228
+ homeProbes.clear();
229
+ shellProbes.clear();
230
+ }
158
231
  /**
159
232
  * The Linux home directory of a distro's default user, as a Linux path. `$HOME`
160
233
  * is set by `wsl.exe` itself from the distro's default user, so this needs no
161
- * passwd parsing.
234
+ * passwd parsing. Resolved once per `(wslPath, distro)` per process.
162
235
  *
163
236
  * @param distro - distro name.
164
237
  * @param options - the `wsl.exe` path and optional cancellation.
165
238
  * @returns e.g. `/home/andy`.
166
239
  * @throws when the distro cannot be queried or reports no home.
167
240
  */
168
- export async function linuxHomePath(distro, options = {}) {
169
- const stdout = await runCapture([options.wslPath ?? DEFAULT_WSL_PATH, "-d", distro, "--exec", "sh", "-c", 'printf %s "$HOME"'], options.signal);
170
- return parseHomePath(distro, stdout);
241
+ export function linuxHomePath(distro, options = {}) {
242
+ const wslPath = options.wslPath ?? DEFAULT_WSL_PATH;
243
+ return sharedProbe(homeProbes, probeKey(wslPath, distro), async () => parseHomePath(distro, await runCapture([wslPath, "-d", distro, "--exec", "sh", "-c", 'printf %s "$HOME"'], options.signal)), () => true, options.signal);
171
244
  }
172
245
  /**
173
246
  * Validate the distro's reported $HOME. A pure seam: the failure shapes
@@ -390,8 +463,10 @@ export async function defaultShell(distro, options = {}) {
390
463
  // No "bash" placeholder: a failed probe (a cold distro, a flaky first
391
464
  // `wsl.exe` call) used to be pinned as the literal shell for the
392
465
  // executor's lifetime. `undefined` tells the caller both answers failed;
393
- // it may retry later or fall back itself.
394
- return ((await ask('getent passwd "$(id -u)" | cut -d: -f7')) ??
466
+ // it may retry later or fall back itself. The shared cache keeps a
467
+ // confirmed answer and drops an unresolved one, so that retry can still
468
+ // happen.
469
+ return sharedProbe(shellProbes, probeKey(wslPath, distro), async () => ((await ask('getent passwd "$(id -u)" | cut -d: -f7')) ??
395
470
  (await ask('printf %s "$SHELL"')) ??
396
- undefined);
471
+ undefined), (value) => value !== undefined, options.signal);
397
472
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-wsl-env",
3
- "version": "0.29.0",
3
+ "version": "0.29.1",
4
4
  "description": "在 WSL 的 Linux 实例中打开项目工作区,在对应 Linux 空间中进行命令执行、运行 shell 脚本和文件访问,以获得全套 Linux Shell 工具链收益,并通过 bubblewrap 对命令进行沙箱隔离",
5
5
  "keywords": [
6
6
  "deepseek-harness",
@@ -219,10 +219,10 @@
219
219
  "lint:types": "tsc --noEmit",
220
220
  "build": "node scripts/build.mjs",
221
221
  "lint:build": "node test/build-freshness.mjs",
222
- "test:browser": "node --test --test-timeout=120000 test/browser/e2e.test.mjs",
223
- "test:coverage": "node scripts/coverage-gate.mjs -- node --test --test-timeout=60000 --experimental-test-coverage --test-coverage-lines=85 --test-coverage-branches=84 --test-coverage-functions=70 --test-coverage-exclude='scripts/**' --test-coverage-exclude='test/**' test/agent-exec.test.mjs test/agent-fs-script.test.mjs test/agent-protocol.test.mjs test/agent.test.mjs test/fs-substrate.test.mjs test/fs.boot.test.mjs test/composition.test.mjs test/bundle-mount.test.mjs test/hot-swap.test.mjs test/takeover-report.test.mjs test/provider.test.mjs test/provider-takeover.test.mjs test/file-reference-wsl.test.mjs test/fsio-agent.test.mjs test/fsio-text.test.mjs test/git-exec.test.mjs test/git-route.test.mjs test/listing.test.mjs test/paths.test.mjs test/ports.test.mjs test/preset-choice.test.mjs test/auto-preset.test.mjs test/probe-cache.test.mjs test/writable-roots.test.mjs test/preflight.test.mjs test/sandbox.test.mjs test/socket-isolation.test.mjs test/search-exec.test.mjs test/search-route.test.mjs test/shell.test.mjs test/shell-env.test.mjs test/terminal-activity.test.mjs test/terminal.test.mjs test/watcher.test.mjs test/wsl.test.mjs test/fs-decisions.test.mjs test/session-scope.test.mjs test/session-runtime.test.mjs test/native-agent.test.mjs test/peers.test.mjs test/agent-shared.test.mjs test/distro-route.test.mjs test/fs-routing.test.mjs test/update-check.test.mjs test/plugin-update.test.mjs test/doctor.test.mjs test/doctor-collector.test.mjs test/release-scripts.test.mjs test/profile-preset.test.mjs test/packaging.test.mjs test/peer-canary.test.mjs test/probe-runner.test.mjs test/cwd-prompt.test.mjs test/cwd-prompt-tool.test.mjs test/wsl-doctor-tool.test.mjs test/wsl-doctor-command.test.mjs test/status.test.mjs test/client-host.test.mjs test/messages.test.mjs test/locales-examples.test.mjs test/client.test.mjs test/open-in-app.test.mjs test/cloud-wsl-gate.test.mjs test/official-harness-smoke.test.mjs",
222
+ "test:browser": "node --test --test-timeout=240000 test/browser/e2e.test.mjs",
223
+ "test:coverage": "node scripts/coverage-gate.mjs -- node --test --test-timeout=240000 --experimental-test-coverage --test-coverage-lines=85 --test-coverage-branches=84 --test-coverage-functions=70 --test-coverage-exclude='scripts/build.mjs' --test-coverage-exclude='scripts/changelog-section.mjs' --test-coverage-exclude='scripts/check-doc-consistency.mjs' --test-coverage-exclude='scripts/check-links.mjs' --test-coverage-exclude='scripts/check-requirements.mjs' --test-coverage-exclude='scripts/coverage-gate.mjs' --test-coverage-exclude='scripts/doctor.mjs' --test-coverage-exclude='scripts/native-wiring-check.mjs' --test-coverage-exclude='scripts/test-watchdog.mjs' --test-coverage-exclude='test/**' test/agent-exec.test.mjs test/agent-fs-script.test.mjs test/agent-protocol.test.mjs test/agent.test.mjs test/fs-substrate.test.mjs test/fs.boot.test.mjs test/composition.test.mjs test/bundle-mount.test.mjs test/hot-swap.test.mjs test/takeover-report.test.mjs test/provider.test.mjs test/provider-takeover.test.mjs test/file-reference-wsl.test.mjs test/fsio-agent.test.mjs test/fsio-text.test.mjs test/git-exec.test.mjs test/git-route.test.mjs test/listing.test.mjs test/paths.test.mjs test/ports.test.mjs test/preset-choice.test.mjs test/auto-preset.test.mjs test/probe-cache.test.mjs test/writable-roots.test.mjs test/preflight.test.mjs test/sandbox.test.mjs test/socket-isolation.test.mjs test/search-exec.test.mjs test/search-route.test.mjs test/shell.test.mjs test/shell-env.test.mjs test/terminal-activity.test.mjs test/terminal.test.mjs test/watcher.test.mjs test/wsl.test.mjs test/fs-decisions.test.mjs test/session-scope.test.mjs test/session-runtime.test.mjs test/native-agent.test.mjs test/peers.test.mjs test/agent-shared.test.mjs test/distro-route.test.mjs test/fs-routing.test.mjs test/update-check.test.mjs test/plugin-update.test.mjs test/doctor.test.mjs test/doctor-collector.test.mjs test/release-scripts.test.mjs test/profile-preset.test.mjs test/preset-sync.test.mjs test/packaging.test.mjs test/peer-canary.test.mjs test/probe-runner.test.mjs test/cwd-prompt.test.mjs test/cwd-prompt-tool.test.mjs test/wsl-doctor-tool.test.mjs test/wsl-doctor-command.test.mjs test/status.test.mjs test/client-host.test.mjs test/messages.test.mjs test/locales-examples.test.mjs test/client.test.mjs test/open-in-app.test.mjs test/cloud-wsl-gate.test.mjs test/official-harness-smoke.test.mjs",
224
224
  "test:syntax": "node test/syntax.mjs",
225
- "test:unit": "node scripts/test-watchdog.mjs -- node --test --test-timeout=60000 test/fs.boot.test.mjs test/fsio-text.test.mjs test/composition.test.mjs test/bundle-mount.test.mjs test/hot-swap.test.mjs test/takeover-report.test.mjs test/provider.test.mjs test/provider-takeover.test.mjs test/file-reference-wsl.test.mjs test/paths.test.mjs test/listing.test.mjs test/shell.test.mjs test/shell-env.test.mjs test/terminal.test.mjs test/probe-cache.test.mjs test/writable-roots.test.mjs test/preflight.test.mjs test/preset-choice.test.mjs test/auto-preset.test.mjs test/sandbox.test.mjs test/socket-isolation.test.mjs test/agent-protocol.test.mjs test/agent.test.mjs test/agent-fs-script.test.mjs test/fsio-agent.test.mjs test/fs-substrate.test.mjs test/agent-exec.test.mjs test/ports.test.mjs test/watcher.test.mjs test/wsl.test.mjs test/fs-decisions.test.mjs test/git-exec.test.mjs test/git-route.test.mjs test/search-route.test.mjs test/search-exec.test.mjs test/terminal-activity.test.mjs test/session-scope.test.mjs test/session-runtime.test.mjs test/native-agent.test.mjs test/peers.test.mjs test/agent-shared.test.mjs test/distro-route.test.mjs test/fs-routing.test.mjs test/update-check.test.mjs test/plugin-update.test.mjs test/doctor.test.mjs test/doctor-collector.test.mjs test/release-scripts.test.mjs test/profile-preset.test.mjs test/packaging.test.mjs test/peer-canary.test.mjs test/probe-runner.test.mjs test/cwd-prompt.test.mjs test/cwd-prompt-tool.test.mjs test/wsl-doctor-tool.test.mjs test/wsl-doctor-command.test.mjs test/status.test.mjs test/client-host.test.mjs test/messages.test.mjs test/locales-examples.test.mjs test/client.test.mjs test/open-in-app.test.mjs test/cloud-wsl-gate.test.mjs test/official-harness-smoke.test.mjs",
225
+ "test:unit": "node scripts/test-watchdog.mjs -- node --test --test-timeout=240000 test/fs.boot.test.mjs test/fsio-text.test.mjs test/composition.test.mjs test/bundle-mount.test.mjs test/hot-swap.test.mjs test/takeover-report.test.mjs test/provider.test.mjs test/provider-takeover.test.mjs test/file-reference-wsl.test.mjs test/paths.test.mjs test/listing.test.mjs test/shell.test.mjs test/shell-env.test.mjs test/terminal.test.mjs test/probe-cache.test.mjs test/writable-roots.test.mjs test/preflight.test.mjs test/preset-choice.test.mjs test/auto-preset.test.mjs test/sandbox.test.mjs test/socket-isolation.test.mjs test/agent-protocol.test.mjs test/agent.test.mjs test/agent-fs-script.test.mjs test/fsio-agent.test.mjs test/fs-substrate.test.mjs test/agent-exec.test.mjs test/ports.test.mjs test/watcher.test.mjs test/wsl.test.mjs test/fs-decisions.test.mjs test/git-exec.test.mjs test/git-route.test.mjs test/search-route.test.mjs test/search-exec.test.mjs test/terminal-activity.test.mjs test/session-scope.test.mjs test/session-runtime.test.mjs test/native-agent.test.mjs test/peers.test.mjs test/agent-shared.test.mjs test/distro-route.test.mjs test/fs-routing.test.mjs test/update-check.test.mjs test/plugin-update.test.mjs test/doctor.test.mjs test/doctor-collector.test.mjs test/release-scripts.test.mjs test/profile-preset.test.mjs test/preset-sync.test.mjs test/packaging.test.mjs test/peer-canary.test.mjs test/probe-runner.test.mjs test/cwd-prompt.test.mjs test/cwd-prompt-tool.test.mjs test/wsl-doctor-tool.test.mjs test/wsl-doctor-command.test.mjs test/status.test.mjs test/client-host.test.mjs test/messages.test.mjs test/locales-examples.test.mjs test/client.test.mjs test/open-in-app.test.mjs test/cloud-wsl-gate.test.mjs test/official-harness-smoke.test.mjs",
226
226
  "lint:style": "node test/style.mjs",
227
227
  "lint:links": "node scripts/check-links.mjs",
228
228
  "lint:requirements": "node scripts/check-requirements.mjs",
@@ -253,6 +253,7 @@
253
253
  "diagnose": "bash scripts/diagnose.sh",
254
254
  "doctor": "node scripts/doctor.mjs",
255
255
  "preset": "node scripts/profile-preset.mjs",
256
+ "preset:sync": "node scripts/preset-sync.mjs",
256
257
  "e2e:install": "bash test/e2e/install.sh",
257
258
  "canary:peers": "node scripts/peer-canary.mjs",
258
259
  "probe:auto-preset": "bash test/probe/auto-preset.sh",
@@ -10,7 +10,11 @@
10
10
  # The install runs as the distro's root through `wsl.exe -d <distro> -u root --`,
11
11
  # so it never touches the Windows side and never needs a sudo prompt inside the
12
12
  # distro. Without --install the script is strictly read-only: it reports and
13
- # prints the exact commands, runnable as-is.
13
+ # prints the exact command, runnable as-is. apt refreshes its package index
14
+ # first (a freshly installed Debian or Ubuntu has none); that command contains
15
+ # a `&&`, so every family's command runs through `sh -c "…"` and the printed
16
+ # line carries the same quotes — they keep the operator inside the distro when
17
+ # the line is pasted into cmd, PowerShell 5.1 or PowerShell 7.
14
18
  #
15
19
  # Exit status: 0 when everything REQUIRED is present (or was installed), 1 when
16
20
  # bubblewrap is still missing.
@@ -42,29 +46,47 @@ run_in_distro() {
42
46
  wsl.exe -d "$DISTRO" --exec sh -c "$1" sh "$2"
43
47
  }
44
48
 
45
- # The package family decides the install command; a distro with none reported
46
- # gets the apt spelling, which covers the default Ubuntu images.
49
+ # One spawn answers every pre-install question — the package family and the
50
+ # tools' presence — where six serial wsl.exe calls used to do it one each.
51
+ # FAMILY is emitted only when found; a distro with none reported keeps the apt
52
+ # spelling, which covers the default Ubuntu images.
53
+ FACTS="$(run_in_distro '
54
+ for f in apt-get dnf pacman zypper; do command -v "$f" >/dev/null 2>&1 && { echo "FAMILY=$f"; break; }; done
55
+ for t in bwrap rg git inotifywait; do
56
+ if p=$(command -v "$t" 2>/dev/null); then echo "TOOL $t $p"; else echo "MISSING $t"; fi
57
+ done
58
+ ' "")"
59
+
60
+ if [ -z "$FACTS" ]; then
61
+ echo "bootstrap: wsl.exe could not run a command in \"$DISTRO\"" >&2
62
+ exit 1
63
+ fi
64
+
47
65
  family() {
48
- run_in_distro 'for f in apt-get dnf pacman zypper; do command -v "$f" >/dev/null 2>&1 && { echo "$f"; exit 0; }; done; echo unknown' ""
66
+ printf '%s\n' "$FACTS" | sed -n 's/^FAMILY=//p' | head -n 1
49
67
  }
50
68
 
51
69
  install_command() {
52
70
  case "$(family)" in
53
- apt-get) echo 'apt-get install -y bubblewrap git ripgrep inotify-tools' ;;
54
71
  dnf) echo 'dnf install -y bubblewrap git ripgrep inotify-tools' ;;
55
- pacman) echo 'pacman -Sy --noconfirm bubblewrap git ripgrep inotify-tools' ;;
72
+ pacman) echo 'pacman -S --noconfirm --needed bubblewrap git ripgrep inotify-tools' ;;
56
73
  zypper) echo 'zypper --non-interactive install bubblewrap git ripgrep inotify-tools' ;;
57
- *) echo 'apt-get install -y bubblewrap git ripgrep inotify-tools' ;;
74
+ *) echo 'apt-get update -qq && apt-get install -y --no-install-recommends bubblewrap git ripgrep inotify-tools' ;;
58
75
  esac
59
76
  }
60
77
 
78
+ # The pre-install answers come from FACTS; only a post-install check re-probes.
79
+ tool_path() {
80
+ printf '%s\n' "$FACTS" | awk -v t="$1" '$1 == "TOOL" && $2 == t { print $3; exit }'
81
+ }
82
+
61
83
  present() {
62
84
  run_in_distro 'for t in "$@"; do command -v "$t" >/dev/null 2>&1 || exit 1; done' "$1"
63
85
  }
64
86
 
65
87
  report() {
66
88
  local label="$1" tool="$2"
67
- if run_in_distro "command -v $tool >/dev/null 2>&1" ""; then
89
+ if [ -n "$(tool_path "$tool")" ]; then
68
90
  echo "ok $label ($tool)"
69
91
  else
70
92
  echo "MISSING $label ($tool)"
@@ -74,10 +96,12 @@ report() {
74
96
  echo "distro: $DISTRO"
75
97
 
76
98
  BW_OK="yes"
77
- if present "bwrap"; then
99
+ if [ -z "$(tool_path bwrap)" ]; then
100
+ BW_OK="no"
101
+ fi
102
+ if [ "$BW_OK" = "yes" ]; then
78
103
  report "bubblewrap (required; commands fail closed without it)" "bwrap"
79
104
  else
80
- BW_OK="no"
81
105
  echo "MISSING bubblewrap (REQUIRED; every command fails closed without it)"
82
106
  fi
83
107
  report "ripgrep (in-distro search backend)" "rg"
@@ -87,7 +111,7 @@ report "inotifywait (watcher primary backend)" "inotifywait"
87
111
  CMD="$(install_command)"
88
112
  echo
89
113
  echo "install command:"
90
- echo " wsl.exe -d $DISTRO -u root -- $CMD"
114
+ echo " wsl.exe -d $DISTRO -u root -- sh -c \"$CMD\""
91
115
 
92
116
  if [ "$BW_OK" = "yes" ]; then
93
117
  echo
@@ -103,7 +127,7 @@ fi
103
127
 
104
128
  echo
105
129
  echo "installing..."
106
- wsl.exe -d "$DISTRO" -u root -- $CMD
130
+ wsl.exe -d "$DISTRO" -u root -- sh -c "$CMD"
107
131
 
108
132
  if present "bwrap"; then
109
133
  echo "bubblewrap installed successfully."