@eddyskywalker/dsh-chatgpt-subscription 0.1.21 → 0.1.23
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 +2 -1
- package/lib/client.js +67 -5
- package/lib/client.js.map +1 -1
- package/lib/index.js +138 -1
- package/lib/types/client/CodexSubscriptionSection.d.ts +8 -1
- package/lib/types/client/CodexSubscriptionSection.d.ts.map +1 -1
- package/lib/types/client/api.d.ts +1 -0
- package/lib/types/client/api.d.ts.map +1 -1
- package/lib/types/client/locales.d.ts +11 -1
- package/lib/types/client/locales.d.ts.map +1 -1
- package/lib/types/client/styles.d.ts.map +1 -1
- package/lib/types/compat.d.ts +2 -0
- package/lib/types/compat.d.ts.map +1 -1
- package/lib/types/host/routes.d.ts.map +1 -1
- package/lib/types/host/usage-service.d.ts +9 -0
- package/lib/types/host/usage-service.d.ts.map +1 -1
- package/lib/types/shared/contracts.d.ts +2 -0
- package/lib/types/shared/contracts.d.ts.map +1 -1
- package/package.json +31 -31
package/CHANGELOG.md
CHANGED
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
## 0.1.21 - 2026-08-22
|
|
8
8
|
|
|
9
9
|
- 修复 DSH 更新到 `0.1.1-rc.2` 后“本轮运行失败:registration.adapter.prepareCall is not a function”:新代理循环经 `ctx.llm.prepareCall()` 冻结每次调用,适配器必须实现 `prepareCall`;CodexChatGptAdapter 现显式绑定同一次解析的模型元数据与流分发(`PreparedAdapterCall`)。
|
|
10
|
-
- `@deepseek-ai
|
|
10
|
+
- 将全部 `@deepseek-ai/*` peerDependencies 与 devDependencies 版本统一从 `^0.1.1-rc.1` 提升至 `^0.1.1-rc.2`,并重新生成 package-lock.json。
|
|
11
|
+
- 增强文件完整性与编码防御:确保 `package.json` 及全部工程文件均为无 BOM 的 UTF-8 编码,新增 `test/package-integrity.test.ts` 自动化防范 UTF-8 BOM 引入与依赖一致性。已在本机 rc.2 依赖集上验证:typecheck、69 项测试与 tsdown 构建全部通过。
|
|
11
12
|
|
|
12
13
|
## 0.1.20 - 2026-08-22
|
|
13
14
|
|
package/lib/client.js
CHANGED
|
@@ -273,6 +273,9 @@ window.__ModuleLoader__.load({
|
|
|
273
273
|
refreshQuota() {
|
|
274
274
|
return post(`${ROUTE_PREFIX}/quota/refresh`, {});
|
|
275
275
|
}
|
|
276
|
+
useResetCredit() {
|
|
277
|
+
return post(`${ROUTE_PREFIX}/quota/reset-credit/use`, {});
|
|
278
|
+
}
|
|
276
279
|
testConnection() {
|
|
277
280
|
return post(`${ROUTE_PREFIX}/connection/test`, {});
|
|
278
281
|
}
|
|
@@ -317,6 +320,7 @@ window.__ModuleLoader__.load({
|
|
|
317
320
|
const [error, setError] = (0, react.useState)(null);
|
|
318
321
|
const [authUrl, setAuthUrl] = (0, react.useState)(null);
|
|
319
322
|
const [popupBlocked, setPopupBlocked] = (0, react.useState)(false);
|
|
323
|
+
const [resetCreditNotice, setResetCreditNotice] = (0, react.useState)(null);
|
|
320
324
|
const [connection, setConnection] = (0, react.useState)(null);
|
|
321
325
|
const [contextDrafts, setContextDrafts] = (0, react.useState)({});
|
|
322
326
|
const load = (0, react.useCallback)(async (quiet = false) => {
|
|
@@ -415,6 +419,17 @@ window.__ModuleLoader__.load({
|
|
|
415
419
|
quota
|
|
416
420
|
});
|
|
417
421
|
});
|
|
422
|
+
const useResetCredit = async () => {
|
|
423
|
+
if (!window.confirm(t("useResetCreditConfirm"))) return;
|
|
424
|
+
await run("reset-credit", async () => {
|
|
425
|
+
const quota = await apiRef.current.useResetCredit();
|
|
426
|
+
setStatus((current) => current === null ? current : {
|
|
427
|
+
...current,
|
|
428
|
+
quota
|
|
429
|
+
});
|
|
430
|
+
setResetCreditNotice(t("resetCreditUsed"));
|
|
431
|
+
});
|
|
432
|
+
};
|
|
418
433
|
const testConnection = async () => run("test", async () => {
|
|
419
434
|
const result = await apiRef.current.testConnection();
|
|
420
435
|
setConnection({
|
|
@@ -453,6 +468,7 @@ window.__ModuleLoader__.load({
|
|
|
453
468
|
const run = async (action, task) => {
|
|
454
469
|
setBusy(action);
|
|
455
470
|
setError(null);
|
|
471
|
+
setResetCreditNotice(null);
|
|
456
472
|
try {
|
|
457
473
|
await task();
|
|
458
474
|
} catch (cause) {
|
|
@@ -706,9 +722,16 @@ window.__ModuleLoader__.load({
|
|
|
706
722
|
label: t("monthlySpend"),
|
|
707
723
|
value: individualLimitLabel(status.quota.individualLimit, t)
|
|
708
724
|
}) : null,
|
|
709
|
-
status?.quota.resetCredits !== null && status?.quota.resetCredits !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
710
|
-
|
|
711
|
-
|
|
725
|
+
status?.quota.resetCredits !== null && status?.quota.resetCredits !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ResetCreditsFact, {
|
|
726
|
+
resetCredits: status.quota.resetCredits,
|
|
727
|
+
busy,
|
|
728
|
+
onUse: useResetCredit,
|
|
729
|
+
t
|
|
730
|
+
}) : null,
|
|
731
|
+
resetCreditNotice !== null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
732
|
+
className: "dsh-codex-success",
|
|
733
|
+
role: "status",
|
|
734
|
+
children: resetCreditNotice
|
|
712
735
|
}) : null,
|
|
713
736
|
status?.quota.spendControlReached === true ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
714
737
|
className: "dsh-codex-warning",
|
|
@@ -814,6 +837,29 @@ window.__ModuleLoader__.load({
|
|
|
814
837
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: label }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: value })]
|
|
815
838
|
});
|
|
816
839
|
}
|
|
840
|
+
function ResetCreditsFact({ resetCredits, busy, onUse, t }) {
|
|
841
|
+
const available = resetCredits.availableCount > 0;
|
|
842
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
843
|
+
className: "dsh-codex-reset-credits",
|
|
844
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
845
|
+
className: "dsh-codex-reset-credits-info",
|
|
846
|
+
children: [
|
|
847
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("resetCredits") }),
|
|
848
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: resetCredits.availableCount }),
|
|
849
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("small", { children: [
|
|
850
|
+
t("resetCreditExpires"),
|
|
851
|
+
": ",
|
|
852
|
+
resetCredits.expiresAt == null ? t("unknown") : formatReset(resetCredits.expiresAt)
|
|
853
|
+
] })
|
|
854
|
+
]
|
|
855
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
856
|
+
primary: true,
|
|
857
|
+
disabled: !available || busy !== null,
|
|
858
|
+
onClick: onUse,
|
|
859
|
+
children: busy === "reset-credit" ? t("usingResetCredit") : t("useResetCredit")
|
|
860
|
+
})]
|
|
861
|
+
});
|
|
862
|
+
}
|
|
817
863
|
function QuotaBar({ label, window, t }) {
|
|
818
864
|
const percent = window.usedPercent;
|
|
819
865
|
const level = percent >= 95 ? "danger" : percent >= 80 ? "warning" : "normal";
|
|
@@ -1314,6 +1360,11 @@ window.__ModuleLoader__.load({
|
|
|
1314
1360
|
credits: "Credits",
|
|
1315
1361
|
monthlySpend: "月度消费控制",
|
|
1316
1362
|
resetCredits: "重置次数",
|
|
1363
|
+
resetCreditExpires: "到期时间",
|
|
1364
|
+
useResetCredit: "使用重置卡",
|
|
1365
|
+
usingResetCredit: "使用中…",
|
|
1366
|
+
useResetCreditConfirm: "使用后会立即消耗 1 次重置机会,并重置符合条件的 Codex 额度窗口。确定继续吗?",
|
|
1367
|
+
resetCreditUsed: "重置卡已使用,用量数据已刷新。",
|
|
1317
1368
|
spendControlReached: "已触发月度消费控制,新的订阅调用可能被限制。",
|
|
1318
1369
|
limit: "上限",
|
|
1319
1370
|
exhausted: "额度已用尽",
|
|
@@ -1431,6 +1482,11 @@ window.__ModuleLoader__.load({
|
|
|
1431
1482
|
credits: "Credits",
|
|
1432
1483
|
monthlySpend: "Monthly spend control",
|
|
1433
1484
|
resetCredits: "Reset credits",
|
|
1485
|
+
resetCreditExpires: "Expires",
|
|
1486
|
+
useResetCredit: "Use reset credit",
|
|
1487
|
+
usingResetCredit: "Using…",
|
|
1488
|
+
useResetCreditConfirm: "This immediately spends one reset credit and resets eligible Codex limit windows. Continue?",
|
|
1489
|
+
resetCreditUsed: "The reset credit was used and usage data was refreshed.",
|
|
1434
1490
|
spendControlReached: "Monthly spend control has been reached; new subscription calls may be limited.",
|
|
1435
1491
|
limit: "Limit",
|
|
1436
1492
|
exhausted: "Quota exhausted",
|
|
@@ -1472,9 +1528,10 @@ window.__ModuleLoader__.load({
|
|
|
1472
1528
|
.dsh-codex-button:disabled{cursor:default;opacity:.5}
|
|
1473
1529
|
.dsh-codex-button-primary{background:var(--dsw-alias-button-info-fill,#397ee8);border-color:transparent;color:var(--dsw-alias-button-info-label,#fff)}
|
|
1474
1530
|
.dsh-codex-notice{background:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-border-l2);border-radius:7px;color:var(--dsw-alias-label-secondary);font-size:12px;line-height:1.55;margin:12px 0 0;padding:10px 12px}
|
|
1475
|
-
.dsh-codex-error,.dsh-codex-warning{font-size:12px;line-height:1.5;margin:8px 0 0}
|
|
1531
|
+
.dsh-codex-error,.dsh-codex-warning,.dsh-codex-success{font-size:12px;line-height:1.5;margin:8px 0 0}
|
|
1476
1532
|
.dsh-codex-error{color:var(--dsw-alias-label-danger,#d94b4b)}
|
|
1477
1533
|
.dsh-codex-warning{color:var(--dsw-alias-label-warning,#c77a18)}
|
|
1534
|
+
.dsh-codex-success{color:var(--dsw-alias-label-success,#2e9b62)}
|
|
1478
1535
|
.dsh-codex-errorbar{align-items:center;background:color-mix(in srgb,var(--dsw-alias-label-danger,#d94b4b) 9%,transparent);border:1px solid color-mix(in srgb,var(--dsw-alias-label-danger,#d94b4b) 28%,transparent);border-radius:7px;color:var(--dsw-alias-label-danger,#d94b4b);display:flex;font-size:13px;gap:12px;justify-content:space-between;padding:10px 12px}
|
|
1479
1536
|
.dsh-codex-link{color:var(--dsw-alias-label-link,#3278d4);display:inline-block;font-size:13px;margin-top:8px}
|
|
1480
1537
|
.dsh-codex-models{display:flex;flex-wrap:wrap;gap:6px;padding-top:12px}
|
|
@@ -1510,6 +1567,11 @@ window.__ModuleLoader__.load({
|
|
|
1510
1567
|
.dsh-codex-quota-fact{align-items:flex-start;border-bottom:1px solid var(--dsw-alias-border-l2);display:flex;font-size:12px;gap:12px;justify-content:space-between;line-height:1.45;padding:10px 0}
|
|
1511
1568
|
.dsh-codex-quota-fact span{color:var(--dsw-alias-label-secondary);flex:none}
|
|
1512
1569
|
.dsh-codex-quota-fact strong{font-weight:600;min-width:0;overflow-wrap:anywhere;text-align:right}
|
|
1570
|
+
.dsh-codex-reset-credits{align-items:center;border-bottom:1px solid var(--dsw-alias-border-l2);display:flex;gap:16px;justify-content:space-between;padding:10px 0}
|
|
1571
|
+
.dsh-codex-reset-credits-info{display:grid;font-size:12px;gap:2px;grid-template-columns:auto auto}
|
|
1572
|
+
.dsh-codex-reset-credits-info>span{color:var(--dsw-alias-label-secondary)}
|
|
1573
|
+
.dsh-codex-reset-credits-info>strong{font-weight:650;text-align:right}
|
|
1574
|
+
.dsh-codex-reset-credits-info>small{color:var(--dsw-alias-label-tertiary);font-size:11px;grid-column:1/-1}
|
|
1513
1575
|
.dsh-codex-meter-wrap{margin-top:13px}
|
|
1514
1576
|
.dsh-codex-meter-label,.dsh-codex-meter-meta{display:flex;gap:10px;justify-content:space-between}
|
|
1515
1577
|
.dsh-codex-meter-label{font-size:12px;margin-bottom:6px}
|
|
@@ -1539,7 +1601,7 @@ window.__ModuleLoader__.load({
|
|
|
1539
1601
|
.dsh-codex-image-loading,.dsh-codex-image-failed{border:1px dashed var(--dsw-alias-border-l2);border-radius:8px;color:var(--dsw-alias-label-tertiary);display:inline-flex;font-size:12px;line-height:1.4;padding:18px 20px}
|
|
1540
1602
|
.dsh-codex-image-failed{color:var(--dsw-alias-label-danger,#d94b4b)}
|
|
1541
1603
|
@keyframes dsh-codex-pulse{0%,100%{opacity:.55}50%{opacity:1}}
|
|
1542
|
-
@media(max-width:560px){.dsh-codex-row,.dsh-codex-pref-row,.dsh-codex-quota-fact{align-items:flex-start;flex-direction:column;gap:3px}.dsh-codex-value,.dsh-codex-quota-fact strong{text-align:left}.dsh-codex-actions{justify-content:flex-start}.dsh-codex-grouphead{align-items:flex-start;flex-direction:column;gap:0;padding:12px 0}.dsh-codex-meter-meta{align-items:flex-start;flex-direction:column;gap:2px}.dsh-codex-errorbar{align-items:flex-start;flex-direction:column}.dsh-codex-segments{width:100%}.dsh-codex-select{max-width:none;width:100%}.dsh-codex-context-row{align-items:flex-start;flex-direction:column;gap:5px}.dsh-codex-segments label{flex:1}.dsh-codex-segments span{text-align:center}.dsh-codex-image-tool{max-width:100%;margin-left:0}}
|
|
1604
|
+
@media(max-width:560px){.dsh-codex-row,.dsh-codex-pref-row,.dsh-codex-quota-fact,.dsh-codex-reset-credits{align-items:flex-start;flex-direction:column;gap:3px}.dsh-codex-value,.dsh-codex-quota-fact strong{text-align:left}.dsh-codex-actions{justify-content:flex-start}.dsh-codex-grouphead{align-items:flex-start;flex-direction:column;gap:0;padding:12px 0}.dsh-codex-meter-meta{align-items:flex-start;flex-direction:column;gap:2px}.dsh-codex-errorbar{align-items:flex-start;flex-direction:column}.dsh-codex-segments{width:100%}.dsh-codex-select{max-width:none;width:100%}.dsh-codex-context-row{align-items:flex-start;flex-direction:column;gap:5px}.dsh-codex-segments label{flex:1}.dsh-codex-segments span{text-align:center}.dsh-codex-image-tool{max-width:100%;margin-left:0}}
|
|
1543
1605
|
@media(prefers-reduced-motion:reduce){.dsh-codex-meter>span{transition:none}.dsh-codex-skeleton span{animation:none}}
|
|
1544
1606
|
`;
|
|
1545
1607
|
function installStyles() {
|