dsh-agent-sdk-bridge 1.0.0 → 1.1.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/DEVELOPMENT.md +62 -3
- package/FAQ.md +58 -0
- package/README.md +53 -24
- package/client.js +2411 -1802
- package/cordis.patch.yml +4 -3
- package/lib/index.js +3151 -250
- package/lib/types/api.d.ts +5 -2
- package/lib/types/brand.d.ts +26 -3
- package/lib/types/codebuddy.d.ts +12 -1
- package/lib/types/config.d.ts +41 -1
- package/lib/types/index.d.ts +21 -0
- package/lib/types/minimax-adapter.d.ts +86 -0
- package/lib/types/minimax-cli.d.ts +69 -0
- package/lib/types/minimax.d.ts +493 -0
- package/package.json +7 -2
- package/src/api.ts +120 -32
- package/src/brand.ts +49 -5
- package/src/codebuddy.ts +55 -4
- package/src/config.ts +53 -1
- package/src/index.ts +50 -4
- package/src/minimax-adapter.ts +370 -0
- package/src/minimax-cli.ts +276 -0
- package/src/minimax.ts +2413 -0
package/lib/types/api.d.ts
CHANGED
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
22
22
|
import type { QoderAdapter } from './adapter.ts';
|
|
23
23
|
import type { CodeBuddyAdapter } from './codebuddy-adapter.ts';
|
|
24
|
-
import type {
|
|
24
|
+
import type { MinimaxAdapter } from './minimax-adapter.ts';
|
|
25
|
+
import type { BrandId, CodeBuddyRegion, MinimaxRegion } from './brand.ts';
|
|
25
26
|
/** Route prefix this plugin owns; the client resolves it relative to the page. */
|
|
26
27
|
export declare const API_PREFIX = "/api/llm-qoder-cn";
|
|
27
28
|
/** One model row as a settings page renders it. */
|
|
@@ -39,10 +40,12 @@ export interface ModelRow {
|
|
|
39
40
|
reasoning: boolean;
|
|
40
41
|
}
|
|
41
42
|
/** The adapters the API can reach, one per provider route. */
|
|
42
|
-
export type AdapterMap = Readonly<Record<BrandId, QoderAdapter | CodeBuddyAdapter>>;
|
|
43
|
+
export type AdapterMap = Readonly<Record<BrandId, QoderAdapter | CodeBuddyAdapter | MinimaxAdapter>>;
|
|
43
44
|
/** Build model rows for a Qoder adapter. */
|
|
44
45
|
export declare function buildRows(adapter: QoderAdapter): Promise<ModelRow[]>;
|
|
45
46
|
/** Build model rows for the CodeBuddy adapter, for one login region. */
|
|
46
47
|
export declare function buildCodeBuddyRows(adapter: CodeBuddyAdapter, region?: CodeBuddyRegion): Promise<ModelRow[]>;
|
|
48
|
+
/** Build model rows for the MiniMax adapter, for one login region. */
|
|
49
|
+
export declare function buildMinimaxRows(adapter: MinimaxAdapter, region?: MinimaxRegion): Promise<ModelRow[]>;
|
|
47
50
|
/** Handle one request under {@link API_PREFIX}. */
|
|
48
51
|
export declare function handleApi(req: IncomingMessage, res: ServerResponse, adapters: AdapterMap): Promise<void>;
|
package/lib/types/brand.d.ts
CHANGED
|
@@ -13,12 +13,16 @@
|
|
|
13
13
|
export type QoderBrand = 'cn' | 'global';
|
|
14
14
|
/** The CodeBuddy integration. Its login region is a config choice, not a brand. */
|
|
15
15
|
export type CodeBuddyBrandId = 'codebuddy';
|
|
16
|
+
/** The MiniMax Code integration, spoken over ACP. */
|
|
17
|
+
export type MinimaxBrandId = 'minimax';
|
|
16
18
|
/** Every provider route this plugin registers. */
|
|
17
|
-
export type BrandId = QoderBrand | CodeBuddyBrandId;
|
|
19
|
+
export type BrandId = QoderBrand | CodeBuddyBrandId | MinimaxBrandId;
|
|
18
20
|
/** Which SDK family a brand belongs to. */
|
|
19
|
-
export type BrandFamily = 'qoder' | 'codebuddy';
|
|
21
|
+
export type BrandFamily = 'qoder' | 'codebuddy' | 'minimax';
|
|
20
22
|
/** CodeBuddy's two public login regions. Enterprise domains are out of scope. */
|
|
21
23
|
export type CodeBuddyRegion = 'global' | 'cn';
|
|
24
|
+
/** MiniMax Code's two public login regions. */
|
|
25
|
+
export type MinimaxRegion = 'global' | 'cn';
|
|
22
26
|
/** Everything that differs between provider brands. */
|
|
23
27
|
export interface BrandProfile {
|
|
24
28
|
id: BrandId;
|
|
@@ -28,7 +32,7 @@ export interface BrandProfile {
|
|
|
28
32
|
/** Display name used when the config leaves it empty. */
|
|
29
33
|
defaultDisplayName: string;
|
|
30
34
|
/** Config field that switches this brand on or off. */
|
|
31
|
-
enabledKey: 'cnEnabled' | 'intlEnabled' | 'codebuddyEnabled';
|
|
35
|
+
enabledKey: 'cnEnabled' | 'intlEnabled' | 'codebuddyEnabled' | 'minimaxEnabled';
|
|
32
36
|
/** SDK package that speaks this brand's protocol. */
|
|
33
37
|
sdkPackage: string;
|
|
34
38
|
/** npm packages the CLI can be installed as, most specific first. */
|
|
@@ -64,6 +68,15 @@ export declare const GLOBAL_BRAND: BrandProfile;
|
|
|
64
68
|
* for the mainland one). Enterprise/IOA/self-hosted login is out of scope.
|
|
65
69
|
*/
|
|
66
70
|
export declare const CODEBUDDY_BRAND: BrandProfile;
|
|
71
|
+
/**
|
|
72
|
+
* MiniMax Code, spoken over the Agent Client Protocol.
|
|
73
|
+
*
|
|
74
|
+
* `mcode acp` runs as a stdio ACP server. Unlike CodeBuddy, there is no SDK
|
|
75
|
+
* package to import: the plugin speaks the protocol directly and the CLI owns
|
|
76
|
+
* login, model selection and the upstream account. The login region is a
|
|
77
|
+
* config choice (`MAVIS_REGION` pins each process), not a brand.
|
|
78
|
+
*/
|
|
79
|
+
export declare const MINIMAX_BRAND: BrandProfile;
|
|
67
80
|
/** Every brand, in the order the settings pages list them. */
|
|
68
81
|
export declare const BRANDS: readonly BrandProfile[];
|
|
69
82
|
/** Whether a value names a Qoder edition. */
|
|
@@ -72,7 +85,17 @@ export declare function isQoderBrand(value: unknown): value is QoderBrand;
|
|
|
72
85
|
export declare function isBrandId(value: unknown): value is BrandId;
|
|
73
86
|
/** Whether a value names a CodeBuddy login region. */
|
|
74
87
|
export declare function isCodeBuddyRegion(value: unknown): value is CodeBuddyRegion;
|
|
88
|
+
/** Whether a value names a MiniMax Code login region. */
|
|
89
|
+
export declare function isMinimaxRegion(value: unknown): value is MinimaxRegion;
|
|
75
90
|
/** The profile for one brand. */
|
|
76
91
|
export declare function brandProfile(brand: BrandId): BrandProfile;
|
|
92
|
+
/**
|
|
93
|
+
* The region name the MiniMax CLI uses internally.
|
|
94
|
+
*
|
|
95
|
+
* The CLI calls the mainland site `cn` and the international one `en`; its
|
|
96
|
+
* login command accepts `global` and maps it to `en`. Processes are pinned
|
|
97
|
+
* with `MAVIS_REGION`, which also expects `cn`/`en`.
|
|
98
|
+
*/
|
|
99
|
+
export declare function minimaxCliRegion(region: MinimaxRegion): 'cn' | 'en';
|
|
77
100
|
/** The SDK environment a CodeBuddy region logs into. */
|
|
78
101
|
export declare function codeBuddyEnvironment(region: CodeBuddyRegion): 'external' | 'internal';
|
package/lib/types/codebuddy.d.ts
CHANGED
|
@@ -194,6 +194,7 @@ export declare class CodeBuddySession {
|
|
|
194
194
|
private mcp;
|
|
195
195
|
private readonly pairing;
|
|
196
196
|
private readonly registered;
|
|
197
|
+
private toolSchemas;
|
|
197
198
|
private queue;
|
|
198
199
|
private disposed;
|
|
199
200
|
private abortPending;
|
|
@@ -230,12 +231,22 @@ export declare class CodeBuddySession {
|
|
|
230
231
|
system?: string;
|
|
231
232
|
cwd?: string;
|
|
232
233
|
}): void;
|
|
233
|
-
/**
|
|
234
|
+
/**
|
|
235
|
+
* Remember the host tools and register them with this session's MCP server.
|
|
236
|
+
*
|
|
237
|
+
* Registration must happen before the CLI connects: the MCP SDK refuses a
|
|
238
|
+
* tool added afterwards. The first turn calls this before the session — and
|
|
239
|
+
* therefore its MCP server — exists, so the schemas are kept and replayed by
|
|
240
|
+
* {@link ensureStarted}. Returning early there left the model with no host
|
|
241
|
+
* tools at all, and it fell back to CodeBuddy's built-in `Bash`, which the
|
|
242
|
+
* host could only answer with "unknown tool".
|
|
243
|
+
*/
|
|
234
244
|
ensureTools(tools: readonly {
|
|
235
245
|
name: string;
|
|
236
246
|
description: string;
|
|
237
247
|
parameters?: unknown;
|
|
238
248
|
}[]): void;
|
|
249
|
+
private registerTools;
|
|
239
250
|
/** Hand the host's tool results to parked or buffered handlers. */
|
|
240
251
|
deliverToolResults(tail: readonly {
|
|
241
252
|
role: string;
|
package/lib/types/config.d.ts
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* @module dsh-agent-sdk-bridge/config
|
|
16
16
|
*/
|
|
17
17
|
import z from '@deepseek-ai/schemastery';
|
|
18
|
-
import type { CodeBuddyRegion } from './brand.ts';
|
|
18
|
+
import type { CodeBuddyRegion, MinimaxRegion } from './brand.ts';
|
|
19
19
|
/**
|
|
20
20
|
* The plugin configuration as authored in a profile patch.
|
|
21
21
|
*
|
|
@@ -99,6 +99,22 @@ export interface Config {
|
|
|
99
99
|
codebuddyCnModelContextWindows?: Record<string, number>;
|
|
100
100
|
/** Extra model aliases for CodeBuddy, shared by both regions. */
|
|
101
101
|
codebuddyModelAliases?: Record<string, string>;
|
|
102
|
+
/** Whether MiniMax Code is served; same semantics as {@link cnEnabled}. */
|
|
103
|
+
minimaxEnabled?: boolean;
|
|
104
|
+
/** Which MiniMax Code login region the sessions use. */
|
|
105
|
+
minimaxRegion?: MinimaxRegion;
|
|
106
|
+
/** Display name of the MiniMax Code provider group in the picker. */
|
|
107
|
+
minimaxDisplayName?: string;
|
|
108
|
+
/** Model ids the user switched OFF for the international region. */
|
|
109
|
+
minimaxGlobalDisabledModels?: string[];
|
|
110
|
+
/** Model ids the user switched OFF for the mainland region. */
|
|
111
|
+
minimaxCnDisabledModels?: string[];
|
|
112
|
+
/** Per-model context window for the international region, keyed by model id. */
|
|
113
|
+
minimaxGlobalModelContextWindows?: Record<string, number>;
|
|
114
|
+
/** Per-model context window for the mainland region, keyed by model id. */
|
|
115
|
+
minimaxCnModelContextWindows?: Record<string, number>;
|
|
116
|
+
/** Extra model aliases for MiniMax Code, shared by both regions. */
|
|
117
|
+
minimaxModelAliases?: Record<string, string>;
|
|
102
118
|
/**
|
|
103
119
|
* Display name of the primary provider group in the model picker.
|
|
104
120
|
*/
|
|
@@ -190,6 +206,14 @@ export declare const Config: z<Schemastery.ObjectS<NoInfer<{
|
|
|
190
206
|
codebuddyGlobalModelContextWindows: z<NoInfer<import("@deepseek-ai/cosmokit").Dict<number, string>>, NoInfer<import("@deepseek-ai/cosmokit").Dict<number, string>>, "volatile-defined">;
|
|
191
207
|
codebuddyCnModelContextWindows: z<NoInfer<import("@deepseek-ai/cosmokit").Dict<number, string>>, NoInfer<import("@deepseek-ai/cosmokit").Dict<number, string>>, "volatile-defined">;
|
|
192
208
|
codebuddyModelAliases: z<NoInfer<import("@deepseek-ai/cosmokit").Dict<string, string>>, NoInfer<import("@deepseek-ai/cosmokit").Dict<string, string>>, "volatile-defined">;
|
|
209
|
+
minimaxEnabled: z<boolean, boolean, "volatile-defined">;
|
|
210
|
+
minimaxRegion: z<string, string, "volatile-defined">;
|
|
211
|
+
minimaxDisplayName: z<string, string, "volatile-defined">;
|
|
212
|
+
minimaxGlobalDisabledModels: z<NoInfer<string[]>, NoInfer<string[]>, "volatile-defined">;
|
|
213
|
+
minimaxCnDisabledModels: z<NoInfer<string[]>, NoInfer<string[]>, "volatile-defined">;
|
|
214
|
+
minimaxGlobalModelContextWindows: z<NoInfer<import("@deepseek-ai/cosmokit").Dict<number, string>>, NoInfer<import("@deepseek-ai/cosmokit").Dict<number, string>>, "volatile-defined">;
|
|
215
|
+
minimaxCnModelContextWindows: z<NoInfer<import("@deepseek-ai/cosmokit").Dict<number, string>>, NoInfer<import("@deepseek-ai/cosmokit").Dict<number, string>>, "volatile-defined">;
|
|
216
|
+
minimaxModelAliases: z<NoInfer<import("@deepseek-ai/cosmokit").Dict<string, string>>, NoInfer<import("@deepseek-ai/cosmokit").Dict<string, string>>, "volatile-defined">;
|
|
193
217
|
displayName: z<string, string, "volatile-defined">;
|
|
194
218
|
maxSessions: z<number, number, "volatile-defined">;
|
|
195
219
|
modelCacheTtlSeconds: z<number, number, "volatile-defined">;
|
|
@@ -217,6 +241,14 @@ export declare const Config: z<Schemastery.ObjectS<NoInfer<{
|
|
|
217
241
|
codebuddyGlobalModelContextWindows: z<NoInfer<import("@deepseek-ai/cosmokit").Dict<number, string>>, NoInfer<import("@deepseek-ai/cosmokit").Dict<number, string>>, "volatile-defined">;
|
|
218
242
|
codebuddyCnModelContextWindows: z<NoInfer<import("@deepseek-ai/cosmokit").Dict<number, string>>, NoInfer<import("@deepseek-ai/cosmokit").Dict<number, string>>, "volatile-defined">;
|
|
219
243
|
codebuddyModelAliases: z<NoInfer<import("@deepseek-ai/cosmokit").Dict<string, string>>, NoInfer<import("@deepseek-ai/cosmokit").Dict<string, string>>, "volatile-defined">;
|
|
244
|
+
minimaxEnabled: z<boolean, boolean, "volatile-defined">;
|
|
245
|
+
minimaxRegion: z<string, string, "volatile-defined">;
|
|
246
|
+
minimaxDisplayName: z<string, string, "volatile-defined">;
|
|
247
|
+
minimaxGlobalDisabledModels: z<NoInfer<string[]>, NoInfer<string[]>, "volatile-defined">;
|
|
248
|
+
minimaxCnDisabledModels: z<NoInfer<string[]>, NoInfer<string[]>, "volatile-defined">;
|
|
249
|
+
minimaxGlobalModelContextWindows: z<NoInfer<import("@deepseek-ai/cosmokit").Dict<number, string>>, NoInfer<import("@deepseek-ai/cosmokit").Dict<number, string>>, "volatile-defined">;
|
|
250
|
+
minimaxCnModelContextWindows: z<NoInfer<import("@deepseek-ai/cosmokit").Dict<number, string>>, NoInfer<import("@deepseek-ai/cosmokit").Dict<number, string>>, "volatile-defined">;
|
|
251
|
+
minimaxModelAliases: z<NoInfer<import("@deepseek-ai/cosmokit").Dict<string, string>>, NoInfer<import("@deepseek-ai/cosmokit").Dict<string, string>>, "volatile-defined">;
|
|
220
252
|
displayName: z<string, string, "volatile-defined">;
|
|
221
253
|
maxSessions: z<number, number, "volatile-defined">;
|
|
222
254
|
modelCacheTtlSeconds: z<number, number, "volatile-defined">;
|
|
@@ -256,6 +288,14 @@ export interface ResolvedConfig {
|
|
|
256
288
|
codebuddyGlobalModelContextWindows: Readonly<Record<string, number>>;
|
|
257
289
|
codebuddyCnModelContextWindows: Readonly<Record<string, number>>;
|
|
258
290
|
codebuddyModelAliases: Readonly<Record<string, string>>;
|
|
291
|
+
minimaxEnabled: boolean;
|
|
292
|
+
minimaxRegion: MinimaxRegion;
|
|
293
|
+
minimaxDisplayName: string;
|
|
294
|
+
minimaxGlobalDisabledModels: readonly string[];
|
|
295
|
+
minimaxCnDisabledModels: readonly string[];
|
|
296
|
+
minimaxGlobalModelContextWindows: Readonly<Record<string, number>>;
|
|
297
|
+
minimaxCnModelContextWindows: Readonly<Record<string, number>>;
|
|
298
|
+
minimaxModelAliases: Readonly<Record<string, string>>;
|
|
259
299
|
}
|
|
260
300
|
/**
|
|
261
301
|
* A parsed config as it arrives at `apply()`: every field wrapped in the
|
package/lib/types/index.d.ts
CHANGED
|
@@ -64,6 +64,11 @@ declare module '@deepseek-ai/cordis' {
|
|
|
64
64
|
export { QoderAdapter, QODER_PROVIDER, QODER_INTL_PROVIDER, cliContextWindow, pickContextWindow } from './adapter.ts';
|
|
65
65
|
export type { ImageRequestReader, QoderAdapterOptions } from './adapter.ts';
|
|
66
66
|
export { CodeBuddyAdapter, CODEBUDDY_PROVIDER, resolveCodeBuddyModelId } from './codebuddy-adapter.ts';
|
|
67
|
+
export { MinimaxAdapter, MINIMAX_PROVIDER, resolveMinimaxModelId } from './minimax-adapter.ts';
|
|
68
|
+
export { MinimaxAcp, MinimaxAuth, MinimaxCatalog, MinimaxSession, MinimaxSessionManager, minimaxColdStream, minimaxDataDir, minimaxAuthStatePath, minimaxCliCommand, isHostMcpTool, hostMcpToolName, minimaxModelsFromConfigOptions, minimaxUsage, minimaxUsageFromParts, invalidateMinimaxUsage, minimaxRegionBlocked, minimaxRegionBlockedCached, minimaxRegionBlockMessage, minimaxHostBelongsToOtherRegion, invalidateMinimaxRegionAccess, MinimaxRegionBlockedError, MINIMAX_DEFAULT_CONTEXT_WINDOW, MINIMAX_DEFAULT_MAX_TOKENS, MINIMAX_USAGE_CACHE_TTL_MS, } from './minimax.ts';
|
|
69
|
+
export type { MinimaxAccountInfo, MinimaxAuthStatus, MinimaxCreditInfo, MinimaxMcpToolResult, MinimaxModel, MinimaxPlanInfo, MinimaxQuotaWindow, MinimaxUsageSnapshot, } from './minimax.ts';
|
|
70
|
+
export { MinimaxCliSetup, readMinimaxSetupStatus, resolveMinimaxCli, startMinimaxSetup, stopMinimaxSetup, } from './minimax-cli.ts';
|
|
71
|
+
export type { MinimaxSetupMode, MinimaxSetupStatus, MinimaxCliSpec } from './minimax-cli.ts';
|
|
67
72
|
export type { CodeBuddyAdapterOptions } from './codebuddy-adapter.ts';
|
|
68
73
|
export { CodeBuddyAuth, CodeBuddyAccountReader, CodeBuddyCatalog, CodeBuddySession, CodeBuddySessionManager, CODEBUDDY_DEFAULT_CONTEXT_WINDOW, CODEBUDDY_DEFAULT_MAX_TOKENS, codeBuddyColdStream, fetchCodeBuddyQuota, parseCodeBuddyQuota, toCodeBuddyModel, } from './codebuddy.ts';
|
|
69
74
|
export type { CodeBuddyAccount, CodeBuddyAuthStatus, CodeBuddyModel, CodeBuddyQuota, CodeBuddyQuotaPackage, CodeBuddyUsageSnapshot, } from './codebuddy.ts';
|
|
@@ -113,6 +118,14 @@ export declare const Config: import("@deepseek-ai/schemastery").default<Schemast
|
|
|
113
118
|
codebuddyGlobalModelContextWindows: import("@deepseek-ai/schemastery").default<NoInfer<import("@deepseek-ai/cosmokit").Dict<number, string>>, NoInfer<import("@deepseek-ai/cosmokit").Dict<number, string>>, "volatile-defined">;
|
|
114
119
|
codebuddyCnModelContextWindows: import("@deepseek-ai/schemastery").default<NoInfer<import("@deepseek-ai/cosmokit").Dict<number, string>>, NoInfer<import("@deepseek-ai/cosmokit").Dict<number, string>>, "volatile-defined">;
|
|
115
120
|
codebuddyModelAliases: import("@deepseek-ai/schemastery").default<NoInfer<import("@deepseek-ai/cosmokit").Dict<string, string>>, NoInfer<import("@deepseek-ai/cosmokit").Dict<string, string>>, "volatile-defined">;
|
|
121
|
+
minimaxEnabled: import("@deepseek-ai/schemastery").default<boolean, boolean, "volatile-defined">;
|
|
122
|
+
minimaxRegion: import("@deepseek-ai/schemastery").default<string, string, "volatile-defined">;
|
|
123
|
+
minimaxDisplayName: import("@deepseek-ai/schemastery").default<string, string, "volatile-defined">;
|
|
124
|
+
minimaxGlobalDisabledModels: import("@deepseek-ai/schemastery").default<NoInfer<string[]>, NoInfer<string[]>, "volatile-defined">;
|
|
125
|
+
minimaxCnDisabledModels: import("@deepseek-ai/schemastery").default<NoInfer<string[]>, NoInfer<string[]>, "volatile-defined">;
|
|
126
|
+
minimaxGlobalModelContextWindows: import("@deepseek-ai/schemastery").default<NoInfer<import("@deepseek-ai/cosmokit").Dict<number, string>>, NoInfer<import("@deepseek-ai/cosmokit").Dict<number, string>>, "volatile-defined">;
|
|
127
|
+
minimaxCnModelContextWindows: import("@deepseek-ai/schemastery").default<NoInfer<import("@deepseek-ai/cosmokit").Dict<number, string>>, NoInfer<import("@deepseek-ai/cosmokit").Dict<number, string>>, "volatile-defined">;
|
|
128
|
+
minimaxModelAliases: import("@deepseek-ai/schemastery").default<NoInfer<import("@deepseek-ai/cosmokit").Dict<string, string>>, NoInfer<import("@deepseek-ai/cosmokit").Dict<string, string>>, "volatile-defined">;
|
|
116
129
|
displayName: import("@deepseek-ai/schemastery").default<string, string, "volatile-defined">;
|
|
117
130
|
maxSessions: import("@deepseek-ai/schemastery").default<number, number, "volatile-defined">;
|
|
118
131
|
modelCacheTtlSeconds: import("@deepseek-ai/schemastery").default<number, number, "volatile-defined">;
|
|
@@ -140,6 +153,14 @@ export declare const Config: import("@deepseek-ai/schemastery").default<Schemast
|
|
|
140
153
|
codebuddyGlobalModelContextWindows: import("@deepseek-ai/schemastery").default<NoInfer<import("@deepseek-ai/cosmokit").Dict<number, string>>, NoInfer<import("@deepseek-ai/cosmokit").Dict<number, string>>, "volatile-defined">;
|
|
141
154
|
codebuddyCnModelContextWindows: import("@deepseek-ai/schemastery").default<NoInfer<import("@deepseek-ai/cosmokit").Dict<number, string>>, NoInfer<import("@deepseek-ai/cosmokit").Dict<number, string>>, "volatile-defined">;
|
|
142
155
|
codebuddyModelAliases: import("@deepseek-ai/schemastery").default<NoInfer<import("@deepseek-ai/cosmokit").Dict<string, string>>, NoInfer<import("@deepseek-ai/cosmokit").Dict<string, string>>, "volatile-defined">;
|
|
156
|
+
minimaxEnabled: import("@deepseek-ai/schemastery").default<boolean, boolean, "volatile-defined">;
|
|
157
|
+
minimaxRegion: import("@deepseek-ai/schemastery").default<string, string, "volatile-defined">;
|
|
158
|
+
minimaxDisplayName: import("@deepseek-ai/schemastery").default<string, string, "volatile-defined">;
|
|
159
|
+
minimaxGlobalDisabledModels: import("@deepseek-ai/schemastery").default<NoInfer<string[]>, NoInfer<string[]>, "volatile-defined">;
|
|
160
|
+
minimaxCnDisabledModels: import("@deepseek-ai/schemastery").default<NoInfer<string[]>, NoInfer<string[]>, "volatile-defined">;
|
|
161
|
+
minimaxGlobalModelContextWindows: import("@deepseek-ai/schemastery").default<NoInfer<import("@deepseek-ai/cosmokit").Dict<number, string>>, NoInfer<import("@deepseek-ai/cosmokit").Dict<number, string>>, "volatile-defined">;
|
|
162
|
+
minimaxCnModelContextWindows: import("@deepseek-ai/schemastery").default<NoInfer<import("@deepseek-ai/cosmokit").Dict<number, string>>, NoInfer<import("@deepseek-ai/cosmokit").Dict<number, string>>, "volatile-defined">;
|
|
163
|
+
minimaxModelAliases: import("@deepseek-ai/schemastery").default<NoInfer<import("@deepseek-ai/cosmokit").Dict<string, string>>, NoInfer<import("@deepseek-ai/cosmokit").Dict<string, string>>, "volatile-defined">;
|
|
143
164
|
displayName: import("@deepseek-ai/schemastery").default<string, string, "volatile-defined">;
|
|
144
165
|
maxSessions: import("@deepseek-ai/schemastery").default<number, number, "volatile-defined">;
|
|
145
166
|
modelCacheTtlSeconds: import("@deepseek-ai/schemastery").default<number, number, "volatile-defined">;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `MinimaxAdapter`: route the harness LLM seam onto a MiniMax Code account.
|
|
3
|
+
*
|
|
4
|
+
* The ACP agent owns the conversation; this adapter decides what new text to
|
|
5
|
+
* send, which model/effort to select, and how the ACP tool calls map onto the
|
|
6
|
+
* harness's tool seam. One provider serves both login regions; the region is a
|
|
7
|
+
* live config choice and every ACP process is pinned to it.
|
|
8
|
+
*
|
|
9
|
+
* @module dsh-agent-sdk-bridge/minimax-adapter
|
|
10
|
+
*/
|
|
11
|
+
import { LlmAdapter } from '@deepseek-ai/dsh-llm';
|
|
12
|
+
import type { GenerateOptions, LlmModelInfo, LlmProviderInfo, LlmResolvedModelInfo, PreparedAdapterCall, StreamChunk } from '@deepseek-ai/dsh-llm';
|
|
13
|
+
import type { MinimaxRegion } from './brand.ts';
|
|
14
|
+
import { MinimaxAuth } from './minimax.ts';
|
|
15
|
+
import type { MinimaxModel, MinimaxUsageSnapshot } from './minimax.ts';
|
|
16
|
+
import type { Live } from './live.ts';
|
|
17
|
+
/** The MiniMax Code provider route. */
|
|
18
|
+
export declare const MINIMAX_PROVIDER = "minimax-acp";
|
|
19
|
+
/** Everything the adapter reads lazily from the plugin config. */
|
|
20
|
+
export interface MinimaxAdapterOptions {
|
|
21
|
+
maxSessions?: Live<number>;
|
|
22
|
+
modelCacheTtlMs?: Live<number>;
|
|
23
|
+
catalogFetchTimeoutMs?: Live<number>;
|
|
24
|
+
toolResultTimeoutMs?: Live<number>;
|
|
25
|
+
abortGraceMs?: Live<number>;
|
|
26
|
+
defaultMaxTokens?: Live<number>;
|
|
27
|
+
defaultReasoningEffort?: Live<string | undefined>;
|
|
28
|
+
displayName?: Live<string>;
|
|
29
|
+
region?: Live<MinimaxRegion>;
|
|
30
|
+
/** Per-region deny-lists; the page edits each region's list separately. */
|
|
31
|
+
disabledModels?: (region: MinimaxRegion) => readonly string[];
|
|
32
|
+
/** Per-region context-window overrides, keyed by model id. */
|
|
33
|
+
modelContextWindows?: (region: MinimaxRegion) => Readonly<Record<string, number>>;
|
|
34
|
+
modelAliases?: Live<Readonly<Record<string, string>>>;
|
|
35
|
+
}
|
|
36
|
+
/** Map a harness-side id onto an ACP model value. */
|
|
37
|
+
export declare function resolveMinimaxModelId(model: string, aliases?: Readonly<Record<string, string>>): string;
|
|
38
|
+
/** The MiniMax Code-backed adapter. */
|
|
39
|
+
export declare class MinimaxAdapter extends LlmAdapter {
|
|
40
|
+
private readonly options;
|
|
41
|
+
private readonly sessions;
|
|
42
|
+
private readonly catalog;
|
|
43
|
+
private readonly auth;
|
|
44
|
+
private readonly mcpServer;
|
|
45
|
+
private readonly disabledCache;
|
|
46
|
+
constructor(options?: MinimaxAdapterOptions);
|
|
47
|
+
private get region();
|
|
48
|
+
private disabledFor;
|
|
49
|
+
private get aliases();
|
|
50
|
+
private get displayName();
|
|
51
|
+
providerInfo(provider: string): LlmProviderInfo;
|
|
52
|
+
/** The live catalog, unfiltered (the page must show switched-off models). */
|
|
53
|
+
describeCatalog(region?: MinimaxRegion): Promise<readonly MinimaxModel[]>;
|
|
54
|
+
/** Whether the region's endpoints are refusing this machine's network. */
|
|
55
|
+
regionBlocked(region?: MinimaxRegion): boolean;
|
|
56
|
+
/** Whether the selected (or given) region has a stored login. */
|
|
57
|
+
isSignedIn(region?: MinimaxRegion): boolean;
|
|
58
|
+
/** Why the last catalog read failed, for the page's guidance. */
|
|
59
|
+
catalogError(region?: MinimaxRegion): string | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* Drop the cached catalog and the region verdict behind it.
|
|
62
|
+
*
|
|
63
|
+
* The page calls this with `fresh=1` on a region switch, which is exactly
|
|
64
|
+
* when the network may have changed; keeping a 30-second "blocked" verdict
|
|
65
|
+
* would hide the catalog the switch was meant to reveal.
|
|
66
|
+
*/
|
|
67
|
+
invalidateCatalog(region?: MinimaxRegion): void;
|
|
68
|
+
/** Login status, installer state and (when signed in) the account's quota. */
|
|
69
|
+
usageInfo(fresh?: boolean, region?: MinimaxRegion): Promise<MinimaxUsageSnapshot>;
|
|
70
|
+
/** Drop cached quota readings and the region verdict (login, logout, CLI). */
|
|
71
|
+
invalidateUsage(region?: MinimaxRegion): void;
|
|
72
|
+
/** Login progress for one region; the page polls this. */
|
|
73
|
+
authStatus(region: MinimaxRegion): ReturnType<MinimaxAuth['status']>;
|
|
74
|
+
startLogin(region: MinimaxRegion): ReturnType<MinimaxAuth['start']>;
|
|
75
|
+
logout(region: MinimaxRegion): ReturnType<MinimaxAuth['logout']>;
|
|
76
|
+
isModelDisabled(id: string, region?: MinimaxRegion): boolean;
|
|
77
|
+
contextWindowFor(id: string, region?: MinimaxRegion): number | undefined;
|
|
78
|
+
listModels(provider: string): Promise<readonly LlmModelInfo[]>;
|
|
79
|
+
resolveModel(provider: string, model: string): Promise<LlmResolvedModelInfo>;
|
|
80
|
+
prepareCall(provider: string, model: string, signal?: AbortSignal): Promise<PreparedAdapterCall>;
|
|
81
|
+
stream(options: GenerateOptions): AsyncIterable<StreamChunk>;
|
|
82
|
+
private dispatch;
|
|
83
|
+
private firstTurn;
|
|
84
|
+
private cwdOf;
|
|
85
|
+
close(): void;
|
|
86
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The MiniMax Code CLI (`mcode`): locating it and running its installer.
|
|
3
|
+
*
|
|
4
|
+
* MiniMax ships `@minimax-ai/code` as a global npm package whose `mcode`
|
|
5
|
+
* launcher is a Node shim. Its native SQLite dependency is installed by a
|
|
6
|
+
* postinstall script, and npm 12 blocks install scripts unless they are named
|
|
7
|
+
* with `--allow-scripts`; a plain `npm i -g` leaves a CLI that cannot start.
|
|
8
|
+
* The installer below therefore passes the flags the package documents.
|
|
9
|
+
*
|
|
10
|
+
* @module dsh-agent-sdk-bridge/minimax-cli
|
|
11
|
+
*/
|
|
12
|
+
/** How to invoke the CLI: an executable plus its leading arguments. */
|
|
13
|
+
export interface MinimaxCliSpec {
|
|
14
|
+
command: string;
|
|
15
|
+
args: string[];
|
|
16
|
+
/** The JavaScript entry, when the launcher resolves to one. */
|
|
17
|
+
cliPath?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Locate `mcode`.
|
|
21
|
+
*
|
|
22
|
+
* `MCODE_CLI_PATH` wins (a cli.js path or an executable); otherwise the PATH
|
|
23
|
+
* shims and the global npm prefixes are checked. The explicit cli.js lookup
|
|
24
|
+
* matters on Windows, where spawning a `.cmd` for ACP would put cmd.exe between
|
|
25
|
+
* the protocol streams.
|
|
26
|
+
*/
|
|
27
|
+
export declare function resolveMinimaxCli(): MinimaxCliSpec | undefined;
|
|
28
|
+
/** The spawn argument list for one CLI invocation. */
|
|
29
|
+
export declare function minimaxCliArgs(spec: MinimaxCliSpec, args: readonly string[]): string[];
|
|
30
|
+
/** What the settings page may ask the installer to do. */
|
|
31
|
+
export type MinimaxSetupMode = 'install' | 'uninstall';
|
|
32
|
+
/** Whether a value names an installer action. */
|
|
33
|
+
export declare function isMinimaxSetupMode(value: unknown): value is MinimaxSetupMode;
|
|
34
|
+
/** Snapshot the page polls. */
|
|
35
|
+
export interface MinimaxSetupStatus {
|
|
36
|
+
running: boolean;
|
|
37
|
+
mode?: MinimaxSetupMode;
|
|
38
|
+
startedAt?: number;
|
|
39
|
+
finishedAt?: number;
|
|
40
|
+
code?: number | null;
|
|
41
|
+
lines: string[];
|
|
42
|
+
truncated: boolean;
|
|
43
|
+
installed: boolean;
|
|
44
|
+
cliPath?: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Start the npm installer or uninstaller.
|
|
48
|
+
*
|
|
49
|
+
* The command is fixed: the mode is an allow-list and no user input reaches
|
|
50
|
+
* argv. npm itself is run through cmd.exe on Windows because npm is a `.cmd`
|
|
51
|
+
* shim and Node refuses to spawn it directly on recent versions.
|
|
52
|
+
*/
|
|
53
|
+
export declare function startMinimaxSetup(mode: MinimaxSetupMode, onFinish?: (code: number | null) => void): {
|
|
54
|
+
started: true;
|
|
55
|
+
} | {
|
|
56
|
+
started: false;
|
|
57
|
+
reason: 'busy' | 'unsupported';
|
|
58
|
+
error: string;
|
|
59
|
+
};
|
|
60
|
+
/** The latest installer run, with any not-yet-newlined tail included. */
|
|
61
|
+
export declare function readMinimaxSetupStatus(): MinimaxSetupStatus;
|
|
62
|
+
/** Abandon a running installer. */
|
|
63
|
+
export declare function stopMinimaxSetup(): void;
|
|
64
|
+
/** A small object facade for callers that prefer a service shape. */
|
|
65
|
+
export declare class MinimaxCliSetup {
|
|
66
|
+
readonly start: typeof startMinimaxSetup;
|
|
67
|
+
readonly status: typeof readMinimaxSetupStatus;
|
|
68
|
+
readonly stop: typeof stopMinimaxSetup;
|
|
69
|
+
}
|