Commit Graph

17 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
c213c3770b fix: rm bundled camoufox-js instead of --prefix override
--prefix installs inside the daemon's node_modules but doesn't
actually replace the bundled file. Node resolves the nested
node_modules/camoufox-js/ first and never sees the global copy.

Fix: simply rm -rf the bundled camoufox-js directory so Node
falls through to the globally installed v0.11.0.
2026-06-13 19:42:59 +05:30
74be39e0d5 fix(install): install camoufox-js@0.11.0 inside daemon package, not globally
Root cause: camoufox-browser@0.1.0 bundles camoufox-js@0.9.3.
When the daemon does 'import("camoufox-js")', Node.js resolves
the BUNDLED version (0.9.3) FIRST — not the global one.
Version 0.9.3 doesn't recognize the version.json format from
0.11.0, so it re-downloads the 298MB browser binary on EVERY
navigation command, causing timeout -> 'Empty response'.

Fix: instead of 'npm install -g camoufox-js@0.11.0' (which
Node ignores because bundled takes priority), use:
  npm install --prefix "$(npm root -g)/camoufox-browser" camoufox-js@0.11.0
This installs v0.11.0 INSIDE the daemon's own node_modules,
overriding the bundled 0.9.3.
2026-06-13 19:25:46 +05:30
05ec7d20b7 fix(install): redirect git clone and cargo build output to stderr
Even with info/ok/warn fixed to stderr, raw command output
from git clone and cargo build was still leaking to stdout
through 2>&1 | tail -5.

Fix: added >&2 after tail -5 so ALL intermediate command output
goes to stderr, leaving only the final echo  on stdout.
2026-06-13 19:05:32 +05:30
aec4209778 fix(install): info/ok/warn write to stderr 2026-06-13 18:58:06 +05:30
179e87dca5 fix(install): sync with release — three-tier binary resolution
Same fix as gyandoot-release: ensure_gyandoot_binary() detects
whether we're in source repo, binary repo, or need to clone.
install_binary() now takes a path parameter.
2026-06-13 18:47:12 +05:30
ff290a2915 fix(banner): corrected ASCII art — now spells GYANDOOT properly
The old banner was a handwritten ASCII art that didn't actually
spell 'GYANDOOT'. Replaced with proper figlet 'standard' font
output so the banner is readable and correct.
2026-06-13 18:42:10 +05:30
667336bcb9 release(v2.0.0): cross-platform release — Linux/macOS/Windows/WSL
Creates full release package with:
- release/install.sh (universal cross-platform installer)
- release/windows/install.bat (Git Bash/MSYS2)
- release/windows/install.ps1 (PowerShell)
- release/homebrew/gyandoot.rb (Homebrew formula)
- release/archives/ prebuilt binary archives
- release/README.md (platform-specific install guide)
- install.sh updated with same cross-platform logic
- README.md updated
2026-06-13 18:35:14 +05:30
3b5b995af8 fix(install): cross-platform binary install + PATH conflict detection
install_binary() now:
1. Automatically picks best location per platform:
   - macOS: ~/.cargo/bin/ (no sudo, in PATH for Rust users)
   - Linux: ~/.cargo/bin/ → /usr/local/bin → ~/.local/bin/
   - Windows: /usr/local/bin (Git Bash/MSYS2)
2. Detects if old binary exists at a different PATH location
   and warns the user: 'There is ANOTHER gyandoot at ...'
3. Verifies 'command -v gyandoot' resolves correctly after install
4. Shows shell profile instructions if PATH needs updating

Previous issue: always installed to /usr/local/bin with sudo,
overwriting the old binary from install.sh but not warning if
another copy existed elsewhere in PATH.
2026-06-13 18:26:39 +05:30
0334cad50e fix(install): add --yes flag to npx so it doesn't hang waiting for prompt
Root cause: 'npx camoufox-js@0.11.0 fetch' on a fresh install prompts
'Ok to proceed? (y/N)' and pipes it through 'tail -5', hiding it. User
sees nothing happening while script waits for input.

Fix:
1. npx --yes — auto-confirms the install prompt, no more silent hang
2. Removed | tail -5 — full output visible so user sees progress bar
3. macOS cache path (~/Library/Caches/) vs Linux (~/.cache/) in verify step
4. Also checks version.json as fallback (binary can be named differently)
2026-06-13 07:31:51 +05:30
b1f38da3d8 fix(browser): pin camoufox-js@0.11.0 and camoufox-browser@0.1.0 — no more @latest
Root cause: camoufox-browser@0.1.0 bundles camoufox-js@0.9.3 which downloads
a BROKEN alpha binary (v150.0.2-alpha.26, missing libmozglue.dylib) on macOS.
The newer camoufox-js@0.11.0 (Jun 4 2026) downloads STABLE builds.

Changes:
1. PINNED VERSIONS (constants at top of file):
   - CAMOUFOX_JS_VERSION = "0.11.0" — for fetching browser binary
   - CAMOUFOX_BROWSER_VERSION = "0.1.0" — for daemon IPC protocol
2. run_fetch() — uses 'npx --yes camoufox-js@0.11.0 fetch' instead of
   'camoufox-browser@latest install' (which called old camoufox-js)
3. Both packages share ~/Library/Caches/camoufox/ — fetch writes correct
   binary + version.json, daemon reads same cache
