IPendingApprovalStore
AgentPrism.Abstractions.dllThe store for pending approval requests.
public interface IPendingApprovalStoreRemarks
Section titled “Remarks”IPendingApprovalStore.ListPendingAsync, IPendingApprovalStore.GetAsync and IPendingApprovalStore.DecideAsync
are limited to the tenant of the caller (ITenantContext): the operator of one
tenant can neither see nor decide the approvals of another tenant.
IPendingApprovalStore.ExpireAsync is a maintenance operation and scans every tenant — the
same reason as IRunStore.ClaimOrphanedRunsAsync.
Methods
Section titled “Methods”CreateAsync(PendingApproval, CancellationToken)
Section titled “ CreateAsync(PendingApproval, CancellationToken)”Creates a new pending approval request.
ValueTask CreateAsync(PendingApproval approval, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”approval PendingApproval
The request to save. PendingApproval.Status must be ApprovalStatus.Pending.
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”DecideAsync(Guid, bool, string, DateTimeOffset, CancellationToken)
Section titled “ DecideAsync(Guid, bool, string, DateTimeOffset, CancellationToken)”Writes a decision on a pending request.
ValueTask<bool> DecideAsync(Guid id, bool approved, string decidedBy, DateTimeOffset decidedAt, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”id Guid
The request id.
approved bool
Whether the request is approved.
decidedBy string
The actor that made the decision.
decidedAt DateTimeOffset
The time of the decision.
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”true when the decision is written; false when the request is not found in the caller’s tenant or is no longer in the ApprovalStatus.Pending state (a second decision is rejected silently).
ExpireAsync(DateTimeOffset, int, CancellationToken)
Section titled “ ExpireAsync(DateTimeOffset, int, CancellationToken)”Closes the requests that expired before olderThan and are still
in the ApprovalStatus.Pending state, marking them
ApprovalStatus.Expired.
ValueTask<IReadOnlyList<PendingApproval>> ExpireAsync(DateTimeOffset olderThan, int max, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”olderThan DateTimeOffset
Requests that expired before this time are closed (UTC).
max int
The upper number of requests closed in this round.
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”ValueTask<IReadOnlyList<PendingApproval>>
The records of the closed requests.
Remarks
Section titled “Remarks”[TenantAgnostic]: this is maintenance work and scans the expired requests
of every tenant; filtering by the ambient tenant would leave the requests of the
other tenants ApprovalStatus.Pending forever.
GetAsync(Guid, CancellationToken)
Section titled “ GetAsync(Guid, CancellationToken)”Returns a single pending approval request.
ValueTask<PendingApproval?> GetAsync(Guid id, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”id Guid
The request id.
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”The request, or null when it is not found in the caller’s tenant.
ListPendingAsync(CancellationToken)
Section titled “ ListPendingAsync(CancellationToken)”Lists the pending requests of the caller’s tenant, ordered from oldest to newest.
ValueTask<IReadOnlyList<PendingApproval>> ListPendingAsync(CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”cancellationToken CancellationToken
The cancellation token.