dsh-plugin-om 0.0.47 → 0.0.49

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 (47) hide show
  1. package/README.md +15 -14
  2. package/dist/client/OmCompactionCard.d.ts +8 -1
  3. package/dist/client/OmCompactionCard.d.ts.map +1 -1
  4. package/dist/client/OmConfigCard.d.ts +2 -2
  5. package/dist/client/OmConfigCard.d.ts.map +1 -1
  6. package/dist/client/OmWarningCard.d.ts +2 -2
  7. package/dist/client/OmWarningCard.d.ts.map +1 -1
  8. package/dist/client/definition.d.ts +8 -8
  9. package/dist/client/definition.d.ts.map +1 -1
  10. package/dist/client/index.d.ts +1 -1
  11. package/dist/client/index.d.ts.map +1 -1
  12. package/dist/client/locales.d.ts +5 -5
  13. package/dist/client/locales.d.ts.map +1 -1
  14. package/dist/client.js +202 -93
  15. package/dist/client.js.map +1 -1
  16. package/dist/compaction-log.d.ts +17 -24
  17. package/dist/compaction-log.d.ts.map +1 -1
  18. package/dist/compress-loop.d.ts.map +1 -1
  19. package/dist/compress.d.ts +4 -2
  20. package/dist/compress.d.ts.map +1 -1
  21. package/dist/config.d.ts +2 -2
  22. package/dist/config.d.ts.map +1 -1
  23. package/dist/constants.d.ts +3 -3
  24. package/dist/constants.d.ts.map +1 -1
  25. package/dist/degrade.d.ts +5 -6
  26. package/dist/degrade.d.ts.map +1 -1
  27. package/dist/embedding.d.ts +1 -1
  28. package/dist/index.d.ts +1 -1
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.mjs +460 -444
  31. package/dist/log-index.d.ts +1 -1
  32. package/dist/om-event.d.ts +14 -27
  33. package/dist/om-event.d.ts.map +1 -1
  34. package/dist/recall-output.d.ts +2 -2
  35. package/dist/recall-output.d.ts.map +1 -1
  36. package/dist/recall-xml.d.ts +1 -1
  37. package/dist/recall.d.ts +31 -10
  38. package/dist/recall.d.ts.map +1 -1
  39. package/dist/semantic-recall.d.ts +32 -26
  40. package/dist/semantic-recall.d.ts.map +1 -1
  41. package/dist/system-reminder.d.ts +35 -0
  42. package/dist/system-reminder.d.ts.map +1 -0
  43. package/dist/types.d.ts +19 -10
  44. package/dist/types.d.ts.map +1 -1
  45. package/package.json +4 -2
  46. package/dist/progress-reminder.d.ts +0 -18
  47. package/dist/progress-reminder.d.ts.map +0 -1
