webfetch

package
v0.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 7, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package webfetch 提供 web_fetch 工具:URL → 正文 markdown 提取(httprequest 只回裸 HTML,真实网页数百 KB 直接爆上下文——本工具做「提取」而非「全文」)。 行为参照 deepseek-harness packages/web/tool-web(MIT,fetch+策略)与 Claude Code WebFetch;URL 策略(域限制/大小上限/超时)按其 web-fetch-http policy 思路内联实现。HTML→markdown 走 x/net/html 结构化提取。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTools

func NewTools(cfg Config) ([]contract.Tool, error)

NewTools 构造 web_fetch(读面:直过审批)。

Types

type Config

type Config struct {
	Client    *http.Client      // 缺省自建:15s 超时、5 跳重定向、按 Insecure/RootCAs 定 TLS 姿态
	MaxBytes  int64             // 响应体读取上限(缺省 2MB)
	MaxOutput int               // markdown 输出上限 runes(缺省 30000,对齐 read_document)
	UserAgent string            // 缺省 einox/0.1
	Insecure  bool              // 跳过 TLS 证书校验(缺省 false=严格校验——行业缺省;内网自签场景显式开)
	RootCAs   *x509.CertPool    // 追加信任根(企业自签 CA 正解:装根而非跳校验;nil=系统池)
	Egress    *egress.Validator // 出口校验器(nil = 不治理——默认零行为变化,真源 §9;注入后:请求前置校验恒生效,受管 transport〔校验与拨号同源〕+ 重定向重校验**仅在 Client 为缺省自建时接管**——自定义 Client 时 transport/redirect 归注入方自担,前置校验之后的绕行面〔如重定向入私网〕不在治理内)
}

Config 配置(零值可用——全部字段有缺省)。

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL