Commit Graph
115 Commits
Author SHA1 Message Date
walker1211andClaude Opus 4.7 4c46d6c5ae fix(browser): 修复 DevTools 页面创建和截图诊断
兼容 Chrome DevTools /json/new 的 PUT 方法,过滤不可用的 top-chrome 页面目标,并在截图前对 0x0 viewport 给出明确错误。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-25 14:46:18 +08:00
Tam Nhu Tran 7732b2039a fix(browser): harden Browser MCP sessions and artifacts 2026-04-22 22:34:49 -04:00
walker1211andClaude Opus 4.7 40c718c584 fix(browser): 修复 download 事件的 pageIndex 过滤
为 browser_wait_for_event 的 download 路径补齐按页面 frame tree 过滤,避免多页面或动态 iframe 下载时误命中或漏命中。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-20 21:42:00 +08:00
walker1211andClaude Opus 4.7 1833ed3ad6 feat(browser): 增加跨 page orchestration 能力
新增显式跨页 orchestration block,支持开页、切页、关页后执行单页逻辑。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-20 21:03:33 +08:00
walker1211andClaude Opus 4.7 2f167d8445 feat(browser): 增加 artifact 持久化与导入导出能力
新增 recording、replay、orchestration 的本地 JSON artifact 导出、导入、列出与删除能力。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-20 20:31:51 +08:00
walker1211andClaude Opus 4.7 101396f728 feat(browser): 增加 orchestration 执行策略增强
为 block 与 sequence step 增加最小 continueOnError 语义,并补充 failures 汇总输出。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-20 19:35:52 +08:00
walker1211andClaude Opus 4.7 0038b063ac feat(browser): 增加 sequence 组合块能力
新增单层 sequence 容器以组合现有 orchestration blocks,并补充 sequence 内失败定位能力。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-20 18:55:24 +08:00
walker1211andClaude Opus 4.7 4af967559c feat(browser): 增强 assert_query 断言与诊断信息
为 assert_query 增加 assertions 数组、更多比较操作和结构化失败 diagnostics。
并补充多断言、类型错误和数值比较的回归覆盖。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-20 17:39:19 +08:00
walker1211andClaude Opus 4.7 77855035f4 feat(browser): 完成 Phase 10C orchestration 能力
新增固定流程块 orchestration 闭环,支持 wait_then_click、wait_then_type、run_replay_sequence 与 assert_query。
并补充 block 级失败定位与相关回归覆盖。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-20 15:00:15 +08:00
walker1211andClaude Opus 4.7 9d21e83d46 feat(browser): 完成 Phase 10B replay 能力
新增最小 replay 闭环,支持消费 10A 结构化 steps 并顺序回放常见动作。
同时补充输入校验、失败定位与 replay 边界覆盖。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-20 13:59:34 +08:00
walker1211andClaude Opus 4.7 5288387151 feat(browser): 完成 Phase 10A 录制动作规范化
补齐 recording 安装阶段的真实页面监听与注入失败回滚,避免空录制和损坏会话状态。
并完善高层 step 规范化与相关回归覆盖。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-20 12:50:15 +08:00
walker1211andClaude Opus 4.7 17a3434056 feat(browser): 增加 Phase 10A recording 生命周期
补齐 recording session state、基础 recorder 注入与 capture 读取,打通 start/stop/get/clear 最小闭环。
并补充 pageId 路由、生命周期错误与 page close 停止录制覆盖。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-20 12:44:22 +08:00
walker1211andClaude Opus 4.7 844b5f6c42 feat(browser): 完成 Phase 9 拖拽与指针动作能力
补齐文件拖拽、元素拖拽与受限 pointer 原语,让 Browser MCP 能覆盖常见上传与页面内拖放交互。
并补足 pageId 路由与回归测试,保持与现有 selected-page 语义一致。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-19 18:41:18 +08:00
walker1211andClaude Opus 4.7 492ee5b083 feat(browser): 完成 Phase 8 文件传输能力
增加 browser-scoped 下载控制与 page-scoped file input 上传,补齐 Phase 8 文档与回归覆盖,并去掉下载列表的 pageId 假能力以保持语义一致。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-19 13:46:07 +08:00
walker1211andClaude Opus 4.7 bd073acf47 feat(browser): 增加 richer request matching 能力
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-19 00:43:37 +08:00
walker1211andClaude Opus 4.7 f133deb539 feat(browser): 增加 Phase 6B mock response 能力
在现有拦截规则之上补齐 fulfill 动作,支持最小状态码、响应头和文本响应体。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-18 23:15:04 +08:00
walker1211andClaude Opus 4.7 a93e0b6494 feat(browser): 完成 browser MCP 第六阶段 6A 最小拦截闭环
补齐最小 request interception 工具链与会话内状态管理,确保规则绑定具体页面并通过完整验证门禁。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-18 22:03:17 +08:00
walker1211andClaude Opus 4.7 ff0e7085b8 feat(browser): 完成 browser MCP 第五阶段页面控制
补充 selected page 会话状态与页面选择、打开、关闭能力,
并为 browser_get_session_info 增加 selected 标记与最小多标签文档说明。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-18 16:39:51 +08:00
walker1211andClaude Opus 4.7 e92a2c11bf feat(browser): 完成 browser MCP 第四阶段输入能力
补齐 browser_click 的精细点击参数,并新增 browser_press_key 与 browser_scroll,继续扩展 browser MCP 的真实交互能力。
同步更新单测与浏览器自动化文档,确保 Phase 4 能力完成并通过验证。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-18 13:59:15 +08:00
walker1211andClaude Opus 4.7 cf2375e169 feat(browser): 完成 browser MCP 第三阶段能力
补齐 iframe/shadow 作用域查询与页面事件观察能力,并同步测试与文档,确保 Phase 3 以可验证增量独立收口。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-18 01:55:16 +08:00
walker1211 b90eae3892 feat(browser): 完成 browser MCP 第一阶段能力与配置打通
- 增加 browser_wait_for、browser_eval 及 click/query 扩展能力
- 打通 browser eval_mode 的配置、状态、启动链路与设置界面
- 补充浏览器相关测试隔离、文档和 CI parity 收尾调整
2026-04-18 00:29:43 +08:00
Tam Nhu Tran d30f5803a7 fix(browser): harden browser MCP websocket startup
- fall back across globalThis.WebSocket, undici, and ws for installed runtimes

