dsh-claude-project-ui 0.4.3 → 0.5.0

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.
@@ -0,0 +1,113 @@
1
+ # dsh-threads
2
+
3
+ [中文](README.md) | English
4
+
5
+ A [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) plugin, modelled on Claude's projects and threads. Your project's main conversation acts as a dispatcher: when a task is self-contained, it opens a **thread** (a real session you can click into and keep talking to), and when the thread finishes, a short report comes back to the main conversation.
6
+
7
+ > Status: stable since 0.1.0; every version is on [Releases](https://github.com/Kyf-eng/dsh-threads/releases). Built against DeepSeek Harness 0.2.1-rc.2 and tested on 0.2.1-rc.2, 0.2.1-rc.3 and 0.2.2-rc.1. See [CHANGELOG.md](CHANGELOG.md) and the design notes in [docs/IMPLEMENTATION.md](docs/IMPLEMENTATION.md).
8
+
9
+ ![One message: the main conversation opens three threads that work at the same time](https://raw.githubusercontent.com/Kyf-eng/dsh-threads/main/docs/media/demo.gif)
10
+
11
+ ## What it does
12
+
13
+ - **Projects**: one folder plus one standing main conversation, with an icon, a goal for the coordinator, and instructions every thread also gets. Create one from **Projects** in the sidebar (the system folder chooser picks the folder), or turn a conversation into a project from its "…" menu. A card's "⋮" menu pins, archives, deletes, sets the project's desktop notifications, and opens its settings (models for the coordinator and threads, usage).
14
+ - **Threads**: the main conversation opens threads for self-contained work, sends follow-ups to them, and suggests threads you did not ask for (they wait in a card above the composer until you start them). Each thread is a real session: open it in the right sidebar and talk to it directly.
15
+ - **Reports**: threads report what is done, what changed and what you need to decide. The main conversation is woken once, when none of its threads is still running, with a guard against wake-up loops. A thread that forgets to report is reminded once, and a report a thread sends later, when a background job it left running finishes, reaches the main conversation too.
16
+ - **Parallel and isolated**: up to 3 threads run at once. Threads that change files work in their own git worktree and branch (`dsh-threads/<n>-<id>`), so the project folder is never touched; the main conversation merges only when you ask, and `/thread cleanup` removes finished worktrees.
17
+ - **Claude-style UI**: thread cards in the conversation, "↳ N replies", a raised hand for threads waiting on you, a breathing dot for running ones, file and branch chips. The sidebar has its own **Projects** section: one row per project (its state and ↳N), which opens the main conversation. Project conversations and threads stay out of the workspace list.
18
+
19
+ ## Platforms
20
+
21
+ - **macOS Desktop**: the main development and test platform; every feature has been tried on it.
22
+ - **Windows Desktop (x64)**: tested in two rounds. Projects, threads, worktrees, cleanup, keeping the approval mode, stopping, archiving and the full workflow work. Install [Git for Windows](https://git-scm.com/download/win) first; for deeply nested repositories, see long paths under Troubleshooting. DeepSeek Harness's own Windows sandbox sometimes cannot give the project folder write access (`SetNamedSecurityInfoW failed (Win32 5)`); thread terminal commands then need your one-time approval to run with more access. Desktop notifications and the English UI are not verified on Windows yet.
23
+ - **Linux**: DeepSeek Harness has no Linux Desktop app; the Web app is untested on Linux.
24
+ - **Web app** (`--profile web`): used on macOS, not fully tested.
25
+ - Unit tests run in CI on Linux, macOS and Windows.
26
+
27
+ ## Install
28
+
29
+ Requires DeepSeek Harness **0.2.x** (Desktop or Web; tested on 0.2.1-rc.2, 0.2.1-rc.3 and 0.2.2-rc.1) and its `dsh` command line. On Desktop it is set up from the app menu (**Manage dsh command…**). Without it, the command line from npm at your DeepSeek Harness version works too, for example `npx -y @deepseek-ai/dsh@0.2.1-rc.2 plugin --profile web add @kyf-eng/dsh-threads`.
30
+
31
+ 1. Quit DeepSeek Harness completely (⌘Q on macOS; also quit from its menu-bar or tray icon if it has one).
32
+ 2. Add the plugin to your profile:
33
+
34
+ ```sh
35
+ dsh plugin --profile desktop add @kyf-eng/dsh-threads
36
+ ```
37
+
38
+ The same command upgrades it later, including from the 0.1.0-rc.7 and later pre-releases to the stable release; projects and threads are kept. Use `--profile web` for the Web app. For a particular version, add `@<version>` to the name (for example `@kyf-eng/dsh-threads@0.1.0`); without npm, use the address of the `.tgz` on [Releases](https://github.com/Kyf-eng/dsh-threads/releases).
39
+ 3. Start DeepSeek Harness. **Projects** appears in the sidebar.
40
+
41
+ To remove it: `dsh plugin --profile desktop remove @kyf-eng/dsh-threads` (`@fky/dsh-threads` for 0.1.0-rc.6 and earlier).
42
+
43
+ Upgrading from 0.1.0-rc.6 or earlier: the package was renamed from `@fky/dsh-threads` to `@kyf-eng/dsh-threads`, so the new version does not replace the old one. Quit DeepSeek Harness completely, run `dsh plugin --profile desktop remove @fky/dsh-threads`, then install with step 2 above. Projects and threads live in DeepSeek Harness's own storage and survive removing the old package.
44
+
45
+ ## Use
46
+
47
+ 1. **Projects → New project**: name it and pick a folder (any folder; it becomes a workspace if it is not one).
48
+ 2. In the project's main conversation, ask for work in the background ("open a thread to…"). You can also type `/thread <task>`, or `/thread -w <task>` for a thread with its own worktree.
49
+ 3. Click a thread card to open the thread on the right. Talk to it there; **Stop** it while it runs (or `/thread stop <n>`), **Mark resolved** when you are done with it, and archive it to put it away (archived threads are listed apart and can be unarchived).
50
+ 4. When the model suggests threads, start one, all, or none from the card above the composer.
51
+ 5. A worktree thread's changes stay on its branch. Merge it yourself or ask the main conversation to, then run `/thread cleanup` (and `/thread cleanup confirm`).
52
+
53
+ ## Configuration
54
+
55
+ Add a `config` to the plugin's entry in your profile's `cordis.patch.yml` (for Desktop, `~/.dsh/profiles/desktop/cordis.patch.yml`):
56
+
57
+ ```yaml
58
+ - id: dsh-threads
59
+ config:
60
+ maxRunning: 2
61
+ ```
62
+
63
+ | Option | Default | Meaning |
64
+ | --- | --- | --- |
65
+ | `maxRunning` | 3 | Threads one main conversation may run at once |
66
+ | `maxAutoWakes` | 5 | Automatic wake-ups in a row before reports wait for you (0: never wake automatically) |
67
+ | `noteMaxChars` | 400 | Longest report delivered to the main conversation |
68
+ | `summaryMaxChars` | 300 | Longest summary a thread may submit |
69
+ | `proposalTtlDays` | 7 | Days before an unstarted suggestion expires |
70
+ | `maxProposalsPerTurn` | 3 | Suggestions the model may make at once |
71
+ | `reportReminder` | true | Remind a thread once when it ends a task without reporting |
72
+ | `inheritPermissionPreset` | true | Threads get the main conversation's permission preset |
73
+ | `offerApproval` | `ask` | When you name a task without asking for a thread: `ask` shows the confirmation card first (open a thread / do it here / not now), `open` opens the thread without asking |
74
+
75
+ ## Troubleshooting
76
+
77
+ - **DeepSeek Harness crashes while Developer tools are on**, with `inspector: source state exceeds the source-frame byte limit` in the log: this is DSH's experimental inspector, and any profile with many plugins can hit it. Add the following to the end of your profile's `cordis.patch.yml` to raise the frame limit to 1 MB (keep `captureFetch: true` in it). Do **not** choose "disable third-party plugins" in the crash dialog: it disables every third-party plugin.
78
+
79
+ ```yaml
80
+ - id: experimental-inspector
81
+ config:
82
+ captureFetch: true
83
+ maxSourceFrameBytes: 1048576
84
+ ```
85
+
86
+ - **"git was not found" when a thread asks for a worktree**: DeepSeek Harness does not ship git; it runs the `git` on the system PATH. On Windows install [Git for Windows](https://git-scm.com/download/win) (a git bundled inside another program does not count), then quit DeepSeek Harness completely and reopen it so it sees the new PATH. When the message quotes git (for example `detected dubious ownership` on Windows), do what git says.
87
+
88
+ - **"Paths too long" for a worktree on Windows**: worktrees live under `.agents\worktrees\…` inside the repository, about forty characters deeper than the repository itself, so a deeply nested repository can go over Windows' default 260-character limit (git says `Filename too long`). Turn on long paths for that repository only (`git -C <repository> config core.longpaths true`), or move the repository to a shorter path.
89
+
90
+ - **No desktop notifications**: none are sent while DeepSeek Harness is in front (the sidebar marks are enough). If they also do not arrive while it is in the background, check the system's notification settings: System Settings → Notifications → DeepSeek Harness on macOS, Settings → System → Notifications on Windows, and your desktop environment's notification service on Linux. The Web app asks for the browser's permission the first time.
91
+
92
+ ## Known limitations
93
+
94
+ - DeepSeek Harness lists 5 sessions per workspace and counts hidden threads among them, so a workspace with many threads shows fewer rows, and its "show N more" count includes threads.
95
+ - A worktree starts from the folder's last commit: uncommitted changes are not in it, and dependencies (`node_modules`, …) have to be installed there.
96
+ - There is no spending cap: apart from how many run at once, threads may use as many tokens as they need. Project settings → Usage shows what they used.
97
+
98
+ ## Development
99
+
100
+ Requires Node ≥ 22.19.
101
+
102
+ ```sh
103
+ npm install
104
+ npm run check
105
+ # quit DeepSeek Harness completely, then:
106
+ npm run dev:install
107
+ ```
108
+
109
+ `dev:install` uses the `dsh` inside the macOS Desktop app. For any other install, run `DSH_CLI=<path to dsh> npm run dev:install`; `DSH_PROFILE` picks the profile (default `desktop`). Conventions and how to test: [CONTRIBUTING.md](CONTRIBUTING.md).
110
+
111
+ ## License
112
+
113
+ MIT
@@ -0,0 +1,113 @@
1
+ # dsh-threads
2
+
3
+ 中文 | [English](README.en.md)
4
+
5
+ 一个 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 插件,照着 Claude 的"项目 + 讨论串"做。项目的主对话当调度员:遇到能独立完成的任务,就开一个**讨论串**——一个你能点进去接着聊的真实会话;讨论串做完后,把简短的回报发回主对话。
6
+
7
+ > 状态:从 0.1.0 起是正式版,各个版本见 [Releases](https://github.com/Kyf-eng/dsh-threads/releases)。基于 DeepSeek Harness 0.2.1-rc.2 开发,在 0.2.1-rc.2、0.2.1-rc.3 和 0.2.2-rc.1 上测试过。更新记录见 [CHANGELOG.md](CHANGELOG.md),设计说明见 [docs/IMPLEMENTATION.md](docs/IMPLEMENTATION.md)。
8
+
9
+ ![一条消息,主对话开出三条讨论串同时干活](https://raw.githubusercontent.com/Kyf-eng/dsh-threads/main/docs/media/demo.gif)
10
+
11
+ ## 功能
12
+
13
+ - **项目**:一个文件夹 + 一个常驻主对话,有图标、给协调者的目标,以及所有讨论串也会收到的项目说明。在左侧"项目"里新建(用系统的文件夹选择器选文件夹),或者在会话的"…"菜单里选"设为项目"。卡片的"⋮"菜单可以置顶、归档、删除、设置这个项目的桌面通知,以及打开项目设置(协调器和讨论串的模型、使用情况)。
14
+ - **讨论串**:主对话为能独立完成的工作开讨论串、给讨论串追加指令,也会提出你没要求的建议(放在输入框上方的卡片里,你点了才开始)。每个讨论串都是真实会话:在右侧面板打开,直接和它对话。
15
+ - **回报**:讨论串回报做完了什么、改了哪些文件、要你决定什么。主对话只在它的讨论串都结束后被唤醒一次,并防止反复唤醒;忘了回报的讨论串会被提醒一次;讨论串留在后台的任务结束后补交的回报,也会送到主对话。
16
+ - **并行和隔离**:最多 3 个讨论串同时运行。会改文件的讨论串在自己的 git worktree 和分支(`dsh-threads/<n>-<id>`)里工作,不碰项目文件夹;你要求时主对话才合并,`/thread cleanup` 清理做完的 worktree。
17
+ - **Claude 式界面**:对话里的讨论串卡片、"↳ N 条回复"、等你回复时的举手、运行中的呼吸点、文件和分支小标签。左侧有单独的"项目"分组:每个项目一行(显示状态和 ↳N),点进去就是主对话。项目的主对话和讨论串都不出现在"工作区"列表里。
18
+
19
+ ## 平台
20
+
21
+ - **macOS 桌面版**:主要的开发和测试平台,全部功能都实测过。
22
+ - **Windows 桌面版(x64)**:实测过两轮。项目、讨论串、worktree、清理、审批沿用、停止、归档和完整流程都正常。需要先装 [Git for Windows](https://git-scm.com/download/win);仓库路径很深时,见下面“排错”里的长路径。DeepSeek Harness 自己的 Windows 沙箱有时给不了项目文件夹写权限(`SetNamedSecurityInfoW failed (Win32 5)`),这时讨论串的终端命令要你一次性批准提权。桌面通知和英文界面还没在 Windows 上验证。
23
+ - **Linux**:DeepSeek Harness 没有 Linux 桌面版;Web 版在 Linux 上没测过。
24
+ - **Web 版**(`--profile web`):在 macOS 上用过,没做完整测试。
25
+ - 单元测试在 Linux、macOS 和 Windows 的 CI 上都跑。
26
+
27
+ ## 安装
28
+
29
+ 需要 DeepSeek Harness **0.2.x**(桌面版或 Web 版;在 0.2.1-rc.2、0.2.1-rc.3 和 0.2.2-rc.1 上测试过)和它的 `dsh` 命令行。桌面版在应用菜单的"管理 dsh 命令…"里设置;没有这个命令时,可以用 npm 上和你的 DeepSeek Harness 同版本的命令行,例如 `npx -y @deepseek-ai/dsh@0.2.1-rc.2 plugin --profile web add @kyf-eng/dsh-threads`。
30
+
31
+ 1. 完全退出 DeepSeek Harness(macOS 上按 ⌘Q;有菜单栏或托盘图标的,也要从那里退出)。
32
+ 2. 把插件加到你的 profile:
33
+
34
+ ```sh
35
+ dsh plugin --profile desktop add @kyf-eng/dsh-threads
36
+ ```
37
+
38
+ 以后升级也是这一条命令(从 0.1.0-rc.7 及以后的预发布版升级到正式版也一样,项目和讨论串都保留)。Web 版用 `--profile web`。要装某个版本,在包名后面加 `@版本号`(例如 `@kyf-eng/dsh-threads@0.1.0`);不想走 npm,也可以填 [Releases](https://github.com/Kyf-eng/dsh-threads/releases) 里那个 `.tgz` 的地址。
39
+ 3. 启动 DeepSeek Harness,左侧出现"项目"。
40
+
41
+ 卸载:`dsh plugin --profile desktop remove @kyf-eng/dsh-threads`(0.1.0-rc.6 及更早的版本叫 `@fky/dsh-threads`)。
42
+
43
+ 从 0.1.0-rc.6 及更早的版本升级:包名从 `@fky/dsh-threads` 改成了 `@kyf-eng/dsh-threads`,新版本不会替换旧的。先完全退出 DeepSeek Harness,运行 `dsh plugin --profile desktop remove @fky/dsh-threads`,再按上面的第 2 步安装。项目和讨论串存在 DeepSeek Harness 自己的存储里,卸载旧包不会丢。
44
+
45
+ ## 使用
46
+
47
+ 1. **项目 → 新建项目**:起名,选一个文件夹(任意文件夹,还不是工作区的会自动添加)。
48
+ 2. 在项目主对话里让它在后台做事("开个讨论串去……")。也可以输入 `/thread <任务>`,或 `/thread -w <任务>` 开一个有独立 worktree 的讨论串。
49
+ 3. 点讨论串卡片,在右侧打开它,可以直接聊;运行中可以点"停止"(或 `/thread stop <n>`),做完了点"标记已解决",不再需要的可以归档(已归档的单独列在最下面,可以取消归档)。
50
+ 4. 模型提出建议时,在输入框上方的卡片里开始一个、全部开始或都不要。
51
+ 5. worktree 讨论串的改动在它自己的分支上。自己合并或让主对话合并,然后 `/thread cleanup`(再 `/thread cleanup confirm`)。
52
+
53
+ ## 配置
54
+
55
+ 在 profile 的 `cordis.patch.yml`(桌面版是 `~/.dsh/profiles/desktop/cordis.patch.yml`)里给插件加 `config`:
56
+
57
+ ```yaml
58
+ - id: dsh-threads
59
+ config:
60
+ maxRunning: 2
61
+ ```
62
+
63
+ | 配置项 | 默认值 | 含义 |
64
+ | --- | --- | --- |
65
+ | `maxRunning` | 3 | 一个主对话同时能跑几个讨论串 |
66
+ | `maxAutoWakes` | 5 | 连续自动唤醒几次后,回报改为等你开口(0 表示从不自动唤醒) |
67
+ | `noteMaxChars` | 400 | 发回主对话的回报最长多少字 |
68
+ | `summaryMaxChars` | 300 | 讨论串摘要最长多少字 |
69
+ | `proposalTtlDays` | 7 | 没开始的建议几天后过期 |
70
+ | `maxProposalsPerTurn` | 3 | 模型一次最多提几个建议 |
71
+ | `reportReminder` | true | 讨论串做完任务却没回报时,提醒它一次 |
72
+ | `inheritPermissionPreset` | true | 讨论串沿用主对话的权限模式 |
73
+ | `offerApproval` | `ask` | 你只说了任务、没说要开讨论串时:`ask` 先弹确认卡(开讨论串 / 在主对话里做 / 先不做),`open` 不问直接开 |
74
+
75
+ ## 排错
76
+
77
+ - **开着"开发者工具"时 DeepSeek Harness 崩溃**,日志里有 `inspector: source state exceeds the source-frame byte limit`:这是 DSH 实验性检查器的问题,插件多的 profile 都可能碰到。在 profile 的 `cordis.patch.yml` 末尾加下面一段,把单帧上限调到 1MB(要连 `captureFetch: true` 一起写)。**不要**点崩溃对话框里的"禁用第三方插件",那会把所有第三方插件一起禁掉。
78
+
79
+ ```yaml
80
+ - id: experimental-inspector
81
+ config:
82
+ captureFetch: true
83
+ maxSourceFrameBytes: 1048576
84
+ ```
85
+
86
+ - **开 worktree 讨论串时提示“找不到 git”**:DeepSeek Harness 自己不带 git,用的是系统 PATH 里的 `git`。Windows 上装 [Git for Windows](https://git-scm.com/download/win)(其他程序自带的 git 不算),然后完全退出并重开 DeepSeek Harness,让它读到新的 PATH。提示里引用了 git 的原话(比如 Windows 上的 `detected dubious ownership`)时,按 git 说的处理。
87
+
88
+ - **Windows 上开 worktree 提示路径太长**:worktree 放在仓库里的 `.agents\worktrees\…` 下,路径比原仓库长四十来个字符,仓库本身路径就很深时会超过 Windows 默认的 260 字符上限(git 报 `Filename too long`)。可以只为这个仓库打开长路径支持(`git -C <仓库> config core.longpaths true`),或者把仓库放到更短的路径下。
89
+
90
+ - **收不到桌面通知**:DeepSeek Harness 在前台时不发通知(侧栏的记号已经够了)。在后台也收不到时,看系统的通知设置:macOS 是"系统设置 → 通知 → DeepSeek Harness",Windows 是"设置 → 系统 → 通知",Linux 取决于桌面环境的通知服务。Web 版第一次会请求浏览器的通知权限。
91
+
92
+ ## 已知限制
93
+
94
+ - DeepSeek Harness 每个工作区默认只列 5 个会话,隐藏的讨论串也算在里面,所以讨论串多的工作区里可见的行会变少,"展开其余 N 个会话"的 N 也包含讨论串。
95
+ - worktree 从文件夹最后一次提交开出:没提交的改动不在里面,依赖(`node_modules` 等)要在 worktree 里重新装。
96
+ - 没有花费上限:除了同时运行的数量,讨论串用多少 token 不设限。用量在项目设置的"使用情况"里看。
97
+
98
+ ## 开发
99
+
100
+ 需要 Node ≥ 22.19。
101
+
102
+ ```sh
103
+ npm install
104
+ npm run check
105
+ # 完全退出 DeepSeek Harness 后:
106
+ npm run dev:install
107
+ ```
108
+
109
+ `dev:install` 默认用 macOS 桌面版自带的 `dsh`。其他安装方式用 `DSH_CLI=<dsh 命令的路径> npm run dev:install`,`DSH_PROFILE` 指定 profile(默认 `desktop`)。约定和测试方法见 [CONTRIBUTING.md](CONTRIBUTING.md)。
110
+
111
+ ## 协议
112
+
113
+ MIT
@@ -0,0 +1,66 @@
1
+ # 内嵌来源(vendored @kyf-eng/dsh-threads)
2
+
3
+ 本目录是 **@kyf-eng/dsh-threads** 的原样副本(byte-exact),由 dsh-claude-project-ui
4
+ 自带,用户不再需要单独安装上游包。
5
+
6
+ ## 来源
7
+
8
+ | 项 | 值 |
9
+ |---|---|
10
+ | 仓库 | https://github.com/lanechenhku/dsh-threads(上游 Kyf-eng/dsh-threads 的 fork,只打 tag、不改代码) |
11
+ | tag | `v0.2.0-baseline` |
12
+ | commit | `469f32c3de8ccce61f88acdb527e5e0131c2ddd1`(`chore: release v0.2.0 (#59)`) |
13
+ | npm 对应版本 | `@kyf-eng/dsh-threads@0.2.0` |
14
+ | 许可证 | MIT,Copyright (c) 2026 fky(原文见 `LICENSE`) |
15
+ | 取用日期 | 2026-12-01 |
16
+
17
+ 上游仓库把 `dist/` 提交进版本库(`dist/ is committed on purpose: GitHub installs run through
18
+ pnpm 11, which blocks prepare scripts`),所以 tag 里的 `dist/` 就是发布物本身。本目录的文件
19
+ 与 tag `v0.2.0-baseline` 及 npm tarball **逐字节相同**,已核对:
20
+
21
+ ```
22
+ 738f2bd854953e50b514d051059afe0b9285adf2363c7c4816033e1530fd794e dist/index.js
23
+ 86a9b93b1122ef125d388d8a66e98acdea6d1fcc7d0c244a50392c3a290c2d95 dist/client.js
24
+ ce014f0a126461a9dc58aaf416780a9a389af90b6836ce5498323897da33edcf locale/zh.json
25
+ b5dbed44361c7ca390188ac7e5dc87d8dbd84f4c3622a7e160f15733371ff622 locale/en.json
26
+ 4c80378da369def693d81b7da4ec7787624ec84099a106733ac5a2fa109db5c0 LICENSE
27
+ ```
28
+
29
+ `test/vendor-checks.mjs` 每次 `npm test` 都会重新核对 `LICENSE` 与 `dist/index.js` 的
30
+ sha256,以及 `src/client.js` 内联段的逐字节一致,防止两手代码悄悄漂移。
31
+
32
+ ## 本目录里的文件
33
+
34
+ | 文件 | 用途 |
35
+ |---|---|
36
+ | `dist/index.js` | 宿主半边(Cordis 插件)。由 `src/threads-vendor.js` 动态 `import` 后 `ctx.plugin()` 挂载。 |
37
+ | `dist/client.js` | 浏览器半边。**原样内联**进 `src/client.js` 的工厂函数(见下),不单独作为模块加载。 |
38
+ | `locale/zh.json`、`locale/en.json` | 上游的工具栏 / 设置页文案(宿主侧读取)。 |
39
+ | `cordis.patch.yml` | 上游的 bundle patch,**不使用**(我们不再插入第二行 Loader 条目)。留作来源记录。 |
40
+ | `package.json` | 上游清单,留作来源记录(版本、peerDependencies、client inject 名单)。 |
41
+ | `README.md`、`README.en.md`、`CHANGELOG.md`、`icon.svg` | 上游文档与图标原样保留,供对照。 |
42
+
43
+ ## 我们对上游代码的改动
44
+
45
+ **这些文件本身一个字节都没改。** 本包对上游的“改动”全部在包住它的那一层:
46
+
47
+ 1. **宿主**:`src/threads-vendor.js` 动态 `import` `vendor/dsh-threads/dist/index.js`,再用
48
+ `ctx.plugin(mod, {})` 挂载到我们的插件作用域里。上游原来那行 `cordis.patch.yml`
49
+ (`id: dsh-threads`)不再插入,所以一个 profile 里只有一行 Loader 条目(我们的)。
50
+ 2. **浏览器**:上游 `dist/client.js` 的 factory 函数体被**原样复制**进 `src/client.js`,
51
+ 包成一个函数 `loadVendoredThreadsClient(require)`,由我们在自己的 `apply` 里按条件调用;
52
+ 我们自己的 bundle 仍然是 `exports["./client"]` 指向的唯一入口。
53
+ 3. **让路**:用户自己装了并启用了上游包时,上面两处都不挂载(`src/threads-vendor.js`
54
+ 的 `vendorDecision()`),见 README 的「两个档」一节。
55
+
56
+ ## 重新同步到新版上游
57
+
58
+ ```sh
59
+ git clone https://github.com/lanechenhku/dsh-threads /tmp/dsh-threads
60
+ cd /tmp/dsh-threads && git checkout <new-tag>
61
+ cp dist/index.js dist/client.js locale/*.json LICENSE README.md README.en.md CHANGELOG.md \
62
+ cordis.patch.yml package.json icon.svg <本包>/vendor/dsh-threads/
63
+ ```
64
+ 客户端那半还要把新的 factory 体重新内联进 `src/client.js`(`npm run sync-client`,
65
+ 见 package.json 的 scripts 与 README「开发者」一节),然后跑 `npm test`——内联段与
66
+ `vendor/dsh-threads/dist/client.js` 不一致时测试会直接失败。
@@ -0,0 +1,6 @@
1
+ # Bundle patch for @kyf-eng/dsh-threads, applied when the bundle is enabled in a profile.
2
+ # The row's `name` must be this package's name so DSH also discovers its dsh.client half.
3
+ - insert:
4
+ - id: dsh-threads
5
+ name: '@kyf-eng/dsh-threads'
6
+ config: {}