dsh-bash-terminal-ts 0.9.0 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/CHANGELOG.md +205 -201
  2. package/CHANGELOG.pt.md +151 -0
  3. package/README.de.md +206 -206
  4. package/README.en.md +212 -212
  5. package/README.es.md +206 -206
  6. package/README.fr.md +206 -206
  7. package/README.it.md +206 -206
  8. package/README.md +423 -423
  9. package/README.pt.md +212 -0
  10. package/README.ru.md +206 -206
  11. package/agent-presets/README.md +171 -171
  12. package/agent-presets/install-presets.mjs +180 -180
  13. package/agent-presets/standard-win/agent.cordis.yml +271 -271
  14. package/agent-presets/standard-win/preset.yml +2 -2
  15. package/agent-presets/standard-win-gitbash/agent.cordis.yml +271 -271
  16. package/agent-presets/standard-win-gitbash/preset.yml +2 -2
  17. package/agent-presets/standard-win-msys2/agent.cordis.yml +272 -272
  18. package/agent-presets/standard-win-msys2/preset.yml +2 -2
  19. package/agent-presets/standard-win-niu/agent.cordis.yml +270 -270
  20. package/agent-presets/standard-win-niu/preset.yml +2 -2
  21. package/agent-presets/standard-win-payload/agent.cordis.yml +271 -271
  22. package/agent-presets/standard-win-payload/preset.yml +2 -2
  23. package/agent-presets/standard-win-wsl2/agent.cordis.yml +271 -271
  24. package/agent-presets/standard-win-wsl2/preset.yml +2 -2
  25. package/cordis.patch.yml +72 -84
  26. package/dist/client.core.js +54 -16
  27. package/dist/client.js +54 -16
  28. package/docs/niu-backend.md +197 -197
  29. package/dsh.plugin.json +23 -22
  30. package/lib/client.js +54 -16
  31. package/lib/dsh-types.d.ts +0 -2
  32. package/lib/index.d.ts +2 -23
  33. package/lib/index.js +4 -34
  34. package/lib/locales.js +49 -11
  35. package/lib/payload.d.ts +72 -72
  36. package/lib/payload.js +279 -279
  37. package/lib/shell-id.d.ts +2 -2
  38. package/lib/shells.d.ts +2 -11
  39. package/lib/shells.js +4 -14
  40. package/lib/terminal.js +0 -1
  41. package/lib/webterminals/catalog.d.ts +0 -2
  42. package/lib/webterminals/catalog.js +0 -1
  43. package/lib/webterminals/mount.d.ts +0 -5
  44. package/lib/webterminals/mount.js +0 -4
  45. package/locale/de.json +5 -5
  46. package/locale/en.json +5 -5
  47. package/locale/es.json +5 -5
  48. package/locale/fr.json +5 -5
  49. package/locale/it.json +5 -5
  50. package/locale/ja.json +5 -5
  51. package/locale/ko.json +5 -5
  52. package/locale/pt.json +6 -0
  53. package/locale/ru.json +5 -5
  54. package/locale/zh.json +5 -5
  55. package/package.json +3 -5
  56. package/scripts/check-artifacts.mjs +96 -96
  57. package/scripts/link-shells.mjs +0 -21
  58. package/src/client.tsx +685 -685
  59. package/src/dsh-types.ts +330 -332
  60. package/src/index.ts +1267 -1316
  61. package/src/locales.ts +499 -461
  62. package/src/shell-id.ts +11 -11
  63. package/src/shells.ts +263 -279
  64. package/src/terminal.ts +615 -616
  65. package/src/webterminals/catalog.ts +0 -3
  66. package/src/webterminals/host.ts +361 -361
  67. package/src/webterminals/mount.ts +228 -237
  68. package/scripts/payload-alias.mjs +0 -97
  69. package/scripts/provision-payload.mjs +0 -233
  70. package/src/payload.ts +0 -322
package/lib/index.d.ts CHANGED
@@ -4,7 +4,7 @@ export declare const name = "bash-terminal";
4
4
  /** Services required before the tool can register. */
