@juicesharp/rpiv-ask-user-question 2.14.0 → 2.14.2
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 +4 -0
- package/locales/de.json +4 -1
- package/locales/en.json +4 -1
- package/locales/es.json +4 -1
- package/locales/fr.json +4 -1
- package/locales/pt-BR.json +4 -1
- package/locales/pt.json +4 -1
- package/locales/ru.json +4 -1
- package/locales/uk.json +4 -1
- package/locales/zh.json +4 -1
- package/package.json +4 -3
- package/state/key-router.ts +4 -5
- package/state/state-reducer.ts +13 -1
- package/view/transcript.ts +144 -0
package/ask-user-question.ts
CHANGED
|
@@ -41,6 +41,7 @@ import {
|
|
|
41
41
|
} from "./tool/types.ts";
|
|
42
42
|
import { validateQuestionnaire } from "./tool/validate-questionnaire.ts";
|
|
43
43
|
import type { WrappingSelectItem } from "./view/components/wrapping-select.ts";
|
|
44
|
+
import { renderAskCall, renderAskResult } from "./view/transcript.ts";
|
|
44
45
|
|
|
45
46
|
function emitAskUserPromptEvent(pi: ExtensionAPI, params: QuestionParams, toolCallId: string): void {
|
|
46
47
|
const payload: AskUserPromptEventPayload = {
|
|
@@ -467,6 +468,9 @@ export function registerAskUserQuestionTool(pi: ExtensionAPI): void {
|
|
|
467
468
|
parameters: QuestionParamsSchema,
|
|
468
469
|
// Undo double-encoded nested arguments before Pi validates them (#244).
|
|
469
470
|
prepareArguments: prepareQuestionArguments,
|
|
471
|
+
renderCall: (args, theme) => renderAskCall(args, theme),
|
|
472
|
+
renderResult: (result, { expanded }, theme, context) =>
|
|
473
|
+
renderAskResult(result, context?.args, theme, { expanded, isError: context?.isError ?? false }),
|
|
470
474
|
|
|
471
475
|
async execute(toolCallId, params, _signal, _onUpdate, ctx) {
|
|
472
476
|
// Line-terminator normalization runs once here, ahead of validation, so
|
package/locales/de.json
CHANGED
|
@@ -29,5 +29,8 @@
|
|
|
29
29
|
"editor.failed": "Externer Editor fehlgeschlagen",
|
|
30
30
|
|
|
31
31
|
"rpc.multi_instructions": "Gib die Nummern aller zutreffenden Optionen durch Kommas getrennt ein (z. B. \"1,3\"). Füge \"; eigene Antwort\" hinzu, um eigenen Text einzuschließen, oder gib nur eigenen Text ein.",
|
|
32
|
-
"rpc.custom_answer_title": "Gib deine Antwort ein:"
|
|
32
|
+
"rpc.custom_answer_title": "Gib deine Antwort ein:",
|
|
33
|
+
|
|
34
|
+
"transcript.not_answered": "nicht beantwortet",
|
|
35
|
+
"transcript.no_answer": "keine Antwort"
|
|
33
36
|
}
|
package/locales/en.json
CHANGED
|
@@ -32,5 +32,8 @@
|
|
|
32
32
|
"editor.failed": "External editor failed",
|
|
33
33
|
|
|
34
34
|
"rpc.multi_instructions": "Enter the numbers of all that apply, comma-separated (e.g. \"1,3\"). Add \"; custom answer\" to include your own text, or type only custom text.",
|
|
35
|
-
"rpc.custom_answer_title": "Type your answer:"
|
|
35
|
+
"rpc.custom_answer_title": "Type your answer:",
|
|
36
|
+
|
|
37
|
+
"transcript.not_answered": "not answered",
|
|
38
|
+
"transcript.no_answer": "no answer"
|
|
36
39
|
}
|
package/locales/es.json
CHANGED
|
@@ -29,5 +29,8 @@
|
|
|
29
29
|
"editor.failed": "Error del editor externo",
|
|
30
30
|
|
|
31
31
|
"rpc.multi_instructions": "Introduce los números de todas las opciones que correspondan, separados por comas (p. ej. \"1,3\"). Añade \"; respuesta propia\" para incluir texto propio, o escribe solo texto propio.",
|
|
32
|
-
"rpc.custom_answer_title": "Escribe tu respuesta:"
|
|
32
|
+
"rpc.custom_answer_title": "Escribe tu respuesta:",
|
|
33
|
+
|
|
34
|
+
"transcript.not_answered": "sin responder",
|
|
35
|
+
"transcript.no_answer": "sin respuesta"
|
|
33
36
|
}
|
package/locales/fr.json
CHANGED
|
@@ -29,5 +29,8 @@
|
|
|
29
29
|
"editor.failed": "Échec de l’éditeur externe",
|
|
30
30
|
|
|
31
31
|
"rpc.multi_instructions": "Saisissez les numéros de toutes les options applicables, séparés par des virgules (p. ex. « 1,3 »). Ajoutez « ; réponse libre » pour inclure votre propre texte, ou saisissez uniquement ce texte.",
|
|
32
|
-
"rpc.custom_answer_title": "Tapez votre réponse :"
|
|
32
|
+
"rpc.custom_answer_title": "Tapez votre réponse :",
|
|
33
|
+
|
|
34
|
+
"transcript.not_answered": "sans réponse",
|
|
35
|
+
"transcript.no_answer": "aucune réponse"
|
|
33
36
|
}
|
package/locales/pt-BR.json
CHANGED
|
@@ -29,5 +29,8 @@
|
|
|
29
29
|
"editor.failed": "Falha no editor externo",
|
|
30
30
|
|
|
31
31
|
"rpc.multi_instructions": "Digite os números de todas as opções aplicáveis, separados por vírgulas (ex.: \"1,3\"). Adicione \"; resposta própria\" para incluir texto próprio, ou digite apenas esse texto.",
|
|
32
|
-
"rpc.custom_answer_title": "Digite sua resposta:"
|
|
32
|
+
"rpc.custom_answer_title": "Digite sua resposta:",
|
|
33
|
+
|
|
34
|
+
"transcript.not_answered": "não respondida",
|
|
35
|
+
"transcript.no_answer": "sem resposta"
|
|
33
36
|
}
|
package/locales/pt.json
CHANGED
|
@@ -29,5 +29,8 @@
|
|
|
29
29
|
"editor.failed": "Falha no editor externo",
|
|
30
30
|
|
|
31
31
|
"rpc.multi_instructions": "Introduza os números de todas as opções aplicáveis, separados por vírgulas (ex.: \"1,3\"). Adicione \"; resposta própria\" para incluir texto próprio, ou escreva apenas esse texto.",
|
|
32
|
-
"rpc.custom_answer_title": "Escreva a sua resposta:"
|
|
32
|
+
"rpc.custom_answer_title": "Escreva a sua resposta:",
|
|
33
|
+
|
|
34
|
+
"transcript.not_answered": "não respondida",
|
|
35
|
+
"transcript.no_answer": "sem resposta"
|
|
33
36
|
}
|
package/locales/ru.json
CHANGED
|
@@ -29,5 +29,8 @@
|
|
|
29
29
|
"editor.failed": "Ошибка внешнего редактора",
|
|
30
30
|
|
|
31
31
|
"rpc.multi_instructions": "Введите номера всех подходящих вариантов через запятую (например, \"1,3\"). Добавьте \"; свой ответ\", чтобы включить собственный текст, или введите только этот текст.",
|
|
32
|
-
"rpc.custom_answer_title": "Введите свой ответ:"
|
|
32
|
+
"rpc.custom_answer_title": "Введите свой ответ:",
|
|
33
|
+
|
|
34
|
+
"transcript.not_answered": "без ответа",
|
|
35
|
+
"transcript.no_answer": "ответа нет"
|
|
33
36
|
}
|
package/locales/uk.json
CHANGED
|
@@ -29,5 +29,8 @@
|
|
|
29
29
|
"editor.failed": "Помилка зовнішнього редактора",
|
|
30
30
|
|
|
31
31
|
"rpc.multi_instructions": "Введіть номери всіх відповідних варіантів через кому (наприклад, \"1,3\"). Додайте \"; власна відповідь\", щоб включити власний текст, або введіть лише цей текст.",
|
|
32
|
-
"rpc.custom_answer_title": "Введіть свою відповідь:"
|
|
32
|
+
"rpc.custom_answer_title": "Введіть свою відповідь:",
|
|
33
|
+
|
|
34
|
+
"transcript.not_answered": "без відповіді",
|
|
35
|
+
"transcript.no_answer": "відповіді немає"
|
|
33
36
|
}
|
package/locales/zh.json
CHANGED
|
@@ -31,5 +31,8 @@
|
|
|
31
31
|
"editor.failed": "外部编辑器启动失败",
|
|
32
32
|
|
|
33
33
|
"rpc.multi_instructions": "输入所有适用选项的编号,用逗号分隔(例如 \"1,3\")。添加 \"; 自定义回答\" 可同时包含自定义文本,也可以只输入自定义文本。",
|
|
34
|
-
"rpc.custom_answer_title": "输入你的回答:"
|
|
34
|
+
"rpc.custom_answer_title": "输入你的回答:",
|
|
35
|
+
|
|
36
|
+
"transcript.not_answered": "未回答",
|
|
37
|
+
"transcript.no_answer": "无回答"
|
|
35
38
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juicesharp/rpiv-ask-user-question",
|
|
3
|
-
"version": "2.14.
|
|
3
|
+
"version": "2.14.2",
|
|
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",
|
|
@@ -81,7 +81,8 @@
|
|
|
81
81
|
"view/scroll-window.ts",
|
|
82
82
|
"view/stateful-view.ts",
|
|
83
83
|
"view/tab-components.ts",
|
|
84
|
-
"view/tab-content-strategy.ts"
|
|
84
|
+
"view/tab-content-strategy.ts",
|
|
85
|
+
"view/transcript.ts"
|
|
85
86
|
],
|
|
86
87
|
"pi": {
|
|
87
88
|
"image": "https://raw.githubusercontent.com/juicesharp/rpiv-mono/main/packages/rpiv-ask-user-question/docs/cover.png",
|
|
@@ -101,6 +102,6 @@
|
|
|
101
102
|
}
|
|
102
103
|
},
|
|
103
104
|
"dependencies": {
|
|
104
|
-
"@juicesharp/rpiv-config": "^2.14.
|
|
105
|
+
"@juicesharp/rpiv-config": "^2.14.2"
|
|
105
106
|
}
|
|
106
107
|
}
|
package/state/key-router.ts
CHANGED
|
@@ -15,7 +15,6 @@ const KEYBIND_CLEAR = "tui.editor.deleteToLineStart";
|
|
|
15
15
|
const KEYBIND_EXTERNAL_EDITOR = "app.editor.external";
|
|
16
16
|
|
|
17
17
|
const NOTES_ACTIVATE_KEY = "n";
|
|
18
|
-
const SPACE_KEY = " ";
|
|
19
18
|
|
|
20
19
|
export type QuestionnaireAction =
|
|
21
20
|
| { kind: "nav"; nextIndex: number; inputValue: string }
|
|
@@ -229,10 +228,10 @@ function routeSubmitTab(
|
|
|
229
228
|
// questionnaire at the pseudo-index (`questions.length` in notesByTab). Reachable only
|
|
230
229
|
// with the editor closed — `routeKey` dispatches notesVisible traffic to
|
|
231
230
|
// `routeNotesMode` before the submit-tab block runs. The branch shadows nothing above
|
|
232
|
-
// it (cancel, tab switch, submit-nav, confirm):
|
|
231
|
+
// it (cancel, tab switch, submit-nav, confirm): an `n` key matches none of them
|
|
233
232
|
// under default bindings, and a user who deliberately binds one of those actions to
|
|
234
233
|
// `n` keeps that mapping because the earlier branch still wins (Enter still submits).
|
|
235
|
-
if (data
|
|
234
|
+
if (matchesKey(data, NOTES_ACTIVATE_KEY)) {
|
|
236
235
|
return { kind: "notes_enter" };
|
|
237
236
|
}
|
|
238
237
|
return { kind: "ignore" };
|
|
@@ -249,7 +248,7 @@ function routeMultiSelectTab(
|
|
|
249
248
|
// Space toggles the focused row's checkbox. Suppressed on rows whose META declares
|
|
250
249
|
// `blocksMultiToggle` (the Next sentinel) or `activatesInputMode` (the "Type
|
|
251
250
|
// something." row — it is an inline input, not a checkable option).
|
|
252
|
-
if (data
|
|
251
|
+
if (matchesKey(data, Key.space)) {
|
|
253
252
|
if (focusedMeta?.blocksMultiToggle) return { kind: "ignore" };
|
|
254
253
|
if (focusedMeta?.activatesInputMode) return { kind: "ignore" };
|
|
255
254
|
return { kind: "toggle", index: state.optionIndex };
|
|
@@ -342,7 +341,7 @@ export function routeKey(data: string, state: QuestionnaireState, runtime: Quest
|
|
|
342
341
|
// "Type something.") is irrelevant: the gate sits ABOVE the multi-select
|
|
343
342
|
// toggle block and the Next sentinel never activates inputMode, so `n` is
|
|
344
343
|
// neither swallowed earlier nor blocked by `blocksMultiToggle`.
|
|
345
|
-
if (data
|
|
344
|
+
if (matchesKey(data, NOTES_ACTIVATE_KEY)) {
|
|
346
345
|
return { kind: "notes_enter" };
|
|
347
346
|
}
|
|
348
347
|
|
package/state/state-reducer.ts
CHANGED
|
@@ -124,12 +124,24 @@ function withoutCustomDraft(state: QuestionnaireState, tab: number): ReadonlyMap
|
|
|
124
124
|
return drafts;
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
+
/**
|
|
128
|
+
* Row focused on entering a tab: the chosen option, or Next for a multi-select answer, so a
|
|
129
|
+
* stray Enter re-confirms the answer instead of replacing it with row 0. A custom answer
|
|
130
|
+
* starts at row 0, since focusing its row would enter input mode.
|
|
131
|
+
*/
|
|
132
|
+
function answeredRowIndex(answer: QuestionAnswer | undefined, items: readonly WrappingSelectItem[]): number {
|
|
133
|
+
let index = -1;
|
|
134
|
+
if (answer?.kind === "option") index = items.findIndex((i) => i.kind === "option" && i.label === answer.answer);
|
|
135
|
+
if (answer?.kind === "multi") index = items.findIndex((i) => i.kind === "next");
|
|
136
|
+
return Math.max(0, index);
|
|
137
|
+
}
|
|
138
|
+
|
|
127
139
|
function switchTabResult(state: QuestionnaireState, nextTab: number, ctx: ApplyContext): ApplyResult {
|
|
128
140
|
const notesValue = notesValueFor(state, nextTab);
|
|
129
141
|
const transitioned: QuestionnaireState = {
|
|
130
142
|
...state,
|
|
131
143
|
currentTab: nextTab,
|
|
132
|
-
optionIndex:
|
|
144
|
+
optionIndex: answeredRowIndex(state.answers.get(nextTab), ctx.itemsByTab[nextTab] ?? []),
|
|
133
145
|
inputMode: false,
|
|
134
146
|
notesVisible: false,
|
|
135
147
|
submitChoiceIndex: 0,
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import type { Theme } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import { type Component, truncateToWidth, visibleWidth, wrapTextWithAnsi } from "@earendil-works/pi-tui";
|
|
3
|
+
import { t } from "../state/i18n-bridge.ts";
|
|
4
|
+
import { NO_INPUT_PLACEHOLDER } from "../tool/format-answer.ts";
|
|
5
|
+
import {
|
|
6
|
+
isQuestionnaireResult,
|
|
7
|
+
type QuestionAnswer,
|
|
8
|
+
type QuestionnaireResult,
|
|
9
|
+
type QuestionParams,
|
|
10
|
+
} from "../tool/types.ts";
|
|
11
|
+
import { stripFenceMarkers } from "./components/preview/preview-box-renderer.ts";
|
|
12
|
+
|
|
13
|
+
const INDENT = " ";
|
|
14
|
+
const COLUMN_GAP = " ";
|
|
15
|
+
const RECOMMENDED_SUFFIX = /\s*\(Recommended\)$/;
|
|
16
|
+
|
|
17
|
+
type ToolResultView = { content: ReadonlyArray<{ type: string; text?: string }>; details?: unknown };
|
|
18
|
+
|
|
19
|
+
/** Lines laid out at render time, so wrapping and truncation follow the terminal width. */
|
|
20
|
+
class WidthLines implements Component {
|
|
21
|
+
constructor(private readonly layout: (width: number) => string[]) {}
|
|
22
|
+
render(width: number): string[] {
|
|
23
|
+
return this.layout(width);
|
|
24
|
+
}
|
|
25
|
+
invalidate(): void {}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** `Ask Format · Migration`: the headers name the questions. */
|
|
29
|
+
export function renderAskCall(args: QuestionParams | undefined, theme: Theme): Component {
|
|
30
|
+
const headers = (args?.questions ?? []).map((q) => q?.header).filter(Boolean);
|
|
31
|
+
const title = theme.fg("toolTitle", theme.bold("Ask"));
|
|
32
|
+
const text = headers.length > 0 ? `${title} ${theme.fg("accent", headers.join(" · "))}` : title;
|
|
33
|
+
return new WidthLines((width) => [truncateToWidth(text, width, "…")]);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The transcript receipt: one `✓ answer` line for a single question, an aligned
|
|
38
|
+
* header/answer table for several. A failure shows `✗` with the first line of the
|
|
39
|
+
* model-facing message; a declined questionnaire shows a dimmed `✗ no answer`.
|
|
40
|
+
*/
|
|
41
|
+
export function renderAskResult(
|
|
42
|
+
result: ToolResultView,
|
|
43
|
+
args: QuestionParams | undefined,
|
|
44
|
+
theme: Theme,
|
|
45
|
+
options: { expanded: boolean; isError: boolean },
|
|
46
|
+
): Component {
|
|
47
|
+
const details = isQuestionnaireResult(result.details) ? result.details : undefined;
|
|
48
|
+
if (options.isError || details?.error) {
|
|
49
|
+
return new WidthLines(() => [theme.fg("error", `✗ ${firstTextLine(result)}`)]);
|
|
50
|
+
}
|
|
51
|
+
if (!details) return new WidthLines(() => [theme.fg("success", "✓")]);
|
|
52
|
+
if (details.cancelled) {
|
|
53
|
+
return new WidthLines(() => [theme.fg("dim", `✗ ${t("transcript.no_answer", "no answer")}`)]);
|
|
54
|
+
}
|
|
55
|
+
const questions = args?.questions ?? [];
|
|
56
|
+
return new WidthLines((width) =>
|
|
57
|
+
questions.length > 1
|
|
58
|
+
? tableLines(details, args as QuestionParams, theme, options.expanded, width)
|
|
59
|
+
: singleLines(details, questions[0]?.question, theme, options.expanded, width),
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function singleLines(
|
|
64
|
+
details: QuestionnaireResult,
|
|
65
|
+
questionText: string | undefined,
|
|
66
|
+
theme: Theme,
|
|
67
|
+
expanded: boolean,
|
|
68
|
+
width: number,
|
|
69
|
+
): string[] {
|
|
70
|
+
const answer = details.answers[0];
|
|
71
|
+
const lines = hanging(`${theme.fg("success", "✓")} `, answerText(answer, theme), width);
|
|
72
|
+
lines.push(...detailLines(answer, expanded ? questionText : undefined, INDENT, theme, width));
|
|
73
|
+
return [...lines, ...globalNoteLines(details, theme, width)];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function tableLines(
|
|
77
|
+
details: QuestionnaireResult,
|
|
78
|
+
args: QuestionParams,
|
|
79
|
+
theme: Theme,
|
|
80
|
+
expanded: boolean,
|
|
81
|
+
width: number,
|
|
82
|
+
): string[] {
|
|
83
|
+
const headerWidth = Math.max(...args.questions.map((q) => visibleWidth(q.header)));
|
|
84
|
+
const answerIndent = " ".repeat(INDENT.length + headerWidth + COLUMN_GAP.length);
|
|
85
|
+
const lines = args.questions.flatMap((q, i) => {
|
|
86
|
+
const answer = details.answers.find((a) => a.questionIndex === i);
|
|
87
|
+
const header = q.header + " ".repeat(headerWidth - visibleWidth(q.header));
|
|
88
|
+
const row = hanging(`${INDENT}${theme.fg("muted", header)}${COLUMN_GAP}`, answerText(answer, theme), width);
|
|
89
|
+
return [...row, ...detailLines(answer, expanded ? q.question : undefined, answerIndent, theme, width)];
|
|
90
|
+
});
|
|
91
|
+
return [...lines, ...globalNoteLines(details, theme, width)];
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** Under an answer: the question text and chosen preview when expanded, then the answer's note. */
|
|
95
|
+
function detailLines(
|
|
96
|
+
answer: QuestionAnswer | undefined,
|
|
97
|
+
questionText: string | undefined,
|
|
98
|
+
indent: string,
|
|
99
|
+
theme: Theme,
|
|
100
|
+
width: number,
|
|
101
|
+
): string[] {
|
|
102
|
+
const lines: string[] = [];
|
|
103
|
+
if (questionText) lines.push(...hanging(indent, theme.fg("dim", questionText), width));
|
|
104
|
+
if (questionText && answer?.preview) {
|
|
105
|
+
for (const line of stripFenceMarkers(answer.preview.split("\n"))) {
|
|
106
|
+
lines.push(truncateToWidth(`${indent}${theme.fg("dim", `│ ${line}`)}`, width, "…"));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (answer?.notes) lines.push(...hanging(indent, theme.fg("dim", `✎ ${answer.notes}`), width));
|
|
110
|
+
return lines;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function globalNoteLines(details: QuestionnaireResult, theme: Theme, width: number): string[] {
|
|
114
|
+
return details.globalNote ? hanging(INDENT, theme.fg("dim", `✎ ${details.globalNote}`), width) : [];
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function answerText(answer: QuestionAnswer | undefined, theme: Theme): string {
|
|
118
|
+
if (!answer) return theme.fg("dim", t("transcript.not_answered", "not answered"));
|
|
119
|
+
const typed = answer.answer ? `"${answer.answer}"` : undefined;
|
|
120
|
+
const picks =
|
|
121
|
+
answer.kind === "option"
|
|
122
|
+
? [label(answer.answer ?? "")]
|
|
123
|
+
: answer.kind === "custom"
|
|
124
|
+
? [typed]
|
|
125
|
+
: [...(answer.selected ?? []).map(label), typed];
|
|
126
|
+
return theme.fg("toolOutput", picks.filter(Boolean).join(", ") || NO_INPUT_PLACEHOLDER);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function label(text: string): string {
|
|
130
|
+
return text.replace(RECOMMENDED_SUFFIX, "");
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/** `prefix` then `text` wrapped to the width left after it; continuation lines align under the text. */
|
|
134
|
+
function hanging(prefix: string, text: string, width: number): string[] {
|
|
135
|
+
const indent = visibleWidth(prefix);
|
|
136
|
+
return wrapTextWithAnsi(text, Math.max(1, width - indent)).map(
|
|
137
|
+
(line, i) => (i === 0 ? prefix : " ".repeat(indent)) + line,
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function firstTextLine(result: ToolResultView): string {
|
|
142
|
+
const text = result.content.find((c) => c.type === "text")?.text ?? "";
|
|
143
|
+
return text.split("\n")[0] ?? "";
|
|
144
|
+
}
|