dsh-bash-terminal-ts 0.7.2-compat.2 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/README.de.md +3 -2
  2. package/README.en.md +102 -3
  3. package/README.es.md +3 -2
  4. package/README.fr.md +3 -2
  5. package/README.it.md +3 -2
  6. package/README.md +198 -4
  7. package/README.ru.md +3 -2
  8. package/cordis.patch.yml +66 -0
  9. package/dist/client.core.js +7888 -79
  10. package/dist/client.js +7888 -79
  11. package/dsh.plugin.json +22 -22
  12. package/lib/browser-i18n.d.ts +4 -0
  13. package/lib/browser-i18n.js +23 -0
  14. package/lib/client.js +7888 -79
  15. package/lib/dsh-types.d.ts +10 -0
  16. package/lib/dsh.d.ts +2 -0
  17. package/lib/index.d.ts +43 -0
  18. package/lib/index.js +176 -91
  19. package/lib/locales.d.ts +4 -0
  20. package/lib/locales.js +422 -0
  21. package/lib/settings-surface.d.ts +20 -0
  22. package/lib/settings-surface.js +49 -0
  23. package/lib/shell-id.d.ts +2 -0
  24. package/lib/shell-id.js +9 -0
  25. package/lib/shells.d.ts +114 -0
  26. package/lib/shells.js +187 -0
  27. package/lib/terminal.d.ts +30 -1
  28. package/lib/terminal.js +18 -5
  29. package/lib/webterminals/catalog.d.ts +36 -0
  30. package/lib/webterminals/catalog.js +93 -0
  31. package/lib/webterminals/host.d.ts +67 -0
  32. package/lib/webterminals/host.js +278 -0
  33. package/lib/webterminals/mount.d.ts +46 -0
  34. package/lib/webterminals/mount.js +171 -0
  35. package/lib/webterminals/protocol.d.ts +94 -0
  36. package/lib/webterminals/protocol.js +9 -0
  37. package/lib/webterminals/pty.d.ts +42 -0
  38. package/lib/webterminals/pty.js +64 -0
  39. package/lib/webterminals/registry.d.ts +139 -0
  40. package/lib/webterminals/registry.js +353 -0
  41. package/lib/webterminals/ws.d.ts +54 -0
  42. package/lib/webterminals/ws.js +140 -0
  43. package/locale/de.json +4 -0
  44. package/locale/en.json +4 -0
  45. package/locale/es.json +4 -0
  46. package/locale/fr.json +4 -0
  47. package/locale/it.json +4 -0
  48. package/locale/ja.json +4 -0
  49. package/locale/ko.json +4 -0
  50. package/locale/ru.json +4 -0
  51. package/locale/zh.json +4 -0
  52. package/package.json +131 -121
  53. package/scripts/build-browser-tests.mjs +36 -0
  54. package/scripts/build-client.mjs +10 -0
  55. package/scripts/check-artifacts.mjs +93 -0
  56. package/scripts/link-shells.mjs +75 -0
  57. package/src/browser-i18n.ts +27 -0
  58. package/src/client.tsx +539 -134
  59. package/src/dsh-types.ts +6 -0
  60. package/src/dsh.ts +2 -0
  61. package/src/index.ts +146 -35
  62. package/src/locales.ts +434 -0
  63. package/src/settings-surface.ts +59 -0
  64. package/src/shell-id.ts +11 -0
  65. package/src/shells.ts +250 -0
  66. package/src/terminal.ts +34 -5
  67. package/src/webterminals/browser/api.ts +212 -0
  68. package/src/webterminals/browser/bridge.ts +188 -0
  69. package/src/webterminals/browser/css.d.ts +16 -0
  70. package/src/webterminals/browser/face.ts +151 -0
  71. package/src/webterminals/browser/shell-picker.tsx +98 -0
  72. package/src/webterminals/browser/store.ts +40 -0
  73. package/src/webterminals/browser/tab.tsx +136 -0
  74. package/src/webterminals/browser/testkit.ts +21 -0
  75. package/src/webterminals/browser/url.ts +70 -0
  76. package/src/webterminals/browser/view.ts +381 -0
  77. package/src/webterminals/browser/xterm.ts +269 -0
  78. package/src/webterminals/catalog.ts +114 -0
  79. package/src/webterminals/host.ts +361 -0
  80. package/src/webterminals/mount.ts +227 -0
  81. package/src/webterminals/protocol.ts +78 -0
  82. package/src/webterminals/pty.ts +90 -0
  83. package/src/webterminals/registry.ts +447 -0
  84. package/src/webterminals/ws.ts +166 -0
  85. package/tsconfig.client.json +9 -1
  86. package/tsconfig.json +1 -1
