@songtonyli/dsh-cli 0.1.38 → 0.1.39

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
@@ -26,7 +26,7 @@ workspace and no build step. Native packages that ship one build per platform
26
26
  ripgrep, the PTY backend's addons, sharp, koffi, and the Landlock launcher — are
27
27
  ordinary optional dependencies, so npm resolves the right one for your machine.
28
28
 
29
- Requires Node `^22.19.0 || >=24.0.0`. Version 0.1.38; `dsh --version`
29
+ Requires Node `^22.19.0 || >=24.0.0`. Version 0.1.39; `dsh --version`
30
30
  also reports the harness build the package was assembled from.
31
31
 
32
32
  ## License
package/bin/dsh.mjs CHANGED
@@ -18,7 +18,7 @@ const argv = process.argv.slice(2)
18
18
  // version this package publishes. Reporting only one of the two would make an
19
19
  // ordinary `npm install @songtonyli/dsh-cli@x` look like it installed something else.
20
20
  if (argv.length === 1 && (argv[0] === '--version' || argv[0] === '-V')) {
21
- console.log('@songtonyli/dsh-cli 0.1.38 (deepseek-harness 0.1.7-alpha.1)')
21
+ console.log('@songtonyli/dsh-cli 0.1.39 (deepseek-harness 0.1.7-alpha.1)')
22
22
  process.exit(0)
23
23
  }
24
24
 
@@ -47,8 +47,8 @@
47
47
  "micromark-extension-gfm": "^3.0.0",
48
48
  "micromark-util-sanitize-uri": "^2.0.1",
49
49
  "simple-icons": "16.31.0",
50
- "@deepseek-ai/cordis": "^4.0.3",
51
50
  "@deepseek-ai/dsh-client-store": "^0.1.7-alpha.1",
51
+ "@deepseek-ai/cordis": "^4.0.3",
52
52
  "@deepseek-ai/dsh-util-workspace-path": "^0.1.7-alpha.1"
53
53
  },
