@goodandready/dsh-subscriptions 0.7.48 → 0.7.49
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/account-features.js +4 -0
- package/lib/adapter.js +9 -5
- package/lib/client.js +12 -0
- package/lib/client.panels.js +30 -3
- package/package.json +1 -1
package/lib/account-features.js
CHANGED
|
@@ -69,6 +69,10 @@ export function createUsageLoader({ load } = {}) {
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
export function supportsFastTier(model) {
|
|
73
|
+
return /(?:^|[-_.])(gpt-5|gpt-6|codex|o3|o4)(?:[-_.]|$)/i.test(String(model || ''))
|
|
74
|
+
}
|
|
75
|
+
|
|
72
76
|
/** #802: explicit child choice > subagent default > session choice > global. */
|
|
73
77
|
export function resolveSpeed({ childSpeed, sessionSpeed, subagentSpeed, modelSupportsFast = true } = {}) {
|
|
74
78
|
const pick = [childSpeed, subagentSpeed, sessionSpeed].find((value) => value === 'standard' || value === 'fast')
|
package/lib/adapter.js
CHANGED
|
@@ -6,7 +6,7 @@ import { LlmAdapter, LlmError, attributionHeaders } from '@deepseek-ai/dsh-llm'
|
|
|
6
6
|
import { displayName } from './refs.js'
|
|
7
7
|
import { applyModelSettings, bestAccountPlan } from './model-settings.js'
|
|
8
8
|
import { getSpeedMode } from './speed-mode.js'
|
|
9
|
-
import { resolveSpeed } from './account-features.js'
|
|
9
|
+
import { resolveSpeed, supportsFastTier } from './account-features.js'
|
|
10
10
|
import { getVendor } from './vendors/index.js'
|
|
11
11
|
import { modelCatalog } from './messages.js'
|
|
12
12
|
import { streamWithRotation } from './stream-rotate.js'
|
|
@@ -204,13 +204,17 @@ export class SubscriptionAdapter extends LlmAdapter {
|
|
|
204
204
|
}
|
|
205
205
|
const poolEnabled = typeof deps.poolEnabled === 'function' ? deps.poolEnabled() !== false : true
|
|
206
206
|
const defaultRef = typeof deps.defaultAccountRef === 'function' ? deps.defaultAccountRef(provider) : null
|
|
207
|
-
const
|
|
208
|
-
|
|
209
|
-
...(provider === 'codex' && resolveSpeed({
|
|
207
|
+
const effectiveSpeed = provider === 'codex'
|
|
208
|
+
? resolveSpeed({
|
|
210
209
|
childSpeed: options.speed,
|
|
211
210
|
sessionSpeed: getSpeedMode(sessionId),
|
|
212
211
|
subagentSpeed: (options.subagent || options.parentSessionId) && typeof deps.subagentSpeed === 'function' ? deps.subagentSpeed() : undefined,
|
|
213
|
-
|
|
212
|
+
modelSupportsFast: supportsFastTier(options.model),
|
|
213
|
+
})
|
|
214
|
+
: 'standard'
|
|
215
|
+
const streamOptions = {
|
|
216
|
+
...hydratedOptions,
|
|
217
|
+
...(provider === 'codex' && effectiveSpeed === 'fast' ? { service_tier: 'priority' } : {}),
|
|
214
218
|
...(effectiveReasoning.effort ? { reasoningEffort: effectiveReasoning.effort } : {}),
|
|
215
219
|
...(effectiveReasoning.budgetTokens ? { thinkingBudget: effectiveReasoning.budgetTokens } : {}),
|
|
216
220
|
// #830: kill switch. With no default account, use a sentinel that
|
package/lib/client.js
CHANGED
|
@@ -1089,6 +1089,7 @@ window.__ModuleLoader__.load({
|
|
|
1089
1089
|
const ProviderPacksPanel = lazyPanel('ProviderPacksPanel')
|
|
1090
1090
|
const SourcesPanel = lazyPanel('SourcesPanel')
|
|
1091
1091
|
const AccountsDashboardPanel = lazyPanel('AccountsDashboardPanel')
|
|
1092
|
+
const SpeedToggle = lazyPanel('SpeedToggle')
|
|
1092
1093
|
|
|
1093
1094
|
// #839 model-list helpers
|
|
1094
1095
|
function modelListSearchText(model) {
|
|
@@ -3900,6 +3901,17 @@ h('div', { className: 'dsub-row' },
|
|
|
3900
3901
|
}, 'dsh-subscriptions: locales')
|
|
3901
3902
|
setT(ctx.locale.bind(NS))
|
|
3902
3903
|
|
|
3904
|
+
ctx.effect(() => {
|
|
3905
|
+
if (!ctx.slots || typeof ctx.slots.inject !== 'function') return () => {}
|
|
3906
|
+
return ctx.slots.inject('conversation.input.right', () => ctx.slots.register({
|
|
3907
|
+
name: 'conversation.input.right',
|
|
3908
|
+
id: 'subscriptions-speed',
|
|
3909
|
+
order: 50,
|
|
3910
|
+
locale: NS,
|
|
3911
|
+
inject: () => ({}),
|
|
3912
|
+
}, SpeedToggle))
|
|
3913
|
+
}, 'dsh-subscriptions: composer speed toggle')
|
|
3914
|
+
|
|
3903
3915
|
ctx.effect(() => {
|
|
3904
3916
|
const cleanups = []
|
|
3905
3917
|
const registerLegacySeats = () => {
|
package/lib/client.panels.js
CHANGED
|
@@ -280,8 +280,8 @@ window.__ModuleLoader__.load({
|
|
|
280
280
|
h('div', { className: 'dsub-row' },
|
|
281
281
|
h('span', { className: 'dsub-h' }, '#' + row.index + ' ' + (row.label || row.email || row.ref)),
|
|
282
282
|
h('span', { className: 'dsub-pillTag' }, row.quarantineUntil > Date.now() ? t('statusQuarantined') : (row.cooldownUntil > Date.now() ? t('statusCooling') : t('statusHealthy')))),
|
|
283
|
-
h('div', { className: 'dsub-sub' }, t('quotaUsed') + ': ' + (row.usagePercent == null ? '—' : row.usagePercent + '%') + ' · ' + t('requests') + ' ' + (row.requests || 0) + ' · ' + t('errors') + ' ' + (row.errors || 0)),
|
|
284
|
-
h('div', { className: 'dsub-row' },
|
|
283
|
+
compact ? null : h('div', { className: 'dsub-sub' }, t('quotaUsed') + ': ' + (row.usagePercent == null ? '—' : row.usagePercent + '%') + ' · ' + t('requests') + ' ' + (row.requests || 0) + ' · ' + t('errors') + ' ' + (row.errors || 0)),
|
|
284
|
+
compact ? null : h('div', { className: 'dsub-row' },
|
|
285
285
|
h('button', { type: 'button', className: 'dsub-mini', onClick: () => loadUsage(row) }, u && u.loading ? '…' : t('loadUsage')),
|
|
286
286
|
u && u.error ? h('span', { className: 'dsub-bad' }, u.error) : null,
|
|
287
287
|
u && u.value ? h('span', { className: 'dsub-dim' }, JSON.stringify(u.value).slice(0, 180)) : null),
|
|
@@ -337,6 +337,33 @@ window.__ModuleLoader__.load({
|
|
|
337
337
|
)
|
|
338
338
|
}
|
|
339
339
|
|
|
340
|
-
|
|
340
|
+
// #802: composer Speed toggle, scoped to the current session.
|
|
341
|
+
function SpeedToggle(props) {
|
|
342
|
+
const sessionId = (props && (props.sessionId || (props.session && props.session.id))) || 'default'
|
|
343
|
+
const [mode, setMode] = React.useState('standard')
|
|
344
|
+
React.useEffect(() => {
|
|
345
|
+
fetch('/dsh-subscriptions/speed?sessionId=' + encodeURIComponent(sessionId), { cache: 'no-store' })
|
|
346
|
+
.then((res) => res.json())
|
|
347
|
+
.then((out) => setMode((out && out.mode) || 'standard'))
|
|
348
|
+
.catch(() => {})
|
|
349
|
+
}, [sessionId])
|
|
350
|
+
const toggle = () => {
|
|
351
|
+
const next = mode === 'fast' ? 'standard' : 'fast'
|
|
352
|
+
setMode(next)
|
|
353
|
+
fetch('/dsh-subscriptions/speed', {
|
|
354
|
+
method: 'POST',
|
|
355
|
+
headers: { 'content-type': 'application/json' },
|
|
356
|
+
body: JSON.stringify({ sessionId, mode: next }),
|
|
357
|
+
}).then((res) => res.json()).then((out) => { if (out && out.mode) setMode(out.mode) }).catch(() => {})
|
|
358
|
+
}
|
|
359
|
+
return h('button', {
|
|
360
|
+
type: 'button',
|
|
361
|
+
className: 'dsub-mini',
|
|
362
|
+
title: 'Codex Speed',
|
|
363
|
+
onClick: toggle,
|
|
364
|
+
}, mode === 'fast' ? '⚡ FAST' : 'Speed')
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
return { WebhookTestButton, VaultSnapshotsPanel, ProviderPacksPanel, SourcesPanel, AccountsDashboardPanel, SpeedToggle }
|
|
341
368
|
}
|
|
342
369
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goodandready/dsh-subscriptions",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.49",
|
|
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",
|