dsh-subscriptions 0.2.3 → 0.3.0

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 (35) hide show
  1. package/README.md +7 -19
  2. package/lib/auth/rpc.d.ts +2 -20
  3. package/lib/auth/rpc.js +3 -49
  4. package/lib/client/ProviderAccountManager.d.ts +1 -1
  5. package/lib/client/ProviderAccountManager.js +86 -110
  6. package/lib/client/ProviderModelEditor.d.ts +1 -1
  7. package/lib/client/ProviderModelEditor.js +2 -6
  8. package/lib/client/SubscriptionUsageBadge.d.ts +1 -1
  9. package/lib/client/SubscriptionUsageBadge.js +1 -13
  10. package/lib/client/SubscriptionsSection.js +1 -2
  11. package/lib/client/locales.d.ts +0 -32
  12. package/lib/client/locales.js +0 -32
  13. package/lib/client/model-filter.js +1 -1
  14. package/lib/client/subscription-card-styles.d.ts +1 -1
  15. package/lib/client/subscription-card-styles.js +1 -1
  16. package/lib/client.js +175 -489
  17. package/lib/client.js.map +1 -1
  18. package/lib/index.js +165 -3275
  19. package/lib/providers/ollama-settings.d.ts +1 -1
  20. package/lib/providers/ollama-settings.js +1 -1
  21. package/package.json +1 -7
  22. package/lib/client/CursorCard.d.ts +0 -9
  23. package/lib/client/CursorCard.js +0 -151
  24. package/lib/providers/cursor-adapter.d.ts +0 -50
  25. package/lib/providers/cursor-adapter.js +0 -304
  26. package/lib/providers/cursor-auth.d.ts +0 -43
  27. package/lib/providers/cursor-auth.js +0 -221
  28. package/lib/providers/cursor-model-settings.d.ts +0 -15
  29. package/lib/providers/cursor-model-settings.js +0 -60
  30. package/lib/providers/cursor-usage.d.ts +0 -9
  31. package/lib/providers/cursor-usage.js +0 -131
  32. package/vendor/cursor/LICENSE +0 -21
  33. package/vendor/cursor/index.d.ts +0 -18
  34. package/vendor/cursor/index.js +0 -3574
  35. package/vendor/cursor/proto.js +0 -254
