@eddyskywalker/dsh-chatgpt-subscription 0.2.10 → 0.2.12

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 (37) hide show
  1. package/CHANGELOG.md +24 -24
  2. package/LICENSE +21 -21
  3. package/README.md +169 -169
  4. package/bin/antigravity-login.mjs +15 -4
  5. package/cordis.patch.yml +6 -6
  6. package/lib/client.js +110 -12
  7. package/lib/client.js.map +1 -1
  8. package/lib/index.js +253 -93
  9. package/lib/types/client/antigravity/AntigravityComposerQuota.d.ts.map +1 -1
  10. package/lib/types/client/antigravity/AntigravitySection.d.ts.map +1 -1
  11. package/lib/types/client/locales.d.ts +65 -1
  12. package/lib/types/client/locales.d.ts.map +1 -1
  13. package/lib/types/compat.d.ts +11 -0
  14. package/lib/types/compat.d.ts.map +1 -1
  15. package/lib/types/host/antigravity/adapter.d.ts +1 -0
  16. package/lib/types/host/antigravity/adapter.d.ts.map +1 -1
  17. package/lib/types/host/antigravity/client.d.ts +23 -1
  18. package/lib/types/host/antigravity/client.d.ts.map +1 -1
  19. package/lib/types/host/antigravity/mapper.d.ts +1 -0
  20. package/lib/types/host/antigravity/mapper.d.ts.map +1 -1
  21. package/lib/types/host/antigravity/oauth.d.ts +9 -3
  22. package/lib/types/host/antigravity/oauth.d.ts.map +1 -1
  23. package/lib/types/host/antigravity/routes.d.ts.map +1 -1
  24. package/lib/types/host/antigravity/types.d.ts +6 -0
  25. package/lib/types/host/antigravity/types.d.ts.map +1 -1
  26. package/lib/types/host/model-catalog.d.ts.map +1 -1
  27. package/lib/types/host/preferences.d.ts.map +1 -1
  28. package/lib/types/host/proxy-manager.d.ts.map +1 -1
  29. package/lib/types/host/responses-mapper.d.ts +1 -0
  30. package/lib/types/host/responses-mapper.d.ts.map +1 -1
  31. package/lib/types/index.d.ts +1 -1
  32. package/lib/types/index.d.ts.map +1 -1
  33. package/lib/types/shared/contracts.d.ts +9 -0
  34. package/lib/types/shared/contracts.d.ts.map +1 -1
  35. package/lib/types/shared/preferences.d.ts +2 -0
  36. package/lib/types/shared/preferences.d.ts.map +1 -1
  37. package/package.json +134 -134
