dsh-cliproxyapi-pro 1.10.0 → 1.10.1
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/CHANGELOG.md +5 -0
- package/README.en.md +2 -2
- package/README.md +2 -2
- package/lib/client.js +152 -26
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
本插件的所有重要变更。版本号遵循[语义化版本](https://semver.org/lang/zh-CN/)。
|
|
6
6
|
|
|
7
|
+
## 1.10.1 — 2026-11-12
|
|
8
|
+
|
|
9
|
+
### 修复
|
|
10
|
+
- **输入框额度详情和生成模型菜单不再乱飘。** 新版 DSH 的输入框底座是 sticky 并带 `will-change: transform`,`position: fixed` 的弹层因此以输入框底座而不是视口为参照,原先按视口坐标计算的位置会偏到别处(常被右侧裁掉),并跟着输入框移动。现在弹层仍渲染在组件内部(不挂到 `document.body`),先在底座原点处隐藏测量,再把按钮的视口位置换算到这一层,保持在视口和聊天滚动区内,高度不超过按钮上方的空间,并在打开期间跟随按钮。问题由 [@CDeZT](https://github.com/CDeZT) 在 #4 / #5 报告。
|
|
11
|
+
|
|
7
12
|
## 1.10.0 — 2026-11-11
|
|
8
13
|
|
|
9
14
|
### 新增
|
package/README.en.md
CHANGED
|
@@ -36,7 +36,7 @@ The plugin is published on npm as [`dsh-cliproxyapi-pro`](https://www.npmjs.com/
|
|
|
36
36
|
dsh-cliproxyapi-pro
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
To pin a version, write `dsh-cliproxyapi-pro@1.10.
|
|
39
|
+
To pin a version, write `dsh-cliproxyapi-pro@1.10.1`.
|
|
40
40
|
4. Click **Install**. When it finishes, the dialog offers to enable the plugin right away — accept it.
|
|
41
41
|
|
|
42
42
|
> If downloads are slow in mainland China, open **Registry** next to the input and choose **the mainland China mirror**.
|
|
@@ -65,7 +65,7 @@ In **Add plugin**, or as the `plugin_manager` `target`, you can also enter:
|
|
|
65
65
|
|
|
66
66
|
| Source | What to enter |
|
|
67
67
|
|---|---|
|
|
68
|
-
| A released version | `git+https://github.com/TinyBOOOOM/dsh-cliproxyapi-pro.git#v1.10.
|
|
68
|
+
| A released version | `git+https://github.com/TinyBOOOOM/dsh-cliproxyapi-pro.git#v1.10.1` |
|
|
69
69
|
| Latest development version | `git+https://github.com/TinyBOOOOM/dsh-cliproxyapi-pro.git#main` |
|
|
70
70
|
| Offline package | Download [`dsh-cliproxyapi-pro.tgz`](https://github.com/TinyBOOOOM/dsh-cliproxyapi-pro/releases/latest/download/dsh-cliproxyapi-pro.tgz) (always the latest release) and enter its absolute local path |
|
|
71
71
|
| Local source (development) | Absolute path of a cloned repository; installed as a link, so code changes go live when the plugin reloads |
|
package/README.md
CHANGED
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
dsh-cliproxyapi-pro
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
需要固定版本时可以写成 `dsh-cliproxyapi-pro@1.10.
|
|
39
|
+
需要固定版本时可以写成 `dsh-cliproxyapi-pro@1.10.1`。
|
|
40
40
|
4. 点击 **安装**,完成后点击 **立即启用**。
|
|
41
41
|
|
|
42
42
|
> 在中国大陆下载慢,可以点输入框旁的 **安装源**,切换到 **中国大陆镜像源**。
|
|
@@ -65,7 +65,7 @@ dsh plugin --profile <profile 名称> add dsh-cliproxyapi-pro
|
|
|
65
65
|
|
|
66
66
|
| 来源 | 填写内容 |
|
|
67
67
|
|---|---|
|
|
68
|
-
| 某个发布版本 | `git+https://github.com/TinyBOOOOM/dsh-cliproxyapi-pro.git#v1.10.
|
|
68
|
+
| 某个发布版本 | `git+https://github.com/TinyBOOOOM/dsh-cliproxyapi-pro.git#v1.10.1` |
|
|
69
69
|
| 最新开发版 | `git+https://github.com/TinyBOOOOM/dsh-cliproxyapi-pro.git#main` |
|
|
70
70
|
| 离线安装包 | 下载 [`dsh-cliproxyapi-pro.tgz`](https://github.com/TinyBOOOOM/dsh-cliproxyapi-pro/releases/latest/download/dsh-cliproxyapi-pro.tgz)(始终是最新版),填写它的本地绝对路径 |
|
|
71
71
|
| 本地源码(开发用) | 克隆后的仓库目录绝对路径;以链接方式安装,改代码后重载插件即生效 |
|
package/lib/client.js
CHANGED
|
@@ -5897,6 +5897,148 @@ select.dcpa-q-input.dcpa-media-kind { flex: none; width: auto; height: 28px; fon
|
|
|
5897
5897
|
return now;
|
|
5898
5898
|
}
|
|
5899
5899
|
|
|
5900
|
+
/*
|
|
5901
|
+
* The composer peeks (`.dcpa-q-pop`, `position: fixed`) stay inside their
|
|
5902
|
+
* component: no portal, nothing appended to document.body. DSH's active
|
|
5903
|
+
* composer seat is sticky and carries `will-change: transform`, which makes
|
|
5904
|
+
* it the containing block of fixed descendants, so `left` / `bottom` count
|
|
5905
|
+
* from the seat, not the viewport. Plain viewport coordinates put the peek
|
|
5906
|
+
* somewhere else and let it drift with the composer.
|
|
5907
|
+
*
|
|
5908
|
+
* Each placement measures where the rendered peek actually landed, derives
|
|
5909
|
+
* the containing block's left and bottom edges from the offsets it applied,
|
|
5910
|
+
* and converts the wanted viewport position into that box. Ancestors from
|
|
5911
|
+
* the containing block upward that clip overflow (the chat scroller) bound
|
|
5912
|
+
* the peek together with the viewport. Without such a box the result equals
|
|
5913
|
+
* plain viewport placement.
|
|
5914
|
+
*/
|
|
5915
|
+
const PEEK_WIDTH = 340;
|
|
5916
|
+
const PEEK_MIN_WIDTH = 160;
|
|
5917
|
+
const PEEK_GAP = 6;
|
|
5918
|
+
const PEEK_MARGIN = 16;
|
|
5919
|
+
const PEEK_MAX_HEIGHT = 440;
|
|
5920
|
+
const PEEK_MIN_HEIGHT = 120;
|
|
5921
|
+
// Measured once on open at the containing block origin, then shown.
|
|
5922
|
+
const PEEK_HIDDEN = Object.freeze({ visibility: "hidden", left: "0px", bottom: "0px" });
|
|
5923
|
+
|
|
5924
|
+
/**
|
|
5925
|
+
* Pure placement. `anchor` and `box` are viewport rects of the anchor and of
|
|
5926
|
+
* the peek as rendered with `applied` `{ left, bottom }` offsets; `bounds`
|
|
5927
|
+
* is the visible area `{ left, top, right, bottom }` in viewport coordinates.
|
|
5928
|
+
* Returns offsets in the peek's own containing block.
|
|
5929
|
+
*/
|
|
5930
|
+
function placePeek({ anchor, box, applied, bounds }) {
|
|
5931
|
+
const originLeft = box.left - applied.left;
|
|
5932
|
+
const originBottom = box.bottom + applied.bottom;
|
|
5933
|
+
const room = bounds.right - bounds.left - 2 * PEEK_MARGIN;
|
|
5934
|
+
const width = Math.min(PEEK_WIDTH, Math.max(PEEK_MIN_WIDTH, room));
|
|
5935
|
+
const left = Math.max(bounds.left + PEEK_MARGIN, Math.min(anchor.left, bounds.right - width - PEEK_MARGIN));
|
|
5936
|
+
const edge = anchor.top - PEEK_GAP;
|
|
5937
|
+
const maxHeight = Math.max(PEEK_MIN_HEIGHT, Math.min(PEEK_MAX_HEIGHT, edge - bounds.top - PEEK_MARGIN));
|
|
5938
|
+
return {
|
|
5939
|
+
left: Math.round(left - originLeft),
|
|
5940
|
+
bottom: Math.round(originBottom - edge),
|
|
5941
|
+
width: Math.round(width),
|
|
5942
|
+
maxHeight: Math.round(maxHeight),
|
|
5943
|
+
};
|
|
5944
|
+
}
|
|
5945
|
+
|
|
5946
|
+
const samePeek = (a, b) =>
|
|
5947
|
+
!!a && !!b && a.left === b.left && a.bottom === b.bottom && a.width === b.width && a.maxHeight === b.maxHeight;
|
|
5948
|
+
|
|
5949
|
+
/** Nearest ancestor that becomes the containing block of fixed descendants. */
|
|
5950
|
+
function fixedContainer(el) {
|
|
5951
|
+
const root = el?.ownerDocument?.documentElement ?? null;
|
|
5952
|
+
for (let node = el?.parentElement ?? null; node && node !== root; node = node.parentElement) {
|
|
5953
|
+
const s = getComputedStyle(node);
|
|
5954
|
+
if (
|
|
5955
|
+
(s.transform && s.transform !== "none") ||
|
|
5956
|
+
(s.perspective && s.perspective !== "none") ||
|
|
5957
|
+
(s.filter && s.filter !== "none") ||
|
|
5958
|
+
(s.backdropFilter && s.backdropFilter !== "none") ||
|
|
5959
|
+
/transform|perspective|filter/.test(s.willChange ?? "") ||
|
|
5960
|
+
/paint|layout|strict|content/.test(s.contain ?? "") ||
|
|
5961
|
+
(s.containerType && s.containerType !== "normal")
|
|
5962
|
+
) {
|
|
5963
|
+
return node;
|
|
5964
|
+
}
|
|
5965
|
+
}
|
|
5966
|
+
return null;
|
|
5967
|
+
}
|
|
5968
|
+
|
|
5969
|
+
/** The containing block and its ancestors that clip a fixed peek. */
|
|
5970
|
+
function peekClips(pop) {
|
|
5971
|
+
const container = fixedContainer(pop);
|
|
5972
|
+
if (!container) return [];
|
|
5973
|
+
const root = pop.ownerDocument?.documentElement ?? null;
|
|
5974
|
+
const clips = [];
|
|
5975
|
+
for (let node = container; node && node !== root; node = node.parentElement) {
|
|
5976
|
+
const s = getComputedStyle(node);
|
|
5977
|
+
if (s.overflowX !== "visible" || s.overflowY !== "visible" || /paint|strict|content/.test(s.contain ?? "")) clips.push(node);
|
|
5978
|
+
}
|
|
5979
|
+
return clips;
|
|
5980
|
+
}
|
|
5981
|
+
|
|
5982
|
+
function peekBounds(clips) {
|
|
5983
|
+
const bounds = { left: 0, top: 0, right: window.innerWidth, bottom: window.innerHeight };
|
|
5984
|
+
for (const node of clips) {
|
|
5985
|
+
const r = node.getBoundingClientRect();
|
|
5986
|
+
if (r.width === 0 && r.height === 0) continue;
|
|
5987
|
+
bounds.left = Math.max(bounds.left, r.left);
|
|
5988
|
+
bounds.top = Math.max(bounds.top, r.top);
|
|
5989
|
+
bounds.right = Math.min(bounds.right, r.right);
|
|
5990
|
+
bounds.bottom = Math.min(bounds.bottom, r.bottom);
|
|
5991
|
+
}
|
|
5992
|
+
return bounds;
|
|
5993
|
+
}
|
|
5994
|
+
|
|
5995
|
+
/**
|
|
5996
|
+
* Style for a fixed peek anchored above `anchorRef`, rendered with
|
|
5997
|
+
* `ref: popRef` inside the same component. Tracks the anchor every frame
|
|
5998
|
+
* while open (state changes only when the placement moves) and stays
|
|
5999
|
+
* hidden until the first measurement.
|
|
6000
|
+
*/
|
|
6001
|
+
function useAnchoredPeek(open, anchorRef, popRef) {
|
|
6002
|
+
const [pos, setPos] = useState(null);
|
|
6003
|
+
useEffect(() => {
|
|
6004
|
+
if (!open) {
|
|
6005
|
+
setPos(null);
|
|
6006
|
+
return undefined;
|
|
6007
|
+
}
|
|
6008
|
+
if (typeof window === "undefined" || typeof getComputedStyle !== "function") return undefined;
|
|
6009
|
+
let clips = null;
|
|
6010
|
+
let frame = 0;
|
|
6011
|
+
const place = () => {
|
|
6012
|
+
const anchor = anchorRef.current?.getBoundingClientRect?.();
|
|
6013
|
+
const pop = popRef.current;
|
|
6014
|
+
const box = pop?.getBoundingClientRect?.();
|
|
6015
|
+
if (!anchor || !box || (anchor.width === 0 && anchor.height === 0)) return;
|
|
6016
|
+
clips ??= peekClips(pop);
|
|
6017
|
+
const applied = { left: parseFloat(pop.style.left) || 0, bottom: parseFloat(pop.style.bottom) || 0 };
|
|
6018
|
+
const next = placePeek({ anchor, box, applied, bounds: peekBounds(clips) });
|
|
6019
|
+
setPos((prev) => (samePeek(prev, next) ? prev : next));
|
|
6020
|
+
};
|
|
6021
|
+
const onResize = () => {
|
|
6022
|
+
clips = null;
|
|
6023
|
+
place();
|
|
6024
|
+
};
|
|
6025
|
+
const raf = typeof window.requestAnimationFrame === "function" ? window.requestAnimationFrame.bind(window) : null;
|
|
6026
|
+
const loop = () => {
|
|
6027
|
+
place();
|
|
6028
|
+
frame = raf(loop);
|
|
6029
|
+
};
|
|
6030
|
+
place();
|
|
6031
|
+
if (raf) frame = raf(loop);
|
|
6032
|
+
window.addEventListener("resize", onResize);
|
|
6033
|
+
return () => {
|
|
6034
|
+
if (raf && frame) window.cancelAnimationFrame?.(frame);
|
|
6035
|
+
window.removeEventListener("resize", onResize);
|
|
6036
|
+
};
|
|
6037
|
+
}, [open]);
|
|
6038
|
+
if (!open || !pos) return PEEK_HIDDEN;
|
|
6039
|
+
return { left: `${pos.left}px`, bottom: `${pos.bottom}px`, width: `${pos.width}px`, maxHeight: `${pos.maxHeight}px` };
|
|
6040
|
+
}
|
|
6041
|
+
|
|
5900
6042
|
function QuotaMeter({ t, w, now }) {
|
|
5901
6043
|
const pct = typeof w.remainingPercent === "number" ? Math.max(0, Math.min(100, w.remainingPercent)) : null;
|
|
5902
6044
|
const level = quotaLevel(pct);
|
|
@@ -6352,23 +6494,16 @@ select.dcpa-q-input.dcpa-media-kind { flex: none; width: auto; height: 28px; fon
|
|
|
6352
6494
|
const snap = useQuota(selection ? store : null);
|
|
6353
6495
|
const now = useNow(60 * 1000);
|
|
6354
6496
|
const [open, setOpen] = useState(false);
|
|
6355
|
-
const [pos, setPos] = useState(null);
|
|
6356
6497
|
const wrapRef = useRef(null);
|
|
6357
6498
|
const buttonRef = useRef(null);
|
|
6499
|
+
const popRef = useRef(null);
|
|
6500
|
+
const popStyle = useAnchoredPeek(open, buttonRef, popRef);
|
|
6358
6501
|
|
|
6359
6502
|
const summary = selection ? summarizeModelQuota(snap.data, selection.provider, selection.model) : null;
|
|
6360
6503
|
const visible = !shadowed && summary !== null && summary.account.keyConfigured === true;
|
|
6361
6504
|
|
|
6362
6505
|
useEffect(() => {
|
|
6363
6506
|
if (!open) return undefined;
|
|
6364
|
-
const place = () => {
|
|
6365
|
-
const rect = buttonRef.current?.getBoundingClientRect?.();
|
|
6366
|
-
if (!rect || typeof window === "undefined") return;
|
|
6367
|
-
const width = Math.min(340, window.innerWidth - 32);
|
|
6368
|
-
const left = Math.max(16, Math.min(rect.left, window.innerWidth - width - 16));
|
|
6369
|
-
setPos({ left, bottom: Math.max(16, window.innerHeight - rect.top + 6), width });
|
|
6370
|
-
};
|
|
6371
|
-
place();
|
|
6372
6507
|
const onDown = (e) => {
|
|
6373
6508
|
if (wrapRef.current && !wrapRef.current.contains(e.target)) setOpen(false);
|
|
6374
6509
|
};
|
|
@@ -6380,11 +6515,9 @@ select.dcpa-q-input.dcpa-media-kind { flex: none; width: auto; height: 28px; fon
|
|
|
6380
6515
|
};
|
|
6381
6516
|
document.addEventListener("mousedown", onDown, true);
|
|
6382
6517
|
document.addEventListener("keydown", onKey, true);
|
|
6383
|
-
window.addEventListener("resize", place);
|
|
6384
6518
|
return () => {
|
|
6385
6519
|
document.removeEventListener("mousedown", onDown, true);
|
|
6386
6520
|
document.removeEventListener("keydown", onKey, true);
|
|
6387
|
-
window.removeEventListener("resize", place);
|
|
6388
6521
|
};
|
|
6389
6522
|
}, [open]);
|
|
6390
6523
|
|
|
@@ -6404,10 +6537,11 @@ select.dcpa-q-input.dcpa-media-kind { flex: none; width: auto; height: 28px; fon
|
|
|
6404
6537
|
? h(
|
|
6405
6538
|
"div",
|
|
6406
6539
|
{
|
|
6540
|
+
ref: popRef,
|
|
6407
6541
|
className: "dcpa-q-pop",
|
|
6408
6542
|
role: "dialog",
|
|
6409
6543
|
"aria-label": label,
|
|
6410
|
-
style:
|
|
6544
|
+
style: popStyle,
|
|
6411
6545
|
},
|
|
6412
6546
|
h(
|
|
6413
6547
|
"div",
|
|
@@ -6535,7 +6669,6 @@ select.dcpa-q-input.dcpa-media-kind { flex: none; width: auto; height: 28px; fon
|
|
|
6535
6669
|
const [loading, setLoading] = useState(true);
|
|
6536
6670
|
// Which kind's model menu is open (image / video), or null.
|
|
6537
6671
|
const [openKind, setOpenKind] = useState(null);
|
|
6538
|
-
const [pos, setPos] = useState(null);
|
|
6539
6672
|
const [busy, setBusy] = useState(false);
|
|
6540
6673
|
const [error, setError] = useState(null);
|
|
6541
6674
|
// Bumped to reload while no image model is known yet.
|
|
@@ -6545,6 +6678,10 @@ select.dcpa-q-input.dcpa-media-kind { flex: none; width: auto; height: 28px; fon
|
|
|
6545
6678
|
const wrapRef = useRef(null);
|
|
6546
6679
|
const buttonRef = useRef(null);
|
|
6547
6680
|
const mounted = useRef(true);
|
|
6681
|
+
const popRef = useRef(null);
|
|
6682
|
+
// Anchor the menu to the whole two-button group; it sits left of the
|
|
6683
|
+
// model selector either way.
|
|
6684
|
+
const popStyle = useAnchoredPeek(openKind !== null, wrapRef, popRef);
|
|
6548
6685
|
const shadowed = useBadgePlacement(placement, sessionId, presence);
|
|
6549
6686
|
// Icon-only buttons while the composer row is narrow (names move to aria-label).
|
|
6550
6687
|
const [compact, setCompact] = useState(false);
|
|
@@ -6625,16 +6762,6 @@ select.dcpa-q-input.dcpa-media-kind { flex: none; width: auto; height: 28px; fon
|
|
|
6625
6762
|
|
|
6626
6763
|
useEffect(() => {
|
|
6627
6764
|
if (openKind === null) return undefined;
|
|
6628
|
-
const place = () => {
|
|
6629
|
-
// Anchor the menu to the whole two-button group; it sits left of the
|
|
6630
|
-
// model selector either way.
|
|
6631
|
-
const rect = wrapRef.current?.getBoundingClientRect?.();
|
|
6632
|
-
if (!rect || typeof window === "undefined") return;
|
|
6633
|
-
const width = Math.min(340, window.innerWidth - 32);
|
|
6634
|
-
const left = Math.max(16, Math.min(rect.left, window.innerWidth - width - 16));
|
|
6635
|
-
setPos({ left, bottom: Math.max(16, window.innerHeight - rect.top + 6), width });
|
|
6636
|
-
};
|
|
6637
|
-
place();
|
|
6638
6765
|
const onDown = (e) => {
|
|
6639
6766
|
if (wrapRef.current && !wrapRef.current.contains(e.target)) closeMenu();
|
|
6640
6767
|
};
|
|
@@ -6646,11 +6773,9 @@ select.dcpa-q-input.dcpa-media-kind { flex: none; width: auto; height: 28px; fon
|
|
|
6646
6773
|
};
|
|
6647
6774
|
document.addEventListener("mousedown", onDown, true);
|
|
6648
6775
|
document.addEventListener("keydown", onKey, true);
|
|
6649
|
-
window.addEventListener("resize", place);
|
|
6650
6776
|
return () => {
|
|
6651
6777
|
document.removeEventListener("mousedown", onDown, true);
|
|
6652
6778
|
document.removeEventListener("keydown", onKey, true);
|
|
6653
|
-
window.removeEventListener("resize", place);
|
|
6654
6779
|
};
|
|
6655
6780
|
}, [openKind]);
|
|
6656
6781
|
|
|
@@ -6838,7 +6963,8 @@ select.dcpa-q-input.dcpa-media-kind { flex: none; width: auto; height: 28px; fon
|
|
|
6838
6963
|
className: "dcpa-q-pop dcpa-m-pop",
|
|
6839
6964
|
role: "dialog",
|
|
6840
6965
|
"aria-label": showingAgent ? t("mediaAgentSection") : t(activeKind.kind === "image" ? "mediaImageGroup" : "mediaVideoGroup"),
|
|
6841
|
-
|
|
6966
|
+
ref: popRef,
|
|
6967
|
+
style: popStyle,
|
|
6842
6968
|
},
|
|
6843
6969
|
head,
|
|
6844
6970
|
...(showingAgent ? [agentSettings] : [optionGroups(activeKind), agentAvailable ? h("div", { className: "dcpa-m-foot" }, agentButton) : null]),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-cliproxyapi-pro",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.1",
|
|
4
4
|
"description": "CLIProxyAPI (CPA) provider for DeepSeek Harness — multiple accounts, model sync over native protocols, per-credential quota, and optional image / video generation.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dsh",
|