package/dist/client.js CHANGED
@@ -7,28 +7,20 @@ window.__ModuleLoader__.load({
7
7
  let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
8
8
  let react = require("react");
9
9
  let react_jsx_runtime = require("react/jsx-runtime");
10
- /**
11
- * 解码一条会话事件为 om 私有事件:仅识别 feedback/record 中带 om 信封前缀的
12
- * text;前缀缺失、JSON 非法、kind 未知或载荷字段缺失时返回 undefined。
13
- */
10
+ //#endregion
11
+ //#region src/om-event.ts
12
+ /** 解码一条会话事件为 om 私有事件:仅识别 plugin:dsh-plugin-om:*。 */
14
13
  function readOmEvent(event) {
15
- if (event === void 0 || event === null || event.type !== "feedback/record") return void 0;
16
- const text = event.data.text;
17
- if (typeof text !== "string" || !text.startsWith("om:1:")) return void 0;
18
- let envelope;
19
- try {
20
- envelope = JSON.parse(text.slice(5));
21
- } catch {
22
- return;
23
- }
24
- if (envelope === null || typeof envelope !== "object" || Array.isArray(envelope)) return void 0;
25
- const { kind, ...rest } = envelope;
26
- switch (kind) {
27
- case "om/warning": {
28
- const { problem, message } = rest;
14
+ if (event === void 0 || event === null) return void 0;
15
+ const data = event.data;
16
+ if (data === null || typeof data !== "object" || Array.isArray(data)) return void 0;
17
+ const record = data;
18
+ switch (event.type) {
19
+ case "plugin:dsh-plugin-om:warning": {
20
+ const { problem, message } = record;
29
21
  if (typeof problem !== "string" || typeof message !== "string") return void 0;
30
22
  return {
31
- kind,
23
+ kind: event.type,
32
24
  data: {
33
25
  problem,
34
26
  message
@@ -36,20 +28,20 @@ window.__ModuleLoader__.load({
36
28
  seq: event.seq
37
29
  };
38
30
  }
39
- case "om/observe-pending": {
40
- const { triggerMessageIndex } = rest;
31
+ case "plugin:dsh-plugin-om:observe-pending": {
32
+ const { triggerMessageIndex } = record;
41
33
  if (typeof triggerMessageIndex !== "number" || !Number.isSafeInteger(triggerMessageIndex)) return void 0;
42
34
  return {
43
- kind,
35
+ kind: event.type,
44
36
  data: { triggerMessageIndex },
45
37
  seq: event.seq
46
38
  };
47
39
  }
48
- case "om/observe-invalidate": {
49
- const { pendingSeq } = rest;
40
+ case "plugin:dsh-plugin-om:observe-invalidate": {
41
+ const { pendingSeq } = record;
50
42
  if (typeof pendingSeq !== "number" || !Number.isSafeInteger(pendingSeq)) return void 0;
51
43
  return {
52
- kind,
44
+ kind: event.type,
53
45
  data: { pendingSeq },
54
46
  seq: event.seq
55
47
  };
@@ -82,8 +74,16 @@ window.__ModuleLoader__.load({
82
74
  if (source?.kind !== "plugin:dsh-plugin-om") return void 0;
83
75
  return typeof source.compactionId === "string" ? source.compactionId : void 0;
84
76
  }
77
+ /** 依次从事件载荷读取非空字符串 diagnosticSessionId;均缺失或非法时返回 null。 */
78
+ function diagnosticSessionIdOf(...matches) {
79
+ for (const match of matches) {
80
+ const id = (match?.event.data)?.diagnosticSessionId;
81
+ if (typeof id === "string" && id !== "") return id;
82
+ }
83
+ return null;
84
+ }
85
85
  /** 从 compaction/summary 载荷提取摘要文本与遮蔽统计(载荷非法时各字段回落 null)。 */
86
- function compactSummaryData(summaryMatch) {
86
+ function compactSummaryData(summaryMatch, endMatch) {
87
87
  let summary = null;
88
88
  let shadowedItemCount = null;
89
89
  let shadowedTokenCount = null;
@@ -108,7 +108,8 @@ window.__ModuleLoader__.load({
108
108
  shadowedTokenCount,
109
109
  shadowedCharCount,
110
110
  summaryCharCount: summary === null ? null : summary.length,
111
- summaryTokenCount: summary === null ? null : Math.ceil(summary.length / 4)
111
+ summaryTokenCount: summary === null ? null : Math.ceil(summary.length / 4),
112
+ diagnosticSessionId: diagnosticSessionIdOf(summaryMatch, endMatch)
112
113
  };
113
114
  }
114
115
  /** 从 compaction/start 载荷读取压缩 pass(observe/reflect;缺失或非法时回落 null)。 */
@@ -128,7 +129,8 @@ window.__ModuleLoader__.load({
128
129
  shadowedTokenCount: null,
129
130
  shadowedCharCount: null,
130
131
  summaryCharCount: null,
131
- summaryTokenCount: null
132
+ summaryTokenCount: null,
133
+ diagnosticSessionId: null
132
134
  };
133
135
  }
134
136
  /**
@@ -148,7 +150,8 @@ window.__ModuleLoader__.load({
148
150
  shadowedTokenCount: null,
149
151
  shadowedCharCount: null,
150
152
  summaryCharCount: null,
151
- summaryTokenCount: null
153
+ summaryTokenCount: null,
154
+ diagnosticSessionId: diagnosticSessionIdOf(end)
152
155
  };
153
156
  }
154
157
  /** 窗口只载入部分事件时的回落证据扫描(summary / 检查点 / end 各自独立)。 */
@@ -220,7 +223,7 @@ window.__ModuleLoader__.load({
220
223
  buildViewNode: (context) => {
221
224
  const state = context.state ?? fallbackState(context);
222
225
  if (state.checkpoint !== void 0) {
223
- const data = compactSummaryData(state.summary);
226
+ const data = compactSummaryData(state.summary, state.end);
224
227
  return chatNode(context, COMPACTION_CARD_KIND, state.checkpoint.event.seq, data);
225
228
  }
226
229
  if (state.end !== void 0) {
@@ -234,15 +237,14 @@ window.__ModuleLoader__.load({
234
237
  }
235
238
  };
236
239
  /**
237
- * 插件功能降级警告定义:每条 om/warning 信封事件独立成节点(id 含 seq),渲染为可
238
- * 展开的「功能降级」警告行。服务端按会话同问题去重后追加,每会话同一问题至多一行;
239
- * 不带 om 信封的 feedback/record 记录(用户自写反馈)不认领。
240
+ * 插件功能降级警告定义:每条 plugin:dsh-plugin-om:warning 事件独立成节点(id 含 seq),渲染为可
241
+ * 展开的「功能降级」警告行。服务端按会话同问题去重后追加,每会话同一问题至多一行。
240
242
  */
241
243
  const omWarningDefinition = {
242
244
  kind: OM_WARNING_CARD_KIND,
243
245
  target: "chat",
244
246
  match: (event) => {
245
- if (readOmEvent(event)?.kind !== "om/warning") return null;
247
+ if (readOmEvent(event)?.kind !== "plugin:dsh-plugin-om:warning") return null;
246
248
  return {
247
249
  id: `om-warning:${event.seq}`,
248
250
  role: "start"
@@ -254,7 +256,7 @@ window.__ModuleLoader__.load({
254
256
  const start = context.start;
255
257
  if (start === void 0) return null;
256
258
  const om = readOmEvent(start.event);
257
- if (om?.kind !== "om/warning") return null;
259
+ if (om?.kind !== "plugin:dsh-plugin-om:warning") return null;
258
260
  const problem = om.data.problem !== "" ? om.data.problem : null;
259
261
  const message = om.data.message !== "" ? om.data.message : null;
260
262
  if (problem === null && message === null) return null;
@@ -285,6 +287,7 @@ window.__ModuleLoader__.load({
285
287
  "compaction.failed": "上下文压缩失败",
286
288
  "compaction.failed.observe": "上下文压缩失败(观察)",
287
289
  "compaction.failed.reflect": "上下文压缩失败(反思)",
290
+ "card.inspect": "查看",
288
291
  warning: "上下文压缩功能降级",
289
292
  "config.description": "配置上下文压缩与原文召回。",
290
293
  "config.loading": "正在加载配置…",
@@ -296,7 +299,6 @@ window.__ModuleLoader__.load({
296
299
  "config.discard": "撤销修改",
297
300
  "config.saving": "保存中…",
298
301
  "config.overridden": "已覆盖",
299
- "config.inherited": "继承默认",
300
302
  "config.reset": "恢复默认",
301
303
  "config.invalidInteger": "请输入整数;留空使用默认值。",
302
304
  "config.observeThresholdTokens": "观察阈值",
@@ -318,13 +320,13 @@ window.__ModuleLoader__.load({
318
320
  "config.rateLimitWaitMs": "限流等待毫秒数",
319
321
  "config.rateLimitWaitMs.hint": "429 限流后的冷却时间;0 表示不等待。",
320
322
  "config.modelDir": "嵌入模型目录",
321
- "config.modelDir.hint": "本地语义召回使用的嵌入模型目录。",
323
+ "config.modelDir.hint": "本地语义增强使用的嵌入模型目录。",
322
324
  "config.omEnabled": "自动压缩",
323
325
  "config.omEnabled.hint": "启用观察压缩和摘要反思合并。",
324
326
  "config.recallEnabled": "原文召回",
325
- "config.recallEnabled.hint": "注册按消息序号召回原文的工具。",
326
- "config.semanticRecallEnabled": "语义召回",
327
- "config.semanticRecallEnabled.hint": "注册本地语义检索工具。",
327
+ "config.recallEnabled.hint": "注册召回工具,按消息序号回看原文。",
328
+ "config.semanticRecallEnabled": "语义增强",
329
+ "config.semanticRecallEnabled.hint": "为原文召回增加按含义检索的能力,依赖原文召回。",
328
330
  "config.debug": "步骤日志",
329
331
  "config.debug.hint": "启用步骤级日志;缺省值由 NODE_ENV 决定。"
330
332
  };
@@ -341,6 +343,7 @@ window.__ModuleLoader__.load({
341
343
  "compaction.failed": "Context compaction failed",
342
344
  "compaction.failed.observe": "Context compaction failed (observation)",
343
345
  "compaction.failed.reflect": "Context compaction failed (reflection)",
346
+ "card.inspect": "Inspect",
344
347
  warning: "Context compaction degraded",
345
348
  "config.description": "Configure context compaction and original-text recall.",
346
349
  "config.loading": "Loading configuration…",
@@ -352,7 +355,6 @@ window.__ModuleLoader__.load({
352
355
  "config.discard": "Discard changes",
353
356
  "config.saving": "Saving…",
354
357
  "config.overridden": "Overridden",
355
- "config.inherited": "Inherited default",
356
358
  "config.reset": "Reset to default",
357
359
  "config.invalidInteger": "Enter an integer; leave blank to use the default.",
358
360
  "config.observeThresholdTokens": "Observation threshold",
@@ -374,13 +376,13 @@ window.__ModuleLoader__.load({
374
376
  "config.rateLimitWaitMs": "Rate-limit wait in milliseconds",
375
377
  "config.rateLimitWaitMs.hint": "Cooldown after a 429 response; zero skips the wait.",
376
378
  "config.modelDir": "Embedding model directory",
377
- "config.modelDir.hint": "Directory containing the local semantic-recall embedding model.",
379
+ "config.modelDir.hint": "Directory containing the local semantic-enhancement embedding model.",
378
380
  "config.omEnabled": "Automatic compaction",
379
381
  "config.omEnabled.hint": "Enable observation and reflection of summaries.",
380
382
  "config.recallEnabled": "Original-text recall",
381
- "config.recallEnabled.hint": "Register the message-index recall tool.",
382
- "config.semanticRecallEnabled": "Semantic recall",
383
- "config.semanticRecallEnabled.hint": "Register the local semantic-search tool.",
383
+ "config.recallEnabled.hint": "Register the recall tool to review original messages by index.",
384
+ "config.semanticRecallEnabled": "Semantic enhancement",
385
+ "config.semanticRecallEnabled.hint": "Add search by meaning to recall. Requires original-text recall.",
384
386
  "config.debug": "Step logs",
385
387
  "config.debug.hint": "Log processing steps; the default follows NODE_ENV."
386
388
  };
@@ -402,22 +404,28 @@ window.__ModuleLoader__.load({
402
404
  }
403
405
  //#endregion
404
406
  //#region src/client/OmCompactionCard.tsx
405
- /** 卡片样式类名(与宿主 ContextInjectionRow.module.css 同款规则,见下方注册)。 */
407
+ /** 卡片样式类名(与宿主 ContextInjectionRow.module.css 同款规则,增加水平滚动支持)。 */
406
408
  const css = {
407
409
  root: "om-compaction-root",
408
410
  chevron: "om-compaction-chevron",
409
411
  sep: "om-compaction-sep",
410
412
  summary: "om-compaction-summary",
411
- body: "om-compaction-body"
413
+ scrollable: "om-compaction-scrollable",
414
+ body: "om-compaction-body",
415
+ inspect: "om-compaction-inspect"
412
416
  };
413
- /** 宿主 ContextInjectionRow.module.css 的规则(逐字一致,仅类名按插件前缀)。 */
417
+ /** 卡片样式规则:保留宿主外观,对折叠摘要与展开体增加水平滚动适配。 */
414
418
  const cardCss = `
415
419
  .${css.root}{min-width:0}
416
420
  .${css.root}[data-open]{padding-bottom:4px}
417
421
  .${css.chevron}{color:var(--dsw-alias-label-secondary)}
418
422
  .${css.sep}{background:var(--dsw-alias-label-caption);border-radius:1px;flex:none;width:2px;height:2px;margin:0 8px}
419
423
  .${css.summary}{min-width:0;color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;flex:auto;font-size:14px;line-height:24px;overflow:hidden}
420
- .${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:auto}
424
+ .${css.summary}.${css.scrollable}{overflow-x:auto;overflow-y:hidden;text-overflow:clip;scrollbar-width:none;-webkit-overflow-scrolling:touch}
425
+ .${css.summary}.${css.scrollable}::-webkit-scrollbar{display:none}
426
+ .${css.inspect}{color:inherit;font:inherit;font-size:12px;line-height:24px;cursor:pointer;white-space:nowrap;background:none;border:none;border-radius:4px;flex:none;align-items:center;gap:4px;margin-left:8px;padding:0 4px;display:inline-flex}
427
+ .${css.inspect}:hover{background:var(--dsw-alias-bg-hover,transparent);color:var(--dsw-alias-label-secondary)}
428
+ .${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}
421
429
  `;
422
430
  /** 注册卡片样式(无 document 的环境如 node 测试直接跳过)。 */
423
431
  if (typeof document !== "undefined" && document.querySelector("style[data-dsh-plugin-om-card]") === null) {
@@ -427,13 +435,28 @@ window.__ModuleLoader__.load({
427
435
  document.head.appendChild(tag);
428
436
  }
429
437
  /** 折叠式压缩卡片(统计标题行 + 代码块样式 summary 展开)。 */
430
- const OmCompactionCard = (0, react.memo)(function OmCompactionCard({ node, t }) {
438
+ const OmCompactionCard = (0, react.memo)(function OmCompactionCard({ node, t, sessionId, openSession }) {
431
439
  const [expanded, setExpanded] = (0, react.useState)(false);
432
440
  const { data } = node;
441
+ const diagnosticSessionId = data.diagnosticSessionId;
442
+ const inspect = diagnosticSessionId !== null && sessionId !== void 0 && openSession !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
443
+ type: "button",
444
+ className: css.inspect,
445
+ "data-om-compaction-inspect": true,
446
+ onClick: (event) => {
447
+ event.stopPropagation();
448
+ openSession({
449
+ parentSessionId: sessionId,
450
+ childSessionId: diagnosticSessionId,
451
+ mode: "one-shot"
452
+ });
453
+ },
454
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconInspectOutlineRegular, { size: 12 }), t("card.inspect")]
455
+ }) : null;
433
456
  if (data.running) {
434
457
  const runningLabel = data.phase === "observe" ? t("compaction.running.observe") : data.phase === "reflect" ? t("compaction.running.reflect") : t("compaction.running");
435
458
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
436
- style: styles.row,
459
+ style: styles$1.row,
437
460
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.DisclosureRow, {
438
461
  className: css.root,
439
462
  icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconBrowseOutlineRegular, { size: 14 }),
@@ -448,19 +471,23 @@ window.__ModuleLoader__.load({
448
471
  const failedLabel = data.phase === "observe" ? t("compaction.failed.observe") : data.phase === "reflect" ? t("compaction.failed.reflect") : t("compaction.failed");
449
472
  const errorSummary = data.error.length > 80 ? `${data.error.slice(0, 80)}…` : data.error;
450
473
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
451
- style: styles.row,
474
+ style: styles$1.row,
452
475
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.DisclosureRow, {
453
476
  className: css.root,
454
477
  icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconBrowseOutlineRegular, { size: 14 }),
455
478
  chevronClassName: css.chevron,
456
479
  title: failedLabel,
457
- collapsedContent: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
458
- className: css.sep,
459
- "aria-hidden": true
460
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
461
- className: css.summary,
462
- children: errorSummary
463
- })] }),
480
+ collapsedContent: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
481
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
482
+ className: css.sep,
483
+ "aria-hidden": true
484
+ }),
485
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
486
+ className: `${css.summary} ${css.scrollable}`,
487
+ children: errorSummary
488
+ }),
489
+ inspect
490
+ ] }),
464
491
  keepContentWhenOpen: true,
465
492
  expandable: true,
466
493
  expandOnRowClick: true,
@@ -470,7 +497,7 @@ window.__ModuleLoader__.load({
470
497
  },
471
498
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
472
499
  className: css.body,
473
- style: styles.body,
500
+ style: styles$1.body,
474
501
  children: data.error
475
502
  })
476
503
  })
@@ -489,20 +516,24 @@ window.__ModuleLoader__.load({
489
516
  tokens: formatCompactCount(data.shadowedTokenCount)
490
517
  }) : expandable ? t("compaction.expand") : t("compaction.unavailable");
491
518
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
492
- style: styles.row,
519
+ style: styles$1.row,
493
520
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.DisclosureRow, {
494
521
  className: css.root,
495
522
  icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconBrowseOutlineRegular, { size: 14 }),
496
523
  chevronClassName: css.chevron,
497
524
  title: t("compaction"),
498
- collapsedContent: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
499
- className: css.sep,
500
- "aria-hidden": true
501
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
502
- className: css.summary,
503
- "data-om-compaction-summary": true,
504
- children: stats
505
- })] }),
525
+ collapsedContent: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
526
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
527
+ className: css.sep,
528
+ "aria-hidden": true
529
+ }),
530
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
531
+ className: `${css.summary} ${css.scrollable}`,
532
+ "data-om-compaction-summary": true,
533
+ children: stats
534
+ }),
535
+ inspect
536
+ ] }),
506
537
  keepContentWhenOpen: true,
507
538
  expandable,
508
539
  expandOnRowClick: true,
@@ -512,13 +543,13 @@ window.__ModuleLoader__.load({
512
543
  },
513
544
  children: data.summary !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
514
545
  className: css.body,
515
- style: styles.body,
546
+ style: styles$1.body,
516
547
  children: data.summary
517
548
  })
518
549
  })
519
550
  });
520
551
  });
521
- const styles = {
552
+ const styles$1 = {
522
553
  row: {},
523
554
  /** 摘要与失败报错为多行文本,保留换行。 */
524
555
  body: { whiteSpace: "pre-wrap" }
@@ -660,7 +691,37 @@ window.__ModuleLoader__.load({
660
691
  };
661
692
  //#endregion
662
693
  //#region src/client/OmConfigCard.tsx
663
- /** 配置行内容:说明、草稿值及继承/覆盖标记。 */
694
+ function BooleanField({ id, label, hint, checked, overridden, overriddenLabel, resetLabel, disabled, onChange, onReset }) {
695
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
696
+ style: styles.field,
697
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
698
+ style: styles.head,
699
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Checkbox, {
700
+ className: id,
701
+ label,
702
+ checked,
703
+ disabled,
704
+ onChange
705
+ }), overridden ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
706
+ style: styles.badges,
707
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tag, {
708
+ tone: "outline",
709
+ children: overriddenLabel
710
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
711
+ type: "button",
712
+ style: styles.resetButton,
713
+ disabled,
714
+ onClick: onReset,
715
+ children: resetLabel
716
+ })]
717
+ }) : null]
718
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
719
+ style: styles.hint,
720
+ children: hint
721
+ })]
722
+ });
723
+ }
724
+ /** 配置行内容:说明、草稿值及规范的继承/覆盖呈现。 */
664
725
  function OmConfigCard(props) {
665
726
  const { t } = props;
666
727
  const state = props.useOmConfigCard((snapshot) => snapshot);
@@ -693,24 +754,33 @@ window.__ModuleLoader__.load({
693
754
  const label = t(`config.${name}`);
694
755
  const hint = t(`config.${name}.hint`);
695
756
  const disabled = !state.writable || state.saving;
757
+ const recallOn = state.fields.recallEnabled.text === "true";
758
+ const semanticOn = state.fields.semanticRecallEnabled.text === "true";
759
+ const isSemantic = name === "semanticRecallEnabled";
760
+ const checked = isSemantic ? semanticOn && recallOn : field.text === "true";
761
+ const onChange = (value) => {
762
+ props.edit(name, String(value));
763
+ if (isSemantic && value) props.edit("recallEnabled", "true");
764
+ if (name === "recallEnabled" && !value && semanticOn) props.edit("semanticRecallEnabled", "false");
765
+ };
766
+ const onReset = () => {
767
+ props.resetField(name);
768
+ if (isSemantic && !recallOn) props.resetField("recallEnabled");
769
+ };
696
770
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
697
771
  "data-om-field": name,
698
- children: kind === "boolean" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
699
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Checkbox, {
700
- label,
701
- checked: field.text === "true",
702
- disabled,
703
- onChange: (value) => props.edit(name, String(value))
704
- }),
705
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: hint }),
706
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: field.overridden ? t("config.overridden") : t("config.inherited") }),
707
- field.overridden ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
708
- type: "button",
709
- disabled,
710
- onClick: () => props.resetField(name),
711
- children: t("config.reset")
712
- }) : null
713
- ] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.SettingsValueField, {
772
+ children: kind === "boolean" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BooleanField, {
773
+ id: `plugin-config-om-${name}`,
774
+ label,
775
+ hint,
776
+ checked,
777
+ overridden: field.overridden,
778
+ overriddenLabel: t("config.overridden"),
779
+ resetLabel: t("config.reset"),
780
+ disabled,
781
+ onChange,
782
+ onReset
783
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.SettingsValueField, {
714
784
  id: `plugin-config-om-${name}`,
715
785
  label,
716
786
  hint,
@@ -722,11 +792,46 @@ window.__ModuleLoader__.load({
722
792
  ...field,
723
793
  onEdit: (text) => props.edit(name, text),
724
794
  onReset: () => props.resetField(name)
725
- }), !field.overridden ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("config.inherited") }) : null] })
795
+ })
726
796
  }, name);
