SurfSense/surfsense_backend/app
DESKTOP-RTLN3BA\$punk bdacea8b6e feat(crawler): captcha solving + per-attempt billing (Phase 3d)
Wire captchatools as the StealthyFetcher-tier page_action to detect, harvest
(egressing from the crawl's own proxy IP), inject, and submit reCAPTCHA v2/v3
and hCaptcha tokens. Opt-in and off by default (zero attempts, zero cost).

Licensing split:
- Apache-2 app/utils/captcha/ holds the generic, vendor-agnostic config
  (CaptchaConfig + captcha_enabled() = flag AND key present).
- Proprietary app/proprietary/web_crawler/captcha.py holds the bypass logic
  (detect/harvest/inject) plus a process-wide solver latch that halts solving
  on unrecoverable errors (no balance / bad key).

Crawler: CrawlOutcome gains captcha_attempts/captcha_solved, surfaced via a
per-call captcha_state dict threaded crawl_url -> _crawl_with_stealthy(_sync)
and stamped onto every stealth terminal outcome. The stealth tier captures the
proxy once and reuses it for both the fetch and the solver (IP-coherence).

Billing: WebCrawlCreditService gains captcha_billing_enabled,
captcha_solves_to_micros, charge_captcha, and a generic check_balance, sharing
a single _apply_debit path. The indexer accumulates attempts (even on failed
crawls), runs a combined crawl+captcha pre-flight, and posts a per-attempt
owner charge as usage_type="web_crawl_captcha". The captcha worst-case is only
reserved when solving is actually enabled, so a solving-off deployment is never
blocked for captcha that can never run. Both chat scrape tools fold attempts
into the current turn before the success/fail branch.

Fully config-driven prices; no migration. New unit tests cover the config,
factory (detection/latch/timeout/cap), credit service, indexer wiring, and the
chat fold.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 22:58:21 -07:00
..
agents feat(crawler): captcha solving + per-attempt billing (Phase 3d) 2026-06-29 22:58:21 -07:00
auth chore: fix linting 2026-06-25 04:31:22 +05:30
automations feat(03a): implement Scrapling-only web crawler and remove Firecrawl integration 2026-06-29 20:37:56 -07:00
config feat(crawler): captcha solving + per-attempt billing (Phase 3d) 2026-06-29 22:58:21 -07:00
connectors feat(03a): implement Scrapling-only web crawler and remove Firecrawl integration 2026-06-29 20:37:56 -07:00
etl_pipeline chore: linting 2026-06-17 22:31:36 -07:00
event_bus refactor(backend): rename search_space -> workspace across app bulk (Phase 2 Wave D) 2026-06-26 18:30:47 +02:00
file_storage refactor(backend): rename search_space -> workspace across app bulk (Phase 2 Wave D) 2026-06-26 18:30:47 +02:00
gateway refactor(backend): rename search_space -> workspace across app bulk (Phase 2 Wave D) 2026-06-26 18:30:47 +02:00
indexing_pipeline refactor(backend): rename search_space -> workspace across app bulk (Phase 2 Wave D) 2026-06-26 18:30:47 +02:00
notifications refactor(backend): rename search_space -> workspace across app bulk (Phase 2 Wave D) 2026-06-26 18:30:47 +02:00
observability refactor(backend): rename search_space -> workspace across app bulk (Phase 2 Wave D) 2026-06-26 18:30:47 +02:00
podcasts refactor(backend): rename search_space -> workspace across app bulk (Phase 2 Wave D) 2026-06-26 18:30:47 +02:00
prompts prompts: remove orphaned system_prompt_composer surface 2026-06-25 18:37:04 +02:00
proprietary feat(crawler): captcha solving + per-attempt billing (Phase 3d) 2026-06-29 22:58:21 -07:00
retriever refactor(backend): rename search_space -> workspace across app bulk (Phase 2 Wave D) 2026-06-26 18:30:47 +02:00
routes refactor(routes): rename to workspace + consolidate URL spellings (Phase 2 Wave E) 2026-06-26 18:35:08 +02:00
schemas refactor(schemas): rename SearchSpace -> Workspace in Pydantic schemas (Phase 2 Wave C) 2026-06-26 18:23:43 +02:00
services feat(crawler): captcha solving + per-attempt billing (Phase 3d) 2026-06-29 22:58:21 -07:00
tasks feat(crawler): captcha solving + per-attempt billing (Phase 3d) 2026-06-29 22:58:21 -07:00
templates feat: update report generation and export capabilities to support multiple formats (PDF, DOCX, HTML, LaTeX, EPUB, ODT, plain text) across documentation and backend 2026-03-09 18:41:21 -07:00
utils feat(crawler): captcha solving + per-attempt billing (Phase 3d) 2026-06-29 22:58:21 -07:00
__init__.py feat: SurfSense v0.0.6 init 2025-03-14 18:53:14 -07:00
app.py refactor(backend): rename search_space -> workspace across app bulk (Phase 2 Wave D) 2026-06-26 18:30:47 +02:00
celery_app.py fix(auth):schedule refresh token cleanup 2026-06-23 12:50:02 +05:30
db.py refactor(db): rename SearchSpace ORM core to Workspace (Phase 2 Wave A) 2026-06-26 18:18:50 +02:00
exceptions.py feat: add processing mode support for document uploads and ETL pipeline, improded error handling ux 2026-04-14 21:26:00 -07:00
rate_limiter.py try: ip fix for cludflare 2026-04-16 02:13:52 -07:00
session_events.py refactor(backend): rename search_space -> workspace across app bulk (Phase 2 Wave D) 2026-06-26 18:30:47 +02:00
users.py refactor(backend): rename search_space -> workspace across app bulk (Phase 2 Wave D) 2026-06-26 18:30:47 +02:00
zero_publication.py refactor(db): publish workspace_id column in zero_publication 2026-06-26 16:56:39 +02:00