package/lib/client.js CHANGED
@@ -183,22 +183,6 @@ const en = {
183
183
  externalUsageApiKey: "API key",
184
184
  externalUsageConfigure: "No API key found at {ref}. Add one in Settings → Models.",
185
185
  externalUsageUnavailable: "Usage status unavailable: {message}",
186
- cursorTitle: "Cursor",
187
- cursorOpenLogin: "Open Cursor sign-in",
188
- cursorWaiting: "Waiting for Cursor sign-in…",
189
- cursorConnected: "Connected",
190
- cursorManageTitle: "Manage Cursor",
191
- cursorManageSignIn: "Sign in to see the models available to this Cursor account.",
192
- cursorAccountsHint: "Cursor uses one connected account. Choose which of its models appear in the model picker.",
193
- cursorManageHint: "Choose model visibility here. Refresh fetches the current models from Cursor; Save changes updates the model picker.",
194
- cursorFilterModels: "Filter models",
195
- cursorModelsLoading: "Loading Cursor models…",
196
- cursorModelsError: "Could not load Cursor models: {message}",
197
- cursorModelsCount: "{count} models available",
198
- cursorIncluded: "Included usage",
199
- cursorModels: "Cursor Models",
200
- cursorOtherModels: "Other Models",
201
- cursorIncludedRequests: "Included requests",
202
186
  modelDefaultsTitle: "Default reasoning effort",
203
187
  modelDefaultsHint: "The model picker preselects this level when you switch to the model; models without levels always follow the provider.",
204
188
  modelDefaultsFollowProvider: "Follow provider",
@@ -429,22 +413,6 @@ const zh = {
429
413
  externalUsageApiKey: "API 密钥",
430
414
  externalUsageConfigure: "未在 {ref} 找到 API 密钥。请在「设置 → 模型」中添加。",
431
415
  externalUsageUnavailable: "无法获取用量状态:{message}",
432
- cursorTitle: "Cursor",
433
- cursorOpenLogin: "打开 Cursor 登录页面",
434
- cursorWaiting: "等待 Cursor 登录…",
435
- cursorConnected: "已连接",
436
- cursorManageTitle: "管理 Cursor",
437
- cursorManageSignIn: "登录后可查看此 Cursor 账号可用的模型。",
438
- cursorAccountsHint: "Cursor 使用一个已连接账号。可在此选择模型选择器中显示的模型。",
439
- cursorManageHint: "在此选择模型是否显示。刷新可从 Cursor 获取当前模型;保存更改后更新模型选择器。",
440
- cursorFilterModels: "筛选模型",
441
- cursorModelsLoading: "正在加载 Cursor 模型…",
442
- cursorModelsError: "无法加载 Cursor 模型:{message}",
443
- cursorModelsCount: "可用模型:{count} 个",
444
- cursorIncluded: "套餐内用量",
445
- cursorModels: "Cursor 模型",
446
- cursorOtherModels: "其他模型",
447
- cursorIncludedRequests: "套餐内请求",
448
416
  modelDefaultsTitle: "默认推理档",
449
417
  modelDefaultsHint: "切换到该模型时,模型选择器会预选此档位;没有推理档的模型始终跟随服务商默认。",
450
418
  modelDefaultsFollowProvider: "跟随服务商",
@@ -717,7 +685,7 @@ const ProviderModelEditor = (0, react.forwardRef)(function ProviderModelEditor$1
717
685
  setBusy(true);
718
686
  setError("");
719
687
  try {
720
- const data = await callSubscriptionsAuth(rpc, provider === "cursor-subscription" ? "cursorSettings" : "providerSettings", {
688
+ const data = await callSubscriptionsAuth(rpc, "providerSettings", {
721
689
  provider,
722
690
  force
723
691
  });
@@ -803,7 +771,7 @@ const ProviderModelEditor = (0, react.forwardRef)(function ProviderModelEditor$1
803
771
  children: [
804
772
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
805
773
  className: "dsh-subscription-hint",
806
- children: t(provider === "cursor-subscription" ? "cursorManageHint" : "modelsHint")
774
+ children: t("modelsHint")
807
775
  }),
808
776
  error && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
809
777
  role: "alert",
@@ -1294,7 +1262,7 @@ function ProviderAccountManager({ provider, name, rpc, t, onClose }) {
1294
1262
  let current = true;
1295
1263
  setLoading(true);
1296
1264
  setError("");
1297
- callSubscriptionsAuth(rpc, provider === "cursor-subscription" ? "cursorSettings" : "providerSettings", { provider }).then((data) => {
1265
+ callSubscriptionsAuth(rpc, "providerSettings", { provider }).then((data) => {
1298
1266
  if (current) {
1299
1267
  setCatalog(data);
1300
1268
  setTtlDraft(data.settings.promptCacheTtl);
@@ -1333,7 +1301,7 @@ function ProviderAccountManager({ provider, name, rpc, t, onClose }) {
1333
1301
  setSaveError("");
1334
1302
  let savedEfforts = 0;
1335
1303
  try {
1336
- if (provider !== "cursor-subscription") for (const { model, effort } of models.efforts) {
1304
+ for (const { model, effort } of models.efforts) {
1337
1305
  await callSubscriptionsAuth(rpc, "setModelDefault", {
1338
1306
  provider,
1339
1307
  model,
@@ -1342,18 +1310,17 @@ function ProviderAccountManager({ provider, name, rpc, t, onClose }) {
1342
1310
  savedEfforts++;
1343
1311
  if (!alive.current) return;
1344
1312
  }
1345
- const latest = await callSubscriptionsAuth(rpc, provider === "cursor-subscription" ? "cursorSettings" : "providerSettings", { provider });
1313
+ const latest = await callSubscriptionsAuth(rpc, "providerSettings", { provider });
1346
1314
  if (!alive.current) return;
1347
- if (provider === "cursor-subscription") await callSubscriptionsAuth(rpc, "cursorSetSettings", { settings: models.settings ?? latest.settings });
1348
- else await callSubscriptionsAuth(rpc, "setProviderSettings", {
1315
+ await callSubscriptionsAuth(rpc, "setProviderSettings", {
1349
1316
  provider,
1350
1317
  settings: mergeAccountChanges(mergePromptCacheTtl(models.settings === void 0 ? latest.settings : mergeLatestAccounts(models.settings, latest.settings), ttlDirty ? ttlDraft : latest.settings.promptCacheTtl), changes)
1351
1318
  });
1352
1319
  if (alive.current) onClose();
1353
1320
  } catch (error$1) {
1354
1321
  if (alive.current) {
1355
- const message$3 = error$1 instanceof Error ? error$1.message : String(error$1);
1356
- setSaveError((savedEfforts ? t("modelsPartialSave") + " " : "") + t("accountsSaveFailed", { message: message$3 }));
1322
+ const message$2 = error$1 instanceof Error ? error$1.message : String(error$1);
1323
+ setSaveError((savedEfforts ? t("modelsPartialSave") + " " : "") + t("accountsSaveFailed", { message: message$2 }));
1357
1324
  }
1358
1325
  } finally {
1359
1326
  saveLock.current = false;
@@ -1401,7 +1368,7 @@ function ProviderAccountManager({ provider, name, rpc, t, onClose }) {
1401
1368
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1402
1369
  id: description,
1403
1370
  className: "dsh-subscription-hint",
1404
- children: t(provider === "cursor-subscription" ? "cursorAccountsHint" : "accountsHint")
1371
+ children: t("accountsHint")
1405
1372
  }),
1406
1373
  error && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1407
1374
  role: "alert",
@@ -1425,190 +1392,173 @@ function ProviderAccountManager({ provider, name, rpc, t, onClose }) {
1425
1392
  margin: 0,
1426
1393
  padding: 0
1427
1394
  },
1428
- children: [
1429
- catalog.accounts.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1430
- className: "dsh-subscription-hint",
1431
- children: t(provider === "cursor-subscription" ? "cursorManageSignIn" : "accountsEmpty")
1432
- }),
1433
- provider === "cursor-subscription" && catalog.accounts.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("fieldset", {
1395
+ children: [catalog.accounts.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1396
+ className: "dsh-subscription-hint",
1397
+ children: t("accountsEmpty")
1398
+ }), catalog.accounts.map((account) => {
1399
+ const preferences = changes[account.key] ?? catalog.settings.accounts?.[account.key] ?? {};
1400
+ const selected = accountPoolSelection(preferences, account.models);
1401
+ const models = accountModelRows(account, preferences);
1402
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("fieldset", {
1434
1403
  style: {
1404
+ ...stack$1,
1435
1405
  border: border$1,
1436
1406
  borderRadius: "var(--dsw-radius-lg, 12px)",
1437
- padding: 14
1407
+ padding: 14,
1408
+ margin: 0
1438
1409
  },
1439
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("legend", {
1440
- style: { padding: "0 6px" },
1441
- children: name
1442
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1443
- className: "dsh-subscription-hint",
1444
- children: t("cursorConnected")
1445
- })]
1446
- }),
1447
- provider !== "cursor-subscription" && catalog.accounts.map((account) => {
1448
- const preferences = changes[account.key] ?? catalog.settings.accounts?.[account.key] ?? {};
1449
- const selected = accountPoolSelection(preferences, account.models);
1450
- const models = accountModelRows(account, preferences);
1451
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("fieldset", {
1452
- style: {
1453
- ...stack$1,
1454
- border: border$1,
1455
- borderRadius: "var(--dsw-radius-lg, 12px)",
1456
- padding: 14,
1457
- margin: 0
1458
- },
1459
- children: [
1460
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("legend", {
1461
- style: {
1462
- padding: "0 6px",
1463
- overflowWrap: "anywhere",
1464
- maxWidth: "100%"
1465
- },
1466
- children: account.label
1467
- }),
1468
- account.unavailable && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1469
- className: "dsh-subscription-hint",
1470
- children: t("accountsCatalogUnavailable")
1410
+ children: [
1411
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("legend", {
1412
+ style: {
1413
+ padding: "0 6px",
1414
+ overflowWrap: "anywhere",
1415
+ maxWidth: "100%"
1416
+ },
1417
+ children: account.label
1418
+ }),
1419
+ account.unavailable && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1420
+ className: "dsh-subscription-hint",
1421
+ children: t("accountsCatalogUnavailable")
1422
+ }),
1423
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
1424
+ style: {
1425
+ ...stack$1,
1426
+ gap: 6
1427
+ },
1428
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1429
+ className: "dsh-subscription-label",
1430
+ children: t("accountsAlias")
1431
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1432
+ value: preferences.alias ?? "",
1433
+ placeholder: account.label,
1434
+ onChange: (event) => {
1435
+ const next = { ...preferences };
1436
+ if (event.target.value.trim()) next.alias = event.target.value;
1437
+ else delete next.alias;
1438
+ edit(account.key, next);
1439
+ }
1440
+ })]
1441
+ }),
1442
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", { children: [
1443
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1444
+ type: "checkbox",
1445
+ checked: preferences.poolEnabled !== false,
1446
+ onChange: (event) => edit(account.key, {
1447
+ ...preferences,
1448
+ poolEnabled: event.target.checked
1449
+ })
1471
1450
  }),
1472
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
1473
- style: {
1474
- ...stack$1,
1475
- gap: 6
1476
- },
1477
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1478
- className: "dsh-subscription-label",
1479
- children: t("accountsAlias")
1480
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1481
- value: preferences.alias ?? "",
1482
- placeholder: account.label,
1483
- onChange: (event) => {
1484
- const next = { ...preferences };
1485
- if (event.target.value.trim()) next.alias = event.target.value;
1486
- else delete next.alias;
1487
- edit(account.key, next);
1488
- }
1489
- })]
1451
+ " ",
1452
+ t("accountsPoolEnabled")
1453
+ ] }),
1454
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", { children: [
1455
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1456
+ type: "checkbox",
1457
+ checked: preferences.independentEntry === true,
1458
+ onChange: (event) => edit(account.key, {
1459
+ ...preferences,
1460
+ independentEntry: event.target.checked
1461
+ })
1490
1462
  }),
1491
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", { children: [
1492
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1493
- type: "checkbox",
1494
- checked: preferences.poolEnabled !== false,
1495
- onChange: (event) => edit(account.key, {
1496
- ...preferences,
1497
- poolEnabled: event.target.checked
1498
- })
1499
- }),
1463
+ " ",
1464
+ t("accountsIndependent")
1465
+ ] }),
1466
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1467
+ className: "dsh-subscription-hint",
1468
+ children: t("accountsIndependentHint")
1469
+ }),
1470
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("details", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("summary", {
1471
+ style: {
1472
+ cursor: "pointer",
1473
+ fontSize: 13
1474
+ },
1475
+ children: [
1476
+ t("accountsModels"),
1477
+ " ·",
1500
1478
  " ",
1501
- t("accountsPoolEnabled")
1502
- ] }),
1503
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", { children: [
1504
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1505
- type: "checkbox",
1506
- checked: preferences.independentEntry === true,
1507
- onChange: (event) => edit(account.key, {
1508
- ...preferences,
1509
- independentEntry: event.target.checked
1510
- })
1479
+ preferences.poolModels === void 0 ? t("accountsModelsAll") : t("accountsModelsCount", { count: preferences.poolModels.length })
1480
+ ]
1481
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1482
+ style: {
1483
+ ...stack$1,
1484
+ marginTop: 12
1485
+ },
1486
+ children: [
1487
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1488
+ className: "dsh-subscription-hint",
1489
+ children: t("accountsModelsHint")
1511
1490
  }),
1512
- " ",
1513
- t("accountsIndependent")
1514
- ] }),
1515
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1516
- className: "dsh-subscription-hint",
1517
- children: t("accountsIndependentHint")
1518
- }),
1519
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("details", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("summary", {
1520
- style: {
1521
- cursor: "pointer",
1522
- fontSize: 13
1523
- },
1524
- children: [
1525
- t("accountsModels"),
1526
- " ·",
1527
- " ",
1528
- preferences.poolModels === void 0 ? t("accountsModelsAll") : t("accountsModelsCount", { count: preferences.poolModels.length })
1529
- ]
1530
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1531
- style: {
1532
- ...stack$1,
1533
- marginTop: 12
1534
- },
1535
- children: [
1536
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1537
- className: "dsh-subscription-hint",
1538
- children: t("accountsModelsHint")
1491
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", { children: [
1492
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1493
+ type: "checkbox",
1494
+ checked: preferences.poolModels === void 0,
1495
+ onChange: (event) => {
1496
+ const next = { ...preferences };
1497
+ if (event.target.checked) delete next.poolModels;
1498
+ else next.poolModels = account.models.map((model) => model.id);
1499
+ edit(account.key, next);
1500
+ }
1539
1501
  }),
1540
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", { children: [
1541
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1542
- type: "checkbox",
1543
- checked: preferences.poolModels === void 0,
1544
- onChange: (event) => {
1545
- const next = { ...preferences };
1546
- if (event.target.checked) delete next.poolModels;
1547
- else next.poolModels = account.models.map((model) => model.id);
1548
- edit(account.key, next);
1549
- }
1502
+ " ",
1503
+ t("accountsModelsAutomatic")
1504
+ ] }),
1505
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1506
+ style: actions$1,
1507
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1508
+ type: "button",
1509
+ onClick: () => edit(account.key, {
1510
+ ...preferences,
1511
+ poolModels: models.map((model) => model.id)
1550
1512
  }),
