origin

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package origin carries agent origin metadata across goroutines via context. Lives in its own leaf package so magus.go can read it without an import cycle.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithContext

func WithContext(ctx context.Context, o Origin) context.Context

WithContext returns ctx carrying o. Retrieve with FromContext.

Types

type Origin

type Origin struct {
	// Agent is the client identifier captured from the MCP initialize
	// handshake's clientInfo, e.g. "someclient/0.7.2". This names the
	// host application, not the model driving it - MCP carries no model field.
	Agent string
	// UserAgent is the raw HTTP User-Agent header of the client, captured on
	// the Streamable-HTTP transport only (empty over stdio). It is a second,
	// out-of-band identity signal: some hosts encode a build or channel here
	// that clientInfo omits. It is still the host's UA, not a guaranteed model.
	UserAgent string
}

Origin describes the agent that triggered a piece of work.

func FromContext

func FromContext(ctx context.Context) (Origin, bool)

FromContext returns the Origin stored by WithContext, or (zero, false).

Jump to

Keyboard shortcuts

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