dsh-provider-qoder 0.4.2 → 0.5.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/README.md +12 -8
- package/README_CN.md +12 -8
- package/lib/client.js +1355 -384
- package/lib/index.d.ts +69 -24
- package/lib/index.js +2669 -635
- package/package.json +3 -1
package/lib/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import z from "@deepseek-ai/schemastery";
|
|
|
2
2
|
import { GenerateOptions, StreamChunk } from "@deepseek-ai/dsh-llm";
|
|
3
3
|
import { WebSearchProvider, WebSearchRequest, WebSearchResult } from "@deepseek-ai/dsh-web";
|
|
4
4
|
import { Context } from "@deepseek-ai/cordis";
|
|
5
|
+
|
|
5
6
|
//#region src/qoder/catalog.d.ts
|
|
6
7
|
/** Browser-safe Qoder model catalog types and built-in fallback entries. */
|
|
7
8
|
interface QoderCatalogModel {
|
|
@@ -41,30 +42,6 @@ interface QoderCatalogModel {
|
|
|
41
42
|
/** Qoder upstream deployment selected for one immutable transport instance. */
|
|
42
43
|
type QoderRegion = 'global' | 'china';
|
|
43
44
|
//#endregion
|
|
44
|
-
//#region src/dsh/config.d.ts
|
|
45
|
-
interface QoderModelsByRegion {
|
|
46
|
-
global?: QoderCatalogModel[];
|
|
47
|
-
china?: QoderCatalogModel[];
|
|
48
|
-
}
|
|
49
|
-
type QoderWebSearchMode = 'auto' | 'always' | 'disabled';
|
|
50
|
-
interface Config {
|
|
51
|
-
region?: QoderRegion;
|
|
52
|
-
modelsByRegion?: QoderModelsByRegion;
|
|
53
|
-
streamIdleTimeoutMs?: number;
|
|
54
|
-
responseHeaderTimeoutMs?: number;
|
|
55
|
-
preserveThinking?: boolean;
|
|
56
|
-
webSearchMode?: QoderWebSearchMode;
|
|
57
|
-
}
|
|
58
|
-
declare const Config: z<Config>;
|
|
59
|
-
type PluginConfig = Config;
|
|
60
|
-
declare const PluginConfig: z<Config> | z<NoInfer<Config>, NoInfer<Config>, "volatile">;
|
|
61
|
-
type LiveConfig = ReturnType<typeof PluginConfig>;
|
|
62
|
-
//#endregion
|
|
63
|
-
//#region src/dsh/plugin.d.ts
|
|
64
|
-
declare const name = "provider-qoder";
|
|
65
|
-
declare const inject: string[];
|
|
66
|
-
declare function apply(ctx: Context, input?: Config | LiveConfig): void;
|
|
67
|
-
//#endregion
|
|
68
45
|
//#region src/qoder/account.d.ts
|
|
69
46
|
/** Browser-safe Qoder subscriber account and quota types. */
|
|
70
47
|
interface QoderSubscriberProfile {
|
|
@@ -109,6 +86,12 @@ interface QoderResourcePackage {
|
|
|
109
86
|
interface QoderQuotaUsage {
|
|
110
87
|
userQuota?: QoderQuota;
|
|
111
88
|
orgResourcePackage?: QoderQuota;
|
|
89
|
+
/**
|
|
90
|
+
* Credit pool the plan holds separately from its own subscription quota.
|
|
91
|
+
* A plan whose subscription quota is zero reports its whole balance here,
|
|
92
|
+
* so a card that ignores this bucket shows no quota at all.
|
|
93
|
+
*/
|
|
94
|
+
addOnQuota?: QoderQuota;
|
|
112
95
|
dedicatedResourcePackages?: QoderResourcePackage[];
|
|
113
96
|
totalUsagePercentage?: number;
|
|
114
97
|
isQuotaExceeded?: boolean;
|
|
@@ -155,8 +138,43 @@ interface QoderAccountInfo {
|
|
|
155
138
|
updatedAt: string;
|
|
156
139
|
}
|
|
157
140
|
//#endregion
|
|
141
|
+
//#region src/qoder/transport/wire/credentials.d.ts
|
|
142
|
+
/** Subscriber credential material shared across Qoder endpoint protocols. */
|
|
143
|
+
interface QoderCredentials {
|
|
144
|
+
userID: string;
|
|
145
|
+
authToken: string;
|
|
146
|
+
name: string;
|
|
147
|
+
email: string;
|
|
148
|
+
machineID?: string;
|
|
149
|
+
organizationId?: string;
|
|
150
|
+
organizationTags?: string[];
|
|
151
|
+
dataPolicyAgreed?: boolean;
|
|
152
|
+
}
|
|
153
|
+
//#endregion
|
|
154
|
+
//#region src/qoder/authorization.d.ts
|
|
155
|
+
interface QoderBrowserGrant {
|
|
156
|
+
id: string;
|
|
157
|
+
region: QoderRegion;
|
|
158
|
+
credentials: QoderCredentials;
|
|
159
|
+
refreshToken: string;
|
|
160
|
+
expiresAt: number;
|
|
161
|
+
refreshExpiresAt?: number;
|
|
162
|
+
}
|
|
163
|
+
interface QoderBrowserLoginFlow {
|
|
164
|
+
url: string;
|
|
165
|
+
expiresAt: number;
|
|
166
|
+
complete(): Promise<QoderBrowserGrant>;
|
|
167
|
+
}
|
|
168
|
+
interface QoderAuthorizationTransport {
|
|
169
|
+
begin(signal: AbortSignal): Promise<QoderBrowserLoginFlow>;
|
|
170
|
+
refresh(grant: QoderBrowserGrant, signal?: AbortSignal, rejectedToken?: string): Promise<QoderBrowserGrant>;
|
|
171
|
+
}
|
|
172
|
+
//#endregion
|
|
158
173
|
//#region src/qoder/transport/index.d.ts
|
|
174
|
+
type QoderModelTransport = 'http' | 'legacy';
|
|
159
175
|
interface QoderTransport {
|
|
176
|
+
/** Optional on third-party test transports; always present on the default transport. */
|
|
177
|
+
authorization?: QoderAuthorizationTransport;
|
|
160
178
|
stream(options: GenerateOptions, model?: QoderCatalogModel): AsyncIterable<StreamChunk>;
|
|
161
179
|
discoverModels(signal?: AbortSignal): Promise<readonly QoderCatalogModel[]>;
|
|
162
180
|
readAccount(options?: {
|
|
@@ -166,6 +184,33 @@ interface QoderTransport {
|
|
|
166
184
|
searchWeb(request: WebSearchRequest, signal?: AbortSignal): Promise<WebSearchResult>;
|
|
167
185
|
}
|
|
168
186
|
//#endregion
|
|
187
|
+
//#region src/dsh/config.d.ts
|
|
188
|
+
interface QoderModelsByRegion {
|
|
189
|
+
global?: QoderCatalogModel[];
|
|
190
|
+
china?: QoderCatalogModel[];
|
|
191
|
+
}
|
|
192
|
+
type QoderWebSearchMode = 'auto' | 'always' | 'disabled';
|
|
193
|
+
interface Config {
|
|
194
|
+
modelQueueMaxWaitMs?: number;
|
|
195
|
+
region?: QoderRegion;
|
|
196
|
+
modelsByRegion?: QoderModelsByRegion;
|
|
197
|
+
streamIdleTimeoutMs?: number;
|
|
198
|
+
responseHeaderTimeoutMs?: number;
|
|
199
|
+
preserveThinking?: boolean;
|
|
200
|
+
webSearchMode?: QoderWebSearchMode;
|
|
201
|
+
requestCompression?: boolean;
|
|
202
|
+
modelTransport?: QoderModelTransport;
|
|
203
|
+
}
|
|
204
|
+
declare const Config: z<Config>;
|
|
205
|
+
type PluginConfig = Config;
|
|
206
|
+
declare const PluginConfig: z<Config> | z<NoInfer<Config>, NoInfer<Config>, "volatile">;
|
|
207
|
+
type LiveConfig = ReturnType<typeof PluginConfig>;
|
|
208
|
+
//#endregion
|
|
209
|
+
//#region src/dsh/plugin.d.ts
|
|
210
|
+
declare const name = "provider-qoder";
|
|
211
|
+
declare const inject: string[];
|
|
212
|
+
declare function apply(ctx: Context, input?: Config | LiveConfig): void;
|
|
213
|
+
//#endregion
|
|
169
214
|
//#region src/dsh/search-provider.d.ts
|
|
170
215
|
declare const QODER_SEARCH_PROVIDER_ID = "qoder";
|
|
171
216
|
interface QoderSearchProviderOptions {
|