Add configuration support for TUI input presets (#54379)

## What changed

Add `tui.presets` entries keyed by a single digit from `0` to `9`, each with an `input` prompt or slash command and an optional `label`. Expose presets in the configuration schema, load them into runtime configuration, and preserve them in TUI local settings.

Reject invalid slots, blank inputs, shell commands beginning with `!` after leading whitespace, and inputs exceeding 8,000 UTF-8 bytes.

## Testing

Extend the runtime configuration test to verify loading both a slash command with a label and a prompt without one.

GitOrigin-RevId: d2911e540bc50f05b4a5224abf17ce4ef5a18ea3
This commit is contained in:
Felipe Coury
2026-10-15 19:01:43 +00:00
committed by copyberry
parent 0884c8047a
commit 1544ffc79d
6 changed files with 110 additions and 0 deletions
+26
View File
@@ -3767,6 +3767,24 @@
},
"type": "object"
},
"Preset": {
"additionalProperties": false,
"description": "One reusable prompt or slash command submitted through the TUI composer.",
"properties": {
"input": {
"description": "Plain-text input, limited to 8,000 UTF-8 bytes.",
"type": "string"
},
"label": {
"description": "Optional short name for the picker and shortcut hints.",
"type": "string"
}
},
"required": [
"input"
],
"type": "object"
},
"ProfileTui": {
"additionalProperties": false,
"description": "TUI settings supported inside a named profile.",
@@ -4963,6 +4981,14 @@
"default": "composer",
"description": "Where the terminal pet should anchor vertically.\n\nDefaults to `composer`, which follows the current TUI composer viewport."
},
"presets": {
"additionalProperties": {
"$ref": "#/definitions/Preset"
},
"default": {},
"description": "Saved inputs keyed by a single digit (`0` through `9`).",
"type": "object"
},
"question_esc_back": {
"default": true,
"description": "Escape returns from async questions to the composer, preserving the answer draft.",