@yusukeshib/pi-babysit 0.6.2 → 0.6.4
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/README.md +4 -2
- package/index.ts +52 -39
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -80,8 +80,10 @@ backgrounding (`… &`, `nohup`, `setsid`, `disown`). Set
|
|
|
80
80
|
|
|
81
81
|
A widget below the editor separates session **kind** from task **state** at a glance:
|
|
82
82
|
summary counts use `RUNNING` / `IDLE`, and every row is labeled
|
|
83
|
-
`
|
|
84
|
-
|
|
83
|
+
`PROCESS RUNNING`, `AGENT RUNNING`, or `AGENT IDLE`. The displayed `age`
|
|
84
|
+
is total session age, not time spent in the current state. Transcript details
|
|
85
|
+
from tool results, snapshots, and completion notifications collapse or expand
|
|
86
|
+
with Pi's tool-output toggle (`Ctrl+O` by default).
|
|
85
87
|
|
|
86
88
|
## Logs without context flooding
|
|
87
89
|
|
package/index.ts
CHANGED
|
@@ -2274,9 +2274,9 @@ export function widgetSummaryText(procs: number, busy: number, idle: number): st
|
|
|
2274
2274
|
const running: string[] = [];
|
|
2275
2275
|
if (procs > 0) running.push(`${procs} process${procs > 1 ? "es" : ""}`);
|
|
2276
2276
|
if (busy > 0) running.push(`${busy} agent${busy > 1 ? "s" : ""}`);
|
|
2277
|
-
if (running.length > 0) sections.push(`RUNNING
|
|
2278
|
-
if (idle > 0) sections.push(`IDLE
|
|
2279
|
-
return sections.join("
|
|
2277
|
+
if (running.length > 0) sections.push(`RUNNING ${running.join(" ")}`);
|
|
2278
|
+
if (idle > 0) sections.push(`IDLE ${idle} agent${idle > 1 ? "s" : ""}`);
|
|
2279
|
+
return sections.join(" ");
|
|
2280
2280
|
}
|
|
2281
2281
|
|
|
2282
2282
|
export function widgetSessionHeader(
|
|
@@ -2286,7 +2286,7 @@ export function widgetSessionHeader(
|
|
|
2286
2286
|
elapsed?: string,
|
|
2287
2287
|
): string {
|
|
2288
2288
|
const icon = state === "running" ? "▶" : "○";
|
|
2289
|
-
return ` ${icon} ${id}
|
|
2289
|
+
return ` ${icon} ${id} ${kind.toUpperCase()} ${state.toUpperCase()}${elapsed ? ` age ${elapsed}` : ""}`;
|
|
2290
2290
|
}
|
|
2291
2291
|
|
|
2292
2292
|
function renderWidgetLines(procs: number, busy: number, idle: number, theme: Theme): string[] {
|
|
@@ -2296,12 +2296,12 @@ function renderWidgetLines(procs: number, busy: number, idle: number, theme: The
|
|
|
2296
2296
|
if (procs > 0) running.push(`${procs} process${procs > 1 ? "es" : ""}`);
|
|
2297
2297
|
if (busy > 0) running.push(`${busy} agent${busy > 1 ? "s" : ""}`);
|
|
2298
2298
|
if (running.length > 0) {
|
|
2299
|
-
sections.push(`${theme.fg("success", theme.bold("RUNNING"))}
|
|
2299
|
+
sections.push(`${theme.fg("success", theme.bold("RUNNING"))} ${running.join(" ")}`);
|
|
2300
2300
|
}
|
|
2301
2301
|
if (idle > 0) {
|
|
2302
|
-
sections.push(`${theme.fg("muted", theme.bold("IDLE"))}
|
|
2302
|
+
sections.push(`${theme.fg("muted", theme.bold("IDLE"))} ${idle} agent${idle > 1 ? "s" : ""}`);
|
|
2303
2303
|
}
|
|
2304
|
-
return [theme.bg("toolPendingBg", ` ${sections.join("
|
|
2304
|
+
return [theme.bg("toolPendingBg", ` ${sections.join(" ")} `)];
|
|
2305
2305
|
}
|
|
2306
2306
|
|
|
2307
2307
|
function renderWidgetSessionHeader(
|
|
@@ -2313,9 +2313,9 @@ function renderWidgetSessionHeader(
|
|
|
2313
2313
|
): string {
|
|
2314
2314
|
const running = state === "running";
|
|
2315
2315
|
const icon = theme.fg(running ? "success" : "muted", running ? "▶" : "○");
|
|
2316
|
-
const kindLabel = theme.fg(kind === "process" ? "accent" : "warning", theme.bold(
|
|
2317
|
-
const stateLabel = theme.fg(running ? "success" : "muted", theme.bold(
|
|
2318
|
-
return ` ${icon} ${id}
|
|
2316
|
+
const kindLabel = theme.fg(kind === "process" ? "accent" : "warning", theme.bold(kind.toUpperCase()));
|
|
2317
|
+
const stateLabel = theme.fg(running ? "success" : "muted", theme.bold(state.toUpperCase()));
|
|
2318
|
+
return ` ${icon} ${id} ${kindLabel} ${stateLabel}${elapsed ? theme.fg("dim", ` age ${elapsed}`) : ""}`;
|
|
2319
2319
|
}
|
|
2320
2320
|
|
|
2321
2321
|
// How many trailing output lines to show per running session in the widget.
|
|
@@ -3257,10 +3257,10 @@ export default function (pi: ExtensionAPI) {
|
|
|
3257
3257
|
theme,
|
|
3258
3258
|
);
|
|
3259
3259
|
if (tails[index].length === 1) {
|
|
3260
|
-
lines.push(`${header}
|
|
3260
|
+
lines.push(`${header} ${tails[index][0]}`);
|
|
3261
3261
|
} else {
|
|
3262
3262
|
lines.push(header);
|
|
3263
|
-
for (const tail of tails[index]) lines.push(`
|
|
3263
|
+
for (const tail of tails[index]) lines.push(` ${tail}`);
|
|
3264
3264
|
}
|
|
3265
3265
|
});
|
|
3266
3266
|
ctx.ui.setWidget("pi-babysit", lines, { placement: "belowEditor" });
|
|
@@ -3294,7 +3294,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
3294
3294
|
|
|
3295
3295
|
// Render snapshots and subagent answers INLINE in the transcript as formatted
|
|
3296
3296
|
// markdown, with a semantic status label that remains readable on any theme.
|
|
3297
|
-
pi.registerMessageRenderer("pi-babysit-result", (message,
|
|
3297
|
+
pi.registerMessageRenderer("pi-babysit-result", (message, { expanded }, theme) => {
|
|
3298
3298
|
const d = (message.details ?? {}) as {
|
|
3299
3299
|
title?: string;
|
|
3300
3300
|
body?: string;
|
|
@@ -3305,35 +3305,44 @@ export default function (pi: ExtensionAPI) {
|
|
|
3305
3305
|
const box = new Box(1, 0, (t) => theme.bg("toolSuccessBg", t));
|
|
3306
3306
|
if (d.status) box.addChild(new Text(renderStatus(d.status, theme), 0, 0));
|
|
3307
3307
|
if (d.title) box.addChild(new Text(theme.fg("accent", d.title), 0, 0));
|
|
3308
|
-
box.addChild(new Markdown(body, 0, 0, getMarkdownTheme()));
|
|
3308
|
+
if (expanded && body) box.addChild(new Markdown(body, 0, 0, getMarkdownTheme()));
|
|
3309
3309
|
return box;
|
|
3310
3310
|
});
|
|
3311
3311
|
|
|
3312
3312
|
// Process-end notification rendering with a colored lifecycle label. Keep the
|
|
3313
3313
|
// box background subtle: coloring a potentially large log excerpt is noisy.
|
|
3314
|
-
pi.registerMessageRenderer(
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3314
|
+
pi.registerMessageRenderer(
|
|
3315
|
+
"pi-babysit-process-end",
|
|
3316
|
+
(message, { expanded }, theme) => {
|
|
3317
|
+
const content = typeof message.content === "string" ? message.content : "";
|
|
3318
|
+
const d = (message.details ?? {}) as {
|
|
3319
|
+
status?: DisplayStatus;
|
|
3320
|
+
success?: boolean;
|
|
3321
|
+
exitCode?: number | null;
|
|
3322
|
+
command?: string;
|
|
3323
|
+
count?: number;
|
|
3324
|
+
};
|
|
3325
|
+
const status =
|
|
3326
|
+
d.status ??
|
|
3327
|
+
(d.success ? "success" : d.exitCode == null ? "terminated" : "failed");
|
|
3328
|
+
const payload = d.command
|
|
3329
|
+
? ` ${summarizeNotificationCommand(d.command)}`
|
|
3330
|
+
: d.count && d.count > 1
|
|
3331
|
+
? ` ×${d.count}`
|
|
3332
|
+
: "";
|
|
3333
|
+
const header = theme.fg(
|
|
3334
|
+
"warning",
|
|
3335
|
+
theme.bold(`babysit_run COMMAND${payload}`),
|
|
3336
|
+
);
|
|
3337
|
+
const box = new Box(1, 1, (t) => theme.bg("toolSuccessBg", t));
|
|
3338
|
+
box.addChild(new Text(header, 0, 0));
|
|
3339
|
+
box.addChild(new Text(renderStatus(status, theme), 0, 0));
|
|
3340
|
+
if (expanded && content) {
|
|
3341
|
+
box.addChild(new Text(theme.fg("toolOutput", content), 0, 0));
|
|
3342
|
+
}
|
|
3343
|
+
return box;
|
|
3344
|
+
},
|
|
3345
|
+
);
|
|
3337
3346
|
|
|
3338
3347
|
let polling = false;
|
|
3339
3348
|
pi.on("session_start", async (_event, ctx) => {
|
|
@@ -3950,7 +3959,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
3950
3959
|
: "";
|
|
3951
3960
|
return new Text(theme.fg("warning", `${title}${agent}${detail}`), 0, 0);
|
|
3952
3961
|
},
|
|
3953
|
-
renderResult(result, { isPartial }, theme, context) {
|
|
3962
|
+
renderResult(result, { expanded, isPartial }, theme, context) {
|
|
3954
3963
|
const details = (result.details ?? {}) as {
|
|
3955
3964
|
kind?: "process" | "subagent";
|
|
3956
3965
|
status?: DisplayStatus;
|
|
@@ -3977,7 +3986,11 @@ export default function (pi: ExtensionAPI) {
|
|
|
3977
3986
|
? "started"
|
|
3978
3987
|
: "success");
|
|
3979
3988
|
const label = renderStatus(status, theme);
|
|
3980
|
-
return new Text(
|
|
3989
|
+
return new Text(
|
|
3990
|
+
expanded && content ? `${label}\n${theme.fg("toolOutput", content)}` : label,
|
|
3991
|
+
0,
|
|
3992
|
+
0,
|
|
3993
|
+
);
|
|
3981
3994
|
},
|
|
3982
3995
|
});
|
|
3983
3996
|
|