mocode-ai 1.7.0 → 1.7.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.
@@ -3,7 +3,10 @@ import Ajv2020 from 'ajv/dist/2020.js';
3
3
  const options = {
4
4
  allErrors: true,
5
5
  strict: false,
6
- coerceTypes: false,
6
+ // 中转网关/弱模型常把 integer/number/boolean 序列化成字符串(如 "100"),
7
+ // 开启标量强转在校验前自动还原;类型完全不符("abc"→number)仍会被拦,
8
+ // minimum/maximum 等约束在转换后照常生效。
9
+ coerceTypes: true,
7
10
  useDefaults: false,
8
11
  removeAdditional: false,
9
12
  validateFormats: false,
@@ -69,7 +72,7 @@ function formatErrors(errors, schema) {
69
72
  }
70
73
  return body + hint;
71
74
  }
72
- /** Validate after tool-local normalization; AJV itself never coerces or mutates arguments. */
75
+ /** Validate after tool-local normalization; AJV coerces scalar strings to declared types. */
73
76
  export function validateToolArguments(tool, args) {
74
77
  if (!args || typeof args !== 'object' || Array.isArray(args)) {
75
78
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mocode-ai",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
4
4
  "description": "终端编码 agent:LLM + tool-call 循环 + 流式输出(含思考)+ 27 个工具,接任意 OpenAI 兼容后端。",
5
5
  "type": "module",
6
6
  "bin": {