@aipanel/provider-deepseek 1.2.16 → 1.2.17

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.
@@ -10,6 +10,11 @@ export declare class LaunchToken {
10
10
  /** 首次超时后缓存失败:本启动已不可能再打印 token,后续 wait 直接快速失败 */
11
11
  private failure?;
12
12
  private waiters;
13
+ /** dsh 进程原始输出尾部缓存,超时报错时回填,便于定位真实根因 */
14
+ private stdoutTail;
15
+ private stderrTail;
16
+ /** 记录 dsh 进程原始输出(只保留末尾,防止内存无限增长),用于超时报错时辅助诊断 */
17
+ recordOutput(stream: "stdout" | "stderr", text: string): void;
13
18
  /** 从子进程输出写入已解析的 token(幂等:只接受第一个) */
14
19
  set(token: string): void;
15
20
  /** 已解析的 token(未就绪时 undefined) */
@@ -10,6 +10,15 @@ class LaunchToken {
10
10
  /** 首次超时后缓存失败:本启动已不可能再打印 token,后续 wait 直接快速失败 */
11
11
  __publicField(this, "failure");
12
12
  __publicField(this, "waiters", []);
13
+ /** dsh 进程原始输出尾部缓存,超时报错时回填,便于定位真实根因 */
14
+ __publicField(this, "stdoutTail", "");
15
+ __publicField(this, "stderrTail", "");
16
+ }
17
+ /** 记录 dsh 进程原始输出(只保留末尾,防止内存无限增长),用于超时报错时辅助诊断 */
18
+ recordOutput(stream, text) {
19
+ const key = stream === "stdout" ? "stdoutTail" : "stderrTail";
20
+ const tail = this[key] + text;
21
+ this[key] = tail.length > 4096 ? tail.slice(-4096) : tail;
13
22
  }
14
23
  /** 从子进程输出写入已解析的 token(幂等:只接受第一个) */
15
24
  set(token) {
@@ -32,9 +41,16 @@ class LaunchToken {
32
41
  if (this.failure) return Promise.reject(this.failure);
33
42
  return new Promise((resolve, reject) => {
34
43
  const timer = setTimeout(() => {
35
- const err = new Error(
36
- `dsh launch token was not captured from stdout within ${timeoutMs}ms (dsh >= 0.1.2 should print the "dsh web: http://127.0.0.1:<port>/?token=..." URL)`
37
- );
44
+ const detail = [
45
+ `dsh launch token was not captured from within ${timeoutMs}ms (dsh >= 0.1.2 should print the "dsh web: http://127.0.0.1:<port>/?token=..." URL)`
46
+ ];
47
+ if (this.stdoutTail.trim()) {
48
+ detail.push("-- last dsh stdout --", this.stdoutTail.trim());
49
+ }
50
+ if (this.stderrTail.trim()) {
51
+ detail.push("-- last dsh stderr --", this.stderrTail.trim());
52
+ }
53
+ const err = new Error(detail.join("\n"));
38
54
  this.failure = err;
39
55
  for (const w of this.waiters) {
40
56
  clearTimeout(w.timer);
@@ -92,6 +108,7 @@ function startDeepSeekWeb(options) {
92
108
  const chunk = data.toString();
93
109
  stdoutBuffer += chunk;
94
110
  if (stdoutBuffer.length > 4096) stdoutBuffer = stdoutBuffer.slice(-4096);
111
+ launchToken?.recordOutput("stdout", chunk);
95
112
  if (launchToken && !launchToken.get()) {
96
113
  const match = stdoutBuffer.match(/[?&]token=([A-Za-z0-9_-]+)/);
97
114
  if (match) {
@@ -107,6 +124,7 @@ function startDeepSeekWeb(options) {
107
124
  });
108
125
  proc.stderr?.on("data", (data) => {
109
126
  const output = data.toString().trim();
127
+ launchToken?.recordOutput("stderr", data.toString());
110
128
  if (output) {
111
129
  log.warn("[dsh stderr]", { output });
112
130
  getProcessLogBuffer().addProviderStderr(output);
@@ -32,6 +32,15 @@ class LaunchToken {
32
32
  /** 首次超时后缓存失败:本启动已不可能再打印 token,后续 wait 直接快速失败 */
33
33
  __publicField(this, "failure");
34
34
  __publicField(this, "waiters", []);
35
+ /** dsh 进程原始输出尾部缓存,超时报错时回填,便于定位真实根因 */
36
+ __publicField(this, "stdoutTail", "");
37
+ __publicField(this, "stderrTail", "");
38
+ }
39
+ /** 记录 dsh 进程原始输出(只保留末尾,防止内存无限增长),用于超时报错时辅助诊断 */
40
+ recordOutput(stream, text) {
41
+ const key = stream === "stdout" ? "stdoutTail" : "stderrTail";
42
+ const tail = this[key] + text;
43
+ this[key] = tail.length > 4096 ? tail.slice(-4096) : tail;
35
44
  }
36
45
  /** 从子进程输出写入已解析的 token(幂等:只接受第一个) */
37
46
  set(token) {
@@ -54,9 +63,16 @@ class LaunchToken {
54
63
  if (this.failure) return Promise.reject(this.failure);
55
64
  return new Promise((resolve, reject) => {
56
65
  const timer = setTimeout(() => {
57
- const err = new Error(
58
- `dsh launch token was not captured from stdout within ${timeoutMs}ms (dsh >= 0.1.2 should print the "dsh web: http://127.0.0.1:<port>/?token=..." URL)`
59
- );
66
+ const detail = [
67
+ `dsh launch token was not captured from within ${timeoutMs}ms (dsh >= 0.1.2 should print the "dsh web: http://127.0.0.1:<port>/?token=..." URL)`
68
+ ];
69
+ if (this.stdoutTail.trim()) {
70
+ detail.push("-- last dsh stdout --", this.stdoutTail.trim());
71
+ }
72
+ if (this.stderrTail.trim()) {
73
+ detail.push("-- last dsh stderr --", this.stderrTail.trim());
74
+ }
75
+ const err = new Error(detail.join("\n"));
60
76
  this.failure = err;
61
77
  for (const w of this.waiters) {
62
78
  clearTimeout(w.timer);
@@ -114,6 +130,7 @@ function startDeepSeekWeb(options) {
114
130
  const chunk = data.toString();
115
131
  stdoutBuffer += chunk;
116
132
  if (stdoutBuffer.length > 4096) stdoutBuffer = stdoutBuffer.slice(-4096);
133
+ launchToken?.recordOutput("stdout", chunk);
117
134
  if (launchToken && !launchToken.get()) {
118
135
  const match = stdoutBuffer.match(/[?&]token=([A-Za-z0-9_-]+)/);
119
136
  if (match) {
@@ -129,6 +146,7 @@ function startDeepSeekWeb(options) {
129
146
  });
130
147
  proc.stderr?.on("data", (data) => {
131
148
  const output = data.toString().trim();
149
+ launchToken?.recordOutput("stderr", data.toString());
132
150
  if (output) {
133
151
  log.warn("[dsh stderr]", { output });
134
152
  (0, import_node.getProcessLogBuffer)().addProviderStderr(output);
@@ -10,6 +10,11 @@ export declare class LaunchToken {
10
10
  /** 首次超时后缓存失败:本启动已不可能再打印 token,后续 wait 直接快速失败 */
11
11
  private failure?;
12
12
  private waiters;
13
+ /** dsh 进程原始输出尾部缓存,超时报错时回填,便于定位真实根因 */
14
+ private stdoutTail;
15
+ private stderrTail;
16
+ /** 记录 dsh 进程原始输出(只保留末尾,防止内存无限增长),用于超时报错时辅助诊断 */
17
+ recordOutput(stream: "stdout" | "stderr", text: string): void;
13
18
  /** 从子进程输出写入已解析的 token(幂等:只接受第一个) */
14
19
  set(token: string): void;
15
20
  /** 已解析的 token(未就绪时 undefined) */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aipanel/provider-deepseek",
3
- "version": "1.2.16",
3
+ "version": "1.2.17",
4
4
  "type": "module",
5
5
  "main": "lib/index.cjs",
6
6
  "module": "es/index.js",
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "execa": "^9.6.1",
25
- "@aipanel/core": "1.2.16"
25
+ "@aipanel/core": "1.2.17"
26
26
  },
27
27
  "devDependencies": {
28
28
  "esbuild": "^0.25.0"