rpc

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package rpc dispatches POST /api/v1/method/{app}.{module}.{method} requests to registered api.MethodHandler implementations, enforcing AllowedRoles through the shared perm.Engine path (TAD §9.2).

See PRD §14.3 and TAD §9.2 for the full specification. Implemented in Phase 6.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DispatchHandler

func DispatchHandler(permEngine perm.Engine) http.HandlerFunc

DispatchHandler handles RPC method dispatch for /api/v1/method/{app}.{module}.{method} or /api/v1/method/*

func RegisterMethod

func RegisterMethod(name string, h MethodHandler, opts MethodOpts)

RegisterMethod registers a custom RPC method.

func ResetRegistry

func ResetRegistry()

ResetRegistry clears all registered RPC methods (useful for testing).

Types

type MethodHandler

type MethodHandler func(ctx context.Context, args map[string]any) (any, error)

MethodHandler handles custom RPC method requests per PRD §14.3 / TAD §9.2.

type MethodOpts

type MethodOpts struct {
	AllowedRoles []string
	HTTPMethod   string // "GET" | "POST"
}

type RegisteredMethod

type RegisteredMethod struct {
	Name    string
	Handler MethodHandler
	Opts    MethodOpts
}

func GetMethod

func GetMethod(name string) (RegisteredMethod, bool)

GetMethod retrieves a registered RPC method by name.

func Methods

func Methods() []RegisteredMethod

Methods returns a copy of every registered RPC method. Consumed by the agent ToolRegistry at compile time to emit one tool per role-gated method (TAD §10.1 step 8).

Jump to

Keyboard shortcuts

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