727
797
  })]
728
798
  });
729
799
  }
800
+ const styles = {
801
+ field: {
802
+ display: "flex",
803
+ flexDirection: "column",
804
+ gap: "6px",
805
+ padding: "12px 0"
806
+ },
807
+ head: {
808
+ display: "flex",
809
+ alignItems: "center",
810
+ justifyContent: "space-between",
811
+ gap: "8px"
812
+ },
813
+ badges: {
814
+ display: "inline-flex",
815
+ alignItems: "center",
816
+ gap: "8px"
817
+ },
818
+ resetButton: {
819
+ border: "none",
820
+ background: "none",
821
+ padding: 0,
822
+ font: "inherit",
823
+ fontSize: "12px",
824
+ lineHeight: "1.5",
825
+ color: "var(--dsw-alias-label-secondary)",
826
+ cursor: "pointer"
827
+ },
828
+ hint: {
829
+ margin: 0,
830
+ fontSize: "12px",
831
+ lineHeight: "1.5",
832
+ color: "var(--dsw-alias-label-tertiary)"
833
+ }
834
+ };
730
835
  //#endregion
731
836
  //#region src/client/OmWarningCard.tsx
732
837
  /** 折叠式功能降级警告行(降级说明摘要行 + 完整说明展开)。 */
@@ -745,7 +850,7 @@ window.__ModuleLoader__.load({
745
850
  className: "om-compaction-sep",
746
851
  "aria-hidden": true
747
852
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
748
- className: "om-compaction-summary",
853
+ className: "om-compaction-summary om-compaction-scrollable",
749
854
  children: messageSummary
750
855
  })] }) : void 0,
