@michengai/dsh-codex-ui 0.2.69 → 0.2.71
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/dist/client.js +34 -72
- package/package.json +6 -6
package/dist/client.js
CHANGED
|
@@ -2705,6 +2705,19 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
|
|
|
2705
2705
|
}
|
|
2706
2706
|
//#endregion
|
|
2707
2707
|
//#region src/client/ChannelBrowser.tsx
|
|
2708
|
+
const CHANNEL_LOCALE_KEYS = {
|
|
2709
|
+
dingtalk: "channel.dingtalk",
|
|
2710
|
+
feishu: "channel.feishu",
|
|
2711
|
+
lark: "channel.lark",
|
|
2712
|
+
weixin: "channel.weixin",
|
|
2713
|
+
wecom: "channel.wecom",
|
|
2714
|
+
qq: "channel.qq",
|
|
2715
|
+
telegram: "channel.telegram"
|
|
2716
|
+
};
|
|
2717
|
+
function channelLabel(id, fallback, t) {
|
|
2718
|
+
const key = CHANNEL_LOCALE_KEYS[id];
|
|
2719
|
+
return key === void 0 ? fallback : t(key);
|
|
2720
|
+
}
|
|
2708
2721
|
/** 频道树:数据来自 IM,行/菜单/悬停与任务树共用。 */
|
|
2709
2722
|
function ChannelBrowser(props) {
|
|
2710
2723
|
const [menu, setMenu] = (0, react.useState)();
|
|
@@ -2747,8 +2760,8 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
|
|
|
2747
2760
|
setGroups(next);
|
|
2748
2761
|
setPollError(void 0);
|
|
2749
2762
|
}
|
|
2750
|
-
}).catch((
|
|
2751
|
-
if (!disposed) setPollError(
|
|
2763
|
+
}).catch(() => {
|
|
2764
|
+
if (!disposed) setPollError(t("channels.loadError"));
|
|
2752
2765
|
}).finally(() => {
|
|
2753
2766
|
loading = false;
|
|
2754
2767
|
});
|
|
@@ -2781,11 +2794,12 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
|
|
|
2781
2794
|
}),
|
|
2782
2795
|
groups.map((group) => {
|
|
2783
2796
|
const isExpanded = expanded[group.id] ?? true;
|
|
2797
|
+
const label = channelLabel(group.id, group.label, t);
|
|
2784
2798
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2785
2799
|
className: "dcu-wb-project",
|
|
2786
2800
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(GroupHead, {
|
|
2787
2801
|
expanded: isExpanded,
|
|
2788
|
-
title:
|
|
2802
|
+
title: label,
|
|
2789
2803
|
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChannelBrandIcon, { id: group.id }),
|
|
2790
2804
|
onToggle: () => {
|
|
2791
2805
|
setExpanded((current) => ({
|
|
@@ -2835,7 +2849,7 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
|
|
|
2835
2849
|
const box = hoverCardAnchor(event.currentTarget.getBoundingClientRect());
|
|
2836
2850
|
showTip({
|
|
2837
2851
|
title,
|
|
2838
|
-
project:
|
|
2852
|
+
project: label,
|
|
2839
2853
|
time: updatedAt === void 0 ? void 0 : formatHoverTime(updatedAt),
|
|
2840
2854
|
left: box.left,
|
|
2841
2855
|
top: box.top
|
|
@@ -4036,6 +4050,14 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
|
|
|
4036
4050
|
"sidebar.channelsTab": "频道",
|
|
4037
4051
|
"sidebar.scheduleTab": "定时",
|
|
4038
4052
|
"channels.empty": "还没有频道会话。先在设置 → IM助理 里连接渠道。",
|
|
4053
|
+
"channels.loadError": "无法读取频道会话。",
|
|
4054
|
+
"channel.dingtalk": "钉钉",
|
|
4055
|
+
"channel.feishu": "飞书",
|
|
4056
|
+
"channel.lark": "Lark",
|
|
4057
|
+
"channel.weixin": "微信",
|
|
4058
|
+
"channel.wecom": "企业微信",
|
|
4059
|
+
"channel.qq": "QQ",
|
|
4060
|
+
"channel.telegram": "Telegram",
|
|
4039
4061
|
"schedule.empty": "还没有定时任务运行记录。",
|
|
4040
4062
|
"search.placeholder": "搜索会话、设置和操作",
|
|
4041
4063
|
"search.empty": "没有匹配的结果。",
|
|
@@ -4147,6 +4169,14 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
|
|
|
4147
4169
|
"sidebar.channelsTab": "Channels",
|
|
4148
4170
|
"sidebar.scheduleTab": "Schedule",
|
|
4149
4171
|
"channels.empty": "No channel conversations yet. Connect a channel in Settings → IM Assistant.",
|
|
4172
|
+
"channels.loadError": "Could not load channel conversations.",
|
|
4173
|
+
"channel.dingtalk": "DingTalk",
|
|
4174
|
+
"channel.feishu": "Feishu",
|
|
4175
|
+
"channel.lark": "Lark",
|
|
4176
|
+
"channel.weixin": "WeChat",
|
|
4177
|
+
"channel.wecom": "WeCom",
|
|
4178
|
+
"channel.qq": "QQ",
|
|
4179
|
+
"channel.telegram": "Telegram",
|
|
4150
4180
|
"schedule.empty": "No scheduled-task runs yet.",
|
|
4151
4181
|
"search.placeholder": "Search conversations, settings, and actions",
|
|
4152
4182
|
"search.empty": "No matching results.",
|
|
@@ -4238,73 +4268,6 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
|
|
|
4238
4268
|
"turns.untitled": "Untitled prompt",
|
|
4239
4269
|
"turns.jump": "Jump to turn {index}: {summary}"
|
|
4240
4270
|
};
|
|
4241
|
-
//#endregion
|
|
4242
|
-
//#region src/client/permission-i18n.ts
|
|
4243
|
-
/**
|
|
4244
|
-
* 官方已负责权限文案及布局;这里只给「完全访问权限」保留醒目的风险提示。
|
|
4245
|
-
*/
|
|
4246
|
-
const PERMISSION_RISK_STYLE = "button[role=menuitem][data-dcu-perm=\"danger-full-access\"],button[role=menuitem][data-dcu-perm=\"danger-full-access\"] *{color:var(--dsw-alias-state-warn-label,#e3942a)}";
|
|
4247
|
-
const FULL_ACCESS_LABELS = [
|
|
4248
|
-
"Full access",
|
|
4249
|
-
"Full Access",
|
|
4250
|
-
"danger-full-access",
|
|
4251
|
-
"完全访问权限",
|
|
4252
|
-
"完全访问"
|
|
4253
|
-
];
|
|
4254
|
-
/** 不改动宿主文案,只识别完全访问权限选项以施加风险色。 */
|
|
4255
|
-
function isFullAccessPermission(text) {
|
|
4256
|
-
const normalized = text.trim().replace(/\s+/g, " ");
|
|
4257
|
-
return FULL_ACCESS_LABELS.some((label) => normalized === label || normalized.includes(label));
|
|
4258
|
-
}
|
|
4259
|
-
function markFullAccessPermissionMenus(root) {
|
|
4260
|
-
let changed = 0;
|
|
4261
|
-
for (const button of root.querySelectorAll("button[role=\"menuitem\"]")) {
|
|
4262
|
-
if (!isFullAccessPermission((button.textContent ?? "").replace(/\s+/g, " "))) continue;
|
|
4263
|
-
if (button.getAttribute("data-dcu-perm") === "danger-full-access") continue;
|
|
4264
|
-
button.setAttribute("data-dcu-perm", "danger-full-access");
|
|
4265
|
-
changed += 1;
|
|
4266
|
-
}
|
|
4267
|
-
return changed;
|
|
4268
|
-
}
|
|
4269
|
-
function observePermissionMenus() {
|
|
4270
|
-
if (typeof document === "undefined") return () => {};
|
|
4271
|
-
const styleId = "dcu-permission-risk";
|
|
4272
|
-
if (document.getElementById(styleId) === null) {
|
|
4273
|
-
const style = document.createElement("style");
|
|
4274
|
-
style.id = styleId;
|
|
4275
|
-
style.textContent = PERMISSION_RISK_STYLE;
|
|
4276
|
-
document.head.append(style);
|
|
4277
|
-
}
|
|
4278
|
-
let applying = false;
|
|
4279
|
-
let frame;
|
|
4280
|
-
const apply = () => {
|
|
4281
|
-
if (applying) return;
|
|
4282
|
-
applying = true;
|
|
4283
|
-
try {
|
|
4284
|
-
markFullAccessPermissionMenus(document);
|
|
4285
|
-
} finally {
|
|
4286
|
-
applying = false;
|
|
4287
|
-
}
|
|
4288
|
-
};
|
|
4289
|
-
const schedule = () => {
|
|
4290
|
-
if (frame !== void 0) return;
|
|
4291
|
-
frame = window.requestAnimationFrame(() => {
|
|
4292
|
-
frame = void 0;
|
|
4293
|
-
apply();
|
|
4294
|
-
});
|
|
4295
|
-
};
|
|
4296
|
-
apply();
|
|
4297
|
-
const observer = new MutationObserver(schedule);
|
|
4298
|
-
observer.observe(document.body, {
|
|
4299
|
-
childList: true,
|
|
4300
|
-
subtree: true,
|
|
4301
|
-
characterData: true
|
|
4302
|
-
});
|
|
4303
|
-
return () => {
|
|
4304
|
-
observer.disconnect();
|
|
4305
|
-
if (frame !== void 0) window.cancelAnimationFrame(frame);
|
|
4306
|
-
};
|
|
4307
|
-
}
|
|
4308
4271
|
const SETTINGS_NAV_ICON_HTML = {
|
|
4309
4272
|
experts: "<path fill=\"currentColor\" d=\"M11.0307 5.46369C11.0305 3.78995 9.6734 2.43357 7.99961 2.43357C6.32601 2.43379 4.96972 3.79009 4.96949 5.46369C4.96949 7.13748 6.32587 8.49455 7.99961 8.49477C9.67354 8.49477 11.0307 7.13762 11.0307 5.46369ZM12.3163 5.46369C12.3163 7.84777 10.3837 9.78042 7.99961 9.78042C5.61572 9.7802 3.68288 7.84763 3.68288 5.46369C3.6831 3.07993 5.61586 1.14718 7.99961 1.14695C10.3836 1.14695 12.3161 3.0798 12.3163 5.46369Z\"/><path fill=\"currentColor\" d=\"M8.00002 10.3316C11.7343 10.3316 14.1864 11.8997 15.0387 14.4445L14.4292 14.6483L13.8197 14.8531C13.1955 12.9893 11.3673 11.6182 8.00002 11.6182C4.63277 11.6182 2.80455 12.9893 2.18031 14.8531L1.5708 14.6483L0.961304 14.4445C1.81368 11.8997 4.26579 10.3316 8.00002 10.3316Z\"/>",
|
|
4310
4273
|
skills: "<path fill=\"currentColor\" d=\"M12.5113 15.4067C12.4395 15.6249 12.1308 15.6249 12.059 15.4067L11.643 14.1416C11.454 13.567 11.0033 13.1164 10.4288 12.9274L9.16369 12.5113C8.94544 12.4395 8.94544 12.1308 9.16369 12.059L10.4288 11.643C11.0033 11.454 11.454 11.0033 11.643 10.4288L12.059 9.16369C12.1308 8.94544 12.4395 8.94544 12.5113 9.16369L12.9274 10.4288C13.1164 11.0033 13.567 11.454 14.1416 11.643L15.4067 12.059C15.6249 12.1308 15.6249 12.4395 15.4067 12.5113L14.1416 12.9274C13.567 13.1164 13.1164 13.567 12.9274 14.1416L12.5113 15.4067Z\"/><path fill=\"currentColor\" d=\"M9.02246 0.546878C9.9822 0.546878 10.7564 0.545403 11.374 0.612307C12.0042 0.680586 12.5515 0.826244 13.0273 1.17188C13.3052 1.37376 13.5501 1.61868 13.752 1.89649C14.0975 2.37225 14.2432 2.91984 14.3115 3.54981C14.3784 4.16727 14.377 4.94206 14.377 5.90137V8.51367C13.9611 8.29533 13.5071 8.13985 13.0273 8.06055V5.90137C13.0273 4.9121 13.0259 4.22322 12.9688 3.69532C12.9129 3.18044 12.8098 2.89782 12.6592 2.69043C12.5406 2.52724 12.3966 2.38326 12.2334 2.26465C12.026 2.11404 11.7437 2.0109 11.2285 1.95508C10.7005 1.89789 10.0122 1.89649 9.02246 1.89649H6.55371C5.56395 1.89649 4.87569 1.89787 4.34766 1.95508C3.83242 2.01092 3.55022 2.11398 3.34278 2.26465C3.17953 2.38329 3.03564 2.52719 2.91699 2.69043C2.76642 2.89782 2.66325 3.18042 2.60742 3.69532C2.55027 4.22322 2.54883 4.9121 2.54883 5.90137V10.0986C2.54883 11.0878 2.55031 11.7768 2.60742 12.3047C2.66326 12.8196 2.76642 13.1032 2.91699 13.3105C3.03558 13.4736 3.17966 13.6178 3.34278 13.7363C3.5502 13.8869 3.83265 13.9901 4.34766 14.0459C4.87568 14.1031 5.56398 14.1035 6.55371 14.1035H8.08399C8.27443 14.6025 8.55077 15.0585 8.89551 15.4541H6.55371C5.59402 15.4541 4.81976 15.4546 4.20215 15.3877C3.57204 15.3194 3.02468 15.1738 2.54883 14.8281C2.27111 14.6263 2.02606 14.3813 1.82422 14.1035C1.47883 13.6278 1.33293 13.08 1.26465 12.4502C1.19783 11.8327 1.19922 11.0579 1.19922 10.0986V5.90137C1.19922 4.94206 1.1978 4.16727 1.26465 3.54981C1.33295 2.91984 1.47867 2.37225 1.82422 1.89649C2.02613 1.61864 2.27098 1.37379 2.54883 1.17188C3.02472 0.826181 3.57197 0.6806 4.20215 0.612307C4.81976 0.545393 5.594 0.546877 6.55371 0.546878H9.02246ZM9.19629 9.14649H4.5459V7.84571H9.19629V9.14649ZM11.0303 6.10645H4.5459V4.80567H11.0303V6.10645Z\"/>",
|
|
@@ -4691,7 +4654,6 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
|
|
|
4691
4654
|
en
|
|
4692
4655
|
}), "michengai-codex-ui: dictionaries");
|
|
4693
4656
|
const t = ctx.locale.bind(NS);
|
|
4694
|
-
ctx.effect(() => observePermissionMenus(), "michengai-codex-ui: permission risk highlight");
|
|
4695
4657
|
ctx.effect(() => observeSlimSidebar(), "michengai-codex-ui: slim sidebar");
|
|
4696
4658
|
ctx.effect(() => observeSettingsNavIcons(), "michengai-codex-ui: settings nav icons");
|
|
4697
4659
|
ctx.effect(() => observeConversationHeader(), "michengai-codex-ui: conversation header");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@michengai/dsh-codex-ui",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.71",
|
|
4
4
|
"description": "以 Codex 风格重构 DSH Web 侧栏的独立客户端插件",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"publishConfig": {
|
|
@@ -51,10 +51,6 @@
|
|
|
51
51
|
"platform": "web"
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
|
-
"scripts": {
|
|
55
|
-
"build": "tsc --noEmit && tsdown",
|
|
56
|
-
"test": "tsx tests/permission-i18n.assert.ts && tsx tests/hover-tip.assert.ts && tsx tests/companion-slots.assert.ts && tsx tests/channel-api.assert.ts && tsx tests/schedule-sessions.assert.ts && tsx tests/session-tree.assert.ts && tsx tests/pinned-sessions.assert.ts && tsx tests/session-manager.assert.ts && tsx tests/workspace-browser.assert.ts && tsx tests/sidebar-search.assert.ts && tsx tests/settings-navigation.assert.ts && tsx tests/settings-nav-icons.assert.ts && tsx tests/locales.assert.ts && vitest run tests/client-runtime.integration.spec.ts && tsx tests/settings-integration.assert.ts && tsx tests/about-dependencies.assert.ts && tsx tests/dependency-manager.assert.ts && tsx tests/conversation-bubbles.assert.ts && tsx tests/conversation-header.assert.ts && tsx tests/conversation-visuals.assert.ts && tsdown && tsx tests/client-bundle.assert.ts && tsx tests/codex-suite.assert.ts"
|
|
57
|
-
},
|
|
58
54
|
"peerDependencies": {
|
|
59
55
|
"@deepseek-ai/cordis": ">=4.0.1 <5.0.0",
|
|
60
56
|
"@deepseek-ai/dsh-client-locale": ">=0.1.0-rc.0 <0.2.0",
|
|
@@ -100,5 +96,9 @@
|
|
|
100
96
|
"tsx": "^4.22.4",
|
|
101
97
|
"typescript": "^6.0.3",
|
|
102
98
|
"vitest": "^4.1.8"
|
|
99
|
+
},
|
|
100
|
+
"scripts": {
|
|
101
|
+
"build": "tsc --noEmit && tsdown",
|
|
102
|
+
"test": "tsx tests/hover-tip.assert.ts && tsx tests/companion-slots.assert.ts && tsx tests/channel-api.assert.ts && tsx tests/schedule-sessions.assert.ts && tsx tests/session-tree.assert.ts && tsx tests/pinned-sessions.assert.ts && tsx tests/session-manager.assert.ts && tsx tests/workspace-browser.assert.ts && tsx tests/sidebar-search.assert.ts && tsx tests/settings-navigation.assert.ts && tsx tests/settings-nav-icons.assert.ts && tsx tests/locales.assert.ts && vitest run tests/client-runtime.integration.spec.ts && tsx tests/settings-integration.assert.ts && tsx tests/about-dependencies.assert.ts && tsx tests/dependency-manager.assert.ts && tsx tests/conversation-bubbles.assert.ts && tsx tests/conversation-header.assert.ts && tsx tests/conversation-visuals.assert.ts && tsdown && tsx tests/client-bundle.assert.ts && tsx tests/codex-suite.assert.ts"
|
|
103
103
|
}
|
|
104
|
-
}
|
|
104
|
+
}
|