@michengai/dsh-im-connect 1.0.11 → 1.0.13

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.
Files changed (62) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/CHANGELOG.zh-CN.md +15 -0
  3. package/README.md +28 -3
  4. package/README.zh-CN.md +28 -3
  5. package/client.js +438 -17
  6. package/lib/api-base.d.ts +21 -0
  7. package/lib/api-base.d.ts.map +1 -0
  8. package/lib/api-base.js +51 -0
  9. package/lib/api-base.js.map +1 -0
  10. package/lib/channels/channel-image-download.d.ts +8 -5
  11. package/lib/channels/channel-image-download.d.ts.map +1 -1
  12. package/lib/channels/channel-image-download.js +70 -2
  13. package/lib/channels/channel-image-download.js.map +1 -1
  14. package/lib/channels/diagnostics.d.ts +1 -1
  15. package/lib/channels/diagnostics.d.ts.map +1 -1
  16. package/lib/channels/diagnostics.js +2 -2
  17. package/lib/channels/diagnostics.js.map +1 -1
  18. package/lib/channels/discord.d.ts +3 -0
  19. package/lib/channels/discord.d.ts.map +1 -1
  20. package/lib/channels/discord.js +56 -7
  21. package/lib/channels/discord.js.map +1 -1
  22. package/lib/channels/factory.d.ts.map +1 -1
  23. package/lib/channels/factory.js +8 -2
  24. package/lib/channels/factory.js.map +1 -1
  25. package/lib/channels/file-send.d.ts +1 -1
  26. package/lib/channels/file-send.d.ts.map +1 -1
  27. package/lib/channels/file-send.js +2 -2
  28. package/lib/channels/file-send.js.map +1 -1
  29. package/lib/channels/meta.d.ts +2 -0
  30. package/lib/channels/meta.d.ts.map +1 -1
  31. package/lib/channels/meta.js +2 -0
  32. package/lib/channels/meta.js.map +1 -1
  33. package/lib/channels/telegram.d.ts +2 -0
  34. package/lib/channels/telegram.d.ts.map +1 -1
  35. package/lib/channels/telegram.js +29 -6
  36. package/lib/channels/telegram.js.map +1 -1
  37. package/lib/client.js +523 -21
  38. package/lib/index.d.ts +2 -0
  39. package/lib/index.d.ts.map +1 -1
  40. package/lib/index.js +10 -6
  41. package/lib/index.js.map +1 -1
  42. package/lib/manager.d.ts +15 -0
  43. package/lib/manager.d.ts.map +1 -1
  44. package/lib/manager.js +221 -32
  45. package/lib/manager.js.map +1 -1
  46. package/lib/plugin-updater.d.ts +1 -0
  47. package/lib/plugin-updater.d.ts.map +1 -1
  48. package/lib/plugin-updater.js +7 -0
  49. package/lib/plugin-updater.js.map +1 -1
  50. package/package.json +5 -4
  51. package/src/api-base.ts +45 -0
  52. package/src/channels/channel-image-download.ts +83 -5
  53. package/src/channels/diagnostics.ts +2 -2
  54. package/src/channels/discord.ts +49 -7
  55. package/src/channels/factory.ts +8 -2
  56. package/src/channels/file-send.ts +2 -2
  57. package/src/channels/meta.ts +4 -0
  58. package/src/channels/telegram.ts +22 -6
  59. package/src/index.ts +12 -6
  60. package/src/manager.ts +214 -31
  61. package/src/plugin-update-ui.js +36 -5
  62. package/src/plugin-updater.ts +8 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.13 - 2026-10-23
