@megen-lebar/dsh-reasoning-effort 0.2.5 → 0.2.7

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.i18n.yaml CHANGED
@@ -1,3 +1,3 @@
1
1
  # Bilingual-pair consistency record: update with git hash-object after editing both README files.
2
- README.md: 470fa72ab06464f8bc1f90bcacbfec9718984e83
3
- README.zh.md: 6af41f3d548007fe47b3804d27b2a0b31fc81faf
2
+ README.md: 8643b0e9101f2185c7c8cc479b4a6f6e3fe4fe66
3
+ README.zh.md: 1affe916bdcbfc58fb74665c82790c26fc94a0af
package/README.md CHANGED
@@ -42,7 +42,7 @@ Fully exit and restart the DSH Web Host after installation, then refresh the GUI
42
42
  ## Compatibility
43
43
 
44
44
  - Runtime requirement: DSH `>=0.1.1-rc.2`, declared as `dsh.engines.dsh` in `package.json`.
45
- - Verified environments: DSH CLI `0.1.1-rc.2` with the `0.1.2-alpha.1` cohort store. The plugin runs normally in both parts of this setup.
45
+ - DSH verified support versions: `0.1.1-rc.2` and `0.1.2-alpha.1`. The plugin runs normally on both versions.
46
46
 
47
47
  ## Uninstall and retained settings
48
48
 
@@ -60,7 +60,7 @@ To clean up, remove the corresponding fields from the `llm-pi-ai` settings and r
60
60
 
