@michengai/dsh-im-connect 0.1.2 → 0.1.4

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.
Files changed (3) hide show
  1. package/client.js +206 -46
  2. package/lib/client.js +206 -46
  3. package/package.json +7 -3
package/client.js CHANGED
@@ -103,11 +103,10 @@ window.__ModuleLoader__.load({
103
103
  .ima-empty{color:var(--ima-muted);font-size:12px;padding:12px 8px}
104
104
  .ima-logo{width:28px;height:28px;flex:none;display:block;line-height:0;background:transparent}
105
105
  .ima-logo svg{width:28px;height:28px;display:block}
106
- .ima-logo.sm{width:16px;height:16px;overflow:visible}
107
- .ima-logo.sm svg{width:16px;height:16px}
108
- .ima-logo.sm[data-brand="weixin"] svg,.ima-logo.sm[data-brand="feishu"] svg,.ima-logo.sm[data-brand="lark"] svg,.ima-logo.sm[data-brand="telegram"] svg,.ima-logo.sm[data-brand="qq"] svg{transform:scale(1.2);transform-origin:center}
106
+ .ima-logo.sm{width:16px;height:16px;overflow:hidden;display:grid;place-items:center}
107
+ .ima-logo.sm svg{width:16px;height:16px;transform:none}
109
108
  .ima-logo[data-brand="wecom"]{border-radius:6px;box-shadow:inset 0 0 0 1px rgba(15,23,42,.12);overflow:hidden;background:#fff}
110
- .ima-logo.sm[data-brand="wecom"]{border-radius:4px}
109
+ .ima-logo.sm[data-brand="wecom"]{border-radius:4px;box-shadow:none;background:transparent}
111
110
  .ima-mask{position:fixed;inset:0;background:var(--dsw-alias-bg-mask-1,rgba(0,0,0,.45));backdrop-filter:var(--dsw-mask-blur,blur(8px));display:grid;place-items:center;z-index:80;padding:24px}
112
111
  .ima-modal{width:min(440px,100%);background:var(--dsw-alias-bg-layer-2,#fff);color:var(--ima-text);border:1px solid var(--ima-line);border-radius:16px;padding:20px 22px 22px;text-align:left;box-shadow:var(--dsw-shadow-lv3,0 16px 48px rgba(0,0,0,.18))}
113
112
  .ima-modal-h{display:flex;align-items:center;justify-content:space-between;margin-bottom:14px}
@@ -150,7 +149,7 @@ window.__ModuleLoader__.load({
150
149
  }, children);
151
150
 
152
151
  if (id === "dingtalk") {
153
- return svg("0 0 48 48", [
152
+ return svg("6 6 36 36", [
154
153
  h("rect", { key: "bg", x: 6, y: 6, width: 36, height: 36, rx: 8, fill: "#0285fc" }),
155
154
  h("path", { key: "mark", d: "m20.178 37.577 3.5-6h-3l2-3c-5.5-1-6.281-3.938-6-4.5.162-.325 2.5 1 6.281 1-8.281-.5-8.281-7-7.781-7.5.423-.424 2.44 1.666 6.564 3.53-9.126-4.314-6.453-11.956-5.064-11.03 3.344 3 9.5 8.5 15 13 .658.538 1 2 0 3.25s-2.5 2.75-3 3.25h2.5z", fill: "#fff" }),
156
155
  ]);
@@ -801,7 +800,7 @@ window.__ModuleLoader__.load({
801
800
  );
802
801
  }
803
802
 
804
- const WB_CSS = `.dcu-wb,.ima-native{display:flex;flex:1;min-height:0;flex-direction:column;padding:0;padding-right:var(--dsh-sidebar-inline-padding,12px);box-sizing:border-box;color:var(--dsw-alias-label-primary,var(--ima-text));font:14px/20px inherit}.ima-n-head{flex:none;display:flex;align-items:center;height:36px;padding-left:4px;margin:2px 0 4px;color:var(--dsw-alias-label-tertiary,#81858C);font:14px/20px inherit}.ima-native-tree,.dcu-wb-tree{padding:0 0 16px 4px;scrollbar-gutter:stable}.ima-native-project+.ima-native-project,.dcu-wb-project+.dcu-wb-project{margin-top:4px}.ima-native-project>*+*,.dcu-wb-project>*+*{margin-top:2px}
803
+ const WB_CSS = `.dcu-wb,.ima-native{display:flex;flex:1;min-height:0;flex-direction:column;padding:0;padding-right:var(--dsh-sidebar-inline-padding,12px);box-sizing:border-box;color:var(--dsw-alias-label-primary,var(--ima-text));font:14px/20px inherit}.ima-n-toolbar{box-sizing:border-box;flex:none;height:36px;margin:2px -4px 4px 0;padding-left:4px;display:flex;justify-content:flex-end;align-items:center;gap:4px;overflow:visible;position:relative;z-index:2;color:var(--dsw-alias-label-tertiary,#81858C);border-radius:12px}.ima-n-head-label{white-space:nowrap;min-width:0;max-width:45%;flex:none;line-height:20px;font-size:14px;overflow:hidden;transition:max-width .18s var(--ds-ease-in-out,ease),margin-right .18s var(--ds-ease-in-out,ease),opacity .12s var(--ds-ease-in-out,ease),transform .18s var(--ds-ease-in-out,ease),visibility 0s linear}.ima-n-toolbar.is-search .ima-n-head-label{opacity:0;visibility:hidden;max-width:0;margin-right:-4px;transform:translate(-4px);transition-delay:0s,0s,0s,0s,.18s}.ima-n-search-slot{box-sizing:border-box;min-width:28px;max-width:28px;transition:max-width .18s var(--ds-ease-in-out,ease);flex:none;align-items:center;margin-left:auto;display:flex;position:relative;z-index:2}.ima-n-toolbar.is-search .ima-n-search-slot{flex:1;min-width:0;max-width:100%}.ima-n-search{box-sizing:border-box;cursor:text;width:100%;height:28px;color:var(--dsw-alias-label-secondary);transition:width .18s var(--ds-ease-in-out,ease),padding .18s var(--ds-ease-in-out,ease),border-color .18s var(--ds-ease-in-out,ease);background:transparent;border:none;border-radius:50%;flex:none;align-items:center;margin:0;padding:0;display:flex;overflow:hidden}.ima-n-toolbar.is-search .ima-n-search{border:1px solid var(--dsw-alias-border-l2,rgba(255,255,255,.10));width:calc(100% + 4px);height:30px;border-radius:10px;margin-inline:-2px;padding:0 4px 0 0}.ima-n-search-btn,.ima-n-head-btn{cursor:pointer;width:28px;height:28px;min-width:28px;min-height:28px;position:relative;z-index:1;color:var(--dsw-alias-label-secondary);background:transparent;border:none;border-radius:50%;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.ima-n-toolbar.is-search .ima-n-search-btn{width:28px;height:30px}.ima-n-search-btn:hover,.ima-n-head-btn:hover,.ima-n-head-btn.on{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06));color:var(--dsw-alias-label-primary,var(--ima-text))}.ima-n-toolbar.is-search .ima-n-search-btn:hover{background:transparent}.ima-n-head-acts{opacity:1;visibility:visible;max-width:32px;transition:max-width .18s var(--ds-ease-in-out,ease),opacity .12s var(--ds-ease-in-out,ease),transform .18s var(--ds-ease-in-out,ease),visibility 0s linear;flex:none;align-items:center;gap:4px;display:flex;overflow:visible;position:relative}.ima-n-toolbar.is-search .ima-n-head-acts{opacity:0;visibility:hidden;pointer-events:none;max-width:0;transform:translate(4px);transition-delay:0s,0s,0s,.18s}.ima-n-head-filter{position:relative}.ima-n-search-input{display:none;opacity:0;pointer-events:none;width:0;min-width:0;flex:none;color:var(--dsw-alias-label-primary,var(--ima-text));transition:opacity .12s var(--ds-ease-in-out,ease);background:transparent;border:none;outline:none;flex:1;font-size:13px;line-height:18px}.ima-n-toolbar.is-search .ima-n-search-input{display:block;opacity:1;pointer-events:auto;margin-left:-2px;width:auto;flex:1;min-width:0}.ima-n-search-input::placeholder{color:var(--dsw-alias-label-tertiary,#81858C)}.ima-n-search-clear{cursor:pointer;width:24px;height:24px;color:var(--dsw-alias-label-secondary);background:transparent;border:none;border-radius:50%;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.ima-n-search-clear:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06))}@media (prefers-reduced-motion:reduce){.ima-n-head-label,.ima-n-search-slot,.ima-n-search,.ima-n-head-acts,.ima-n-search-input{transition:none}}.ima-n-filter-menu{position:absolute;right:0;top:calc(100% + 6px);z-index:30;min-width:196px;padding:8px 6px;border:1px solid var(--dsw-alias-border-inverted,rgba(255,255,255,.12));border-radius:12px;background:var(--dsw-specific-menu,var(--dsw-alias-bg-layer-2,#1c2128));box-shadow:var(--dsw-shadow-lv3,0 8px 24px rgba(0,0,0,.36))}.ima-n-filter-label{padding:6px 10px 4px;font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary,#81858C)}.ima-n-filter-split{height:1px;margin:6px 8px;background:var(--dsw-alias-border-l2,rgba(255,255,255,.1))}.ima-n-filter-menu button{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;min-height:36px;padding:6px 10px;border:0;border-radius:8px;background:transparent;color:inherit;font:14px/20px inherit;cursor:pointer;text-align:left}.ima-n-filter-menu button:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06))}.ima-n-filter-tick{width:16px;height:16px;flex:none}.ima-native-tree,.dcu-wb-tree{padding:0 0 16px;scrollbar-gutter:stable}.ima-native-project+.ima-native-project,.dcu-wb-project+.dcu-wb-project{margin-top:4px}.ima-native-project>*+*,.dcu-wb-project>*+*{margin-top:2px}
805
804
  .dcu-wb *,.ima-native *{box-sizing:border-box}
806
805
  .dcu-wb-tree,.ima-native-tree{flex:1;min-height:0;overflow-y:auto;padding-bottom:16px;user-select:none}
807
806
  .dcu-wb-project-head,.ima-native-head,.dcu-wb-session,.ima-native-session{display:flex;align-items:center;gap:6px;width:100%;border:0;border-radius:8px;padding:0 8px;background:transparent;color:inherit;cursor:pointer;font:inherit;text-align:left}
@@ -820,16 +819,20 @@ window.__ModuleLoader__.load({
820
819
  .ima-sess-menu button:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06))}
821
820
  .ima-sess-menu button.danger{color:var(--dsw-alias-state-error-primary,var(--ima-danger))}
822
821
  .ima-rename{flex:1;min-width:0;min-height:28px;padding:2px 8px;border-radius:6px;border:1px solid var(--dsw-alias-stroke-primary,var(--ima-line));background:transparent;color:inherit;font:inherit}
823
- .ima-n-row,.ima-n-sess{display:flex;align-items:center;gap:6px;border-radius:8px;padding:0 8px;cursor:pointer;user-select:none;width:100%;border:0;background:transparent;color:var(--dsw-alias-label-primary,var(--ima-text));font:14px/20px inherit;text-align:left;box-sizing:border-box}
822
+ .ima-n-row,.ima-n-sess{display:flex;align-items:center;gap:6px;border-radius:8px;padding:0 8px 0 12px;cursor:pointer;user-select:none;width:100%;border:0;background:transparent;color:var(--dsw-alias-label-primary,var(--ima-text));font:14px/20px inherit;text-align:left;box-sizing:border-box}
824
823
  .ima-n-row{height:34px}
825
824
  .ima-n-sess{height:32px;gap:0;position:relative}
826
825
  .ima-n-row:hover,.ima-n-sess:hover,.ima-n-sess.on,.ima-n-row.menu-on,.ima-n-sess.menu-on{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06))}
827
826
  .ima-n-slot{flex:none;width:16px;height:20px;display:inline-flex;align-items:center;justify-content:center;color:var(--dsw-alias-label-tertiary,#81858C)}.ima-run-dot{flex:none;color:var(--dsw-static-deepseek-450,#4c8dff)}.ima-run-dot-cell{fill:currentColor;opacity:.15;animation:ima-run-chase 1s infinite}@keyframes ima-run-chase{0%,12.4%{opacity:1}12.5%,24.9%{opacity:.6}25%,37.4%{opacity:.35}37.5%,100%{opacity:.15}}
828
- .ima-n-row .ima-n-chevron{display:none;color:var(--dsw-alias-label-caption,#ADB2B8)}
829
- .ima-n-row:hover .ima-n-chevron{display:inline-flex}
830
- .ima-n-row:hover .ima-n-folder{display:none}
831
- .ima-n-arrow{transition:transform .15s ease}
832
- .ima-n-arrow.open{transform:rotate(90deg)}
827
+ .ima-n-folder{color:var(--dsw-alias-label-secondary,#9ca39f)}
828
+ .ima-n-lead{color:var(--dsw-alias-label-tertiary,#81858C)}
829
+ .ima-n-corner{color:var(--dsw-alias-label-caption,#ADB2B8);width:8px}
830
+ .ima-n-hover{position:fixed;z-index:4100;min-width:188px;max-width:280px;padding:12px 14px;border:1px solid var(--dsw-alias-border-inverted,rgba(255,255,255,.12));border-radius:12px;background:var(--dsw-specific-menu,var(--dsw-alias-bg-layer-2,#1c2128));box-shadow:var(--dsw-shadow-lv3,0 8px 24px rgba(0,0,0,.36));color:var(--dsw-alias-label-primary,var(--ima-text))}
831
+ .ima-n-hover-title{font-size:14px;line-height:20px;font-weight:500}
832
+ .ima-n-hover-time{margin-top:4px;font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary,#81858C)}
833
+ .ima-n-hover-state{display:flex;align-items:center;gap:6px;margin-top:8px;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary,#9ca39f)}
834
+ .ima-n-hover-dot{width:8px;height:8px;border-radius:50%;background:#34c759;flex:none}
835
+ .ima-n-hover-dot.is-run{background:#4c8dff}
833
836
  .ima-n-title{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px;line-height:20px;flex:1;font-weight:400}
834
837
  .ima-n-sess .ima-n-title{margin:0 6px 0 4px}
835
838
  .ima-n-time{flex:none;font-size:12px;line-height:20px;color:var(--dsw-alias-label-tertiary,#81858C)}
@@ -875,14 +878,93 @@ window.__ModuleLoader__.load({
875
878
  return NativeSvg("0 0 16 16", 16, NativePath("M14.478 4.841 14.214 10.115c-.104 2.072-.147 2.896-.827 3.846a3.53 3.53 0 0 1-1.044.993c-.519.333-1.101.478-1.784.546-.671.067-1.509.066-2.559.066s-1.887.001-2.558-.066c-.683-.068-1.266-.213-1.784-.546a3.53 3.53 0 0 1-1.044-.993c-.681-.95-.724-1.774-.828-3.846L1.522 4.841l1.368-.068.263 5.273c.109 2.176.171 2.556.573 3.117a2.16 2.16 0 0 0 .673.64c.263.169.603.277 1.179.334.587.059 1.345.06 2.422.06s1.834-.001 2.422-.06c.575-.057.916-.165 1.179-.335.262-.168.49-.386.672-.64.402-.56.464-.94.573-3.116l.263-5.273 1.369.068ZM5.43 6.228h1.37v5.163H5.43V6.228Zm3.77 0h1.37v5.163H9.2V6.228ZM8.536.434c.644 0 1.116-.007 1.56.137.14.045.276.101.406.168.416.212.745.552 1.2 1.007l.796.795h2.876v1.37H.626V2.541h2.876l.796-.795c.456-.455.784-.795 1.2-1.007.13-.067.266-.123.405-.168C6.348.427 6.82.434 7.464.434h1.072Zm-1.072 1.37c-.732 0-.948.008-1.138.07a2.2 2.2 0 0 0-.206.085c-.156.08-.296.204-.678.583h5.117c-.382-.379-.522-.503-.679-.583a2.2 2.2 0 0 0-.205-.085c-.191-.062-.406-.07-1.138-.07H7.464Z"));
876
879
  }
877
880
  function IconFolderClose() {
878
- return NativeSvg("0 0 16 16", 16, NativePath("M6.556 3.377 6.007 3.725l.549-.348ZM14.5 12.342h.65V6.397h-.65-.65v5.945h.65Zm-1.674-7.618v-.65H8.023v.65h4.803Zm-5.746-.519.55-.347-.525-.828-.549.348-.549.348.525.828.55-.348ZM5.613 2.858h0H3.174v.65h2.439v-.65ZM3 4.532v8.46h.65V4.532H3Zm11.326 9.484v-.65H4.674v.65h9.652ZM3 12.342h-.65A2.324 2.324 0 0 0 4.674 14.666v-1.3A.824.824 0 0 1 3.65 12.342H3Zm.174-9.484h0A2.324 2.324 0 0 0 2.35 4.532h1.3A.824.824 0 0 1 4.674 3.508h0V2.858Zm3.382.519.549-.348A1.824 1.824 0 0 0 5.613 2.208v1.3c.16 0 .308.082.394.217l.549-.348Zm1.467 1.347h0c-.16 0-.308-.082-.393-.216l-.55.347-.549.348A1.824 1.824 0 0 0 8.023 5.374v-1.3ZM14.5 6.397h.65A2.324 2.324 0 0 0 12.826 4.073v1.3c.565 0 1.024.458 1.024 1.024h.65Zm0 5.945h-.65c0 .565-.458 1.024-1.024 1.024v1.3A2.324 2.324 0 0 0 15.15 12.342h-.65Z"));
881
+ return NativeSvg("0 0 16 16", 16, h("path", { fill: "currentColor", transform: "translate(1.5 2.429)", d: "M5.05582 0.518756L4.50669 0.86654L5.05582 0.518756ZM13 9.4837L13.65 9.4837L13.65 3.53962L13 3.53962L12.35 3.53962L12.35 9.4837L13 9.4837ZM11.3264 1.86603L11.3264 1.21603L6.52313 1.21603L6.52313 1.86603L6.52313 2.51603L11.3264 2.51603L11.3264 1.86603ZM5.58054 1.34727L6.12968 0.999489L5.60495 0.170972L5.05582 0.518756L4.50669 0.86654L5.03141 1.69506L5.58054 1.34727ZM4.11323 1.23058e-13L4.11323 -0.65L1.67359 -0.65L1.67359 5.00699e-14L1.67359 0.65L4.11323 0.65L4.11323 1.23058e-13ZM0 1.67359L-0.65 1.67359L-0.65 9.4837L0 9.4837L0.65 9.4837L0.65 1.67359L0 1.67359ZM11.3264 11.1573L11.3264 10.5073L1.67359 10.5073L1.67359 11.1573L1.67359 11.8073L11.3264 11.8073L11.3264 11.1573ZM0 9.4837L-0.65 9.4837C-0.65 10.767 0.390308 11.8073 1.67359 11.8073L1.67359 11.1573L1.67359 10.5073C1.10828 10.5073 0.65 10.049 0.65 9.4837L0 9.4837ZM1.67359 5.00699e-14L1.67359 -0.65C0.390307 -0.65 -0.65 0.390309 -0.65 1.67359L0 1.67359L0.65 1.67359C0.65 1.10828 1.10828 0.65 1.67359 0.65L1.67359 5.00699e-14ZM5.05582 0.518756L5.60495 0.170972C5.28121 -0.340193 4.71829 -0.65 4.11323 -0.65L4.11323 1.23058e-13L4.11323 0.65C4.27282 0.65 4.4213 0.731715 4.50669 0.86654L5.05582 0.518756ZM6.52313 1.86603L6.52313 1.21603C6.36354 1.21603 6.21507 1.13431 6.12968 0.999489L5.58054 1.34727L5.03141 1.69506C5.35515 2.20622 5.91808 2.51603 6.52313 2.51603L6.52313 1.86603ZM13 3.53962L13.65 3.53962C13.65 2.25634 12.6097 1.21603 11.3264 1.21603L11.3264 1.86603L11.3264 2.51603C11.8917 2.51603 12.35 2.97431 12.35 3.53962L13 3.53962ZM13 9.4837L12.35 9.4837C12.35 10.049 11.8917 10.5073 11.3264 10.5073L11.3264 11.1573L11.3264 11.8073C12.6097 11.8073 13.65 10.767 13.65 9.4837L13 9.4837Z" }));
879
882
  }
880
883
  function IconFolderOpen() {
881
- return NativeSvg("0 0 16 16", 16, NativePath("M5.196 1.571c.615 0 1.19.308 1.532.819l.471.708c.086.128.23.205.383.205h4.588A2.666 2.666 0 0 1 14.586 5.72v.907c.683.4 1.074 1.223.852 2.06l-1.053 3.971A2.666 2.666 0 0 1 12.05 14.453H2.917A2.416 2.416 0 0 1 .502 11.952V3.987A2.416 2.416 0 0 1 2.918 1.571h2.278Zm-1.417 6.185c-.469 0-.88.316-1.001.77l-.862 3.247c-.174.657.322 1.301 1.001 1.301H12.05c.469 0 .88-.316 1.001-.77l1.053-3.97c.078-.291-.142-.577-.444-.577H3.779Zm-.861-4.804c-.572 0-1.035.464-1.035 1.035v3.307a2.67 2.67 0 0 1 1.896-.919h9.426V5.72c0-.572-.464-1.035-1.035-1.035H7.582c-.615 0-1.19-.309-1.531-.82L5.579 3.156a.666.666 0 0 0-.383-.204H2.918Z"));
884
+ return NativeSvg("0 0 16 16", 16, [
885
+ NativePath("M5.19629 1.57104C5.81144 1.5711 6.38623 1.8786 6.72754 2.39038L7.19922 3.09839C7.28454 3.22635 7.42824 3.30344 7.58203 3.30347H12.1699C13.5039 3.30348 14.5859 4.38548 14.5859 5.71948V6.62671C15.2694 7.02689 15.6605 7.85012 15.4385 8.68726L14.3848 12.658C14.1037 13.7164 13.1449 14.4527 12.0498 14.4529H2.91699C1.51651 14.4529 0.451662 13.2814 0.501954 11.9519V3.98706C0.501954 2.65305 1.58396 1.57104 2.91797 1.57104H5.19629ZM3.7793 7.75562C3.30994 7.75562 2.89883 8.07153 2.77832 8.52515L1.91602 11.7722C1.74167 12.4291 2.23734 13.073 2.91699 13.073H12.0498C12.5191 13.0728 12.9304 12.757 13.0508 12.3035L14.1045 8.33374C14.1819 8.04202 13.9619 7.756 13.6602 7.75562H3.7793ZM2.91797 2.9519C2.34625 2.9519 1.88281 3.41534 1.88281 3.98706V7.2937C2.33068 6.7269 3.02249 6.37476 3.7793 6.37476H13.2051V5.71948C13.2051 5.14777 12.7416 4.68434 12.1699 4.68433H7.58203C6.96675 4.6843 6.39209 4.37595 6.05078 3.86401L5.5791 3.15601C5.49379 3.02821 5.34995 2.95196 5.19629 2.9519H2.91797Z"),
886
+ h("path", { fill: "currentColor", opacity: "0.2", d: "M13.6602 7.75525C13.9618 7.7556 14.1815 8.04179 14.1045 8.33337L13.0508 12.3031C12.9304 12.7567 12.5191 13.0725 12.0498 13.0726H2.91701C2.23744 13.0725 1.7417 12.4287 1.91603 11.7719L2.77834 8.52478C2.89898 8.07146 3.31018 7.75532 3.77931 7.75525H13.6602ZM5.1963 2.95154C5.34985 2.95159 5.49377 3.02803 5.57912 3.15564L6.0508 3.86365C6.39205 4.37553 6.96685 4.68385 7.58205 4.68396H12.1699C12.7416 4.68396 13.2049 5.14754 13.2051 5.71912V6.37439H3.77931C3.02267 6.37444 2.33067 6.72671 1.88283 7.29333V3.98669C1.88299 3.4152 2.34649 2.95168 2.91798 2.95154H5.1963Z" }),
887
+ ]);
882
888
  }
883
889
  function IconChevron() {
884
890
  return NativeSvg("0 0 14 14", 14, NativePath("M4.25 2.828v8.344c0 .49.592.735.939.389l4.172-4.172a.55.55 0 0 0 0-.778L5.189 2.439c-.347-.347-.939-.101-.939.389Z"));
885
891
  }
892
+ function IconSearchOutline(props) {
893
+ const size = props && props.size ? props.size : 16;
894
+ return NativeSvg("0 0 16 16", size, [
895
+ NativePath("M11.894845 6.647401C11.894845 3.725463 9.534486 1.356779 6.623219 1.35657C3.711786 1.35657 1.351635 3.725338 1.351635 6.647401C1.351843 9.569296 3.711911 11.938273 6.623219 11.938273C9.534361 11.938064 11.894637 9.569171 11.894845 6.647401ZM13.245462 6.647401C13.245254 10.317935 10.280401 13.293613 6.623219 13.293821C2.965871 13.293821 0.000204 10.31806 0 6.647401C0 2.976574 2.965746 0 6.623219 0C10.280526 0.000205 13.245462 2.9767 13.245462 6.647401Z"),
896
+ NativePath("M16.000417 15.041079L15.044449 16.000433L11.530434 12.473588L12.486298 11.514234L16.000417 15.041079Z"),
897
+ ]);
898
+ }
899
+ function IconSliders() {
900
+ return NativeSvg("0 0 16 16", 16, NativePath("M2.2 3.4h6.05a1.85 1.85 0 0 0 3.5 0H13.8v1.3H11.75a1.85 1.85 0 0 0-3.5 0H2.2V3.4Zm8.6 1.15A.75.75 0 1 1 10.05 4.55.75.75 0 0 1 10.8 4.55ZM2.2 7.35h2.35a1.85 1.85 0 0 0 3.5 0H13.8v1.3H8.05a1.85 1.85 0 0 0-3.5 0H2.2V7.35Zm4.1 1.15A.75.75 0 1 1 5.55 8.5a.75.75 0 0 1 .75-.75ZM2.2 11.3h7.35a1.85 1.85 0 0 0 3.5 0H13.8v1.3h-.75a1.85 1.85 0 0 0-3.5 0H2.2v-1.3Zm9.9 1.15a.75.75 0 1 1-.75-.75.75.75 0 0 1 .75.75Z"));
901
+ }
902
+ function IconCloseOutline(props) {
903
+ const size = props && props.size ? props.size : 16;
904
+ return NativeSvg("0 0 16 16", size, [
905
+ NativePath("M14.1168 13.197L13.197 14.1167L1.8833 2.80303L2.80309 1.88324L14.1168 13.197Z"),
906
+ NativePath("M13.197 1.88326L14.1168 2.80305L2.80309 14.1168L1.8833 13.197L13.197 1.88326Z"),
907
+ ]);
908
+ }
909
+ function IconCheckOutline() {
910
+ return NativeSvg("0 0 16 16", 16, NativePath("M15.0498 3.92579L8.49512 12.3818C8.25774 12.6881 8.04517 12.9645 7.84668 13.1689C7.63957 13.3823 7.38732 13.5841 7.04492 13.6719C6.86373 13.7183 6.6757 13.7346 6.48926 13.7197C6.13666 13.6915 5.8528 13.5355 5.6123 13.3604C5.38201 13.1926 5.12573 12.9567 4.83984 12.6953L1.03125 9.21289L1.96875 8.1875L5.77734 11.6699C6.08684 11.9529 6.27773 12.1249 6.43066 12.2363C6.50183 12.2882 6.54699 12.3135 6.57324 12.3252C6.58525 12.3305 6.59269 12.3322 6.5957 12.333C6.59802 12.3336 6.59961 12.334 6.59961 12.334C6.63317 12.3367 6.66758 12.3335 6.7002 12.3252C6.7002 12.3252 6.70211 12.3251 6.7041 12.3242C6.70698 12.3229 6.71348 12.319 6.72461 12.3115C6.74849 12.2956 6.78843 12.2642 6.84961 12.2012C6.98138 12.0654 7.13957 11.8628 7.39648 11.5313L13.9502 3.07422L15.0498 3.92579Z"));
911
+ }
912
+ function FilterRow({ label, selected, onSelect }) {
913
+ return h("button", { type: "button", className: selected ? "on" : undefined, onClick: onSelect },
914
+ h("span", null, label),
915
+ selected ? h(IconCheckOutline) : h("span", { className: "ima-n-filter-tick" }),
916
+ );
917
+ }
918
+ function ChannelWorkspaceHead({ query, sort, groupMode, onQuery, onSort, onGroupMode }) {
919
+ const [searching, setSearching] = useState(!!query);
920
+ const [open, setOpen] = useState(false);
921
+ const searchSize = searching ? 11 : 14;
922
+ return h("div", { className: searching ? "ima-n-toolbar is-search" : "ima-n-toolbar" },
923
+ h("span", { className: "ima-n-head-label" }, "工作区"),
924
+ h("div", { className: "ima-n-search-slot" },
925
+ h("div", { className: "ima-n-search", onClick: () => { setOpen(false); setSearching(true); } },
926
+ h("button", { type: "button", className: "ima-n-search-btn", "aria-label": "搜索", "aria-expanded": searching, onClick: () => { setOpen(false); setSearching(true); } }, h(IconSearchOutline, { size: searchSize })),
927
+ h("input", { className: "ima-n-search-input", value: query, placeholder: "搜索会话...", "aria-label": "搜索会话", tabIndex: searching ? 0 : -1, onChange: (e) => onQuery(e.target.value), onKeyDown: (e) => { if (e.key === "Escape") { onQuery(""); setSearching(false); } } }),
928
+ searching && h("button", { type: "button", className: "ima-n-search-clear", "aria-label": "清除搜索", onClick: (e) => { e.stopPropagation(); onQuery(""); setSearching(false); } }, h(IconCloseOutline, { size: 14 })),
929
+ ),
930
+ ),
931
+ h("div", { className: "ima-n-head-acts" },
932
+ h("div", { className: "ima-n-head-filter" },
933
+ h("button", { type: "button", className: open ? "ima-n-head-btn on" : "ima-n-head-btn", "aria-label": "筛选", onClick: () => setOpen(!open) }, h(IconSliders)),
934
+ open && h("div", { className: "ima-n-filter-menu" },
935
+ h("div", { className: "ima-n-filter-label" }, "分组方式"),
936
+ h(FilterRow, { label: "按工作区", selected: groupMode === "workspace", onSelect: () => { onGroupMode("workspace"); setOpen(false); } }),
937
+ h(FilterRow, { label: "单列表", selected: groupMode === "list", onSelect: () => { onGroupMode("list"); setOpen(false); } }),
938
+ h("div", { className: "ima-n-filter-split" }),
939
+ h("div", { className: "ima-n-filter-label" }, "排序方式"),
940
+ h(FilterRow, { label: "手动排序", selected: sort === "manual", onSelect: () => { onSort("manual"); setOpen(false); } }),
941
+ h(FilterRow, { label: "最近更新", selected: sort === "time", onSelect: () => { onSort("time"); setOpen(false); } }),
942
+ ),
943
+ ),
944
+ ),
945
+ );
946
+ }
947
+ function IconPlayOutline() {
948
+ return NativeSvg("0 0 16 16", 16, [
949
+ NativePath("M14.1446 8C14.1446 4.6062 11.3938 1.85539 8 1.85539C4.6062 1.85539 1.85539 4.6062 1.85539 8C1.85539 11.3938 4.6062 14.1446 8 14.1446C11.3938 14.1446 14.1446 11.3938 14.1446 8ZM15.511 8C15.511 12.148 12.148 15.511 8 15.511C3.85202 15.511 0.489014 12.148 0.489014 8C0.489014 3.85202 3.85202 0.489014 8 0.489014C12.148 0.489014 15.511 3.85202 15.511 8Z"),
950
+ NativePath("M10.5617 8.42578C10.852 8.21614 10.852 7.78386 10.5617 7.57422L7.25708 5.18751C6.90974 4.93666 6.42436 5.18484 6.42436 5.61329V10.3867C6.42436 10.8152 6.90974 11.0633 7.25708 10.8125L10.5617 8.42578Z"),
951
+ ]);
952
+ }
953
+ function IconTreeCorner() {
954
+ return h("svg", { viewBox: "-0.5 0 8.5 10.5", width: 8, height: 10, fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true" },
955
+ NativePath("M0 0L-0.5 0L-0.5 7L0 7L0.5 7L0.5 0L0 0ZM3 10L3 10.5L8 10.5L8 10L8 9.5L3 9.5L3 10ZM0 7L-0.5 7C-0.5 8.933 1.067 10.5 3 10.5L3 10L3 9.5C1.61929 9.5 0.5 8.38071 0.5 7L0 7Z"),
956
+ );
957
+ }
958
+ function SessionHoverCard({ title, time, running, style, cardRef }) {
959
+ return h("div", { className: "ima-n-hover", style, ref: cardRef },
960
+ h("div", { className: "ima-n-hover-title" }, title),
961
+ time ? h("div", { className: "ima-n-hover-time" }, time) : null,
962
+ h("div", { className: "ima-n-hover-state" },
963
+ h("span", { className: running ? "ima-n-hover-dot is-run" : "ima-n-hover-dot" }),
964
+ running ? "运行中" : "空闲",
965
+ ),
966
+ );
967
+ }
886
968
  function MoreIcon() {
887
969
  return h(IconEllipsis);
888
970
  }
@@ -900,10 +982,10 @@ window.__ModuleLoader__.load({
900
982
  const delta = Math.max(0, Date.now() - ts);
901
983
  const min = Math.floor(delta / 60000);
902
984
  if (min < 1) return "刚刚";
903
- if (min < 60) return min + "分钟";
985
+ if (min < 60) return min + "分钟前";
904
986
  const hour = Math.floor(min / 60);
905
- if (hour < 24) return hour + "小时";
906
- return Math.floor(hour / 24) + "天";
987
+ if (hour < 24) return hour + "小时前";
988
+ return Math.floor(hour / 24) + "天前";
907
989
  }
908
990
 
909
991
 
@@ -953,8 +1035,32 @@ window.__ModuleLoader__.load({
953
1035
  const setMenu = (next) => onMenuChange(!!next);
954
1036
  const [renaming, setRenaming] = useState(false);
955
1037
  const [draft, setDraft] = useState(sess.title || sess.chatId || "");
1038
+ const rowRef = useRef(null);
1039
+ const hoverRef = useRef(null);
1040
+ const hoverTimer = useRef(null);
1041
+ const [hoverOpen, setHoverOpen] = useState(false);
1042
+ const [hoverStyle, setHoverStyle] = useState({});
956
1043
  const title = sess.title || sess.chatId;
957
1044
  const native = skin !== "codex";
1045
+ const running = !!(sess.running || (sessionById && sessionById[sess.sessionId] && sessionById[sess.sessionId].running));
1046
+ const showHover = () => {
1047
+ if (menu || !native) return;
1048
+ if (hoverTimer.current) window.clearTimeout(hoverTimer.current);
1049
+ hoverTimer.current = window.setTimeout(() => setHoverOpen(true), 500);
1050
+ };
1051
+ const hideHover = () => {
1052
+ if (hoverTimer.current) window.clearTimeout(hoverTimer.current);
1053
+ setHoverOpen(false);
1054
+ };
1055
+ useLayoutEffect(() => {
1056
+ if (!hoverOpen || menu || !rowRef.current) return;
1057
+ const row = rowRef.current.getBoundingClientRect();
1058
+ const card = hoverRef.current;
1059
+ const height = card && card.offsetHeight ? card.offsetHeight : 96;
1060
+ const top = row.top + height > window.innerHeight - 8 ? Math.max(8, window.innerHeight - height - 8) : Math.max(8, row.top);
1061
+ setHoverStyle({ position: "fixed", zIndex: 4100, left: Math.round(row.right + 8) + "px", top: Math.round(top) + "px" });
1062
+ }, [hoverOpen, menu, title, running]);
1063
+ useEffect(() => () => { if (hoverTimer.current) window.clearTimeout(hoverTimer.current); }, []);
958
1064
  const rowClass = native
959
1065
  ? ("ima-native-session" + (selected ? " on" : "") + (menu ? " menu-on" : ""))
960
1066
  : ("dcu-wb-session" + (selected ? " dcu-wb-selected" : "") + (menu ? " dcu-wb-menu-open" : ""));
@@ -1021,18 +1127,20 @@ window.__ModuleLoader__.load({
1021
1127
  { id: "rename", label: "重命名", icon: h(IconEdit), go: () => { setRenaming(true); } },
1022
1128
  { id: "fork", label: "分叉会话", icon: h(IconBranch), go: () => run("fork") },
1023
1129
  { id: "archive", label: "归档会话", icon: h(IconArchive), go: () => run("archive") },
1024
- { id: "delete", label: "删除会话", icon: h(IconTrash), danger: true, go: () => run("delete") },
1025
1130
  ];
1026
1131
  return h("div", {
1132
+ ref: rowRef,
1027
1133
  className: native ? ("ima-n-sess" + (selected ? " on" : "") + (menu ? " menu-on" : "")) : rowClass,
1028
1134
  role: "treeitem",
1029
1135
  tabIndex: 0,
1030
1136
  "aria-selected": selected,
1031
- onClick: () => { setMenu(false); onOpen(sess.sessionId); },
1137
+ onClick: () => { setMenu(false); hideHover(); onOpen(sess.sessionId); },
1138
+ onMouseEnter: showHover,
1139
+ onMouseLeave: hideHover,
1032
1140
  onKeyDown: (e) => { if (e.key === "Enter" || e.key === " ") { e.preventDefault(); setMenu(false); onOpen(sess.sessionId); } },
1033
- onContextMenu: (e) => { e.preventDefault(); e.stopPropagation(); onMenuChange(true, e); },
1141
+ onContextMenu: (e) => { e.preventDefault(); e.stopPropagation(); hideHover(); onMenuChange(true, e); },
1034
1142
  },
1035
- native && h("span", { className: "ima-n-slot" }, (sess.running || (sessionById && sessionById[sess.sessionId] && sessionById[sess.sessionId].running)) ? h(RunningStateDot) : null),
1143
+ native && h("span", { className: "ima-n-slot" }, running ? h(RunningStateDot) : null),
1036
1144
  h("span", { className: native ? "ima-n-title" : "dcu-wb-session-title" }, title),
1037
1145
  native && h("span", { className: "ima-n-time" }, relativeTime(sess.updatedAt)),
1038
1146
  h("span", { className: native ? "ima-n-acts" : "dcu-wb-actions" },
@@ -1045,6 +1153,13 @@ window.__ModuleLoader__.load({
1045
1153
  onClick: (e) => { e.stopPropagation(); onMenuChange(!menu, e); },
1046
1154
  }, native ? h(IconEllipsis) : h(MoreIcon)),
1047
1155
  ),
1156
+ hoverOpen && !menu && native && h(SessionHoverCard, {
1157
+ title,
1158
+ time: relativeTime(sess.updatedAt),
1159
+ running,
1160
+ style: hoverStyle,
1161
+ cardRef: hoverRef,
1162
+ }),
1048
1163
  menu && h(SessionPointerMenu, {
1049
1164
  native,
1050
1165
  x: menuOpen && menuOpen.x,
@@ -1082,6 +1197,9 @@ window.__ModuleLoader__.load({
1082
1197
  const [folded, setFolded] = useState({});
1083
1198
  const [error, setError] = useState("");
1084
1199
  const [openMenu, setOpenMenu] = useState(null);
1200
+ const [query, setQuery] = useState("");
1201
+ const [sort, setSort] = useState("time");
1202
+ const [groupMode, setGroupMode] = useState("workspace");
1085
1203
  const selectedId = props.selectedId;
1086
1204
  const archived = new Set(props.archivedIds || []);
1087
1205
  const skin = props.skin || channelSkin;
@@ -1114,17 +1232,35 @@ window.__ModuleLoader__.load({
1114
1232
  document.removeEventListener("keydown", onKeyDown);
1115
1233
  };
1116
1234
  }, [openMenu]);
1235
+ const needle = query.trim().toLowerCase();
1236
+ const visibleGroups = groups.map((g) => {
1237
+ const sessions = (g.sessions || []).filter((sess) => !archived.has(sess.sessionId));
1238
+ if (!needle) return Object.assign({}, g, { sessions });
1239
+ const nameHit = String(g.label || "").toLowerCase().includes(needle);
1240
+ return Object.assign({}, g, { sessions: nameHit ? sessions : sessions.filter((sess) => String(sess.title || sess.chatId || "").toLowerCase().includes(needle)) });
1241
+ });
1242
+ if (sort === "time") {
1243
+ visibleGroups.sort((a, b) => {
1244
+ const latest = (g) => Math.max(0, ...(g.sessions || []).map((sess) => Date.parse(sess.updatedAt || "") || 0));
1245
+ return latest(b) - latest(a);
1246
+ });
1247
+ }
1248
+ if (groupMode === "list") {
1249
+ const sessions = visibleGroups.flatMap((g) => g.sessions || []);
1250
+ if (sort === "time") sessions.sort((a, b) => (Date.parse(b.updatedAt || "") || 0) - (Date.parse(a.updatedAt || "") || 0));
1251
+ visibleGroups.splice(0, visibleGroups.length, { id: "__flat__", label: "", sessions });
1252
+ }
1117
1253
  return h("div", { className: native ? "ima-native ima-rail" : "dcu-wb ima-rail" },
1118
1254
  h("style", null, WB_CSS),
1255
+ h(ChannelWorkspaceHead, { query, sort, groupMode, onQuery: setQuery, onSort: setSort, onGroupMode: setGroupMode }),
1119
1256
  h("div", { className: native ? "ima-native-tree" : "dcu-wb-tree", role: "tree" },
1120
1257
  error && h("div", { className: native ? "ima-native-empty" : "dcu-wb-empty" }, error),
1121
1258
  !error && groups.length === 0 && h("div", { className: native ? "ima-native-empty" : "dcu-wb-empty" }, "还没有频道会话。先在设置 → IM助理 里连接渠道,并给机器人发一条消息。"),
1122
- ...groups.map((g) => {
1123
- const visible = (g.sessions || []).filter((sess) => !archived.has(sess.sessionId));
1124
- if (!visible.length) return null;
1259
+ ...visibleGroups.map((g) => {
1260
+ const visible = g.sessions || [];
1125
1261
  const expanded = !folded[g.id];
1126
1262
  return h("div", { key: g.id, className: native ? "ima-native-project" : "dcu-wb-project" },
1127
- h("button", {
1263
+ groupMode !== "list" && h("button", {
1128
1264
  className: native ? "ima-n-row" : "dcu-wb-project-head",
1129
1265
  type: "button",
1130
1266
  role: "treeitem",
@@ -1134,7 +1270,6 @@ window.__ModuleLoader__.load({
1134
1270
  native
1135
1271
  ? [
1136
1272
  h("span", { key: "folder", className: "ima-n-slot ima-n-folder" }, h(Logo, { id: g.id, small: true })),
1137
- h("span", { key: "chev", className: "ima-n-slot ima-n-chevron" }, h("span", { className: expanded ? "ima-n-arrow open" : "ima-n-arrow" }, h(IconChevron))),
1138
1273
  h("span", { key: "title", className: "ima-n-title" }, g.label),
1139
1274
  ]
1140
1275
  : [
@@ -1142,8 +1277,7 @@ window.__ModuleLoader__.load({
1142
1277
  h("span", { key: "title", className: "dcu-wb-project-title" }, g.label),
1143
1278
  ],
1144
1279
  ),
1145
- !folded[g.id] && (visible.length
1146
- ? visible.map((sess) => h(ChannelSessionRow, {
1280
+ (groupMode === "list" || !folded[g.id]) && visible.length > 0 && visible.map((sess) => h(ChannelSessionRow, {
1147
1281
  key: sess.sessionId,
1148
1282
  sess,
1149
1283
  selected: selectedId === sess.sessionId,
@@ -1164,8 +1298,7 @@ window.__ModuleLoader__.load({
1164
1298
  forkSession: props.forkSession,
1165
1299
  openPath: props.openPath,
1166
1300
  },
1167
- }))
1168
- : h("div", { className: native ? "ima-native-empty" : "dcu-wb-empty" }, "暂无会话")),
1301
+ })),
1169
1302
  );
1170
1303
  }),
1171
1304
  ),
@@ -1229,15 +1362,32 @@ window.__ModuleLoader__.load({
1229
1362
  );
1230
1363
  }
1231
1364
 
1232
- function filterSessionsByIm(state, keepIm) {
1233
- const src = state || { ids: [], byId: {}, current: null };
1234
- const ids = (src.ids || []).filter((id) => String(id).startsWith("im:") === keepIm);
1365
+ const imSessionFilterCache = new WeakMap();
1366
+ const registryFilterCache = new WeakMap();
1367
+ function cacheFilteredSessions(src, ids) {
1368
+ if (ids.length === (src.ids || []).length) return src;
1235
1369
  const byId = {};
1236
1370
  for (const id of ids) {
1237
1371
  if (src.byId && src.byId[id]) byId[id] = src.byId[id];
1238
1372
  }
1239
1373
  return Object.assign({}, src, { ids, byId });
1240
1374
  }
1375
+ function filterSessionsByIm(state, keepIm) {
1376
+ const src = state || { ids: [], byId: {}, current: null };
1377
+ const key = keepIm ? "im" : "task";
1378
+ if (src && typeof src === "object") {
1379
+ const hit = imSessionFilterCache.get(src);
1380
+ if (hit && hit[key]) return hit[key];
1381
+ }
1382
+ const ids = (src.ids || []).filter((id) => String(id).startsWith("im:") === keepIm);
1383
+ const result = cacheFilteredSessions(src, ids);
1384
+ if (src && typeof src === "object") {
1385
+ const bucket = imSessionFilterCache.get(src) || {};
1386
+ bucket[key] = result;
1387
+ imSessionFilterCache.set(src, bucket);
1388
+ }
1389
+ return result;
1390
+ }
1241
1391
 
1242
1392
  function filterTaskSessions(state) {
1243
1393
  return filterSessionsByIm(state, false);
@@ -1292,12 +1442,14 @@ window.__ModuleLoader__.load({
1292
1442
  const src = state || { ids: [], byId: {}, current: null };
1293
1443
  const filters = registry && registry.sessionFilters ? registry.sessionFilters : [];
1294
1444
  if (!filters.length) return src;
1295
- const ids = (src.ids || []).filter((id) => filters.every((fn) => fn(String(id))));
1296
- const byId = {};
1297
- for (const id of ids) {
1298
- if (src.byId && src.byId[id]) byId[id] = src.byId[id];
1445
+ if (src && typeof src === "object") {
1446
+ const hit = registryFilterCache.get(src);
1447
+ if (hit && hit.filters === filters) return hit.result;
1299
1448
  }
1300
- return Object.assign({}, src, { ids, byId });
1449
+ const ids = (src.ids || []).filter((id) => filters.every((fn) => fn(String(id))));
1450
+ const result = cacheFilteredSessions(src, ids);
1451
+ if (src && typeof src === "object") registryFilterCache.set(src, { filters, result });
1452
+ return result;
1301
1453
  }
1302
1454
 
1303
1455
  function SessionSwitcher(props) {
@@ -1315,22 +1467,30 @@ window.__ModuleLoader__.load({
1315
1467
  const currentId = typeof rawUseSessions === "function"
1316
1468
  ? rawUseSessions((state) => (state && state.current) || null)
1317
1469
  : (props.selectedId || null);
1318
- const useTaskSessions = useCallback((selector) => {
1470
+ const useTaskSessions = useCallback((selector, eq) => {
1319
1471
  if (typeof rawUseSessions !== "function") return selector({ ids: [], byId: {}, current: null });
1320
- return rawUseSessions((state) => selector(applyRegistryFilters(filterTaskSessions(state), nativeTabs)));
1472
+ return rawUseSessions((state) => selector(applyRegistryFilters(filterTaskSessions(state), nativeTabs)), eq);
1321
1473
  }, [rawUseSessions, nativeTabs]);
1322
- const useChannelSessions = useCallback((selector) => {
1474
+ const useChannelSessions = useCallback((selector, eq) => {
1323
1475
  if (typeof rawUseSessions !== "function") return selector({ ids: [], byId: {}, current: null });
1324
- return rawUseSessions((state) => selector(filterChannelSessions(state)));
1476
+ return rawUseSessions((state) => selector(filterChannelSessions(state)), eq);
1325
1477
  }, [rawUseSessions]);
1326
1478
  useEffect(() => { ensureStyle(); }, []);
1327
1479
  useEffect(() => { try { localStorage.setItem(TAB_KEY, tab); } catch { /* ignore */ } }, [tab]);
1480
+ const previousCurrentId = useRef(currentId);
1481
+ const tabFollowReady = useRef(false);
1328
1482
  useEffect(() => {
1329
- if (typeof currentId === "string" && currentId.startsWith("im:")) setTab("channels");
1330
- if (typeof currentId === "string") {
1331
- const matched = extraTabs.find((item) => item.matchSession && item.matchSession(currentId));
1332
- if (matched) setTab(matched.id);
1483
+ if (!tabFollowReady.current) {
1484
+ tabFollowReady.current = true;
1485
+ previousCurrentId.current = currentId;
1486
+ return;
1333
1487
  }
1488
+ const previous = previousCurrentId.current;
1489
+ previousCurrentId.current = currentId;
1490
+ if (typeof currentId !== "string" || currentId === "" || currentId === previous) return;
1491
+ if (currentId.startsWith("im:")) setTab("channels");
1492
+ const matched = extraTabs.find((item) => item.matchSession && item.matchSession(currentId));
1493
+ if (matched && matched.id !== "schedule") setTab(matched.id);
1334
1494
  }, [currentId, extraTabs]);
1335
1495
  const openSession = (id) => openListedSession(id, props.openSession || props.open);
1336
1496
  const officialProps = Object.assign({}, props, { useSessions: useTaskSessions });
package/lib/client.js CHANGED
@@ -103,11 +103,10 @@ window.__ModuleLoader__.load({
103
103
  .ima-empty{color:var(--ima-muted);font-size:12px;padding:12px 8px}
104
104
  .ima-logo{width:28px;height:28px;flex:none;display:block;line-height:0;background:transparent}
105
105
  .ima-logo svg{width:28px;height:28px;display:block}
106
- .ima-logo.sm{width:16px;height:16px;overflow:visible}
107
- .ima-logo.sm svg{width:16px;height:16px}
108
- .ima-logo.sm[data-brand="weixin"] svg,.ima-logo.sm[data-brand="feishu"] svg,.ima-logo.sm[data-brand="lark"] svg,.ima-logo.sm[data-brand="telegram"] svg,.ima-logo.sm[data-brand="qq"] svg{transform:scale(1.2);transform-origin:center}
106
+ .ima-logo.sm{width:16px;height:16px;overflow:hidden;display:grid;place-items:center}
107
+ .ima-logo.sm svg{width:16px;height:16px;transform:none}
109
108
  .ima-logo[data-brand="wecom"]{border-radius:6px;box-shadow:inset 0 0 0 1px rgba(15,23,42,.12);overflow:hidden;background:#fff}
110
- .ima-logo.sm[data-brand="wecom"]{border-radius:4px}
109
+ .ima-logo.sm[data-brand="wecom"]{border-radius:4px;box-shadow:none;background:transparent}
111
110
  .ima-mask{position:fixed;inset:0;background:var(--dsw-alias-bg-mask-1,rgba(0,0,0,.45));backdrop-filter:var(--dsw-mask-blur,blur(8px));display:grid;place-items:center;z-index:80;padding:24px}
112
111
  .ima-modal{width:min(440px,100%);background:var(--dsw-alias-bg-layer-2,#fff);color:var(--ima-text);border:1px solid var(--ima-line);border-radius:16px;padding:20px 22px 22px;text-align:left;box-shadow:var(--dsw-shadow-lv3,0 16px 48px rgba(0,0,0,.18))}
113
112
  .ima-modal-h{display:flex;align-items:center;justify-content:space-between;margin-bottom:14px}
@@ -150,7 +149,7 @@ window.__ModuleLoader__.load({
150
149
  }, children);
151
150
 
152
151
  if (id === "dingtalk") {
153
- return svg("0 0 48 48", [
152
+ return svg("6 6 36 36", [
154
153
  h("rect", { key: "bg", x: 6, y: 6, width: 36, height: 36, rx: 8, fill: "#0285fc" }),
155
154
  h("path", { key: "mark", d: "m20.178 37.577 3.5-6h-3l2-3c-5.5-1-6.281-3.938-6-4.5.162-.325 2.5 1 6.281 1-8.281-.5-8.281-7-7.781-7.5.423-.424 2.44 1.666 6.564 3.53-9.126-4.314-6.453-11.956-5.064-11.03 3.344 3 9.5 8.5 15 13 .658.538 1 2 0 3.25s-2.5 2.75-3 3.25h2.5z", fill: "#fff" }),
156
155
  ]);
@@ -801,7 +800,7 @@ window.__ModuleLoader__.load({
801
800
  );
802
801
  }
803
802
 
804
- const WB_CSS = `.dcu-wb,.ima-native{display:flex;flex:1;min-height:0;flex-direction:column;padding:0;padding-right:var(--dsh-sidebar-inline-padding,12px);box-sizing:border-box;color:var(--dsw-alias-label-primary,var(--ima-text));font:14px/20px inherit}.ima-n-head{flex:none;display:flex;align-items:center;height:36px;padding-left:4px;margin:2px 0 4px;color:var(--dsw-alias-label-tertiary,#81858C);font:14px/20px inherit}.ima-native-tree,.dcu-wb-tree{padding:0 0 16px 4px;scrollbar-gutter:stable}.ima-native-project+.ima-native-project,.dcu-wb-project+.dcu-wb-project{margin-top:4px}.ima-native-project>*+*,.dcu-wb-project>*+*{margin-top:2px}
803
+ const WB_CSS = `.dcu-wb,.ima-native{display:flex;flex:1;min-height:0;flex-direction:column;padding:0;padding-right:var(--dsh-sidebar-inline-padding,12px);box-sizing:border-box;color:var(--dsw-alias-label-primary,var(--ima-text));font:14px/20px inherit}.ima-n-toolbar{box-sizing:border-box;flex:none;height:36px;margin:2px -4px 4px 0;padding-left:4px;display:flex;justify-content:flex-end;align-items:center;gap:4px;overflow:visible;position:relative;z-index:2;color:var(--dsw-alias-label-tertiary,#81858C);border-radius:12px}.ima-n-head-label{white-space:nowrap;min-width:0;max-width:45%;flex:none;line-height:20px;font-size:14px;overflow:hidden;transition:max-width .18s var(--ds-ease-in-out,ease),margin-right .18s var(--ds-ease-in-out,ease),opacity .12s var(--ds-ease-in-out,ease),transform .18s var(--ds-ease-in-out,ease),visibility 0s linear}.ima-n-toolbar.is-search .ima-n-head-label{opacity:0;visibility:hidden;max-width:0;margin-right:-4px;transform:translate(-4px);transition-delay:0s,0s,0s,0s,.18s}.ima-n-search-slot{box-sizing:border-box;min-width:28px;max-width:28px;transition:max-width .18s var(--ds-ease-in-out,ease);flex:none;align-items:center;margin-left:auto;display:flex;position:relative;z-index:2}.ima-n-toolbar.is-search .ima-n-search-slot{flex:1;min-width:0;max-width:100%}.ima-n-search{box-sizing:border-box;cursor:text;width:100%;height:28px;color:var(--dsw-alias-label-secondary);transition:width .18s var(--ds-ease-in-out,ease),padding .18s var(--ds-ease-in-out,ease),border-color .18s var(--ds-ease-in-out,ease);background:transparent;border:none;border-radius:50%;flex:none;align-items:center;margin:0;padding:0;display:flex;overflow:hidden}.ima-n-toolbar.is-search .ima-n-search{border:1px solid var(--dsw-alias-border-l2,rgba(255,255,255,.10));width:calc(100% + 4px);height:30px;border-radius:10px;margin-inline:-2px;padding:0 4px 0 0}.ima-n-search-btn,.ima-n-head-btn{cursor:pointer;width:28px;height:28px;min-width:28px;min-height:28px;position:relative;z-index:1;color:var(--dsw-alias-label-secondary);background:transparent;border:none;border-radius:50%;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.ima-n-toolbar.is-search .ima-n-search-btn{width:28px;height:30px}.ima-n-search-btn:hover,.ima-n-head-btn:hover,.ima-n-head-btn.on{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06));color:var(--dsw-alias-label-primary,var(--ima-text))}.ima-n-toolbar.is-search .ima-n-search-btn:hover{background:transparent}.ima-n-head-acts{opacity:1;visibility:visible;max-width:32px;transition:max-width .18s var(--ds-ease-in-out,ease),opacity .12s var(--ds-ease-in-out,ease),transform .18s var(--ds-ease-in-out,ease),visibility 0s linear;flex:none;align-items:center;gap:4px;display:flex;overflow:visible;position:relative}.ima-n-toolbar.is-search .ima-n-head-acts{opacity:0;visibility:hidden;pointer-events:none;max-width:0;transform:translate(4px);transition-delay:0s,0s,0s,.18s}.ima-n-head-filter{position:relative}.ima-n-search-input{display:none;opacity:0;pointer-events:none;width:0;min-width:0;flex:none;color:var(--dsw-alias-label-primary,var(--ima-text));transition:opacity .12s var(--ds-ease-in-out,ease);background:transparent;border:none;outline:none;flex:1;font-size:13px;line-height:18px}.ima-n-toolbar.is-search .ima-n-search-input{display:block;opacity:1;pointer-events:auto;margin-left:-2px;width:auto;flex:1;min-width:0}.ima-n-search-input::placeholder{color:var(--dsw-alias-label-tertiary,#81858C)}.ima-n-search-clear{cursor:pointer;width:24px;height:24px;color:var(--dsw-alias-label-secondary);background:transparent;border:none;border-radius:50%;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.ima-n-search-clear:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06))}@media (prefers-reduced-motion:reduce){.ima-n-head-label,.ima-n-search-slot,.ima-n-search,.ima-n-head-acts,.ima-n-search-input{transition:none}}.ima-n-filter-menu{position:absolute;right:0;top:calc(100% + 6px);z-index:30;min-width:196px;padding:8px 6px;border:1px solid var(--dsw-alias-border-inverted,rgba(255,255,255,.12));border-radius:12px;background:var(--dsw-specific-menu,var(--dsw-alias-bg-layer-2,#1c2128));box-shadow:var(--dsw-shadow-lv3,0 8px 24px rgba(0,0,0,.36))}.ima-n-filter-label{padding:6px 10px 4px;font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary,#81858C)}.ima-n-filter-split{height:1px;margin:6px 8px;background:var(--dsw-alias-border-l2,rgba(255,255,255,.1))}.ima-n-filter-menu button{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;min-height:36px;padding:6px 10px;border:0;border-radius:8px;background:transparent;color:inherit;font:14px/20px inherit;cursor:pointer;text-align:left}.ima-n-filter-menu button:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06))}.ima-n-filter-tick{width:16px;height:16px;flex:none}.ima-native-tree,.dcu-wb-tree{padding:0 0 16px;scrollbar-gutter:stable}.ima-native-project+.ima-native-project,.dcu-wb-project+.dcu-wb-project{margin-top:4px}.ima-native-project>*+*,.dcu-wb-project>*+*{margin-top:2px}
805
804
  .dcu-wb *,.ima-native *{box-sizing:border-box}
806
805
  .dcu-wb-tree,.ima-native-tree{flex:1;min-height:0;overflow-y:auto;padding-bottom:16px;user-select:none}
807
806
  .dcu-wb-project-head,.ima-native-head,.dcu-wb-session,.ima-native-session{display:flex;align-items:center;gap:6px;width:100%;border:0;border-radius:8px;padding:0 8px;background:transparent;color:inherit;cursor:pointer;font:inherit;text-align:left}
@@ -820,16 +819,20 @@ window.__ModuleLoader__.load({
820
819
  .ima-sess-menu button:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06))}
821
820
  .ima-sess-menu button.danger{color:var(--dsw-alias-state-error-primary,var(--ima-danger))}
822
821
  .ima-rename{flex:1;min-width:0;min-height:28px;padding:2px 8px;border-radius:6px;border:1px solid var(--dsw-alias-stroke-primary,var(--ima-line));background:transparent;color:inherit;font:inherit}
823
- .ima-n-row,.ima-n-sess{display:flex;align-items:center;gap:6px;border-radius:8px;padding:0 8px;cursor:pointer;user-select:none;width:100%;border:0;background:transparent;color:var(--dsw-alias-label-primary,var(--ima-text));font:14px/20px inherit;text-align:left;box-sizing:border-box}
822
+ .ima-n-row,.ima-n-sess{display:flex;align-items:center;gap:6px;border-radius:8px;padding:0 8px 0 12px;cursor:pointer;user-select:none;width:100%;border:0;background:transparent;color:var(--dsw-alias-label-primary,var(--ima-text));font:14px/20px inherit;text-align:left;box-sizing:border-box}
824
823
  .ima-n-row{height:34px}
825
824
  .ima-n-sess{height:32px;gap:0;position:relative}
826
825
  .ima-n-row:hover,.ima-n-sess:hover,.ima-n-sess.on,.ima-n-row.menu-on,.ima-n-sess.menu-on{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06))}
827
826
  .ima-n-slot{flex:none;width:16px;height:20px;display:inline-flex;align-items:center;justify-content:center;color:var(--dsw-alias-label-tertiary,#81858C)}.ima-run-dot{flex:none;color:var(--dsw-static-deepseek-450,#4c8dff)}.ima-run-dot-cell{fill:currentColor;opacity:.15;animation:ima-run-chase 1s infinite}@keyframes ima-run-chase{0%,12.4%{opacity:1}12.5%,24.9%{opacity:.6}25%,37.4%{opacity:.35}37.5%,100%{opacity:.15}}
828
- .ima-n-row .ima-n-chevron{display:none;color:var(--dsw-alias-label-caption,#ADB2B8)}
829
- .ima-n-row:hover .ima-n-chevron{display:inline-flex}
830
- .ima-n-row:hover .ima-n-folder{display:none}
831
- .ima-n-arrow{transition:transform .15s ease}
832
- .ima-n-arrow.open{transform:rotate(90deg)}
827
+ .ima-n-folder{color:var(--dsw-alias-label-secondary,#9ca39f)}
828
+ .ima-n-lead{color:var(--dsw-alias-label-tertiary,#81858C)}
829
+ .ima-n-corner{color:var(--dsw-alias-label-caption,#ADB2B8);width:8px}
830
+ .ima-n-hover{position:fixed;z-index:4100;min-width:188px;max-width:280px;padding:12px 14px;border:1px solid var(--dsw-alias-border-inverted,rgba(255,255,255,.12));border-radius:12px;background:var(--dsw-specific-menu,var(--dsw-alias-bg-layer-2,#1c2128));box-shadow:var(--dsw-shadow-lv3,0 8px 24px rgba(0,0,0,.36));color:var(--dsw-alias-label-primary,var(--ima-text))}
831
+ .ima-n-hover-title{font-size:14px;line-height:20px;font-weight:500}
832
+ .ima-n-hover-time{margin-top:4px;font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary,#81858C)}
833
+ .ima-n-hover-state{display:flex;align-items:center;gap:6px;margin-top:8px;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary,#9ca39f)}
834
+ .ima-n-hover-dot{width:8px;height:8px;border-radius:50%;background:#34c759;flex:none}
835
+ .ima-n-hover-dot.is-run{background:#4c8dff}
833
836
  .ima-n-title{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px;line-height:20px;flex:1;font-weight:400}
834
837
  .ima-n-sess .ima-n-title{margin:0 6px 0 4px}
835
838
  .ima-n-time{flex:none;font-size:12px;line-height:20px;color:var(--dsw-alias-label-tertiary,#81858C)}
@@ -875,14 +878,93 @@ window.__ModuleLoader__.load({
875
878
  return NativeSvg("0 0 16 16", 16, NativePath("M14.478 4.841 14.214 10.115c-.104 2.072-.147 2.896-.827 3.846a3.53 3.53 0 0 1-1.044.993c-.519.333-1.101.478-1.784.546-.671.067-1.509.066-2.559.066s-1.887.001-2.558-.066c-.683-.068-1.266-.213-1.784-.546a3.53 3.53 0 0 1-1.044-.993c-.681-.95-.724-1.774-.828-3.846L1.522 4.841l1.368-.068.263 5.273c.109 2.176.171 2.556.573 3.117a2.16 2.16 0 0 0 .673.64c.263.169.603.277 1.179.334.587.059 1.345.06 2.422.06s1.834-.001 2.422-.06c.575-.057.916-.165 1.179-.335.262-.168.49-.386.672-.64.402-.56.464-.94.573-3.116l.263-5.273 1.369.068ZM5.43 6.228h1.37v5.163H5.43V6.228Zm3.77 0h1.37v5.163H9.2V6.228ZM8.536.434c.644 0 1.116-.007 1.56.137.14.045.276.101.406.168.416.212.745.552 1.2 1.007l.796.795h2.876v1.37H.626V2.541h2.876l.796-.795c.456-.455.784-.795 1.2-1.007.13-.067.266-.123.405-.168C6.348.427 6.82.434 7.464.434h1.072Zm-1.072 1.37c-.732 0-.948.008-1.138.07a2.2 2.2 0 0 0-.206.085c-.156.08-.296.204-.678.583h5.117c-.382-.379-.522-.503-.679-.583a2.2 2.2 0 0 0-.205-.085c-.191-.062-.406-.07-1.138-.07H7.464Z"));
876
879
  }
877
880
  function IconFolderClose() {
878
- return NativeSvg("0 0 16 16", 16, NativePath("M6.556 3.377 6.007 3.725l.549-.348ZM14.5 12.342h.65V6.397h-.65-.65v5.945h.65Zm-1.674-7.618v-.65H8.023v.65h4.803Zm-5.746-.519.55-.347-.525-.828-.549.348-.549.348.525.828.55-.348ZM5.613 2.858h0H3.174v.65h2.439v-.65ZM3 4.532v8.46h.65V4.532H3Zm11.326 9.484v-.65H4.674v.65h9.652ZM3 12.342h-.65A2.324 2.324 0 0 0 4.674 14.666v-1.3A.824.824 0 0 1 3.65 12.342H3Zm.174-9.484h0A2.324 2.324 0 0 0 2.35 4.532h1.3A.824.824 0 0 1 4.674 3.508h0V2.858Zm3.382.519.549-.348A1.824 1.824 0 0 0 5.613 2.208v1.3c.16 0 .308.082.394.217l.549-.348Zm1.467 1.347h0c-.16 0-.308-.082-.393-.216l-.55.347-.549.348A1.824 1.824 0 0 0 8.023 5.374v-1.3ZM14.5 6.397h.65A2.324 2.324 0 0 0 12.826 4.073v1.3c.565 0 1.024.458 1.024 1.024h.65Zm0 5.945h-.65c0 .565-.458 1.024-1.024 1.024v1.3A2.324 2.324 0 0 0 15.15 12.342h-.65Z"));
881
+ return NativeSvg("0 0 16 16", 16, h("path", { fill: "currentColor", transform: "translate(1.5 2.429)", d: "M5.05582 0.518756L4.50669 0.86654L5.05582 0.518756ZM13 9.4837L13.65 9.4837L13.65 3.53962L13 3.53962L12.35 3.53962L12.35 9.4837L13 9.4837ZM11.3264 1.86603L11.3264 1.21603L6.52313 1.21603L6.52313 1.86603L6.52313 2.51603L11.3264 2.51603L11.3264 1.86603ZM5.58054 1.34727L6.12968 0.999489L5.60495 0.170972L5.05582 0.518756L4.50669 0.86654L5.03141 1.69506L5.58054 1.34727ZM4.11323 1.23058e-13L4.11323 -0.65L1.67359 -0.65L1.67359 5.00699e-14L1.67359 0.65L4.11323 0.65L4.11323 1.23058e-13ZM0 1.67359L-0.65 1.67359L-0.65 9.4837L0 9.4837L0.65 9.4837L0.65 1.67359L0 1.67359ZM11.3264 11.1573L11.3264 10.5073L1.67359 10.5073L1.67359 11.1573L1.67359 11.8073L11.3264 11.8073L11.3264 11.1573ZM0 9.4837L-0.65 9.4837C-0.65 10.767 0.390308 11.8073 1.67359 11.8073L1.67359 11.1573L1.67359 10.5073C1.10828 10.5073 0.65 10.049 0.65 9.4837L0 9.4837ZM1.67359 5.00699e-14L1.67359 -0.65C0.390307 -0.65 -0.65 0.390309 -0.65 1.67359L0 1.67359L0.65 1.67359C0.65 1.10828 1.10828 0.65 1.67359 0.65L1.67359 5.00699e-14ZM5.05582 0.518756L5.60495 0.170972C5.28121 -0.340193 4.71829 -0.65 4.11323 -0.65L4.11323 1.23058e-13L4.11323 0.65C4.27282 0.65 4.4213 0.731715 4.50669 0.86654L5.05582 0.518756ZM6.52313 1.86603L6.52313 1.21603C6.36354 1.21603 6.21507 1.13431 6.12968 0.999489L5.58054 1.34727L5.03141 1.69506C5.35515 2.20622 5.91808 2.51603 6.52313 2.51603L6.52313 1.86603ZM13 3.53962L13.65 3.53962C13.65 2.25634 12.6097 1.21603 11.3264 1.21603L11.3264 1.86603L11.3264 2.51603C11.8917 2.51603 12.35 2.97431 12.35 3.53962L13 3.53962ZM13 9.4837L12.35 9.4837C12.35 10.049 11.8917 10.5073 11.3264 10.5073L11.3264 11.1573L11.3264 11.8073C12.6097 11.8073 13.65 10.767 13.65 9.4837L13 9.4837Z" }));
879
882
  }
880
883
  function IconFolderOpen() {
881
- return NativeSvg("0 0 16 16", 16, NativePath("M5.196 1.571c.615 0 1.19.308 1.532.819l.471.708c.086.128.23.205.383.205h4.588A2.666 2.666 0 0 1 14.586 5.72v.907c.683.4 1.074 1.223.852 2.06l-1.053 3.971A2.666 2.666 0 0 1 12.05 14.453H2.917A2.416 2.416 0 0 1 .502 11.952V3.987A2.416 2.416 0 0 1 2.918 1.571h2.278Zm-1.417 6.185c-.469 0-.88.316-1.001.77l-.862 3.247c-.174.657.322 1.301 1.001 1.301H12.05c.469 0 .88-.316 1.001-.77l1.053-3.97c.078-.291-.142-.577-.444-.577H3.779Zm-.861-4.804c-.572 0-1.035.464-1.035 1.035v3.307a2.67 2.67 0 0 1 1.896-.919h9.426V5.72c0-.572-.464-1.035-1.035-1.035H7.582c-.615 0-1.19-.309-1.531-.82L5.579 3.156a.666.666 0 0 0-.383-.204H2.918Z"));
884
+ return NativeSvg("0 0 16 16", 16, [
885
+ NativePath("M5.19629 1.57104C5.81144 1.5711 6.38623 1.8786 6.72754 2.39038L7.19922 3.09839C7.28454 3.22635 7.42824 3.30344 7.58203 3.30347H12.1699C13.5039 3.30348 14.5859 4.38548 14.5859 5.71948V6.62671C15.2694 7.02689 15.6605 7.85012 15.4385 8.68726L14.3848 12.658C14.1037 13.7164 13.1449 14.4527 12.0498 14.4529H2.91699C1.51651 14.4529 0.451662 13.2814 0.501954 11.9519V3.98706C0.501954 2.65305 1.58396 1.57104 2.91797 1.57104H5.19629ZM3.7793 7.75562C3.30994 7.75562 2.89883 8.07153 2.77832 8.52515L1.91602 11.7722C1.74167 12.4291 2.23734 13.073 2.91699 13.073H12.0498C12.5191 13.0728 12.9304 12.757 13.0508 12.3035L14.1045 8.33374C14.1819 8.04202 13.9619 7.756 13.6602 7.75562H3.7793ZM2.91797 2.9519C2.34625 2.9519 1.88281 3.41534 1.88281 3.98706V7.2937C2.33068 6.7269 3.02249 6.37476 3.7793 6.37476H13.2051V5.71948C13.2051 5.14777 12.7416 4.68434 12.1699 4.68433H7.58203C6.96675 4.6843 6.39209 4.37595 6.05078 3.86401L5.5791 3.15601C5.49379 3.02821 5.34995 2.95196 5.19629 2.9519H2.91797Z"),
886
+ h("path", { fill: "currentColor", opacity: "0.2", d: "M13.6602 7.75525C13.9618 7.7556 14.1815 8.04179 14.1045 8.33337L13.0508 12.3031C12.9304 12.7567 12.5191 13.0725 12.0498 13.0726H2.91701C2.23744 13.0725 1.7417 12.4287 1.91603 11.7719L2.77834 8.52478C2.89898 8.07146 3.31018 7.75532 3.77931 7.75525H13.6602ZM5.1963 2.95154C5.34985 2.95159 5.49377 3.02803 5.57912 3.15564L6.0508 3.86365C6.39205 4.37553 6.96685 4.68385 7.58205 4.68396H12.1699C12.7416 4.68396 13.2049 5.14754 13.2051 5.71912V6.37439H3.77931C3.02267 6.37444 2.33067 6.72671 1.88283 7.29333V3.98669C1.88299 3.4152 2.34649 2.95168 2.91798 2.95154H5.1963Z" }),
887
+ ]);
882
888
  }
883
889
  function IconChevron() {
884
890
  return NativeSvg("0 0 14 14", 14, NativePath("M4.25 2.828v8.344c0 .49.592.735.939.389l4.172-4.172a.55.55 0 0 0 0-.778L5.189 2.439c-.347-.347-.939-.101-.939.389Z"));
885
891
  }
892
+ function IconSearchOutline(props) {
893
+ const size = props && props.size ? props.size : 16;
894
+ return NativeSvg("0 0 16 16", size, [
895
+ NativePath("M11.894845 6.647401C11.894845 3.725463 9.534486 1.356779 6.623219 1.35657C3.711786 1.35657 1.351635 3.725338 1.351635 6.647401C1.351843 9.569296 3.711911 11.938273 6.623219 11.938273C9.534361 11.938064 11.894637 9.569171 11.894845 6.647401ZM13.245462 6.647401C13.245254 10.317935 10.280401 13.293613 6.623219 13.293821C2.965871 13.293821 0.000204 10.31806 0 6.647401C0 2.976574 2.965746 0 6.623219 0C10.280526 0.000205 13.245462 2.9767 13.245462 6.647401Z"),
896
+ NativePath("M16.000417 15.041079L15.044449 16.000433L11.530434 12.473588L12.486298 11.514234L16.000417 15.041079Z"),
897
+ ]);
898
+ }
899
+ function IconSliders() {
900
+ return NativeSvg("0 0 16 16", 16, NativePath("M2.2 3.4h6.05a1.85 1.85 0 0 0 3.5 0H13.8v1.3H11.75a1.85 1.85 0 0 0-3.5 0H2.2V3.4Zm8.6 1.15A.75.75 0 1 1 10.05 4.55.75.75 0 0 1 10.8 4.55ZM2.2 7.35h2.35a1.85 1.85 0 0 0 3.5 0H13.8v1.3H8.05a1.85 1.85 0 0 0-3.5 0H2.2V7.35Zm4.1 1.15A.75.75 0 1 1 5.55 8.5a.75.75 0 0 1 .75-.75ZM2.2 11.3h7.35a1.85 1.85 0 0 0 3.5 0H13.8v1.3h-.75a1.85 1.85 0 0 0-3.5 0H2.2v-1.3Zm9.9 1.15a.75.75 0 1 1-.75-.75.75.75 0 0 1 .75.75Z"));
901
+ }
902
+ function IconCloseOutline(props) {
903
+ const size = props && props.size ? props.size : 16;
904
+ return NativeSvg("0 0 16 16", size, [
905
+ NativePath("M14.1168 13.197L13.197 14.1167L1.8833 2.80303L2.80309 1.88324L14.1168 13.197Z"),
906
+ NativePath("M13.197 1.88326L14.1168 2.80305L2.80309 14.1168L1.8833 13.197L13.197 1.88326Z"),
907
+ ]);
908
+ }
909
+ function IconCheckOutline() {
910
+ return NativeSvg("0 0 16 16", 16, NativePath("M15.0498 3.92579L8.49512 12.3818C8.25774 12.6881 8.04517 12.9645 7.84668 13.1689C7.63957 13.3823 7.38732 13.5841 7.04492 13.6719C6.86373 13.7183 6.6757 13.7346 6.48926 13.7197C6.13666 13.6915 5.8528 13.5355 5.6123 13.3604C5.38201 13.1926 5.12573 12.9567 4.83984 12.6953L1.03125 9.21289L1.96875 8.1875L5.77734 11.6699C6.08684 11.9529 6.27773 12.1249 6.43066 12.2363C6.50183 12.2882 6.54699 12.3135 6.57324 12.3252C6.58525 12.3305 6.59269 12.3322 6.5957 12.333C6.59802 12.3336 6.59961 12.334 6.59961 12.334C6.63317 12.3367 6.66758 12.3335 6.7002 12.3252C6.7002 12.3252 6.70211 12.3251 6.7041 12.3242C6.70698 12.3229 6.71348 12.319 6.72461 12.3115C6.74849 12.2956 6.78843 12.2642 6.84961 12.2012C6.98138 12.0654 7.13957 11.8628 7.39648 11.5313L13.9502 3.07422L15.0498 3.92579Z"));
911
+ }
912
+ function FilterRow({ label, selected, onSelect }) {
913
+ return h("button", { type: "button", className: selected ? "on" : undefined, onClick: onSelect },
914
+ h("span", null, label),
915
+ selected ? h(IconCheckOutline) : h("span", { className: "ima-n-filter-tick" }),
916
+ );
917
+ }
918
+ function ChannelWorkspaceHead({ query, sort, groupMode, onQuery, onSort, onGroupMode }) {
919
+ const [searching, setSearching] = useState(!!query);
920
+ const [open, setOpen] = useState(false);
921
+ const searchSize = searching ? 11 : 14;
922
+ return h("div", { className: searching ? "ima-n-toolbar is-search" : "ima-n-toolbar" },
923
+ h("span", { className: "ima-n-head-label" }, "工作区"),
924
+ h("div", { className: "ima-n-search-slot" },
925
+ h("div", { className: "ima-n-search", onClick: () => { setOpen(false); setSearching(true); } },
926
+ h("button", { type: "button", className: "ima-n-search-btn", "aria-label": "搜索", "aria-expanded": searching, onClick: () => { setOpen(false); setSearching(true); } }, h(IconSearchOutline, { size: searchSize })),
927
+ h("input", { className: "ima-n-search-input", value: query, placeholder: "搜索会话...", "aria-label": "搜索会话", tabIndex: searching ? 0 : -1, onChange: (e) => onQuery(e.target.value), onKeyDown: (e) => { if (e.key === "Escape") { onQuery(""); setSearching(false); } } }),
928
+ searching && h("button", { type: "button", className: "ima-n-search-clear", "aria-label": "清除搜索", onClick: (e) => { e.stopPropagation(); onQuery(""); setSearching(false); } }, h(IconCloseOutline, { size: 14 })),
929
+ ),
930
+ ),
931
+ h("div", { className: "ima-n-head-acts" },
932
+ h("div", { className: "ima-n-head-filter" },
933
+ h("button", { type: "button", className: open ? "ima-n-head-btn on" : "ima-n-head-btn", "aria-label": "筛选", onClick: () => setOpen(!open) }, h(IconSliders)),
934
+ open && h("div", { className: "ima-n-filter-menu" },
935
+ h("div", { className: "ima-n-filter-label" }, "分组方式"),
936
+ h(FilterRow, { label: "按工作区", selected: groupMode === "workspace", onSelect: () => { onGroupMode("workspace"); setOpen(false); } }),
937
+ h(FilterRow, { label: "单列表", selected: groupMode === "list", onSelect: () => { onGroupMode("list"); setOpen(false); } }),
938
+ h("div", { className: "ima-n-filter-split" }),
939
+ h("div", { className: "ima-n-filter-label" }, "排序方式"),
940
+ h(FilterRow, { label: "手动排序", selected: sort === "manual", onSelect: () => { onSort("manual"); setOpen(false); } }),
941
+ h(FilterRow, { label: "最近更新", selected: sort === "time", onSelect: () => { onSort("time"); setOpen(false); } }),
942
+ ),
943
+ ),
944
+ ),
945
+ );
946
+ }
947
+ function IconPlayOutline() {
948
+ return NativeSvg("0 0 16 16", 16, [
949
+ NativePath("M14.1446 8C14.1446 4.6062 11.3938 1.85539 8 1.85539C4.6062 1.85539 1.85539 4.6062 1.85539 8C1.85539 11.3938 4.6062 14.1446 8 14.1446C11.3938 14.1446 14.1446 11.3938 14.1446 8ZM15.511 8C15.511 12.148 12.148 15.511 8 15.511C3.85202 15.511 0.489014 12.148 0.489014 8C0.489014 3.85202 3.85202 0.489014 8 0.489014C12.148 0.489014 15.511 3.85202 15.511 8Z"),
950
+ NativePath("M10.5617 8.42578C10.852 8.21614 10.852 7.78386 10.5617 7.57422L7.25708 5.18751C6.90974 4.93666 6.42436 5.18484 6.42436 5.61329V10.3867C6.42436 10.8152 6.90974 11.0633 7.25708 10.8125L10.5617 8.42578Z"),
951
+ ]);
952
+ }
953
+ function IconTreeCorner() {
954
+ return h("svg", { viewBox: "-0.5 0 8.5 10.5", width: 8, height: 10, fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true" },
955
+ NativePath("M0 0L-0.5 0L-0.5 7L0 7L0.5 7L0.5 0L0 0ZM3 10L3 10.5L8 10.5L8 10L8 9.5L3 9.5L3 10ZM0 7L-0.5 7C-0.5 8.933 1.067 10.5 3 10.5L3 10L3 9.5C1.61929 9.5 0.5 8.38071 0.5 7L0 7Z"),
956
+ );
957
+ }
958
+ function SessionHoverCard({ title, time, running, style, cardRef }) {
959
+ return h("div", { className: "ima-n-hover", style, ref: cardRef },
960
+ h("div", { className: "ima-n-hover-title" }, title),
961
+ time ? h("div", { className: "ima-n-hover-time" }, time) : null,
962
+ h("div", { className: "ima-n-hover-state" },
963
+ h("span", { className: running ? "ima-n-hover-dot is-run" : "ima-n-hover-dot" }),
964
+ running ? "运行中" : "空闲",
965
+ ),
966
+ );
967
+ }
886
968
  function MoreIcon() {
887
969
  return h(IconEllipsis);
888
970
  }
@@ -900,10 +982,10 @@ window.__ModuleLoader__.load({
900
982
  const delta = Math.max(0, Date.now() - ts);
901
983
  const min = Math.floor(delta / 60000);
902
984
  if (min < 1) return "刚刚";
903
- if (min < 60) return min + "分钟";
985
+ if (min < 60) return min + "分钟前";
904
986
  const hour = Math.floor(min / 60);
905
- if (hour < 24) return hour + "小时";
906
- return Math.floor(hour / 24) + "天";
987
+ if (hour < 24) return hour + "小时前";
988
+ return Math.floor(hour / 24) + "天前";
907
989
  }
908
990
 
909
991
 
@@ -953,8 +1035,32 @@ window.__ModuleLoader__.load({
953
1035
  const setMenu = (next) => onMenuChange(!!next);
954
1036
  const [renaming, setRenaming] = useState(false);
955
1037
  const [draft, setDraft] = useState(sess.title || sess.chatId || "");
1038
+ const rowRef = useRef(null);
1039
+ const hoverRef = useRef(null);
1040
+ const hoverTimer = useRef(null);
1041
+ const [hoverOpen, setHoverOpen] = useState(false);
1042
+ const [hoverStyle, setHoverStyle] = useState({});
956
1043
  const title = sess.title || sess.chatId;
957
1044
  const native = skin !== "codex";
1045
+ const running = !!(sess.running || (sessionById && sessionById[sess.sessionId] && sessionById[sess.sessionId].running));
1046
+ const showHover = () => {
1047
+ if (menu || !native) return;
1048
+ if (hoverTimer.current) window.clearTimeout(hoverTimer.current);
1049
+ hoverTimer.current = window.setTimeout(() => setHoverOpen(true), 500);
1050
+ };
1051
+ const hideHover = () => {
1052
+ if (hoverTimer.current) window.clearTimeout(hoverTimer.current);
1053
+ setHoverOpen(false);
1054
+ };
1055
+ useLayoutEffect(() => {
1056
+ if (!hoverOpen || menu || !rowRef.current) return;
1057
+ const row = rowRef.current.getBoundingClientRect();
1058
+ const card = hoverRef.current;
1059
+ const height = card && card.offsetHeight ? card.offsetHeight : 96;
1060
+ const top = row.top + height > window.innerHeight - 8 ? Math.max(8, window.innerHeight - height - 8) : Math.max(8, row.top);
1061
+ setHoverStyle({ position: "fixed", zIndex: 4100, left: Math.round(row.right + 8) + "px", top: Math.round(top) + "px" });
1062
+ }, [hoverOpen, menu, title, running]);
1063
+ useEffect(() => () => { if (hoverTimer.current) window.clearTimeout(hoverTimer.current); }, []);
958
1064
  const rowClass = native
959
1065
  ? ("ima-native-session" + (selected ? " on" : "") + (menu ? " menu-on" : ""))
960
1066
  : ("dcu-wb-session" + (selected ? " dcu-wb-selected" : "") + (menu ? " dcu-wb-menu-open" : ""));
@@ -1021,18 +1127,20 @@ window.__ModuleLoader__.load({
1021
1127
  { id: "rename", label: "重命名", icon: h(IconEdit), go: () => { setRenaming(true); } },
1022
1128
  { id: "fork", label: "分叉会话", icon: h(IconBranch), go: () => run("fork") },
1023
1129
  { id: "archive", label: "归档会话", icon: h(IconArchive), go: () => run("archive") },
1024
- { id: "delete", label: "删除会话", icon: h(IconTrash), danger: true, go: () => run("delete") },
1025
1130
  ];
1026
1131
  return h("div", {
1132
+ ref: rowRef,
1027
1133
  className: native ? ("ima-n-sess" + (selected ? " on" : "") + (menu ? " menu-on" : "")) : rowClass,
1028
1134
  role: "treeitem",
1029
1135
  tabIndex: 0,
1030
1136
  "aria-selected": selected,
1031
- onClick: () => { setMenu(false); onOpen(sess.sessionId); },
1137
+ onClick: () => { setMenu(false); hideHover(); onOpen(sess.sessionId); },
1138
+ onMouseEnter: showHover,
1139
+ onMouseLeave: hideHover,
1032
1140
  onKeyDown: (e) => { if (e.key === "Enter" || e.key === " ") { e.preventDefault(); setMenu(false); onOpen(sess.sessionId); } },
1033
- onContextMenu: (e) => { e.preventDefault(); e.stopPropagation(); onMenuChange(true, e); },
1141
+ onContextMenu: (e) => { e.preventDefault(); e.stopPropagation(); hideHover(); onMenuChange(true, e); },
1034
1142
  },
1035
- native && h("span", { className: "ima-n-slot" }, (sess.running || (sessionById && sessionById[sess.sessionId] && sessionById[sess.sessionId].running)) ? h(RunningStateDot) : null),
1143
+ native && h("span", { className: "ima-n-slot" }, running ? h(RunningStateDot) : null),
1036
1144
  h("span", { className: native ? "ima-n-title" : "dcu-wb-session-title" }, title),
1037
1145
  native && h("span", { className: "ima-n-time" }, relativeTime(sess.updatedAt)),
1038
1146
  h("span", { className: native ? "ima-n-acts" : "dcu-wb-actions" },
@@ -1045,6 +1153,13 @@ window.__ModuleLoader__.load({
1045
1153
  onClick: (e) => { e.stopPropagation(); onMenuChange(!menu, e); },
1046
1154
  }, native ? h(IconEllipsis) : h(MoreIcon)),
1047
1155
  ),
1156
+ hoverOpen && !menu && native && h(SessionHoverCard, {
1157
+ title,
1158
+ time: relativeTime(sess.updatedAt),
1159
+ running,
1160
+ style: hoverStyle,
1161
+ cardRef: hoverRef,
1162
+ }),
1048
1163
  menu && h(SessionPointerMenu, {
1049
1164
  native,
1050
1165
  x: menuOpen && menuOpen.x,
@@ -1082,6 +1197,9 @@ window.__ModuleLoader__.load({
1082
1197
  const [folded, setFolded] = useState({});
1083
1198
  const [error, setError] = useState("");
1084
1199
  const [openMenu, setOpenMenu] = useState(null);
1200
+ const [query, setQuery] = useState("");
1201
+ const [sort, setSort] = useState("time");
1202
+ const [groupMode, setGroupMode] = useState("workspace");
1085
1203
  const selectedId = props.selectedId;
1086
1204
  const archived = new Set(props.archivedIds || []);
1087
1205
  const skin = props.skin || channelSkin;
@@ -1114,17 +1232,35 @@ window.__ModuleLoader__.load({
1114
1232
  document.removeEventListener("keydown", onKeyDown);
1115
1233
  };
1116
1234
  }, [openMenu]);
1235
+ const needle = query.trim().toLowerCase();
1236
+ const visibleGroups = groups.map((g) => {
1237
+ const sessions = (g.sessions || []).filter((sess) => !archived.has(sess.sessionId));
1238
+ if (!needle) return Object.assign({}, g, { sessions });
1239
+ const nameHit = String(g.label || "").toLowerCase().includes(needle);
1240
+ return Object.assign({}, g, { sessions: nameHit ? sessions : sessions.filter((sess) => String(sess.title || sess.chatId || "").toLowerCase().includes(needle)) });
1241
+ });
1242
+ if (sort === "time") {
1243
+ visibleGroups.sort((a, b) => {
1244
+ const latest = (g) => Math.max(0, ...(g.sessions || []).map((sess) => Date.parse(sess.updatedAt || "") || 0));
1245
+ return latest(b) - latest(a);
1246
+ });
1247
+ }
1248
+ if (groupMode === "list") {
1249
+ const sessions = visibleGroups.flatMap((g) => g.sessions || []);
1250
+ if (sort === "time") sessions.sort((a, b) => (Date.parse(b.updatedAt || "") || 0) - (Date.parse(a.updatedAt || "") || 0));
1251
+ visibleGroups.splice(0, visibleGroups.length, { id: "__flat__", label: "", sessions });
1252
+ }
1117
1253
  return h("div", { className: native ? "ima-native ima-rail" : "dcu-wb ima-rail" },
1118
1254
  h("style", null, WB_CSS),
1255
+ h(ChannelWorkspaceHead, { query, sort, groupMode, onQuery: setQuery, onSort: setSort, onGroupMode: setGroupMode }),
1119
1256
  h("div", { className: native ? "ima-native-tree" : "dcu-wb-tree", role: "tree" },
1120
1257
  error && h("div", { className: native ? "ima-native-empty" : "dcu-wb-empty" }, error),
1121
1258
  !error && groups.length === 0 && h("div", { className: native ? "ima-native-empty" : "dcu-wb-empty" }, "还没有频道会话。先在设置 → IM助理 里连接渠道,并给机器人发一条消息。"),
1122
- ...groups.map((g) => {
1123
- const visible = (g.sessions || []).filter((sess) => !archived.has(sess.sessionId));
1124
- if (!visible.length) return null;
1259
+ ...visibleGroups.map((g) => {
1260
+ const visible = g.sessions || [];
1125
1261
  const expanded = !folded[g.id];
1126
1262
  return h("div", { key: g.id, className: native ? "ima-native-project" : "dcu-wb-project" },
1127
- h("button", {
1263
+ groupMode !== "list" && h("button", {
1128
1264
  className: native ? "ima-n-row" : "dcu-wb-project-head",
1129
1265
  type: "button",
1130
1266
  role: "treeitem",
@@ -1134,7 +1270,6 @@ window.__ModuleLoader__.load({
1134
1270
  native
1135
1271
  ? [
1136
1272
  h("span", { key: "folder", className: "ima-n-slot ima-n-folder" }, h(Logo, { id: g.id, small: true })),
1137
- h("span", { key: "chev", className: "ima-n-slot ima-n-chevron" }, h("span", { className: expanded ? "ima-n-arrow open" : "ima-n-arrow" }, h(IconChevron))),
1138
1273
  h("span", { key: "title", className: "ima-n-title" }, g.label),
1139
1274
  ]
1140
1275
  : [
@@ -1142,8 +1277,7 @@ window.__ModuleLoader__.load({
1142
1277
  h("span", { key: "title", className: "dcu-wb-project-title" }, g.label),
1143
1278
  ],
1144
1279
  ),
1145
- !folded[g.id] && (visible.length
1146
- ? visible.map((sess) => h(ChannelSessionRow, {
1280
+ (groupMode === "list" || !folded[g.id]) && visible.length > 0 && visible.map((sess) => h(ChannelSessionRow, {
1147
1281
  key: sess.sessionId,
1148
1282
  sess,
1149
1283
  selected: selectedId === sess.sessionId,
@@ -1164,8 +1298,7 @@ window.__ModuleLoader__.load({
1164
1298
  forkSession: props.forkSession,
1165
1299
  openPath: props.openPath,
1166
1300
  },
1167
- }))
1168
- : h("div", { className: native ? "ima-native-empty" : "dcu-wb-empty" }, "暂无会话")),
1301
+ })),
1169
1302
  );
1170
1303
  }),
1171
1304
  ),
@@ -1229,15 +1362,32 @@ window.__ModuleLoader__.load({
1229
1362
  );
1230
1363
  }
1231
1364
 
1232
- function filterSessionsByIm(state, keepIm) {
1233
- const src = state || { ids: [], byId: {}, current: null };
1234
- const ids = (src.ids || []).filter((id) => String(id).startsWith("im:") === keepIm);
1365
+ const imSessionFilterCache = new WeakMap();
1366
+ const registryFilterCache = new WeakMap();
1367
+ function cacheFilteredSessions(src, ids) {
1368
+ if (ids.length === (src.ids || []).length) return src;
1235
1369
  const byId = {};
1236
1370
  for (const id of ids) {
1237
1371
  if (src.byId && src.byId[id]) byId[id] = src.byId[id];
1238
1372
  }
1239
1373
  return Object.assign({}, src, { ids, byId });
1240
1374
  }
1375
+ function filterSessionsByIm(state, keepIm) {
1376
+ const src = state || { ids: [], byId: {}, current: null };
1377
+ const key = keepIm ? "im" : "task";
1378
+ if (src && typeof src === "object") {
1379
+ const hit = imSessionFilterCache.get(src);
1380
+ if (hit && hit[key]) return hit[key];
1381
+ }
1382
+ const ids = (src.ids || []).filter((id) => String(id).startsWith("im:") === keepIm);
1383
+ const result = cacheFilteredSessions(src, ids);
1384
+ if (src && typeof src === "object") {
1385
+ const bucket = imSessionFilterCache.get(src) || {};
1386
+ bucket[key] = result;
1387
+ imSessionFilterCache.set(src, bucket);
1388
+ }
1389
+ return result;
1390
+ }
1241
1391
 
1242
1392
  function filterTaskSessions(state) {
1243
1393
  return filterSessionsByIm(state, false);
@@ -1292,12 +1442,14 @@ window.__ModuleLoader__.load({
1292
1442
  const src = state || { ids: [], byId: {}, current: null };
1293
1443
  const filters = registry && registry.sessionFilters ? registry.sessionFilters : [];
1294
1444
  if (!filters.length) return src;
1295
- const ids = (src.ids || []).filter((id) => filters.every((fn) => fn(String(id))));
1296
- const byId = {};
1297
- for (const id of ids) {
1298
- if (src.byId && src.byId[id]) byId[id] = src.byId[id];
1445
+ if (src && typeof src === "object") {
1446
+ const hit = registryFilterCache.get(src);
1447
+ if (hit && hit.filters === filters) return hit.result;
1299
1448
  }
1300
- return Object.assign({}, src, { ids, byId });
1449
+ const ids = (src.ids || []).filter((id) => filters.every((fn) => fn(String(id))));
1450
+ const result = cacheFilteredSessions(src, ids);
1451
+ if (src && typeof src === "object") registryFilterCache.set(src, { filters, result });
1452
+ return result;
1301
1453
  }
1302
1454
 
1303
1455
  function SessionSwitcher(props) {
@@ -1315,22 +1467,30 @@ window.__ModuleLoader__.load({
1315
1467
  const currentId = typeof rawUseSessions === "function"
1316
1468
  ? rawUseSessions((state) => (state && state.current) || null)
1317
1469
  : (props.selectedId || null);
1318
- const useTaskSessions = useCallback((selector) => {
1470
+ const useTaskSessions = useCallback((selector, eq) => {
1319
1471
  if (typeof rawUseSessions !== "function") return selector({ ids: [], byId: {}, current: null });
1320
- return rawUseSessions((state) => selector(applyRegistryFilters(filterTaskSessions(state), nativeTabs)));
1472
+ return rawUseSessions((state) => selector(applyRegistryFilters(filterTaskSessions(state), nativeTabs)), eq);
1321
1473
  }, [rawUseSessions, nativeTabs]);
1322
- const useChannelSessions = useCallback((selector) => {
1474
+ const useChannelSessions = useCallback((selector, eq) => {
1323
1475
  if (typeof rawUseSessions !== "function") return selector({ ids: [], byId: {}, current: null });
1324
- return rawUseSessions((state) => selector(filterChannelSessions(state)));
1476
+ return rawUseSessions((state) => selector(filterChannelSessions(state)), eq);
1325
1477
  }, [rawUseSessions]);
1326
1478
  useEffect(() => { ensureStyle(); }, []);
1327
1479
  useEffect(() => { try { localStorage.setItem(TAB_KEY, tab); } catch { /* ignore */ } }, [tab]);
1480
+ const previousCurrentId = useRef(currentId);
1481
+ const tabFollowReady = useRef(false);
1328
1482
  useEffect(() => {
1329
- if (typeof currentId === "string" && currentId.startsWith("im:")) setTab("channels");
1330
- if (typeof currentId === "string") {
1331
- const matched = extraTabs.find((item) => item.matchSession && item.matchSession(currentId));
1332
- if (matched) setTab(matched.id);
1483
+ if (!tabFollowReady.current) {
1484
+ tabFollowReady.current = true;
1485
+ previousCurrentId.current = currentId;
1486
+ return;
1333
1487
  }
1488
+ const previous = previousCurrentId.current;
1489
+ previousCurrentId.current = currentId;
1490
+ if (typeof currentId !== "string" || currentId === "" || currentId === previous) return;
1491
+ if (currentId.startsWith("im:")) setTab("channels");
1492
+ const matched = extraTabs.find((item) => item.matchSession && item.matchSession(currentId));
1493
+ if (matched && matched.id !== "schedule") setTab(matched.id);
1334
1494
  }, [currentId, extraTabs]);
1335
1495
  const openSession = (id) => openListedSession(id, props.openSession || props.open);
1336
1496
  const officialProps = Object.assign({}, props, { useSessions: useTaskSessions });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@michengai/dsh-im-connect",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "DeepSeek Harness IM 助理:把本机 agent 接到微信、企微、钉钉、飞书、QQ、Telegram,会话与网页任务分列。",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -41,15 +41,19 @@
41
41
  "node": ">=22.19"
42
42
  },
43
43
  "dependencies": {
44
- "@deepseek-ai/cordis": "^4.0.1",
45
- "@deepseek-ai/schemastery": "^3.18.1",
46
44
  "@larksuiteoapi/node-sdk": "^1.36.0",
47
45
  "@tencent-connect/qqbot-connector": "^1.2.0",
48
46
  "@wecom/aibot-node-sdk": "^1.0.7",
49
47
  "dingtalk-stream": "^2.1.4",
50
48
  "qrcode": "^1.5.4"
51
49
  },
50
+ "peerDependencies": {
51
+ "@deepseek-ai/cordis": "^4.0.1",
52
+ "@deepseek-ai/schemastery": "^3.18.1"
53
+ },
52
54
  "devDependencies": {
55
+ "@deepseek-ai/cordis": "^4.0.1",
56
+ "@deepseek-ai/schemastery": "^3.18.1",
53
57
  "@types/node": "^22.10.0",
54
58
  "@types/qrcode": "^1.5.6",
55
59
  "typescript": "^5.9.2"