trading_agent.terminal.widgets.request_dock
¶
The dock above the message box that holds the desk's pending question, plan or permission request.
It shows one request at a time, permission requests first because they lapse, with "1 of N waiting for you" when more are waiting. The dock never takes the focus by itself: the user presses Tab to answer and Escape to go back, so typing meant for the message box can never answer a request, and Enter can never allow a tool call by accident. A card stays in place while its request is still first, so a half-written answer is not lost when the list is read again.
Typical usage example:
dock = RequestDock(gateway) dock.show(pending_requests)
RequestDock
¶
Bases: VerticalScroll
The request dock; hidden while nothing waits.
Creates the dock, hidden and empty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gateway
|
GatewayClient
|
The gateway, which the cards send answers to. |
required |
Source code in src/trading_agent/terminal/widgets/request_dock.py
Answered
¶
Bases: Message
The shown request was answered, decided or dismissed.
Left
¶
Bases: Message
The user pressed Escape on a card to go back to the message box.
compose
¶
on_mount
¶
shown_request_id
¶
The request the dock shows.
Returns:
| Type | Description |
|---|---|
str | None
|
Its id, or None when the dock is empty. |
focus_card
¶
Puts the focus on the shown card.
Returns:
| Type | Description |
|---|---|
bool
|
True when there is a card to focus. |
show
¶
Shows the first waiting request, permission requests first.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
requests
|
list[dict[str, Any]]
|
The desk's pending requests. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True when a different request is now shown, so the screen can move the focus to it. |
Source code in src/trading_agent/terminal/widgets/request_dock.py
on_question_card_done
¶
Passes on that the questions were answered.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
Done
|
The notice. |
required |
Source code in src/trading_agent/terminal/widgets/request_dock.py
on_plan_card_done
¶
Passes on that the plan was decided.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
Done
|
The notice. |
required |