751
856
  keepContentWhenOpen: true,
@@ -765,12 +870,13 @@ window.__ModuleLoader__.load({
765
870
  const bodyStyle = { whiteSpace: "pre-wrap" };
766
871
  //#endregion
767
872
  //#region src/client/index.ts
768
- /** 必需服务:聊天节点槽、会话定义、双语 locale 与宿主配置表单。 */
873
+ /** 必需服务:聊天节点槽、会话定义、双语 locale、宿主配置表单与会话跳转。 */
769
874
  const inject = [
770
875
  "slots",
771
876
  "uiConversation",
772
877
  "locale",
773
- "configForms"
878
+ "configForms",
879
+ "uiWorkspace"
774
880
  ];
775
881
  /** 挂载压缩卡片、警告行和可配置的插件行。 */
776
882
  function apply(ctx) {
@@ -783,7 +889,10 @@ window.__ModuleLoader__.load({
783
889
  ctx.slots.inject("conversation.chat.node", () => ctx.slots.register({
784
890
  name: "conversation.chat.node",
785
891
  key: "om-compaction",
786
- locale: NS
892
+ locale: NS,
893
+ inject: () => ({ openSession: (target) => {
894
+ ctx.uiWorkspace.openSession(target);
895
+ } })
787
896
  }, OmCompactionCard));
788
897
  ctx.slots.inject("conversation.chat.node", () => ctx.slots.register({
789
898
  name: "conversation.chat.node",