@juicesharp/rpiv-ask-user-question 2.13.8 → 2.13.9

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.
Files changed (44) hide show
  1. package/answer-channel.ts +109 -0
  2. package/ask-user-question.ts +117 -71
  3. package/docs/hosts.md +2 -0
  4. package/docs/keyboard.md +3 -1
  5. package/docs/startup-performance.md +83 -0
  6. package/docs/tool-schema.md +74 -5
  7. package/events.ts +84 -0
  8. package/index.ts +10 -4
  9. package/package.json +4 -2
  10. package/presentation.ts +1 -1
  11. package/reconcile.ts +1 -1
  12. package/rpc-fallback.ts +5 -4
  13. package/state/build-questionnaire.ts +19 -19
  14. package/state/i18n-bridge.ts +1 -1
  15. package/state/key-router.ts +7 -4
  16. package/state/questionnaire-session.ts +10 -10
  17. package/state/row-intent.ts +2 -2
  18. package/state/selectors/contract.ts +6 -6
  19. package/state/selectors/derivations.ts +2 -2
  20. package/state/selectors/focus.ts +1 -1
  21. package/state/selectors/projections.ts +9 -9
  22. package/state/state-reducer.ts +5 -5
  23. package/state/state.ts +2 -2
  24. package/tool/external-answer.ts +125 -0
  25. package/tool/format-answer.ts +1 -1
  26. package/tool/normalize-params.ts +1 -1
  27. package/tool/response-envelope.ts +2 -2
  28. package/tool/types.ts +1 -1
  29. package/tool/validate-questionnaire.ts +1 -1
  30. package/view/component-binding.ts +4 -4
  31. package/view/components/multi-select-view.ts +4 -4
  32. package/view/components/option-list-view.ts +2 -2
  33. package/view/components/preview/markdown-content-cache.ts +3 -3
  34. package/view/components/preview/preview-block-renderer.ts +5 -5
  35. package/view/components/preview/preview-layout-decider.ts +3 -3
  36. package/view/components/preview/preview-pane.ts +10 -10
  37. package/view/components/submit-picker.ts +2 -2
  38. package/view/components/tab-bar.ts +1 -1
  39. package/view/components/wrapping-select.ts +1 -1
  40. package/view/dialog-builder.ts +9 -9
  41. package/view/dialog-copy.ts +1 -1
  42. package/view/props-adapter.ts +8 -8
  43. package/view/tab-components.ts +4 -4
  44. package/view/tab-content-strategy.ts +10 -10
@@ -1,8 +1,8 @@
1
1
  import type { Theme } from "@earendil-works/pi-coding-agent";
2
2
  import { Markdown, type MarkdownTheme, visibleWidth } from "@earendil-works/pi-tui";
3
- import { t } from "../../../state/i18n-bridge.js";
4
- import type { QuestionData } from "../../../tool/types.js";
5
- import { stripFenceMarkers } from "./preview-box-renderer.js";
3
+ import { t } from "../../../state/i18n-bridge.ts";
4
+ import type { QuestionData } from "../../../tool/types.ts";
5
+ import { stripFenceMarkers } from "./preview-box-renderer.ts";
6
6
 
7
7
  /** CC parity in side-by-side layout. */
8
8
  export const MAX_PREVIEW_HEIGHT_SIDE_BY_SIDE = 20;
@@ -1,21 +1,21 @@
1
1
  import type { Theme } from "@earendil-works/pi-coding-agent";
2
2
  import type { MarkdownTheme } from "@earendil-works/pi-tui";
3
- import { t } from "../../../state/i18n-bridge.js";
4
- import type { QuestionData } from "../../../tool/types.js";
3
+ import { t } from "../../../state/i18n-bridge.ts";
4
+ import type { QuestionData } from "../../../tool/types.ts";
5
5
  import {
6
6
  MAX_PREVIEW_HEIGHT_SIDE_BY_SIDE,
7
7
  MAX_PREVIEW_HEIGHT_STACKED,
8
8
  MarkdownContentCache,
9
9
  NOTES_AFFORDANCE_OVERHEAD,
10
- } from "./markdown-content-cache.js";
10
+ } from "./markdown-content-cache.ts";
11
11
  import {
12
12
  BORDER_HORIZONTAL_OVERHEAD,
13
13
  BORDER_INNER_PADDING_HORIZONTAL,
14
14
  BORDER_VERTICAL_OVERHEAD,
15
15
  computeBoxDimensions,
16
16
  renderBorderedBox,
17
- } from "./preview-box-renderer.js";
18
- import type { PreviewLayoutMode } from "./preview-layout-decider.js";
17
+ } from "./preview-box-renderer.ts";
18
+ import type { PreviewLayoutMode } from "./preview-layout-decider.ts";
19
19
 
