@michengai/dsh-im-connect 0.1.28 → 0.1.29
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 +8 -0
- package/CHANGELOG.zh-CN.md +8 -0
- package/README.en.md +15 -10
- package/README.md +15 -10
- package/assets/screenshots/settings-channels.png +0 -0
- package/client.js +59 -44
- package/lib/client.js +59 -44
- package/lib/manager.d.ts +2 -0
- package/lib/manager.d.ts.map +1 -1
- package/lib/manager.js +7 -1
- package/lib/manager.js.map +1 -1
- package/package.json +1 -1
- package/src/manager.ts +9 -1
package/lib/client.js
CHANGED
|
@@ -18,35 +18,41 @@ window.__ModuleLoader__.load({
|
|
|
18
18
|
const IM_LOCALE_NS = "im-connect";
|
|
19
19
|
const IM_LOCALES = {
|
|
20
20
|
zh: {
|
|
21
|
-
"settings.label": "IM助理", "settings.title": "IM
|
|
21
|
+
"settings.label": "IM助理", "settings.title": "IM机器人", "settings.description": "管理各渠道账号。每个账号独立选择工作区、模型和权限,配置仅保存在本机。",
|
|
22
22
|
"settings.aria": "IM助理", "settings.selectAccountTitle": "选择一个账号", "settings.selectAccountDescription": "从左侧选择账号,查看并修改工作区、模型和权限配置。", "settings.noAccountsTitle": "还没有接入账号", "settings.noAccountsDescription": "请在左侧选择对应渠道,然后点击“添加账号”。", "settings.publicChatNotice": "未批准用户可以发起聊天,但不能批准工具调用。", "pending.notice": "有访问请求。批准后该用户才能驱动本机助手。", "action.approve": "批准", "action.deny": "拒绝", "loading": "加载中…",
|
|
23
|
+
"account.workspace": "工作区", "account.currentWorkspace": "当前工作区", "account.selectWorkspace": "请选择工作区", "account.selectModel": "请选择模型", "account.selectPermission": "请选择权限", "account.privateAccess": "私聊准入", "account.privateApproved": "仅已批准用户", "account.privateAll": "允许所有私聊用户", "account.autoNameNote": "绑定成功后会自动生成账号名,无需手动填写。", "account.defaultName": "{channel}账号 {count}",
|
|
24
|
+
"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": "确定移除这个账号?本机保存的配置和凭据将一并删除。",
|
|
25
|
+
"action.addAccount": "添加账号", "action.generateQr": "生成二维码", "action.checkConnection": "检查连接", "action.reconnectAccount": "重新连接", "action.removeAccount": "移除接入", "status.saving": "保存中…", "status.saved": "已保存",
|
|
23
26
|
"channel.dingtalk": "钉钉", "channel.feishu": "飞书", "channel.lark": "Lark", "channel.weixin": "微信", "channel.wecom": "企业微信", "channel.qq": "QQ", "channel.telegram": "Telegram",
|
|
24
27
|
"field.dingtalk.clientId": "Client ID(原 AppKey)", "field.dingtalk.clientSecret": "Client Secret(原 AppSecret)",
|
|
25
28
|
"bind.title": "配置 {channel}", "bind.close": "关闭", "bind.quick": "快捷绑定(推荐)", "bind.manual": "手动配置", "bind.success": "绑定成功,频道已连接", "bind.newIdentity": "检测到新的账号身份,已创建新账号", "bind.qrAlt": "{channel} 绑定二维码", "bind.generating": "正在生成…", "bind.expire": "二维码 {time} 后过期", "bind.scanned": "已扫码,请在手机上确认", "bind.retry": "请重新生成二维码", "bind.refresh": "重新生成二维码", "action.saving": "保存中…", "action.confirm": "确认",
|
|
26
29
|
"qr.weixin": "请使用微信扫描二维码完成绑定", "qr.feishu": "请使用飞书扫描二维码,将自动创建机器人", "qr.lark": "请使用 Lark 扫描二维码完成配对", "qr.wecom": "请使用企业微信扫描二维码,快捷绑定机器人", "qr.dingtalk": "请使用钉钉扫描二维码,自动创建机器人", "qr.qq": "请使用手机 QQ 扫描二维码,创建开放平台机器人", "qr.default": "请使用对应 App 扫描二维码",
|
|
27
30
|
"status.unconfigured": "未配置", "status.connected": "已连接", "status.connecting": "接入中…", "action.configure": "配置", "action.more": "{channel} 更多", "action.reconnect": "重新接入", "action.disconnect": "断开", "action.removeConfig": "删除配置", "action.receive": "接收消息",
|
|
28
|
-
"error.loadAssistant": "
|
|
31
|
+
"error.loadAssistant": "无法加载账号配置", "error.noModels": "当前 Host 还没有可用模型,请先在网页里配置提供商", "error.save": "保存失败", "error.chooseWorkspace": "请选择工作区目录", "error.workspaceUnavailable": "当前 Host 无法新增工作区", "error.addWorkspace": "新增工作区失败", "error.load": "加载失败", "error.connection": "无法连接本机 IM 助理接口", "error.request": "请求失败", "error.action": "操作失败", "error.qr": "无法生成二维码", "error.detailsInLog": "操作失败,请查看服务器日志。",
|
|
29
32
|
"composer.aria": "全局会话配置", "composer.project": "选择项目", "composer.projectAria": "项目", "composer.noWorkspaces": "暂无工作区", "composer.addWorkspace": "添加工作区…", "composer.permission": "权限", "composer.noModels": "暂无模型", "composer.workspacePath": "工作区路径", "action.cancel": "取消", "action.adding": "添加中…",
|
|
30
33
|
"permission.readOnly": "只读", "permission.workspaceWrite": "工作区写入", "permission.fullAccess": "完全访问",
|
|
31
34
|
"rail.workspace": "工作区", "rail.search": "搜索", "rail.searchPlaceholder": "搜索会话...", "rail.clearSearch": "清除搜索", "rail.filter": "筛选", "rail.group": "分组方式", "rail.byWorkspace": "按工作区", "rail.list": "单列表", "rail.sort": "排序方式", "rail.manual": "手动排序", "rail.recent": "最近更新", "rail.running": "运行中", "rail.idle": "空闲", "rail.renameAria": "重命名会话", "rail.rename": "重命名", "rail.fork": "分叉会话", "rail.archive": "归档会话", "rail.empty": "还没有频道会话。先在设置 → IM助理 里连接渠道,并给机器人发一条消息。", "rail.noTasks": "暂无网页任务", "rail.ungrouped": "未分组", "rail.tabsAria": "工作区分类", "rail.tasks": "任务", "rail.channels": "频道",
|
|
32
35
|
"time.now": "刚刚", "time.minutes": "{count}分钟前", "time.hours": "{count}小时前", "time.days": "{count}天前",
|
|
33
|
-
"server.unknownChannel": "未知渠道", "server.channelUnconfigured": "渠道未配置", "server.sessionMissing": "会话不存在", "server.qrUnsupported": "该渠道不支持扫码绑定", "server.qrExpired": "二维码已过期", "server.qrIncomplete": "扫码未完成", "server.accessDenied": "未授权:请管理员在设置 → IM助理 中批准你的访问。",
|
|
36
|
+
"server.unknownChannel": "未知渠道", "server.channelUnconfigured": "渠道未配置", "server.sessionMissing": "会话不存在", "server.accountMissing": "账号不存在", "server.accountConnectFailed": "账号连接失败,请查看本机日志", "server.accountReconnectFailed": "重新连接失败,请查看本机日志", "server.selectAccountSettings": "请选择提供商、模型、工作区或权限", "server.selectModel": "请选择提供商和模型", "server.selectWorkspace": "请选择工作区", "server.selectPermission": "请选择权限", "server.missingCredentials": "凭据不足,无法启动渠道", "server.qrUnsupported": "该渠道不支持扫码绑定", "server.qrExpired": "二维码已过期", "server.qrIncomplete": "扫码未完成", "server.accessDenied": "未授权:请管理员在设置 → IM助理 中批准你的访问。",
|
|
34
37
|
"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": "登录中",
|
|
35
38
|
},
|
|
36
39
|
en: {
|
|
37
|
-
"settings.label": "IM Assistant", "settings.title": "IM
|
|
40
|
+
"settings.label": "IM Assistant", "settings.title": "IM Bots", "settings.description": "Manage accounts across channels. Each account has its own workspace, model, and permission settings, stored only on this machine.",
|
|
38
41
|
"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
|
+
"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
|
+
"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.",
|
|
44
|
+
"action.addAccount": "Add account", "action.generateQr": "Generate QR code", "action.checkConnection": "Check", "action.reconnectAccount": "Reconnect", "action.removeAccount": "Remove", "status.saving": "Saving…", "status.saved": "Saved",
|
|
39
45
|
"channel.dingtalk": "DingTalk", "channel.feishu": "Feishu", "channel.lark": "Lark", "channel.weixin": "WeChat", "channel.wecom": "WeCom", "channel.qq": "QQ", "channel.telegram": "Telegram",
|
|
40
46
|
"field.dingtalk.clientId": "Client ID (formerly AppKey)", "field.dingtalk.clientSecret": "Client Secret (formerly AppSecret)",
|
|
41
47
|
"bind.title": "Set up {channel}", "bind.close": "Close", "bind.quick": "Quick setup (recommended)", "bind.manual": "Manual setup", "bind.success": "Connected successfully", "bind.newIdentity": "A new account identity was detected and a new account was created", "bind.qrAlt": "{channel} setup QR code", "bind.generating": "Generating…", "bind.expire": "QR code expires in {time}", "bind.scanned": "Scanned. Confirm on your phone.", "bind.retry": "Generate a new QR code", "bind.refresh": "Generate a new QR code", "action.saving": "Saving…", "action.confirm": "Confirm",
|
|
42
48
|
"qr.weixin": "Scan the QR code with WeChat to connect", "qr.feishu": "Scan with Feishu; a bot will be created automatically", "qr.lark": "Scan with Lark to pair", "qr.wecom": "Scan with WeCom to quickly connect a bot", "qr.dingtalk": "Scan with DingTalk; a bot will be created automatically", "qr.qq": "Scan with mobile QQ to create an Open Platform bot", "qr.default": "Scan the QR code with the corresponding app",
|
|
43
49
|
"status.unconfigured": "Not configured", "status.connected": "Connected", "status.connecting": "Connecting…", "action.configure": "Configure", "action.more": "More options for {channel}", "action.reconnect": "Reconnect", "action.disconnect": "Disconnect", "action.removeConfig": "Remove configuration", "action.receive": "Receive messages",
|
|
44
|
-
"error.loadAssistant": "Could not load
|
|
50
|
+
"error.loadAssistant": "Could not load account settings", "error.noModels": "No models are available in the Host. Configure a provider in the web app first.", "error.save": "Could not save", "error.chooseWorkspace": "Choose a workspace directory", "error.workspaceUnavailable": "This Host cannot create workspaces", "error.addWorkspace": "Could not add workspace", "error.load": "Could not load", "error.connection": "Could not connect to the local IM Assistant API", "error.request": "Request failed", "error.action": "Action failed", "error.qr": "Could not generate a QR code", "error.detailsInLog": "The operation failed. Check the server logs for details.",
|
|
45
51
|
"composer.aria": "Global session settings", "composer.project": "Select project", "composer.projectAria": "Project", "composer.noWorkspaces": "No workspaces", "composer.addWorkspace": "Add workspace…", "composer.permission": "Permission", "composer.noModels": "No models", "composer.workspacePath": "Workspace path", "action.cancel": "Cancel", "action.adding": "Adding…",
|
|
46
52
|
"permission.readOnly": "Read Only", "permission.workspaceWrite": "Workspace Write", "permission.fullAccess": "Full access",
|
|
47
53
|
"rail.workspace": "Workspaces", "rail.search": "Search", "rail.searchPlaceholder": "Search sessions...", "rail.clearSearch": "Clear search", "rail.filter": "Filter", "rail.group": "Group by", "rail.byWorkspace": "By workspace", "rail.list": "Single list", "rail.sort": "Sort by", "rail.manual": "Manual", "rail.recent": "Recently updated", "rail.running": "Running", "rail.idle": "Idle", "rail.renameAria": "Rename session", "rail.rename": "Rename", "rail.fork": "Fork session", "rail.archive": "Archive session", "rail.empty": "No channel sessions yet. Connect a channel in Settings → IM Assistant, then send the bot a message.", "rail.noTasks": "No web tasks", "rail.ungrouped": "Ungrouped", "rail.tabsAria": "Workspace categories", "rail.tasks": "Tasks", "rail.channels": "Channels",
|
|
48
54
|
"time.now": "Just now", "time.minutes": "{count} min ago", "time.hours": "{count} hr ago", "time.days": "{count} days ago",
|
|
49
|
-
"server.unknownChannel": "Unknown channel", "server.channelUnconfigured": "Channel is not configured", "server.sessionMissing": "Session does not exist", "server.qrUnsupported": "This channel does not support QR setup", "server.qrExpired": "QR code has expired", "server.qrIncomplete": "QR setup was not completed", "server.accessDenied": "Access denied: ask an administrator to approve you in Settings → IM Assistant.",
|
|
55
|
+
"server.unknownChannel": "Unknown channel", "server.channelUnconfigured": "Channel is not configured", "server.sessionMissing": "Session does not exist", "server.accountMissing": "Account does not exist", "server.accountConnectFailed": "Could not connect the account. Check the local logs.", "server.accountReconnectFailed": "Could not reconnect the account. Check the local logs.", "server.selectAccountSettings": "Select a provider, model, workspace, or permission setting", "server.selectModel": "Select a provider and model", "server.selectWorkspace": "Select a workspace", "server.selectPermission": "Select a permission", "server.missingCredentials": "The channel cannot start because credentials are missing", "server.qrUnsupported": "This channel does not support QR setup", "server.qrExpired": "QR code has expired", "server.qrIncomplete": "QR setup was not completed", "server.accessDenied": "Access denied: ask an administrator to approve you in Settings → IM Assistant.",
|
|
50
56
|
"status.disconnected": "Disconnected", "status.reconnectFailed": "Reconnect failed", "status.connectingSocket": "Connecting", "status.waitHandshake": "Waiting for gateway handshake", "status.authenticating": "Authenticating", "status.reconnecting": "Reconnecting", "status.connectionError": "Connection error", "status.connectionFailed": "Connection failed", "status.streamConnected": "Stream connected", "status.stopped": "Stopped", "status.longConnection": "Long connection established", "status.polling": "Polling", "status.notLoggedIn": "Not signed in", "status.waitQr": "Waiting for scan", "status.loggedIn": "Signed in", "status.loggedInRecovered": "Signed in (restored)", "status.loggingIn": "Signing in",
|
|
51
57
|
},
|
|
52
58
|
};
|
|
@@ -190,7 +196,7 @@ window.__ModuleLoader__.load({
|
|
|
190
196
|
.ima-inspector{padding:22px 24px 26px;min-width:0}.ima-inspector-empty{display:grid;min-height:580px;padding:32px;place-items:center;text-align:center}.ima-inspector-empty-copy{max-width:300px}.ima-inspector-empty-title{margin:0;color:var(--ima-text);font-size:16px;font-weight:650;line-height:24px}.ima-inspector-empty-description{margin:8px 0 0;color:var(--ima-muted);font-size:13px;line-height:20px}.ima-inspector-head{display:flex;align-items:flex-start;gap:12px;padding-bottom:18px;border-bottom:1px solid var(--ima-line)}.ima-inspector-head-copy{min-width:0;flex:1}.ima-inspector-title{margin:1px 0 3px;font-size:17px;line-height:24px}.ima-inspector-status{color:var(--ima-muted);font-size:12px}.ima-inspector-status.ok{color:var(--ima-ok)}
|
|
191
197
|
.ima-form{display:flex;flex-direction:column;gap:16px;padding-top:20px}.ima-control{display:flex;flex-direction:column;gap:7px}.ima-control>span{color:var(--ima-muted);font-size:12px;font-weight:550}.ima-control input,.ima-control select{box-sizing:border-box;width:100%;min-height:44px;padding:0 12px;border:1px solid var(--ima-line);border-radius:9px;background:var(--dsw-alias-bg-layer-2,rgba(255,255,255,.04));color:var(--ima-text);font:13px inherit;outline:none}.ima-control input:focus,.ima-control select:focus{border-color:var(--ima-accent);box-shadow:0 0 0 2px color-mix(in srgb,var(--ima-accent) 18%,transparent)}.ima-control option{background:#202124;color:#f2f3f5}
|
|
192
198
|
.ima-switch-row{display:flex;align-items:center;justify-content:space-between;min-height:48px;padding:0 2px}.ima-switch-copy strong{display:block;font-size:13px}.ima-switch-copy small{display:block;margin-top:2px;color:var(--ima-muted);font-size:11px}
|
|
193
|
-
.ima-inspector-actions{display:flex;align-items:center;gap:8px;margin-top:6px;padding-top:18px;border-top:1px solid var(--ima-line)}.ima-inspector-actions .ima-btn{min-height:36px}.ima-inspector-actions .danger{margin-left:auto;color:var(--ima-danger);border-color:color-mix(in srgb,var(--ima-danger) 35%,transparent)}
|
|
199
|
+
.ima-inspector-actions{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-top:6px;padding-top:18px;border-top:1px solid var(--ima-line)}.ima-inspector-actions .ima-btn{flex:none;min-width:0;min-height:36px;padding:0 8px;font-size:12px;white-space:nowrap}.ima-inspector-actions .danger{margin-left:auto;color:var(--ima-danger);border-color:color-mix(in srgb,var(--ima-danger) 35%,transparent)}
|
|
194
200
|
.ima-save-note{min-height:18px;color:var(--ima-muted);font-size:11px}.ima-save-note.ok{color:var(--ima-ok)}
|
|
195
201
|
.ima-modal.ima-account-modal{width:min(560px,100%);max-height:min(760px,calc(100vh - 48px));overflow:auto}.ima-setup-section{margin:4px 0 14px;padding-bottom:14px;border-bottom:1px solid var(--ima-line)}
|
|
196
202
|
.ima-account-settings{display:grid;grid-template-columns:1fr 1fr;gap:12px}.ima-account-settings.compact{grid-template-columns:1fr}.ima-picker-field{display:flex;min-width:0;flex-direction:column;gap:7px}.ima-picker-field.wide{grid-column:1/-1}.ima-picker-label{color:var(--ima-muted);font-size:12px;font-weight:550}.ima-account-picker{width:100%}.ima-account-picker .ima-chip-btn{width:100%;height:auto;min-height:44px;justify-content:flex-start;padding:8px 12px;border:1px solid var(--ima-line);border-radius:9px;background:var(--dsw-alias-bg-layer-2,rgba(255,255,255,.04));color:var(--ima-text);font-size:13px;text-align:left}.ima-account-picker .ima-chip-btn:hover,.ima-account-picker.is-open .ima-chip-btn{border-color:var(--ima-accent);background:var(--dsw-alias-bg-layer-2,rgba(255,255,255,.04));box-shadow:0 0 0 2px color-mix(in srgb,var(--ima-accent) 18%,transparent)}.ima-account-picker .ima-chip-label{flex:1}.ima-account-picker .ima-chip-btn em{margin-left:auto}.ima-account-picker .ima-chip-menu{width:100%;min-width:100%;max-height:min(320px,calc(100vh - 120px))}.ima-account-picker.ima-model-select .ima-chip-btn{border-radius:9px}.ima-account-picker.ima-model-select .ima-chip-menu{width:max(100%,320px);min-width:100%}.ima-account-settings .ima-chip-dialog{grid-column:1/-1;margin-top:0}.ima-picker-note{grid-column:1/-1;color:var(--ima-muted);font-size:11px;line-height:1.5}.ima-picker-note.warning{color:var(--ima-warning)}
|
|
@@ -303,9 +309,11 @@ window.__ModuleLoader__.load({
|
|
|
303
309
|
|
|
304
310
|
const SERVER_TEXT_KEYS = new Map([
|
|
305
311
|
["未知渠道", "server.unknownChannel"], ["渠道未配置", "server.channelUnconfigured"], ["会话不存在", "server.sessionMissing"],
|
|
312
|
+
["账号不存在", "server.accountMissing"], ["账号连接失败,请查看本机日志", "server.accountConnectFailed"], ["重新连接失败,请查看本机日志", "server.accountReconnectFailed"],
|
|
313
|
+
["请选择提供商、模型、工作区或权限", "server.selectAccountSettings"], ["请选择提供商和模型", "server.selectModel"], ["请选择工作区", "server.selectWorkspace"], ["请选择权限", "server.selectPermission"], ["凭据不足,无法启动渠道", "server.missingCredentials"],
|
|
306
314
|
["该渠道不支持扫码绑定", "server.qrUnsupported"], ["二维码已过期", "server.qrExpired"], ["扫码未完成", "server.qrIncomplete"],
|
|
307
315
|
["未授权:请管理员在设置 → IM助理 中批准你的访问。", "server.accessDenied"],
|
|
308
|
-
["已断开", "status.disconnected"], ["重连失败", "status.reconnectFailed"], ["连接中", "status.connectingSocket"], ["等待网关握手", "status.waitHandshake"],
|
|
316
|
+
["未连接", "account.statusNotConnected"], ["已断开", "status.disconnected"], ["重连失败", "status.reconnectFailed"], ["连接中", "status.connectingSocket"], ["等待网关握手", "status.waitHandshake"],
|
|
309
317
|
["鉴权中", "status.authenticating"], ["已连接", "status.connected"], ["重连中", "status.reconnecting"], ["连接错误", "status.connectionError"], ["连接失败", "status.connectionFailed"],
|
|
310
318
|
["Stream 已连接", "status.streamConnected"], ["已停止", "status.stopped"], ["长连接已建立", "status.longConnection"], ["轮询中", "status.polling"],
|
|
311
319
|
["未登录", "status.notLoggedIn"], ["等待扫码", "status.waitQr"], ["已登录", "status.loggedIn"], ["已登录(自动恢复)", "status.loggedInRecovered"], ["登录中", "status.loggingIn"],
|
|
@@ -325,6 +333,13 @@ window.__ModuleLoader__.load({
|
|
|
325
333
|
const translated = t(key);
|
|
326
334
|
return translated === key ? (ch.label || ch.id) : translated;
|
|
327
335
|
}
|
|
336
|
+
function accountLabel(account, t) {
|
|
337
|
+
if (!account || !account.autoName) return account && (account.name || account.id) || "";
|
|
338
|
+
return t("account.defaultName", {
|
|
339
|
+
channel: channelLabel({ id: account.platform, label: account.platform }, t),
|
|
340
|
+
count: account.nameOrdinal || 1,
|
|
341
|
+
});
|
|
342
|
+
}
|
|
328
343
|
function fieldLabel(ch, field, t) {
|
|
329
344
|
const key = "field." + ch.id + "." + field.key;
|
|
330
345
|
const translated = t(key);
|
|
@@ -527,7 +542,7 @@ window.__ModuleLoader__.load({
|
|
|
527
542
|
h("p", { className: "ima-hint" }, hintOf(ch, t)),
|
|
528
543
|
(busy || status === "starting") && h("div", { className: "ima-bind-status" }, t("bind.generating")),
|
|
529
544
|
(status === "expired" || status === "failed") && h("div", { className: "ima-error" }, serverText(pairing && pairing.error, t) || t("bind.retry")),
|
|
530
|
-
h("button", { className: "ima-btn primary", disabled: busy || !settings.cwd || !settings.provider || !settings.model || !settings.permission, onClick: () => startQr(qrStarted) }, busy ? t("bind.generating") : qrStarted ? t("bind.refresh") : "
|
|
545
|
+
h("button", { className: "ima-btn primary", disabled: busy || !settings.cwd || !settings.provider || !settings.model || !settings.permission, onClick: () => startQr(qrStarted) }, busy ? t("bind.generating") : qrStarted ? t("bind.refresh") : t("action.generateQr")),
|
|
531
546
|
)
|
|
532
547
|
),
|
|
533
548
|
tab === "manual" && hasManual && h("div", null,
|
|
@@ -797,12 +812,12 @@ window.__ModuleLoader__.load({
|
|
|
797
812
|
);
|
|
798
813
|
|
|
799
814
|
return h("div", { className: "ima-account-settings" + (props.compact ? " compact" : "") },
|
|
800
|
-
field("workspace", props.workspaceLabel || "
|
|
815
|
+
field("workspace", props.workspaceLabel || t("account.workspace"), h(ChipMenu, {
|
|
801
816
|
open: open === "workspace",
|
|
802
817
|
onToggle: (next) => setOpen(next ? "workspace" : ""),
|
|
803
818
|
icon: h(FolderIcon),
|
|
804
|
-
label: (workspace && (workspace.title || workspace.path)) || cwd || "
|
|
805
|
-
ariaLabel: props.workspaceLabel || "
|
|
819
|
+
label: (workspace && (workspace.title || workspace.path)) || cwd || t("account.selectWorkspace"),
|
|
820
|
+
ariaLabel: props.workspaceLabel || t("account.workspace"),
|
|
806
821
|
className: "ima-account-picker",
|
|
807
822
|
},
|
|
808
823
|
items.length === 0 && h("div", { className: "ima-chip-empty" }, t("composer.noWorkspaces")),
|
|
@@ -817,11 +832,11 @@ window.__ModuleLoader__.load({
|
|
|
817
832
|
h("div", { className: "ima-chip-split" }),
|
|
818
833
|
h(ChipRow, { icon: h(PlusIcon), label: t("composer.addWorkspace"), onClick: onAddWorkspace }),
|
|
819
834
|
), true),
|
|
820
|
-
field("model", "
|
|
835
|
+
field("model", modelT("menu.model"), h(ChipMenu, {
|
|
821
836
|
open: open === "model",
|
|
822
837
|
onToggle: (next) => { setOpen(next ? "model" : ""); if (next) setModelPane("root"); },
|
|
823
838
|
icon: null,
|
|
824
|
-
label: (currentModel && currentModel.label) || "
|
|
839
|
+
label: (currentModel && currentModel.label) || t("account.selectModel"),
|
|
825
840
|
title: currentModel && currentModel.label,
|
|
826
841
|
suffix: effortLabel,
|
|
827
842
|
ariaLabel: modelT("trigger.selectAria"),
|
|
@@ -830,7 +845,7 @@ window.__ModuleLoader__.load({
|
|
|
830
845
|
menuClassName: "ima-model-menu",
|
|
831
846
|
},
|
|
832
847
|
modelPane === "root" && [
|
|
833
|
-
h(ChipRow, { key: "model", kv: true, label: modelT("menu.model"), hint: (currentModel && currentModel.label) || "
|
|
848
|
+
h(ChipRow, { key: "model", kv: true, label: modelT("menu.model"), hint: (currentModel && currentModel.label) || t("account.selectModel"), chevron: true, onClick: () => setModelPane("model") }),
|
|
834
849
|
reasoning && h(ChipRow, { key: "effort", kv: true, label: modelT("menu.effort"), hint: effortLabel || modelT("effort.providerDefault"), chevron: true, onClick: () => setModelPane("effort") }),
|
|
835
850
|
],
|
|
836
851
|
modelPane === "model" && (models.length === 0
|
|
@@ -857,11 +872,11 @@ window.__ModuleLoader__.load({
|
|
|
857
872
|
onClick: () => { update({ provider, model, reasoningEffort: item.id }); setOpen(""); },
|
|
858
873
|
})),
|
|
859
874
|
)),
|
|
860
|
-
field("permission", "
|
|
875
|
+
field("permission", t("composer.permission"), h(ChipMenu, {
|
|
861
876
|
open: open === "permission",
|
|
862
877
|
onToggle: (next) => setOpen(next ? "permission" : ""),
|
|
863
878
|
icon: h(ShieldIcon),
|
|
864
|
-
label: (currentPermission && currentPermission.label) || "
|
|
879
|
+
label: (currentPermission && currentPermission.label) || t("account.selectPermission"),
|
|
865
880
|
ariaLabel: t("composer.permission"),
|
|
866
881
|
className: "ima-account-picker",
|
|
867
882
|
},
|
|
@@ -873,16 +888,16 @@ window.__ModuleLoader__.load({
|
|
|
873
888
|
onClick: () => selectPermission(item.value),
|
|
874
889
|
})),
|
|
875
890
|
)),
|
|
876
|
-
field("private", "
|
|
891
|
+
field("private", t("account.privateAccess"), h(ChipMenu, {
|
|
877
892
|
open: open === "private",
|
|
878
893
|
onToggle: (next) => setOpen(next ? "private" : ""),
|
|
879
894
|
icon: h(ShieldIcon),
|
|
880
|
-
label: privateAccess === "all" ? "
|
|
881
|
-
ariaLabel: "
|
|
895
|
+
label: privateAccess === "all" ? t("account.privateAll") : t("account.privateApproved"),
|
|
896
|
+
ariaLabel: t("account.privateAccess"),
|
|
882
897
|
className: "ima-account-picker",
|
|
883
898
|
},
|
|
884
|
-
h(ChipRow, { icon: h(ShieldIcon), label: "
|
|
885
|
-
h(ChipRow, { icon: h(ShieldIcon), label: "
|
|
899
|
+
h(ChipRow, { icon: h(ShieldIcon), label: t("account.privateApproved"), active: privateAccess === "approved", onClick: () => { update({ privateAccess: "approved" }); setOpen(""); } }),
|
|
900
|
+
h(ChipRow, { icon: h(ShieldIcon), label: t("account.privateAll"), active: privateAccess === "all", onClick: () => { update({ privateAccess: "all" }); setOpen(""); } }),
|
|
886
901
|
), true),
|
|
887
902
|
privateAccess === "all" && h("div", { className: "ima-picker-note warning" }, t("settings.publicChatNotice")),
|
|
888
903
|
adding && h("div", { className: "ima-chip-dialog" },
|
|
@@ -894,7 +909,7 @@ window.__ModuleLoader__.load({
|
|
|
894
909
|
),
|
|
895
910
|
),
|
|
896
911
|
hint && h("div", { className: "ima-picker-note" }, hint),
|
|
897
|
-
props.showAutoNameNote && h("div", { className: "ima-picker-note" }, "
|
|
912
|
+
props.showAutoNameNote && h("div", { className: "ima-picker-note" }, t("account.autoNameNote")),
|
|
898
913
|
h(RiskConfirmation, {
|
|
899
914
|
open: confirmingFullAccess,
|
|
900
915
|
title: permissionT("confirm.title"),
|
|
@@ -1205,7 +1220,7 @@ window.__ModuleLoader__.load({
|
|
|
1205
1220
|
const seq = ++saveSeq.current;
|
|
1206
1221
|
const next = { ...draft, ...patch };
|
|
1207
1222
|
setDraft(next);
|
|
1208
|
-
setNote("
|
|
1223
|
+
setNote("status.saving");
|
|
1209
1224
|
return onSave(account.id, {
|
|
1210
1225
|
name: next.name,
|
|
1211
1226
|
cwd: next.cwd,
|
|
@@ -1215,7 +1230,7 @@ window.__ModuleLoader__.load({
|
|
|
1215
1230
|
permission: next.permission,
|
|
1216
1231
|
privateAccess: next.privateAccess,
|
|
1217
1232
|
}).then((ok) => {
|
|
1218
|
-
if (seq === saveSeq.current) setNote(ok ? "
|
|
1233
|
+
if (seq === saveSeq.current) setNote(ok ? "status.saved" : "error.save");
|
|
1219
1234
|
return ok;
|
|
1220
1235
|
});
|
|
1221
1236
|
};
|
|
@@ -1234,8 +1249,8 @@ window.__ModuleLoader__.load({
|
|
|
1234
1249
|
h("div", { className: "ima-inspector-head" },
|
|
1235
1250
|
h(Logo, { id: account.platform }),
|
|
1236
1251
|
h("div", { className: "ima-inspector-head-copy" },
|
|
1237
|
-
h("h3", { className: "ima-inspector-title" }, account
|
|
1238
|
-
h("div", { className: account.connected ? "ima-inspector-status ok" : "ima-inspector-status" }, account.connected ? "
|
|
1252
|
+
h("h3", { className: "ima-inspector-title" }, accountLabel(account, t)),
|
|
1253
|
+
h("div", { className: account.connected ? "ima-inspector-status ok" : "ima-inspector-status" }, "● " + (account.connected ? t("account.statusRunning") : (serverText(account.status, t) || t("account.statusNotConnected")))),
|
|
1239
1254
|
h("div", { className: "ima-account-id" }, account.id),
|
|
1240
1255
|
),
|
|
1241
1256
|
),
|
|
@@ -1251,18 +1266,18 @@ window.__ModuleLoader__.load({
|
|
|
1251
1266
|
modelT,
|
|
1252
1267
|
permissionT,
|
|
1253
1268
|
compact: true,
|
|
1254
|
-
workspaceLabel: "
|
|
1269
|
+
workspaceLabel: t("account.currentWorkspace"),
|
|
1255
1270
|
t,
|
|
1256
1271
|
}),
|
|
1257
1272
|
h("div", { className: "ima-switch-row" },
|
|
1258
|
-
h("div", { className: "ima-switch-copy" }, h("strong", null, "
|
|
1259
|
-
h("button", { type: "button", className: draft.receiveEnabled ? "ima-switch" : "ima-switch off", role: "switch", "aria-checked": Boolean(draft.receiveEnabled), "aria-label": "
|
|
1273
|
+
h("div", { className: "ima-switch-copy" }, h("strong", null, t("account.receive")), h("small", null, t("account.receiveDescription"))),
|
|
1274
|
+
h("button", { type: "button", className: draft.receiveEnabled ? "ima-switch" : "ima-switch off", role: "switch", "aria-checked": Boolean(draft.receiveEnabled), "aria-label": t("account.receive"), onClick: () => onAction(account.id, "receive", { receiveEnabled: !draft.receiveEnabled }) }, h("i")),
|
|
1260
1275
|
),
|
|
1261
|
-
h("div", { className: note === "
|
|
1276
|
+
h("div", { className: note === "status.saved" ? "ima-save-note ok" : "ima-save-note" }, note && t(note)),
|
|
1262
1277
|
h("div", { className: "ima-inspector-actions" },
|
|
1263
|
-
h("button", { className: "ima-btn", onClick: () => onAction(account.id, "check") }, "
|
|
1264
|
-
h("button", { className: "ima-btn", onClick: () => onAction(account.id, "reconnect") }, "
|
|
1265
|
-
h("button", { className: "ima-btn danger", onClick: () => { if (window.confirm("
|
|
1278
|
+
h("button", { className: "ima-btn", onClick: () => onAction(account.id, "check") }, t("action.checkConnection")),
|
|
1279
|
+
h("button", { className: "ima-btn", onClick: () => onAction(account.id, "reconnect") }, t("action.reconnectAccount")),
|
|
1280
|
+
h("button", { className: "ima-btn danger", onClick: () => { if (window.confirm(t("account.removeConfirm"))) onAction(account.id, "remove"); } }, t("action.removeAccount")),
|
|
1266
1281
|
),
|
|
1267
1282
|
),
|
|
1268
1283
|
);
|
|
@@ -1344,15 +1359,15 @@ window.__ModuleLoader__.load({
|
|
|
1344
1359
|
return h("section", { className: "ima-page ima-account-page", "aria-label": t("settings.aria") },
|
|
1345
1360
|
h("header", { className: "ima-head" },
|
|
1346
1361
|
h("div", null,
|
|
1347
|
-
h("h2", { className: "ima-title" }, "
|
|
1348
|
-
h("p", { className: "ima-sub" }, "
|
|
1362
|
+
h("h2", { className: "ima-title" }, t("settings.title")),
|
|
1363
|
+
h("p", { className: "ima-sub" }, t("settings.description")),
|
|
1349
1364
|
),
|
|
1350
1365
|
),
|
|
1351
1366
|
error && h("div", { className: "ima-error" }, error),
|
|
1352
1367
|
pending.length > 0 && h("div", { className: "ima-pending" },
|
|
1353
1368
|
h("div", null, t("pending.notice")),
|
|
1354
1369
|
...pending.map((p) => h("div", { key: p.channelId + p.userId, className: "ima-pending-row" },
|
|
1355
|
-
h("span", { style: { flex: 1 } }, (p.username || p.userId) + " · " + (allAccounts.find((item) => item.id === p.channelId)
|
|
1370
|
+
h("span", { style: { flex: 1 } }, (p.username || p.userId) + " · " + (accountLabel(allAccounts.find((item) => item.id === p.channelId), t) || p.channelId)),
|
|
1356
1371
|
h("button", { className: "ima-btn", onClick: () => onAction(p.channelId, "approve", { userId: p.userId }) }, t("action.approve")),
|
|
1357
1372
|
h("button", { className: "ima-btn", onClick: () => onAction(p.channelId, "deny", { userId: p.userId }) }, t("action.deny")),
|
|
1358
1373
|
)),
|
|
@@ -1366,26 +1381,26 @@ window.__ModuleLoader__.load({
|
|
|
1366
1381
|
const open = canExpand && Boolean(expanded[ch.id]);
|
|
1367
1382
|
const toggleExpanded = canExpand ? () => setExpanded({ ...expanded, [ch.id]: !open }) : undefined;
|
|
1368
1383
|
const channelStatus = ch.total === 0
|
|
1369
|
-
? { label: "
|
|
1384
|
+
? { label: t("account.countZero"), tone: "muted" }
|
|
1370
1385
|
: ch.online === ch.total
|
|
1371
|
-
? { label:
|
|
1386
|
+
? { label: t("account.countOnline", { online: ch.online, total: ch.total }), tone: "online" }
|
|
1372
1387
|
: ch.online === 0
|
|
1373
|
-
? { label:
|
|
1374
|
-
: { label:
|
|
1388
|
+
? { label: t("account.countOffline", { total: ch.total }), tone: "offline" }
|
|
1389
|
+
: { label: t("account.countOnline", { online: ch.online, total: ch.total }), tone: "partial" };
|
|
1375
1390
|
return h("div", { key: ch.id, className: "ima-platform" + (open ? " open" : "") + (canExpand ? "" : " empty") },
|
|
1376
1391
|
h("div", { className: "ima-platform-head", role: canExpand ? "button" : undefined, tabIndex: canExpand ? 0 : undefined, "aria-expanded": canExpand ? open : undefined, onClick: toggleExpanded, onKeyDown: canExpand ? (e) => { if (e.key === "Enter" || e.key === " ") { e.preventDefault(); toggleExpanded(); } } : undefined },
|
|
1377
1392
|
h(Logo, { id: ch.id }),
|
|
1378
1393
|
h("span", { className: "ima-platform-title" }, channelLabel(ch, t)),
|
|
1379
1394
|
h("span", { className: "ima-platform-count " + channelStatus.tone }, channelStatus.label),
|
|
1380
|
-
h("button", { className: "ima-platform-add", type: "button", onClick: (e) => { e.stopPropagation(); setEditing(ch.id); } }, "+
|
|
1395
|
+
h("button", { className: "ima-platform-add", type: "button", onClick: (e) => { e.stopPropagation(); setEditing(ch.id); } }, "+ " + t("action.addAccount")),
|
|
1381
1396
|
h("span", { className: canExpand ? "ima-platform-caret" : "ima-platform-caret empty", "aria-hidden": "true" }, canExpand && h(IconChevron)),
|
|
1382
1397
|
),
|
|
1383
1398
|
open && h("div", { className: "ima-account-list" },
|
|
1384
1399
|
...(ch.accounts || []).map((account) => h("button", { key: account.id, type: "button", className: account.id === selected ? "ima-account-row on" : "ima-account-row", onClick: () => selectAccount(account.id) },
|
|
1385
1400
|
h("span", { className: account.connected ? "ima-dot on" : "ima-dot" }),
|
|
1386
1401
|
h(Logo, { id: ch.id }),
|
|
1387
|
-
h("span", { className: "ima-account-copy" }, h("span", { className: "ima-account-name" }, account
|
|
1388
|
-
h("span", { className: busy[account.id] ? "ima-account-state" : account.connected ? "ima-account-state online" : "ima-account-state offline" }, busy[account.id] ? "
|
|
1402
|
+
h("span", { className: "ima-account-copy" }, h("span", { className: "ima-account-name" }, accountLabel(account, t)), h("span", { className: "ima-account-id" }, account.id)),
|
|
1403
|
+
h("span", { className: busy[account.id] ? "ima-account-state" : account.connected ? "ima-account-state online" : "ima-account-state offline" }, busy[account.id] ? t("account.statusProcessing") : account.connected ? t("account.statusOnline") : t("account.statusOffline")),
|
|
1389
1404
|
h("span", { className: "ima-account-next", "aria-hidden": "true" }, h(IconChevron)),
|
|
1390
1405
|
)),
|
|
1391
1406
|
),
|
package/lib/manager.d.ts
CHANGED
package/lib/manager.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../src/manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAOlD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAMvD,OAAO,EAAwE,KAAK,cAAc,EAAE,KAAK,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACjK,OAAO,KAAK,EAAkB,YAAY,EAAa,MAAM,mBAAmB,CAAA;AAIhF,eAAO,MAAM,iBAAiB,4BAA4B,CAAA;AAG1D,UAAU,iBAAiB;IACzB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC7B,SAAS,EAAE,OAAO,CAAA;IAClB,WAAW,EAAE,OAAO,CAAA;CACrB;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AAc;IAQtB,iBAAiB,IAAI,gBAAgB;IAKrC,OAAO,CAAC,eAAe;IAOvB,iBAAiB,IAAI,oBAAoB,EAAE;IAK3C,OAAO,CAAC,iBAAiB;YAIX,gBAAgB;YA6DhB,QAAQ;YA8DR,OAAO;YAQP,cAAc;YAcd,cAAc;YAed,wBAAwB;IAUtC,OAAO,CAAC,IAAI;IA0BZ,OAAO,CAAC,sBAAsB;IAiB9B,OAAO,CAAC,wBAAwB;IAkBhC,OAAO,CAAC,YAAY;IAgBpB,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,mBAAmB;IAe3B,eAAe,IAAI,KAAK,CAAC,cAAc,GAAG;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IAMhE,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO;IAa5C,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO;IASzC,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,oBAAoB;IAW5B,OAAO,CAAC,KAAK;CAGd"}
|
package/lib/manager.js
CHANGED
|
@@ -179,10 +179,16 @@ export class ChannelManager {
|
|
|
179
179
|
const adapter = this.running.get(accountId);
|
|
180
180
|
const status = adapter?.status() ?? state.lastError ?? (state.enabled ? '未连接' : '已停止');
|
|
181
181
|
const connected = adapter !== undefined && !status.includes('失败') && status !== '未连接' && status !== '已停止';
|
|
182
|
+
const defaultNamePrefix = `${CHANNEL_META[platform].label}账号`;
|
|
183
|
+
const name = String(state.name || defaultNamePrefix).trim();
|
|
184
|
+
const defaultNameSuffix = name.startsWith(`${defaultNamePrefix} `) ? name.slice(defaultNamePrefix.length + 1) : '';
|
|
185
|
+
const autoName = name === defaultNamePrefix || /^\d+$/.test(defaultNameSuffix);
|
|
182
186
|
return {
|
|
183
187
|
id: accountId,
|
|
184
188
|
platform,
|
|
185
|
-
name
|
|
189
|
+
name,
|
|
190
|
+
autoName,
|
|
191
|
+
...(autoName ? { nameOrdinal: Number(defaultNameSuffix || 1) } : {}),
|
|
186
192
|
connected,
|
|
187
193
|
receiveEnabled: connected && state.receiveEnabled !== false,
|
|
188
194
|
configuredKeys: Object.keys(config).filter((key) => Boolean(config[key]) && !key.endsWith('Ref')),
|