@deepseek-ai/dsh-llm-mock-server 0.2.1-alpha.1 → 0.2.1-alpha.3
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 +2 -2
- package/README.md +1 -1
- package/README.zh.md +1 -1
- package/lib/index.js +2 -1
- package/package.json +3 -3
package/README.i18n.yaml
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
en: bf31466ee0c85b69
|
|
10
10
|
zh: 77ac4edc39b8fc19
|
|
11
11
|
/deepseek-ai-dsh-llm-mock-server/summary:
|
|
12
|
-
en:
|
|
13
|
-
zh:
|
|
12
|
+
en: 1cfa2887c40b3229
|
|
13
|
+
zh: 14963d3d17f980f9
|
|
14
14
|
/deepseek-ai-dsh-llm-mock-server/table-of-contents:
|
|
15
15
|
en: d152484eb41ac6b4
|
|
16
16
|
zh: 09388d293f9be9cb
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ English | [中文](README.zh.md)
|
|
|
9
9
|
|
|
10
10
|
## Summary
|
|
11
11
|
|
|
12
|
-
This package gives tests and demos a scriptable Messages-compatible HTTP/SSE endpoint, so they can exercise model-provider failures and successes without a provider key. Each accepted `/v1/messages` request consumes the next scripted behavior, including resets, stalls, malformed chunks, rate limits, server errors, completions, and tool calls. Test authors can run it with `pnpm run mock:llm` or call `startMockLlmServer`, which returns captured requests for assertions. Seeded `random` behavior supports reproducible mixed-failure stress runs.
|
|
12
|
+
This package gives tests and demos a scriptable Messages-compatible HTTP/SSE endpoint with named events for native SDK consumers, so they can exercise model-provider failures and successes without a provider key. Each accepted `/v1/messages` request consumes the next scripted behavior, including resets, stalls, malformed chunks, rate limits, server errors, completions, and tool calls. Test authors can run it with `pnpm run mock:llm` or call `startMockLlmServer`, which returns captured requests for assertions. Seeded `random` behavior supports reproducible mixed-failure stress runs.
|
|
13
13
|
|
|
14
14
|
## Table of Contents
|
|
15
15
|
|
package/README.zh.md
CHANGED
|
@@ -9,7 +9,7 @@ kind: "package-library"
|
|
|
9
9
|
|
|
10
10
|
## 概述
|
|
11
11
|
|
|
12
|
-
本包为测试与演示提供可编脚本的 Messages 兼容 HTTP/SSE(Server-Sent Events
|
|
12
|
+
本包为测试与演示提供可编脚本的 Messages 兼容 HTTP/SSE(Server-Sent Events)端点,并为原生 SDK 消费方发送具名事件,使其无需提供方密钥即可检验模型提供方的失败与成功。每个已接受的 `/v1/messages` 请求依次消费下一个脚本行为,包括重置、停滞、畸形分片、限流、服务器错误、补全与工具调用。测试作者可以通过 `pnpm run mock:llm` 运行服务器,也可以调用 `startMockLlmServer`,后者会返回捕获的请求供断言使用。带种子的 `random` 行为支持可复现的混合故障压力运行。
|
|
13
13
|
|
|
14
14
|
## 目录
|
|
15
15
|
|
package/lib/index.js
CHANGED
|
@@ -149,7 +149,8 @@ function openSse(response, contentType = "text/event-stream; charset=utf-8") {
|
|
|
149
149
|
response.flushHeaders();
|
|
150
150
|
}
|
|
151
151
|
function writeSse(record, response, payload) {
|
|
152
|
-
|
|
152
|
+
const event = typeof payload === "string" ? "" : `event: ${payload.type}\n`;
|
|
153
|
+
response.write(`${event}data: ${typeof payload === "string" ? payload : JSON.stringify(payload)}\n\n`);
|
|
153
154
|
record.chunksSent += 1;
|
|
154
155
|
}
|
|
155
156
|
function writeDone(record, response) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-llm-mock-server",
|
|
3
3
|
"description": "Scriptable Messages HTTP/SSE fault server for LLM recovery tests",
|
|
4
|
-
"version": "0.2.1-alpha.
|
|
4
|
+
"version": "0.2.1-alpha.3",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
],
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@deepseek-ai/cordis": "~4.0.5-alpha.
|
|
30
|
+
"@deepseek-ai/cordis": "~4.0.5-alpha.2"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@deepseek-ai/cordis": "~4.0.5-alpha.
|
|
33
|
+
"@deepseek-ai/cordis": "~4.0.5-alpha.2"
|
|
34
34
|
}
|
|
35
35
|
}
|