dsh-any-deepseek 0.0.32 → 0.0.33
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/lib/adapter.d.ts +55 -1
- package/lib/index.js +40 -0
- package/package.json +1 -1
package/lib/adapter.d.ts
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* single point of failure for model traffic.
|
|
25
25
|
*/
|
|
26
26
|
import { LlmAdapter } from '@deepseek-ai/dsh-llm';
|
|
27
|
-
import type { GenerateOptions, LlmModelInfo, LlmProviderInfo, LlmResolvedModelInfo, PreparedAdapterCall, StreamChunk, TokenUsage } from '@deepseek-ai/dsh-llm';
|
|
27
|
+
import type { GenerateOptions, LlmModelInfo, LlmProviderInfo, LlmResolvedModelInfo, PreparedAdapterCall, ResolvedRetryPolicy, StreamChunk, TokenUsage } from '@deepseek-ai/dsh-llm';
|
|
28
28
|
import { credentialRef } from '@deepseek-ai/dsh-credentials';
|
|
29
29
|
import { type Api, type AssistantMessage, type AssistantMessageEvent, type Context as PiContext, type Model } from '@earendil-works/pi-ai';
|
|
30
30
|
import { openAICompletionsApi } from '@earendil-works/pi-ai/api/openai-completions.lazy';
|
|
@@ -55,6 +55,51 @@ export declare const PROVIDER_NAME = "Any DeepSeek";
|
|
|
55
55
|
* model's.
|
|
56
56
|
*/
|
|
57
57
|
export declare const MODEL_INPUT_MODALITIES: readonly ChannelModality[];
|
|
58
|
+
/**
|
|
59
|
+
* Retry budget this provider asks the harness to use, per request.
|
|
60
|
+
*
|
|
61
|
+
* ## Why the provider owns this number at all
|
|
62
|
+
*
|
|
63
|
+
* The harness stores one retry policy **per registered route**, captured at registration
|
|
64
|
+
* (`dsh-llm/lib/index.js:1876`: `adapter.providerRetryPolicy(provider) ?? resolveRetryPolicy(undefined, …)`),
|
|
65
|
+
* and hands it to the `agent/request-error` waterfall on every failed attempt
|
|
66
|
+
* (`dsh-agent-loop/lib/index.js:934`). The `dsh-llm-retry` plugin is the consumer that acts on it.
|
|
67
|
+
* An adapter that does not override `providerRetryPolicy` gets the host default —
|
|
68
|
+
* **5 retries** (`dsh-llm/lib/types/retry-policy.js:12`).
|
|
69
|
+
*
|
|
70
|
+
* Owner request (2026-11-10): 「把 dsh 的模型调用重试 patch 到 100」. Behind a relay that returns
|
|
71
|
+
* intermittent 5xx (e.g. the upstream `workspace_billing_scope_unavailable` that motivated 0.0.32),
|
|
72
|
+
* five attempts can all land inside one outage window and the turn dies. A larger budget costs
|
|
73
|
+
* nothing when the relay is healthy — the policy is only consulted after a failure.
|
|
74
|
+
*
|
|
75
|
+
* ## What this deliberately does NOT change
|
|
76
|
+
*
|
|
77
|
+
* `retryableCodes`, `backoff` and `mode` stay at the host's values. Raising only the COUNT keeps
|
|
78
|
+
* the failure taxonomy exactly as the host defines it: auth and quota are still not retried, and
|
|
79
|
+
* `CONTEXT_WINDOW_EXCEEDED` still never retries (0.0.32's whole point). A policy that widened the
|
|
80
|
+
* code set would be this plugin deciding which failures are recoverable — it does not get to.
|
|
81
|
+
*
|
|
82
|
+
* ⚠️ **This is a request, not a guarantee**: the policy reaches `dsh-llm-retry` through the host's
|
|
83
|
+
* registration, so an installation without that plugin simply ignores it (still one attempt per
|
|
84
|
+
* stream, as `dsh-llm` documents).
|
|
85
|
+
*/
|
|
86
|
+
export declare const PROVIDER_MAX_RETRIES = 100;
|
|
87
|
+
/**
|
|
88
|
+
* The resolved retry policy this route registers.
|
|
89
|
+
*
|
|
90
|
+
* ⚠️ **The backoff fields are FLAT here, not nested under `backoff`.** The host's INPUT shape
|
|
91
|
+
* (`RetryPolicyConfig`) nests them, but its RESOLVED shape does not:
|
|
92
|
+
* `ResolvedNormalRetryPolicy extends ResolvedRetryBackoff` (`dsh-llm/lib/types/retry-policy.d.ts:46-50`),
|
|
93
|
+
* so the policy a `providerRetryPolicy()` implementation returns carries
|
|
94
|
+
* `initialDelayMs` / `maxDelayMs` / `jitterRatio` as siblings of `mode` and `maxRetries`. The
|
|
95
|
+
* distinction is only visible because TypeScript rejected the nested form — worth pinning here so
|
|
96
|
+
* the next reader does not "tidy" it back into a nested object that silently fails to typecheck
|
|
97
|
+
* (and, in a JavaScript build, would silently fall back to defaults instead).
|
|
98
|
+
*
|
|
99
|
+
* Values mirror `dsh-llm/lib/types/retry-policy.js:13-22` exactly; if the host changes those
|
|
100
|
+
* defaults, this stays pinned to what it says rather than silently following.
|
|
101
|
+
*/
|
|
102
|
+
export declare const PROVIDER_RETRY_POLICY: ResolvedRetryPolicy;
|
|
58
103
|
/**
|
|
59
104
|
* The reasoning levels in force for one channel.
|
|
60
105
|
*
|
|
@@ -273,6 +318,15 @@ export declare class AnyDeepSeekAdapter extends LlmAdapter {
|
|
|
273
318
|
private readonly deps;
|
|
274
319
|
constructor(deps: AdapterDeps);
|
|
275
320
|
providerInfo(provider: string): LlmProviderInfo;
|
|
321
|
+
/**
|
|
322
|
+
* The retry budget this route asks the harness to use.
|
|
323
|
+
*
|
|
324
|
+
* 🔴 Without this override the host substitutes its own default (5 retries) — and the failure is
|
|
325
|
+
* completely silent: requests still work, they just give up sooner. See
|
|
326
|
+
* {@link PROVIDER_RETRY_POLICY} for why 100 and what is deliberately left untouched.
|
|
327
|
+
* @returns the frozen policy captured at registration.
|
|
328
|
+
*/
|
|
329
|
+
providerRetryPolicy(_provider: string): ResolvedRetryPolicy;
|
|
276
330
|
/**
|
|
277
331
|
* Advertise exactly one model — **unconditionally**.
|
|
278
332
|
*
|
package/lib/index.js
CHANGED
|
@@ -804,6 +804,35 @@ const PROVIDER_NAME = "Any DeepSeek";
|
|
|
804
804
|
*/
|
|
805
805
|
const MODEL_INPUT_MODALITIES = V41_FLASH_CAPS.input;
|
|
806
806
|
/**
|
|
807
|
+
* The resolved retry policy this route registers.
|
|
808
|
+
*
|
|
809
|
+
* ⚠️ **The backoff fields are FLAT here, not nested under `backoff`.** The host's INPUT shape
|
|
810
|
+
* (`RetryPolicyConfig`) nests them, but its RESOLVED shape does not:
|
|
811
|
+
* `ResolvedNormalRetryPolicy extends ResolvedRetryBackoff` (`dsh-llm/lib/types/retry-policy.d.ts:46-50`),
|
|
812
|
+
* so the policy a `providerRetryPolicy()` implementation returns carries
|
|
813
|
+
* `initialDelayMs` / `maxDelayMs` / `jitterRatio` as siblings of `mode` and `maxRetries`. The
|
|
814
|
+
* distinction is only visible because TypeScript rejected the nested form — worth pinning here so
|
|
815
|
+
* the next reader does not "tidy" it back into a nested object that silently fails to typecheck
|
|
816
|
+
* (and, in a JavaScript build, would silently fall back to defaults instead).
|
|
817
|
+
*
|
|
818
|
+
* Values mirror `dsh-llm/lib/types/retry-policy.js:13-22` exactly; if the host changes those
|
|
819
|
+
* defaults, this stays pinned to what it says rather than silently following.
|
|
820
|
+
*/
|
|
821
|
+
const PROVIDER_RETRY_POLICY = Object.freeze({
|
|
822
|
+
mode: "normal",
|
|
823
|
+
maxRetries: 100,
|
|
824
|
+
retryableCodes: Object.freeze([
|
|
825
|
+
"EMPTY_RESPONSE",
|
|
826
|
+
"RATE_LIMIT",
|
|
827
|
+
"SERVER",
|
|
828
|
+
"TIMEOUT",
|
|
829
|
+
"TRANSPORT"
|
|
830
|
+
]),
|
|
831
|
+
initialDelayMs: 500,
|
|
832
|
+
maxDelayMs: 1e4,
|
|
833
|
+
jitterRatio: .1
|
|
834
|
+
});
|
|
835
|
+
/**
|
|
807
836
|
* The reasoning levels in force for one channel.
|
|
808
837
|
*
|
|
809
838
|
* 🔴 **A channel that says nothing inherits the model's table, and that is the whole fix for the
|
|
@@ -1386,6 +1415,17 @@ var AnyDeepSeekAdapter = class extends LlmAdapter {
|
|
|
1386
1415
|
};
|
|
1387
1416
|
}
|
|
1388
1417
|
/**
|
|
1418
|
+
* The retry budget this route asks the harness to use.
|
|
1419
|
+
*
|
|
1420
|
+
* 🔴 Without this override the host substitutes its own default (5 retries) — and the failure is
|
|
1421
|
+
* completely silent: requests still work, they just give up sooner. See
|
|
1422
|
+
* {@link PROVIDER_RETRY_POLICY} for why 100 and what is deliberately left untouched.
|
|
1423
|
+
* @returns the frozen policy captured at registration.
|
|
1424
|
+
*/
|
|
1425
|
+
providerRetryPolicy(_provider) {
|
|
1426
|
+
return PROVIDER_RETRY_POLICY;
|
|
1427
|
+
}
|
|
1428
|
+
/**
|
|
1389
1429
|
* Advertise exactly one model — **unconditionally**.
|
|
1390
1430
|
*
|
|
1391
1431
|
* 🔴 **This used to require a resolvable key, and that was wrong.**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-any-deepseek",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.33",
|
|
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": {
|