dsh-plugin-om 0.0.62 → 0.0.64

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 (50) hide show
  1. package/README.md +38 -24
  2. package/cordis.patch.yml +2 -0
  3. package/dist/client/OmCompactionCard.d.ts +1 -4
  4. package/dist/client/OmCompactionCard.d.ts.map +1 -1
  5. package/dist/client/definition.d.ts +1 -1
  6. package/dist/client/eval-model-panel.d.ts +17 -2
  7. package/dist/client/eval-model-panel.d.ts.map +1 -1
  8. package/dist/client/eval-model-register.d.ts +5 -2
  9. package/dist/client/eval-model-register.d.ts.map +1 -1
  10. package/dist/client/index.d.ts +2 -1
  11. package/dist/client/index.d.ts.map +1 -1
  12. package/dist/client/locales.d.ts +6 -18
  13. package/dist/client/locales.d.ts.map +1 -1
  14. package/dist/client/om-config-controller.d.ts +3 -7
  15. package/dist/client/om-config-controller.d.ts.map +1 -1
  16. package/dist/client.js +115 -550
  17. package/dist/client.js.map +1 -1
  18. package/dist/compaction-eval/index.d.ts +8 -0
  19. package/dist/compaction-eval/index.d.ts.map +1 -0
  20. package/dist/compaction-eval/index.mjs +206 -0
  21. package/dist/compaction-eval-command.d.ts +6 -3
  22. package/dist/compaction-eval-command.d.ts.map +1 -1
  23. package/dist/compress.d.ts +1 -1
  24. package/dist/compress.d.ts.map +1 -1
  25. package/dist/config.d.ts +3 -11
  26. package/dist/config.d.ts.map +1 -1
  27. package/dist/index.d.ts +1 -1
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.mjs +38 -549
  30. package/dist/skill/compaction-eval/SKILL.md +2 -1
  31. package/dist/skill/compaction-eval/scripts/compress.mjs +21 -21
  32. package/dist/skill/compaction-eval/scripts/view.mjs +77 -79
  33. package/dist/system-reminder.d.ts +2 -2
  34. package/dist/system-reminder.d.ts.map +1 -1
  35. package/dist/utils-D-cEbiTF.mjs +89 -0
  36. package/locale/compaction-eval/en.json +6 -0
  37. package/locale/compaction-eval/zh.json +6 -0
  38. package/locale/en.json +6 -0
  39. package/locale/zh.json +6 -0
  40. package/package.json +12 -1
  41. package/dist/client/OmRecompressMenu.d.ts +0 -11
  42. package/dist/client/OmRecompressMenu.d.ts.map +0 -1
  43. package/dist/client/recompress-inject.d.ts +0 -9
  44. package/dist/client/recompress-inject.d.ts.map +0 -1
  45. package/dist/client/recompress-run.d.ts +0 -94
  46. package/dist/client/recompress-run.d.ts.map +0 -1
  47. package/dist/recompress-gate.d.ts +0 -11
  48. package/dist/recompress-gate.d.ts.map +0 -1
  49. package/dist/recompress.d.ts +0 -82
  50. package/dist/recompress.d.ts.map +0 -1
