@juicesharp/rpiv-ask-user-question 2.5.2 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -27,6 +27,8 @@ Nothing to set up — the tool is live as soon as Pi restarts. Hand the model a
27
27
 
28
28
  Rather than picking a strategy on your behalf, the model calls `ask_user_question` and a dialog takes over the bottom of your terminal. Move with `↑`/`↓`, choose with `Enter`, press `n` to attach a note, or land on the `Type something.` row to answer in your own words. While typing, `Shift+Enter` adds a line, `Ctrl+G` opens Pi's configured external editor, and `Ctrl+U` clears the draft; browsing another option and returning keeps what you wrote. `Esc` abandons the questionnaire entirely.
29
29
 
30
+ When the questionnaire begins waiting in an interactive TTY, it emits one standard terminal BEL (`\x07`). Your terminal configuration determines whether that appears as an audible alert, a visual alert, or nothing; redirected and non-TTY output is untouched.
31
+
30
32
  ![Single question in the dialog: the tab strip reads Feature Type, Design Tab, Testing, Release, Submit; the question Which real development task are we planning right now? sits above four numbered options — Bug fix (Recommended), New feature, Refactor, Perf tuning — each with a one-line description, followed by the appended Type something. row](https://raw.githubusercontent.com/juicesharp/rpiv-mono/main/packages/rpiv-ask-user-question/docs/single-question.jpg)
31
33
 
32
34
  When the model asks several things at once, `Tab` moves between them and a Submit tab reviews everything before it goes back:
@@ -61,6 +61,24 @@ const ERROR_SESSION_LOAD_FAILED =
61
61
  const ERROR_STALE_MODULE_CACHE =
62
62
  "Error: the questionnaire UI cannot load — the host's module cache went stale after an earlier failed load (typically dependencies replaced on disk mid-session). This is unrecoverable within the current Pi process. The user never saw the questions — do NOT treat this as a decline. Ask the questions as plain chat text instead, and tell the user to restart Pi to restore this tool.";
63
63
 
64
+ /** Standard terminal bell — same byte rpiv-warp exports as OSC_TERMINATOR. */
65
+ export const BEL = "\x07";
66
+
67
+ /**
68
+ * Emit one portable terminal attention signal without touching redirected output.
69
+ * Writes to stdout rather than rpiv-warp's `/dev/tty` transport: the `isTTY` gate
70
+ * both proves an interactive terminal owns the coming wait and keeps the byte out
71
+ * of piped RPC transports (VS Code pendant, Zed) — a `/dev/tty` write would ring
72
+ * even when the questionnaire renders in a remote host's own UI.
73
+ */
74
+ function emitTerminalAttention(): void {
75
+ try {
76
+ if (process.stdout.isTTY) process.stdout.write(BEL);
77
+ } catch {
78
+ // Terminal attention is best effort; the questionnaire must still proceed.
79
+ }
80
+ }
81
+
64
82
  /** Delay before the background session-graph pre-warm; mirrors rpiv-workflow's /wf prewarm. */
65
83
  export const PREWARM_DELAY_MS = 2000;
66
84
 
@@ -173,6 +191,7 @@ Preview content is rendered as markdown in a monospace box. Multi-line text with
173
191
  if ((ctx as { mode?: string }).mode === "rpc" && hasDialogUI(ctx.ui)) {
174
192
  emitAskUserBlockedEvent(pi, true);
175
193
  try {
194
+ emitTerminalAttention();
176
195
  return buildQuestionnaireResponse(await runRpcQuestionnaire(ctx.ui, typed), typed);
177
196
  } finally {
178
197
  emitAskUserBlockedEvent(pi, false);
@@ -232,6 +251,7 @@ Preview content is rendered as markdown in a monospace box. Multi-line text with
232
251
 
233
252
  emitAskUserBlockedEvent(pi, true);
234
253
  try {
254
+ emitTerminalAttention();
235
255
  const result = await ctx.ui.custom<QuestionnaireResult>(
236
256
  (tui, theme, keybindings, done) => {
237
257
  const session = new QuestionnaireSession({
package/docs/hosts.md CHANGED
@@ -11,6 +11,12 @@ render at all.
11
11
  | RPC / ACP host (VS Code pendant, Zed, Paseo) | `ask_user_question` in its tool list | A sequence of the host's own native select and input dialogs |
12
12
  | Non-interactive run (no UI) | Nothing — the tool is removed | Nothing |
13
13
 
14
+ ### Terminal attention
15
+
16
+ After UI availability and questionnaire validation succeed, the package emits exactly one standard terminal BEL (`\x07`) immediately before the interactive wait begins. The signal is sent to `stdout` only when `process.stdout.isTTY` is true, so redirected output and non-TTY RPC streams stay untouched. A TTY-backed RPC dialog walker receives the same signal as the TUI path.
17
+
18
+ The BEL is best effort: if the synchronous terminal write fails, the questionnaire continues and its existing prompt/blocked lifecycle and result envelope are unchanged. The terminal configuration decides whether the BEL is audible, visual, or ignored. No BEL is emitted for missing UI, invalid questionnaires, or a failed TUI session load.
19
+
14
20
  ### Non-interactive runs
15
21
 
16
22
  A `before_agent_start` hook reconciles the active tool set against `ctx.hasUI` before every
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juicesharp/rpiv-ask-user-question",
3
- "version": "2.5.2",
3
+ "version": "2.6.0",
4
4
  "description": "Pi extension. A structured questionnaire the model can put to you when it would otherwise guess, with typed options instead of free-form replies.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -93,7 +93,7 @@
93
93
  }
94
94
  },
95
95
  "dependencies": {
96
- "@juicesharp/rpiv-config": "^2.5.2",
96
+ "@juicesharp/rpiv-config": "^2.6.0",
97
97
  "typebox": "^1.1.24"
98
98
  }
99
99
  }