pi-todo-ledger 0.7.3 → 0.7.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-todo-ledger",
3
- "version": "0.7.3",
3
+ "version": "0.7.4",
4
4
  "description": "A todo list for pi agents with a public bookkeeping contract: snapshot entries, change events, and namespace validators. Fork of @juicesharp/rpiv-todo",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -41,7 +41,7 @@ import { type PlanRow, planView } from "./view/plan.ts";
41
41
  import type { Task } from "./tool/types.ts";
42
42
 
43
43
  import { history } from "./ledger/herdr-runs.ts";
44
- import { liveRows, runLine, runState, type Query, type RunRow } from "./view/live-runs.ts";
44
+ import { liveRows, runLine, type Query, type RunRow } from "./view/live-runs.ts";
45
45
 
46
46
  const WIDGET_KEY = "rpiv-todos";
47
47
 
@@ -633,16 +633,12 @@ export class TodoOverlay {
633
633
  }
634
634
 
635
635
  /**
636
- * One run row under `branch`. A run waiting for a reply stands out; idle and
637
- * running rows stay dim, and so does the tree. Only a row shown in full is
636
+ * One run row under the dim tree branch. Only a row shown in full is
638
637
  * claimed; a truncated one carries no marker.
639
638
  */
640
639
  private drawRun(lines: string[], r: RunRow, branch: string, draw: DrawContext, frame: Frame) {
641
640
  const { theme, width, truncate, now, evidence } = draw;
642
- const line =
643
- runState(r) === "waiting"
644
- ? theme.fg("dim", branch) + theme.fg("warning", runLine(r, now))
645
- : theme.fg("dim", branch + runLine(r, now));
641
+ const line = theme.fg("dim", branch) + runLine(r, now, (color, text) => theme.fg(color, text));
646
642
  const whole = visibleWidth(line) <= width;
647
643
  frame.ticking = true;
648
644
  if (whole && evidence === "screen") {
@@ -84,7 +84,8 @@ const words: Record<string, string> = {
84
84
  "state.idle": "idle",
85
85
  "state.waiting": "waiting",
86
86
  };
87
- export function runLine(row: RunRow, now: number) {
87
+ type RunColor = "dim" | "warning" | "mdLink";
88
+ export function runLine(row: RunRow, now: number, fg: (color: RunColor, text: string) => string = (_, text) => text) {
88
89
  const { kind, label, since } = row.phase;
89
90
  // A pending cancel outranks the lifecycle: the host hides its own warning for claimed rows.
90
91
  const cancel = pendingCancel(row);
@@ -113,10 +114,11 @@ export function runLine(row: RunRow, now: number) {
113
114
  : s < 3600
114
115
  ? `${Math.floor(s / 60)}m`
115
116
  : `${Math.floor(s / 3600)}h${String(Math.floor(s / 60) % 60).padStart(2, "0")}m`;
116
- return sanitizeTerminalText(
117
- (state && MARKS[state] ? `${MARKS[state]} ` : "") +
118
- [row.name, row.model && shortModel(row.model), `${word} ${time}`]
119
- .filter(Boolean)
120
- .join(" · "),
121
- );
117
+ const color = state === "waiting" ? "warning" : "dim";
118
+ const mark = state && MARKS[state];
119
+ const name = sanitizeTerminalText(row.name);
120
+ const model = row.model && sanitizeTerminalText(shortModel(row.model));
121
+ const middle = (name ? " · " : "") + (model ? `${model} · ` : "");
122
+ return (mark ? fg(color, `${mark} `) : "") + (name ? fg("mdLink", name) : "") +
123
+ (middle ? fg("dim", middle) : "") + fg(color, sanitizeTerminalText(`${word} ${time}`));
122
124
  }