main
md 69 lines 3.34 KB
Rendered Raw
1 # runtime.py DOX
2
3 ## Purpose
4
5 - Own the `runtime.py` helper module.
6 - This module owns runtime identity, environment flags, and startup arguments.
7 - Keep this file-level DOX profile synchronized with `runtime.py` because this directory is intentionally flat.
8
9 ## Ownership
10
11 - `runtime.py` owns the runtime implementation.
12 - `runtime.py.dox.md` owns durable notes about responsibilities, contracts, side effects, and verification for that implementation.
13 - Top-level functions:
14 - `initialize()`
15 - `get_arg(name: str)`
16 - `has_arg(name: str)`
17 - `is_dockerized() -> bool`
18 - `is_development() -> bool`
19 - `get_local_url()`
20 - `get_runtime_id() -> str`
21 - `get_persistent_id() -> str`
22 - `async call_development_function(func: Callable[..., Awaitable[T]], *args, **kwargs) -> T`
23 - `async call_development_function(func: Callable[..., T], *args, **kwargs) -> T`
24 - `async call_development_function(func: Union[Callable[..., T], Callable[..., Awaitable[T]]], *args, **kwargs) -> T`
25 - `async handle_rfc(rfc_call: rfc.RFCCall)`
26 - `_get_rfc_password() -> str`
27 - `_get_rfc_url() -> str`
28 - `call_development_function_sync(func: Union[Callable[..., T], Callable[..., Awaitable[T]]], *args, **kwargs) -> T`
29 - `get_web_ui_port()`
30 - `get_tunnel_api_port()`
31 - `get_platform()`
32 - `is_windows()`
33 - `get_terminal_executable()`
34 - Notable constants/configuration names: `T`, `R`.
35
36 ## Runtime Contracts
37
38 - Helper modules own reusable framework APIs and must preserve public callers unless all callers, tests, and docs are updated together.
39 - Update this file whenever public functions, classes, persistence behavior, path/security assumptions, side effects, or cross-module contracts change.
40 - Observed side-effect areas: filesystem reads, filesystem writes, subprocess/runtime control, settings/state persistence, secret handling, tunnel state.
41 - Imported dependency areas include: `argparse`, `asyncio`, `helpers`, `inspect`, `nest_asyncio`, `pathlib`, `queue`, `secrets`, `sys`, `threading`, `typing`.
42
43 ## Key Concepts
44
45 - Important called helpers/classes observed in the source: `nest_asyncio.apply`, `TypeVar`, `argparse.ArgumentParser`, `parser.add_argument`, `parser.parse_known_args`, `vars`, `is_dockerized`, `dotenv.get_dotenv_value`, `is_development`, `settings.get_settings`, `url.endswith`, `queue.Queue`, `threading.Thread`, `thread.start`, `thread.join`, `thread.is_alive`, `result_queue.get_nowait`, `cast`, `is_windows`, `get_arg`.
46 - Keep request/response, tool, or helper semantics documented here at the same time as source changes.
47
48 ## Work Guidance
49
50 - Preserve public helper APIs used by core code and plugins unless every caller is updated.
51 - Keep path, auth, secret, persistence, network, and subprocess behavior explicit and bounded.
52 - Prefer adding cohesive helper functions here only when behavior is reused across modules.
53
54 ## Verification
55
56 - Run targeted tests for changed helper behavior; run security regressions for auth, filesystem, WebSocket, tunnel, upload, or secret-handling helpers.
57 - Related tests observed by source search:
58 - `tests/test_a0_connector_computer_use_metadata.py`
59 - `tests/test_a0_connector_prompt_gating.py`
60 - `tests/test_browser_agent_regressions.py`
61 - `tests/test_default_prompt_budget.py`
62 - `tests/test_document_query_plugin.py`
63 - `tests/test_host_browser_connector.py`
64 - `tests/test_http_auth_csrf.py`
65 - `tests/test_image_get_security.py`
66
67 ## Child DOX Index
68
69 No child DOX files.