Commit Graph

6 Commits

Author SHA1 Message Date
d5cab65099 feat: embed daemon JS in binary, eliminate npm install of camoufox-browser
The daemon JS files (daemon.js, server.js, browser.js, protocol.js,
snapshot.js, ipc.js) are now EMBEDDED in the compiled Rust binary via
include_dir! and extracted to ~/.gyandoot/daemon/ on first run.

This eliminates the need to npm install -g camoufox-browser@0.1.0,
which bundles an incompatible camoufox-js@0.9.3 that caused:
- 'Cannot open database' errors
- Re-downloading 298MB browser on every navigation
- Circular install/remove/install loops

Now the daemon imports camoufox-js from the global npm install (v0.11.0)
which is installed by install.sh. Clean, no bundled deps, no conflicts.

Also removed: is_npm_package_installed(), install_npm_package(),
find_daemon_js() — all replaced by gyandoot_browser::daemon::extract_daemon()
2026-06-13 23:22:15 +05:30
274020319f fix: two root-cause bug fixes for web_search
Bug 1 — writer.shutdown() kills Node socket before response:
  Rust called shutdown() on the write half immediately after writing
  the command. This sent EOF to the Node.js daemon, whose safeWrite()
  checks socket.destroyed and silently bails. Fixed by dropping writer
  instead.

Bug 2 — daemon has zero macro support:
  The daemon's execute() never handles macro_name/query. Only url
  matters for the navigate action. Fixed search() to resolve all 12
  macros (@google_search, @youtube_search, etc.) to actual search URLs
  in Rust before sending navigate with cmd.url set.
2026-06-13 20:00:20 +05:30
71cf7c8830 fix(browser): dual transport — Unix socket + HTTP Docker + binary corruption detection
Root cause on macOS: camoufox-browser@0.1.0 downloads an alpha binary
(v150.0.2-alpha.26) from daijro/camoufox that has a broken macOS build
(missing libmozglue.dylib). Binary crashes with SIGABRT/SIGKILL.

Changes:
1. gyandoot-browser client now supports TWO transports:
   - Transport::UnixSocket (existing — daemon IPC)
   - Transport::Http (new — Docker REST API on port 9377)
2. init_browser() tries Docker HTTP first, falls back to npx daemon
3. HTTP transport maps browser actions to Docker REST endpoints
   (/navigate, /tabs, /health, etc.) with correct userId params
4. check_known_errors() detects libmozglue.dylib + SIGKILL patterns
5. Browser cache check works for both macOS and Linux paths
6. Error messages correctly say 'Use Docker' on corrupted binary
7. Added reqwest dep to gyandoot-agent for Docker health check

Clean build: 0 errors
2026-06-12 19:49:16 +05:30
8c9a32075d Slash commands (/quit, /help) + zero compiler warnings
1. /quit and /help commands restored:
   - /quit: exits the interactive loop
   - /help: shows formatted help box with available commands & tips
   - Unknown commands get a friendly error pointing to /help
   - Slash commands intercepted before LLM processing (no token waste)

2. Zero warnings across entire workspace (13 files fixed):
   - Fixed ambiguous glob re-exports in gyandoot-core
   - Added #[allow(dead_code)] on intentional dead fields
   - Fixed unused imports, variables, and macros
   - Fixed unused assignments in subagents
   - cleaned up service.rs, profile, kanban warnings

install.sh now produces a completely clean build with zero warnings.
2026-06-12 12:15:01 +05:30
e06094c0a2 Option C: Rewrite gyandoot-browser for camoufox-browser@0.1.0 daemon IPC
Complete rewrite removing old HTTP REST client. The latest camoufox-browser
npm package (v0.1.0) uses Unix socket JSON-line IPC, not HTTP REST on :9377.

Changes:
- gyandoot-browser/client.rs: Full daemon IPC via Unix socket (~/.camoufox-browser/*.sock)
  - JSON-line protocol matching ensureDaemonRunning + daemon.js
  - Auto-launches browser on first command (daemon manages lifecycle)
  - Supports navigate, click, type, scroll, snapshot, search macros, tab management
  - Proper HeathResponse, NavigationResult, PageSnapshot types
- gyandoot-browser/lib.rs: Exports new client API (no SearchMacro enum, no SessionManager)
- gyandoot-browser/Cargo.toml: reqwest -> tokio Unix socket deps
- Removed: macros.rs, session.rs, snapshot.rs (all merged into client.rs)
- browser_manager.rs: Triggers daemon via npx, waits for Unix socket
- browser_tools.rs: Simplified API (no tab_id, no create_tab/close_tab)

Fix: camoufox-browser process exited with status 1 error on fresh install
2026-06-12 11:12:51 +05:30
605747023b Add camofox-browser integration: gyandoot-browser crate + agent tools
New crate: crates/gyandoot-browser/
  - client.rs: Full REST client for camofox-browser API (health, tabs,
    navigation, snapshots, click/type/scroll, search macros)
  - macros.rs: 14 SearchMacro enum (Google, YouTube, Amazon, Reddit,
    Wikipedia, Twitter, Yelp, Spotify, Netflix, LinkedIn, Instagram,
    TikTok, Twitch) with parse/display
  - snapshot.rs: PageSnapshot, PageLinks, NavigationResult, HealthResponse
  - session.rs: BrowserSession, SessionManager with idle cleanup

New module: crates/gyandoot-agent/src/browser_tools.rs
  - WebSearchTool: Search the web using anti-detection browser
  - WebBrowseTool: Browse URLs, click, type, scroll with element refs
  - register_browser_tools(): Wire both tools into ToolExecutor

CLI: Added
                                 o
                                 |
               - - - - - -     .---.     - - - - - -
          - - - - - - - - -  [ ^   ^ ]  - - - - - - - - -
             - - - - - - -   |  ___  |   - - - - - - -
                              `-----'
           ____ __   __  ___   _   _  ____   ___   ___  _____
          / ___|\ \ / / / _ \ | \ | ||  _ \ / _ \ / _ \|_   _|
         | |  _  \ V / / /_\ \|  \| || | | | | | | | | | | |
         | |_| |  | |  |  _  || |\  || |_| | |_| | |_| | | |
          \____/  |_|  |_| |_||_| \_||____/ \___/ \___/  |_|

        o - - - - - - -  knowledge. delivered. - - - - - - - o

Unknown command: browser
Run 'gyandoot help' for usage. subcommand with health/search/browse actions

Installer: Updated install.sh with camofox-browser cloning, Node.js
detection, npm dependency install, and systemd service setup

Camofox-browser running at http://localhost:9377 (Docker, verified working)

Workspace: 12 crates + CLI binary — cargo check passes with 0 errors.
2026-06-11 20:23:35 +05:30