dsh-code 1.0.7 → 1.2.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.
Files changed (81) hide show
  1. package/README.en.md +70 -24
  2. package/README.md +71 -25
  3. package/bin/deepseek.mjs +202 -39
  4. package/cordis.patch.yml +13 -4
  5. package/lib/index.mjs +4063 -844
  6. package/lib/session-query.mjs +3 -2
  7. package/lib/startup.mjs +4 -4
  8. package/lib/{theme-DCT8Y2xf.mjs → theme-7u5Qo3dF.mjs} +657 -20
  9. package/lib/types/app.d.ts +100 -63
  10. package/lib/types/authorization-panel.d.ts +3 -3
  11. package/lib/types/git-workflow.d.ts +91 -2
  12. package/lib/types/i18n.d.ts +39 -0
  13. package/lib/types/index.d.ts +73 -1
  14. package/lib/types/input-split.d.ts +1 -1
  15. package/lib/types/kernel-panels.d.ts +86 -31
  16. package/lib/types/language-panel.d.ts +12 -0
  17. package/lib/types/locales/en.d.ts +450 -0
  18. package/lib/types/locales/zh.d.ts +9 -0
  19. package/lib/types/mentions.d.ts +7 -3
  20. package/lib/types/models.d.ts +14 -0
  21. package/lib/types/panel-accent.d.ts +28 -0
  22. package/lib/types/rainbow.d.ts +69 -0
  23. package/lib/types/render/animations.d.ts +42 -0
  24. package/lib/types/render/inspector.d.ts +26 -0
  25. package/lib/types/render/lines.d.ts +21 -1
  26. package/lib/types/render/markdown.d.ts +1 -1
  27. package/lib/types/render/projection.d.ts +95 -4
  28. package/lib/types/render/status.d.ts +8 -8
  29. package/lib/types/render/text.d.ts +6 -0
  30. package/lib/types/render/usage.d.ts +113 -0
  31. package/lib/types/session-directory.d.ts +17 -0
  32. package/lib/types/startup.d.ts +1 -1
  33. package/lib/types/terminal-title.d.ts +8 -0
  34. package/lib/types/theme-panel.d.ts +2 -2
  35. package/lib/types/theme.d.ts +271 -52
  36. package/lib/types/update-panel.d.ts +5 -5
  37. package/lib/types/update.d.ts +10 -1
  38. package/lib/types/version.d.ts +4 -3
  39. package/package.json +24 -7
  40. package/src/app.ts +1155 -478
  41. package/src/approval.ts +166 -166
  42. package/src/authorization-panel.ts +19 -16
  43. package/src/editor-keys.ts +371 -371
  44. package/src/git-workflow.ts +229 -3
  45. package/src/i18n.ts +68 -0
  46. package/src/index.ts +412 -76
  47. package/src/input-split.ts +3 -3
  48. package/src/kernel-panels.ts +471 -89
  49. package/src/keyboard.ts +5 -4
  50. package/src/language-panel.ts +53 -0
  51. package/src/locales/en.ts +489 -0
  52. package/src/locales/zh.ts +488 -0
  53. package/src/mentions.ts +8 -4
  54. package/src/models.ts +264 -212
  55. package/src/panel-accent.ts +41 -0
  56. package/src/presets.ts +1 -1
  57. package/src/provider-settings.ts +1 -1
  58. package/src/rainbow.ts +208 -0
  59. package/src/render/animations.ts +104 -6
  60. package/src/render/editor.ts +20 -20
  61. package/src/render/export.ts +116 -95
  62. package/src/render/inspector.ts +42 -0
  63. package/src/render/lines.ts +628 -415
  64. package/src/render/markdown.ts +15 -3
  65. package/src/render/projection.ts +429 -19
  66. package/src/render/status.ts +41 -35
  67. package/src/render/text.ts +14 -0
  68. package/src/render/tool-preview.ts +77 -77
  69. package/src/render/usage.ts +430 -0
  70. package/src/render/width.ts +2 -2
  71. package/src/session-directory.ts +8 -6
  72. package/src/session-query.ts +8 -4
  73. package/src/startup.ts +3 -3
  74. package/src/subagents.ts +229 -229
  75. package/src/terminal-title.ts +22 -5
  76. package/src/theme-panel.ts +17 -21
  77. package/src/theme.ts +281 -33
  78. package/src/update-panel.ts +37 -27
  79. package/src/update.ts +19 -3
  80. package/src/version.ts +58 -20
  81. package/src/whale-glyph.ts +23 -23