package/dist/client.js CHANGED
@@ -8,7 +8,6 @@ window.__ModuleLoader__.load({
8
8
  let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
9
9
  let react = require("react");
10
10
  let react_jsx_runtime = require("react/jsx-runtime");
11
- let react_dom = require("react-dom");
12
11
  //#region src/eval-session-text.ts
13
12
  /**
14
13
  * /om-compaction-eval 的文本契约:命令名与描述、新会话首条消息、成功文本及其反解。
@@ -492,21 +491,13 @@ window.__ModuleLoader__.load({
492
491
  "compaction.failed.reflect": "上下文压缩失败(反思)",
493
492
  "card.inspect": "诊断日志",
494
493
  "card.trajectory": "轨迹",
495
- "recompress.action": "尝试其他模型",
496
- "recompress.running": "重压缩中:{model}…",
497
- "recompress.started": "压缩开始,完成后会添加至“子智能体”",
498
- "recompress.search": "搜索模型",
499
- "recompress.loading": "正在加载模型…",
500
- "recompress.empty": "没有可用模型",
501
- "recompress.loadFailed": "模型列表加载失败",
502
- "recompress.retry": "重试",
503
- "recompress.effort.title": "思考等级",
504
- "recompress.effort.default": "模型默认",
505
- "recompress.start": "开始({count})",
506
- "recompress.done": "重压缩完成,会话记录已写入日志",
507
- "recompress.failed": "重压缩失败:{error}",
508
494
  "eval.search": "搜索模型",
495
+ "eval.loading": "正在加载模型…",
509
496
  "eval.empty": "没有可用模型",
497
+ "eval.loadFailed": "模型列表加载失败",
498
+ "eval.retry": "重试",
499
+ "eval.effort": "思考等级",
500
+ "eval.effortDefault": "模型默认",
510
501
  "eval.noResults": "没有匹配的模型",
511
502
  "eval.loadError": "加载失败:{message}",
512
503
  "eval.pickModel": "先在左侧选择模型",
@@ -543,14 +534,10 @@ window.__ModuleLoader__.load({
543
534
  "config.compressSkipReasoning.hint": "压缩时不将历史 reasoning 纳入参考。",
544
535
  "config.rateLimitWaitMs": "限流等待毫秒数",
545
536
  "config.rateLimitWaitMs.hint": "429 限流后的冷却时间;0 表示不等待。",
546
- "config.recompressConcurrency": "重压缩并发数",
547
- "config.recompressConcurrency.hint": "换模型重压缩同时运行的上限,至少为 1;超出的排队等待。",
548
537
  "config.modelDir": "嵌入模型目录",
549
538
  "config.modelDir.hint": "本地语义增强使用的嵌入模型目录。",
550
- "config.omEnabled": "自动压缩",
551
- "config.omEnabled.hint": "启用观察压缩和摘要反思合并;关闭后进度提醒也不再注入。",
552
539
  "config.progressReminderEnabled": "进度提醒",
553
- "config.progressReminderEnabled.hint": "向主会话注入进度提醒,要求模型持续输出记录;需同时开启自动压缩。",
540
+ "config.progressReminderEnabled.hint": "向主会话注入进度提醒,要求模型持续输出记录。",
554
541
  "config.progressReminderIdleEnabled": "长期无记录时重发",
555
542
  "config.progressReminderIdleEnabled.hint": "模型长期只调用工具不输出记录时重发提醒;关闭后仅在提醒缺失时补发。",
556
543
  "config.progressReminderIdleSteps": "重发步数",
@@ -579,21 +566,13 @@ window.__ModuleLoader__.load({
579
566
  "compaction.failed.reflect": "Context compaction failed (reflection)",
580
567
  "card.inspect": "Diagnostic log",
581
568
  "card.trajectory": "Trajectory",
582
- "recompress.action": "Try another model",
583
- "recompress.running": "Recompressing: {model}…",
584
- "recompress.started": "Compression started; it will be added to “Subagents” when done",
585
- "recompress.search": "Search models",
586
- "recompress.loading": "Loading models…",
587
- "recompress.empty": "No models available",
588
- "recompress.loadFailed": "Failed to load models",
589
- "recompress.retry": "Retry",
590
- "recompress.effort.title": "Reasoning effort",
591
- "recompress.effort.default": "Model default",
592
- "recompress.start": "Start ({count})",
593
- "recompress.done": "Recompression finished; the session record is in the log",
594
- "recompress.failed": "Recompression failed: {error}",
595
569
  "eval.search": "Search models",
570
+ "eval.loading": "Loading models…",
596
571
  "eval.empty": "No models available",
572
+ "eval.loadFailed": "Failed to load models",
573
+ "eval.retry": "Retry",
574
+ "eval.effort": "Reasoning effort",
575
+ "eval.effortDefault": "Model default",
597
576
  "eval.noResults": "No matching models",
598
577
  "eval.loadError": "Failed to load: {message}",
599
578
  "eval.pickModel": "Pick a model on the left first",
@@ -630,14 +609,10 @@ window.__ModuleLoader__.load({
630
609
  "config.compressSkipReasoning.hint": "Exclude historical reasoning from compression references.",
631
610
  "config.rateLimitWaitMs": "Rate-limit wait in milliseconds",
632
611
  "config.rateLimitWaitMs.hint": "Cooldown after a 429 response; zero skips the wait.",
633
- "config.recompressConcurrency": "Recompression concurrency",
634
- "config.recompressConcurrency.hint": "Maximum concurrent model-switch recompressions, at least one; extra runs wait in a queue.",
635
612
  "config.modelDir": "Embedding model directory",
636
613
  "config.modelDir.hint": "Directory containing the local semantic-enhancement embedding model.",
637
- "config.omEnabled": "Automatic compaction",
638
- "config.omEnabled.hint": "Enable observation and reflection of summaries. Turning it off also stops progress reminders.",
639
614
  "config.progressReminderEnabled": "Progress reminder",
640
- "config.progressReminderEnabled.hint": "Inject a progress reminder asking the model to keep writing notes. Requires automatic compaction.",
615
+ "config.progressReminderEnabled.hint": "Inject a progress reminder asking the model to keep writing notes.",
641
616
  "config.progressReminderIdleEnabled": "Resend when silent",
642
617
  "config.progressReminderIdleEnabled.hint": "Resend the reminder when the model only calls tools without notes; off resends only when it is missing.",
643
618
  "config.progressReminderIdleSteps": "Resend step count",
@@ -657,7 +632,7 @@ window.__ModuleLoader__.load({
657
632
  * 提交失败的原因显示在面板内;点面板外或按 Esc 关闭。
658
633
  * 数据来自会话共享的模型目录(与 /model 同一份)。导出 OmEvalModelPanel。
659
634
  */
660
- const css$2 = {
635
+ const css$1 = {
661
636
  panel: "om-eval-panel",
662
637
  columns: "om-eval-columns",
663
638
  left: "om-eval-left",
@@ -673,22 +648,22 @@ window.__ModuleLoader__.load({
673
648
  error: "om-eval-error"
674
649
  };
675
650
  const panelCss = `
676
- .${css$2.panel}{position:fixed;z-index:1000;left:50%;top:50%;transform:translate(-50%,-50%);box-sizing:border-box;width:min(560px,calc(100vw - 24px));max-height:min(420px,calc(100vh - 24px));display:flex;flex-direction:column;overflow:hidden}
677
- .${css$2.columns}{min-height:0;flex:1;display:flex}
678
- .${css$2.left}{flex:1 1 60%;min-width:0;display:flex;flex-direction:column;border-right:1px solid var(--dsw-alias-label-caption)}
679
- .${css$2.right}{flex:1 1 40%;min-width:0;overflow-y:auto;padding:4px}
680
- .${css$2.search}{box-sizing:border-box;width:100%;margin:0;padding:8px 12px;font:inherit;font-size:13px;color:inherit;background:none;border:none;border-bottom:1px solid var(--dsw-alias-label-caption);outline:none}
681
- .${css$2.list}{min-height:0;overflow-y:auto;padding:4px}
682
- .${css$2.row}{box-sizing:border-box;width:100%;display:flex;align-items:center;gap:6px;text-align:left;font:inherit;font-size:13px;line-height:20px;color:inherit;background:none;border:none;border-radius:6px;padding:4px 8px;cursor:pointer}
683
- .${css$2.row}:hover,.${css$2.row}:focus-visible,.${css$2.row}[aria-checked=true]{background:var(--dsw-alias-interactive-bg-hover-solid);outline:none}
684
- .${css$2.row}:disabled{cursor:default;opacity:.55}
685
- .${css$2.mark}{flex:none;color:var(--dsw-alias-label-secondary)}
686
- .${css$2.section}{padding:6px 8px 2px;font-size:11px;color:var(--dsw-alias-label-tertiary)}
687
- .${css$2.footer}{flex:none;display:flex;padding:8px;border-top:1px solid var(--dsw-alias-label-caption)}
688
- .${css$2.start}{flex:1;box-sizing:border-box;font:inherit;font-size:13px;line-height:20px;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover-solid);border:none;border-radius:6px;padding:4px 8px;cursor:pointer}
689
- .${css$2.start}:disabled{opacity:.45;cursor:default}
690
- .${css$2.note}{padding:8px 12px;font-size:13px;color:var(--dsw-alias-label-tertiary)}
691
- .${css$2.error}{flex:none;padding:6px 12px;font-size:12px;color:var(--dsw-alias-state-error-primary)}
651
+ .${css$1.panel}{position:fixed;z-index:1000;left:50%;top:50%;transform:translate(-50%,-50%);box-sizing:border-box;width:min(560px,calc(100vw - 24px));max-height:min(420px,calc(100vh - 24px));display:flex;flex-direction:column;overflow:hidden}
652
+ .${css$1.columns}{min-height:0;flex:1;display:flex}
653
+ .${css$1.left}{flex:1 1 60%;min-width:0;display:flex;flex-direction:column;border-right:1px solid var(--dsw-alias-label-caption)}
654
+ .${css$1.right}{flex:1 1 40%;min-width:0;overflow-y:auto;padding:4px}
655
+ .${css$1.search}{box-sizing:border-box;width:100%;margin:0;padding:8px 12px;font:inherit;font-size:13px;color:inherit;background:none;border:none;border-bottom:1px solid var(--dsw-alias-label-caption);outline:none}
656
+ .${css$1.list}{min-height:0;overflow-y:auto;padding:4px}
657
+ .${css$1.row}{box-sizing:border-box;width:100%;display:flex;align-items:center;gap:6px;text-align:left;font:inherit;font-size:13px;line-height:20px;color:inherit;background:none;border:none;border-radius:6px;padding:4px 8px;cursor:pointer}
658
+ .${css$1.row}:hover,.${css$1.row}:focus-visible,.${css$1.row}[aria-checked=true]{background:var(--dsw-alias-interactive-bg-hover-solid);outline:none}
659
+ .${css$1.row}:disabled{cursor:default;opacity:.55}
660
+ .${css$1.mark}{flex:none;color:var(--dsw-alias-label-secondary)}
661
+ .${css$1.section}{padding:6px 8px 2px;font-size:11px;color:var(--dsw-alias-label-tertiary)}
662
+ .${css$1.footer}{flex:none;display:flex;padding:8px;border-top:1px solid var(--dsw-alias-label-caption)}
663
+ .${css$1.start}{flex:1;box-sizing:border-box;font:inherit;font-size:13px;line-height:20px;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover-solid);border:none;border-radius:6px;padding:4px 8px;cursor:pointer}
664
+ .${css$1.start}:disabled{opacity:.45;cursor:default}
665
+ .${css$1.note}{padding:8px 12px;font-size:13px;color:var(--dsw-alias-label-tertiary)}
666
+ .${css$1.error}{flex:none;padding:6px 12px;font-size:12px;color:var(--dsw-alias-state-error-primary)}
692
667
  `;
693
668
  /** 注册面板样式(无 document 的环境如 node 测试直接跳过)。 */
694
669
  if (typeof document !== "undefined" && document.querySelector("style[data-dsh-plugin-om-eval]") === null) {
@@ -759,48 +734,48 @@ window.__ModuleLoader__.load({
759
734
  }
760
735
  };
761
736
  const mark = (checked) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
762
- className: css$2.mark,
737
+ className: css$1.mark,
763
738
  "aria-hidden": "true",
764
739
  children: checked ? "◉" : "○"
765
740
  });
766
741
  let left;
767
742
  if (state.status === "error" && groups.length === 0) left = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
768
- className: css$2.note,
743
+ className: css$1.note,
769
744
  children: [
770
- state.error ?? t("recompress.loadFailed"),
745
+ state.error ?? t("eval.loadFailed"),
771
746
  " ",
772
747
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
773
748
  type: "button",
774
- className: css$2.row,
749
+ className: css$1.row,
775
750
  "data-om-eval-retry": true,
776
751
  onClick: () => load(),
777
- children: t("recompress.retry")
752
+ children: t("eval.retry")
778
753
  })
779
754
  ]
780
755
  });
