.NET API
IToolApprovalRuleStore
Tracon.Abstractions.dllThe store for persistent approval rules.
public interface IToolApprovalRuleStoreRemarks
Section titled “Remarks”The rules are read on every run; implementations must keep the read cheap. The
in-memory implementation holds every rule in memory; the PostgreSQL implementation is
indexed on (tenant_id, tool_name).
Methods
Section titled “Methods”AddAsync(ToolApprovalRule, CancellationToken)
Section titled “ AddAsync(ToolApprovalRule, CancellationToken)”Adds a rule. When a rule with the same identity is already stored, the existing rule is returned and no new record is opened.
ValueTask<ToolApprovalRule> AddAsync(ToolApprovalRule rule, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”rule ToolApprovalRule
The rule to add.
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”The persisted rule.
Remarks
Section titled “Remarks”A rule’s identity is its tenant, agent, tool, ToolApprovalRule.ArgumentsHash,
ToolApprovalRule.SourceFingerprint, and condition set. Two rules that
differ only in their source fingerprint are two rules: a rule for the same tool of a
server that has since moved to another endpoint must not come back in place of a
new one. The condition set is compared as a set - the order of the
conditions does not count. Within a condition, the path and the operator are
compared exactly and the value as its JSON text, with one exception: a list value
(ToolArgumentOperator.In, ToolArgumentOperator.NotIn) is
compared element by element, so whitespace between its elements does not count.
Every other value is compared as the exact JSON text it was written with -
100 and 100.0 are two different conditions, and so are two strings
that differ only inside the quotes.
DeleteAsync(string, Guid, CancellationToken)
Section titled “ DeleteAsync(string, Guid, CancellationToken)”Deletes a rule.
ValueTask<bool> DeleteAsync(string tenantId, Guid ruleId, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”tenantId string
The tenant id. The rule of another tenant cannot be deleted.
ruleId Guid
The rule id.
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”true when the rule was deleted.
ListAsync(string, CancellationToken)
Section titled “ ListAsync(string, CancellationToken)”Lists the rules of a tenant.
ValueTask<IReadOnlyList<ToolApprovalRule>> ListAsync(string tenantId, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”tenantId string
The tenant id.
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”ValueTask<IReadOnlyList<ToolApprovalRule>>
The rules, newest first.