@kenkaiiii/gg-core 5.2.0 → 5.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.
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { ContextWindowOptions, DEFAULT_MAX_VIDEO_BYTES, MODELS, ModelInfo, getContextWindow, getDefaultModel, getMaxThinkingLevel, getModel, getModelsForProvider, getSummaryModel, getVideoByteLimit, usesOpenAICodexTransport } from './model-registry.cjs';
1
+ export { ContextWindowOptions, DEFAULT_MAX_VIDEO_BYTES, MODELS, ModelInfo, getAuthStorageKey, getAuthStorageKeys, getContextWindow, getDefaultModel, getMaxThinkingLevel, getModel, getModelsForProvider, getSummaryModel, getVideoByteLimit, usesOpenAICodexTransport } from './model-registry.cjs';
2
2
  import { Provider, ThinkingLevel } from '@kenkaiiii/gg-ai';
3
3
  export { AppPaths, getAppPaths } from './paths.cjs';
4
4
 
@@ -71,6 +71,15 @@ interface OAuthLoginCallbacks {
71
71
  * prefer OAuth for the logical `moonshot` provider.
72
72
  */
73
73
  declare const MOONSHOT_OAUTH_KEY = "moonshot-oauth";
74
+ /**
75
+ * Storage key for the Xiaomi API Credits credential (`https://api.xiaomimimo.com/v1`).
76
+ * Kept distinct from the `xiaomi` Token Plan entry (`token-plan-sgp.xiaomimimo.com`)
77
+ * so a user can configure BOTH — `mimo-v2.5-pro-ultraspeed` is API Credits-only,
78
+ * while `mimo-v2.5-pro`/`mimo-v2.5` prefer the Token Plan but fall back to API
79
+ * Credits when only that's configured. Which key(s) a model tries, and in what
80
+ * order, is decided per-model via `getAuthStorageKeys()` in model-registry.ts.
81
+ */
82
+ declare const XIAOMI_CREDITS_KEY = "xiaomi-credits";
74
83
  declare class AuthStorage {
75
84
  private data;
76
85
  private filePath;
@@ -84,6 +93,14 @@ declare class AuthStorage {
84
93
  listProviders(): Promise<string[]>;
85
94
  /** True if credentials exist for `provider`. */
86
95
  hasCredentials(provider: string): Promise<boolean>;
96
+ /**
97
+ * First key in `keys` (in order) that has stored credentials, or `undefined`
98
+ * if none do. Mirrors the first-match logic `resolveCredentials({ storageKeys })`
99
+ * uses internally — callers that need to know WHICH credential will actually
100
+ * be used (e.g. to clear the right one after a 401) call this directly
101
+ * instead of re-deriving the same order.
102
+ */
103
+ pickStorageKey(keys: string[]): Promise<string | undefined>;
87
104
  /**
88
105
  * True if the user has any usable auth for the logical provider. For
89
106
  * `moonshot` this is satisfied by either the Kimi OAuth credential or the
@@ -110,6 +127,7 @@ declare class AuthStorage {
110
127
  */
111
128
  resolveCredentials(provider: string, opts?: {
112
129
  forceRefresh?: boolean;
130
+ storageKeys?: string[];
113
131
  }): Promise<OAuthCredentials>;
114
132
  /**
115
133
  * Returns a valid access token, auto-refreshing if expired.
@@ -356,4 +374,4 @@ interface AutoUpdater {
356
374
  }
357
375
  declare function createAutoUpdater(config: AutoUpdateConfig): AutoUpdater;
358
376
 
359
- export { AuthStorage, type AutoUpdateConfig, type AutoUpdater, type InlineButton, type LogLevel, MOONSHOT_OAUTH_KEY, NotLoggedInError, type OAuthCredentials, type OAuthLoginCallbacks, type ProgressCallback, TelegramBot, type TelegramConfig, type TelegramMessage, type TelegramUpdate, type TelegramVoiceMessage, closeLogger, createAutoUpdater, decodeOggOpus, downmixToMono, generatePKCE, getClaudeCliUserAgent, getClaudeCodeVersion, getNextThinkingLevel, getSessionId, getSupportedThinkingLevels, isKimiCodingEndpoint, isLoggerOpen, isModelLoaded, isThinkingLevelSupported, kimiCodeBaseUrl, kimiCodingHeaders, log, loginAnthropic, loginGemini, loginKimi, loginOpenAI, openLog, refreshAnthropicToken, refreshGeminiToken, refreshKimiToken, refreshOpenAIToken, registerLogCleanup, resample, setProgressCallback, transcribeVoice, withFileLock };
377
+ export { AuthStorage, type AutoUpdateConfig, type AutoUpdater, type InlineButton, type LogLevel, MOONSHOT_OAUTH_KEY, NotLoggedInError, type OAuthCredentials, type OAuthLoginCallbacks, type ProgressCallback, TelegramBot, type TelegramConfig, type TelegramMessage, type TelegramUpdate, type TelegramVoiceMessage, XIAOMI_CREDITS_KEY, closeLogger, createAutoUpdater, decodeOggOpus, downmixToMono, generatePKCE, getClaudeCliUserAgent, getClaudeCodeVersion, getNextThinkingLevel, getSessionId, getSupportedThinkingLevels, isKimiCodingEndpoint, isLoggerOpen, isModelLoaded, isThinkingLevelSupported, kimiCodeBaseUrl, kimiCodingHeaders, log, loginAnthropic, loginGemini, loginKimi, loginOpenAI, openLog, refreshAnthropicToken, refreshGeminiToken, refreshKimiToken, refreshOpenAIToken, registerLogCleanup, resample, setProgressCallback, transcribeVoice, withFileLock };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { ContextWindowOptions, DEFAULT_MAX_VIDEO_BYTES, MODELS, ModelInfo, getContextWindow, getDefaultModel, getMaxThinkingLevel, getModel, getModelsForProvider, getSummaryModel, getVideoByteLimit, usesOpenAICodexTransport } from './model-registry.js';
1
+ export { ContextWindowOptions, DEFAULT_MAX_VIDEO_BYTES, MODELS, ModelInfo, getAuthStorageKey, getAuthStorageKeys, getContextWindow, getDefaultModel, getMaxThinkingLevel, getModel, getModelsForProvider, getSummaryModel, getVideoByteLimit, usesOpenAICodexTransport } from './model-registry.js';
2
2
  import { Provider, ThinkingLevel } from '@kenkaiiii/gg-ai';
3
3
  export { AppPaths, getAppPaths } from './paths.js';
4
4
 
@@ -71,6 +71,15 @@ interface OAuthLoginCallbacks {
71
71
  * prefer OAuth for the logical `moonshot` provider.
72
72
  */
73
73
  declare const MOONSHOT_OAUTH_KEY = "moonshot-oauth";
74
+ /**
75
+ * Storage key for the Xiaomi API Credits credential (`https://api.xiaomimimo.com/v1`).
76
+ * Kept distinct from the `xiaomi` Token Plan entry (`token-plan-sgp.xiaomimimo.com`)
77
+ * so a user can configure BOTH — `mimo-v2.5-pro-ultraspeed` is API Credits-only,
78
+ * while `mimo-v2.5-pro`/`mimo-v2.5` prefer the Token Plan but fall back to API
79
+ * Credits when only that's configured. Which key(s) a model tries, and in what
80
+ * order, is decided per-model via `getAuthStorageKeys()` in model-registry.ts.
81
+ */
82
+ declare const XIAOMI_CREDITS_KEY = "xiaomi-credits";
74
83
  declare class AuthStorage {
75
84
  private data;
76
85
  private filePath;
@@ -84,6 +93,14 @@ declare class AuthStorage {
84
93
  listProviders(): Promise<string[]>;
85
94
  /** True if credentials exist for `provider`. */
86
95
  hasCredentials(provider: string): Promise<boolean>;
96
+ /**
97
+ * First key in `keys` (in order) that has stored credentials, or `undefined`
98
+ * if none do. Mirrors the first-match logic `resolveCredentials({ storageKeys })`
99
+ * uses internally — callers that need to know WHICH credential will actually
100
+ * be used (e.g. to clear the right one after a 401) call this directly
101
+ * instead of re-deriving the same order.
102
+ */
103
+ pickStorageKey(keys: string[]): Promise<string | undefined>;
87
104
  /**
88
105
  * True if the user has any usable auth for the logical provider. For
89
106
  * `moonshot` this is satisfied by either the Kimi OAuth credential or the
@@ -110,6 +127,7 @@ declare class AuthStorage {
110
127
  */
111
128
  resolveCredentials(provider: string, opts?: {
112
129
  forceRefresh?: boolean;
130
+ storageKeys?: string[];
113
131
  }): Promise<OAuthCredentials>;
114
132
  /**
115
133
  * Returns a valid access token, auto-refreshing if expired.
@@ -356,4 +374,4 @@ interface AutoUpdater {
356
374
  }
357
375
  declare function createAutoUpdater(config: AutoUpdateConfig): AutoUpdater;
358
376
 
359
- export { AuthStorage, type AutoUpdateConfig, type AutoUpdater, type InlineButton, type LogLevel, MOONSHOT_OAUTH_KEY, NotLoggedInError, type OAuthCredentials, type OAuthLoginCallbacks, type ProgressCallback, TelegramBot, type TelegramConfig, type TelegramMessage, type TelegramUpdate, type TelegramVoiceMessage, closeLogger, createAutoUpdater, decodeOggOpus, downmixToMono, generatePKCE, getClaudeCliUserAgent, getClaudeCodeVersion, getNextThinkingLevel, getSessionId, getSupportedThinkingLevels, isKimiCodingEndpoint, isLoggerOpen, isModelLoaded, isThinkingLevelSupported, kimiCodeBaseUrl, kimiCodingHeaders, log, loginAnthropic, loginGemini, loginKimi, loginOpenAI, openLog, refreshAnthropicToken, refreshGeminiToken, refreshKimiToken, refreshOpenAIToken, registerLogCleanup, resample, setProgressCallback, transcribeVoice, withFileLock };
377
+ export { AuthStorage, type AutoUpdateConfig, type AutoUpdater, type InlineButton, type LogLevel, MOONSHOT_OAUTH_KEY, NotLoggedInError, type OAuthCredentials, type OAuthLoginCallbacks, type ProgressCallback, TelegramBot, type TelegramConfig, type TelegramMessage, type TelegramUpdate, type TelegramVoiceMessage, XIAOMI_CREDITS_KEY, closeLogger, createAutoUpdater, decodeOggOpus, downmixToMono, generatePKCE, getClaudeCliUserAgent, getClaudeCodeVersion, getNextThinkingLevel, getSessionId, getSupportedThinkingLevels, isKimiCodingEndpoint, isLoggerOpen, isModelLoaded, isThinkingLevelSupported, kimiCodeBaseUrl, kimiCodingHeaders, log, loginAnthropic, loginGemini, loginKimi, loginOpenAI, openLog, refreshAnthropicToken, refreshGeminiToken, refreshKimiToken, refreshOpenAIToken, registerLogCleanup, resample, setProgressCallback, transcribeVoice, withFileLock };