1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// lc-agents/src/approval.rs
//! Approval gate (§4.2): **asynchronous** approval gate before tool execution.
//!
//! Coexists with the synchronous hook system (`hooks::ApprovalHook` /
//! `ToolCallAction`) without conflict: the sync hook runs inside
//! `execute_tool`, and the approval gate also runs inside `execute_tool`, after
//! the sync hook and **before** actual execution — the order is
//! `budget gate → execute_tool (sync hook → approval gate → tool execution)`.
//!
//! The framework only provides the gate; the approval strategy is implemented
//! by the caller via [`ApprovalHandler`]. [`AllowAll`] is a reference
//! implementation for testing / demos.
use async_trait;
use Value;
use crateToolCallContext;
/// Approval decision before tool execution.
/// Approval-gate interface. Implemented by the caller and injected via
/// `AgentExecutor::with_approval`.
///
/// `approve` is async: implementations may `await` an approval signal (CLI
/// interaction / webhook / messaging channel). Same-process resume works
/// naturally through async/await — the future suspends waiting for the signal
/// and continues from the same line when it arrives, no serialization /
/// Checkpointer needed.
/// Reference implementation: allows everything. For tests / demos.
;