Documentation
¶
Overview ¶
Package toolpolicy defines provider-neutral policy hooks for model-emitted tool calls.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Decision ¶
type Decision int
Decision is the policy outcome for a canonical tool-call lifecycle event.
type Meta ¶
type Meta struct {
TraceID string
ALegID string
BLegID string
AttemptSeq int
Principal execview.PrincipalView
Scope scope.PrincipalScopeView
Session session.SessionView
Workspace workspace.WorkspaceView
}
Meta carries read-only execution context for tool-call policy decisions. Scope is the authoritative principal/scope attribution, carried separately from the legacy Principal projection (requirement 2.6). A zero Scope preserves local/anonymous identity semantics.
type Policy ¶
type Policy interface {
ID() string
Order() int
FailureMode() sdkhooks.FailureMode
Handle(ctx context.Context, event lipapi.ToolEvent, meta Meta, svc Services) (Decision, error)
}
Policy decides whether a canonical model-emitted tool event is allowed to continue. It is distinct from toolcatalog.Filter, which shapes the advertised catalog before backend execution, and from hooks.ToolReactor, which can rewrite tool events.
func MaterializeSorted ¶
MaterializeSorted returns policies ordered by Order, ID, then registration index.