The commit function updates your Policy’s state after successful Ability execution. This is crucial for maintaining accurate tracking of limits, counters, and other stateful information.
If your Policy is stateful (tracks spending, counts executions, etc.), you MUST implement a commit function. Without it, your Policy will make incorrect decisions in future executions.
Object adhering to the commitParamsSchema you have defined for your policy. This should include the specific parameters that your policy needs to update the state your policy depends on for its validation checks.
Notice that unlike the precheck and evaluate functions, the commit function does not receive the abilityParams and userParams arguments. If you need access to any of those variables, make sure to include them in the commitParamsSchema you have defined for your policy.
A Zod schema that defines the structure of successful commit results. Include details about what state was updated, such as new spending totals or execution counts.