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
//! An agent hook end to end: take the JSON payload on stdin, decide, write the envelope on stdout.
//!
//! Exists as its own example because the hook contract is the one place where the *bytes on
//! stdout* are the interface. Everywhere else in this crate a script's output is for a person to
//! read; here it is parsed by the process that invoked the hook, so a stray newline, a hand-rolled
//! nesting or a well-meant progress line is a bug rather than a blemish. That is a whole shape,
//! not a function call, which is why it does not fit in a doc comment on [`airsl::modules::Hook`].
//!
//! Responsibilities: `hook.payload`, `hook.context` and `hook.emit` as the three halves of the
//! contract, `stdio.isatty` as the way a script tells a reader from a parser, and the reason only
//! the exit status can block the tool call a hook fired on.
//!
//! Non-responsibilities: choosing that exit status. This example always returns zero;
//! [`airsl::FailurePolicy`] and [`failure-policy`](../failure-policy/) are where that decision is
//! made.
use Error;
use Path;
use ;