dsh-plugin-om 0.0.50 → 0.0.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -7,10 +7,12 @@
7
7
  ## 功能
8
8
 
9
9
  - 自动压缩主会话历史,并在摘要过大时再次合并
10
- - OM 启用时以 system-reminder 消息提示模型边做边以文本记录结论与规划,压缩后自动补发
10
+ - OM 启用时以 system-reminder 消息提示模型用 1-2 句话记录中间结论与下一步规划,记录后继续任务,最终输出另行构建
11
+ - 表层缺少同 kind 进度提醒时补发,不比较文本内容
12
+ - 最近真实用户消息、非空模型文本或进度提醒之后,表层活动累计至少 4 个已结束模型 step 且超过 10 次工具调用时重发,并要求立刻输出记录
11
13
  - recall 启用或表层存在压缩历史块时以 system-reminder 消息说明完整消息定义,压缩后自动补发
12
- - 通过工具循环生成摘要,保留用户消息、系统消息和未压缩内容
13
- - 保留工具加载与手动加载的 skill 原文,并在压缩前再次确认
14
+ - 通过工具循环生成摘要,保留用户消息和未压缩内容;系统消息不占完整消息 index
15
+ - 保留工具加载的 skill 原文,并在压缩前再次确认
14
16
  - 有效提问首次直接压缩需再次确认,保留时查看选项后在下一轮重写问答并展开选项引用
15
17
  - 中断或错误的提问作为普通工具调用处理
16
18
  - 使用 `recall` 按消息序号回看原文,启用语义增强后还可按含义检索
@@ -125,7 +127,7 @@ src/
125
127
  ├── om-config-controller.ts # 宿主配置表单、草稿和原子保存
126
128
  ├── OmConfigCard.tsx # 十四项双语配置控件
127
129
  ├── definition.ts # 压缩卡片定义:生命周期事件、检查点替换与警告事件
128
- ├── OmCompactionCard.tsx # 压缩结果与错误卡片,可跳转诊断子会话
130
+ ├── OmCompactionCard.tsx # 压缩结果与错误卡片,可跳转轨迹与诊断子会话
129
131
  ├── OmWarningCard.tsx # 功能降级警告行
130
132
  ├── format.ts # 统计数字紧凑格式化
131
133
  └── locales.ts # 中英文文案
@@ -2,11 +2,13 @@
2
2
  * 压缩卡片渲染器:与宿主「上下文注入」卡片同款的折叠行。
3
3
  * 复用平台原语 DisclosureRow;行内统计与展开体样式按宿主 ContextInjectionRow 的规则
4
4
  * 注入 <style>(宿主该卡片样式是编译期哈希的 CSS Module,插件 bundle 无法引用其类名)。
5
- * 卡片报告模型从何处起不再看到那段历史;summary 留在加载窗口外时行不可展开。
5
+ * 卡片报告模型从何处起不再看到那段历史;summary 留在加载窗口外且无操作按钮时行不可展开。
6
6
  * 压缩失败节点渲染为可展开的错误行:折叠行显示错误摘要,展开体显示完整报错。
7
- * 节点带诊断子会话 id 且宿主注入 openSession 时,行尾显示「查看」,跳转到该子会话页面。
7
+ * 展开体下方的操作栏(宿主 inspectButton 同款胶囊):「轨迹」(宿主提供 inspectCall 时渲染)
8
+ * 暂以 display:none 隐藏;节点带诊断子会话 id 且宿主注入 openSession 时显示「诊断日志」,
9
+ * 跳转到该子会话页面。
8
10
  */
9
- import type { ChatNode } from '@deepseek-ai/dsh-client-ui-chat/client';
11
+ import type { ChatNode, ToolCallId } from '@deepseek-ai/dsh-client-ui-chat/client';
10
12
  import type { TranslateNS } from '@deepseek-ai/dsh-client-ui-slots';
11
13
  import type { SessionId } from '@deepseek-ai/dsh-session/types';
12
14
  import type { SubagentAddress } from '@deepseek-ai/dsh-subagent/client';