54
54
  "files": [
@@ -158,7 +158,7 @@ window.__ModuleLoader__.load({
158
158
  const SCROLLBAR_LINGER_MS = 2e3;
159
159
  /** Format complete-build metadata for the local brand badge. */
160
160
  function localBuildVersion() {
161
- return `0.1.7-alpha.1-520bcb7` + ({}.DSH_CLIENT_GIT_DIRTY === "true" ? "-dirty" : "");
161
+ return `0.1.7-alpha.1-157800d` + ({}.DSH_CLIENT_GIT_DIRTY === "true" ? "-dirty" : "");
162
162
  }
163
163
  /** Each panel row subscribes only to its own selection state. */
164
164
  function PanelRow({ id, label, wide, usePanelInfo, selectPanel, renderSlot }) {
@@ -24,8 +24,8 @@
24
24
  "license": "MIT",
25
25
  "devDependencies": {
26
26
  "@types/react": "~18.3.1",
27
- "@deepseek-ai/cordis": "^4.0.3",
28
- "@deepseek-ai/dsh-client-store": "^0.1.7-alpha.1"
27
+ "@deepseek-ai/dsh-client-store": "^0.1.7-alpha.1",
28
+ "@deepseek-ai/cordis": "^4.0.3"
29
29
  },
30
30
  "files": [
31
31
  "lib/index.js",
@@ -228,7 +228,7 @@ An approval request draws `Allow <tool>?` with the asker's reason, the logged ca
228
228
  | `liveRefreshMs` | `1000` | Period of the redraw that advances the `turn` segment and the panel's elapsed values and re-reads a stale subagent listing |
229
229
  | `streamFadeSteps` | `24` | How many ticks a fade lasts: reply text fades in, reasoning and tool cards float out, over `streamFadeSteps × streamFadeStepMs` |
230
230
  | `streamFadeStepMs` | `16` | One frame: the fade tick, the repaint period while anything is still moving, and the period paced stream text is drawn at; duration is `streamFadeSteps × streamFadeStepMs` |
231
- | `streamPaceFrames` | `8` | Frames a backlog of streamed reasoning, reply text, or tool arguments takes to reach the screen; `0`, like `reducedMotion`, draws each delta as it arrives |
231
+ | `streamPaceFrames` | `8` | Frames a backlog of streamed reply text or tool arguments takes to reach the screen. Thinking still queued when its block ends, or when reply text or a tool call starts, is drawn at once; `0`, like `reducedMotion`, draws each delta as it arrives |
232
232
  | `reducedMotion` | `false` | Draw streamed text, streamed reasoning, tool cards, and the chrome in their settled colors, with no fade, no lift, and no repeating repaint |
233
233
  | `openBrowser` | `true` | Hand marked authorization pages to the local default browser |
234
234
 
@@ -305,8 +305,8 @@ The patch rides over `dsh-base`: it sets the coding persona prefix and cwd suffi
305
305
  | [`tests/editor.spec.ts`](tests/editor.spec.ts) | The terminal caret, `Shift+Left` / `Shift+Right` word navigation, and `!` / `!!` draft colour against pi-tui's editor behavior |
306
306
  | [`tests/frame.spec.ts`](tests/frame.spec.ts) | The rules, the chip, the body rows, and the legend a width holds |
307
307
  | [`tests/motion.spec.ts`](tests/motion.spec.ts) | The motion clock's levels, its repaint demand, and the lift each level draws |
308
- | [`tests/pace.spec.ts`](tests/pace.spec.ts) | The pacer's per-frame share, grapheme cuts, arrival order, flush, and clear |
309
- | [`tests/stream-pace.spec.ts`](tests/stream-pace.spec.ts) | Paced reasoning, reply text, and tool arguments in stream order, the flush at stream end and before a logged event, and reduced motion |
308
+ | [`tests/pace.spec.ts`](tests/pace.spec.ts) | The pacer's per-frame share, grapheme cuts, arrival order, flush, per-channel flush, and clear |
309
+ | [`tests/stream-pace.spec.ts`](tests/stream-pace.spec.ts) | Paced reply text and tool arguments in stream order, thinking drawn when its block ends, the flush at stream end and before a logged event, and reduced motion |
310
310
  | [`tests/toast.spec.ts`](tests/toast.spec.ts) | The transient line's box, its hold, its fade, and its early settlement |
311
311
  | [`tests/reader.spec.ts`](tests/reader.spec.ts) | The reader's geometry, its state machine, its filter, and the rows it returns |
312
312
  | [`tests/reader-screen.spec.ts`](tests/reader-screen.spec.ts) | The reader pane: its key map, the screen it fills, its re-anchoring, and its exit |
@@ -228,7 +228,7 @@ follow-ups 面板持有键盘时:
228
228
  | `liveRefreshMs` | `1000` | 重绘周期:推进 `turn` 分段与面板中的已用时间,并重新读取已过期的子 agent 列表 |
229
229
  | `streamFadeSteps` | `24` | 一次淡入或浮出持续多少拍:回复文字淡入,推理与工具卡片浮出,时长为 `streamFadeSteps × streamFadeStepMs` |
230
230
  | `streamFadeStepMs` | `16` | 一帧的时长:淡入或浮出的一拍、仍在变化时的重绘周期,也是逐帧绘制流式文字的周期;总时长为 `streamFadeSteps × streamFadeStepMs` |
231
- | `streamPaceFrames` | `8` | 积压的流式推理、回复文字或工具参数要经过多少帧才全部上屏;`0` 与 `reducedMotion` 一样,收到即绘制 |
231
+ | `streamPaceFrames` | `8` | 积压的流式回复文字或工具参数要经过多少帧才全部上屏。思考块结束时,或回复文字或工具调用开始时,仍在队列中的思考立即画出;`0` 与 `reducedMotion` 一样,收到即绘制 |
232
232
  | `reducedMotion` | `false` | 以稳定颜色绘制流式文本、流式推理、工具卡片与应用自身的边框装饰,不做淡入、不做抬亮,也不重复重绘 |
233
233
  | `openBrowser` | `true` | 把被标记的授权页面交给本地默认浏览器 |
234
234
 
@@ -305,8 +305,8 @@ runner 等待完整应用就绪(`ctx.get('loader')?.await()`),并在核心
305
305
  | [`tests/editor.spec.ts`](tests/editor.spec.ts) | 对照 pi-tui 编辑器行为验证终端光标、`Shift+Left` / `Shift+Right` 词导航,以及 `!` / `!!` 草稿着色 |
306
306
  | [`tests/frame.spec.ts`](tests/frame.spec.ts) | 边框线、徽标、正文行,以及某个宽度容纳得下的按键提示 |
307
307
  | [`tests/motion.spec.ts`](tests/motion.spec.ts) | 动效时钟的各个级别、它对重绘的要求,以及每一级所绘的抬亮 |
308
- | [`tests/pace.spec.ts`](tests/pace.spec.ts) | 节拍器的每帧份额、按字素切分、到达顺序、flush 与 clear |
309
- | [`tests/stream-pace.spec.ts`](tests/stream-pace.spec.ts) | 按流顺序分批绘制的推理、回复文字与工具参数,流结束时与已记录事件前的 flush,以及 reducedMotion |
308
+ | [`tests/pace.spec.ts`](tests/pace.spec.ts) | 节拍器的每帧份额、按字素切分、到达顺序、flush、按通道 flush 与 clear |
309
+ | [`tests/stream-pace.spec.ts`](tests/stream-pace.spec.ts) | 按流顺序分批绘制的回复文字与工具参数,思考块结束时画出思考,流结束时与已记录事件前的 flush,以及 reducedMotion |
310
310
  | [`tests/toast.spec.ts`](tests/toast.spec.ts) | 临时提示行的方框、其保持、其淡出与其提前结算 |
311
311
  | [`tests/reader.spec.ts`](tests/reader.spec.ts) | 阅读器的几何布局、其状态机、其过滤,以及它返回的各行 |
312
312
  | [`tests/reader-screen.spec.ts`](tests/reader-screen.spec.ts) | 阅读器面板:其按键映射、它铺满的屏幕、其重新锚定与其退出 |
@@ -4589,6 +4589,29 @@ var StreamPacer = class {
4589
4589
  this.credit = 0;
4590
4590
  for (const entry of entries) entry.release(entry.text);
4591
4591
  }
4592
+ /**
4593
+ * Release every queued entry of one channel now, and keep every other
4594
+ * entry in arrival order. A finished thinking block uses this so its
4595
+ * remainder is drawn before later reply text is paced.
4596
+ * @param channel - the channel to release.
4597
+ * @returns whether any entry of that channel was queued.
4598
+ */
4599
+ flushChannel(channel) {
4600
+ const pending = this.entries.splice(0);
4601
+ const kept = [];
4602
+ const release = [];
4603
+ let backlog = 0;
4604
+ for (const entry of pending) if (entry.channel === channel) release.push(entry);
4605
+ else {
4606
+ kept.push(entry);
4607
+ backlog += entry.text.length;
4608
+ }
4609
+ this.entries.push(...kept);
4610
+ this.backlog = backlog;
4611
+ if (this.entries.length === 0) this.credit = 0;
4612
+ for (const entry of release) entry.release(entry.text);
4613
+ return release.length > 0;
4614
+ }
4592
4615
  /** Drop everything queued without releasing it. */
4593
4616
  clear() {
4594
4617
  this.entries.length = 0;
@@ -12788,6 +12811,13 @@ var TuiApp = class {
12788
12811
  this.updateFadeTicker();
12789
12812
  }
12790
12813
  /**
12814
+ * Draw thinking that is still queued. The pacer would otherwise keep
12815
+ * releasing it after the model has moved on to reply text or a tool call.
12816
+ */
12817
+ finishReasoningPace() {
12818
+ if (this.pacer?.flushChannel("reasoning") === true) this.tui.requestRender();
12819
+ }
12820
+ /**
12791
12821
  * Take one visible text delta: the block draws it and the tail of that same
12792
12822
  * block ages it. The tail is created with the first delta of a message, so
12793
12823
  * a block rebuilt from history or committed from the log never carries one.
@@ -13059,23 +13089,26 @@ var TuiApp = class {
13059
13089
  switch (chunk.type) {
13060
13090
  case "text-delta":
13061
13091
  if (chunk.text !== "") {
13092
+ this.finishReasoningPace();
13093
+ this.setStreamActivity("writing");
13062
13094
  this.pace("text", chunk.text, (text) => {
13063
13095
  this.appendStreamedText(text);
13064
- this.setStreamActivity("writing");
13065
13096
  });
13066
13097
  this.noteStreamedChars(chunk.text.length);
13067
13098
  }
13068
13099
  break;
13069
13100
  case "reasoning-delta":
13070
13101
  if (chunk.text !== "") {
13102
+ this.setStreamActivity("thinking");
13071
13103
  this.pace("reasoning", chunk.text, (text) => {
13072
13104
  this.appendStreamedReasoning(text);
13073
- this.setStreamActivity("thinking");
13074
13105
  });
13075
13106
  this.noteStreamedChars(chunk.text.length);
13076
13107
  }
13077
13108
  break;
13078
13109
  case "tool-call-delta":
13110
+ this.finishReasoningPace();
13111
+ this.noteStreamedToolCall(chunk);
13079
13112
  this.pace(`tool:${chunk.id}:${chunk.name ?? ""}`, chunk.argumentsDelta, (text) => {
13080
13113
  this.onToolCallDelta({
13081
13114
  ...chunk,
@@ -13088,7 +13121,17 @@ var TuiApp = class {
13088
13121
  this.applyLiveUsage(chunk.usage);
13089
13122
  break;
13090
13123
  case "block-start":
13124
+ if (chunk.blockType === "text") {
13125
+ this.finishReasoningPace();
13126
+ this.setStreamActivity("writing");
13127
+ } else if (chunk.blockType === "tool-call") {
13128
+ this.finishReasoningPace();
13129
+ if (!isCallingActivity(this.loaderActivity)) this.setLoaderActivity(callingActivity(void 0));
13130
+ } else if (chunk.blockType !== "reasoning") this.finishReasoningPace();
13131
+ break;
13091
13132
  case "block-end":
13133
+ if (chunk.block.type === "reasoning") this.finishReasoningPace();
13134
+ break;
13092
13135
  case "finish": break;
13093
13136
  /* v8 ignore next -- closed-union exhaustiveness guard */
13094
13137
  default: assertNever(chunk, "tui stream chunk");
@@ -13353,17 +13396,35 @@ var TuiApp = class {
13353
13396
  this.loader.setMessage(suffix === "" ? this.loaderActivity : `${this.loaderActivity} ${suffix}`);
13354
13397
  }
13355
13398
  /**
13356
- * Mount or refresh a tool card from a stream delta: the name as soon as
13357
- * the model sends one, then the presenter headline once the arguments
13358
- * parse as JSON.
13399
+ * Label the spinner for a tool-call delta before its card is paced.
13400
+ * A known name becomes `calling <name>` and is remembered until the call
13401
+ * settles; a delta that has not named a tool yet says `calling`, and does
13402
+ * not replace a label that already names one.
13359
13403
  * @param chunk - one `tool-call-delta` of the live assistant stream.
13360
13404
  */
13361
- onToolCallDelta(chunk) {
13362
- const name = chunk.name === "" ? void 0 : chunk.name ?? this.toolBlocks.get(chunk.id)?.name;
13405
+ noteStreamedToolCall(chunk) {
13406
+ const name = this.streamedToolName(chunk);
13363
13407
  if (name !== void 0) {
13364
13408
  if (chunk.id !== "") this.pendingToolNames.set(chunk.id, name);
13365
13409
  this.setLoaderActivity(callingActivity(name));
13366
13410
  } else if (!isCallingActivity(this.loaderActivity)) this.setLoaderActivity(callingActivity(void 0));
13411
+ }
13412
+ /**
13413
+ * The tool name a live delta carries, or the name already drawn for that call.
13414
+ * @param chunk - one `tool-call-delta` of the live assistant stream.
13415
+ * @returns the name, or undefined while the model has not sent one.
13416
+ */
13417
+ streamedToolName(chunk) {
13418
+ return chunk.name === "" ? void 0 : chunk.name ?? this.toolBlocks.get(chunk.id)?.name;
13419
+ }
13420
+ /**
13421
+ * Mount or refresh a tool card from a stream delta: the name as soon as
13422
+ * the model sends one, then the presenter headline once the arguments
13423
+ * parse as JSON.
13424
+ * @param chunk - one `tool-call-delta` of the live assistant stream.
13425
+ */
13426
+ onToolCallDelta(chunk) {
13427
+ const name = this.streamedToolName(chunk);
13367
13428
  if (chunk.id === "") return;
13368
13429
  const argumentsJson = (this.toolStreamArgs.get(chunk.id) ?? "") + chunk.argumentsDelta;
13369
13430
  this.toolStreamArgs.set(chunk.id, argumentsJson);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@songtonyli/dsh-cli",
3
- "version": "0.1.38",
3
+ "version": "0.1.39",
4
4
  "description": "The dsh terminal agent: an interactive TUI over the DeepSeek Harness, with its whole Node runtime bundled in one install.",
5
5
  "license": "MIT",
6
6
  "type": "module",