Files
cursor2api/package.json
小海 d27a5c98ec feat: v2.6.0 — Thinking支持 + 阶梯式截断恢复 + 提示词精简 + 工具签名压缩
★ Thinking 功能集成:
- 新增 src/thinking.ts: <thinking> 标签提取器
- Anthropic 路径: thinking content block (stream/non-stream)
- OpenAI 路径: reasoning_content 字段 (stream/non-stream)
- 配置: enableThinking (默认 true), 支持 config.yaml/ENABLE_THINKING 环境变量
- 提示词克制: 限制 thinking 长度避免吃 output token 预算

★ 阶梯式截断恢复 (替代旧的 6 次盲目续写):
- Tier 1: Bash/拆分引导 — 让模型改用 cat>>file append 或多次小 Write
- Tier 2: 强制拆分 — ≤80 行/块
- Tier 3-4: 传统续写 (最后手段, 最多 2 次)
- 拒绝安全网: Tier 响应为拒绝时恢复原始截断响应
- Thinking 前置: 在截断检测前提取, 避免假截断+省 API 调用

★ 提示词精简 (~50% token 节省):
- 工具格式: 函数签名式 ToolName(params) 替代多行 markdown
- 类型缩写: string→str, number→num, boolean→bool, integer→int
- 行为规则: 3段合并为1段精简指令
- Tier/续写提示词: 5行缩为1行
- 描述截断: 80→50 chars

★ 其他改进:
- vision.ts: 优化图片处理
- cursor-client.ts: 微调
2026-03-13 10:34:23 +08:00

35 lines
1.1 KiB
JSON

{
"name": "cursor2api",
"version": "2.5.6",
"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",
"ts-node": "^10.9.2",
"tsx": "^4.19.0",
"typescript": "^5.8.0"
}
}