4. Removed Docker HTTP transport — no longer needed, daemon works on macOS
5. Removed reqwest dep from gyandoot-agent + gyandoot-browser
6. install.sh updated: uses camoufox-js@0.11.0 fetch + pinned npm package
7. install.sh verifies version.json exists, not just binary

Clean build: 0 errors, 0 warnings
No Docker dependency. No @latest. Pinned and stable.
2026-06-12 20:00:53 +05:30
cd0e58be82 feat(install): auto-detect WSL + install Linux system deps for camoufox
The Camoufox browser (Playwright-based) needs ~30 Linux system libraries
to run. On fresh WSL/Ubuntu, these are not pre-installed, causing the
browser daemon to crash silently with only a cryptic 'No such file or
directory' error.

Changes:
1. Add detect_wsl() — reads /proc/version for 'microsoft'/'wsl'
2. Add install_linux_deps() — installs all 30+ Playwright deps via
   apt-get/dnf/yum before installing camoufox-browser
3. Handles t64 package name variants (libasound2t64 vs libasound2)
4. Shows WSL-specific note at end of install
5. npm install -g camoufox-browser + install now run with better output
6. Verifies browser binary exists at ~/.cache/camoufox/ post-install
7. Install now fully automatic on fresh WSL — no manual apt-get needed
2026-06-12 18:25:09 +05:30
b2650a569c feat: system service management (gyandoot service install|remove|status)
- Create systemd + launchd service templates in resources/
- Add gyandoot-core/src/service.rs module with full lifecycle
  - systemd: user service, daemon-reload, enable, start, stop, disable
  - launchd: macOS plist, load/unload, start/stop (launchctl)
- Add 'gyandoot service install|remove|status' CLI subcommand
- Update setup wizard: prompts 'Install system service? [y/N]'
- Update install.sh: prompts user for service install after binary
- Browser auto-starts at runtime (browser_manager), no separate service needed
- Camoufox installed via npm, auto-started by GyanDoot agent loop
2026-06-11 23:23:49 +05:30
f2d612bd28 🚀 Camoufox default web engine — auto-install + auto-start
Full integration:
- install.sh now installs camoufox-browser via npm (preferred) or Docker
- install.sh creates systemd/launchd auto-start service on Linux/macOS
- New browser_manager.rs — health-check, auto-start, wait-for-ready
- AgentLoop::run() auto-inits Camoufox and registers web_search/web_browse
- System prompt tells LLM to use web_search/web_browse as PRIMARY tools
- Graceful fallback: if Camoufox unavailable, logs warning, uses bash tools
- ToolExecutor is now Arc<Mutex<>> for runtime tool registration

GyanDoot v2 now: install → Camoufox auto-starts → web tools available →
"search NSE India" uses Camoufox with anti-detection 🎯
2026-06-11 23:12:57 +05:30
dd21654555 P1 deep-dive: platform, security, subagents, skills, profile + installer fix
PLATFORM (gyandoot-platform):
- Telegram adapter: Long-polling, sendMessage, sendDocument, chat actions
- Discord adapter: REST polling, Bearer auth, channel discovery
- Webhook adapter: Hyper v1 HTTP server, HMAC-SHA256 verification
- CLI UX: Robot head banner, spinner, confirm prompts, colored output

SECURITY (gyandoot-security):
- CredentialVault: AES-256-GCM encrypted per-key files in ~/.gyandoot/vault/
- Sanitizer: PII redaction (email, phone, API keys, IPs), control char stripping
- ThreatDetector: Prompt injection, jailbreak, exfiltration detection with severity

SUBAGENTS (gyandoot-subagents):
- SubAgentWorker: Isolated agent loop with tool filtering and workdir
- SubAgentManager: Bounded concurrency via tokio::Semaphore
- Full lifecycle tracking and result collection

SKILLS (gyandoot-skills):
- SkillsManager: scan, load, inject_skills with YAML frontmatter parsing
- Preprocessor:  template resolution
- SkillBundle: JSON bundle serialization

PROFILE (gyandoot-profile):
- Profile struct with builder and validation
- ConfigResolver: env > symlink > profile > default chain
- ProfileManager: create, list, switch, delete, CRUD with real filesystem ops

INSTALLER FIX: Fixed camofox-browser directory escaping bug that caused
'could not find Cargo.toml' on macOS. Always CD back to project root.
2026-06-11 21:18:42 +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
851c838ca5 Initial scaffold: GyanDoot v2.0 in Rust
Full Cargo workspace with 11 crates:
- gyandoot-core: Shared types, config, error types
- gyandoot-agent: Agent loop, tool execution, context compression
- gyandoot-providers: LLM provider abstraction (OpenAI, Anthropic, Ollama)
- gyandoot-memory: MemPalace persistent memory system
- gyandoot-platform: Platform adapters (Telegram, Discord, Webhook, CLI)
- gyandoot-security: Credential vault, sanitizer, threat detector
- gyandoot-kanban: Task decomposition, swarm orchestration, diagnostics
- gyandoot-subagents: Sub-agent spawning and orchestration
- gyandoot-skills: Skills discovery, loading, preprocessing, bundles
- gyandoot-profile: Multi-agent profile manager
- gyandoot-gateway: Gateway sessions, routing, access control

Plus: CLI entry point with clap, cross-platform installer script,
KANBAN.md, .gnpl/AGENTS.md

Workspace compiles clean: cargo check passes with 0 errors.
2026-06-11 20:04:12 +05:30