toolsurface

package
v0.46.2 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package toolsurface records which surface a tool call came from, so a tool can tell whether a person approved it. It sits below every package that makes in-process API calls (internal/util/rest among them), so those calls can strip the mark: an approval belongs to the request that obtained it and must not reach nested calls made on its behalf.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Strip

func Strip(ctx context.Context) context.Context

Strip returns ctx without a surface mark, for a nested call (an in-process API request, a plugin tool, a chat completion) that must not inherit the approval of the request it runs under.

func With

func With(ctx context.Context, surface Surface) context.Context

With marks ctx as coming from a surface that approves tool calls.

Types

type Surface

type Surface string

Surface names where a tool call came from. The web assistant asks the user before tool calls and shows their arguments; an MCP client is expected to do the same for a tool marked destructive. Everything else sets no surface.

const (
	WebChat Surface = "web-chat"
	MCP     Surface = "mcp"
)

func From

func From(ctx context.Context) Surface

From returns the surface ctx was marked with, "" when none.

Jump to

Keyboard shortcuts

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