20
20
  /**
21
21
  * Affordance text shown below the bordered preview when focused on a preview-bearing option.
@@ -1,7 +1,7 @@
1
1
  import { visibleWidth } from "@earendil-works/pi-tui";
2
- import type { QuestionData } from "../../../tool/types.js";
3
- import type { WrappingSelectItem } from "../wrapping-select.js";
4
- import { BORDER_HORIZONTAL_OVERHEAD, BORDER_INNER_PADDING_HORIZONTAL } from "./preview-box-renderer.js";
2
+ import type { QuestionData } from "../../../tool/types.ts";
3
+ import type { WrappingSelectItem } from "../wrapping-select.ts";
4
+ import { BORDER_HORIZONTAL_OVERHEAD, BORDER_INNER_PADDING_HORIZONTAL } from "./preview-box-renderer.ts";
5
5
 
6
6
  /** Min terminal/pane width for the side-by-side layout to engage. */
7
7
  export const PREVIEW_MIN_WIDTH = 100;
@@ -1,10 +1,10 @@
1
1
  import type { Theme } from "@earendil-works/pi-coding-agent";
2
2
  import { type Component, truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
3
- import type { QuestionData } from "../../../tool/types.js";
4
- import { windowLines } from "../../scroll-window.js";
5
- import type { StatefulView } from "../../stateful-view.js";
6
- import type { OptionListView } from "../option-list-view.js";
7
- import type { NotesAffordance, PreviewBlockRenderer } from "./preview-block-renderer.js";
3
+ import type { QuestionData } from "../../../tool/types.ts";
4
+ import { windowLines } from "../../scroll-window.ts";
5
+ import type { StatefulView } from "../../stateful-view.ts";
6
+ import type { OptionListView } from "../option-list-view.ts";
7
+ import type { NotesAffordance, PreviewBlockRenderer } from "./preview-block-renderer.ts";
8
8
  import {
9
9
  bodyWidths,
10
10
  columnWidths,
@@ -12,7 +12,7 @@ import {
12
12
  PREVIEW_PADDING_LEFT,
13
13
  type PreviewLayoutMode,
14
14
  STACKED_GAP_ROWS,
15
- } from "./preview-layout-decider.js";
15
+ } from "./preview-layout-decider.ts";
16
16
 
17
17
  /** Smallest preview box worth showing: top border, one content line, bottom border. */
18
18
  const MIN_BOX_ROWS = 3;
@@ -23,8 +23,8 @@ export {
23
23
  MAX_PREVIEW_HEIGHT_STACKED,
24
24
  NO_PREVIEW_TEXT,
25
25
  NOTES_AFFORDANCE_OVERHEAD,
26
- } from "./markdown-content-cache.js";
27
- export { NOTES_AFFORDANCE_TEXT, NOTES_EDIT_AFFORDANCE_TEXT, PreviewBlockRenderer } from "./preview-block-renderer.js";
26
+ } from "./markdown-content-cache.ts";
27
+ export { NOTES_AFFORDANCE_TEXT, NOTES_EDIT_AFFORDANCE_TEXT, PreviewBlockRenderer } from "./preview-block-renderer.ts";
28
28
  export {
29
29
  BORDER_HORIZONTAL_OVERHEAD,
30
30
  BORDER_INNER_PADDING_HORIZONTAL,
@@ -32,13 +32,13 @@ export {
32
32
  BOX_MIN_CONTENT_WIDTH,
33
33
  renderBorderedBox,
34
34
  stripFenceMarkers,
35
- } from "./preview-box-renderer.js";
35
+ } from "./preview-box-renderer.ts";
36
36
  export {
37
37
  PREVIEW_COLUMN_GAP,
38
38
  PREVIEW_MIN_WIDTH,
39
39
  PREVIEW_PADDING_LEFT,
40
40
  STACKED_GAP_ROWS,
41
- } from "./preview-layout-decider.js";
41
+ } from "./preview-layout-decider.ts";
42
42
 
