dsh-any-deepseek 0.0.40 → 0.0.41
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 +5 -1
- package/lib/adapter.d.ts +32 -2
- package/lib/index.js +319 -55
- package/lib/presets.d.ts +173 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -56,7 +56,11 @@ dsh plugin --profile web add dsh-any-deepseek
|
|
|
56
56
|
**渠道 id** 会自动填好(可以改,只是配置里的键名)。**显示名**留空的话用规格的默认名 ——
|
|
57
57
|
同一家开两个号时,填上「主号」「备号」之类会好认。
|
|
58
58
|
|
|
59
|
-
内置规格:DeepSeek Official、OpenCode Go、Ollama Cloud、Open Design、CommandCode、Tencent TokenHub
|
|
59
|
+
内置规格:DeepSeek Official、OpenCode Go、OpenCode Go · Hy4 Flash、Ollama Cloud、Open Design、CommandCode、Tencent TokenHub
|
|
60
|
+
|
|
61
|
+
**两个 provider**:`Any DeepSeek`(DeepSeek V4.1 Flash)与 `Any Hy`(Hy4 Flash)。
|
|
62
|
+
它们共用同一张渠道表与同一个 `current`,区别只在"谁能服务这个模型"——
|
|
63
|
+
选中 `Any Hy` 时,只有模型写 `hy4-flash` 的渠道会被路由到。
|
|
60
64
|
(这些名字与下拉框里显示的完全一致)。
|
|
61
65
|
要接别家,见 [接一个新渠道](#接一个新渠道)。
|
|
62
66
|
|
package/lib/adapter.d.ts
CHANGED
|
@@ -32,7 +32,13 @@ import { type ChannelModality } from './presets.js';
|
|
|
32
32
|
import type { ResolvedChannel } from './channels.js';
|
|
33
33
|
import { SupplyStatus, type QuotaCooldown } from './failover.js';
|
|
34
34
|
import type { LedgerEntry } from './usage-ledger.js';
|
|
35
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* The provider route this plugin owns.
|
|
37
|
+
*
|
|
38
|
+
* Kept exported because existing saved model selections and `agent-default-model` name it, so it
|
|
39
|
+
* must remain stable. It is now the FIRST of {@link PROVIDER_ROUTES}, not the only one — see
|
|
40
|
+
* `presets.ts` for why a second model became a second provider.
|
|
41
|
+
*/
|
|
36
42
|
export declare const PROVIDER_ID = "any-deepseek";
|
|
37
43
|
/** Display name for the route in provider selectors. */
|
|
38
44
|
export declare const PROVIDER_NAME = "Any DeepSeek";
|
|
@@ -104,7 +110,7 @@ export declare const PROVIDER_RETRY_POLICY: ResolvedRetryPolicy;
|
|
|
104
110
|
/**
|
|
105
111
|
* The reasoning levels in force for one channel.
|
|
106
112
|
*
|
|
107
|
-
* 🔴 **A channel that says nothing inherits
|
|
113
|
+
* 🔴 **A channel that says nothing inherits its ROUTE's table, and that is the whole fix for the
|
|
108
114
|
* missing thinking control.**
|
|
109
115
|
*
|
|
110
116
|
* The old code read `channel.reasoningEfforts` alone. That value only existed once a channel
|
|
@@ -115,6 +121,11 @@ export declare const PROVIDER_RETRY_POLICY: ResolvedRetryPolicy;
|
|
|
115
121
|
* An empty map counts as silence, not as "explicitly unsupported": `z.dict()` produces `{}` when
|
|
116
122
|
* the panel writes the field, and treating that as a negative capability is how the picker broke
|
|
117
123
|
* with `INVALID_MODEL_REASONING` in the first place.
|
|
124
|
+
*
|
|
125
|
+
* ⚠️ **The fallback is the ROUTE's table, not DeepSeek's.** Hy4 Flash accepts `none`/`high` only;
|
|
126
|
+
* inheriting the DeepSeek table for it would offer `medium` to a caller whose upstream refuses it.
|
|
127
|
+
* The route is derived from the channel's wire model id, so this holds even for a custom channel
|
|
128
|
+
* that names no preset.
|
|
118
129
|
* @param channel - the selected channel, when there is one.
|
|
119
130
|
* @returns the levels to advertise and to send, keyed by level name.
|
|
120
131
|
*/
|
|
@@ -405,6 +416,25 @@ export declare class AnyDeepSeekAdapter extends LlmAdapter {
|
|
|
405
416
|
stream(options: GenerateOptions): AsyncGenerator<StreamChunk>;
|
|
406
417
|
/** The channel that will serve the next request, if any (used for model metadata). */
|
|
407
418
|
private selected;
|
|
419
|
+
/**
|
|
420
|
+
* The channel that will serve the next request **for one provider route**.
|
|
421
|
+
*
|
|
422
|
+
* 🔴 This is what makes the second provider a real axis instead of a label. Without the filter,
|
|
423
|
+
* selecting `any-hy` in the model picker would still route to whatever channel `current` names —
|
|
424
|
+
* so the user's choice would change the composer's title and nothing else.
|
|
425
|
+
*
|
|
426
|
+
* ## Why filtering, rather than a second `current`
|
|
427
|
+
*
|
|
428
|
+
* `current` answers "which channel is live" and stays the single source of truth for that. A
|
|
429
|
+
* provider route only narrows the SET of channels eligible to answer it. That keeps one axis:
|
|
430
|
+
* adding a route can never put two settings into contradiction, and removing every route-eligible
|
|
431
|
+
* channel is a visible failure (`CHANNEL_UNKNOWN` naming the available ids) rather than a silent
|
|
432
|
+
* fallback to a channel serving a different model.
|
|
433
|
+
*
|
|
434
|
+
* @param provider - the route key the harness is dispatching to.
|
|
435
|
+
* @returns the selected channel when it serves this route; otherwise the first channel that does.
|
|
436
|
+
*/
|
|
437
|
+
private selectedFor;
|
|
408
438
|
}
|
|
409
439
|
/** Re-export the credential helper so callers build references the same way the adapter does. */
|
|
410
440
|
export { credentialRef };
|
package/lib/index.js
CHANGED
|
@@ -139,15 +139,6 @@ const ADVERTISED_MODEL_ID = "deepseek-v4.1-flash";
|
|
|
139
139
|
/** Display name for {@link ADVERTISED_MODEL_ID}. */
|
|
140
140
|
const ADVERTISED_MODEL_NAME = "DeepSeek V4.1 Flash";
|
|
141
141
|
/**
|
|
142
|
-
* Fallbacks for a custom channel that declares a model without capacities.
|
|
143
|
-
*
|
|
144
|
-
* These match the pi-ai adapter's own documented defaults (`DEFAULT_CONTEXT_WINDOW`,
|
|
145
|
-
* `DEFAULT_MAX_TOKENS`) so a half-filled custom channel behaves the same way a pi-ai route
|
|
146
|
-
* would, rather than surprising the user with a plugin-specific number.
|
|
147
|
-
*/
|
|
148
|
-
const DEFAULT_CONTEXT_WINDOW = 262144;
|
|
149
|
-
const DEFAULT_MAX_TOKENS = 32768;
|
|
150
|
-
/**
|
|
151
142
|
* Capability numbers shared by every DeepSeek V4.1 Flash deployment we know of.
|
|
152
143
|
*
|
|
153
144
|
* Kept as one constant because these are properties of the *model*, not of a relay; a relay
|
|
@@ -167,6 +158,12 @@ const DEFAULT_MAX_TOKENS = 32768;
|
|
|
167
158
|
* describe the advertised model rather than any one channel. Reaching for this constant (instead
|
|
168
159
|
* of re-listing the numbers there) keeps the catalog and the exact-model answer from drifting —
|
|
169
160
|
* and they are read by different host paths, so a drift is silent.
|
|
161
|
+
*
|
|
162
|
+
* ⚠️ **Declared BEFORE {@link PROVIDER_ROUTES}, and the order is load-bearing.** That table reads
|
|
163
|
+
* this constant while the module is being initialised; putting it below would hit the temporal
|
|
164
|
+
* dead zone and throw at import time (`Cannot access 'V41_FLASH_CAPS' before initialization`),
|
|
165
|
+
* which takes the whole provider offline rather than degrading. Same reason {@link HY4_FLASH_CAPS}
|
|
166
|
+
* sits above the table.
|
|
170
167
|
*/
|
|
171
168
|
const V41_FLASH_CAPS = {
|
|
172
169
|
contextWindow: 1e6,
|
|
@@ -189,6 +186,115 @@ const V41_FLASH_CAPS = {
|
|
|
189
186
|
}
|
|
190
187
|
};
|
|
191
188
|
/**
|
|
189
|
+
* Capabilities of Hy4 Flash, measured from the relay's own model list (2026-12-01).
|
|
190
|
+
*
|
|
191
|
+
* Provenance and the full entry: `docs/hy4-flash-model-facts.md`.
|
|
192
|
+
*
|
|
193
|
+
* 🔴 **The thinking levels are `none` / `high` and nothing else.** Not a trimmed copy of the
|
|
194
|
+
* DeepSeek table by choice — the endpoint advertises exactly those two (`capabilities.reasoning.
|
|
195
|
+
* effort: ["none","high"]`). Declaring `medium` here would offer the user a level the upstream
|
|
196
|
+
* refuses, which is the same class of defect as hiding one it accepts.
|
|
197
|
+
*
|
|
198
|
+
* ⚠️ Three sibling models exist in the same catalog (`hy4`, `hy4-preview`, `hy4-flash`). This
|
|
199
|
+
* constant is the `hy4-flash` one: image input, 1M context, 64k output.
|
|
200
|
+
*/
|
|
201
|
+
const HY4_FLASH_CAPS = {
|
|
202
|
+
contextWindow: 1048576,
|
|
203
|
+
maxTokens: 65536,
|
|
204
|
+
input: ["text", "image"],
|
|
205
|
+
/**
|
|
206
|
+
* `off` maps to the wire value `none` rather than `null`.
|
|
207
|
+
*
|
|
208
|
+
* 🔴 The distinction matters twice over: `null` would mark the level as "explicitly
|
|
209
|
+
* unsupported" and drop it from the picker (see `effectiveReasoningEfforts`), while this relay
|
|
210
|
+
* genuinely accepts "no thinking". Mapping `off → 'none'` keeps the level selectable AND sends
|
|
211
|
+
* the spelling the endpoint documents.
|
|
212
|
+
*/
|
|
213
|
+
reasoningEfforts: {
|
|
214
|
+
off: "none",
|
|
215
|
+
high: "high"
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
/**
|
|
219
|
+
* The provider routes this plugin registers.
|
|
220
|
+
*
|
|
221
|
+
* ⚠️ Order is the order the host shows them in; `any-deepseek` stays first because it is the
|
|
222
|
+
* route every existing saved selection already names (and the container's default model points
|
|
223
|
+
* at it). Reordering this array would not break those selections — they name the route
|
|
224
|
+
* explicitly — but it would change what a user sees first.
|
|
225
|
+
*/
|
|
226
|
+
const PROVIDER_ROUTES = [{
|
|
227
|
+
id: "any-deepseek",
|
|
228
|
+
name: "Any DeepSeek",
|
|
229
|
+
model: {
|
|
230
|
+
id: ADVERTISED_MODEL_ID,
|
|
231
|
+
name: ADVERTISED_MODEL_NAME
|
|
232
|
+
},
|
|
233
|
+
serves: (channel) => channel.model === ADVERTISED_MODEL_ID,
|
|
234
|
+
fallback: true,
|
|
235
|
+
caps: V41_FLASH_CAPS,
|
|
236
|
+
defaultEffort: "high"
|
|
237
|
+
}, {
|
|
238
|
+
id: "any-hy",
|
|
239
|
+
name: "Any Hy",
|
|
240
|
+
model: {
|
|
241
|
+
id: "deepseek-hy4-flash",
|
|
242
|
+
name: "Hy4 Flash"
|
|
243
|
+
},
|
|
244
|
+
serves: (channel) => channel.model === "hy4-flash",
|
|
245
|
+
caps: HY4_FLASH_CAPS,
|
|
246
|
+
defaultEffort: "high"
|
|
247
|
+
}];
|
|
248
|
+
/**
|
|
249
|
+
* Whether one route may serve one channel's wire model.
|
|
250
|
+
*
|
|
251
|
+
* 🔴 **This is the only correct way to ask**, and the reason is a capability that must not
|
|
252
|
+
* regress: a user may fully declare a custom channel with an arbitrary `model` and point `current`
|
|
253
|
+
* at it. That always worked. A strict per-route filter would answer "no channel serves this route"
|
|
254
|
+
* for a perfectly valid configuration, so the route marked {@link ProviderRoute.fallback} also
|
|
255
|
+
* accepts every model no other route claims.
|
|
256
|
+
*
|
|
257
|
+
* ⚠️ "Claims" is computed against the OTHER routes, not against this one, so the answer does not
|
|
258
|
+
* depend on which route happens to be asked first.
|
|
259
|
+
* @param route - the route being tested.
|
|
260
|
+
* @param channel - the channel, by wire model id.
|
|
261
|
+
* @returns whether this route may serve that channel.
|
|
262
|
+
*/
|
|
263
|
+
function routeServes(route, channel) {
|
|
264
|
+
if (route.serves(channel)) return true;
|
|
265
|
+
if (route.fallback !== true) return false;
|
|
266
|
+
return !PROVIDER_ROUTES.some((other) => other !== route && other.serves(channel));
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Look one route up by its key.
|
|
270
|
+
* @param id - `GenerateOptions.provider`.
|
|
271
|
+
* @returns the route, or `undefined` when the id is not ours.
|
|
272
|
+
*/
|
|
273
|
+
function providerRoute(id) {
|
|
274
|
+
return PROVIDER_ROUTES.find((route) => route.id === id);
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* The route a channel belongs to, by its wire model id.
|
|
278
|
+
*
|
|
279
|
+
* Falls back to the first route so a custom channel the user declared by hand still resolves
|
|
280
|
+
* against a real capability table instead of a made-up one — the old behaviour for every
|
|
281
|
+
* unrecognised model, preserved deliberately.
|
|
282
|
+
* @param channel - a resolved or partially declared channel.
|
|
283
|
+
* @returns the matching route.
|
|
284
|
+
*/
|
|
285
|
+
function routeForChannel(channel) {
|
|
286
|
+
return PROVIDER_ROUTES.find((route) => channel.model !== void 0 && routeServes(route, { model: channel.model })) ?? PROVIDER_ROUTES[0];
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Fallbacks for a custom channel that declares a model without capacities.
|
|
290
|
+
*
|
|
291
|
+
* These match the pi-ai adapter's own documented defaults (`DEFAULT_CONTEXT_WINDOW`,
|
|
292
|
+
* `DEFAULT_MAX_TOKENS`) so a half-filled custom channel behaves the same way a pi-ai route
|
|
293
|
+
* would, rather than surprising the user with a plugin-specific number.
|
|
294
|
+
*/
|
|
295
|
+
const DEFAULT_CONTEXT_WINDOW = 262144;
|
|
296
|
+
const DEFAULT_MAX_TOKENS = 32768;
|
|
297
|
+
/**
|
|
192
298
|
* DeepSeek's chat-completions thinking dialect: a `thinking` object plus `reasoning_effort`,
|
|
193
299
|
* with replay needing an explicit empty `reasoning_content` on assistant messages.
|
|
194
300
|
*/
|
|
@@ -375,6 +481,56 @@ const CHANNEL_PRESETS = {
|
|
|
375
481
|
*/
|
|
376
482
|
note: "Tencent Cloud forwarding endpoint; model id is frozen with a -202605 suffix. Takes images (owner profile + Tencent model list, 2026-10-21). No balance API — the panel verifies liveness instead."
|
|
377
483
|
},
|
|
484
|
+
/**
|
|
485
|
+
* Hy4 Flash on OpenCode Go (owner request, 2026-12-01: 「我想给AnyDeepseek增加Hy4 flash这个模型;
|
|
486
|
+
* 目前只有opencode go 提供这个模型」).
|
|
487
|
+
*
|
|
488
|
+
* 🔴 **Model id `hy4-flash`, verified against the relay's own catalog** rather than guessed from
|
|
489
|
+
* the product name: `GET https://opencode.ai/inference/go/v1/models` lists THREE siblings that
|
|
490
|
+
* are easy to confuse — `hy4`, `hy4-preview`, `hy4-flash`. Full entry and provenance:
|
|
491
|
+
* `docs/hy4-flash-model-facts.md`.
|
|
492
|
+
*
|
|
493
|
+
* ⚠️ `hy4` and `hy4-preview` are NOT interchangeable with this one: `hy4-preview` accepts text
|
|
494
|
+
* only, and both carry a smaller Go allowance than `hy4-flash`. Picking the wrong spelling does
|
|
495
|
+
* not fail locally — the upstream either 400s or silently answers with a cheaper model.
|
|
496
|
+
*
|
|
497
|
+
* ## Why the base URL differs from the `opencode-go` preset
|
|
498
|
+
*
|
|
499
|
+
* The catalog documents `https://opencode.ai/inference/go/openai/v1` for every Go model, while
|
|
500
|
+
* the existing `opencode-go` preset uses `https://opencode.ai/zen/go/v1`. Both prefixes LIST
|
|
501
|
+
* `hy4-flash` (measured: the same entry appears under `/zen/go/v1/models`), so both are plausible
|
|
502
|
+
* — and "plausible" is not "verified". This preset follows the **documented** inference base URL
|
|
503
|
+
* because that is the one the provider itself publishes for chat-completions, and the one its
|
|
504
|
+
* `compatibility.reasoning_field: reasoning_content` note belongs to.
|
|
505
|
+
*
|
|
506
|
+
* ⚠️ **Not measured**: whether `/zen/go/v1` also serves inference for this model. Stated as a gap
|
|
507
|
+
* rather than covered by a guess — a probe costs a real call and I do not spend production
|
|
508
|
+
* tokens to find out.
|
|
509
|
+
*
|
|
510
|
+
* ## Why the thinking table is NOT inherited from DeepSeek
|
|
511
|
+
*
|
|
512
|
+
* `capabilities.reasoning.effort` for this model is exactly `["none","high"]`. Copying
|
|
513
|
+
* `V41_FLASH_CAPS.reasoningEfforts` would advertise `low`/`medium`/`max` to the picker and every
|
|
514
|
+
* one of them would be refused upstream.
|
|
515
|
+
*/
|
|
516
|
+
"opencode-go-hy4": {
|
|
517
|
+
displayName: "OpenCode Go · Hy4 Flash",
|
|
518
|
+
api: "openai-completions",
|
|
519
|
+
baseURL: "https://opencode.ai/inference/go/openai/v1",
|
|
520
|
+
model: "hy4-flash",
|
|
521
|
+
...HY4_FLASH_CAPS,
|
|
522
|
+
compat: { ...DEEPSEEK_THINKING_COMPAT },
|
|
523
|
+
headers: { ...OPENCODE_HEADERS },
|
|
524
|
+
/**
|
|
525
|
+
* The Go usage-window surface, same as the other OpenCode preset.
|
|
526
|
+
*
|
|
527
|
+
* ⚠️ It reports the shared Go allowance, not a per-model figure: every Go model draws from ONE
|
|
528
|
+
* allowance (`docs/console/go`: 「The paid models you use on Go share one allowance」). So this
|
|
529
|
+
* row answers "how much subscription is left", never "how much Hy4 specifically".
|
|
530
|
+
*/
|
|
531
|
+
balance: { shape: "opencode-windows" },
|
|
532
|
+
note: "OpenCode Go · Hy4 Flash (model id is `hy4-flash`). Thinking levels are none/high only. Usage windows are the SHARED Go allowance, not a per-model figure."
|
|
533
|
+
},
|
|
378
534
|
ollama: {
|
|
379
535
|
displayName: "Ollama Cloud",
|
|
380
536
|
api: "openai-completions",
|
|
@@ -1243,30 +1399,17 @@ var SupplyStatus = class {
|
|
|
1243
1399
|
* this request". The ledger write cannot fail the call — accounting is not allowed to be a
|
|
1244
1400
|
* single point of failure for model traffic.
|
|
1245
1401
|
*/
|
|
1246
|
-
/** The single provider route this plugin owns. */
|
|
1247
|
-
const PROVIDER_ID = "any-deepseek";
|
|
1248
|
-
/** Display name for the route in provider selectors. */
|
|
1249
|
-
const PROVIDER_NAME = "Any DeepSeek";
|
|
1250
1402
|
/**
|
|
1251
|
-
*
|
|
1403
|
+
* The provider route this plugin owns.
|
|
1252
1404
|
*
|
|
1253
|
-
*
|
|
1254
|
-
*
|
|
1255
|
-
* `
|
|
1256
|
-
* types.d.ts:330-331`), and the host reads it at dispatch to decide whether an image survives
|
|
1257
|
-
* projection at all: `if (modelInfo.inputModalities !== undefined &&
|
|
1258
|
-
* !modelInfo.inputModalities.includes('image') && …) projectImagesForTextModel(…)`
|
|
1259
|
-
* (`dsh-llm/lib/index.js:2337`). Omitting it therefore did not mean "we never send images"; it
|
|
1260
|
-
* meant a user's screenshot was replaced by a placeholder *before* this plugin ever saw it, which
|
|
1261
|
-
* is why the model answered as though the message had been text.
|
|
1262
|
-
*
|
|
1263
|
-
* The value is the MODEL's capability, so it does not depend on which channel is selected, on
|
|
1264
|
-
* whether a key exists, or on whether `current` is set — the same rule as the catalog itself.
|
|
1265
|
-
* A relay that genuinely cannot carry images declares `input: ['text']` on its own channel, and
|
|
1266
|
-
* the transport (`pi-ai`) downgrades the image per channel; the harness-level answer stays the
|
|
1267
|
-
* model's.
|
|
1405
|
+
* Kept exported because existing saved model selections and `agent-default-model` name it, so it
|
|
1406
|
+
* must remain stable. It is now the FIRST of {@link PROVIDER_ROUTES}, not the only one — see
|
|
1407
|
+
* `presets.ts` for why a second model became a second provider.
|
|
1268
1408
|
*/
|
|
1269
|
-
const
|
|
1409
|
+
const PROVIDER_ID = "any-deepseek";
|
|
1410
|
+
/** Display name for the route in provider selectors. */
|
|
1411
|
+
const PROVIDER_NAME = "Any DeepSeek";
|
|
1412
|
+
V41_FLASH_CAPS.input;
|
|
1270
1413
|
/**
|
|
1271
1414
|
* The resolved retry policy this route registers.
|
|
1272
1415
|
*
|
|
@@ -1299,7 +1442,7 @@ const PROVIDER_RETRY_POLICY = Object.freeze({
|
|
|
1299
1442
|
/**
|
|
1300
1443
|
* The reasoning levels in force for one channel.
|
|
1301
1444
|
*
|
|
1302
|
-
* 🔴 **A channel that says nothing inherits
|
|
1445
|
+
* 🔴 **A channel that says nothing inherits its ROUTE's table, and that is the whole fix for the
|
|
1303
1446
|
* missing thinking control.**
|
|
1304
1447
|
*
|
|
1305
1448
|
* The old code read `channel.reasoningEfforts` alone. That value only existed once a channel
|
|
@@ -1310,13 +1453,18 @@ const PROVIDER_RETRY_POLICY = Object.freeze({
|
|
|
1310
1453
|
* An empty map counts as silence, not as "explicitly unsupported": `z.dict()` produces `{}` when
|
|
1311
1454
|
* the panel writes the field, and treating that as a negative capability is how the picker broke
|
|
1312
1455
|
* with `INVALID_MODEL_REASONING` in the first place.
|
|
1456
|
+
*
|
|
1457
|
+
* ⚠️ **The fallback is the ROUTE's table, not DeepSeek's.** Hy4 Flash accepts `none`/`high` only;
|
|
1458
|
+
* inheriting the DeepSeek table for it would offer `medium` to a caller whose upstream refuses it.
|
|
1459
|
+
* The route is derived from the channel's wire model id, so this holds even for a custom channel
|
|
1460
|
+
* that names no preset.
|
|
1313
1461
|
* @param channel - the selected channel, when there is one.
|
|
1314
1462
|
* @returns the levels to advertise and to send, keyed by level name.
|
|
1315
1463
|
*/
|
|
1316
1464
|
function effectiveReasoningEfforts(channel) {
|
|
1317
1465
|
const declared = channel?.reasoningEfforts;
|
|
1318
1466
|
if (declared !== void 0 && Object.keys(declared).length > 0) return declared;
|
|
1319
|
-
return
|
|
1467
|
+
return routeForChannel(channel ?? {}).caps.reasoningEfforts;
|
|
1320
1468
|
}
|
|
1321
1469
|
/**
|
|
1322
1470
|
* Derive the value for the OpenCode session header.
|
|
@@ -1935,29 +2083,70 @@ var AnyDeepSeekAdapter = class extends LlmAdapter {
|
|
|
1935
2083
|
const selected = this.selected();
|
|
1936
2084
|
const first = this.deps.channels()[0];
|
|
1937
2085
|
const label = selected?.label ?? first?.label;
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
2086
|
+
/**
|
|
2087
|
+
* 🔴 One entry per ROUTE, each describing the model THAT ROUTE serves.
|
|
2088
|
+
*
|
|
2089
|
+
* The catalog is asked per provider (`listModels(provider)`), but the host's wording is
|
|
2090
|
+
* "discover models advertised by one registered provider" and the answer is allowed to be
|
|
2091
|
+
* advisory. Since each of our routes serves exactly one model, returning all of them here keeps
|
|
2092
|
+
* the picker complete even when the host asks once — and returning them ALWAYS, never filtered
|
|
2093
|
+
* by which channels happen to exist, is decision 26 (a provider that vanishes when
|
|
2094
|
+
* unconfigured looks exactly like one that is not installed).
|
|
2095
|
+
*
|
|
2096
|
+
* ⚠️ `inputModalities` is per route, not global: Hy4 Flash and DeepSeek V4.1 Flash agree today,
|
|
2097
|
+
* but a route-level table is the only shape that stays true if they ever diverge.
|
|
2098
|
+
*/
|
|
2099
|
+
return PROVIDER_ROUTES.map((route) => ({
|
|
2100
|
+
provider: route.id,
|
|
2101
|
+
id: route.model.id,
|
|
2102
|
+
name: route.model.name,
|
|
1942
2103
|
description: label === void 0 ? "no channel configured yet" : `via ${label}`,
|
|
1943
|
-
inputModalities: [...
|
|
1944
|
-
}
|
|
2104
|
+
inputModalities: [...route.caps.input]
|
|
2105
|
+
}));
|
|
1945
2106
|
}
|
|
1946
2107
|
async resolveModel(provider, model, _signal) {
|
|
1947
|
-
const channel = this.
|
|
2108
|
+
const channel = this.selectedFor(provider);
|
|
2109
|
+
/**
|
|
2110
|
+
* 🔴 The route the CALLER asked for decides the capability table, not the channel that happens
|
|
2111
|
+
* to be live. `provider` is the route the harness will dispatch to, so answering from any
|
|
2112
|
+
* other route's table would describe a model the request is not going to use.
|
|
2113
|
+
*
|
|
2114
|
+
* Falls back to the first route for an unrecognised provider id so an older saved selection
|
|
2115
|
+
* still resolves instead of throwing — the host turns a resolve failure into a model that
|
|
2116
|
+
* cannot be selected at all, which is worse than a slightly wrong capability number.
|
|
2117
|
+
*/
|
|
2118
|
+
const route = providerRoute(provider) ?? PROVIDER_ROUTES[0];
|
|
1948
2119
|
const efforts = Object.entries(effectiveReasoningEfforts(channel)).filter(([, wire]) => wire !== null).map(([id]) => id);
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
2120
|
+
/**
|
|
2121
|
+
* 🔴 `defaultEffort` is the whole of the owner's 「默认的思考强度都是 high」 requirement.
|
|
2122
|
+
*
|
|
2123
|
+
* The host fills it in only when the caller named no effort
|
|
2124
|
+
* (`const effective = requested ?? reasoning.defaultEffort`, `dsh-llm/lib/index.js:2198`), so
|
|
2125
|
+
* an explicit choice still wins untouched. Declaring `high` is therefore a DEFAULT, not an
|
|
2126
|
+
* override: no request that already names an effort changes shape.
|
|
2127
|
+
*
|
|
2128
|
+
* ⚠️ Emitted ONLY when the level is actually offered by this route. The host rejects an
|
|
2129
|
+
* unknown default outright with `INVALID_MODEL_REASONING` (`index.js:2160`) and that takes the
|
|
2130
|
+
* whole route offline — so a route whose table lacks `high` must not claim it. This is why the
|
|
2131
|
+
* guard is `efforts.includes(...)` rather than a bare spread.
|
|
2132
|
+
*/
|
|
2133
|
+
const wantsDefault = route.defaultEffort;
|
|
2134
|
+
const defaultEffort = wantsDefault !== void 0 && efforts.includes(wantsDefault) ? { defaultEffort: ReasoningEffortId(wantsDefault) } : {};
|
|
2135
|
+
const reasoning = efforts.length === 0 ? {} : { reasoning: {
|
|
2136
|
+
efforts: efforts.map((id) => ({
|
|
2137
|
+
id: ReasoningEffortId(id),
|
|
2138
|
+
name: id
|
|
2139
|
+
})),
|
|
2140
|
+
...defaultEffort
|
|
2141
|
+
} };
|
|
1953
2142
|
return {
|
|
1954
2143
|
provider,
|
|
1955
2144
|
id: model,
|
|
1956
|
-
name:
|
|
2145
|
+
name: route.model.name,
|
|
1957
2146
|
description: channel === void 0 ? void 0 : `via ${channel.label}`,
|
|
1958
|
-
context: { contextWindow: channel?.contextWindow ??
|
|
1959
|
-
defaultMaxTokens: channel?.maxTokens,
|
|
1960
|
-
inputModalities: [...
|
|
2147
|
+
context: { contextWindow: channel?.contextWindow ?? route.caps.contextWindow },
|
|
2148
|
+
defaultMaxTokens: channel?.maxTokens ?? route.caps.maxTokens,
|
|
2149
|
+
inputModalities: [...route.caps.input],
|
|
1961
2150
|
...reasoning
|
|
1962
2151
|
};
|
|
1963
2152
|
}
|
|
@@ -2000,9 +2189,27 @@ var AnyDeepSeekAdapter = class extends LlmAdapter {
|
|
|
2000
2189
|
async *stream(options) {
|
|
2001
2190
|
const supply = this.deps.supply();
|
|
2002
2191
|
supply.status.bind(supply.members);
|
|
2003
|
-
|
|
2192
|
+
/**
|
|
2193
|
+
* 🔴 **Filter by the route the caller dispatched to — this is what makes a second provider a
|
|
2194
|
+
* real choice.** `options.provider` is the registered route the harness picked
|
|
2195
|
+
* (`dsh-llm/lib/types/types.d.ts:508`), so `any-hy` narrows the eligible channels to those
|
|
2196
|
+
* whose wire model is Hy4 Flash. Without this line the picker would change a title and route
|
|
2197
|
+
* exactly the same requests, which is the defect class this repo keeps paying for: a control
|
|
2198
|
+
* that reports a choice it never applies.
|
|
2199
|
+
*
|
|
2200
|
+
* ⚠️ Filtering happens BEFORE selection, so `current` keeps its single meaning ("which
|
|
2201
|
+
* channel is live") and a route can only exclude channels, never elect one behind the user's
|
|
2202
|
+
* back. When nothing eligible remains the failure names the situation rather than silently
|
|
2203
|
+
* serving a different model.
|
|
2204
|
+
*/
|
|
2205
|
+
const route = providerRoute(options.provider);
|
|
2206
|
+
const eligible = route === void 0 ? this.deps.channels() : this.deps.channels().filter((channel) => routeServes(route, channel));
|
|
2207
|
+
const selection = selectChannel(eligible, this.deps.current(), supply.members);
|
|
2004
2208
|
if (!selection.ok) {
|
|
2005
|
-
yield failureChunk(
|
|
2209
|
+
yield failureChunk(route !== void 0 && eligible.length === 0 ? {
|
|
2210
|
+
code: "NO_CHANNELS",
|
|
2211
|
+
detail: `no channel serves the "${route.name}" route; add a channel whose model is ${route.model.id === void 0 ? route.model.name : route.model.id} in Settings → Any DeepSeek`
|
|
2212
|
+
} : selection.failure);
|
|
2006
2213
|
return;
|
|
2007
2214
|
}
|
|
2008
2215
|
const head = selection.channel;
|
|
@@ -2038,8 +2245,14 @@ var AnyDeepSeekAdapter = class extends LlmAdapter {
|
|
|
2038
2245
|
* ⚠️ The failed channel is excluded. It is `current`, so a user may well have put it in the
|
|
2039
2246
|
* group too; re-attempting it immediately would spend a guaranteed second refusal on the same
|
|
2040
2247
|
* dead account, which is not "供应不中断", it is a loop.
|
|
2248
|
+
*
|
|
2249
|
+
* 🔴 **Filtered by ROUTE as well** (same reason as the head selection). A group may legitimately
|
|
2250
|
+
* mix models — the user's priority order is about accounts, not about models — so without this
|
|
2251
|
+
* an `any-hy` request that fell back would continue onto a DeepSeek channel and answer with a
|
|
2252
|
+
* different model than the one the caller selected. The safety net exists to keep TOKENS
|
|
2253
|
+
* flowing, not to silently swap the model.
|
|
2041
2254
|
*/
|
|
2042
|
-
const groupFallback = fromGroup ? [] : orderWithCooldowns(groupMembers(this.deps.channels(), supply.members).ordered.filter((channel) => channel.id !== head.id), cooling).walk;
|
|
2255
|
+
const groupFallback = fromGroup ? [] : orderWithCooldowns(groupMembers(this.deps.channels(), supply.members).ordered.filter((channel) => channel.id !== head.id).filter((channel) => route === void 0 || routeServes(route, channel)), cooling).walk;
|
|
2043
2256
|
/** Whether the safety net has already fired for this request (it may fire at most once). */
|
|
2044
2257
|
let fellBack = false;
|
|
2045
2258
|
/** Every attempt this request made, for the message on total failure. */
|
|
@@ -2214,6 +2427,41 @@ var AnyDeepSeekAdapter = class extends LlmAdapter {
|
|
|
2214
2427
|
const selection = selectChannel(this.deps.channels(), this.deps.current(), supply.members);
|
|
2215
2428
|
return selection.ok ? selection.channel : void 0;
|
|
2216
2429
|
}
|
|
2430
|
+
/**
|
|
2431
|
+
* The channel that will serve the next request **for one provider route**.
|
|
2432
|
+
*
|
|
2433
|
+
* 🔴 This is what makes the second provider a real axis instead of a label. Without the filter,
|
|
2434
|
+
* selecting `any-hy` in the model picker would still route to whatever channel `current` names —
|
|
2435
|
+
* so the user's choice would change the composer's title and nothing else.
|
|
2436
|
+
*
|
|
2437
|
+
* ## Why filtering, rather than a second `current`
|
|
2438
|
+
*
|
|
2439
|
+
* `current` answers "which channel is live" and stays the single source of truth for that. A
|
|
2440
|
+
* provider route only narrows the SET of channels eligible to answer it. That keeps one axis:
|
|
2441
|
+
* adding a route can never put two settings into contradiction, and removing every route-eligible
|
|
2442
|
+
* channel is a visible failure (`CHANNEL_UNKNOWN` naming the available ids) rather than a silent
|
|
2443
|
+
* fallback to a channel serving a different model.
|
|
2444
|
+
*
|
|
2445
|
+
* @param provider - the route key the harness is dispatching to.
|
|
2446
|
+
* @returns the selected channel when it serves this route; otherwise the first channel that does.
|
|
2447
|
+
*/
|
|
2448
|
+
selectedFor(provider) {
|
|
2449
|
+
const route = providerRoute(provider);
|
|
2450
|
+
if (route === void 0) return this.selected();
|
|
2451
|
+
const eligible = this.deps.channels().filter((channel) => routeServes(route, channel));
|
|
2452
|
+
if (eligible.length === 0) return void 0;
|
|
2453
|
+
const supply = this.deps.supply();
|
|
2454
|
+
const selection = selectChannel(eligible, this.deps.current(), supply.members);
|
|
2455
|
+
/**
|
|
2456
|
+
* ⚠️ The configured selection may name a channel that serves a DIFFERENT route (the user is on
|
|
2457
|
+
* `any-deepseek` with `current` pointing at a DeepSeek channel, then switches the picker to
|
|
2458
|
+
* `any-hy`). In that case `selectChannel` fails with `CHANNEL_UNKNOWN` — correct for routing a
|
|
2459
|
+
* request, but wrong for reading metadata, where a fallback tells the composer what this route
|
|
2460
|
+
* can actually do. So metadata falls back to the first eligible channel.
|
|
2461
|
+
*/
|
|
2462
|
+
if (selection.ok) return selection.channel;
|
|
2463
|
+
return eligible[0];
|
|
2464
|
+
}
|
|
2217
2465
|
};
|
|
2218
2466
|
/**
|
|
2219
2467
|
* Turn a terminal failure into the message the user reads.
|
|
@@ -3552,14 +3800,30 @@ function apply(ctx, config) {
|
|
|
3552
3800
|
elapsed: () => Number(process.hrtime.bigint() / 1000000n)
|
|
3553
3801
|
});
|
|
3554
3802
|
const llm = service(ctx, "llm");
|
|
3555
|
-
if (typeof llm?.registerAdapter === "function")
|
|
3803
|
+
if (typeof llm?.registerAdapter === "function")
|
|
3804
|
+
/**
|
|
3805
|
+
* 🔴 **Every route in ONE call, because the host's signature takes an ARRAY**
|
|
3806
|
+
* (`registerAdapter(providers: string[], adapter)`, `dsh-llm/lib/types/index.d.ts:262`).
|
|
3807
|
+
*
|
|
3808
|
+
* That is what lets one adapter instance serve `any-deepseek` and `any-hy`: the route key
|
|
3809
|
+
* arrives on every request as `GenerateOptions.provider`, so `stream()` can filter eligible
|
|
3810
|
+
* channels per route. Registering one route at a time would still work, but it would create two
|
|
3811
|
+
* adapter instances over the same configuration state and they could disagree about `current`.
|
|
3812
|
+
*/
|
|
3813
|
+
llm.registerAdapter(PROVIDER_ROUTES.map((route) => route.id), adapter);
|
|
3556
3814
|
else console.warn("[any-deepseek] the `llm` service is unavailable; the provider was not registered");
|
|
3557
|
-
if (typeof llm?.registerConfigurableProviders === "function")
|
|
3558
|
-
|
|
3559
|
-
|
|
3815
|
+
if (typeof llm?.registerConfigurableProviders === "function")
|
|
3816
|
+
/**
|
|
3817
|
+
* One directory row per route. `settingsNs` is the same for both — they are configured by the
|
|
3818
|
+
* SAME settings section (one channel table, one `current`), which is the point: the routes are
|
|
3819
|
+
* two views of one configuration, not two configurations.
|
|
3820
|
+
*/
|
|
3821
|
+
llm.registerConfigurableProviders(PROVIDER_ROUTES.map((route) => ({
|
|
3822
|
+
provider: route.id,
|
|
3823
|
+
displayName: route.name,
|
|
3560
3824
|
settingsNs: "dsh-any-deepseek",
|
|
3561
3825
|
settingsPath: []
|
|
3562
|
-
}
|
|
3826
|
+
})));
|
|
3563
3827
|
const webServer = service(ctx, "webServer");
|
|
3564
3828
|
if (typeof webServer?.register === "function") registerStatsRoutes(ctx, webServer, {
|
|
3565
3829
|
channels,
|
package/lib/presets.d.ts
CHANGED
|
@@ -116,14 +116,94 @@ export declare const ADVERTISED_MODEL_ID = "deepseek-v4.1-flash";
|
|
|
116
116
|
/** Display name for {@link ADVERTISED_MODEL_ID}. */
|
|
117
117
|
export declare const ADVERTISED_MODEL_NAME = "DeepSeek V4.1 Flash";
|
|
118
118
|
/**
|
|
119
|
-
*
|
|
119
|
+
* One registration unit: a provider route, the ONE model it exposes, and that model's facts.
|
|
120
120
|
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
121
|
+
* ## Why a provider per model rather than two entries in one picker (owner, 2026-12-01)
|
|
122
|
+
*
|
|
123
|
+
* Owner ruling: 「我觉得我们多注册一个provider,叫 Any Hy 好像就行了」. That is the right shape for a
|
|
124
|
+
* measured reason, not a cosmetic one — **the model id a caller selects never reaches routing**.
|
|
125
|
+
* `stream()` resolves the serving channel from `current` alone and `buildPiModel()` substitutes
|
|
126
|
+
* each channel's own `model`; `options.model` is read for nothing but echo. So a second entry in
|
|
127
|
+
* the SAME provider's model list would be a control that changes no behaviour: the user picks
|
|
128
|
+
* "Hy4 flash", the request still goes out as whatever the channel's `model` spells, and the only
|
|
129
|
+
* visible difference would be a name in the composer. Adding a provider instead makes the choice
|
|
130
|
+
* real, because `GenerateOptions.provider` DOES reach the adapter on every request
|
|
131
|
+
* (`dsh-llm/lib/types/types.d.ts:508`), so the adapter can filter channels by it.
|
|
132
|
+
*
|
|
133
|
+
* The host leaves this seam open on purpose: `registerAdapter(providers: string[], adapter)`
|
|
134
|
+
* takes an ARRAY (`dsh-llm/lib/types/index.d.ts:262`). One adapter instance can therefore serve
|
|
135
|
+
* several routes, which is what lets this stay one file's worth of wiring instead of two.
|
|
136
|
+
*
|
|
137
|
+
* ⚠️ **This is a real axis boundary, not a convenience.** A provider is a promise about WHICH
|
|
138
|
+
* MODEL the caller gets. Two models behind one provider would let a single conversation change
|
|
139
|
+
* models mid-thread with no replayed-message compatibility between them.
|
|
124
140
|
*/
|
|
125
|
-
export
|
|
126
|
-
|
|
141
|
+
export interface ProviderRoute {
|
|
142
|
+
/** Route key, i.e. `GenerateOptions.provider`. Part of the user's saved model selection. */
|
|
143
|
+
id: string;
|
|
144
|
+
/** Display name in provider selectors. */
|
|
145
|
+
name: string;
|
|
146
|
+
/** The one model this route exposes, as the picker shows it. Provider-neutral spelling. */
|
|
147
|
+
model: {
|
|
148
|
+
id: string;
|
|
149
|
+
name: string;
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* Which channels may serve this route.
|
|
153
|
+
*
|
|
154
|
+
* 🔴 **A predicate over the resolved channel, not a list of preset ids.** The rule a user
|
|
155
|
+
* reasons about is "this route serves this model", which is a fact about the model id on the
|
|
156
|
+
* wire — a channel that names a preset AND overrides `model` must still land on the right side.
|
|
157
|
+
* Matching on preset id would put an overridden channel on the wrong route silently.
|
|
158
|
+
*
|
|
159
|
+
* ⚠️ Read through {@link routeServes}, not called directly: a `fallback` route also owns every
|
|
160
|
+
* channel no other route claims.
|
|
161
|
+
*/
|
|
162
|
+
serves: (channel: {
|
|
163
|
+
model: string;
|
|
164
|
+
}) => boolean;
|
|
165
|
+
/**
|
|
166
|
+
* Whether this route is the one for models no other route names.
|
|
167
|
+
*
|
|
168
|
+
* 🔴 **Load-bearing, and it preserves a capability that already shipped.** A user may fully
|
|
169
|
+
* declare a custom channel with an arbitrary model id and point `current` at it — that has
|
|
170
|
+
* always worked and must keep working. A strict per-route filter would silently make such a
|
|
171
|
+
* channel unusable: the request would fail with "no channel serves this route" even though the
|
|
172
|
+
* user's configuration is perfectly valid.
|
|
173
|
+
*
|
|
174
|
+
* ⇒ Exactly one route is the fallback, and it accepts what nobody else claims. Adding a second
|
|
175
|
+
* `fallback: true` would make the answer ambiguous, so this is a shape guarantee to be checked,
|
|
176
|
+
* not a free flag — a negative control pins it.
|
|
177
|
+
*/
|
|
178
|
+
fallback?: boolean;
|
|
179
|
+
/**
|
|
180
|
+
* Capabilities of {@link model}, used for the catalog and for `resolveModel()`.
|
|
181
|
+
*
|
|
182
|
+
* Both host paths read this, and they read it independently — see the drift note on
|
|
183
|
+
* {@link V41_FLASH_CAPS}.
|
|
184
|
+
*/
|
|
185
|
+
caps: {
|
|
186
|
+
contextWindow: number;
|
|
187
|
+
maxTokens: number;
|
|
188
|
+
input: ChannelModality[];
|
|
189
|
+
reasoningEfforts: Record<string, string | null>;
|
|
190
|
+
};
|
|
191
|
+
/**
|
|
192
|
+
* The thinking level used when the caller names none.
|
|
193
|
+
*
|
|
194
|
+
* 🔴 **Load-bearing, and it is the whole of the owner's second request** (「我们提供的模型默认的
|
|
195
|
+
* 思考强度都是high」). The host materialises it for us rather than us rewriting requests:
|
|
196
|
+
* `const effective = requested ?? reasoning.defaultEffort` (`dsh-llm/lib/index.js:2198`). So this
|
|
197
|
+
* is not a preference this plugin applies — it is a default the host fills in when nobody
|
|
198
|
+
* asked, which means an explicit user choice still wins and a request that names an effort is
|
|
199
|
+
* byte-for-byte what it was before.
|
|
200
|
+
*
|
|
201
|
+
* ⚠️ Must exist in {@link caps}`.reasoningEfforts` with a non-null wire value: the host rejects
|
|
202
|
+
* an unknown default outright (`INVALID_MODEL_REASONING`, `index.js:2160`), which would take
|
|
203
|
+
* the whole route offline. A negative control pins this.
|
|
204
|
+
*/
|
|
205
|
+
defaultEffort: string;
|
|
206
|
+
}
|
|
127
207
|
/**
|
|
128
208
|
* Capability numbers shared by every DeepSeek V4.1 Flash deployment we know of.
|
|
129
209
|
*
|
|
@@ -144,6 +224,12 @@ export declare const DEFAULT_MAX_TOKENS = 32768;
|
|
|
144
224
|
* describe the advertised model rather than any one channel. Reaching for this constant (instead
|
|
145
225
|
* of re-listing the numbers there) keeps the catalog and the exact-model answer from drifting —
|
|
146
226
|
* and they are read by different host paths, so a drift is silent.
|
|
227
|
+
*
|
|
228
|
+
* ⚠️ **Declared BEFORE {@link PROVIDER_ROUTES}, and the order is load-bearing.** That table reads
|
|
229
|
+
* this constant while the module is being initialised; putting it below would hit the temporal
|
|
230
|
+
* dead zone and throw at import time (`Cannot access 'V41_FLASH_CAPS' before initialization`),
|
|
231
|
+
* which takes the whole provider offline rather than degrading. Same reason {@link HY4_FLASH_CAPS}
|
|
232
|
+
* sits above the table.
|
|
147
233
|
*/
|
|
148
234
|
export declare const V41_FLASH_CAPS: {
|
|
149
235
|
contextWindow: number;
|
|
@@ -159,6 +245,87 @@ export declare const V41_FLASH_CAPS: {
|
|
|
159
245
|
*/
|
|
160
246
|
reasoningEfforts: Record<string, string | null>;
|
|
161
247
|
};
|
|
248
|
+
/**
|
|
249
|
+
* Capabilities of Hy4 Flash, measured from the relay's own model list (2026-12-01).
|
|
250
|
+
*
|
|
251
|
+
* Provenance and the full entry: `docs/hy4-flash-model-facts.md`.
|
|
252
|
+
*
|
|
253
|
+
* 🔴 **The thinking levels are `none` / `high` and nothing else.** Not a trimmed copy of the
|
|
254
|
+
* DeepSeek table by choice — the endpoint advertises exactly those two (`capabilities.reasoning.
|
|
255
|
+
* effort: ["none","high"]`). Declaring `medium` here would offer the user a level the upstream
|
|
256
|
+
* refuses, which is the same class of defect as hiding one it accepts.
|
|
257
|
+
*
|
|
258
|
+
* ⚠️ Three sibling models exist in the same catalog (`hy4`, `hy4-preview`, `hy4-flash`). This
|
|
259
|
+
* constant is the `hy4-flash` one: image input, 1M context, 64k output.
|
|
260
|
+
*/
|
|
261
|
+
export declare const HY4_FLASH_CAPS: {
|
|
262
|
+
contextWindow: number;
|
|
263
|
+
maxTokens: number;
|
|
264
|
+
input: ChannelModality[];
|
|
265
|
+
/**
|
|
266
|
+
* `off` maps to the wire value `none` rather than `null`.
|
|
267
|
+
*
|
|
268
|
+
* 🔴 The distinction matters twice over: `null` would mark the level as "explicitly
|
|
269
|
+
* unsupported" and drop it from the picker (see `effectiveReasoningEfforts`), while this relay
|
|
270
|
+
* genuinely accepts "no thinking". Mapping `off → 'none'` keeps the level selectable AND sends
|
|
271
|
+
* the spelling the endpoint documents.
|
|
272
|
+
*/
|
|
273
|
+
reasoningEfforts: Record<string, string | null>;
|
|
274
|
+
};
|
|
275
|
+
/**
|
|
276
|
+
* The provider routes this plugin registers.
|
|
277
|
+
*
|
|
278
|
+
* ⚠️ Order is the order the host shows them in; `any-deepseek` stays first because it is the
|
|
279
|
+
* route every existing saved selection already names (and the container's default model points
|
|
280
|
+
* at it). Reordering this array would not break those selections — they name the route
|
|
281
|
+
* explicitly — but it would change what a user sees first.
|
|
282
|
+
*/
|
|
283
|
+
export declare const PROVIDER_ROUTES: readonly ProviderRoute[];
|
|
284
|
+
/**
|
|
285
|
+
* Whether one route may serve one channel's wire model.
|
|
286
|
+
*
|
|
287
|
+
* 🔴 **This is the only correct way to ask**, and the reason is a capability that must not
|
|
288
|
+
* regress: a user may fully declare a custom channel with an arbitrary `model` and point `current`
|
|
289
|
+
* at it. That always worked. A strict per-route filter would answer "no channel serves this route"
|
|
290
|
+
* for a perfectly valid configuration, so the route marked {@link ProviderRoute.fallback} also
|
|
291
|
+
* accepts every model no other route claims.
|
|
292
|
+
*
|
|
293
|
+
* ⚠️ "Claims" is computed against the OTHER routes, not against this one, so the answer does not
|
|
294
|
+
* depend on which route happens to be asked first.
|
|
295
|
+
* @param route - the route being tested.
|
|
296
|
+
* @param channel - the channel, by wire model id.
|
|
297
|
+
* @returns whether this route may serve that channel.
|
|
298
|
+
*/
|
|
299
|
+
export declare function routeServes(route: ProviderRoute, channel: {
|
|
300
|
+
model: string;
|
|
301
|
+
}): boolean;
|
|
302
|
+
/**
|
|
303
|
+
* Look one route up by its key.
|
|
304
|
+
* @param id - `GenerateOptions.provider`.
|
|
305
|
+
* @returns the route, or `undefined` when the id is not ours.
|
|
306
|
+
*/
|
|
307
|
+
export declare function providerRoute(id: string): ProviderRoute | undefined;
|
|
308
|
+
/**
|
|
309
|
+
* The route a channel belongs to, by its wire model id.
|
|
310
|
+
*
|
|
311
|
+
* Falls back to the first route so a custom channel the user declared by hand still resolves
|
|
312
|
+
* against a real capability table instead of a made-up one — the old behaviour for every
|
|
313
|
+
* unrecognised model, preserved deliberately.
|
|
314
|
+
* @param channel - a resolved or partially declared channel.
|
|
315
|
+
* @returns the matching route.
|
|
316
|
+
*/
|
|
317
|
+
export declare function routeForChannel(channel: {
|
|
318
|
+
model?: string;
|
|
319
|
+
}): ProviderRoute;
|
|
320
|
+
/**
|
|
321
|
+
* Fallbacks for a custom channel that declares a model without capacities.
|
|
322
|
+
*
|
|
323
|
+
* These match the pi-ai adapter's own documented defaults (`DEFAULT_CONTEXT_WINDOW`,
|
|
324
|
+
* `DEFAULT_MAX_TOKENS`) so a half-filled custom channel behaves the same way a pi-ai route
|
|
325
|
+
* would, rather than surprising the user with a plugin-specific number.
|
|
326
|
+
*/
|
|
327
|
+
export declare const DEFAULT_CONTEXT_WINDOW = 262144;
|
|
328
|
+
export declare const DEFAULT_MAX_TOKENS = 32768;
|
|
162
329
|
/**
|
|
163
330
|
* The user agent a request to OpenCode Go identifies itself with.
|
|
164
331
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-any-deepseek",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.41",
|
|
4
4
|
"description": "One DeepSeek V4.1 Flash provider for DeepSeek Harness: paste a key per channel, switch channels manually, token usage booked per real upstream.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|