@deepseek-ai/dsh-session-snapshot 0.1.7-alpha.2 → 0.1.7-rc.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 +60 -5
- package/README.md +1 -1
- package/README.zh.md +1 -1
- package/lib/index.js +17 -7
- package/lib/types/normalize.d.ts +3 -1
- package/lib/types/suite.d.ts +1 -1
- package/package.json +18 -18
package/README.i18n.yaml
CHANGED
|
@@ -1,6 +1,61 @@
|
|
|
1
|
-
# Bilingual-pair consistency record (docs/i18n/README.md):
|
|
2
|
-
#
|
|
3
|
-
#
|
|
1
|
+
# Bilingual-pair consistency record for README.md (docs/i18n/README.md): per heading
|
|
2
|
+
# section, a hash of its English and Chinese blocks outside code blocks and generated regions.
|
|
3
|
+
# After editing either side, bring the other along and re-record with:
|
|
4
4
|
# pnpm run verify-translation-pairing --write packages/test-support/session-snapshot/README.md
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
/:
|
|
6
|
+
en: 35f64a68381efbd0
|
|
7
|
+
zh: dd2c508ba263d788
|
|
8
|
+
/deepseek-ai-dsh-session-snapshot:
|
|
9
|
+
en: b184b97e2d1e1fa7
|
|
10
|
+
zh: 7d4b4cc8d73446af
|
|
11
|
+
/deepseek-ai-dsh-session-snapshot/summary:
|
|
12
|
+
en: 71cd3441e7189ac4
|
|
13
|
+
zh: 874ae7ac5fd231c9
|
|
14
|
+
/deepseek-ai-dsh-session-snapshot/table-of-contents:
|
|
15
|
+
en: d152484eb41ac6b4
|
|
16
|
+
zh: 09388d293f9be9cb
|
|
17
|
+
/deepseek-ai-dsh-session-snapshot/use-this-package:
|
|
18
|
+
en: 594ad1f3e6f02054
|
|
19
|
+
zh: 7ca4f565976704be
|
|
20
|
+
/deepseek-ai-dsh-session-snapshot/use-this-package/writing-a-snapshot-suite:
|
|
21
|
+
en: b753e44790d4df99
|
|
22
|
+
zh: 5547c21757797d9b
|
|
23
|
+
/deepseek-ai-dsh-session-snapshot/use-this-package/record-replay-and-refresh:
|
|
24
|
+
en: 4c4b1d6a459d2dc6
|
|
25
|
+
zh: 10c1bb216c50fea8
|
|
26
|
+
/deepseek-ai-dsh-session-snapshot/use-this-package/pinning-request-headers-and-system-prompts:
|
|
27
|
+
en: 6b11d5111e1a3222
|
|
28
|
+
zh: de4d3889b1a5ebb4
|
|
29
|
+
/deepseek-ai-dsh-session-snapshot/use-this-package/platform-and-composition-variants:
|
|
30
|
+
en: 64666ea2894acc4a
|
|
31
|
+
zh: 0e78df32bcfd3633
|
|
32
|
+
/deepseek-ai-dsh-session-snapshot/use-this-package/what-can-go-wrong:
|
|
33
|
+
en: f9dc0b285401e01e
|
|
34
|
+
zh: e2b365b082dbaa82
|
|
35
|
+
/deepseek-ai-dsh-session-snapshot/understand-the-implementation:
|
|
36
|
+
en: 18ff76b440fe40da
|
|
37
|
+
zh: 4dbf2eb5f9ee98a2
|
|
38
|
+
/deepseek-ai-dsh-session-snapshot/understand-the-implementation/design:
|
|
39
|
+
en: 8771607f15c4f4e1
|
|
40
|
+
zh: 7c2cf395f704717c
|
|
41
|
+
/deepseek-ai-dsh-session-snapshot/understand-the-implementation/source-map:
|
|
42
|
+
en: 4c3ff235ca8fe261
|
|
43
|
+
zh: 0f03425b926721cc
|
|
44
|
+
/deepseek-ai-dsh-session-snapshot/understand-the-implementation/data-flow:
|
|
45
|
+
en: a71c8ab2e78798c5
|
|
46
|
+
zh: 419cebed1c023fbf
|
|
47
|
+
/deepseek-ai-dsh-session-snapshot/further-exploration:
|
|
48
|
+
en: 84279d50373a156a
|
|
49
|
+
zh: fcd600bf386f6efe
|
|
50
|
+
/deepseek-ai-dsh-session-snapshot/model-experience:
|
|
51
|
+
en: 9f12d94ab5e31ade
|
|
52
|
+
zh: 7c75a17565caca1c
|
|
53
|
+
/deepseek-ai-dsh-session-snapshot/model-experience/kv-cache-effect:
|
|
54
|
+
en: ca75c51c89c2c9b0
|
|
55
|
+
zh: f57cc48a1b5cbfa9
|
|
56
|
+
/deepseek-ai-dsh-session-snapshot/known-limitations-and-deferred-work:
|
|
57
|
+
en: 42e871839dddaf6d
|
|
58
|
+
zh: b7ab1d313527612b
|
|
59
|
+
/deepseek-ai-dsh-session-snapshot/known-limitations-and-deferred-work/dev-note:
|
|
60
|
+
en: e67f633dc6fe7773
|
|
61
|
+
zh: 3bb0c20c93f16f98
|
package/README.md
CHANGED
|
@@ -84,7 +84,7 @@ Headless/ACP and SDK adapters compare raw catalog child-creation times with harv
|
|
|
84
84
|
|
|
85
85
|
### Pinning request headers and system prompts
|
|
86
86
|
|
|
87
|
-
A pin owns its generated `system-prompt.expected.md` or `tool-schemas.expected.json` sidecar by default; `systemPromptSource` and `toolSchemasSource` name another pin when the complete corresponding sequence is identical, so each distinct version is committed once. The system prompt is surface node 0, logged as a `system/message` event before the step's first `request/header`; every fixture stores its text block as `"text":"{{system}}"` and the prompt sidecar keeps the full text. The pin's `request/header` events store `"tools":"{{tools}}"` while retaining config and reason, and the structured schema sidecar keeps the full catalogs. A child Session whose own scope composes a different request declares it per fixture index with `pinsChildToolSchemas` and `pinsChildSystemPrompts`. A scenario that changes the request header mid-run declares `expectedHeaderChanges`; a scenario whose prompt changes mid-run — replacing node 0, or appending after the cached history on an `in-history` route — declares `expectedPromptChanges`, and each change adds a `<!-- system/message change N -->` section to the prompt sidecar. The manifest spells these `header.changes` and `header.promptChanges`.
|
|
87
|
+
A pin owns its generated `system-prompt.expected.md` or `tool-schemas.expected.json` sidecar by default; `systemPromptSource` and `toolSchemasSource` name another pin when the complete corresponding sequence is identical, so each distinct version is committed once. The system prompt is surface node 0, logged as a `system/message` event before the step's first `request/header`; every fixture stores its text block as `"text":"{{system}}"` and the prompt sidecar keeps the full text. The pin's `request/header` events store `"tools":"{{tools}}"` while retaining config and reason, and the structured schema sidecar keeps the full catalogs. Logs containing developer messages retain ordered tool names in each header instead of the token so historical addition references remain verifiable. A child Session whose own scope composes a different request declares it per fixture index with `pinsChildToolSchemas` and `pinsChildSystemPrompts`. A scenario that changes the request header mid-run declares `expectedHeaderChanges`; a scenario whose prompt changes mid-run — replacing node 0, or appending after the cached history on an `in-history` route — declares `expectedPromptChanges`, and each change adds a `<!-- system/message change N -->` section to the prompt sidecar. The manifest spells these `header.changes` and `header.promptChanges`.
|
|
88
88
|
|
|
89
89
|
### Platform and composition variants
|
|
90
90
|
|
package/README.zh.md
CHANGED
|
@@ -84,7 +84,7 @@ Headless/ACP 与 SDK 适配器在规范化之前,将原始目录中的子创
|
|
|
84
84
|
|
|
85
85
|
### 固定请求 header 与系统提示
|
|
86
86
|
|
|
87
|
-
每个 pin 默认拥有其生成的 `system-prompt.expected.md` 或 `tool-schemas.expected.json` 伴随文件;当完整的对应序列相同时,`systemPromptSource` 与 `toolSchemasSource` 指定另一个 pin 作为来源,因此每个不同版本只提交一次。系统提示是 surface 节点 0,作为 `system/message` 事件记录在该步骤第一个 `request/header` 之前;每个 fixture 把其文本块存储为 `"text":"{{system}}"`,提示词伴随文件保留完整文本。该 pin 的 `request/header` 事件存储 `"tools":"{{tools}}"`,同时保留配置与原因,结构化 schema
|
|
87
|
+
每个 pin 默认拥有其生成的 `system-prompt.expected.md` 或 `tool-schemas.expected.json` 伴随文件;当完整的对应序列相同时,`systemPromptSource` 与 `toolSchemasSource` 指定另一个 pin 作为来源,因此每个不同版本只提交一次。系统提示是 surface 节点 0,作为 `system/message` 事件记录在该步骤第一个 `request/header` 之前;每个 fixture 把其文本块存储为 `"text":"{{system}}"`,提示词伴随文件保留完整文本。该 pin 的 `request/header` 事件存储 `"tools":"{{tools}}"`,同时保留配置与原因,结构化 schema 伴随文件保留完整目录。包含 developer 消息的日志会在各 header 中保留有序工具名,而不使用 token,以便继续校验历史工具添加引用。自身作用域组合出不同请求的 child Session 按 fixture 索引以 `pinsChildToolSchemas` 与 `pinsChildSystemPrompts` 单独声明。运行中改变请求 header 的场景声明 `expectedHeaderChanges`;运行中提示词发生变化的场景——替换节点 0,或在 `in-history` 路由上追加到已缓存历史之后——声明 `expectedPromptChanges`,每次变化在提示词伴随文件中增加一个 `<!-- system/message change N -->` 小节。manifest 中对应字段为 `header.changes` 与 `header.promptChanges`。
|
|
88
88
|
|
|
89
89
|
### 平台与组合变体
|
|
90
90
|
|
package/lib/index.js
CHANGED
|
@@ -1512,7 +1512,9 @@ function scrubSystemPrompts(rawLog) {
|
|
|
1512
1512
|
}
|
|
1513
1513
|
/**
|
|
1514
1514
|
* Replace tool schemas in full request-header snapshots with `{{tools}}`
|
|
1515
|
-
* tokens while retaining field presence.
|
|
1515
|
+
* tokens while retaining field presence. Logs containing developer messages
|
|
1516
|
+
* retain tool names so historical addition references remain verifiable.
|
|
1517
|
+
* System-prompt text stays verbatim so
|
|
1516
1518
|
* pinning fixtures can move only schema bulk into their dedicated JSON
|
|
1517
1519
|
* sidecar. Lines without a tool payload pass through byte-for-byte; the
|
|
1518
1520
|
* transform is idempotent.
|
|
@@ -1583,9 +1585,12 @@ function systemPromptBlock(data) {
|
|
|
1583
1585
|
}
|
|
1584
1586
|
/** Transform the selected model-request payloads. */
|
|
1585
1587
|
function scrubModelRequestContent(rawLog, options) {
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1588
|
+
const lines = rawLog.split("\n");
|
|
1589
|
+
const records = lines.map((line) => line.trim().length === 0 ? void 0 : JSON.parse(line));
|
|
1590
|
+
const retainToolNames = records.some((record) => record?.type === "developer/message");
|
|
1591
|
+
return lines.map((line, index) => {
|
|
1592
|
+
const record = records[index];
|
|
1593
|
+
if (record === void 0) return line;
|
|
1589
1594
|
const data = record.data;
|
|
1590
1595
|
if (data === null || typeof data !== "object") return line;
|
|
1591
1596
|
if (options.system === true && record.type === "system/message") {
|
|
@@ -1597,7 +1602,7 @@ function scrubModelRequestContent(rawLog, options) {
|
|
|
1597
1602
|
if (options.tools === true && record.type === "request/header") {
|
|
1598
1603
|
const header = data.header;
|
|
1599
1604
|
if (header === null || typeof header !== "object" || !("tools" in header)) return line;
|
|
1600
|
-
header.tools = TOOLS;
|
|
1605
|
+
header.tools = retainToolNames && Array.isArray(header.tools) ? header.tools.map((tool) => typeof tool === "string" ? tool : tool.name) : TOOLS;
|
|
1601
1606
|
return JSON.stringify(record);
|
|
1602
1607
|
}
|
|
1603
1608
|
return line;
|
|
@@ -2105,13 +2110,18 @@ function parseToolSchemasSnapshot(snapshot) {
|
|
|
2105
2110
|
/**
|
|
2106
2111
|
* Restore one sidecar schema set into a tokenized pinned header.
|
|
2107
2112
|
*
|
|
2108
|
-
* @param header The parsed request header carrying
|
|
2113
|
+
* @param header The parsed request header carrying a tools token or ordered tool names matching the sidecar.
|
|
2109
2114
|
* @param schemas The complete schemas for this full header snapshot.
|
|
2110
2115
|
* @returns A copy of the header with its complete schemas restored.
|
|
2111
2116
|
*/
|
|
2112
2117
|
function restorePinnedToolSchemas(header, schemas) {
|
|
2113
2118
|
if (header === null || typeof header !== "object" || Array.isArray(header)) throw new Error("acp-snapshot: pinned request header must be an object");
|
|
2114
|
-
|
|
2119
|
+
const tools = header.tools;
|
|
2120
|
+
const namesMatch = Array.isArray(tools) && tools.length === schemas.length && tools.every((name, index) => {
|
|
2121
|
+
const schema = schemas[index];
|
|
2122
|
+
return typeof name === "string" && schema !== null && typeof schema === "object" && "name" in schema && schema.name === name;
|
|
2123
|
+
});
|
|
2124
|
+
if (tools !== TOOLS_TOKEN && !namesMatch) throw new Error(`acp-snapshot: pinned request header tools must equal ${TOOLS_TOKEN} or the ordered sidecar tool names`);
|
|
2115
2125
|
return {
|
|
2116
2126
|
...header,
|
|
2117
2127
|
tools: schemas
|
package/lib/types/normalize.d.ts
CHANGED
|
@@ -119,7 +119,9 @@ export declare function normalizeSessionFormatMetadata(rawLog: string, sourceVer
|
|
|
119
119
|
export declare function scrubSystemPrompts(rawLog: string): string;
|
|
120
120
|
/**
|
|
121
121
|
* Replace tool schemas in full request-header snapshots with `{{tools}}`
|
|
122
|
-
* tokens while retaining field presence.
|
|
122
|
+
* tokens while retaining field presence. Logs containing developer messages
|
|
123
|
+
* retain tool names so historical addition references remain verifiable.
|
|
124
|
+
* System-prompt text stays verbatim so
|
|
123
125
|
* pinning fixtures can move only schema bulk into their dedicated JSON
|
|
124
126
|
* sidecar. Lines without a tool payload pass through byte-for-byte; the
|
|
125
127
|
* transform is idempotent.
|
package/lib/types/suite.d.ts
CHANGED
|
@@ -312,7 +312,7 @@ export declare function parseToolSchemasSnapshot(snapshot: string): ToolSchemasS
|
|
|
312
312
|
/**
|
|
313
313
|
* Restore one sidecar schema set into a tokenized pinned header.
|
|
314
314
|
*
|
|
315
|
-
* @param header The parsed request header carrying
|
|
315
|
+
* @param header The parsed request header carrying a tools token or ordered tool names matching the sidecar.
|
|
316
316
|
* @param schemas The complete schemas for this full header snapshot.
|
|
317
317
|
* @returns A copy of the header with its complete schemas restored.
|
|
318
318
|
*/
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-session-snapshot",
|
|
3
3
|
"description": "Session-log snapshot core with an ACP protocol adapter, expected-output normalization, and fixture invariants",
|
|
4
|
-
"version": "0.1.7-
|
|
4
|
+
"version": "0.1.7-rc.2",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -30,29 +30,29 @@
|
|
|
30
30
|
"@agentclientprotocol/sdk": "1.4.0",
|
|
31
31
|
"js-yaml": "^4.2.0",
|
|
32
32
|
"vitest": "^4.1.8",
|
|
33
|
-
"@deepseek-ai/dsh-session-format": "0.1.7-alpha.2",
|
|
34
33
|
"@deepseek-ai/cordis-plugin-include": "~1.0.9",
|
|
35
|
-
"@deepseek-ai/dsh-llm-replay": "0.1.7-
|
|
36
|
-
"@deepseek-ai/dsh-loader-smoke": "0.1.7-
|
|
34
|
+
"@deepseek-ai/dsh-llm-replay": "0.1.7-rc.2",
|
|
35
|
+
"@deepseek-ai/dsh-loader-smoke": "0.1.7-rc.2",
|
|
36
|
+
"@deepseek-ai/dsh-session-format": "0.1.7-rc.2"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@deepseek-ai/dsh-session": "0.1.7-
|
|
40
|
-
"@deepseek-ai/
|
|
41
|
-
"@deepseek-ai/
|
|
39
|
+
"@deepseek-ai/dsh-session": "0.1.7-rc.2",
|
|
40
|
+
"@deepseek-ai/cordis": "~4.0.4",
|
|
41
|
+
"@deepseek-ai/dsh-http-proxy": "0.1.7-rc.2"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/js-yaml": "^4.0.9",
|
|
45
45
|
"@deepseek-ai/cordis": "~4.0.4",
|
|
46
|
-
"@deepseek-ai/dsh-agent": "0.1.7-
|
|
47
|
-
"@deepseek-ai/dsh-agent-loop": "0.1.7-
|
|
48
|
-
"@deepseek-ai/dsh-compaction": "0.1.7-
|
|
49
|
-
"@deepseek-ai/dsh-llm": "0.1.7-
|
|
50
|
-
"@deepseek-ai/dsh-sandbox": "0.1.7-
|
|
51
|
-
"@deepseek-ai/dsh-sandbox-policy": "0.1.7-
|
|
52
|
-
"@deepseek-ai/dsh-session": "0.1.7-
|
|
53
|
-
"@deepseek-ai/dsh-subagent": "0.1.7-
|
|
54
|
-
"@deepseek-ai/dsh-
|
|
55
|
-
"@deepseek-ai/dsh-
|
|
56
|
-
"@deepseek-ai/dsh-
|
|
46
|
+
"@deepseek-ai/dsh-agent": "0.1.7-rc.2",
|
|
47
|
+
"@deepseek-ai/dsh-agent-loop": "0.1.7-rc.2",
|
|
48
|
+
"@deepseek-ai/dsh-compaction": "0.1.7-rc.2",
|
|
49
|
+
"@deepseek-ai/dsh-llm": "0.1.7-rc.2",
|
|
50
|
+
"@deepseek-ai/dsh-sandbox": "0.1.7-rc.2",
|
|
51
|
+
"@deepseek-ai/dsh-sandbox-policy": "0.1.7-rc.2",
|
|
52
|
+
"@deepseek-ai/dsh-session": "0.1.7-rc.2",
|
|
53
|
+
"@deepseek-ai/dsh-subagent": "0.1.7-rc.2",
|
|
54
|
+
"@deepseek-ai/dsh-tools": "0.1.7-rc.2",
|
|
55
|
+
"@deepseek-ai/dsh-user-questions": "0.1.7-rc.2",
|
|
56
|
+
"@deepseek-ai/dsh-http-proxy": "0.1.7-rc.2"
|
|
57
57
|
}
|
|
58
58
|
}
|