1551
- " ",
1552
- t("accountsModelsAutomatic")
1553
- ] }),
1554
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1555
- style: actions$1,
1556
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1557
- type: "button",
1558
- onClick: () => edit(account.key, {
1559
- ...preferences,
1560
- poolModels: models.map((model) => model.id)
1561
- }),
1562
- children: t("modelsSelectAll")
1563
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1564
- type: "button",
1565
- onClick: () => edit(account.key, {
1566
- ...preferences,
1567
- poolModels: []
1513
+ children: t("modelsSelectAll")
1514
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1515
+ type: "button",
1516
+ onClick: () => edit(account.key, {
1517
+ ...preferences,
1518
+ poolModels: []
1519
+ }),
1520
+ children: t("modelsSelectNone")
1521
+ })]
1522
+ }),
1523
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1524
+ style: {
1525
+ ...stack$1,
1526
+ gap: 8,
1527
+ maxHeight: 240,
1528
+ overflowY: "auto"
1529
+ },
1530
+ children: [models.map((model) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
1531
+ style: { overflowWrap: "anywhere" },
1532
+ children: [
1533
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1534
+ type: "checkbox",
1535
+ checked: selected.has(model.id),
1536
+ onChange: (event) => {
1537
+ const next = new Set(selected);
1538
+ if (event.target.checked) next.add(model.id);
1539
+ else next.delete(model.id);
1540
+ edit(account.key, {
1541
+ ...preferences,
1542
+ poolModels: [...next]
1543
+ });
1544
+ }
1568
1545
  }),
1569
- children: t("modelsSelectNone")
1570
- })]
1571
- }),
1572
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1573
- style: {
1574
- ...stack$1,
1575
- gap: 8,
1576
- maxHeight: 240,
1577
- overflowY: "auto"
1578
- },
1579
- children: [models.map((model) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
1580
- style: { overflowWrap: "anywhere" },
1581
- children: [
1582
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1583
- type: "checkbox",
1584
- checked: selected.has(model.id),
1585
- onChange: (event) => {
1586
- const next = new Set(selected);
1587
- if (event.target.checked) next.add(model.id);
1588
- else next.delete(model.id);
1589
- edit(account.key, {
1590
- ...preferences,
1591
- poolModels: [...next]
1592
- });
1593
- }
1594
- }),
1595
- " ",
1596
- model.name,
1597
- model.unavailable && ` (${t("modelsUnavailable")})`
1598
- ]
1599
- }, model.id)), models.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1600
- className: "dsh-subscription-hint",
1601
- children: t("accountsNoModels")
1602
- })]
1603
- })
1604
- ]
1605
- })] })
1606
- ]
1607
- }, account.key);
1608
- })
1609
- ]
1546
+ " ",
1547
+ model.name,
1548
+ model.unavailable && ` (${t("modelsUnavailable")})`
1549
+ ]
1550
+ }, model.id)), models.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1551
+ className: "dsh-subscription-hint",
1552
+ children: t("accountsNoModels")
1553
+ })]
1554
+ })
1555
+ ]
1556
+ })] })
1557
+ ]
1558
+ }, account.key);
1559
+ })]
1610
1560
  }),
