Files
cursor2api/package.json
小海 5f0f9b7936 feat: v2.5.1 - 上下文智能压缩 + 截断检测 + tolerantParse 增强
🗜️ 智能压缩
- 长对话老消息压缩而非丢弃,保留因果链语义
- 工具结果压缩为摘要,助手消息保留工具名
- 压缩率 70-80%,解决 Cursor 上下文溢出问题

⚠️ 截断检测
- 代码块/XML 未闭合时返回 stop_reason=max_tokens
- Claude Code 自动继续,无需手动点击"继续"

🔧 tolerantParse
- 新增正则兜底层,处理未转义双引号的 JSON
- 解决 position 5384 等长参数解析崩溃

🛡️ 拒绝 fallback 优化
- 工具模式下返回极短引导文本
2026-03-10 17:29:49 +08:00

32 lines
1002 B
JSON

{
"name": "cursor2api",
"version": "2.5.1",
"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"
}
}