@prestyj/core 5.24.0 → 5.25.1
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/dist/{chunk-SQLBQOQH.js → chunk-THUBQC6I.js} +162 -53
- package/dist/chunk-THUBQC6I.js.map +1 -0
- package/dist/index.cjs +169 -58
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +30 -4
- package/dist/index.d.ts +30 -4
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/model-registry.cjs +66 -43
- package/dist/model-registry.cjs.map +1 -1
- package/dist/model-registry.d.cts +3 -3
- package/dist/model-registry.d.ts +3 -3
- package/dist/model-registry.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-SQLBQOQH.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -168,13 +168,39 @@ declare function closeLogger(opts?: {
|
|
|
168
168
|
*/
|
|
169
169
|
declare function withFileLock<T>(filePath: string, fn: () => Promise<T>): Promise<T>;
|
|
170
170
|
|
|
171
|
+
/**
|
|
172
|
+
* Compare two dotted version strings numerically.
|
|
173
|
+
*
|
|
174
|
+
* Returns >0 when `a` is newer, <0 when older, 0 when equal. Segment-wise
|
|
175
|
+
* numeric comparison matters here: Claude Code is deep into 2.1.x, where a
|
|
176
|
+
* lexical compare puts "2.1.9" above "2.1.280" and would happily serve a UA
|
|
177
|
+
* that Anthropic rejects.
|
|
178
|
+
*/
|
|
179
|
+
declare function compareClaudeCodeVersions(a: string, b: string): number;
|
|
171
180
|
/**
|
|
172
181
|
* Resolve the current Claude Code release version for spoofing the claude-cli
|
|
173
|
-
* User-Agent on OAuth and inference requests.
|
|
174
|
-
*
|
|
175
|
-
*
|
|
182
|
+
* User-Agent on OAuth and inference requests.
|
|
183
|
+
*
|
|
184
|
+
* A cached value under an hour old is served straight away. An older one is
|
|
185
|
+
* still served immediately — the hot path never waits on npm — but triggers a
|
|
186
|
+
* background refresh, so a client-version gate on a newly released model costs
|
|
187
|
+
* at most one request instead of a full day of lockout. Past 24h the cache is
|
|
188
|
+
* refreshed synchronously, and only falls back to the stale value (then the
|
|
189
|
+
* bundled constant) if npm cannot be reached at all.
|
|
176
190
|
*/
|
|
177
191
|
declare function getClaudeCodeVersion(): Promise<string>;
|
|
192
|
+
/**
|
|
193
|
+
* Learn the minimum client version from a provider rejection.
|
|
194
|
+
*
|
|
195
|
+
* Anthropic gates newly released models on a minimum Claude Code version and
|
|
196
|
+
* names it in the error ("version 2.1.280 or newer is required"). That message
|
|
197
|
+
* is authoritative — more current than the npm registry can be at launch — so
|
|
198
|
+
* we pin it as a floor, persist it, and drop the memoised value. The next
|
|
199
|
+
* request builds its User-Agent from the floor and succeeds.
|
|
200
|
+
*
|
|
201
|
+
* Returns the newly applied floor, or null when the error is unrelated.
|
|
202
|
+
*/
|
|
203
|
+
declare function recordRequiredClaudeCodeVersion(message: string): string | null;
|
|
178
204
|
/** Build the User-Agent string Anthropic's OAuth + inference edges expect. */
|
|
179
205
|
declare function getClaudeCliUserAgent(): Promise<string>;
|
|
180
206
|
|
|
@@ -752,4 +778,4 @@ interface AutoUpdater {
|
|
|
752
778
|
}
|
|
753
779
|
declare function createAutoUpdater(config: AutoUpdateConfig): AutoUpdater;
|
|
754
780
|
|
|
755
|
-
export { AuthStorage, type AutoUpdateConfig, type AutoUpdater, DEFAULT_LOCAL_ENDPOINTS, type DiscoverOptions, type DiscoveryResult, type DualAuthProvider, FALLBACK_CONTEXT_WINDOW, type InlineButton, LOCAL_API_KEY_PLACEHOLDER, LOCAL_AUTH_KEY_PREFIX, type LocalEndpoint, type LocalEndpointKind, type LocalEndpointProbe, type LocalModel, type LogLevel, MOONSHOT_OAUTH_KEY, ModelInfo, NotLoggedInError, type OAuthCredentials, type OAuthLoginCallbacks, PLAN_MODE_THINKING_CAP, type ProbeOptions, type ProgressCallback, SubscriptionUsageError, type SubscriptionUsageProvider, type SubscriptionUsageSnapshot, type SubscriptionUsageWindow, TelegramBot, type TelegramConfig, type TelegramMessage, type TelegramUpdate, type TelegramVoiceMessage, XAI_OAUTH_KEY, XIAOMI_CREDITS_KEY, clampThinkingForPlanMode, clearLocalDiscoveryCache, closeLogger, createAutoUpdater, decodeOggOpus, discoverLocalModels, downmixToMono, dualAuthProvider, dualAuthProviderByOAuthKey, endpointRoot, fetchSubscriptionUsage, findProbedModel, formatLocalModelId, generatePKCE, getClaudeCliUserAgent, getClaudeCodeVersion, getNextThinkingLevel, getSessionId, getSupportedThinkingLevels, grokCliBaseUrl, grokCliHeaders, isGrokCliEndpoint, isKimiCodingEndpoint, isLocalModelId, isLoggerOpen, isModelLoaded, isThinkingLevelSupported, kimiCodeBaseUrl, kimiCodingHeaders, localAuthStorageKey, log, loginAnthropic, loginGemini, loginKimi, loginOpenAI, loginXai, oauthStorageKey, openLog, parseLocalModelId, probeEndpoint, providerStorageKeys, readStoredBaseUrlSync, refreshAnthropicToken, refreshGeminiToken, refreshKimiToken, refreshOpenAIToken, refreshXaiToken, registerLogCleanup, resample, setProgressCallback, toModelInfo, transcribeVoice, withFileLock };
|
|
781
|
+
export { AuthStorage, type AutoUpdateConfig, type AutoUpdater, DEFAULT_LOCAL_ENDPOINTS, type DiscoverOptions, type DiscoveryResult, type DualAuthProvider, FALLBACK_CONTEXT_WINDOW, type InlineButton, LOCAL_API_KEY_PLACEHOLDER, LOCAL_AUTH_KEY_PREFIX, type LocalEndpoint, type LocalEndpointKind, type LocalEndpointProbe, type LocalModel, type LogLevel, MOONSHOT_OAUTH_KEY, ModelInfo, NotLoggedInError, type OAuthCredentials, type OAuthLoginCallbacks, PLAN_MODE_THINKING_CAP, type ProbeOptions, type ProgressCallback, SubscriptionUsageError, type SubscriptionUsageProvider, type SubscriptionUsageSnapshot, type SubscriptionUsageWindow, TelegramBot, type TelegramConfig, type TelegramMessage, type TelegramUpdate, type TelegramVoiceMessage, XAI_OAUTH_KEY, XIAOMI_CREDITS_KEY, clampThinkingForPlanMode, clearLocalDiscoveryCache, closeLogger, compareClaudeCodeVersions, createAutoUpdater, decodeOggOpus, discoverLocalModels, downmixToMono, dualAuthProvider, dualAuthProviderByOAuthKey, endpointRoot, fetchSubscriptionUsage, findProbedModel, formatLocalModelId, generatePKCE, getClaudeCliUserAgent, getClaudeCodeVersion, getNextThinkingLevel, getSessionId, getSupportedThinkingLevels, grokCliBaseUrl, grokCliHeaders, isGrokCliEndpoint, isKimiCodingEndpoint, isLocalModelId, isLoggerOpen, isModelLoaded, isThinkingLevelSupported, kimiCodeBaseUrl, kimiCodingHeaders, localAuthStorageKey, log, loginAnthropic, loginGemini, loginKimi, loginOpenAI, loginXai, oauthStorageKey, openLog, parseLocalModelId, probeEndpoint, providerStorageKeys, readStoredBaseUrlSync, recordRequiredClaudeCodeVersion, refreshAnthropicToken, refreshGeminiToken, refreshKimiToken, refreshOpenAIToken, refreshXaiToken, registerLogCleanup, resample, setProgressCallback, toModelInfo, transcribeVoice, withFileLock };
|
package/dist/index.d.ts
CHANGED
|
@@ -168,13 +168,39 @@ declare function closeLogger(opts?: {
|
|
|
168
168
|
*/
|
|
169
169
|
declare function withFileLock<T>(filePath: string, fn: () => Promise<T>): Promise<T>;
|
|
170
170
|
|
|
171
|
+
/**
|
|
172
|
+
* Compare two dotted version strings numerically.
|
|
173
|
+
*
|
|
174
|
+
* Returns >0 when `a` is newer, <0 when older, 0 when equal. Segment-wise
|
|
175
|
+
* numeric comparison matters here: Claude Code is deep into 2.1.x, where a
|
|
176
|
+
* lexical compare puts "2.1.9" above "2.1.280" and would happily serve a UA
|
|
177
|
+
* that Anthropic rejects.
|
|
178
|
+
*/
|
|
179
|
+
declare function compareClaudeCodeVersions(a: string, b: string): number;
|
|
171
180
|
/**
|
|
172
181
|
* Resolve the current Claude Code release version for spoofing the claude-cli
|
|
173
|
-
* User-Agent on OAuth and inference requests.
|
|
174
|
-
*
|
|
175
|
-
*
|
|
182
|
+
* User-Agent on OAuth and inference requests.
|
|
183
|
+
*
|
|
184
|
+
* A cached value under an hour old is served straight away. An older one is
|
|
185
|
+
* still served immediately — the hot path never waits on npm — but triggers a
|
|
186
|
+
* background refresh, so a client-version gate on a newly released model costs
|
|
187
|
+
* at most one request instead of a full day of lockout. Past 24h the cache is
|
|
188
|
+
* refreshed synchronously, and only falls back to the stale value (then the
|
|
189
|
+
* bundled constant) if npm cannot be reached at all.
|
|
176
190
|
*/
|
|
177
191
|
declare function getClaudeCodeVersion(): Promise<string>;
|
|
192
|
+
/**
|
|
193
|
+
* Learn the minimum client version from a provider rejection.
|
|
194
|
+
*
|
|
195
|
+
* Anthropic gates newly released models on a minimum Claude Code version and
|
|
196
|
+
* names it in the error ("version 2.1.280 or newer is required"). That message
|
|
197
|
+
* is authoritative — more current than the npm registry can be at launch — so
|
|
198
|
+
* we pin it as a floor, persist it, and drop the memoised value. The next
|
|
199
|
+
* request builds its User-Agent from the floor and succeeds.
|
|
200
|
+
*
|
|
201
|
+
* Returns the newly applied floor, or null when the error is unrelated.
|
|
202
|
+
*/
|
|
203
|
+
declare function recordRequiredClaudeCodeVersion(message: string): string | null;
|
|
178
204
|
/** Build the User-Agent string Anthropic's OAuth + inference edges expect. */
|
|
179
205
|
declare function getClaudeCliUserAgent(): Promise<string>;
|
|
180
206
|
|
|
@@ -752,4 +778,4 @@ interface AutoUpdater {
|
|
|
752
778
|
}
|
|
753
779
|
declare function createAutoUpdater(config: AutoUpdateConfig): AutoUpdater;
|
|
754
780
|
|
|
755
|
-
export { AuthStorage, type AutoUpdateConfig, type AutoUpdater, DEFAULT_LOCAL_ENDPOINTS, type DiscoverOptions, type DiscoveryResult, type DualAuthProvider, FALLBACK_CONTEXT_WINDOW, type InlineButton, LOCAL_API_KEY_PLACEHOLDER, LOCAL_AUTH_KEY_PREFIX, type LocalEndpoint, type LocalEndpointKind, type LocalEndpointProbe, type LocalModel, type LogLevel, MOONSHOT_OAUTH_KEY, ModelInfo, NotLoggedInError, type OAuthCredentials, type OAuthLoginCallbacks, PLAN_MODE_THINKING_CAP, type ProbeOptions, type ProgressCallback, SubscriptionUsageError, type SubscriptionUsageProvider, type SubscriptionUsageSnapshot, type SubscriptionUsageWindow, TelegramBot, type TelegramConfig, type TelegramMessage, type TelegramUpdate, type TelegramVoiceMessage, XAI_OAUTH_KEY, XIAOMI_CREDITS_KEY, clampThinkingForPlanMode, clearLocalDiscoveryCache, closeLogger, createAutoUpdater, decodeOggOpus, discoverLocalModels, downmixToMono, dualAuthProvider, dualAuthProviderByOAuthKey, endpointRoot, fetchSubscriptionUsage, findProbedModel, formatLocalModelId, generatePKCE, getClaudeCliUserAgent, getClaudeCodeVersion, getNextThinkingLevel, getSessionId, getSupportedThinkingLevels, grokCliBaseUrl, grokCliHeaders, isGrokCliEndpoint, isKimiCodingEndpoint, isLocalModelId, isLoggerOpen, isModelLoaded, isThinkingLevelSupported, kimiCodeBaseUrl, kimiCodingHeaders, localAuthStorageKey, log, loginAnthropic, loginGemini, loginKimi, loginOpenAI, loginXai, oauthStorageKey, openLog, parseLocalModelId, probeEndpoint, providerStorageKeys, readStoredBaseUrlSync, refreshAnthropicToken, refreshGeminiToken, refreshKimiToken, refreshOpenAIToken, refreshXaiToken, registerLogCleanup, resample, setProgressCallback, toModelInfo, transcribeVoice, withFileLock };
|
|
781
|
+
export { AuthStorage, type AutoUpdateConfig, type AutoUpdater, DEFAULT_LOCAL_ENDPOINTS, type DiscoverOptions, type DiscoveryResult, type DualAuthProvider, FALLBACK_CONTEXT_WINDOW, type InlineButton, LOCAL_API_KEY_PLACEHOLDER, LOCAL_AUTH_KEY_PREFIX, type LocalEndpoint, type LocalEndpointKind, type LocalEndpointProbe, type LocalModel, type LogLevel, MOONSHOT_OAUTH_KEY, ModelInfo, NotLoggedInError, type OAuthCredentials, type OAuthLoginCallbacks, PLAN_MODE_THINKING_CAP, type ProbeOptions, type ProgressCallback, SubscriptionUsageError, type SubscriptionUsageProvider, type SubscriptionUsageSnapshot, type SubscriptionUsageWindow, TelegramBot, type TelegramConfig, type TelegramMessage, type TelegramUpdate, type TelegramVoiceMessage, XAI_OAUTH_KEY, XIAOMI_CREDITS_KEY, clampThinkingForPlanMode, clearLocalDiscoveryCache, closeLogger, compareClaudeCodeVersions, createAutoUpdater, decodeOggOpus, discoverLocalModels, downmixToMono, dualAuthProvider, dualAuthProviderByOAuthKey, endpointRoot, fetchSubscriptionUsage, findProbedModel, formatLocalModelId, generatePKCE, getClaudeCliUserAgent, getClaudeCodeVersion, getNextThinkingLevel, getSessionId, getSupportedThinkingLevels, grokCliBaseUrl, grokCliHeaders, isGrokCliEndpoint, isKimiCodingEndpoint, isLocalModelId, isLoggerOpen, isModelLoaded, isThinkingLevelSupported, kimiCodeBaseUrl, kimiCodingHeaders, localAuthStorageKey, log, loginAnthropic, loginGemini, loginKimi, loginOpenAI, loginXai, oauthStorageKey, openLog, parseLocalModelId, probeEndpoint, providerStorageKeys, readStoredBaseUrlSync, recordRequiredClaudeCodeVersion, refreshAnthropicToken, refreshGeminiToken, refreshKimiToken, refreshOpenAIToken, refreshXaiToken, registerLogCleanup, resample, setProgressCallback, toModelInfo, transcribeVoice, withFileLock };
|
package/dist/index.js
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
XIAOMI_CREDITS_KEY,
|
|
10
10
|
clearRuntimeModels,
|
|
11
11
|
closeLogger,
|
|
12
|
+
compareClaudeCodeVersions,
|
|
12
13
|
dualAuthProvider,
|
|
13
14
|
dualAuthProviderByOAuthKey,
|
|
14
15
|
generatePKCE,
|
|
@@ -45,6 +46,7 @@ import {
|
|
|
45
46
|
openLog,
|
|
46
47
|
providerStorageKeys,
|
|
47
48
|
readStoredBaseUrlSync,
|
|
49
|
+
recordRequiredClaudeCodeVersion,
|
|
48
50
|
refreshAnthropicToken,
|
|
49
51
|
refreshGeminiToken,
|
|
50
52
|
refreshKimiToken,
|
|
@@ -54,7 +56,7 @@ import {
|
|
|
54
56
|
registerRuntimeModels,
|
|
55
57
|
usesOpenAICodexTransport,
|
|
56
58
|
withFileLock
|
|
57
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-THUBQC6I.js";
|
|
58
60
|
import {
|
|
59
61
|
getAppPaths
|
|
60
62
|
} from "./chunk-CRU3SSNX.js";
|
|
@@ -1185,6 +1187,7 @@ export {
|
|
|
1185
1187
|
clearLocalDiscoveryCache,
|
|
1186
1188
|
clearRuntimeModels,
|
|
1187
1189
|
closeLogger,
|
|
1190
|
+
compareClaudeCodeVersions,
|
|
1188
1191
|
createAutoUpdater,
|
|
1189
1192
|
decodeOggOpus,
|
|
1190
1193
|
discoverLocalModels,
|
|
@@ -1238,6 +1241,7 @@ export {
|
|
|
1238
1241
|
probeEndpoint,
|
|
1239
1242
|
providerStorageKeys,
|
|
1240
1243
|
readStoredBaseUrlSync,
|
|
1244
|
+
recordRequiredClaudeCodeVersion,
|
|
1241
1245
|
refreshAnthropicToken,
|
|
1242
1246
|
refreshGeminiToken,
|
|
1243
1247
|
refreshKimiToken,
|