@crazyhappyone/dsh-tui 0.1.0-alpha.4 → 0.1.0-alpha.6

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.md CHANGED
@@ -44,22 +44,34 @@ After sending `你好`:
44
44
  -----
45
45
 
46
46
  <a id="install-the-launcher"></a>
47
- ## Install the launcher
47
+ ## Install the launcher and runtime modes
48
48
 
49
49
  The unscoped `dsh-tui` package belongs to another maintainer. This project publishes only under the authenticated `crazyhappyone` npm scope.
50
50
 
51
- The launcher requires Git, pnpm, and a DSH-supported Node version. Installing `@deepseek-ai/dsh` separately is neither required nor used: `dsh-tui` always runs the `deepseek-tui` profile from its dedicated source checkout.
51
+ `dsh-tui` supports two runtime modes:
52
52
 
53
- Install the prerelease and complete the first launch:
53
+ ### Mode A: Lightweight Mode (Recommended, Zero-Clone)
54
+ Install the official core engine and the TUI launcher globally (dozens of MB):
54
55
 
55
56
  ```text
57
+ npm install --global @deepseek-ai/dsh
56
58
  npm install --global @crazyhappyone/dsh-tui@next
57
- dsh-tui version
58
- dsh-tui update
59
+ dsh-tui probe
59
60
  dsh-tui
60
61
  ```
61
62
 
62
- Package installation creates only the launcher. It does not clone DSH, run `pnpm install`, prompt for Git credentials, or execute a postinstall script. The explicit `dsh-tui update` command creates the source runtime; its default private source requires repository authorization.
63
+ In this mode, the launcher automatically detects the installed `dsh` executable and mounts the bundled prebuilt TUI extension without cloning the 2GB monorepo.
64
+
65
+ ### Mode B: Source Mode (Developer / Debugging)
66
+ To debug or hack on TUI or DSH source directly:
67
+
68
+ ```text
69
+ npm install --global @crazyhappyone/dsh-tui@next
70
+ dsh-tui update
71
+ dsh-tui --source
72
+ ```
73
+
74
+ The explicit `dsh-tui update` command clones the monorepo via Git and runs `pnpm install`. You can use `dsh-tui probe` anytime to inspect the detected engine.
63
75
 
64
76
  -----
65
77
 
package/README.zh.md CHANGED
@@ -44,22 +44,34 @@ kind: "package-group"
44
44
  -----
45
45
 
46
46
  <a id="install-the-launcher"></a>
47
- ## 安装 launcher
47
+ ## 安装 launcher 与运行模式
48
48
 
49
49
  无 scope 的 `dsh-tui` 包属于另一位 maintainer。本项目只在已认证的 `crazyhappyone` npm scope 下发布。
50
50
 
51
- Launcher 需要 Git、pnpm 与 DSH 支持的 Node 版本。无需单独安装 `@deepseek-ai/dsh`,launcher 也不会使用它:`dsh-tui` 始终从专用源码 checkout 运行 `deepseek-tui` profile。
51
+ `dsh-tui` 支持两种运行模式:
52
52
 
53
- 安装 prerelease 并完成首次启动:
53
+ ### 模式 A:轻量模式(推荐,零 Clone 秒开)
54
+ 只需通过 npm 全局安装官方核心引擎与 TUI launcher(仅数十 MB),即可直接运行:
54
55
 
55
56
  ```text
57
+ npm install --global @deepseek-ai/dsh
56
58
  npm install --global @crazyhappyone/dsh-tui@next
57
- dsh-tui version
58
- dsh-tui update
59
+ dsh-tui probe
59
60
  dsh-tui
60
61
  ```
61
62
 
62
- 安装 npm 包只会创建 launcher。它不会 clone DSH、运行 `pnpm install`、请求 Git 凭据或执行 postinstall script。显式执行 `dsh-tui update` 才会创建源码运行时;其默认 private 源码需要仓库授权。
63
+ 在此模式下,launcher 会自动探测全局 `dsh`,并挂载预构建的 TUI 扩展,无需克隆 2GB monorepo 仓库。
64
+
65
+ ### 模式 B:源码模式(开发者调试)
66
+ 若需对 TUI 或 DSH 底层代码进行修改与调试:
67
+
68
+ ```text
69
+ npm install --global @crazyhappyone/dsh-tui@next
70
+ dsh-tui update
71
+ dsh-tui --source
72
+ ```
73
+
74
+ 显式执行 `dsh-tui update` 才会通过 Git 克隆源码并执行 `pnpm install`。可通过 `dsh-tui probe` 查看当前探测到的运行引擎。
63
75
 
64
76
  -----
65
77
 
package/bin/dsh-tui.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  /** Command-line entry for the dsh-tui source-runtime launcher. */
3
3
 
