dsh-plugin-wsl-env 0.21.0 → 0.23.0
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/CHANGELOG.md +119 -0
- package/CONTRIBUTING.md +7 -3
- package/README.md +11 -9
- package/SUPPORT.md +1 -1
- package/client.js +153 -33
- package/cordis.patch.yml +13 -4
- package/docs/AGENT-PROTOCOL-V7.md +4 -4
- package/docs/API.md +12 -2
- package/docs/ARCHITECTURE.md +59 -19
- package/docs/CONFIGURATION.md +44 -13
- package/docs/CONFIGURATION.zh.md +44 -8
- package/docs/DIAGNOSTICS.md +41 -1
- package/docs/DIAGNOSTICS.zh.md +34 -2
- package/docs/LIMITATIONS.md +42 -17
- package/docs/LIMITATIONS.zh.md +47 -12
- package/docs/MIGRATION.md +1 -1
- package/docs/PEER-PARITY.md +8 -7
- package/docs/QUICKSTART.md +16 -8
- package/docs/QUICKSTART.zh.md +22 -4
- package/docs/README.zh.md +19 -10
- package/docs/RELEASING.md +8 -3
- package/docs/REQUIREMENTS.zh.md +11 -6
- package/docs/ROADMAP-1.0.md +12 -11
- package/docs/ROADMAP.md +10 -8
- package/docs/UPSTREAM-FILE-REFERENCE-SEAM.md +3 -2
- package/docs/UPSTREAM-FSIO-EXPORT.md +8 -9
- package/docs/UPSTREAM-SERVICE-SWAP.md +9 -5
- package/docs/UPSTREAM-TERMINAL-TITLE.md +9 -8
- package/docs/VALUE.zh.md +5 -5
- package/docs/root-fs-routing.md +26 -19
- package/lib/agent-confined.d.ts +2 -2
- package/lib/agent-confined.js +0 -1
- package/lib/agent-exec.d.ts +2 -11
- package/lib/agent-protocol.d.ts +6 -5
- package/lib/agent.d.ts +5 -5
- package/lib/auto-preset.d.ts +4 -3
- package/lib/bwrap.d.ts +2 -1
- package/lib/client-host.d.ts +1 -1
- package/lib/client-host.js +1 -1
- package/lib/cwd-prompt-tool.d.ts +4 -20
- package/lib/cwd-prompt.d.ts +11 -10
- package/lib/distro-route.d.ts +3 -2
- package/lib/doctor-live.d.ts +2 -1
- package/lib/fs-routing.d.ts +29 -1
- package/lib/fs-routing.js +30 -3
- package/lib/fs-substrate.d.ts +0 -1
- package/lib/fs-substrate.js +0 -1
- package/lib/fsio-agent.d.ts +3 -21
- package/lib/fsio-agent.js +2 -4
- package/lib/git-exec.d.ts +3 -2
- package/lib/git-route.d.ts +4 -2
- package/lib/git-route.js +4 -2
- package/lib/index.d.ts +20 -10
- package/lib/index.js +128 -12
- package/lib/listing.d.ts +2 -1
- package/lib/messages.d.ts +82 -1
- package/lib/messages.js +94 -1
- package/lib/native-agent.d.ts +3 -2
- package/lib/paths.d.ts +2 -1
- package/lib/picker.d.ts +1 -14
- package/lib/picker.js +1 -2
- package/lib/preflight.d.ts +5 -4
- package/lib/probe-cache.d.ts +2 -1
- package/lib/sandbox-core.d.ts +2 -11
- package/lib/sandbox-core.js +1 -1
- package/lib/sandbox.d.ts +0 -1
- package/lib/sandbox.js +0 -4
- package/lib/search-exec.d.ts +2 -1
- package/lib/session-runtime.d.ts +3 -2
- package/lib/shell-env.d.ts +3 -2
- package/lib/shell.d.ts +1 -1
- package/lib/shell.js +1 -1
- package/lib/subprocess.d.ts +1 -1
- package/lib/update-check.d.ts +3 -3
- package/lib/wsl-doctor-command.d.ts +133 -0
- package/lib/wsl-doctor-command.js +381 -0
- package/lib/wsl-doctor-tool.d.ts +101 -16
- package/lib/wsl-doctor-tool.js +290 -22
- package/lib/wsl.d.ts +3 -2
- package/locale/doctor/en.json +30 -0
- package/locale/doctor/zh.json +30 -0
- package/package.json +29 -31
- package/scripts/bootstrap-import.sh +189 -0
- package/scripts/doctor.mjs +569 -141
- package/scripts/open-wsl-vscode.ps1 +36 -0
- package/examples/preset-wsl-session-sandbox.cordis.patch.yml +0 -178
package/lib/messages.js
CHANGED
|
@@ -69,6 +69,39 @@ const en = {
|
|
|
69
69
|
workdirAnotherDistro: ({ workdir, distro }) => `"${workdir}" names a workspace in another WSL distro, and this profile pins its commands to "${distro}" — ` +
|
|
70
70
|
`running them here would act on a different machine's tree. Open a session in that distro, ` +
|
|
71
71
|
`or point cwd/workdir at this distro.`,
|
|
72
|
+
/** `wsl_doctor` digest: the verdict line. `verdict` is the report's own `ready`/`blocked`. */
|
|
73
|
+
doctorDigestVerdict: ({ verdict }) => `wsl doctor verdict: ${verdict}`,
|
|
74
|
+
/** `wsl_doctor` digest: the host-wide group heading. */
|
|
75
|
+
doctorDigestHostLabel: () => "(host — Windows and global checks)",
|
|
76
|
+
/** `wsl_doctor` digest: the heading for checks the run's scope never executed. */
|
|
77
|
+
doctorDigestNotRunLabel: () => "(not run in this scope)",
|
|
78
|
+
/** `wsl_doctor` digest: marks which distro group is the session's own. */
|
|
79
|
+
doctorDigestSessionLabel: ({ name }) => `${name} (this session's distro)`,
|
|
80
|
+
/** `wsl_doctor` digest: one summary line for the checks the run's scope never executed; `reason` says why (the run's scope profile). */
|
|
81
|
+
doctorDigestSkipRow: ({ n, reason, ids }) => `[SKIP] not run in this scope — ${reason} (${n}): ${ids}`,
|
|
82
|
+
/** `wsl_doctor` digest: the scope reason for a quick run's skip line. */
|
|
83
|
+
doctorSkipReasonQuick: () => "the quick profile covers first-command prerequisites only",
|
|
84
|
+
/** `wsl_doctor` digest: the scope reason for a section-filtered run's skip line. */
|
|
85
|
+
doctorSkipReasonSections: ({ sections }) => `the run covered only: ${sections}`,
|
|
86
|
+
/** `wsl_doctor` digest: the scope reason when the report recorded none. */
|
|
87
|
+
doctorSkipReasonGeneric: () => "no scope recorded for this report",
|
|
88
|
+
/** `wsl_doctor` digest: one line per check a failed prerequisite gated out; `reason` names the blocker. */
|
|
89
|
+
doctorSkipGated: ({ id, reason }) => `[SKIP] ${id} — skipped: ${reason}`,
|
|
90
|
+
/** `wsl_doctor` digest: per-group tallies, one entry per non-zero status. */
|
|
91
|
+
doctorTallyOk: ({ n }) => `${n} ok`,
|
|
92
|
+
doctorTallyWarn: ({ n }) => `${n} warn`,
|
|
93
|
+
doctorTallyFail: ({ n }) => `${n} fail`,
|
|
94
|
+
doctorTallyUnknown: ({ n }) => `${n} unknown`,
|
|
95
|
+
doctorTallyInfo: ({ n }) => `${n} info`,
|
|
96
|
+
doctorTallySkipped: ({ n }) => `${n} skipped`,
|
|
97
|
+
/** `wsl_doctor` digest: the remedy prefix under a failed check. */
|
|
98
|
+
doctorDigestFixPrefix: ({ remedy }) => ` fix: ${remedy}`,
|
|
99
|
+
/** `wsl_doctor` digest: the ready note (how to attach the full report). */
|
|
100
|
+
doctorDigestNoteReady: () => "the first command should succeed; run the CLI (pnpm run doctor --bundle <path>) for the attachable file",
|
|
101
|
+
/** `wsl_doctor` digest: the blocked note (the rerun is the re-verification). */
|
|
102
|
+
doctorDigestNoteBlocked: () => "apply each remedy above, then call this tool again — the re-run is the re-verification",
|
|
103
|
+
/** `wsl_doctor` digest: the blocked summary tail; `noneBlocking` is the fixed clause. */
|
|
104
|
+
doctorDigestBlockedTail: ({ blockers, warnings, skipped, note }) => `blocked by: ${blockers}; ${warnings} warning(s), ${skipped} skipped leg(s) — none blocking; ${note}`,
|
|
72
105
|
};
|
|
73
106
|
/** The Chinese catalog; the type keeps every key and parameter in step with `en`. */
|
|
74
107
|
const zh = {
|
|
@@ -94,6 +127,25 @@ const zh = {
|
|
|
94
127
|
`请创建该目录,或将 \`cwd\`(或请求的 \`workdir\`)指向一个已存在的目录。`,
|
|
95
128
|
workdirAnotherDistro: ({ workdir, distro }) => `"${workdir}" 指向另一个 WSL 发行版中的工作区,而本 profile 将命令固定在 "${distro}" —— ` +
|
|
96
129
|
`在这里运行会作用于另一台机器的目录树。请在该发行版中打开会话,或将 cwd/workdir 指向本发行版。`,
|
|
130
|
+
doctorDigestVerdict: ({ verdict }) => `wsl doctor 裁决:${verdict}`,
|
|
131
|
+
doctorDigestHostLabel: () => "(宿主——Windows 与全局检查)",
|
|
132
|
+
doctorDigestNotRunLabel: () => "(不在本次范围)",
|
|
133
|
+
doctorDigestSessionLabel: ({ name }) => `${name}(当前会话的 distro)`,
|
|
134
|
+
doctorDigestSkipRow: ({ n, reason, ids }) => `[SKIP] 不在本次范围——${reason}(${n}):${ids}`,
|
|
135
|
+
doctorSkipReasonQuick: () => "quick 档只探首条命令的前置项",
|
|
136
|
+
doctorSkipReasonSections: ({ sections }) => `本次只运行了这些分区:${sections}`,
|
|
137
|
+
doctorSkipReasonGeneric: () => "报告未记录运行范围",
|
|
138
|
+
doctorSkipGated: ({ id, reason }) => `[SKIP] ${id}——被前置阻断:${reason}`,
|
|
139
|
+
doctorTallyOk: ({ n }) => `通过 ${n}`,
|
|
140
|
+
doctorTallyWarn: ({ n }) => `警告 ${n}`,
|
|
141
|
+
doctorTallyFail: ({ n }) => `失败 ${n}`,
|
|
142
|
+
doctorTallyUnknown: ({ n }) => `未知 ${n}`,
|
|
143
|
+
doctorTallyInfo: ({ n }) => `信息 ${n}`,
|
|
144
|
+
doctorTallySkipped: ({ n }) => `跳过 ${n}`,
|
|
145
|
+
doctorDigestFixPrefix: ({ remedy }) => ` 修复: ${remedy}`,
|
|
146
|
+
doctorDigestNoteReady: () => "首条命令应能成功;如需可附加的报告文件,运行 CLI(pnpm run doctor --bundle <path>)",
|
|
147
|
+
doctorDigestNoteBlocked: () => "应用上方每条修复,然后再次调用本工具——重跑即复核",
|
|
148
|
+
doctorDigestBlockedTail: ({ blockers, warnings, skipped, note }) => `阻断项:${blockers};${warnings} 个警告,${skipped} 个跳过腿——均不阻断;${note}`,
|
|
97
149
|
};
|
|
98
150
|
/** The active language; English until a settings service reports otherwise. */
|
|
99
151
|
let current = "en";
|
|
@@ -160,9 +212,20 @@ export function resolveMessagesLocale(preference) {
|
|
|
160
212
|
* which also covers the `locale` entry activating after this row did. A read
|
|
161
213
|
* that throws keeps the previous language: this is presentation, not gating.
|
|
162
214
|
*
|
|
215
|
+
* A browser whose user never picked a language in Settings has NO persisted
|
|
216
|
+
* `locale.preference` — its Chinese UI came from the navigator's provisional
|
|
217
|
+
* match, which the Host settings never record. For that case the fallback
|
|
218
|
+
* reads the process's ICU default locale (Electron: the OS UI language), so
|
|
219
|
+
* a zh-CN Windows with a provisional-Chinese UI still renders Chinese. An
|
|
220
|
+
* explicit Settings choice always wins over the fallback.
|
|
221
|
+
*
|
|
163
222
|
* @param ctx - the row's composition context.
|
|
164
223
|
*/
|
|
165
224
|
export function installMessagesLocale(ctx) {
|
|
225
|
+
// Provisional fallback first: the settings read below is asynchronous (it
|
|
226
|
+
// waits for the injection), and the OS language is the best guess until a
|
|
227
|
+
// stored preference replaces it.
|
|
228
|
+
configureMessagesLocale(hostFallbackLocale());
|
|
166
229
|
if (typeof ctx.inject !== "function")
|
|
167
230
|
return;
|
|
168
231
|
ctx.inject(["settings"], (scope) => {
|
|
@@ -174,8 +237,12 @@ export function installMessagesLocale(ctx) {
|
|
|
174
237
|
const read = () => {
|
|
175
238
|
try {
|
|
176
239
|
const row = settings.describe().find((entry) => entry.ns === "locale");
|
|
177
|
-
if (row === undefined)
|
|
240
|
+
if (row === undefined) {
|
|
241
|
+
// No stored preference (the provisional-UI case): the OS fallback
|
|
242
|
+
// stands. It was already applied above; keep it.
|
|
243
|
+
configureMessagesLocale(hostFallbackLocale());
|
|
178
244
|
return;
|
|
245
|
+
}
|
|
179
246
|
// The descriptor's value is the entry's projected volatile form —
|
|
180
247
|
// `{ preference?: string }` for the locale entry.
|
|
181
248
|
const preference = row.value?.preference;
|
|
@@ -197,3 +264,29 @@ export function installMessagesLocale(ctx) {
|
|
|
197
264
|
export function resetMessagesLocaleForTests() {
|
|
198
265
|
current = "en";
|
|
199
266
|
}
|
|
267
|
+
/**
|
|
268
|
+
* The no-settings fallback: the process's ICU default locale, which in the
|
|
269
|
+
* desktop app follows the OS UI language (a zh-CN Windows yields `zh-CN`).
|
|
270
|
+
* Under Node's small-icu builds this is `en-US`, which maps to English — the
|
|
271
|
+
* previous default. Exported for tests.
|
|
272
|
+
*
|
|
273
|
+
* @returns {"en" | "zh"} the language the OS-level locale selects.
|
|
274
|
+
*/
|
|
275
|
+
export function hostFallbackLocale() {
|
|
276
|
+
try {
|
|
277
|
+
return localeFromTag(Intl.DateTimeFormat().resolvedOptions().locale);
|
|
278
|
+
}
|
|
279
|
+
catch {
|
|
280
|
+
return "en";
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Map one BCP 47-style tag onto a catalog language: `zh*` renders Chinese,
|
|
285
|
+
* everything else English.
|
|
286
|
+
*
|
|
287
|
+
* @param tag - the locale tag (may be empty).
|
|
288
|
+
* @returns {"en" | "zh"} the catalog language the tag selects.
|
|
289
|
+
*/
|
|
290
|
+
function localeFromTag(tag) {
|
|
291
|
+
return /^zh/iu.test(tag) ? "zh" : "en";
|
|
292
|
+
}
|
package/lib/native-agent.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export declare const NATIVE_AGENT_ENV = "DSH_WSL_AGENT_NATIVE";
|
|
|
33
33
|
*/
|
|
34
34
|
export declare function nativeCacheScript(digest: string): string;
|
|
35
35
|
/** The injectable edges. */
|
|
36
|
-
|
|
36
|
+
interface NativeBackendOptions {
|
|
37
37
|
/** The `wsl.exe` path. */
|
|
38
38
|
wslPath: string;
|
|
39
39
|
/** The distro. */
|
|
@@ -53,7 +53,7 @@ export interface NativeBackendOptions {
|
|
|
53
53
|
copy?: (script: string, binary: Buffer) => Promise<string>;
|
|
54
54
|
}
|
|
55
55
|
/** A prepared native binary: its in-distro path and the sha256 of its bytes. */
|
|
56
|
-
|
|
56
|
+
interface NativeBackendResult {
|
|
57
57
|
/** The Linux path the session runtime spawns. */
|
|
58
58
|
path: string;
|
|
59
59
|
/** Lowercase hex sha256; the agent's HELLO digest must match it. */
|
|
@@ -122,3 +122,4 @@ export declare function ensureNativeSessionAgent({ wslPath, distro, setNative, e
|
|
|
122
122
|
/** Prepare the binary; tests substitute. */
|
|
123
123
|
ensure?: (options: NativeBackendOptions) => Promise<NativeBackendResult | undefined>;
|
|
124
124
|
}): Promise<void>;
|
|
125
|
+
export {};
|
package/lib/paths.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ export interface DistroPath {
|
|
|
30
30
|
* What the two world-path translators may consult: the pinned distro and the
|
|
31
31
|
* fallback directory for relative input.
|
|
32
32
|
*/
|
|
33
|
-
|
|
33
|
+
interface WorldPathOptions {
|
|
34
34
|
/**
|
|
35
35
|
* The pinned distro, which maps a POSIX-absolute input onto its UNC identity
|
|
36
36
|
* in {@link toWorldPath}.
|
|
@@ -198,3 +198,4 @@ export declare function distroRoot(distro: string): string;
|
|
|
198
198
|
* @returns true for `\\wsl.localhost` and `\\wsl$` in any casing.
|
|
199
199
|
*/
|
|
200
200
|
export declare function isProviderRoot(value: string): boolean;
|
|
201
|
+
export {};
|
package/lib/picker.d.ts
CHANGED
|
@@ -54,7 +54,7 @@ import type { DirectoryEntry, DirectoryListing, DirectoryPickerBrowseCapability
|
|
|
54
54
|
/**
|
|
55
55
|
* The resolved service configuration, as {@link WslDirectoryPicker.Config} yields.
|
|
56
56
|
*/
|
|
57
|
-
|
|
57
|
+
interface PickerConfig {
|
|
58
58
|
/** Path to `wsl.exe`; overridable for a non-standard install. */
|
|
59
59
|
wslPath: string;
|
|
60
60
|
/**
|
|
@@ -74,18 +74,6 @@ export interface PickerConfig {
|
|
|
74
74
|
/** How long a resolved distro list stays fresh. */
|
|
75
75
|
distroCacheMs: number;
|
|
76
76
|
}
|
|
77
|
-
/**
|
|
78
|
-
* Await `operation`, but reject with the signal's reason the moment it aborts.
|
|
79
|
-
* Node's filesystem reads are not retractable, so the operation itself keeps
|
|
80
|
-
* running against a handle the caller then closes; its late settlement is
|
|
81
|
-
* swallowed so an abandoned read cannot surface as an unhandled rejection.
|
|
82
|
-
*
|
|
83
|
-
* @template T
|
|
84
|
-
* @param operation - the in-flight filesystem step.
|
|
85
|
-
* @param signal - caller lifetime; absent means plain awaiting.
|
|
86
|
-
* @returns the operation's value.
|
|
87
|
-
*/
|
|
88
|
-
export declare function raceAbort<T>(operation: Promise<T>, signal?: AbortSignal): Promise<T>;
|
|
89
77
|
/**
|
|
90
78
|
* The `ctx.directoryPicker` WSL implementation.
|
|
91
79
|
*
|
|
@@ -263,4 +251,3 @@ export declare class WslDirectoryPicker extends DirectoryPicker {
|
|
|
263
251
|
createDistroDirectory(parent: string, name: string, target: string): Promise<string>;
|
|
264
252
|
}
|
|
265
253
|
export default WslDirectoryPicker;
|
|
266
|
-
export { ancestryCrumbs, boundedInsert, breadcrumbs, fullyQualified } from "./listing.js";
|
package/lib/picker.js
CHANGED
|
@@ -70,7 +70,7 @@ const DEFAULT_DISTRO_CACHE_MS = 5_000;
|
|
|
70
70
|
* @param signal - caller lifetime; absent means plain awaiting.
|
|
71
71
|
* @returns the operation's value.
|
|
72
72
|
*/
|
|
73
|
-
|
|
73
|
+
function raceAbort(operation, signal) {
|
|
74
74
|
if (signal === void 0)
|
|
75
75
|
return operation;
|
|
76
76
|
return new Promise((resolve, reject) => {
|
|
@@ -471,4 +471,3 @@ export class WslDirectoryPicker extends DirectoryPicker {
|
|
|
471
471
|
}
|
|
472
472
|
}
|
|
473
473
|
export default WslDirectoryPicker;
|
|
474
|
-
export { ancestryCrumbs, boundedInsert, breadcrumbs, fullyQualified } from "./listing.js";
|
package/lib/preflight.d.ts
CHANGED
|
@@ -86,7 +86,7 @@ export declare const Config: z<Schemastery.ObjectS<NoInfer<{
|
|
|
86
86
|
startup: z<boolean, boolean, "defined">;
|
|
87
87
|
}>>, "plain">;
|
|
88
88
|
/** The config schema's validated output. */
|
|
89
|
-
|
|
89
|
+
interface PreflightConfig {
|
|
90
90
|
/** The distro mode: empty/`auto`, an explicit name, or `default`. */
|
|
91
91
|
distro?: string;
|
|
92
92
|
/** The `wsl.exe` path the probe spawns. */
|
|
@@ -102,7 +102,7 @@ export interface PreflightConfig {
|
|
|
102
102
|
* The slice of a created agent this service inspects; the harness's agent
|
|
103
103
|
* object is structural here, the same view `auto-preset` uses.
|
|
104
104
|
*/
|
|
105
|
-
|
|
105
|
+
interface PreflightAgent {
|
|
106
106
|
/** The agent's id. */
|
|
107
107
|
id: string;
|
|
108
108
|
/** The session stub, when mounted. */
|
|
@@ -122,7 +122,7 @@ export interface PreflightAgent {
|
|
|
122
122
|
} | undefined;
|
|
123
123
|
}
|
|
124
124
|
/** The slice of a session context that can carry the advisory. */
|
|
125
|
-
|
|
125
|
+
interface PreflightPromptScope {
|
|
126
126
|
systemPrompt: {
|
|
127
127
|
context: (entry: {
|
|
128
128
|
name: string;
|
|
@@ -137,7 +137,7 @@ export interface PreflightPromptScope {
|
|
|
137
137
|
* visible to this plugin, so they are spelled structurally on top of the
|
|
138
138
|
* framework's {@link Context}.
|
|
139
139
|
*/
|
|
140
|
-
|
|
140
|
+
type PreflightContext = Context & {
|
|
141
141
|
logger?: {
|
|
142
142
|
debug?: (message: string) => void;
|
|
143
143
|
warn?: (message: string) => void;
|
|
@@ -156,3 +156,4 @@ export type PreflightContext = Context & {
|
|
|
156
156
|
* @param config - the schema-validated plugin config.
|
|
157
157
|
*/
|
|
158
158
|
export declare function apply(ctx: PreflightContext, config?: PreflightConfig): Promise<void>;
|
|
159
|
+
export {};
|
package/lib/probe-cache.d.ts
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* fails when it drifts.
|
|
20
20
|
*/
|
|
21
21
|
/** One probe cache's surface. */
|
|
22
|
-
|
|
22
|
+
interface ProbeCache {
|
|
23
23
|
/**
|
|
24
24
|
* Run one probe under the policy.
|
|
25
25
|
*
|
|
@@ -49,3 +49,4 @@ export interface ProbeCache {
|
|
|
49
49
|
* @returns the policy object `lib/sandbox-core.js` holds per provider.
|
|
50
50
|
*/
|
|
51
51
|
export declare function createProbeCache(): ProbeCache;
|
|
52
|
+
export {};
|
package/lib/sandbox-core.d.ts
CHANGED
|
@@ -28,16 +28,6 @@
|
|
|
28
28
|
* @returns the operator-facing remedy text.
|
|
29
29
|
*/
|
|
30
30
|
export declare function missingBwrapRemedy(distro: string, family?: string): string;
|
|
31
|
-
/**
|
|
32
|
-
* The remedy for a bwrap that PROBED healthy but failed a run — the runtime
|
|
33
|
-
* twin of {@link missingBwrapRemedy}. No family knowledge exists on this path
|
|
34
|
-
* (the probe succeeded, so no family probe ever ran), and reinstalling is only
|
|
35
|
-
* one of the plausible fixes, so the hint leads with diagnosis.
|
|
36
|
-
*
|
|
37
|
-
* @param distro - the distro whose bwrap failed at run time.
|
|
38
|
-
* @returns the operator-facing hint text.
|
|
39
|
-
*/
|
|
40
|
-
export declare function bwrapInstallHint(distro: string): string;
|
|
41
31
|
/**
|
|
42
32
|
* Append {@link bwrapInstallHint} to a runner-failure detail that names bwrap.
|
|
43
33
|
* A probe-time failure composes its own classified remedy; this covers the
|
|
@@ -90,7 +80,7 @@ export declare function bwrapFailure(wslPath: string, distro: string): string |
|
|
|
90
80
|
* The seam's `ConfinedArgv` settlement facts, plus this core's `windowsDrive`
|
|
91
81
|
* mitigation flag.
|
|
92
82
|
*/
|
|
93
|
-
|
|
83
|
+
interface WslConfined {
|
|
94
84
|
/** The wrapped argv (bwrap prefix, separator, the caller's argv). */
|
|
95
85
|
argv: string[];
|
|
96
86
|
/**
|
|
@@ -147,3 +137,4 @@ export declare function createSandboxCore({ SandboxUnavailableError }: {
|
|
|
147
137
|
wslPath?: string;
|
|
148
138
|
maskWindowsDrive?: boolean;
|
|
149
139
|
} | undefined) => WslSandboxCoreInstance;
|
|
140
|
+
export {};
|
package/lib/sandbox-core.js
CHANGED
|
@@ -177,7 +177,7 @@ export function missingBwrapRemedy(distro, family) {
|
|
|
177
177
|
* @param distro - the distro whose bwrap failed at run time.
|
|
178
178
|
* @returns the operator-facing hint text.
|
|
179
179
|
*/
|
|
180
|
-
|
|
180
|
+
function bwrapInstallHint(distro) {
|
|
181
181
|
return t("bwrapRuntimeFailure", { distro });
|
|
182
182
|
}
|
|
183
183
|
/**
|
package/lib/sandbox.d.ts
CHANGED
|
@@ -36,7 +36,6 @@
|
|
|
36
36
|
*
|
|
37
37
|
* @module dsh-plugin-wsl-env/sandbox
|
|
38
38
|
*/
|
|
39
|
-
export { bwrapProfileArgs } from "./bwrap.js";
|
|
40
39
|
/**
|
|
41
40
|
* The confinement over WSL: the probe-then-confine class bound to the peer's
|
|
42
41
|
* failure type. See the core module for the probe policy and the profile.
|
package/lib/sandbox.js
CHANGED
|
@@ -38,10 +38,6 @@
|
|
|
38
38
|
*/
|
|
39
39
|
import { SandboxUnavailableError } from "@deepseek-ai/dsh-sandbox";
|
|
40
40
|
import { createSandboxCore } from "./sandbox-core.js";
|
|
41
|
-
// The profile and the argv prefix are also what `lib/agent-confined.js` builds
|
|
42
|
-
// for its residents, so both live in the peer-free `lib/bwrap.js` and are
|
|
43
|
-
// re-exported here, where the sandbox's callers have always found them.
|
|
44
|
-
export { bwrapProfileArgs } from "./bwrap.js";
|
|
45
41
|
/**
|
|
46
42
|
* The confinement over WSL: the probe-then-confine class bound to the peer's
|
|
47
43
|
* failure type. See the core module for the probe policy and the profile.
|
package/lib/search-exec.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ import type { AgentExecRunner } from "./agent-exec.js";
|
|
|
34
34
|
* The output-stream reader the search tool consumes: `handle.collected.stdout`
|
|
35
35
|
* / `stderr` expose `readFrom(offset)` with the seam's standard shape.
|
|
36
36
|
*/
|
|
37
|
-
|
|
37
|
+
interface SearchCollectedReader {
|
|
38
38
|
/** Read the stream from a byte offset. */
|
|
39
39
|
readFrom: (from: number) => {
|
|
40
40
|
text: string;
|
|
@@ -94,3 +94,4 @@ export declare function searchExecutionHandle({ agent, cwd, argv, maxOutputBytes
|
|
|
94
94
|
*/
|
|
95
95
|
spawnFallback: () => SearchExecutionHandle;
|
|
96
96
|
}): SearchExecutionHandle;
|
|
97
|
+
export {};
|
package/lib/session-runtime.d.ts
CHANGED
|
@@ -42,7 +42,7 @@ export declare function probeSessionRuntime({ wslPath, distro, run }: {
|
|
|
42
42
|
run: (argv: string[]) => Promise<string>;
|
|
43
43
|
}): Promise<string | null>;
|
|
44
44
|
/** One request for a session runtime. */
|
|
45
|
-
|
|
45
|
+
interface SessionRuntimeRequest {
|
|
46
46
|
/** The session identity; absent requests each get a separate runtime. */
|
|
47
47
|
sessionId?: string;
|
|
48
48
|
/** The distro the runtime lives in. */
|
|
@@ -74,7 +74,7 @@ export interface SessionRuntimeEntry {
|
|
|
74
74
|
refs: number;
|
|
75
75
|
}
|
|
76
76
|
/** The injectable edges, so the registry is testable without systemd. */
|
|
77
|
-
|
|
77
|
+
interface SessionRuntimeOptions {
|
|
78
78
|
/** Create the agent; tests substitute a fake. */
|
|
79
79
|
spawnAgent?: (options: {
|
|
80
80
|
/** The distro. */
|
|
@@ -161,3 +161,4 @@ export declare class SessionRuntimes {
|
|
|
161
161
|
}
|
|
162
162
|
/** The process-wide registry the providers will share. */
|
|
163
163
|
export declare const sessionRuntimes: SessionRuntimes;
|
|
164
|
+
export {};
|
package/lib/shell-env.d.ts
CHANGED
|
@@ -73,7 +73,7 @@ export declare const Config: z<Schemastery.ObjectS<NoInfer<{
|
|
|
73
73
|
portsRefreshMs: z<number, number, "defined">;
|
|
74
74
|
}>>, "plain">;
|
|
75
75
|
/** The config schema's validated output. */
|
|
76
|
-
|
|
76
|
+
interface ShellEnvConfig {
|
|
77
77
|
/** The distro mode: empty/`auto`, an explicit name, or `default`. */
|
|
78
78
|
distro?: string;
|
|
79
79
|
/** How often the listening-port snapshot refreshes, in milliseconds. */
|
|
@@ -83,7 +83,7 @@ export interface ShellEnvConfig {
|
|
|
83
83
|
* The execution slice the shell-env registry hands a contributor's `resolve`;
|
|
84
84
|
* the harness's execution object is structural here.
|
|
85
85
|
*/
|
|
86
|
-
|
|
86
|
+
interface ShellEnvExecution {
|
|
87
87
|
/** The executing session's agent stub. */
|
|
88
88
|
agent?: {
|
|
89
89
|
session?: {
|
|
@@ -117,3 +117,4 @@ export type ShellEnvContext = Context & {
|
|
|
117
117
|
* @param config - the schema-validated plugin config.
|
|
118
118
|
*/
|
|
119
119
|
export declare function apply(ctx: ShellEnvContext, config?: ShellEnvConfig): Promise<void>;
|
|
120
|
+
export {};
|
package/lib/shell.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `ctx.shell` executor for the WSL agent preset — load as
|
|
3
|
-
* `dsh-plugin-wsl-env/shell` (before 0.
|
|
3
|
+
* `dsh-plugin-wsl-env/shell` (before 0.21.0 the package root resolved here;
|
|
4
4
|
* the root is now the no-op web client host half, see `src/client-host.ts`).
|
|
5
5
|
*
|
|
6
6
|
* This is a TypeScript source built to `lib/shell.js`; edit THIS file and run
|
package/lib/shell.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `ctx.shell` executor for the WSL agent preset — load as
|
|
3
|
-
* `dsh-plugin-wsl-env/shell` (before 0.
|
|
3
|
+
* `dsh-plugin-wsl-env/shell` (before 0.21.0 the package root resolved here;
|
|
4
4
|
* the root is now the no-op web client host half, see `src/client-host.ts`).
|
|
5
5
|
*
|
|
6
6
|
* This is a TypeScript source built to `lib/shell.js`; edit THIS file and run
|
package/lib/subprocess.d.ts
CHANGED
|
@@ -92,7 +92,7 @@ import type { SubprocessTerminalActivity } from "./terminal-activity.js";
|
|
|
92
92
|
* present after validation; `hostCwd` is the volatile accessor the schema
|
|
93
93
|
* builds.
|
|
94
94
|
*/
|
|
95
|
-
|
|
95
|
+
interface WslSubprocessConfig {
|
|
96
96
|
/**
|
|
97
97
|
* Distro mode: empty/`"auto"` follows the launch directory, `"default"`
|
|
98
98
|
* forces WSL's default, and an explicit name pins.
|
package/lib/update-check.d.ts
CHANGED
|
@@ -45,7 +45,7 @@ export declare const Config: z<Schemastery.ObjectS<NoInfer<{
|
|
|
45
45
|
intervalMs: z<number, number, "defined">;
|
|
46
46
|
}>>, "plain">;
|
|
47
47
|
/** The config schema's validated output. */
|
|
48
|
-
|
|
48
|
+
interface UpdateCheckConfig {
|
|
49
49
|
/** Whether the update check runs at all. */
|
|
50
50
|
enabled?: boolean;
|
|
51
51
|
/** How often the registry is asked, in milliseconds. */
|
|
@@ -92,7 +92,7 @@ export interface PluginManagerSlice {
|
|
|
92
92
|
listVersions: (name: string) => Promise<VersionList>;
|
|
93
93
|
}
|
|
94
94
|
/** The update fact one successful check publishes. */
|
|
95
|
-
|
|
95
|
+
interface UpdateFact {
|
|
96
96
|
/** The version this process runs. */
|
|
97
97
|
installed: string;
|
|
98
98
|
/** The version the stable channel offers. */
|
|
@@ -181,7 +181,7 @@ export declare function updateFactMessage(update: UpdateFact | undefined): strin
|
|
|
181
181
|
* visible to this plugin, so they are spelled structurally on top of the
|
|
182
182
|
* framework's {@link Context}.
|
|
183
183
|
*/
|
|
184
|
-
|
|
184
|
+
type UpdateCheckContext = Context & {
|
|
185
185
|
logger?: {
|
|
186
186
|
debug?: (message: string) => void;
|
|
187
187
|
};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
export declare const name = "wsl-doctor-command";
|
|
2
|
+
/**
|
|
3
|
+
* No required inject: a headless deployment has no commands registry, and a
|
|
4
|
+
* required inject would fail the whole composition mount over a surface this
|
|
5
|
+
* row cannot use. The registry resolves per mount through the optional
|
|
6
|
+
* `ctx.get` (cordis answers undefined for an absent name; a `get` needs no
|
|
7
|
+
* inject), with a plain property as the test seam — the same shape the
|
|
8
|
+
* `wsl_doctor` tool uses for its optional collector.
|
|
9
|
+
*/
|
|
10
|
+
export declare const inject: string[];
|
|
11
|
+
/** The host commands registry slice this row consumes. */
|
|
12
|
+
interface CommandsRegistrySlice {
|
|
13
|
+
register: (definition: WslDoctorCommandDefinition) => unknown;
|
|
14
|
+
}
|
|
15
|
+
/** The invocation face the registry hands a handler. */
|
|
16
|
+
interface WslDoctorCommandInvocation {
|
|
17
|
+
/** The receiving agent, when the command ran against a session. */
|
|
18
|
+
agent?: unknown;
|
|
19
|
+
/** Everything after the command name, separator whitespace trimmed. */
|
|
20
|
+
rawInput: string;
|
|
21
|
+
/** The dispatcher's abort signal; cancelling stops awaiting and kills the child. */
|
|
22
|
+
signal?: AbortSignal;
|
|
23
|
+
}
|
|
24
|
+
/** The command definition face this row registers. */
|
|
25
|
+
export interface WslDoctorCommandDefinition {
|
|
26
|
+
name: string;
|
|
27
|
+
description: string;
|
|
28
|
+
input?: {
|
|
29
|
+
hint: string;
|
|
30
|
+
};
|
|
31
|
+
handler: (invocation: WslDoctorCommandInvocation) => Promise<WslDoctorCommandResult>;
|
|
32
|
+
}
|
|
33
|
+
/** The settled result the adapter renders detached from model history. */
|
|
34
|
+
interface WslDoctorCommandResult {
|
|
35
|
+
kind: "success" | "error";
|
|
36
|
+
text: string;
|
|
37
|
+
}
|
|
38
|
+
/** The context slice this service consumes. */
|
|
39
|
+
type WslDoctorCommandContext = {
|
|
40
|
+
/** The commands registry, when the deployment has a command adapter. */
|
|
41
|
+
commands?: CommandsRegistrySlice;
|
|
42
|
+
/** The harness's cwd service, used to name the session's distro. */
|
|
43
|
+
workingDirectory?: WorkingDirectorySlice;
|
|
44
|
+
/** Optional cordis-style lookup: how production resolves both without an inject. */
|
|
45
|
+
get?: (name: string) => unknown;
|
|
46
|
+
/** The test seam: a provided CLI runner replaces the real subprocess. */
|
|
47
|
+
doctorCli?: DoctorCliRunner;
|
|
48
|
+
};
|
|
49
|
+
/** The harness's `workingDirectory` service slice. */
|
|
50
|
+
interface WorkingDirectorySlice {
|
|
51
|
+
/** The Session's current directory, recorded synchronously when available. */
|
|
52
|
+
get?: (session: unknown) => string | null | undefined;
|
|
53
|
+
/** Resolve (and repair) the Session's current directory. */
|
|
54
|
+
ensure?: (agent: unknown, signal?: unknown) => Promise<string>;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* How long a distro-scoped doctor CLI run may take. A scoped quick run takes
|
|
58
|
+
* seconds and a scoped full run ~15 s, so only a stall reaches this; it sits
|
|
59
|
+
* below the command dispatcher's own deadline so the run settles with a
|
|
60
|
+
* message naming what happened instead of the dispatcher's opaque "operation
|
|
61
|
+
* was aborted".
|
|
62
|
+
*/
|
|
63
|
+
export declare const DOCTOR_CLI_TIMEOUT_MS = 120000;
|
|
64
|
+
/**
|
|
65
|
+
* How long an UNRESOLVED-target run may take. Without a distro the CLI's
|
|
66
|
+
* effective configuration decides, and the shipped `auto` probes every
|
|
67
|
+
* installed distro — minutes on a machine with several, with no progress to
|
|
68
|
+
* show in the UI. Failing fast with the narrowing hint beats a card that sits
|
|
69
|
+
* "executing" for the dispatcher's whole budget.
|
|
70
|
+
*/
|
|
71
|
+
export declare const DOCTOR_CLI_SWEEP_TIMEOUT_MS = 60000;
|
|
72
|
+
/** The CLI runner seam: argv in (node-less — the runner owns the runtime), JSON text out. */
|
|
73
|
+
type DoctorCliRunner = (argv: string[], signal?: AbortSignal, timeoutMs?: number) => Promise<string>;
|
|
74
|
+
/** The parsed `/wsl-doctor` line. */
|
|
75
|
+
interface ParsedDoctorInput {
|
|
76
|
+
/** quick → `--quick`; full → no flag; section → `--sections <name>`. */
|
|
77
|
+
mode: "quick" | "full" | "section";
|
|
78
|
+
/** The section name, when `mode` is `"section"`. */
|
|
79
|
+
section?: string;
|
|
80
|
+
/** The explicit distro, or empty to resolve from the session's cwd. */
|
|
81
|
+
distro: string;
|
|
82
|
+
}
|
|
83
|
+
/** The doctor CLI this row spawns, resolved from the built module's package root. */
|
|
84
|
+
export declare const DOCTOR_SCRIPT: string;
|
|
85
|
+
/** The usage text a grammar violation settles with. */
|
|
86
|
+
export declare const USAGE: string;
|
|
87
|
+
/**
|
|
88
|
+
* Parse the raw input after the command name. Tokens: one mode word or
|
|
89
|
+
* section name, plus an optional `--distro <name>` / `--distro=<name>`; a
|
|
90
|
+
* second bare token is accepted as the distro name.
|
|
91
|
+
*
|
|
92
|
+
* @param rawInput - everything after the command name.
|
|
93
|
+
* @returns the parsed mode, optional section, and optional distro.
|
|
94
|
+
* @throws when a token matches nothing — the caller settles usage text.
|
|
95
|
+
*/
|
|
96
|
+
export declare function parseDoctorInput(rawInput: string): ParsedDoctorInput;
|
|
97
|
+
/**
|
|
98
|
+
* The default CLI runner: spawn the standalone doctor as a host subprocess.
|
|
99
|
+
* `process.execPath` is the Electron binary inside the harness, so
|
|
100
|
+
* `ELECTRON_RUN_AS_NODE=1` turns it into plain node for the child; under a
|
|
101
|
+
* plain node runtime the variable is ignored. Exit code 1 is a *blocked
|
|
102
|
+
* verdict*, which is a successful diagnosis — the JSON on stdout still parses;
|
|
103
|
+
* only a spawn failure or unparseable output is an infrastructure error.
|
|
104
|
+
*
|
|
105
|
+
* The run is bounded by {@link DOCTOR_CLI_TIMEOUT_MS}. Without a deadline a
|
|
106
|
+
* doctor that never reports keeps the command "executing" until the command
|
|
107
|
+
* dispatcher aborts it, and that abort surfaces as an opaque "operation was
|
|
108
|
+
* aborted" that names neither what ran nor how to narrow it.
|
|
109
|
+
*
|
|
110
|
+
* @param argv - flags after the script path (no node, no script — added here).
|
|
111
|
+
* @param signal - the dispatcher's abort signal; abort kills the child.
|
|
112
|
+
* @param timeoutMs - the deadline; tests shrink it to exercise the timeout.
|
|
113
|
+
* @returns the CLI's stdout (one JSON report).
|
|
114
|
+
*/
|
|
115
|
+
export declare function runDoctorCli(argv: string[], signal?: AbortSignal, timeoutMs?: number): Promise<string>;
|
|
116
|
+
/**
|
|
117
|
+
* Format the CLI's JSON report into the itemized text the UI renders — the
|
|
118
|
+
* same digest the `wsl_doctor` tool returns, so both surfaces itemize every
|
|
119
|
+
* check identically.
|
|
120
|
+
*
|
|
121
|
+
* @param json - the CLI's stdout, one versioned JSON report.
|
|
122
|
+
* @param distro - the distro the run named, for the session-distro markers.
|
|
123
|
+
* @returns the rendered report text.
|
|
124
|
+
*/
|
|
125
|
+
export declare function formatDoctorReport(json: string, distro: string): string;
|
|
126
|
+
/**
|
|
127
|
+
* Mount the command.
|
|
128
|
+
*
|
|
129
|
+
* @param ctx - the cordis context (the composition root, where the commands
|
|
130
|
+
* registry and the harness cwd service are reachable).
|
|
131
|
+
*/
|
|
132
|
+
export declare function apply(ctx: WslDoctorCommandContext): Promise<void>;
|
|
133
|
+
export {};
|