@raolin2025/claude-code-node 2.2.1 → 2.2.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raolin2025/claude-code-node",
3
- "version": "2.2.1",
3
+ "version": "2.2.3",
4
4
  "description": "Node.js AI Code Agent CLI - Zero dependencies, pure JavaScript, security hardened, multi-channel notifications",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/core/cli.js CHANGED
@@ -172,6 +172,10 @@ function parseArgs(argv) {
172
172
  case '--resume': case '-r': args.resume = argv[++i]; break
173
173
  case '--verbose': case '-v': args.verbose = true; break
174
174
  case '--no-stream': args.noStream = true; break
175
+ case '--version':
176
+ const pkg = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'))
177
+ console.log(pkg.version)
178
+ process.exit(0)
175
179
  case '--help': case '-h':
176
180
  console.log(`Usage: cc-node [options] [prompt]
177
181
 
@@ -183,6 +187,7 @@ Options:
183
187
  --api-base URL API base URL
184
188
  --api-key *** API key (or set LLM_API_KEY env)
185
189
  -r, --resume ID Resume a session
190
+ --version Show version
186
191
  -v, --verbose Verbose mode
187
192
  --no-stream Disable streaming
188
193
  -h, --help Show this help
@@ -293,6 +293,8 @@ export class QueryEngine {
293
293
  }))
294
294
 
295
295
  const useStream = !this.config.noStream
296
+ const modelLower = this.config.model.toLowerCase()
297
+
296
298
  const body = {
297
299
  model: this.config.model,
298
300
  messages,
@@ -301,6 +303,13 @@ export class QueryEngine {
301
303
  ...(useStream && { stream: true }),
302
304
  }
303
305
 
306
+ // DeepSeek V4: 默认启用 thinking mode → 要求回传 reasoning_content
307
+ // 这里显式关闭,避免 tool call 场景下的 400 错误
308
+ // thinking 参数是 DeepSeek 私有扩展,直接放在 body 顶层
309
+ if (modelLower.startsWith('deepseek-v')) {
310
+ body.thinking = { type: 'disabled' }
311
+ }
312
+
304
313
  const url = apiBase.replace(/\/+$/, '') + '/chat/completions'
305
314
 
306
315
  // H3 修复:SSRF 防护 — 在 fetch 之前检查 API 主机名
@@ -398,7 +407,7 @@ export class QueryEngine {
398
407
  * 处理流式响应 — 逐 token 输出
399
408
  */
400
409
  async _handleStreamResponse(response) {
401
- const result = { content: '', toolCalls: [], usage: {} }
410
+ const result = { content: '', reasoningContent: '', toolCalls: [], usage: {} }
402
411
  let currentText = ''
403
412
 
404
413
  try {