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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
//! [`EngineError`]: [`crate::tui_client::CodeEngine`]'s unified error type.
//!
//! Why: `CodeEngine`'s `TuiEngine` methods return `anyhow::Result` (the
//! trait's signature, `crates/trusty-code-tui/src/engine.rs`), but the engine's
//! own internal helpers need a concrete, matchable error type — both so
//! tests can assert on WHICH failure occurred and so `?` composes cleanly
//! across the client's submodules before the outer `TuiEngine` method converts
//! the final error into `anyhow::Error` (automatic via `anyhow`'s blanket
//! `From<E: std::error::Error>` impl).
//! What: one variant per failure class this client can observe over the
//! daemon's Unix socket (#6637): a transport-level failure, a JSON-RPC error
//! envelope, a response whose shape this client did not expect, an event
//! stream that ended without a terminal session event, and "no active session"
//! (a caller-usage error, not a transport one — `handle_input` before `setup`
//! completed).
//!
//! The HTTP-shaped variants are gone with the transport. `Discovery` went with
//! `TCODE_DAEMON_URL` and the `http_addr` file — the socket path is derived,
//! not discovered. `Status` went with HTTP status codes, which a framed
//! JSON-RPC response does not have: every daemon-side refusal now arrives as
//! [`EngineError::Rpc`] carrying a code, and every transport failure as
//! [`EngineError::Transport`].
//!
//! Test: exercised indirectly through every `tui_client` submodule's own
//! tests and `tests/tui_client_engine.rs`.
use PathBuf;
use Value;
use UdsRpcError;
/// See module docs.