Documentation
¶
Overview ¶
Package shieldguard adapts github.com/xraph/shield to the agent.Guard seam. It is opt-in: core/agent never imports shield. Wire it with forgeext.WithGuard(shieldguard.New(shieldExt.Engine())).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Guard ¶
type Guard struct {
// contains filtered or unexported fields
}
Guard adapts a shield Scanner to agent.Guard.
func (Guard) Guard ¶
func (g Guard) Guard(ctx context.Context, in agent.GuardInput) (agent.GuardResult, error)
Guard scans in.Text through the shield engine and maps the verdict onto agent.GuardResult. GuardIngest scans input (user->agent), GuardEmit scans output (agent->user). On a scanner error it returns the error unmodified so the caller's applyGuard can apply the deployment's fail-closed/open policy.
type Scanner ¶
type Scanner interface {
ScanInput(ctx context.Context, in *scan.Input) (*scan.Result, error)
ScanOutput(ctx context.Context, in *scan.Input) (*scan.Result, error)
}
Scanner is the subset of *engine.Engine this adapter needs (so it is testable without standing up a full shield engine).