Documentation
¶
Overview ¶
Package runtime is the invoke sequence shared by the CLI, MCP, and the library.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidApproval = errors.New("invalid approval")
ErrInvalidApproval is an approved id that does not match this caller, operation, and parameters.
Functions ¶
Types ¶
type Executor ¶
type Executor interface {
InvokeHTTPResult(ctx context.Context, op *catalog.Operation, params map[string]string) (result.HTTPResult, error)
}
Executor performs the HTTP call. It does not apply policy.
type HTTPRequest ¶
type HTTPRequest struct {
Method string `json:"method,omitempty"`
URL string `json:"url,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
Body string `json:"body,omitempty"`
}
HTTPRequest is the call that would be sent, with secret values removed.
type InvokeGate ¶
type InvokeGate struct {
Per int
Window time.Duration
Max int
// contains filtered or unexported fields
}
InvokeGate is the per-runtime invoke cap. Zero Per, Window, and Max use 16 calls per second and 256 callers.
type Preview ¶
type Preview struct {
OperationID string `json:"operation_id,omitempty"`
Method string `json:"method,omitempty"`
Path string `json:"path,omitempty"`
Request HTTPRequest `json:"request"`
Errors []string `json:"errors,omitempty"`
Decision string `json:"decision,omitempty"`
ApprovalRequired bool `json:"approval_required"`
}
Preview is resolve, validate, and policy with no token fetch and no upstream HTTP.
type Request ¶
type Request struct {
Operation string
Arguments map[string]any
Caller string
Approval string
Idempotency string
Fields []string
Offset int
Limit int
}
Request is one invoke. Caller is the caller or tenant. Arguments stay typed until HTTP serialization. Fields names the response fields to return. An empty list leaves the body unchanged.
type Result ¶
type Result struct {
Status string `json:"Status"`
ApprovalID string `json:"ApprovalID"`
OperationID string `json:"OperationID"`
HTTPStatus int `json:"HTTPStatus"`
Body string `json:"Body"`
Code string `json:"Code"`
Retryable bool `json:"Retryable"`
RetryAfter string `json:"RetryAfter,omitempty"`
Error string `json:"Error"`
Truncated bool `json:"Truncated"`
Page *result.Page `json:"Page"`
}
Result is the shaped outcome of one invoke.
type Runtime ¶
type Runtime struct {
Catalog *catalog.Catalog
Policy policy.Hook
Base policy.Hook
State *policy.State
Exec Executor
Notify policy.Notifier
Gate *InvokeGate
// contains filtered or unexported fields
}
Runtime resolves, validates, checks policy, verifies approval, executes, shapes, and records. A nil Gate is created on first use. Copies made before that call do not share the gate. Runtime is stored and returned by value, so the publish lock stays off the struct.