mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
feat(coding-agent): let ctx.ui.custom() overlays report blocked program status (#11851)
Closes #11816. ## Problem `ctx.ui.custom()` accepted `blocked` only for inline components. Overlays ignored it, so an extension question shown as an overlay left pi reporting `working` over OSC 7501. Example: pi-ask-user in its default overlay mode inside Herdr App never shows the session as blocked and never notifies. ## Change - Each overlay opened with `blocked` registers its own program status source (`extension-overlay:N`) after `showOverlay()` and clears it when the overlay calls `done()`. - The status stays while the overlay is hidden with `setHidden()` or covered by another overlay: the question is still unanswered. - Separate sources per overlay, so closing one keeps other open questions, dialogs and login prompts blocked. With several blocking prompts, the most recently shown one supplies `kind` and `message`. - Overlays without `blocked` (loaders etc.) register nothing and cannot clear another overlay's status. - `/reload` and session switches drop overlays without calling `done()`; `resetExtensionUI()` now clears their blocked status so pi does not stay blocked. - Inline components are unchanged: they report the dialog shown in the editor slot, so a non-blocking component shown in its place clears the status until it closes. - Docs (`docs/tui.md`, `custom()` JSDoc) and changelog updated. ## Testing - `npm run check` - `test/interactive-mode-extension-dialogs.test.ts`: new regression test (two blocking overlays, one non-blocking overlay, hide, close in order) and one for clearing the status on reset. pi-ask-user still needs to pass `blocked` for its overlay prompts.
This commit is contained in:
parent
36142c1c7e
commit
7f47a2ed09
5 changed files with 129 additions and 5 deletions
|
|
@ -135,7 +135,7 @@ export default function (pi: ExtensionAPI) {
|
|||
|
||||
This component does not display a text cursor, so it does not need `Focusable`. A component containing `Input` or `Editor` must implement `Focusable` and propagate its `focused` value to that child.
|
||||
|
||||
Custom components do not report pi as waiting for the user, because `ctx.ui.custom()` also hosts loaders and other non-blocking UI. When an inline component waits for an answer, pass `blocked: { kind: "question", message: "Pick a color" }` so terminals that support [program status](terminal-setup.md#program-status) show pi as blocked while the component is visible. `kind` is `"question"`, `"permission"`, or `"auth"`. Overlays ignore this option.
|
||||
Custom components do not report pi as waiting for the user, because `ctx.ui.custom()` also hosts loaders and other non-blocking UI. When a component waits for an answer, pass `blocked: { kind: "question", message: "Pick a color" }` so terminals that support [program status](terminal-setup.md#program-status) show pi as blocked. `kind` is `"question"`, `"permission"`, or `"auth"`. An inline component reports blocked while it is visible: a newer dialog or component shown in its place reports its own status instead. An overlay reports blocked from when it is shown until it calls `done()`, also while it is hidden with `setHidden()` or covered by another overlay. When several blocking prompts are open, the most recently shown one supplies `kind` and `message`.
|
||||
|
||||
Pass `overlay: true` to draw above existing content. Overlay options control size, anchors, offsets, margins, and responsive visibility. An overlay handle can change focus or temporarily hide and show the overlay with `setHidden()` while the interaction remains active.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue