trading_agent.terminal.widgets.permission_card
¶
The card for a tool call that needs the user's permission, as the web page's PermissionCard.tsx and Claude Code show it.
The card names the tool and its arguments and counts down to the moment the request lapses. The choices are Yes (once), Yes and don't ask again for this tool on this desk (until revoked on the Settings screen), and No with an optional reason that goes to the desk.
Keys: Up and Down move, Enter or 1 to 3 decides, Tab moves to the reason box and back. Typing a letter while the choices have the focus goes into the reason box, so a reason being typed can never be lost and Enter can never pick Yes in its place.
Typical usage example:
card = PermissionCard(request, gateway)
PermissionCard
¶
Bases: Vertical
A card for allowing or denying one tool call.
Creates the card.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request
|
dict[str, Any]
|
The pending permission request. |
required |
gateway
|
GatewayClient
|
The gateway, to send the decision. |
required |
Source code in src/trading_agent/terminal/widgets/permission_card.py
Done
¶
Bases: Message
The request was decided.
compose
¶
Builds the card.
Yields:
| Type | Description |
|---|---|
Widget
|
The heading with the countdown, the tool and its arguments, the choices, the reason box, the error and the hint. |
Source code in src/trading_agent/terminal/widgets/permission_card.py
on_mount
¶
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/permission_card.py
action_focus_box
¶
Moves to the reason box, or back to the choices from it.
Source code in src/trading_agent/terminal/widgets/permission_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/permission_card.py
on_input_submitted
¶
Denies with the typed reason when Enter is pressed in the box.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
Submitted
|
The submission. |
required |