trading_agent.terminal.widgets.plan_card
¶
The card for a plan a desk presents for approval (present_plan), as the web page's PlanCard.tsx shows it.
The plan is drawn as Markdown. The user approves it, optionally with notes, or sends it back with feedback, which "Keep planning" requires. The desk does not act on the plan until it is approved.
Keys: 1 or Enter on "Approve" approves, 2 keeps planning, Tab moves to the feedback box and back, Ctrl+X dismisses without deciding. Typing a letter while the choices have the focus goes into the feedback box.
Typical usage example:
card = PlanCard(request, gateway)
PlanCard
¶
Bases: Vertical
A card for approving or revising the desk's plan.
Creates the card.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request
|
dict[str, Any]
|
The pending plan request. |
required |
gateway
|
GatewayClient
|
The gateway, to send the decision. |
required |
Source code in src/trading_agent/terminal/widgets/plan_card.py
Done
¶
Bases: Message
The request was decided or dismissed.
compose
¶
Builds the card.
Yields:
| Type | Description |
|---|---|
Widget
|
The heading, title, plan, choices, feedback box, error and hint. |
Source code in src/trading_agent/terminal/widgets/plan_card.py
focus_card
¶
on_key
¶
Decides with a number key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
Key
|
The key press. |
required |
Source code in src/trading_agent/terminal/widgets/plan_card.py
action_focus_box
¶
Moves to the feedback box, or back to the choices from it.
Source code in src/trading_agent/terminal/widgets/plan_card.py
on_option_list_option_selected
¶
Decides with the selected choice.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
OptionSelected
|
The selection. |
required |
Source code in src/trading_agent/terminal/widgets/plan_card.py
on_input_submitted
¶
Sends the plan back with the feedback when Enter is pressed in the box.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
Submitted
|
The submission. |
required |