web

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 9, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package web implements a stdlib-only web_fetch tool: download a URL, convert HTML to plain text, and return a slice of the result with optional pagination. Intended for documentation lookups and inspecting URLs the model encounters in error messages.

Safety guards: http/https only, configurable timeout, body size cap, and redirect limit. There is no host allow/deny list — operators who need to keep the agent off internal networks should run with `-bash restricted` and consider running gocode itself in a sandbox.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalToolInput

func MarshalToolInput(in fetchInput) (json.RawMessage, error)

MarshalToolInput is exposed for tests.

Types

type Config

type Config struct {
	Timeout      time.Duration
	MaxBodyBytes int64
	MaxRedirects int
	UserAgent    string
}

Config controls Fetcher behaviour. Zero values pick sensible defaults.

type Fetcher

type Fetcher struct {
	// contains filtered or unexported fields
}

Fetcher implements the web_fetch tool.

func New

func New(cfg Config) *Fetcher

New constructs a Fetcher.

func (*Fetcher) Toolset

func (f *Fetcher) Toolset() gocode.Toolset

Toolset returns a single-binding toolset registering web_fetch.

Jump to

Keyboard shortcuts

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