@juicesharp/rpiv-ask-user-question 1.2.0 → 1.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/ask-user-question.ts +1 -1
- package/index.ts +1 -1
- package/package.json +3 -3
- package/state/build-questionnaire.ts +2 -2
- package/state/key-router.ts +1 -1
- package/state/questionnaire-session.ts +2 -2
- package/view/body-residual-spacer.ts +1 -1
- package/view/components/chat-row-view.ts +1 -1
- package/view/components/multi-select-view.ts +2 -2
- package/view/components/preview/markdown-content-cache.ts +2 -2
- package/view/components/preview/preview-block-renderer.ts +2 -2
- package/view/components/preview/preview-box-renderer.ts +1 -1
- package/view/components/preview/preview-layout-decider.ts +1 -1
- package/view/components/preview/preview-pane.ts +1 -1
- package/view/components/submit-picker.ts +2 -2
- package/view/components/tab-bar.ts +2 -2
- package/view/components/wrapping-select.ts +21 -6
- package/view/dialog-builder.ts +2 -2
- package/view/props-adapter.ts +1 -1
- package/view/stateful-view.ts +1 -1
- package/view/tab-content-strategy.ts +2 -2
package/ask-user-question.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExtensionAPI } from "@
|
|
1
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import { displayLabel } from "./state/i18n-bridge.js";
|
|
3
3
|
import { QuestionnaireSession } from "./state/questionnaire-session.js";
|
|
4
4
|
import { sentinelsToAppend } from "./state/row-intent.js";
|
package/index.ts
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
import { readFileSync } from "node:fs";
|
|
19
19
|
import { fileURLToPath } from "node:url";
|
|
20
|
-
import type { ExtensionAPI } from "@
|
|
20
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
21
21
|
import { registerAskUserQuestionTool } from "./ask-user-question.js";
|
|
22
22
|
import { I18N_NAMESPACE } from "./state/i18n-bridge.js";
|
|
23
23
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juicesharp/rpiv-ask-user-question",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Pi extension. A structured questionnaire the model can put to you when it would otherwise guess, with typed options instead of free-form replies.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|
|
@@ -72,8 +72,8 @@
|
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
74
|
"@juicesharp/rpiv-i18n": "*",
|
|
75
|
-
"@
|
|
76
|
-
"@
|
|
75
|
+
"@earendil-works/pi-coding-agent": "*",
|
|
76
|
+
"@earendil-works/pi-tui": "*",
|
|
77
77
|
"typebox": "*"
|
|
78
78
|
},
|
|
79
79
|
"peerDependenciesMeta": {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getMarkdownTheme, type Theme } from "@
|
|
2
|
-
import { Input } from "@
|
|
1
|
+
import { getMarkdownTheme, type Theme } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import { Input } from "@earendil-works/pi-tui";
|
|
3
3
|
import type { QuestionData } from "../tool/types.js";
|
|
4
4
|
import {
|
|
5
5
|
type BoundGlobalBinding,
|
package/state/key-router.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Key, matchesKey } from "@
|
|
1
|
+
import { Key, matchesKey } from "@earendil-works/pi-tui";
|
|
2
2
|
import type { QuestionAnswer } from "../tool/types.js";
|
|
3
3
|
import { ROW_INTENT_META } from "./row-intent.js";
|
|
4
4
|
import type { QuestionnaireRuntime, QuestionnaireState } from "./state.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Theme } from "@
|
|
2
|
-
import { getKeybindings, type Input } from "@
|
|
1
|
+
import type { Theme } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import { getKeybindings, type Input } from "@earendil-works/pi-tui";
|
|
3
3
|
import type { QuestionData, QuestionnaireResult, QuestionParams } from "../tool/types.js";
|
|
4
4
|
import type { WrappingSelectItem } from "../view/components/wrapping-select.js";
|
|
5
5
|
import type { QuestionnairePropsAdapter } from "../view/props-adapter.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Component } from "@
|
|
1
|
+
import type { Component } from "@earendil-works/pi-tui";
|
|
2
2
|
import type { StatefulView } from "../stateful-view.js";
|
|
3
3
|
import { WrappingSelect, type WrappingSelectItem, type WrappingSelectTheme } from "./wrapping-select.js";
|
|
4
4
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Theme } from "@
|
|
2
|
-
import { truncateToWidth, visibleWidth, wrapTextWithAnsi } from "@
|
|
1
|
+
import type { Theme } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import { truncateToWidth, visibleWidth, wrapTextWithAnsi } from "@earendil-works/pi-tui";
|
|
3
3
|
import { displayLabel } from "../../state/i18n-bridge.js";
|
|
4
4
|
import type { QuestionData } from "../../tool/types.js";
|
|
5
5
|
import type { StatefulView } from "../stateful-view.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Theme } from "@
|
|
2
|
-
import { Markdown, type MarkdownTheme, visibleWidth } from "@
|
|
1
|
+
import type { Theme } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import { Markdown, type MarkdownTheme, visibleWidth } from "@earendil-works/pi-tui";
|
|
3
3
|
import { t } from "../../../state/i18n-bridge.js";
|
|
4
4
|
import type { QuestionData } from "../../../tool/types.js";
|
|
5
5
|
import { stripFenceMarkers } from "./preview-box-renderer.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Theme } from "@
|
|
2
|
-
import type { MarkdownTheme } from "@
|
|
1
|
+
import type { Theme } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import type { MarkdownTheme } from "@earendil-works/pi-tui";
|
|
3
3
|
import { t } from "../../../state/i18n-bridge.js";
|
|
4
4
|
import type { QuestionData } from "../../../tool/types.js";
|
|
5
5
|
import {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { visibleWidth } from "@
|
|
1
|
+
import { visibleWidth } from "@earendil-works/pi-tui";
|
|
2
2
|
import type { QuestionData } from "../../../tool/types.js";
|
|
3
3
|
import type { WrappingSelectItem } from "../wrapping-select.js";
|
|
4
4
|
import { BORDER_HORIZONTAL_OVERHEAD, BORDER_INNER_PADDING_HORIZONTAL } from "./preview-box-renderer.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Component, truncateToWidth, visibleWidth } from "@
|
|
1
|
+
import { type Component, truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
|
|
2
2
|
import type { QuestionData } from "../../../tool/types.js";
|
|
3
3
|
import type { StatefulView } from "../../stateful-view.js";
|
|
4
4
|
import type { OptionListView } from "../option-list-view.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Theme } from "@
|
|
2
|
-
import { truncateToWidth } from "@
|
|
1
|
+
import type { Theme } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import { truncateToWidth } from "@earendil-works/pi-tui";
|
|
3
3
|
import { t } from "../../state/i18n-bridge.js";
|
|
4
4
|
import type { StatefulView } from "../stateful-view.js";
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Theme } from "@
|
|
2
|
-
import { truncateToWidth } from "@
|
|
1
|
+
import type { Theme } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import { truncateToWidth } from "@earendil-works/pi-tui";
|
|
3
3
|
import type { StatefulView } from "../stateful-view.js";
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Component } from "@
|
|
2
|
-
import {
|
|
1
|
+
import type { Component } from "@earendil-works/pi-tui";
|
|
2
|
+
import { visibleWidth, wrapTextWithAnsi } from "@earendil-works/pi-tui";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Row-intent discriminated union. `kind` is the single discriminator —
|
|
@@ -173,7 +173,7 @@ export class WrappingSelect implements Component {
|
|
|
173
173
|
const contentWidth = Math.max(WrappingSelect.MIN_CONTENT_WIDTH, width - visibleWidth(rowPrefix));
|
|
174
174
|
|
|
175
175
|
if (this.shouldRenderAsInlineInput(item, isActive)) {
|
|
176
|
-
return
|
|
176
|
+
return this.renderInlineInputRow(rowPrefix, continuationPrefix, contentWidth);
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
// Confirmed row gets a trailing ` ✔` and accent+bold styling; pointer is independent
|
|
@@ -205,9 +205,24 @@ export class WrappingSelect implements Component {
|
|
|
205
205
|
return item.kind === "other" && isActive;
|
|
206
206
|
}
|
|
207
207
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
208
|
+
/**
|
|
209
|
+
* Render the inline input row across one or more lines, wrapping at `contentWidth`
|
|
210
|
+
* so long input doesn't run off the right edge or trip the parent renderer's
|
|
211
|
+
* width invariant. Mirrors `renderLabelBlock`'s contract: first line carries
|
|
212
|
+
* `rowPrefix`, continuation lines carry `continuationPrefix` (spaces), and every
|
|
213
|
+
* emitted line passes through `theme.selectedText`. The trailing cursor glyph
|
|
214
|
+
* `▌` is appended to the buffer pre-wrap so it lands at the visual end of the
|
|
215
|
+
* input — `Input` only exposes `getValue()` (cursor offset is private), so
|
|
216
|
+
* cursor-mid-string is intentionally not rendered here; that would require
|
|
217
|
+
* either an `Input.getCursorOffset()` API or delegating to `Input.render`.
|
|
218
|
+
*/
|
|
219
|
+
private renderInlineInputRow(rowPrefix: string, continuationPrefix: string, contentWidth: number): string[] {
|
|
220
|
+
const raw = `${this.inputBuffer}${WrappingSelect.INPUT_CURSOR}`;
|
|
221
|
+
const wrapped = wrapTextWithAnsi(raw, contentWidth);
|
|
222
|
+
return wrapped.map((segment, index) => {
|
|
223
|
+
const prefix = index === 0 ? rowPrefix : continuationPrefix;
|
|
224
|
+
return this.theme.selectedText(`${prefix}${segment}`);
|
|
225
|
+
});
|
|
211
226
|
}
|
|
212
227
|
|
|
213
228
|
private renderLabelBlock(
|
package/view/dialog-builder.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DynamicBorder, type Theme } from "@
|
|
2
|
-
import { type Component, Container, type Input, Spacer } from "@
|
|
1
|
+
import { DynamicBorder, type Theme } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import { type Component, Container, type Input, Spacer } from "@earendil-works/pi-tui";
|
|
3
3
|
import type { QuestionnaireState } from "../state/state.js";
|
|
4
4
|
import type { QuestionData } from "../tool/types.js";
|
|
5
5
|
import { BodyResidualSpacer } from "./body-residual-spacer.js";
|
package/view/props-adapter.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Input } from "@
|
|
1
|
+
import type { Input } from "@earendil-works/pi-tui";
|
|
2
2
|
import type { BindingContext, PerTabBindingContext } from "../state/selectors/contract.js";
|
|
3
3
|
import { selectActivePreviewPaneIndex } from "../state/selectors/derivations.js";
|
|
4
4
|
import { selectActiveView } from "../state/selectors/focus.js";
|
package/view/stateful-view.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Theme } from "@
|
|
2
|
-
import { type Component, Container, type Input, Spacer, Text } from "@
|
|
1
|
+
import type { Theme } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import { type Component, Container, type Input, Spacer, Text } from "@earendil-works/pi-tui";
|
|
3
3
|
import { t } from "../state/i18n-bridge.js";
|
|
4
4
|
import { formatAnswerScalar } from "../tool/format-answer.js";
|
|
5
5
|
import type { QuestionData } from "../tool/types.js";
|