@@ -16,9 +18,11 @@ export interface OmCompactionCardProps {
16
18
  readonly t: TranslateNS<'om-compaction'>;
17
19
  /** 当前(父)会话 id,作为诊断子会话地址的 parentSessionId。 */
18
20
  readonly sessionId?: SessionId;
19
- /** 宿主注入的会话跳转;缺失时不显示「查看」。 */
21
+ /** 宿主注入的会话跳转;缺失时不显示「诊断日志」。 */
20
22
  readonly openSession?: (target: SubagentAddress) => void;
23
+ /** 宿主 owner 提供的轨迹视图跳转;缺失(轨迹视图不可用)时不显示「轨迹」。 */
24
+ readonly inspectCall?: ((callId: ToolCallId) => void) | undefined;
21
25
  }
22
26
  /** 折叠式压缩卡片(统计标题行 + 代码块样式 summary 展开)。 */
23
- export declare const OmCompactionCard: import("react").MemoExoticComponent<({ node, t, sessionId, openSession, }: OmCompactionCardProps) => import("react").JSX.Element>;
27
+ export declare const OmCompactionCard: import("react").MemoExoticComponent<({ node, t, sessionId, openSession, inspectCall, }: OmCompactionCardProps) => import("react").JSX.Element>;
24
28
  //# sourceMappingURL=OmCompactionCard.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"OmCompactionCard.d.ts","sourceRoot":"","sources":["../../src/client/OmCompactionCard.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAMvE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAKxE,0EAA0E;AAC1E,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,eAAe,CAAC,CAAC;IACzC,QAAQ,CAAC,CAAC,EAAE,WAAW,CAAC,eAAe,CAAC,CAAC;IACzC,6CAA6C;IAC7C,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC;IAC/B,4BAA4B;IAC5B,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;CAC1D;AAsCD,yCAAyC;AACzC,eAAO,MAAM,gBAAgB,6EAK1B,qBAAqB,iCA8ItB,CAAC"}
