Xu Kang
1fb66fa612
Merge pull request #139 from BaskDuan/feat/stealth-bundled
...
feat: 内置 stealth-proxy,单容器绕过 Vercel Bot Protection
2026-04-03 09:13:57 +08:00
BaskDuan
49de433965
feat: 优先使用系统 Chrome 过 Vercel challenge,fallback 到 Playwright Chromium
...
系统 Chrome 指纹更真实,不易被 bot 检测拦截。
支持 macOS / Linux / Windows 自动检测 Chrome 路径。
Docker 环境无系统 Chrome 时自动回退到 Playwright Chromium。
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-03 00:05:37 +08:00
BaskDuan
941f8e234a
feat: stealth-proxy 添加人类行为模拟,帮助通过 Vercel bot 检测
...
模拟鼠标移动轨迹、滚动、点击等行为,降低被风控拦截概率。
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-02 23:57:55 +08:00
BaskDuan
7e0a01f14f
feat: 添加 npm run test:stealth 诊断 challenge 耗时
...
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-02 23:40:23 +08:00
BaskDuan
848a265aec
fix: CHALLENGE_WAIT 调整为 55s
...
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-02 23:25:50 +08:00
BaskDuan
c5f3c6bb61
fix: CHALLENGE_WAIT 增加到 50s
...
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-02 23:25:30 +08:00
BaskDuan
4a5b215b01
fix: stealth-proxy 启动失败自动重试,最多 5 次递增延迟
...
网络不稳定时自动清理浏览器实例并重试,每次间隔递增(5s/10s/15s/20s/25s)。
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-02 23:24:22 +08:00
BaskDuan
484262ca8a
fix: 增加 challenge 容错 — 超时延长到 30s 并支持自动重试
...
- CHALLENGE_WAIT 从 15s 增加到 30s
- challenge 页面改用 domcontentloaded + 60s 超时
- 首次获取 cookie 失败后自动刷新重试一次
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-02 23:09:09 +08:00
BaskDuan
6c56417a06
fix: worker 页面改用 domcontentloaded 避免 networkidle 超时
...
challenge 页面已获取 cookie,worker 页面无需等 networkidle。
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-02 23:06:04 +08:00
BaskDuan
e6e15c86d1
fix: dev:stealth 等待 stealth-proxy 就绪后再启动 cursor2api
...
避免请求到达时 stealth-proxy 还未 ready 导致 fetch failed。
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-02 23:04:35 +08:00
BaskDuan
5592cbb1c4
feat: postinstall 自动安装 stealth-proxy 依赖和 Chromium
...
npm install 一把搞定,无需手动进 stealth-proxy 目录操作。
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-02 22:56:28 +08:00
BaskDuan
59372c3775
feat: 添加 dev:stealth 本地开发命令,一键启动 stealth-proxy + cursor2api
...
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-02 22:51:20 +08:00
BaskDuan
0f8b3246ed
feat: 内置 stealth-proxy 到 Docker 镜像,一个容器搞定 Vercel Bot Protection
...
- Dockerfile 从 alpine 切换到 slim (Debian) 以支持 Playwright Chromium
- 新增 start.sh 入口脚本,ENABLE_STEALTH=true 时自动启动内置 stealth-proxy
- docker-compose.yml 简化为单容器方案,默认启用 stealth 模式
- 新增 cookie/stealth_proxy/system_prompt 配置项及环境变量支持
- deploy-all.sh 加入 .gitignore(含敏感服务器信息)
- 更新默认指纹为 macOS Chrome 146
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-02 15:44:32 +08:00
Xu Kang
bfb9f9c2aa
Revise README for v2.7.8 features and changes
...
Updated README to reflect new features in v2.7.8.
2026-04-01 08:59:40 +08:00
Bask
a18e39aebe
Merge branch '7836246:main' into main
2026-03-28 11:33:29 +08:00
Xu Kang
935bb3fde9
Merge pull request #115 from wsyh4567/fix/codex-sse-response-format
...
fix: SSE response events must wrap response object under "response" f…
2026-03-28 10:35:03 +08:00
wsyh4567
0958ca3c2a
fix: SSE 事件格式错误导致 Codex CLI v0.117+ 出现 stream closed before response.completed
...
修复两处导致 Codex CLI v0.117+ 报错 "stream closed before response.completed" 的 bug:
Bug 1:writeResponsesSSE 发送的 data JSON 缺少 "type" 字段
Codex 的 ResponsesStreamEvent 结构体要求每条事件的 data 必须包含
"type" 字段,否则整条事件解析失败被跳过。
修复:将 JSON.stringify(data) 改为 JSON.stringify({ type: eventType, ...data })
Bug 2(主要原因):response 对象未嵌套在 "response" 字段下
Codex 处理 response.completed / response.created / response.in_progress 时,
从 event.response 字段读取 response 对象。cursor2api 原本将
buildResponseObject() 的字段全部展开到顶层,导致 event.response = null,
整个事件被静默忽略,等流关闭时报 "stream closed before response.completed"。
修复:所有 buildResponseObject() 调用改为 { response: buildResponseObject(...) }
共修改 8 处(emitResponsesTextStream、工具调用路径、错误回退路径)
参考:https://github.com/openai/codex/blob/main/codex-rs/codex-api/src/sse/responses.rs
关联 Issue:#114
2026-03-28 00:41:58 +08:00
小海
0716b602ac
feat: v2.7.8 - 新增三大防截断机制
...
- 上下文压力膨胀(context_pressure):虚增 input_tokens 让客户端提前触发自动压缩
- 自适应历史预算(tools.adaptive_budget):工具数量越多,自动预留越多输出空间
- 工具结果智能截断(tools.smart_truncation):按工具类型差异化截断(Read/Bash/Search)
- 三个功能均默认关闭,支持 config.yaml 和环境变量控制
- 更新 config.yaml.example、docker-compose.yml、README 更新日志
v2.7.8
2026-03-27 11:48:37 +08:00
小海
55a679fb2c
docs: 添加赞助感谢板块
2026-03-27 10:28:54 +08:00
BaskDuan
42f2c41875
fix: hardcode lowercase ghcr tag
...
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2026-03-27 00:45:36 +08:00
BaskDuan
578e59abd9
fix: force lowercase tag for GHCR
...
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2026-03-27 00:44:29 +08:00
BaskDuan
57e0bb5ad4
fix: use lowercase repository_owner for GHCR tag
...
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2026-03-27 00:43:16 +08:00
BaskDuan
8109757adc
feat: add GitHub Actions workflow for amd64 Docker build and GHCR push
...
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2026-03-27 00:41:46 +08:00
Xu Kang
7a929c9c44
Merge pull request #102 from huangzt/feature/vue-logs-ui
...
feat: Vue UI 增强 — 统计/筛选联动、自动跟随、交互优化
2026-03-23 21:20:42 +08:00
huangzhenting
717af46606
feat: Vue UI 增强 — 统计/筛选联动、自动跟随、交互优化
...
- 新增 getVueStats(since?)/apiGetVueStats/GET /api/vue/stats,供 Vue UI 专用
SQLite 模式走数据库全量聚合+since过滤,getStats() 保持原样不影响 HTML 版本
- Vue UI 所有 /api/stats 调用改为 /api/vue/stats
- SSE stats 事件改为调 statsStore.load() 从 /api/vue/stats 拉最新数据
- 时间筛选增加 1小时/6小时选项,状态筛选改为 emoji 图标风格
- 状态筛选选中态:全部用蓝紫渐变底色,图标按钮用对应颜色边框+文字
- AppHeader/RequestList 缩写处全面补充 title tooltip
- 新增「自动跟随」功能:选中记录后可开启,SSE 推送新请求时自动切换并滚动到顶部
- 修复 ConfigDrawer draft 可能为 null 的 TS 错误
- 修复 CSS typo:.rfmt.responses background 颜色值多余空格
- upsertRequest 改用 Object.assign 避免 SSE 推送时替换对象引用打断 hover
2026-03-23 17:35:13 +08:00
小海
2933df2697
fix: improve truncation recovery and diagnostics for v2.7.7
...
- mark degraded requests in logs and viewer when execution quality drops
- record Anthropic toolCallsDetected correctly in summaries
- continue semantically incomplete long Write/Edit tool payloads
- restore truncated OpenAI stream long Write tool_calls
- update release docs, sample config, docker notes, and README guidance
v2.7.7
2026-03-23 11:39:00 +08:00
Xu Kang
70fa4074e8
Merge pull request #93 from huangzt/feature/vue-logs-ui
...
feat: 新增 SQLite 日志持久化 + Vue UI 后端过滤分页(完全兼容,不影响主流程)
2026-03-23 09:05:18 +08:00
huangzhenting
a84dfd6d03
feat: 实现 db_enabled/db_path 热重载支持,修复文档格式
...
- logger-db.ts: 新增 closeDb(),修复 initDb() 支持安全重复调用
- logger.ts: 注册 onConfigReload 回调,db_enabled/db_path 变更后无需重启
- config.yaml.example: 删除「需重启」警告注释,补充热重载说明
- README.md: 修复环境变量表格被 blockquote 截断的格式问题,更新热重载说明
- vue-ui/README.md: 删除「需重启服务」错误说明
- ConfigDrawer.vue: 删除「需重启」提示
2026-03-23 08:45:21 +08:00
huangzhenting
1bc91cac24
feat: 新增 SQLite 持久化支持 + Vue UI 后端过滤与分页优化
...
- 新增 src/logger-db.ts:SQLite 封装层(WAL 模式,支持写入/分页/状态计数/按需 payload 查询)
- logger.ts:双写 SQLite+JSONL,启动时 db_enabled 模式跳过 JSONL 读取避免 OOM,新增游标分页和后端过滤函数
- config.ts/config-api.ts:新增 db_enabled/db_path 配置字段及 LOG_DB_ENABLED/LOG_DB_PATH 环境变量
- log-viewer.ts/index.ts:新增 /api/requests/more 支持 status/keyword/since 后端过滤
- Vue UI:搜索框 400ms 防抖,状态/时间筛选立即触发后端查询,statusCounts 不受状态筛选影响,SSE 实时推送时增量更新计数
- 新增迁移工具 test/migrate-jsonl-to-sqlite.mjs 和单元测试 test/unit-logger-db.mjs
- 完善 README.md、config.yaml.example、docker-compose.yml、vue-ui/README.md 文档
2026-03-22 21:10:26 +08:00
Xu Kang
9a69e66a7e
Merge pull request #90 from huangzt/feature/vue-logs-ui
...
fix: 修复 thinking 截断时内容泄漏到正文的问题
2026-03-22 18:24:54 +08:00
huangzhenting
f317dc04b0
fix: 修复 thinking 截断时内容泄漏到正文的问题
...
问题:当模型 thinking 内容超出单次输出上限时,<thinking> 标签未闭合,
导致 thinking 内容被当作正文泄漏给客户端;续写请求中 assistantContext
含未闭合标签,模型不知道思考阶段已结束,继续输出 thinking 而非正文。
修复:
1. splitLeadingThinkingBlocks:未闭合时返回已积累的部分 thinkingContent
而非空字符串,供调用方正确提取
2. handler.ts / openai-handler.ts:流结束 flush 新增 !complete 分支,
提取截断的 thinkingContent,不将 thinking 内容 flush 为正文
3. 新增 closeUnclosedThinking:续写前补全缺失的 </thinking> 标签,
应用于所有 4 处续写 assistantContext 构建,让模型正确从正文续写
4. shouldAutoContinueTruncatedToolResponse:json action 块未闭合时
跳过 200-char 检查,修复 thinking 剥离后正文过短导致续写不触发的问题
测试:新增 unit-thinking-truncation.mjs(11个单元测试)、
e2e-thinking-truncation.mjs(3个实际 API 请求测试),全部通过
2026-03-22 14:10:58 +08:00
Xu Kang
bb86c1a66e
Merge pull request #88 from huangzt/feature/vue-logs-ui
...
fix: 优化 token 预算精度,新增 TokenDiff 日志对比功能
2026-03-22 10:49:40 +08:00
huangzhenting
c4b81f33d1
fix: improve token budget accuracy and add TokenDiff logging
...
- converter: replace rough overhead formula (tools*70+350) with actual
estimateTokens on built few-shot messages + Cursor hidden overhead
(1300 base + perTool by schema_mode); remove 16000 output reservation
- cursor-client: sendCursorRequestFull now returns {text, usage?} to
capture real Cursor inputTokens/outputTokens from messageMetadata
- handler: add estimateCursorReqTokens() and [TokenDiff] log to compare
tiktoken estimate vs actual Cursor usage; fix non-stream retry paths
to update usage from retry result; skip auto-continue when response < 200 chars
- openai-handler: update 4 call sites for new sendCursorRequestFull return type
- config: raise default maxHistoryTokens from 130000 to 150000
- docs/config: remove incorrect 'tiktoken underestimates 10~20%' claim;
update overhead description and reference range to 130000~170000
2026-03-22 02:35:04 +08:00
Xu Kang
3e0ceb2227
Merge pull request #87 from huangzt/feature/vue-logs-ui
...
feat: 新增 max_history_tokens 按 token 数裁剪历史 + 记录 Cursor API 真实 token 用量
2026-03-21 19:09:55 +08:00
huangzhenting
a153dad4de
feat: record and display real Cursor API token usage
...
Capture the actual input/output token counts from Cursor API's finish
event (messageMetadata.usage) and use them in place of tiktoken
estimates where available. Fall back to tiktoken if not present.
- src/types.ts: extend CursorSSEEvent with finishReason/messageMetadata
- src/handler.ts: capture finish event usage in streaming paths, pass
real counts to updateSummary with tiktoken fallback
- src/logger.ts: add inputTokens/outputTokens fields to RequestSummary
- vue-ui: show ↑/↓ Cursor tokens in RequestList, DetailPanel, PayloadView
- public/logs.js: show ↑/↓ Cursor tokens in scard and prompts summary
2026-03-21 18:42:12 +08:00
huangzhenting
b542d554c6
feat: add max_history_tokens to trim context by token budget
...
Introduce js-tiktoken (cl100k_base) based token estimation to replace
the naive chars/3 approach. Add max_history_tokens config option that
trims oldest messages when the estimated token budget is exceeded.
- src/tokenizer.ts: new module wrapping js-tiktoken getEncoding
- src/config.ts/config-api.ts: YAML parse, env var, hot-reload, default 130000
- src/converter.ts: token budget trimming after max_history_messages pass
- src/handler.ts: replace estimateInputTokens with tiktoken-based version
- config.yaml.example/docker-compose.yml/README.md: docs and examples
- vue-ui: ConfigDrawer field, HotConfig type, README table row
2026-03-21 18:41:45 +08:00
Xu Kang
b70f787aef
Merge pull request #84 from huangzt/feature/vue-logs-ui
...
fix: HTML token 重复检测 + CodeBlock 语法高亮修复
2026-03-21 01:19:20 +08:00
huangzhenting
a3bd993d15
fix: CodeBlock 仅对指定 lang 做语法高亮,markdown 类型非 MD 预览时显示原始文本
...
- 移除 highlightAuto,避免纯文本内容被误判染色
- lang=markdown 仅在 mdPreview 开启时渲染,否则显示原始文本
- toolCalls 区块补充 lang=json 以保留 JSON 高亮
2026-03-21 00:47:13 +08:00
huangzhenting
feab833fbd
fix: replace line-repeat detection with HTML token repeat detection
...
- 用跨 delta 拼接的 HTML token 重复检测替换依赖 \n 的行级检测
- 新增 streaming-text warmup HTML guard,阻止纯 HTML token 在 warmup 阶段提前 unlock 推流
- 覆盖 <br>、</s>、 等被拆散发送或无换行的场景
2026-03-21 00:30:01 +08:00
Xu Kang
d519338ba1
Merge pull request #79 from huangzt/feature/vue-logs-ui
...
feat: Vue UI 配置抽屉、行级重复检测修复、Docker 部署文档完善
2026-03-20 18:11:40 +08:00
huangzhenting
35e2c56855
docs: update vue-ui README with Docker deploy notes, fix config.yaml ro mount
...
Remove :ro from config.yaml volume mount in docker-compose.yml so the
config drawer can write back changes at runtime. Add deployment section
to vue-ui/README.md covering: build-before-docker requirement, config.yaml
read-write mount, first-time setup steps, and config drawer field reference.
2026-03-20 17:54:51 +08:00
huangzhenting
45f192a381
feat: add Vue config drawer for hot-reloadable settings
...
Add /api/config GET+POST endpoints to read and write config.yaml fields
that support hot-reload. Frontend: config button in AppHeader opens a
650px side drawer with grouped fields, SegSelect/Toggle components,
YAML key names as labels, and descriptions sourced from config.yaml.example.
thinking.enabled supports a 3-way selector (auto/off/on) where auto
deletes the yaml key so the default kicks in.
2026-03-20 17:50:49 +08:00
huangzhenting
203de92228
fix: detect and abort line-level repetition loops in cursor stream
...
Adds line-by-line repeat detection alongside the existing delta-level
degenerate loop guard. When the same non-empty line appears 8+ consecutive
times, the stream is cancelled and a retryable error is thrown.
2026-03-20 17:50:38 +08:00
Xu Kang
3ad8be7d33
Merge pull request #78 from majorcheng/main
...
fix: complete OpenAI logs and default persisted logs to summary
2026-03-20 14:29:27 +08:00
majorcheng
310fd8672d
fix: complete OpenAI logs and default persisted logs to summary
2026-03-20 14:06:46 +08:00
小海
d293d272ad
release: v2.7.6 - tool passthrough/disabled modes, identity leak fix, tool_choice guidance
...
New features:
- tools.passthrough: bypass few-shot injection, embed raw tool defs (for Roo Code/Cline)
- tools.disabled: skip all tool injection for max context savings
- Enhanced Cursor identity leak sanitization (new regex patterns)
- Improved tool_choice=any guidance with collaborative tone
- TOOLS_PASSTHROUGH / TOOLS_DISABLED env var support
- Startup & request logs show tool mode (disabled/passthrough/standard)
v2.7.6
2026-03-20 09:28:49 +08:00
小海
db5d3fb1f7
feat: show tools mode (disabled/passthrough) in startup and request logs
...
- Startup log: Tools: disabled / passthrough / schema=full
- Request log: tools=98(跳过) / tools=98(透传) / tools=98
2026-03-20 09:26:23 +08:00
小海
4a026b6b98
feat: add tools.disabled mode to skip all tool injection for max context savings
...
- tools.disabled: true completely skips tool definitions + few-shot injection
- Response-side parseToolCalls still works if model outputs action blocks
- Env var: TOOLS_DISABLED=true|false
- Updated config.yaml.example and docker-compose.yml
2026-03-20 09:23:15 +08:00
小海
7c2422ce60
feat: add TOOLS_PASSTHROUGH env var override for Docker support
2026-03-20 09:18:13 +08:00
小海
70d077b27a
docs: add passthrough option to config.yaml.example
2026-03-20 09:16:33 +08:00