- normalize socket event handling for both WHATWG and ws implementations

- add an installed-copy regression test for missing ws in Bun global layouts
2026-04-13 12:56:22 -04:00
walkerandClaude Opus 4.6 74f028168d fix(browser): 加固 browser_click 激活语义并修复相关验证阻塞
- 将 browser_click 调整为 mousedown/mouseup 后走 native click
- 在取消激活和中途 detached 场景下避免强制触发 native activation
- 补齐 browser_click 的回归测试与取消激活场景覆盖
- 修复 cliproxy 本地代理、Droid 环境隔离、图像分析 hook 与 proxy 集成测试的验证阻塞

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-13 11:19:16 +08:00
walkerandClaude Opus 4.6 eb8149e8fa feat(browser): 接入 CCS browser MCP 与最小交互闭环
新增 browser MCP 安装、Chrome 复用与运行时接线,
实现 navigate、click、type、take_screenshot 四个 phase-1 工具并补齐相关单测。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-13 11:19:16 +08:00
Tam Nhu Tran 8b553c35c1 fix(websearch): harden searxng url handling 2026-04-12 06:31:20 -04:00
buiducnhat eec8c8b4a3 feat(websearch): add SearXNG provider support and configuration
- Updated websearch.md to include SearXNG in the configuration guide.
- Implemented SearXNG JSON API integration in websearch-transformer.cjs.
- Enhanced unified-config-loader.ts to support SearXNG settings.
- Defined SearXNG configuration types in unified-config-types.ts.
- Updated hook-env.ts to manage SearXNG environment variables.
- Modified status.ts to include SearXNG in web search provider checks.
- Added SearXNG routes and validation in websearch-routes.ts.
- Implemented SearXNG provider tests in websearch-transformer.test.ts.
- Updated readiness tests to account for SearXNG in status.test.ts.
- Enhanced websearch routes tests to validate SearXNG settings.
- Added SearXNG configuration fields in the UI settings.
2026-04-11 16:43:59 +07:00
Tam Nhu Tran 64ecd8b3dc feat(image-analysis): make MCP-first provisioning self-healing 2026-04-08 13:36:05 -04:00
Tam Nhu Tran a33d3f4481 fix: classify DuckDuckGo non-result HTML as failure 2026-04-04 13:05:31 -04:00
Tam Nhu Tran 77b488f8b1 fix(image-analysis): harden runtime and provisioning 2026-04-02 18:36:19 -04:00
Tam Nhu Tran 813b2dd4d0 feat(image-analysis): add provider-backed runtime 2026-04-02 15:44:13 -04:00
Tam Nhu Tran 7f83e041b7 feat(websearch): add managed mcp runtime and provider cooldowns
- switch ccs-websearch MCP to stdio-first framing and keep legacy compatibility

