refactor: consolidate chat state and task bridges
Centralize session scope, chat projections and typed task bridges. Keep historical interaction replies authoritative and publish terminal state to subscribers. Validate Server contracts before replacing generated artifacts.
This commit is contained in:
@@ -67,3 +67,13 @@ business task.
|
||||
Running text additions use `POST /api/v1/responses` with stream=false, conversation, `tjwater.delivery="steer" | "queue"` and a stable tjwater.input_id. HTTP 202/tjwater.response_input is an inbox receipt, not execution completion. The existing SSE connection carries tjwater.user_input pending/delivered states; delivered means the native inbox took the input. `GET /api/v1/session/:session_id/inputs` lists pending input; PATCH of its /:input_id delivery can change its mode before processing and returns 409 afterward. Restored session streams retain these semantics.
|
||||
|
||||
A pending host question or failed continuation does not disable input admission. With no active host turn, steer/queue messages enter the native inbox with resume=false and remain available for the next owned continuation. This does not answer a host question or launch inference. A lost delivery acknowledgement can be reconciled only after verifying both native consumption and completed related output. HTTP 409 with code RESPONSE_FINISHED means the input was rejected before admission because the turn has ended; the client may refresh state and send it as a new response. Other failures do not authorize automatic resubmission.
|
||||
|
||||
## Chat state projections
|
||||
|
||||
`src/routes/chat-run-accumulator.ts` consumes native and host events before publishing them.
|
||||
Permission replies (including `permission_response` with `status="error"` and `error`),
|
||||
question reconciliation and abort must use `publishRunEvent`, rather than mutate legacy messages.
|
||||
Canonical parts are the saved history; reconnect compatibility fields are projections of the same events.
|
||||
`data-run_status` retains completed, waiting_input, error or aborted state for reloads. Host-confirmed
|
||||
interaction updates may update stored parts after a response has finished without reopening its wire stream.
|
||||
UI, redacted transcript and native execution history retain their separate purposes and retention rules.
|
||||
|
||||
Reference in New Issue
Block a user