@yusukeshib/pi-babysit 0.6.9 → 0.6.12

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.
Files changed (3) hide show
  1. package/README.md +6 -5
  2. package/index.ts +13 -19
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -85,11 +85,12 @@ summary counts use `RUNNING` / `IDLE`, and every row is labeled
85
85
  Click the header to toggle to `babysits(n all)`, which also shows finished and failed
86
86
  sessions, and click again to return to running-only. Both modes show newest first,
87
87
  ten per page; `< 1/4 >` shows the current/total page when needed. Click the
88
- arrows to page. Collapsed rows show the complete command for processes and the
89
- complete task for agents, wrapping long text across lines rather than abbreviating
90
- it. Click an agent row for the task,
91
- its RPC worker launch argv (bold, readable text rather than a copy-paste shell
92
- command), and up to 20 output lines. Opening another row closes the previous
88
+ arrows to page. Collapsed rows occupy one line, previewing the command for
89
+ processes and the task for agents (with `…` when clipped). Click a row for the
90
+ complete wrapped command or task; agent rows also show their RPC worker launch
91
+ argv (bold, readable text rather than a copy-paste shell command), and up to 20
92
+ output lines. Expanded output lines wrap without a 100-character cutoff.
93
+ Opening another row closes the previous
93
94
  one. A session with no available output shows an explicit placeholder when
94
95
  expanded. Mouse clicks
95
96
  require fullscreen mode; `/babysit` works in regular mode. The displayed `age`
package/index.ts CHANGED
@@ -2369,7 +2369,6 @@ function renderWidgetSessionHeader(
2369
2369
  // How many trailing output lines to show per session in the widget.
2370
2370
  const WIDGET_COLLAPSED_TAIL_LINES = 1;
2371
2371
  const WIDGET_EXPANDED_TAIL_LINES = 20;
2372
- const WIDGET_TAIL_WIDTH = 100;
2373
2372
  const WIDGET_SESSION_PAGE_SIZE = 10;
2374
2373
 
2375
2374
  export interface WidgetSessionListState {
@@ -2411,13 +2410,10 @@ export function createWidgetComponent(
2411
2410
  render(width: number): string[] {
2412
2411
  const lines: string[] = [];
2413
2412
  targetByLine = [];
2414
- const push = (text: string, target?: Target) => {
2415
- lines.push(truncateToWidth(text, Math.max(0, width), ""));
2413
+ const push = (text: string, target?: Target, ellipsis = "") => {
2414
+ lines.push(truncateToWidth(text, Math.max(0, width), ellipsis));
2416
2415
  targetByLine.push(target);
2417
2416
  };
2418
- const pushWrapped = (text: string, target?: Target) => {
2419
- for (const line of wrapTextWithAnsi(text, Math.max(1, width))) push(line, target);
2420
- };
2421
2417
  const pushSession = (session: WidgetSessionDisplay) => {
2422
2418
  const expanded = session.expandable && expandedSessionIds.has(session.id);
2423
2419
  const tail = session.tail.slice(
@@ -2425,25 +2421,23 @@ export function createWidgetComponent(
2425
2421
  );
2426
2422
  const target = session.expandable ? { type: "session" as const, id: session.id } : undefined;
2427
2423
  const details = session.details ?? [];
2428
- const pushDetail = (detail: string) => {
2429
- const text = detail.startsWith("task: ") ? detail.slice(6) : detail;
2430
- if (width > 6) {
2431
- for (const line of wrapTextWithAnsi(text, width - 6)) push(` ${line}`, target);
2432
- } else {
2433
- push(` ${text}`, target);
2424
+ const pushWrapped = (text: string) => {
2425
+ const indent = width > 6 ? " " : "";
2426
+ for (const line of wrapTextWithAnsi(text, Math.max(1, width - indent.length))) {
2427
+ push(`${indent}${line}`, target);
2434
2428
  }
2435
2429
  };
2436
- if (!expanded && details[0]?.startsWith("task: ")) {
2437
- pushWrapped(`${session.header} ${details[0].slice(6)}`, target);
2438
- } else if (!expanded && details.length) {
2439
- pushWrapped(`${session.header} ${details[0]}`, target);
2440
- for (const detail of details.slice(1)) pushDetail(detail);
2430
+ const pushDetail = (detail: string) =>
2431
+ pushWrapped(detail.startsWith("task: ") ? detail.slice(6) : detail);
2432
+ if (!expanded && details.length) {
2433
+ const preview = details[0].startsWith("task: ") ? details[0].slice(6) : details[0];
2434
+ push(`${session.header} ${preview}`, target, "…");
2441
2435
  } else if (!expanded && tail.length === 1) {
2442
2436
  push(`${session.header} ${tail[0]}`, target);
2443
2437
  } else {
2444
2438
  push(session.header, target);
2445
2439
  for (const detail of details) pushDetail(detail);
2446
- for (const line of tail) push(` ${line}`, target);
2440
+ for (const line of tail) pushWrapped(line);
2447
2441
  if (expanded && tail.length === 0) push(" (no output available)", target);
2448
2442
  }
2449
2443
  };
@@ -2529,7 +2523,7 @@ function sanitizeTailLine(s: string): string {
2529
2523
  .replace(/\x1b[@-Z\\-_]|\x1b\[[0-?]*[ -/]*[@-~]/g, "")
2530
2524
  // remaining non-printable control chars (keep tab)
2531
2525
  .replace(/[\x00-\x08\x0b-\x1f\x7f]/g, "");
2532
- return clean.length > WIDGET_TAIL_WIDTH ? `${clean.slice(0, WIDGET_TAIL_WIDTH - 1)}…` : clean;
2526
+ return clean;
2533
2527
  }
2534
2528
 
2535
2529
  function readTailLines(file: string, lines: number, maxBytes = 64_000): string[] {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yusukeshib/pi-babysit",
3
- "version": "0.6.9",
3
+ "version": "0.6.12",
4
4
  "description": "Run any shell command and pi subagents under babysit, with context-safe captured output.",
5
5
  "keywords": [
6
6
  "pi-package",