@michengai/dsh-im-connect 0.1.34 → 0.1.37
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/CHANGELOG.md +16 -1
- package/CHANGELOG.zh-CN.md +16 -1
- package/README.en.md +4 -0
- package/README.md +4 -0
- package/client.js +40 -5
- package/lib/client.js +334 -5
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +6 -0
- package/lib/index.js.map +1 -1
- package/lib/plugin-updater.d.ts +22 -0
- package/lib/plugin-updater.d.ts.map +1 -0
- package/lib/plugin-updater.js +277 -0
- package/lib/plugin-updater.js.map +1 -0
- package/package.json +5 -2
- package/src/index.ts +6 -0
- package/src/plugin-update-ui.js +293 -0
- package/src/plugin-updater.ts +259 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,9 +4,24 @@
|
|
|
4
4
|
|
|
5
5
|
The five most recent published versions are listed below. Git tags and GitHub Releases now mirror these entries; historical sections retain links to their original release commits.
|
|
6
6
|
|
|
7
|
+
## Unreleased
|
|
8
|
+
|
|
9
|
+
## 0.1.37 - 2026-09-07
|
|
10
|
+
|
|
11
|
+
- Withdraw the unfinished proactive delivery feature, including account delivery settings, `im-send`, Agent tools, and delivery HTTP endpoints. Existing IM replies and plugin update controls are retained.
|
|
12
|
+
|
|
13
|
+
## 0.1.36 - 2026-09-07
|
|
14
|
+
|
|
15
|
+
- Aligned the DSH webserver peer and development dependency at `0.1.2-rc.1` so CI can resolve the package dependency graph.
|
|
16
|
+
|
|
17
|
+
## 0.1.35 - 2026-09-07
|
|
18
|
+
|
|
19
|
+
- Added independent in-product update checks with automatic updates when a verified DSH update service is available and a profile-specific manual fallback otherwise.
|
|
20
|
+
- Removed the update-button dependency on `react-dom/client` so the client can load on Hosts that do not register that module id.
|
|
21
|
+
|
|
7
22
|
## 0.1.34 — 2026-09-03
|
|
8
23
|
|
|
9
|
-
-
|
|
24
|
+
- Added compatibility with DeepSeek Harness `0.1.2-rc.1`.
|
|
10
25
|
|
|
11
26
|
## 0.1.33 — 2026-09-03
|
|
12
27
|
|
package/CHANGELOG.zh-CN.md
CHANGED
|
@@ -4,9 +4,24 @@
|
|
|
4
4
|
|
|
5
5
|
以下记录最近发布的五个版本。Git 标签与 GitHub Release 现已和这些条目同步;历史条目继续保留原始发布提交链接。
|
|
6
6
|
|
|
7
|
+
## 未发布
|
|
8
|
+
|
|
9
|
+
## 0.1.37 - 2026-09-07
|
|
10
|
+
|
|
11
|
+
- 撤回尚未开发完成的主动投递功能,包括账号投递设置、`im-send`、Agent 工具及投递 HTTP 接口;保留原有 IM 对话回复和插件更新功能。
|
|
12
|
+
|
|
13
|
+
## 0.1.36 - 2026-09-07
|
|
14
|
+
|
|
15
|
+
- 将 DSH Webserver 的 peer 与开发依赖统一为 `0.1.2-rc.1`,使 CI 能够解析该包的依赖图。
|
|
16
|
+
|
|
17
|
+
## 0.1.35 - 2026-09-07
|
|
18
|
+
|
|
19
|
+
- 新增独立的插件内检查更新能力:仅在已验证的 DSH 更新服务可用时自动更新,其余环境提供与 Profile 对应的手工更新命令。
|
|
20
|
+
- 更新按钮图标不再依赖 `react-dom/client`,避免宿主未注册该模块 id 时客户端无法加载。
|
|
21
|
+
|
|
7
22
|
## 0.1.34 — 2026-09-03
|
|
8
23
|
|
|
9
|
-
-
|
|
24
|
+
- 支持 DeepSeek Harness `0.1.2-rc.1`。
|
|
10
25
|
|
|
11
26
|
## 0.1.33 — 2026-09-03
|
|
12
27
|
|
package/README.en.md
CHANGED
|
@@ -186,6 +186,10 @@ dsh --profile web --dump-config
|
|
|
186
186
|
|
|
187
187
|
Restart DSH Web and hard-refresh the browser. `dsh plugin ... add .` reads the package metadata and `cordis.patch.yml`; do not install by copying `lib` directly.
|
|
188
188
|
|
|
189
|
+
## Updates
|
|
190
|
+
|
|
191
|
+
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.
|
|
192
|
+
|
|
189
193
|
## Usage
|
|
190
194
|
|
|
191
195
|
Open **Settings → IM Assistant**, select **Add account** under the target channel, then choose that account's workspace, model, permission, and private-access mode. The full guide is [Usage guide](docs/02-产品与业务/04-使用说明.md).
|
package/README.md
CHANGED
|
@@ -186,6 +186,10 @@ dsh --profile web --dump-config
|
|
|
186
186
|
|
|
187
187
|
完成后重启 DSH Web 并硬刷新浏览器。`dsh plugin ... add .` 会读取当前目录的包信息和 `cordis.patch.yml`;不要改为直接复制 `lib` 目录。
|
|
188
188
|
|
|
189
|
+
## 在线更新
|
|
190
|
+
|
|
191
|
+
设置标题会显示当前版本和“检查更新”按钮。发现新版后,只有检测到 DSH CLI 或 Desktop 更新服务时才可使用“自动更新”;其他环境会在弹窗中提供可复制、与当前 Profile 对应的手工更新命令。
|
|
192
|
+
|
|
189
193
|
## 使用
|
|
190
194
|
|
|
191
195
|
打开「设置 → IM助理」,在目标渠道点击「添加账号」,并为该账号选择工作区、模型、权限和私聊准入。详细步骤见 [使用说明](docs/02-产品与业务/04-使用说明.md)。
|
package/client.js
CHANGED
|
@@ -9,16 +9,42 @@ window.__ModuleLoader__.load({
|
|
|
9
9
|
const React = require("react");
|
|
10
10
|
const { useState, useEffect, useLayoutEffect, useCallback, useRef, useSyncExternalStore } = React;
|
|
11
11
|
const ReactDOM = require("react-dom");
|
|
12
|
-
const { RiskConfirmation, IconListPenOutline16 } = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
12
|
+
const { RiskConfirmation, IconListPenOutline16, IconRefreshOutline16, IconDownloadOutline16, IconCopyOutline16, IconCloseOutline16 } = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
13
13
|
const EMPTY_EXTRA_TABS = [];
|
|
14
14
|
const inject = ["slots", "sessions", "workspaces", "locale"];
|
|
15
15
|
const API_BASE = "/dsh-im-connect/api";
|
|
16
16
|
const TAB_KEY = "dsh-im-connect.sidebar-tab";
|
|
17
17
|
const ACCOUNT_SELECTION_KEY = "dsh-im-connect.settings.selected-account";
|
|
18
18
|
const IM_LOCALE_NS = "im-connect";
|
|
19
|
+
const UPDATE_ICON_PATHS = {
|
|
20
|
+
refresh: ["M13.5 5.5V2.5m0 0h-3m3 0-2.1 2.1A5.5 5.5 0 1 0 13.2 12"],
|
|
21
|
+
download: ["M8 2v8m0 0 3-3m-3 3-3-3M3 13v2h10v-2"],
|
|
22
|
+
copy: ["M5 5h8v8H5z", "M3 3h8"],
|
|
23
|
+
close: ["m4 4 8 8M12 4 4 12"],
|
|
24
|
+
};
|
|
25
|
+
function createPluginUpdateIcon(name) {
|
|
26
|
+
const element = document.createElement("span");
|
|
27
|
+
const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
28
|
+
svg.setAttribute("viewBox", "0 0 16 16");
|
|
29
|
+
svg.setAttribute("width", "16");
|
|
30
|
+
svg.setAttribute("height", "16");
|
|
31
|
+
svg.setAttribute("fill", "none");
|
|
32
|
+
svg.setAttribute("stroke", "currentColor");
|
|
33
|
+
svg.setAttribute("stroke-width", "1.5");
|
|
34
|
+
svg.setAttribute("stroke-linecap", "round");
|
|
35
|
+
svg.setAttribute("stroke-linejoin", "round");
|
|
36
|
+
svg.setAttribute("aria-hidden", "true");
|
|
37
|
+
UPDATE_ICON_PATHS[name].forEach((d) => {
|
|
38
|
+
const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
39
|
+
path.setAttribute("d", d);
|
|
40
|
+
svg.append(path);
|
|
41
|
+
});
|
|
42
|
+
element.append(svg);
|
|
43
|
+
return element;
|
|
44
|
+
}
|
|
19
45
|
const IM_LOCALES = {
|
|
20
46
|
zh: {
|
|
21
|
-
"settings.label": "IM助理", "settings.title": "IM
|
|
47
|
+
"settings.label": "IM助理", "settings.title": "IM助理", "settings.description": "管理各渠道账号。每个账号独立选择工作区、模型和权限,配置仅保存在本机。", "settings.viewProject": "GitHub", "settings.feedback": "问题反馈",
|
|
22
48
|
"settings.aria": "IM助理", "settings.selectAccountTitle": "选择一个账号", "settings.selectAccountDescription": "从左侧选择账号,查看并修改工作区、模型和权限配置。", "settings.noAccountsTitle": "还没有接入账号", "settings.noAccountsDescription": "请在左侧选择对应渠道,然后点击“添加账号”。", "settings.publicChatNotice": "未批准用户可以发起聊天,但不能批准工具调用。", "pending.notice": "有访问请求。批准后该用户才能驱动本机助手。", "action.approve": "批准", "action.deny": "拒绝", "loading": "加载中…",
|
|
23
49
|
"account.workspace": "工作区", "account.currentWorkspace": "当前工作区", "account.selectWorkspace": "请选择工作区", "account.selectModel": "请选择模型", "account.selectPermission": "请选择权限", "account.privateAccess": "私聊准入", "account.privateApproved": "仅已批准用户", "account.privateAll": "允许所有私聊用户", "account.autoNameNote": "绑定成功后会自动生成账号名,无需手动填写。", "account.defaultName": "{channel}账号 {count}",
|
|
24
50
|
"account.countZero": "0 个账号", "account.countOnline": "{online} / {total} 在线", "account.countOffline": "{total} / {total} 离线", "account.statusProcessing": "处理中…", "account.statusOnline": "在线", "account.statusOffline": "离线", "account.statusRunning": "运行正常", "account.statusNotConnected": "未连接", "account.receive": "接收消息", "account.receiveDescription": "关闭后保留账号配置,但不接收新消息", "account.removeConfirm": "确定移除这个账号?本机保存的配置和凭据将一并删除。",
|
|
@@ -37,7 +63,7 @@ window.__ModuleLoader__.load({
|
|
|
37
63
|
"status.disconnected": "已断开", "status.reconnectFailed": "重连失败", "status.connectingSocket": "连接中", "status.waitHandshake": "等待网关握手", "status.authenticating": "鉴权中", "status.reconnecting": "重连中", "status.connectionError": "连接错误", "status.connectionFailed": "连接失败", "status.streamConnected": "Stream 已连接", "status.stopped": "已停止", "status.longConnection": "长连接已建立", "status.polling": "轮询中", "status.notLoggedIn": "未登录", "status.waitQr": "等待扫码", "status.loggedIn": "已登录", "status.loggedInRecovered": "已登录(自动恢复)", "status.loggingIn": "登录中",
|
|
38
64
|
},
|
|
39
65
|
en: {
|
|
40
|
-
"settings.label": "IM Assistant", "settings.title": "IM
|
|
66
|
+
"settings.label": "IM Assistant", "settings.title": "IM Assistant", "settings.description": "Manage accounts across channels. Each account has its own workspace, model, and permission settings, stored only on this machine.", "settings.viewProject": "GitHub", "settings.feedback": "Issues",
|
|
41
67
|
"settings.aria": "IM Assistant", "settings.selectAccountTitle": "Select an account", "settings.selectAccountDescription": "Choose an account on the left to view and edit its workspace, model, and permissions.", "settings.noAccountsTitle": "No accounts connected", "settings.noAccountsDescription": "Choose a channel on the left, then select Add account.", "settings.publicChatNotice": "Unapproved users can start chats, but they cannot approve tool calls.", "pending.notice": "There are access requests. Approve a user before they can control the local assistant.", "action.approve": "Approve", "action.deny": "Deny", "loading": "Loading…",
|
|
42
68
|
"account.workspace": "Workspace", "account.currentWorkspace": "Current workspace", "account.selectWorkspace": "Select a workspace", "account.selectModel": "Select a model", "account.selectPermission": "Select a permission", "account.privateAccess": "Private chat access", "account.privateApproved": "Approved users only", "account.privateAll": "Allow all DM users", "account.autoNameNote": "The account name is generated automatically after setup.", "account.defaultName": "{channel} account {count}",
|
|
43
69
|
"account.countZero": "0 accounts", "account.countOnline": "{online} / {total} online", "account.countOffline": "{total} / {total} offline", "account.statusProcessing": "Processing…", "account.statusOnline": "Online", "account.statusOffline": "Offline", "account.statusRunning": "Running normally", "account.statusNotConnected": "Not connected", "account.receive": "Receive messages", "account.receiveDescription": "Turn this off to keep the account settings without receiving new messages", "account.removeConfirm": "Remove this account? Its saved settings and credentials will also be deleted.",
|
|
@@ -183,8 +209,8 @@ window.__ModuleLoader__.load({
|
|
|
183
209
|
.ima-ok{color:var(--ima-ok);font-size:14px;text-align:center;padding:24px 0}
|
|
184
210
|
.ima-modal .ima-error{color:var(--ima-danger)}
|
|
185
211
|
.ima-page.ima-account-page{max-width:1120px;padding-bottom:40px}
|
|
186
|
-
.ima-account-shell{display:grid;grid-template-columns:minmax(330px,390px) minmax(360px,1fr);min-height:650px;border:1px solid var(--ima-line);border-radius:16px;overflow:hidden;background:
|
|
187
|
-
.ima-platforms{padding:0;border-right:1px solid var(--ima-line);background:
|
|
212
|
+
.ima-account-shell{display:grid;grid-template-columns:minmax(330px,390px) minmax(360px,1fr);min-height:650px;border:1px solid var(--ima-line);border-radius:16px;overflow:hidden;background:transparent}
|
|
213
|
+
.ima-platforms{padding:0;border-right:1px solid var(--ima-line);background:transparent}
|
|
188
214
|
.ima-platform{border:0;border-bottom:1px solid var(--ima-line);border-radius:0;margin:0;overflow:visible;background:transparent}.ima-platform:last-child{border-bottom:0}.ima-platform.open{background:transparent}
|
|
189
215
|
.ima-platform-head{display:flex;align-items:center;gap:10px;width:100%;min-height:64px;padding:10px 18px;border:0;border-radius:0;background:transparent;color:inherit;text-align:left;cursor:pointer}
|
|
190
216
|
.ima-platform:not(.open):not(.empty) .ima-platform-head:hover{background:var(--ima-card-hover)}.ima-platform.empty .ima-platform-head{cursor:default}.ima-platform-title{min-width:0;flex:1;font-size:14px;font-weight:650}.ima-platform-count{color:var(--ima-muted);font-size:12px;white-space:nowrap}.ima-platform-count.online{color:var(--ima-ok)}.ima-platform-count.offline,.ima-platform-count.partial{color:var(--ima-warning)}
|
|
@@ -2251,6 +2277,15 @@ window.__ModuleLoader__.load({
|
|
|
2251
2277
|
ensureStyle();
|
|
2252
2278
|
ctx.effect(() => ctx.locale.register(IM_LOCALE_NS, IM_LOCALES), "im-connect: dictionaries");
|
|
2253
2279
|
const t = ctx.locale.bind(IM_LOCALE_NS);
|
|
2280
|
+
ctx.effect(() => observePluginUpdate({
|
|
2281
|
+
endpoint: "/api/michengai/dsh-im-connect/update",
|
|
2282
|
+
packageName: "@michengai/dsh-im-connect",
|
|
2283
|
+
titleRowSelector: ".ima-title-row",
|
|
2284
|
+
linksSelector: ".ima-title-links",
|
|
2285
|
+
zhName: t("settings.title"),
|
|
2286
|
+
enName: t("settings.title"),
|
|
2287
|
+
createIcon: createPluginUpdateIcon,
|
|
2288
|
+
}), "im-connect: plugin update ui");
|
|
2254
2289
|
const permissionT = ctx.locale.bind("permission.access");
|
|
2255
2290
|
const modelT = ctx.locale.bind("model");
|
|
2256
2291
|
const subscribeLocale = (listener) => ctx.locale.subscribe(listener);
|
package/lib/client.js
CHANGED
|
@@ -1,3 +1,297 @@
|
|
|
1
|
+
const UPDATE_HEADER = "x-michengai-plugin-update";
|
|
2
|
+
const STYLE_ID = "michengai-plugin-update-ui";
|
|
3
|
+
const CSS = `
|
|
4
|
+
.mpi-version{margin-left:8px;color:var(--dsw-alias-label-tertiary,#9da1aa);font-family:inherit;font-size:12px;font-weight:500;line-height:18px;letter-spacing:0;white-space:nowrap;vertical-align:baseline}.mpi-check{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:28px;padding:0 8px;border:1px solid var(--dsw-alias-border-l2,#4b4d52);border-radius:7px;background:transparent;color:var(--dsw-alias-label-secondary,#b8bbc2);font:inherit;font-size:12px;font-weight:500;line-height:18px;white-space:nowrap;cursor:pointer}.mpi-check:hover{background:var(--dsw-alias-interactive-bg-hover,#3a3b3f);color:var(--dsw-alias-label-primary,#fff)}.mpi-check:focus-visible,.mpi-action:focus-visible,.mpi-dialog-close:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary,#4f8cff);outline-offset:2px}.mpi-icon{display:inline-flex;flex:0 0 auto;width:16px;height:16px;align-items:center;justify-content:center;pointer-events:none}.mpi-icon svg{display:block;width:16px;height:16px}
|
|
5
|
+
.mpi-overlay{position:fixed;inset:0;z-index:2147483647;display:flex;align-items:center;justify-content:center;padding:24px;background:rgba(0,0,0,.62)}.mpi-dialog{position:relative;box-sizing:border-box;width:min(680px,100%);max-height:calc(100vh - 48px);overflow:auto;border:1px solid var(--dsw-alias-border-l2,#4b4d52);border-radius:14px;padding:22px;background:var(--dsw-alias-bg-layer-2,var(--dsw-specific-menu,#202124));color:var(--dsw-alias-label-primary,#fff);box-shadow:var(--dsw-shadow-lv3,0 16px 48px rgba(0,0,0,.24));font-family:inherit}.mpi-head{display:flex;align-items:center;justify-content:space-between;gap:12px}.mpi-dialog h2{margin:0;font-size:18px;line-height:26px}.mpi-dialog-close{display:inline-flex;flex:0 0 28px;width:28px;height:28px;align-items:center;justify-content:center;padding:0;border:0;border-radius:8px;background:transparent;color:var(--dsw-alias-label-secondary,#b8bbc2);cursor:pointer}.mpi-dialog-close:hover{background:var(--dsw-alias-interactive-bg-hover,#3a3b3f);color:var(--dsw-alias-label-primary,#fff)}.mpi-intro{margin:8px 0 18px;color:var(--dsw-alias-label-secondary,#c2c4ca);font-size:13px;line-height:20px}.mpi-meta{display:grid;grid-template-columns:max-content minmax(0,1fr);gap:8px 18px;margin:0 0 16px;font-size:12px;line-height:18px}.mpi-meta dt{color:var(--dsw-alias-label-secondary,#c2c4ca)}.mpi-meta dd{margin:0;font-family:ui-monospace,SFMono-Regular,Consolas,monospace}.mpi-status{margin:0 0 18px;border-radius:7px;padding:12px 14px;background:var(--dsw-alias-bg-layer-3,var(--dsw-specific-menu-item-hover,#252527));font-size:13px;font-weight:600;line-height:20px}.mpi-status[data-kind=error]{color:var(--dsw-alias-state-error-primary,#ff6464)}.mpi-status[data-kind=success]{color:var(--dsw-alias-state-success-primary,#36d67a)}.mpi-manual{border-top:1px solid var(--dsw-alias-border-l2,#4b4d52);padding-top:16px}.mpi-manual h3{margin:0 0 6px;font-size:14px;line-height:20px}.mpi-manual p{margin:0 0 10px;color:var(--dsw-alias-label-secondary,#c2c4ca);font-size:12px;line-height:18px}.mpi-command{display:flex;align-items:center;gap:8px;border:1px solid var(--dsw-alias-border-l2,#4b4d52);border-radius:7px;padding:10px;background:var(--dsw-alias-bg-layer-3,var(--dsw-specific-menu-item-hover,#252527))}.mpi-command code{min-width:0;flex:1;overflow:auto;font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:12px;line-height:18px;white-space:nowrap}.mpi-actions{display:flex;align-items:center;justify-content:flex-end;gap:12px;margin-top:18px}.mpi-actions-group{display:flex;gap:8px}.mpi-action{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:32px;border:1px solid var(--dsw-alias-border-l2,#4b4d52);border-radius:7px;padding:6px 10px;background:transparent;color:inherit;font:inherit;font-size:12px;cursor:pointer}.mpi-action:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover,#414247)}.mpi-action:disabled{cursor:not-allowed;opacity:.55}.mpi-primary{border-color:var(--dsw-alias-state-business-primary,#4f8cff);background:var(--dsw-alias-state-business-primary,#4f8cff);color:#fff}.mpi-progress{height:4px;margin-top:10px;overflow:hidden;border-radius:99px;background:var(--dsw-alias-border-l2,#4b4d52)}.mpi-progress::after{display:block;width:32%;height:100%;background:var(--dsw-alias-state-business-primary,#4f8cff);content:'';animation:mpi-wave 1.15s ease-in-out infinite}@keyframes mpi-wave{from{transform:translateX(-110%)}to{transform:translateX(330%)}}@media(max-width:560px){.mpi-overlay{padding:10px}.mpi-dialog{max-height:calc(100vh - 20px);padding:16px}.mpi-actions{align-items:stretch}.mpi-actions-group{justify-content:flex-end;flex-wrap:wrap}.mpi-meta{grid-template-columns:1fr;gap:2px}.mpi-meta dd{margin-bottom:6px}}
|
|
6
|
+
`;
|
|
7
|
+
const ZH = {
|
|
8
|
+
check: "\u68C0\u67E5\u66F4\u65B0",
|
|
9
|
+
update: "\u66F4\u65B0",
|
|
10
|
+
close: "\u5173\u95ED",
|
|
11
|
+
recheck: "\u91CD\u65B0\u68C0\u67E5",
|
|
12
|
+
auto: "\u81EA\u52A8\u66F4\u65B0",
|
|
13
|
+
updating: "\u6B63\u5728\u66F4\u65B0\u2026",
|
|
14
|
+
copy: "\u590D\u5236\u547D\u4EE4",
|
|
15
|
+
copied: "\u5DF2\u590D\u5236",
|
|
16
|
+
copyFailed: "\u590D\u5236\u5931\u8D25",
|
|
17
|
+
checking: "\u6B63\u5728\u68C0\u67E5\u66F4\u65B0\u2026",
|
|
18
|
+
latest: "\u5DF2\u662F\u6700\u65B0\u7248\u672C",
|
|
19
|
+
found: "\u53D1\u73B0\u65B0\u7248\u672C",
|
|
20
|
+
failed: "\u68C0\u67E5\u66F4\u65B0\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",
|
|
21
|
+
current: "\u8FD0\u884C\u7248\u672C",
|
|
22
|
+
latestLabel: "\u6700\u65B0\u7248\u672C",
|
|
23
|
+
profile: "\u76EE\u6807 profile",
|
|
24
|
+
unknown: "\u672A\u77E5",
|
|
25
|
+
manual: "\u624B\u5DE5\u66F4\u65B0",
|
|
26
|
+
manualHint: "\u81EA\u52A8\u66F4\u65B0\u5931\u8D25\u65F6\uFF0C\u53EF\u5728\u5F53\u524D DSH \u7EC8\u7AEF\u6267\u884C\u4EE5\u4E0B\u547D\u4EE4\uFF0C\u5B8C\u6210\u540E\u91CD\u542F DSH Web\u3002",
|
|
27
|
+
intro: "\u4EC5\u68C0\u67E5\u5E76\u66F4\u65B0\u5F53\u524D\u63D2\u4EF6\uFF0C\u4E0D\u4F1A\u8054\u52A8\u5B89\u88C5\u5176\u4ED6\u63D2\u4EF6\u3002",
|
|
28
|
+
restart: "\u66F4\u65B0\u5B8C\u6210\uFF0C\u8BF7\u91CD\u542F DSH Web\u3002",
|
|
29
|
+
restarting: "\u66F4\u65B0\u5B8C\u6210\uFF0C\u6B63\u5728\u91CD\u542F DSH Desktop\u2026",
|
|
30
|
+
unavailable: "\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u81EA\u52A8\u66F4\u65B0\uFF0C\u8BF7\u4F7F\u7528\u624B\u5DE5\u66F4\u65B0\u547D\u4EE4\u3002"
|
|
31
|
+
};
|
|
32
|
+
const EN = {
|
|
33
|
+
check: "Check for updates",
|
|
34
|
+
update: "Update",
|
|
35
|
+
close: "Close",
|
|
36
|
+
recheck: "Check again",
|
|
37
|
+
auto: "Update automatically",
|
|
38
|
+
updating: "Updating\u2026",
|
|
39
|
+
copy: "Copy command",
|
|
40
|
+
copied: "Copied",
|
|
41
|
+
copyFailed: "Copy failed",
|
|
42
|
+
checking: "Checking for updates\u2026",
|
|
43
|
+
latest: "You are up to date",
|
|
44
|
+
found: "New version available",
|
|
45
|
+
failed: "Could not check for updates. Try again later.",
|
|
46
|
+
current: "Running version",
|
|
47
|
+
latestLabel: "Latest version",
|
|
48
|
+
profile: "Target profile",
|
|
49
|
+
unknown: "Unknown",
|
|
50
|
+
manual: "Manual update",
|
|
51
|
+
manualHint: "If automatic update fails, run this command in the current DSH terminal, then restart DSH Web.",
|
|
52
|
+
intro: "Only this plugin is checked and updated. Other plugins are not changed.",
|
|
53
|
+
restart: "Update complete. Restart DSH Web.",
|
|
54
|
+
restarting: "Update complete. Restarting DSH Desktop\u2026",
|
|
55
|
+
unavailable: "Automatic update is unavailable. Use the manual command."
|
|
56
|
+
};
|
|
57
|
+
function strings() {
|
|
58
|
+
const lang = document.documentElement.lang.toLowerCase();
|
|
59
|
+
const settings = document.querySelector('[role="dialog"]')?.textContent ?? "";
|
|
60
|
+
return lang.startsWith("en") || settings.includes("Settings") && !settings.includes("\u8BBE\u7F6E") ? EN : ZH;
|
|
61
|
+
}
|
|
62
|
+
function ensureStyle() {
|
|
63
|
+
if (document.getElementById(STYLE_ID) !== null) return;
|
|
64
|
+
const style = document.createElement("style");
|
|
65
|
+
style.id = STYLE_ID;
|
|
66
|
+
style.textContent = CSS;
|
|
67
|
+
(document.head ?? document.documentElement).append(style);
|
|
68
|
+
}
|
|
69
|
+
function validPayload(value) {
|
|
70
|
+
if (value === null || typeof value !== "object") return false;
|
|
71
|
+
const item = value;
|
|
72
|
+
return typeof item.packageName === "string" && typeof item.currentVersion === "string" && typeof item.updateAvailable === "boolean" && typeof item.profileName === "string" && typeof item.canAutoUpdate === "boolean" && typeof item.latestCheckFailed === "boolean" && (item.latestVersion === void 0 || typeof item.latestVersion === "string");
|
|
73
|
+
}
|
|
74
|
+
async function requestStatus(endpoint, method, signal) {
|
|
75
|
+
const signalOption = signal === void 0 ? {} : { signal };
|
|
76
|
+
const response = await fetch(endpoint, method === "GET" ? { cache: "no-store", ...signalOption } : {
|
|
77
|
+
method: "POST",
|
|
78
|
+
headers: { "content-type": "application/json", [UPDATE_HEADER]: "1" },
|
|
79
|
+
body: "{}",
|
|
80
|
+
...signalOption
|
|
81
|
+
});
|
|
82
|
+
const value = await response.json();
|
|
83
|
+
if (!response.ok || !validPayload(value)) throw new Error(typeof value.error === "string" ? value.error : strings().failed);
|
|
84
|
+
return value;
|
|
85
|
+
}
|
|
86
|
+
function manualPluginUpdateCommand(profileName, packageName, version) {
|
|
87
|
+
const profile = profileName.trim() === "" ? "" : ` --profile ${profileName.trim()}`;
|
|
88
|
+
return `dsh plugin${profile} add ${packageName}@${version} --registry=https://registry.npmjs.org/`;
|
|
89
|
+
}
|
|
90
|
+
function handlePluginUpdateEscape(event, close) {
|
|
91
|
+
if (event.key !== "Escape") return false;
|
|
92
|
+
event.preventDefault();
|
|
93
|
+
event.stopPropagation();
|
|
94
|
+
event.stopImmediatePropagation();
|
|
95
|
+
close();
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
98
|
+
function observePluginUpdate(options) {
|
|
99
|
+
if (typeof document === "undefined" || document.body === null) return () => {
|
|
100
|
+
};
|
|
101
|
+
ensureStyle();
|
|
102
|
+
const controller = new AbortController();
|
|
103
|
+
let payload;
|
|
104
|
+
let overlay;
|
|
105
|
+
let frame;
|
|
106
|
+
const setButtonContent = (button, label, iconName) => {
|
|
107
|
+
const icon = options.createIcon(iconName);
|
|
108
|
+
icon.classList.add("mpi-icon");
|
|
109
|
+
icon.setAttribute("aria-hidden", "true");
|
|
110
|
+
const text = document.createElement("span");
|
|
111
|
+
text.dataset.mpiLabel = "";
|
|
112
|
+
text.textContent = label;
|
|
113
|
+
button.replaceChildren(icon, text);
|
|
114
|
+
};
|
|
115
|
+
const setButtonLabel = (button, label) => {
|
|
116
|
+
const text = button.querySelector("[data-mpi-label]");
|
|
117
|
+
if (text === null) button.textContent = label;
|
|
118
|
+
else text.textContent = label;
|
|
119
|
+
};
|
|
120
|
+
const applyControls = () => {
|
|
121
|
+
const row = document.querySelector(options.titleRowSelector);
|
|
122
|
+
if (row === null) return;
|
|
123
|
+
const heading = row.querySelector("h1,h2");
|
|
124
|
+
if (heading !== null && payload !== void 0) {
|
|
125
|
+
let version = heading.querySelector(`.mpi-version[data-package="${options.packageName}"]`);
|
|
126
|
+
if (version === null) {
|
|
127
|
+
version = document.createElement("span");
|
|
128
|
+
version.className = "mpi-version";
|
|
129
|
+
version.dataset.package = options.packageName;
|
|
130
|
+
heading.append(version);
|
|
131
|
+
}
|
|
132
|
+
const versionLabel = `v${payload.currentVersion}`;
|
|
133
|
+
if (version.textContent !== versionLabel) version.textContent = versionLabel;
|
|
134
|
+
}
|
|
135
|
+
const links = row.querySelector(options.linksSelector);
|
|
136
|
+
if (links === null || links.querySelector(`[data-mpi-check="${options.packageName}"]`) !== null) return;
|
|
137
|
+
const button = document.createElement("button");
|
|
138
|
+
button.type = "button";
|
|
139
|
+
button.className = "mpi-check";
|
|
140
|
+
button.dataset.mpiCheck = options.packageName;
|
|
141
|
+
setButtonContent(button, strings().check, "refresh");
|
|
142
|
+
button.addEventListener("click", openDialog);
|
|
143
|
+
links.append(button);
|
|
144
|
+
};
|
|
145
|
+
const load = async () => {
|
|
146
|
+
payload = await requestStatus(options.endpoint, "GET", controller.signal);
|
|
147
|
+
applyControls();
|
|
148
|
+
return payload;
|
|
149
|
+
};
|
|
150
|
+
const closeDialog = () => {
|
|
151
|
+
overlay?.remove();
|
|
152
|
+
overlay = void 0;
|
|
153
|
+
};
|
|
154
|
+
function openDialog() {
|
|
155
|
+
closeDialog();
|
|
156
|
+
const text = strings();
|
|
157
|
+
overlay = document.createElement("div");
|
|
158
|
+
overlay.className = "mpi-overlay";
|
|
159
|
+
const dialog = document.createElement("section");
|
|
160
|
+
dialog.className = "mpi-dialog";
|
|
161
|
+
dialog.setAttribute("role", "dialog");
|
|
162
|
+
dialog.setAttribute("aria-modal", "true");
|
|
163
|
+
dialog.innerHTML = `<header class="mpi-head"><h2></h2><button type="button" class="mpi-dialog-close" data-action="close"></button></header><p class="mpi-intro"></p><dl class="mpi-meta"><dt></dt><dd data-role="current"></dd><dt></dt><dd data-role="latest"></dd><dt></dt><dd data-role="profile"></dd></dl><div class="mpi-status" role="status"></div><div class="mpi-progress" hidden></div><section class="mpi-manual"><h3></h3><p></p><div class="mpi-command"><code></code><button type="button" class="mpi-action" data-action="copy"></button></div></section><footer class="mpi-actions"><div class="mpi-actions-group"><button type="button" class="mpi-action" data-action="check"></button><button type="button" class="mpi-action mpi-primary" data-action="update"></button></div></footer>`;
|
|
164
|
+
const name = document.documentElement.lang.toLowerCase().startsWith("en") ? options.enName : options.zhName;
|
|
165
|
+
dialog.querySelector("h2").textContent = `${name} ${text.update}`;
|
|
166
|
+
dialog.querySelector(".mpi-intro").textContent = text.intro;
|
|
167
|
+
const terms = dialog.querySelectorAll("dt");
|
|
168
|
+
terms[0].textContent = text.current;
|
|
169
|
+
terms[1].textContent = text.latestLabel;
|
|
170
|
+
terms[2].textContent = text.profile;
|
|
171
|
+
dialog.querySelector(".mpi-manual h3").textContent = text.manual;
|
|
172
|
+
dialog.querySelector(".mpi-manual p").textContent = text.manualHint;
|
|
173
|
+
const status = dialog.querySelector(".mpi-status");
|
|
174
|
+
const progress = dialog.querySelector(".mpi-progress");
|
|
175
|
+
const command = dialog.querySelector(".mpi-command code");
|
|
176
|
+
const close = dialog.querySelector("[data-action=close]");
|
|
177
|
+
const check = dialog.querySelector("[data-action=check]");
|
|
178
|
+
const update = dialog.querySelector("[data-action=update]");
|
|
179
|
+
const copy = dialog.querySelector("[data-action=copy]");
|
|
180
|
+
setButtonContent(close, text.close, "close");
|
|
181
|
+
close.querySelector("[data-mpi-label]")?.remove();
|
|
182
|
+
close.setAttribute("aria-label", text.close);
|
|
183
|
+
close.title = text.close;
|
|
184
|
+
setButtonContent(check, text.recheck, "refresh");
|
|
185
|
+
setButtonContent(update, text.auto, "download");
|
|
186
|
+
setButtonContent(copy, text.copy, "copy");
|
|
187
|
+
let busy = false;
|
|
188
|
+
const setMessage = (message, kind = "") => {
|
|
189
|
+
status.textContent = message;
|
|
190
|
+
status.dataset.kind = kind;
|
|
191
|
+
};
|
|
192
|
+
const setBusy = (value) => {
|
|
193
|
+
busy = value;
|
|
194
|
+
check.disabled = value;
|
|
195
|
+
copy.disabled = value;
|
|
196
|
+
update.disabled = value || payload?.canAutoUpdate !== true || payload.updateAvailable !== true;
|
|
197
|
+
progress.hidden = !value;
|
|
198
|
+
};
|
|
199
|
+
const render = () => {
|
|
200
|
+
dialog.querySelector("[data-role=current]").textContent = payload === void 0 ? text.unknown : `v${payload.currentVersion}`;
|
|
201
|
+
dialog.querySelector("[data-role=latest]").textContent = payload?.latestVersion === void 0 ? text.unknown : `v${payload.latestVersion}`;
|
|
202
|
+
dialog.querySelector("[data-role=profile]").textContent = payload?.profileName ?? text.unknown;
|
|
203
|
+
command.textContent = manualPluginUpdateCommand(payload?.profileName ?? "", options.packageName, payload?.latestVersion ?? "latest");
|
|
204
|
+
update.disabled = busy || payload?.canAutoUpdate !== true || payload.updateAvailable !== true;
|
|
205
|
+
if (payload === void 0) setMessage(text.checking);
|
|
206
|
+
else if (payload.latestCheckFailed) setMessage(text.failed, "error");
|
|
207
|
+
else if (payload.updateAvailable) setMessage(`${text.found}: v${payload.latestVersion ?? text.unknown}`);
|
|
208
|
+
else setMessage(text.latest, "success");
|
|
209
|
+
if (payload !== void 0 && !payload.canAutoUpdate && payload.updateAvailable) setMessage(text.unavailable);
|
|
210
|
+
};
|
|
211
|
+
const checkNow = async () => {
|
|
212
|
+
if (busy) return;
|
|
213
|
+
setBusy(true);
|
|
214
|
+
setMessage(text.checking);
|
|
215
|
+
try {
|
|
216
|
+
await load();
|
|
217
|
+
setBusy(false);
|
|
218
|
+
render();
|
|
219
|
+
} catch (error) {
|
|
220
|
+
setBusy(false);
|
|
221
|
+
setMessage(error instanceof Error ? error.message : text.failed, "error");
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
const updateNow = async () => {
|
|
225
|
+
if (busy) return;
|
|
226
|
+
setBusy(true);
|
|
227
|
+
setButtonLabel(update, text.updating);
|
|
228
|
+
setMessage(text.updating);
|
|
229
|
+
try {
|
|
230
|
+
payload = await requestStatus(options.endpoint, "POST", controller.signal);
|
|
231
|
+
applyControls();
|
|
232
|
+
render();
|
|
233
|
+
setMessage(payload.autoReload === true ? text.restarting : text.restart, "success");
|
|
234
|
+
} catch (error) {
|
|
235
|
+
setMessage(error instanceof Error ? error.message : text.failed, "error");
|
|
236
|
+
} finally {
|
|
237
|
+
setButtonLabel(update, text.auto);
|
|
238
|
+
setBusy(false);
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
close.addEventListener("click", closeDialog);
|
|
242
|
+
check.addEventListener("click", () => {
|
|
243
|
+
void checkNow();
|
|
244
|
+
});
|
|
245
|
+
update.addEventListener("click", () => {
|
|
246
|
+
void updateNow();
|
|
247
|
+
});
|
|
248
|
+
copy.addEventListener("click", () => {
|
|
249
|
+
void navigator.clipboard?.writeText(command.textContent ?? "").then(() => {
|
|
250
|
+
setButtonLabel(copy, text.copied);
|
|
251
|
+
setTimeout(() => {
|
|
252
|
+
setButtonLabel(copy, text.copy);
|
|
253
|
+
}, 1400);
|
|
254
|
+
}).catch(() => {
|
|
255
|
+
setButtonLabel(copy, text.copyFailed);
|
|
256
|
+
});
|
|
257
|
+
});
|
|
258
|
+
overlay.addEventListener("click", (event) => {
|
|
259
|
+
if (event.target === overlay) closeDialog();
|
|
260
|
+
});
|
|
261
|
+
overlay.addEventListener("keydown", (event) => {
|
|
262
|
+
handlePluginUpdateEscape(event, closeDialog);
|
|
263
|
+
}, true);
|
|
264
|
+
overlay.append(dialog);
|
|
265
|
+
document.body.append(overlay);
|
|
266
|
+
render();
|
|
267
|
+
close.focus();
|
|
268
|
+
void checkNow();
|
|
269
|
+
}
|
|
270
|
+
const observer = new MutationObserver(() => {
|
|
271
|
+
if (frame !== void 0) return;
|
|
272
|
+
frame = window.requestAnimationFrame(() => {
|
|
273
|
+
frame = void 0;
|
|
274
|
+
applyControls();
|
|
275
|
+
});
|
|
276
|
+
});
|
|
277
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
278
|
+
applyControls();
|
|
279
|
+
void load().catch(() => {
|
|
280
|
+
});
|
|
281
|
+
return () => {
|
|
282
|
+
controller.abort();
|
|
283
|
+
observer.disconnect();
|
|
284
|
+
closeDialog();
|
|
285
|
+
if (frame !== void 0) window.cancelAnimationFrame(frame);
|
|
286
|
+
document.querySelectorAll(`[data-mpi-check="${options.packageName}"],.mpi-version[data-package="${options.packageName}"]`).forEach((node) => node.remove());
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
{
|
|
290
|
+
handlePluginUpdateEscape,
|
|
291
|
+
manualPluginUpdateCommand,
|
|
292
|
+
observePluginUpdate
|
|
293
|
+
};
|
|
294
|
+
|
|
1
295
|
/**
|
|
2
296
|
* dsh-im-connect 浏览器端:IM助理设置页 + 工作区频道槽。
|
|
3
297
|
*/
|
|
@@ -9,16 +303,42 @@ window.__ModuleLoader__.load({
|
|
|
9
303
|
const React = require("react");
|
|
10
304
|
const { useState, useEffect, useLayoutEffect, useCallback, useRef, useSyncExternalStore } = React;
|
|
11
305
|
const ReactDOM = require("react-dom");
|
|
12
|
-
const { RiskConfirmation, IconListPenOutline16 } = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
306
|
+
const { RiskConfirmation, IconListPenOutline16, IconRefreshOutline16, IconDownloadOutline16, IconCopyOutline16, IconCloseOutline16 } = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
13
307
|
const EMPTY_EXTRA_TABS = [];
|
|
14
308
|
const inject = ["slots", "sessions", "workspaces", "locale"];
|
|
15
309
|
const API_BASE = "/dsh-im-connect/api";
|
|
16
310
|
const TAB_KEY = "dsh-im-connect.sidebar-tab";
|
|
17
311
|
const ACCOUNT_SELECTION_KEY = "dsh-im-connect.settings.selected-account";
|
|
18
312
|
const IM_LOCALE_NS = "im-connect";
|
|
313
|
+
const UPDATE_ICON_PATHS = {
|
|
314
|
+
refresh: ["M13.5 5.5V2.5m0 0h-3m3 0-2.1 2.1A5.5 5.5 0 1 0 13.2 12"],
|
|
315
|
+
download: ["M8 2v8m0 0 3-3m-3 3-3-3M3 13v2h10v-2"],
|
|
316
|
+
copy: ["M5 5h8v8H5z", "M3 3h8"],
|
|
317
|
+
close: ["m4 4 8 8M12 4 4 12"],
|
|
318
|
+
};
|
|
319
|
+
function createPluginUpdateIcon(name) {
|
|
320
|
+
const element = document.createElement("span");
|
|
321
|
+
const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
322
|
+
svg.setAttribute("viewBox", "0 0 16 16");
|
|
323
|
+
svg.setAttribute("width", "16");
|
|
324
|
+
svg.setAttribute("height", "16");
|
|
325
|
+
svg.setAttribute("fill", "none");
|
|
326
|
+
svg.setAttribute("stroke", "currentColor");
|
|
327
|
+
svg.setAttribute("stroke-width", "1.5");
|
|
328
|
+
svg.setAttribute("stroke-linecap", "round");
|
|
329
|
+
svg.setAttribute("stroke-linejoin", "round");
|
|
330
|
+
svg.setAttribute("aria-hidden", "true");
|
|
331
|
+
UPDATE_ICON_PATHS[name].forEach((d) => {
|
|
332
|
+
const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
333
|
+
path.setAttribute("d", d);
|
|
334
|
+
svg.append(path);
|
|
335
|
+
});
|
|
336
|
+
element.append(svg);
|
|
337
|
+
return element;
|
|
338
|
+
}
|
|
19
339
|
const IM_LOCALES = {
|
|
20
340
|
zh: {
|
|
21
|
-
"settings.label": "IM助理", "settings.title": "IM
|
|
341
|
+
"settings.label": "IM助理", "settings.title": "IM助理", "settings.description": "管理各渠道账号。每个账号独立选择工作区、模型和权限,配置仅保存在本机。", "settings.viewProject": "GitHub", "settings.feedback": "问题反馈",
|
|
22
342
|
"settings.aria": "IM助理", "settings.selectAccountTitle": "选择一个账号", "settings.selectAccountDescription": "从左侧选择账号,查看并修改工作区、模型和权限配置。", "settings.noAccountsTitle": "还没有接入账号", "settings.noAccountsDescription": "请在左侧选择对应渠道,然后点击“添加账号”。", "settings.publicChatNotice": "未批准用户可以发起聊天,但不能批准工具调用。", "pending.notice": "有访问请求。批准后该用户才能驱动本机助手。", "action.approve": "批准", "action.deny": "拒绝", "loading": "加载中…",
|
|
23
343
|
"account.workspace": "工作区", "account.currentWorkspace": "当前工作区", "account.selectWorkspace": "请选择工作区", "account.selectModel": "请选择模型", "account.selectPermission": "请选择权限", "account.privateAccess": "私聊准入", "account.privateApproved": "仅已批准用户", "account.privateAll": "允许所有私聊用户", "account.autoNameNote": "绑定成功后会自动生成账号名,无需手动填写。", "account.defaultName": "{channel}账号 {count}",
|
|
24
344
|
"account.countZero": "0 个账号", "account.countOnline": "{online} / {total} 在线", "account.countOffline": "{total} / {total} 离线", "account.statusProcessing": "处理中…", "account.statusOnline": "在线", "account.statusOffline": "离线", "account.statusRunning": "运行正常", "account.statusNotConnected": "未连接", "account.receive": "接收消息", "account.receiveDescription": "关闭后保留账号配置,但不接收新消息", "account.removeConfirm": "确定移除这个账号?本机保存的配置和凭据将一并删除。",
|
|
@@ -37,7 +357,7 @@ window.__ModuleLoader__.load({
|
|
|
37
357
|
"status.disconnected": "已断开", "status.reconnectFailed": "重连失败", "status.connectingSocket": "连接中", "status.waitHandshake": "等待网关握手", "status.authenticating": "鉴权中", "status.reconnecting": "重连中", "status.connectionError": "连接错误", "status.connectionFailed": "连接失败", "status.streamConnected": "Stream 已连接", "status.stopped": "已停止", "status.longConnection": "长连接已建立", "status.polling": "轮询中", "status.notLoggedIn": "未登录", "status.waitQr": "等待扫码", "status.loggedIn": "已登录", "status.loggedInRecovered": "已登录(自动恢复)", "status.loggingIn": "登录中",
|
|
38
358
|
},
|
|
39
359
|
en: {
|
|
40
|
-
"settings.label": "IM Assistant", "settings.title": "IM
|
|
360
|
+
"settings.label": "IM Assistant", "settings.title": "IM Assistant", "settings.description": "Manage accounts across channels. Each account has its own workspace, model, and permission settings, stored only on this machine.", "settings.viewProject": "GitHub", "settings.feedback": "Issues",
|
|
41
361
|
"settings.aria": "IM Assistant", "settings.selectAccountTitle": "Select an account", "settings.selectAccountDescription": "Choose an account on the left to view and edit its workspace, model, and permissions.", "settings.noAccountsTitle": "No accounts connected", "settings.noAccountsDescription": "Choose a channel on the left, then select Add account.", "settings.publicChatNotice": "Unapproved users can start chats, but they cannot approve tool calls.", "pending.notice": "There are access requests. Approve a user before they can control the local assistant.", "action.approve": "Approve", "action.deny": "Deny", "loading": "Loading…",
|
|
42
362
|
"account.workspace": "Workspace", "account.currentWorkspace": "Current workspace", "account.selectWorkspace": "Select a workspace", "account.selectModel": "Select a model", "account.selectPermission": "Select a permission", "account.privateAccess": "Private chat access", "account.privateApproved": "Approved users only", "account.privateAll": "Allow all DM users", "account.autoNameNote": "The account name is generated automatically after setup.", "account.defaultName": "{channel} account {count}",
|
|
43
363
|
"account.countZero": "0 accounts", "account.countOnline": "{online} / {total} online", "account.countOffline": "{total} / {total} offline", "account.statusProcessing": "Processing…", "account.statusOnline": "Online", "account.statusOffline": "Offline", "account.statusRunning": "Running normally", "account.statusNotConnected": "Not connected", "account.receive": "Receive messages", "account.receiveDescription": "Turn this off to keep the account settings without receiving new messages", "account.removeConfirm": "Remove this account? Its saved settings and credentials will also be deleted.",
|
|
@@ -183,8 +503,8 @@ window.__ModuleLoader__.load({
|
|
|
183
503
|
.ima-ok{color:var(--ima-ok);font-size:14px;text-align:center;padding:24px 0}
|
|
184
504
|
.ima-modal .ima-error{color:var(--ima-danger)}
|
|
185
505
|
.ima-page.ima-account-page{max-width:1120px;padding-bottom:40px}
|
|
186
|
-
.ima-account-shell{display:grid;grid-template-columns:minmax(330px,390px) minmax(360px,1fr);min-height:650px;border:1px solid var(--ima-line);border-radius:16px;overflow:hidden;background:
|
|
187
|
-
.ima-platforms{padding:0;border-right:1px solid var(--ima-line);background:
|
|
506
|
+
.ima-account-shell{display:grid;grid-template-columns:minmax(330px,390px) minmax(360px,1fr);min-height:650px;border:1px solid var(--ima-line);border-radius:16px;overflow:hidden;background:transparent}
|
|
507
|
+
.ima-platforms{padding:0;border-right:1px solid var(--ima-line);background:transparent}
|
|
188
508
|
.ima-platform{border:0;border-bottom:1px solid var(--ima-line);border-radius:0;margin:0;overflow:visible;background:transparent}.ima-platform:last-child{border-bottom:0}.ima-platform.open{background:transparent}
|
|
189
509
|
.ima-platform-head{display:flex;align-items:center;gap:10px;width:100%;min-height:64px;padding:10px 18px;border:0;border-radius:0;background:transparent;color:inherit;text-align:left;cursor:pointer}
|
|
190
510
|
.ima-platform:not(.open):not(.empty) .ima-platform-head:hover{background:var(--ima-card-hover)}.ima-platform.empty .ima-platform-head{cursor:default}.ima-platform-title{min-width:0;flex:1;font-size:14px;font-weight:650}.ima-platform-count{color:var(--ima-muted);font-size:12px;white-space:nowrap}.ima-platform-count.online{color:var(--ima-ok)}.ima-platform-count.offline,.ima-platform-count.partial{color:var(--ima-warning)}
|
|
@@ -2251,6 +2571,15 @@ window.__ModuleLoader__.load({
|
|
|
2251
2571
|
ensureStyle();
|
|
2252
2572
|
ctx.effect(() => ctx.locale.register(IM_LOCALE_NS, IM_LOCALES), "im-connect: dictionaries");
|
|
2253
2573
|
const t = ctx.locale.bind(IM_LOCALE_NS);
|
|
2574
|
+
ctx.effect(() => observePluginUpdate({
|
|
2575
|
+
endpoint: "/api/michengai/dsh-im-connect/update",
|
|
2576
|
+
packageName: "@michengai/dsh-im-connect",
|
|
2577
|
+
titleRowSelector: ".ima-title-row",
|
|
2578
|
+
linksSelector: ".ima-title-links",
|
|
2579
|
+
zhName: t("settings.title"),
|
|
2580
|
+
enName: t("settings.title"),
|
|
2581
|
+
createIcon: createPluginUpdateIcon,
|
|
2582
|
+
}), "im-connect: plugin update ui");
|
|
2254
2583
|
const permissionT = ctx.locale.bind("permission.access");
|
|
2255
2584
|
const modelT = ctx.locale.bind("model");
|
|
2256
2585
|
const subscribeLocale = (listener) => ctx.locale.subscribe(listener);
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,MAAM,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,MAAM,MAAM,0BAA0B,CAAA;AAS7C,eAAO,MAAM,IAAI,mBAAmB,CAAA;AACpC,eAAO,MAAM,MAAM,UAQlB,CAAA;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAA;IAChB,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,gBAAgB,EAAE,MAAM,CAAA;CACzB;AAED,eAAO,MAAM,MAAM,EAAE,MAAM,CAAC,YAAY,CAOtC,CAAA;AAEF,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAqC9D;AAED,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACjF,OAAO,EACL,SAAS,EACT,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EACV,aAAa,EACb,aAAa,EACb,YAAY,GACb,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA"}
|
package/lib/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import { join } from 'node:path';
|
|
|
4
4
|
import { mkdirSync } from 'node:fs';
|
|
5
5
|
import { ChannelManager } from './manager.js';
|
|
6
6
|
import { createRotatingFileAppender } from './engine/file-log.js';
|
|
7
|
+
import { registerPluginUpdater } from './plugin-updater.js';
|
|
7
8
|
export const name = 'dsh-im-connect';
|
|
8
9
|
export const inject = [
|
|
9
10
|
'webServer',
|
|
@@ -23,6 +24,11 @@ export const Config = Schema.object({
|
|
|
23
24
|
mergeTimeoutSecs: Schema.number().default(5),
|
|
24
25
|
});
|
|
25
26
|
export function apply(ctx, config) {
|
|
27
|
+
ctx.effect(() => registerPluginUpdater(ctx, {
|
|
28
|
+
endpoint: '/api/michengai/dsh-im-connect/update',
|
|
29
|
+
packageName: '@michengai/dsh-im-connect',
|
|
30
|
+
manifestUrl: new URL('../package.json', import.meta.url),
|
|
31
|
+
}), 'im-connect.plugin-updater');
|
|
26
32
|
const permissionPresets = ctx.permissionPresets;
|
|
27
33
|
const stateDir = config.stateDir !== ''
|
|
28
34
|
? config.stateDir
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,MAAM,MAAM,0BAA0B,CAAA;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAE7C,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
export declare const PLUGIN_UPDATE_HEADER = "x-michengai-plugin-update";
|
|
3
|
+
export declare const PLUGIN_UPDATE_IPC = "apply-plugin-updates";
|
|
4
|
+
type HostRequest = {
|
|
5
|
+
method?: string;
|
|
6
|
+
url?: string;
|
|
7
|
+
headers?: Record<string, string | string[] | undefined>;
|
|
8
|
+
socket?: {
|
|
9
|
+
remoteAddress?: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export type PluginUpdaterOptions = {
|
|
13
|
+
readonly endpoint: string;
|
|
14
|
+
readonly packageName: string;
|
|
15
|
+
readonly manifestUrl: URL;
|
|
16
|
+
};
|
|
17
|
+
export declare function isTrustedUpdateRequest(request: HostRequest): boolean;
|
|
18
|
+
export declare function isDshCliEntry(entry: string, manifest: unknown, packageRoot: string): boolean;
|
|
19
|
+
export declare function isNewerVersion(currentValue: string, candidateValue: string): boolean;
|
|
20
|
+
export declare function registerPluginUpdater(ctx: Context, options: PluginUpdaterOptions): () => void;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=plugin-updater.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-updater.d.ts","sourceRoot":"","sources":["../src/plugin-updater.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAQlD,eAAO,MAAM,oBAAoB,8BAA8B,CAAA;AAC/D,eAAO,MAAM,iBAAiB,yBAAyB,CAAA;AAEvD,KAAK,WAAW,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC;IAAC,MAAM,CAAC,EAAE;QAAE,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAAA;AAOlJ,MAAM,MAAM,oBAAoB,GAAG;IAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,WAAW,EAAE,GAAG,CAAA;CAAE,CAAA;AAwBzH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAYpE;AAeD,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAU5F;AA8CD,wBAAgB,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAQpF;AA6FD,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,oBAAoB,GAAG,MAAM,IAAI,CAgC7F"}
|