@juicesharp/rpiv-ask-user-question 0.12.5 → 0.12.7
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 +8 -5
- package/package.json +1 -1
- package/wrapping-select.ts +5 -4
package/README.md
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
# rpiv-ask-user-question
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@juicesharp/rpiv-ask-user-question)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
Let the model ask a structured clarifying question instead of guessing. `rpiv-ask-user-question` adds the `ask_user_question` tool to [Pi Agent](https://github.com/badlogic/pi-mono) — a structured option selector with an optional free-text "Other" fallback.
|
|
6
7
|
|
|
7
8
|

|
|
8
9
|
|
|
9
|
-
##
|
|
10
|
+
## Install
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
```bash
|
|
13
|
+
pi install npm:@juicesharp/rpiv-ask-user-question
|
|
14
|
+
```
|
|
12
15
|
|
|
13
16
|
Then restart your Pi session.
|
|
14
17
|
|
package/package.json
CHANGED
package/wrapping-select.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Component } from "@mariozechner/pi-tui";
|
|
2
|
-
import { visibleWidth, wrapTextWithAnsi } from "@mariozechner/pi-tui";
|
|
2
|
+
import { truncateToWidth, visibleWidth, wrapTextWithAnsi } from "@mariozechner/pi-tui";
|
|
3
3
|
|
|
4
4
|
export interface WrappingSelectItem {
|
|
5
5
|
label: string;
|
|
@@ -127,7 +127,7 @@ export class WrappingSelect implements Component {
|
|
|
127
127
|
const contentWidth = Math.max(WrappingSelect.MIN_CONTENT_WIDTH, width - visibleWidth(rowPrefix));
|
|
128
128
|
|
|
129
129
|
if (this.shouldRenderAsInlineInput(item, isActive)) {
|
|
130
|
-
return [this.renderInlineInputRow(rowPrefix)];
|
|
130
|
+
return [this.renderInlineInputRow(rowPrefix, width)];
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
return [
|
|
@@ -147,8 +147,9 @@ export class WrappingSelect implements Component {
|
|
|
147
147
|
return !!item.isOther && isActive;
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
private renderInlineInputRow(rowPrefix: string): string {
|
|
151
|
-
|
|
150
|
+
private renderInlineInputRow(rowPrefix: string, width: number): string {
|
|
151
|
+
const raw = `${rowPrefix}${this.inputBuffer}${WrappingSelect.INPUT_CURSOR}`;
|
|
152
|
+
return truncateToWidth(this.theme.selectedText(raw), width, "");
|
|
152
153
|
}
|
|
153
154
|
|
|
154
155
|
private renderLabelBlock(
|