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

bundle

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: 5 Imported by: 0

README

Tool exposure rules

Workspace bundle match rules and agent tool.items accept tier and alwaysInclude:

match:
  - name: "catalog:lookup"
    tier: critical
  - name: "catalog:details"
    tier: onDemand
  - name: "catalog:help"
    tier: onDemand
    alwaysInclude: true
  • critical retains the admitted schema on every model iteration, including empty intake choices and clarification turns.
  • base is initially available and may be narrowed by intake. An omitted tier preserves this legacy behavior.
  • onDemand remains discoverable, but its schema is omitted until an exact intake selection, exact caller/profile choice, discovery-list result, or tool activation requests it. Selecting its owning bundle alone does not promote it.
  • alwaysInclude: true retains an admitted schema regardless of intake narrowing, including an onDemand schema.

Discovery covers the full connected model-visible catalog, including tools absent from every bundle. Bundle membership is a starting/workflow set, not an admission requirement. Only explicit exclusions narrow discovery, and another trusted positive rule can admit the excluded operation.

llm/tools:list makes every tool on the returned page available on the next model iteration without a separate activation call. Unreturned pages remain unselected. Successful same-turn discovery selections survive resume and are revalidated against the current catalog. List filters narrow search results; they do not turn workflow bundles into execution allowlists.

Retention rules apply across available trusted workspace/profile bundles and explicit agent rules. Model visibility, rule exclusions, explicit caller scope, profile restrictions and execution authorization still apply. Explicit runtime bundles retain their existing union with caller tool names. A selected template controls document injection, not tool removal.

Duplicate admitted rules combine retention flags. critical takes precedence; otherwise an explicit onDemand declaration takes precedence over base. Invalid tier names fail bundle/agent validation. Schema producers cannot set this metadata through MCP tool definitions; it is applied after catalog lookup and is excluded from serialized model schemas. Existing catalog caches and cloning preserve source definitions without retaining rule metadata on them.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultIconRef

func DefaultIconRef(service string) string

DefaultIconRef returns an iconRef for well-known built-in tool services. UI is expected to resolve these IDs to PNG assets.

func ResolveDefinitions

func ResolveDefinitions(b *Bundle, matchFn func(pattern string) []*llm.ToolDefinition) []llm.ToolDefinition

ResolveDefinitions expands bundle match rules into concrete tool definitions using matchFn. It applies rule-level excludes and de-duplicates by canonical tool name.

Types

type Bundle

type Bundle struct {
	ID          string `yaml:"id" json:"id"`
	Title       string `yaml:"title,omitempty" json:"title,omitempty"`
	Description string `yaml:"description,omitempty" json:"description,omitempty"`

	// IconRef refers to a built-in icon identifier (UI-owned mapping).
	IconRef string `yaml:"iconRef,omitempty" json:"iconRef,omitempty"`
	// IconURI references a workspace-local image (workspace://... only).
	IconURI string `yaml:"iconURI,omitempty" json:"iconURI,omitempty"`

	Priority int `yaml:"priority,omitempty" json:"priority,omitempty"`

	Match []llm.Tool `yaml:"match,omitempty" json:"match,omitempty"`
}

Bundle groups tool patterns into a selectable unit. Bundles are global (workspace) and may be referenced by ID from agents or runtime inputs.

func DeriveBundles

func DeriveBundles(defs []llm.ToolDefinition) []*Bundle

DeriveBundles groups concrete tool definitions by their service name and returns a default bundle list. It is used when no workspace bundles exist.

func (*Bundle) Validate

func (b *Bundle) Validate() error

type ResolveResult

type ResolveResult struct {
	Definitions  []llm.ToolDefinition
	ApprovalByID map[string]*llm.ApprovalConfig
	AsyncByID    map[string]*llm.Tool
}

func ResolveDefinitionsWithOptions

func ResolveDefinitionsWithOptions(b *Bundle, matchFn func(pattern string) []*llm.ToolDefinition) ResolveResult

ResolveDefinitionsWithOptions expands bundle match rules and returns both definitions and per-tool approval config.

Jump to

Keyboard shortcuts

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