781
756
  else if (groups.length === 0) left = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
782
- className: css$2.note,
783
- children: state.status === "ready" ? t("eval.empty") : t("recompress.loading")
757
+ className: css$1.note,
758
+ children: state.status === "ready" ? t("eval.empty") : t("eval.loading")
784
759
  });
785
760
  else left = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
786
- className: css$2.search,
761
+ className: css$1.search,
787
762
  "data-om-eval-search": true,
788
763
  value: query,
789
764
  placeholder: t("eval.search"),
790
765
  onChange: (event) => setQuery(event.target.value),
791
766
  autoFocus: true
792
767
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
793
- className: css$2.list,
768
+ className: css$1.list,
794
769
  children: [
795
770
  filtered.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
796
- className: css$2.note,
771
+ className: css$1.note,
797
772
  children: t("eval.noResults")
798
773
  }),
799
774
  filtered.map((group) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.MenuGroup, {
800
775
  label: group.name,
801
776
  children: group.models.map((model) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
802
777
  type: "button",
803
- className: css$2.row,
778
+ className: css$1.row,
804
779
  role: "menuitemradio",
805
780
  "aria-checked": picked?.provider === group.id && picked.model.id === model.id,
806
781
  "data-om-eval-model": `${group.id}/${model.id}`,
@@ -810,7 +785,7 @@ window.__ModuleLoader__.load({
810
785
  }, group.id)),
811
786
  state.failures.map((failure) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
812
787
  type: "button",
813
- className: css$2.row,
788
+ className: css$1.row,
814
789
  disabled: true,
815
790
  title: t("eval.loadError", { message: failure.message }),
816
791
  children: failure.name
@@ -820,30 +795,30 @@ window.__ModuleLoader__.load({
820
795
  const efforts = picked?.model.reasoning?.efforts ?? [];
821
796
  let right;
822
797
  if (picked === null) right = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
823
- className: css$2.note,
798
+ className: css$1.note,
824
799
  children: t("eval.pickModel")
825
800
  });
826
801
  else if (efforts.length === 0) right = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
827
- className: css$2.note,
802
+ className: css$1.note,
828
803
  children: t("eval.noEffort")
829
804
  });
830
805
  else right = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
831
806
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
832
- className: css$2.section,
833
- children: t("recompress.effort.title")
807
+ className: css$1.section,
808
+ children: t("eval.effort")
834
809
  }),
835
810
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
836
811
  type: "button",
837
- className: css$2.row,
812
+ className: css$1.row,
838
813
  role: "menuitemradio",
839
814
  "aria-checked": effort === void 0,
840
815
  "data-om-eval-effort": "",
841
816
  onClick: () => setEffort(void 0),
842
- children: [mark(effort === void 0), t("recompress.effort.default")]
817
+ children: [mark(effort === void 0), t("eval.effortDefault")]
843
818
  }),
844
819
  efforts.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
845
820
  type: "button",
846
- className: css$2.row,
821
+ className: css$1.row,
847
822
  role: "menuitemradio",
848
823
  "aria-checked": effort === item.id,
849
824
  "data-om-eval-effort": item.id,
@@ -853,29 +828,29 @@ window.__ModuleLoader__.load({
853
828
  ] });
854
829
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_deepseek_ai_dsh_client_ui_primitives.MenuSurface, {
855
830
  ref: panelRef,
856
- className: css$2.panel,
831
+ className: css$1.panel,
857
832
  role: "menu",
858
833
  children: [
859
834
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
860
- className: css$2.columns,
835
+ className: css$1.columns,
861
836
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
862
- className: css$2.left,
837
+ className: css$1.left,
863
838
  children: left
864
839
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
865
- className: css$2.right,
840
+ className: css$1.right,
866
841
  children: right
867
842
  })]
