dsh-chat-embed 0.6.8 → 0.6.9

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
@@ -330,6 +330,7 @@ node scripts/release.mjs 0.6.7 --summary "..." --dry-run # 只看计划
330
330
 
331
331
  | 版本 | 变化 |
332
332
  | --- | --- |
333
+ | `0.6.9` | 设置菜单把「跨重启保持登录」与「检查补丁配置」合成一行(滑动开关 + 确认弹窗 + 新会话引导);发版改用 OIDC Trusted Publishing,不再保存 npm 令牌,并附带 provenance |
333
334
  | `0.6.8` | 去掉单提交策略:发版改为普通提交 + 普通推送,不再 --orphan 重写、reflog expire、gc --prune 与强推;恢复 git log/diff/blame/bisect,发版失败可 reset 回退,并为 OIDC provenance 扫清障碍 |
334
335
  | `0.6.7` | 发版脚本:一条命令完成 bump/gate/提交/推送/等 CI/发布/打 tag/建 release;新增 dependabot 自动维护固定 SHA 的 Action |
335
336
  | `0.6.6` | 元数据同步版:把 `engines.node` 收紧到 `>=22.14.0`、门禁脚本从 `prepublishOnly` 换成 `prepack`(同时覆盖 `npm pack` 与 `npm publish`)落到 npm 上;新增 CI 工作流(Node 22/24 跑门禁,并校验 tag 与 `BUILD` 一致)。无功能变化 |