43
43
  /**
44
44
  * Per-tick projection of PreviewPane state. Replaces the prior
@@ -1,7 +1,7 @@
1
1
  import type { Theme } from "@earendil-works/pi-coding-agent";
2
2
  import { truncateToWidth } from "@earendil-works/pi-tui";
3
- import { t } from "../../state/i18n-bridge.js";
4
- import type { StatefulView } from "../stateful-view.js";
3
+ import { t } from "../../state/i18n-bridge.ts";
4
+ import type { StatefulView } from "../stateful-view.ts";
5
5
 
6
6
  const ACTIVE_POINTER = "❯ ";
7
7
  const INACTIVE_POINTER = " ";
@@ -1,6 +1,6 @@
1
1
  import type { Theme } from "@earendil-works/pi-coding-agent";
2
2
  import { truncateToWidth } from "@earendil-works/pi-tui";
3
- import type { StatefulView } from "../stateful-view.js";
3
+ import type { StatefulView } from "../stateful-view.ts";
4
4
 
5
5
  /**
6
6
  * Per-tick projection of TabBar state. The selector
@@ -1,6 +1,6 @@
1
1
  import type { Component } from "@earendil-works/pi-tui";
2
2
  import { visibleWidth, wrapTextWithAnsi } from "@earendil-works/pi-tui";
3
- import { renderInlineInputRow } from "./inline-input.js";
3
+ import { renderInlineInputRow } from "./inline-input.ts";
4
4
 
5
5
  /**
6
6
  * Row-intent discriminated union. `kind` is the single discriminator —
@@ -1,13 +1,13 @@
1
1
  import { DynamicBorder, type Theme } from "@earendil-works/pi-coding-agent";
2
2
  import { type Component, Container, type Editor, Spacer } from "@earendil-works/pi-tui";
3
- import type { QuestionnaireState } from "../state/state.js";
4
- import type { QuestionData } from "../tool/types.js";
5
- import type { PreviewPaneProps } from "./components/preview/preview-pane.js";
6
- import type { TabBar } from "./components/tab-bar.js";
7
- import { computeScrollStart, decorateOverflow } from "./scroll-window.js";
8
- import type { StatefulView } from "./stateful-view.js";
9
- import type { TabComponents } from "./tab-components.js";
10
- import { QuestionTabStrategy, SubmitTabStrategy, type TabContentStrategy } from "./tab-content-strategy.js";
3
+ import type { QuestionnaireState } from "../state/state.ts";
4
+ import type { QuestionData } from "../tool/types.ts";
5
+ import type { PreviewPaneProps } from "./components/preview/preview-pane.ts";
6
+ import type { TabBar } from "./components/tab-bar.ts";
7
+ import { computeScrollStart, decorateOverflow } from "./scroll-window.ts";
8
+ import type { StatefulView } from "./stateful-view.ts";
9
+ import type { TabComponents } from "./tab-components.ts";
10
+ import { QuestionTabStrategy, SubmitTabStrategy, type TabContentStrategy } from "./tab-content-strategy.ts";
11
11
 
12
12
  export {
13
13
  COLLAPSED_HINT_TEMPLATE,
@@ -28,7 +28,7 @@ export {
28
28
  KEY_PLACEHOLDER,
29
29
  READY_PROMPT,
30
30
  REVIEW_HEADING,
31
- } from "./dialog-copy.js";
31
+ } from "./dialog-copy.ts";
32
32
 
33
33
  /**
34
34
  * Rows the scroll window must keep for the body before the heading (header badge +
@@ -1,4 +1,4 @@
1
- import { DEFAULT_COLLAPSE_KEY, formatKeySpecForDisplay } from "../config.js";
1
+ import { DEFAULT_COLLAPSE_KEY, formatKeySpecForDisplay } from "../config.ts";
2
2
 
3
3
  /** Leaf: imports nothing from `view/`, so `dialog-builder` and `tab-content-strategy` never form a runtime cycle (#208). */
4
4
 
@@ -1,12 +1,12 @@
1
1
  import type { Editor } from "@earendil-works/pi-tui";
