@xynogen/pix-ask 0.2.27 → 0.2.28
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/package.json +1 -1
- package/src/helpers.ts +9 -1
- package/src/index.ts +5 -2
package/package.json
CHANGED
package/src/helpers.ts
CHANGED
|
@@ -56,7 +56,15 @@ export function buildResponseText(answers: QuestionAnswer[], questions: Question
|
|
|
56
56
|
if (a.preview) s += `. selected preview: ${a.preview}`;
|
|
57
57
|
segs.push(s);
|
|
58
58
|
}
|
|
59
|
-
|
|
59
|
+
if (!segs.length) return "User declined to answer questions.";
|
|
60
|
+
// Partial close: name the questions left unanswered so the model doesn't
|
|
61
|
+
// assume silence means agreement.
|
|
62
|
+
const answered = new Set(answers.map((a) => a.questionIndex));
|
|
63
|
+
const unanswered = questions
|
|
64
|
+
.map((q, i) => (answered.has(i) ? null : `"${q.question}"`))
|
|
65
|
+
.filter((s): s is string => s !== null);
|
|
66
|
+
const tail = unanswered.length ? ` Unanswered: ${unanswered.join(", ")}.` : "";
|
|
67
|
+
return `User answered: ${segs.join(". ")}.${tail}`;
|
|
60
68
|
}
|
|
61
69
|
|
|
62
70
|
// ── Scroll indicator ───────────────────────────────────────────────────
|
package/src/index.ts
CHANGED
|
@@ -90,7 +90,10 @@ export default function registerAsk(pi: ExtensionAPI): void {
|
|
|
90
90
|
),
|
|
91
91
|
);
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
// Preserve any answers filled before the user closed the modal. cancel()
|
|
94
|
+
// in the questionnaire already passes the partial set; only a truly empty
|
|
95
|
+
// result counts as a full decline.
|
|
96
|
+
if (!result || (result.cancelled && !result.answers.length)) {
|
|
94
97
|
return {
|
|
95
98
|
content: [{ type: "text", text: "User cancelled the questionnaire" }],
|
|
96
99
|
details: result ?? { answers: [], cancelled: true },
|
|
@@ -141,7 +144,7 @@ export default function registerAsk(pi: ExtensionAPI): void {
|
|
|
141
144
|
text.setText(error || "Error");
|
|
142
145
|
return frameToolResult(text, theme, true);
|
|
143
146
|
}
|
|
144
|
-
if (!details
|
|
147
|
+
if (!details?.answers?.length) {
|
|
145
148
|
// Cancellation is a warning outcome, not success — shared row keeps the
|
|
146
149
|
// tool identity and a text label (never color alone) for accessibility.
|
|
147
150
|
text.setText(formatCollapsedToolRow(theme, "ask_user", "", "cancelled", "warning"));
|