@hheei/pi-ask-user 0.2.0 → 0.3.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/dist/ask-prompt.js +0 -3
- package/dist/batch-prompt.d.ts +1 -1
- package/dist/batch-prompt.js +4 -10
- package/dist/prompt-layout.d.ts +0 -3
- package/dist/prompt-layout.js +0 -4
- package/package.json +1 -1
package/dist/ask-prompt.js
CHANGED
|
@@ -3,7 +3,6 @@ import { INLINE_CONTEXT_MAX_ROWS } from "./constants";
|
|
|
3
3
|
import { MultiSelectList } from "./multi-select-list";
|
|
4
4
|
import { PromptContextPane } from "./prompt-context";
|
|
5
5
|
import { buildHelpText } from "./prompt-help";
|
|
6
|
-
import { railRow } from "./prompt-layout";
|
|
7
6
|
import { createFreeformResponse, createSelectionResponse } from "./response";
|
|
8
7
|
import { WrappedSingleSelectList } from "./single-select-list";
|
|
9
8
|
function editorTheme(theme) {
|
|
@@ -95,11 +94,9 @@ export class AskComponent extends Container {
|
|
|
95
94
|
const fullContextLines = this.contextPane.fullLines(width);
|
|
96
95
|
this.contextPane.setCollapsible(fullContextLines.length > INLINE_CONTEXT_MAX_ROWS);
|
|
97
96
|
return [
|
|
98
|
-
railRow(this.theme, width),
|
|
99
97
|
...this.buildPromptLines(width, fullContextLines),
|
|
100
98
|
"",
|
|
101
99
|
...this.modeContainer.render(width),
|
|
102
|
-
railRow(this.theme, width),
|
|
103
100
|
...this.helpLines(width),
|
|
104
101
|
];
|
|
105
102
|
}
|
package/dist/batch-prompt.d.ts
CHANGED
|
@@ -35,6 +35,6 @@ export declare class BatchAskComponent implements Component {
|
|
|
35
35
|
private unansweredCount;
|
|
36
36
|
private handleReviewInput;
|
|
37
37
|
private renderReview;
|
|
38
|
-
/** Rows the review page may use
|
|
38
|
+
/** Rows the review page may use. */
|
|
39
39
|
private reviewLineCap;
|
|
40
40
|
}
|
package/dist/batch-prompt.js
CHANGED
|
@@ -2,7 +2,7 @@ import { decodeKittyPrintable, Key, matchesKey, wrapTextWithAnsi, } from "@earen
|
|
|
2
2
|
import { AskComponent } from "./ask-prompt";
|
|
3
3
|
import { INLINE_DOCK_RESERVED_ROWS } from "./constants";
|
|
4
4
|
import { formatKeyList } from "./prompt-help";
|
|
5
|
-
import { getMaxRenderLinesForRows
|
|
5
|
+
import { getMaxRenderLinesForRows } from "./prompt-layout";
|
|
6
6
|
import { formatResponseSummary, } from "./response";
|
|
7
7
|
/**
|
|
8
8
|
* One prompt for a whole `questions` batch: a page per question plus a review
|
|
@@ -166,16 +166,10 @@ export class BatchAskComponent {
|
|
|
166
166
|
const footerLines = [...(warning ? wrap(warning) : []), ...wrap(theme.fg("dim", hints))];
|
|
167
167
|
// The title and the footer are fixed; the answers take what is left and are
|
|
168
168
|
// cut from the end, so a short prompt still shows the first ones.
|
|
169
|
-
const budget = Math.max(1, this.reviewLineCap() -
|
|
170
|
-
return [
|
|
171
|
-
railRow(theme, width),
|
|
172
|
-
theme.fg("dim", this.title),
|
|
173
|
-
...answerLines.slice(0, budget),
|
|
174
|
-
...footerLines,
|
|
175
|
-
railRow(theme, width),
|
|
176
|
-
];
|
|
169
|
+
const budget = Math.max(1, this.reviewLineCap() - 1 - footerLines.length);
|
|
170
|
+
return [theme.fg("dim", this.title), ...answerLines.slice(0, budget), ...footerLines];
|
|
177
171
|
}
|
|
178
|
-
/** Rows the review page may use
|
|
172
|
+
/** Rows the review page may use. */
|
|
179
173
|
reviewLineCap() {
|
|
180
174
|
const rows = Number.isFinite(this.tui.terminal.rows) ? Math.floor(this.tui.terminal.rows) : 24;
|
|
181
175
|
// Inline prompts sit in Pi's fullscreen input dock, which clips anything
|
package/dist/prompt-layout.d.ts
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
import type { Theme } from "@earendil-works/pi-coding-agent";
|
|
2
|
-
/** The native separator row: one full-width `─` rule in `borderMuted`. */
|
|
3
|
-
export declare function railRow(theme: Theme, width: number): string;
|
|
4
1
|
/** Rows a prompt may draw for the terminal height: a ratio cap with a usable floor. */
|
|
5
2
|
export declare function getMaxRenderLinesForRows(rows: number): number;
|
package/dist/prompt-layout.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import { ASK_MAX_RENDER_LINES_RATIO, ASK_MIN_RENDER_LINES } from "./constants";
|
|
2
|
-
/** The native separator row: one full-width `─` rule in `borderMuted`. */
|
|
3
|
-
export function railRow(theme, width) {
|
|
4
|
-
return theme.fg("borderMuted", "─".repeat(Math.max(0, width)));
|
|
5
|
-
}
|
|
6
2
|
/** Rows a prompt may draw for the terminal height: a ratio cap with a usable floor. */
|
|
7
3
|
export function getMaxRenderLinesForRows(rows) {
|
|
8
4
|
const normalizedRows = Number.isFinite(rows) ? Math.max(1, Math.floor(rows)) : 24;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hheei/pi-ask-user",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Interactive ask_user tool for pi-coding-agent: one question or 2-4 in one prompt, multiple choice, multi-select, and freeform answers.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|