Commit Graph

26 Commits

Author SHA1 Message Date
Deheng Huang b9f1d921b4 Update scripts/auth_manager.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-01-29 22:09:21 +08:00
copilot-swe-agent[bot] 3371ea385e refactor: address code review feedback - DRY validation, shared instances
Co-authored-by: magicseek <446252+magicseek@users.noreply.github.com>
2026-01-29 14:06:13 +00:00
copilot-swe-agent[bot] c446c56d77 fix: address code review feedback - error handling, validation, and compatibility
Co-authored-by: magicseek <446252+magicseek@users.noreply.github.com>
2026-01-29 14:02:48 +00:00
Deheng Huang 88e5fc09b9 feat(auth): fresh profile and symlink improvements
AuthManager improvements for multi-account support:

1. Fresh profile support:
   - Add use_fresh_profile parameter to setup() and _setup_google_with_patchright()
   - Pass through to patchright for new account authentication
   - _accounts_add() uses fresh profile to force account selection

2. Symlink management:
   - Add quiet parameter to _ensure_storage_state_symlink()
   - Call symlink update in __init__ after migration (silent)
   - Update symlink on account switch for notebooklm-py compatibility

3. Better integration:
   - Symlink now always points to active account's auth file
   - Ensures notebooklm-py uses correct credentials after switch

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-29 13:48:09 +08:00
Deheng Huang 4dfba9c512 fix(symlink): update storage_state symlink for multi-account
Symlink now points to active account's credential file
in the google/ subdirectory.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-28 23:18:46 +08:00
Deheng Huang fb22193f8a feat(status): show active account in auth status
Display active Google account email and index at the top
of the status output.

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-01-28 23:16:41 +08:00
Deheng Huang 03d3f0f9b2 feat(cli): add accounts subcommand to auth_manager
Commands:
- accounts list: show all accounts
- accounts add: add new account via auth
- accounts switch <id>: switch active account
- accounts remove <id>: remove account
- accounts reauth <id>: re-authenticate existing account

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-28 23:02:00 +08:00
Deheng Huang bf24e2d45e feat(auth): integrate AccountManager into AuthManager
- Delegate Google auth file resolution to AccountManager
- Handle add/update account flow in setup
- Maintain backward compatibility with existing API

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-28 22:57:10 +08:00
Deheng Huang 6f0d08deae feat(auth): use Patchright for Google authentication
Google blocks personal Gmail sign-in with Playwright's bundled Chromium,
showing "This browser or app may not be secure" error. This commit:

- Add patchright_auth.py module using anti-detection Playwright fork
- Route Google auth through Patchright in auth_manager.py
- Add patchright>=1.50.0 to requirements.txt
- Fall back to agent-browser if Patchright unavailable

Key anti-detection techniques:
- ignore_default_args=["--enable-automation"]
- --disable-blink-features=AutomationControlled
- Uses real Chrome via executable_path
- Persistent context for session management

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-27 10:21:53 +08:00
Deheng Huang 6c1a8b9888 fix(auth): create storage_state.json symlink for notebooklm-py compatibility
The notebooklm-py library's download methods use Playwright internally and
look for storage at NOTEBOOKLM_HOME/storage_state.json. This fix:

