Files
cursor2api/package.json
小海 14aa65349c feat: v2.7.5 — 常量集中管理 + 自定义拒绝规则 + 响应清洗开关
🏗️ 常量集中管理
- 新增 constants.ts,提取 REFUSAL_PATTERNS、IDENTITY_PROBE_PATTERNS、
  TOOL_CAPABILITY_PATTERNS、CLAUDE_IDENTITY_RESPONSE、CLAUDE_TOOLS_RESPONSE
- isRefusal() 统一导出,内置 + 自定义规则合并检测

🔧 自定义拒绝检测规则 (config.yaml: refusal_patterns)
- 用户可添加自定义正则匹配规则,追加到内置列表
- 无效正则自动退化为字面量匹配
- 缓存编译 + 热重载支持

🔀 响应内容清洗开关 (config.yaml: sanitize_response)
- 控制 sanitizeResponse() 是否替换 Cursor 身份引用为 Claude
- 默认关闭,关闭时零开销
- 支持环境变量 SANITIZE_RESPONSE 覆盖
2026-03-19 09:44:21 +08:00

40 lines
1.7 KiB
JSON

{
"name": "cursor2api",
"version": "2.7.5",
"description": "Proxy Cursor docs AI to Anthropic Messages API for Claude Code",
"type": "module",
"scripts": {
"dev": "tsx watch src/index.ts",
"build": "tsc",
"start": "node dist/index.js",
"test:handler-truncation": "node test/unit-handler-truncation.mjs",
"test:openai-stream-truncation": "node test/unit-openai-stream-truncation.mjs",
"test:image-paths": "node test/unit-image-paths.mjs",
"test:openai-image-file": "node test/unit-openai-image-file.mjs",
"test:openai-chat-input": "node test/unit-openai-chat-input.mjs",
"test:vision": "node test/unit-vision.mjs",
"test:unit": "node test/unit-tolerant-parse.mjs",
"test:tool-fixer": "node test/unit-tool-fixer.mjs",
"test:openai-compat": "node test/unit-openai-compat.mjs",
"test:all": "node test/unit-tolerant-parse.mjs && node test/unit-tool-fixer.mjs && node test/unit-openai-compat.mjs && node test/unit-proxy-agent.mjs && node test/unit-image-paths.mjs && node test/unit-vision.mjs && node test/unit-openai-chat-input.mjs && node test/unit-openai-image-file.mjs && node test/unit-handler-truncation.mjs && node test/unit-openai-stream-truncation.mjs",
"test:e2e": "node test/e2e-chat.mjs",
"test:agentic": "node test/e2e-agentic.mjs"
},
"dependencies": {
"dotenv": "^16.5.0",
"eventsource-parser": "^3.0.1",
"express": "^5.1.0",
"tesseract.js": "^7.0.0",
"undici": "^7.22.0",
"uuid": "^11.1.0",
"yaml": "^2.7.1"
},
"devDependencies": {
"@types/express": "^5.0.2",
"@types/node": "^22.15.0",
"@types/uuid": "^10.0.0",
"tsx": "^4.19.0",
"typescript": "^5.8.0"
}
}