.NET API
TraconToolApprovalPolicyExtensions
Tracon.Core.dllChain extension that registers a code-defined approval policy for a tool.
public static class TraconToolApprovalPolicyExtensionsInheritance
Section titled “Inheritance”object ← TraconToolApprovalPolicyExtensions
Inherited Members
Section titled “Inherited Members”object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Remarks
Section titled “Remarks”This is an extension method, not a member of ITraconBuilder: adding a member to the interface is a breaking change after release; adding an extension method is not.
Methods
Section titled “Methods”AddToolApprovalPolicy(ITraconBuilder, string, Func<ToolApprovalContext, ToolApprovalPolicyDecision>)
Section titled “ AddToolApprovalPolicy(ITraconBuilder, string, Func<ToolApprovalContext, ToolApprovalPolicyDecision>)”Registers a code-defined approval policy for a tool.
public static ITraconBuilder AddToolApprovalPolicy(this ITraconBuilder builder, string toolName, Func<ToolApprovalContext, ToolApprovalPolicyDecision> policy)Parameters
Section titled “Parameters”builder ITraconBuilder
The configuration chain.
toolName string
The tool the policy judges.
policy Func<ToolApprovalContext, ToolApprovalPolicyDecision>
The policy delegate. Runs at every call to toolName, before the
data rules (ToolApprovalRule). ToolApprovalPolicyDecision.Required
and ToolApprovalPolicyDecision.NotRequired override the data rules;
ToolApprovalPolicyDecision.Undecided defers to them. An exception is treated
as ToolApprovalPolicyDecision.Required and logged — a broken policy does not
silently release a tool from approval.
Returns
Section titled “Returns”The chain, for further configuration.
Remarks
Section titled “Remarks”The policy’s dependencies must be captured at REGISTRATION time (the delegate’s closure), not resolved from a service provider inside the delegate — the service provider a tool call sees is empty.
builder.AddTracon() .AddToolApprovalPolicy("refund_order", context => context.GetNumber("amount") is { } amount && amount <= 100 ? ToolApprovalPolicyDecision.NotRequired : ToolApprovalPolicyDecision.Required);Exceptions
Section titled “Exceptions”builder or policy is null.
toolName is empty or whitespace.