@crazyhappyone/dsh-tui 0.1.0-alpha.3 → 0.1.0-alpha.5

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.i18n.yaml CHANGED
@@ -1,5 +1,5 @@
1
1
  # Bilingual-pair consistency record: both languages carry equal authority.
2
2
  # This source-only mirror has no DSH pairing runner. Recompute with:
3
3
  # git hash-object README.md README.zh.md
4
- README.md: 6ba38f56bdd03135d3b64978b0cb48bd011d67a7
5
- README.zh.md: 9fe961f55b084acfa9938638238ea71ab43c6147
4
+ README.md: 496d812168deb2af7d4a933f961b58c1cfd814cd
5
+ README.zh.md: 8474c7be4cf16c0d5123222bab95b5231f34e185
package/README.md CHANGED
@@ -7,6 +7,10 @@ kind: "package-group"
7
7
 
8
8
  English | [中文](README.zh.md)
9
9
 
10
+ [![CI](https://github.com/zhangyang-crazy-one/dsh-tui/actions/workflows/ci.yml/badge.svg)](https://github.com/zhangyang-crazy-one/dsh-tui/actions/workflows/ci.yml)
11
+ [![GitHub release](https://img.shields.io/github/v/release/zhangyang-crazy-one/dsh-tui?include_prereleases)](https://github.com/zhangyang-crazy-one/dsh-tui/releases)
12
+ [![npm next](https://img.shields.io/npm/v/%40crazyhappyone%2Fdsh-tui/next?label=npm%40next)](https://www.npmjs.com/package/@crazyhappyone/dsh-tui)
13
+
10
14
  ## Summary
11
15
 
12
16
  `@crazyhappyone/dsh-tui` provides the `dsh-tui` command for running and safely updating the DeepSeek Harness terminal interface. The launcher manages a dedicated DSH source checkout, so it never pulls, resets, stashes, or cleans a contributor's development checkout. This public repository also mirrors the `packages/tui/` bundle and renderer sources for review. DSH continues to own agents, sessions, tools, persistence, providers, permissions, and profile assembly.
@@ -40,22 +44,34 @@ After sending `你好`:
40
44
  -----
41
45
 
42
46
  <a id="install-the-launcher"></a>
43
- ## Install the launcher
47
+ ## Install the launcher and runtime modes
44
48
 
45
49
  The unscoped `dsh-tui` package belongs to another maintainer. This project publishes only under the authenticated `crazyhappyone` npm scope.
46
50
 
47
- 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:
48
52
 
49
- 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):
50
55
 
51
56
  ```text
57
+ npm install --global @deepseek-ai/dsh
52
58
  npm install --global @crazyhappyone/dsh-tui@next
53
- dsh-tui version
54
- dsh-tui update
59
+ dsh-tui probe
55
60
  dsh-tui
56
61
  ```
57
62
 
58
- 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.
59
75
 
60
76
  -----
61
77
 
@@ -146,30 +162,26 @@ The launcher runtime must remain separate from the development checkout. To test
146
162
  <a id="publish-the-npm-package"></a>
147
163
  ## Publish the npm package
148
164
 
149
- The operator authenticates through npm's browser flow and verifies the selected account:
165
+ GitHub Actions tests every pull request and push to `main` on Node 22.19 and 24. Publishing starts only when a GitHub Release is published. The workflow rejects a release tag unless it equals `v` followed by the version in `package.json`; prereleases publish to npm's `next` tag and stable releases publish to `latest`.
150
166
 
151
- ```text
152
- npm config delete //registry.npmjs.org/:_authToken
153
- npm config set registry https://registry.npmjs.org/
154
- npm login --registry=https://registry.npmjs.org/ --auth-type=web
155
- npm whoami
156
- ```
157
-
158
- `npm whoami` must print `crazyhappyone`. Never place the password, OTP, or npm token in this repository, an issue, command output captured for review, or an AI conversation.
159
-
160
- After tests and packed-install verification pass, publish a prerelease only with explicit operator approval:
167
+ Configure npm Trusted Publishing once after `publish.yml` is present on the default branch. npm CLI 11.5.1 or newer can register the GitHub workflow through an authenticated browser session. The command below runs a compatible npm 11 temporarily and does not replace the globally installed npm:
161
168
 
162
169
  ```text
163
- npm publish --access public --tag next
170
+ npx --yes npm@11 trust github @crazyhappyone/dsh-tui \
171
+ --file publish.yml \
172
+ --repository zhangyang-crazy-one/dsh-tui \
173
+ --allow-publish
164
174
  ```
165
175
 
166
- When npm requires two-factor authentication, the operator supplies the current code locally:
176
+ The equivalent npm website settings are organization or user `zhangyang-crazy-one`, repository `dsh-tui`, workflow filename `publish.yml`, with no environment restriction. The workflow uses GitHub OIDC and stores no npm token, password, or OTP.
177
+
178
+ For each release, bump `package.json`, merge the change after CI passes, then create a GitHub Release whose tag matches the package version:
167
179
 
168
180
  ```text
169
- npm publish --access public --tag next --otp=<six-digit-code>
181
+ gh release create v0.1.0-alpha.4 --prerelease --generate-notes
170
182
  ```
171
183
 
172
- Promotion to `latest` is a separate release decision. Local implementation and verification never create or change a registry package automatically.
184
+ The `Publish npm` workflow runs tests and packed-package verification again before publishing. Do not rerun an old release tag: npm versions are immutable. Promotion to stable is a new version and a non-prerelease GitHub Release.
173
185
 
174
186
  -----
175
187
 
package/README.zh.md CHANGED
@@ -7,6 +7,10 @@ kind: "package-group"
7
7
 
8
8
  [English](README.md) | 中文
9
9
 
10
+ [![CI](https://github.com/zhangyang-crazy-one/dsh-tui/actions/workflows/ci.yml/badge.svg)](https://github.com/zhangyang-crazy-one/dsh-tui/actions/workflows/ci.yml)
11
+ [![GitHub release](https://img.shields.io/github/v/release/zhangyang-crazy-one/dsh-tui?include_prereleases)](https://github.com/zhangyang-crazy-one/dsh-tui/releases)
12
+ [![npm next](https://img.shields.io/npm/v/%40crazyhappyone%2Fdsh-tui/next?label=npm%40next)](https://www.npmjs.com/package/@crazyhappyone/dsh-tui)
13
+
10
14
  ## 概述
11
15
 
12
16
  `@crazyhappyone/dsh-tui` 提供 `dsh-tui` 命令,用于运行和安全更新 DeepSeek Harness 终端界面。Launcher 管理专用 DSH 源码 checkout,因此不会 pull、reset、stash 或 clean 贡献者的开发 checkout。本公开仓库还镜像 `packages/tui/` bundle 与 renderer 源码以供审查。Agent、会话、工具、持久化、provider、权限与 profile 组装仍由 DSH 拥有。
@@ -40,22 +44,34 @@ kind: "package-group"
40
44
  -----
41
45
 
42
46
  <a id="install-the-launcher"></a>
43
- ## 安装 launcher
47
+ ## 安装 launcher 与运行模式
44
48
 
45
49
  无 scope 的 `dsh-tui` 包属于另一位 maintainer。本项目只在已认证的 `crazyhappyone` npm scope 下发布。
46
50
 
47
- Launcher 需要 Git、pnpm 与 DSH 支持的 Node 版本。无需单独安装 `@deepseek-ai/dsh`,launcher 也不会使用它:`dsh-tui` 始终从专用源码 checkout 运行 `deepseek-tui` profile。
51
+ `dsh-tui` 支持两种运行模式:
48
52
 
49
- 安装 prerelease 并完成首次启动:
53
+ ### 模式 A:轻量模式(推荐,零 Clone 秒开)
54
+ 只需通过 npm 全局安装官方核心引擎与 TUI launcher(仅数十 MB),即可直接运行:
50
55
 
51
56
  ```text
57
+ npm install --global @deepseek-ai/dsh
52
58
  npm install --global @crazyhappyone/dsh-tui@next
53
- dsh-tui version
54
- dsh-tui update
59
+ dsh-tui probe
55
60
  dsh-tui
56
61
  ```
57
62
 
58
- 安装 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` 查看当前探测到的运行引擎。
59
75
 
60
76
  -----
61
77
 
@@ -146,30 +162,26 @@ Launcher runtime 必须与开发 checkout 分离。要安全测试其他源码
146
162
  <a id="publish-the-npm-package"></a>
147
163
  ## 发布 npm 包
148
164
 
149
- Operator 通过 npm browser flow 认证,并验证所选账号:
165
+ GitHub Actions 会在每个 pull request 和向 `main` 的 push 上使用 Node 22.19 与 24 运行测试。只有发布 GitHub Release 才会启动 npm 发布。工作流要求 Release tag 等于 `v` 加 `package.json` 中的版本;prerelease 发布到 npm `next` tag,stable release 发布到 `latest`。
150
166
 
151
- ```text
152
- npm config delete //registry.npmjs.org/:_authToken
153
- npm config set registry https://registry.npmjs.org/
154
- npm login --registry=https://registry.npmjs.org/ --auth-type=web
155
- npm whoami
156
- ```
157
-
158
- `npm whoami` 必须打印 `crazyhappyone`。绝不要把密码、OTP 或 npm token 放入本仓库、issue、供审查捕获的命令输出或 AI conversation。
159
-
160
- 测试与 packed-install 验证通过后,仅在 operator 显式批准时发布 prerelease:
167
+ 在 `publish.yml` 进入默认分支后,一次性配置 npm Trusted Publishing。npm CLI 11.5.1 或更高版本可以通过已认证的 browser session 注册 GitHub workflow。下面的命令会临时运行兼容的 npm 11,不替换全局安装的 npm:
161
168
 
162
169
  ```text
163
- npm publish --access public --tag next
170
+ npx --yes npm@11 trust github @crazyhappyone/dsh-tui \
171
+ --file publish.yml \
172
+ --repository zhangyang-crazy-one/dsh-tui \
173
+ --allow-publish
164
174
  ```
165
175
 
166
- npm 要求双因素认证时,operator 在本地提供当前验证码:
176
+ 对应的 npm 网站配置为:organization or user 填 `zhangyang-crazy-one`,repository 填 `dsh-tui`,workflow filename 填 `publish.yml`,environment 留空。工作流使用 GitHub OIDC,不保存 npm token、密码或 OTP。
177
+
178
+ 每次发布时,先提升 `package.json` 版本,等待 CI 通过并合并,然后创建 tag 与 package version 一致的 GitHub Release:
167
179
 
168
180
  ```text
169
- npm publish --access public --tag next --otp=<six-digit-code>
181
+ gh release create v0.1.0-alpha.4 --prerelease --generate-notes
170
182
  ```
171
183
 
172
- 提升到 `latest` 是单独的 release 决策。本地实现与验证绝不会自动创建或更改 registry package
184
+ `Publish npm` workflow 会在发布前再次运行测试与 packed-package 验证。不要重新运行旧的 release tag:npm version 不可覆盖。提升到 stable 必须使用新版本并发布 non-prerelease GitHub Release
173
185
 
174
186
  -----
175
187
 
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