| name | sb-internals-url-fetch |
| description | Internal: fetch URL HTTP/HTTPS e extrair main content como markdown. Não invocar diretamente — usado por sb-ingest e sb-autoresearch (futuro). |
| contract | v1.0 |
sb-internals/url-fetch
Wrapper sobre WebFetch tool com extração simples de main content.
Interface
fetch.sh <url>
- stdout: markdown extraído (UTF-8). Body HTML simplificado pra texto markdown via pandoc (preferencial) ou fallback regex.
- exit codes:
- 0: success
- 1: fetch failure (404, timeout, redirect loop, DNS)
- 2: parse failure (HTML inválido, conteúdo vazio)
Limites
- Body max 5 MB (DL-M3-J). Acima disso → exit 1.
- Timeout connect 5s, read 10s.
- Retry 1× com fixed 1s delay em transientes (timeout, 5xx).
- NÃO retry em 4xx, DNS, redirect loop.
Dependências
- WebFetch tool (built-in Claude Code) — primary path.
pandoc (preferred) OR Python 3 stdlib (fallback HTML→text).
Testes
tests/test_url_fetch.py — 6 cenários determinísticos via http.server local.