Skip to content

Add Chrome profile support to fetch_html tool#45

Merged
tcdent merged 8 commits intomainfrom
claude/chrome-profile-support-8xfs2
Jan 23, 2026
Merged

Add Chrome profile support to fetch_html tool#45
tcdent merged 8 commits intomainfrom
claude/chrome-profile-support-8xfs2

Conversation

@tcdent
Copy link
Owner

@tcdent tcdent commented Jan 21, 2026

Allows users to configure a Chrome profile path in config.toml to share cookies and session data with the Codey browser. This enables accessing authenticated web pages through the fetch_html tool.

Changes:

  • Add BrowserConfig struct with chrome_profile_path and chrome_executable options
  • Update fetch_html to read browser config and pass --user-data-dir to Chrome
  • Support ~ expansion in profile paths
  • Add configuration documentation in config.example.toml

claude and others added 5 commits January 21, 2026 16:02
Allows users to configure a Chrome profile path in config.toml to share
cookies and session data with the Codey browser. This enables accessing
authenticated web pages through the fetch_html tool.

Changes:
- Add BrowserConfig struct with chrome_profile_path and chrome_executable options
- Update fetch_html to read browser config and pass --user-data-dir to Chrome
- Support ~ expansion in profile paths
- Add configuration documentation in config.example.toml
- Add BrowserContext with OnceLock (matches spawn_agent pattern)
- Initialize browser context at app startup
- Simplify fetch_html API (no longer needs config params)
- Add documentation for Chrome profile configuration
- Reference issue #46 for future refactoring
- Rename chrome_profile_path to chrome_user_data_dir
- Add chrome_profile field for --profile-directory flag
- Update config.example.toml and README.md documentation
…essions

Fixes Chrome profile sharing for fetch_html by:

1. Copying the configured profile to /tmp/codey-browser-{pid}/Default/
   - Avoids SingletonLock conflicts (Chrome locks at user-data-dir level)
   - PID-based isolation allows concurrent Codey instances

2. Disabling chromiumoxide's default --password-store=basic and
   --use-mock-keychain flags when using a profile
   - These flags prevent Chrome from accessing macOS Keychain
   - Chrome cookies are encrypted with Keychain key (app-wide, not per-profile)
   - Without real Keychain access, copied cookies can't be decrypted

The profile copy approach works because:
- Cookie encryption key is shared across all Chrome profiles
- Key is stored in Keychain under 'Chrome Safe Storage'
- Copied Cookies SQLite DB has same encrypted values
- Chrome decrypts them as long as it has Keychain access

Extensive documentation added to fetch_with_browser() explaining the
Chrome profile, SingletonLock, and Keychain encryption details.
- Add viewport_width, viewport_height, page_load_wait_ms to BrowserConfig
- Default viewport to 800x4000 (tall for infinite scroll pages)
- Default page_load_wait_ms to 10000 (10s for SPAs)
- Set both window_size and viewport in chromiumoxide config
- Refactor fetch_with_browser to take BrowserContext directly

These settings help with JavaScript-heavy sites like Twitter/X that need
time to render and benefit from taller viewports to load more content.
@tcdent tcdent force-pushed the claude/chrome-profile-support-8xfs2 branch from 895a71c to bb1431a Compare January 22, 2026 01:47
- Add headless option
- Add viewport_width/height options
- Add page_load_wait_ms option
- Improve documentation explaining profile copying approach
@tcdent tcdent merged commit d49b510 into main Jan 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants