dsh-plugin-wsl-env 0.18.0 → 0.19.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 +152 -0
- package/CONTRIBUTING.md +37 -5
- package/README.md +59 -4
- package/SUPPORT.md +3 -3
- package/agent/native/linux-aarch64/dsh-wsl-agent +0 -0
- package/agent/native/linux-x86_64/dsh-wsl-agent +0 -0
- package/agent/wsl-agent.sh +331 -11
- package/docs/AGENT-PROTOCOL-V7.md +175 -0
- package/docs/API.md +24 -0
- package/docs/ARCHITECTURE.md +14 -1
- package/docs/CONFIGURATION.md +12 -5
- package/docs/CONFIGURATION.zh.md +5 -3
- package/docs/LIMITATIONS.md +16 -4
- package/docs/LIMITATIONS.zh.md +20 -11
- package/docs/MIGRATION.md +4 -4
- package/docs/PEER-PARITY.md +50 -33
- package/docs/QUICKSTART.md +18 -1
- package/docs/QUICKSTART.zh.md +16 -1
- package/docs/README.zh.md +43 -4
- package/docs/RELEASING.md +1 -1
- package/docs/REQUIREMENTS.zh.md +3 -2
- package/docs/ROADMAP-1.0.md +27 -16
- package/docs/UPSTREAM-FILE-REFERENCE-SEAM.md +3 -1
- package/docs/UPSTREAM-SESSION-NOTICE.md +3 -1
- package/docs/UPSTREAM-TERMINAL-TITLE.md +3 -0
- package/docs/root-fs-routing.md +3 -3
- package/lib/agent-confined.js +4 -4
- package/lib/agent-errors.d.ts +1 -1
- package/lib/agent-errors.js +1 -1
- package/lib/agent-exec.d.ts +1 -1
- package/lib/agent-exec.js +1 -1
- package/lib/agent-protocol.d.ts +58 -8
- package/lib/agent-protocol.js +40 -7
- package/lib/agent-shared.d.ts +1 -1
- package/lib/agent-shared.js +1 -1
- package/lib/agent.d.ts +171 -1
- package/lib/agent.js +448 -288
- package/lib/auto-preset.d.ts +1 -1
- package/lib/auto-preset.js +1 -1
- package/lib/bwrap.d.ts +1 -1
- package/lib/bwrap.js +1 -1
- package/lib/distro-route.d.ts +1 -1
- package/lib/distro-route.js +1 -1
- package/lib/doctor-live.d.ts +53 -0
- package/lib/doctor-live.js +37 -0
- package/lib/file-reference-wsl.d.ts +1 -1
- package/lib/file-reference-wsl.js +1 -1
- package/lib/fs-decisions.d.ts +1 -1
- package/lib/fs-decisions.js +1 -1
- package/lib/fs-routing.d.ts +1 -1
- package/lib/fs-routing.js +1 -1
- package/lib/fs-substrate.d.ts +90 -11
- package/lib/fs-substrate.js +202 -1
- package/lib/fs.d.ts +1 -1
- package/lib/fs.js +1 -1
- package/lib/fsio-agent.d.ts +128 -4
- package/lib/fsio-agent.js +224 -15
- package/lib/fsio-text.d.ts +1 -1
- package/lib/fsio-text.js +1 -1
- package/lib/git-exec.d.ts +1 -1
- package/lib/git-exec.js +1 -1
- package/lib/git-route.d.ts +1 -1
- package/lib/git-route.js +1 -1
- package/lib/index.d.ts +105 -30
- package/lib/index.js +266 -122
- package/lib/listing.d.ts +1 -1
- package/lib/listing.js +1 -1
- package/lib/native-agent.d.ts +1 -1
- package/lib/native-agent.js +2 -2
- package/lib/paths.d.ts +6 -3
- package/lib/paths.js +4 -4
- package/lib/picker.d.ts +1 -1
- package/lib/picker.js +7 -7
- package/lib/ports.d.ts +1 -1
- package/lib/ports.js +1 -1
- package/lib/preflight.d.ts +1 -1
- package/lib/preflight.js +1 -1
- package/lib/sandbox-core.d.ts +1 -1
- package/lib/sandbox-core.js +2 -2
- package/lib/sandbox.d.ts +1 -1
- package/lib/sandbox.js +1 -1
- package/lib/search-exec.d.ts +1 -1
- package/lib/search-exec.js +1 -1
- package/lib/search-route.d.ts +1 -1
- package/lib/search-route.js +1 -1
- package/lib/session-runtime.d.ts +1 -1
- package/lib/session-runtime.js +2 -2
- package/lib/session-scope.d.ts +1 -1
- package/lib/session-scope.js +1 -1
- package/lib/shell-env.d.ts +1 -1
- package/lib/shell-env.js +1 -1
- package/lib/shell.d.ts +1 -1
- package/lib/shell.js +1 -1
- package/lib/subprocess.d.ts +1 -1
- package/lib/subprocess.js +2 -2
- package/lib/terminal-activity.d.ts +1 -1
- package/lib/terminal-activity.js +1 -1
- package/lib/terminal-route.d.ts +1 -1
- package/lib/terminal-route.js +1 -1
- package/lib/watcher.d.ts +1 -1
- package/lib/watcher.js +1 -1
- package/lib/wsl.d.ts +1 -31
- package/lib/wsl.js +1 -21
- package/package.json +15 -4
- package/scripts/doctor.mjs +34 -11
package/lib/index.d.ts
CHANGED
|
@@ -44,9 +44,10 @@ import { LocalBashExecutor } from "@deepseek-ai/dsh-bash-local";
|
|
|
44
44
|
import { LocalFileSystem } from "@deepseek-ai/dsh-fs-local";
|
|
45
45
|
import { FsError } from "@deepseek-ai/dsh-fs";
|
|
46
46
|
import { WslSandbox } from "./sandbox.js";
|
|
47
|
-
import type { WslAgent } from "./agent.js";
|
|
47
|
+
import type { WslAgent, AgentStatus } from "./agent.js";
|
|
48
48
|
import { AgentSubstrate } from "./fs-substrate.js";
|
|
49
49
|
import { SessionRuntimes } from "./session-runtime.js";
|
|
50
|
+
import { type DoctorReport } from "./doctor-live.js";
|
|
50
51
|
import type { AgentBackend } from "./native-agent.js";
|
|
51
52
|
import type { SessionRuntimeEntry } from "./session-runtime.js";
|
|
52
53
|
import type { Context } from "@deepseek-ai/cordis";
|
|
@@ -84,6 +85,38 @@ export type ConfinedProfile = Awaited<ReturnType<InstanceType<typeof WslSandbox>
|
|
|
84
85
|
export type WslExecSpec = ShellExecSpec & {
|
|
85
86
|
relativeWorkdir?: string;
|
|
86
87
|
};
|
|
88
|
+
/**
|
|
89
|
+
* Collect the doctor's versioned JSON report and merge the live resident's
|
|
90
|
+
* own lifecycle facts when this process holds one (WSL-313).
|
|
91
|
+
*
|
|
92
|
+
* The doctor CLI is a separate process, so its handshake check can only probe
|
|
93
|
+
* a fresh resident; a live resident's `deaths` and `lastError` are
|
|
94
|
+
* host-process state with no IPC to reach them. This entry point runs from
|
|
95
|
+
* the plugin's own context instead: it collects the report as a subprocess
|
|
96
|
+
* (no plugin code is re-entered) and folds `sharedAgent(distro).status()` in
|
|
97
|
+
* — the sanctioned merge, since a snapshot that answers for no resident
|
|
98
|
+
* changes nothing. Outside the app the singleton was never started, so the
|
|
99
|
+
* returned report is the fresh probe verbatim; inside it, a wedged live
|
|
100
|
+
* resident's failures finally reach the report.
|
|
101
|
+
*
|
|
102
|
+
* @param distro - the distro the doctor examines.
|
|
103
|
+
* @param options - `doctorPath` overrides the shipped script (tests);
|
|
104
|
+
* `liveStatus` overrides the in-process status snapshot (tests).
|
|
105
|
+
* @returns the merged report.
|
|
106
|
+
*/
|
|
107
|
+
export declare function doctorReport(distro: string, options?: {
|
|
108
|
+
doctorPath?: string;
|
|
109
|
+
/** The `wsl.exe` the doctor probes with; forwarded as `--wsl <path>`. */
|
|
110
|
+
wslPath?: string;
|
|
111
|
+
/**
|
|
112
|
+
* Prepended to the doctor subprocess's PATH — a caller that stages a fake
|
|
113
|
+
* `wsl.exe` (tests) passes the staging directory here instead of mutating
|
|
114
|
+
* `process.env`, whose visibility across spawned grandchildren is exactly
|
|
115
|
+
* the ambiguity this option removes.
|
|
116
|
+
*/
|
|
117
|
+
envPath?: string;
|
|
118
|
+
liveStatus?: AgentStatus;
|
|
119
|
+
}): Promise<DoctorReport>;
|
|
87
120
|
/**
|
|
88
121
|
* The WSL shell executor's validated config — the keys of
|
|
89
122
|
* {@link WslShellExecutor.Config}, which the upstream `LocalBashExecutor`
|
|
@@ -467,7 +500,8 @@ export declare class WslShellExecutor extends LocalBashExecutor {
|
|
|
467
500
|
* The shell name for the default/pinned distro, as the shell tool presents
|
|
468
501
|
* it.
|
|
469
502
|
*
|
|
470
|
-
* @returns the basename of the shell
|
|
503
|
+
* @returns the basename of the shell; `shell` while the probe fails, and
|
|
504
|
+
* `bash` for an implausible basename.
|
|
471
505
|
*/
|
|
472
506
|
shellName(): Promise<string>;
|
|
473
507
|
/**
|
|
@@ -477,6 +511,8 @@ export declare class WslShellExecutor extends LocalBashExecutor {
|
|
|
477
511
|
*
|
|
478
512
|
* @param distro - the distro name.
|
|
479
513
|
* @returns an absolute path to the shell inside the distro.
|
|
514
|
+
* @throws {Error} when neither the config nor the distro names a usable
|
|
515
|
+
* shell — the failure is not cached, so the next call re-probes.
|
|
480
516
|
*/
|
|
481
517
|
shellFor(distro: string): Promise<string>;
|
|
482
518
|
/**
|
|
@@ -484,6 +520,8 @@ export declare class WslShellExecutor extends LocalBashExecutor {
|
|
|
484
520
|
* login shell, resolved once and cached.
|
|
485
521
|
*
|
|
486
522
|
* @returns an absolute path to the shell inside the distro.
|
|
523
|
+
* @throws {Error} when neither the config nor the distro names a usable
|
|
524
|
+
* shell — the failure is not cached, so the next call re-probes.
|
|
487
525
|
*/
|
|
488
526
|
shell(): Promise<string>;
|
|
489
527
|
/**
|
|
@@ -735,6 +773,41 @@ export declare class WslShellExecutor extends LocalBashExecutor {
|
|
|
735
773
|
* @returns the decorated execution result.
|
|
736
774
|
*/
|
|
737
775
|
executeOneShot(resolved: WslExecSpec, distro: string, shell: string): Promise<ShellExecution>;
|
|
776
|
+
/**
|
|
777
|
+
* The confined one-shot's argv prepare: confine the distro argv under the
|
|
778
|
+
* policy, keep the resulting profile for the fact-stamper and the settlement
|
|
779
|
+
* mapping, and hand back the wrapped host argv.
|
|
780
|
+
*
|
|
781
|
+
* @param resolved - the resolved spec.
|
|
782
|
+
* @param distro - the resolved distro name.
|
|
783
|
+
* @param shell - the resolved distro shell.
|
|
784
|
+
* @param policy - the confined policy (narrowed in by `executeOneShot`).
|
|
785
|
+
* @param slot - the closure the builder assigns the profile into.
|
|
786
|
+
* @param signal - the caller's cancellation.
|
|
787
|
+
*/
|
|
788
|
+
private prepareConfinedArgv;
|
|
789
|
+
/**
|
|
790
|
+
* Stamp the per-process sandbox facts before `done` settles, so a background
|
|
791
|
+
* process reports the same mode, denial and enforcement a foreground run
|
|
792
|
+
* would.
|
|
793
|
+
*
|
|
794
|
+
* @param resolved - the resolved spec.
|
|
795
|
+
* @param mode - the confined policy's mode.
|
|
796
|
+
* @param slot - the closure holding the assigned profile.
|
|
797
|
+
* @param process - the spawned handle.
|
|
798
|
+
*/
|
|
799
|
+
private stampConfinedFacts;
|
|
800
|
+
/**
|
|
801
|
+
* Settle one confined one-shot result: the distro and workdir verdicts, the
|
|
802
|
+
* never-armed honesty stamp, the runner-failure throw, and the denial facts.
|
|
803
|
+
*
|
|
804
|
+
* @param result - the settled process result.
|
|
805
|
+
* @param distro - the resolved distro name.
|
|
806
|
+
* @param resolved - the resolved spec.
|
|
807
|
+
* @param mode - the confined policy's mode.
|
|
808
|
+
* @param confined - the profile the argv prepare armed, when it ran.
|
|
809
|
+
*/
|
|
810
|
+
private settleConfinedOneShot;
|
|
738
811
|
}
|
|
739
812
|
/**
|
|
740
813
|
* Filesystem backend over a WSL distro's UNC share.
|
|
@@ -1335,45 +1408,47 @@ export declare class WslFileSystem extends LocalFileSystem {
|
|
|
1335
1408
|
version: FsVersion;
|
|
1336
1409
|
}, signal?: AbortSignal, sandboxPolicy?: SandboxExecutionPolicy): Promise<FsEditOutcome>;
|
|
1337
1410
|
/**
|
|
1338
|
-
*
|
|
1339
|
-
*
|
|
1340
|
-
* the
|
|
1341
|
-
*
|
|
1342
|
-
* `FS_NOT_FOUND` that names the wrong world. Fail closed here until the
|
|
1343
|
-
* agent substrate grows a patch op (see `docs/PEER-PARITY.md`, the new-peer
|
|
1344
|
-
* operations section).
|
|
1411
|
+
* Apply parsed hunks (protocol 7): hunk matching and application run
|
|
1412
|
+
* in-process through the peer's own `applyHunks` (the same dialect and
|
|
1413
|
+
* `FS_PATCH_MISMATCH` the peer emits), against the distro's bytes, then
|
|
1414
|
+
* publish through the same guarded atomic write an edit takes.
|
|
1345
1415
|
*
|
|
1346
|
-
* @param target - the resolved
|
|
1347
|
-
* @param
|
|
1348
|
-
* @param
|
|
1349
|
-
* @param
|
|
1350
|
-
* @param
|
|
1416
|
+
* @param target - the resolved regular file.
|
|
1417
|
+
* @param hunks - ordered hunks from the caller's patch parse.
|
|
1418
|
+
* @param expected - the version the patch was based on.
|
|
1419
|
+
* @param signal - cancels the patch.
|
|
1420
|
+
* @param sandboxPolicy - the per-call policy; omit for the deployment default.
|
|
1421
|
+
* @returns the pre/post text and the published version.
|
|
1351
1422
|
*/
|
|
1352
|
-
patchText(target: FsTarget,
|
|
1423
|
+
patchText(target: FsTarget, hunks: PatchHunks, expected?: {
|
|
1353
1424
|
version: FsVersion;
|
|
1354
|
-
},
|
|
1425
|
+
}, signal?: AbortSignal, sandboxPolicy?: SandboxExecutionPolicy): Promise<FsEditOutcome>;
|
|
1355
1426
|
/**
|
|
1356
|
-
*
|
|
1357
|
-
*
|
|
1427
|
+
* Remove one regular file (protocol 7) after fencing the target by the
|
|
1428
|
+
* per-call policy; the guarded removal re-verifies the expected version
|
|
1429
|
+
* distro-side.
|
|
1358
1430
|
*
|
|
1359
|
-
* @param target - the resolved
|
|
1360
|
-
* @param
|
|
1361
|
-
* @param
|
|
1362
|
-
* @param
|
|
1431
|
+
* @param target - the resolved file.
|
|
1432
|
+
* @param expected - the version the removal was based on.
|
|
1433
|
+
* @param signal - cancels the removal.
|
|
1434
|
+
* @param sandboxPolicy - the per-call policy; omit for the deployment default.
|
|
1435
|
+
* @returns the bounded pre-removal text basis.
|
|
1363
1436
|
*/
|
|
1364
|
-
deleteFile(target: FsTarget,
|
|
1437
|
+
deleteFile(target: FsTarget, expected?: {
|
|
1365
1438
|
version: FsVersion;
|
|
1366
|
-
},
|
|
1439
|
+
}, signal?: AbortSignal, sandboxPolicy?: SandboxExecutionPolicy): Promise<FsDeleteOutcome>;
|
|
1367
1440
|
/**
|
|
1368
|
-
*
|
|
1369
|
-
*
|
|
1441
|
+
* Move one regular file (protocol 7) after fencing BOTH endpoints by the
|
|
1442
|
+
* per-call policy — the destination publishes and the source is removed, so
|
|
1443
|
+
* each must be writable under the same roots.
|
|
1370
1444
|
*
|
|
1371
1445
|
* @param source - the resolved source.
|
|
1372
1446
|
* @param destination - the resolved destination.
|
|
1373
|
-
* @param
|
|
1374
|
-
* @param
|
|
1375
|
-
* @param
|
|
1447
|
+
* @param options - the hunks and the source/destination guards.
|
|
1448
|
+
* @param signal - cancels before publication.
|
|
1449
|
+
* @param sandboxPolicy - the per-call policy; omit for the deployment default.
|
|
1450
|
+
* @returns the bounded source basis and the destination outcome.
|
|
1376
1451
|
*/
|
|
1377
|
-
moveFile(source: FsTarget, destination: FsTarget,
|
|
1452
|
+
moveFile(source: FsTarget, destination: FsTarget, options: MoveFileOptions, signal?: AbortSignal, sandboxPolicy?: SandboxExecutionPolicy): Promise<FsMoveOutcome>;
|
|
1378
1453
|
}
|
|
1379
1454
|
export {};
|