dsh-opendesign-corouter 0.1.11 → 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.
@@ -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 the user's explicit capacity overrides. The input row and
40
- * its arrays are never mutated; other overrides (sampling, effort) belong to the request,
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. */
@@ -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
- * - `temperature`/`top_p` 等采样参数原样透传,其取值限制(只针对特定 Claude 代际)与
14
- * 「仅接受 enabled + budget_tokens 的 legacy 模型」能否使用,都由上游按实际模型判定,
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;
@@ -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 {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-opendesign-corouter",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "description": "OpenDesign CoRouter:套餐赠送与付费模型双 Provider、桌面登录态额度及独立登录",
5
5
  "type": "module",
6
6
  "license": "MIT",