dsh-plugin-subscription-oauth 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +413 -2
- package/cordis.patch.yml +13 -0
- package/lib/auth/device-flow.d.ts +112 -0
- package/lib/auth/device-flow.js +319 -0
- package/lib/auth/device-id.d.ts +31 -0
- package/lib/auth/device-id.js +58 -0
- package/lib/auth/flow.d.ts +33 -0
- package/lib/auth/flow.js +12 -0
- package/lib/auth/glm-flow.d.ts +99 -0
- package/lib/auth/glm-flow.js +194 -0
- package/lib/auth/headers.d.ts +61 -0
- package/lib/auth/headers.js +106 -0
- package/lib/auth/pkce-flow.d.ts +78 -0
- package/lib/auth/pkce-flow.js +205 -0
- package/lib/auth/provider-controller.d.ts +241 -0
- package/lib/auth/provider-controller.js +502 -0
- package/lib/auth/registry.d.ts +91 -0
- package/lib/auth/registry.js +149 -0
- package/lib/auth/rpc.d.ts +31 -0
- package/lib/auth/rpc.js +200 -0
- package/lib/auth/store.d.ts +99 -0
- package/lib/auth/store.js +213 -0
- package/lib/auth/tokens.d.ts +76 -0
- package/lib/auth/tokens.js +103 -0
- package/lib/client/SubscriptionsSection.d.ts +34 -0
- package/lib/client/SubscriptionsSection.js +742 -0
- package/lib/client/index.d.ts +36 -0
- package/lib/client/index.js +47 -0
- package/lib/client/locales.d.ts +187 -0
- package/lib/client/locales.js +185 -0
- package/lib/client/styles.d.ts +18 -0
- package/lib/client/styles.js +257 -0
- package/lib/client/subscriptions-rpc.d.ts +24 -0
- package/lib/client/subscriptions-rpc.js +44 -0
- package/lib/client.js +2078 -0
- package/lib/client.js.map +1 -0
- package/lib/constants.d.ts +79 -0
- package/lib/constants.js +91 -0
- package/lib/errors.d.ts +28 -0
- package/lib/errors.js +34 -0
- package/lib/http.d.ts +24 -0
- package/lib/http.js +98 -0
- package/lib/index.d.ts +57 -0
- package/lib/index.js +185 -0
- package/lib/protocol.d.ts +316 -0
- package/lib/protocol.js +29 -0
- package/lib/providers/antigravity-catalog.d.ts +53 -0
- package/lib/providers/antigravity-catalog.js +269 -0
- package/lib/providers/antigravity.d.ts +331 -0
- package/lib/providers/antigravity.js +821 -0
- package/lib/providers/auto.d.ts +151 -0
- package/lib/providers/auto.js +351 -0
- package/lib/providers/catalog.d.ts +69 -0
- package/lib/providers/catalog.js +78 -0
- package/lib/providers/common.d.ts +51 -0
- package/lib/providers/common.js +169 -0
- package/lib/providers/glm-provider.d.ts +41 -0
- package/lib/providers/glm-provider.js +165 -0
- package/lib/providers/glm.d.ts +159 -0
- package/lib/providers/glm.js +445 -0
- package/lib/providers/grok.d.ts +224 -0
- package/lib/providers/grok.js +700 -0
- package/lib/providers/kimi-provider.d.ts +45 -0
- package/lib/providers/kimi-provider.js +148 -0
- package/lib/providers/kimi.d.ts +151 -0
- package/lib/providers/kimi.js +400 -0
- package/lib/providers/responses-stream.d.ts +58 -0
- package/lib/providers/responses-stream.js +115 -0
- package/lib/providers/usage.d.ts +65 -0
- package/lib/providers/usage.js +309 -0
- package/lib/settings.d.ts +122 -0
- package/lib/settings.js +333 -0
- package/lib/translate/antigravity-schema.d.ts +24 -0
- package/lib/translate/antigravity-schema.js +174 -0
- package/lib/translate/antigravity.d.ts +184 -0
- package/lib/translate/antigravity.js +419 -0
- package/lib/translate/responses.d.ts +156 -0
- package/lib/translate/responses.js +395 -0
- package/lib/translate/sse.d.ts +27 -0
- package/lib/translate/sse.js +82 -0
- package/package.json +126 -4
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `kimi` provider route's wiring: credential store, device-flow login,
|
|
3
|
+
* token refresh, model catalog, and its Settings card facts.
|
|
4
|
+
*
|
|
5
|
+
* @module dsh-plugin-subscription-oauth/providers/kimi-provider
|
|
6
|
+
*/
|
|
7
|
+
import type { ProviderRoute } from '../auth/registry.js';
|
|
8
|
+
import type { ModelPreferences } from '../settings.js';
|
|
9
|
+
import type { FetchFn } from '../http.js';
|
|
10
|
+
import type { AttachmentStore } from '@deepseek-ai/dsh-attachment';
|
|
11
|
+
/** Everything the Kimi route needs from the plugin configuration. */
|
|
12
|
+
export interface KimiProviderOptions {
|
|
13
|
+
/** Directory holding the device id. */
|
|
14
|
+
dataDir: string;
|
|
15
|
+
/** Absolute path of `auth.json`. */
|
|
16
|
+
credentialFile: string;
|
|
17
|
+
/** OAuth host serving the device flow. */
|
|
18
|
+
oauthHost: string;
|
|
19
|
+
/** Request base; `<base>/responses` is the endpoint. */
|
|
20
|
+
apiBase: string;
|
|
21
|
+
/** Consult the endpoint's live model list. */
|
|
22
|
+
discovery: boolean;
|
|
23
|
+
/** Abandon a stream after this much silence. */
|
|
24
|
+
streamIdleTimeoutMs: number;
|
|
25
|
+
/** Model the picker preselects. */
|
|
26
|
+
defaultModel?: string;
|
|
27
|
+
/** Extra model ids published without shipped metadata. */
|
|
28
|
+
extraModels?: readonly string[];
|
|
29
|
+
/** Shared model-visibility preferences. */
|
|
30
|
+
preferences: ModelPreferences;
|
|
31
|
+
/** Resolve the attachment service per request. */
|
|
32
|
+
resolveAttachments?: () => AttachmentStore | undefined;
|
|
33
|
+
/** Invoked when the catalog or its visibility changed. */
|
|
34
|
+
onCatalogChanged?: () => void;
|
|
35
|
+
onWarn?: (message: string) => void;
|
|
36
|
+
/** Fetch implementation; defaults to the proxy-aware fetch. */
|
|
37
|
+
fetchFn?: FetchFn;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Build the `kimi` route: its adapter and its login/lifecycle controller.
|
|
41
|
+
*
|
|
42
|
+
* @param options - resolved endpoints, paths, and shared services.
|
|
43
|
+
* @returns the route, ready to register and to serve over RPC.
|
|
44
|
+
*/
|
|
45
|
+
export declare function createKimiProvider(options: KimiProviderOptions): ProviderRoute;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `kimi` provider route's wiring: credential store, device-flow login,
|
|
3
|
+
* token refresh, model catalog, and its Settings card facts.
|
|
4
|
+
*
|
|
5
|
+
* @module dsh-plugin-subscription-oauth/providers/kimi-provider
|
|
6
|
+
*/
|
|
7
|
+
import { REAUTH_REQUIRED, ProviderError } from '../errors.js';
|
|
8
|
+
import { KIMI_CODE_URL, KIMI_CONTEXT_WINDOW, KIMI_DEFAULT_MODEL, KIMI_PROVIDER_ID, KIMI_PROVIDER_NAME } from '../constants.js';
|
|
9
|
+
import { TokenStore } from '../auth/store.js';
|
|
10
|
+
import { TokenManager } from '../auth/tokens.js';
|
|
11
|
+
import { DeviceFlowManager, identityFromTokens, refreshKimiToken } from '../auth/device-flow.js';
|
|
12
|
+
import { loadOrCreateDeviceId } from '../auth/device-id.js';
|
|
13
|
+
import { kimiIdentityHeaders } from '../auth/headers.js';
|
|
14
|
+
import { KimiAdapter, parseKimiSession } from './kimi.js';
|
|
15
|
+
import { readKimiUsage } from './usage.js';
|
|
16
|
+
import { ProviderController } from '../auth/provider-controller.js';
|
|
17
|
+
import { proxiedFetch } from '../http.js';
|
|
18
|
+
/**
|
|
19
|
+
* Build the `kimi` route: its adapter and its login/lifecycle controller.
|
|
20
|
+
*
|
|
21
|
+
* @param options - resolved endpoints, paths, and shared services.
|
|
22
|
+
* @returns the route, ready to register and to serve over RPC.
|
|
23
|
+
*/
|
|
24
|
+
export function createKimiProvider(options) {
|
|
25
|
+
const fetchFn = options.fetchFn ?? proxiedFetch;
|
|
26
|
+
const store = new TokenStore(options.credentialFile, KIMI_PROVIDER_ID, parseKimiSession);
|
|
27
|
+
const deviceFlow = new DeviceFlowManager();
|
|
28
|
+
/** The wrapped in-flight attempt, so `pending()` is stable across calls. */
|
|
29
|
+
let current;
|
|
30
|
+
const toSession = (tokens) => ({
|
|
31
|
+
accessToken: tokens.accessToken,
|
|
32
|
+
...tokens.refreshToken === undefined ? {} : { refreshToken: tokens.refreshToken },
|
|
33
|
+
expiresAt: tokens.expiresAt,
|
|
34
|
+
oauthHost: options.oauthHost,
|
|
35
|
+
apiBase: options.apiBase,
|
|
36
|
+
...identityFromTokens(tokens.accessToken, tokens.refreshToken),
|
|
37
|
+
});
|
|
38
|
+
/** Adapt one device attempt onto the shared login contract. */
|
|
39
|
+
const wrap = (attempt) => ({
|
|
40
|
+
prompt: {
|
|
41
|
+
url: attempt.verificationUrl,
|
|
42
|
+
userCode: attempt.userCode,
|
|
43
|
+
expiresAt: attempt.expiresAt,
|
|
44
|
+
mode: 'device-code',
|
|
45
|
+
},
|
|
46
|
+
session: attempt.waitToken().then(toSession),
|
|
47
|
+
cancel: () => { attempt.cancel(); },
|
|
48
|
+
});
|
|
49
|
+
const flow = {
|
|
50
|
+
async start() {
|
|
51
|
+
const attempt = await deviceFlow.start(KIMI_PROVIDER_ID, {
|
|
52
|
+
host: options.oauthHost,
|
|
53
|
+
deviceId: await loadOrCreateDeviceId(options.dataDir),
|
|
54
|
+
fetchFn,
|
|
55
|
+
});
|
|
56
|
+
const wrapped = wrap(attempt);
|
|
57
|
+
current = wrapped;
|
|
58
|
+
// The manager drops its own record once the attempt settles; mirror that
|
|
59
|
+
// so `pending()` cannot report a finished login.
|
|
60
|
+
void attempt.waitToken().catch(() => undefined).finally(() => {
|
|
61
|
+
if (current === wrapped)
|
|
62
|
+
current = undefined;
|
|
63
|
+
});
|
|
64
|
+
return wrapped;
|
|
65
|
+
},
|
|
66
|
+
pending() {
|
|
67
|
+
return deviceFlow.pending(KIMI_PROVIDER_ID) === undefined ? undefined : current;
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
const tokens = new TokenManager({
|
|
71
|
+
store,
|
|
72
|
+
displayName: KIMI_PROVIDER_NAME,
|
|
73
|
+
refresh: async (session) => {
|
|
74
|
+
const refreshToken = session.refreshToken;
|
|
75
|
+
if (refreshToken === undefined) {
|
|
76
|
+
throw new ProviderError(`${KIMI_PROVIDER_NAME} account has no refresh token; sign in again`, REAUTH_REQUIRED);
|
|
77
|
+
}
|
|
78
|
+
return refreshKimiToken({
|
|
79
|
+
host: session.oauthHost,
|
|
80
|
+
deviceId: await loadOrCreateDeviceId(options.dataDir),
|
|
81
|
+
fetchFn,
|
|
82
|
+
}, refreshToken);
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
const adapter = new KimiAdapter({
|
|
86
|
+
apiBase: options.apiBase,
|
|
87
|
+
discovery: options.discovery,
|
|
88
|
+
streamIdleTimeoutMs: options.streamIdleTimeoutMs,
|
|
89
|
+
tokens,
|
|
90
|
+
...options.onWarn === undefined ? {} : { onWarn: options.onWarn },
|
|
91
|
+
...options.resolveAttachments === undefined ? {} : { resolveAttachments: options.resolveAttachments },
|
|
92
|
+
identityHeaders: async () => kimiIdentityHeaders(await loadOrCreateDeviceId(options.dataDir)),
|
|
93
|
+
hiddenModels: () => options.preferences.hiddenIds(KIMI_PROVIDER_ID),
|
|
94
|
+
userModels: () => options.preferences.extraIds(KIMI_PROVIDER_ID),
|
|
95
|
+
modelOrder: () => options.preferences.orderOf(KIMI_PROVIDER_ID),
|
|
96
|
+
...options.extraModels === undefined ? {} : { extraModels: options.extraModels },
|
|
97
|
+
fetchFn,
|
|
98
|
+
});
|
|
99
|
+
const spec = {
|
|
100
|
+
id: KIMI_PROVIDER_ID,
|
|
101
|
+
displayName: KIMI_PROVIDER_NAME,
|
|
102
|
+
codeUrl: KIMI_CODE_URL,
|
|
103
|
+
credentialFile: options.credentialFile,
|
|
104
|
+
discovery: options.discovery,
|
|
105
|
+
defaultModel: KIMI_DEFAULT_MODEL,
|
|
106
|
+
catalog: () => adapter.catalogEntries(),
|
|
107
|
+
catalogOwn: () => adapter.ownCatalogEntries(),
|
|
108
|
+
fallbackContextWindow: KIMI_CONTEXT_WINDOW,
|
|
109
|
+
discover: (accessToken) => adapter.fetchCatalog(accessToken),
|
|
110
|
+
usage: (accessToken) => readKimiUsage({ apiBase: options.apiBase, accessToken, fetchFn }),
|
|
111
|
+
details: () => [
|
|
112
|
+
{ key: 'oauthHost', value: options.oauthHost },
|
|
113
|
+
{ key: 'apiBase', value: options.apiBase },
|
|
114
|
+
{ key: 'credentialFile', value: options.credentialFile },
|
|
115
|
+
],
|
|
116
|
+
applyDiscovery: (ids) => { adapter.discover(ids); },
|
|
117
|
+
};
|
|
118
|
+
const controller = new ProviderController({
|
|
119
|
+
spec,
|
|
120
|
+
store,
|
|
121
|
+
tokens,
|
|
122
|
+
flow,
|
|
123
|
+
preferences: options.preferences,
|
|
124
|
+
...options.onCatalogChanged === undefined ? {} : { onCatalogChanged: options.onCatalogChanged },
|
|
125
|
+
...options.onWarn === undefined ? {} : { onWarn: options.onWarn },
|
|
126
|
+
});
|
|
127
|
+
// An explicit façade, not a spread: a spread would copy own properties and
|
|
128
|
+
// drop the class prototype, leaving every method undefined.
|
|
129
|
+
return {
|
|
130
|
+
id: controller.id,
|
|
131
|
+
displayName: controller.displayName,
|
|
132
|
+
credentialFile: controller.credentialFile,
|
|
133
|
+
adapter,
|
|
134
|
+
status: () => controller.status(),
|
|
135
|
+
login: (account) => controller.login(account),
|
|
136
|
+
cancel: () => controller.cancel(),
|
|
137
|
+
logout: (account) => controller.logout(account),
|
|
138
|
+
setDefault: (account) => controller.setDefault(account),
|
|
139
|
+
refresh: (account) => controller.refresh(account),
|
|
140
|
+
discover: (force) => controller.discover(force),
|
|
141
|
+
setModelVisible: (id, visible) => controller.setModelVisible(id, visible),
|
|
142
|
+
setModelOrder: (ids) => controller.setModelOrder(ids),
|
|
143
|
+
addModel: (id) => controller.addModel(id),
|
|
144
|
+
removeModel: (id) => controller.removeModel(id),
|
|
145
|
+
usage: (force) => controller.usage(force),
|
|
146
|
+
reload: () => controller.reload(),
|
|
147
|
+
};
|
|
148
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `kimi` provider route: Kimi Code model catalog, request assembly over
|
|
3
|
+
* the OpenAI Responses wire, and streaming.
|
|
4
|
+
*
|
|
5
|
+
* @module dsh-plugin-subscription-oauth/providers/kimi
|
|
6
|
+
*/
|
|
7
|
+
import { LlmAdapter } from '@deepseek-ai/dsh-llm';
|
|
8
|
+
import type { GenerateOptions, LlmModelInfo, LlmProviderInfo, LlmResolvedModelInfo, StreamChunk } from '@deepseek-ai/dsh-llm';
|
|
9
|
+
import type { AttachmentStore } from '@deepseek-ai/dsh-attachment';
|
|
10
|
+
import type { FetchFn } from '../http.js';
|
|
11
|
+
import type { TokenManager } from '../auth/tokens.js';
|
|
12
|
+
import type { SessionBase } from '../auth/store.js';
|
|
13
|
+
import type { CatalogEntry } from './catalog.js';
|
|
14
|
+
/** One catalog entry exposed as a selectable model. */
|
|
15
|
+
export type KimiModelEntry = CatalogEntry;
|
|
16
|
+
/**
|
|
17
|
+
* A stored Kimi Code login.
|
|
18
|
+
*
|
|
19
|
+
* The OAuth host and API base are recorded per account so a later refresh uses
|
|
20
|
+
* the same endpoints the login did, even if the plugin configuration changes.
|
|
21
|
+
*/
|
|
22
|
+
export interface KimiSession extends SessionBase {
|
|
23
|
+
/** OAuth host the tokens were issued by. */
|
|
24
|
+
oauthHost: string;
|
|
25
|
+
/** API base recorded at login time (diagnostics only). */
|
|
26
|
+
apiBase?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Coerce one decoded credential entry into a Kimi session.
|
|
30
|
+
* @param value - decoded JSON value for one account.
|
|
31
|
+
* @returns the session, or undefined when required fields are missing.
|
|
32
|
+
*/
|
|
33
|
+
export declare function parseKimiSession(value: unknown): KimiSession | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Kimi Code's live coding catalog.
|
|
36
|
+
*
|
|
37
|
+
* `kimi-for-coding` is the stable subscription alias Moonshot re-points at each
|
|
38
|
+
* coding release; `k3` is the current flagship, with the `[1m]` suffix selecting
|
|
39
|
+
* its 1M-token window.
|
|
40
|
+
*/
|
|
41
|
+
export declare const KIMI_MODELS: readonly KimiModelEntry[];
|
|
42
|
+
/** Constructor dependencies for {@link KimiAdapter}. */
|
|
43
|
+
export interface KimiAdapterOptions {
|
|
44
|
+
/** Resolved Kimi Code API base (`<base>/responses`). */
|
|
45
|
+
apiBase: string;
|
|
46
|
+
/** Whether the live `/models` catalog is consulted when logged in. */
|
|
47
|
+
discovery: boolean;
|
|
48
|
+
/** Inactivity budget before a stalled stream is abandoned. */
|
|
49
|
+
streamIdleTimeoutMs: number;
|
|
50
|
+
/** OAuth token manager owning refresh and invalidation. */
|
|
51
|
+
tokens: TokenManager<KimiSession>;
|
|
52
|
+
/** Warning sink for discovery failures that fall back to the static catalog. */
|
|
53
|
+
onWarn?: (message: string) => void;
|
|
54
|
+
/** Resolve the attachment service per request, so a late service start still works. */
|
|
55
|
+
resolveAttachments?: () => AttachmentStore | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Client-identity headers (`X-Msh-*` + `User-Agent`) for this machine.
|
|
58
|
+
* Resolved per request because the device id file is read lazily.
|
|
59
|
+
*/
|
|
60
|
+
identityHeaders?: () => Promise<Record<string, string>>;
|
|
61
|
+
/** Fetch implementation; defaults to the proxy-aware fetch. */
|
|
62
|
+
fetchFn?: FetchFn;
|
|
63
|
+
/** Called when a call proved the stored credential unusable. */
|
|
64
|
+
onCredentialRejected?: (account: string) => void;
|
|
65
|
+
/** Extra model ids from the plugin configuration, appended to the catalog. */
|
|
66
|
+
extraModels?: readonly string[];
|
|
67
|
+
/**
|
|
68
|
+
* The user's model rank for this route, most preferred first.
|
|
69
|
+
*
|
|
70
|
+
* Read per catalog query, so a drag-and-drop re-order takes effect at the
|
|
71
|
+
* picker's next refresh without rebuilding the adapter.
|
|
72
|
+
*/
|
|
73
|
+
modelOrder?: () => Promise<readonly string[]>;
|
|
74
|
+
/**
|
|
75
|
+
* Model ids the session model picker must not offer.
|
|
76
|
+
*
|
|
77
|
+
* Read per catalog query, so a settings change takes effect at the picker's
|
|
78
|
+
* next refresh without rebuilding the adapter. A hidden model stays
|
|
79
|
+
* resolvable: an existing session that already selected it keeps working.
|
|
80
|
+
*/
|
|
81
|
+
hiddenModels?: () => Promise<ReadonlySet<string>>;
|
|
82
|
+
/**
|
|
83
|
+
* Model ids the user added by hand.
|
|
84
|
+
*
|
|
85
|
+
* Read per catalog query, so the add button takes effect at the picker's next
|
|
86
|
+
* refresh. A hand-added id is published with conservative metadata: the
|
|
87
|
+
* endpoint is the authority on what it serves, not this build.
|
|
88
|
+
*/
|
|
89
|
+
userModels?: () => Promise<readonly string[]>;
|
|
90
|
+
}
|
|
91
|
+
/** Kimi Code adapter serving the `kimi` provider route. */
|
|
92
|
+
export declare class KimiAdapter extends LlmAdapter {
|
|
93
|
+
private readonly options;
|
|
94
|
+
/** Live catalog ids seen this session, used to accept renamed models. */
|
|
95
|
+
private discovered;
|
|
96
|
+
/** Ids the user added by hand, cached so the sync catalog can name them. */
|
|
97
|
+
private userAddedIds;
|
|
98
|
+
constructor(options: KimiAdapterOptions);
|
|
99
|
+
providerInfo(provider: string): LlmProviderInfo;
|
|
100
|
+
providerRetryPolicy(): undefined;
|
|
101
|
+
listModels(_provider: string): Promise<readonly LlmModelInfo[]>;
|
|
102
|
+
/** The ids the picker must currently omit. */
|
|
103
|
+
private hidden;
|
|
104
|
+
resolveModel(_provider: string, model: string): Promise<LlmResolvedModelInfo>;
|
|
105
|
+
stream(options: GenerateOptions): AsyncIterable<StreamChunk>;
|
|
106
|
+
/** Translate an auth failure into the message a user can act on. */
|
|
107
|
+
private refreshHint;
|
|
108
|
+
/**
|
|
109
|
+
* The catalog the route serves: its own entries, then the ids the user added
|
|
110
|
+
* by hand. The two are built separately so the hand-added check can look at
|
|
111
|
+
* the shipped list without recursing.
|
|
112
|
+
*/
|
|
113
|
+
private catalog;
|
|
114
|
+
/**
|
|
115
|
+
* The catalog to present: the shipped entries in their curated order and with
|
|
116
|
+
* their curated metadata, then any configured extra id, then any live id this
|
|
117
|
+
* build does not know.
|
|
118
|
+
*
|
|
119
|
+
* The live list never removes a shipped entry: the endpoint serves variants
|
|
120
|
+
* such as `k3[1m]` that its own `/models` listing omits, so absence there is
|
|
121
|
+
* not evidence of retirement.
|
|
122
|
+
*/
|
|
123
|
+
private shippedCatalog;
|
|
124
|
+
/** Whether one shipped entry covers a live model id. */
|
|
125
|
+
private entryMatches;
|
|
126
|
+
/** Resolve a requested model id onto its catalog entry. */
|
|
127
|
+
private entryFor;
|
|
128
|
+
/** Re-read the ids the user added by hand. */
|
|
129
|
+
private syncUserModels;
|
|
130
|
+
/**
|
|
131
|
+
* The entries for ids the user added by hand, in the order they added them.
|
|
132
|
+
*
|
|
133
|
+
* Published without shipped metadata: this build has never seen the model, so
|
|
134
|
+
* the endpoint's own defaults are the honest description.
|
|
135
|
+
*/
|
|
136
|
+
private addedEntries;
|
|
137
|
+
/** Record the live catalog for the picker; failures keep the shipped list. */
|
|
138
|
+
discover(ids: readonly string[]): void;
|
|
139
|
+
/** The curated catalog, for the Settings page's model list. */
|
|
140
|
+
catalogEntries(): readonly KimiModelEntry[];
|
|
141
|
+
/** What this route itself serves, without the ids added by hand. */
|
|
142
|
+
ownCatalogEntries(): readonly KimiModelEntry[];
|
|
143
|
+
/** Build and send one request. */
|
|
144
|
+
private request;
|
|
145
|
+
/** Client-identity headers for this machine, when configured. */
|
|
146
|
+
private identity;
|
|
147
|
+
/** Resolve image blocks through the attachment service, when it is present. */
|
|
148
|
+
private imageResolver;
|
|
149
|
+
/** Read the live `/models` catalog, or undefined when unavailable. */
|
|
150
|
+
fetchCatalog(accessToken: string, signal?: AbortSignal): Promise<readonly string[] | undefined>;
|
|
151
|
+
}
|