@@ -0,0 +1,75 @@
1
+ // Create the shell aliases the host's terminal menu needs, and say what is missing.
2
+ //
3
+ // Why this exists as a script: `@deepseek-ai/dsh-api-terminal-controller` builds its
4
+ // shell list with `discoverShells`, which keys a Map by the executable FILE NAME and
5
+ // keeps the earliest entry. Git Bash and MSYS2 are both `bash.exe`, so on the stock list
6
+ // one of them cannot appear at all - the fix is a hard link with its own name, which is
7
+ // free (same inode, no copy, deleting the link reverts it) but is a filesystem change
8
+ // outside this package.
9
+ //
10
+ // The two links are not equal in privilege: `C:\msys64` is user-writable, while
11
+ // `C:\Program Files\Git\bin` is not - CreateHardLink needs write access to the SOURCE
12
+ // file, so the Git link cannot be moved to a writable directory even though a link can
13
+ // physically live anywhere on the same volume (and it must not: bash derives its POSIX
14
+ // root from its own path). That one therefore needs an elevated run, and this script
15
+ // prints the exact command instead of failing with a bare EPERM.
16
+ //
17
+ // Run: node scripts/link-shells.mjs (checks and creates what it can)
18
+ // as Administrator: same command, to also create the Git one.
19
+
20
+ import { existsSync, linkSync, statSync } from "node:fs";
21
+
22
+ /** Each alias: the link to create and the shell it must point at. */
23
+ const ALIASES = [
24
+ {
25
+ id: "msys2",
26
+ link: "C:\\msys64\\usr\\bin\\msys-bash.exe",
27
+ source: "C:\\msys64\\usr\\bin\\bash.exe",
28
+ elevation: false,
29
+ },
30
+ {
31
+ id: "gitbash",
32
+ link: "C:\\Program Files\\Git\\bin\\git-bash.exe",
33
+ source: "C:\\Program Files\\Git\\bin\\bash.exe",
34
+ elevation: true,
35
+ },
36
+ ];
37
+
38
+ let blocked = 0;
39
+ let missing = 0;
40
+
41
+ for (const alias of ALIASES) {
42
+ if (!existsSync(alias.source)) {
43
+ // Not an error: a machine without MSYS2 should not gain an entry for it. The
44
+ // candidate stays listed in cordis.patch.yml and the host skips it per-candidate.
45
+ console.log(`skip ${alias.id.padEnd(8)} ${alias.source} not found on this machine`);
46
+ missing += 1;
47
+ continue;
48
+ }
49
+ if (existsSync(alias.link)) {
50
+ const a = statSync(alias.source);
51
+ const b = statSync(alias.link);
52
+ const shared = a.ino === b.ino && a.dev === b.dev;
53
+ console.log(`${shared ? "ok " : "BAD "} ${alias.id.padEnd(8)} ${alias.link}${shared ? ` (same inode, nlink=${b.nlink})` : " (exists but is NOT a hard link of the source!)"}`);
54
+ if (!shared) blocked += 1;
55
+ continue;
56
+ }
57
+ try {
58
+ linkSync(alias.source, alias.link);
59
+ console.log(`created ${alias.id.padEnd(8)} ${alias.link}`);
60
+ } catch (error) {
61
+ const code = error instanceof Error ? error.code ?? error.message : String(error);
62
+ console.log(`denied ${alias.id.padEnd(8)} ${code}`);
63
+ console.log(` run this in an elevated PowerShell or cmd:`);
64
+ console.log(` cmd /c mklink /H "${alias.link}" "${alias.source}"`);
65
+ blocked += 1;
66
+ }
67
+ }
68
+
69
+ console.log("");
70
+ if (blocked > 0) {
71
+ console.log(`${blocked} alias(es) still missing - the official shell menu will not offer them until they exist.`);
72
+ process.exitCode = 1;
73
+ } else {
74
+ console.log(missing === ALIASES.length ? "no MSYS2 / Git installs found; nothing to do" : "all present aliases are in place");
75
+ }
@@ -0,0 +1,27 @@
1
+ // The client-side translator handle, in its own module.
2
+ //
3
+ // Both halves of the browser code need it: the settings row (registered through
4
+ // `ctx.slots`) and the bottom-dock tab (rendered by dsh-better-sidebar's own tree,
5
+ // which passes us no provider). A React context would therefore reach neither
6
+ // cleanly, and the previous revision of this plugin solved it by reading the Chinese
7
+ // dictionary object directly - registered seven languages, rendered `zh`, silently
8
+ // wrong on every other locale.
9
+
10
+ import { fallbackDict } from "./locales.js";
11
+
12
+ /**
13
+ * The active translator. It starts on the Chinese dictionary rather than on the
14
+ * identity function, because the oldest hosts expose no `locale.bind` at all: showing
15
+ * raw keys there would be a regression, and Chinese is what those hosts show.
16
+ */
17
+ let current: (key: string, params?: Record<string, string | number>) => string = (key) => fallbackDict[key] ?? key;
18
+
19
+ /** Install the host-bound translator (called once from the client `apply`). */
20
+ export function setTranslator(fn: (key: string, params?: Record<string, string | number>) => string): void {
21
+ current = fn;
22
+ }
23
+
24
+ /** Translate a `settings.bash-terminal` key. */
25
+ export function tr(key: string, params?: Record<string, string | number>): string {
26
+ return current(key, params);
27
+ }