@aipanel/provider-deepseek 1.2.16 → 1.2.18
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/es/deepseek-web.d.ts +8 -0
- package/es/deepseek-web.js +24 -0
- package/es/provider.js +1 -0
- package/lib/deepseek-web.cjs +24 -0
- package/lib/deepseek-web.d.ts +8 -0
- package/lib/provider.cjs +1 -0
- package/package.json +2 -2
package/es/deepseek-web.d.ts
CHANGED
|
@@ -10,8 +10,16 @@ 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;
|
|
20
|
+
/** 报错时把 dsh web 启动的原始日志作为一条日志整体输出(幂等:每实例只打一次) */
|
|
21
|
+
private printed;
|
|
22
|
+
private printStartupOutput;
|
|
15
23
|
/** 已解析的 token(未就绪时 undefined) */
|
|
16
24
|
get(): string | undefined;
|
|
17
25
|
/** 等待 token 就绪(默认 20s 超时;未打印则抛错并快速失败,调用方降级处理) */
|
package/es/deepseek-web.js
CHANGED
|
@@ -10,6 +10,17 @@ 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
|
+
/** 报错时把 dsh web 启动的原始日志作为一条日志整体输出(幂等:每实例只打一次) */
|
|
17
|
+
__publicField(this, "printed", false);
|
|
18
|
+
}
|
|
19
|
+
/** 记录 dsh 进程原始输出(只保留末尾,防止内存无限增长),用于超时报错时辅助诊断 */
|
|
20
|
+
recordOutput(stream, text) {
|
|
21
|
+
const key = stream === "stdout" ? "stdoutTail" : "stderrTail";
|
|
22
|
+
const tail = this[key] + text;
|
|
23
|
+
this[key] = tail.length > 4096 ? tail.slice(-4096) : tail;
|
|
13
24
|
}
|
|
14
25
|
/** 从子进程输出写入已解析的 token(幂等:只接受第一个) */
|
|
15
26
|
set(token) {
|
|
@@ -22,6 +33,16 @@ class LaunchToken {
|
|
|
22
33
|
}
|
|
23
34
|
this.waiters = [];
|
|
24
35
|
}
|
|
36
|
+
printStartupOutput() {
|
|
37
|
+
if (this.printed) return;
|
|
38
|
+
this.printed = true;
|
|
39
|
+
const stdout = this.stdoutTail.trim();
|
|
40
|
+
const stderr = this.stderrTail.trim();
|
|
41
|
+
const lines = ["dsh launch token was not captured; dsh web startup output:"];
|
|
42
|
+
lines.push(stdout || "(no dsh stdout captured)");
|
|
43
|
+
if (stderr) lines.push(`dsh web stderr: ${stderr}`);
|
|
44
|
+
log.warn(lines.join("\n"));
|
|
45
|
+
}
|
|
25
46
|
/** 已解析的 token(未就绪时 undefined) */
|
|
26
47
|
get() {
|
|
27
48
|
return this.token;
|
|
@@ -32,6 +53,7 @@ class LaunchToken {
|
|
|
32
53
|
if (this.failure) return Promise.reject(this.failure);
|
|
33
54
|
return new Promise((resolve, reject) => {
|
|
34
55
|
const timer = setTimeout(() => {
|
|
56
|
+
this.printStartupOutput();
|
|
35
57
|
const err = new Error(
|
|
36
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)`
|
|
37
59
|
);
|
|
@@ -92,6 +114,7 @@ function startDeepSeekWeb(options) {
|
|
|
92
114
|
const chunk = data.toString();
|
|
93
115
|
stdoutBuffer += chunk;
|
|
94
116
|
if (stdoutBuffer.length > 4096) stdoutBuffer = stdoutBuffer.slice(-4096);
|
|
117
|
+
launchToken?.recordOutput("stdout", chunk);
|
|
95
118
|
if (launchToken && !launchToken.get()) {
|
|
96
119
|
const match = stdoutBuffer.match(/[?&]token=([A-Za-z0-9_-]+)/);
|
|
97
120
|
if (match) {
|
|
@@ -107,6 +130,7 @@ function startDeepSeekWeb(options) {
|
|
|
107
130
|
});
|
|
108
131
|
proc.stderr?.on("data", (data) => {
|
|
109
132
|
const output = data.toString().trim();
|
|
133
|
+
launchToken?.recordOutput("stderr", data.toString());
|
|
110
134
|
if (output) {
|
|
111
135
|
log.warn("[dsh stderr]", { output });
|
|
112
136
|
getProcessLogBuffer().addProviderStderr(output);
|
package/es/provider.js
CHANGED
|
@@ -61,6 +61,7 @@ or run without installing:
|
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
63
|
const version = await getDeepSeekVersion();
|
|
64
|
+
log.debug("Detected dsh version", { version: version ?? "unknown" });
|
|
64
65
|
const compatible = version === null ? true : isDeepSeekVersionAtLeast(version);
|
|
65
66
|
if (compatible === false) {
|
|
66
67
|
return {
|
package/lib/deepseek-web.cjs
CHANGED
|
@@ -32,6 +32,17 @@ 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
|
+
/** 报错时把 dsh web 启动的原始日志作为一条日志整体输出(幂等:每实例只打一次) */
|
|
39
|
+
__publicField(this, "printed", false);
|
|
40
|
+
}
|
|
41
|
+
/** 记录 dsh 进程原始输出(只保留末尾,防止内存无限增长),用于超时报错时辅助诊断 */
|
|
42
|
+
recordOutput(stream, text) {
|
|
43
|
+
const key = stream === "stdout" ? "stdoutTail" : "stderrTail";
|
|
44
|
+
const tail = this[key] + text;
|
|
45
|
+
this[key] = tail.length > 4096 ? tail.slice(-4096) : tail;
|
|
35
46
|
}
|
|
36
47
|
/** 从子进程输出写入已解析的 token(幂等:只接受第一个) */
|
|
37
48
|
set(token) {
|
|
@@ -44,6 +55,16 @@ class LaunchToken {
|
|
|
44
55
|
}
|
|
45
56
|
this.waiters = [];
|
|
46
57
|
}
|
|
58
|
+
printStartupOutput() {
|
|
59
|
+
if (this.printed) return;
|
|
60
|
+
this.printed = true;
|
|
61
|
+
const stdout = this.stdoutTail.trim();
|
|
62
|
+
const stderr = this.stderrTail.trim();
|
|
63
|
+
const lines = ["dsh launch token was not captured; dsh web startup output:"];
|
|
64
|
+
lines.push(stdout || "(no dsh stdout captured)");
|
|
65
|
+
if (stderr) lines.push(`dsh web stderr: ${stderr}`);
|
|
66
|
+
log.warn(lines.join("\n"));
|
|
67
|
+
}
|
|
47
68
|
/** 已解析的 token(未就绪时 undefined) */
|
|
48
69
|
get() {
|
|
49
70
|
return this.token;
|
|
@@ -54,6 +75,7 @@ class LaunchToken {
|
|
|
54
75
|
if (this.failure) return Promise.reject(this.failure);
|
|
55
76
|
return new Promise((resolve, reject) => {
|
|
56
77
|
const timer = setTimeout(() => {
|
|
78
|
+
this.printStartupOutput();
|
|
57
79
|
const err = new Error(
|
|
58
80
|
`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
81
|
);
|
|
@@ -114,6 +136,7 @@ function startDeepSeekWeb(options) {
|
|
|
114
136
|
const chunk = data.toString();
|
|
115
137
|
stdoutBuffer += chunk;
|
|
116
138
|
if (stdoutBuffer.length > 4096) stdoutBuffer = stdoutBuffer.slice(-4096);
|
|
139
|
+
launchToken?.recordOutput("stdout", chunk);
|
|
117
140
|
if (launchToken && !launchToken.get()) {
|
|
118
141
|
const match = stdoutBuffer.match(/[?&]token=([A-Za-z0-9_-]+)/);
|
|
119
142
|
if (match) {
|
|
@@ -129,6 +152,7 @@ function startDeepSeekWeb(options) {
|
|
|
129
152
|
});
|
|
130
153
|
proc.stderr?.on("data", (data) => {
|
|
131
154
|
const output = data.toString().trim();
|
|
155
|
+
launchToken?.recordOutput("stderr", data.toString());
|
|
132
156
|
if (output) {
|
|
133
157
|
log.warn("[dsh stderr]", { output });
|
|
134
158
|
(0, import_node.getProcessLogBuffer)().addProviderStderr(output);
|
package/lib/deepseek-web.d.ts
CHANGED
|
@@ -10,8 +10,16 @@ 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;
|
|
20
|
+
/** 报错时把 dsh web 启动的原始日志作为一条日志整体输出(幂等:每实例只打一次) */
|
|
21
|
+
private printed;
|
|
22
|
+
private printStartupOutput;
|
|
15
23
|
/** 已解析的 token(未就绪时 undefined) */
|
|
16
24
|
get(): string | undefined;
|
|
17
25
|
/** 等待 token 就绪(默认 20s 超时;未打印则抛错并快速失败,调用方降级处理) */
|
package/lib/provider.cjs
CHANGED
|
@@ -71,6 +71,7 @@ or run without installing:
|
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
73
|
const version = await (0, import_system.getDeepSeekVersion)();
|
|
74
|
+
log.debug("Detected dsh version", { version: version ?? "unknown" });
|
|
74
75
|
const compatible = version === null ? true : (0, import_system.isDeepSeekVersionAtLeast)(version);
|
|
75
76
|
if (compatible === false) {
|
|
76
77
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aipanel/provider-deepseek",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.18",
|
|
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.
|
|
25
|
+
"@aipanel/core": "1.2.18"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"esbuild": "^0.25.0"
|