web

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package web is the agent searching and reading the open web, within a daily cap. A page can only be read if it came from one of its own searches, so a link on a page can never send it somewhere; everything it reads is fenced as untrusted material, never instructions.

Index

Constants

View Source
const (
	SearchName = "web_search"
	PageName   = "read_page"

	NotesKind = "reading_notes"
)

Variables

View Source
var ErrOverCap = errors.New("over today's limit")

Functions

This section is empty.

Types

type Limits

type Limits struct {
	Searches int
	Pages    int
}

Limits are per day.

type Page

type Page struct {
	Fetcher search.Fetcher
	Store   Store
	Limits  Limits
}

Page reads a page one of its searches found.

func (Page) Describe

func (Page) Describe() string

func (Page) Name

func (Page) Name() string

func (Page) Prepare

func (p Page) Prepare(ctx context.Context, a ability.Act) (ability.Material, error)

func (Page) Risk

func (Page) Risk() ability.Risk
type Search struct {
	Searcher search.Searcher
	Fetcher  search.Fetcher
	Store    Store
	Limits   Limits
}

func (Search) Describe

func (Search) Describe() string

func (Search) Name

func (Search) Name() string

func (Search) Prepare

func (s Search) Prepare(ctx context.Context, a ability.Act) (ability.Material, error)

func (Search) Risk

func (Search) Risk() ability.Risk

type Store

type Store interface {
	// SaveFound remembers pages a search found, so it may read them later.
	SaveFound(ctx context.Context, query string, rs []search.Result, at time.Time) error
	Found(ctx context.Context, url string) (search.Result, bool, error)
	LogWeb(ctx context.Context, kind, what string, costUSD float64, at time.Time) error
	WebSince(ctx context.Context, kind string, since time.Time) (int, error)
}

Jump to

Keyboard shortcuts

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