dsh-desktop-enhance 0.6.6 → 0.6.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +2 -2
  2. package/lib/client.js +48 -39
  3. package/package.json +12 -14
package/README.md CHANGED
@@ -112,13 +112,13 @@ Web 版(浏览器里打开的那种)键位是 **`Cmd+Shift+.`** —— `Cmd+
112
112
 
113
113
  ### 异常轮次分叉
114
114
 
115
- 已经报错或停止的轮次,也能在原位置点击 Fork。保留原生操作栏,不增加第二个入口;没有最终答复的轮次会补齐该入口。设置页「会话能力 → 异常轮次分叉」可关闭并恢复原生行为。
115
+ 已经结束、但原生 Fork 仍不可用的轮次,也能在原位置分叉,包括恢复会话、前置检查拒绝,以及正常结束却没有最终文本的情况。不按结束原因筛选;原生按钮已可用时保持不变,不增加第二个入口。没有最终答复的轮次会补齐该入口。设置页「对话与显示 → 异常轮次分叉」可关闭并恢复原生行为。
116
116
 
117
117
  只支持已保存结束记录的轮次,不处理运行中或损坏记录。**分叉复制对话,不回滚文件和外部操作**。
118
118
 
119
119
  ### 子智能体与团队会话模型
120
120
 
121
- 在输入框原模型位置显示子智能体和团队成员最近请求实际使用的模型与推理档位,只读、不可切换;悬停可查看完整 `provider/model`。普通会话仍使用原生模型选择器。首次自身请求前显示「模型尚未记录」,不把 Fork 继承的父会话模型冒充为子会话模型。设置页「会话能力 → 子会话模型」可单独关闭,恢复原生界面。
121
+ 在输入框原模型位置显示子智能体和团队成员最近请求实际使用的模型与推理档位,只读、不可切换;悬停可查看完整 `provider/model`。普通会话仍使用原生模型选择器。首次自身请求前显示「模型尚未记录」,不把 Fork 继承的父会话模型冒充为子会话模型。设置页「对话与显示 → 子会话模型」可单独关闭,恢复原生界面。
122
122
 
123
123
  ### 会话信息
124
124
 
package/lib/client.js CHANGED
@@ -215,7 +215,7 @@ window.__ModuleLoader__.load({
215
215
  "abnormalFork.failed": "分叉失败",
216
216
  "abnormalFork.created": "分叉已创建,但后续操作失败;请在侧栏查看",
217
217
  "settings.abnormalFork": "异常轮次分叉",
218
- "settings.abnormalFork.hint": "让已报错或停止的轮次也能从原位置分叉;不处理运行中或未完整记录的轮次",
218
+ "settings.abnormalFork.hint": "为已结束但原生 Fork 不可用的轮次恢复分叉入口;不处理运行中或缺少结束记录的轮次",
219
219
  "settings.sessionModel": "子会话模型",
220
220
  "settings.sessionModel.hint": "在子智能体与团队会话的输入区域只读显示实际模型;关闭后恢复原生界面",
221
221
  "settings.sessionInfo": "会话信息",
@@ -371,7 +371,7 @@ window.__ModuleLoader__.load({
371
371
  "abnormalFork.failed": "Fork failed",
372
372
  "abnormalFork.created": "The fork was created, but a later operation failed; check the sidebar",
373
373
  "settings.abnormalFork": "Fork interrupted turns",
374
- "settings.abnormalFork.hint": "Enables branching from the original position after a turn fails or is stopped; excludes running or unclosed turns",
374
+ "settings.abnormalFork.hint": "Restores branching at the original position for closed turns whose native Fork is unavailable; excludes running or unclosed turns",
375
375
  "settings.sessionModel": "Child session model",
376
376
  "settings.sessionModel.hint": "Shows the actual model read-only in subagent and team session input areas; disabling restores the native UI",
377
377
  "settings.sessionInfo": "Session info",
@@ -724,7 +724,9 @@ window.__ModuleLoader__.load({
724
724
  "turnPrefix",
725
725
  "compactionRow",
726
726
  "stepDuration",
727
- "folderStatus"
727
+ "folderStatus",
728
+ "sessionModel",
729
+ "abnormalFork"
728
730
  ]
729
731
  },
730
732
  {
@@ -735,8 +737,6 @@ window.__ModuleLoader__.load({
735
737
  id: "session",
736
738
  fields: [
737
739
  "sessionInfo",
738
- "sessionModel",
739
- "abnormalFork",
740
740
  "toolsManager",
741
741
  "skillsManager"
742
742
  ]
@@ -6948,10 +6948,11 @@ window.__ModuleLoader__.load({
6948
6948
  //#region src/client/mobile/styles.ts
6949
6949
  const ADAPT_CSS = [
6950
6950
  "html:has(body.dsh-remote-portrait){overflow:hidden;overscroll-behavior:none}",
6951
- "body.dsh-remote-portrait{position:fixed;inset:0;width:100%;height:100%;overflow:hidden;overscroll-behavior:none}",
6951
+ "body.dsh-remote-portrait{position:fixed;inset:var(--desktop-enhance-viewport-top,0px) 0 auto;width:100%;height:var(--desktop-enhance-viewport-height,100%);overflow:hidden;overscroll-behavior:none}",
6952
6952
  "body.dsh-remote-portrait [class*=\"_frame\"]:has([class*=\"_centerCol\"]){width:100%;height:var(--desktop-enhance-viewport-height,100dvh);max-height:100%;overflow:hidden}",
6953
6953
  `body.dsh-remote-portrait{--dsh-content-font-size:14px !important;--dsh-content-font-size-secondary:12.5px !important;--dsh-content-font-delta:0px !important;--dsh-content-font-delta-secondary:0px !important;--dsh-code-font-size:12px !important;--dsh-code-font-delta:0px !important;--dsh-terminal-font-size:12px !important;--dsh-composer-side-clearance:10px !important;--dsw-font-markdown-base:400 14px/21px var(--dsw-font-family) !important;--dsw-font-markdown-base-font-size:14px !important;--dsw-font-markdown-base-line-height:21px !important;--dsw-font-markdown-base-strong:600 14px/21px var(--dsw-font-family) !important;--dsw-font-markdown-h1:700 16.5px/23px var(--dsw-font-family) !important;--dsw-font-markdown-h2:700 15.5px/22px var(--dsw-font-family) !important;--dsw-font-markdown-h3:600 14.5px/21px var(--dsw-font-family) !important;--dsw-font-markdown-h4:600 14px/20px var(--dsw-font-family) !important}`,
6954
6954
  "[class$=\"_railFish\"] button,[class$=\"_panelIcon\"],[class$=\"_newSession\"]{min-width:44px;min-height:44px}",
6955
+ "body.dsh-remote-portrait [data-conversation-scroll]{overflow-x:hidden}",
6955
6956
  `body.dsh-remote-portrait [class$="_scroll"]{padding:8px 12px !important}`,
6956
6957
  "[class$=\"_input\"],textarea,input{font-size:16px}",
6957
6958
  "[class$=\"_composer\"]{padding-bottom:calc(4px + env(safe-area-inset-bottom))}",
@@ -6989,6 +6990,7 @@ window.__ModuleLoader__.load({
6989
6990
  `body.dsh-remote-portrait header[class*="_header"] [class$="_headerActions"]{margin-left:auto;gap:4px}`,
6990
6991
  `body.dsh-remote-portrait header[class*="_header"] [class$="_headerActions"] button{height:24px;min-height:24px;font-size:11px;padding:0 6px}`,
6991
6992
  `#dshRemoteWhale{position:fixed;top:calc(4px + env(safe-area-inset-top));left:calc(8px + env(safe-area-inset-left));z-index:2147482999;width:34px;height:34px;min-width:34px;padding:0;border-radius:10px;background:var(--dsw-alias-bg-module-platform);border:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-primary);display:flex;align-items:center;justify-content:center;cursor:pointer;box-shadow:0 1px 6px rgba(0,0,0,.25);touch-action:none}`,
