@molecule/api-ai-moonshot 1.0.1 → 1.1.1
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/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +16 -2
- package/package.json +5 -4
package/dist/provider.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,UAAU,EAOX,MAAM,kBAAkB,CAAA;AASzB,OAAO,cAAc,CAAA;AAErB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,UAAU,EAOX,MAAM,kBAAkB,CAAA;AASzB,OAAO,cAAc,CAAA;AAErB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AA8oBhD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,CAAC,EAAE,cAAc,GAAG,UAAU,CAElE"}
|
package/dist/provider.js
CHANGED
|
@@ -83,6 +83,15 @@ class MoonshotAIProvider {
|
|
|
83
83
|
const allTools = [...functions, ...serverTools];
|
|
84
84
|
if (allTools.length > 0) {
|
|
85
85
|
body.tools = allTools;
|
|
86
|
+
// Honor forced tool choice (discovery mode relies on it — an unenforced
|
|
87
|
+
// 'required' lets the model narrate the call as text instead of emitting
|
|
88
|
+
// tool_use). OpenAI-compatible forms; 'auto' is the API default → omit.
|
|
89
|
+
if (params.toolChoice === 'required') {
|
|
90
|
+
body.tool_choice = 'required';
|
|
91
|
+
}
|
|
92
|
+
else if (typeof params.toolChoice === 'object' && params.toolChoice.type === 'tool') {
|
|
93
|
+
body.tool_choice = { type: 'function', function: { name: params.toolChoice.name } };
|
|
94
|
+
}
|
|
86
95
|
}
|
|
87
96
|
// Model-family thinking rules (platform.kimi.ai docs, verified 2026-07-28):
|
|
88
97
|
// - kimi-k3: thinking is ALWAYS ON and the K2.x `thinking` param is
|
|
@@ -91,14 +100,19 @@ class MoonshotAIProvider {
|
|
|
91
100
|
// - kimi-k2.7-code: thinking always on, no reasoning_effort — send neither.
|
|
92
101
|
// - other kimi-k2.x: thinking on/off via `thinking: {type:"disabled"}`;
|
|
93
102
|
// reasoning_effort (minimal..high) is accepted though undocumented.
|
|
94
|
-
|
|
103
|
+
// Family-gate on the CANONICAL id: `model` is the mapped upstream id on
|
|
104
|
+
// re-hosts (`moonshotai/Kimi-K3`), which these prefixes never match — so
|
|
105
|
+
// every US turn fell into the env-default branch and sent
|
|
106
|
+
// `thinking: {type:"disabled"}` to forced-thinking models, a param the
|
|
107
|
+
// native API explicitly rejects (DeepInfra merely ignores it today).
|
|
108
|
+
if (canonicalModel.startsWith('kimi-k3')) {
|
|
95
109
|
const effort = params.thinking?.effort;
|
|
96
110
|
if (effort === 'low' || effort === 'high' || effort === 'max') {
|
|
97
111
|
body.reasoning_effort = effort;
|
|
98
112
|
}
|
|
99
113
|
// No effort resolved → omit and let the upstream default (max) apply.
|
|
100
114
|
}
|
|
101
|
-
else if (
|
|
115
|
+
else if (canonicalModel.startsWith('kimi-k2.7-code')) {
|
|
102
116
|
// Forced thinking, no depth knob — nothing to send.
|
|
103
117
|
}
|
|
104
118
|
else if (params.thinking) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/api-ai-moonshot",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Moonshot (Kimi) AI provider for molecule.dev",
|
|
5
|
+
"homepage": "https://www.molecule.dev/packages/api-ai-moonshot",
|
|
5
6
|
"type": "module",
|
|
6
7
|
"main": "dist/index.js",
|
|
7
8
|
"types": "dist/index.d.ts",
|
|
@@ -33,11 +34,11 @@
|
|
|
33
34
|
"directory": "packages/api/bonds/ai/moonshot"
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
36
|
-
"@molecule/api-ai": "1.
|
|
37
|
-
"@molecule/api-bond": "1.0.
|
|
37
|
+
"@molecule/api-ai": "1.2.1",
|
|
38
|
+
"@molecule/api-bond": "1.0.2",
|
|
38
39
|
"@types/node": "26.1.2",
|
|
39
40
|
"typescript": "6.0.3",
|
|
40
|
-
"vitest": "4.1.
|
|
41
|
+
"vitest": "4.1.11"
|
|
41
42
|
},
|
|
42
43
|
"peerDependencies": {
|
|
43
44
|
"@molecule/api-ai": "^1.0.1",
|