4
+
5
+ - Add an optional IM Assistant sidebar entry that opens the full management panel in a centered workspace view, while retaining the existing Settings entry.
6
+ - Add persistent sidebar-entry and online-update switches to the plugin details page. Disabling updates hides both the update button and version badge; re-enabling refreshes version information even after starting with updates disabled. Host-level update locks remain authoritative and are shown as a disabled switch.
7
+ - Fix management and update requests losing the deployment prefix when DSH is accessed through a path-prefixed reverse proxy.
8
+ - Restore workspace creation and the host's model, permission, and preset labels in the sidebar management panel. Failed or unavailable workspace creation now reports an error instead of selecting an unregistered path.
9
+ - Prevent sidebar search requests from reopening a collapsed sidebar, and clarify how UI preferences and host update locks are stored and applied.
10
+
11
+ ## 1.0.12 - 2026-10-21
12
+
13
+ - Support per-account outbound proxy configuration for Telegram and Discord: choose between following host proxy (default), connecting directly, or configuring custom HTTP/HTTPS proxies.
14
+ - Route all Telegram and Discord outbound traffic through the configured proxy, including REST APIs, Telegram long polling, Discord Gateway WebSocket connections, file transfers, connection diagnostics, and inbound media/attachment downloads.
15
+ - Display proxy addresses as standard text fields with reflection and draft retention while keeping credentials securely stored in the local vault, and avoid unnecessary channel restarts when editing unrelated account settings.
16
+ - Improve Discord Gateway reconnection resilience: dynamically recreate closed dispatchers on reconnect, and automatically clear expired session cursors to fall back to a fresh Identify immediately when receiving Opcode 9 (`Invalid Session`).
17
+
3
18
  ## 1.0.11 - 2026-10-21
4
19
 
5
20
  - Fix Feishu and Lark replies failing to fall back to plain text when a card is rejected with HTTP 400, such as a reply containing a local inline image. The fallback preserves the full text, image description, and path; it does not upload or render the local image.
@@ -4,6 +4,21 @@
4
4
 
5
5
  以下记录近期发布的版本。Git 标签与 GitHub Release 现已和这些条目同步;历史条目继续保留原始发布提交链接。
6
6
 
7
+ ## 1.0.13 - 2026-10-23
8
+
9
+ - 新增可选的「IM助理」侧边栏入口,在主工作区以居中版心打开完整管理面板,同时保留原有设置入口。
10
+ - 插件详情页新增侧边栏入口与在线更新开关,选择会持久保存;关闭更新时同步隐藏检查更新按钮和版本提示,即使启动时已关闭,重新开启后也会读取并恢复版本提示;宿主锁定更新时开关置灰且不可解除锁定。
11
+ - 修复通过带路径前缀的反向代理访问 DSH 时,管理和更新请求丢失部署前缀的问题。
12
+ - 补齐侧栏管理面板的工作区创建能力及宿主模型、权限和预设文案;创建能力不可用或创建失败时明确报错,不再把未登记路径误选为创建成功。
13
+ - 修复侧栏收起后被搜索请求意外重新展开的问题,并说明界面偏好与宿主更新锁定的保存位置和生效优先级。
14
+
15
+ ## 1.0.12 - 2026-10-21
16
+
17
+ - 支持 Telegram 与 Discord 按账号独立配置出站代理:可在账号设置中选择跟随宿主(默认)、直连或手动配置 HTTP/HTTPS 代理。
18
+ - 覆盖全链路出站代理分流:包含 REST Web API、Telegram 长轮询、Discord Gateway WebSocket 连接与重连、文件发送、连接诊断以及入站图片和附件下载。
19
+ - 代理输入框使用标准文本框并支持地址反显与草稿保留,底层统一安全存储于本地凭据库;修改无关设置时避免触发通道不必要的重启。
20
+ - 优化 Discord Gateway 重连韧性:在重连时动态恢复存活的 Dispatcher 连接池;当服务端旧会话游标失效(收到 Opcode 9)时自动清空游标并立即回退到全新 Identify 握手,消除通道卡在重连中的问题。
21
+
7
22
  ## 1.0.11 - 2026-10-21
8
23
 
9
24
  - 修复飞书和 Lark 回复卡片因本地内联图片等内容被平台以 HTTP 400 拒绝时,未尝试纯文本回退的问题。回退保留完整正文、图片说明和路径,不会自动上传或渲染本地图片。
