pi-ext
bugabingas pi extensions
owned by admin
feat(ultra): show phases and runs in collapsed tool view
a9ba080beab49a07a5bf7a3c42bde95aeb85a7b8
Oliver Jan Krylow <oliver@bugabinga.net> ·
SSH signature · not checked
Browse filesCompare with HEAD
Changed files (2)
extensions/ultra/__tests__/ui.test.ts
Modified 255 255 expect(collapsed).
toContain(
"1 active");
256 256 expect(collapsed).
toContain(
"1 queued");
257 257 expect(collapsed).
toContain(
"2 later");
258 - expect(collapsed).not.
toContain(
"active#0");
258 + expect(collapsed).
toContain(
"▶ active");
259 + expect(collapsed).
toContain(
"active#0 · Review active path");
260 + expect(collapsed).
toContain(
"active#1 · Check failed path");
261 + expect(collapsed).not.
toContain(
"transport: rate limited");
261 264 it(
"truncation keeps ellipsis in the surrounding style span", ()
=> {
317 - it(
"collapsed: shows phase/agent counts + summary + expand hint, never bodies", ()
=> {
320 + it(
"collapsed: shows phase and run summaries without actions or transcripts", ()
=> {
318 321 const out
= toolText(scripted, { expanded:
false, isPartial:
true });
320 323 expect(out).
toContain(
"phase 1/1");
322 325 expect(out).
toContain(
"1✗");
324 327 expect(out).
toContain(
"to expand");
328 + expect(out).
toContain(
"▶ review");
329 + expect(out).
toContain(
" a");
330 + expect(out).
toContain(
" b");
326 331 expect(out).not.
toContain(
"/SECRET-ACTION");
327 332 expect(out).not.
toContain(
"SECRET-TRANSCRIPT-BODY");
329 - expect(out).not.
toContain(
"agentId");
333 + expect(out).not.
toContain(
"rate limited");
336 + it(
"collapsed: bounds visible phases and runs while keeping the active phase", ()
=> {
337 + const phases
= [
"prepare",
"scan",
"review",
"verify",
"publish"].
map(
338 + (phase)
=> ({ phase, status:
"resolved" as const, agentIds: [] }),
340 + let state
= reduceProgress(
initialReducerState(), {
342 + startedAt:
Date.
now(),
345 + state
= reduceProgress(state, {
348 + status:
"resolved",
349 + agentIds: [
"verify#0",
"verify#1",
"verify#2",
"verify#3",
"verify#4"],
351 + for (
let index
= 0; index
< 5; index
++) {
352 + state
= reduceProgress(
355 + agentId:
`verify#${index}`,
358 + summary:
`Run ${index}`,
359 + prompt:
"SECRET EXACT PROMPT",
362 + state
= reduceProgress(
364 + pe({ agentId:
`verify#${index}`, phase:
"verify", kind:
"start" }),
367 + for (
const width
of [
24,
54,
120]) {
368 + const lines
= renderTool(
370 + { expanded:
false, isPartial:
true },
373 + const out
= lines.
join(
"\n");
374 + expect(out).
toContain(
"▶ verify");
375 + expect(out).
toContain(
"earlier phases");
376 + expect(out).
toContain(
"more runs");
377 + expect(out).
toContain(
"verify#0");
378 + expect(out).not.
toContain(
"SECRET EXACT PROMPT");
380 + lines.
every((line)
=> stripVTControlCharacters(line).
length <= width),
332 385 it(
"expanded: shows authored summaries but never exact prompts", ()
=> {
extensions/ultra/ui.ts
Modified 377 377 lines.
push(theme.
fg(
"muted",
fitLine(metrics, w)));
379 379 if (
!options.expanded) {
380 + const focus
= Math.
max(
382 + state.phases.
findIndex((phase)
=> phase.phase
=== state.phase),
384 + const first
= Math.
max(
0,
Math.
min(focus
- 1, state.phases.
length - 3));
386 + lines.
push(theme.
fg(
"dim",
fitLine(
` ${first} earlier phases`, w)));
387 + for (
const phase
of state.phases.
slice(first, first
+ 3))
389 + theme.
fg(
"muted",
fitLine(
` ${phaseLabel(state, phase, false)}`, w)),
391 + const remaining
= state.phases.
length - first
- 3;
393 + lines.
push(theme.
fg(
"dim",
fitLine(
` ${remaining} later phases`, w)));
397 + state.phases.
find((phase)
=> phase.
status === "resolved")?.phase;
398 + const runs
= current
? rowsInPhase(state, current)
: [];
399 + const ranked
= ([
"running",
"dropped",
"queued",
"done"]
as const).
flatMap(
400 + (status)
=> runs.
filter((row)
=> row.
status === status),
402 + for (
const row
of ranked.
slice(
0,
3)) {
403 + const summary
= row.
summary?.
trim();
404 + const label
= summary
? `${row.agentId} · ${summary}` : row.agentId;
407 + row.
status === "dropped" ? "error" : "muted",
408 + fitLine(
` ${STATUS_ICON[row.status]} ${label}`, w),
412 + if (ranked.
length > 3)
414 + theme.
fg(
"dim",
fitLine(
` ${ranked.length - 3} more runs`, w)),
380 416 if (state.workflowResult?.fullOutputPath)
384 420 fitLine(
`Evidence: ${state.workflowResult.fullOutputPath}`, w),
388 423 lines.
push(theme.
fg(
"muted",
fitLine(
expandHint(), w)));
389 424 return lines.
map((l)
=> fitLine(l, w));