pi-ask-questions 0.2.0 → 0.2.1

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/CHANGELOG.md CHANGED
@@ -5,6 +5,16 @@ All notable changes to this project are documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.2.1] - 2026-10-15
9
+
10
+ ### Fixed
11
+
12
+ - A background questionnaire (`noWait: true`) that fails to open now reports the failure to the user with an error notification instead of failing silently. The background slot is still released so later calls can open a new questionnaire.
13
+
14
+ ### Documentation
15
+
16
+ - Documented the `pending` shape of `structuredContent`: while a background questionnaire is open, each `answers[]` entry is a stub with an empty `answers` array, so consumers must branch on `pending` before reading answers.
17
+
8
18
  ## [0.2.0] - 2026-10-15
9
19
 
10
20
  ### Changed
package/README.md CHANGED
@@ -132,6 +132,12 @@ Notes: (skipped)
132
132
  | `questions[].otherLabel` | string | Custom label for the typed-answer entry. |
133
133
  | `noWait` | boolean | Show the questionnaire in the background and return immediately (interactive TUI only). The answers arrive as a follow-up message. Only one background questionnaire can be open at a time. |
134
134
 
135
+ ### Structured results
136
+
137
+ `structuredContent` mirrors the answers for codemode scripts: `cancelled`, an optional `pending`, and `answers[]` with `{ id, question, skipped, answers: [{ value, label, custom }] }`.
138
+
139
+ While a background questionnaire is open, `pending` is `true` and each `answers[]` entry is a stub with an empty `answers` array. Branch on `pending` before reading them; the real answers arrive as a follow-up message.
140
+
135
141
  ### Keyboard reference
136
142
 
137
143
  | Keys | Action |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-ask-questions",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Interactive questionnaires for Pi: tabs, multi-select, free-form typing, validation, and structured answers.",
5
5
  "keywords": [
6
6
  "pi-package",
package/src/extension.ts CHANGED
@@ -175,8 +175,19 @@ export default function askQuestionsExtension(pi: ExtensionAPI): void {
175
175
  { triggerTurn: true, deliverAs: "followUp" },
176
176
  );
177
177
  })
178
- .catch(() => {
179
- // The questionnaire could not be shown; there is nothing to deliver.
178
+ .catch((error: unknown) => {
179
+ // The questionnaire could not be shown. The tool result already told
180
+ // the model it was pending, so surface the failure to the user
181
+ // instead of leaving everyone waiting for answers that never come.
182
+ const reason = error instanceof Error ? error.message : String(error);
183
+ try {
184
+ ctx.ui.notify(
185
+ `ask_user could not show the background questionnaire: ${reason}`,
186
+ "error",
187
+ );
188
+ } catch {
189
+ // Reporting is best-effort; the background slot still clears.
190
+ }
180
191
  })
181
192
  .finally(() => {
182
193
  if (backgroundController === controller) {