@raolin2025/claude-code-node 2.8.8 → 2.8.10

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.8.8",
3
+ "version": "2.8.10",
4
4
  "description": "Node.js AI Code Agent CLI - Zero dependencies, pure JavaScript, security hardened, multi-channel notifications, Telegram & QQ Bot remote programming, rich media upload, multi-account management",
5
5
  "type": "module",
6
6
  "main": "src/core/index.js",
@@ -347,6 +347,7 @@ export class QueryEngine {
347
347
 
348
348
  const useStream = !this.config.noStream
349
349
  const modelLower = this.config.model.toLowerCase()
350
+ const url = apiBase.replace(/\/+$/, '') + '/chat/completions'
350
351
 
351
352
  const body = {
352
353
  model: this.config.model,
@@ -356,6 +357,20 @@ export class QueryEngine {
356
357
  ...(useStream && { stream: true }),
357
358
  }
358
359
 
360
+ // [debug] 打印实际发送请求的关键信息,用于排查"模型为何不调用工具"
361
+ if (this.config.verbose) {
362
+ const sysCount = messages.filter(m => m.role === 'system').length
363
+ const toolCallsInHistory = messages.filter(m => m.role === 'assistant' && m.tool_calls).length
364
+ console.error(`[debug] → ${url}`)
365
+ console.error(`[debug] model=${body.model} | messages=${messages.length} (system=${sysCount}, user=${messages.filter(m=>m.role==='user').length}, assistant=${messages.filter(m=>m.role==='assistant').length}, tool=${messages.filter(m=>m.role==='tool').length}) | tools=${tools.length} | max_tokens=${body.max_tokens}`)
366
+ console.error(`[debug] history tool_calls=${toolCallsInHistory} | 首条=${messages[0]?.role}:${String(messages[0]?.content).slice(0,40)} | 末条=${messages[messages.length-1]?.role}:${String(messages[messages.length-1]?.content).slice(0,40)}`)
367
+ if (tools.length) {
368
+ console.error(`[debug] 工具名: ${tools.map(t=>t.function.name).join(', ')}`)
369
+ } else {
370
+ console.error(`[debug] ⚠️ tools 为空!请求未携带工具定义,模型不会调用工具`)
371
+ }
372
+ }
373
+
359
374
  // DeepSeek V4: 默认启用 thinking mode → 要求回传 reasoning_content
360
375
  // 这里显式关闭,避免 tool call 场景下的 400 错误
361
376
  // thinking 参数是 DeepSeek 私有扩展,直接放在 body 顶层
@@ -363,8 +378,6 @@ export class QueryEngine {
363
378
  body.thinking = { type: 'disabled' }
364
379
  }
365
380
 
366
- const url = apiBase.replace(/\/+$/, '') + '/chat/completions'
367
-
368
381
  // apiBase 是用户显式指定的配置(--api-base),不是外部输入,跳过 SSRF 检查
369
382
  // SSRF 防护仅适用于 web-fetch/web-search 等工具发起的请求
370
383
  const maxRetries = 3