Versions in this module Expand all Collapse all v0 v0.1.0 Aug 21, 2026 Changes in this version + const ActionAllow + const ActionDeny + const ActionWarn + const DefaultAPIURL + const DefaultLocalControlInterval + const LocalControlPollPath + const LocalControlReportPath + const MetadataTokens + const OriginTypeAgent + const OriginTypeAutonomous + const OriginTypeUser + const StagePostLLM + const StagePreLLM + const StageToolCall + const StageToolCallResponse + func ContextWithAgentIdentity(ctx context.Context, sid, urn string) context.Context + func ContextWithDelegation(ctx context.Context, token string) context.Context + func ContextWithEndpointAgent(ctx context.Context, agent EndpointAgent) context.Context + func ContextWithPrincipal(ctx context.Context, p Principal) context.Context + func ContextWithSession(ctx context.Context, id string) context.Context + func ContextWithTrace(ctx context.Context, traceID, spanID string) context.Context + type Action = enforce.Action + type AuthContext = enforce.AuthContext + type CheckRequest = enforce.CheckRequest + type Config struct + APIURL string + DID string + FailMode FailMode + KeyPEM []byte + KeyPEMPath string + Mode Mode + ProxyMode bool + SimTelemetryURL string + Timeout time.Duration + func LoadEnv() Config + type Content = enforce.Content + type Decision = enforce.Decision + type DenyError struct + Decision Decision + func AsDenyError(err error) (*DenyError, bool) + func (e *DenyError) Error() string + type EndpointAgent = enforce.EndpointAgent + type ExecutionContext = enforce.ExecutionContext + type FailMode string + const FailClosed + const FailOpen + type Guard struct + func New(cfg Config, opts ...Option) (*Guard, error) + func (g *Guard) AcknowledgeSessionTaint(ctx context.Context, sessionID string) error + func (g *Guard) Check(ctx context.Context, req CheckRequest) (Decision, error) + func (g *Guard) CheckModelResponse(ctx context.Context, session, model, text string) (Decision, error) + func (g *Guard) CheckToolCall(ctx context.Context, session, toolName string, args any, destDomain string) (Decision, error) + func (g *Guard) CheckToolResponse(ctx context.Context, session, toolName string, result any) (Decision, error) + func (g *Guard) Close() error + func (g *Guard) Connect(ctx context.Context, info ManifestInfo) error + func (g *Guard) DID() string + func (g *Guard) GovernToolResult(ctx context.Context, session, toolName, result string) (string, Decision, error) + func (g *Guard) LocalControlDetectors() []string + func (g *Guard) ModelMode() ModelMode + func (g *Guard) RecordLLMCall(sessionID, requestID, model, provider string, inputTokens, outputTokens int64, ...) + func (g *Guard) RecordLLMCallDetail(c LLMCall) + func (g *Guard) RecordLLMCallStreamed(sessionID, requestID, model, provider string, inputTokens, outputTokens int64, ...) + func (g *Guard) RecordSessionStart(sessionID string, data map[string]any) + func (g *Guard) RecordSessionSummary(sessionID string, data map[string]any) + func (g *Guard) RecordToolIO(sessionID, requestID, toolName, argsJSON, resultJSON string) + func (g *Guard) RecordToolIODetail(c ToolIO) + func (g *Guard) Report() Summary + func (g *Guard) SessionTaint(ctx context.Context, sessionID string) (*Taint, error) + func (g *Guard) SetLocalControls(cfg localcontrol.Config) error + func (g *Guard) SimulationActive() bool + func (g *Guard) SimulationConfig() *SimulationConfig + func (g *Guard) StopLocalControlSync() + func (g *Guard) SyncLocalControls(opts ...LocalControlSyncOption) error + func (g *Guard) WrapRoundTripper(base http.RoundTripper, opts ...WrapOption) http.RoundTripper + type KillInfo = enforce.KillInfo + type KillSwitchError struct + Kills []KillInfo + func AsKillSwitchError(err error) (*KillSwitchError, bool) + func (e *KillSwitchError) Error() string + type LLMCall struct + AgentID string + CacheReadTokens int64 + CacheWriteTokens int64 + ComponentName string + EndpointID string + InputTokens int64 + InstanceKey string + LatencyMS float64 + Model string + OutputTokens int64 + ParentSpanID string + Provider string + RequestID string + SessionID string + Streamed *bool + type LocalControlSyncOption func(*localControlSyncSettings) + func WithLocalControlApplyHook(fn func(cfg localcontrol.Config, err error)) LocalControlSyncOption + func WithLocalControlInterval(d time.Duration) LocalControlSyncOption + type ManifestInfo struct + Enterprise map[string]any + EnterpriseToken string + Environment string + Framework string + Models []string + Skills []SkillInfo + Tools []string + type Mode string + const ModeAudit + const ModeEnforce + const ModeOff + const ModeWarn + type ModelMode string + const ModelModeCheck + const ModelModeGateway + const ModelModePassthrough + type Operation = enforce.Operation + type Option func(*Guard) error + func WithCloudTelemetry(interval time.Duration) Option + func WithEnforcer(e enforce.Enforcer) Option + func WithFailMode(f FailMode) Option + func WithHeartbeat(interval time.Duration) Option + func WithLocalControlEngine(e *localcontrol.Engine) Option + func WithLocalControls(cfg localcontrol.Config) Option + func WithManifestRefreshHandler(fn func()) Option + func WithMode(m Mode) Option + func WithModeChangeHandler(fn func(old, cur ModelMode)) Option + func WithSigner(s identity.Signer) Option + func WithSimulation(enabled bool) Option + func WithSimulationTelemetryURL(url string) Option + func WithTelemetry(t telemetry.Telemetry) Option + type Principal = enforce.Principal + type SimulationConfig struct + Active bool + Extra json.RawMessage + Middlewares []string + ProtectionDisabled bool + RunID string + TelemetryJWT string + TelemetryURL string + type SkillInfo struct + AllowedTools []string + Description string + Name string + Scripts []string + Source string + SourcePath string + type Stage = enforce.Stage + type Summary = telemetry.Summary + type Taint struct + CurrentTurn int + NamespaceID string + SessionID string + SessionSeverity float64 + TaintHash string + Taints []TaintEntry + Version int + type TaintEntry struct + CreatedAt string + InjectionScore *float64 + Labels []string + PIIScore *float64 + Severity float64 + ToolCallID string + ToolName string + Turn int + type ToolIO struct + AgentFramework string + ArgsJSON string + Data map[string]any + EndpointID string + InstanceKey string + ParentSpanID string + RequestID string + ResultJSON string + SessionID string + SpanID string + ToolName string + TraceID string + type WrapOption func(*guardRoundTripper) + func WithResponseCheck() WrapOption