2
- import type { BindingContext, PerTabBindingContext } from "../state/selectors/contract.js";
3
- import { selectActivePreviewPaneIndex } from "../state/selectors/derivations.js";
4
- import { selectActiveView } from "../state/selectors/focus.js";
5
- import type { QuestionnaireState } from "../state/state.js";
6
- import type { QuestionData } from "../tool/types.js";
7
- import type { BoundGlobalBinding, BoundPerTabBinding } from "./component-binding.js";
8
- import type { WrappingSelectItem } from "./components/wrapping-select.js";
9
- import type { TabComponents } from "./tab-components.js";
2
+ import type { BindingContext, PerTabBindingContext } from "../state/selectors/contract.ts";
3
+ import { selectActivePreviewPaneIndex } from "../state/selectors/derivations.ts";
4
+ import { selectActiveView } from "../state/selectors/focus.ts";
5
+ import type { QuestionnaireState } from "../state/state.ts";
6
+ import type { QuestionData } from "../tool/types.ts";
7
+ import type { BoundGlobalBinding, BoundPerTabBinding } from "./component-binding.ts";
8
+ import type { WrappingSelectItem } from "./components/wrapping-select.ts";
9
+ import type { TabComponents } from "./tab-components.ts";
10
10
 
11
11
  /** Cache-invalidation contract used by the adapter. `pi-tui` `Component` already satisfies it. */
12
12
  interface Invalidatable {
@@ -1,7 +1,7 @@
1
- import type { MultiSelectView } from "./components/multi-select-view.js";
2
- import type { OptionListViewProps } from "./components/option-list-view.js";
3
- import type { PreviewPane } from "./components/preview/preview-pane.js";
4
- import type { StatefulView } from "./stateful-view.js";
1
+ import type { MultiSelectView } from "./components/multi-select-view.ts";
2
+ import type { OptionListViewProps } from "./components/option-list-view.ts";
3
+ import type { PreviewPane } from "./components/preview/preview-pane.ts";
4
+ import type { StatefulView } from "./stateful-view.ts";
5
5
 
6
6
  export interface TabBodyHeights {
7
7
  current: number;
@@ -1,12 +1,12 @@
1
1
  import type { Theme } from "@earendil-works/pi-coding-agent";
2
2
  import { type Component, Container, type Editor, Spacer, Text, truncateToWidth } from "@earendil-works/pi-tui";
3
- import { COLLAPSE_KEY_OFF, formatKeySpecForDisplay } from "../config.js";
4
- import { t } from "../state/i18n-bridge.js";
5
- import { selectSavedNote } from "../state/selectors/derivations.js";
6
- import { formatAnswerScalar } from "../tool/format-answer.js";
7
- import type { QuestionData } from "../tool/types.js";
8
- import type { PreviewPane, PreviewPaneProps } from "./components/preview/preview-pane.js";
9
- import type { DialogState } from "./dialog-builder.js";
3
+ import { COLLAPSE_KEY_OFF, formatKeySpecForDisplay } from "../config.ts";
4
+ import { t } from "../state/i18n-bridge.ts";
5
+ import { selectSavedNote } from "../state/selectors/derivations.ts";
6
+ import { formatAnswerScalar } from "../tool/format-answer.ts";
7
+ import type { QuestionData } from "../tool/types.ts";
8
+ import type { PreviewPane, PreviewPaneProps } from "./components/preview/preview-pane.ts";
9
+ import type { DialogState } from "./dialog-builder.ts";
10
10
  import {
11
11
  HINT_PART_CANCEL,
12
12
  HINT_PART_CLEAR,
@@ -21,9 +21,9 @@ import {
21
21
  KEY_PLACEHOLDER,
22
22
  READY_PROMPT,
23
23
  REVIEW_HEADING,
24
- } from "./dialog-copy.js";
25
- import type { StatefulView } from "./stateful-view.js";
26
- import type { TabComponents } from "./tab-components.js";
24
+ } from "./dialog-copy.ts";
25
+ import type { StatefulView } from "./stateful-view.ts";
26
+ import type { TabComponents } from "./tab-components.ts";
27
27
 
28
28
  const NOTES_HEADER = "Notes:";
29
29
  const GLOBAL_NOTES_HEADER = "Global note:";