@pi-kaush/pi-tool-call-markers 0.3.7 → 0.3.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.
- package/CHANGELOG.md +7 -0
- package/README.md +2 -0
- package/package.json +1 -1
- package/src/question-block.ts +33 -22
- package/src/thinking-block-merger.ts +16 -5
package/CHANGELOG.md
CHANGED
|
@@ -22,6 +22,13 @@
|
|
|
22
22
|
existing `!`-block shape (1/0) come from one code path instead of the body
|
|
23
23
|
width being hardcoded.
|
|
24
24
|
|
|
25
|
+
- Separate asked questions with one painted blank row. Adjacent questions ran
|
|
26
|
+
together as one wall of text; each question/answer pair now gets a blank body
|
|
27
|
+
row between it and the next. A lone question keeps its outcome on the
|
|
28
|
+
following line, and a global outcome (still awaiting, or declined) is
|
|
29
|
+
separated from a multi-question ask so it cannot read as answering only the
|
|
30
|
+
last question.
|
|
31
|
+
|
|
25
32
|
- Extract the railed prompt shell into `src/prompt-shell.ts`. User `!` blocks
|
|
26
33
|
and asked-question blocks share one implementation of the inset, rail,
|
|
27
34
|
surface background, and background repaint instead of two.
|
package/README.md
CHANGED
|
@@ -55,6 +55,7 @@ A call that asks the user something is a user-input moment, not an execution row
|
|
|
55
55
|
▎
|
|
56
56
|
▎ > Which call-site shape should `notifications:` use?
|
|
57
57
|
▎ User: Nested within subagent (Recommended)
|
|
58
|
+
▎
|
|
58
59
|
▎ > Which tier should the flag read at runtime?
|
|
59
60
|
▎ User: Client only, Client and server
|
|
60
61
|
▎
|
|
@@ -66,6 +67,7 @@ The block reuses `pi-content-layout`'s submitted-prompt geometry — the same ra
|
|
|
66
67
|
- **Answers, not options.** Each question shows its answer: an option label, typed custom text, or multi-select labels joined with commas. A question left blank reads `User: (no answer)`, a decline reads `User declined to answer questions`, and a validation failure keeps Pi's native failure row.
|
|
67
68
|
- **Quoted questions.** The question is the model's text read inside a user-input shell, so it renders italic under a `>` marker and the answer stays upright: the answer is the user's own words. A theme without italics renders the question plainly.
|
|
68
69
|
- **Prompt-shell tones.** The rail uses `borderAccent` and the body paints on `userMessageBg`, with the question in `text`, the `User:` label in `muted`, the answer in `userMessageText`, and a live row's `awaiting your answer…` in `warning`.
|
|
70
|
+
- **One blank row per question.** Questions are separated by a painted blank row so a multi-question ask stays scannable. A lone question keeps its outcome on the following line.
|
|
69
71
|
- **No grouping.** Question blocks never join an adjacent tool group and carry no tool glyph. `Ctrl+O` still restores Pi's native expanded rendering.
|
|
70
72
|
|
|
71
73
|
## Edit diffs
|
package/package.json
CHANGED
package/src/question-block.ts
CHANGED
|
@@ -41,7 +41,9 @@ type AnswerEntry = {
|
|
|
41
41
|
type QuestionLine =
|
|
42
42
|
| { kind: "question"; text: string }
|
|
43
43
|
| { kind: "answer"; text: string }
|
|
44
|
-
| { kind: "status"; text: string; tone: "muted" | "warning" }
|
|
44
|
+
| { kind: "status"; text: string; tone: "muted" | "warning" }
|
|
45
|
+
// A painted blank body row; the shell gives it the prompt surface.
|
|
46
|
+
| { kind: "spacer" };
|
|
45
47
|
|
|
46
48
|
// rpiv's canonical decline text, reused verbatim so the transcript says what
|
|
47
49
|
// the model was told.
|
|
@@ -173,30 +175,38 @@ function questionLines(
|
|
|
173
175
|
}
|
|
174
176
|
if (pairs.length === 0) return undefined;
|
|
175
177
|
|
|
176
|
-
const
|
|
177
|
-
const
|
|
178
|
-
|
|
179
|
-
);
|
|
180
|
-
if (row.isPartial === true) {
|
|
181
|
-
return [
|
|
182
|
-
...questions,
|
|
183
|
-
{ kind: "status", text: AWAITING_TEXT, tone: "warning" },
|
|
184
|
-
];
|
|
185
|
-
}
|
|
186
|
-
if (
|
|
178
|
+
const pending = row.isPartial === true;
|
|
179
|
+
const declined =
|
|
180
|
+
!pending &&
|
|
187
181
|
isRecord(details) &&
|
|
188
182
|
details.cancelled === true &&
|
|
189
|
-
pairs.every((pair) => pair.answer === undefined)
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
];
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
183
|
+
pairs.every((pair) => pair.answer === undefined);
|
|
184
|
+
|
|
185
|
+
// One group per question. Groups are separated by a painted blank row so a
|
|
186
|
+
// multi-question ask stays scannable.
|
|
187
|
+
const groups: QuestionLine[][] = pairs.map((pair) => {
|
|
188
|
+
const group: QuestionLine[] = [{ kind: "question", text: pair.question }];
|
|
189
|
+
if (!pending && !declined) {
|
|
190
|
+
group.push({ kind: "answer", text: pair.answer ?? NO_ANSWER_TEXT });
|
|
191
|
+
}
|
|
192
|
+
return group;
|
|
193
|
+
});
|
|
194
|
+
if (pending || declined) {
|
|
195
|
+
const status: QuestionLine = pending
|
|
196
|
+
? { kind: "status", text: AWAITING_TEXT, tone: "warning" }
|
|
197
|
+
: { kind: "status", text: DECLINE_TEXT, tone: "muted" };
|
|
198
|
+
// A lone question keeps its outcome on the following line; a
|
|
199
|
+
// multi-question ask separates the global outcome so it cannot read as
|
|
200
|
+
// answering only the last question.
|
|
201
|
+
if (groups.length > 1) groups.push([status]);
|
|
202
|
+
else groups[0]!.push(status);
|
|
199
203
|
}
|
|
204
|
+
|
|
205
|
+
const lines: QuestionLine[] = [];
|
|
206
|
+
groups.forEach((group, index) => {
|
|
207
|
+
if (index > 0) lines.push({ kind: "spacer" });
|
|
208
|
+
lines.push(...group);
|
|
209
|
+
});
|
|
200
210
|
return lines;
|
|
201
211
|
}
|
|
202
212
|
|
|
@@ -258,6 +268,7 @@ function styleLine(
|
|
|
258
268
|
width: number,
|
|
259
269
|
theme: QuestionTheme,
|
|
260
270
|
): string[] {
|
|
271
|
+
if (line.kind === "spacer") return [""];
|
|
261
272
|
const prefix =
|
|
262
273
|
line.kind === "question"
|
|
263
274
|
? QUESTION_PREFIX
|
|
@@ -148,10 +148,23 @@ type MarkdownLikeChild = {
|
|
|
148
148
|
// the italic default style is what identifies the trace: Pi passes it for
|
|
149
149
|
// thinking content and for nothing else. Callers gate on the row actually
|
|
150
150
|
// carrying thinking, so no other italic block is touched.
|
|
151
|
-
|
|
151
|
+
// Pi 1.0 wraps each thinking child in a MouseRegion (click toggles
|
|
152
|
+
// visibility); older versions hang the Markdown/Text directly. Walk both
|
|
153
|
+
// shapes so the restyle reaches the node either way.
|
|
154
|
+
function contentNodes(row: AssistantMessageRow): unknown[] {
|
|
152
155
|
const children = row.contentContainer?.children;
|
|
153
|
-
if (!Array.isArray(children)) return;
|
|
156
|
+
if (!Array.isArray(children)) return [];
|
|
157
|
+
const nodes: unknown[] = [];
|
|
154
158
|
for (const child of children) {
|
|
159
|
+
nodes.push(child);
|
|
160
|
+
const inner = (child as { child?: unknown } | undefined)?.child;
|
|
161
|
+
if (inner !== undefined && inner !== null) nodes.push(inner);
|
|
162
|
+
}
|
|
163
|
+
return nodes;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function unitalicizeSettledThinking(row: AssistantMessageRow): void {
|
|
167
|
+
for (const child of contentNodes(row)) {
|
|
155
168
|
const markdown = child as MarkdownLikeChild | undefined;
|
|
156
169
|
const style = markdown?.defaultTextStyle;
|
|
157
170
|
if (style?.italic !== true) continue;
|
|
@@ -174,11 +187,9 @@ function restyleHiddenThinkingLabel(row: AssistantMessageRow): void {
|
|
|
174
187
|
return;
|
|
175
188
|
}
|
|
176
189
|
const label = row.hiddenThinkingLabel;
|
|
177
|
-
const children = row.contentContainer?.children;
|
|
178
|
-
if (!Array.isArray(children)) return;
|
|
179
190
|
if (!stylesThinkingLabels()) return;
|
|
180
191
|
const styled = visibleThoughtLabel(label);
|
|
181
|
-
for (const child of
|
|
192
|
+
for (const child of contentNodes(row)) {
|
|
182
193
|
const textChild = child as TextLikeChild | undefined;
|
|
183
194
|
if (
|
|
184
195
|
typeof textChild?.text !== "string" ||
|