main
md 47 lines 2.26 KB
Rendered Raw
1 # chat_create.py DOX
2
3 ## Purpose
4
5 - Own the `chat_create.py` API endpoint.
6 - This module handles chat create requests.
7 - Keep this file-level DOX profile synchronized with `chat_create.py` because this directory is intentionally flat.
8
9 ## Ownership
10
11 - `chat_create.py` owns the runtime implementation.
12 - `chat_create.py.dox.md` owns durable notes about responsibilities, contracts, side effects, and verification for that implementation.
13 - Classes:
14 - `CreateChat` (`ApiHandler`)
15 - `async process(self, input: Input, request: Request) -> Output`
16
17 ## Runtime Contracts
18
19 - HTTP handlers must derive from `helpers.api.ApiHandler`; WebSocket handlers must derive from `helpers.ws.WsHandler`.
20 - Update this file whenever request payloads, authentication or CSRF requirements, response shapes, route side effects, or WebSocket event contracts change.
21 - `CreateChat` is an `ApiHandler`.
22 - `CreateChat` defines `process(...)`.
23 - A newly created chat reconciles its profile after project inheritance, so it
24 never keeps a profile unavailable in the inherited scope.
25 - Observed side-effect areas: filesystem writes, model calls, plugin state, settings/state persistence.
26 - Imported dependency areas include: `agent`, `helpers`, `helpers.api`.
27
28 ## Key Concepts
29
30 - Important called helpers/classes observed in the source: `self.use_context`, `mark_dirty_all`, `guids.generate_id`, `current_context.get_data`, `current_context.get_output_data`, `new_context.set_data`, `new_context.set_output_data`, `is_chat_override_allowed`, `settings.get_settings`, `projects.get_context_project_name`, `projects.reconcile_agent_profile`.
31 - Keep request/response, tool, or helper semantics documented here at the same time as source changes.
32
33 ## Work Guidance
34
35 - Preserve authentication, CSRF, loopback, and API-key checks unless the endpoint contract explicitly changes.
36 - Update frontend callers, plugin callers, and tests together when payload shape changes.
37 - Use `helpers.api.Response` for non-JSON responses, files, redirects, or status-specific replies.
38
39 ## Verification
40
41 - Run endpoint-specific or API/WebSocket tests for changed behavior; smoke-test browser callers when no focused test exists.
42 - Related tests observed by source search:
43 - `tests/test_browser_agent_regressions.py`
44
45 ## Child DOX Index
46
47 No child DOX files.