1
+ {"version":3,"file":"OmCompactionCard.d.ts","sourceRoot":"","sources":["../../src/client/OmCompactionCard.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AAMnF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAKxE,0EAA0E;AAC1E,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,eAAe,CAAC,CAAC;IACzC,QAAQ,CAAC,CAAC,EAAE,WAAW,CAAC,eAAe,CAAC,CAAC;IACzC,6CAA6C;IAC7C,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC;IAC/B,8BAA8B;IAC9B,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;IACzD,8CAA8C;IAC9C,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;CACnE;AA0CD,yCAAyC;AACzC,eAAO,MAAM,gBAAgB,0FAM1B,qBAAqB,iCAyKtB,CAAC"}
@@ -17,7 +17,8 @@ export declare const zh: {
17
17
  readonly 'compaction.failed': "上下文压缩失败";
18
18
  readonly 'compaction.failed.observe': "上下文压缩失败(观察)";
19
19
  readonly 'compaction.failed.reflect': "上下文压缩失败(反思)";
20
- readonly 'card.inspect': "查看";
20
+ readonly 'card.inspect': "诊断日志";
21
+ readonly 'card.trajectory': "轨迹";
21
22
  readonly warning: "上下文压缩功能降级";
22
23
  readonly 'config.description': "配置上下文压缩与原文召回。";
23
24
  readonly 'config.loading': "正在加载配置…";
@@ -1 +1 @@
1
- {"version":3,"file":"locales.d.ts","sourceRoot":"","sources":["../../src/client/locales.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,iDAAiD;AACjD,eAAO,MAAM,EAAE,kBAAkB,CAAC;AAElC,mEAAmE;AACnE,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuDL,CAAC;AAEX,qCAAqC;AACrC,eAAO,MAAM,EAAE,EAAE,MAAM,CAAC,MAAM,OAAO,EAAE,EAAE,MAAM,CA0D9C,CAAC;AAEF,OAAO,QAAQ,kCAAkC,CAAC;IAChD,UAAU,kBAAkB;QAC1B,mDAAmD;QACnD,eAAe,EAAE,MAAM,OAAO,EAAE,CAAC;KAClC;CACF"}
1
+ {"version":3,"file":"locales.d.ts","sourceRoot":"","sources":["../../src/client/locales.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,iDAAiD;AACjD,eAAO,MAAM,EAAE,kBAAkB,CAAC;AAElC,mEAAmE;AACnE,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwDL,CAAC;AAEX,qCAAqC;AACrC,eAAO,MAAM,EAAE,EAAE,MAAM,CAAC,MAAM,OAAO,EAAE,EAAE,MAAM,CA2D9C,CAAC;AAEF,OAAO,QAAQ,kCAAkC,CAAC;IAChD,UAAU,kBAAkB;QAC1B,mDAAmD;QACnD,eAAe,EAAE,MAAM,OAAO,EAAE,CAAC;KAClC;CACF"}
package/dist/client.js CHANGED
@@ -296,7 +296,8 @@ window.__ModuleLoader__.load({
296
296
  "compaction.failed": "上下文压缩失败",
297
297
  "compaction.failed.observe": "上下文压缩失败(观察)",
298
298
  "compaction.failed.reflect": "上下文压缩失败(反思)",
299
- "card.inspect": "查看",
299
+ "card.inspect": "诊断日志",
300
+ "card.trajectory": "轨迹",
300
301
  warning: "上下文压缩功能降级",
301
302
  "config.description": "配置上下文压缩与原文召回。",
302
303
  "config.loading": "正在加载配置…",
@@ -352,7 +353,8 @@ window.__ModuleLoader__.load({
352
353
  "compaction.failed": "Context compaction failed",
353
354
  "compaction.failed.observe": "Context compaction failed (observation)",
354
355
  "compaction.failed.reflect": "Context compaction failed (reflection)",
355
- "card.inspect": "Inspect",
356
+ "card.inspect": "Diagnostic log",
357
+ "card.trajectory": "Trajectory",
356
358
  warning: "Context compaction degraded",
357
359
  "config.description": "Configure context compaction and original-text recall.",
358
360
  "config.loading": "Loading configuration…",
@@ -421,7 +423,9 @@ window.__ModuleLoader__.load({
421
423
  summary: "om-compaction-summary",
422
424
  scrollable: "om-compaction-scrollable",
423
425
  body: "om-compaction-body",
424
- inspect: "om-compaction-inspect"
426
+ actions: "om-compaction-actions",
427
+ inspect: "om-compaction-inspect",
428
+ trajectory: "om-compaction-trajectory"
425
429
  };
426
430
  /** 卡片样式规则:保留宿主外观,对折叠摘要与展开体增加水平滚动适配。 */
427
431
  const cardCss = `
@@ -432,8 +436,10 @@ window.__ModuleLoader__.load({
432
436
  .${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}
433
437
  .${css.summary}.${css.scrollable}{overflow-x:auto;overflow-y:hidden;text-overflow:clip;scrollbar-width:none;-webkit-overflow-scrolling:touch}
434
438
  .${css.summary}.${css.scrollable}::-webkit-scrollbar{display:none}
435
- .${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}
436
- .${css.inspect}:hover{background:var(--dsw-alias-bg-hover,transparent);color:var(--dsw-alias-label-secondary)}
439
+ .${css.actions}{flex-wrap:wrap;align-items:center;gap:8px;margin:4px 0 2px 22px;display:flex}
440
+ .${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}
441
+ .${css.inspect}:is(:hover,:focus-visible){background:var(--dsw-alias-interactive-bg-hover-solid);color:var(--dsw-alias-label-primary)}
442
+ .${css.trajectory}{display:none}
437
443
  .${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}
438
444
  `;
439
445
  /** 注册卡片样式(无 document 的环境如 node 测试直接跳过)。 */
@@ -444,7 +450,7 @@ window.__ModuleLoader__.load({
444
450
  document.head.appendChild(tag);
445
451
  }
446
452
  /** 折叠式压缩卡片(统计标题行 + 代码块样式 summary 展开)。 */
447
- const OmCompactionCard = (0, react.memo)(function OmCompactionCard({ node, t, sessionId, openSession }) {
453
+ const OmCompactionCard = (0, react.memo)(function OmCompactionCard({ node, t, sessionId, openSession, inspectCall }) {
448
454
  const [expanded, setExpanded] = (0, react.useState)(false);
449
455
  const { data } = node;
450
456
  const diagnosticSessionId = data.diagnosticSessionId;
@@ -462,6 +468,21 @@ window.__ModuleLoader__.load({
462
468
  },
463
469
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconInspectOutlineRegular, { size: 12 }), t("card.inspect")]
464
470
  }) : null;
471
+ const trajectory = inspectCall === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
472
+ type: "button",
473
+ className: `${css.inspect} ${css.trajectory}`,
474
+ "data-om-compaction-trajectory": true,
475
+ onClick: (event) => {
476
+ event.stopPropagation();
477
+ inspectCall(node.key);
478
+ },
479
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconInspectOutlineRegular, { size: 12 }), t("card.trajectory")]
480
+ });
481
+ const actions = inspect === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
482
+ className: css.actions,
483
+ "data-om-compaction-actions": true,
484
+ children: [trajectory, inspect]
485
+ });
465
486
  if (data.running) {
466
487
  const runningLabel = data.phase === "observe" ? t("compaction.running.observe") : data.phase === "reflect" ? t("compaction.running.reflect") : t("compaction.running");
467
488
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -481,22 +502,18 @@ window.__ModuleLoader__.load({
481
502
  const errorSummary = data.error.length > 80 ? `${data.error.slice(0, 80)}…` : data.error;
482
503
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
483
504
  style: styles$1.row,
484
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.DisclosureRow, {
505
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_deepseek_ai_dsh_client_ui_primitives.DisclosureRow, {
485
506
  className: css.root,
486
507
  icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconBrowseOutlineRegular, { size: 14 }),
487
508
  chevronClassName: css.chevron,
488
509
  title: failedLabel,
489
- collapsedContent: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
490
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
491
- className: css.sep,
492
- "aria-hidden": true
493
- }),
494
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
495
- className: `${css.summary} ${css.scrollable}`,
496
- children: errorSummary
497
- }),
498
- inspect
499
- ] }),
510
+ collapsedContent: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
511
+ className: css.sep,
512
+ "aria-hidden": true
513
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
514
+ className: `${css.summary} ${css.scrollable}`,
515
+ children: errorSummary
516
+ })] }),
500
517
  keepContentWhenOpen: true,
