Skip to main content

AuthorityPolicy

@totemsdk/agent-policy


@totemsdk/agent-policy / AuthorityPolicy

Class: AuthorityPolicy

AuthorityPolicy — bridges PolicyMiddleware evaluation with mandate-based authority verification.

Corrected bridge:

  • uses the authenticated proposal.principal (never agentId as principal);
  • preserves the real action namespace (no synthesized payment:*);
  • returns the full AuthorityDecision + usage delta, not a boolean;
  • binds the decision to the proposal id as the intent nonce.

Insert this layer into a ComposablePolicy pipeline to ensure every proposal is backed by a valid mandate before it is approved.

Implements​

Constructors​

Constructor​

new AuthorityPolicy(evaluator, extractAction?, options?): AuthorityPolicy

Parameters​

evaluator​

AuthorityEvaluator

extractAction?​

(proposal) => AuthorityActionIntent

options?​

AuthorityPolicyOptions

Returns​

AuthorityPolicy

Methods​

evaluate()​

evaluate(proposal, now?): Promise<PolicyEvalResult>

Evaluate a proposal. Called in sequence by ComposablePolicy.

Parameters​

proposal​

AgentProposal

now?​

number = ...

Returns​

Promise<PolicyEvalResult>

Implementation of​

PolicyMiddleware.evaluate