868
843
  }),
869
844
  error !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
870
- className: css$2.error,
845
+ className: css$1.error,
871
846
  "data-om-eval-error": true,
872
847
  children: error
873
848
  }),
874
849
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
875
- className: css$2.footer,
850
+ className: css$1.footer,
876
851
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
877
852
  type: "button",
878
- className: css$2.start,
853
+ className: css$1.start,
879
854
  "data-om-eval-start": true,
880
855
  disabled: picked === null || submitting,
881
856
  onClick: () => void submit(),
@@ -887,8 +862,11 @@ window.__ModuleLoader__.load({
887
862
  }
888
863
  //#endregion
889
864
  //#region src/client/eval-model-register.tsx
890
- /** 在 commandUi 与 modelDirectories 都就绪后注册装饰;任一服务缺失则不挂载。 */
891
- function registerEvalModelPanel(ctx) {
865
+ /**
866
+ * 在 commandUi 与 modelDirectories 都就绪后注册装饰;任一服务缺失则不挂载。
867
+ * available 由调用方提供,评估组件行停用期间面板不可用。
868
+ */
869
+ function registerEvalModelPanel(ctx, available) {
892
870
  const t = ctx.locale.bind(NS);
893
871
  ctx.inject(["commandUi", "modelDirectories"], (scope) => {
894
872
  const directories = scope.modelDirectories;
@@ -925,7 +903,7 @@ window.__ModuleLoader__.load({
925
903
  scope.effect(() => {
926
904
  const dispose = scope.commandUi.decorate({
927
905
  name: EVAL_COMMAND_NAME,
928
- available: () => true,
906
+ available,
929
907
  ui: {
930
908
  kind: "action",
931
909
  run: (session) => open(session.sessionId)
@@ -959,341 +937,6 @@ window.__ModuleLoader__.load({
959
937
  return `${(durationMs / 1e3).toFixed(1)}s`;
960
938
  }
961
939
  //#endregion
962
- //#region src/client/recompress-run.ts
963
- /** 所选模型的思考等级并集:按 id 去重并保持首次出现顺序。 */
964
- function effortUnion(selected) {
965
- const union = /* @__PURE__ */ new Map();
966
- for (const { model } of selected) for (const effort of model.reasoning?.efforts ?? []) if (!union.has(effort.id)) union.set(effort.id, {
967
- id: effort.id,
968
- name: effort.name
969
- });
970
- return [...union.values()];
971
- }
972
- /**
973
- * 把勾选展开为待运行的组合列表:带等级模型在勾默认时先出默认组合,再按模型等级顺序
974
- * 为每个被勾且被支持的等级出一组,不支持的跳过;无等级模型固定只出一个默认组合;
975
- * 顺序按模型选择顺序再按等级顺序。
976
- */
977
- function expandRecompressChoices(selected, picks) {
978
- const choices = [];
979
- for (const { provider, model } of selected) {
980
- const efforts = model.reasoning?.efforts ?? [];
981
- if (efforts.length === 0) {
982
- choices.push({
983
- provider,
984
- model: model.id
985
- });
986
- continue;
987
- }
988
- if (picks.useDefault) choices.push({
989
- provider,
990
- model: model.id
991
- });
992
- for (const effort of efforts) if (picks.effortIds.has(effort.id)) choices.push({
993
- provider,
994
- model: model.id,
995
- reasoningEffort: effort.id
996
- });
997
- }
998
- return choices;
999
- }
1000
- /** 拼出命令行:/om-recompress <compactionId> <provider> <model> [effort]。 */
1001
- function recompressLine(compactionId, choice) {
1002
- const effort = choice.reasoningEffort === void 0 ? "" : ` ${choice.reasoningEffort}`;
1003
- return `/om-recompress ${compactionId} ${choice.provider} ${choice.model}${effort}`;
1004
- }
1005
- /** 经命令通道提交一次重压缩;远程拒绝或抛错都归一为失败结果。 */
1006
- async function submitRecompress(execute, sessionId, compactionId, choice) {
1007
- try {
1008
- const result = await execute(sessionId, recompressLine(compactionId, choice));
1009
- if (!result.ok) return {
1010
- ok: false,
1011
- text: result.error.message
1012
- };
1013
- const { kind, text } = result.value.result;
1014
- return {
1015
- ok: kind === "success",
1016
- text: text ?? ""
1017
- };
1018
- } catch (error) {
1019
- return {
1020
- ok: false,
1021
- text: error instanceof Error ? error.message : String(error)
1022
- };
1023
- }
1024
- }
1025
- //#endregion
1026
- //#region src/client/OmRecompressMenu.tsx
1027
- /**
1028
- * 换模型重压缩的模型选择菜单:触发按钮 + 浮层,支持多选批量提交。
1029
- * 数据来自宿主会话共享的模型目录(与 /model 弹窗同一份:按供应商分组、模型的思考等级
1030
- * 元数据),搜索排序复用宿主 rankByName,浮层材质复用 MenuSurface / MenuGroup。
1031
- * 模型为复选框多选;勾选后出现全局思考等级区(「模型默认」+ 所选模型等级并集);
1032
- * 底部「开始(N)」一次性展开为模型×等级组合并提交 onPick,N 为 0 时禁用;
1033
- * 点浮层外或 Esc 关闭不提交。选择只触发 onPick,不改变会话自身所选模型。
1034
- * 导出 OmRecompressMenu。
1035
- */
1036
- /** 超过该模型数才显示搜索框。 */
1037
- const SEARCH_MIN_MODELS = 5;
1038
- const css$1 = {
1039
- button: "om-recompress-button",
1040
- panel: "om-recompress-panel",
1041
- search: "om-recompress-search",
1042
- list: "om-recompress-list",
1043
- row: "om-recompress-row",
1044
- mark: "om-recompress-mark",
1045
- section: "om-recompress-section",
1046
- footer: "om-recompress-footer",
1047
- start: "om-recompress-start",
1048
- note: "om-recompress-note"
1049
- };
1050
- const menuCss = `
1051
- .${css$1.button}{border:.5px solid var(--dsw-alias-border-l4);background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-secondary);font:inherit;font-size:11px;line-height:16px;cursor:pointer;white-space:nowrap;border-radius:999px;flex:none;align-items:center;gap:4px;margin:0;padding:2px 8px;display:inline-flex}
1052
- .${css$1.button}:is(:hover,:focus-visible):not(:disabled){background:var(--dsw-alias-interactive-bg-hover-solid);color:var(--dsw-alias-label-primary)}
1053
- .${css$1.panel}{position:fixed;z-index:1000;box-sizing:border-box;width:260px;max-height:320px;display:flex;flex-direction:column;overflow:hidden}
1054
- .${css$1.search}{box-sizing:border-box;width:100%;margin:0;padding:8px 12px;font:inherit;font-size:13px;color:inherit;background:none;border:none;border-bottom:1px solid var(--dsw-alias-label-caption);outline:none}
1055
- .${css$1.list}{min-height:0;overflow-y:auto;padding:4px}
1056
- .${css$1.row}{box-sizing:border-box;width:100%;display:flex;align-items:center;gap:6px;text-align:left;font:inherit;font-size:13px;line-height:20px;color:inherit;background:none;border:none;border-radius:6px;padding:4px 8px;cursor:pointer}
1057
- .${css$1.row}:hover,.${css$1.row}:focus-visible{background:var(--dsw-alias-bg-hover,transparent);outline:none}
1058
- .${css$1.mark}{flex:none;color:var(--dsw-alias-label-secondary)}
1059
- .${css$1.section}{padding:6px 8px 2px;font-size:11px;color:var(--dsw-alias-label-tertiary)}
1060
- .${css$1.footer}{flex:none;display:flex;padding:8px;border-top:1px solid var(--dsw-alias-label-caption)}
1061
- .${css$1.start}{flex:1;box-sizing:border-box;font:inherit;font-size:13px;line-height:20px;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover-solid);border:none;border-radius:6px;padding:4px 8px;cursor:pointer}
1062
- .${css$1.start}:disabled{opacity:.45;cursor:default}
1063
- .${css$1.note}{padding:8px 12px;font-size:13px;color:var(--dsw-alias-label-tertiary)}
1064
- `;
1065
- /** 注册菜单样式(无 document 的环境如 node 测试直接跳过)。 */
1066
- if (typeof document !== "undefined" && document.querySelector("style[data-dsh-plugin-om-recompress]") === null) {
1067
- const tag = document.createElement("style");
1068
- tag.dataset.dshPluginOmRecompress = "true";
1069
- tag.textContent = menuCss;
1070
- document.head.appendChild(tag);
1071
- }
1072
- /** 触发按钮与模型多选浮层。 */
1073
- function OmRecompressMenu({ source, t, onPick }) {
1074
- const state = (0, react.useSyncExternalStore)((listener) => source.directory.subscribe(listener), () => source.directory.getSnapshot());
1075
- const [open, setOpen] = (0, react.useState)(false);
1076
- const [query, setQuery] = (0, react.useState)("");
1077
- const [selected, setSelected] = (0, react.useState)([]);
1078
- const [useDefault, setUseDefault] = (0, react.useState)(true);
1079
- const [effortIds, setEffortIds] = (0, react.useState)(() => /* @__PURE__ */ new Set());
1080
- const [position, setPosition] = (0, react.useState)(null);
1081
- const triggerRef = (0, react.useRef)(null);
1082
- const panelRef = (0, react.useRef)(null);
1083
- const showSearch = state.groups.reduce((sum, group) => sum + group.models.length, 0) >= SEARCH_MIN_MODELS;
1084
- const groups = (0, react.useMemo)(() => {
1085
- const text = showSearch ? query.trim() : "";
1086
- return state.groups.map((group) => ({
1087
- ...group,
1088
- models: (0, _deepseek_ai_dsh_client_ui_primitives.rankByName)(group.models, text)
1089
- })).filter((group) => group.models.length > 0);
1090
- }, [
1091
- state.groups,
1092
- query,
1093
- showSearch
1094
- ]);
1095
- const efforts = (0, react.useMemo)(() => effortUnion(selected), [selected]);
1096
- const picks = (0, react.useMemo)(() => ({
1097
- useDefault,
1098
- effortIds
1099
- }), [useDefault, effortIds]);
1100
- const choices = (0, react.useMemo)(() => expandRecompressChoices(selected, picks), [selected, picks]);
1101
- const close = (0, react.useCallback)(() => {
1102
- setOpen(false);
1103
- setQuery("");
1104
- setSelected([]);
1105
- setUseDefault(true);
1106
- setEffortIds(/* @__PURE__ */ new Set());
1107
- }, []);
1108
- (0, react.useEffect)(() => {
1109
- if (!open) return;
1110
- const outside = (event) => {
1111
- const target = event.target;
1112
- if (triggerRef.current?.contains(target) === true) return;
1113
- if (panelRef.current?.contains(target) === true) return;
1114
- close();
1115
- };
1116
- const onKey = (event) => {
1117
- if (event.key === "Escape") close();
1118
- };
1119
- document.addEventListener("mousedown", outside);
1120
- document.addEventListener("keydown", onKey);
1121
- return () => {
1122
- document.removeEventListener("mousedown", outside);
1123
- document.removeEventListener("keydown", onKey);
1124
- };
1125
- }, [open, close]);
1126
- (0, react.useLayoutEffect)(() => {
1127
- if (!open) {
1128
- setPosition(null);
1129
- return;
1130
- }
1131
- const place = () => {
1132
- const rect = triggerRef.current?.getBoundingClientRect();
1133
- if (rect === void 0) return;
1134
- const margin = 12;
1135
- const width = panelRef.current?.offsetWidth ?? 260;
1136
- const height = panelRef.current?.offsetHeight ?? 0;
1137
- const left = Math.min(Math.max(rect.right - width, margin), window.innerWidth - width - margin);
1138
- const below = rect.bottom + 4;
1139
- const top = below + height <= window.innerHeight - margin ? below : Math.max(margin, rect.top - 4 - height);
1140
- setPosition({
1141
- left,
1142
- top
1143
- });
1144
- };
1145
- place();
1146
- window.addEventListener("scroll", place, true);
1147
- window.addEventListener("resize", place);
1148
- return () => {
1149
- window.removeEventListener("scroll", place, true);
1150
- window.removeEventListener("resize", place);
1151
- };
1152
- }, [
1153
- open,
1154
- state,
1155
- query,
1156
- selected,
1157
- useDefault,
1158
- effortIds
1159
- ]);
1160
- const isSelected = (provider, model) => selected.some((entry) => entry.provider === provider && entry.model.id === model.id);
1161
- const toggleModel = (provider, model) => {
1162
- setSelected((prev) => prev.some((entry) => entry.provider === provider && entry.model.id === model.id) ? prev.filter((entry) => !(entry.provider === provider && entry.model.id === model.id)) : [...prev, {
1163
- provider,
1164
- model
1165
- }]);
1166
- };
1167
- const toggleEffort = (id) => {
1168
- setEffortIds((prev) => {
1169
- const next = new Set(prev);
1170
- if (next.has(id)) next.delete(id);
1171
- else next.add(id);
1172
- return next;
1173
- });
1174
- };
1175
- const submit = () => {
1176
- const batch = choices;
1177
- close();
1178
- onPick(batch);
1179
- };
1180
- const mark = (checked) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1181
- className: css$1.mark,
1182
- "aria-hidden": "true",
1183
- children: checked ? "☑" : "☐"
1184
- });
1185
- let body;
1186
- if (state.status === "error" && state.groups.length === 0) body = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1187
- className: css$1.note,
1188
- children: [
1189
- state.error ?? t("recompress.loadFailed"),
1190
- " ",
1191
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1192
- type: "button",
1193
- className: css$1.row,
1194
- "data-om-recompress-retry": true,
1195
- onClick: () => source.load(),
1196
- children: t("recompress.retry")
1197
- })
1198
- ]
1199
- });
1200
- else if (state.groups.length === 0) body = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1201
- className: css$1.note,
1202
- children: state.status === "ready" ? t("recompress.empty") : t("recompress.loading")
1203
- });
1204
- else body = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
1205
- showSearch && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1206
- className: css$1.search,
1207
- "data-om-recompress-search": true,
1208
- value: query,
1209
- placeholder: t("recompress.search"),
1210
- onChange: (event) => setQuery(event.target.value),
1211
- autoFocus: true
1212
- }),
1213
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1214
- className: css$1.list,
1215
- children: [groups.map((group) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.MenuGroup, {
1216
- label: group.name,
1217
- children: group.models.map((model) => {
1218
- const checked = isSelected(group.id, model);
1219
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1220
- type: "button",
1221
- className: css$1.row,
1222
- role: "menuitemcheckbox",
1223
- "aria-checked": checked,
1224
- "data-om-recompress-model": `${group.id}/${model.id}`,
1225
- onClick: () => toggleModel(group.id, model),
1226
- children: [mark(checked), model.name]
1227
- }, model.id);
1228
- })
1229
- }, group.id)), efforts.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
1230
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1231
- className: css$1.section,
1232
- children: t("recompress.effort.title")
1233
- }),
1234
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1235
- type: "button",
1236
- className: css$1.row,
1237
- role: "menuitemcheckbox",
1238
- "aria-checked": useDefault,
1239
- "data-om-recompress-effort": "",
1240
- onClick: () => setUseDefault((prev) => !prev),
1241
- children: [mark(useDefault), t("recompress.effort.default")]
1242
- }),
1243
- efforts.map((effort) => {
1244
- const checked = effortIds.has(effort.id);
1245
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1246
- type: "button",
1247
- className: css$1.row,
1248
- role: "menuitemcheckbox",
1249
- "aria-checked": checked,
1250
- "data-om-recompress-effort": effort.id,
1251
- onClick: () => toggleEffort(effort.id),
1252
- children: [mark(checked), effort.name]
1253
- }, effort.id);
1254
- })
1255
- ] })]
1256
- }),
1257
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1258
- className: css$1.footer,
1259
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1260
- type: "button",
1261
- className: css$1.start,
1262
- "data-om-recompress-start": true,
1263
- disabled: choices.length === 0,
1264
- onClick: submit,
1265
- children: t("recompress.start", { count: choices.length })
1266
- })
1267
- })
1268
- ] });
1269
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1270
- ref: triggerRef,
1271
- type: "button",
1272
- className: css$1.button,
1273
- "data-om-recompress": true,
1274
- onClick: (event) => {
1275
- event.stopPropagation();
1276
- if (open) {
1277
- close();
1278
- return;
1279
- }
1280
- source.load();
1281
- setOpen(true);
1282
- },
1283
- children: t("recompress.action")
1284
- }), open && (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.MenuSurface, {
1285
- ref: panelRef,
1286
- className: css$1.panel,
1287
- role: "menu",
1288
- style: position ?? {
1289
- visibility: "hidden",
1290
- left: 0,
1291
- top: 0
1292
- },
1293
- children: body
1294
- }), document.body)] });
1295
- }
1296
- //#endregion
1297
940
  //#region src/client/OmCompactionCard.tsx