501
518
  expandable: true,
502
519
  expandOnRowClick: true,
@@ -504,15 +521,15 @@ window.__ModuleLoader__.load({
504
521
  onToggle: () => {
505
522
  setExpanded((value) => !value);
506
523
  },
507
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
524
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
508
525
  className: css.body,
509
526
  style: styles$1.body,
510
527
  children: data.error
511
- })
528
+ }), actions]
512
529
  })
513
530
  });
514
531
  }
515
- const expandable = data.summary !== null;
532
+ const expandable = data.summary !== null || actions !== null;
516
533
  const open = expandable && expanded;
517
534
  const stats = data.shadowedItemCount !== null && data.shadowedCharCount !== null && data.shadowedTokenCount !== null && data.summaryCharCount !== null && data.summaryTokenCount !== null ? t("compaction.stats", {
518
535
  items: formatCompactCount(data.shadowedItemCount),
@@ -523,26 +540,22 @@ window.__ModuleLoader__.load({
523
540
  }) : data.shadowedItemCount !== null && data.shadowedTokenCount !== null ? t("compaction.completed", {
524
541
  items: formatCompactCount(data.shadowedItemCount),
525
542
  tokens: formatCompactCount(data.shadowedTokenCount)
526
- }) : expandable ? t("compaction.expand") : t("compaction.unavailable");
543
+ }) : data.summary !== null ? t("compaction.expand") : t("compaction.unavailable");
527
544
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
528
545
  style: styles$1.row,
529
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.DisclosureRow, {
546
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_deepseek_ai_dsh_client_ui_primitives.DisclosureRow, {
530
547
  className: css.root,
531
548
  icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconBrowseOutlineRegular, { size: 14 }),
532
549
  chevronClassName: css.chevron,
533
550
  title: t("compaction"),
534
- collapsedContent: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
535
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
536
- className: css.sep,
537
- "aria-hidden": true
538
- }),
539
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
540
- className: `${css.summary} ${css.scrollable}`,
541
- "data-om-compaction-summary": true,
542
- children: stats
543
- }),
544
- inspect
545
- ] }),
551
+ collapsedContent: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
552
+ className: css.sep,
553
+ "aria-hidden": true
554
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
555
+ className: `${css.summary} ${css.scrollable}`,
556
+ "data-om-compaction-summary": true,
557
+ children: stats
558
+ })] }),
546
559
  keepContentWhenOpen: true,
547
560
  expandable,
548
561
  expandOnRowClick: true,
@@ -550,11 +563,11 @@ window.__ModuleLoader__.load({
550
563
  onToggle: () => {
551
564
  setExpanded((value) => !value);
552
565
  },
553
- children: data.summary !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
566
+ children: [data.summary !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
554
567
  className: css.body,
555
568
  style: styles$1.body,
556
569
  children: data.summary
557
- })
570
+ }), actions]
558
571
  })
559
572
  });
560
573
  });