@yusukeshib/pi-babysit 0.6.23 → 0.6.24
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 +5 -3
- package/index.ts +8 -3
- package/log-viewer.ts +5 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -167,9 +167,11 @@ sessions, and click again to return to running-only. Both modes show newest firs
|
|
|
167
167
|
ten per page; `< 1/4 >` shows the current/total page when needed. Click the
|
|
168
168
|
arrows to page. Rows occupy one line, previewing the description (or the command
|
|
169
169
|
for older processes and task for older agents), with `…` when clipped. Click an
|
|
170
|
-
AGENT or PROCESS row to replace the list with a
|
|
171
|
-
overlay or separate screen.
|
|
172
|
-
|
|
170
|
+
AGENT or PROCESS row to replace the list with a **log viewer in the same widget area**, not an
|
|
171
|
+
overlay or separate screen. The viewer is capped at ten lines including its header
|
|
172
|
+
and footer; all saved history remains available by scrolling. Click anywhere on
|
|
173
|
+
the viewer's header row to restore the list, preserving its mode and page.
|
|
174
|
+
There is no separate Close button or Esc binding. The viewer uses Pi's `ScrollView` for
|
|
173
175
|
scroll position and follow behavior, with a widget-local scrollbar styled using
|
|
174
176
|
Pi's scrollbar theme. Wheel, scrollbar drag/track clicks, and ↑/↓ navigate the
|
|
175
177
|
log without requiring any Pi core changes. Home/End and PageUp/PageDown remain
|
package/index.ts
CHANGED
|
@@ -2600,6 +2600,7 @@ function renderWidgetSessionHeader(
|
|
|
2600
2600
|
// How many trailing output lines to show per session in the widget.
|
|
2601
2601
|
const WIDGET_COLLAPSED_TAIL_LINES = 1;
|
|
2602
2602
|
const WIDGET_SESSION_PAGE_SIZE = 10;
|
|
2603
|
+
const WIDGET_VIEWER_MAX_LINES = 10;
|
|
2603
2604
|
|
|
2604
2605
|
export interface WidgetSessionListState {
|
|
2605
2606
|
mode: "running" | "all";
|
|
@@ -2755,7 +2756,11 @@ export function createSessionWidget(options: {
|
|
|
2755
2756
|
viewer?.dispose();
|
|
2756
2757
|
source = undefined;
|
|
2757
2758
|
selectedId = id;
|
|
2758
|
-
viewer = createLogViewer({
|
|
2759
|
+
viewer = createLogViewer({
|
|
2760
|
+
...options,
|
|
2761
|
+
getHeight: () => Math.min(WIDGET_VIEWER_MAX_LINES, options.getHeight()),
|
|
2762
|
+
onClose: close,
|
|
2763
|
+
});
|
|
2759
2764
|
refreshViewer();
|
|
2760
2765
|
options.requestRender();
|
|
2761
2766
|
}
|
|
@@ -4186,7 +4191,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
4186
4191
|
: d.count && d.count > 1
|
|
4187
4192
|
? theme.fg("muted", `×${d.count}`)
|
|
4188
4193
|
: "";
|
|
4189
|
-
const header = theme.fg("muted", theme.bold("babysit_run
|
|
4194
|
+
const header = theme.fg("muted", theme.bold("babysit_run PROCESS")) + (payload ? ` ${payload}` : "");
|
|
4190
4195
|
const box = new Box(1, 1, (t) => theme.bg("toolSuccessBg", t));
|
|
4191
4196
|
box.addChild(new Text(header, 0, 0));
|
|
4192
4197
|
box.addChild(new Text(renderStatus(status, theme), 0, 0));
|
|
@@ -4854,7 +4859,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
4854
4859
|
// Legacy calls without descriptions still render their original payload safely.
|
|
4855
4860
|
renderCall(args, theme) {
|
|
4856
4861
|
const isSubagent = args.profile === "subagent";
|
|
4857
|
-
const kind = isSubagent ? "AGENT" : "
|
|
4862
|
+
const kind = isSubagent ? "AGENT" : "PROCESS";
|
|
4858
4863
|
const payload = isSubagent ? args.task : args.command;
|
|
4859
4864
|
const agent = isSubagent && args.agent ? ` [${escapeCommandForDisplay(args.agent)}]` : "";
|
|
4860
4865
|
const title = theme.fg("muted", `${theme.bold(`babysit_run ${kind}`)}${agent}`);
|
package/log-viewer.ts
CHANGED
|
@@ -244,21 +244,18 @@ export function createLogViewer(options: LogViewerOptions) {
|
|
|
244
244
|
const heading = {
|
|
245
245
|
invalidate() {},
|
|
246
246
|
render(width: number) {
|
|
247
|
-
const
|
|
248
|
-
const room = Math.max(0, width - visibleWidth(close) - 1);
|
|
249
|
-
const title = truncateToWidth(sanitize(header).replace(/\n/g, " "), room);
|
|
247
|
+
const title = truncateToWidth(sanitize(header).replace(/\n/g, " "), width);
|
|
250
248
|
return [
|
|
251
249
|
options.getTheme().fg("accent", title) +
|
|
252
250
|
" ".repeat(
|
|
253
|
-
Math.max(0, width - visibleWidth(title)
|
|
254
|
-
)
|
|
255
|
-
options.getTheme().fg("muted", close),
|
|
251
|
+
Math.max(0, width - visibleWidth(title)),
|
|
252
|
+
),
|
|
256
253
|
];
|
|
257
254
|
},
|
|
258
255
|
handleMouse(e: TuiMouseEvent) {
|
|
259
256
|
if (
|
|
260
257
|
e.button !== "left" ||
|
|
261
|
-
e.x <
|
|
258
|
+
e.x < 0 ||
|
|
262
259
|
e.x >= e.width
|
|
263
260
|
)
|
|
264
261
|
return;
|
|
@@ -272,7 +269,7 @@ export function createLogViewer(options: LogViewerOptions) {
|
|
|
272
269
|
const footer: Component = {
|
|
273
270
|
invalidate() {},
|
|
274
271
|
render: (width) => [
|
|
275
|
-
options.getTheme().fg("dim", truncateToWidth(source ? `↑↓ · bytes ${pages[0]?.start ?? 0}–${pages.at(-1)?.end ?? 0}/${source.size} (window)
|
|
272
|
+
options.getTheme().fg("dim", truncateToWidth(source ? `↑↓ · bytes ${pages[0]?.start ?? 0}–${pages.at(-1)?.end ?? 0}/${source.size} (window)` : "↑↓", width)),
|
|
276
273
|
],
|
|
277
274
|
};
|
|
278
275
|
let geometry = {
|
|
@@ -489,10 +486,6 @@ export function createLogViewer(options: LogViewerOptions) {
|
|
|
489
486
|
options.requestRender();
|
|
490
487
|
},
|
|
491
488
|
handleKey(data: string): boolean {
|
|
492
|
-
if (matchesKey(data, Key.escape)) {
|
|
493
|
-
options.onClose();
|
|
494
|
-
return true;
|
|
495
|
-
}
|
|
496
489
|
if (matchesKey(data, Key.up)) scrollView.scrollBy(-1);
|
|
497
490
|
else if (matchesKey(data, Key.down)) scrollView.scrollBy(1);
|
|
498
491
|
else return false;
|