Help us shape the future of Go! Take the 2026 Go Developer Survey

toolselection

package
v0.1.58 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package toolselection holds discovery and schema activation for one turn. Activation changes model exposure only; tool execution retains its normal guards.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithState

func WithState(ctx context.Context, candidates []llm.Tool) context.Context

WithState starts a new selection scope from the caller's already authorized candidates. Call once per turn and retain the context across model iterations.

Types

type Candidate

type Candidate struct {
	Namespace   string `json:"-"`
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
}

type State

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

func FromContext

func FromContext(ctx context.Context) (*State, bool)

FromContext rejects inherited state after a principal or turn change.

func (*State) Activate

func (s *State) Activate(names []string) error

Activate validates the complete exact-name batch before changing exposure.

func (*State) List

func (s *State) List(query string, offset, limit int) ([]Candidate, bool, error)

List returns bounded metadata only, never input/output schemas.

func (*State) ListPage

func (s *State) ListPage(ctx context.Context, query primitive.CatalogQuery, offset int) (*primitive.CatalogPage[Candidate], error)

ListPage shares the skill catalog's literal OR-within/AND-between filters. Offset supports older tool clients; cursors retain the shared snapshot/query binding. The immutable index is reused until SetCandidates changes metadata.

func (*State) SelectedNames

func (s *State) SelectedNames() []string

func (*State) SetCandidates

func (s *State) SetCandidates(candidates []llm.Tool)

SetCandidates refreshes metadata from the normal authorized binding pipeline. Removed candidates also lose activation; this method grants no execution rights.

Jump to

Keyboard shortcuts

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