SurfSense/surfsense_backend/app/services
DESKTOP-RTLN3BA\$punk 17bdb06825 feat(03c): bill credits per successful web crawl
Add a config-driven crawl meter (1 USD / 1000 successes by default, retunable
via WEB_CRAWL_MICROS_PER_SUCCESS) mirroring EtlCreditService:

- WebCrawlCreditService (gate -> pre-check -> post-charge) on the unified wallet
- webcrawler indexer: pre-flight credit block + post-charge of the workspace
  owner per success, with a web_crawl TokenUsage audit row
- chat scrape_webpage (main + research): fold each successful scrape into the
  active turn's token accumulator so it settles with the chat turn
- WEB_CRAWL_CREDIT_BILLING_ENABLED / WEB_CRAWL_MICROS_PER_SUCCESS config + env
- unit tests (service) + integration tests (indexer wiring)
- scripts/e2e_phase3_crawl_billing.py: manual functional e2e (3a/3b/3c)

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 21:40:53 -07:00
..
confluence refactor(backend): rename search_space -> workspace across app bulk (Phase 2 Wave D) 2026-06-26 18:30:47 +02:00
dropbox refactor(backend): rename search_space -> workspace across app bulk (Phase 2 Wave D) 2026-06-26 18:30:47 +02:00
gmail refactor(backend): rename search_space -> workspace across app bulk (Phase 2 Wave D) 2026-06-26 18:30:47 +02:00
google_calendar refactor(backend): rename search_space -> workspace across app bulk (Phase 2 Wave D) 2026-06-26 18:30:47 +02:00
google_drive refactor(backend): rename search_space -> workspace across app bulk (Phase 2 Wave D) 2026-06-26 18:30:47 +02:00
linear refactor(backend): rename search_space -> workspace across app bulk (Phase 2 Wave D) 2026-06-26 18:30:47 +02:00
mcp_oauth Harden Linear and Slack MCP subagent permissions. 2026-04-29 20:24:21 +02:00
memory refactor(backend): rename search_space -> workspace across app bulk (Phase 2 Wave D) 2026-06-26 18:30:47 +02:00
notion refactor(backend): rename search_space -> workspace across app bulk (Phase 2 Wave D) 2026-06-26 18:30:47 +02:00
onedrive refactor(backend): rename search_space -> workspace across app bulk (Phase 2 Wave D) 2026-06-26 18:30:47 +02:00
streaming feat: improved document, folder mentions rendering 2026-05-09 22:15:51 -07:00
__init__.py Fixed all ruff lint and formatting errors 2025-07-24 14:43:48 -07:00
ai_file_sort_service.py refactor(backend): rename search_space -> workspace across app bulk (Phase 2 Wave D) 2026-06-26 18:30:47 +02:00
auto_model_pin_service.py refactor(backend): rename search_space -> workspace across app bulk (Phase 2 Wave D) 2026-06-26 18:30:47 +02:00
auto_reload_service.py feat(refactor): refactor payment system to implement unified credit wallet. 2026-06-10 16:49:03 -07:00
billable_calls.py refactor(backend): rename search_space -> workspace across app bulk (Phase 2 Wave D) 2026-06-26 18:30:47 +02:00
chat_comments_service.py refactor(backend): rename search_space -> workspace across app bulk (Phase 2 Wave D) 2026-06-26 18:30:47 +02:00
chat_session_state_service.py Add chat session state service 2026-01-20 16:31:40 +02:00
composio_service.py feat: enhance task management and timeout configurations in multi-agent chat 2026-05-27 14:58:10 -07:00
connector_service.py refactor(backend): rename search_space -> workspace across app bulk (Phase 2 Wave D) 2026-06-26 18:30:47 +02:00
docling_service.py feat(backend): Remove LLM summaries from document indexing 2026-06-04 00:50:19 +05:30
etl_credit_service.py feat(refactor): refactor payment system to implement unified credit wallet. 2026-06-10 16:49:03 -07:00
export_service.py refactor(backend): rename search_space -> workspace across app bulk (Phase 2 Wave D) 2026-06-26 18:30:47 +02:00
folder_service.py refactor(backend): rename search_space -> workspace across app bulk (Phase 2 Wave D) 2026-06-26 18:30:47 +02:00
global_model_catalog.py refactor(model-connections): remove unused fields and update verification logic 2026-06-14 02:46:19 +05:30
image_gen_router_service.py chore: ran linting 2026-06-13 21:59:35 +05:30
kokoro_tts_service.py feat: Added Local TTS (Kokoro TTS) Support 2025-08-13 17:25:34 -07:00
llm_error_adapter.py chore: ran linting 2026-06-13 21:59:35 +05:30
llm_router_service.py feat: antropic model added fix & kb tooling fixes 2026-06-25 20:19:44 -07:00
llm_service.py refactor(backend): rename search_space -> workspace across app bulk (Phase 2 Wave D) 2026-06-26 18:30:47 +02:00
model_capabilities.py refactor(model-connections): move backend model connections to provider capabilities 2026-06-12 02:17:22 +05:30
model_connection_service.py refactor(model-connections): remove unused fields and update verification logic 2026-06-14 02:46:19 +05:30
model_list_service.py feat(database-migrations): add migration to remove legacy model config tables and remove stale model connection code 2026-06-13 12:45:43 +05:30
model_resolver.py feat: antropic model added fix & kb tooling fixes 2026-06-25 20:19:44 -07:00
new_streaming_service.py Include optional metadata on tool and thinking-step SSE payloads. 2026-05-08 22:47:58 +02:00
obsidian_plugin_indexer.py refactor(backend): rename search_space -> workspace across app bulk (Phase 2 Wave D) 2026-06-26 18:30:47 +02:00
openrouter_integration_service.py chore: ran linting 2026-06-13 21:59:35 +05:30
openrouter_model_normalizer.py chore: ran linting 2026-06-13 21:59:35 +05:30
pricing_registration.py feat(database-migrations): add migration to remove legacy model config tables and remove stale model connection code 2026-06-13 12:45:43 +05:30
provider_capabilities.py refactor(model-connections): move backend model connections to provider capabilities 2026-06-12 02:17:22 +05:30
provider_registry.py chore: ran linting 2026-06-13 21:59:35 +05:30
public_chat_service.py refactor(backend): rename search_space -> workspace across app bulk (Phase 2 Wave D) 2026-06-26 18:30:47 +02:00
quality_score.py feat(database-migrations): add migration to remove legacy model config tables and remove stale model connection code 2026-06-13 12:45:43 +05:30
quota_checked_vision_llm.py refactor(backend): rename search_space -> workspace across app bulk (Phase 2 Wave D) 2026-06-26 18:30:47 +02:00
reranker_service.py roadmap(1.3): Update citation prompt to use new whole document structure 2025-12-14 22:07:31 -08:00
revert_service.py refactor(backend): rename search_space -> workspace across app bulk (Phase 2 Wave D) 2026-06-26 18:30:47 +02:00
stt_service.py chore: updated docs & refactored sst_service.py 2025-10-15 14:31:38 -07:00
task_dispatcher.py refactor(backend): rename search_space -> workspace across app bulk (Phase 2 Wave D) 2026-06-26 18:30:47 +02:00
task_logging_service.py refactor(backend): rename search_space -> workspace across app bulk (Phase 2 Wave D) 2026-06-26 18:30:47 +02:00
token_quota_service.py feat(refactor): refactor payment system to implement unified credit wallet. 2026-06-10 16:49:03 -07:00
token_tracking_service.py refactor(backend): rename search_space -> workspace across app bulk (Phase 2 Wave D) 2026-06-26 18:30:47 +02:00
turnstile_service.py feat: no login experience and prem tokens 2026-04-15 17:02:00 -07:00
user_tool_allowlist.py refactor(backend): rename search_space -> workspace across app bulk (Phase 2 Wave D) 2026-06-26 18:30:47 +02:00
web_crawl_credit_service.py feat(03c): bill credits per successful web crawl 2026-06-29 21:40:53 -07:00
web_search_service.py chore: ran linting 2026-03-17 04:40:46 +05:30