main
md 48 lines 2.25 KB
Rendered Raw
1 # get_work_dir_files.py DOX
2
3 ## Purpose
4
5 - Own the `get_work_dir_files.py` API endpoint.
6 - This module handles workdir file operations for get work dir files.
7 - Keep this file-level DOX profile synchronized with `get_work_dir_files.py` because this directory is intentionally flat.
8
9 ## Ownership
10
11 - `get_work_dir_files.py` owns the runtime implementation.
12 - `get_work_dir_files.py.dox.md` owns durable notes about responsibilities, contracts, side effects, and verification for that implementation.
13 - Classes:
14 - `GetWorkDirFiles` (`ApiHandler`)
15 - `get_methods(cls)`
16 - `async process(self, input: dict, request: Request) -> dict | Response`
17 - Top-level functions:
18 - `async get_files(path)`
19
20 ## Runtime Contracts
21
22 - HTTP handlers must derive from `helpers.api.ApiHandler`; WebSocket handlers must derive from `helpers.ws.WsHandler`.
23 - Update this file whenever request payloads, authentication or CSRF requirements, response shapes, route side effects, or WebSocket event contracts change.
24 - `GetWorkDirFiles` is an `ApiHandler`.
25 - `GetWorkDirFiles` defines `process(...)`.
26 - `GetWorkDirFiles` defines `get_methods(...)`.
27 - Imported dependency areas include: `helpers`, `helpers.api`, `helpers.file_browser`.
28
29 ## Key Concepts
30
31 - Important called helpers/classes observed in the source: `FileBrowser`, `browser.get_files`, `runtime.call_development_function`.
32 - Empty `path` requests and explicit `$WORK_DIR` requests resolve to the default workdir path before `FileBrowser` is called, so the WebUI never receives an empty startup path for the default file browser view.
33 - Keep request/response, tool, or helper semantics documented here at the same time as source changes.
34
35 ## Work Guidance
36
37 - Preserve authentication, CSRF, loopback, and API-key checks unless the endpoint contract explicitly changes.
38 - Update frontend callers, plugin callers, and tests together when payload shape changes.
39 - Use `helpers.api.Response` for non-JSON responses, files, redirects, or status-specific replies.
40
41 ## Verification
42
43 - Run endpoint-specific or API/WebSocket tests for changed behavior; smoke-test browser callers when no focused test exists.
44 - No direct test reference was found by name search; choose the nearest behavioral test or perform a focused smoke check.
45
46 ## Child DOX Index
47
48 No child DOX files.