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
95
96
97
98
99
100
//! Fleet-by-project route for the managed session API.
//!
//! Why: extracted from `managed_routes/mod.rs` to keep that file under the
//! 500-SLOC production cap. The fleet endpoint is a cohesive unit with its own
//! request/response types and is large enough to warrant a sibling file.
//! What: defines [`FleetProjectGroup`], [`FleetByProjectResponse`], and the
//! [`fleet_by_project_route`] axum handler.
//! Test: `fleet_route_groups_by_project` in `tests/session_manager_mvp.rs`.
use Arc;
use ;
use Serialize;
use warn;
use crateDaemonState;
use crateSessionRecord;
use ;
/// Per-project group entry for GET /api/v1/sessions/managed/fleet.
///
/// Why: the fleet-by-project response nests sessions under their owning project;
/// a typed struct keeps the shape explicit and forward-compatible.
/// What: the project name/URL and the session summaries bound to it.
/// Test: `fleet_route_groups_by_project` in `tests/session_manager_mvp.rs`.
/// Response for GET /api/v1/sessions/managed/fleet.
///
/// Why: wraps the per-project groups so the wire shape is consistent with other
/// list endpoints (which all wrap their arrays under a key).
/// What: a `projects` array of [`FleetProjectGroup`] entries.
/// Test: `fleet_route_groups_by_project` in `tests/session_manager_mvp.rs`.
/// GET /api/v1/sessions/managed/fleet — list managed sessions grouped by project.
///
/// Why: an operator working across multiple repos benefits from a per-project
/// view of active sessions rather than a flat list. `fleet_by_project` from the
/// project resolver provides the grouping; this route exposes it over HTTP so
/// every adapter (Telegram `/fleet`, TUI, CLI) can render the same grouped view.
/// What: reads all live sessions from the `SessionManager`, all registered
/// projects from the `ProjectRegistry`, runs `fleet_by_project` to group them,
/// and returns a `FleetByProjectResponse` with one `FleetProjectGroup` per
/// project (empty `sessions` list included — the operator sees the full project
/// landscape, not just active ones). Each session's `unresumable` flag (#2595)
/// is computed via [`checked_summaries`] — the SAME checked, concurrently-probed
/// path `list_managed_sessions` uses — so the TUI (the primary consumer of
/// this route) never offers a dead session for resume either.
/// Test: `fleet_route_groups_by_project` in `tests/session_manager_mvp.rs`;
/// `fleet_route_marks_dead_session_unresumable` in the same file (#2595).
pub async