@lyhue1991/dsh-soup 0.7.1 → 0.7.2

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 (2) hide show
  1. package/lib/host/speed.js +18 -0
  2. package/package.json +1 -1
package/lib/host/speed.js CHANGED
@@ -47,10 +47,25 @@ function extractChunk(chunk) {
47
47
  }
48
48
  }
49
49
  }
50
+ const appendToolCalls = (calls) => {
51
+ if (!Array.isArray(calls)) return
52
+ for (const call of calls) {
53
+ // OpenAI-style delta: { function: { arguments: '...' } }. Some adapters
54
+ // use `arguments` directly on the call object.
55
+ appendText(call?.function?.arguments)
56
+ appendText(call?.arguments)
57
+ appendText(call?.argumentsDelta)
58
+ }
59
+ }
50
60
  try {
51
61
  if (!chunk) return { text, realTokens }
52
62
  appendText(chunk.text)
53
63
  appendText(chunk.content)
64
+ // Tool-call argument deltas are generated output too. DSH's abstract
65
+ // StreamChunk carries them as `argumentsDelta`; when the model writes a
66
+ // file the whole stream is tool-call deltas, so without this the content
67
+ // clock never advances and the badge degrades to the waiting text.
68
+ appendText(chunk.argumentsDelta)
54
69
  // Reasoning streams use different names across providers/adapters. They
55
70
  // are still generated output and must keep the throughput window alive.
56
71
  appendText(chunk.reasoning_content)
@@ -64,8 +79,10 @@ function extractChunk(chunk) {
64
79
  appendText(chunk.delta.reasoningContent)
65
80
  appendText(chunk.delta.reasoning)
66
81
  appendText(chunk.delta.thinking)
82
+ appendToolCalls(chunk.delta.tool_calls)
67
83
  realTokens = outputTokens(chunk.delta.usage) ?? realTokens
68
84
  }
85
+ appendToolCalls(chunk.tool_calls)
69
86
  realTokens = outputTokens(chunk.usage) ?? realTokens
70
87
  if (Array.isArray(chunk.choices)) {
71
88
  for (const choice of chunk.choices) {
@@ -75,6 +92,7 @@ function extractChunk(chunk) {
75
92
  appendText(choice?.delta?.reasoningContent)
76
93
  appendText(choice?.delta?.reasoning)
77
94
  appendText(choice?.delta?.thinking)
95
+ appendToolCalls(choice?.delta?.tool_calls)
78
96
  realTokens = outputTokens(choice?.delta?.usage) ?? realTokens
79
97
  }
80
98
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lyhue1991/dsh-soup",
3
3
  "description": "dsh 体验增强四件套 = Jupyter风格SideBar + 中央文件预览Tab + 多行GoalBar + 实时Token流速徽标",
4
- "version": "0.7.1",
4
+ "version": "0.7.2",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "scripts": {