@ch4acko3/dsh-turn-fold 0.3.0 → 0.3.1

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.md CHANGED
@@ -5,6 +5,8 @@ English | [简体中文](README.zh-CN.md)
5
5
  A [dsh-harmony](https://github.com/memorax-ai/dsh-harmony) provider that adds
6
6
  Codex-Desktop-style turn folding to the DSH WebUI conversation.
7
7
 
8
+ https://github.com/user-attachments/assets/3c9dfdcf-a454-4750-9edf-76771ed5a9a6
9
+
8
10
  During a turn, the summary bar remains visible while native thinking, notes,
9
11
  commands, and tool calls keep streaming. Consecutive reasoning and tool activity
10
12
  share one compact group from the second item onward. When a turn settles, known
@@ -29,7 +31,7 @@ short open/close transition that unmounts the activity after it closes.
29
31
 
30
32
  ## How it works
31
33
 
32
- Two pinned Source Patches run in memory against the compiled browser bundle of
34
+ Three pinned Source Patches run in memory against the compiled browser bundle of
33
35
  `@deepseek-ai/dsh-client-ui-conversation` (`lib/client.js`); installed DSH files
34
36
  are never modified.
35
37
 
@@ -37,12 +39,13 @@ are never modified.
37
39
  | --- | --- | --- |
38
40
  | `inject-turn-fold-runtime` | `FunctionDeclaration[name.name="ChatView"], VariableStatement:has(VariableDeclaration[name.name="ChatView"])` | Injects the fold renderer + disclosure UI into either native or decorated `ChatView` |
39
41
  | `rewrite-node-render-loop` | `CallExpression[expression.name.name="map"][expression.expression.name="order"]` | Replaces the `order.map(...)` node loop with the per-turn renderer |
42
+ | `install-turn-fold-services` | `VariableStatement:has(VariableDeclaration[name.name="t"][initializer.expression.name.name="bind"])` | Registers the bundled English and Chinese dictionaries through DSH's native locale service and binds the native settings scope |
40
43
 
41
44
  ## Install
42
45
 
43
46
  ```sh
44
47
  dsh plugin --profile web add github:CH4ACKO3/dsh-turn-fold
45
- dsh harmony status --profile web # both patches must be `bound`
48
+ dsh harmony status --profile web # all three patches must be `bound`
46
49
  ```
47
50
 
48
51
  ## Test
@@ -51,9 +54,31 @@ dsh harmony status --profile web # both patches must be `bound`
51
54
  node test/run.cjs
52
55
  ```
53
56
 
54
- `npm install` installs test-only copies of the pinned DSH conversation package,
55
- TypeScript, and TSQuery. The test suite applies both patches in memory, parses
56
- the final browser bundle, and covers completed, split-activity, post-closing,
57
- partial-history, failed, interrupted, open, accessibility, and state-retention
57
+ `npm install` installs the dependencies required by the test harness. The test
58
+ suite applies all three patches in memory, parses the final browser bundle, and
59
+ covers completed, split-activity, post-closing, partial-history, failed,
60
+ interrupted, open, accessibility, localization, settings, and state-retention
58
61
  behavior. A missing target or selector mismatch fails the test; it is never
59
62
  reported as a skipped pass.
63
+
64
+ ## CI and release
65
+
66
+ GitHub Actions runs the test suite and a package dry run for every pull request
67
+ and every push to `main`. Version tags publish to npm through Trusted Publishing
68
+ (OIDC), without a long-lived npm token.
69
+
70
+ Configure the npm trusted publisher once:
71
+
72
+ ```sh
73
+ npx npm@^11.15.0 trust github @ch4acko3/dsh-turn-fold \
74
+ --repo ch4acko3/dsh-turn-fold \
75
+ --file release.yml \
76
+ --allow-publish
77
+ ```
78
+
79
+ Then create and push a version tag whose value matches `package.json`:
80
+
81
+ ```sh
82
+ npm version patch
83
+ git push --follow-tags
84
+ ```
package/README.zh-CN.md CHANGED
@@ -4,6 +4,8 @@
4
4
 
5
5
  一个基于 [dsh-harmony](https://github.com/memorax-ai/dsh-harmony) 的 Provider,为 DSH WebUI 对话添加 Codex Desktop 风格的回合折叠。
6
6
 
7
+ https://github.com/user-attachments/assets/3c9dfdcf-a454-4750-9edf-76771ed5a9a6
8
+
7
9
  回合进行期间,摘要栏保持可见,原生思考、说明、命令和工具调用继续流式输出。从第二项开始,连续的推理和工具活动会合并为一个紧凑分组。回合结束后,包括上下文注入在内的已知 Agent 活动会收进最终答复前方的折叠栏。摘要指标可以配置,默认显示耗时、工具调用次数以及输入/输出 token;只有当已加载的回合包含足够数据、无需猜测即可计算时才会展示对应指标。
8
10
 
9
11
  最终答复通过 `turn-tail.closing.finalNode` 定位,不依赖 `finish_reason` 或 DOM 位置。正常完成、已停止和已中断的回合都会折叠,后两者显示不同的状态标签。当 DSH 将结束分支标记为不可用、结束答复之后仍有节点,或者用户的键盘焦点或文本选择位于活动内容中时,回合会保持展开。失败、达到最大 token、缺少结束节点以及仍在进行的回合也会保持展开,避免隐藏错误或未完成的工作。
@@ -12,18 +14,19 @@
12
14
 
13
15
  ## 工作原理
14
16
 
15
- 两个固定目标的 Source Patch 会在内存中修改 `@deepseek-ai/dsh-client-ui-conversation` 的编译后浏览器包(`lib/client.js`),不会修改已安装的 DSH 文件。
17
+ 三个固定目标的 Source Patch 会在内存中修改 `@deepseek-ai/dsh-client-ui-conversation` 的编译后浏览器包(`lib/client.js`),不会修改已安装的 DSH 文件。
16
18
 
17
19
  | Patch | 选择器(预期命中 1 次) | 作用 |
18
20
  | --- | --- | --- |
19
21
  | `inject-turn-fold-runtime` | `FunctionDeclaration[name.name="ChatView"], VariableStatement:has(VariableDeclaration[name.name="ChatView"])` | 向原生或已装饰的 `ChatView` 注入折叠渲染器和折叠 UI |
20
22
  | `rewrite-node-render-loop` | `CallExpression[expression.name.name="map"][expression.expression.name="order"]` | 将 `order.map(...)` 节点循环替换为按回合渲染器 |
23
+ | `install-turn-fold-services` | `VariableStatement:has(VariableDeclaration[name.name="t"][initializer.expression.name.name="bind"])` | 通过 DSH 原生语言服务注册内置的中英文词典,并绑定原生设置作用域 |
21
24
 
22
25
  ## 安装
23
26
 
24
27
  ```sh
25
28
  dsh plugin --profile web add github:CH4ACKO3/dsh-turn-fold
26
- dsh harmony status --profile web # 两个 Patch 都必须为 `bound`
29
+ dsh harmony status --profile web # 三个 Patch 都必须为 `bound`
27
30
  ```
28
31
 
29
32
  ## 测试
@@ -32,4 +35,26 @@ dsh harmony status --profile web # 两个 Patch 都必须为 `bound`
32
35
  node test/run.cjs
33
36
  ```
34
37
 
35
- `npm install` 会安装仅用于测试的固定版本 DSH 对话包、TypeScript 和 TSQuery。测试套件会在内存中应用两个 Patch、解析最终浏览器包,并覆盖已完成回合、分段活动、结束后活动、部分历史、失败、中断、进行中、无障碍和状态保留等行为。目标缺失或选择器不匹配会使测试失败,不会被报告为跳过后通过。
38
+ `npm install` 会安装测试工具所需的依赖。测试套件会在内存中应用三个 Patch、解析最终浏览器包,并覆盖已完成回合、分段活动、结束后活动、部分历史、失败、中断、进行中、无障碍、本地化、设置和状态保留等行为。目标缺失或选择器不匹配会使测试失败,不会被报告为跳过后通过。
39
+
40
+ ## CI 与发布
41
+
42
+ GitHub Actions 会在每个 Pull Request 和每次推送到 `main` 时运行测试套件及
43
+ 包内容预检。版本标签通过 Trusted Publishing(OIDC)发布到 npm,无需保存
44
+ 长期 npm Token。
45
+
46
+ 首次使用时配置一次 npm 可信发布者:
47
+
48
+ ```sh
49
+ npx npm@^11.15.0 trust github @ch4acko3/dsh-turn-fold \
50
+ --repo ch4acko3/dsh-turn-fold \
51
+ --file release.yml \
52
+ --allow-publish
53
+ ```
54
+
55
+ 之后创建与 `package.json` 版本一致的标签并推送:
56
+
57
+ ```sh
58
+ npm version patch
59
+ git push --follow-tags
60
+ ```
package/package.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
2
  "name": "@ch4acko3/dsh-turn-fold",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Codex-style turn folding for the DSH WebUI conversation, implemented as a dsh-harmony provider.",
5
5
  "main": "./index.cjs",
6
+ "engines": {
7
+ "node": "^22.22.3 || >=24.11.1"
8
+ },
6
9
  "files": [
7
10
  "README.md",
8
11
  "README.zh-CN.md",
@@ -20,7 +23,7 @@
20
23
  },
21
24
  "repository": {
22
25
  "type": "git",
23
- "url": "git+https://github.com/ch4acko3/dsh-turn-fold.git"
26
+ "url": "https://github.com/CH4ACKO3/dsh-turn-fold"
24
27
  },
25
28
  "dsh": {
26
29
  "bundle": {
@@ -47,12 +50,18 @@
47
50
  "check": "node test/run.cjs"
48
51
  },
49
52
  "dependencies": {
50
- "@deepseek-ai/dsh-settings": "0.1.0-rc.8",
51
53
  "@deepseek-ai/schemastery": "^3.18.1"
52
54
  },
55
+ "peerDependencies": {
56
+ "@deepseek-ai/dsh-client-ui-conversation": "^0.1.0-rc.8",
57
+ "@deepseek-ai/dsh-settings": "^0.1.0-rc.8",
58
+ "dsh-harmony": "^0.7.0"
59
+ },
53
60
  "devDependencies": {
54
61
  "@deepseek-ai/dsh-client-ui-conversation": "0.1.0-rc.8",
62
+ "@deepseek-ai/dsh-settings": "0.1.0-rc.8",
55
63
  "@phenomnomnominal/tsquery": "^6.2.0",
64
+ "dsh-harmony": "^0.7.0",
56
65
  "react": "18.3.1",
57
66
  "react-test-renderer": "18.3.1",
58
67
  "typescript": "^6.0.3"
package/patch.cjs CHANGED
@@ -13,7 +13,7 @@
13
13
  // 3. install-turn-fold-services — registers the plugin's native DSH locale
14
14
  // namespace and binds its native settings scope during conversation boot.
15
15
  //
16
- // Both selectors are pinned with an exact `expect: 1` and a target version so
16
+ // All three selectors are pinned with an exact `expect: 1` and a target version so
17
17
  // a compiled-shape drift fails loudly in `dsh harmony status`.
18
18
 
19
19
  const INLINE = require('./inline-source.cjs')
@@ -21,7 +21,7 @@ const INLINE = require('./inline-source.cjs')
21
21
  const TARGET = {
22
22
  package: '@deepseek-ai/dsh-client-ui-conversation',
23
23
  version: '0.1.0-rc.8',
24
- files: ['lib/client.js'],
24
+ file: 'lib/client.js',
25
25
  }
26
26
 
27
27
  module.exports = [