@luxass/pi-questions 0.1.3 → 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/README.md +2 -0
- package/package.json +9 -4
- package/src/index.ts +5 -3
- package/src/viewport.ts +1 -1
package/README.md
CHANGED
|
@@ -10,6 +10,8 @@ pi install npm:@luxass/pi-questions
|
|
|
10
10
|
|
|
11
11
|
Requires interactive Pi. RPC, JSON, and print modes are not supported. There are no commands or configuration files.
|
|
12
12
|
|
|
13
|
+
In Rex, Pi reports `Waiting for answers` while a questionnaire is open. Pi clears the status when the questionnaire closes. Pi 1.5.0 reports this status only for inline questionnaires.
|
|
14
|
+
|
|
13
15
|
With Herdr's Pi integration installed and loaded, Herdr marks the agent as blocked while a questionnaire is open. The bundled `@luxass/herdr-agent-shared` library adds the sidebar label `Waiting for answers`. Include `state_text` in Herdr's agent sidebar rows to display it. No extra Pi extension is needed. Submission, cancellation, an abort, or an error clears this questionnaire's state and label. Without Herdr, questionnaires work as usual.
|
|
14
16
|
|
|
15
17
|
## Use
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luxass/pi-questions",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Ask structured questions in Pi with tabs, choices, notes, and Markdown previews.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
14
14
|
"url": "https://github.com/luxass/agent-extensions",
|
|
15
|
-
"directory": "packages/pi
|
|
15
|
+
"directory": "packages/pi/questions"
|
|
16
16
|
},
|
|
17
17
|
"files": [
|
|
18
18
|
"src",
|
|
@@ -26,13 +26,17 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@luxass/herdr-agent-shared": "^0.1.0"
|
|
28
28
|
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@earendil-works/pi-coding-agent": "1.6.0",
|
|
31
|
+
"@earendil-works/pi-tui": "1.6.0"
|
|
32
|
+
},
|
|
29
33
|
"peerDependencies": {
|
|
30
34
|
"@earendil-works/pi-coding-agent": "*",
|
|
31
35
|
"@earendil-works/pi-tui": "*",
|
|
32
36
|
"typebox": "*"
|
|
33
37
|
},
|
|
34
38
|
"pi": {
|
|
35
|
-
"image": "https://raw.githubusercontent.com/luxass/agent-extensions/main/packages/pi
|
|
39
|
+
"image": "https://raw.githubusercontent.com/luxass/agent-extensions/main/packages/pi/questions/docs/cover.png",
|
|
36
40
|
"extensions": [
|
|
37
41
|
"./src/index.ts"
|
|
38
42
|
]
|
|
@@ -42,6 +46,7 @@
|
|
|
42
46
|
"lint:fix": "oxlint --fix .",
|
|
43
47
|
"fmt": "oxfmt .",
|
|
44
48
|
"fmt:check": "oxfmt --check .",
|
|
45
|
-
"typecheck": "tsc -p tsconfig.json"
|
|
49
|
+
"typecheck": "tsc -p tsconfig.json",
|
|
50
|
+
"test": "node --test \"test/**/*.test.ts\""
|
|
46
51
|
}
|
|
47
52
|
}
|
package/src/index.ts
CHANGED
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
} from "./questions.ts";
|
|
18
18
|
|
|
19
19
|
const TOOL_NAME = "ask_questions";
|
|
20
|
+
const QUESTION_BLOCKED_STATUS = { kind: "question", message: "Waiting for answers" } as const;
|
|
20
21
|
// Only one questionnaire can own Pi's editor slot. Others stack at the bottom as overlays.
|
|
21
22
|
let inlineInUse = false;
|
|
22
23
|
|
|
@@ -56,15 +57,16 @@ async function showQuestions(
|
|
|
56
57
|
? {
|
|
57
58
|
overlay: true,
|
|
58
59
|
overlayOptions: { width: "100%", maxHeight: "70%", anchor: "bottom-center" },
|
|
60
|
+
blocked: QUESTION_BLOCKED_STATUS,
|
|
59
61
|
}
|
|
60
|
-
: { overlay: false },
|
|
62
|
+
: { overlay: false, blocked: QUESTION_BLOCKED_STATUS },
|
|
61
63
|
);
|
|
62
64
|
let ownsInlineSlot = !inlineInUse;
|
|
63
65
|
if (ownsInlineSlot) inlineInUse = true;
|
|
64
|
-
const releaseLabel = blocked.block(
|
|
66
|
+
const releaseLabel = blocked.block(QUESTION_BLOCKED_STATUS.message);
|
|
65
67
|
try {
|
|
66
68
|
// Herdr's optional Pi integration owns state reporting and counts overlapping blockers.
|
|
67
|
-
pi.events.emit("herdr:blocked", { active: true, label:
|
|
69
|
+
pi.events.emit("herdr:blocked", { active: true, label: QUESTION_BLOCKED_STATUS.message });
|
|
68
70
|
if (ownsInlineSlot) {
|
|
69
71
|
const result = await mount(false);
|
|
70
72
|
if (result) return result;
|
package/src/viewport.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { ScrollView, type Component, type TuiMouseEvent } from "@earendil-works/
|
|
|
4
4
|
export class Viewport extends ScrollView {
|
|
5
5
|
maxHeight = 1;
|
|
6
6
|
totalLines = 0;
|
|
7
|
-
followLine?: (lines: string[]) => number | undefined;
|
|
7
|
+
followLine?: (lines: readonly string[]) => number | undefined;
|
|
8
8
|
private readonly requestRender: () => void;
|
|
9
9
|
|
|
10
10
|
constructor(content: Component, requestRender: () => void) {
|