mirror of
https://github.com/7836246/cursor2api.git
synced 2026-05-22 20:41:03 +08:00
🖥️ Cursor IDE 适配: - 新增 /v1/responses 端点(Responses API → Chat Completions 自动转换) - 兼容 Cursor 扁平工具格式 { name, input_schema } - 扩展 /v1/models 模型列表(claude-sonnet-4-5/4/3.5) - 连续同角色消息自动合并(mergeConsecutiveRoles) - content 数组中 tool_use/tool_result 块直接透传 🔧 工具参数自动修复 (tool-fixer.ts): - normalizeToolArguments: file_path → path 字段名映射 - replaceSmartQuotes: 中文/法文智能引号替换 - repairExactMatchToolArguments: 模糊匹配修复 - extractToolResultNatural: 自然语言 tool_result 转换 🚀 流式增量优化: - input_json_delta / tool_calls 按 128 字节分块 - 拒绝重试扩展到工具模式 - 极短响应自动重试 🧪 新增 44 个单元测试 (tool-fixer + openai-compat)
32 lines
1002 B
JSON
32 lines
1002 B
JSON
{
|
|
"name": "cursor2api",
|
|
"version": "2.5.0",
|
|
"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: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",
|
|
"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",
|
|
"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"
|
|
}
|
|
} |