Documentation
¶
Overview ¶
Package approval obtains human confirmation for write tools, either via MCP elicitation inside the client or via a browser approval page.
Index ¶
- func RestartURL(base, cluster, kind, namespace, name string) string
- type BrowserAuth
- type Manager
- func (m *Manager) Close()
- func (m *Manager) Confirm(ctx context.Context, req *mcp.CallToolRequest, r tool.ConfirmRequest) (method string, err error)
- func (m *Manager) EnableInboxNotify(cfg config.InboxNotify) error
- func (m *Manager) EnablePush(cfg config.ApprovalPush) error
- func (m *Manager) RegisterStatus(s *mcp.Server, env *tool.Env)
- func (m *Manager) ResolveApproval(ctx context.Context, r tool.ConfirmRequest) error
- func (m *Manager) Routes(mux *http.ServeMux)
- func (m *Manager) SetDirect(lookup func(name string) *tool.Direct)
- func (m *Manager) SetHostOptions(...)
- func (m *Manager) SetOptions(...)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RestartURL ¶
RestartURL returns the link that requests approval to restart a workload. It holds no secret and changes nothing until a signed-in person approves. Invalid or masked values produce no link.
Types ¶
type BrowserAuth ¶
type BrowserAuth interface {
RequireUser(next func(w http.ResponseWriter, r *http.Request, subject string)) http.Handler
}
BrowserAuth signs a person in for the approval page. Implemented by oauth.Server.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager implements tool.Confirmer.
func New ¶
New returns a Manager. browser may be nil, which disables web approval. publicURL is the origin used to build approval links.
func (*Manager) Close ¶ added in v0.4.0
func (m *Manager) Close()
Close stops push delivery, including any in-flight HTTP request.
func (*Manager) Confirm ¶
func (m *Manager) Confirm(ctx context.Context, req *mcp.CallToolRequest, r tool.ConfirmRequest) (method string, err error)
Confirm implements tool.Confirmer.
func (*Manager) EnableInboxNotify ¶ added in v0.4.0
func (m *Manager) EnableInboxNotify(cfg config.InboxNotify) error
EnableInboxNotify loads the shared key before serving. Notices never create approvals; the usual authenticated live choices flow remains the only gate.
func (*Manager) EnablePush ¶ added in v0.4.0
func (m *Manager) EnablePush(cfg config.ApprovalPush) error
EnablePush loads durable subscriptions before HTTP serving starts. A storage error fails startup rather than silently replacing the devices' VAPID key.
func (*Manager) RegisterStatus ¶ added in v0.4.0
RegisterStatus exposes only the requester's approval records. Add supplies scope, per-caller tool policy, timeout, audit and output bounds.
func (*Manager) ResolveApproval ¶ added in v0.4.0
ResolveApproval retrieves the original invocation, even if applying it changed the current plan. Its hash binds all original arguments (including the target); only the stored runner can apply, after checking the approved summary/target.