dsh-opendesign-corouter 0.1.10 → 0.1.12
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 -5
- package/SECURITY.md +1 -0
- package/lib/adapter.d.ts +2 -0
- package/lib/catalog.d.ts +4 -3
- package/lib/claude-capabilities.d.ts +8 -0
- package/lib/claude-parameters.d.ts +3 -0
- package/lib/client.d.ts +4 -1
- package/lib/client.js +125 -17
- package/lib/device-auth.d.ts +1 -1
- package/lib/empty-turn.d.ts +11 -6
- package/lib/eot-code.d.ts +2 -0
- package/lib/eot-recovery.d.ts +33 -0
- package/lib/generated/typert.host.js +12 -1
- package/lib/generated/typert.remote-client.js +12 -1
- package/lib/index.js +579 -132
- package/lib/index.js.map +4 -4
- package/lib/model-settings.d.ts +4 -3
- package/lib/protocols/errors.d.ts +4 -0
- package/lib/protocols/messages.d.ts +5 -7
- package/lib/protocols/types.d.ts +10 -1
- package/lib/remote.d.ts +2 -0
- package/lib/replay-key.d.ts +13 -0
- package/package.json +1 -1
package/lib/model-settings.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ import type { CatalogModel } from './catalog.js';
|
|
|
16
16
|
export interface ModelSettings {
|
|
17
17
|
/** 是否出现在模型选择器;缺省视为启用。 */
|
|
18
18
|
enabled?: boolean;
|
|
19
|
+
/** 图片输入的手动覆盖;缺省时沿用目录能力或保持未知。 */
|
|
20
|
+
imageInput?: boolean;
|
|
19
21
|
/** 采样温度,0–2。 */
|
|
20
22
|
temperature?: number;
|
|
21
23
|
/** 核采样,0–1。 */
|
|
@@ -36,9 +38,8 @@ export type ModelSettingsMap = Record<string, ModelSettings>;
|
|
|
36
38
|
*/
|
|
37
39
|
export declare function parseModelSettingsMap(value: unknown): ModelSettingsMap;
|
|
38
40
|
/**
|
|
39
|
-
* Copy a catalog row and apply
|
|
40
|
-
* its arrays are never mutated;
|
|
41
|
-
* not to the catalog row, so they are not folded in here.
|
|
41
|
+
* Copy a catalog row and apply explicit capacity and image-input overrides. The input row and
|
|
42
|
+
* its arrays are never mutated; sampling and effort belong to the request instead.
|
|
42
43
|
*/
|
|
43
44
|
export declare function applyModelSettings(row: CatalogModel, settings?: ModelSettings): CatalogModel;
|
|
44
45
|
/** A model is selectable unless the map explicitly disables it; unknown ids and an absent map stay enabled. */
|
|
@@ -22,6 +22,10 @@
|
|
|
22
22
|
* 归入额度而不是限流,401 + 额度证据归入额度而不是认证。
|
|
23
23
|
*/
|
|
24
24
|
import { LlmError } from '@deepseek-ai/dsh-llm';
|
|
25
|
+
/** Missing terminal event, distinguished from a malformed event without changing its base code. */
|
|
26
|
+
export declare class PrematureEndError extends LlmError {
|
|
27
|
+
constructor(message: string);
|
|
28
|
+
}
|
|
25
29
|
/**
|
|
26
30
|
* OpenAI 风格信封:`{ error: { code, type, message } }`(Chat Completions 与 Responses 实测一致)。
|
|
27
31
|
*
|
|
@@ -10,14 +10,12 @@
|
|
|
10
10
|
* - `reasoningEffort` 按现代 Messages 标准投影为 `thinking: {type:'adaptive'}` +
|
|
11
11
|
* `output_config.effort`;`none` 投影为 `thinking: {type:'disabled'}`;`minimal`/`ultra`
|
|
12
12
|
* 等没有对应 effort 的档位抛 UNSUPPORTED_OPTION;
|
|
13
|
-
* -
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* - 历史 assistant 的 reasoning 块没有 Anthropic 签名,**不回放**(伪造签名会污染上下文),
|
|
17
|
-
* 只把本轮 `thinking_delta` 映射成 reasoning 输出块。
|
|
13
|
+
* - 已确认的八个 Claude 模型先校验 Messages 采样默认值与 128000 输出上限;
|
|
14
|
+
* 其余模型的采样限制及 legacy thinking 兼容性由上游按实际模型判定;
|
|
15
|
+
* - 签名与密态仅保存在 adapter-private replay metadata;历史无签名 reasoning 不回放。
|
|
18
16
|
*/
|
|
19
17
|
import { type StreamChunk } from '@deepseek-ai/dsh-llm';
|
|
20
|
-
import type { Protocol, ProtocolContext, WireRequest } from './types.js';
|
|
18
|
+
import type { Protocol, ProtocolContext, ProtocolStreamContext, WireRequest } from './types.js';
|
|
21
19
|
/** 未显式给出 `max_tokens` 时的保守默认值(与适配器元数据一致)。 */
|
|
22
20
|
export declare const MESSAGES_DEFAULT_MAX_TOKENS = 4096;
|
|
23
21
|
/** 网关根或 `/v1` Base 都补成 `/v1/messages`。 */
|
|
@@ -25,5 +23,5 @@ export declare function messagesURL(baseURL: string): string;
|
|
|
25
23
|
/** 构造 Messages 请求。 */
|
|
26
24
|
export declare function buildMessagesRequest(ctx: ProtocolContext): WireRequest;
|
|
27
25
|
/** 把 Messages 的 SSE 事件翻译成 DSH 流式块。 */
|
|
28
|
-
export declare function streamMessages(body: ReadableStream<Uint8Array>, signal: AbortSignal, idleMs: number): AsyncGenerator<StreamChunk>;
|
|
26
|
+
export declare function streamMessages(body: ReadableStream<Uint8Array>, signal: AbortSignal, idleMs: number, context?: ProtocolStreamContext): AsyncGenerator<StreamChunk>;
|
|
29
27
|
export declare const messages: Protocol;
|
package/lib/protocols/types.d.ts
CHANGED
|
@@ -22,6 +22,8 @@ export interface ProtocolContext {
|
|
|
22
22
|
images: ReadonlyMap<string, string>;
|
|
23
23
|
/** 每模型可选 `top_p`;未设置时不发送。 */
|
|
24
24
|
topP?: number;
|
|
25
|
+
/** Keyed credential/origin binding; adapter-private and never sent upstream. */
|
|
26
|
+
credentialIdentity?: string;
|
|
25
27
|
}
|
|
26
28
|
/** 一个可直接 fetch 的请求。 */
|
|
27
29
|
export interface WireRequest {
|
|
@@ -29,11 +31,18 @@ export interface WireRequest {
|
|
|
29
31
|
headers: Record<string, string>;
|
|
30
32
|
body: unknown;
|
|
31
33
|
}
|
|
34
|
+
/** Prepared request identity; contains no transport credentials. */
|
|
35
|
+
export interface ProtocolStreamContext {
|
|
36
|
+
provider: string;
|
|
37
|
+
model: string;
|
|
38
|
+
baseURL: string;
|
|
39
|
+
credentialIdentity?: string;
|
|
40
|
+
}
|
|
32
41
|
/** 一种线协议的实现。 */
|
|
33
42
|
export interface Protocol {
|
|
34
43
|
readonly id: ApiProtocol;
|
|
35
44
|
/** 把协议无关调用投影成本协议的请求。 */
|
|
36
45
|
build(ctx: ProtocolContext): WireRequest;
|
|
37
46
|
/** 把上游 SSE 响应体翻译成 DSH 流式块。 */
|
|
38
|
-
stream(body: ReadableStream<Uint8Array>, signal: AbortSignal, idleMs: number): AsyncIterable<StreamChunk>;
|
|
47
|
+
stream(body: ReadableStream<Uint8Array>, signal: AbortSignal, idleMs: number, context?: ProtocolStreamContext): AsyncIterable<StreamChunk>;
|
|
39
48
|
}
|
package/lib/remote.d.ts
CHANGED
|
@@ -26,6 +26,8 @@ export interface StatusModel {
|
|
|
26
26
|
name: string;
|
|
27
27
|
group: 'plan' | 'paid';
|
|
28
28
|
enabled?: boolean;
|
|
29
|
+
/** Catalog evidence, independent of any user override; omission means unknown. */
|
|
30
|
+
inputModalities?: readonly ('text' | 'image')[];
|
|
29
31
|
contextWindow?: number;
|
|
30
32
|
maxOutputTokens?: number;
|
|
31
33
|
reasoningEfforts?: readonly string[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type CredentialProvider } from '@deepseek-ai/dsh-credentials';
|
|
2
|
+
export declare const REPLAY_BINDING_KEY: import("@deepseek-ai/dsh-credentials").CredentialKey;
|
|
3
|
+
type ReplayCredentials = Pick<CredentialProvider, 'readRecord' | 'modifyRecord'>;
|
|
4
|
+
/** Lazy, atomic credential-service binding. No inference key ever enters this store. */
|
|
5
|
+
export declare class ReplayKeyStore {
|
|
6
|
+
#private;
|
|
7
|
+
readonly provider: () => ReplayCredentials | undefined;
|
|
8
|
+
constructor(provider: () => ReplayCredentials | undefined);
|
|
9
|
+
dispose(): void;
|
|
10
|
+
/** Returns caller-owned bytes; callers clear them after deriving the binding. */
|
|
11
|
+
get(signal: AbortSignal): Promise<Uint8Array>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|