openurl

package
v1.164.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 9 Imported by: 1 module, 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 openurl implements a built-in toolset that exposes a single tool which opens a fixed URL in the user's default browser. The URL is baked into the toolset definition (the YAML `url` field), so the model only has to call the tool by name — it never supplies the URL itself.

Opening the URL is delegated to pkg/browser, which picks the right platform helper (open / xdg-open / rundll32), so the tool works across macOS, Linux and Windows.

Index

Constants

View Source
const ToolNameOpenURL = "open_url"

Variables

This section is empty.

Functions

func CreateToolSet

func CreateToolSet(toolset latest.Toolset, runConfig *config.RuntimeConfig) (tools.ToolSet, error)

CreateToolSet is used by the tools registry.

func Creator added in v1.132.0

func Creator(_ context.Context, toolset latest.Toolset, _ string, runConfig *config.RuntimeConfig, _ string) (tools.ToolSet, error)

Creator builds this toolset from its YAML declaration. It matches teamloader.ToolsetCreator so it can be registered directly:

teamloader.NewToolsetRegistry(map[string]teamloader.ToolsetCreator{"open_url": openurl.Creator})

Types

type Option

type Option func(*ToolSet)

func WithExpander

func WithExpander(expander urlExpander) Option

WithExpander enables ${env.X} interpolation of the configured URL.

func WithName

func WithName(name string) Option

WithName overrides the tool name. An empty name keeps the default.

func WithOpener

func WithOpener(open func(context.Context, string) error) Option

WithOpener overrides the function used to open the URL. Tests use it to avoid spawning a real browser.

type ToolSet

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

func New

func New(url string, opts ...Option) *ToolSet

func (*ToolSet) Instructions

func (t *ToolSet) Instructions() string

func (*ToolSet) Tools

func (t *ToolSet) Tools(context.Context) ([]tools.Tool, error)

Jump to

Keyboard shortcuts

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