dsh-volcengine-provider 0.2.6 → 0.2.9

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.
@@ -0,0 +1,86 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "verifiedAt": "2026-10-30",
4
+ "models": {
5
+ "doubao-seed-evolving": {
6
+ "ids": ["doubao-seed-evolving"],
7
+ "multiplier": 2.5
8
+ },
9
+ "doubao-seed-2.1-pro": {
10
+ "ids": ["doubao-seed-2-1-pro-260915", "doubao-seed-2-1-pro"],
11
+ "multiplier": 2.5
12
+ },
13
+ "doubao-seed-2.1-lite": {
14
+ "ids": ["doubao-seed-2-1-lite-260915", "doubao-seed-2-1-lite"],
15
+ "multiplier": 0.5
16
+ },
17
+ "doubao-seed-2.0-mini": {
18
+ "ids": ["doubao-seed-2-0-mini-260428", "doubao-seed-2-0-mini"],
19
+ "multiplier": 0.25
20
+ },
21
+ "kimi-k3.1-pro": {
22
+ "ids": ["kimi-k3-1-pro-261024", "kimi-k3.1-pro"],
23
+ "multiplier": 7,
24
+ "discount": {
25
+ "multiplier": 3.5,
26
+ "startsAt": "2026-10-24T00:00:00+08:00",
27
+ "endsAt": "2026-11-09T23:59:59+08:00"
28
+ }
29
+ },
30
+ "deepseek-v4.1-flash": {
31
+ "ids": ["deepseek-v4-1-flash-261017", "deepseek-v4-1-flash"],
32
+ "multiplier": 2.5,
33
+ "discount": {
34
+ "multiplier": 1.25,
35
+ "startsAt": "2026-09-15T00:00:00+08:00",
36
+ "endsAt": "2026-12-30T23:59:59+08:00"
37
+ }
38
+ },
39
+ "deepseek-v4.1-flash-economy": {
40
+ "ids": ["deepseek-v4-1-flash-economy-261017", "deepseek-v4-1-flash-economy"],
41
+ "multiplier": 2,
42
+ "discount": {
43
+ "multiplier": 1,
44
+ "startsAt": "2026-10-20T00:00:00+08:00",
45
+ "endsAt": "2026-12-30T23:59:59+08:00"
46
+ }
47
+ },
48
+ "kimi-k2.8-preview": {
49
+ "ids": ["kimi-k2-8-preview"],
50
+ "multiplier": 8,
51
+ "discount": {
52
+ "multiplier": 4.8,
53
+ "startsAt": "2026-09-17T00:00:00+08:00",
54
+ "endsAt": "2026-12-14T23:59:59+08:00"
55
+ }
56
+ },
57
+ "glm-5.3-flash": {
58
+ "ids": ["glm-5-3-flash-260828", "glm-5-3-flash"],
59
+ "multiplier": 0.5
60
+ },
61
+ "glm-5.3": {
62
+ "ids": ["glm-5.3"],
63
+ "multiplier": 4.5
64
+ },
65
+ "deepseek-v4-pro": {
66
+ "ids": ["deepseek-v4-pro-ga-260813", "deepseek-v4-pro"],
67
+ "multiplier": 5.5
68
+ },
69
+ "deepseek-v4-flash": {
70
+ "ids": ["deepseek-v4-flash-ga-260731", "deepseek-v4-flash"],
71
+ "multiplier": 0.5
72
+ },
73
+ "kimi-k3": {
74
+ "ids": ["kimi-k3"],
75
+ "multiplier": 10
76
+ },
77
+ "kimi-k2.7-code": {
78
+ "ids": ["kimi-k2.7-code"],
79
+ "multiplier": 4.5
80
+ },
81
+ "minimax-m3": {
82
+ "ids": ["minimax-m3"],
83
+ "multiplier": 2.5
84
+ }
85
+ }
86
+ }
@@ -10,6 +10,18 @@ function withoutEffort(payload) {
10
10
  return result;
11
11
  }
12
12
 
13
+ /**
14
+ * 逐模型关闭工具调用时,服务端只接受 tools 非空搭配 tool_choice:none。
15
+ * 没有工具声明时不发送 tool_choice,工具声明与历史保持原样。
16
+ */
17
+ function withToolChoice(payload, toolsEnabled) {
18
+ if (toolsEnabled !== false) return payload;
19
+ const result = { ...payload };
20
+ if (Array.isArray(result.tools) && result.tools.length) result.tool_choice = { type: 'none' };
21
+ else delete result.tool_choice;
22
+ return result;
23
+ }
24
+
13
25
  /** Normalize only request-level controls; replay blocks and signatures stay SDK-owned. */
