Documentation
¶
Overview ¶
Package mcpapps carries request-scoped host-only MCP results separately from model-safe tool text. No result enters model messages or shared agent state.
Index ¶
- func Active(ctx context.Context) bool
- func Activity(messageID string, app AppBinding, result, args json.RawMessage) (json.RawMessage, error)
- func EmitActivity(ctx context.Context, app AppBinding, result, args json.RawMessage) error
- func HasActivityEmitter(ctx context.Context) bool
- func Record(ctx context.Context, server, tool, nativeOperationID string, ...) error
- func RecordCompletion(ctx context.Context, principal, conversation, turn string)
- func Scope(ctx context.Context) (string, string, bool)
- func ServerHash(transport, endpoint string) (string, error)
- func TurnID(ctx context.Context) string
- func Visible(meta map[string]interface{}, audience string) bool
- func WithActivityEmitter(ctx context.Context, emit ActivityEmitter) context.Context
- func WithRecorder(ctx context.Context, recorder func(json.RawMessage, string) error) context.Context
- func WithTurnID(ctx context.Context, turnID string) context.Context
- type ActivityEmitter
- type AppBinding
- type Capture
- type CompletionReceipt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Activity ¶
func Activity(messageID string, app AppBinding, result, args json.RawMessage) (json.RawMessage, error)
func EmitActivity ¶
func EmitActivity(ctx context.Context, app AppBinding, result, args json.RawMessage) error
func HasActivityEmitter ¶
func Record ¶
func Record(ctx context.Context, server, tool, nativeOperationID string, result *mcpschema.CallToolResult) error
Record is called at the canonical registry's actual MCP response boundary. The exact selected server/method must match this one host request.
func RecordCompletion ¶
RecordCompletion follows successful full native guest-turn finalization. It also requires that the canonical capture belongs to this exact request and already has the same durably committed effect/result.
func Scope ¶
Scope is the exact native server/tool selected by the already authorized host binding. It is never reconstructed from a lossy provider tool alias.
func ServerHash ¶
func Visible ¶
Visible implements the stable Apps _meta.ui.visibility contract. Missing visibility defaults to model and app. Malformed/unknown audiences fail closed.
func WithActivityEmitter ¶
func WithActivityEmitter(ctx context.Context, emit ActivityEmitter) context.Context
func WithRecorder ¶
Types ¶
type ActivityEmitter ¶
type ActivityEmitter func(context.Context, AppBinding, json.RawMessage, json.RawMessage) error
type AppBinding ¶
type AppBinding struct {
AppInstanceID string `json:"appInstanceId"`
PublicServerID string `json:"publicServerId"`
Version string `json:"version"`
ThreadID string `json:"threadId"`
NativeTurnID string `json:"nativeTurnId,omitempty"`
InvocationID string `json:"invocationId,omitempty"`
ServerID string `json:"nativeServerId"`
ServerHash string `json:"serverHash"`
ResourceURI string `json:"resourceUri"`
}
type Capture ¶
type Capture struct {
Server, Tool, OperationID string
NativeOperationID string
Result json.RawMessage
// contains filtered or unexported fields
}
func WithCapture ¶
type CompletionReceipt ¶
type CompletionReceipt struct {
// contains filtered or unexported fields
}
CompletionReceipt is private to one server-owned proxy invocation. It is neither serialized nor recovered from a journal or guest-supplied metadata.
func WithCompletionReceipt ¶
func WithCompletionReceipt(ctx context.Context, principal, conversation, turn, operation, server, tool string) (context.Context, *CompletionReceipt)
WithCompletionReceipt is called only for a fresh, non-resumed host request. Each invocation gets a new receipt; identity and completion are never cached across requests or installed by a wire field.
func (*CompletionReceipt) Matches ¶
func (r *CompletionReceipt) Matches(principal, conversation, turn, operation, native, status string, result json.RawMessage) bool
Matches permits reuse only for the exact successful completion in this same live invocation. Failed, missing, changed or recovered receipts fall through to the existing full finalizer.
func (*CompletionReceipt) RecordDurable ¶
func (r *CompletionReceipt) RecordDurable(native string, result json.RawMessage)
RecordDurable is called by the trusted host recorder only after its exact native effect and full result were successfully committed to the journal.