selfcall

package
v1.164.0 Latest Latest
Warning

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

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

Documentation

Overview

Package selfcall carries a request to the platform's own HTTP API that is served inside this process on behalf of a caller the platform has already authenticated (#2086).

Every call on the built-in platform-admin connection is served by the platform's own handler in this process, and its request is marked as made by a tool call (ByTool), whether or not it carries the caller's token (#2656). That marker says who is asking -- an agent, not the person at a browser -- and grants nothing: the routes that make an agent's move wait on a person read it, and nothing authenticates by it. A call that carries the caller's token keeps it, and the admin and portal authenticators check it like any other. A managed script's run has no token -- it presents the roles its owner held at the save -- so the identity the tool-call middleware authenticated is recorded on the request's context too (With), and the authenticators read it from there. A request that arrives over the network cannot carry a context value, so neither adds a credential anyone can send.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByTool added in v1.162.1

func ByTool(ctx context.Context) bool

ByTool reports whether a request was made by a tool call (an agent's call on the platform-admin connection, a managed script's run, a tool that serves itself through the API) rather than by a person's own client. It is the one answer every "is this an agent" check reads (#2656).

func ForCall

func ForCall(ctx context.Context, req *http.Request) (*http.Request, bool)

ForCall marks req to be served inside this process when the tool call it belongs to was authenticated as someone and carries no token to forward: a managed script's run. It reports false, leaving req alone, otherwise.

func From

func From(ctx context.Context) (mcpcontext.Caller, bool)

From returns the caller a request served inside this process was made for, and false for every other request.

func Install

func Install[T any](kits []T, h http.Handler)

Install hands h to every toolkit among kits that serves a connection with the platform's own handler (the api kind's platform-admin connection).

func MarkTool added in v1.162.1

func MarkTool(ctx context.Context) context.Context

MarkTool returns ctx marked as a request a tool call made to the platform's own API. It names no one and authenticates nothing.

func Transport

func Transport(self http.RoundTripper) http.RoundTripper

Transport serves every request through self, the platform's own handler, marked as made by a tool call: the transport of the platform-admin connection, every request of which is a tool call's (#2656).

func With

With returns ctx marked as a request served inside this process for c, and as made by a tool call.

Types

type Handler

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

Handler is the platform's own HTTP handler, set once the server has assembled it. The connection that dispatches to it is registered before the server exists, so it holds this and the server fills it in.

func (*Handler) ServeHTTP

func (s *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves r with the installed handler, or answers 503 when the server has not installed one: a process serving no HTTP API.

func (*Handler) Set

func (s *Handler) Set(h http.Handler)

Set installs the handler requests are served by.

type PersonaError

type PersonaError struct {
	Surface string
	Persona string
	Need    []string
	Caller  string
	Has     []string
}

PersonaError refuses a caller whose roles do not resolve to the persona a surface requires. Its text names the persona, the roles that reach it, and the roles the caller presents.

func (*PersonaError) Error

func (e *PersonaError) Error() string

Jump to

Keyboard shortcuts

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