package/lib/client.js CHANGED
@@ -1473,7 +1473,39 @@ window.__ModuleLoader__.load({
1473
1473
  imagePreviewClose: "关闭",
1474
1474
  imagePreviewOpenOriginal: "打开原图",
1475
1475
  retry: "重试",
1476
- unknown: "未知"
1476
+ unknown: "未知",
1477
+ teamModelRulesTitle: "智能体团队 (Agent Teams) 混合模型规则",
1478
+ teamModelRulesHint: "在 Agent Teams 协同模式下,可根据 Teammate 角色或名称前缀(如 reviewer*、code*、scout)自动匹配不同模型,未匹配项使用默认子代理模型。",
1479
+ teamRulePattern: "匹配角色/前缀",
1480
+ teamRulePatternPlaceholder: "输入通配符,如 reviewer* 或 audit",
1481
+ teamRuleModel: "目标模型",
1482
+ teamRuleModelPlaceholder: "输入模型 ID,如 custom:model-id",
1483
+ teamRuleEffort: "思考档位",
1484
+ teamRuleAdd: "添加团队规则",
1485
+ teamRuleDelete: "删除",
1486
+ teamRuleEmpty: "暂未配置团队规则,所有 Teammate 将使用全局默认子代理模型。",
1487
+ teamRuleQuickPresets: "团队预设模板",
1488
+ teamRuleQuickPresetsHint: "一键为常见团队角色快速注入推荐模型与思考深度。",
1489
+ presetReviewer: "代码审查员 (review* -> 6 Astra)",
1490
+ presetCoder: "实现工程师 (code* -> 5.6 Sol)",
1491
+ presetFast: "轻量助理 (scout/test* -> DeepSeek V41 Flash)",
1492
+ presetReviewerShort: "审查员",
1493
+ presetCoderShort: "工程师",
1494
+ presetFastShort: "轻量探索",
1495
+ teamRuleAddLabel: "添加规则",
1496
+ roleReviewer: "代码审查员 (Reviewer · review*)",
1497
+ roleCoder: "实现工程师 (Coder · code*)",
1498
+ roleTester: "测试与质量 (Tester · test*)",
1499
+ roleScout: "探索调研员 (Scout/Research · scout*)",
1500
+ roleArchitect: "架构规划师 (Architect · design*)",
1501
+ roleDoc: "文档撰写员 (Documentation · doc*)",
1502
+ roleCustom: "自定义角色模式…",
1503
+ modelCustom: "自定义模型 ID…",
1504
+ effortDefault: "默认思考档位",
1505
+ effortLow: "低思考 (low) · 快速响应",
1506
+ effortMedium: "中思考 (medium) · 推荐平衡",
1507
+ effortHigh: "高思考 (high) · 深度推导",
1508
+ effortMax: "极致思考 (max) · 超强推理"
1477
1509
  },
1478
1510
  en: {
1479
1511
  title: "ChatGPT",
@@ -1604,7 +1636,39 @@ window.__ModuleLoader__.load({
1604
1636
  imagePreviewClose: "Close",
1605
1637
  imagePreviewOpenOriginal: "Open original",
1606
1638
  retry: "Retry",
1607
- unknown: "Unknown"
1639
+ unknown: "Unknown",
1640
+ teamModelRulesTitle: "Agent Teams Hybrid Model Rules",
1641
+ teamModelRulesHint: "In Agent Teams mode, automatically route teammates to specialized models by matching role or name patterns (e.g. reviewer*, code*, scout). Unmatched teammates fall back to the default subagent model.",
1642
+ teamRulePattern: "Pattern / Role",
1643
+ teamRulePatternPlaceholder: "Enter wildcard, e.g. reviewer* or audit",
1644
+ teamRuleModel: "Target Model",
1645
+ teamRuleModelPlaceholder: "Enter model ID, e.g. custom:model-id",
1646
+ teamRuleEffort: "Reasoning Effort",
1647
+ teamRuleAdd: "Add Team Rule",
1648
+ teamRuleDelete: "Delete",
1649
+ teamRuleEmpty: "No team rules configured. All teammates will inherit the default subagent model.",
1650
+ teamRuleQuickPresets: "Team Presets",
1651
+ teamRuleQuickPresetsHint: "One-click presets with recommended models and reasoning efforts.",
1652
+ presetReviewer: "Code Reviewer (review* -> 6 Astra)",
1653
+ presetCoder: "Implementer (code* -> 5.6 Sol)",
1654
+ presetFast: "Fast Assistant (scout/test* -> DeepSeek V41 Flash)",
1655
+ presetReviewerShort: "Reviewer",
1656
+ presetCoderShort: "Coder",
1657
+ presetFastShort: "Fast Scout",
1658
+ teamRuleAddLabel: "Add Rule",
1659
+ roleReviewer: "Code Reviewer (Reviewer · review*)",
1660
+ roleCoder: "Implementer (Coder · code*)",
1661
+ roleTester: "Tester & QA (Tester · test*)",
1662
+ roleScout: "Researcher (Scout/Research · scout*)",
1663
+ roleArchitect: "Architect (Architect · design*)",
1664
+ roleDoc: "Tech Writer (Documentation · doc*)",
1665
+ roleCustom: "Custom Role Pattern…",
1666
+ modelCustom: "Custom Model ID…",
1667
+ effortDefault: "Default Reasoning Effort",
1668
+ effortLow: "Low Effort (low) · Fast",
1669
+ effortMedium: "Medium Effort (medium) · Balanced",
1670
+ effortHigh: "High Effort (high) · Deep Reason",
1671
+ effortMax: "Max Effort (max) · Complex Tasks"
1608
1672
  }
1609
1673
  };
1610
1674
  //#endregion
@@ -1712,7 +1776,7 @@ window.__ModuleLoader__.load({
1712
1776
  .dsh-codex-image-preview{background:var(--dsw-alias-bg-layer-2);border:0.5px solid var(--dsw-alias-border-l2);border-radius:8px;display:block;max-height:260px;max-width:min(100%,360px);object-fit:contain}
1713
1777
  .dsh-codex-image-loading,.dsh-codex-image-failed{border:0.5px 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}
1714
1778
  .dsh-codex-image-failed{color:var(--dsw-alias-label-danger,#d94b4b)}
1715
- @keyframes dsh-codex-pulse{0%,100%{opacity:.55}50%{opacity:1}}
1779
+ @keyframes dsh-codex-pulse{0%,100%{opacity:.45}50%{opacity:.85}}
1716
1780
  @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}}
1717
1781
  @media(prefers-reduced-motion:reduce){.dsh-codex-meter>span{transition:none}.dsh-codex-skeleton span{animation:none}}
1718
1782
  `;
@@ -1886,6 +1950,8 @@ window.__ModuleLoader__.load({
1886
1950
  const [loading, setLoading] = (0, react.useState)(true);
1887
1951
  const [busy, setBusy] = (0, react.useState)(null);
1888
1952
  const [error, setError] = (0, react.useState)(null);
1953
+ const [validationUrl, setValidationUrl] = (0, react.useState)(null);
1954
+ const [loginProgress, setLoginProgress] = (0, react.useState)(null);
1889
1955
  const [contextDrafts, setContextDrafts] = (0, react.useState)({});
1890
1956
  const [savingModel, setSavingModel] = (0, react.useState)(null);
1891
1957
  const t = zh;
@@ -1894,10 +1960,14 @@ window.__ModuleLoader__.load({
1894
1960
  loadModelDirectory?.();
1895
1961
  }, [onModelChange, loadModelDirectory]);
1896
1962
  const loadStatus = (0, react.useCallback)(async (quiet = false) => {
1897
- if (!quiet) setError(null);
1963
+ if (!quiet) {
1964
+ setError(null);
1965
+ setValidationUrl(null);
1966
+ }
1898
1967
  try {
1899
1968
  const data = await fetchApi$1("/status");
1900
1969
  setStatus(data);
1970
+ if (data.authenticated && (!data.quota || data.quota.groups.length === 0)) fetchApi$1("/quota", { method: "POST" }).then((updated) => setStatus(updated)).catch(() => void 0);
1901
1971
  const drafts = {};
1902
1972
  for (const m of data.models) {
1903
1973
  const val = data.contextWindowOverrides[m.id] || m.defaultContextWindow;
@@ -1926,29 +1996,37 @@ window.__ModuleLoader__.load({
1926
1996
  try {
1927
1997
  setBusy("login");
1928
1998
  setError(null);
1999
+ setValidationUrl(null);
2000
+ setLoginProgress(null);
1929
2001
  const flow = await fetchApi$1("/login", { method: "POST" });
1930
2002
  if (flow.authUrl) window.open(flow.authUrl, "_blank");
1931
2003
  const pollTimer = setInterval(async () => {
1932
2004
  try {
1933
2005
  const pollStatus = await fetchApi$1("/login/status");
2006
+ if (pollStatus.progress) setLoginProgress(pollStatus.progress);
1934
2007
  if (pollStatus.status === "complete") {
1935
2008
  clearInterval(pollTimer);
1936
2009
  setBusy(null);
2010
+ setLoginProgress(null);
1937
2011
  await loadStatus();
1938
2012
  notifyChange();
1939
2013
  } else if (pollStatus.status === "error") {
1940
2014
  clearInterval(pollTimer);
1941
2015
  setBusy(null);
1942
- setError(t.loginFailed);
2016
+ setLoginProgress(null);
2017
+ setError(pollStatus.error || t.loginFailed);
2018
+ if (pollStatus.validationUrl) setValidationUrl(pollStatus.validationUrl);
1943
2019
  }
1944
2020
  } catch {}
1945
2021
  }, 1500);
1946
2022
  setTimeout(() => {
1947
2023
  clearInterval(pollTimer);
1948
2024
  setBusy(null);
2025
+ setLoginProgress(null);
1949
2026
  }, 300 * 1e3);
1950
2027
  } catch (err) {
1951
2028
  setBusy(null);
2029
+ setLoginProgress(null);
1952
2030
  setError(err instanceof Error ? err.message : String(err));
1953
2031
  }
1954
2032
  };
@@ -2127,13 +2205,13 @@ window.__ModuleLoader__.load({
2127
2205
  className: "dsha-btn dsha-btn-primary",
2128
2206
  disabled: busy !== null,
2129
2207
  onClick: handleLogin,
2130
- children: busy === "login" ? t.signingIn : t.signIn
2208
+ children: busy === "login" ? loginProgress || t.signingIn : t.signIn
2131
2209
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
2132
2210
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2133
2211
  className: "dsha-btn dsha-btn-primary",
2134
2212
  disabled: busy !== null,
2135
2213
  onClick: handleLogin,
2136
- children: t.signInAgain
2214
+ children: busy === "login" ? loginProgress || t.signingIn : t.signInAgain
2137
2215
  }),
2138
2216
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2139
2217
  className: "dsha-btn",
@@ -2319,7 +2397,7 @@ window.__ModuleLoader__.load({
2319
2397
  children: t.signedOut
2320
2398
  }) : groups.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2321
2399
  className: "dsha-empty",
2322
- children: "暂无配额数据,点击右上角刷新用量。"
2400
+ children: busy === "quota" ? t.refreshingQuota : "正在获取配额用量数据..."
2323
2401
  }) : groups.map((group, gIdx) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2324
2402
  className: "dsha-quota-card",
2325
2403
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -2354,9 +2432,24 @@ window.__ModuleLoader__.load({
2354
2432
  })
2355
2433
  ]
2356
2434
  }),
2357
- error && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2435
+ error && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2358
2436
  className: "dsha-error",
2359
- children: error
2437
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: error }), validationUrl && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2438
+ style: { marginTop: "8px" },
2439
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
2440
+ href: validationUrl,
2441
+ target: "_blank",
2442
+ rel: "noreferrer",
2443
+ className: "dsha-btn dsha-btn-primary",
2444
+ style: {
2445
+ display: "inline-block",
2446
+ textDecoration: "none",
2447
+ padding: "4px 10px",
2448
+ fontSize: "12px"
2449
+ },
2450
+ children: "前往 Google 完成账号验证"
2451
+ })
2452
+ })]
2360
2453
  })
2361
2454
  ]
2362
2455
  });
@@ -2494,7 +2587,12 @@ window.__ModuleLoader__.load({
2494
2587
  setLoading(true);
2495
2588
  try {
2496
2589
  const data = refresh ? await fetchApi("/quota", { method: "POST" }) : await fetchApi("/status");
2497
- if (mountedRef.current) setStatus(data);
2590
+ if (mountedRef.current) {
2591
+ setStatus(data);
2592
+ if (data.authenticated && (!data.quota || data.quota.groups.length === 0) && !refresh) fetchApi("/quota", { method: "POST" }).then((updated) => {
2593
+ if (mountedRef.current) setStatus(updated);
2594
+ }).catch(() => void 0);
2595
+ }
2498
2596
  } catch {} finally {
2499
2597
  if (mountedRef.current) setLoading(false);
2500
2598
  }
@@ -2670,7 +2768,7 @@ window.__ModuleLoader__.load({
2670
2768
  <button type="button" class="dsh-mermaid-modal-btn" data-action="zoom-out" title="缩小">− 缩小</button>
2671
2769
  <button type="button" class="dsh-mermaid-modal-btn" data-action="zoom-in" title="放大">+ 放大</button>
2672
2770
  <button type="button" class="dsh-mermaid-modal-btn" data-action="reset" title="重置">⟳ 重置</button>
2673
- <button type="button" class="dsh-mermaid-modal-btn" data-action="close" title="关闭">✕ 关闭</button>
2771
+ <button type="button" class="dsh-mermaid-modal-btn" data-action="close" title="关闭">关闭</button>
2674
2772
  </div>
2675
2773
  <div class="dsh-mermaid-modal-stage">
2676
2774
  <div class="dsh-mermaid-zoom-container">${svgHtml}</div>