1611
- (provider !== "cursor-subscription" || (catalog?.accounts.length ?? 0) > 0) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProviderModelEditor, {
1561
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProviderModelEditor, {
1612
1562
  ref: editor,
1613
1563
  provider,
1614
1564
  rpc,
@@ -1703,7 +1653,7 @@ function ProviderAccountManager({ provider, name, rpc, t, onClose }) {
1703
1653
 
1704
1654
  //#endregion
1705
1655
  //#region src/client/subscription-card-styles.ts
1706
- /** Shared visual language for OAuth, Cursor, and built-in provider cards. */
1656
+ /** Shared visual language for OAuth and built-in provider cards. */
1707
1657
  const subscriptionCardStyles = {
1708
1658
  card: {
1709
1659
  border: "1px solid var(--dsw-alias-border-l2)",
@@ -2286,250 +2236,6 @@ function ExternalUsageCards({ rpc, t }) {
2286
2236
  }) });
2287
2237
  }
2288
2238
 
2289
- //#endregion
2290
- //#region src/client/CursorCard.tsx
2291
- function message$2(error) {
2292
- return error instanceof Error ? error.message : String(error);
2293
- }
2294
- /** Cursor's single connected account, rendered with the same card and Manage dialog as the other providers. */
2295
- function CursorCard({ rpc, t }) {
2296
- const [status, setStatus] = (0, react.useState)();
2297
- const [usage, setUsage] = (0, react.useState)();
2298
- const [observedAt, setObservedAt] = (0, react.useState)();
2299
- const [usageStale, setUsageStale] = (0, react.useState)(false);
2300
- const [authorizeUrl, setAuthorizeUrl] = (0, react.useState)();
2301
- const [error, setError] = (0, react.useState)();
2302
- const [loading, setLoading] = (0, react.useState)(false);
2303
- const [manage, setManage] = (0, react.useState)(false);
2304
- const authenticated = (0, react.useRef)();
2305
- const refreshStatus = (0, react.useCallback)(async () => {
2306
- try {
2307
- const value = await callSubscriptionsAuth(rpc, "cursorStatus", {});
2308
- setStatus(value);
2309
- if (authenticated.current !== value.authenticated) {
2310
- authenticated.current = value.authenticated;
2311
- window.dispatchEvent(new Event(USAGE_BADGE_REFRESH_EVENT));
2312
- }
2313
- if (value.authenticated) setAuthorizeUrl(void 0);
2314
- if (value.error) setError(value.error);
2315
- } catch (failure) {
2316
- setError(message$2(failure));
2317
- }
2318
- }, [rpc]);
2319
- const refreshUsage = (0, react.useCallback)(async () => {
2320
- setLoading(true);
2321
- try {
2322
- const value = await callSubscriptionsAuth(rpc, "cursorUsage", {});
2323
- setUsage(value);
2324
- setObservedAt(value.observedAt ?? Date.now());
2325
- setUsageStale(value.stale === true);
2326
- setError(void 0);
2327
- window.dispatchEvent(new Event(USAGE_BADGE_REFRESH_EVENT));
2328
- } catch (failure) {
2329
- setError(message$2(failure));
2330
- setUsageStale(true);
2331
- } finally {
2332
- setLoading(false);
2333
- }
2334
- }, [rpc]);
2335
- (0, react.useEffect)(() => {
2336
- refreshStatus();
2337
- }, [refreshStatus]);
2338
- (0, react.useEffect)(() => {
2339
- if (status?.busy !== true) return;
2340
- const timer = setInterval(() => {
2341
- refreshStatus();
2342
- }, 2e3);
2343
- return () => clearInterval(timer);
2344
- }, [status?.busy, refreshStatus]);
2345
- (0, react.useEffect)(() => {
2346
- if (status?.authenticated === true) refreshUsage();
2347
- }, [status?.authenticated, refreshUsage]);
2348
- const login = async () => {
2349
- setError(void 0);
2350
- try {
2351
- const value = await callSubscriptionsAuth(rpc, "cursorLogin", {});
2352
- setAuthorizeUrl(value.authorizeUrl);
2353
- window.open(value.authorizeUrl, "_blank", "noopener");
2354
- await refreshStatus();
2355
- } catch (failure) {
2356
- setError(message$2(failure));
2357
- }
2358
- };
2359
- const cancel = async () => {
2360
- try {
2361
- await callSubscriptionsAuth(rpc, "cursorCancel", {});
2362
- setAuthorizeUrl(void 0);
2363
- await refreshStatus();
2364
- } catch (failure) {
2365
- setError(message$2(failure));
2366
- }
2367
- };
2368
- const logout = async () => {
2369
- if (!window.confirm(t("logoutAccountConfirm", {
2370
- account: "Cursor",
2371
- provider: "Cursor"
2372
- }))) return;
2373
- try {
2374
- await callSubscriptionsAuth(rpc, "cursorLogout", {});
2375
- setUsage(void 0);
2376
- setObservedAt(void 0);
2377
- setUsageStale(false);
2378
- await refreshStatus();
2379
- } catch (failure) {
2380
- setError(message$2(failure));
2381
- }
2382
- };
2383
- const connected = status?.authenticated === true;
2384
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2385
- style: subscriptionCardStyles.card,
2386
- children: [
2387
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2388
- style: subscriptionCardStyles.header,
2389
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { style: {
2390
- ...subscriptionCardStyles.dot,
2391
- background: status?.busy ? "var(--dsw-alias-state-warn-label)" : connected ? "var(--dsw-alias-state-success-primary)" : "var(--dsw-alias-label-dimmed)"
2392
- } }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2393
- style: subscriptionCardStyles.name,
2394
- children: t("cursorTitle")
2395
- })]
2396
- }),
2397
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
2398
- style: subscriptionCardStyles.status,
2399
- children: status === void 0 ? t("checking") : status.busy ? t("loginInProgress") : connected ? t("loggedInCount", { count: 1 }) : t("notLoggedIn")
2400
- }),
2401
- error !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
2402
- style: subscriptionCardStyles.error,
2403
- children: error
2404
- }),
2405
- connected && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2406
- style: subscriptionCardStyles.account,
2407
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2408
- style: subscriptionCardStyles.accountHeader,
2409
- children: [
2410
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2411
- style: subscriptionCardStyles.defaultStar,
2412
- title: t("defaultBadge"),
2413
- children: "★"
2414
- }),
2415
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2416
- style: subscriptionCardStyles.accountName,
2417
- children: "Cursor"
2418
- }),
2419
- status.expiresAt !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2420
- style: subscriptionCardStyles.status,
2421
- children: t("accountExpires", { date: new Date(status.expiresAt).toLocaleString() })
2422
- }),
2423
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2424
- type: "button",
2425
- style: {
2426
- ...subscriptionCardStyles.button,
2427
- marginLeft: "auto",
2428
- flexShrink: 0
2429
- },
2430
- onClick: () => {
2431
- logout();
2432
- },
2433
- children: t("logout")
2434
- })
2435
- ]
2436
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2437
- style: subscriptionCardStyles.usage,
2438
- children: [
2439
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2440
- style: subscriptionCardStyles.usageHeader,
2441
- children: [
2442
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2443
- style: subscriptionCardStyles.usageTitle,
2444
- children: t("usageTitle")
2445
- }),
2446
- usage?.plan !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2447
- style: subscriptionCardStyles.status,
2448
- children: t("usagePlan", { plan: usage.plan })
2449
- }),
2450
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2451
- type: "button",
2452
- style: subscriptionCardStyles.usageRefresh,
2453
- disabled: loading,
2454
- onClick: () => {
2455
- refreshUsage();
2456
- },
2457
- children: t("usageRefresh")
2458
- })
2459
- ]
2460
- }),
2461
- loading && usage === void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
2462
- style: subscriptionCardStyles.status,
2463
- children: t("usageLoading")
2464
- }),
2465
- usage?.windows?.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
2466
- style: subscriptionCardStyles.status,
2467
- children: t("usageEmpty")
2468
- }),
2469
- usage?.windows?.map((window$1, index) => {
2470
- const percent = displayUsedPercent(window$1.usedPercent);
2471
- const label = window$1.scope === "Included" ? t("cursorIncluded") : window$1.scope === "Cursor Models" ? t("cursorModels") : window$1.scope === "Other Models" ? t("cursorOtherModels") : window$1.scope === "Included requests" ? t("cursorIncludedRequests") : window$1.scope ?? t("usageWindow");
2472
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2473
- style: subscriptionCardStyles.usageRow,
2474
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2475
- style: subscriptionCardStyles.usageMeta,
2476
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: label }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [percent === void 0 ? t("usageMeterInvalid") : `${percent}%`, window$1.resetsAt === void 0 ? "" : ` · ${t("usageResets", { date: new Date(window$1.resetsAt).toLocaleString() })}`] })]
2477
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UsageMeter, {
2478
- window: window$1,
2479
- t,
2480
- observedAt,
2481
- stale: usageStale
2482
- })]
2483
- }, index);
2484
- })
2485
- ]
2486
- })]
2487
- }),
2488
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2489
- style: subscriptionCardStyles.actions,
2490
- children: [
2491
- status?.authenticated === false && !status.busy && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2492
- type: "button",
2493
- style: subscriptionCardStyles.button,
2494
- onClick: () => {
2495
- login();
2496
- },
2497
- children: t("login")
2498
- }),
2499
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2500
- type: "button",
2501
- style: subscriptionCardStyles.button,
2502
- "aria-haspopup": "dialog",
2503
- onClick: () => setManage(true),
2504
- children: t("accountsManage")
2505
- }),
2506
- status?.busy === true && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2507
- type: "button",
2508
- style: subscriptionCardStyles.button,
2509
- onClick: () => {
2510
- cancel();
2511
- },
2512
- children: t("cancel")
2513
- })
2514
- ]
2515
- }),
2516
- status?.busy === true && authorizeUrl !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
2517
- href: authorizeUrl,
2518
- target: "_blank",
2519
- rel: "noopener noreferrer",
2520
- children: t("cursorOpenLogin")
2521
- }),
2522
- manage && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProviderAccountManager, {
2523
- provider: "cursor-subscription",
2524
- name: "Cursor",
2525
- rpc,
2526
- t,
2527
- onClose: () => setManage(false)
2528
- })
2529
- ]
2530
- });
2531
- }
2532
-
2533
2239
  //#endregion
