@morlay/dsh-llm-openai-compatible 0.0.14 → 0.0.16

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 CHANGED
@@ -2,10 +2,10 @@
2
2
 
3
3
  DeepSeek Harness 的 **OpenAI 兼容 LLM 适配器**:`providers` 是 dict 多路由(**key 就是 provider 路由键**),每个
4
4
  profile 除了端点与模型目录,还能声明 **profile 级默认采样参数**(`temperature` / `topP` / `topK` /
5
- `presencePenalty` / `frequencyPenalty` / `seed`)——请求级 `GenerateOptions.temperature` 优先于 profile 默认,缺省
6
- 一律不发送(= 提供方默认)。传输层复用
5
+ `presencePenalty` / `frequencyPenalty` / `seed`)。传输层复用
7
6
  **[@ai-sdk/openai-compatible](https://www.npmjs.com/package/@ai-sdk/openai-compatible)**,本插件只做 harness
8
- 适配:消息 → AI SDK prompt、采样合并、stream part → `StreamChunk`、错误归一化与凭据策略。
7
+ 适配:消息 → AI SDK prompt、采样合并、stream part → `StreamChunk`、错误归一化与凭据策略。合并规则与省略语义见
8
+ [ADR 采样默认值合并规则与省略语义](./.agents/adrs/20260917-采样默认值合并规则与省略语义.md)。
9
9
 
10
10
  **与官方 `llm-pi-ai` 二选一**:两者都提供 openai-compatible 的 `providers` dict 与同名 provider 路由,同装会有
11
11
  两套适配器抢同一批路由,一个部署只装一个。本部署装的是官方那行——它的 `ollama` route 由
@@ -37,6 +37,7 @@ profile 除了端点与模型目录,还能声明 **profile 级默认采样参
37
37
  reasoningEfforts: { off: null, high: high, max: max }
38
38
  ```
39
39
 
40
- `providers` 标了 `.volatile()`——**运行期可改**:值经 Loader 的引用读取,设置页(Models 页)改的就是它,不需要
41
- 重挂这行插件。字段清单(端点与请求头、采样、模型目录、传输与重试)、wire 落点与省略语义、错误映射、凭据与图片
42
- 策略都在各自 ADR 里;`$DSH_HOME/settings.yaml` 里同名的段由上游在启动时导入同 id 的行 config。
40
+ `providers` 标了 `.volatile()`——运行期可改,不需要重挂这行插件(见
41
+ [ADR 运行期改配置走 volatile 引用](./.agents/adrs/20260922-运行期改配置走volatile引用.md))。字段清单(端点与
42
+ 请求头、采样、模型目录、传输与重试)、wire 落点与省略语义、错误映射、凭据与图片策略都在各自 ADR 里;
43
+ `$DSH_HOME/settings.yaml` 里同名的段由上游在启动时导入同 id 的行 config。
@@ -1,7 +1,7 @@
1
1
  import { GenerateOptions, LlmAdapter, LlmModelInfo, LlmProviderInfo, LlmResolvedModelInfo, ModelModality, ResolvedRetryPolicy, StreamChunk } from "@deepseek-ai/dsh-llm";
2
- import { CredentialRef } from "@deepseek-ai/dsh-credentials";
3
- import { LanguageModelV4Usage } from "@ai-sdk/provider";
4
2
  import { AttachmentStore } from "@deepseek-ai/dsh-attachment";
3
+ import { LanguageModelV4Usage } from "@ai-sdk/provider";
4
+ import { CredentialRef } from "@deepseek-ai/dsh-credentials";
5
5
  //#region src/adapter.d.ts
6
6
  declare const DEFAULT_STREAM_IDLE_TIMEOUT_MS = 300000;
7
7
  declare const DEFAULT_CONTEXT_WINDOW = 262144;
package/dist/index.d.mts CHANGED
@@ -1,11 +1,7 @@
1
- import { a as OpenAICompatibleAdapter, c as ResolvedModelProfile, i as DEFAULT_STREAM_IDLE_TIMEOUT_MS, l as ResolvedProviderProfile, n as DEFAULT_MAX_REQUEST_IMAGE_BYTES, o as OpenAICompatibleAdapterOptions, r as DEFAULT_MAX_TOKENS, s as ReasoningEffort, t as DEFAULT_CONTEXT_WINDOW } from "./adapter-CYd_pegB.mjs";
2
- import z from "@deepseek-ai/schemastery";
1
+ import { a as OpenAICompatibleAdapter, c as ResolvedModelProfile, i as DEFAULT_STREAM_IDLE_TIMEOUT_MS, l as ResolvedProviderProfile, n as DEFAULT_MAX_REQUEST_IMAGE_BYTES, o as OpenAICompatibleAdapterOptions, r as DEFAULT_MAX_TOKENS, s as ReasoningEffort, t as DEFAULT_CONTEXT_WINDOW } from "./adapter-DvNmFVoM.mjs";
3
2
  import { ModelModality, RetryPolicyConfig } from "@deepseek-ai/dsh-llm";
4
3
  import { Context, Volatile } from "@deepseek-ai/cordis";
5
- //#region ../../../vendor/deepseek-harness/vendor/cosmokit/lib/types/misc.d.ts
6
- /** String/symbol keyed dictionary type. */
7
- type Dict<T = any, K extends string | symbol = string> = { [key in K]: T; };
8
- //#endregion
4
+ import z from "@deepseek-ai/schemastery";
9
5
  //#region src/index.d.ts
10
6
  export declare const name = "llm-openai-compatible";
11
7
  export declare const inject: string[];
@@ -46,9 +42,9 @@ export interface Config {
46
42
  }
47
43
  export type Options = { [K in keyof Config]?: Config[K] extends Volatile<infer T> ? T : never; };
48
44
  export declare const Config: z<Schemastery.ObjectS<NoInfer<{
49
- providers: z<NoInfer<Dict<ProviderProfileSource, string>>, NoInfer<Dict<ProviderProfileSource, string>>, "volatile-defined">;
45
+ providers: z<NoInfer<import("@deepseek-ai/cosmokit").Dict<ProviderProfileSource, string>>, NoInfer<import("@deepseek-ai/cosmokit").Dict<ProviderProfileSource, string>>, "volatile-defined">;
50
46
  }>>, Schemastery.ObjectT<NoInfer<{
51
- providers: z<NoInfer<Dict<ProviderProfileSource, string>>, NoInfer<Dict<ProviderProfileSource, string>>, "volatile-defined">;
47
+ providers: z<NoInfer<import("@deepseek-ai/cosmokit").Dict<ProviderProfileSource, string>>, NoInfer<import("@deepseek-ai/cosmokit").Dict<ProviderProfileSource, string>>, "volatile-defined">;
52
48
  }>>, "plain">;
53
49
  export declare function resolveAdapterOptions(provider: string, source: ProviderProfileSource): ResolvedProviderProfile;
54
50
  export declare function resolveProfiles(providers: Readonly<Record<string, ProviderProfileSource>> | undefined): Map<string, ResolvedProviderProfile>;
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { a as serializeCallOptions, o as serializeCallOptionsWithImages, r as translate } from "./translate-D9PyJrw2.mjs";
2
- import z from "@deepseek-ai/schemastery";
3
2
  import { CONTEXT_WINDOW_EXCEEDED_CODE, LlmAdapter, LlmError, ProviderRequestId, QUOTA_EXCEEDED_CODE, ReasoningEffortId, RetryPolicySchema, assertUsableApiKey, attributionHeaders, contentHasImage, isContextWindowExceededError, isQuotaExceededError, resolveRetryPolicy } from "@deepseek-ai/dsh-llm";
3
+ import z from "@deepseek-ai/schemastery";
4
4
  import { credentialRef } from "@deepseek-ai/dsh-credentials";
5
5
  import { launchEnvironmentOf } from "@deepseek-ai/dsh-launch-environment";
6
6
  import { deepEqualJson } from "@deepseek-ai/dsh-util-values";
package/dist/wire.d.mts CHANGED
@@ -1,7 +1,7 @@
1
- import { c as ResolvedModelProfile, l as ResolvedProviderProfile } from "./adapter-CYd_pegB.mjs";
1
+ import { c as ResolvedModelProfile, l as ResolvedProviderProfile } from "./adapter-DvNmFVoM.mjs";
2
2
  import { FinishReason, GenerateOptions, StreamChunk, TokenUsage } from "@deepseek-ai/dsh-llm";
3
- import { LanguageModelV4FinishReason, LanguageModelV4FunctionTool, LanguageModelV4Prompt, LanguageModelV4StreamPart, LanguageModelV4Usage, SharedV4ProviderOptions } from "@ai-sdk/provider";
4
3
  import { AttachmentStore } from "@deepseek-ai/dsh-attachment";
4
+ import { LanguageModelV4FinishReason, LanguageModelV4FunctionTool, LanguageModelV4Prompt, LanguageModelV4StreamPart, LanguageModelV4Usage, SharedV4ProviderOptions } from "@ai-sdk/provider";
5
5
  //#region src/serialize.d.ts
6
6
  export type OpenAICompatibleProviderOptions = SharedV4ProviderOptions & {
7
7
  "openai-compatible"?: {
package/dist/wire.mjs CHANGED
@@ -1,2 +1 @@
1
- import { a as serializeCallOptions, i as resolveReasoningWire, n as mapUsage, o as serializeCallOptionsWithImages, r as translate, t as mapFinishReason } from "./translate-D9PyJrw2.mjs";
2
- export { mapFinishReason, mapUsage, resolveReasoningWire, serializeCallOptions, serializeCallOptionsWithImages, translate };
1
+ export { t as mapFinishReason, n as mapUsage, i as resolveReasoningWire, a as serializeCallOptions, o as serializeCallOptionsWithImages, r as translate } from "./translate-D9PyJrw2.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morlay/dsh-llm-openai-compatible",
3
- "version": "0.0.14",
3
+ "version": "0.0.16",
4
4
  "description": "Optional OpenAI-compatible LLM adapter plugin for DeepSeek Harness with configurable default sampling parameters (temperature / topP / topK / penalties / seed) over a providers dict. Pick either this adapter or the built-in llm-pi-ai, never both.",
5
5
  "keywords": [
6
6
  "dsh",
@@ -23,28 +23,35 @@
23
23
  ],
24
24
  "type": "module",
25
25
  "exports": {
26
- ".": "./dist/index.mjs",
27
- "./wire": "./dist/wire.mjs",
28
- "./invariant": "./dist/invariant.mjs",
26
+ ".": {
27
+ "types": "./dist/index.d.mts",
28
+ "default": "./dist/index.mjs"
29
+ },
30
+ "./wire": {
31
+ "types": "./dist/wire.d.mts",
32
+ "default": "./dist/wire.mjs"
33
+ },
29
34
  "./package.json": "./package.json",
30
35
  "./locale/*.json": "./locale/*.json"
31
36
  },
32
37
  "dependencies": {
33
38
  "@ai-sdk/openai-compatible": "^3.0.32",
34
39
  "@ai-sdk/provider": "^4.0.7",
35
- "@deepseek-ai/dsh-util-values": "^0.2.0-rc.2"
40
+ "@deepseek-ai/dsh-util-values": "^0.2.1-rc.1"
36
41
  },
37
42
  "peerDependencies": {
38
- "@deepseek-ai/cordis": "^4.0.4",
39
- "@deepseek-ai/dsh-anonymous-user-id": "^0.2.0-rc.2",
40
- "@deepseek-ai/dsh-attachment": "^0.2.0-rc.2",
41
- "@deepseek-ai/dsh-credentials": "^0.2.0-rc.2",
42
- "@deepseek-ai/dsh-invariants": "^0.2.0-rc.2",
43
- "@deepseek-ai/dsh-launch-environment": "^0.2.0-rc.2",
44
- "@deepseek-ai/dsh-llm": "^0.2.0-rc.2",
45
- "@deepseek-ai/dsh-settings": "^0.2.0-rc.2",
46
- "@deepseek-ai/dsh-timeout": "^0.2.0-rc.2",
47
- "@deepseek-ai/schemastery": "^3.18.4"
43
+ "@deepseek-ai/cordis": "^4.0.5",
44
+ "@deepseek-ai/dsh-anonymous-user-id": "^0.2.1-rc.1",
45
+ "@deepseek-ai/dsh-attachment": "^0.2.1-rc.1",
46
+ "@deepseek-ai/dsh-credentials": "^0.2.1-rc.1",
47
+ "@deepseek-ai/dsh-launch-environment": "^0.2.1-rc.1",
48
+ "@deepseek-ai/dsh-llm": "^0.2.1-rc.1",
49
+ "@deepseek-ai/dsh-settings": "^0.2.1-rc.1",
50
+ "@deepseek-ai/dsh-timeout": "^0.2.1-rc.1",
51
+ "@deepseek-ai/schemastery": "^3.18.5"
52
+ },
53
+ "engines": {
54
+ "dsh": ">= 0.2.1-rc.1 < 0.2.2"
48
55
  },
49
56
  "scripts": {
50
57
  "build": "pnpm exec tsdown"
@@ -1,6 +0,0 @@
1
- import { Context } from "@deepseek-ai/cordis";
2
- //#region src/invariant.d.ts
3
- export declare const name = "llm-openai-compatible-invariant";
4
- export declare const inject: string[];
5
- export declare const apply: (ctx: Context) => Promise<() => void>;
6
- //#endregion
@@ -1,8 +0,0 @@
1
- //#region src/invariant.ts
2
- const PACKAGE_NAME = "@morlay/dsh-llm-openai-compatible";
3
- const name = "llm-openai-compatible-invariant";
4
- const inject = ["invariants"];
5
- const install = () => {};
6
- const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
7
- //#endregion
8
- export { apply, inject, name };
package/src/invariant.ts DELETED
@@ -1,13 +0,0 @@
1
- import type { Context } from "@deepseek-ai/cordis";
2
- import type { InvariantInstaller } from "@deepseek-ai/dsh-invariants";
3
-
4
- const PACKAGE_NAME = "@morlay/dsh-llm-openai-compatible";
5
-
6
- export const name = "llm-openai-compatible-invariant";
7
-
8
- export const inject = ["invariants"];
9
-
10
- const install: InvariantInstaller = () => {};
11
-
12
- export const apply = (ctx: Context): Promise<() => void> =>
13
- Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));