dsh-plugin-dingtalk-bridge 0.3.6 → 0.3.7

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/client.js CHANGED
@@ -24,7 +24,7 @@ window.__ModuleLoader__.load({
24
24
  const POLL_MS = 5000
25
25
  const SOFT_POLL_MS = 30000
26
26
  // 与 package.json 的 version 保持一致:宿主上报的 build 前缀对不上,说明 DSH 还在跑旧宿主代码。
27
- const CLIENT_BUILD = '0.3.6'
27
+ const CLIENT_BUILD = '0.3.7'
28
28
  // 源码仓库(GitHub):Star 与 Issue 入口都指向这里
29
29
  const REPO_URL = 'https://github.com/gcggcg/dsh-plugin-dingtalk-bridge'
30
30
  const ISSUES_URL = `${REPO_URL}/issues`
@@ -1349,6 +1349,7 @@ dws 版本 1.0.68
1349
1349
  - npm 12 默认会拦掉依赖的 `postinstall`,插件会在装完后手动跑一次包内的 `install.js`(`DWS_NO_SKILLS=1`),再用 `npm root -g` 找到 `vendor/dws.exe` 并自动把 `dwsPath` 指过去。
1350
1350
  - 「检查更新」只发一次 `GET <registry>/dingtalk-workspace-cli/latest`(10 秒超时),不下载任何东西。
1351
1351
  - 想换国内镜像:配置项 `dwsRegistry` 改成 `https://registry.npmmirror.com/`。
1352
+ - 安装成功后插件会把 `vendor/dws.exe` 的绝对路径写进 `state.json`,**重启后自动沿用**(前提是你没有在配置里显式指定 `dwsPath`),所以即使 npm 全局目录不在 PATH 里也能一直用。
1352
1353
 
1353
1354
  ### 10.1 顶部显示「dws 未就绪」
1354
1355
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-dingtalk-bridge",
3
- "version": "0.3.6",
3
+ "version": "0.3.7",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "钉钉私信 / 群 @ 消息实时接收、按发送人记录来源、AI 建议回复与自动回复插件",
@@ -1,4 +1,5 @@
1
1
  import { readFile, writeFile, rename, mkdir, unlink, appendFile } from 'node:fs/promises'
2
+ import { existsSync } from 'node:fs'
2
3
  import { homedir } from 'node:os'
3
4
  import { join, dirname } from 'node:path'
4
5
  import { randomUUID } from 'node:crypto'
@@ -19,7 +20,7 @@ import { buildSuggestPrompt, generateSuggestion, formatClock } from './suggest.j
19
20
 
20
21
  export const ROUTE_PREFIX = '/api/dingtalk-bridge'
21
22
  /** 每次改动宿主行为就换个标记:界面与 http-debug.log 都会带上,用来确认「跑的是新代码」。 */
22
- export const HOST_BUILD = '0.3.6-20261117T1415'
23
+ export const HOST_BUILD = '0.3.7-20261117T1445'
23
24
 
24
25
  /** 私信(单聊)全部消息。 */
25
26
  const O2O_KEY = 'user_im_message_receive_o2o_all'
@@ -2542,6 +2543,13 @@ export class DingTalkBridgeService {
2542
2543
  if (typeof payload.windowMessages === 'number' && payload.windowMessages >= 2 && payload.windowMessages <= 20) {
2543
2544
  this.config.windowMessages = Math.round(payload.windowMessages)
2544
2545
  }
2546
+ // 上次自动安装记下的 dws 路径:只在用户没显式配置(仍为默认 'dws')时采用,
2547
+ // 并且必须真的存在,否则继续用 PATH 里的 dws。
2548
+ if (typeof payload.dwsPath === 'string' && payload.dwsPath.trim() !== '') {
2549
+ const saved = payload.dwsPath.trim()
2550
+ const configured = this.config.dwsPath
2551
+ if ((configured === 'dws' || configured === '') && existsSync(saved)) this.config.dwsPath = saved
2552
+ }
2545
2553
  // 恢复每个来源的滑动窗口;老存档没有这一段,就等新消息进来再重建。
2546
2554
  this.restoreWindows(payload.windows)
2547
2555
  }
@@ -2558,6 +2566,9 @@ export class DingTalkBridgeService {
2558
2566
  autoReplyAt: Number(this.state.autoReplyAt) || 0,
2559
2567
  minConfidence: this.config.minConfidence,
2560
2568
  windowMessages: this.config.windowMessages,
2569
+ // 自动安装后 dwsPath 会指向 npm 全局包里的 vendor 可执行文件;记下来,
2570
+ // 否则重启后 PATH 里没有 dws 又会退回「未安装」。
2571
+ dwsPath: this.config.dwsPath,
2561
2572
  selfName: this.state.selfName,
2562
2573
  titles: Object.fromEntries([...this.titleCache.entries()].filter(([, value]) => value !== '')),
2563
2574
  messages: this.state.messages.slice(0, this.config.maxInbox),