@xmanrui/dsh-im 4.19.0 → 4.19.1
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/lib/client.js +116 -10
- package/lib/index.js +210 -210
- package/package.json +1 -1
- package/plugin-src/client/bot-alias.js +78 -1
- package/plugin-src/client/styles.js +17 -8
- package/plugin-src/host/session-sync-coordinator.mjs +14 -13
- package/src/channels/feishu/bridge.mjs +219 -262
- package/src/channels/shared/session-sync-registry.mjs +16 -28
package/lib/client.js
CHANGED
|
@@ -582,7 +582,7 @@ var React30 = __toESM(require("react"), 1);
|
|
|
582
582
|
// package.json
|
|
583
583
|
var package_default = {
|
|
584
584
|
name: "@xmanrui/dsh-im",
|
|
585
|
-
version: "4.19.
|
|
585
|
+
version: "4.19.1",
|
|
586
586
|
description: "\u628A\u5341\u4E00\u79CD IM \u6E20\u9053\u548C\u516C\u7F51 AI Office \u63A5\u5165\u672C\u673A DeepSeek Harness\u3002 Connect eleven IM channels and a public AI Office to a local DeepSeek Harness.",
|
|
587
587
|
keywords: [
|
|
588
588
|
"deepseek-harness",
|
|
@@ -3105,12 +3105,109 @@ function AliasDialog({ bot, onSave, onClose }) {
|
|
|
3105
3105
|
);
|
|
3106
3106
|
return globalThis.document?.body ? (0, import_react_dom.createPortal)(content, document.body) : content;
|
|
3107
3107
|
}
|
|
3108
|
+
function BotNameTooltip({ anchorRef, id: id6, name: name2, onDismiss }) {
|
|
3109
|
+
const tooltipRef = React5.useRef(null);
|
|
3110
|
+
const [position, setPosition] = React5.useState(null);
|
|
3111
|
+
React5.useLayoutEffect(() => {
|
|
3112
|
+
const anchor = anchorRef.current;
|
|
3113
|
+
const tooltip = tooltipRef.current;
|
|
3114
|
+
if (!anchor || !tooltip) return void 0;
|
|
3115
|
+
const document2 = anchor.ownerDocument;
|
|
3116
|
+
const view = document2.defaultView;
|
|
3117
|
+
const place = () => {
|
|
3118
|
+
const rect = anchor.getBoundingClientRect();
|
|
3119
|
+
const { width, height } = tooltip.getBoundingClientRect();
|
|
3120
|
+
const viewport = document2.documentElement;
|
|
3121
|
+
const margin = 8;
|
|
3122
|
+
const below = rect.bottom + 6;
|
|
3123
|
+
setPosition({
|
|
3124
|
+
left: Math.max(margin, Math.min(rect.left, viewport.clientWidth - width - margin)),
|
|
3125
|
+
top: Math.max(margin, Math.min(
|
|
3126
|
+
below + height <= viewport.clientHeight - margin ? below : rect.top - height - 6,
|
|
3127
|
+
viewport.clientHeight - height - margin
|
|
3128
|
+
))
|
|
3129
|
+
});
|
|
3130
|
+
};
|
|
3131
|
+
const dismiss = (event) => {
|
|
3132
|
+
if (event.key === "Escape") {
|
|
3133
|
+
event.stopPropagation();
|
|
3134
|
+
onDismiss();
|
|
3135
|
+
}
|
|
3136
|
+
};
|
|
3137
|
+
place();
|
|
3138
|
+
view.addEventListener("resize", place);
|
|
3139
|
+
document2.addEventListener("scroll", onDismiss, true);
|
|
3140
|
+
document2.addEventListener("keydown", dismiss, true);
|
|
3141
|
+
return () => {
|
|
3142
|
+
view.removeEventListener("resize", place);
|
|
3143
|
+
document2.removeEventListener("scroll", onDismiss, true);
|
|
3144
|
+
document2.removeEventListener("keydown", dismiss, true);
|
|
3145
|
+
};
|
|
3146
|
+
}, [anchorRef, name2, onDismiss]);
|
|
3147
|
+
const body = anchorRef.current?.ownerDocument.body;
|
|
3148
|
+
return body ? (0, import_react_dom.createPortal)(h2("span", {
|
|
3149
|
+
ref: tooltipRef,
|
|
3150
|
+
id: id6,
|
|
3151
|
+
role: "tooltip",
|
|
3152
|
+
className: "dim-botNameTooltip",
|
|
3153
|
+
style: position ?? { visibility: "hidden" }
|
|
3154
|
+
}, name2), body) : null;
|
|
3155
|
+
}
|
|
3108
3156
|
function BotName({ bot, id: id6, disabled = false, onSave }) {
|
|
3109
3157
|
const [open, setOpen] = React5.useState(false);
|
|
3158
|
+
const nameRef = React5.useRef(null);
|
|
3159
|
+
const tooltipId = React5.useId();
|
|
3160
|
+
const [truncated, setTruncated] = React5.useState(false);
|
|
3161
|
+
const [hovered, setHovered] = React5.useState(false);
|
|
3162
|
+
const [focused, setFocused] = React5.useState(false);
|
|
3163
|
+
const [dismissed, setDismissed] = React5.useState(false);
|
|
3164
|
+
const dismissTooltip = React5.useCallback(() => setDismissed(true), []);
|
|
3165
|
+
const measure = React5.useCallback(() => {
|
|
3166
|
+
const node = nameRef.current;
|
|
3167
|
+
setTruncated(Boolean(node && node.scrollWidth > node.clientWidth));
|
|
3168
|
+
}, []);
|
|
3169
|
+
React5.useEffect(() => {
|
|
3170
|
+
const node = nameRef.current;
|
|
3171
|
+
if (!node) return void 0;
|
|
3172
|
+
measure();
|
|
3173
|
+
const view = node.ownerDocument.defaultView;
|
|
3174
|
+
const observer = view.ResizeObserver ? new view.ResizeObserver(measure) : null;
|
|
3175
|
+
observer?.observe(node);
|
|
3176
|
+
view.addEventListener("resize", measure);
|
|
3177
|
+
return () => {
|
|
3178
|
+
observer?.disconnect();
|
|
3179
|
+
view.removeEventListener("resize", measure);
|
|
3180
|
+
};
|
|
3181
|
+
}, [bot.name, measure]);
|
|
3182
|
+
const showTooltip = truncated && !dismissed && !open && (hovered || focused);
|
|
3110
3183
|
return h2(
|
|
3111
3184
|
"div",
|
|
3112
3185
|
{ className: "dim-aliasName" },
|
|
3113
|
-
h2("h3", {
|
|
3186
|
+
h2("h3", {
|
|
3187
|
+
id: id6,
|
|
3188
|
+
ref: nameRef,
|
|
3189
|
+
tabIndex: truncated ? 0 : void 0,
|
|
3190
|
+
"aria-describedby": showTooltip ? tooltipId : void 0,
|
|
3191
|
+
onMouseEnter: () => {
|
|
3192
|
+
measure();
|
|
3193
|
+
setHovered(true);
|
|
3194
|
+
setDismissed(false);
|
|
3195
|
+
},
|
|
3196
|
+
onMouseLeave: () => setHovered(false),
|
|
3197
|
+
onFocus: () => {
|
|
3198
|
+
measure();
|
|
3199
|
+
setFocused(true);
|
|
3200
|
+
setDismissed(false);
|
|
3201
|
+
},
|
|
3202
|
+
onBlur: () => setFocused(false),
|
|
3203
|
+
onClick: dismissTooltip
|
|
3204
|
+
}, bot.name),
|
|
3205
|
+
showTooltip ? h2(BotNameTooltip, {
|
|
3206
|
+
anchorRef: nameRef,
|
|
3207
|
+
id: tooltipId,
|
|
3208
|
+
name: bot.name,
|
|
3209
|
+
onDismiss: dismissTooltip
|
|
3210
|
+
}) : null,
|
|
3114
3211
|
h2(
|
|
3115
3212
|
"span",
|
|
3116
3213
|
{
|
|
@@ -16178,9 +16275,15 @@ var IM_STYLE_ID = "xmanrui-dsh-im-settings";
|
|
|
16178
16275
|
var CSS13 = String.raw`
|
|
16179
16276
|
.dim-aliasName { display: flex; align-items: center; gap: 4px; min-width: 0; }
|
|
16180
16277
|
.dim-aliasName h3 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
16278
|
+
.dim-aliasName h3:focus-visible { outline: 2px solid var(--dsw-alias-state-business-primary, #3370ff); outline-offset: 2px; border-radius: 3px; }
|
|
16279
|
+
.dim-botNameTooltip { position: fixed; z-index: 1000; box-sizing: border-box; width: max-content; max-width: min(320px, calc(100vw - 16px)); padding: 6px 9px; border: 1px solid var(--dsw-alias-border-l2, #dfe1e5); border-radius: 7px; color: var(--dsw-alias-label-primary, #1f2329); background: var(--dsw-alias-bg-layer-3, #fff); box-shadow: 0 8px 24px rgb(31 35 41 / 14%); font: 500 12px/18px -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; white-space: normal; overflow-wrap: anywhere; pointer-events: none; animation: dim-botNameTooltip-in .15s ease; }
|
|
16280
|
+
@keyframes dim-botNameTooltip-in { from { opacity: 0; } to { opacity: 1; } }
|
|
16281
|
+
@media (prefers-reduced-motion: reduce) { .dim-botNameTooltip { animation: none; } }
|
|
16181
16282
|
.dim-aliasEntry { display: inline-flex; flex: none; }
|
|
16182
|
-
.dim-aliasEdit { display: grid; place-items: center; width: 28px; height: 28px; padding: 4px; border: 0; border-radius: 5px; color: var(--dsw-alias-label-
|
|
16183
|
-
.dim-aliasEdit
|
|
16283
|
+
.dim-aliasEdit { display: grid; place-items: center; width: 28px; height: 28px; padding: 4px; border: 0; border-radius: 5px; color: var(--dsw-alias-label-tertiary, #8f959e); background: transparent; cursor: pointer; }
|
|
16284
|
+
.dim-aliasEdit svg { opacity: .55; transition: opacity .15s ease; }
|
|
16285
|
+
.dim-aliasName:hover .dim-aliasEdit:not(:disabled) svg, .dim-aliasEdit:focus-visible svg { opacity: 1; }
|
|
16286
|
+
.dim-aliasEdit:hover:not(:disabled), .dim-aliasEdit:focus-visible { color: var(--dsw-alias-state-business-primary, #3370ff); background: var(--dsw-alias-interactive-bg-hover, #f7f8fa); }
|
|
16184
16287
|
.dim-aliasDialog { box-sizing: border-box; width: min(380px, calc(100% - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 22px; border: 1px solid var(--dsw-alias-border-l2, #dfe1e5); border-radius: 12px; color: var(--dsw-alias-label-primary, #1f2329); background: var(--dsw-alias-bg-layer-3, #fff); box-shadow: 0 12px 36px rgb(0 0 0 / 18%); font: 13px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
|
|
16185
16288
|
.dim-aliasDialog * { box-sizing: border-box; }
|
|
16186
16289
|
.dim-aliasDialog::backdrop { background: rgb(15 17 21 / 30%); }
|
|
@@ -16576,9 +16679,9 @@ var CSS13 = String.raw`
|
|
|
16576
16679
|
/* Header tooltips may extend beyond the card; the collapsible body clips its own content. */
|
|
16577
16680
|
.dim-panel .dim-botCard { position: relative; min-width: 0; width: 100%; max-width: 100%; overflow: visible; border: 1px solid var(--dsw-alias-border-l2, #e5e6eb); border-radius: 14px; background: var(--dsw-alias-bg-layer-1, #fff); box-shadow: 0 1px 2px rgb(31 35 41 / 3%); }
|
|
16578
16681
|
.dim-panel .dim-botCard::before { display: none; }
|
|
16579
|
-
.dim-panel .dim-botCardBody { position: relative; min-width: 0; width: 100%; max-width: 100%; padding: 12px; }
|
|
16682
|
+
.dim-panel .dim-botCardBody { position: relative; min-width: 0; width: 100%; max-width: 100%; padding: 12px 8px; }
|
|
16580
16683
|
.dim-collapsibleAccount { min-width: 0; display: flex; flex-direction: column; }
|
|
16581
|
-
.dim-collapsibleHead { min-width: 0; display: flex; align-items: center; gap:
|
|
16684
|
+
.dim-collapsibleHead { min-width: 0; display: flex; align-items: center; gap: 4px; cursor: pointer; user-select: none; -webkit-user-select: none; }
|
|
16582
16685
|
.dim-collapsibleHead:focus-visible { outline: 2px solid var(--dsw-alias-state-business-primary, #3370ff); outline-offset: 2px; border-radius: 8px; }
|
|
16583
16686
|
.dim-collapsibleHeaderContent { min-width: 0; flex: 1 1 auto; display: flex; align-items: center; }
|
|
16584
16687
|
.dim-collapsibleChevron { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 9px; height: 9px; border-right: 1.6px solid var(--dsw-alias-label-tertiary, #8f959e); border-bottom: 1.6px solid var(--dsw-alias-label-tertiary, #8f959e); transform: rotate(-45deg); transition: transform .22s cubic-bezier(.4, 0, .2, 1); transform-origin: 50% 50%; }
|
|
@@ -16588,14 +16691,17 @@ var CSS13 = String.raw`
|
|
|
16588
16691
|
.dim-collapsibleAccount.is-open > .dim-collapsibleBody { grid-template-rows: 1fr; }
|
|
16589
16692
|
.dim-collapsibleBodyInner { min-height: 0; overflow: hidden; }
|
|
16590
16693
|
.dim-collapsibleAccount:not(.is-open) .dim-collapsibleBodyInner { visibility: hidden; }
|
|
16591
|
-
|
|
16592
|
-
|
|
16694
|
+
/* Reclaim horizontal spacing for names while keeping status on the same row,
|
|
16695
|
+
including when a channel's mobile stylesheet requests a column layout. */
|
|
16696
|
+
.dim-panel .dim-botCardTop { min-width: 0; width: 100%; max-width: 100%; display: flex; flex-direction: row; flex-wrap: nowrap; align-items: flex-start; justify-content: space-between; gap: 6px; }
|
|
16697
|
+
.dim-panel .dim-botIdentity { min-width: 0; flex: 1 1 0; display: flex; align-items: center; gap: 6px; }
|
|
16593
16698
|
.dim-panel .dim-botAvatar { flex: none; width: 38px; height: 38px; display: grid; place-items: center; overflow: hidden; border-radius: 11px; box-shadow: none; }
|
|
16594
16699
|
.dim-panel .dim-botAvatar svg { width: 27px; height: 27px; }
|
|
16595
|
-
.dim-panel .dim-botName { min-width: 0; }
|
|
16700
|
+
.dim-panel .dim-botName { min-width: 0; flex: 1; }
|
|
16701
|
+
.dim-panel .dim-aliasName { gap: 2px; }
|
|
16596
16702
|
.dim-panel .dim-botName h3 { overflow: hidden; margin: 0; color: var(--dsw-alias-label-primary, #1f2329); font-size: 15px; font-weight: 650; line-height: normal; text-overflow: ellipsis; white-space: nowrap; }
|
|
16597
16703
|
.dim-panel .dim-botName p { overflow: hidden; margin: 4px 0 0; color: var(--dsw-alias-label-secondary, #646a73); font: 12px ui-monospace, SFMono-Regular, monospace; line-height: normal; text-overflow: ellipsis; white-space: nowrap; }
|
|
16598
|
-
.dim-panel .dim-botCardTools { flex: none; display: flex; align-items: flex-start; gap:
|
|
16704
|
+
.dim-panel .dim-botCardTools { flex: none; display: flex; align-items: flex-start; gap: 4px; }
|
|
16599
16705
|
.dim-panel .dim-botHealthGroup { min-width: 0; max-width: 100%; flex: none; display: grid; justify-items: end; gap: 5px; }
|
|
16600
16706
|
.dim-panel .dim-botCard .dim-botHealth { flex: none; min-height: 0; display: inline-flex; align-items: center; gap: 7px; padding: 0; border: 0; border-radius: 0; color: var(--dsw-alias-label-secondary, #646a73); background: transparent; font: inherit; font-size: 12px; font-weight: 400; line-height: normal; white-space: nowrap; }
|
|
16601
16707
|
.dim-panel .dim-lastChecked { display: inline-flex; align-items: baseline; gap: 4px; color: var(--dsw-alias-label-tertiary, #8f959e); font: inherit; font-size: 11px; font-weight: 400; line-height: normal; white-space: nowrap; }
|