- Adds _ensure_storage_state_symlink() to create symlink after Google auth
- Symlink points storage_state.json -> google.json in auth directory
- Falls back to file copy on Windows if symlink creation fails
- NOTEBOOKLM_HOME env var already set in config.py to data/auth

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-25 21:21:52 +08:00
Deheng Huang 87ea9e09dd docs: rebrand to nblm with multi-agent support
- Complete README rewrite with new nblm identity
- Add npx add-skill installation via vercel-labs/add-skill
- Position as multi-agent skill (Claude Code, Cursor, OpenCode)
- Add tiered command docs (Quick Start + collapsible reference)
- Add acknowledgments for upstream projects
- Update package.json name to nblm
- Replace all "NotebookLM Skill" references across codebase
- Update .gitignore for .claude-plugin/ and docs/plans/

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-25 21:12:53 +08:00
Deheng Huang cd3bf5faa6 fix: extract API tokens during login and improve browser fallback upload
- Add _extract_and_save_tokens() helper that navigates to NotebookLM before extraction
- Token extraction now happens reliably after successful login (no re-auth needed)
- Fix browser fallback upload to use refs instead of CSS selectors
- Add _find_file_input_ref() to locate upload input in snapshot
- Improve upload flow with better error messages and progress logging

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-25 20:16:16 +08:00
Deheng Huang 88e3b140fe feat: add token extraction and refresh for notebooklm-py
Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-25 20:16:16 +08:00
Deheng Huang 35dec2e09a feat: add browser-based uploads with text fallback 2026-01-25 20:16:15 +08:00
Deheng Huang b27ce3ef03 feat: add http fallback for notebooklm auth 2026-01-25 20:16:15 +08:00
Deheng Huang 462a39fa16 feat: allow notebooklm credentials from env 2026-01-25 20:16:15 +08:00
Deheng Huang 63c39dd707 fix: store notebooklm timestamp in utc 2026-01-25 20:16:15 +08:00
Deheng Huang 851e5f6e35 feat: persist notebooklm auth credentials 2026-01-25 20:16:15 +08:00
Deheng Huang c7ba37ad87 fix: improve Z-Library auth detection 2026-01-25 20:16:15 +08:00
Deheng Huang ef0bdf5815 feat: expand agent-browser automation and source ingestion 2026-01-25 20:16:15 +08:00
Deheng Huang fb5d0c12dc feat: add daemon watchdog and auth state caching 2026-01-25 20:16:15 +08:00
Deheng Huang 0dcfef1805 refactor: use agent-browser CLI sessions 2026-01-25 20:16:14 +08:00
Deheng Huang 872e8ca6c0 refactor: rewrite auth_manager.py for agent-browser 2026-01-25 20:15:05 +08:00
PleasePrompto 0942e849f5 feat: v1.3.0 - Modular Architecture, Timeout Fix, Thinking Detection
- Add modular architecture (config.py, browser_utils.py)
- Increase timeout from 30s to 120s (fixes #4)
- Add thinking message detection (div.thinking-message)
- Fix CSS selectors to match current NotebookLM UI
- Improve stability detection (3 polls instead of 1s wait)
2026-01-25 20:15:05 +08:00
PleasePrompto 79547a550f Major authentication reliability fix: Hybrid approach + Chrome + Anti-detection
Implements robust auth strategy based on MCP Server TypeScript implementation:

Auth Architecture Changes:
- Hybrid auth: persistent browser profile (user_data_dir) + manual cookie injection
- Fixes Playwright bug #36139: Session cookies now persist correctly
- Real Chrome via channel="chrome" instead of Chromium (cross-platform reliability)
- Remove automation detection: ignore_default_args=["--enable-automation"]
- Manual cookie injection from state.json for session cookie persistence

Technical Details:
- Python's launch_persistent_context doesn't support storage_state parameter (unlike TypeScript)
- Workaround: Launch with user_data_dir, then manually inject cookies via context.add_cookies()
- Browser profile stores: fingerprint + persistent cookies + cache
- state.json stores: ALL cookies including session cookies (expires=-1)
- This ensures both consistent fingerprinting AND reliable session cookie persistence

Files Changed:
- scripts/ask_question.py: Add hybrid auth + ignore_default_args
- scripts/auth_manager.py: Update setup_auth() and validate_auth() with new approach
- scripts/setup_environment.py: Install Chrome instead of Chromium
- requirements.txt: Add Chrome installation note
- README.md: Add Chrome installation section with rationale
- AUTHENTICATION.md: NEW - Complete auth architecture documentation

Why This Fixes Issue #2:
- Session cookies (without Expires) were lost on restart (Playwright bug)
- Chromium had cross-platform reliability issues
- Manual cookie injection ensures session cookies persist
- Real Chrome ensures consistent behavior across systems

References:
- Playwright Issue #36139: Session cookies not persisting
- Playwright Issue #14949: storage_state with persistent context
- Based on: notebooklm-mcp TypeScript implementation
2026-01-25 20:15:05 +08:00
PleasePrompto 3af8794786 Initial commit: NotebookLM Claude Code Skill
Add NotebookLM integration skill for Claude Code:
- Browser automation for querying NotebookLM
- Library management for notebook organization
- Persistent authentication with Google
- Zero-hallucination research directly in Claude Code

Based on notebooklm-mcp server, adapted for Claude Skills architecture.
2026-01-25 20:14:42 +08:00