@michengai/dsh-im-connect 1.0.19 → 1.0.21

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.21 - 2026-10-30
4
+
5
+ - Add idle session auto-rotation: After a long pause in conversation, incoming messages can automatically start a fresh session, preventing previous conversation context from polluting new topics; previous sessions are preserved in history and can be resumed anytime via `/sessions` (PR #52).
6
+ - Per-account configuration: Added an "Idle session rotation" dropdown right below "Send mode" in each account's settings modal, supporting customizable thresholds (30 min, 1 hr, 2 hrs, 6 hrs, 12 hrs, 24 hrs, or Disabled); existing accounts default to Disabled to preserve original behavior.
7
+ - Running task safety protection: Sessions currently executing tasks are never interrupted or rotated, ensuring follow-up instructions for long tasks remain in the same context; slash commands such as `/sessions`, `/workspace`, and `/help` automatically refresh activity timing.
8
+ - Account settings UI polish: Removed redundant explanatory text beneath the segmented reply interval inputs, cleanly aligning the two-column settings form for a more compact layout.
9
+
10
+ ## 1.0.20 - 2026-10-29
11
+
12
+ - Fix missing settings navigation icon in latest DSH Alpha Web host: Eliminate dynamic React rendering and `<use>` sprite references, resolving an issue where browser SVG Data URL security sandboxing produced a 100% transparent mask.
13
+ - Align settings nav icon implementation with ecosystem standards: Adopt self-contained vector masks generated directly from official host `ChatLinesOutlineArtwork` paths, paired with pure attribute markers and standard CSS `mask` pseudo-element rules for robust visual consistency across host versions and skins.
14
+
3
15
  ## 1.0.19 - 2026-10-27
4
16
 
5
17
  - Add segmented replies: when set to "Send in segments" in an account's settings, the assistant splits one reply into several short messages at a line-exclusive separator (default `<<<MSG>>>`) and sends them sequentially; defaults to "Send as whole", preserving original behavior (#49).
@@ -4,6 +4,18 @@
4
4
 
5
5
  以下记录近期发布的版本。Git 标签与 GitHub Release 现已和这些条目同步;历史条目继续保留原始发布提交链接。
6
6
 
7
+ ## 1.0.21 - 2026-10-30
8
+
9
+ - 新增空闲超时自动新开会话功能:长时间未交流后再次发送新消息,助手可自动开启全新会话,避免旧会话上下文与新话题混杂;旧会话仍完好保留在历史中,随时可用 `/sessions` 命令切换找回(PR #52)。
10
+ - 支持账号独立配置:在账号「设置」弹窗中的「发送方式」下方新增「空闲新开会话」选项,支持按需配置超时时长(30分钟、1小时、2小时、6小时、12小时、24小时或关闭),各账号互不干扰;存量账号默认保持关闭,行为与以前完全一致。
11
+ - 会话安全保护机制:当旧会话当前正在执行任务时绝不切断或轮换,确保长任务的追问与补充要求仍在原会话中继续;执行 `/sessions`、`/workspace`、`/help` 等命令交互会自动刷新活跃计时。
12
+ - 账号设置界面优化:移除分段发送间隔输入框下方冗余的通栏文字,使表单双列网格自然对齐,界面更整洁紧凑。
13
+
14
+ ## 1.0.20 - 2026-10-29
15
+
16
+ - 修复最新 DSH Alpha Web 宿主下设置导航图标空白问题:彻底移除运行时 React 动态渲染与 `<use>` 隐式引用,解决独立 SVG Data URL 遮罩受浏览器跨文档安全沙箱限制导致图标 100% 透明空白的根因。
17
+ - 100% 对齐官方插件标准实现范式:重构设置侧栏导航图标注入逻辑,直接采用宿主官方原版会话气泡几何(`ChatLinesOutlineArtwork`)生成自包含的独立矢量 Mask,结合纯属性选择器标记与标准 CSS `mask` 伪元素渲染,确保各宿主版本与皮肤下稳定显现。
18
+
7
19
  ## 1.0.19 - 2026-10-27
8
20
 
9
21
  - 新增分段回复支持:账号「设置」中将「分段回复」选为「分段发送」后,助手按独占一行的分隔标记(默认 `<<<MSG>>>`)把一次回复拆成多条短消息逐条发送;默认保持「完整发送」,行为与以前一致(#49)。
package/README.md CHANGED
@@ -322,6 +322,14 @@ When **Segmented replies** is set to Send in segments for an account, the assist
322
322
  - **Separator**: set by the plugin configuration `segmentMarker`, default `<<<MSG>>>`, and must occupy its own line. The same text inside a fenced code block never splits a reply, so code samples stay intact.
323
323
  - **Where it is stored**: the toggle and range live per account in `channels.json`; the plugin configuration `segmentReply` acts as the default for every account, with the account setting taking precedence. If one segment fails to send, the rest stop instead of resending the whole reply, so no duplicate messages.
324
324
 
325
+ ### Idle session rotation
326
+
327
+ Groups and DMs bind one session per chat, so a message after a long pause easily continues the previous topic. Configure **Idle session rotation** right below Send mode in account settings; when more than that many minutes passed since the last user message, the next message starts a new session with a single notice in the chat. The previous session is kept and `/sessions` can switch back. The default is Disabled (keep session).
328
+
329
+ - A session that is still running is never rotated, so follow-up instructions for a long task stay in the same context; the switch happens before the next message is submitted.
330
+ - The timer is stored per chat as `lastInboundAt` in `sessions.json` and keeps counting across restarts; explicit `/new`, `/session`, and `/workspace` are unaffected.
331
+ - Configurable per account in settings (30 min, 1 hr, 2 hrs, 6 hrs, 12 hrs, 24 hrs, or Disabled).
332
+
325
333
  ### Connecting Slack
326
334
 
327
335
  Slack uses a Socket Mode long connection, so no public URL or request URL is required:
package/README.zh-CN.md CHANGED
@@ -316,6 +316,14 @@ Telegram 话题默认使用第一条非兜底会话标题自动命名一次,
316
316
  - **分隔标记**:由插件配置 `segmentMarker` 指定,默认 `<<<MSG>>>`,必须独占一行;围栏代码块里的同名标记不会触发分段,代码示例不会被拆散。
317
317
  - **配置位置**:开关和间隔按账号保存在 `channels.json`;插件配置 `segmentReply` 可作为所有账号的默认值,账号设置优先。分段发送中途失败就停止,不整条重发,避免重复消息。
318
318
 
319
+ ### 空闲新开会话
320
+
321
+ 群聊和私聊都按「聊天」绑定会话,隔了很久再说话容易接着上一个话题。在账号设置里的「发送方式」下方配置「空闲新开会话」,距上一条用户消息超过该时间后,下一条消息会新开一个会话,并在聊天里提示一次;旧会话照常保留,用 `/sessions` 可以切回。缺省为关闭(保持原会话),行为与以前一致。
322
+
323
+ - 旧会话仍在运行时不切换,避免把长任务的补充指令切进新上下文;切换发生在下一条消息提交之前。
324
+ - 计时按聊天持久化在 `sessions.json` 的 `lastInboundAt`,重启后继续累计;`/new`、`/session`、`/workspace` 等手动命令不受影响。
325
+ - 支持在账号设置弹窗中直接选择:30 分钟、1 小时、2 小时、6 小时、12 小时、24 小时或关闭。
326
+
319
327
  ### Slack 接入步骤
320
328
 
321
329
  Slack 走 Socket Mode 长连接,不需要公网地址,也不用配置请求网址:
package/client.js CHANGED
@@ -590,7 +590,7 @@ window.__ModuleLoader__.load({
590
590
  }
591
591
  const EMPTY_EXTRA_TABS = [];
592
592
  const inject = ["slots", "sessions", "workspaces", "locale"];
593
- const API_BASE = "/api/dsh-im-connect";
593
+ const API_BASE = "/api/michengai/dsh-im-connect";
594
594
  const TAB_KEY = "dsh-native-sidebar.tab";
595
595
  const ACCOUNT_SELECTION_KEY = "dsh-im-connect.settings.selected-account";
596
596
  const IM_LOCALE_NS = "im-connect";
@@ -619,7 +619,7 @@ window.__ModuleLoader__.load({
619
619
  "taskTreeSessions.entry.title": "在任务树显示 IM 会话", "taskTreeSessions.entry.desc": "在官方工作区任务树中显示各渠道会话。关闭后仅在侧栏「频道」页签中显示", "taskTreeSessions.entry.toggle": "切换在任务树显示 IM 会话",
620
620
  "settings.aria": "IM助理", "settings.publicChatNotice": "未批准用户可以发起聊天,但不能批准工具调用。", "pending.notice": "有访问请求。批准后该用户才能驱动本机助手。", "action.approve": "批准", "action.deny": "拒绝", "loading": "加载中…",
621
621
  "account.presetUnavailable": "预设不可用", "action.settings": "设置", "command.dm": "私聊命令", "command.group": "群聊命令", "command.enabled": "可以执行命令", "command.disabled": "仅正常对话",
622
- "account.workspace": "工作区", "account.currentWorkspace": "当前工作区", "account.selectWorkspace": "请选择工作区", "account.selectModel": "请选择模型", "account.selectPermission": "请选择权限", "account.privateAccess": "私聊准入", "account.privateApproved": "仅已批准用户", "account.privateAll": "允许所有私聊用户", "account.sendMode": "发送方式", "account.sendQueue": "排队发送", "account.sendSteer": "插话发送", "account.sendSteerNote": "插话发送会把消息作为补充指令立即交给运行中的任务;任务空闲时与排队发送相同。", "account.segmentReply": "分段回复", "account.segmentFull": "完整发送", "account.segmentSplit": "分段发送", "account.segmentReplyNote": "选择分段发送时助手会把一次回复拆成多条短消息,在分隔标记处切开逐条发送;完整发送时仍是一条完整回复。", "account.segmentGap": "发送间隔", "account.segmentGapMin": "最小间隔", "account.segmentGapMax": "最大间隔", "account.segmentGapNote": "每条分段消息之间会从这个区间里随机取一个间隔,单位秒,可直接填写。", "account.segmentGapInvalid": "请填写 0 到 60 之间的秒数", "account.segmentGapOrder": "上限不能低于下限", "account.seconds": "秒", "account.autoNameNote": "绑定成功后会自动生成账号名,无需手动填写。需要区分使用者时,可在账号行填写备注。", "account.proxyMode": "网络代理", "account.proxyInherit": "跟随宿主", "account.proxyDirect": "直接连接", "account.proxyCustom": "手动配置", "account.proxyUrl": "代理地址", "account.proxyNote": "仅影响当前账号;保存后自动重连生效。", "account.proxySaved": "代理地址已保存;留空保存可保留当前地址。", "account.defaultName": "{channel}账号 {count}",
622
+ "account.workspace": "工作区", "account.currentWorkspace": "当前工作区", "account.selectWorkspace": "请选择工作区", "account.selectModel": "请选择模型", "account.selectPermission": "请选择权限", "account.privateAccess": "私聊准入", "account.privateApproved": "仅已批准用户", "account.privateAll": "允许所有私聊用户", "account.sendMode": "发送方式", "account.sendQueue": "排队发送", "account.sendSteer": "插话发送", "account.sendSteerNote": "插话发送会把消息作为补充指令立即交给运行中的任务;任务空闲时与排队发送相同。", "account.sessionIdle": "空闲新开会话", "account.sessionIdleOff": "关闭(保持原会话)", "account.sessionIdleMin": "{n} 分钟", "account.sessionIdleHour": "{n} 小时", "account.sessionIdleHours": "{n} 小时", "account.sessionIdleNote": "距上一条消息超过该时间后再收到新消息,将开启新会话;旧会话仍可用 /sessions 找回。设为 0 表示关闭。", "account.segmentReply": "分段回复", "account.segmentFull": "完整发送", "account.segmentSplit": "分段发送", "account.segmentReplyNote": "选择分段发送时助手会把一次回复拆成多条短消息,在分隔标记处切开逐条发送;完整发送时仍是一条完整回复。", "account.segmentGap": "发送间隔", "account.segmentGapMin": "最小间隔", "account.segmentGapMax": "最大间隔", "account.segmentGapInvalid": "请填写 0 到 60 之间的秒数", "account.segmentGapOrder": "上限不能低于下限", "account.seconds": "秒", "account.autoNameNote": "绑定成功后会自动生成账号名,无需手动填写。需要区分使用者时,可在账号行填写备注。", "account.proxyMode": "网络代理", "account.proxyInherit": "跟随宿主", "account.proxyDirect": "直接连接", "account.proxyCustom": "手动配置", "account.proxyUrl": "代理地址", "account.proxyNote": "仅影响当前账号;保存后自动重连生效。", "account.proxySaved": "代理地址已保存;留空保存可保留当前地址。", "account.defaultName": "{channel}账号 {count}",
623
623
  "account.remark": "名称备注", "account.remarkNote": "只在本机设置页区分账号,留空恢复自动名称。", "account.rename": "修改名称备注",
624
624
  "account.count": "{count} 个账号", "account.statusProcessing": "处理中…", "account.statusNotConnected": "未连接", "account.receive": "接收消息", "account.receiveDescription": "关闭后保留账号配置,但不接收新消息", "account.removeConfirm": "确定移除这个账号?本机保存的配置和凭据将一并删除。",
625
625
  "action.addAccount": "添加账号", "action.generateQr": "生成二维码", "action.checkConnection": "诊断连接", "action.reconnectAccount": "重新连接", "action.removeAccount": "移除接入", "status.saving": "保存中…", "status.saved": "已保存",
@@ -651,7 +651,7 @@ window.__ModuleLoader__.load({
651
651
  "taskTreeSessions.entry.title": "Show IM sessions in task tree", "taskTreeSessions.entry.desc": "Show messaging channel sessions in the official workspace task tree. When disabled, sessions are shown only under the 'Channels' tab.", "taskTreeSessions.entry.toggle": "Toggle show IM sessions in task tree",
652
652
  "settings.aria": "IM Assistant", "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…",
653
653
  "account.presetUnavailable": "Preset unavailable", "action.settings": "Settings", "command.dm": "DM commands", "command.group": "Group commands", "command.enabled": "Commands enabled", "command.disabled": "Conversation only",
654
- "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.sendMode": "Send mode", "account.sendQueue": "Queue", "account.sendSteer": "Steer", "account.sendSteerNote": "Steer hands the message to the running task as additional instructions at its next step; when the task is idle it behaves like Queue.", "account.segmentReply": "Segmented replies", "account.segmentFull": "Send as whole", "account.segmentSplit": "Send in segments", "account.segmentReplyNote": "When set to Send in segments, the assistant splits one reply into several short messages at the separator and sends them one by one; Send as whole keeps the entire reply in a single message.", "account.segmentGap": "Send gap", "account.segmentGapMin": "Minimum gap", "account.segmentGapMax": "Maximum gap", "account.segmentGapNote": "Each segmented message waits a random gap inside this range, in seconds. Type the values directly.", "account.segmentGapInvalid": "Enter a number of seconds between 0 and 60.", "account.segmentGapOrder": "The maximum gap cannot be lower than the minimum.", "account.seconds": "s", "account.autoNameNote": "The account name is generated automatically after setup. Add a remark on the account row if you need to tell users apart.", "account.proxyMode": "Network proxy", "account.proxyInherit": "Follow Host", "account.proxyDirect": "Connect directly", "account.proxyCustom": "Configure manually", "account.proxyUrl": "Proxy address", "account.proxyNote": "Affects only this account. The channel reconnects automatically after saving.", "account.proxySaved": "A proxy address is saved. Leave the field blank to keep it.", "account.defaultName": "{channel} account {count}",
654
+ "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.sendMode": "Send mode", "account.sendQueue": "Queue", "account.sendSteer": "Steer", "account.sendSteerNote": "Steer hands the message to the running task as additional instructions at its next step; when the task is idle it behaves like Queue.", "account.sessionIdle": "Idle session rotation", "account.sessionIdleOff": "Disabled (keep session)", "account.sessionIdleMin": "{n} min", "account.sessionIdleHour": "{n} hr", "account.sessionIdleHours": "{n} hrs", "account.sessionIdleNote": "Start a new session when the next message arrives after this idle period; previous sessions remain accessible via /sessions. Set to 0 to disable.", "account.segmentReply": "Segmented replies", "account.segmentFull": "Send as whole", "account.segmentSplit": "Send in segments", "account.segmentReplyNote": "When set to Send in segments, the assistant splits one reply into several short messages at the separator and sends them one by one; Send as whole keeps the entire reply in a single message.", "account.segmentGap": "Send gap", "account.segmentGapMin": "Minimum gap", "account.segmentGapMax": "Maximum gap", "account.segmentGapInvalid": "Enter a number of seconds between 0 and 60.", "account.segmentGapOrder": "The maximum gap cannot be lower than the minimum.", "account.seconds": "s", "account.autoNameNote": "The account name is generated automatically after setup. Add a remark on the account row if you need to tell users apart.", "account.proxyMode": "Network proxy", "account.proxyInherit": "Follow Host", "account.proxyDirect": "Connect directly", "account.proxyCustom": "Configure manually", "account.proxyUrl": "Proxy address", "account.proxyNote": "Affects only this account. The channel reconnects automatically after saving.", "account.proxySaved": "A proxy address is saved. Leave the field blank to keep it.", "account.defaultName": "{channel} account {count}",
655
655
  "account.remark": "Name remark", "account.remarkNote": "Shown only in settings to tell accounts apart. Leave blank to restore the automatic name.", "account.rename": "Edit name remark",
656
656
  "account.count": "{count} accounts", "account.statusProcessing": "Processing…", "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.",
657
657
  "action.addAccount": "Add account", "action.generateQr": "Generate QR code", "action.checkConnection": "Diagnose connection", "action.reconnectAccount": "Reconnect", "action.removeAccount": "Remove", "status.saving": "Saving…", "status.saved": "Saved",
@@ -677,6 +677,10 @@ window.__ModuleLoader__.load({
677
677
  return children;
678
678
  }
679
679
 
680
+ const QUEUE_ICON_PATHS = '<path d="M5 6.75H11"/><path d="M5 9H8"/><path d="M2.37067 11.2497C1.5872 9.89252 1.32042 8.29798 1.61945 6.7597C1.91847 5.22141 2.76317 3.84293 3.99801 2.87809C5.23285 1.91325 6.7747 1.427 8.33964 1.50888C9.90458 1.59076 11.3873 2.23526 12.5147 3.32369C13.6422 4.41232 14.3384 5.8717 14.4751 7.43304C14.6118 8.99438 14.1797 10.5525 13.2585 11.8205C12.3372 13.0885 10.9889 13.9809 9.4617 14.3334C8.18666 14.6277 6.8587 14.529 5.64964 14.0601C5.17095 13.8745 4.76937 13.4929 4.26509 13.3963C3.67389 13.2832 2.95232 13.5595 2.0377 14.3334"/>';
681
+ const QUEUE_ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="black" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round">${QUEUE_ICON_PATHS}</svg>`;
682
+ const QUEUE_ICON_MASK = `url("data:image/svg+xml,${encodeURIComponent(QUEUE_ICON_SVG)}")`;
683
+
680
684
  const CSS = `
681
685
  .ima-page,.ima-account-modal,.ima-bind-modal,.ima-inspector{--ima-text:var(--dsw-alias-label-primary,var(--dsh-text,#e6edf3));--ima-muted:var(--dsw-alias-label-tertiary,var(--dsh-text-muted,#8b949e));--ima-line:var(--dsw-alias-border-l2,var(--dsh-border,rgba(255,255,255,.1)));--ima-card:var(--dsw-alias-bg-layer-2,rgba(255,255,255,.04));--ima-card-hover:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06));--ima-ok:var(--dsw-alias-state-success-primary,#3fb950);--ima-warning:var(--dsw-alias-state-warning-primary,#d29922);--ima-danger:var(--dsw-alias-state-error-primary,#f85149);--ima-accent:var(--dsw-alias-brand-primary,#4b7cff)}
682
686
  .ima-page{box-sizing:border-box;max-width:none;width:100%;margin:0;padding:0 0 32px;color:var(--ima-text)}
@@ -686,7 +690,7 @@ window.__ModuleLoader__.load({
686
690
  .ima-title-links{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
687
691
  .ima-title-links>span[data-mpi-check]{display:inline-flex;align-items:center}
688
692
  [data-ima-nav-icon]>svg{display:none!important}
689
- [data-ima-nav-icon]::before{content:'';flex:none;width:16px;height:16px;background:currentColor;-webkit-mask:var(--ima-nav-icon-mask) center/contain no-repeat;mask:var(--ima-nav-icon-mask) center/contain no-repeat;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-position:center;mask-position:center;-webkit-mask-size:16px 16px;mask-size:16px 16px}
693
+ [data-ima-nav-icon]::before{content:'';flex:none;width:16px;height:16px;background-color:currentColor;-webkit-mask:${QUEUE_ICON_MASK} center/contain no-repeat;mask:${QUEUE_ICON_MASK} center/contain no-repeat;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-position:center;mask-position:center;-webkit-mask-size:16px 16px;mask-size:16px 16px}
690
694
  .ima-btn{display:inline-flex;align-items:center;justify-content:center;gap:4px;height:32px;padding:0 12px;border:0.5px solid var(--dsw-alias-border-l3,#555);border-radius:var(--dsw-radius-sm,8px);background:transparent;color:var(--dsw-alias-label-primary,#eee);font:inherit;font-size:13px;line-height:20px;cursor:pointer;user-select:none;box-sizing:border-box;text-decoration:none;transition:border-color 120ms ease,color 120ms ease,background 120ms ease}
691
695
  .ima-btn:not(.is-primary):not(.ima-btn-danger){color:var(--dsw-alias-label-primary,#eee)!important}
692
696
  .ima-btn:hover:not(:disabled):not(.ima-btn-danger){border-color:var(--dsw-alias-border-l3,#666)!important;color:var(--dsw-alias-label-primary,#fff)!important;background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06))!important}
@@ -1861,6 +1865,49 @@ window.__ModuleLoader__.load({
1861
1865
  : tipAnchor,
1862
1866
  );
1863
1867
 
1868
+ const sessionIdleMinutes = Number.isFinite(value.sessionIdleMinutes) ? Math.max(0, Math.round(value.sessionIdleMinutes)) : 0;
1869
+ const sessionIdleTip = t("account.sessionIdleNote");
1870
+ const sessionIdleTipAnchor = h("span", {
1871
+ className: "ima-label-tip",
1872
+ title: HostTooltip ? undefined : sessionIdleTip,
1873
+ "aria-label": sessionIdleTip,
1874
+ role: "button",
1875
+ tabIndex: 0,
1876
+ style: {
1877
+ display: "inline-flex",
1878
+ alignItems: "center",
1879
+ cursor: "help",
1880
+ color: "var(--dsw-alias-label-tertiary, var(--ima-muted))",
1881
+ marginLeft: 2,
1882
+ },
1883
+ }, h(IconInfoOutline, { size: 12 }));
1884
+
1885
+ const sessionIdleLabel = h("span", { style: { display: "inline-flex", alignItems: "center", gap: 4 } },
1886
+ h("span", null, t("account.sessionIdle")),
1887
+ HostTooltip
1888
+ ? h(HostTooltip, { label: sessionIdleTip, portal: true, side: "top" }, sessionIdleTipAnchor)
1889
+ : sessionIdleTipAnchor,
1890
+ );
1891
+
1892
+ const standardIdlePresets = [0, 30, 60, 120, 360, 720, 1440];
1893
+ const sessionIdleOptions = standardIdlePresets.map((mins) => {
1894
+ if (mins === 0) return { value: "0", label: t("account.sessionIdleOff") };
1895
+ if (mins < 60) return { value: String(mins), label: t("account.sessionIdleMin", { n: mins }) };
1896
+ const hours = mins / 60;
1897
+ return {
1898
+ value: String(mins),
1899
+ label: hours === 1 ? t("account.sessionIdleHour", { n: hours }) : t("account.sessionIdleHours", { n: hours }),
1900
+ };
1901
+ });
1902
+ if (sessionIdleMinutes > 0 && !standardIdlePresets.includes(sessionIdleMinutes)) {
1903
+ sessionIdleOptions.splice(1, 0, {
1904
+ value: String(sessionIdleMinutes),
1905
+ label: sessionIdleMinutes % 60 === 0
1906
+ ? t("account.sessionIdleHours", { n: sessionIdleMinutes / 60 })
1907
+ : t("account.sessionIdleMin", { n: sessionIdleMinutes }),
1908
+ });
1909
+ }
1910
+
1864
1911
  return h("div", { className: "ima-account-settings" + (props.compact ? " compact" : "") },
1865
1912
  field("workspace", props.workspaceLabel || t("account.workspace"), items.length === 0
1866
1913
  ? h("div", null,
@@ -1949,6 +1996,13 @@ window.__ModuleLoader__.load({
1949
1996
  ],
1950
1997
  onChange: (next) => update({ sendMode: next }),
1951
1998
  })),
1999
+ field("sessionIdle", sessionIdleLabel, h(Select, {
2000
+ className: "ima-account-picker",
2001
+ value: String(sessionIdleMinutes),
2002
+ "aria-label": t("account.sessionIdle"),
2003
+ options: sessionIdleOptions,
2004
+ onChange: (next) => update({ sessionIdleMinutes: Number(next) }),
2005
+ })),
1952
2006
  segmentSupported && field("segmentReply", segmentReplyLabel, h(Select, {
1953
2007
  className: "ima-account-picker",
1954
2008
  value: segmentReply ? "segmented" : "full",
@@ -1993,7 +2047,6 @@ window.__ModuleLoader__.load({
1993
2047
  h("span", { className: "ima-segment-gap-unit" }, t("account.seconds")),
1994
2048
  )),
1995
2049
  segmentSupported && segmentReply && segmentGapError && h("div", { className: "ima-picker-note warning" }, segmentGapError),
1996
- segmentSupported && segmentReply && h("div", { className: "ima-picker-note" }, t("account.segmentGapNote")),
1997
2050
  privateAccess === "all" && h("div", { className: "ima-picker-note warning" }, t("settings.publicChatNotice")),
1998
2051
  hint && h("div", { className: "ima-picker-note" }, hint),
1999
2052
  props.showAutoNameNote && h("div", { className: "ima-picker-note" }, t("account.autoNameNote")),
@@ -2101,7 +2154,7 @@ window.__ModuleLoader__.load({
2101
2154
  setDraft(account);
2102
2155
  setProxyModeDraft(account.proxyMode || "inherit");
2103
2156
  setNote("");
2104
- }, [account.id, account.cwd, account.permission, account.agentPreset, account.privateAccess, account.sendMode, account.segmentReply, account.segmentDelayMinSecs, account.segmentDelayMaxSecs, account.proxyMode, account.proxyConfigured, JSON.stringify(account.commandPermissions), account.receiveEnabled, account.assistant && account.assistant.provider, account.assistant && account.assistant.model, account.assistant && account.assistant.reasoningEffort]);
2157
+ }, [account.id, account.cwd, account.permission, account.agentPreset, account.privateAccess, account.sendMode, account.sessionIdleMinutes, account.segmentReply, account.segmentDelayMinSecs, account.segmentDelayMaxSecs, account.proxyMode, account.proxyConfigured, JSON.stringify(account.commandPermissions), account.receiveEnabled, account.assistant && account.assistant.provider, account.assistant && account.assistant.model, account.assistant && account.assistant.reasoningEffort]);
2105
2158
  useEffect(() => {
2106
2159
  setProxyUrlDraft(account.proxyUrl || "");
2107
2160
  }, [account.id, account.proxyUrl]);
@@ -2120,6 +2173,7 @@ window.__ModuleLoader__.load({
2120
2173
  permission: next.permission,
2121
2174
  privateAccess: next.privateAccess,
2122
2175
  sendMode: next.sendMode,
2176
+ sessionIdleMinutes: Number.isFinite(next.sessionIdleMinutes) ? Math.max(0, Math.round(next.sessionIdleMinutes)) : 0,
2123
2177
  segmentReply: next.segmentReply === true,
2124
2178
  segmentDelayMinSecs: next.segmentDelayMinSecs,
2125
2179
  segmentDelayMaxSecs: next.segmentDelayMaxSecs,
@@ -2855,15 +2909,6 @@ window.__ModuleLoader__.load({
2855
2909
  return css;
2856
2910
  }
2857
2911
 
2858
- let settingsNavIconMaskValue;
2859
- /** 设置导航图标:用宿主 IconQueueOutline 的几何生成 mask,保持皮肤安全。 */
2860
- function settingsNavIconMask() {
2861
- if (settingsNavIconMaskValue !== undefined) return settingsNavIconMaskValue;
2862
- const markup = channelMarkup(h(IconQueueOutline, { size: 16 })).split("currentColor").join("#000");
2863
- settingsNavIconMaskValue = `url("data:image/svg+xml,${encodeURIComponent(markup)}")`;
2864
- return settingsNavIconMaskValue;
2865
- }
2866
-
2867
2912
  /**
2868
2913
  * 官方视图选项菜单没有扩展位,注入第四个分组项「按频道」。
2869
2914
  * 只在频道页签挂载期间生效。
@@ -4148,19 +4193,51 @@ window.__ModuleLoader__.load({
4148
4193
  };
4149
4194
 
4150
4195
  const NAV_ICON_MARKER = "data-ima-nav-icon";
4151
- const NAV_ROW_SELECTOR = '[role="dialog"] nav button';
4196
+ const NAV_ROW_SELECTOR = '[role="dialog"] nav button, [data-shortcut-modal="settings"] nav button';
4197
+ const NAV_ICON_STYLE_ID = "ima-settings-nav-icon-style";
4198
+ const KNOWN_NAV_LABELS = new Set(["im助理", "imassistant"]);
4199
+
4200
+ const QUEUE_ICON_PATHS = '<path d="M5 6.75H11"/><path d="M5 9H8"/><path d="M2.37067 11.2497C1.5872 9.89252 1.32042 8.29798 1.61945 6.7597C1.91847 5.22141 2.76317 3.84293 3.99801 2.87809C5.23285 1.91325 6.7747 1.427 8.33964 1.50888C9.90458 1.59076 11.3873 2.23526 12.5147 3.32369C13.6422 4.41232 14.3384 5.8717 14.4751 7.43304C14.6118 8.99438 14.1797 10.5525 13.2585 11.8205C12.3372 13.0885 10.9889 13.9809 9.4617 14.3334C8.18666 14.6277 6.8587 14.529 5.64964 14.0601C5.17095 13.8745 4.76937 13.4929 4.26509 13.3963C3.67389 13.2832 2.95232 13.5595 2.0377 14.3334"/>';
4201
+ const QUEUE_ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="black" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round">${QUEUE_ICON_PATHS}</svg>`;
4202
+ const QUEUE_ICON_MASK = `url("data:image/svg+xml,${encodeURIComponent(QUEUE_ICON_SVG)}")`;
4203
+
4204
+ const NAV_ICON_CSS = `[${NAV_ICON_MARKER}]>svg{display:none!important}[${NAV_ICON_MARKER}]::before{content:'';flex:none;width:16px;height:16px;background-color:currentColor;-webkit-mask:${QUEUE_ICON_MASK} center/contain no-repeat;mask:${QUEUE_ICON_MASK} center/contain no-repeat;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-position:center;mask-position:center;-webkit-mask-size:16px 16px;mask-size:16px 16px}`;
4205
+
4206
+ function ensureNavIconStyle(doc) {
4207
+ const targetDoc = doc || (typeof document !== "undefined" ? document : null);
4208
+ if (!targetDoc || typeof targetDoc.getElementById !== "function") return;
4209
+ if (targetDoc.getElementById(NAV_ICON_STYLE_ID) !== null) return;
4210
+ const style = typeof targetDoc.createElement === "function" ? targetDoc.createElement("style") : null;
4211
+ if (!style) return;
4212
+ style.id = NAV_ICON_STYLE_ID;
4213
+ style.textContent = NAV_ICON_CSS;
4214
+ const targetParent = targetDoc.head ?? targetDoc.documentElement;
4215
+ if (targetParent && typeof targetParent.appendChild === "function") {
4216
+ targetParent.appendChild(style);
4217
+ }
4218
+ }
4219
+
4220
+ function getNavButtonText(button) {
4221
+ if (!button) return "";
4222
+ const span = typeof button.querySelector === "function" ? button.querySelector("span") : null;
4223
+ const label = span && span.textContent ? span.textContent : button.textContent;
4224
+ return String(label ?? "").trim();
4225
+ }
4152
4226
 
4153
4227
  function isOwnNavRow(rowText, wantedLabel) {
4154
- const wanted = String(wantedLabel ?? "").trim();
4155
- if (wanted.length === 0) return false;
4156
- const current = String(rowText ?? "").trim();
4157
- return current === wanted;
4228
+ const normRow = String(rowText ?? "").replace(/\s+/g, "").toLowerCase();
4229
+ if (normRow.length === 0) return false;
4230
+ const normWanted = String(wantedLabel ?? "").replace(/\s+/g, "").toLowerCase();
4231
+ if (normWanted.length > 0 && normWanted !== "settings.label" && !KNOWN_NAV_LABELS.has(normWanted)) {
4232
+ return false;
4233
+ }
4234
+ if (KNOWN_NAV_LABELS.has(normRow)) return true;
4235
+ return normWanted.length > 0 && normRow === normWanted;
4158
4236
  }
4159
4237
 
4160
4238
  function applySettingsNavIcon(button, wantedLabel) {
4161
- const isOwn = isOwnNavRow(button.textContent, wantedLabel());
4239
+ const isOwn = isOwnNavRow(getNavButtonText(button), typeof wantedLabel === "function" ? wantedLabel() : wantedLabel);
4162
4240
  if (isOwn) {
4163
- button.style.setProperty("--ima-nav-icon-mask", settingsNavIconMask());
4164
4241
  if (button.getAttribute(NAV_ICON_MARKER) === "") return false;
4165
4242
  button.setAttribute(NAV_ICON_MARKER, "");
4166
4243
  return true;
@@ -4180,6 +4257,7 @@ window.__ModuleLoader__.load({
4180
4257
 
4181
4258
  function installSettingsNavIcon(targetCtx, resolveLabel) {
4182
4259
  if (typeof document === "undefined") return;
4260
+ ensureNavIconStyle(document);
4183
4261
  targetCtx.effect(() => {
4184
4262
  let disposed = false;
4185
4263
  let scheduled = false;
@@ -4187,6 +4265,7 @@ window.__ModuleLoader__.load({
4187
4265
  const sync = () => {
4188
4266
  scheduled = false;
4189
4267
  if (disposed) return;
4268
+ ensureNavIconStyle(document);
4190
4269
  for (const row of document.querySelectorAll(NAV_ROW_SELECTOR)) {
4191
4270
  applySettingsNavIcon(row, resolveLabel);
4192
4271
  }
@@ -4199,8 +4278,9 @@ window.__ModuleLoader__.load({
4199
4278
  };
4200
4279
 
4201
4280
  sync();
4281
+ const targetRoot = document.documentElement || document.body;
4202
4282
  const observer = new MutationObserver(schedule);
4203
- observer.observe(document.body, { childList: true, subtree: true, characterData: true });
4283
+ observer.observe(targetRoot, { childList: true, subtree: true, characterData: true });
4204
4284
 
4205
4285
  return () => {
4206
4286
  disposed = true;
package/lib/api-base.d.ts CHANGED
@@ -13,7 +13,7 @@
13
13
  /**
14
14
  * 解析插件端点 URL。
15
15
  *
16
- * @param path 端点路径,通常是 "/api/dsh-im-connect/xxx" 这类根绝对路径。
16
+ * @param path 端点路径,通常是 "/api/michengai/dsh-im-connect/xxx" 这类根绝对路径。
17
17
  * @returns 基于页面 base 的绝对 URL;相对路径、完整 URL、协议相对 URL、无 document
18
18
  * 或 base 非法时原样返回,保证非浏览器环境与测试夹具行为不变。
19
19
  */
package/lib/api-base.js CHANGED
@@ -31,7 +31,7 @@ function pageBaseHref() {
31
31
  /**
32
32
  * 解析插件端点 URL。
33
33
  *
34
- * @param path 端点路径,通常是 "/api/dsh-im-connect/xxx" 这类根绝对路径。
34
+ * @param path 端点路径,通常是 "/api/michengai/dsh-im-connect/xxx" 这类根绝对路径。
35
35
  * @returns 基于页面 base 的绝对 URL;相对路径、完整 URL、协议相对 URL、无 document
36
36
  * 或 base 非法时原样返回,保证非浏览器环境与测试夹具行为不变。
37
37
  */