- add cooldown persistence and bounded retries for provider failures

- surface cooldown status in readiness output and regression tests
2026-03-31 14:22:11 -04:00
Tam Nhu Tran cae5b710b8 fix(websearch): close review gaps in managed runtime 2026-03-30 23:02:20 -04:00
Tam Nhu Tran de7171d810 feat(websearch): finish managed third-party rollout
- steer third-party launches toward the managed WebSearch MCP tool

- add opt-in trace diagnostics across launch, MCP, provider, and headless paths

- extend docs and regression coverage for the first-class runtime

Refs #862
2026-03-30 22:41:51 -04:00
Tam Nhu Tran e260df7178 feat: add first-class CCS WebSearch runtime 2026-03-30 16:10:39 -04:00
Tam Nhu Tran a5d71e3560 fix: normalize websearch hook output for local providers 2026-03-30 15:10:30 -04:00
Tam Nhu Tran 6c7d215ecc feat(websearch): add real provider chain 2026-03-23 15:26:05 -04:00
Kai (Tam Nhu) TranandGitHub 3c7b352656 Merge pull request #680 from 0xble/fix/image-analyzer-thinking-blocks
fix(hooks): handle thinking blocks in image analyzer response parsing
2026-03-07 02:58:39 -05:00
Tam Nhu Tran 50973752ba test(hooks): add image analyzer regression coverage 2026-03-07 14:50:39 +07:00
Tam Nhu Tran 2be5c5a706 fix: sync error code docs links 2026-03-07 09:56:35 +07:00
Brian Le 0060c77c25 fix(hooks): handle thinking blocks in image analyzer response parsing
When models have thinking enabled (e.g. codex with thinking: auto), the
API returns content as [{ type: 'thinking', thinking: '...' }, { type:
'text', text: '...' }]. The hook reads content[0].text which is
undefined for thinking blocks, causing 'No text content in response'
errors that block the Read tool (exit 2).

Also fix cross-provider model fallback: getModelsToTry() unconditionally
appends DEFAULT_MODEL (gemini-2.5-flash) as retry, which 502s on
non-gemini provider routes (e.g. codex). Only use DEFAULT_MODEL when no
provider-specific model is configured.

