@raolin2025/claude-code-node 2.3.4 → 2.3.6
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 +1 -1
- package/src/core/cli.js +4 -3
- package/src/core/query-engine.js +2 -16
package/package.json
CHANGED
package/src/core/cli.js
CHANGED
|
@@ -144,6 +144,7 @@ function buildBanner({ model, permissionMode, session, maxTokens }) {
|
|
|
144
144
|
const BLUE = '\x1b[34m'
|
|
145
145
|
const CYAN = '\x1b[36m'
|
|
146
146
|
const RESET = '\x1b[0m'
|
|
147
|
+
const RED = '\x1b[31m'
|
|
147
148
|
|
|
148
149
|
// 像素风格 CC 机器人(19字符宽,带颜色边框)
|
|
149
150
|
const robotRaw = [
|
|
@@ -151,8 +152,8 @@ function buildBanner({ model, permissionMode, session, maxTokens }) {
|
|
|
151
152
|
' │ ██ ██ │ ',
|
|
152
153
|
' │ ██████ │ ',
|
|
153
154
|
' │ ██ ██ │ ',
|
|
154
|
-
' │
|
|
155
|
-
' │ ███████
|
|
155
|
+
' │ │ ',
|
|
156
|
+
' │ ███████ │ ',
|
|
156
157
|
' │ ██ ██ │ ',
|
|
157
158
|
' │ ██████ │ ',
|
|
158
159
|
' │ ██ ██ ██ │ ',
|
|
@@ -163,7 +164,7 @@ function buildBanner({ model, permissionMode, session, maxTokens }) {
|
|
|
163
164
|
const colorize = (line) =>
|
|
164
165
|
line
|
|
165
166
|
.replace(/[┌└─╭╮┐┘│]/g, BLUE + '$&' + RESET)
|
|
166
|
-
.replace(/[█]/g,
|
|
167
|
+
.replace(/[█]/g, RED + '$&' + RESET)
|
|
167
168
|
|
|
168
169
|
const robotColored = robotRaw.map(colorize)
|
|
169
170
|
|
package/src/core/query-engine.js
CHANGED
|
@@ -17,7 +17,6 @@ import { parseStream, parseNonStreamResponse } from './streaming.js'
|
|
|
17
17
|
import { autoCompact } from './compact.js'
|
|
18
18
|
import { CostTracker } from './cost-tracker.js'
|
|
19
19
|
import { EnhancedPermissionChecker } from '../security/enhanced-permission.js'
|
|
20
|
-
import { checkHostSafety } from '../security/ssrf-guard.js'
|
|
21
20
|
|
|
22
21
|
/**
|
|
23
22
|
* 配置选项
|
|
@@ -312,21 +311,8 @@ export class QueryEngine {
|
|
|
312
311
|
|
|
313
312
|
const url = apiBase.replace(/\/+$/, '') + '/chat/completions'
|
|
314
313
|
|
|
315
|
-
//
|
|
316
|
-
|
|
317
|
-
const parsedUrl = new URL(url)
|
|
318
|
-
const hostResult = await checkHostSafety(parsedUrl.hostname)
|
|
319
|
-
if (!hostResult.allowed) {
|
|
320
|
-
throw new Error(`SSRF blocked: ${hostResult.reason}`)
|
|
321
|
-
}
|
|
322
|
-
} catch (err) {
|
|
323
|
-
if (err.message.startsWith('SSRF blocked:')) {
|
|
324
|
-
throw err
|
|
325
|
-
}
|
|
326
|
-
// URL 解析错误忽略,让 fetch 自己处理
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
// 带重试的 fetch
|
|
314
|
+
// apiBase 是用户显式指定的配置(--api-base),不是外部输入,跳过 SSRF 检查
|
|
315
|
+
// SSRF 防护仅适用于 web-fetch/web-search 等工具发起的请求
|
|
330
316
|
const maxRetries = 3
|
|
331
317
|
// Jitter 退避 — 指数退避 + 随机 ±50%,防止惊群效应
|
|
332
318
|
const retryDelay = (baseMs, attempt) => {
|