dsh-bash-terminal-ts 0.8.2 → 0.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.de.md +1 -1
- package/README.en.md +6 -2
- package/README.es.md +1 -1
- package/README.fr.md +1 -1
- package/README.it.md +1 -1
- package/README.md +5 -1
- package/README.ru.md +1 -1
- package/agent-presets/README.md +170 -0
- package/agent-presets/install-presets.mjs +179 -0
- package/agent-presets/standard-win/agent.cordis.yml +271 -0
- package/agent-presets/standard-win/preset.yml +2 -0
- package/agent-presets/standard-win-gitbash/agent.cordis.yml +271 -0
- package/agent-presets/standard-win-gitbash/preset.yml +2 -0
- package/agent-presets/standard-win-msys2/agent.cordis.yml +272 -0
- package/agent-presets/standard-win-msys2/preset.yml +2 -0
- package/agent-presets/standard-win-payload/agent.cordis.yml +271 -0
- package/agent-presets/standard-win-payload/preset.yml +2 -0
- package/agent-presets/standard-win-wsl2/agent.cordis.yml +271 -0
- package/agent-presets/standard-win-wsl2/preset.yml +2 -0
- package/cordis.patch.yml +12 -0
- package/dist/client.core.js +43 -12
- package/dist/client.js +43 -12
- package/dsh.plugin.json +2 -2
- package/lib/client.js +43 -12
- package/lib/dsh-types.d.ts +3 -1
- package/lib/index.d.ts +23 -2
- package/lib/index.js +79 -18
- package/lib/locales.js +27 -9
- package/lib/payload.d.ts +72 -0
- package/lib/payload.js +279 -0
- package/lib/shell-id.d.ts +2 -2
- package/lib/shells.d.ts +11 -2
- package/lib/shells.js +18 -4
- package/lib/terminal.js +1 -0
- package/lib/webterminals/catalog.d.ts +2 -0
- package/lib/webterminals/catalog.js +1 -0
- package/lib/webterminals/host.js +2 -2
- package/lib/webterminals/mount.d.ts +5 -0
- package/lib/webterminals/mount.js +4 -0
- package/package.json +17 -11
- package/scripts/check-artifacts.mjs +1 -1
- package/scripts/link-shells.mjs +22 -0
- package/scripts/payload-alias.mjs +97 -0
- package/scripts/provision-payload.mjs +233 -0
- package/src/client.tsx +29 -4
- package/src/dsh-types.ts +3 -1
- package/src/index.ts +117 -16
- package/src/locales.ts +27 -9
- package/src/payload.ts +322 -0
- package/src/shell-id.ts +2 -2
- package/src/shells.ts +27 -5
- package/src/terminal.ts +1 -0
- package/src/webterminals/browser/api.ts +1 -1
- package/src/webterminals/catalog.ts +3 -0
- package/src/webterminals/host.ts +2 -2
- package/src/webterminals/mount.ts +9 -0
package/lib/index.js
CHANGED
|
@@ -26,6 +26,7 @@ import { isAbsolute, join, resolve } from "node:path";
|
|
|
26
26
|
import { mountBrowserTerminals } from "./webterminals/mount.js";
|
|
27
27
|
import { ESCALATION_TARGETS, TOOL_ABORTED, approveEscalation, defineTool, escalationHintMarker, clampTimeout, deadline, parseExitStatus, timeoutOf, sandboxDenialMarker, validateEscalationArgs, z, HarnessError } from "./dsh.js";
|
|
28
28
|
import { createTerminalRegistry, terminalTool } from "./terminal.js";
|
|
29
|
+
import { resolvePayloadBash } from "./payload.js";
|
|
29
30
|
/** Stable Cordis plugin name. */
|
|
30
31
|
export const name = "bash-terminal";
|
|
31
32
|
/** Composition entry id (the `tool-bash-terminal` row the bundle patch declares). */
|
|
@@ -33,7 +34,7 @@ const ENTRY_ID = "tool-bash-terminal";
|
|
|
33
34
|
/** Services required before the tool can register. */
|
|
34
35
|
export const inject = ["tools", "systemPrompt", "shellEnv", "subprocess", "settings", "sandbox", "sandboxPolicy"];
|
|
35
36
|
/** The terminal backends this tool exposes, in catalog order. */
|
|
36
|
-
export const SHELLS = ["powershell", "gitbash", "msys2", "wsl"];
|
|
37
|
+
export const SHELLS = ["powershell", "gitbash", "msys2", "wsl", "payload"];
|
|
37
38
|
/** The backend used when the caller does not name one. */
|
|
38
39
|
export const DEFAULT_SHELL = "powershell";
|
|
39
40
|
/** Default per-command timeout (ms). */
|
|
@@ -72,7 +73,12 @@ export const Config = z.object({
|
|
|
72
73
|
shellGitBash: z.boolean().default(true).volatile(),
|
|
73
74
|
shellMsys2: z.boolean().default(true).volatile(),
|
|
74
75
|
shellWsl: z.boolean().default(true).volatile(),
|
|
75
|
-
|
|
76
|
+
shellPayload: z.boolean().default(false).volatile(),
|
|
77
|
+
wslDistro: z.string().default("").volatile(),
|
|
78
|
+
// Payload gate state is read once per process (paths resolve at startup), so
|
|
79
|
+
// these are deliberately NOT volatile: a flip needs the restart it implies.
|
|
80
|
+
enablePosixPayload: z.boolean().default(false),
|
|
81
|
+
payloadPosixPath: z.string().default("")
|
|
76
82
|
});
|
|
77
83
|
// ---- executable resolution ------------------------------------------------
|
|
78
84
|
function candidateExists(candidate) {
|
|
@@ -165,7 +171,7 @@ export function defaultWslPath(env = process.env) {
|
|
|
165
171
|
const systemRoot = env.SystemRoot ?? "C:\\Windows";
|
|
166
172
|
return join(systemRoot, "System32", "wsl.exe");
|
|
167
173
|
}
|
|
168
|
-
export function resolveAllPaths(config = {}, env = process.env) {
|
|
174
|
+
export function resolveAllPaths(config = {}, env = process.env, payloadBash) {
|
|
169
175
|
const pwsh = config.pwshPath && config.pwshPath.trim().length > 0
|
|
170
176
|
? config.pwshPath
|
|
171
177
|
: resolveFromCandidates(candidatePwshPaths(env));
|
|
@@ -178,7 +184,10 @@ export function resolveAllPaths(config = {}, env = process.env) {
|
|
|
178
184
|
const wsl = config.wslPath && config.wslPath.trim().length > 0
|
|
179
185
|
? config.wslPath
|
|
180
186
|
: defaultWslPath(env);
|
|
181
|
-
|
|
187
|
+
// The payload is its OWN backend (first-class catalog row) - it never
|
|
188
|
+
// silently substitutes for the gitbash slot, so a row labelled "Git Bash"
|
|
189
|
+
// always names a shell the machine actually has.
|
|
190
|
+
return { pwsh, gitbash, msys2, wsl, ...(payloadBash !== undefined ? { payload: payloadBash } : {}) };
|
|
182
191
|
}
|
|
183
192
|
// ---- argv / env construction ------------------------------------------------
|
|
184
193
|
export function buildArgv(shell, command, paths, distro) {
|
|
@@ -192,6 +201,10 @@ export function buildArgv(shell, command, paths, distro) {
|
|
|
192
201
|
// /usr/bin and /mingw64/bin on PATH. With a bare -c, `tr`, `sed`, `gcc`
|
|
193
202
|
// and friends are all "command not found".
|
|
194
203
|
return [paths.msys2, "-lc", command];
|
|
204
|
+
case "payload":
|
|
205
|
+
// Same login-shell rule as msys2/gitbash: the payload is a
|
|
206
|
+
// Git-for-Windows tree and `-lc` is what gives it a usable PATH.
|
|
207
|
+
return [paths.payload, "-lc", command];
|
|
195
208
|
case "wsl": {
|
|
196
209
|
const distroArg = distro !== undefined && distro.trim().length > 0 ? ["-d", distro.trim()] : [];
|
|
197
210
|
return [paths.wsl, ...distroArg, "-e", "bash", "-lc", command];
|
|
@@ -409,7 +422,8 @@ export const SHELL_DESCRIPTIONS = {
|
|
|
409
422
|
powershell: "Execute a PowerShell command (pwsh -NoLogo -NoProfile -NonInteractive -Command <command>) and return its stdout/stderr. PowerShell syntax; native Windows paths (C:\\...); environment variables via $env:NAME.",
|
|
410
423
|
gitbash: "Execute a bash command (Git for Windows bash -lc <command>) and return its stdout/stderr. POSIX syntax; paths like /d/WorkSpace; PATH includes /usr/bin and /mingw64/bin so git, npm, ssh etc. work; environment variables via $NAME.",
|
|
411
424
|
msys2: "Execute a bash command (MSYS2 bash -lc <command>) and return its stdout/stderr. POSIX syntax; paths like /c/...; PATH includes /usr/bin and /mingw64/bin so git, npm, gcc, make etc. work; environment variables via $NAME. MSYS2 provides a full GCC/mingw64 toolchain.",
|
|
412
|
-
wsl: "Execute a Linux bash command (wsl [-d <distro>] -e bash -lc <command>) and return its stdout/stderr. Linux syntax; Windows files under /mnt/d/...; environment variables via $NAME."
|
|
425
|
+
wsl: "Execute a Linux bash command (wsl [-d <distro>] -e bash -lc <command>) and return its stdout/stderr. Linux syntax; Windows files under /mnt/d/...; environment variables via $NAME.",
|
|
426
|
+
payload: "Execute a bash command in the plugin's pinned POSIX runtime payload (a digest-verified Git-for-Windows bash -lc <command>) and return its stdout/stderr. POSIX syntax; paths like /c/...; PATH includes /usr/bin so git, npm, ssh etc. work; environment variables via $NAME. Use it only when the user has deliberately enabled the payload backend."
|
|
413
427
|
};
|
|
414
428
|
/**
|
|
415
429
|
* Render the model-facing tool description for one backend. The backend is
|
|
@@ -424,7 +438,7 @@ export function toolDescription(backgroundEnabled, shell = DEFAULT_SHELL) {
|
|
|
424
438
|
const base = [
|
|
425
439
|
`The user's chosen default terminal (Settings -> General -> Default terminal) is ${active}; commands run there.`,
|
|
426
440
|
lead,
|
|
427
|
-
"Each call spawns a fresh shell: no state (cwd, variables, aliases) persists between calls - pass workdir instead of using cd. Non-zero exits are reported as [exit code: N] markers; investigate failures before moving on. Long output is truncated to its tail; the full output is saved to a file whose path is reported when available. Commands run under the DSH sandbox: confined modes (read-only / workspace-write) are enforced through ctx.sandbox and deny fail-closed for PowerShell; danger-full-access, Git Bash, MSYS2, and WSL run unconfined."
|
|
441
|
+
"Each call spawns a fresh shell: no state (cwd, variables, aliases) persists between calls - pass workdir instead of using cd. Non-zero exits are reported as [exit code: N] markers; investigate failures before moving on. Long output is truncated to its tail; the full output is saved to a file whose path is reported when available. Commands run under the DSH sandbox: confined modes (read-only / workspace-write) are enforced through ctx.sandbox and deny fail-closed for PowerShell; danger-full-access, Git Bash, MSYS2, the pinned POSIX payload, and WSL run unconfined."
|
|
428
442
|
].join(" ");
|
|
429
443
|
if (!backgroundEnabled)
|
|
430
444
|
return base;
|
|
@@ -456,14 +470,18 @@ export function validateArgs(args) {
|
|
|
456
470
|
* exactly like the shipped executors.
|
|
457
471
|
*/
|
|
458
472
|
function confineSpawn(ctx, argv, policy, shell) {
|
|
459
|
-
if (policy.mode === "danger-full-access" || shell === "wsl" || shell === "gitbash" || shell === "msys2") {
|
|
473
|
+
if (policy.mode === "danger-full-access" || shell === "wsl" || shell === "gitbash" || shell === "msys2" || shell === "payload") {
|
|
460
474
|
const sandbox = shell === "wsl"
|
|
461
475
|
? { mode: policy.mode, enforcement: "wsl-isolation" }
|
|
462
476
|
: shell === "gitbash"
|
|
463
477
|
? { mode: policy.mode, enforcement: "gitbash-unconfined" }
|
|
464
478
|
: shell === "msys2"
|
|
465
479
|
? { mode: policy.mode, enforcement: "msys2-unconfined" }
|
|
466
|
-
:
|
|
480
|
+
: shell === "payload"
|
|
481
|
+
// The payload cannot be confined either (same Cygwin/MSYS runtime
|
|
482
|
+
// constraint as Git Bash) - its safety layer is the digest gate.
|
|
483
|
+
? { mode: policy.mode, enforcement: "payload-unconfined" }
|
|
484
|
+
: undefined;
|
|
467
485
|
return { argv, sandbox };
|
|
468
486
|
}
|
|
469
487
|
const confined = ctx.sandbox.confine(argv, policy);
|
|
@@ -539,7 +557,20 @@ export async function persistConfigValue(svc, path, value) {
|
|
|
539
557
|
}
|
|
540
558
|
// ---- plugin -------------------------------------------------------------------
|
|
541
559
|
export function apply(ctx, config = {}) {
|
|
542
|
-
|
|
560
|
+
// Pinned backup POSIX runtime payload: opt-in, its OWN backend slot. A
|
|
561
|
+
// detected WSL distro is an advisory note only (the official menu lists both
|
|
562
|
+
// side by side, so our picker must not be stricter); the digest gate is the
|
|
563
|
+
// only hard no: an unverified payload simply does not run.
|
|
564
|
+
let payloadBash;
|
|
565
|
+
const payloadSuppressed = false;
|
|
566
|
+
if (config.enablePosixPayload === true && process.platform === "win32") {
|
|
567
|
+
const outcome = resolvePayloadBash({ payloadBashPath: config.payloadPosixPath ?? "" });
|
|
568
|
+
if (outcome.engaged)
|
|
569
|
+
payloadBash = outcome.bashPath;
|
|
570
|
+
for (const note of outcome.notes)
|
|
571
|
+
ctx.logger?.warn?.(`dsh-bash-terminal-ts: ${note}`);
|
|
572
|
+
}
|
|
573
|
+
const paths = resolveAllPaths(config, process.env, payloadBash);
|
|
543
574
|
// 0.1.7: `defaultShell` is a `.volatile()` config field — the loader hands
|
|
544
575
|
// `apply` a live ref and the latest value is resolved on every read; there
|
|
545
576
|
// is no settings registration call anymore (removed with the 0.1.7 host).
|
|
@@ -565,6 +596,28 @@ export function apply(ctx, config = {}) {
|
|
|
565
596
|
* command in a different shell than the model was told about.
|
|
566
597
|
*/
|
|
567
598
|
const currentShell = storedShell;
|
|
599
|
+
/**
|
|
600
|
+
* The activation switches are ONE truth: a switch off hides the backend from
|
|
601
|
+
* the dock AND makes it an invalid shell-tool target (powershell is the
|
|
602
|
+
* floor and always on). A stored defaultShell pointing at a switched-off
|
|
603
|
+
* backend is therefore stale, not executable.
|
|
604
|
+
*/
|
|
605
|
+
const switchOn = (shell) => {
|
|
606
|
+
const read = (v, fallback) => typeof v === "object" && v !== null && typeof v.get === "function"
|
|
607
|
+
? (v.get() ?? fallback)
|
|
608
|
+
: (v ?? fallback);
|
|
609
|
+
if (shell === "powershell")
|
|
610
|
+
return true;
|
|
611
|
+
if (shell === "gitbash")
|
|
612
|
+
return read(config.shellGitBash, true);
|
|
613
|
+
if (shell === "msys2")
|
|
614
|
+
return read(config.shellMsys2, true);
|
|
615
|
+
if (shell === "wsl")
|
|
616
|
+
return read(config.shellWsl, true);
|
|
617
|
+
if (shell === "payload")
|
|
618
|
+
return read(config.shellPayload, false);
|
|
619
|
+
return false;
|
|
620
|
+
};
|
|
568
621
|
/**
|
|
569
622
|
* What the model is TOLD. Sanitised, because this one runs on every prompt
|
|
570
623
|
* assembly: an invalid stored value must not break the whole prompt, and naming
|
|
@@ -572,11 +625,11 @@ export function apply(ctx, config = {}) {
|
|
|
572
625
|
*/
|
|
573
626
|
const describedShell = () => {
|
|
574
627
|
const stored = storedShell();
|
|
575
|
-
if (SHELLS.includes(stored))
|
|
628
|
+
if (SHELLS.includes(stored) && switchOn(stored))
|
|
576
629
|
return stored;
|
|
577
630
|
if (!warnedStale) {
|
|
578
631
|
warnedStale = true;
|
|
579
|
-
ctx.logger?.warn?.(`dsh-bash-terminal-ts: defaultShell ${JSON.stringify(stored)} is not a selectable backend; shell calls will fail closed and the bottom terminal falls back to ${DEFAULT_SHELL}`);
|
|
632
|
+
ctx.logger?.warn?.(`dsh-bash-terminal-ts: defaultShell ${JSON.stringify(stored)} is not a selectable/activated backend; shell calls will fail closed and the bottom terminal falls back to ${DEFAULT_SHELL}`);
|
|
580
633
|
}
|
|
581
634
|
return DEFAULT_SHELL;
|
|
582
635
|
};
|
|
@@ -590,6 +643,7 @@ export function apply(ctx, config = {}) {
|
|
|
590
643
|
config: config,
|
|
591
644
|
paths,
|
|
592
645
|
configuredShell: storedShell,
|
|
646
|
+
payloadSuppressed: () => payloadSuppressed,
|
|
593
647
|
persist: async (svc, path, value) => {
|
|
594
648
|
await persistConfigValue(svc, path, value);
|
|
595
649
|
// ≤0.1.6 hosts have no config hot-reload, so mirror a defaultShell write into
|
|
@@ -633,11 +687,6 @@ export function apply(ctx, config = {}) {
|
|
|
633
687
|
order: 105,
|
|
634
688
|
text: "Use the shell tool for terminal commands: it runs in the terminal the user chose in Settings -> General -> Default terminal (PowerShell, Git Bash, MSYS2, or WSL) and honors the DSH sandbox. Prefer it over the pwsh tool for everyday commands; keep the pwsh tool for cases that specifically need the sandboxed PowerShell surface."
|
|
635
689
|
});
|
|
636
|
-
// compat-legacy: 六线统一配置通道(≤0.1.6 无 client-store 模块表,client 走本
|
|
637
|
-
// bridge 读写 defaultShell)。写路径 = settings.mutate;≤0.1.6 的 loader 不会自动
|
|
638
|
-
// 注册命名空间,复用 perm-gate 自门控(not registered → register → 重试);
|
|
639
|
-
// rc.1+ 命名空间由 loader 占用,该分支自然不命中。GET 带回当前值与可选集。
|
|
640
|
-
// 宿主 context 类型未收录 inject/局部服务形状,compat 桥按宽化面调用。
|
|
641
690
|
const compatCtx = ctx;
|
|
642
691
|
if (typeof compatCtx.inject !== "function") {
|
|
643
692
|
// A context without `inject` (a bare mock, or a host that resolves services
|
|
@@ -692,7 +741,7 @@ export function apply(ctx, config = {}) {
|
|
|
692
741
|
chunks.push(c);
|
|
693
742
|
});
|
|
694
743
|
req.on("end", () => {
|
|
695
|
-
let body
|
|
744
|
+
let body;
|
|
696
745
|
try {
|
|
697
746
|
body = JSON.parse(Buffer.concat(chunks).toString("utf8") || "{}");
|
|
698
747
|
}
|
|
@@ -721,7 +770,16 @@ export function apply(ctx, config = {}) {
|
|
|
721
770
|
});
|
|
722
771
|
const toolName = "shell";
|
|
723
772
|
const terminalRegistry = createTerminalRegistry(ctx);
|
|
724
|
-
|
|
773
|
+
// The interactive terminal obeys the SAME activation gate as the shell tool:
|
|
774
|
+
// the getter throws for a switched-off backend, so a session cannot open on
|
|
775
|
+
// a shell the user just disabled.
|
|
776
|
+
ctx.tools.register(terminalTool(ctx, terminalRegistry, paths, () => {
|
|
777
|
+
const shell = currentShell();
|
|
778
|
+
if (SHELLS.includes(shell) && !switchOn(shell)) {
|
|
779
|
+
throw new Error(`dsh-bash-terminal-ts: ${shell} backend is not activated - enable its switch in the plugin settings first.`);
|
|
780
|
+
}
|
|
781
|
+
return shell;
|
|
782
|
+
}));
|
|
725
783
|
// The model-facing description must track the user's chosen default
|
|
726
784
|
// terminal: a static description listing every backend leaves the model
|
|
727
785
|
// guessing which syntax applies. Re-render it on every prompt assembly —
|
|
@@ -837,6 +895,9 @@ export function apply(ctx, config = {}) {
|
|
|
837
895
|
async execute(args, exec) {
|
|
838
896
|
const v = validateArgs(args);
|
|
839
897
|
const shell = currentShell();
|
|
898
|
+
if (SHELLS.includes(shell) && !switchOn(shell)) {
|
|
899
|
+
throw new Error(`dsh-bash-terminal-ts: ${shell} backend is not activated - ask the user to enable its switch in the plugin settings (bottom terminal), or choose another default terminal.`);
|
|
900
|
+
}
|
|
840
901
|
const argv0 = buildArgv(shell, v.command, paths, v.distro);
|
|
841
902
|
if (argv0[0] === undefined) {
|
|
842
903
|
throw new Error(`dsh-bash-terminal-ts: ${shell} backend unavailable - executable not found. Install it or set the corresponding *Path config.`);
|
package/lib/locales.js
CHANGED
|
@@ -20,9 +20,11 @@ const zh = {
|
|
|
20
20
|
"shell.wsl": "WSL",
|
|
21
21
|
"shell.unavailable": "设置面不可用:宿主配置桥未响应(检查宿主是否为 compat 版)",
|
|
22
22
|
"dock.title": "底部终端",
|
|
23
|
-
"dock.hint": "
|
|
23
|
+
"dock.hint": "开关同时约束底部终端与 shell 工具的可选后端(PowerShell 为保底,恒可选);不改变官方右栏终端。",
|
|
24
24
|
"dock.state.available": "可用",
|
|
25
25
|
"dock.state.notInstalled": "未探测到",
|
|
26
|
+
"dock.state.wslPreferred": "已检测到 WSL 发行版(优先用 WSL bash)",
|
|
27
|
+
"shell.payload": "POSIX payload",
|
|
26
28
|
"dock.state.noDistro": "无已安装发行版",
|
|
27
29
|
"dock.state.launcherOnly": "只找到启动器,无法内嵌",
|
|
28
30
|
"dock.powershell.locked": "PowerShell 是保底后端,无法关闭。",
|
|
@@ -65,9 +67,11 @@ const en = {
|
|
|
65
67
|
"shell.wsl": "WSL",
|
|
66
68
|
"shell.unavailable": "Settings unavailable: the host config bridge did not respond (is the host a compat build?)",
|
|
67
69
|
"dock.title": "Bottom terminal",
|
|
68
|
-
"dock.hint": "These switches
|
|
70
|
+
"dock.hint": "These switches gate both the bottom dock terminal and the shell tool's selectable backends (PowerShell is the floor and always available). The official right-hand terminal is untouched.",
|
|
69
71
|
"dock.state.available": "Available",
|
|
70
72
|
"dock.state.notInstalled": "Not found",
|
|
73
|
+
"dock.state.wslPreferred": "WSL distro detected (WSL bash preferred)",
|
|
74
|
+
"shell.payload": "POSIX payload",
|
|
71
75
|
"dock.state.noDistro": "No distro installed",
|
|
72
76
|
"dock.state.launcherOnly": "Only a launcher was found; it cannot be embedded",
|
|
73
77
|
"dock.powershell.locked": "PowerShell is the fallback backend and cannot be turned off.",
|
|
@@ -110,9 +114,11 @@ const ja = {
|
|
|
110
114
|
"shell.wsl": "WSL",
|
|
111
115
|
"shell.unavailable": "設定面を利用できません:ホストの設定ブリッジが応答しません(compat ビルドですか?)",
|
|
112
116
|
"dock.title": "下部ターミナル",
|
|
113
|
-
"dock.hint": "
|
|
117
|
+
"dock.hint": "このスイッチは下部ドックのターミナルと shell ツールの選択可能バックエンドの両方に影響します(PowerShell は最終代替のため常に選択可)。公式の右側ターミナルは変更されません。",
|
|
114
118
|
"dock.state.available": "利用可",
|
|
115
119
|
"dock.state.notInstalled": "見つかりません",
|
|
120
|
+
"dock.state.wslPreferred": "WSL ディストリ検出済み(WSL bash 優先)",
|
|
121
|
+
"shell.payload": "POSIX payload",
|
|
116
122
|
"dock.state.noDistro": "インストール済みディストリビューションなし",
|
|
117
123
|
"dock.state.launcherOnly": "ランチャーのみ検出、埋め込み不可",
|
|
118
124
|
"dock.powershell.locked": "PowerShell は最後の代替のため無効化できません。",
|
|
@@ -155,9 +161,11 @@ const ko = {
|
|
|
155
161
|
"shell.wsl": "WSL",
|
|
156
162
|
"shell.unavailable": "설정면을 사용할 수 없습니다: 호스트 설정 브리지가 응답하지 않습니다 (compat 빌드인가요?)",
|
|
157
163
|
"dock.title": "하단 터미널",
|
|
158
|
-
"dock.hint": "이 스위치는 하단
|
|
164
|
+
"dock.hint": "이 스위치는 하단 독 터미널과 shell 도구의 선택 가능 백엔드 모두에 영향을 줍니다(PowerShell은 항상 선택 가능). 공식 오른쪽 터미널은 변경되지 않습니다.",
|
|
159
165
|
"dock.state.available": "사용 가능",
|
|
160
166
|
"dock.state.notInstalled": "탐지되지 않음",
|
|
167
|
+
"dock.state.wslPreferred": "WSL 배포판 감지됨 (WSL bash 우선)",
|
|
168
|
+
"shell.payload": "POSIX payload",
|
|
161
169
|
"dock.state.noDistro": "설치된 배포판 없음",
|
|
162
170
|
"dock.state.launcherOnly": "런처만 발견되어 내장할 수 없음",
|
|
163
171
|
"dock.powershell.locked": "PowerShell은 최종 대체 항목이므로 끌 수 없습니다.",
|
|
@@ -200,9 +208,11 @@ const fr = {
|
|
|
200
208
|
"shell.wsl": "WSL",
|
|
201
209
|
"shell.unavailable": "Paramètres indisponibles: le pont de configuration de l'hôte n'a pas répondu",
|
|
202
210
|
"dock.title": "Terminal inférieur",
|
|
203
|
-
"dock.hint": "Ces interrupteurs
|
|
211
|
+
"dock.hint": "Ces interrupteurs régissent à la fois le terminal du dock bas et les backends sélectionnables de l'outil shell (PowerShell reste toujours disponible). Le terminal officiel de droite reste inchangé.",
|
|
204
212
|
"dock.state.available": "Disponible",
|
|
205
213
|
"dock.state.notInstalled": "Non détecté",
|
|
214
|
+
"dock.state.wslPreferred": "Distro WSL détectée (bash WSL préféré)",
|
|
215
|
+
"shell.payload": "POSIX payload",
|
|
206
216
|
"dock.state.noDistro": "Aucune distribution installée",
|
|
207
217
|
"dock.state.launcherOnly": "Seuls des lanceurs ont été trouvés; intégration impossible",
|
|
208
218
|
"dock.powershell.locked": "PowerShell sert de repli final et ne peut pas être désactivé.",
|
|
@@ -245,9 +255,11 @@ const de = {
|
|
|
245
255
|
"shell.wsl": "WSL",
|
|
246
256
|
"shell.unavailable": "Einstellungen nicht verfügbar: Die Konfigurationsbrücke des Hosts hat nicht geantwortet",
|
|
247
257
|
"dock.title": "Unteres Terminal",
|
|
248
|
-
"dock.hint": "Diese Schalter
|
|
258
|
+
"dock.hint": "Diese Schalter steuern sowohl das Terminal im unteren Dock als auch die wählbaren Backends des shell-Werkzeugs (PowerShell bleibt immer verfügbar). Das offizielle rechte Terminal bleibt unberührt.",
|
|
249
259
|
"dock.state.available": "Verfügbar",
|
|
250
260
|
"dock.state.notInstalled": "Nicht gefunden",
|
|
261
|
+
"dock.state.wslPreferred": "WSL-Distro erkannt (WSL bash bevorzugt)",
|
|
262
|
+
"shell.payload": "POSIX payload",
|
|
251
263
|
"dock.state.noDistro": "Keine Distribution installiert",
|
|
252
264
|
"dock.state.launcherOnly": "Nur Launcher gefunden; Einbettung nicht möglich",
|
|
253
265
|
"dock.powershell.locked": "PowerShell ist die letzte Rückfallmöglichkeit und kann nicht deaktiviert werden.",
|
|
@@ -290,9 +302,11 @@ const it = {
|
|
|
290
302
|
"shell.wsl": "WSL",
|
|
291
303
|
"shell.unavailable": "Impostazioni non disponibili: il bridge di configurazione dell'host non ha risposto",
|
|
292
304
|
"dock.title": "Terminale inferiore",
|
|
293
|
-
"dock.hint": "Questi interruttori
|
|
305
|
+
"dock.hint": "Questi interruttori controllano sia il terminale nella barra inferiore sia i backend selezionabili dello strumento shell (PowerShell resta sempre disponibile). Il terminale ufficiale a destra non cambia.",
|
|
294
306
|
"dock.state.available": "Disponibile",
|
|
295
307
|
"dock.state.notInstalled": "Non trovato",
|
|
308
|
+
"dock.state.wslPreferred": "Distro WSL rilevata (bash WSL preferito)",
|
|
309
|
+
"shell.payload": "POSIX payload",
|
|
296
310
|
"dock.state.noDistro": "Nessuna distribuzione installata",
|
|
297
311
|
"dock.state.launcherOnly": "Trovato solo un launcher; incorporamento non possibile",
|
|
298
312
|
"dock.powershell.locked": "PowerShell è il ripiego finale e non può essere disattivato.",
|
|
@@ -335,9 +349,11 @@ const ru = {
|
|
|
335
349
|
"shell.wsl": "WSL",
|
|
336
350
|
"shell.unavailable": "Настройки недоступны: мост конфигурации хоста не ответил",
|
|
337
351
|
"dock.title": "Нижний терминал",
|
|
338
|
-
"dock.hint": "Эти переключатели влияют
|
|
352
|
+
"dock.hint": "Эти переключатели влияют и на терминал в нижней панели, и на выбираемые бэкенды инструмента shell (PowerShell доступен всегда). Официальный правый терминал не меняется.",
|
|
339
353
|
"dock.state.available": "Доступен",
|
|
340
354
|
"dock.state.notInstalled": "Не найден",
|
|
355
|
+
"dock.state.wslPreferred": "Обнаружен дистрибутив WSL (предпочтительнее WSL bash)",
|
|
356
|
+
"shell.payload": "POSIX payload",
|
|
341
357
|
"dock.state.noDistro": "Нет установленных дистрибутивов",
|
|
342
358
|
"dock.state.launcherOnly": "Найден только лаунчер, встраивание невозможно",
|
|
343
359
|
"dock.powershell.locked": "PowerShell — резервный вариант, его нельзя отключить.",
|
|
@@ -380,9 +396,11 @@ const es = {
|
|
|
380
396
|
"shell.wsl": "WSL",
|
|
381
397
|
"shell.unavailable": "Configuración no disponible: el puente de configuración del host no respondió",
|
|
382
398
|
"dock.title": "Terminal inferior",
|
|
383
|
-
"dock.hint": "Estos interruptores
|
|
399
|
+
"dock.hint": "Estos interruptores afectan tanto al terminal del panel inferior como a los backends seleccionables de la herramienta shell (PowerShell siempre está disponible). El terminal oficial derecho no cambia.",
|
|
384
400
|
"dock.state.available": "Disponible",
|
|
385
401
|
"dock.state.notInstalled": "No detectado",
|
|
402
|
+
"dock.state.wslPreferred": "Distro de WSL detectada (se prefiere bash de WSL)",
|
|
403
|
+
"shell.payload": "POSIX payload",
|
|
386
404
|
"dock.state.noDistro": "Sin distribución instalada",
|
|
387
405
|
"dock.state.launcherOnly": "Solo se encontró un lanzador; no se puede incrustar",
|
|
388
406
|
"dock.powershell.locked": "PowerShell es el respaldo final y no puede desactivarse.",
|
package/lib/payload.d.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/** npm package name of OUR POSIX runtime repack (optionalDependency-style; absent = simply no payload). */
|
|
2
|
+
export declare const PAYLOAD_PACKAGE = "@drscrewdriver/posix-runtime-win32-x64";
|
|
3
|
+
/** Trust record written next to a provisioned payload root by scripts/provision-payload.mjs. */
|
|
4
|
+
export declare const TRUST_FILE_NAME = "payload.trust.json";
|
|
5
|
+
/** Files every payload root must expose for verification, normalized to forward slashes, lowercase. */
|
|
6
|
+
export declare const REQUIRED_FILES: readonly string[];
|
|
7
|
+
/** One pinned payload build = one digest map. Keyed by the `posix-*` label. */
|
|
8
|
+
export type DigestMap = Record<string, string>;
|
|
9
|
+
/**
|
|
10
|
+
* Built-in ledger, keyed by payload build label. Populated by
|
|
11
|
+
* `provision-payload.mjs --emit-ledger` at release time (V-flow). EMPTY on a
|
|
12
|
+
* fresh checkout by design: with no ledger entry, a root is only usable if the
|
|
13
|
+
* operator's local trust file pins it - which is an explicit human act, the
|
|
14
|
+
* same posture as `dsh-ops provision-shells` but self-managed.
|
|
15
|
+
*/
|
|
16
|
+
export declare const PAYLOAD_LEDGER: Readonly<Record<string, DigestMap>>;
|
|
17
|
+
export type PayloadVerdict = {
|
|
18
|
+
readonly ok: true;
|
|
19
|
+
readonly bashPath: string;
|
|
20
|
+
readonly source: "ledger" | "trust";
|
|
21
|
+
} | {
|
|
22
|
+
readonly ok: false;
|
|
23
|
+
readonly reason: string;
|
|
24
|
+
};
|
|
25
|
+
/** The OS face this module needs; tests substitute a table-driven fake. */
|
|
26
|
+
export interface PayloadProbe {
|
|
27
|
+
exists(path: string): boolean;
|
|
28
|
+
read(path: string): Buffer | undefined;
|
|
29
|
+
/** `size|mtimeMs` fingerprint for the hash cache, or undefined when unstatable. */
|
|
30
|
+
stamp(path: string): string | undefined;
|
|
31
|
+
readdir(dir: string): string[];
|
|
32
|
+
/** Directory holding `package.json` of PAYLOAD_PACKAGE, if installed. */
|
|
33
|
+
resolvePackageRoot(): string | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* WSL distro probe: names of installed distros, or undefined when the probe
|
|
36
|
+
* cannot answer (undefined is NOT "no distro" - absence needs a positive
|
|
37
|
+
* empty list, same three-valued rule as the browser catalog's distros fact).
|
|
38
|
+
*/
|
|
39
|
+
wslDistros(): readonly string[] | undefined;
|
|
40
|
+
}
|
|
41
|
+
/** Environment directory carrying auto-discovered payload roots. */
|
|
42
|
+
export declare function payloadStoreDir(env?: NodeJS.ProcessEnv): string | undefined;
|
|
43
|
+
/** sha256 hex of one file, memoized on (size, mtimeMs); undefined when unreadable. */
|
|
44
|
+
export declare function hashFile(path: string, probe?: PayloadProbe): string | undefined;
|
|
45
|
+
/** Test/backdoor: drop the memo (a payload replaced in place must re-verify). */
|
|
46
|
+
export declare function clearHashCache(): void;
|
|
47
|
+
/**
|
|
48
|
+
* Verify one payload root: both REQUIRED_FILES exist, their digests match the
|
|
49
|
+
* built-in ledger OR the root-local trust file. Everything else fails closed.
|
|
50
|
+
*/
|
|
51
|
+
export declare function verifyPayloadRoot(root: string, probe?: PayloadProbe): PayloadVerdict;
|
|
52
|
+
/** Candidate payload roots in preference order: explicit path, npm package, store dir. */
|
|
53
|
+
export declare function findPayloadRoots(config: {
|
|
54
|
+
payloadBashPath?: string;
|
|
55
|
+
}, probe?: PayloadProbe, env?: NodeJS.ProcessEnv): string[];
|
|
56
|
+
export interface PayloadOutcome {
|
|
57
|
+
/** True only when a verified payload bash was selected. */
|
|
58
|
+
readonly engaged: boolean;
|
|
59
|
+
readonly bashPath?: string;
|
|
60
|
+
/** True when a WSL distro was positively detected - advisory, not a veto. */
|
|
61
|
+
readonly wslPreferred?: boolean;
|
|
62
|
+
/** One-shot human-readable notes for the plugin log. */
|
|
63
|
+
readonly notes: readonly string[];
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The whole decision table for one startup. Call ONLY when the payload feature
|
|
67
|
+
* is enabled; the caller wires the resulting `bashPath` into the gitbash slot
|
|
68
|
+
* of `resolveAllPaths` as the last-resort source.
|
|
69
|
+
*/
|
|
70
|
+
export declare function resolvePayloadBash(config: {
|
|
71
|
+
payloadBashPath?: string;
|
|
72
|
+
}, probe?: PayloadProbe, env?: NodeJS.ProcessEnv): PayloadOutcome;
|