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
63
64
65
66
67
68
69
//! Hooks: neutral `[[hooks]]` in `pack.toml` and tool-specific `native/<tool>/hooks.toml`.
//!
//! Both files describe the same thing: an event, an optional selector, an action. One set of
//! event, action, run and grant rules reads them, so two copies cannot drift apart.
//!
//! # Responsibilities
//!
//! - [`Hook`]: a neutral hook: event, `match` values, `agents` and action.
//! - [`HookEvent`]: the closed vocabulary of neutral events.
//! - [`MatchValue`]: the closed set of `match` selector values.
//! - [`HookAction`]: a message or a Lua script, chosen by `kind`.
//! - [`MessageHook`]: a message action: its text.
//! - [`LuaHook`]: a Lua action: script, arguments, `may_block` and grants.
//! - [`HookRun`]: a Lua hook's `run`: as written, the pack it names and its pack-relative path.
//! - [`Grants`]: what a Lua hook may touch: paths, environment variables and binaries.
//! - [`Policy`]: the sandbox policy, `confined`.
//! - [`InvalidHookEvent`], [`InvalidMatchValue`], [`InvalidPolicy`]: the refusals [`HookEvent`],
//! [`MatchValue`] and [`Policy`] return.
//! - [`NativeHook`]: a hook of a tool's own event vocabulary, kept opaque.
//! - [`NativeHooks`]: a whole `native/<tool>/hooks.toml`.
//!
//! # Non-responsibilities
//!
//! Whether a `run` file or an `agents` entry exists belongs to the pack loader, and whether a tool
//! knows a native event belongs to that tool's extension. Turning grants and policy into airsl
//! flags belongs to the extension host.
//!
//! This file is an export-only module with no executable logic, so it carries no inline tests.
pub use HookAction;
pub use HookEvent;
pub use Grants;
pub use InvalidHookEvent;
pub use InvalidMatchValue;
pub use InvalidPolicy;
pub use LuaHook;
pub use MatchValue;
pub use MessageHook;
pub use NativeHook;
pub use NativeHooks;
pub use Hook;
pub use Policy;
pub use HookRun;