@deepseek-ai/dsh-llm-mock-server 0.2.0-rc.2 → 0.2.1-alpha.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.
- package/README.i18n.yaml +4 -4
- package/README.md +1 -2
- package/README.zh.md +1 -2
- 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
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
en: 393a6ca8f1eb021e
|
|
40
40
|
zh: d71bc369d550b527
|
|
41
41
|
/deepseek-ai-dsh-llm-mock-server/understand-the-implementation/source-map:
|
|
42
|
-
en:
|
|
43
|
-
zh:
|
|
42
|
+
en: 893c33eff2af34d1
|
|
43
|
+
zh: 44eed7b3810023a9
|
|
44
44
|
/deepseek-ai-dsh-llm-mock-server/understand-the-implementation/wire-flow:
|
|
45
45
|
en: 34abeb79b2e0cdcd
|
|
46
46
|
zh: d175185e4f1cc190
|
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
|
|
|
@@ -117,7 +117,6 @@ The server is built on one rule: each accepted Messages request consumes exactly
|
|
|
117
117
|
| [`src/index.ts`](src/index.ts) | `startMockLlmServer`: listener, behavior table, seeded randomness, telemetry, captured request records |
|
|
118
118
|
| [`src/cli.ts`](src/cli.ts) | `--sequence` and timing/content option parsing, JSONL stdout telemetry |
|
|
119
119
|
| [`src/bin.ts`](src/bin.ts) | The `pnpm run mock:llm` source entry |
|
|
120
|
-
| — | No runtime invariant companion is published; this standalone test server owns no Cordis event stream or shared data; its wire behavior and lifecycle are exercised through direct HTTP and assembled-loop tests. |
|
|
121
120
|
|
|
122
121
|
### Wire flow
|
|
123
122
|
|
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
|
|
|
@@ -117,7 +117,6 @@ CLI 公开 `--success-text`、`--partial-text`、`--reasoning-text`、`--chunk-s
|
|
|
117
117
|
| [`src/index.ts`](src/index.ts) | `startMockLlmServer`:listener、行为表、种子随机、遥测(telemetry)、捕获的请求记录 |
|
|
118
118
|
| [`src/cli.ts`](src/cli.ts) | `--sequence` 与时序/内容选项解析、JSONL stdout 遥测 |
|
|
119
119
|
| [`src/bin.ts`](src/bin.ts) | `pnpm run mock:llm` 源入口 |
|
|
120
|
-
| — | 不发布运行时不变式伴生组件;该独立测试服务器不拥有 Cordis 事件流或共享数据;其协议行为和生命周期通过直接 HTTP 测试及组装后的循环测试进行检验。 |
|
|
121
120
|
|
|
122
121
|
### 协议流程
|
|
123
122
|
|
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.
|
|
4
|
+
"version": "0.2.1-alpha.2",
|
|
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.
|
|
30
|
+
"@deepseek-ai/cordis": "~4.0.5-alpha.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@deepseek-ai/cordis": "~4.0.
|
|
33
|
+
"@deepseek-ai/cordis": "~4.0.5-alpha.1"
|
|
34
34
|
}
|
|
35
35
|
}
|