@kenkaiiii/gg-core 5.24.0 → 5.26.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/{chunk-7OICWYUV.js → chunk-6OH2XAFL.js} +69 -5
- package/dist/chunk-6OH2XAFL.js.map +1 -0
- package/dist/index.cjs +357 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +135 -2
- package/dist/index.d.ts +135 -2
- package/dist/index.js +281 -2
- package/dist/index.js.map +1 -1
- package/dist/model-registry.cjs +41 -3
- package/dist/model-registry.cjs.map +1 -1
- package/dist/model-registry.d.cts +10 -1
- package/dist/model-registry.d.ts +10 -1
- package/dist/model-registry.js +7 -1
- package/package.json +2 -2
- package/dist/chunk-7OICWYUV.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { ModelInfo } from './model-registry.cjs';
|
|
2
|
+
export { ContextWindowOptions, DEFAULT_MAX_VIDEO_BYTES, MODELS, clearRuntimeModels, getAllModels, getAuthStorageKey, getAuthStorageKeys, getContextWindow, getDefaultModel, getDefaultThinkingLevel, getFastModel, getMaxThinkingLevel, getModel, getModelsForProvider, getSummaryModel, getToolResultCharLimit, getVideoByteLimit, registerRuntimeModels, usesOpenAICodexTransport } from './model-registry.cjs';
|
|
2
3
|
import { Provider, ThinkingLevel } from '@kenkaiiii/gg-ai';
|
|
3
4
|
export { AppPaths, getAppPaths } from './paths.cjs';
|
|
4
5
|
|
|
@@ -6,6 +7,120 @@ declare function getSupportedThinkingLevels(provider: Provider, model: string):
|
|
|
6
7
|
declare function isThinkingLevelSupported(provider: Provider, model: string, level: ThinkingLevel): boolean;
|
|
7
8
|
declare function getNextThinkingLevel(provider: Provider, model: string, current: ThinkingLevel | undefined): ThinkingLevel | undefined;
|
|
8
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Local model discovery — Ollama, LM Studio, llama.cpp (`llama-server`), vLLM,
|
|
12
|
+
* and any other OpenAI-compatible server the user points us at.
|
|
13
|
+
*
|
|
14
|
+
* Everything rides the OpenAI-compatible `/v1` transport (see the `local`
|
|
15
|
+
* provider in gg-ai's stream.ts); the only per-server difference is where the
|
|
16
|
+
* *capabilities* come from, because `GET /v1/models` reports nothing useful:
|
|
17
|
+
*
|
|
18
|
+
* - Ollama → `POST /api/show` → `capabilities[]` + `model_info["<arch>.context_length"]`
|
|
19
|
+
* - LM Studio → `GET /api/v0/models` → `type`, `state`, `max_context_length`
|
|
20
|
+
* - llama.cpp → `GET /props` → `default_generation_settings.n_ctx`
|
|
21
|
+
* - vLLM/other → nothing; `max_model_len` sometimes rides the model object.
|
|
22
|
+
*
|
|
23
|
+
* Probing never throws: an unreachable server is a normal state (the user just
|
|
24
|
+
* doesn't have it running), not an error to surface.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/** Which capability API a local endpoint speaks, beyond plain `/v1/models`. */
|
|
28
|
+
type LocalEndpointKind = "ollama" | "lmstudio" | "llamacpp" | "vllm" | "custom";
|
|
29
|
+
interface LocalEndpoint {
|
|
30
|
+
/** Stable slug, used in model ids (`local/<id>/<rawId>`) and auth keys (`local:<id>`). */
|
|
31
|
+
id: string;
|
|
32
|
+
label: string;
|
|
33
|
+
/** OpenAI-compatible base URL, including the `/v1` suffix. */
|
|
34
|
+
baseUrl: string;
|
|
35
|
+
kind: LocalEndpointKind;
|
|
36
|
+
/** Optional bearer token (LM Studio 0.4+ can require one). */
|
|
37
|
+
apiKey?: string;
|
|
38
|
+
/** True for endpoints the user added by hand (removable). */
|
|
39
|
+
custom?: boolean;
|
|
40
|
+
}
|
|
41
|
+
/** One model as reported (and enriched) by a local server. */
|
|
42
|
+
interface LocalModel {
|
|
43
|
+
/** Model id on the wire, exactly as the server names it (e.g. `qwen3-coder:30b`). */
|
|
44
|
+
rawId: string;
|
|
45
|
+
endpointId: string;
|
|
46
|
+
contextWindow: number;
|
|
47
|
+
/** True when the server told us the real window; false means we guessed. */
|
|
48
|
+
contextWindowKnown: boolean;
|
|
49
|
+
supportsTools: boolean;
|
|
50
|
+
supportsImages: boolean;
|
|
51
|
+
supportsThinking: boolean;
|
|
52
|
+
/** LM Studio only: whether the model is currently resident in memory. */
|
|
53
|
+
loaded?: boolean;
|
|
54
|
+
}
|
|
55
|
+
interface LocalEndpointProbe {
|
|
56
|
+
endpoint: LocalEndpoint;
|
|
57
|
+
reachable: boolean;
|
|
58
|
+
/** Human-readable reason when `reachable` is false (never a raw stack). */
|
|
59
|
+
reason?: string;
|
|
60
|
+
models: LocalModel[];
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* The servers we look for without being asked. Ports are each project's
|
|
64
|
+
* documented default; users who moved a port add a custom endpoint instead.
|
|
65
|
+
*/
|
|
66
|
+
declare const DEFAULT_LOCAL_ENDPOINTS: readonly LocalEndpoint[];
|
|
67
|
+
/**
|
|
68
|
+
* Context window assumed when a server tells us nothing. Deliberately
|
|
69
|
+
* conservative: over-guessing means the provider 400s mid-run at a point
|
|
70
|
+
* auto-compaction already sailed past, while under-guessing only compacts early.
|
|
71
|
+
*/
|
|
72
|
+
declare const FALLBACK_CONTEXT_WINDOW = 8192;
|
|
73
|
+
/** Placeholder token for endpoints with no key — these servers ignore it. */
|
|
74
|
+
declare const LOCAL_API_KEY_PLACEHOLDER = "local";
|
|
75
|
+
/**
|
|
76
|
+
* `local/<endpointId>/<rawModelId>`. The raw id can itself contain slashes
|
|
77
|
+
* (`hf.co/user/repo:q4`), so only the first two segments are structural.
|
|
78
|
+
*/
|
|
79
|
+
declare function formatLocalModelId(endpointId: string, rawId: string): string;
|
|
80
|
+
declare function parseLocalModelId(id: string): {
|
|
81
|
+
endpointId: string;
|
|
82
|
+
rawId: string;
|
|
83
|
+
} | undefined;
|
|
84
|
+
declare function isLocalModelId(id: string): boolean;
|
|
85
|
+
/** Auth-storage key holding the credential (and baseUrl) for one local endpoint. */
|
|
86
|
+
declare function localAuthStorageKey(endpointId: string): string;
|
|
87
|
+
/** Base URL with any trailing `/v1` (and trailing slashes) removed — the server root. */
|
|
88
|
+
declare function endpointRoot(baseUrl: string): string;
|
|
89
|
+
interface ProbeOptions {
|
|
90
|
+
timeoutMs?: number;
|
|
91
|
+
signal?: AbortSignal;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Ask one endpoint what it serves. Never throws — an unreachable server yields
|
|
95
|
+
* `{ reachable: false, reason }` so the UI can say "not running" without an
|
|
96
|
+
* error toast.
|
|
97
|
+
*/
|
|
98
|
+
declare function probeEndpoint(endpoint: LocalEndpoint, { timeoutMs, signal }?: ProbeOptions): Promise<LocalEndpointProbe>;
|
|
99
|
+
/** Convert a probed local model into the registry shape the whole app speaks. */
|
|
100
|
+
declare function toModelInfo(model: LocalModel, endpoint: LocalEndpoint): ModelInfo;
|
|
101
|
+
interface DiscoveryResult {
|
|
102
|
+
probes: LocalEndpointProbe[];
|
|
103
|
+
models: ModelInfo[];
|
|
104
|
+
}
|
|
105
|
+
interface DiscoverOptions extends ProbeOptions {
|
|
106
|
+
/** Skip the 30s cache (the UI's "Scan" button). */
|
|
107
|
+
force?: boolean;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Probe every endpoint in parallel and return both the per-endpoint status (for
|
|
111
|
+
* the UI) and the `ModelInfo[]` ready for `registerRuntimeModels()`. Results are
|
|
112
|
+
* cached for 30s per endpoint set so repeated `GET /models` calls don't re-probe
|
|
113
|
+
* four servers; `force` bypasses it after an `ollama pull`.
|
|
114
|
+
*/
|
|
115
|
+
declare function discoverLocalModels(endpoints?: readonly LocalEndpoint[], options?: DiscoverOptions): Promise<DiscoveryResult>;
|
|
116
|
+
/** Drop the discovery cache (used by tests and after an endpoint is added/removed). */
|
|
117
|
+
declare function clearLocalDiscoveryCache(): void;
|
|
118
|
+
/** Look up the probed capabilities of a discovered model, by full local id. */
|
|
119
|
+
declare function findProbedModel(probes: readonly LocalEndpointProbe[], modelId: string): {
|
|
120
|
+
model: LocalModel;
|
|
121
|
+
endpoint: LocalEndpoint;
|
|
122
|
+
} | undefined;
|
|
123
|
+
|
|
9
124
|
type LogLevel = "INFO" | "ERROR" | "WARN" | "DEBUG";
|
|
10
125
|
/**
|
|
11
126
|
* Open the debug log in append mode, tagging this process with a session id and
|
|
@@ -89,6 +204,14 @@ declare const MOONSHOT_OAUTH_KEY = "moonshot-oauth";
|
|
|
89
204
|
* order, is decided per-model via `getAuthStorageKeys()` in model-registry.ts.
|
|
90
205
|
*/
|
|
91
206
|
declare const XIAOMI_CREDITS_KEY = "xiaomi-credits";
|
|
207
|
+
/**
|
|
208
|
+
* Prefix for local-endpoint credentials (`local:ollama`, `local:lmstudio`, …).
|
|
209
|
+
* One entry per endpoint, each carrying that endpoint's `baseUrl`, so the
|
|
210
|
+
* existing `resolveCredentials({ storageKeys })` override resolves a local model
|
|
211
|
+
* with no new code path. Kept in sync with `localAuthStorageKey()` in
|
|
212
|
+
* local-models.ts.
|
|
213
|
+
*/
|
|
214
|
+
declare const LOCAL_AUTH_KEY_PREFIX = "local:";
|
|
92
215
|
/**
|
|
93
216
|
* Synchronous baseUrl read straight from the auth file, for boot paths that
|
|
94
217
|
* need the active endpoint before an AuthStorage instance exists (e.g. the
|
|
@@ -124,6 +247,16 @@ declare class AuthStorage {
|
|
|
124
247
|
* Moonshot API key.
|
|
125
248
|
*/
|
|
126
249
|
hasProviderAuth(provider: string): Promise<boolean>;
|
|
250
|
+
/** Endpoint ids that currently have a `local:<id>` credential stored. */
|
|
251
|
+
listLocalEndpointIds(): Promise<string[]>;
|
|
252
|
+
/**
|
|
253
|
+
* Write (or refresh) the credential for one local endpoint. The `baseUrl` is
|
|
254
|
+
* what `effectiveBaseUrl` later picks up, and `accessToken` is the endpoint's
|
|
255
|
+
* key — a placeholder for the servers that ignore it.
|
|
256
|
+
*/
|
|
257
|
+
setLocalEndpoint(endpointId: string, baseUrl: string, apiKey?: string): Promise<void>;
|
|
258
|
+
/** Remove one local endpoint's credential. No-op when it isn't stored. */
|
|
259
|
+
removeLocalEndpoint(endpointId: string): Promise<void>;
|
|
127
260
|
/**
|
|
128
261
|
* True if the active credential for `provider` is a static API key with no
|
|
129
262
|
* refresh mechanism. For `moonshot` this is only true when the Kimi OAuth
|
|
@@ -451,4 +584,4 @@ interface AutoUpdater {
|
|
|
451
584
|
}
|
|
452
585
|
declare function createAutoUpdater(config: AutoUpdateConfig): AutoUpdater;
|
|
453
586
|
|
|
454
|
-
export { AuthStorage, type AutoUpdateConfig, type AutoUpdater, type InlineButton, type LogLevel, MOONSHOT_OAUTH_KEY, NotLoggedInError, type OAuthCredentials, type OAuthLoginCallbacks, type ProgressCallback, SubscriptionUsageError, type SubscriptionUsageProvider, type SubscriptionUsageSnapshot, type SubscriptionUsageWindow, TelegramBot, type TelegramConfig, type TelegramMessage, type TelegramUpdate, type TelegramVoiceMessage, XIAOMI_CREDITS_KEY, closeLogger, createAutoUpdater, decodeOggOpus, downmixToMono, fetchSubscriptionUsage, generatePKCE, getClaudeCliUserAgent, getClaudeCodeVersion, getNextThinkingLevel, getSessionId, getSupportedThinkingLevels, isKimiCodingEndpoint, isLoggerOpen, isModelLoaded, isThinkingLevelSupported, kimiCodeBaseUrl, kimiCodingHeaders, log, loginAnthropic, loginGemini, loginKimi, loginOpenAI, openLog, readStoredBaseUrlSync, refreshAnthropicToken, refreshGeminiToken, refreshKimiToken, refreshOpenAIToken, registerLogCleanup, resample, setProgressCallback, transcribeVoice, withFileLock };
|
|
587
|
+
export { AuthStorage, type AutoUpdateConfig, type AutoUpdater, DEFAULT_LOCAL_ENDPOINTS, type DiscoverOptions, type DiscoveryResult, 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, type ProbeOptions, type ProgressCallback, SubscriptionUsageError, type SubscriptionUsageProvider, type SubscriptionUsageSnapshot, type SubscriptionUsageWindow, TelegramBot, type TelegramConfig, type TelegramMessage, type TelegramUpdate, type TelegramVoiceMessage, XIAOMI_CREDITS_KEY, clearLocalDiscoveryCache, closeLogger, createAutoUpdater, decodeOggOpus, discoverLocalModels, downmixToMono, endpointRoot, fetchSubscriptionUsage, findProbedModel, formatLocalModelId, generatePKCE, getClaudeCliUserAgent, getClaudeCodeVersion, getNextThinkingLevel, getSessionId, getSupportedThinkingLevels, isKimiCodingEndpoint, isLocalModelId, isLoggerOpen, isModelLoaded, isThinkingLevelSupported, kimiCodeBaseUrl, kimiCodingHeaders, localAuthStorageKey, log, loginAnthropic, loginGemini, loginKimi, loginOpenAI, openLog, parseLocalModelId, probeEndpoint, readStoredBaseUrlSync, refreshAnthropicToken, refreshGeminiToken, refreshKimiToken, refreshOpenAIToken, registerLogCleanup, resample, setProgressCallback, toModelInfo, transcribeVoice, withFileLock };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { ModelInfo } from './model-registry.js';
|
|
2
|
+
export { ContextWindowOptions, DEFAULT_MAX_VIDEO_BYTES, MODELS, clearRuntimeModels, getAllModels, getAuthStorageKey, getAuthStorageKeys, getContextWindow, getDefaultModel, getDefaultThinkingLevel, getFastModel, getMaxThinkingLevel, getModel, getModelsForProvider, getSummaryModel, getToolResultCharLimit, getVideoByteLimit, registerRuntimeModels, usesOpenAICodexTransport } from './model-registry.js';
|
|
2
3
|
import { Provider, ThinkingLevel } from '@kenkaiiii/gg-ai';
|
|
3
4
|
export { AppPaths, getAppPaths } from './paths.js';
|
|
4
5
|
|
|
@@ -6,6 +7,120 @@ declare function getSupportedThinkingLevels(provider: Provider, model: string):
|
|
|
6
7
|
declare function isThinkingLevelSupported(provider: Provider, model: string, level: ThinkingLevel): boolean;
|
|
7
8
|
declare function getNextThinkingLevel(provider: Provider, model: string, current: ThinkingLevel | undefined): ThinkingLevel | undefined;
|
|
8
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Local model discovery — Ollama, LM Studio, llama.cpp (`llama-server`), vLLM,
|
|
12
|
+
* and any other OpenAI-compatible server the user points us at.
|
|
13
|
+
*
|
|
14
|
+
* Everything rides the OpenAI-compatible `/v1` transport (see the `local`
|
|
15
|
+
* provider in gg-ai's stream.ts); the only per-server difference is where the
|
|
16
|
+
* *capabilities* come from, because `GET /v1/models` reports nothing useful:
|
|
17
|
+
*
|
|
18
|
+
* - Ollama → `POST /api/show` → `capabilities[]` + `model_info["<arch>.context_length"]`
|
|
19
|
+
* - LM Studio → `GET /api/v0/models` → `type`, `state`, `max_context_length`
|
|
20
|
+
* - llama.cpp → `GET /props` → `default_generation_settings.n_ctx`
|
|
21
|
+
* - vLLM/other → nothing; `max_model_len` sometimes rides the model object.
|
|
22
|
+
*
|
|
23
|
+
* Probing never throws: an unreachable server is a normal state (the user just
|
|
24
|
+
* doesn't have it running), not an error to surface.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/** Which capability API a local endpoint speaks, beyond plain `/v1/models`. */
|
|
28
|
+
type LocalEndpointKind = "ollama" | "lmstudio" | "llamacpp" | "vllm" | "custom";
|
|
29
|
+
interface LocalEndpoint {
|
|
30
|
+
/** Stable slug, used in model ids (`local/<id>/<rawId>`) and auth keys (`local:<id>`). */
|
|
31
|
+
id: string;
|
|
32
|
+
label: string;
|
|
33
|
+
/** OpenAI-compatible base URL, including the `/v1` suffix. */
|
|
34
|
+
baseUrl: string;
|
|
35
|
+
kind: LocalEndpointKind;
|
|
36
|
+
/** Optional bearer token (LM Studio 0.4+ can require one). */
|
|
37
|
+
apiKey?: string;
|
|
38
|
+
/** True for endpoints the user added by hand (removable). */
|
|
39
|
+
custom?: boolean;
|
|
40
|
+
}
|
|
41
|
+
/** One model as reported (and enriched) by a local server. */
|
|
42
|
+
interface LocalModel {
|
|
43
|
+
/** Model id on the wire, exactly as the server names it (e.g. `qwen3-coder:30b`). */
|
|
44
|
+
rawId: string;
|
|
45
|
+
endpointId: string;
|
|
46
|
+
contextWindow: number;
|
|
47
|
+
/** True when the server told us the real window; false means we guessed. */
|
|
48
|
+
contextWindowKnown: boolean;
|
|
49
|
+
supportsTools: boolean;
|
|
50
|
+
supportsImages: boolean;
|
|
51
|
+
supportsThinking: boolean;
|
|
52
|
+
/** LM Studio only: whether the model is currently resident in memory. */
|
|
53
|
+
loaded?: boolean;
|
|
54
|
+
}
|
|
55
|
+
interface LocalEndpointProbe {
|
|
56
|
+
endpoint: LocalEndpoint;
|
|
57
|
+
reachable: boolean;
|
|
58
|
+
/** Human-readable reason when `reachable` is false (never a raw stack). */
|
|
59
|
+
reason?: string;
|
|
60
|
+
models: LocalModel[];
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* The servers we look for without being asked. Ports are each project's
|
|
64
|
+
* documented default; users who moved a port add a custom endpoint instead.
|
|
65
|
+
*/
|
|
66
|
+
declare const DEFAULT_LOCAL_ENDPOINTS: readonly LocalEndpoint[];
|
|
67
|
+
/**
|
|
68
|
+
* Context window assumed when a server tells us nothing. Deliberately
|
|
69
|
+
* conservative: over-guessing means the provider 400s mid-run at a point
|
|
70
|
+
* auto-compaction already sailed past, while under-guessing only compacts early.
|
|
71
|
+
*/
|
|
72
|
+
declare const FALLBACK_CONTEXT_WINDOW = 8192;
|
|
73
|
+
/** Placeholder token for endpoints with no key — these servers ignore it. */
|
|
74
|
+
declare const LOCAL_API_KEY_PLACEHOLDER = "local";
|
|
75
|
+
/**
|
|
76
|
+
* `local/<endpointId>/<rawModelId>`. The raw id can itself contain slashes
|
|
77
|
+
* (`hf.co/user/repo:q4`), so only the first two segments are structural.
|
|
78
|
+
*/
|
|
79
|
+
declare function formatLocalModelId(endpointId: string, rawId: string): string;
|
|
80
|
+
declare function parseLocalModelId(id: string): {
|
|
81
|
+
endpointId: string;
|
|
82
|
+
rawId: string;
|
|
83
|
+
} | undefined;
|
|
84
|
+
declare function isLocalModelId(id: string): boolean;
|
|
85
|
+
/** Auth-storage key holding the credential (and baseUrl) for one local endpoint. */
|
|
86
|
+
declare function localAuthStorageKey(endpointId: string): string;
|
|
87
|
+
/** Base URL with any trailing `/v1` (and trailing slashes) removed — the server root. */
|
|
88
|
+
declare function endpointRoot(baseUrl: string): string;
|
|
89
|
+
interface ProbeOptions {
|
|
90
|
+
timeoutMs?: number;
|
|
91
|
+
signal?: AbortSignal;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Ask one endpoint what it serves. Never throws — an unreachable server yields
|
|
95
|
+
* `{ reachable: false, reason }` so the UI can say "not running" without an
|
|
96
|
+
* error toast.
|
|
97
|
+
*/
|
|
98
|
+
declare function probeEndpoint(endpoint: LocalEndpoint, { timeoutMs, signal }?: ProbeOptions): Promise<LocalEndpointProbe>;
|
|
99
|
+
/** Convert a probed local model into the registry shape the whole app speaks. */
|
|
100
|
+
declare function toModelInfo(model: LocalModel, endpoint: LocalEndpoint): ModelInfo;
|
|
101
|
+
interface DiscoveryResult {
|
|
102
|
+
probes: LocalEndpointProbe[];
|
|
103
|
+
models: ModelInfo[];
|
|
104
|
+
}
|
|
105
|
+
interface DiscoverOptions extends ProbeOptions {
|
|
106
|
+
/** Skip the 30s cache (the UI's "Scan" button). */
|
|
107
|
+
force?: boolean;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Probe every endpoint in parallel and return both the per-endpoint status (for
|
|
111
|
+
* the UI) and the `ModelInfo[]` ready for `registerRuntimeModels()`. Results are
|
|
112
|
+
* cached for 30s per endpoint set so repeated `GET /models` calls don't re-probe
|
|
113
|
+
* four servers; `force` bypasses it after an `ollama pull`.
|
|
114
|
+
*/
|
|
115
|
+
declare function discoverLocalModels(endpoints?: readonly LocalEndpoint[], options?: DiscoverOptions): Promise<DiscoveryResult>;
|
|
116
|
+
/** Drop the discovery cache (used by tests and after an endpoint is added/removed). */
|
|
117
|
+
declare function clearLocalDiscoveryCache(): void;
|
|
118
|
+
/** Look up the probed capabilities of a discovered model, by full local id. */
|
|
119
|
+
declare function findProbedModel(probes: readonly LocalEndpointProbe[], modelId: string): {
|
|
120
|
+
model: LocalModel;
|
|
121
|
+
endpoint: LocalEndpoint;
|
|
122
|
+
} | undefined;
|
|
123
|
+
|
|
9
124
|
type LogLevel = "INFO" | "ERROR" | "WARN" | "DEBUG";
|
|
10
125
|
/**
|
|
11
126
|
* Open the debug log in append mode, tagging this process with a session id and
|
|
@@ -89,6 +204,14 @@ declare const MOONSHOT_OAUTH_KEY = "moonshot-oauth";
|
|
|
89
204
|
* order, is decided per-model via `getAuthStorageKeys()` in model-registry.ts.
|
|
90
205
|
*/
|
|
91
206
|
declare const XIAOMI_CREDITS_KEY = "xiaomi-credits";
|
|
207
|
+
/**
|
|
208
|
+
* Prefix for local-endpoint credentials (`local:ollama`, `local:lmstudio`, …).
|
|
209
|
+
* One entry per endpoint, each carrying that endpoint's `baseUrl`, so the
|
|
210
|
+
* existing `resolveCredentials({ storageKeys })` override resolves a local model
|
|
211
|
+
* with no new code path. Kept in sync with `localAuthStorageKey()` in
|
|
212
|
+
* local-models.ts.
|
|
213
|
+
*/
|
|
214
|
+
declare const LOCAL_AUTH_KEY_PREFIX = "local:";
|
|
92
215
|
/**
|
|
93
216
|
* Synchronous baseUrl read straight from the auth file, for boot paths that
|
|
94
217
|
* need the active endpoint before an AuthStorage instance exists (e.g. the
|
|
@@ -124,6 +247,16 @@ declare class AuthStorage {
|
|
|
124
247
|
* Moonshot API key.
|
|
125
248
|
*/
|
|
126
249
|
hasProviderAuth(provider: string): Promise<boolean>;
|
|
250
|
+
/** Endpoint ids that currently have a `local:<id>` credential stored. */
|
|
251
|
+
listLocalEndpointIds(): Promise<string[]>;
|
|
252
|
+
/**
|
|
253
|
+
* Write (or refresh) the credential for one local endpoint. The `baseUrl` is
|
|
254
|
+
* what `effectiveBaseUrl` later picks up, and `accessToken` is the endpoint's
|
|
255
|
+
* key — a placeholder for the servers that ignore it.
|
|
256
|
+
*/
|
|
257
|
+
setLocalEndpoint(endpointId: string, baseUrl: string, apiKey?: string): Promise<void>;
|
|
258
|
+
/** Remove one local endpoint's credential. No-op when it isn't stored. */
|
|
259
|
+
removeLocalEndpoint(endpointId: string): Promise<void>;
|
|
127
260
|
/**
|
|
128
261
|
* True if the active credential for `provider` is a static API key with no
|
|
129
262
|
* refresh mechanism. For `moonshot` this is only true when the Kimi OAuth
|
|
@@ -451,4 +584,4 @@ interface AutoUpdater {
|
|
|
451
584
|
}
|
|
452
585
|
declare function createAutoUpdater(config: AutoUpdateConfig): AutoUpdater;
|
|
453
586
|
|
|
454
|
-
export { AuthStorage, type AutoUpdateConfig, type AutoUpdater, type InlineButton, type LogLevel, MOONSHOT_OAUTH_KEY, NotLoggedInError, type OAuthCredentials, type OAuthLoginCallbacks, type ProgressCallback, SubscriptionUsageError, type SubscriptionUsageProvider, type SubscriptionUsageSnapshot, type SubscriptionUsageWindow, TelegramBot, type TelegramConfig, type TelegramMessage, type TelegramUpdate, type TelegramVoiceMessage, XIAOMI_CREDITS_KEY, closeLogger, createAutoUpdater, decodeOggOpus, downmixToMono, fetchSubscriptionUsage, generatePKCE, getClaudeCliUserAgent, getClaudeCodeVersion, getNextThinkingLevel, getSessionId, getSupportedThinkingLevels, isKimiCodingEndpoint, isLoggerOpen, isModelLoaded, isThinkingLevelSupported, kimiCodeBaseUrl, kimiCodingHeaders, log, loginAnthropic, loginGemini, loginKimi, loginOpenAI, openLog, readStoredBaseUrlSync, refreshAnthropicToken, refreshGeminiToken, refreshKimiToken, refreshOpenAIToken, registerLogCleanup, resample, setProgressCallback, transcribeVoice, withFileLock };
|
|
587
|
+
export { AuthStorage, type AutoUpdateConfig, type AutoUpdater, DEFAULT_LOCAL_ENDPOINTS, type DiscoverOptions, type DiscoveryResult, 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, type ProbeOptions, type ProgressCallback, SubscriptionUsageError, type SubscriptionUsageProvider, type SubscriptionUsageSnapshot, type SubscriptionUsageWindow, TelegramBot, type TelegramConfig, type TelegramMessage, type TelegramUpdate, type TelegramVoiceMessage, XIAOMI_CREDITS_KEY, clearLocalDiscoveryCache, closeLogger, createAutoUpdater, decodeOggOpus, discoverLocalModels, downmixToMono, endpointRoot, fetchSubscriptionUsage, findProbedModel, formatLocalModelId, generatePKCE, getClaudeCliUserAgent, getClaudeCodeVersion, getNextThinkingLevel, getSessionId, getSupportedThinkingLevels, isKimiCodingEndpoint, isLocalModelId, isLoggerOpen, isModelLoaded, isThinkingLevelSupported, kimiCodeBaseUrl, kimiCodingHeaders, localAuthStorageKey, log, loginAnthropic, loginGemini, loginKimi, loginOpenAI, openLog, parseLocalModelId, probeEndpoint, readStoredBaseUrlSync, refreshAnthropicToken, refreshGeminiToken, refreshKimiToken, refreshOpenAIToken, registerLogCleanup, resample, setProgressCallback, toModelInfo, transcribeVoice, withFileLock };
|