5
5
  export declare const inject: string[];
6
6
  /** The terminal backends this tool exposes, in catalog order. */
7
- export declare const SHELLS: readonly ["powershell", "gitbash", "msys2", "wsl", "payload", "niu"];
7
+ export declare const SHELLS: readonly ["powershell", "gitbash", "msys2", "wsl", "niu"];
8
8
  /** The backend used when the caller does not name one. */
9
9
  export declare const DEFAULT_SHELL: ShellId;
10
10
  /** Static shape of the runtime configuration schema. */
@@ -41,29 +41,8 @@ export interface ConfigValues {
41
41
  shellGitBash: boolean;
42
42
  shellMsys2: boolean;
43
43
  shellWsl: boolean;
44
- /**
45
- * Activation switch for the payload row in the bottom-terminal UI. Separate
46
- * from `enablePosixPayload` (the operator gate that RUNS the digest check at
47
- * startup): this one only decides whether a resolved payload may appear in
48
- * pickers. Default false - the payload is opt-in twice, provisioning and
49
- * activation.
50
- */
51
- shellPayload: boolean;
52
44
  /** WSL distribution for the browser terminal; '' means the WSL default. */
53
45
  wslDistro: string;
54
- /**
55
- * Pinned backup POSIX runtime payload (see src/payload.ts - the artifact is
56
- * a Git-for-Windows tree; OUR name avoids the bash/msys tokens by policy).
57
- * Default off; enabling it lets a digest-verified payload fill the Git Bash
58
- * slot as a LAST-RESORT source when the machine has no system Git Bash. A
59
- * detected WSL distro outranks the payload entirely (a real WSL bash is the
60
- * better POSIX shell), and an unverifiable payload fails closed - it is
61
- * never run, never silently replaced. Resolved at startup, so toggling
62
- * takes effect on the next restart.
63
- */
64
- enablePosixPayload: boolean;
65
- /** Explicit payload root or bin/bash.exe path; '' = auto-discovery only. */
66
- payloadPosixPath: string;
67
46
  /** Fixed niu.exe path; '' = auto-discovery via candidateNiuPaths. */
68
47
  niuPath: string;
69
48
  /** Activation switch for the Niubash row (default true: detected means on). */
@@ -108,7 +87,7 @@ export declare function defaultWslPath(env?: NodeJS.ProcessEnv): string;
108
87
  /** Executable paths, possibly undefined when a backend is not installed. */
109
88
  export type { ResolvedPaths };
110
89
  type PathConfig = Partial<Pick<ConfigValues, "pwshPath" | "gitBashPath" | "msys2Path" | "wslPath" | "niuPath">>;
111
- export declare function resolveAllPaths(config?: PathConfig, env?: NodeJS.ProcessEnv, payloadBash?: string): ResolvedPaths;
90
+ export declare function resolveAllPaths(config?: PathConfig, env?: NodeJS.ProcessEnv): ResolvedPaths;
112
91
  export declare function buildArgv(shell: string, command: string, paths: ResolvedPaths, distro?: string): Array<string | undefined>;
113
92
  /**
114
93
  * Merge the DSH_* environment over the process environment. For WSL, only
package/lib/index.js CHANGED
@@ -26,7 +26,6 @@ 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";
30
29
  /** Stable Cordis plugin name. */
31
30
  export const name = "bash-terminal";
32
31
  /** Composition entry id (the `tool-bash-terminal` row the bundle patch declares). */
@@ -34,7 +33,7 @@ const ENTRY_ID = "tool-bash-terminal";
34
33
  /** Services required before the tool can register. */
35
34
  export const inject = ["tools", "systemPrompt", "shellEnv", "subprocess", "settings", "sandbox", "sandboxPolicy"];
36
35
  /** The terminal backends this tool exposes, in catalog order. */
37
- export const SHELLS = ["powershell", "gitbash", "msys2", "wsl", "payload", "niu"];
36
+ export const SHELLS = ["powershell", "gitbash", "msys2", "wsl", "niu"];
38
37
  /** The backend used when the caller does not name one. */
39
38
  export const DEFAULT_SHELL = "powershell";
40
39
  /** Default per-command timeout (ms). */
@@ -73,12 +72,7 @@ export const Config = z.object({
73
72
  shellGitBash: z.boolean().default(true).volatile(),
74
73
  shellMsys2: z.boolean().default(true).volatile(),
75
74
  shellWsl: z.boolean().default(true).volatile(),
76
- shellPayload: z.boolean().default(false).volatile(),
77
75
  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(""),
82
76
  niuPath: z.string().default(""),
83
77
  shellNiu: z.boolean().default(true).volatile()
84
78
  });
@@ -198,7 +192,7 @@ export function defaultWslPath(env = process.env) {
198
192
  const systemRoot = env.SystemRoot ?? "C:\\Windows";
199
193
  return join(systemRoot, "System32", "wsl.exe");
200
194
  }
201
- export function resolveAllPaths(config = {}, env = process.env, payloadBash) {
195
+ export function resolveAllPaths(config = {}, env = process.env) {
202
196
  const pwsh = config.pwshPath && config.pwshPath.trim().length > 0
203
197
  ? config.pwshPath
204
198
  : resolveFromCandidates(candidatePwshPaths(env));
@@ -214,10 +208,7 @@ export function resolveAllPaths(config = {}, env = process.env, payloadBash) {
214
208
  const niu = config.niuPath && config.niuPath.trim().length > 0
215
209
  ? config.niuPath
216
210
  : resolveFromCandidates(candidateNiuPaths(env));
217
- // The payload is its OWN backend (first-class catalog row) - it never
218
- // silently substitutes for the gitbash slot, so a row labelled "Git Bash"
219
- // always names a shell the machine actually has.
220
- return { pwsh, gitbash, msys2, wsl, niu, ...(payloadBash !== undefined ? { payload: payloadBash } : {}) };
211
+ return { pwsh, gitbash, msys2, wsl, niu };
221
212
  }
222
213
  // ---- argv / env construction ------------------------------------------------
223
214
  export function buildArgv(shell, command, paths, distro) {
@@ -231,10 +222,6 @@ export function buildArgv(shell, command, paths, distro) {
231
222
  // /usr/bin and /mingw64/bin on PATH. With a bare -c, `tr`, `sed`, `gcc`
232
223
  // and friends are all "command not found".
233
224
  return [paths.msys2, "-lc", command];
234
- case "payload":
235
- // Same login-shell rule as msys2/gitbash: the payload is a
236
- // Git-for-Windows tree and `-lc` is what gives it a usable PATH.
237
- return [paths.payload, "-lc", command];
238
225
  case "niu":
239
226
  // Same login-shell rule: -lc sources the profile chain so winuxcmd's
240
227
  // bin directory joins PATH. (niu has no MSYS runtime; see findings F2
@@ -458,7 +445,6 @@ export const SHELL_DESCRIPTIONS = {
458
445
  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.",
459
446
  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.",
460
447
  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.",
461
- 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.",
462
448
  niu: "Execute a bash command (Niubash niu -lc <command>) and return its stdout/stderr. GNU bash 5.3 semantics; WinuxCmd applets (ls, cp, rm, grep, find, cat, sed, awk, ...) are on PATH; native Windows paths such as C:\\... are kept as-is while /c/... style arguments are translated; environment variables via $NAME. Niubash is a native binary with no MSYS emulation layer, so /dev/* redirects other than /dev/null do not exist; its startup file is ~/.niubashrc."
463
449
  };
464
450
  /**
@@ -593,20 +579,7 @@ export async function persistConfigValue(svc, path, value) {
593
579
  }
594
580
  // ---- plugin -------------------------------------------------------------------
595
581
  export function apply(ctx, config = {}) {
596
- // Pinned backup POSIX runtime payload: opt-in, its OWN backend slot. A
597
- // detected WSL distro is an advisory note only (the official menu lists both
598
- // side by side, so our picker must not be stricter); the digest gate is the
599
- // only hard no: an unverified payload simply does not run.
600
- let payloadBash;
601
- const payloadSuppressed = false;
602
- if (config.enablePosixPayload === true && process.platform === "win32") {
603
- const outcome = resolvePayloadBash({ payloadBashPath: config.payloadPosixPath ?? "" });
604
- if (outcome.engaged)
605
- payloadBash = outcome.bashPath;
606
- for (const note of outcome.notes)
607
- ctx.logger?.warn?.(`dsh-bash-terminal-ts: ${note}`);
608
- }
609
- const paths = resolveAllPaths(config, process.env, payloadBash);
582
+ const paths = resolveAllPaths(config, process.env);
610
583
  // 0.1.7: `defaultShell` is a `.volatile()` config field — the loader hands
611
584
  // `apply` a live ref and the latest value is resolved on every read; there
612
585
  // is no settings registration call anymore (removed with the 0.1.7 host).
@@ -650,8 +623,6 @@ export function apply(ctx, config = {}) {
650
623
  return read(config.shellMsys2, true);
651
624
  if (shell === "wsl")
652
625
  return read(config.shellWsl, true);
653
- if (shell === "payload")
654
- return read(config.shellPayload, false);
655
626
  if (shell === "niu")
656
627
  return read(config.shellNiu, true);
657
628
  return false;
@@ -681,7 +652,6 @@ export function apply(ctx, config = {}) {
681
652
  config: config,
682
653
  paths,
683
654
  configuredShell: storedShell,
684
- payloadSuppressed: () => payloadSuppressed,
685
655
  persist: async (svc, path, value) => {
686
656
  await persistConfigValue(svc, path, value);
687
657
  // ≤0.1.6 hosts have no config hot-reload, so mirror a defaultShell write into
package/lib/locales.js CHANGED
@@ -1,4 +1,4 @@
1
- // The client dictionary for the settings surface, all nine host languages.
1
+ // The client dictionary for the settings surface, all ten host languages.
2
2
  //
3
3
  // `zh` is the key source: every other language is typed `Record<keyof typeof zh,
4
4
  // string>`, so a missing or misspelled key is a compile error rather than a
@@ -24,7 +24,6 @@ const zh = {
24
24
  "dock.state.available": "可用",
25
25
  "dock.state.notInstalled": "未探测到",
26
26
  "dock.state.wslPreferred": "已检测到 WSL 发行版(优先用 WSL bash)",
27
- "shell.payload": "POSIX payload",
28
27
  "shell.niu": "Niubash",
29
28
  "dock.state.noDistro": "无已安装发行版",
30
29
  "dock.state.launcherOnly": "只找到启动器,无法内嵌",
@@ -72,7 +71,6 @@ const en = {
72
71
  "dock.state.available": "Available",
73
72
  "dock.state.notInstalled": "Not found",
74
73
  "dock.state.wslPreferred": "WSL distro detected (WSL bash preferred)",
75
- "shell.payload": "POSIX payload",
76
74
  "shell.niu": "Niubash",
77
75
  "dock.state.noDistro": "No distro installed",
78
76
  "dock.state.launcherOnly": "Only a launcher was found; it cannot be embedded",
@@ -120,7 +118,6 @@ const ja = {
120
118
  "dock.state.available": "利用可",
121
119
  "dock.state.notInstalled": "見つかりません",
122
120
  "dock.state.wslPreferred": "WSL ディストリ検出済み(WSL bash 優先)",
123
- "shell.payload": "POSIX payload",
124
121
  "shell.niu": "Niubash",
125
122
  "dock.state.noDistro": "インストール済みディストリビューションなし",
126
123
  "dock.state.launcherOnly": "ランチャーのみ検出、埋め込み不可",
@@ -168,7 +165,6 @@ const ko = {
168
165
  "dock.state.available": "사용 가능",
169
166
  "dock.state.notInstalled": "탐지되지 않음",
170
167
  "dock.state.wslPreferred": "WSL 배포판 감지됨 (WSL bash 우선)",
171
- "shell.payload": "POSIX payload",
172
168
  "shell.niu": "Niubash",
173
169
  "dock.state.noDistro": "설치된 배포판 없음",
174
170
  "dock.state.launcherOnly": "런처만 발견되어 내장할 수 없음",
@@ -216,7 +212,6 @@ const fr = {
216
212
  "dock.state.available": "Disponible",
217
213
  "dock.state.notInstalled": "Non détecté",
218
214
  "dock.state.wslPreferred": "Distro WSL détectée (bash WSL préféré)",
219
- "shell.payload": "POSIX payload",
220
215
  "shell.niu": "Niubash",
221
216
  "dock.state.noDistro": "Aucune distribution installée",
222
217
  "dock.state.launcherOnly": "Seuls des lanceurs ont été trouvés; intégration impossible",
@@ -264,7 +259,6 @@ const de = {
264
259
  "dock.state.available": "Verfügbar",
265
260
  "dock.state.notInstalled": "Nicht gefunden",
266
261
  "dock.state.wslPreferred": "WSL-Distro erkannt (WSL bash bevorzugt)",
267
- "shell.payload": "POSIX payload",
268
262
  "shell.niu": "Niubash",
269
263
  "dock.state.noDistro": "Keine Distribution installiert",
270
264
  "dock.state.launcherOnly": "Nur Launcher gefunden; Einbettung nicht möglich",
@@ -312,7 +306,6 @@ const it = {
312
306
  "dock.state.available": "Disponibile",
313
307
  "dock.state.notInstalled": "Non trovato",
314
308
  "dock.state.wslPreferred": "Distro WSL rilevata (bash WSL preferito)",
315
- "shell.payload": "POSIX payload",
316
309
  "shell.niu": "Niubash",
317
310
  "dock.state.noDistro": "Nessuna distribuzione installata",
318
311
  "dock.state.launcherOnly": "Trovato solo un launcher; incorporamento non possibile",
@@ -360,7 +353,6 @@ const ru = {
360
353
  "dock.state.available": "Доступен",
361
354
  "dock.state.notInstalled": "Не найден",
362
355
  "dock.state.wslPreferred": "Обнаружен дистрибутив WSL (предпочтительнее WSL bash)",
363
- "shell.payload": "POSIX payload",
364
356
  "shell.niu": "Niubash",
365
357
  "dock.state.noDistro": "Нет установленных дистрибутивов",
366
358
  "dock.state.launcherOnly": "Найден только лаунчер, встраивание невозможно",
@@ -408,7 +400,6 @@ const es = {
408
400
  "dock.state.available": "Disponible",
409
401
  "dock.state.notInstalled": "No detectado",
410
402
  "dock.state.wslPreferred": "Distro de WSL detectada (se prefiere bash de WSL)",
411
- "shell.payload": "POSIX payload",
412
403
  "shell.niu": "Niubash",
413
404
  "dock.state.noDistro": "Sin distribución instalada",
414
405
  "dock.state.launcherOnly": "Solo se encontró un lanzador; no se puede incrustar",
@@ -443,7 +434,54 @@ const es = {
443
434
  "tab.phase.exited": "terminado",
444
435
  "tab.phase.failed": "falló",
445
436
  };
437
+ const pt = {
438
+ "shell.title": "Terminal padrão",
439
+ "shell.description": "Terminal usado pela ferramenta shell para executar comandos",
440
+ "shell.powershell": "PowerShell",
441
+ "shell.gitbash": "Git Bash",
442
+ "shell.msys2": "MSYS2",
443
+ "shell.wsl": "WSL",
444
+ "shell.unavailable": "Configuração indisponível: a ponte de configuração do host não respondeu (verifique se o host é a linha compat)",
445
+ "dock.title": "Terminal inferior",
446
+ "dock.hint": "Essas chaves valem tanto para o terminal do painel inferior quanto para os backends selecionáveis da ferramenta shell (PowerShell é o piso, sempre disponível). O terminal oficial da coluna direita não muda.",
447
+ "dock.state.available": "Disponível",
448
+ "dock.state.notInstalled": "Não detectado",
449
+ "dock.state.wslPreferred": "Distro WSL detectada (bash do WSL preferido)",
450
+ "shell.niu": "Niubash",
451
+ "dock.state.noDistro": "Nenhuma distribuição instalada",
452
+ "dock.state.launcherOnly": "Apenas um lançador foi encontrado; não é possível incorporá-lo",
453
+ "dock.powershell.locked": "PowerShell é o backend de último recurso e não pode ser desativado.",
454
+ "dock.defaultChoice": "Shell padrão (apenas as ativas e disponíveis aparecem na lista)",
455
+ "dock.wslDistro": "Distribuição WSL (vazio usa a padrão do WSL)",
456
+ "dock.fallback.notice": "{from} não está disponível agora; este terminal foi iniciado com {to}.",
457
+ "dock.floor.notice": "Todas as shells estão desativadas ou indisponíveis; {to} foi usado como último recurso.",
458
+ "dock.unavailable.noPty": "Nenhum backend PTY disponível neste computador: o node-pty não foi compilado e o host não expõe a costura de terminal (execute pnpm approve-builds).",
459
+ "dock.unavailable.noSocket": "O host não expõe um canal de upgrade de WebSocket; o terminal inferior não recebe saída.",
460
+ "dock.unavailable.notInstalled": "O host ainda não montou as rotas de terminal; o terminal inferior está indisponível.",
461
+ "dock.hostProvided": "O terminal do host está no comando; este plugin se colocou de lado.",
462
+ "dock.applying": "Salvando…",
463
+ "dock.failed": "Falha ao gravar: {message}",
464
+ "dock.terminals": "{count} terminal(is) em execução",
465
+ "dock.refresh": "Redetectar",
466
+ "dock.enabled.title": "Ativar o terminal inferior",
467
+ "dock.enabled.description": "Chave geral: desligada oculta as subchaves das shells e recusa alocações",
468
+ "dock.enabled.off": "Desligado. As subchaves das shells disponíveis aparecem ao ligá-lo",
469
+ "dock.shim.title": "Assumir a linha do terminal oficial",
470
+ "dock.shim.description": "Ative apenas se o host não tem controlador de terminal. Publicar duas vezes o mesmo serviço faz o outro provedor falhar; desligado por padrão.",
471
+ "dock.shim.published": "Assumida: a linha «Terminal» oficial agora é alimentada por este plugin",
472
+ "dock.shim.hostProvides": "O host já publica webTerminals; nada foi assumido (a linha oficial já funciona)",
473
+ "dock.state.floor": "último recurso",
474
+ "tab.title": "Terminal (multi-shell)",
475
+ "tab.description": "Abre Git Bash / MSYS2 / WSL / PowerShell sobre o backend PTY deste plugin, ao lado do terminal oficial",
476
+ "tab.new": "Novo",
477
+ "tab.noShell": "Nenhuma shell disponível (ative uma nos ajustes)",
478
+ "tab.phase.allocating": "alocando",
479
+ "tab.phase.connecting": "conectando",
480
+ "tab.phase.running": "em execução",
481
+ "tab.phase.exited": "encerrado",
482
+ "tab.phase.failed": "falhou",
483
+ };
446
484
  /** The registered dictionary, one row per host language. */
447
- export const dictionaries = { zh, en, ja, ko, fr, de, it, ru, es };
485
+ export const dictionaries = { zh, en, ja, ko, fr, de, it, ru, es, pt };
448
486
  /** The Chinese fallback used when the host exposes no `locale.bind` (0.1.0/0.1.1). */
449
487
  export const fallbackDict = { ...zh };
package/lib/payload.d.ts CHANGED
@@ -1,72 +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;
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;