@lune_99/pi-ask-question 0.1.0 → 0.2.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.
@@ -3,7 +3,7 @@ import type { Theme } from "@earendil-works/pi-coding-agent";
3
3
  import { Text } from "@earendil-works/pi-tui";
4
4
 
5
5
  import { formatAnswer, questionHeaderPrefix, summarizeText } from "../core/question-format.ts";
6
- import type { AnswerMessageQuestion, AskQuestionAnswer } from "../core/questionManager.ts";
6
+ import type { AnswerMessageQuestion, AskQuestionAnswer } from "../core/question-types.ts";
7
7
 
8
8
  export interface AskQuestionAnswerMessageDetails {
9
9
  requestId?: string;
@@ -21,9 +21,11 @@ export function renderQuestionAnswerMessage(
21
21
  const skipped = details?.status === "skipped";
22
22
 
23
23
  const lines: string[] = [
24
- theme.bold(skipped
25
- ? theme.fg("warning", "Questions skipped")
26
- : theme.fg("success", "Questions answered")),
24
+ theme.bold(
25
+ skipped
26
+ ? theme.fg("warning", "Questions skipped")
27
+ : theme.fg("success", "Questions answered"),
28
+ ),
27
29
  ];
28
30
 
29
31
  for (const [index, question] of questions.entries()) {
@@ -1,41 +1,81 @@
1
1
  import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
2
- import { stripTerminalSequences, truncateToWidth, type Component } from "@earendil-works/pi-tui";
3
- import { createDockContribution, type LuneDockSnapshot } from "@lune_99/pi-lune-extensions-core/dock";
2
+ import { visibleWidth, type Component } from "@earendil-works/pi-tui";
3
+ import {
4
+ createDockContribution,
5
+ type LuneDockSnapshot,
6
+ } from "@lune_99/pi-lune-extensions-core/dock";
4
7
  import { openPendingQuestions } from "../commands/question.ts";
5
- import { questionManager } from "../core/questionManager.ts";
6
- import { questionDock } from "./question-dock.ts";
8
+ import { singleLine } from "../core/question-format.ts";
9
+ import type { QuestionManager } from "../core/questionManager.ts";
10
+ import { fitRanked, type RankedPart } from "./dock-line.ts";
11
+ import type { QuestionPanels } from "./panel/question-panel.ts";
12
+ import { QuestionDock } from "./question-dock.ts";
7
13
 
8
14
  export const QUESTION_CONTRIBUTION_ID = "ask-question";
9
15
 
10
- export function getQuestionDockSnapshot(ctx: ExtensionContext): LuneDockSnapshot {
11
- const count = questionManager.getPendingRequests().length;
12
- const next = questionManager.nextPendingRequest();
13
- const title = stripTerminalSequences(
14
- next?.questions[0]?.header ?? next?.questions[0]?.question ?? "",
15
- ).replace(/[\r\n\t]+/g, " ");
16
- const summary =
17
- count === 0 ? "idle" : `${count} pending ${count === 1 ? "request" : "requests"}`;
18
- const component = (suffix: string): Component => ({
16
+ /**
17
+ * Ranks of the line's parts: a narrow cell drops the lowest first, so `agent waiting` stays
18
+ * longest and the request's title goes first.
19
+ */
20
+ const WAITING_RANK = 2;
21
+ const COUNT_RANK = 1;
22
+ const TITLE_RANK = 0;
23
+
24
+ /**
25
+ * Base says whether the agent waits; detail adds the count; full adds the next request's title.
26
+ * No level cuts a part: a narrow cell leaves out whole parts, then the title, down to the marker.
27
+ */
28
+ export function getQuestionDockSnapshot(
29
+ ctx: ExtensionContext,
30
+ manager: QuestionManager,
31
+ ): LuneDockSnapshot {
32
+ const theme = ctx.ui.theme;
33
+ const muted = (text: string): string => theme.fg("muted", text);
34
+ const count = manager.getPendingRequests().length;
35
+ const next = manager.nextPendingRequest();
36
+ const title = singleLine(next?.questions[0]?.header ?? next?.questions[0]?.question ?? "");
37
+ // A waited-on request is always the next one; every level shows that the agent is paused.
38
+ const waiting: RankedPart[] =
39
+ next !== undefined && manager.isWaiting(next.id)
40
+ ? [{ text: muted("agent waiting"), rank: WAITING_RANK }]
41
+ : [];
42
+ const summary: RankedPart[] = [
43
+ ...(count === 0
44
+ ? []
45
+ : [
46
+ {
47
+ text: muted(`${count} pending ${count === 1 ? "request" : "requests"}`),
48
+ rank: COUNT_RANK,
49
+ },
50
+ ]),
51
+ ...waiting,
52
+ ];
53
+ const marker = theme.fg(count > 0 ? "warning" : "dim", count > 0 ? "●" : "○");
54
+ const component = (parts: readonly RankedPart[]): Component => ({
19
55
  render: (width) => [
20
- truncateToWidth(
21
- `${ctx.ui.theme.fg(count > 0 ? "warning" : "dim", count > 0 ? "●" : "○")} Ask${suffix ? ctx.ui.theme.fg("muted", ` · ${suffix}`) : ""}`,
22
- width,
23
- ),
56
+ fitRanked(parts, width, (texts) => [`${marker} Ask`, ...texts].join(muted(" · "))) ??
57
+ (visibleWidth(marker) <= width ? marker : ""),
24
58
  ],
25
59
  invalidate() {},
26
60
  });
27
61
  return {
28
- base: component(""),
62
+ base: component(waiting),
29
63
  detail: component(summary),
30
- full: component([summary, title].filter(Boolean).join(" · ")),
64
+ full: component(
65
+ title.length > 0 ? [...summary, { text: muted(title), rank: TITLE_RANK }] : summary,
66
+ ),
31
67
  };
32
68
  }
33
69
 
34
- export function createQuestionDockContribution(persist: (ctx: ExtensionContext) => void) {
70
+ export function createQuestionDockContribution(
71
+ manager: QuestionManager,
72
+ panels: QuestionPanels,
73
+ persist: (ctx: ExtensionContext) => void,
74
+ ) {
35
75
  return createDockContribution({
36
76
  id: QUESTION_CONTRIBUTION_ID,
37
- getSnapshot: getQuestionDockSnapshot,
38
- activate: (ctx) => openPendingQuestions(ctx, persist),
39
- standalone: questionDock,
77
+ getSnapshot: (ctx) => getQuestionDockSnapshot(ctx, manager),
78
+ activate: (ctx) => openPendingQuestions(ctx, manager, panels, persist),
79
+ standalone: new QuestionDock(manager),
40
80
  });
41
81
  }
@@ -1,21 +1,34 @@
1
1
  import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
2
+ import { visibleWidth } from "@earendil-works/pi-tui";
2
3
 
3
- import { summarizeText } from "../core/question-format.ts";
4
- import { questionManager } from "../core/questionManager.ts";
4
+ import { singleLine } from "../core/question-format.ts";
5
+ import type { QuestionManager } from "../core/questionManager.ts";
6
+ import { fitRanked, type RankedPart } from "./dock-line.ts";
5
7
 
6
8
  const WIDGET_ID = "pi-ask-question";
7
9
 
8
- /** Budget for the question preview before the hint; keeps the hint visible on narrow terminals. */
9
- const SUMMARY_MAX_WIDTH = 40;
10
+ /**
11
+ * Ranks of the parts after the count: a narrow row drops the lowest first. The hint outranks the
12
+ * question, so a narrow terminal still says how to reopen the panel.
13
+ */
14
+ const WAITING_RANK = 2;
15
+ const HINT_RANK = 1;
16
+ const QUESTION_RANK = 0;
10
17
 
11
18
  /**
12
19
  * Persistent hint below the editor that a question is waiting.
13
20
  *
14
21
  * The panel itself is transient: Esc closes it, so without this row a closed panel
15
- * would be invisible until the user remembered `/question`.
22
+ * would be invisible until the user remembered `/question`. No part is cut: a narrow row
23
+ * leaves out whole parts after the count.
16
24
  */
17
25
  export class QuestionDock {
18
26
  private ctx: ExtensionContext | undefined;
27
+ private readonly manager: QuestionManager;
28
+
29
+ constructor(manager: QuestionManager) {
30
+ this.manager = manager;
31
+ }
19
32
 
20
33
  setCtx(ctx: ExtensionContext | undefined): void {
21
34
  this.ctx = ctx;
@@ -26,30 +39,56 @@ export class QuestionDock {
26
39
  return;
27
40
  }
28
41
 
29
- const pending = questionManager.getPendingRequests();
30
- const next = questionManager.nextPendingRequest();
42
+ const pending = this.manager.getPendingRequests();
31
43
 
32
44
  if (pending.length === 0) {
33
45
  this.ctx.ui.setWidget(WIDGET_ID, undefined);
34
46
  return;
35
47
  }
36
48
 
49
+ const next = this.manager.nextPendingRequest();
37
50
  const theme = this.ctx.ui.theme;
38
- const count = `${pending.length} pending ${pending.length === 1 ? "question" : "questions"}`;
39
- // The question the panel would show next, so the hint and `/question` agree.
40
- const summary = summarizeText(next?.questions[0]?.question ?? "", SUMMARY_MAX_WIDTH);
51
+ // The row names questions, so it counts them: one request can hold several. The Lune
52
+ // Dock item counts requests instead, and the two are never shown together.
53
+ const questions = pending.reduce((total, request) => total + request.questions.length, 0);
54
+ const count = `${questions} pending ${questions === 1 ? "question" : "questions"}`;
55
+ // The question the panel would show next, so the hint and `/question` agree. Its header is
56
+ // the shorter variant for a row too narrow for the whole question.
57
+ const first = next?.questions[0];
58
+ const summaries = [
59
+ singleLine(first?.question ?? ""),
60
+ singleLine(first?.header ?? ""),
61
+ ].filter((text) => text.length > 0);
62
+ // A waited-on request is always the next one, and the agent is paused until it settles.
63
+ const waiting = next !== undefined && this.manager.isWaiting(next.id);
64
+ const lead = theme.fg("accent", count);
65
+ const separator = theme.fg("dim", " · ");
66
+ const compose = (texts: readonly string[]): string => [lead, ...texts].join(separator);
67
+ const parts = (summary: string | undefined): RankedPart[] => [
68
+ ...(waiting
69
+ ? [{ text: theme.fg("warning", "agent waiting"), rank: WAITING_RANK }]
70
+ : []),
71
+ ...(summary === undefined
72
+ ? []
73
+ : [{ text: theme.fg("muted", summary), rank: QUESTION_RANK }]),
74
+ { text: theme.fg("dim", "/question to answer"), rank: HINT_RANK },
75
+ ];
76
+ const row = (width: number): string => {
77
+ // The summary ranks lowest, so it stays only when the whole row fits.
78
+ const summary = summaries.find(
79
+ (text) => visibleWidth(compose(parts(text).map((part) => part.text))) <= width,
80
+ );
81
+
82
+ return fitRanked(parts(summary), width, compose) ?? "";
83
+ };
41
84
 
85
+ // Pi pads string rows by one column on each side; this row keeps the same margins.
42
86
  this.ctx.ui.setWidget(
43
87
  WIDGET_ID,
44
- [
45
- [
46
- theme.fg("accent", count),
47
- summary.length > 0 ? theme.fg("muted", summary) : undefined,
48
- theme.fg("dim", "/question to answer"),
49
- ]
50
- .filter((part): part is string => part !== undefined)
51
- .join(theme.fg("dim", " · ")),
52
- ],
88
+ () => ({
89
+ render: (width) => [` ${row(Math.max(0, width - 2))}`],
90
+ invalidate() {},
91
+ }),
53
92
  {
54
93
  placement: "belowEditor",
55
94
  },
@@ -64,5 +103,3 @@ export class QuestionDock {
64
103
  this.ctx.ui.setWidget(WIDGET_ID, undefined);
65
104
  }
66
105
  }
67
-
68
- export const questionDock = new QuestionDock();
Binary file
@@ -1,16 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="879" height="167" viewBox="0 0 879 167" font-family="Menlo, ui-monospace, monospace" font-size="14">
2
- <rect width="879" height="167" rx="10" fill="#21252c"/>
3
- <rect y="0" width="879" height="34" rx="10" fill="#768186" opacity="0.25"/>
4
- <circle cx="24" cy="17" r="5" fill="#ff5f57"/><circle cx="42" cy="17" r="5" fill="#febc2e"/><circle cx="60" cy="17" r="5" fill="#28c840"/>
5
- <text x="80" y="22" fill="#9da5a9" font-size="13">pi — the answer message that resumes the model</text>
6
-
7
- <text x="18" y="66.0" fill="#dee0e1" xml:space="preserve"><tspan fill="#68b78d" font-weight="600">Questions answered</tspan><tspan> </tspan></text>
8
-
9
- <text x="18" y="85.4" fill="#dee0e1" xml:space="preserve"><tspan fill="#9da5a9">Storage: </tspan><tspan fill="#dee0e1">Where should the new session index live?</tspan><tspan> </tspan></text>
10
-
11
- <text x="18" y="104.8" fill="#dee0e1" xml:space="preserve"><tspan> </tspan><tspan fill="#a798d7">selected: 1. SQLite index (Recommended)</tspan><tspan> </tspan></text>
12
-
13
- <text x="18" y="124.2" fill="#dee0e1" xml:space="preserve"><tspan fill="#9da5a9">Timeouts: </tspan><tspan fill="#dee0e1">How should a stalled shell job be reported?</tspan><tspan> </tspan></text>
14
-
15
- <text x="18" y="143.6" fill="#dee0e1" xml:space="preserve"><tspan> </tspan><tspan fill="#a798d7">wrote: Warn at 60s, kill at 90s</tspan><tspan> </tspan></text>
16
- </svg>
Binary file
@@ -1,8 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="879" height="89.4" viewBox="0 0 879 89.4" font-family="Menlo, ui-monospace, monospace" font-size="14">
2
- <rect width="879" height="89.4" rx="10" fill="#21252c"/>
3
- <rect y="0" width="879" height="34" rx="10" fill="#768186" opacity="0.25"/>
4
- <circle cx="24" cy="17" r="5" fill="#ff5f57"/><circle cx="42" cy="17" r="5" fill="#febc2e"/><circle cx="60" cy="17" r="5" fill="#28c840"/>
5
- <text x="80" y="22" fill="#9da5a9" font-size="13">pi — the pending dock below the editor after Esc closed the panel</text>
6
-
7
- <text x="18" y="66.0" fill="#dee0e1" xml:space="preserve"><tspan> </tspan><tspan fill="#a798d7">1 pending question</tspan><tspan fill="#7e888e"> · </tspan><tspan fill="#9da5a9">Where should the new session index live?</tspan><tspan fill="#7e888e"> · </tspan><tspan fill="#7e888e">/question to answer</tspan><tspan> </tspan></text>
8
- </svg>
@@ -1,58 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="980.16" height="574.4" viewBox="0 0 980.16 574.4" font-family="Menlo, ui-monospace, monospace" font-size="14">
2
- <rect width="980.16" height="574.4" rx="10" fill="#21252c"/>
3
- <rect y="0" width="980.16" height="34" rx="10" fill="#768186" opacity="0.25"/>
4
- <circle cx="24" cy="17" r="5" fill="#ff5f57"/><circle cx="42" cy="17" r="5" fill="#febc2e"/><circle cx="60" cy="17" r="5" fill="#28c840"/>
5
- <text x="80" y="22" fill="#9da5a9" font-size="13">pi — ask_user_questions: 2 questions, the focused option's preview pane</text>
6
-
7
- <text x="18" y="66.0" fill="#dee0e1" xml:space="preserve"><tspan fill="#5fa8cc">┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────┐</tspan></text>
8
-
9
- <text x="18" y="85.4" fill="#dee0e1" xml:space="preserve"><tspan fill="#5fa8cc">│</tspan><tspan> </tspan><tspan font-weight="600">Questions</tspan><tspan> </tspan><tspan fill="#9da5a9">0/2 answered</tspan><tspan> </tspan><tspan fill="#5fa8cc">│</tspan></text>
10
-
11
- <text x="18" y="104.8" fill="#dee0e1" xml:space="preserve"><tspan fill="#5fa8cc">├──────────────────────────────────────────────────────────────────────────────────────────────────────────────┤</tspan></text>
12
- <rect x="51.7" y="110.2" width="92.7" height="19.4" fill="#213b49"/>
13
- <text x="18" y="124.2" fill="#dee0e1" xml:space="preserve"><tspan fill="#5fa8cc">│</tspan><tspan> ← </tspan><tspan fill="#dee0e1"> □ Storage </tspan><tspan> </tspan><tspan fill="#9da5a9"> □ Timeouts </tspan><tspan> </tspan><tspan fill="#7e888e"> ✓ Submit </tspan><tspan>→ </tspan><tspan fill="#5fa8cc">│</tspan></text>
14
-
15
- <text x="18" y="143.6" fill="#dee0e1" xml:space="preserve"><tspan fill="#5fa8cc">│</tspan><tspan> </tspan><tspan fill="#5fa8cc">│</tspan></text>
16
-
17
- <text x="18" y="163.0" fill="#dee0e1" xml:space="preserve"><tspan fill="#5fa8cc">│</tspan><tspan> </tspan><tspan fill="#dee0e1" font-weight="600">Where should the new session index live?</tspan><tspan> </tspan><tspan fill="#5fa8cc">│</tspan></text>
18
-
19
- <text x="18" y="182.4" fill="#dee0e1" xml:space="preserve"><tspan fill="#5fa8cc">│</tspan><tspan> </tspan><tspan fill="#5fa8cc">│</tspan></text>
20
-
21
- <text x="18" y="201.8" fill="#dee0e1" xml:space="preserve"><tspan fill="#5fa8cc">│</tspan><tspan> The transcript itself stays on disk either way; only the lookup path changes. </tspan><tspan fill="#5fa8cc">│</tspan></text>
22
-
23
- <text x="18" y="221.2" fill="#dee0e1" xml:space="preserve"><tspan fill="#5fa8cc">│</tspan><tspan> </tspan><tspan fill="#5fa8cc">│</tspan></text>
24
-
25
- <text x="18" y="240.6" fill="#dee0e1" xml:space="preserve"><tspan fill="#5fa8cc">│</tspan><tspan> </tspan><tspan fill="#a798d7">- </tspan><tspan fill="#a798d7">sqlite</tspan><tspan> adds one file next to the config </tspan><tspan fill="#5fa8cc">│</tspan></text>
26
-
27
- <text x="18" y="260.0" fill="#dee0e1" xml:space="preserve"><tspan fill="#5fa8cc">│</tspan><tspan> </tspan><tspan fill="#a798d7">- </tspan><tspan fill="#a798d7">jsonl</tspan><tspan> reuses what already ships </tspan><tspan fill="#5fa8cc">│</tspan></text>
28
-
29
- <text x="18" y="279.4" fill="#dee0e1" xml:space="preserve"><tspan fill="#5fa8cc">│</tspan><tspan> </tspan><tspan fill="#5fa8cc">│</tspan></text>
30
-
31
- <text x="18" y="298.8" fill="#dee0e1" xml:space="preserve"><tspan fill="#5fa8cc">│</tspan><tspan> </tspan><tspan fill="#a798d7">›</tspan><tspan> </tspan><tspan fill="#7e888e">○</tspan><tspan> </tspan><tspan fill="#a798d7" font-weight="600">1. SQLite index (Recommended)</tspan><tspan> </tspan><tspan fill="#5fa8cc">┌─ SQLite index (Recommended) ─────────────┐</tspan><tspan> </tspan><tspan fill="#5fa8cc">│</tspan></text>
32
-
33
- <text x="18" y="318.2" fill="#dee0e1" xml:space="preserve"><tspan fill="#5fa8cc">│</tspan><tspan> </tspan><tspan fill="#9da5a9">One file, constant-time </tspan><tspan fill="#5fa8cc">│</tspan><tspan> </tspan><tspan fill="#68b78d">sessions/</tspan><tspan> </tspan><tspan fill="#5fa8cc">│</tspan><tspan> </tspan><tspan fill="#5fa8cc">│</tspan></text>
34
-
35
- <text x="18" y="337.6" fill="#dee0e1" xml:space="preserve"><tspan fill="#5fa8cc">│</tspan><tspan> </tspan><tspan fill="#9da5a9">resume, no extra service.</tspan><tspan> </tspan><tspan fill="#5fa8cc">│</tspan><tspan> </tspan><tspan fill="#68b78d"> index.sqlite</tspan><tspan> </tspan><tspan fill="#5fa8cc">│</tspan><tspan> </tspan><tspan fill="#5fa8cc">│</tspan></text>
36
-
37
- <text x="18" y="357.0" fill="#dee0e1" xml:space="preserve"><tspan fill="#5fa8cc">│</tspan><tspan> </tspan><tspan fill="#7e888e">○</tspan><tspan> </tspan><tspan fill="#dee0e1">2. Scan every JSONL</tspan><tspan> </tspan><tspan fill="#5fa8cc">│</tspan><tspan> </tspan><tspan fill="#68b78d"> 4f2a9c.jsonl</tspan><tspan> </tspan><tspan fill="#5fa8cc">│</tspan><tspan> </tspan><tspan fill="#5fa8cc">│</tspan></text>
38
-
39
- <text x="18" y="376.4" fill="#dee0e1" xml:space="preserve"><tspan fill="#5fa8cc">│</tspan><tspan> </tspan><tspan fill="#9da5a9">No new dependency; resume </tspan><tspan fill="#5fa8cc">│</tspan><tspan> </tspan><tspan fill="#5fa8cc">│</tspan><tspan> </tspan><tspan fill="#5fa8cc">│</tspan></text>
40
-
41
- <text x="18" y="395.8" fill="#dee0e1" xml:space="preserve"><tspan fill="#5fa8cc">│</tspan><tspan> </tspan><tspan fill="#9da5a9">re-reads each session file.</tspan><tspan> </tspan><tspan fill="#5fa8cc">│</tspan><tspan> </tspan><tspan fill="#a798d7">- </tspan><tspan>a </tspan><tspan fill="#a798d7">WAL</tspan><tspan> file appears beside it </tspan><tspan fill="#5fa8cc">│</tspan><tspan> </tspan><tspan fill="#5fa8cc">│</tspan></text>
42
-
43
- <text x="18" y="415.2" fill="#dee0e1" xml:space="preserve"><tspan fill="#5fa8cc">│</tspan><tspan> </tspan><tspan fill="#7e888e">○</tspan><tspan> </tspan><tspan fill="#dee0e1">3. Rebuild in memory</tspan><tspan> </tspan><tspan fill="#5fa8cc">│</tspan><tspan> </tspan><tspan fill="#a798d7">- </tspan><tspan>survives a crash mid-write </tspan><tspan fill="#5fa8cc">│</tspan><tspan> </tspan><tspan fill="#5fa8cc">│</tspan></text>
44
-
45
- <text x="18" y="434.6" fill="#dee0e1" xml:space="preserve"><tspan fill="#5fa8cc">│</tspan><tspan> </tspan><tspan fill="#9da5a9">Nothing on disk; the index </tspan><tspan fill="#5fa8cc">└──────────────────────────────────────────┘</tspan><tspan> </tspan><tspan fill="#5fa8cc">│</tspan></text>
46
-
47
- <text x="18" y="454.0" fill="#dee0e1" xml:space="preserve"><tspan fill="#5fa8cc">│</tspan><tspan> </tspan><tspan fill="#9da5a9">is rebuilt on every start.</tspan><tspan> </tspan><tspan fill="#5fa8cc">│</tspan></text>
48
-
49
- <text x="18" y="473.4" fill="#dee0e1" xml:space="preserve"><tspan fill="#5fa8cc">│</tspan><tspan> </tspan><tspan fill="#7e888e">✎</tspan><tspan> </tspan><tspan fill="#dee0e1">Type something</tspan><tspan> </tspan><tspan fill="#5fa8cc">│</tspan></text>
50
-
51
- <text x="18" y="492.8" fill="#dee0e1" xml:space="preserve"><tspan fill="#5fa8cc">│</tspan><tspan> </tspan><tspan fill="#9da5a9">write your own answer</tspan><tspan> </tspan><tspan fill="#5fa8cc">│</tspan></text>
52
-
53
- <text x="18" y="512.2" fill="#dee0e1" xml:space="preserve"><tspan fill="#5fa8cc">├──────────────────────────────────────────────────────────────────────────────────────────────────────────────┤</tspan></text>
54
-
55
- <text x="18" y="531.6" fill="#dee0e1" xml:space="preserve"><tspan fill="#5fa8cc">│</tspan><tspan> </tspan><tspan fill="#7e888e">↑↓ select · Enter confirm · Tab/←→ switch · ⇧S skip · Esc close</tspan><tspan> </tspan><tspan fill="#5fa8cc">│</tspan></text>
56
-
57
- <text x="18" y="551.0" fill="#dee0e1" xml:space="preserve"><tspan fill="#5fa8cc">└──────────────────────────────────────────────────────────────────────────────────────────────────────────────┘</tspan></text>
58
- </svg>
@@ -1,34 +0,0 @@
1
- import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
-
3
- import { deliverQuestionResult, type QuestionDeliveryOptions } from "./question-delivery.ts";
4
- import { questionManager } from "./questionManager.ts";
5
-
6
- export { ASK_QUESTION_ANSWER_MESSAGE } from "./question-delivery.ts";
7
-
8
- export type QuestionAnswerNotificationOptions = QuestionDeliveryOptions;
9
-
10
- /**
11
- * Attempt delivery as soon as a request settles.
12
- *
13
- * This is the initial attempt only. The persistence listener runs first, so the settled
14
- * request is already in the durable outbox when this send happens; if pi drops the message,
15
- * reconciliation recovers it instead of the answer being lost with the call.
16
- */
17
- export function registerQuestionAnswerNotifications(
18
- pi: ExtensionAPI,
19
- options: QuestionAnswerNotificationOptions = {},
20
- ): () => void {
21
- return questionManager.subscribe((event) => {
22
- if (event.type !== "request-answered" && event.type !== "request-skipped") {
23
- return;
24
- }
25
-
26
- const request = questionManager.get(event.id);
27
-
28
- if (!request) {
29
- return;
30
- }
31
-
32
- deliverQuestionResult(pi, request, options);
33
- });
34
- }