@goodandready/dsh-subscriptions 0.7.4 → 0.7.5

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.
@@ -57,6 +57,18 @@ export async function readKeyRotationStatus({ baseUrl, path = KEY_ROTATION_STATU
57
57
  }
58
58
  }
59
59
 
60
+ export function subscriptionCandidate(row) {
61
+ const value = row && typeof row === 'object' ? row : {}
62
+ return {
63
+ provider: value.provider,
64
+ index: value.index,
65
+ label: value.label || null,
66
+ loggedIn: Boolean(value.configured ?? value.hasToken),
67
+ usagePercent: value.usagePercent == null ? null : Number(value.usagePercent),
68
+ cooldownUntil: value.cooldownUntil == null ? null : Number(value.cooldownUntil),
69
+ }
70
+ }
71
+
60
72
  const SOURCE_ORDER = ['oauth', 'api-key', 'ollama']
61
73
 
62
74
  export function buildSourceChain({ subscriptions = [], keyRotation = null, ollama = { available: false } } = {}) {
@@ -1,5 +1,5 @@
1
1
  import { isTrustedSettingsRequest, safeJsonHandler, writeJson } from '../http.js'
2
- import { buildSourceChain, readKeyRotationStatus } from '../key-rotation-bridge.js'
2
+ import { buildSourceChain, readKeyRotationStatus, subscriptionCandidate } from '../key-rotation-bridge.js'
3
3
 
4
4
  export function registerSourcesRoutes(ctx, state) {
5
5
  const { accountsView, live } = state
@@ -19,14 +19,7 @@ export function registerSourcesRoutes(ctx, state) {
19
19
  let subscriptions = []
20
20
  try {
21
21
  const rows = await accountsView()
22
- subscriptions = (rows || []).map((row) => ({
23
- provider: row.provider,
24
- index: row.index,
25
- label: row.label,
26
- loggedIn: Boolean(row.hasToken),
27
- usagePercent: row.usagePercent,
28
- cooldownUntil: row.cooldownUntil,
29
- }))
22
+ subscriptions = (rows || []).map(subscriptionCandidate)
30
23
  } catch { /* keep the chain available */ }
31
24
  const port = req.socket && req.socket.localPort
32
25
  const keyRotation = port
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goodandready/dsh-subscriptions",
3
- "version": "0.7.4",
3
+ "version": "0.7.5",
4
4
  "description": "Use ChatGPT Codex, Claude, Grok, Antigravity, Kimi, GLM, Cursor, Kiro, Copilot, Qwen, ERNIE, Spark, JetBrains, Perplexity, Replit, and Cody subscriptions as DeepSeek Harness LLM providers via OAuth.",
5
5
  "license": "MIT",
6
6
  "type": "module",