6993
+ `#dshRemoteWhale{translate:0 var(--desktop-enhance-viewport-top,0px)}`,
6992
6994
  `#dshRemoteWhale svg{width:20px;height:15px;display:block}`,
6993
6995
  `#dshRemoteWhale:active{opacity:.72}`,
6994
6996
  `#dshRemoteWhale [data-mobile-connection-label]{position:absolute;left:calc(100% + 7px);top:50%;transform:translateY(-50%);max-width:calc(50vw - 36px);padding:5px 8px;border:1px solid var(--dsw-alias-border-l2);border-radius:8px;background:var(--dsw-alias-bg-module-platform);color:var(--dsw-alias-label-primary);font-size:12px;line-height:18px;white-space:nowrap;box-shadow:0 2px 8px var(--dsw-alias-interactive-bg-hover);pointer-events:none}`,
@@ -7023,8 +7025,9 @@ window.__ModuleLoader__.load({
7023
7025
  "[class$=\"_composerSeat\"] [class$=\"_primary\"]:has(~ [class$=\"_primary\"]){right:48px}",
7024
7026
  "[class$=\"_composerSeat\"] [class$=\"_dock\"]{padding-top:2px;gap:8px}",
7025
7027
  "[class$=\"_composerSeat\"]{transform:none !important}",
7026
- `body.dsh-remote-portrait[data-mobile-bottom-sheet] [class$="_composerSeat"] [class$="_menu"],body.dsh-remote-portrait[data-mobile-bottom-sheet] > [class$="_menu"]{position:fixed !important;left:12px !important;right:12px !important;top:auto !important;bottom:calc(56px + env(safe-area-inset-bottom)) !important;width:auto !important;max-width:none !important;max-height:65dvh !important;overflow-y:auto !important;z-index:2147482000 !important}`,
7027
- `body.dsh-remote-portrait[data-mobile-bottom-sheet] [class$="_composerSeat"] [class$="_menu"] [class$="_cell"],body.dsh-remote-portrait[data-mobile-bottom-sheet] > [class$="_menu"] [class$="_cell"]{height:44px;min-height:44px;font-size:13px}`,
7028
+ `body.dsh-remote-portrait[data-mobile-bottom-sheet] [class$="_composerSeat"] [class$="_menu"]:not([data-trigger-menu]){position:fixed !important;left:12px !important;right:12px !important;top:auto !important;bottom:calc(56px + env(safe-area-inset-bottom)) !important;width:auto !important;max-width:none !important;max-height:65dvh !important;overflow-y:auto !important;z-index:2147482000 !important}`,
7029
+ "body.dsh-remote-portrait [data-composer-seat] [data-trigger-menu]{max-height:min(400px,max(0px,calc(var(--desktop-enhance-viewport-height,100dvh) - var(--dsh-composer-height,0px) - 84px))) !important}",
7030
+ `body.dsh-remote-portrait[data-mobile-bottom-sheet] [class$="_composerSeat"] [class$="_menu"] [class$="_cell"]{height:44px;min-height:44px;font-size:13px}`,
7028
7031
  `body.dsh-remote-portrait[data-mobile-bottom-sheet] .dsh-codex-quota-popover{position:fixed !important;left:12px !important;right:12px !important;top:auto !important;bottom:calc(56px + env(safe-area-inset-bottom)) !important;width:auto !important;max-width:none !important;z-index:2147482000 !important}`,
7029
7032
  "[class$=\"_composerSeat\"] [data-slot=\"conversation.composer.dock\"] [class$=\"_root\"]{font-size:10px;white-space:normal;word-break:break-word;overflow-wrap:anywhere;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;text-align:left;line-height:13px;letter-spacing:-0.2px;padding-left:0;padding-right:0}",
7030
7033
  "[class*=\"_bubble\"][role=\"tooltip\"]{display:none}",
@@ -7149,6 +7152,7 @@ window.__ModuleLoader__.load({
7149
7152
  if (viewport && viewport.scale !== 1) return;
7150
7153
  viewportHeight = viewport?.height ?? globalThis.window.innerHeight;
7151
7154
  globalThis.document.body.style.setProperty("--desktop-enhance-viewport-height", `${viewportHeight}px`);
7155
+ globalThis.document.body.style.setProperty("--desktop-enhance-viewport-top", `${viewport?.offsetTop ?? 0}px`);
7152
7156
  if (drag === null) applyWhalePos();
7153
7157
  }
7154
7158
  let whaleEvents = null;
@@ -7209,6 +7213,7 @@ window.__ModuleLoader__.load({
7209
7213
  restoreRowDrag();
7210
7214
  globalThis.document.body.classList.remove(ACTIVE_CLASS);
7211
7215
  globalThis.document.body.style.removeProperty("--desktop-enhance-viewport-height");
7216
+ globalThis.document.body.style.removeProperty("--desktop-enhance-viewport-top");
7212
7217
  globalThis.document.body.classList.remove(RAIL_HIDDEN_CLASS);
7213
7218
  globalThis.document.body.classList.remove(WHALE_MOVED_CLASS);
7214
7219
  globalThis.document.body.removeAttribute("data-mobile-bottom-sheet");
@@ -7484,7 +7489,10 @@ window.__ModuleLoader__.load({
7484
7489
  }
7485
7490
  listen(globalThis.window, "orientationchange", evaluate);
7486
7491
  listen(globalThis.window, "resize", evaluate);
7487
- if (globalThis.window.visualViewport) listen(globalThis.window.visualViewport, "resize", syncViewport);
7492
+ if (globalThis.window.visualViewport) {
7493
+ listen(globalThis.window.visualViewport, "resize", syncViewport);
7494
+ listen(globalThis.window.visualViewport, "scroll", syncViewport);
7495
+ }
7488
7496
  listen(globalThis.window, "pageshow", evaluate);
7489
7497
  listen(globalThis.document, "visibilitychange", () => {
7490
7498
  setWhaleTimer(globalThis.document.visibilityState !== "hidden");
@@ -7804,16 +7812,10 @@ window.__ModuleLoader__.load({
7804
7812
  var styles_css_default$1 = ":root[data-desktop-enhance-off-session-model] [data-desktop-enhance-session-model] { display: none !important; }\n\n\n:root:not([data-desktop-enhance-off-session-model]) [data-desktop-enhance-session-model] {\n display: flex;\n align-items: center;\n gap: 4px;\n min-width: 0;\n max-width: min(360px, 45cqw);\n height: 28px;\n padding: 0 4px 0 8px;\n color: var(--dsw-alias-label-secondary);\n font-size: 13px;\n font-weight: 400;\n line-height: 20px;\n}\n.de-session-model-name,\n.de-session-model-effort {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.de-session-model-effort { flex-shrink: 1000; }\n.de-readonly-model-composer {\n border: 0.5px solid var(--dsw-alias-border-l1);\n border-radius: var(--dsw-radius-lg);\n background: var(--dsw-alias-bg-layer-1);\n color: var(--dsw-alias-label-secondary);\n margin: 0 24px 20px;\n padding: 10px 16px;\n font-size: 13px;\n line-height: 20px;\n}\n.de-readonly-model-notice {\n display: flex;\n flex-wrap: wrap;\n justify-content: center;\n align-items: center;\n gap: 8px;\n}\n.de-readonly-model-notice strong { color: var(--dsw-alias-label-primary); font-weight: 510; }\n.de-readonly-model-row { display: flex; justify-content: flex-end; margin-top: 8px; }\n";
7805
7813
  //#endregion
7806
7814
  //#region src/client/abnormal-fork/model.ts
7807
- function abnormalBoundary(turn) {
7815
+ function closedTurnBoundary(turn) {
7808
7816
  const end = turn.end;
7809
7817
  const tail = turn.data.get("turn-tail");
7810
7818
  if (turn.status !== "closed" || !end || !Number.isSafeInteger(end.data?.turn) || end.data.turn < 1 || !Number.isSafeInteger(end.seq) || end.seq < 0 || tail?.turn !== end.data.turn || tail.seq !== end.seq) return null;
7811
- if (![
7812
- "error",
7813
- "aborted",
7814
- "interrupted",
7815
- "max-tokens"
7816
- ].includes(end.data.reason?.kind)) return null;
7817
7819
  return end.seq;
7818
7820
  }
7819
7821
  function createForkAction(services, sessionId, atSeq, allowed, publish) {
@@ -7866,27 +7868,45 @@ window.__ModuleLoader__.load({
7866
7868
  const OWNED = "data-desktop-enhance-abnormal-fork-button";
7867
7869
  function takeNativeFork(root, label, run, isDisabled) {
7868
7870
  const originals = new Map();
7871
+ const restoreTooltip = (original) => {
7872
+ const saved = original.tooltip;
7873
+ if (saved && saved.node.textContent === label) saved.node.textContent = saved.text;
7874
+ delete original.tooltip;
7875
+ };
7869
7876
  const refresh = () => {
7870
- for (const [button, original] of originals) {
7877
+ for (const button of originals.keys()) {
7871
7878
  if (button.getAttribute("data-unavailable") === "true") continue;
7872
7879
  button.removeAttribute(OWNED);
7873
- if (original.title === null) button.removeAttribute("title");
7874
- else button.setAttribute("title", original.title);
7875
7880
  originals.delete(button);
7876
7881
  }
7877
7882
  const row = root.querySelector(":scope > [data-clock=\"end\"]");
7878
7883
  for (const child of Array.from(row?.children ?? [])) {
7879
7884
  if (!(child instanceof globalThis.HTMLButtonElement) || child.getAttribute("aria-label") !== label || child.getAttribute("data-unavailable") !== "true") continue;
7880
- if (!originals.has(child)) originals.set(child, {
7881
- disabled: child.getAttribute("aria-disabled"),
7882
- described: child.getAttribute("aria-describedby"),
7883
- title: child.getAttribute("title")
7884
- });
7885
+ let original = originals.get(child);
7886
+ if (!original) {
7887
+ original = {
7888
+ disabled: child.getAttribute("aria-disabled"),
7889
+ described: child.getAttribute("aria-describedby")
7890
+ };
7891
+ originals.set(child, original);
7892
+ }
7885
7893
  child.setAttribute(OWNED, "");
7886
7894
  const desired = isDisabled() ? "true" : "false";
7887
7895
  if (child.getAttribute("aria-disabled") !== desired) child.setAttribute("aria-disabled", desired);
7888
7896
  child.removeAttribute("aria-describedby");
7889
- child.setAttribute("title", label);
7897
+ const bubble = child.nextElementSibling;
7898
+ const content = bubble?.getAttribute("role") === "tooltip" ? bubble.firstElementChild : null;
7899
+ if (original.tooltip?.node !== content) {
7900
+ restoreTooltip(original);
7901
+ if (content) original.tooltip = {
7902
+ node: content,
7903
+ text: content.textContent
7904
+ };
7905
+ }
7906
+ if (content && content.textContent !== label) {
7907
+ if (original.tooltip) original.tooltip.text = content.textContent;
7908
+ content.textContent = label;
7909
+ }
7890
7910
  }
7891
7911
  };
7892
7912
  const onClick = (event) => {
@@ -7896,21 +7916,12 @@ window.__ModuleLoader__.load({
7896
7916
  event.stopPropagation();
7897
7917
  if (!isDisabled()) run();
7898
7918
  };
7899
- const suppressUnavailableTooltip = (event) => {
7900
- const target = event.target instanceof globalThis.Element ? event.target.closest("button") : null;
7901
- if (target && originals.has(target) && target.getAttribute("data-unavailable") === "true") event.stopPropagation();
7902
- };
7903
- const tooltipEvents = [
7904
- "mouseover",
7905
- "pointerover",
7906
- "focusin"
7907
- ];
7908
- for (const name of tooltipEvents) root.addEventListener(name, suppressUnavailableTooltip, true);
7909
7919
  root.addEventListener("click", onClick, true);
7910
7920
  const observer = new globalThis.MutationObserver(refresh);
7911
7921
  observer.observe(root, {
7912
7922
  childList: true,
7913
7923
  subtree: true,
7924
+ characterData: true,
7914
7925
  attributes: true,
7915
7926
  attributeFilter: [
7916
7927
  "aria-disabled",
@@ -7922,12 +7933,10 @@ window.__ModuleLoader__.load({
7922
7933
  return () => {
7923
7934
  observer.disconnect();
7924
7935
  root.removeEventListener("click", onClick, true);
7925
- for (const name of tooltipEvents) root.removeEventListener(name, suppressUnavailableTooltip, true);
7926
7936
  for (const [button, original] of originals) {
7927
7937
  button.removeAttribute(OWNED);
7928
- if (original.title === null) button.removeAttribute("title");
7929
- else button.setAttribute("title", original.title);
7930
7938
  if (button.getAttribute("data-unavailable") !== "true") continue;
7939
+ restoreTooltip(original);
7931
7940
  const attributes = [["aria-disabled", original.disabled], ["aria-describedby", original.described]];
7932
7941
  for (const [key, value] of attributes) if (value === null) button.removeAttribute(key);
7933
7942
  else button.setAttribute(key, value);
@@ -8023,7 +8032,7 @@ window.__ModuleLoader__.load({
8023
8032
  }, `${t(state.created ? "abnormalFork.created" : "abnormalFork.failed")}: ${state.error}`) : null);
8024
8033
  }
8025
8034
  function Contribution(props) {
8026
- const boundary = abnormalBoundary(props.turn);
8035
+ const boundary = closedTurnBoundary(props.turn);
8027
8036
  if (boundary === null) return null;
8028
8037
  return h(Controls, {
8029
8038
  ...props,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-desktop-enhance",
3
- "version": "0.6.6",
3
+ "version": "0.6.8",
4
4
  "description": "DSH Desktop 界面增强:页内查找(Cmd+F)、轮次编号、上下文压缩行常显、建议、每步耗时、折叠文件夹状态计数、会话信息(含上下文注入 C1 视图)、工具管理、Skill 管理、独立远程接入与手机体验。",
5
5
  "type": "module",
6
6
  "icon": "./icon.svg",
@@ -32,18 +32,6 @@
32
32
  "icon.svg",
33
33
  "cordis.patch.yml"
34
34
  ],
35
- "scripts": {
36
- "build": "tsdown",
37
- "dev": "tsdown --watch",
38
- "typecheck": "tsc --noEmit",
39
- "test": "node --test tests/*.test.mjs",
40
- "test:isolation": "./tools/test-isolation.sh",
41
- "verify": "pnpm typecheck && pnpm build && pnpm test && pnpm test:isolation",
42
- "prepack": "pnpm build",
43
- "prepublishOnly": "pnpm verify",
44
- "release:patch": "npm version patch && pnpm publish",
45
- "release:minor": "npm version minor && pnpm publish"
46
- },
47
35
  "publishConfig": {
48
36
  "access": "public"
49
37
  },
@@ -62,5 +50,15 @@
62
50
  "@types/react": "^18.3.31",
63
51
  "tsdown": "0.23.0",
64
52
  "typescript": "5.9.3"
53
+ },
54
+ "scripts": {
55
+ "build": "tsdown",
56
+ "dev": "tsdown --watch",
57
+ "typecheck": "tsc --noEmit",
58
+ "test": "node --test tests/*.test.mjs",
59
+ "test:isolation": "./tools/test-isolation.sh",
60
+ "verify": "pnpm typecheck && pnpm build && pnpm test && pnpm test:isolation",
61
+ "release:patch": "npm version patch && pnpm publish",
62
+ "release:minor": "npm version minor && pnpm publish"
65
63
  }
66
- }
64
+ }