package/README.md CHANGED
@@ -205,6 +205,7 @@ For a desktop workbench, download [DSH Codex Desktop](https://github.com/Micheng
205
205
  - Examples use the `web` profile; replace it with the target profile.
206
206
  - Source installation and development require Node.js 22+. npm installation does not require running `npm install` in an arbitrary directory.
207
207
  - After install, restart `dsh web` and hard-refresh the browser before opening **Settings → IM Assistant**.
208
+ - **Reverse proxy deployment**: Supports hosting DSH behind prefix-stripping reverse proxies (e.g. `/app/dsh/`). API and update endpoints automatically resolve against the page base URI (`document.baseURI`), preventing 404 errors caused by lost prefix segments.
208
209
 
209
210
  ## Installation
210
211
 
@@ -233,9 +234,33 @@ To pin a release, replace `@latest` with a version such as `@0.1.28`.
233
234
 
234
235
  The configuration output should contain `im-connect`. Restart DSH Web and hard-refresh the browser. Do not copy client files manually: `dsh plugin add` also applies `cordis.patch.yml`.
235
236
 
236
- ## Updates
237
-
238
- The settings title shows the installed version and a **Check for updates** button. When a newer release is available, **Update automatically** runs only when the DSH CLI or Desktop update service is available; otherwise, the dialog provides a profile-specific manual command to copy and run.
237
+ ## Plugin Configuration & Toggles
238
+
239
+ The plugin follows standard DSH bundle configuration conventions. Options are located at:
240
+ > **Sidebar → Plugins → Click `@michengai/dsh-im-connect`** (the host's `plugins.bundle.config` slot).
241
+
242
+ Two native switches are available. Their values are persisted in `channels.json` under the plugin's `stateDir` and survive restarts; they are not two equivalent Cordis YAML options. `sidebarEntry` is managed through this UI, while `onlineUpdate` is also subject to the host lock described below:
243
+
244
+ ### 1. Sidebar Entry (`sidebarEntry`)
245
+ - **Default**: Disabled (`false`)
246
+ - **Description**: Displays a persistent **IM Connect** navigation icon in the host's left primary sidebar.
247
+ - **Effect**:
248
+ - When enabled, clicking the sidebar icon opens the IM Assistant management page directly in the primary workspace with a **960px centered container** (matching host plugin manager conventions). This eliminates vertical scrolling constraints in narrow settings dialogs;
249
+ - When disabled, unregisters the sidebar entry cleanly (and resets active panel gracefully if currently viewing the panel, preventing blank views);
250
+ - The standard **Settings → IM Assistant** view remains active either way, and state is synchronized live across both entry points.
251
+
252
+ ### 2. Online Updates (`onlineUpdate` / `updater`)
253
+ - **Default**: Enabled (`true`)
254
+ - **Description**: Controls whether the plugin checks for and installs updates from npm.
255
+ - **Effect**:
256
+ - **Dynamic UI Sync**: Disabling the toggle hides the **Check for updates** button and version badge in the header immediately without requiring a full page reload;
257
+ - **Endpoint Guard**: When disabled, the update API route returns `HTTP 403` for all check and install requests, preventing unreviewed updates;
258
+ - **Host / Platform Lock**: For curated plugin indexes (such as VibeDev) or restricted enterprise environments, this can be locked directly via Cordis configuration (bundle patch) without needing UI interaction:
259
+ ```yaml
260
+ updater: false # or onlineUpdate: false
261
+ ```
262
+ Once configured, the updater is disabled at startup, the update action stays hidden, and the online-update switch is disabled. The host lock takes precedence over the user's choice in `channels.json` and cannot be lifted through the UI. Removing the host lock restores the saved user preference.
263
+ - **Update Modes**: When a newer release is available, **Update automatically** runs only when the DSH CLI or Desktop update service is available; otherwise, the dialog provides a profile-specific manual command to copy and run.
239
264
 
240
265
  ## Usage
241
266
 
package/README.zh-CN.md CHANGED
@@ -205,6 +205,7 @@ IM 消息发起的处理结束后,会在正文和文件投递完成后给出
205
205
  - 以下示例使用 `web` profile;请替换为实际目标 profile。
206
206
  - 从源码安装或二次开发需要 Node.js 22+;仅从 npm 安装无需在任意目录执行 `npm install`。
207
207
  - 安装后必须重启 `dsh web`,并在浏览器硬刷新,才能看到「设置 → IM助理」。
208
+ - **反向代理部署**:支持将 DSH 部署在带路径前缀的反向代理后面(如 `/app/dsh/`),插件 API 与更新检查端点统一自动按页面基址(`document.baseURI`)相对解析,避免丢失代理路径前缀导致 404。
208
209
 
209
210
  ## 安装
210
211
 
@@ -233,9 +234,33 @@ dsh --profile web --dump-config
233
234
 
234
235
  配置输出中应包含 `im-connect`。安装后重启 DSH Web 并在浏览器硬刷新。不要手工复制客户端文件,`dsh plugin add` 会同时应用 `cordis.patch.yml`。
235
236
 
236
- ## 在线更新
237
-
238
- 设置标题会显示当前版本和“检查更新”按钮。发现新版后,只有检测到 DSH CLI 或 Desktop 更新服务时才可使用“自动更新”;其他环境会在弹窗中提供可复制、与当前 Profile 对应的手工更新命令。
237
+ ## 插件配置与可选开关
238
+
239
+ 插件遵循 DSH 官方扩展配置规范,配置项位于:
240
+ > **主界面侧边栏「插件」→ 点击 `@michengai/dsh-im-connect` 详情页**(对应宿主 `plugins.bundle.config` 槽位)。
241
+
242
+ 此处提供两个原生扁平行开关。界面开关值保存在插件 `stateDir` 下的 `channels.json` 中,重启后保留;它们不是两个等价的 Cordis YAML 配置项。`sidebarEntry` 只通过此界面管理,`onlineUpdate` 另受下述宿主锁定规则约束:
243
+
244
+ ### 1. 侧边栏入口 (`sidebarEntry`)
245
+ - **默认状态**:关闭(`false`)
246
+ - **功能说明**:在宿主左侧主导航栏增加常驻的 **「即时通讯」** 图标入口。
247
+ - **生效效果**:
248
+ - 开启后,在侧边栏点击即可直达 IM 助理中心,并在主工作区以 **960px 居中版心**(对齐官方插件管理与市场规范)展开完整大面板,彻底告别在设置弹窗狭窄视口内滚动的局限;
249
+ - 关闭后安全注销侧栏槽位(若当前正停留在 IM 面板,会自动安全切回默认视图,防止悬空和白屏);
250
+ - 无论是否开启侧栏入口,DSH 原有的「设置 → IM助理」入口始终保留,两处界面数据与状态 100% 实时同步。
251
+
252
+ ### 2. 在线更新 (`onlineUpdate` / `updater`)
253
+ - **默认状态**:开启(`true`)
254
+ - **功能说明**:控制是否允许在线检查并安装 IM 连接器的新版本。
255
+ - **生效效果**:
256
+ - **界面联动**:关闭开关后,IM 管理面板标题旁的「检查更新」按钮与版本提示将即时隐藏,无需刷新页面;开启后自动恢复展示;
257
+ - **接口安全拦截**:关闭后,服务端的更新路由对任何版本检查和安装请求均返回 `HTTP 403` 禁用状态,彻底杜绝在插件内安装未审核版本;
258
+ - **宿主/平台级锁定**:面向精选插件索引(如 VibeDev)或企业安全合规环境,支持直接在 Cordis 配置文件(bundle patch)中声明,无需进入界面手动配置:
259
+ ```yaml
260
+ updater: false # 或 onlineUpdate: false
261
+ ```
262
+ 配置生效后,更新器在启动时即被禁用,更新入口隐藏,详情页在线更新开关置灰。宿主锁定优先于 `channels.json` 中的用户选择,界面不能解除锁定;宿主移除锁定后,重新按已保存的用户选择生效。
263
+ - **更新模式**:发现新版后,只有检测到 DSH CLI 或 Desktop 更新服务时才可使用“自动更新”;其他环境会在弹窗中提供可复制、与当前 Profile 对应的手工更新命令。
239
264
 
240
265
  ## 使用
241
266