4
- import { lstatSync, mkdirSync, readFileSync } from 'node:fs'
4
+ import { lstatSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'
5
5
  import { constants, homedir } from 'node:os'
6
6
  import { fileURLToPath } from 'node:url'
7
7
  import { spawnSync } from 'node:child_process'
@@ -50,17 +50,21 @@ function signalOutcome(signal) {
50
50
 
51
51
  const manifest = JSON.parse(readFileSync(fileURLToPath(new URL('../package.json', import.meta.url)), 'utf8'))
52
52
 
53
+ const packageRoot = fileURLToPath(new URL('..', import.meta.url))
54
+
53
55
  try {
54
56
  const invocation = parseLauncherInvocation(process.argv.slice(2))
55
- const settings = resolveLauncherSettings({ env: process.env, homeDirectory: homedir() })
57
+ const settings = resolveLauncherSettings({ env: process.env, homeDirectory: homedir(), packageRoot })
56
58
  process.exitCode = runLauncher({
57
59
  invocation,
58
60
  settings,
59
61
  packageVersion: manifest.version,
62
+ env: process.env,
60
63
  adapters: {
61
64
  inspectPath,
62
65
  makeDirectory: path => mkdirSync(path, { recursive: true, mode: 0o700 }),
63
66
  readText: path => readFileSync(path, 'utf8'),
67
+ writeText: (path, content) => writeFileSync(path, content, 'utf8'),
64
68
  run,
65
69
  writeOut: text => process.stdout.write(text),
66
70
  writeError: text => process.stderr.write(text),
@@ -0,0 +1,73 @@
1
+ # The deepseek-tui bundle patch: terminal-surface mode directly over dsh-base.
2
+ # It mounts no Host, HTTP server, Web runtime, or browser plugin. An ordinary
3
+ # provider plugin parses --resume/--cwd and the task positional, then the
4
+ # terminal driver creates an Agent through the core registry and prints its
5
+ # durable result. Unlike the web surface, the agent plane stays process-wide:
6
+ # dsh-base keeps tool-bash/tool-fs/tool-todo and friends because the TUI is
7
+ # single-session and composes its agent process-wide.
8
+
9
+ - id: system-prompt
10
+ config:
11
+ persona: >-
12
+ You are a coding agent powered by the {{model}} model. Your working directory is {{cwd}}.
13
+ You are interacting with the user through the deepseek-tui terminal interface.
14
+
15
+ # The shared module-reload HMR row stays off; the launcher's watch-only
16
+ # fallback still keeps the user patch layers live until the run exits.
17
+ - id: hmr
18
+ disabled: true
19
+
20
+ - id: tools
21
+ config:
22
+ # Keep the same temporary process-wide Code Mode opt-in as the Web surface.
23
+ mode: !!js process.env.DSH_TOOLS_MODE
24
+
25
+ - id: approval
26
+ config:
27
+ policy: !!js "(process.env.DSH_PERMISSION_MODE ?? 'workspace-write') === 'danger-full-access' ? 'never' : 'ask'"
28
+
29
+ # Full-text session search stays disabled until the first Ctrl+K search (the
30
+ # base row's `openAt: never`). The TUI has no browser-latency concern, so the
31
+ # node:sqlite import and in-memory handle open lazily on first search.
32
+ - id: session-query-sqlite
33
+ config:
34
+ path: ':memory:'
35
+ openAt: first-search
36
+
37
+ - insert:
38
+ - id: tui-startup
39
+ name: "./dist/startup.js"
40
+
41
+ # Reads its task from the ordinary tuiStartup provider.
42
+ - id: tui-runtime
43
+ name: "./dist/index.js"
44
+ inject: [tuiStartup]
45
+ config:
46
+ task: !!js ctx.tuiStartup.task
47
+ resume: !!js ctx.tuiStartup.resume
48
+ cwd: !!js ctx.tuiStartup.cwd
49
+ frameStats: !!js ctx.tuiStartup.frameStats
50
+ # Render policy (overscan + stream pacing + scroll pacing + cache budgets).
51
+ # Loaded by the runtime Config schema; the values below mirror the
52
+ # schema defaults so the deployment layer owns the tunables. Override
53
+ # here to retune without touching the plugin.
54
+ renderPolicy:
55
+ transcriptOverscan: 16
56
+ stream:
57
+ frameIntervalMs: 16
58
+ entryDepth: 64
59
+ exitDepth: 32
60
+ entryOldestAgeMs: 500
61
+ exitOldestAgeMs: 250
62
+ entryDrainBackpressureMs: 100
63
+ exitDrainBackpressureMs: 50
64
+ catchUpRowsPerFrame: 16
65
+ scroll:
66
+ frameIntervalMs: 16
67
+ stepPerFrame: 1
68
+ wheelRows: 3
69
+ catchUpThreshold: 10
70
+ maxCatchUpStep: 8
71
+ cache:
72
+ maxRows: 4096
73
+ maxBytes: 4194304