package/src/version.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  /** Installed dsh-code version exposed by the terminal header. */
2
2
 
3
- import { readFileSync } from 'node:fs'
3
+ import { readFileSync, realpathSync } from 'node:fs'
4
+ import { createRequire } from 'node:module'
4
5
  import { dirname, join, resolve } from 'node:path'
5
6
 
6
7
  /** Read one package manifest version without making terminal startup depend on it. */
@@ -22,27 +23,28 @@ const DSH_HOST_PACKAGE_NAME = '@deepseek-ai/dsh'
22
23
  /** Parent levels above the host entry allowed to hold its package manifest. */
23
24
  const DSH_HOST_WALK_LIMIT = 4
24
25
 
25
- /**
26
- * Resolve the running dsh CLI host's version from its entry file
27
- * (`process.argv[1]`, e.g. `.../@deepseek-ai/dsh/lib/bin.js`). Only a manifest
28
- * literally named `@deepseek-ai/dsh` counts, so an unrelated entry (vitest, a
29
- * plain node script) resolves to undefined instead of faking a kernel version.
30
- */
31
- export function resolveDshHostVersion(entry: string | undefined = process.argv[1]): string | undefined {
32
- if (entry === undefined || entry === '') return undefined
26
+ /** Read `@deepseek-ai/dsh`'s version from a directory's package.json, or undefined. */
27
+ function readHostVersion(directory: string): string | undefined {
28
+ try {
29
+ const parsed = JSON.parse(readFileSync(join(directory, 'package.json'), 'utf8')) as {
30
+ name?: unknown
31
+ version?: unknown
32
+ }
33
+ if (parsed.name === DSH_HOST_PACKAGE_NAME && typeof parsed.version === 'string' && parsed.version.length > 0) {
34
+ return parsed.version
35
+ }
36
+ } catch {
37
+ // No readable host manifest at this level.
38
+ }
39
+ return undefined
40
+ }
41
+
42
+ /** Climb from an entry file toward a host package.json. */
43
+ function walkFrom(entry: string): string | undefined {
33
44
  let directory = dirname(resolve(entry))
34
45
  for (let depth = 0; depth < DSH_HOST_WALK_LIMIT; depth += 1) {
35
- try {
36
- const parsed = JSON.parse(readFileSync(join(directory, 'package.json'), 'utf8')) as {
37
- name?: unknown
38
- version?: unknown
39
- }
40
- if (parsed.name === DSH_HOST_PACKAGE_NAME && typeof parsed.version === 'string' && parsed.version.length > 0) {
41
- return parsed.version
42
- }
43
- } catch {
44
- // No readable manifest at this level: keep climbing.
45
- }
46
+ const version = readHostVersion(directory)
47
+ if (version !== undefined) return version
46
48
  const parent = dirname(directory)
47
49
  if (parent === directory) return undefined
48
50
  directory = parent
@@ -50,6 +52,42 @@ export function resolveDshHostVersion(entry: string | undefined = process.argv[1
50
52
  return undefined
51
53
  }
52
54
 
55
+ /**
56
+ * Resolve the host package via Node's module lookup from an entry file.
57
+ * Covers global `bin/dsh` shims that are not inside the package tree.
58
+ */
59
+ function resolveFromNode(from: string): string | undefined {
60
+ try {
61
+ const manifest = createRequire(from).resolve(`${DSH_HOST_PACKAGE_NAME}/package.json`)
62
+ return readHostVersion(dirname(manifest))
63
+ } catch {
64
+ return undefined
65
+ }
66
+ }
67
+
68
+ /**
69
+ * Resolve the running dsh CLI host's version from its entry file
70
+ * (`process.argv[1]`, e.g. `.../@deepseek-ai/dsh/lib/bin.js` or a PATH
71
+ * symlink `.../bin/dsh` → that file). Only a manifest literally named
72
+ * `@deepseek-ai/dsh` counts, so an unrelated entry (vitest, a plain node
73
+ * script) resolves to undefined instead of faking a kernel version.
74
+ */
75
+ export function resolveDshHostVersion(entry: string | undefined = process.argv[1]): string | undefined {
76
+ if (entry === undefined || entry === '') return undefined
77
+ const fromWalk = walkFrom(entry)
78
+ if (fromWalk !== undefined) return fromWalk
79
+ try {
80
+ const real = realpathSync(entry)
81
+ if (real !== resolve(entry)) {
82
+ const fromReal = walkFrom(real)
83
+ if (fromReal !== undefined) return fromReal
84
+ }
85
+ } catch {
86
+ // Broken or missing symlink: fall through to Node resolution.
87
+ }
88
+ return resolveFromNode(resolve(entry))
89
+ }
90
+
53
91
  let cachedDshKernelVersion: string | undefined
54
92
  let dshKernelVersionResolved = false
55
93
 
@@ -1,23 +1,23 @@
1
- // GENERATED by scripts/gen-whale-glyph.ts — do not edit by hand. Rerun the
2
- // generator after changing the FishLogo path. Half-block rendering of the
3
- // DeepSeek fish logo (figma I39:24057;88:8943 fillGeometry, exact extract;
4
- // native 23.16x17.04 → 26 columns × 8 half-block rows).
5
- // Blank cells are part of the glyph's fixed 26-column grid: pad, never trim.
6
-
7
- /** Half-block whale glyph rows; render with the brand color. */
8
- export const WHALE_GLYPH: readonly string[] = [
9
- ' ▄▄▄▄▄▄▄▄█ ▄█▄ ▄',
10
- ' ▄▄██████████▄▄ ▀███▄████',
11
- '▄███████████████▄ ███▀▀▀ ',
12
- '██ ▀▀█████▄▀██████ ',
13
- '██▄ ▀████▄▄████ ',
14
- ' ██▄ ▀██████▀ ',
15
- ' ▀██▄▄ ██▄ ▀███▄▄ ',
16
- ' ▀▀███████▀▀ ▀▀▀ ',
17
- ]
18
-
19
- /** Fixed glyph width in terminal columns. */
20
- export const WHALE_GLYPH_COLUMNS = 26
21
-
22
- /** Fixed glyph height in half-block rows. */
23
- export const WHALE_GLYPH_ROWS = 8
1
+ // GENERATED by scripts/gen-whale-glyph.ts — do not edit by hand. Rerun the
2
+ // generator after changing the FishLogo path. Half-block rendering of the
3
+ // DeepSeek fish logo (figma I39:24057;88:8943 fillGeometry, exact extract;
4
+ // native 23.16x17.04 → 26 columns × 8 half-block rows).
5
+ // Blank cells are part of the glyph's fixed 26-column grid: pad, never trim.
6
+
7
+ /** Half-block whale glyph rows; render with the brand color. */
8
+ export const WHALE_GLYPH: readonly string[] = [
9
+ ' ▄▄▄▄▄▄▄▄█ ▄█▄ ▄',
10
+ ' ▄▄██████████▄▄ ▀███▄████',
11
+ '▄███████████████▄ ███▀▀▀ ',
12
+ '██ ▀▀█████▄▀██████ ',
13
+ '██▄ ▀████▄▄████ ',
14
+ ' ██▄ ▀██████▀ ',
15
+ ' ▀██▄▄ ██▄ ▀███▄▄ ',
16
+ ' ▀▀███████▀▀ ▀▀▀ ',
17
+ ]
18
+
19
+ /** Fixed glyph width in terminal columns. */
20
+ export const WHALE_GLYPH_COLUMNS = 26
21
+
22
+ /** Fixed glyph height in half-block rows. */
23
+ export const WHALE_GLYPH_ROWS = 8