Files
cursor2api/package.json
小海 d366125a56 feat(v2.7.1): 智能压缩算法 + 可配置压缩系统 + 日志鉴权 + Thinking 修复
🗜️ 智能历史压缩算法:
- 修复 JSON Action 块截断: 工具调用消息摘要化, 不再切断代码块
- 工具结果 60% 头 + 40% 尾保留, 错误信息不丢失
- 修复非工具模式 few-shot 偏移量 Bug
- 普通文本在自然边界(换行符)处截断

⚙️ 可配置压缩系统 (config.yaml):
- compression.enabled: 开关
- compression.level: 1(轻度) / 2(中等) / 3(激进)
- compression.keep_recent / early_msg_max_chars: 高级覆盖
- 支持 COMPRESSION_ENABLED / COMPRESSION_LEVEL 环境变量

🔐 日志查看器鉴权:
- 配置 auth_tokens 后 /logs 及 API 端点需验证
- 精美登录页, token 缓存到 localStorage
- 支持 query/header/x-api-key 三种传入方式

🧠 Thinking 修复:
- 拒绝检测先剥离 <thinking> 标签, 防止误判
- OpenAI 格式默认启用 thinking
2026-03-16 17:11:01 +08:00

34 lines
1.0 KiB
JSON

{
"name": "cursor2api",
"version": "2.7.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 && node test/unit-proxy-agent.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"
}
}