1298
941
  /** 卡片样式类名(与宿主 ContextInjectionRow.module.css 同款规则,增加水平滚动支持)。 */
1299
942
  const css = {
@@ -1305,7 +948,6 @@ window.__ModuleLoader__.load({
1305
948
  body: "om-compaction-body",
1306
949
  actions: "om-compaction-actions",
1307
950
  inspect: "om-compaction-inspect",
1308
- result: "om-compaction-recompress-result",
1309
951
  trajectory: "om-compaction-trajectory"
1310
952
  };
1311
953
  /** 卡片样式规则:保留宿主外观,对折叠摘要与展开体增加水平滚动适配。 */
@@ -1321,7 +963,6 @@ window.__ModuleLoader__.load({
1321
963
  .${css.inspect}{border:.5px solid var(--dsw-alias-border-l4);background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-secondary);font:inherit;font-size:11px;line-height:16px;cursor:pointer;white-space:nowrap;border-radius:999px;flex:none;align-items:center;gap:4px;margin:0;padding:2px 8px;display:inline-flex}
1322
964
  .${css.inspect}:is(:hover,:focus-visible){background:var(--dsw-alias-interactive-bg-hover-solid);color:var(--dsw-alias-label-primary)}
1323
965
  .${css.trajectory}{display:none}
1324
- .${css.result}{padding:2px 0 0 22px;font-size:12px;line-height:20px;color:var(--dsw-alias-label-tertiary);max-height:60px;overflow-y:auto;overflow-wrap:anywhere;overscroll-behavior:contain;scrollbar-width:thin}
1325
966
  .${css.body}{box-sizing:border-box;background:var(--dsw-alias-markdown-code-block);width:calc(100% - 22px);max-height:141px;color:var(--dsw-alias-label-tertiary);font:400 11px/16px var(--ds-font-family-code);border:none;border-radius:8px;margin:4px 0 0 22px;padding:10px 16px 12px 12px;overflow-x:auto;overflow-y:auto;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch;scrollbar-width:thin}
1326
967
  `;
1327
968
  /** 注册卡片样式(无 document 的环境如 node 测试直接跳过)。 */
@@ -1332,11 +973,8 @@ window.__ModuleLoader__.load({
1332
973
  document.head.appendChild(tag);
1333
974
  }
1334
975
  /** 折叠式压缩卡片(统计标题行 + 代码块样式 summary 展开)。 */
1335
- const OmCompactionCard = (0, react.memo)(function OmCompactionCard({ node, t, sessionId, openSession, recompress, inspectCall }) {
976
+ const OmCompactionCard = (0, react.memo)(function OmCompactionCard({ node, t, sessionId, openSession, inspectCall }) {
1336
977
  const [expanded, setExpanded] = (0, react.useState)(false);
1337
- const [recompressEntries, setRecompressEntries] = (0, react.useState)([]);
1338
- const nextEntryId = (0, react.useRef)(0);
1339
- const [startedToast, setStartedToast] = (0, react.useState)(0);
1340
978
  const { data } = node;
1341
979
  const diagnosticSessionId = data.diagnosticSessionId;
1342
980
  const inspect = diagnosticSessionId !== null && sessionId !== void 0 && openSession !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
@@ -1353,42 +991,6 @@ window.__ModuleLoader__.load({
1353
991
  },
1354
992
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconInspectOutlineRegular, { size: 12 }), t("card.inspect")]
1355
993
  }) : null;
1356
- const pickRecompress = (choices) => {
1357
- if (recompress === void 0) return;
1358
- const batch = choices.map((choice) => ({
1359
- id: nextEntryId.current++,
1360
- choice,
1361
- model: `${choice.provider}/${choice.model}(${choice.reasoningEffort ?? t("compaction.stats.effortDefault")})`
1362
- }));
1363
- setRecompressEntries((entries) => [...entries.filter((entry) => entry.status === "running"), ...batch.map(({ id, model }) => ({
1364
- id,
1365
- status: "running",
1366
- model
1367
- }))]);
1368
- setStartedToast((seq) => seq + 1);
1369
- for (const { id, choice } of batch) recompress.run(data.compactionId, choice).then((outcome) => {
1370
- const text = outcome.ok ? outcome.text || t("recompress.done") : t("recompress.failed", { error: outcome.text });
1371
- setRecompressEntries((entries) => entries.map((entry) => entry.id === id ? {
1372
- id,
1373
- status: outcome.ok ? "done" : "failed",
1374
- text
1375
- } : entry));
1376
- });
1377
- };
1378
- const recompressButton = recompress === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OmRecompressMenu, {
1379
- source: recompress,
1380
- t,
1381
- onPick: pickRecompress
1382
- });
1383
- const recompressResult = recompressEntries.map((entry) => entry.status === "running" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1384
- className: css.result,
1385
- "data-om-recompress-running": true,
1386
- children: t("recompress.running", { model: entry.model })
1387
- }, entry.id) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1388
- className: css.result,
1389
- "data-om-recompress-result": true,
1390
- children: entry.text
1391
- }, entry.id));
1392
994
  const trajectory = inspectCall === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1393
995
  type: "button",
1394
996
  className: `${css.inspect} ${css.trajectory}`,
@@ -1399,17 +1001,11 @@ window.__ModuleLoader__.load({
1399
1001
  },
1400
1002
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconInspectOutlineRegular, { size: 12 }), t("card.trajectory")]
1401
1003
  });
1402
- const actionBar = (extra) => inspect === null && extra === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1004
+ const actions = inspect === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1403
1005
  className: css.actions,
1404
1006
  "data-om-compaction-actions": true,
1405
- children: [
1406
- trajectory,
1407
- inspect,
1408
- extra
1409
- ]
1007
+ children: [trajectory, inspect]
1410
1008
  });
1411
- const failureActions = actionBar(null);
1412
- const actions = actionBar(recompressButton);
1413
1009
  if (data.running) {
1414
1010
  const runningLabel = data.phase === "observe" ? t("compaction.running.observe") : data.phase === "reflect" ? t("compaction.running.reflect") : t("compaction.running");
1415
1011
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -1452,7 +1048,7 @@ window.__ModuleLoader__.load({
1452
1048
  className: css.body,
1453
1049
  style: styles$1.body,
1454
1050
  children: data.error
1455
- }), failureActions]
1051
+ }), actions]
1456
1052
  })
1457
1053
  });
1458
1054
  }
@@ -1469,45 +1065,34 @@ window.__ModuleLoader__.load({
1469
1065
  items: formatCompactCount(data.shadowedItemCount),
1470
1066
  tokens: formatCompactCount(data.shadowedTokenCount)
1471
1067
  }) : data.summary !== null ? t("compaction.expand") : t("compaction.unavailable");
1472
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1068
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1473
1069
  style: styles$1.row,
1474
- children: [
1475
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_deepseek_ai_dsh_client_ui_primitives.DisclosureRow, {
1476
- className: css.root,
1477
- icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconBrowseOutlineRegular, { size: 14 }),
1478
- chevronClassName: css.chevron,
1479
- title: t("compaction"),
1480
- collapsedContent: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1481
- className: css.sep,
1482
- "aria-hidden": true
1483
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1484
- className: `${css.summary} ${css.scrollable}`,
1485
- "data-om-compaction-summary": true,
1486
- children: stats
1487
- })] }),
1488
- keepContentWhenOpen: true,
1489
- expandable,
1490
- expandOnRowClick: true,
1491
- open,
1492
- onToggle: () => {
1493
- setExpanded((value) => !value);
1494
- },
1495
- children: [data.summary !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1496
- className: css.body,
1497
- style: styles$1.body,
1498
- children: data.summary
1499
- }), actions]
1500
- }),
1501
- recompressResult,
1502
- startedToast > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Toast, {
1503
- tone: "success",
1504
- text: t("recompress.started"),
1505
- holdMs: 4e3,
1506
- onDone: () => {
1507
- setStartedToast(0);
1508
- }
1509
- }, startedToast)
1510
- ]
1070
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_deepseek_ai_dsh_client_ui_primitives.DisclosureRow, {
1071
+ className: css.root,
1072
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconBrowseOutlineRegular, { size: 14 }),
1073
+ chevronClassName: css.chevron,
1074
+ title: t("compaction"),
1075
+ collapsedContent: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1076
+ className: css.sep,
1077
+ "aria-hidden": true
1078
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1079
+ className: `${css.summary} ${css.scrollable}`,
1080
+ "data-om-compaction-summary": true,
1081
+ children: stats
1082
+ })] }),
1083
+ keepContentWhenOpen: true,
1084
+ expandable,
1085
+ expandOnRowClick: true,
1086
+ open,
1087
+ onToggle: () => {
1088
+ setExpanded((value) => !value);
1089
+ },
1090
+ children: [data.summary !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1091
+ className: css.body,
1092
+ style: styles$1.body,
1093
+ children: data.summary
1094
+ }), actions]
1095
+ })
1511
1096
  });
1512
1097
  });
1513
1098
  const styles$1 = {
@@ -1519,12 +1104,10 @@ window.__ModuleLoader__.load({
1519
1104
  //#region src/client/om-config-controller.ts
1520
1105
  /** 由宿主提供的插件条目配置命名空间。 */
1521
1106
  const CONFIG_NS = "dsh-plugin-om";
1107
+ /** 评估组件行的配置命名空间(该行无配置项,命名空间仅用于启用门控)。 */
1108
+ const EVAL_NS = "dsh-plugin-om-compaction-eval";
1522
1109
  /** 完整表单字段及控件类别,顺序即面板顺序:父开关在前,其控制的细节紧随其后。 */
1523
1110
  const OM_CONFIG_FIELDS = [
1524
- {
1525
- name: "omEnabled",
1526
- kind: "boolean"
1527
- },
1528
1111
  {
1529
1112
  name: "observeThresholdTokens",
1530
1113
  kind: "integer"
@@ -1569,10 +1152,6 @@ window.__ModuleLoader__.load({
1569
1152
  name: "rateLimitWaitMs",
1570
1153
  kind: "integer"
1571
1154
  },
1572
- {
1573
- name: "recompressConcurrency",
1574
- kind: "integer"
1575
- },
1576
1155
  {
1577
1156
  name: "progressReminderEnabled",
1578
1157
  kind: "boolean"
@@ -1852,23 +1431,6 @@ window.__ModuleLoader__.load({
1852
1431
  });
1853
1432
  const bodyStyle = { whiteSpace: "pre-wrap" };
1854
1433
  //#endregion
1855
- //#region src/client/recompress-inject.ts
1856
- /** 构造某会话的重压缩能力:目录与 /model 弹窗共用,提交走 command.execute。 */
1857
- function recompressFor(ctx, directories, sessionId) {
1858
- const directory = directories.directoryFor(sessionId);
1859
- return {
1860
- directory: directory.store,
1861
- load: () => {
1862
- directory.load();
1863
- },
1864
- run: (compactionId, choice) => submitRecompress(async (id, line) => {
1865
- const commands = ctx.get("remote.commands");
1866
- if (commands === void 0) throw new Error("remote.commands unavailable");
1867
- return commands.execute(id, line, []);
1868
- }, sessionId, compactionId, choice)
1869
- };
1870
- }
1871
- //#endregion
1872
1434
  //#region src/client/index.ts
1873
1435
  /** 必需服务:聊天节点槽、会话定义、双语 locale、宿主配置表单与会话跳转。 */
1874
1436
  const inject = [
@@ -1878,8 +1440,22 @@ window.__ModuleLoader__.load({
1878
1440
  "configForms",
1879
1441
  "uiWorkspace"
1880
1442
  ];
1443
+ /** 行的配置命名空间是否被宿主服务,即该行是否启用。 */
1444
+ function rowServed(ctx, ns) {
1445
+ return ctx.configForms.describe().getSnapshot().view?.namespaces.some((item) => item.ns === ns) ?? false;
1446
+ }
1447
+ /** 在宿主服务该行命名空间期间注册行配置页;槽键为 <包名>#<行 id>。 */
1448
+ function registerRowConfig(ctx, ns, page) {
1449
+ return ctx.configForms.whileServed([ns], () => ctx.slots.inject("plugins.row.config", () => ctx.slots.register({
1450
+ name: "plugins.row.config",
1451
+ key: `dsh-plugin-om#${ns}`,
1452
+ locale: NS,
1453
+ inject: () => page.inject()
1454
+ }, OmConfigCard)));
1455
+ }
1881
1456
  /** 挂载压缩卡片、警告行和可配置的插件行。 */
