Skip to main content

Module fs

Module fs 

Source
Expand description

GET /fs REST route over the fs.list_dir JSON-RPC method (#2983 Slice 5).

Why: the daemon-side folder picker (crate::fs_browse::protocol — screen 7a) is the other half of the local-development surface a REST-only client needs alongside session.*/task.*. As with every route in this gateway, the handler stays thin — extract the query params, call super::respond — because the actual behaviour (path expansion/ canonicalization, the NotFound/PermissionDenied/NotADirectory/ NoHome/Io error taxonomy) already lives in crate::fs_browse::protocol::list_dir; duplicating it here would fork the two surfaces (see super module docs). No path-scoping/validation logic belongs in this handler either — fs.list_dir intentionally carries none (crate::fs_browse module docs: tcode is a local app run by the operator, not a multi-tenant service), and this route must not second-guess that decision. What: routes builds a standalone axum::Router<()> (its own FsState carrying just the Arc<Router>, with_state-erased before return, mirroring super::sessions::SessionsState) mapping GET /fs?path=..&include_hidden=.. -> fs.list_dir. The simpler GET /fs shape (rather than GET /fs/list) was chosen because no spec in this repo mandates a /list suffix: DOC-39 §5.0 (“Today’s surface”) explicitly says “there is no REST resource surface”, and its §5.8 (project.list_dir, predating the #2983 REST gateway) proposes that method as “a new method on the existing POST /rpc route — no new HTTP route” rather than any REST shape at all. crate::serve::http::build_axum_router merges this into the daemon’s main router alongside POST /rpc, GET /health, GET /sessions/{id}/events, and the other REST resource groups — /fs collides with none of them. Test: tests::*.

Functions§

routes
Build the GET /fs route group.