Skip to main content

validate_lease

Function validate_lease 

Source
pub fn validate_lease(
    lease: &ControlLease,
    envelope: &ActionEnvelope,
) -> Result<(), ComputerUseError>
Available on crate feature computer-use only.
Expand description

Verifies a lease belongs to this session, principal, agent, and mode, and is usable.

§Errors

Returns ComputerUseError::IdentityMismatch when any bound field disagrees with envelope, when the lease is not active, or when its action budget is exhausted.

§Example

use adk_computer_use::runtime::binding::validate_lease;
use adk_computer_use::{ActionEnvelope, ControlLease};

let envelope = envelope();
let lease = lease_for_another_session();

// A well-formed lease bound to a different session is refused here rather than
// entering graph state.
assert!(validate_lease(&lease, &envelope).is_err());