1882
1457
  function apply(ctx) {
1458
+ ctx.configForms.describe().ensure();
1883
1459
  ctx.effect(() => ctx.locale.register(NS, {
1884
1460
  zh,
1885
1461
  en
@@ -1887,34 +1463,23 @@ window.__ModuleLoader__.load({
1887
1463
  ctx.effect(() => ctx.uiConversation.events.register(omCompactionDefinition), "dsh-plugin-om: compaction definition");
1888
1464
  ctx.effect(() => ctx.uiConversation.events.register(omWarningDefinition), "dsh-plugin-om: om warning definition");
1889
1465
  ctx.effect(() => registerCompactionEvalJump(ctx), "dsh-plugin-om: compaction eval jump");
1890
- registerEvalModelPanel(ctx);
1466
+ registerEvalModelPanel(ctx, () => rowServed(ctx, EVAL_NS));
1891
1467
  ctx.slots.inject("conversation.chat.node", () => ctx.slots.register({
1892
1468
  name: "conversation.chat.node",
1893
1469
  key: "om-compaction",
1894
1470
  locale: NS,
1895
- inject: (sessionId) => {
1896
- const directories = ctx.get("modelDirectories");
1897
- return {
1898
- openSession: (target) => {
1899
- ctx.uiWorkspace.openSession(target);
1900
- },
1901
- ...directories === void 0 ? {} : { recompress: recompressFor(ctx, directories, sessionId) }
1902
- };
1903
- }
1471
+ inject: () => ({ openSession: (target) => {
1472
+ ctx.uiWorkspace.openSession(target);
1473
+ } })
1904
1474
  }, OmCompactionCard));
1905
1475
  ctx.slots.inject("conversation.chat.node", () => ctx.slots.register({
1906
1476
  name: "conversation.chat.node",
1907
1477
  key: "om-warning",
1908
1478
  locale: NS
1909
1479
  }, OmWarningCard));
1910
- const card = new OmConfigController(ctx.configForms.get(CONFIG_NS));
1911
- ctx.effect(() => () => card.dispose(), "dsh-plugin-om: config form subscription");
1912
- ctx.effect(() => ctx.configForms.whileServed([CONFIG_NS], () => ctx.slots.inject("plugins.row.config", () => ctx.slots.register({
1913
- name: "plugins.row.config",
1914
- key: "dsh-plugin-om#dsh-plugin-om",
1915
- locale: NS,
1916
- inject: () => card.inject()
1917
- }, OmConfigCard))), "dsh-plugin-om: row configuration");
1480
+ const page = new OmConfigController(ctx.configForms.get(CONFIG_NS));
1481
+ ctx.effect(() => () => page.dispose(), "dsh-plugin-om: config form subscription");
1482
+ ctx.effect(() => registerRowConfig(ctx, CONFIG_NS, page), "dsh-plugin-om: row configuration");
1918
1483
  }
1919
1484
  //#endregion
1920
1485
  exports.apply = apply;