@michengai/dsh-im-connect 1.0.18 → 1.0.19
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 +9 -0
- package/CHANGELOG.zh-CN.md +9 -0
- package/README.md +19 -2
- package/README.zh-CN.md +19 -2
- package/assets/icon.svg +27 -0
- package/client.js +300 -8
- package/lib/channels/meta.d.ts +7 -0
- package/lib/channels/meta.d.ts.map +1 -1
- package/lib/channels/meta.js +11 -0
- package/lib/channels/meta.js.map +1 -1
- package/lib/client.js +300 -8
- package/lib/engine/command-messages.d.ts +1 -0
- package/lib/engine/command-messages.d.ts.map +1 -1
- package/lib/engine/command-messages.js +1 -0
- package/lib/engine/command-messages.js.map +1 -1
- package/lib/engine/gateway.d.ts +16 -0
- package/lib/engine/gateway.d.ts.map +1 -1
- package/lib/engine/gateway.js +94 -3
- package/lib/engine/gateway.js.map +1 -1
- package/lib/engine/router.js +1 -1
- package/lib/engine/router.js.map +1 -1
- package/lib/engine/segments.d.ts +20 -0
- package/lib/engine/segments.d.ts.map +1 -0
- package/lib/engine/segments.js +80 -0
- package/lib/engine/segments.js.map +1 -0
- package/lib/engine/session-id.d.ts +11 -3
- package/lib/engine/session-id.d.ts.map +1 -1
- package/lib/engine/session-id.js +16 -10
- package/lib/engine/session-id.js.map +1 -1
- package/lib/engine/types.d.ts +8 -0
- package/lib/engine/types.d.ts.map +1 -1
- package/lib/index.d.ts +9 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +41 -1
- package/lib/index.js.map +1 -1
- package/lib/manager.d.ts +17 -0
- package/lib/manager.d.ts.map +1 -1
- package/lib/manager.js +79 -3
- package/lib/manager.js.map +1 -1
- package/package.json +3 -2
- package/src/channels/meta.ts +16 -0
- package/src/engine/command-messages.ts +2 -0
- package/src/engine/gateway.ts +92 -3
- package/src/engine/router.ts +1 -1
- package/src/engine/segments.ts +85 -0
- package/src/engine/session-id.ts +17 -11
- package/src/engine/types.ts +8 -0
- package/src/index.ts +55 -0
- package/src/manager.ts +92 -4
package/client.js
CHANGED
|
@@ -14,6 +14,7 @@ window.__ModuleLoader__.load({
|
|
|
14
14
|
const HostMenu = primitives.Menu;
|
|
15
15
|
const HostModal = primitives.Modal;
|
|
16
16
|
const HostSegmentedTabs = primitives.SegmentedTabs;
|
|
17
|
+
const HostTooltip = primitives.Tooltip;
|
|
17
18
|
const PrimitiveSwitch = primitives.Switch;
|
|
18
19
|
// 宿主 Button 由 forwardRef 包成对象,typeof 是 object,不是 function。
|
|
19
20
|
function isHostComponent(component) {
|
|
@@ -418,6 +419,9 @@ window.__ModuleLoader__.load({
|
|
|
418
419
|
}
|
|
419
420
|
|
|
420
421
|
const IconSettingsOutline16 = pickHostIcon("IconSettingsOutlineRegular", "IconSettingsOutline16");
|
|
422
|
+
// 已通过逐条投递验证的渠道,与宿主端 channels/meta.ts 的 supportsSegmentReply 保持一致。
|
|
423
|
+
const SEGMENT_REPLY_PLATFORMS = ["qq"];
|
|
424
|
+
const supportsSegmentReply = (platform) => SEGMENT_REPLY_PLATFORMS.indexOf(platform) >= 0;
|
|
421
425
|
const CHANNEL_SETTINGS_EVENT = "dsh-im-connect:open-channel-settings";
|
|
422
426
|
const CHANNEL_SETTINGS_STORAGE_KEY = "dsh-im-connect:pending-channel-settings";
|
|
423
427
|
const SETTINGS_CODEX_TRIGGER_SELECTOR = "[data-dcu-settings-trigger]";
|
|
@@ -612,9 +616,10 @@ window.__ModuleLoader__.load({
|
|
|
612
616
|
"settings.label": "IM助理", "settings.title": "IM助理", "settings.description": "管理各渠道账号。每个账号独立选择工作区、模型和权限,配置仅保存在本机。", "settings.viewProject": "GitHub", "settings.feedback": "问题反馈",
|
|
613
617
|
"sidebar.entry.title": "侧边栏入口", "sidebar.entry.desc": "在侧栏显示即时通讯管理入口。设置里的入口不变。", "sidebar.entry.toggle": "切换侧边栏入口",
|
|
614
618
|
"update.entry.title": "在线更新", "update.entry.desc": "允许检查并在线安装即时通讯插件的新版本。关闭后隐藏更新入口。", "update.entry.toggle": "切换在线更新", "error.update.disabled": "在线更新已被禁用",
|
|
619
|
+
"taskTreeSessions.entry.title": "在任务树显示 IM 会话", "taskTreeSessions.entry.desc": "在官方工作区任务树中显示各渠道会话。关闭后仅在侧栏「频道」页签中显示", "taskTreeSessions.entry.toggle": "切换在任务树显示 IM 会话",
|
|
615
620
|
"settings.aria": "IM助理", "settings.publicChatNotice": "未批准用户可以发起聊天,但不能批准工具调用。", "pending.notice": "有访问请求。批准后该用户才能驱动本机助手。", "action.approve": "批准", "action.deny": "拒绝", "loading": "加载中…",
|
|
616
|
-
"account.presetUnavailable": "预设不可用", "
|
|
617
|
-
"account.workspace": "工作区", "account.currentWorkspace": "当前工作区", "account.selectWorkspace": "请选择工作区", "account.selectModel": "请选择模型", "account.selectPermission": "请选择权限", "account.privateAccess": "私聊准入", "account.privateApproved": "仅已批准用户", "account.privateAll": "允许所有私聊用户",
|
|
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}",
|
|
618
623
|
"account.remark": "名称备注", "account.remarkNote": "只在本机设置页区分账号,留空恢复自动名称。", "account.rename": "修改名称备注",
|
|
619
624
|
"account.count": "{count} 个账号", "account.statusProcessing": "处理中…", "account.statusNotConnected": "未连接", "account.receive": "接收消息", "account.receiveDescription": "关闭后保留账号配置,但不接收新消息", "account.removeConfirm": "确定移除这个账号?本机保存的配置和凭据将一并删除。",
|
|
620
625
|
"action.addAccount": "添加账号", "action.generateQr": "生成二维码", "action.checkConnection": "诊断连接", "action.reconnectAccount": "重新连接", "action.removeAccount": "移除接入", "status.saving": "保存中…", "status.saved": "已保存",
|
|
@@ -643,9 +648,10 @@ window.__ModuleLoader__.load({
|
|
|
643
648
|
"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",
|
|
644
649
|
"sidebar.entry.title": "Sidebar entry", "sidebar.entry.desc": "Show IM Connect in the sidebar. The Settings entry stays either way.", "sidebar.entry.toggle": "Toggle sidebar entry",
|
|
645
650
|
"update.entry.title": "Online updates", "update.entry.desc": "Allow checking and installing new versions online. Hides the update entry when disabled.", "update.entry.toggle": "Toggle online updates", "error.update.disabled": "Online updates are disabled",
|
|
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",
|
|
646
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…",
|
|
647
|
-
"account.presetUnavailable": "Preset unavailable", "
|
|
648
|
-
"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",
|
|
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}",
|
|
649
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",
|
|
650
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.",
|
|
651
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",
|
|
@@ -814,6 +820,9 @@ window.__ModuleLoader__.load({
|
|
|
814
820
|
把宿主的 content 区设为滚动容器,footer 保持在容器外可见。 */
|
|
815
821
|
.ima-bind-modal>.ima-modal-content,.ima-account-modal>.ima-modal-content{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-gutter:stable}
|
|
816
822
|
.ima-account-settings{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px 16px;width:100%;box-sizing:border-box}
|
|
823
|
+
.ima-segment-gap{display:flex;align-items:center;gap:8px;width:100%}
|
|
824
|
+
.ima-segment-gap-input{flex:1 1 0;min-width:0}
|
|
825
|
+
.ima-segment-gap-sep,.ima-segment-gap-unit{color:var(--ima-muted, #8a8a8a);white-space:nowrap}
|
|
817
826
|
.ima-account-settings.compact{grid-template-columns:1fr}
|
|
818
827
|
.ima-proxy-settings{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px 16px;width:100%;box-sizing:border-box}
|
|
819
828
|
.ima-proxy-settings>.ima-picker-note{grid-column:1/-1}
|
|
@@ -899,6 +908,7 @@ window.__ModuleLoader__.load({
|
|
|
899
908
|
const value = String(sessionId || "");
|
|
900
909
|
const mapped = channelSessionChannels.get(value);
|
|
901
910
|
if (mapped) return mapped;
|
|
911
|
+
// 统一 UUID 不含渠道信息,映射未到达前只能返回空;旧语义 ID 仍可从字符串反解。
|
|
902
912
|
if (!value.startsWith("im:")) return undefined;
|
|
903
913
|
const rest = value.slice(3);
|
|
904
914
|
const split = rest.indexOf(":");
|
|
@@ -906,7 +916,11 @@ window.__ModuleLoader__.load({
|
|
|
906
916
|
const platform = instance.split("_", 1)[0];
|
|
907
917
|
return platform || undefined;
|
|
908
918
|
}
|
|
909
|
-
|
|
919
|
+
// 新旧两代 IM 前缀都要认,否则存量会话升级后会掉出渠道页签。
|
|
920
|
+
const isChannelSession = (id) => {
|
|
921
|
+
const value = String(id);
|
|
922
|
+
return value.startsWith("dsh-im-session-") || value.startsWith("im:") || channelSessionIds.has(value);
|
|
923
|
+
};
|
|
910
924
|
const subscribeChannelMembership = (listener) => {
|
|
911
925
|
channelMembershipListeners.add(listener);
|
|
912
926
|
return () => channelMembershipListeners.delete(listener);
|
|
@@ -1411,6 +1425,9 @@ window.__ModuleLoader__.load({
|
|
|
1411
1425
|
permission: defaults && defaults.permission || "",
|
|
1412
1426
|
privateAccess: "approved",
|
|
1413
1427
|
sendMode: "queue",
|
|
1428
|
+
segmentReply: false,
|
|
1429
|
+
segmentDelayMinSecs: 1,
|
|
1430
|
+
segmentDelayMaxSecs: 2,
|
|
1414
1431
|
agentPreset: defaults && defaults.agentPreset || "standard",
|
|
1415
1432
|
};
|
|
1416
1433
|
});
|
|
@@ -1587,6 +1604,7 @@ window.__ModuleLoader__.load({
|
|
|
1587
1604
|
permissionT,
|
|
1588
1605
|
presetT,
|
|
1589
1606
|
showAutoNameNote: true,
|
|
1607
|
+
segmentReplySupported: supportsSegmentReply(ch.id),
|
|
1590
1608
|
t,
|
|
1591
1609
|
}),
|
|
1592
1610
|
h(CommandPermissionSettings, { value: settings.commandPermissions, onSave: commandPermissions => setSettings(current => ({ ...current, commandPermissions })), t }),
|
|
@@ -1685,10 +1703,17 @@ window.__ModuleLoader__.load({
|
|
|
1685
1703
|
const permissionT = props.permissionT || ((key) => key);
|
|
1686
1704
|
const presetT = props.presetT || ((key) => key);
|
|
1687
1705
|
const value = props.value || {};
|
|
1706
|
+
const segmentDelayMinSecs = Number.isInteger(value.segmentDelayMinSecs) ? value.segmentDelayMinSecs : 1;
|
|
1707
|
+
const segmentDelayMaxSecs = Number.isInteger(value.segmentDelayMaxSecs) ? value.segmentDelayMaxSecs : 2;
|
|
1688
1708
|
const [addBusy, setAddBusy] = useState(false);
|
|
1689
1709
|
const [hint, setHint] = useState("");
|
|
1690
1710
|
const [confirmingFullAccess, setConfirmingFullAccess] = useState(false);
|
|
1691
1711
|
const [fullAccessAcknowledged, setFullAccessAcknowledged] = useState(false);
|
|
1712
|
+
const [segmentGapMinDraft, setSegmentGapMinDraft] = useState(String(segmentDelayMinSecs));
|
|
1713
|
+
const [segmentGapMaxDraft, setSegmentGapMaxDraft] = useState(String(segmentDelayMaxSecs));
|
|
1714
|
+
const [segmentGapError, setSegmentGapError] = useState("");
|
|
1715
|
+
useEffect(() => { setSegmentGapMinDraft(String(segmentDelayMinSecs)); }, [segmentDelayMinSecs]);
|
|
1716
|
+
useEffect(() => { setSegmentGapMaxDraft(String(segmentDelayMaxSecs)); }, [segmentDelayMaxSecs]);
|
|
1692
1717
|
const items = props.workspaces || [];
|
|
1693
1718
|
const providers = props.catalog || [];
|
|
1694
1719
|
const permissions = props.permissions || [];
|
|
@@ -1699,6 +1724,10 @@ window.__ModuleLoader__.load({
|
|
|
1699
1724
|
const permission = value.permission || "";
|
|
1700
1725
|
const privateAccess = value.privateAccess === "all" ? "all" : "approved";
|
|
1701
1726
|
const sendMode = value.sendMode === "steer" ? "steer" : "queue";
|
|
1727
|
+
const segmentSupported = typeof props.segmentReplySupported === "boolean"
|
|
1728
|
+
? props.segmentReplySupported
|
|
1729
|
+
: supportsSegmentReply(value.platform);
|
|
1730
|
+
const segmentReply = value.segmentReply === true;
|
|
1702
1731
|
const workspace = items.find((item) => item.path === cwd);
|
|
1703
1732
|
const modelGroups = providers.map((item) => {
|
|
1704
1733
|
const providerName = formatProviderLabel(item.id, item.name || item.id, modelT);
|
|
@@ -1736,6 +1765,27 @@ window.__ModuleLoader__.load({
|
|
|
1736
1765
|
if (typeof props.onChange === "function") props.onChange(patch);
|
|
1737
1766
|
};
|
|
1738
1767
|
|
|
1768
|
+
// 分段间隔手填秒数:失焦时统一校验,不合法就保留草稿并提示,不提交脏值。
|
|
1769
|
+
const parseSegmentSecs = (raw) => {
|
|
1770
|
+
const text = String(raw == null ? "" : raw).trim();
|
|
1771
|
+
if (text === "") return undefined;
|
|
1772
|
+
const parsed = Number(text);
|
|
1773
|
+
if (!Number.isFinite(parsed)) return undefined;
|
|
1774
|
+
return Math.min(60, Math.max(0, Math.round(parsed)));
|
|
1775
|
+
};
|
|
1776
|
+
const commitSegmentGap = () => {
|
|
1777
|
+
const min = parseSegmentSecs(segmentGapMinDraft);
|
|
1778
|
+
const max = parseSegmentSecs(segmentGapMaxDraft);
|
|
1779
|
+
if (min === undefined || max === undefined) { setSegmentGapError(t("account.segmentGapInvalid")); return; }
|
|
1780
|
+
if (max < min) { setSegmentGapError(t("account.segmentGapOrder")); return; }
|
|
1781
|
+
setSegmentGapError("");
|
|
1782
|
+
const patch = {};
|
|
1783
|
+
if (min !== segmentDelayMinSecs) patch.segmentDelayMinSecs = min;
|
|
1784
|
+
if (max !== segmentDelayMaxSecs) patch.segmentDelayMaxSecs = max;
|
|
1785
|
+
if (patch.segmentDelayMinSecs === undefined && patch.segmentDelayMaxSecs === undefined) return;
|
|
1786
|
+
update(patch);
|
|
1787
|
+
};
|
|
1788
|
+
|
|
1739
1789
|
const addWorkspace = (path) => {
|
|
1740
1790
|
const next = (path || "").trim();
|
|
1741
1791
|
if (!next) { setHint(t("error.chooseWorkspace")); return Promise.resolve(); }
|
|
@@ -1788,6 +1838,29 @@ window.__ModuleLoader__.load({
|
|
|
1788
1838
|
picker,
|
|
1789
1839
|
);
|
|
1790
1840
|
|
|
1841
|
+
const segmentReplyTip = t("account.segmentReplyNote");
|
|
1842
|
+
const tipAnchor = h("span", {
|
|
1843
|
+
className: "ima-label-tip",
|
|
1844
|
+
title: HostTooltip ? undefined : segmentReplyTip,
|
|
1845
|
+
"aria-label": segmentReplyTip,
|
|
1846
|
+
role: "button",
|
|
1847
|
+
tabIndex: 0,
|
|
1848
|
+
style: {
|
|
1849
|
+
display: "inline-flex",
|
|
1850
|
+
alignItems: "center",
|
|
1851
|
+
cursor: "help",
|
|
1852
|
+
color: "var(--dsw-alias-label-tertiary, var(--ima-muted))",
|
|
1853
|
+
marginLeft: 2,
|
|
1854
|
+
},
|
|
1855
|
+
}, h(IconInfoOutline, { size: 12 }));
|
|
1856
|
+
|
|
1857
|
+
const segmentReplyLabel = h("span", { style: { display: "inline-flex", alignItems: "center", gap: 4 } },
|
|
1858
|
+
h("span", null, t("account.segmentReply")),
|
|
1859
|
+
HostTooltip
|
|
1860
|
+
? h(HostTooltip, { label: segmentReplyTip, portal: true, side: "top" }, tipAnchor)
|
|
1861
|
+
: tipAnchor,
|
|
1862
|
+
);
|
|
1863
|
+
|
|
1791
1864
|
return h("div", { className: "ima-account-settings" + (props.compact ? " compact" : "") },
|
|
1792
1865
|
field("workspace", props.workspaceLabel || t("account.workspace"), items.length === 0
|
|
1793
1866
|
? h("div", null,
|
|
@@ -1876,8 +1949,51 @@ window.__ModuleLoader__.load({
|
|
|
1876
1949
|
],
|
|
1877
1950
|
onChange: (next) => update({ sendMode: next }),
|
|
1878
1951
|
})),
|
|
1879
|
-
|
|
1952
|
+
segmentSupported && field("segmentReply", segmentReplyLabel, h(Select, {
|
|
1953
|
+
className: "ima-account-picker",
|
|
1954
|
+
value: segmentReply ? "segmented" : "full",
|
|
1955
|
+
"aria-label": t("account.segmentReply"),
|
|
1956
|
+
options: [
|
|
1957
|
+
{ value: "full", label: t("account.segmentFull") },
|
|
1958
|
+
{ value: "segmented", label: t("account.segmentSplit") },
|
|
1959
|
+
],
|
|
1960
|
+
onChange: (next) => update({ segmentReply: next === "segmented" }),
|
|
1961
|
+
})),
|
|
1880
1962
|
sendMode === "steer" && h("div", { className: "ima-picker-note" }, t("account.sendSteerNote")),
|
|
1963
|
+
segmentSupported && segmentReply && field("segmentGap", t("account.segmentGap"), h("div", { className: "ima-segment-gap" },
|
|
1964
|
+
h(Input, {
|
|
1965
|
+
type: "number",
|
|
1966
|
+
min: 0,
|
|
1967
|
+
max: 60,
|
|
1968
|
+
step: 1,
|
|
1969
|
+
inputMode: "numeric",
|
|
1970
|
+
className: "ima-segment-gap-input",
|
|
1971
|
+
value: segmentGapMinDraft,
|
|
1972
|
+
placeholder: "1",
|
|
1973
|
+
"aria-label": t("account.segmentGapMin"),
|
|
1974
|
+
onChange: (event) => { setSegmentGapMinDraft(event.target.value); setSegmentGapError(""); },
|
|
1975
|
+
onBlur: commitSegmentGap,
|
|
1976
|
+
onKeyDown: (event) => { if (event.key === "Enter") event.currentTarget.blur(); },
|
|
1977
|
+
}),
|
|
1978
|
+
h("span", { className: "ima-segment-gap-sep" }, "~"),
|
|
1979
|
+
h(Input, {
|
|
1980
|
+
type: "number",
|
|
1981
|
+
min: 0,
|
|
1982
|
+
max: 60,
|
|
1983
|
+
step: 1,
|
|
1984
|
+
inputMode: "numeric",
|
|
1985
|
+
className: "ima-segment-gap-input",
|
|
1986
|
+
value: segmentGapMaxDraft,
|
|
1987
|
+
placeholder: "2",
|
|
1988
|
+
"aria-label": t("account.segmentGapMax"),
|
|
1989
|
+
onChange: (event) => { setSegmentGapMaxDraft(event.target.value); setSegmentGapError(""); },
|
|
1990
|
+
onBlur: commitSegmentGap,
|
|
1991
|
+
onKeyDown: (event) => { if (event.key === "Enter") event.currentTarget.blur(); },
|
|
1992
|
+
}),
|
|
1993
|
+
h("span", { className: "ima-segment-gap-unit" }, t("account.seconds")),
|
|
1994
|
+
)),
|
|
1995
|
+
segmentSupported && segmentReply && segmentGapError && h("div", { className: "ima-picker-note warning" }, segmentGapError),
|
|
1996
|
+
segmentSupported && segmentReply && h("div", { className: "ima-picker-note" }, t("account.segmentGapNote")),
|
|
1881
1997
|
privateAccess === "all" && h("div", { className: "ima-picker-note warning" }, t("settings.publicChatNotice")),
|
|
1882
1998
|
hint && h("div", { className: "ima-picker-note" }, hint),
|
|
1883
1999
|
props.showAutoNameNote && h("div", { className: "ima-picker-note" }, t("account.autoNameNote")),
|
|
@@ -1985,7 +2101,7 @@ window.__ModuleLoader__.load({
|
|
|
1985
2101
|
setDraft(account);
|
|
1986
2102
|
setProxyModeDraft(account.proxyMode || "inherit");
|
|
1987
2103
|
setNote("");
|
|
1988
|
-
}, [account.id, account.cwd, account.permission, account.agentPreset, account.privateAccess, account.sendMode, 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]);
|
|
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]);
|
|
1989
2105
|
useEffect(() => {
|
|
1990
2106
|
setProxyUrlDraft(account.proxyUrl || "");
|
|
1991
2107
|
}, [account.id, account.proxyUrl]);
|
|
@@ -2004,6 +2120,9 @@ window.__ModuleLoader__.load({
|
|
|
2004
2120
|
permission: next.permission,
|
|
2005
2121
|
privateAccess: next.privateAccess,
|
|
2006
2122
|
sendMode: next.sendMode,
|
|
2123
|
+
segmentReply: next.segmentReply === true,
|
|
2124
|
+
segmentDelayMinSecs: next.segmentDelayMinSecs,
|
|
2125
|
+
segmentDelayMaxSecs: next.segmentDelayMaxSecs,
|
|
2007
2126
|
agentPreset: next.agentPreset,
|
|
2008
2127
|
commandPermissions: next.commandPermissions,
|
|
2009
2128
|
};
|
|
@@ -2054,6 +2173,7 @@ window.__ModuleLoader__.load({
|
|
|
2054
2173
|
h(AccountSettingsPicker, {
|
|
2055
2174
|
value: draft,
|
|
2056
2175
|
onChange: applySettings,
|
|
2176
|
+
segmentReplySupported: account.segmentReplySupported !== false,
|
|
2057
2177
|
catalog,
|
|
2058
2178
|
permissions,
|
|
2059
2179
|
agentPresets,
|
|
@@ -3506,6 +3626,9 @@ window.__ModuleLoader__.load({
|
|
|
3506
3626
|
onToggleOnlineUpdate,
|
|
3507
3627
|
onlineUpdateDisabled,
|
|
3508
3628
|
onlineUpdateLocked = false,
|
|
3629
|
+
taskTreeSessionsEnabled = false,
|
|
3630
|
+
onToggleTaskTreeSessions,
|
|
3631
|
+
taskTreeSessionsDisabled = false,
|
|
3509
3632
|
} = props;
|
|
3510
3633
|
|
|
3511
3634
|
const SwitchComponent = PrimitiveSwitch || Switch;
|
|
@@ -3544,6 +3667,23 @@ window.__ModuleLoader__.load({
|
|
|
3544
3667
|
);
|
|
3545
3668
|
}
|
|
3546
3669
|
|
|
3670
|
+
if (typeof onToggleTaskTreeSessions === "function") {
|
|
3671
|
+
rows.push(
|
|
3672
|
+
h("div", { key: "task-tree-sessions", className: "ima-bundle-row" },
|
|
3673
|
+
h("div", { className: "ima-bundle-label-box" },
|
|
3674
|
+
h("span", { className: "ima-bundle-title" }, t("taskTreeSessions.entry.title")),
|
|
3675
|
+
h("span", { className: "ima-bundle-desc" }, t("taskTreeSessions.entry.desc"))
|
|
3676
|
+
),
|
|
3677
|
+
h(SwitchComponent, {
|
|
3678
|
+
checked: taskTreeSessionsEnabled,
|
|
3679
|
+
onChange: onToggleTaskTreeSessions,
|
|
3680
|
+
label: t("taskTreeSessions.entry.toggle"),
|
|
3681
|
+
disabled: taskTreeSessionsDisabled,
|
|
3682
|
+
})
|
|
3683
|
+
)
|
|
3684
|
+
);
|
|
3685
|
+
}
|
|
3686
|
+
|
|
3547
3687
|
return h(React.Fragment, null, rows);
|
|
3548
3688
|
}
|
|
3549
3689
|
|
|
@@ -3551,8 +3691,10 @@ window.__ModuleLoader__.load({
|
|
|
3551
3691
|
const [enabled, setEnabled] = useState(props.getEnabled);
|
|
3552
3692
|
const [onlineUpdateEnabled, setOnlineUpdateEnabled] = useState(props.getOnlineUpdateEnabled ? props.getOnlineUpdateEnabled : () => true);
|
|
3553
3693
|
const [onlineUpdateLocked, setOnlineUpdateLocked] = useState(props.getOnlineUpdateLocked ? props.getOnlineUpdateLocked : () => false);
|
|
3694
|
+
const [taskTreeSessionsEnabled, setTaskTreeSessionsEnabled] = useState(props.getTaskTreeSessionsEnabled ? props.getTaskTreeSessionsEnabled : () => false);
|
|
3554
3695
|
const [savingSidebar, setSavingSidebar] = useState(false);
|
|
3555
3696
|
const [savingUpdate, setSavingUpdate] = useState(false);
|
|
3697
|
+
const [savingTaskTreeSessions, setSavingTaskTreeSessions] = useState(false);
|
|
3556
3698
|
|
|
3557
3699
|
useEffect(() => {
|
|
3558
3700
|
setEnabled(props.getEnabled());
|
|
@@ -3562,6 +3704,9 @@ window.__ModuleLoader__.load({
|
|
|
3562
3704
|
if (props.getOnlineUpdateLocked) {
|
|
3563
3705
|
setOnlineUpdateLocked(props.getOnlineUpdateLocked());
|
|
3564
3706
|
}
|
|
3707
|
+
if (props.getTaskTreeSessionsEnabled) {
|
|
3708
|
+
setTaskTreeSessionsEnabled(props.getTaskTreeSessionsEnabled());
|
|
3709
|
+
}
|
|
3565
3710
|
return props.subscribe(() => {
|
|
3566
3711
|
setEnabled(props.getEnabled());
|
|
3567
3712
|
if (props.getOnlineUpdateEnabled) {
|
|
@@ -3570,6 +3715,9 @@ window.__ModuleLoader__.load({
|
|
|
3570
3715
|
if (props.getOnlineUpdateLocked) {
|
|
3571
3716
|
setOnlineUpdateLocked(props.getOnlineUpdateLocked());
|
|
3572
3717
|
}
|
|
3718
|
+
if (props.getTaskTreeSessionsEnabled) {
|
|
3719
|
+
setTaskTreeSessionsEnabled(props.getTaskTreeSessionsEnabled());
|
|
3720
|
+
}
|
|
3573
3721
|
});
|
|
3574
3722
|
}, [props]);
|
|
3575
3723
|
|
|
@@ -3596,6 +3744,18 @@ window.__ModuleLoader__.load({
|
|
|
3596
3744
|
});
|
|
3597
3745
|
} : undefined;
|
|
3598
3746
|
|
|
3747
|
+
const onToggleTaskTreeSessions = props.setTaskTreeSessions ? (next) => {
|
|
3748
|
+
setSavingTaskTreeSessions(true);
|
|
3749
|
+
setTaskTreeSessionsEnabled(next);
|
|
3750
|
+
props.setTaskTreeSessions(next).catch(() => {
|
|
3751
|
+
if (props.getTaskTreeSessionsEnabled) {
|
|
3752
|
+
setTaskTreeSessionsEnabled(props.getTaskTreeSessionsEnabled());
|
|
3753
|
+
}
|
|
3754
|
+
}).finally(() => {
|
|
3755
|
+
setSavingTaskTreeSessions(false);
|
|
3756
|
+
});
|
|
3757
|
+
} : undefined;
|
|
3758
|
+
|
|
3599
3759
|
return h(ImBundleConfigCard, {
|
|
3600
3760
|
t: props.t,
|
|
3601
3761
|
enabled,
|
|
@@ -3605,9 +3765,14 @@ window.__ModuleLoader__.load({
|
|
|
3605
3765
|
onlineUpdateDisabled: savingUpdate,
|
|
3606
3766
|
onlineUpdateLocked,
|
|
3607
3767
|
onToggleOnlineUpdate,
|
|
3768
|
+
taskTreeSessionsEnabled,
|
|
3769
|
+
taskTreeSessionsDisabled: savingTaskTreeSessions,
|
|
3770
|
+
onToggleTaskTreeSessions,
|
|
3608
3771
|
});
|
|
3609
3772
|
}
|
|
3610
3773
|
|
|
3774
|
+
const STORAGE_KEY_TASK_TREE_SESSIONS = "dsh-im-connect.task-tree-sessions";
|
|
3775
|
+
|
|
3611
3776
|
function setupSidebarEntry(ctx, options) {
|
|
3612
3777
|
if (!ctx.locale) {
|
|
3613
3778
|
return {
|
|
@@ -3615,7 +3780,10 @@ window.__ModuleLoader__.load({
|
|
|
3615
3780
|
isSupported: () => false,
|
|
3616
3781
|
setEnabled: async () => false,
|
|
3617
3782
|
isOnlineUpdateEnabled: () => true,
|
|
3783
|
+
isOnlineUpdateLocked: () => false,
|
|
3618
3784
|
setOnlineUpdate: async () => false,
|
|
3785
|
+
isTaskTreeSessionsEnabled: () => false,
|
|
3786
|
+
setTaskTreeSessions: async () => false,
|
|
3619
3787
|
destroy: () => {},
|
|
3620
3788
|
};
|
|
3621
3789
|
}
|
|
@@ -3757,6 +3925,62 @@ window.__ModuleLoader__.load({
|
|
|
3757
3925
|
})
|
|
3758
3926
|
.catch(() => {});
|
|
3759
3927
|
|
|
3928
|
+
let taskTreeSessionsEnabled = (() => {
|
|
3929
|
+
try {
|
|
3930
|
+
return localStorage.getItem(STORAGE_KEY_TASK_TREE_SESSIONS) === "true";
|
|
3931
|
+
} catch {
|
|
3932
|
+
return false;
|
|
3933
|
+
}
|
|
3934
|
+
})();
|
|
3935
|
+
let taskTreeEpoch = 0;
|
|
3936
|
+
|
|
3937
|
+
const setTaskTreeSessions = async (next) => {
|
|
3938
|
+
const currentEpoch = ++taskTreeEpoch;
|
|
3939
|
+
taskTreeSessionsEnabled = next;
|
|
3940
|
+
try {
|
|
3941
|
+
localStorage.setItem(STORAGE_KEY_TASK_TREE_SESSIONS, next ? "true" : "false");
|
|
3942
|
+
} catch {}
|
|
3943
|
+
notify();
|
|
3944
|
+
if (typeof options.onTaskTreeSessionsChange === "function") {
|
|
3945
|
+
try { options.onTaskTreeSessionsChange(next); } catch {}
|
|
3946
|
+
}
|
|
3947
|
+
try {
|
|
3948
|
+
await callApi("/task-tree-sessions", {
|
|
3949
|
+
method: "POST",
|
|
3950
|
+
body: JSON.stringify({ enabled: next }),
|
|
3951
|
+
});
|
|
3952
|
+
return next;
|
|
3953
|
+
} catch (err) {
|
|
3954
|
+
if (currentEpoch === taskTreeEpoch) {
|
|
3955
|
+
taskTreeSessionsEnabled = !next;
|
|
3956
|
+
try {
|
|
3957
|
+
localStorage.setItem(STORAGE_KEY_TASK_TREE_SESSIONS, (!next) ? "true" : "false");
|
|
3958
|
+
} catch {}
|
|
3959
|
+
notify();
|
|
3960
|
+
if (typeof options.onTaskTreeSessionsChange === "function") {
|
|
3961
|
+
try { options.onTaskTreeSessionsChange(!next); } catch {}
|
|
3962
|
+
}
|
|
3963
|
+
}
|
|
3964
|
+
throw err;
|
|
3965
|
+
}
|
|
3966
|
+
};
|
|
3967
|
+
|
|
3968
|
+
const loadTaskTreeEpoch = taskTreeEpoch;
|
|
3969
|
+
callApi("/task-tree-sessions")
|
|
3970
|
+
.then((res) => {
|
|
3971
|
+
if (taskTreeEpoch === loadTaskTreeEpoch && res && typeof res.enabled === "boolean") {
|
|
3972
|
+
taskTreeSessionsEnabled = res.enabled;
|
|
3973
|
+
try {
|
|
3974
|
+
localStorage.setItem(STORAGE_KEY_TASK_TREE_SESSIONS, res.enabled ? "true" : "false");
|
|
3975
|
+
} catch {}
|
|
3976
|
+
notify();
|
|
3977
|
+
if (typeof options.onTaskTreeSessionsChange === "function") {
|
|
3978
|
+
try { options.onTaskTreeSessionsChange(taskTreeSessionsEnabled); } catch {}
|
|
3979
|
+
}
|
|
3980
|
+
}
|
|
3981
|
+
})
|
|
3982
|
+
.catch(() => {});
|
|
3983
|
+
|
|
3760
3984
|
if (typeof ctx.inject === "function") {
|
|
3761
3985
|
ctx.inject(["layout"], (scoped) => {
|
|
3762
3986
|
layoutService = scoped.layout;
|
|
@@ -3782,6 +4006,8 @@ window.__ModuleLoader__.load({
|
|
|
3782
4006
|
getOnlineUpdateEnabled: () => onlineUpdateEnabled,
|
|
3783
4007
|
getOnlineUpdateLocked: () => onlineUpdateLocked,
|
|
3784
4008
|
setOnlineUpdate: setOnlineUpdate,
|
|
4009
|
+
getTaskTreeSessionsEnabled: () => taskTreeSessionsEnabled,
|
|
4010
|
+
setTaskTreeSessions: setTaskTreeSessions,
|
|
3785
4011
|
subscribe: (fn) => {
|
|
3786
4012
|
listeners.add(fn);
|
|
3787
4013
|
return () => { listeners.delete(fn); };
|
|
@@ -3797,6 +4023,8 @@ window.__ModuleLoader__.load({
|
|
|
3797
4023
|
isOnlineUpdateEnabled: () => onlineUpdateEnabled,
|
|
3798
4024
|
isOnlineUpdateLocked: () => onlineUpdateLocked,
|
|
3799
4025
|
setOnlineUpdate,
|
|
4026
|
+
isTaskTreeSessionsEnabled: () => taskTreeSessionsEnabled,
|
|
4027
|
+
setTaskTreeSessions,
|
|
3800
4028
|
destroy: () => {
|
|
3801
4029
|
listeners.clear();
|
|
3802
4030
|
if (offRow) {
|
|
@@ -3846,6 +4074,7 @@ window.__ModuleLoader__.load({
|
|
|
3846
4074
|
const permissionT = ctx.locale.bind("permission.access");
|
|
3847
4075
|
const modelT = ctx.locale.bind("model");
|
|
3848
4076
|
const presetT = ctx.locale.bind("settings.agentPreset");
|
|
4077
|
+
let syncActiveTaskTreeFilter = () => {};
|
|
3849
4078
|
const sidebarController = setupSidebarEntry(ctx, {
|
|
3850
4079
|
callApi: api,
|
|
3851
4080
|
renderPanel: (ownerProps) => h(LocalizedSettingsPage, ownerProps),
|
|
@@ -3860,6 +4089,9 @@ window.__ModuleLoader__.load({
|
|
|
3860
4089
|
onOnlineUpdateChange: () => {
|
|
3861
4090
|
if (typeof window !== "undefined") window.dispatchEvent(new CustomEvent("ima-update-toggle"));
|
|
3862
4091
|
},
|
|
4092
|
+
onTaskTreeSessionsChange: () => {
|
|
4093
|
+
syncActiveTaskTreeFilter();
|
|
4094
|
+
},
|
|
3863
4095
|
});
|
|
3864
4096
|
ctx.effect(() => () => sidebarController.destroy(), "im-connect: sidebar entry");
|
|
3865
4097
|
ctx.effect(() => observePluginUpdate({
|
|
@@ -4032,11 +4264,59 @@ window.__ModuleLoader__.load({
|
|
|
4032
4264
|
let ownedRegistry = null;
|
|
4033
4265
|
let removeInsertedTab = () => {};
|
|
4034
4266
|
let removeInsertedOpener = () => {};
|
|
4267
|
+
let removeInsertedFilter = () => {};
|
|
4268
|
+
let activeFilterRegistry = null;
|
|
4269
|
+
let filterInstalled = false;
|
|
4270
|
+
let warnedUnsupportedFilter = false;
|
|
4035
4271
|
let stopInsertedTabLocale = () => {};
|
|
4036
4272
|
let insertedTabRegistry = null;
|
|
4037
4273
|
let syncing = false;
|
|
4038
4274
|
// 与定时插件共享通知,补足直接替换 component 不触发宿主插槽通知的情况。
|
|
4039
4275
|
const notifyPeers = () => { queueMicrotask(() => window.dispatchEvent(new Event("dsh-native-sidebar-change"))); };
|
|
4276
|
+
const clearFilter = () => {
|
|
4277
|
+
if (filterInstalled) {
|
|
4278
|
+
removeInsertedFilter();
|
|
4279
|
+
removeInsertedFilter = () => {};
|
|
4280
|
+
filterInstalled = false;
|
|
4281
|
+
}
|
|
4282
|
+
warnedUnsupportedFilter = false;
|
|
4283
|
+
};
|
|
4284
|
+
const ensureFilter = (registry) => {
|
|
4285
|
+
if (registry !== activeFilterRegistry) {
|
|
4286
|
+
clearFilter();
|
|
4287
|
+
activeFilterRegistry = registry;
|
|
4288
|
+
}
|
|
4289
|
+
if (!registry) {
|
|
4290
|
+
clearFilter();
|
|
4291
|
+
return;
|
|
4292
|
+
}
|
|
4293
|
+
const showSessions = typeof sidebarController !== "undefined"
|
|
4294
|
+
&& sidebarController
|
|
4295
|
+
&& typeof sidebarController.isTaskTreeSessionsEnabled === "function"
|
|
4296
|
+
? sidebarController.isTaskTreeSessionsEnabled()
|
|
4297
|
+
: false;
|
|
4298
|
+
if (showSessions) {
|
|
4299
|
+
clearFilter();
|
|
4300
|
+
return;
|
|
4301
|
+
}
|
|
4302
|
+
if (!filterInstalled) {
|
|
4303
|
+
if (typeof registry.addSessionFilter === "function") {
|
|
4304
|
+
const dispose = registry.addSessionFilter((sessionId) => {
|
|
4305
|
+
return !isChannelSession(sessionId);
|
|
4306
|
+
});
|
|
4307
|
+
removeInsertedFilter = () => {
|
|
4308
|
+
dispose();
|
|
4309
|
+
};
|
|
4310
|
+
filterInstalled = true;
|
|
4311
|
+
} else if (!warnedUnsupportedFilter) {
|
|
4312
|
+
warnedUnsupportedFilter = true;
|
|
4313
|
+
console.warn("[dsh-im-connect] 外壳注册表未支持 addSessionFilter 协议,无法在任务树过滤会话");
|
|
4314
|
+
}
|
|
4315
|
+
}
|
|
4316
|
+
};
|
|
4317
|
+
syncActiveTaskTreeFilter = () => {
|
|
4318
|
+
ensureFilter(insertedTabRegistry || ownedRegistry);
|
|
4319
|
+
};
|
|
4040
4320
|
const installSessionOpener = (registry) => {
|
|
4041
4321
|
if (!registry || typeof registry.addSessionOpener !== "function") return () => {};
|
|
4042
4322
|
if (registry.sessionOpeners && registry.sessionOpeners.some((item) => item.id === "im-connect")) return () => {};
|
|
@@ -4059,10 +4339,13 @@ window.__ModuleLoader__.load({
|
|
|
4059
4339
|
removeInsertedTab = () => {};
|
|
4060
4340
|
removeInsertedOpener();
|
|
4061
4341
|
removeInsertedOpener = () => {};
|
|
4342
|
+
clearFilter();
|
|
4062
4343
|
insertedTabRegistry = null;
|
|
4063
4344
|
};
|
|
4064
4345
|
const unwrap = () => {
|
|
4065
4346
|
clearInsertedTab();
|
|
4347
|
+
clearFilter();
|
|
4348
|
+
activeFilterRegistry = null;
|
|
4066
4349
|
if (wrappedEntry) {
|
|
4067
4350
|
if (originalComp && wrappedEntry.component === ownedWrapper) wrappedEntry.component = originalComp;
|
|
4068
4351
|
if (wrappedEntry.__dshNativeTabs === ownedRegistry) delete wrappedEntry.__dshNativeTabs;
|
|
@@ -4081,6 +4364,7 @@ window.__ModuleLoader__.load({
|
|
|
4081
4364
|
insertedTabRegistry = registry;
|
|
4082
4365
|
removeInsertedOpener = installSessionOpener(registry);
|
|
4083
4366
|
}
|
|
4367
|
+
ensureFilter(registry);
|
|
4084
4368
|
if (registry.getTabs().some((item) => item.id === "channels")) return true;
|
|
4085
4369
|
const refreshInsertedTab = () => {
|
|
4086
4370
|
removeInsertedTab = registry.insert({
|
|
@@ -4134,6 +4418,7 @@ window.__ModuleLoader__.load({
|
|
|
4134
4418
|
const registry = createNativeTabRegistry(originalComp);
|
|
4135
4419
|
ownedRegistry = registry;
|
|
4136
4420
|
removeInsertedOpener = installSessionOpener(registry);
|
|
4421
|
+
ensureFilter(registry);
|
|
4137
4422
|
const tree = originalComp;
|
|
4138
4423
|
attachNativeTabRegistry(official, registry);
|
|
4139
4424
|
function DshNativeTabWorkspaceShell(innerProps) {
|
|
@@ -4168,7 +4453,14 @@ window.__ModuleLoader__.load({
|
|
|
4168
4453
|
sync();
|
|
4169
4454
|
if (insertedTabRegistry || ++retries >= 20) window.clearInterval(retryTimer);
|
|
4170
4455
|
}, 250);
|
|
4171
|
-
return () => {
|
|
4456
|
+
return () => {
|
|
4457
|
+
syncActiveTaskTreeFilter = () => {};
|
|
4458
|
+
window.clearInterval(retryTimer);
|
|
4459
|
+
unsub();
|
|
4460
|
+
unsubSidebar();
|
|
4461
|
+
window.removeEventListener("dsh-native-sidebar-change", sync);
|
|
4462
|
+
unwrap();
|
|
4463
|
+
};
|
|
4172
4464
|
});
|
|
4173
4465
|
}
|
|
4174
4466
|
|
package/lib/channels/meta.d.ts
CHANGED
|
@@ -13,10 +13,17 @@ export interface ChannelMeta {
|
|
|
13
13
|
description: string;
|
|
14
14
|
kind: ChannelKind;
|
|
15
15
|
fields: ChannelField[];
|
|
16
|
+
/**
|
|
17
|
+
* 是否开放分段回复:只对已验证「一条回复拆成多条消息」的渠道放开。
|
|
18
|
+
* 未标记的渠道不展示开关、不注入提示词,引擎也不会切分。
|
|
19
|
+
*/
|
|
20
|
+
supportsSegmentReply?: boolean;
|
|
16
21
|
}
|
|
17
22
|
/** 设置页卡片顺序,对标视觉稿后再补 Telegram。 */
|
|
18
23
|
export declare const CHANNEL_ORDER: ChannelId[];
|
|
19
24
|
export declare const CHANNEL_META: Record<ChannelId, ChannelMeta>;
|
|
20
25
|
export declare function listChannelMeta(): ChannelMeta[];
|
|
21
26
|
export declare function supportsQr(id: ChannelId): boolean;
|
|
27
|
+
/** 该渠道是否已验证逐条投递,可以开放分段回复。 */
|
|
28
|
+
export declare function channelSupportsSegmentReply(id: ChannelId | string): boolean;
|
|
22
29
|
//# sourceMappingURL=meta.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../src/channels/meta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAExD,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,aAAa,GAAG,mBAAmB,CAAA;AAEpE,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,+BAA+B;IAC/B,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,SAAS,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,WAAW,CAAA;IACjB,MAAM,EAAE,YAAY,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../src/channels/meta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAExD,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,aAAa,GAAG,mBAAmB,CAAA;AAEpE,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,+BAA+B;IAC/B,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,SAAS,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,WAAW,CAAA;IACjB,MAAM,EAAE,YAAY,EAAE,CAAA;IACtB;;;OAGG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAA;CAC/B;AAED,iCAAiC;AACjC,eAAO,MAAM,aAAa,EAAE,SAAS,EAUpC,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,SAAS,EAAE,WAAW,CA2FvD,CAAA;AAED,wBAAgB,eAAe,IAAI,WAAW,EAAE,CAE/C;AAED,wBAAgB,UAAU,CAAC,EAAE,EAAE,SAAS,GAAG,OAAO,CAGjD;AAED,6BAA6B;AAC7B,wBAAgB,2BAA2B,CAAC,EAAE,EAAE,SAAS,GAAG,MAAM,GAAG,OAAO,CAM3E"}
|
package/lib/channels/meta.js
CHANGED
|
@@ -67,6 +67,8 @@ export const CHANNEL_META = {
|
|
|
67
67
|
{ key: 'appId', label: 'AppID' },
|
|
68
68
|
{ key: 'appSecret', label: 'AppSecret', secret: true },
|
|
69
69
|
],
|
|
70
|
+
// 先在 QQ 上验证「一条回复拆成多条消息」:被动回复按 msg_seq 递增逐条发出。
|
|
71
|
+
supportsSegmentReply: true,
|
|
70
72
|
},
|
|
71
73
|
telegram: {
|
|
72
74
|
id: 'telegram',
|
|
@@ -106,4 +108,13 @@ export function supportsQr(id) {
|
|
|
106
108
|
const kind = CHANNEL_META[id]?.kind;
|
|
107
109
|
return kind === 'qr' || kind === 'qr-or-credentials';
|
|
108
110
|
}
|
|
111
|
+
/** 该渠道是否已验证逐条投递,可以开放分段回复。 */
|
|
112
|
+
export function channelSupportsSegmentReply(id) {
|
|
113
|
+
const key = String(id);
|
|
114
|
+
if (CHANNEL_META[key]?.supportsSegmentReply === true)
|
|
115
|
+
return true;
|
|
116
|
+
// 引擎和会话绑定里拿到的常是账号 ID(如 qq_8107bade2f35),回落到平台名再查一次。
|
|
117
|
+
const platform = key.split('_', 1)[0];
|
|
118
|
+
return CHANNEL_META[platform]?.supportsSegmentReply === true;
|
|
119
|
+
}
|
|
109
120
|
//# sourceMappingURL=meta.js.map
|
package/lib/channels/meta.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta.js","sourceRoot":"","sources":["../../src/channels/meta.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"meta.js","sourceRoot":"","sources":["../../src/channels/meta.ts"],"names":[],"mappings":"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"}
|