Fixes: content[0].text -> content.find(b => b.type === 'text')
Fixes: cross-provider retry causing 'unknown provider' 502
Ref: #511
2026-03-04 00:29:17 -05:00
Tam Nhu Tran 0d09604bb9 fix(websearch): support Gemini positional prompt mode 2026-02-26 22:12:16 +07:00
Kai (Tam Nhu) TranGitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
051805074e feat: account safety, quota monitoring, and stability fixes (#530)
* fix(cliproxy): migrate deprecated gemini-claude-* model names to upstream claude-* names (#515)

* fix(cliproxy): migrate deprecated gemini-claude-* model names to upstream claude-* names

CLIProxyAPI registry no longer recognizes the gemini-claude-* prefix convention.
Model names in catalog, base config, and user settings are migrated to upstream
claude-* names. Auto-migration in env-builder rewrites existing user settings on
load and persists the change.

Closes #513

* fix: address code review feedback — sync UI layer and add migration tests

- Sync UI isNativeGeminiModel() with backend (remove gemini-claude- exclusion)
- Update UI model catalog agy entries from gemini-claude-* to claude-*
- Update CI/CD workflow and code-reviewer default model names
- Add unit tests for migrateDeprecatedModelNames() logic

* fix(hooks): isolate image type check before error-prone processing (#514)

* fix(hooks): isolate image type check before error-prone processing

Restructure processHook() into two phases so non-image Read calls
never see hook error messages. Phase 1 defensively checks tool name
and file extension, exiting 0 silently on any failure. Phase 2 only
runs for confirmed image/PDF files where errors are relevant.

Closes #511

* fix(hooks): sync image analyzer hook file on every profile launch

Add installImageAnalyzerHook() call to cliproxy executor, matching
the existing installWebSearchHook() pattern. This ensures the .cjs
file in ~/.ccs/hooks/ gets refreshed from the npm package on every
launch, so users receive hook updates after npm update.

* chore(release): 7.41.0-dev.1 [skip ci]

* fix(cliproxy): add fork:true for Claude model aliases in config generator (#523)

Config generator now outputs fork:true for Claude model alias entries,
ensuring both upstream (claude-*) and aliased (gemini-claude-*) model
names appear in /v1/models listings. Also preserves fork flag when
parsing user-added aliases during config regeneration.

Bumps config version to v7 to trigger regeneration on next ccs doctor.

Closes #522

* chore(release): 7.41.0-dev.2 [skip ci]

* feat(cliproxy): add account safety guards to prevent Google account bans (#516)

* feat(cliproxy): add account safety guards to prevent Google account bans

Implements cross-provider isolation to prevent Google from flagging
concurrent OAuth usage across different client IDs (ref: #509, #512).

Three pillars:
1. Auto-pause enforcement at session launch — conflicting accounts in
   other Google OAuth providers are paused so CLIProxyAPI can't use them,
   restored on session exit with crash recovery via auto-paused.json
2. Ban/disable detection — error responses matching Google ban patterns
   auto-pause the affected account to prevent further damage
3. Cross-provider conflict warnings during OAuth registration

Key design decisions:
- PID-based session tracking for crash recovery (dead PID = restore)
- Timestamp comparison prevents restoring ban-paused accounts on exit
- Schema validation on auto-paused.json prevents corrupted state
- Falls back to warn-only when another session is managing isolation

* fix(cliproxy): address code review feedback (attempt 1/5)

- Re-read auto-paused.json before write in enforceProviderIsolation to
  reduce concurrent write race window
- Use actual email from registry for display instead of raw accountId
- Export maskEmail for testability
- Add 27 unit tests covering ban detection, email masking,
  cross-provider duplicate detection, enforcement lifecycle,
  crash recovery, and timestamp-guarded restore

* fix(cliproxy): address remaining review feedback (attempt 2/5)

- Add handleBanDetection test verifying account pause on ban error
- Add warnCrossProviderDuplicates tests (true/false/non-Google)
- Document PID reuse limitation in isPidAlive JSDoc comment

* chore(release): 7.41.0-dev.3 [skip ci]

* feat(cliproxy): runtime quota monitoring during active sessions (#529)

* feat(cliproxy): add runtime quota monitoring during active sessions

Adds adaptive background quota polling to detect and respond to quota
exhaustion during active CLIProxy sessions. Prevents rate-limit-driven
account bans by auto-cooling exhausted accounts and switching defaults.

- Adaptive polling: 300s normal, 60s at 20% threshold, stops at 0%
- Stderr warnings at 20%, boxed exhaustion alerts at 0%
- Cooldown + default switch on exhaustion (existing patterns)
- Configurable via quota_management.runtime_monitor in config.yaml
- Timer.unref() prevents blocking process exit
- monitorStopped guard for in-flight poll safety

Closes #524

* fix: address code review feedback (attempt 1/5)

- M1: Round quotaPercent display with Math.round() to avoid ugly floats
- M2: Rename exhaust_threshold -> exhaustion_threshold for consistency
  with existing auto.exhaustion_threshold config field
- M3: Replace async not.toThrow() with direct await assertion pattern

* fix: address code review feedback (attempt 2/5)

- Remove .claude/agent-memory/ from tracking and add to .gitignore
- Unify cooldown_minutes default to 5 (was 10 in runtime_monitor, 5 in auto)
- Add threshold validation in startQuotaMonitor (warn > exhaustion)
- Document intentional post-switch monitoring gap in code comment

* chore(release): 7.41.0-dev.4 [skip ci]

* fix(cliproxy): mask email in ban detection and fix JSDoc default

- Use maskEmail() in handleBanDetection output for consistency
- Fix cooldown_minutes JSDoc: default is 5, not 10

* chore(release): 7.41.0-dev.5 [skip ci]

* fix(cliproxy): address all review feedback (Low + informational)

- Add sync constraint comment on process.exit handler (executor)
- Add TOCTOU race acceptability comment (account-safety)
- Mask email in handleQuotaExhaustion reason string
- Use realistic exhaustion_threshold (5) in test configs

* chore(release): 7.41.0-dev.6 [skip ci]

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-02-12 00:48:29 +07:00
kaitranntt 1201b4bb4b fix(hooks): add network errors to noRetryPatterns, update E2E test
- Add ENOTFOUND, ENETUNREACH, EAI_AGAIN to noRetryPatterns to prevent
  infinite retries on network errors
- Update E2E test to expect exit code 2 (block) when CLIProxy unavailable
- Fix debug message expectation in test
2026-02-04 00:59:10 -05:00
kaitranntt 51b719ef34 refactor(hooks): deprecate block-image-read, add CLIProxy fallback
- Remove redundant block-image-read.cjs hook (image-analyzer handles all)
- Add fallback blocking when CLIProxy unavailable (prevents context overflow)
- Simplify fallback message to prevent context pollution/hallucination
- Remove image-read-block-hook-env.ts and related exports
- Update comments per PR #442 review suggestions
- Add defensive check for empty models array

Closes #426
2026-02-04 00:49:52 -05:00
kaitranntt ae3eb282b4 feat(hooks): add ANTHROPIC_MODEL fallback for image analysis
Model resolution priority:
1. provider_models[current_provider]
2. ANTHROPIC_MODEL from profile settings
3. DEFAULT_MODEL (gemini-2.5-flash)

Allows users to override vision model via profile's ANTHROPIC_MODEL.
2026-02-04 00:19:51 -05:00
kaitranntt cb8de2c8e8 fix(hooks): improve error handling and edge cases for image analysis
- Add empty model string validation in config command

- Add --enable/--disable conflict detection

- Truncate long model names in display (>40 chars)

- Add EACCES/EPERM file permission error handler

- Add filesystem error classification (ENOSPC, EROFS)

- Log config upgrade save failures instead of silent catch
2026-02-03 22:32:49 -05:00
kaitranntt 2b0717ed53 feat(hooks): add UX improvements for image analysis hook
Add comprehensive UX enhancements for the image analysis CLIProxy hook:

- Add `ccs config image-analysis` CLI command for managing settings
  - Enable/disable toggle
  - Timeout configuration (10-600s)
  - Per-provider model configuration
  - Status display with provider models

- Add specialized error handlers with actionable messages
  - File too large (with compression hints)
  - CLIProxy unavailable (with start instructions)
  - Auth failure (with re-auth commands)
  - Timeout (with increase timeout hint)
  - Rate limit (with retry guidance)
  - API error (with response body parsing)

- Add comprehensive debug output (CCS_DEBUG=1)
  - Provider name and model
  - File size and media type
  - Timeout and endpoint
  - Skip reasons with context

- Add help text updates
  - `ccs --help` includes Image Analysis section
  - `ccs config --help` lists image-analysis subcommand

- Add doctor integration
  - Validates image_analysis config
  - Checks enabled status, providers, timeout
  - Warns if CLIProxy not running

- Add unit tests for new config command
2026-02-03 22:14:52 -05:00
kaitranntt 0e7b9c9190 fix(hooks): add edge case validation in image analyzer
- Empty model validation: check `model.trim()` before using
- 10MB boundary: use `>=` instead of `>` for consistent messaging
- Timeout clamping: ensure timeout is between 1-600 seconds
- Response stream error: add error handler for network failures
- Empty response validation: check before JSON.parse to prevent crashes
2026-02-03 21:44:44 -05:00
kaitranntt 40caff13ad refactor(hooks): use provider_models mapping for image analysis
Changes ImageAnalysisConfig from providers array to provider_models
mapping for granular vision model control per CLIProxy provider.

Breaking change: config.yaml image_analysis section now uses
provider_models instead of providers/model fields.

Provider-to-model mappings:
- agy → gemini-2.5-flash
- gemini → gemini-2.5-flash
- codex → gpt-5.1-codex-mini
- kiro → kiro-claude-haiku-4-5
- ghcp → claude-haiku-4.5
- claude → claude-haiku-4-5-20251001

Hook checks CCS_CURRENT_PROVIDER against provider_models and skips
if no vision model configured for that provider.
2026-02-03 21:32:19 -05:00
kaitranntt 70caaa00a0 fix(hooks): improve image analysis output format
Match websearch transformer format:
- Header: [Image Analysis via CLIProxy]
- Metadata: File name, size in KB, model used
- Separator lines for better readability
- Footer instruction for Claude
2026-02-03 20:58:05 -05:00