dsh-plugin-subscription-oauth 0.11.0 → 0.12.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.
- package/lib/auth/mimo-flow.d.ts +9 -0
- package/lib/auth/mimo-flow.js +171 -0
- package/lib/auth/registry.d.ts +10 -1
- package/lib/auth/registry.js +11 -1
- package/lib/auth/rpc.js +6 -0
- package/lib/client/SubscriptionsSection.js +37 -17
- package/lib/client.js +108 -135
- package/lib/client.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/protocol.d.ts +13 -1
- package/lib/protocol.js +1 -0
- package/lib/providers/auto.js +3 -0
- package/lib/providers/grok.d.ts +2 -0
- package/lib/providers/grok.js +31 -21
- package/lib/providers/kimi-provider.js +2 -1
- package/lib/providers/kimi.js +18 -13
- package/lib/providers/mimo.d.ts +10 -0
- package/lib/providers/mimo.js +65 -1
- package/lib/settings.d.ts +8 -0
- package/lib/settings.js +19 -5
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -936,7 +936,16 @@ const styles = {
|
|
|
936
936
|
height: 8,
|
|
937
937
|
borderRadius: "50%",
|
|
938
938
|
flexShrink: 0,
|
|
939
|
-
|
|
939
|
+
border: "1.5px solid var(--dsw-alias-label-dimmed)",
|
|
940
|
+
background: "transparent"
|
|
941
|
+
},
|
|
942
|
+
dotLive: {
|
|
943
|
+
borderColor: "var(--dsw-alias-state-success-primary, #067647)",
|
|
944
|
+
background: "var(--dsw-alias-state-success-primary, #067647)"
|
|
945
|
+
},
|
|
946
|
+
dotBusy: {
|
|
947
|
+
borderColor: "var(--dsw-alias-state-warn-primary, #f5a524)",
|
|
948
|
+
background: "var(--dsw-alias-state-warn-primary, #f5a524)"
|
|
940
949
|
},
|
|
941
950
|
name: {
|
|
942
951
|
fontWeight: 600,
|
|
@@ -944,15 +953,6 @@ const styles = {
|
|
|
944
953
|
lineHeight: "22px",
|
|
945
954
|
color: "var(--dsw-alias-label-primary)"
|
|
946
955
|
},
|
|
947
|
-
providerId: {
|
|
948
|
-
fontSize: 11,
|
|
949
|
-
lineHeight: "16px",
|
|
950
|
-
color: "var(--dsw-alias-label-dimmed)",
|
|
951
|
-
padding: "1px 6px",
|
|
952
|
-
borderRadius: 999,
|
|
953
|
-
background: "var(--dsw-alias-bg-layer-3, var(--dsw-alias-bg-layer-1))",
|
|
954
|
-
fontFamily: "monospace"
|
|
955
|
-
},
|
|
956
956
|
statusLine: {
|
|
957
957
|
margin: 0,
|
|
958
958
|
fontSize: 12,
|
|
@@ -1183,6 +1183,12 @@ const styles = {
|
|
|
1183
1183
|
background: "var(--dsw-alias-bg-layer-1)",
|
|
1184
1184
|
border: "0.5px solid var(--dsw-alias-border-l2)"
|
|
1185
1185
|
},
|
|
1186
|
+
usageInline: {
|
|
1187
|
+
display: "flex",
|
|
1188
|
+
flexDirection: "column",
|
|
1189
|
+
gap: 6,
|
|
1190
|
+
marginTop: 4
|
|
1191
|
+
},
|
|
1186
1192
|
modelRow: {
|
|
1187
1193
|
display: "flex",
|
|
1188
1194
|
alignItems: "flex-start",
|
|
@@ -1291,11 +1297,11 @@ const styles = {
|
|
|
1291
1297
|
},
|
|
1292
1298
|
divider: { borderTop: "0.5px solid var(--dsw-alias-border-l2)" }
|
|
1293
1299
|
};
|
|
1294
|
-
/** Status dot
|
|
1295
|
-
function
|
|
1296
|
-
if (status.busy) return
|
|
1297
|
-
if (status.loggedIn) return
|
|
1298
|
-
return
|
|
1300
|
+
/** Status dot style for one provider's connection state. */
|
|
1301
|
+
function dotStyle(status) {
|
|
1302
|
+
if (status.busy) return styles.dotBusy;
|
|
1303
|
+
if (status.loggedIn) return styles.dotLive;
|
|
1304
|
+
return {};
|
|
1299
1305
|
}
|
|
1300
1306
|
/** Localized label for one provider-owned detail row. */
|
|
1301
1307
|
function detailLabel(t, row) {
|
|
@@ -1313,70 +1319,38 @@ function windowAmount(window$1) {
|
|
|
1313
1319
|
if (window$1.used !== void 0 && window$1.limit !== void 0) return `${String(window$1.used)}/${String(window$1.limit)}`;
|
|
1314
1320
|
return "—";
|
|
1315
1321
|
}
|
|
1316
|
-
/** One account's
|
|
1317
|
-
function
|
|
1318
|
-
const {
|
|
1322
|
+
/** One account's metered windows, rendered under its account row. */
|
|
1323
|
+
function AccountUsage(props) {
|
|
1324
|
+
const { entry, t } = props;
|
|
1325
|
+
if (entry === void 0) return null;
|
|
1319
1326
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1320
|
-
style: styles.
|
|
1321
|
-
children: [
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1327
|
+
style: styles.usageInline,
|
|
1328
|
+
children: [entry.windows.map((window$1) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1329
|
+
style: styles.usageRow,
|
|
1330
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1331
|
+
style: styles.usageLine,
|
|
1332
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
1333
|
+
style: styles.modelName,
|
|
1334
|
+
children: [
|
|
1335
|
+
windowLabel(t, window$1),
|
|
1336
|
+
" · ",
|
|
1337
|
+
windowAmount(window$1)
|
|
1338
|
+
]
|
|
1339
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1340
|
+
style: styles.modelMeta,
|
|
1341
|
+
children: window$1.resetsAt === void 0 ? "" : formatReset$1(window$1.resetsAt, t)
|
|
1334
1342
|
})]
|
|
1335
|
-
}),
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1347
|
-
style: styles.usageLine,
|
|
1348
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
1349
|
-
style: styles.modelMeta,
|
|
1350
|
-
children: [entry.plan === void 0 ? entry.account : t("usagePlan", { plan: entry.plan }), entry.renewsAt === void 0 ? "" : ` · ${t("usageRenews", { time: formatTime(entry.renewsAt) })}`]
|
|
1351
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1352
|
-
style: styles.modelMeta,
|
|
1353
|
-
children: t("usageFetched", { time: formatTime(entry.fetchedAt) })
|
|
1354
|
-
})]
|
|
1355
|
-
}), entry.windows.map((window$1) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1356
|
-
style: styles.usageRow,
|
|
1357
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1358
|
-
style: styles.usageLine,
|
|
1359
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
1360
|
-
style: styles.modelName,
|
|
1361
|
-
children: [
|
|
1362
|
-
windowLabel(t, window$1),
|
|
1363
|
-
" · ",
|
|
1364
|
-
windowAmount(window$1)
|
|
1365
|
-
]
|
|
1366
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1367
|
-
style: styles.modelMeta,
|
|
1368
|
-
children: window$1.resetsAt === void 0 ? "" : formatReset$1(window$1.resetsAt, t)
|
|
1369
|
-
})]
|
|
1370
|
-
}), window$1.usedPercent !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1371
|
-
className: "dsh-subscription-meter",
|
|
1372
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1373
|
-
style: { width: `${String(Math.min(100, Math.max(0, window$1.usedPercent)))}%` },
|
|
1374
|
-
"data-exhausted": window$1.usedPercent >= 90 ? "true" : "false"
|
|
1375
|
-
})
|
|
1376
|
-
})]
|
|
1377
|
-
}, `${entry.account}-${window$1.label}`))]
|
|
1378
|
-
}, entry.account))
|
|
1379
|
-
]
|
|
1343
|
+
}), window$1.usedPercent !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1344
|
+
className: "dsh-subscription-meter",
|
|
1345
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1346
|
+
style: { width: `${String(Math.min(100, Math.max(0, window$1.usedPercent)))}%` },
|
|
1347
|
+
"data-exhausted": window$1.usedPercent >= 90 ? "true" : "false"
|
|
1348
|
+
})
|
|
1349
|
+
})]
|
|
1350
|
+
}, `${entry.account}-${window$1.label}`)), entry.windows.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1351
|
+
style: styles.statusLine,
|
|
1352
|
+
children: t("usageNone")
|
|
1353
|
+
})]
|
|
1380
1354
|
});
|
|
1381
1355
|
}
|
|
1382
1356
|
/** The pending-login block: a device code, or a link to the sign-in page. */
|
|
@@ -1601,7 +1575,7 @@ function ProviderCard(props) {
|
|
|
1601
1575
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1602
1576
|
style: {
|
|
1603
1577
|
...styles.dot,
|
|
1604
|
-
|
|
1578
|
+
...dotStyle(status)
|
|
1605
1579
|
},
|
|
1606
1580
|
"aria-hidden": "true"
|
|
1607
1581
|
}),
|
|
@@ -1609,10 +1583,6 @@ function ProviderCard(props) {
|
|
|
1609
1583
|
style: styles.name,
|
|
1610
1584
|
children: status.displayName
|
|
1611
1585
|
}),
|
|
1612
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1613
|
-
style: styles.providerId,
|
|
1614
|
-
children: status.provider
|
|
1615
|
-
}),
|
|
1616
1586
|
status.loggedIn && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1617
1587
|
style: styles.badgeDefault,
|
|
1618
1588
|
children: t("badgeLive")
|
|
@@ -1658,52 +1628,62 @@ function ProviderCard(props) {
|
|
|
1658
1628
|
className: "dsh-subscription-success",
|
|
1659
1629
|
children: message.text
|
|
1660
1630
|
}),
|
|
1661
|
-
accounts.map((account) =>
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
style: styles.
|
|
1665
|
-
children: [
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1631
|
+
accounts.map((account) => {
|
|
1632
|
+
const usageEntry = (status.usage ?? []).find((entry) => entry.account === account.account);
|
|
1633
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1634
|
+
style: styles.accountRow,
|
|
1635
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1636
|
+
style: styles.accountHeader,
|
|
1637
|
+
children: [
|
|
1638
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1639
|
+
type: "button",
|
|
1640
|
+
style: styles.starButton,
|
|
1641
|
+
title: account.isDefault ? t("defaultBadge") : t("makeDefault"),
|
|
1642
|
+
"aria-label": account.isDefault ? t("defaultBadge") : t("makeDefault"),
|
|
1643
|
+
disabled: busyAction || account.isDefault,
|
|
1644
|
+
onClick: () => {
|
|
1645
|
+
props.onSetDefault(account.account);
|
|
1646
|
+
},
|
|
1647
|
+
children: account.isDefault ? "★" : "☆"
|
|
1648
|
+
}),
|
|
1649
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1650
|
+
style: styles.accountName,
|
|
1651
|
+
children: account.label
|
|
1652
|
+
}),
|
|
1653
|
+
account.isDefault && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1654
|
+
style: styles.badgeDefault,
|
|
1655
|
+
children: t("defaultBadge")
|
|
1656
|
+
}),
|
|
1657
|
+
account.needsLogin === true && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1658
|
+
style: styles.badgeWarn,
|
|
1659
|
+
title: t("accountNeedsLoginHint"),
|
|
1660
|
+
children: t("accountNeedsLogin")
|
|
1661
|
+
}),
|
|
1662
|
+
usageEntry?.plan !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1663
|
+
style: styles.badge,
|
|
1664
|
+
children: t("usagePlan", { plan: usageEntry.plan })
|
|
1665
|
+
}),
|
|
1666
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1667
|
+
style: styles.statusLine,
|
|
1668
|
+
children: account.expired ? t("accountExpired") : t("accountExpires", { time: formatTime(account.expiresAt) })
|
|
1669
|
+
}),
|
|
1670
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1671
|
+
type: "button",
|
|
1672
|
+
className: "dsh-subscription-quiet",
|
|
1673
|
+
style: styles.pushRight,
|
|
1674
|
+
disabled: busyAction,
|
|
1675
|
+
onClick: () => {
|
|
1676
|
+
props.onLogout(account.account);
|
|
1677
|
+
},
|
|
1678
|
+
children: t("logout")
|
|
1679
|
+
})
|
|
1680
|
+
]
|
|
1681
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AccountUsage, {
|
|
1682
|
+
entry: usageEntry,
|
|
1683
|
+
t
|
|
1684
|
+
})]
|
|
1685
|
+
}, account.account);
|
|
1686
|
+
}),
|
|
1707
1687
|
status.loggedIn && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1708
1688
|
style: styles.catalog,
|
|
1709
1689
|
children: [
|
|
@@ -1894,13 +1874,6 @@ function ProviderCard(props) {
|
|
|
1894
1874
|
})
|
|
1895
1875
|
]
|
|
1896
1876
|
}),
|
|
1897
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(UsageBlock, {
|
|
1898
|
-
usage: status.usage ?? [],
|
|
1899
|
-
...status.usageError === void 0 ? {} : { error: status.usageError },
|
|
1900
|
-
t,
|
|
1901
|
-
busyAction,
|
|
1902
|
-
onRefresh: props.onRefreshUsage
|
|
1903
|
-
}),
|
|
1904
1877
|
connectable && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1905
1878
|
style: styles.actions,
|
|
1906
1879
|
children: [
|