package/client.js CHANGED
@@ -103,7 +103,7 @@ window.__ModuleLoader__.load({
103
103
  let openRightTabImpl = () => {}
104
104
 
105
105
  /** Build identity, surfaced in the panel so a packaged app can be diagnosed. */
106
- const BUILD = '0.6.8'
106
+ const BUILD = '0.6.9'
107
107
 
108
108
  /** Where a re-applied instance finds the one it must take over from. */
109
109
  const INSTANCE_KEY = '__DSH_CHAT_EMBED_INSTANCE__'
@@ -262,9 +262,11 @@ window.__ModuleLoader__.load({
262
262
  persistHint: 'Needs the shell patch; a plugin cannot change how the shell names partitions.',
263
263
  persistRisk:
264
264
  'Experimental: the patch rewrites the app.asar of the desktop shell and needs write access to its install folder. A shell update replaces it, so the patch has to be applied again.',
265
- persistCopy: 'Copy the patch instructions',
266
- persistCheck: 'Check the patch setup',
267
265
  persistCheckHint: 'Opens a new session and drafts the check for you',
266
+ persistConfirmTitle: 'Turn on “login across restarts”?',
267
+ persistConfirmNote: 'Continuing opens a new session with the known facts already in the composer — review them and press send.',
268
+ persistConfirmGo: 'Continue',
269
+ persistConfirmCancel: 'Cancel',
268
270
  patchPromptPlugin: 'Plugin',
269
271
  patchPrompt:
270
272
  'Check the DSH desktop shell patch that keeps the embedded chat logins across restarts, and tell me what to do.\n\nKnown so far:\n{facts}\n\nCall the dsh_chat_embed_patch_check tool to confirm the facts, then:\n1. say in a sentence or two what the situation is;\n2. if the patch is missing or was lost, give me the exact command to run;\n3. do not modify any file.',
@@ -347,16 +349,18 @@ window.__ModuleLoader__.load({
347
349
  loggingOn: '开',
348
350
  loggingOff: '关',
349
351
  loggingCopy: '复制日志',
350
- persistLabel: '跨重启保持登录',
352
+ persistLabel: '重启保持登录',
351
353
  persistOn: '已开启(persist: 分区)',
352
354
  persistOff: '未开启(内存分区)',
353
355
  persistLost: '已失效(桌面壳升级覆盖了补丁)',
354
356
  persistUnknown: '尚未检测',
355
357
  persistHint: '需要桌面壳补丁;插件无法改变壳的分区命名。',
356
358
  persistRisk: '实验性功能:补丁会改写桌面壳的 app.asar,需要安装目录的写权限;桌面壳升级会覆盖补丁,需要重新打一次。',
357
- persistCopy: '复制补丁说明',
358
- persistCheck: '检查补丁配置',
359
359
  persistCheckHint: '打开新会话,把检查内容写好,点发送即可',
360
+ persistConfirmTitle: '开启「重启保持登录」?',
361
+ persistConfirmNote: '点击「继续」会打开一个新会话,把已知信息写进输入框,确认后发送即可。',
362
+ persistConfirmGo: '继续',
363
+ persistConfirmCancel: '取消',
360
364
  patchPromptPlugin: '插件',
361
365
  patchPrompt:
362
366
  '帮我检查 DSH 桌面版「跨重启保持登录」的补丁状态,并告诉我该做什么。\n\n已知信息:\n{facts}\n\n请先调用 dsh_chat_embed_patch_check 工具核对上面的信息,然后:\n1. 用一两句话说明现在是什么情况;\n2. 如果补丁没打或已失效,给出我可以直接执行的命令;\n3. 不要修改任何文件。',
@@ -2827,10 +2831,9 @@ window.__ModuleLoader__.load({
2827
2831
  '.dce-menu-row{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:5px 8px;border-radius:6px;font-size:13px;color:var(--dsw-alias-label-primary,#1f2329)}',
2828
2832
  '.dce-menu-row:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.12))}',
2829
2833
  '.dce-menu-label{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}',
2830
- '.dce-menu-value{flex:0 0 auto;font-size:12px;color:var(--dsw-alias-label-tertiary,#9aa0a6)}',
2831
2834
  '.dce-menu-sep{margin:5px 0 3px;border-top:1px solid var(--dsw-alias-border-l1,rgba(127,127,127,.24))}',
2832
- '.dce-menu-note{margin:4px 8px 6px;font-size:11.5px;line-height:1.5;color:var(--dsw-alias-label-tertiary,#9aa0a6);white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word;max-width:100%;box-sizing:border-box}',
2833
- '.dce-menu-note[data-persist-risk="true"]{color:var(--dsw-alias-label-warning,#c98b16)}',
2835
+ '.dce-confirm-scrim{position:absolute;inset:0;z-index:7;background:rgba(0,0,0,.28)}',
2836
+ '.dce-card[data-modal="true"]{z-index:8}',
2834
2837
  '.dce-menu-item{display:flex;align-items:center;justify-content:flex-start;gap:8px;width:100%;box-sizing:border-box;padding:6px 8px;border:0;border-radius:6px;background:transparent;color:inherit;font-size:13px;text-align:left;cursor:pointer}',
2835
2838
  '.dce-menu-item:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.12))}',
2836
2839
  '.dce-right-title{display:inline-flex;align-items:center;gap:6px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}',
@@ -3251,6 +3254,7 @@ window.__ModuleLoader__.load({
3251
3254
  // Auto-hiding tab bar: hidden until the pointer reaches the top hot zone.
3252
3255
  const [barOpen, setBarOpen] = React.useState(false)
3253
3256
  const [menuOpen, setMenuOpen] = React.useState(false)
3257
+ const [confirmOpen, setConfirmOpen] = React.useState(false)
3254
3258
 
3255
3259
  /**
3256
3260
  * Close the settings menu.
@@ -3498,52 +3502,22 @@ window.__ModuleLoader__.load({
3498
3502
  h(
3499
3503
  'div',
3500
3504
  { className: 'dce-menu-row' },
3501
- h('span', { className: 'dce-menu-label' }, t('persistLabel')),
3502
- h(
3503
- 'span',
3504
- { className: 'dce-menu-value', title: t('persistHint') },
3505
- persistenceText(t, persistenceState()),
3506
- ),
3507
- ),
3508
- persistenceState() === 'on'
3509
- ? null
3510
- : h('div', { className: 'dce-menu-note', 'data-persist-risk': 'true' }, t('persistRisk')),
3511
- persistenceState() === 'on'
3512
- ? null
3513
- : h(
3514
- 'button',
3515
- {
3516
- type: 'button',
3517
- className: 'dce-menu-item',
3518
- 'data-patch-help': 'true',
3519
- onClick: () => {
3520
- void fetchProbe().then((probe) => copyText(patchInstructions(t, probe)))
3521
- },
3522
- },
3523
- h('span', { className: 'dce-menu-label' }, t('persistCopy')),
3524
- ),
3525
- h(
3526
- 'div',
3527
- { className: 'dce-menu-row' },
3528
- h('span', { className: 'dce-menu-label', title: t('persistCheckHint') }, t('persistCheck')),
3529
- h(
3530
- 'button',
3531
- {
3532
- type: 'button',
3533
- role: 'switch',
3534
- className: 'dce-switch',
3535
- 'data-on': patchCheck.running ? 'true' : 'false',
3536
- 'aria-checked': patchCheck.running ? 'true' : 'false',
3537
- 'data-patch-check': 'true',
3538
- 'aria-label': t('persistCheck'),
3539
- title: t('persistCheckHint'),
3540
- disabled: patchCheck.running,
3541
- onClick: () => {
3542
- closeMenu()
3543
- void openPatchCheckSession(t)
3544
- },
3505
+ h('span', { className: 'dce-menu-label', title: t('persistHint') }, t('persistLabel')),
3506
+ h('button', {
3507
+ type: 'button',
3508
+ role: 'switch',
3509
+ className: 'dce-switch',
3510
+ 'data-on': persistenceState() === 'on' ? 'true' : 'false',
3511
+ 'aria-checked': persistenceState() === 'on' ? 'true' : 'false',
3512
+ 'data-persist-open': 'true',
3513
+ 'aria-label': t('persistLabel'),
3514
+ title: t('persistCheckHint'),
3515
+ disabled: patchCheck.running,
3516
+ onClick: () => {
3517
+ closeMenu()
3518
+ setConfirmOpen(true)
3545
3519
  },
3546
- ),
3520
+ }),
3547
3521
  ),
3548
3522
  h(
3549
3523
  'button',
@@ -3583,6 +3557,49 @@ window.__ModuleLoader__.load({
3583
3557
  ),
3584
3558
  )
3585
3559
  : null,
3560
+ confirmOpen
3561
+ ? h('div', {
3562
+ className: 'dce-confirm-scrim',
3563
+ onPointerDown: () => setConfirmOpen(false),
3564
+ })
3565
+ : null,
3566
+ confirmOpen
3567
+ ? h(
3568
+ 'div',
3569
+ {
3570
+ className: 'dce-card',
3571
+ role: 'dialog',
3572
+ 'aria-modal': 'true',
3573
+ 'data-modal': 'true',
3574
+ 'aria-label': t('persistConfirmTitle'),
3575
+ },
3576
+ h('div', { className: 'dce-card-title' }, t('persistConfirmTitle')),
3577
+ h('div', { className: 'dce-card-body' }, t('persistRisk')),
3578
+ h('div', { className: 'dce-card-body' }, t('persistConfirmNote')),
3579
+ h(
3580
+ 'div',
3581
+ { className: 'dce-card-actions' },
3582
+ h(
3583
+ 'button',
3584
+ { type: 'button', className: 'dce-button', 'data-persist-cancel': 'true', onClick: () => setConfirmOpen(false) },
3585
+ t('persistConfirmCancel'),
3586
+ ),
3587
+ h(
3588
+ 'button',
3589
+ {
3590
+ type: 'button',
3591
+ className: 'dce-button dce-button-primary',
3592
+ 'data-persist-confirm': 'true',
3593
+ onClick: () => {
3594
+ setConfirmOpen(false)
3595
+ void openPatchCheckSession(t)
3596
+ },
3597
+ },
3598
+ t('persistConfirmGo'),
3599
+ ),
3600
+ ),
3601
+ )
3602
+ : null,
3586
3603
  showStatus
3587
3604
  ? h(
3588
3605
  'div',
@@ -3,7 +3,7 @@
3
3
  本文记录 `client.js` 里每一条**反直觉**的实现决策、支撑它的证据,以及升级桌面壳时必须重新验证的清单。
4
4
 
5
5
  目标运行环境:**`@deepseek-ai/dsh-desktop 0.2.2-rc.1`(Electron / Chromium)**。
6
- 当前实现:**v0.6.8**(`client.js` 约 3985 行,85 项契约测试)。
6
+ 当前实现:**v0.6.9**(`client.js` 约 3985 行,85 项契约测试)。
7
7
 
8
8
  > **架构一句话**:聊天页直接渲染在**席位的布局盒**里(`.dce-panel.dce-inline`,`width/height:100%`),几何完全交给 CSS;席位只有两个 —— 中央主面板(`main`)和右栏聊天 tab —— 二者互斥,**哪边点哪边接管**,切换时 guest 重建一次并回到上次会话。
9
9
 
@@ -22,6 +22,13 @@
22
22
 
23
23
  仓库没有运行时依赖,也没有 lock 文件,所以正常情况下 `npm ci` 会跳过;一旦加了依赖,锁文件出现后自动生效。
24
24
 
25
+ `.github/workflows/publish.yml`:发布专用,**只有手动触发**(`workflow_dispatch`)。它跑门禁、校验版本一致性,然后用 **OIDC Trusted Publishing** 发布,仓库和本机都不保存任何 npm 令牌。由 `scripts/release.mjs` 触发,也可以手动:
26
+
27
+ ```powershell
28
+ gh workflow run publish.yml -f version=0.6.9
29
+ gh run watch
30
+ ```
31
+
25
32
  `.github/dependabot.yml`:每周一维护 `ci.yml` 里固定成 commit SHA 的 action。我们钉的是 `uses: owner/action@<40 位 SHA> # vX.Y.Z` 这种形式,Dependabot 认得行尾的版本注释,会把 SHA 换成新版本的完整 SHA 并同步更新注释。同周的 action 升级合成一个 PR。包本身没有依赖,所以没有声明 npm 生态。
26
33
 
27
34
  ## 发版步骤
@@ -32,7 +39,7 @@
32
39
  node scripts/release.mjs 0.6.7 --summary "一句话说明这次改了什么"
33
40
  ```
34
41
 
35
- 它按顺序做六件事。**顺序的理由:先发布,后打 tag。** `npm publish` 是唯一不可逆的一步(72 小时后只能 deprecate),tag 与 Release 随时可删可重做;先做不可逆的,失败就停,不会留下"GitHub 有 Release、npm 没有包"的幽灵版本。
42
+ 它按顺序做六件事。**顺序的理由:先发布,后打 tag。** 发布到 npm 是唯一不可逆的一步(72 小时后只能 deprecate),tag 与 Release 随时可删可重做;先做不可逆的,失败就停,不会留下"GitHub 有 Release、npm 没有包"的幽灵版本。
36
43
 
37
44
  | 阶段 | 做什么 | 已经做过时怎么判断 |
38
45
  | --- | --- | --- |
@@ -41,7 +48,7 @@ node scripts/release.mjs 0.6.7 --summary "一句话说明这次改了什么"
41
48
  | commit | `git add -A` + 普通提交 | 工作树干净则跳过 |
42
49
  | push | 推送 master,触发 CI | — |
43
50
  | ci | 等这次推送的 CI 跑完,红了就停 | — |
44
- | publish | `npm publish` | registry 上已有该版本则跳过 |
51
+ | publish | 触发 `publish.yml`,由 OIDC 在 CI 里发布 | registry 上已有该版本则跳过 |
45
52
  | tag | 打 tag 并推送(CI 再校验一次) | tag 已存在则跳过 |
46
53
  | release | `npm run pack:dist` + `gh release create` | Release 已存在则跳过 |
47
54
 
@@ -63,7 +70,7 @@ node scripts/release.mjs 0.6.7 --summary "..." --notes dist\notes.md # Release
63
70
  npm run check # 1. 本地门禁
64
71
  # 2. git add -A && git commit && git push
65
72
  gh run list --repo poluce/dsh-chat-embed --limit 1 # 3. 等 CI 绿
66
- npm publish # 4. 发布到 npm(prepack 会自动再跑一次门禁)
73
+ gh workflow run publish.yml -f version=<版本> # 4. 发布(OIDC,在 CI 里跑)
67
74
  git tag v<版本> # 5. 打 tag 并推送
68
75
  git push origin refs/tags/v<版本>
69
76
  npm run pack:dist # 6. 打包 + 建 Release
@@ -87,15 +94,42 @@ Get-FileHash $env:TEMP\check\dsh-chat-embed-<版本>.tgz -Algorithm SHA256
87
94
 
88
95
  0.6.5 及之前的版本是「tag → Release → publish」,与上面的顺序相反。已发布的历史无法回溯修正,从下一个版本起按新顺序执行。
89
96
 
90
- ## trusted publishing(未启用)
97
+ ## 发布凭证:OIDC Trusted Publishing
98
+
99
+ 发布走 `.github/workflows/publish.yml`,用 **OIDC** 换取一次性的短期凭证。**仓库里、本机上都没有 npm 令牌可偷。**
100
+
101
+ ### 在 npm 侧登记(一次性,只有包所有者能做)
102
+
103
+ 1. npm 包设置页 → **Trusted Publisher** → 选 **GitHub Actions**;
104
+ 2. 填三个字段:
105
+ - Organization or user:`poluce`
106
+ - Repository:`dsh-chat-embed`
107
+ - Workflow filename:`publish.yml`(**只填文件名,含扩展名,且必须与仓库里的一致**)
108
+ 3. Environment 留空(这个 workflow 没有用 GitHub Environment);
109
+ 4. 保存后在 **2 天内完成首次成功发布**,否则这条配置过期作废。
110
+
111
+ ### CI 侧的要求(已在 workflow 里落实)
112
+
113
+ - job 带 `id-token: write`;
114
+ - 运行器是 GitHub-hosted(自托管不支持 OIDC);
115
+ - npm ≥ 11.5.1(workflow 里固定装 `npm@11.15.0`);
116
+ - **不设置** `NODE_AUTH_TOKEN` / `NPM_TOKEN`,残留令牌会干扰认证;
117
+ - `actions/setup-node` 刻意不传 `registry-url`,否则它会在 `.npmrc` 里写一行空的 `_authToken`。
118
+
119
+ ### 为什么比令牌强
120
+
121
+ | | Granular token(旧) | OIDC(现在) |
122
+ | --- | --- | --- |
123
+ | 存在形态 | 40 字符静态串,存在 `~/.npmrc` | 每次运行现签,几分钟后失效 |
124
+ | 泄露后果 | 任何拿到的人在任何机器上都能发包 | 离开那次运行即无效 |
125
+ | 绑定 | 无 | 仓库 + workflow 文件名 + 分支 |
126
+ | provenance | 无 | 自动附带,用户可 `npm audit signatures` 验证 |
91
127
 
92
- 目前用 `~/.npmrc` 里的 Granular token 发布(绕过 2FA),包上没有 provenance。切 OIDC 需要:
128
+ ### 迁移后可以做的收尾
93
129
 
94
- 1. npm 包设置页 → Trusted Publisher → GitHub Actions,填 owner `poluce`、repo `dsh-chat-embed`、workflow 文件名;
95
- 2. 该配置**必须在 2 天内完成首次成功发布**,否则过期;
96
- 3. 需要 workflow 带 `id-token: write`、GitHub-hosted runner、npm CLI ≥ 11.5.1、Node ≥ 22.14.0(`engines` 已收紧)。
130
+ 迁移验证通过后,去 npm 网页撤销那个 Bypass 2FA 的 Granular token,并把包设置收紧为"仅 Trusted Publishing"。这样即使旧 token 曾泄露也不再有价值。
97
131
 
98
- 提交历史正常累积之后,provenance 里的 commit SHA 会长期可达,npm 页面上的"source commit"链接不会失效。
132
+ 提交历史正常累积之后,provenance 里的 commit SHA 长期可达,npm 页面上"source commit"链接不会失效。
99
133
 
100
134
  ## 当前发布物
101
135
 
@@ -103,8 +137,8 @@ Get-FileHash $env:TEMP\check\dsh-chat-embed-<版本>.tgz -Algorithm SHA256
103
137
  | --- | --- |
104
138
  | 仓库 | <https://github.com/poluce/dsh-chat-embed> |
105
139
  | Release | <https://github.com/poluce/dsh-chat-embed/releases> |
106
- | 分发包 | `dsh-chat-embed-0.6.8.tgz`(16 个文件,约 70 kB) |
107
- | npm | `dsh-chat-embed@0.6.8`(<https://www.npmjs.com/package/dsh-chat-embed>,维护者 `poluce_auto`) |
140
+ | 分发包 | `dsh-chat-embed-0.6.9.tgz`(16 个文件,约 70 kB) |
141
+ | npm | `dsh-chat-embed@0.6.9`(<https://www.npmjs.com/package/dsh-chat-embed>,维护者 `poluce_auto`) |
108
142
  | 商店图标 | `assets/icon-180.png`(180×180 PNG) |
109
143
  | 商店截图 | `assets/screenshots/` + 仓库根 `screenshots.json`(6 张) |
110
144
 
@@ -123,7 +157,7 @@ dsh plugin --profile desktop add git+https://github.com/poluce/dsh-chat-embed.gi
123
157
 
124
158
  1. 注册账号并完成邮箱验证:<https://www.npmjs.com/signup>;
125
159
  2. 本机登录:`npm login`(浏览器确认或一次性密码;开了 2FA 输入验证码);
126
- 3. 发布:`npm publish`(`prepack` 自动跑门禁;包名 `dsh-chat-embed` 已发布 `0.6.8`);
160
+ 3. 发布:`npm publish`(`prepack` 自动跑门禁;包名 `dsh-chat-embed` 已发布 `0.6.9`);
127
161
  4. 使用者随后只需:`dsh plugin --profile desktop add dsh-chat-embed`。
128
162
 
129
163
  ## 发布前后检查项
@@ -134,8 +168,8 @@ dsh plugin --profile desktop add git+https://github.com/poluce/dsh-chat-embed.gi
134
168
  - 发布后用一份干净 profile 验证:`dsh plugin --profile <新名字> add <包名>`,然后打开左栏入口;
135
169
  - 可选壳补丁(跨重启免登录)不是安装必需项;不装补丁时功能完整,只是重启后要重新登录;
136
170
  - npm 首次发布新包时会出现 `0.0.0-stage` 占位版本(staged publishing 机制),审核/发布完成后 `latest` 指向正式版本;占位版本可忽略;
137
- - 账号 2FA 使用通行密钥(passkey),CLI 发布需要交互式终端完成 WebAuthn,或在 npm 网页创建 **Bypass 2FA 的 Granular Token** 后用 `npm publish --//registry.npmjs.org/:_authToken=<token>`;
138
- - 带 Bypass 2FA 的直接发布能力 npm 计划 2027 年 1 月收紧,届时改用 trusted publishing 或 staged 流程。
171
+ - 发布凭证走 OIDC,本机不需要任何 npm 令牌(见上文「发布凭证」);本地 `npm publish` 已不再使用;
172
+ - 若临时需要兜底,只能在 npm 网页创建 Bypass 2FA 的 Granular token,用完立刻撤销——npm 计划 2027 年 1 月收紧该能力。
139
173
 
140
174
  ## 提交到插件列表(awesome-dsh-plugin)
141
175
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-chat-embed",
3
- "version": "0.6.8",
3
+ "version": "0.6.9",
4
4
  "author": "poluce <fishsummer@126.com>",
5
5
  "description": "Multi-tab AI chat embed for the DeepSeek Harness desktop app: DeepSeek, 豆包, ChatGPT, MiniMax, Kimi, Gemini and Grok, each signed in separately.",
6
6
  "type": "module",