mirror of
https://github.com/hanzoai/crawl.git
synced 2026-10-30 18:42:25 +00:00
The fetch, extract and render engine with an SSRF guard at the dialer, an archive over any Get/Put store, optional browser escalation and a render meter. serve mounts POST /v1/crawl on a zip app, which is also the MCP tool read_page; cmd/crawl is the same engine as a CLI and a daemon. Co-authored-by: Hanzo Dev <[email protected]>
24 lines
2.7 KiB
Go
24 lines
2.7 KiB
Go
// Code generated by zipdoc; DO NOT EDIT.
|
|
|
|
package serve
|
|
|
|
import (
|
|
"github.com/zap-proto/zip"
|
|
)
|
|
|
|
func init() {
|
|
zip.Describe("github.com/hanzoai/crawl/serve POST /v1/crawl", zip.Doc{
|
|
Description: "Fetches one URL and answers with the page as markdown.\n\nIt answers with the address it actually landed on, the document's title, its\ncontent rendered to MARKDOWN, and whatever the page said about itself.\n\nA PAGE THAT COULD NOT BE FETCHED IS A NORMAL ANSWER, not a fault. An\nunreachable host, a refused address and a content type that is not a document\nall answer 200 with `success:false` and the reason in `error`. Non-2xx is\nreserved for a caller problem — 400 with the same body when there is no url,\n401 when the caller is not admitted — so error handling can trust the status.\nCheck `success` before reading `data`.\n\nPages are kept under the caller's verified scope, never a scope named in the\nbody, so a URL already read under that scope is answered without touching the\nnetwork.\n\nThe URL is caller-supplied, which makes this a request-forgery primitive by\nconstruction. Only http and https are accepted, and every address actually\ndialled must be public unicast — loopback, link-local, private and multicast\nare refused. The check lives in the DIALER rather than on the hostname, because\nresolving a name to validate it and then letting the transport resolve it again\nis a gap DNS rebinding walks straight through; redirects re-enter the same\ndialer.",
|
|
Fields: map[string]string{
|
|
"crawlDocument.markdown": "Markdown is the page's content, extracted and rendered to markdown. This is\nthe field to read.",
|
|
"crawlDocument.metadata": "Metadata is whatever the document said about itself — description, og:*,\nlanguage — plus the response status, the final URL and the content type. It\nis an open key space, carried as raw JSON so the document publishes \"any\nJSON\", which is true.",
|
|
"crawlDocument.title": "Title is the document's title, when it carried one.",
|
|
"crawlDocument.url": "URL is the address actually read, after redirects.",
|
|
"crawlRequest.url": "URL is the page to read, absolute and http or https — no other scheme is\ndialled. An address that turns out to be loopback, link-local, private or\nmulticast is refused at the dialer, redirects included. Empty is answered\nwith success false and the reason in error.",
|
|
"crawlResult.data": "Data is the page, present exactly when Success.",
|
|
"crawlResult.error": "Error says what stopped the fetch: the host was refused, unreachable, or\nserved something that is not a document.",
|
|
"crawlResult.success": "Success is whether the page was fetched and read. FALSE with an Error is a\ncomplete answer, not a fault — check this before reading Data.",
|
|
},
|
|
})
|
|
}
|