61
61
  - The source for npm `0.2.0` is `Jamsharden/dsh-plugins` commit [`ddd1ed2f`](https://github.com/Jamsharden/dsh-plugins/commit/ddd1ed2f636a4fc1c4a29544d90b268eef1ceeab).
62
62
  - The source for npm `0.2.3` is `Jamsharden/dsh-plugins` commit [`8137d40b`](https://github.com/Jamsharden/dsh-plugins/commit/8137d40b952949ade8d36792498d7afc51edf839), tagged [`dsh-reasoning-effort-v0.2.3`](https://github.com/Jamsharden/dsh-plugins/releases/tag/dsh-reasoning-effort-v0.2.3).
63
- - Version `0.2.5` is prepared in this standalone repository: <https://github.com/Jamsharden/dsh-reasoning-effort>.
63
+ - Version `0.2.7` is published from this standalone repository: <https://github.com/Jamsharden/dsh-reasoning-effort>.
64
64
 
65
65
  ## Known limitations
66
66
 
package/README.zh.md CHANGED
@@ -42,7 +42,7 @@ dsh plugin --profile web add @megen-lebar/dsh-reasoning-effort
42
42
  ## 兼容性
43
43
 
44
44
  - 运行时要求:DSH `>=0.1.1-rc.2`,已在 `package.json` 的 `dsh.engines.dsh` 中声明。
45
- - 已验证环境:DSH CLI `0.1.1-rc.2` 与 `0.1.2-alpha.1` cohort store。该组合下插件两部分均可正常运行。
45
+ - DSH核验支持版本:`0.1.1-rc.2` 与 `0.1.2-alpha.1`。插件在这两个版本下均可正常运行。
46
46
 
47
47
  ## 卸载与配置保留
48
48
 
@@ -60,7 +60,7 @@ dsh plugin --profile web add @megen-lebar/dsh-reasoning-effort
60
60
 
61
61
  - npm `0.2.0` 的源码来自 `Jamsharden/dsh-plugins` 提交 [`ddd1ed2f`](https://github.com/Jamsharden/dsh-plugins/commit/ddd1ed2f636a4fc1c4a29544d90b268eef1ceeab)。
62
62
  - npm `0.2.3` 的源码来自 `Jamsharden/dsh-plugins` 提交 [`8137d40b`](https://github.com/Jamsharden/dsh-plugins/commit/8137d40b952949ade8d36792498d7afc51edf839),对应标签 [`dsh-reasoning-effort-v0.2.3`](https://github.com/Jamsharden/dsh-plugins/releases/tag/dsh-reasoning-effort-v0.2.3)。
63
- - `0.2.5` 版本在本独立仓库准备发布:<https://github.com/Jamsharden/dsh-reasoning-effort>。
63
+ - `0.2.7` 版本已从本独立仓库发布:<https://github.com/Jamsharden/dsh-reasoning-effort>。
64
64
 
65
65
  ## 已知限制
66
66
 
package/lib/client.js CHANGED
@@ -46,6 +46,10 @@ window.__ModuleLoader__.load({
46
46
 
47
47
  var icons = {
48
48
  brain: '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M9.5 4.5A3.5 3.5 0 0 0 3 6.3a3.6 3.6 0 0 0-.8 5.9A3.6 3.6 0 0 0 5.7 18c1.5 0 2.8-.9 3.8-2.1V4.5Z"/><path d="M14.5 4.5A3.5 3.5 0 0 1 21 6.3a3.6 3.6 0 0 1 .8 5.9 3.6 3.6 0 0 1-3.5 5.8c-1.5 0-2.8-.9-3.8-2.1V4.5Z"/><path d="M5.8 9.2c1.4.1 2.4.9 2.8 2.2M18.2 9.2c-1.4.1-2.4.9-2.8 2.2"/></svg>',
49
+ // Sidebar entry glyph: wavy two-lobe brain in the official primitives
50
+ // Outline16 spec (viewBox 16, rendered 16px, stroke 1.2 — identical
51
+ // metrics to the official plugin-manager sidebar icon).
52
+ entryBrain: '<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6.98 1.7V13.6A1.8 1.8 0 0 1 3.9 13.1A5.5 5.5 0 0 1 1.9 7.6A4.6 4.6 0 0 1 4.1 2.6A1.6 1.6 0 0 1 6.98 1.7Z"/><path d="M5.5 7.9c-.8.22-1.35.7-1.5 1.3"/><path d="M9.02 1.7V13.6A1.8 1.8 0 0 0 12.1 13.1A5.5 5.5 0 0 0 14.1 7.6A4.6 4.6 0 0 0 11.9 2.6A1.6 1.6 0 0 0 9.02 1.7Z"/><path d="M10.5 7.9c.8.22 1.35.7 1.5 1.3"/></svg>',
49
53
  close: '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="m6 6 12 12M18 6 6 18"/></svg>',
50
54
  back: '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg>',
51
55
  refresh: '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M20 12a8 8 0 1 1-2.3-5.7L20 8"/><path d="M20 3v5h-5"/></svg>',
@@ -92,16 +96,21 @@ window.__ModuleLoader__.load({
92
96
 
93
97
  function cssText() {
94
98
  return [
95
- // ── 侧边栏入口:与 ssh / 任务看板同一套行样式 ──
96
- '[data-dsh-reasoning-entry]{box-sizing:border-box;width:100%;min-height:36px;color:var(--dsw-alias-label-secondary);cursor:pointer;white-space:nowrap;background:0 0;border:none;border-radius:8px;align-items:center;gap:10px;padding:0 10px;font-size:13px;display:flex;font-family:inherit;transition:background-color .12s,color .12s}',
97
- '[data-dsh-reasoning-entry]:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}',
98
- '[data-dsh-reasoning-entry][data-active]{background:var(--dsw-alias-interactive-bg-active);color:var(--dsw-alias-label-primary);font-weight:600}',
99
- '[data-dsh-reasoning-entry]:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}',
100
- '[data-dsh-reasoning-entry-icon]{flex:none;justify-content:center;align-items:center;width:24px;height:24px;display:inline-flex}',
101
- '[data-dsh-reasoning-entry-icon] svg{width:18px;height:18px;display:block;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}',
102
- '[data-dsh-reasoning-entry-label]{text-overflow:ellipsis;overflow:hidden}',
103
- '[data-dsh-frame][data-sidebar-collapsed] [data-dsh-reasoning-entry]{border-radius:50%;justify-content:center;width:36px;min-height:36px;margin:0 auto 12px;padding:0}',
104
- '[data-dsh-frame][data-sidebar-collapsed] [data-dsh-reasoning-entry-label]{display:none}',
99
+ // ── 侧边栏入口:镜像官方 ui-sidebar panelRow 规格 ──
100
+ // (min-height 36 / margin 0 2px / padding 7px 8px / gap 8 / radius 12 /
101
+ // font inherit 14px-22 / glyph 16px / stroke 1.2,与“插件”行逐项一致)
102
+ '[data-dsh-reasoning-entry]{box-sizing:border-box;width:100%;min-height:36px;margin:0 2px 4px;padding:7px 8px;color:var(--dsw-alias-label-primary);cursor:pointer;background:0 0;border:none;border-radius:12px;align-items:center;gap:8px;font:inherit;line-height:22px;text-align:left;display:flex}',
103
+ '[data-dsh-reasoning-entry]:hover{background:var(--dsw-alias-interactive-bg-hover)}',
104
+ '[data-dsh-reasoning-entry][data-active]{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}',
105
+ '[data-dsh-reasoning-entry]:focus-visible{outline:2px solid var(--dsw-alias-label-primary);outline-offset:-2px}',
106
+ '[data-dsh-reasoning-entry-icon]{flex:none;justify-content:center;align-items:center;display:inline-flex}',
107
+ '[data-dsh-reasoning-entry-icon] svg{width:16px;height:16px;display:block}',
108
+ '[data-dsh-reasoning-entry-label]{min-width:0;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}',
109
+ '@media(width<=768px){[data-dsh-reasoning-entry]{min-height:44px}}',
110
+ '[data-dsh-frame][data-sidebar-collapsed] [data-dsh-reasoning-entry],[data-sidebar-collapsed] [data-dsh-reasoning-entry]{justify-content:center;width:36px;height:36px;min-height:36px;margin:0 0 12px;padding:0}',
111
+ '[data-dsh-frame][data-sidebar-collapsed] [data-dsh-reasoning-entry-icon] svg,[data-sidebar-collapsed] [data-dsh-reasoning-entry-icon] svg{width:18px;height:18px}',
112
+ '[data-dsh-frame][data-sidebar-collapsed] [data-dsh-reasoning-entry-label],[data-sidebar-collapsed] [data-dsh-reasoning-entry-label]{display:none}',
113
+ 'html[data-windows-titlebar] [data-sidebar-collapsed] [data-dsh-reasoning-entry]{display:none}',
105
114
  // ── 主视图:悬浮抽屉,贴侧栏弹出;水墨纸色 ──
106
115
  '[data-dsh-reasoning-view]{--ink-paper:#f7f6f1;--ink-card:#fdfcf8;--ink-soft:#eeece4;--ink-text:#211f1b;--ink-mist:#8a867a;--ink-faint:#b9b5a7;--ink-line:rgba(33,31,27,.1);--ink-line-strong:rgba(33,31,27,.18);--ink-hover:rgba(33,31,27,.045);--ink-active:rgba(33,31,27,.075);--ink-cinnabar:#b5432f;--ink-cinnabar-soft:rgba(181,67,47,.09);--ink-pine:#41705a;--ink-focus:rgba(33,31,27,.16);--ink-mask:rgba(28,26,22,.36);--ink-serif:"Noto Serif SC","Source Han Serif SC","Songti SC","STSong","STZhongsong","SimSun",serif;z-index:10000;display:none;position:fixed;left:-100000px;top:0;width:420px;height:0;max-width:calc(100vw - 16px);box-sizing:border-box;flex-direction:column;background:var(--ink-paper);color:var(--ink-text);font-family:var(--dsw-font-family,inherit);border:1px solid var(--ink-line);border-radius:16px;box-shadow:0 18px 48px rgba(28,26,22,.16);overflow:hidden;overscroll-behavior:contain;isolation:isolate}',
107
116
  '[data-dsh-reasoning-view][data-open]{display:flex}',
@@ -218,7 +227,7 @@ window.__ModuleLoader__.load({
218
227
  '[data-dsh-reasoning-notice=success]{border-left-color:var(--ink-pine);color:var(--ink-pine)}',
219
228
  '[data-dsh-reasoning-notice=error]{border-left-color:var(--ink-cinnabar);color:var(--ink-cinnabar)}',
220
229
  '[data-dsh-reasoning-view] button:focus-visible{outline:2px solid var(--ink-text);outline-offset:2px}',
221
- '@media(max-width:768px){[data-dsh-reasoning-entry],[data-dsh-reasoning-btn]{min-height:44px}[data-dsh-reasoning-dd-btn],[data-dsh-reasoning-search],[data-dsh-reasoning-wire]{height:44px;font-size:16px}[data-dsh-reasoning-model]{min-height:52px}[data-dsh-reasoning-body]{padding:4px 14px 18px}[data-dsh-reasoning-header]{padding:14px 14px 10px}[data-dsh-reasoning-notice]{margin:0 14px}[data-dsh-reasoning-form-row]{flex-wrap:wrap}[data-dsh-reasoning-form-row] [data-dsh-reasoning-dd]{flex:1 1 170px;width:auto}[data-dsh-reasoning-wire]{width:112px}[data-dsh-reasoning-actions]{padding:10px 14px calc(10px + env(safe-area-inset-bottom,0px))}}',
230
+ '@media(max-width:768px){[data-dsh-reasoning-btn]{min-height:44px}[data-dsh-reasoning-dd-btn],[data-dsh-reasoning-search],[data-dsh-reasoning-wire]{height:44px;font-size:16px}[data-dsh-reasoning-model]{min-height:52px}[data-dsh-reasoning-body]{padding:4px 14px 18px}[data-dsh-reasoning-header]{padding:14px 14px 10px}[data-dsh-reasoning-notice]{margin:0 14px}[data-dsh-reasoning-form-row]{flex-wrap:wrap}[data-dsh-reasoning-form-row] [data-dsh-reasoning-dd]{flex:1 1 170px;width:auto}[data-dsh-reasoning-wire]{width:112px}[data-dsh-reasoning-actions]{padding:10px 14px calc(10px + env(safe-area-inset-bottom,0px))}}',
222
231
  '@media(prefers-reduced-motion:reduce){[data-dsh-reasoning-entry],[data-dsh-reasoning-view],[data-dsh-reasoning-view] *,[data-dsh-reasoning-icon-btn] svg{transition:none!important;animation:none!important}}',
223
232
  // ── 液态玻璃皮肤:白色玻璃主体 + 青花瓷釉色点缀 + 活水(焦散漂光/折射带呼吸) ──
224
233
  // body 前缀 + !important,覆盖上方水墨纸色规则(注入顺序也在其后)
@@ -1510,14 +1519,26 @@ window.__ModuleLoader__.load({
1510
1519
  }
1511
1520
 
1512
1521
  function mountEntry() {
1522
+ var ROW_SELECTOR = "[data-dsh-reasoning-entry]";
1523
+ var FAMILY_SELECTORS = [
1524
+ "[data-dsh-taskboard-entry]",
1525
+ "[data-dsh-ssh-entry]",
1526
+ "[data-dsh-skill-explorer-entry]",
1527
+ ROW_SELECTOR,
1528
+ ];
1529
+ // A hot-reload or a duplicate bundle must not create a second row.
1530
+ if (document.querySelector(ROW_SELECTOR)) return function () {};
1531
+
1513
1532
  var entry = el("button", {
1514
1533
  "data-dsh-reasoning-entry": "",
1534
+ "data-dsh-plugin": "reasoning-effort",
1535
+ "data-dsh-part": "sidebar-entry",
1536
+ class: "entry",
1515
1537
  type: "button",
1516
- title: "思考强度配置",
1517
1538
  "aria-label": "思考强度",
1518
1539
  }, [
1519
- el("span", { "data-dsh-reasoning-entry-icon": "", html: icons.brain }),
1520
- el("span", { "data-dsh-reasoning-entry-label": "", text: "思考强度" }),
1540
+ el("span", { "data-dsh-reasoning-entry-icon": "", class: "entryIcon", html: icons.entryBrain }),
1541
+ el("span", { "data-dsh-reasoning-entry-label": "", class: "entryLabel", text: "思考强度" }),
1521
1542
  ]);
1522
1543
  entry.addEventListener("click", function () {
1523
1544
  toggle();
@@ -1525,35 +1546,50 @@ window.__ModuleLoader__.load({
1525
1546
  });
1526
1547
 
1527
1548
  var root;
1549
+ var rootObserver;
1528
1550
  var placed = false;
1529
1551
  function placeEntry(nextRoot) {
1530
1552
  var button = newSessionButton(nextRoot);
1531
1553
  if (!button) return false;
1532
- if (entry.parentElement !== nextRoot) {
1533
- var row = button.closest('[class*="logoRow"]');
1534
- var base = row && row.parentElement === nextRoot ? row : button;
1535
- nextRoot.insertBefore(entry, base.nextElementSibling);
1536
- }
1554
+ var row = button.closest('[class*="logoRow"]');
1555
+ var base = row && row.parentElement === nextRoot ? row : button;
1556
+ var family = Array.from(nextRoot.children).filter(function (child) {
1557
+ return child instanceof HTMLElement && child.matches(FAMILY_SELECTORS.join(", "));
1558
+ });
1559
+ var anchor = family.length ? family[family.length - 1].nextElementSibling : base.nextElementSibling;
1560
+ if (entry.parentElement !== nextRoot || entry.nextElementSibling !== anchor) nextRoot.insertBefore(entry, anchor);
1537
1561
  return true;
1538
1562
  }
1539
1563
  function tryPlace() {
1540
- if (root && !root.isConnected) { root = undefined; placed = false; }
1541
- if (!placed) {
1542
- root = root || sidebarRoot();
1543
- if (!root) return;
1544
- placed = placeEntry(root);
1564
+ if (root && !document.body.contains(root)) {
1565
+ if (rootObserver) rootObserver.disconnect();
1566
+ rootObserver = undefined;
1567
+ root = undefined;
1568
+ placed = false;
1569
+ }
1570
+ if (!root) root = sidebarRoot();
1571
+ if (!root) return;
1572
+ if (!rootObserver) {
1573
+ rootObserver = new MutationObserver(tryPlace);
1574
+ rootObserver.observe(root, { childList: true, subtree: true });
1575
+ }
1576
+ placed = placeEntry(root);
1577
+ if (placed && !document.body.contains(entry)) {
1578
+ placed = false;
1579
+ tryPlace();
1545
1580
  }
1546
- if (placed && !document.body.contains(entry)) { placed = false; root = undefined; tryPlace(); }
1547
1581
  }
1548
1582
  var observer = new MutationObserver(tryPlace);
1549
1583
  observer.observe(document.body, { childList: true, subtree: true });
1550
1584
  var unsubscribe = subscribe(function () {
1551
- entry.toggleAttribute("data-active", state.open);
1585
+ if (state.open) entry.setAttribute("data-active", "true");
1586
+ else entry.removeAttribute("data-active");
1552
1587
  });
1553
1588
  tryPlace();
1554
1589
 
1555
1590
  return function () {
1556
1591
  observer.disconnect();
1592
+ if (rootObserver) rootObserver.disconnect();
1557
1593
  unsubscribe();
1558
1594
  entry.remove();
1559
1595
  };