appoperation

package
v1.36.0 Latest Latest
Warning

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

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

Documentation

Overview

Package appoperation carries exact App operation coordinates through admitted browser and trusted planner requests. It grants no authority: the broker must check its current policy and the verified caller coordinates.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalid = errors.New("invalid app operation binding")

ErrInvalid is a closed, content-free refusal of an operation binding.

Functions

func AgentInvocationFrom added in v1.33.2

func AgentInvocationFrom(ctx context.Context) (string, bool)

AgentInvocationFrom returns the agent stamped by trusted planner dispatch.

func ArgumentsDigest

func ArgumentsDigest(raw json.RawMessage) (string, error)

ArgumentsDigest hashes a bounded, duplicate-free JSON object after key sorting and string normalization. Number spelling is preserved (including integers beyond float64 precision). Absent arguments mean the empty object.

func CanonicalArguments added in v1.33.2

func CanonicalArguments(raw json.RawMessage) (json.RawMessage, string, error)

CanonicalArguments returns key-sorted, duplicate-free object JSON with exact number spelling and its SHA-256 digest, using the app-operation-v1 codec.

func DecodeArguments

func DecodeArguments(raw json.RawMessage) (map[string]any, error)

DecodeArguments validates closed object input and preserves exact JSON numbers.

func WithAgentCall added in v1.33.2

func WithAgentCall(ctx context.Context, agent, server, tool string, args json.RawMessage) (context.Context, error)

WithAgentCall binds one trusted planner invocation to its final outgoing input. The random reference is a call coordinate, never authority or a browser selector.

func WithAgentInvocation added in v1.33.2

func WithAgentInvocation(ctx context.Context, agent string) context.Context

WithAgentInvocation marks the trusted planner dispatch boundary with its reach-admitted effective agent. This is not a Protocol or model input.

func WithAgentRead added in v1.33.2

func WithAgentRead(ctx context.Context, agent, server, resource string) (context.Context, error)

WithAgentRead binds one trusted planner invocation to an exact App resource.

func WithCall

func WithCall(ctx context.Context, ref, agent, server, resource, generation, tool string, args json.RawMessage) (context.Context, error)

WithCall binds a selector to a fresh-render-admitted exact tool invocation.

func WithRead

func WithRead(ctx context.Context, ref, agent, server, resource string) (context.Context, error)

WithRead binds a selector to the resource read admitted by the Protocol.

Types

type Binding

type Binding struct {
	Version         string          `json:"version"`
	Reference       string          `json:"reference"`
	Kind            string          `json:"kind"`
	AgentID         string          `json:"agent_id"`
	ServerID        string          `json:"server_id"`
	ResourceURI     string          `json:"resource_uri"`
	Generation      string          `json:"generation,omitempty"`
	Tool            string          `json:"tool,omitempty"`
	ArgumentsSHA256 string          `json:"arguments_sha256,omitempty"`
	Arguments       json.RawMessage `json:"arguments,omitempty"`
}

Binding is the broker request extension. Agent tool bindings carry bounded canonical outgoing arguments; identity and destination remain authenticated separately.

func From

func From(ctx context.Context) (Binding, bool)

From returns a value copy; callers cannot mutate another request's binding.

func (Binding) CheckCall

func (b Binding) CheckCall(server, tool string, args map[string]any) error

CheckCall compares the actual outgoing MCP arguments, after any transformation.

func (Binding) CheckResource

func (b Binding) CheckResource(server, resource string) error

CheckResource refuses reuse for another source or resource before credential resolution or network dispatch.

func (Binding) Digest

func (b Binding) Digest() (string, error)

Digest identifies the complete binding acknowledged by the broker.

Jump to

Keyboard shortcuts

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