2534
2240
  //#region src/client/ollama-draft.ts
2535
2241
  /**
@@ -3646,15 +3352,15 @@ function showsResetCredits(provider, credits) {
3646
3352
  return (credits?.length ?? 0) > 0;
3647
3353
  }
3648
3354
  /** The error line the settings card mounts. Claude never interpolates provider text. */
3649
- function ResetCreditsErrorLine({ provider, message: message$3, t }) {
3355
+ function ResetCreditsErrorLine({ provider, message: message$2, t }) {
3650
3356
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
3651
3357
  style: subscriptionCardStyles.error,
3652
- children: resetCreditsErrorText(provider, message$3, t)
3358
+ children: resetCreditsErrorText(provider, message$2, t)
3653
3359
  });
3654
3360
  }
3655
3361
  /** Fixed sentence for Claude. Codex may include the lookup message; Claude must not. */
3656
- function resetCreditsErrorText(provider, message$3, t) {
3657
- return provider === "claude" ? t("resetCreditsErrorFixed") : t("resetCreditsError", { message: message$3 });
3362
+ function resetCreditsErrorText(provider, message$2, t) {
3363
+ return provider === "claude" ? t("resetCreditsErrorFixed") : t("resetCreditsError", { message: message$2 });
3658
3364
  }
3659
3365
  const summaryStyle = {
3660
3366
  ...subscriptionCardStyles.usageMeta,
@@ -4190,12 +3896,12 @@ function SubscriptionsSection(props) {
4190
3896
  const usageInflightRef = (0, react.useRef)(/* @__PURE__ */ new Map());
4191
3897
  const usageRosterSignatureRef = (0, react.useRef)();
4192
3898
  const [managedProvider, setManagedProvider] = (0, react.useState)();
4193
- const setProviderError = (0, react.useCallback)((provider, message$3) => {
3899
+ const setProviderError = (0, react.useCallback)((provider, message$2) => {
4194
3900
  if (!mountedRef.current) return;
4195
3901
  setErrors((prev) => {
4196
3902
  const next = { ...prev };
4197
- if (message$3 === void 0) delete next[provider];
4198
- else next[provider] = message$3;
3903
+ if (message$2 === void 0) delete next[provider];
3904
+ else next[provider] = message$2;
4199
3905
  return next;
4200
3906
  });
4201
3907
  }, []);
@@ -4213,8 +3919,8 @@ function SubscriptionsSection(props) {
4213
3919
  try {
4214
3920
  response = await callSubscriptionsAuth(rpc, "status", {});
4215
3921
  } catch (error) {
4216
- const message$3 = error instanceof Error ? error.message : String(error);
4217
- for (const { id } of PROVIDERS) setProviderError(id, message$3);
3922
+ const message$2 = error instanceof Error ? error.message : String(error);
3923
+ for (const { id } of PROVIDERS) setProviderError(id, message$2);
4218
3924
  return;
4219
3925
  }
4220
3926
  if (!mountedRef.current) return;
@@ -4786,10 +4492,6 @@ function SubscriptionsSection(props) {
4786
4492
  ]
4787
4493
  }, id);
4788
4494
  }),
4789
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CursorCard, {
4790
- rpc,
4791
- t
4792
- }),
4793
4495
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OllamaCard, {
4794
4496
  rpc,
4795
4497
  t
@@ -6042,7 +5744,6 @@ const PROVIDER_NAMES = {
6042
5744
  grok: "Grok",
6043
5745
  copilot: "Copilot",
6044
5746
  antigravity: "Antigravity",
6045
- "cursor-subscription": "Cursor",
6046
5747
  "opencode-go": "OpenCode Go",
6047
5748
  "kimi-coding": "Kimi Code",
6048
5749
  minimax: "MiniMax",
@@ -6089,11 +5790,7 @@ function groupUsageDisplays(roster, windowsOf, plans) {
6089
5790
  }
6090
5791
  /** Read each account source independently so a failing endpoint cannot hide the others. */
6091
5792
  async function loadBadgeRoster(rpc) {
6092
- const [subscriptions, cursor, external] = await Promise.allSettled([
6093
- callSubscriptionsAuth(rpc, "status", {}),
6094
- callSubscriptionsAuth(rpc, "cursorStatus", {}),
6095
- callSubscriptionsAuth(rpc, "externalStatus", {})
6096
- ]);
5793
+ const [subscriptions, external] = await Promise.allSettled([callSubscriptionsAuth(rpc, "status", {}), callSubscriptionsAuth(rpc, "externalStatus", {})]);
6097
5794
  const roster = [];
6098
5795
  const refreshed = /* @__PURE__ */ new Set();
6099
5796
  if (subscriptions.status === "fulfilled") for (const provider of [
@@ -6109,16 +5806,6 @@ async function loadBadgeRoster(rpc) {
6109
5806
  account
6110
5807
  });
6111
5808
  }
6112
- if (cursor.status === "fulfilled") {
6113
- refreshed.add("cursor-subscription");
6114
- if (cursor.value.authenticated) roster.push({
6115
- provider: "cursor-subscription",
6116
- account: {
6117
- key: "cursor",
6118
- isDefault: true
6119
- }
6120
- });
6121
- }
6122
5809
  if (external.status === "fulfilled") for (const [source, provider] of [
6123
5810
  ["opencode-go", "opencode-go"],
6124
5811
  ["kimi-code", "kimi-coding"],
@@ -6141,7 +5828,6 @@ async function loadBadgeRoster(rpc) {
6141
5828
  };
6142
5829
  }
6143
5830
  async function usageOf(rpc, { provider, account }) {
6144
- if (provider === "cursor-subscription") return callSubscriptionsAuth(rpc, "cursorUsage", {});
6145
5831
  if (provider === "opencode-go" || provider === "kimi-coding" || provider === "minimax" || provider === "minimax-cn" || provider === "ollama-cloud") return callSubscriptionsAuth(rpc, "externalUsage", { source: provider === "kimi-coding" ? "kimi-code" : provider });
6146
5832
  return callSubscriptionsAuth(rpc, "usage", {
6147
5833
  provider,