14
26
  export function messagesPayload(payload, control = {}) {
15
27
  const mode = control.messagesThinkingMode ?? 'server-default';
@@ -18,7 +30,7 @@ export function messagesPayload(payload, control = {}) {
18
30
  if (effort === undefined || effort === null) {
19
31
  const result = withoutEffort(payload);
20
32
  delete result.thinking;
21
- return result;
33
+ return withToolChoice(result, control.toolsEnabled);
22
34
  }
23
35
  const mappedOff = effort === 'off' && typeof control.offWire === 'string';
24
36
  if (effort === 'off' && !mappedOff) {
@@ -27,7 +39,7 @@ export function messagesPayload(payload, control = {}) {
27
39
  error.code = 'UNSUPPORTED_REASONING_EFFORT';
28
40
  throw error;
29
41
  }
30
- return { ...withoutEffort(payload), thinking: { type: 'disabled' } };
42
+ return withToolChoice({ ...withoutEffort(payload), thinking: { type: 'disabled' } }, control.toolsEnabled);
31
43
  }
32
44
  const result = { ...payload };
33
45
  if (mappedOff) result.output_config = { ...payload.output_config, effort: control.offWire };
@@ -41,7 +53,7 @@ export function messagesPayload(payload, control = {}) {
41
53
  // A fixed-budget override intentionally keeps the SDK's enabled + budget shape.
42
54
  if (Object.keys(thinking).length) result.thinking = thinking;
43
55
  else delete result.thinking;
44
- return result;
56
+ return withToolChoice(result, control.toolsEnabled);
45
57
  }
46
58
 
47
59
  /** Compose the SDK callback, without replacing fetch globally or serializing history. */
package/lib/state.mjs CHANGED
@@ -9,7 +9,9 @@ export const LABELS = { 'agent-plan': '火山方舟 · Agent 套餐', 'coding-pl
9
9
  // Core(pi-ai)已声明的思考档位,模型设置只接受这些键。
10
10
  export const CORE_THINKING_LEVELS = ['off', 'minimal', 'low', 'medium', 'high', 'xhigh', 'max'];
11
11
  // 逐模型覆盖允许出现的字段;其余字段一律拒绝(含任何凭据字段)。
12
- export const MODEL_SETTING_FIELDS = ['enabled', 'contextWindow', 'maxTokens', 'temperature', 'reasoningEfforts', 'defaultReasoning', 'forceAdaptiveThinking'];
12
+ export const MODEL_SETTING_FIELDS = ['enabled', 'contextWindow', 'maxTokens', 'temperature', 'reasoningEfforts', 'defaultReasoning', 'forceAdaptiveThinking', 'imageInput', 'toolsEnabled'];
13
+ // 图片输入与工具开关只接受布尔值;不给出时保持缺省,由目录默认值继承。
14
+ export const MODEL_SETTING_BOOLEAN_FIELDS = ['imageInput', 'toolsEnabled'];
13
15
  // 预算模式(未开启自适应思考)下 Core 只消费档位键:xhigh/max 会被折叠为 high,映射值也不再上线。
14
16
  export const BUDGET_THINKING_LEVELS = ['off', 'minimal', 'low', 'medium', 'high'];
15
17
  const idPattern = /^[a-z][a-z0-9-]{0,63}$/;
@@ -113,6 +115,12 @@ export function normalizeModelSettings(input) {
113
115
  if (typeof input.forceAdaptiveThinking !== 'boolean') throw new Error('forceAdaptiveThinking 必须是布尔值');
114
116
  settings.forceAdaptiveThinking = input.forceAdaptiveThinking;
115
117
  }
118
+ // 图片输入与工具开关:只接受布尔值;缺省不落盘,由目录默认值继承。
119
+ for (const key of MODEL_SETTING_BOOLEAN_FIELDS) {
120
+ if (!(key in input)) continue;
121
+ if (typeof input[key] !== 'boolean') throw new Error(`${key} 必须是布尔值`);
122
+ settings[key] = input[key];
123
+ }
116
124
  if ('reasoningEfforts' in input) settings.reasoningEfforts = normalizeReasoningEfforts(input.reasoningEfforts);
117
125
  if ('defaultReasoning' in input) {
118
126
  const value = input.defaultReasoning;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-volcengine-provider",
3
3
  "displayName": "火山方舟 Provider",
4
- "version": "0.2.6",
4
+ "version": "0.2.9",
5
5
  "description": "火山方舟 Agent Plan 与 Coding Plan:OAuth 登录、账号、模型与额度管理。",
6
6
  "repository": {"type": "git", "url": "git+https://github.com/KouzakiUmi/dsh-volcengine-provider.git"},
7
7
  "homepage": "https://github.com/KouzakiUmi/dsh-volcengine-provider#readme",
@@ -19,12 +19,12 @@
19
19
  "peerDependencies": {
20
20
  "@deepseek-ai/cordis": "^4.0.5",
21
21
  "@deepseek-ai/schemastery": "^3.18.4",
22
- "@deepseek-ai/dsh-llm": "0.2.1-rc.3",
23
- "@deepseek-ai/dsh-llm-pi-ai": "0.2.1-rc.3",
22
+ "@deepseek-ai/dsh-llm": "0.2.1-rc.5",
23
+ "@deepseek-ai/dsh-llm-pi-ai": "0.2.1-rc.5",
24
24
  "@earendil-works/pi-ai": "1.1.0",
25
- "@deepseek-ai/dsh-credentials": "0.2.1-rc.3",
26
- "@deepseek-ai/dsh-launch-environment": "0.2.1-rc.3",
27
- "@deepseek-ai/dsh-typert-protocol": "0.2.1-rc.3"
25
+ "@deepseek-ai/dsh-credentials": "0.2.1-rc.5",
26
+ "@deepseek-ai/dsh-launch-environment": "0.2.1-rc.5",
27
+ "@deepseek-ai/dsh-typert-protocol": "0.2.1-rc.5"
28
28
  },
29
29
  "dsh": {
30
30
  "bundle": {"patch": "./cordis.patch.yml"},