@pi-archimedes/todo 1.2.2 → 1.3.1

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-archimedes/todo",
3
- "version": "1.2.2",
3
+ "version": "1.3.1",
4
4
  "type": "module",
5
5
  "keywords": [
6
6
  "pi-package"
@@ -11,7 +11,7 @@
11
11
  ],
12
12
  "main": "./src/index.ts",
13
13
  "dependencies": {
14
- "@pi-archimedes/core": "1.2.2"
14
+ "@pi-archimedes/core": "1.3.1"
15
15
  },
16
16
  "peerDependencies": {
17
17
  "@earendil-works/pi-ai": ">=0.1.0",
@@ -63,6 +63,12 @@ export function updateWidget(
63
63
 
64
64
  const maxRows = Math.max(...columns.map((c) => c.todos.length));
65
65
 
66
+ // When any column has a subagent header, reserve an extra row at the top
67
+ // for the headers so todo[0] isn't overwritten by the header text.
68
+ const hasSubHeader = columns.some((c) => c.header.length > 0);
69
+ const headerRows = hasSubHeader ? 1 : 0;
70
+ const totalRows = maxRows + headerRows;
71
+
66
72
  return {
67
73
  render(width: number) {
68
74
  const lines: string[] = [];
@@ -81,29 +87,31 @@ export function updateWidget(
81
87
  let colWidth = numCols > 0 ? Math.floor((width - dividerWidth) / numCols) : width;
82
88
  colWidth = Math.max(colWidth, minColWidth);
83
89
 
84
- // Render subagent headers on row 0
85
- const hasSubHeader = columns.some((c) => c.header.length > 0);
86
-
87
- for (let row = 0; row < maxRows; row++) {
90
+ for (let row = 0; row < totalRows; row++) {
88
91
  const cellParts: string[] = [];
89
92
 
90
93
  for (const column of columns) {
91
94
  let cellText: string;
92
95
 
93
- if (row === 0 && hasSubHeader && column.header) {
96
+ if (row === 0 && headerRows > 0 && column.header) {
97
+ // Header row for subagent columns
94
98
  cellText = ` ${column.header}`;
95
- } else if (row < column.todos.length) {
96
- const todo = column.todos[row];
97
- if (todo) {
98
- const icon = getStatusIcon(todo.status, theme);
99
- const idStr = theme.fg("accent", `${todo.id}.`);
100
- const title = formatTodoTitle(todo, theme);
101
- cellText = ` ${icon} ${idStr} ${title}`;
99
+ } else {
100
+ // Todo row — offset by the header row count
101
+ const todoIndex = row - headerRows;
102
+ if (todoIndex >= 0 && todoIndex < column.todos.length) {
103
+ const todo = column.todos[todoIndex];
104
+ if (todo) {
105
+ const icon = getStatusIcon(todo.status, theme);
106
+ const idStr = theme.fg("accent", `${todo.id}.`);
107
+ const title = formatTodoTitle(todo, theme);
108
+ cellText = ` ${icon} ${idStr} ${title}`;
109
+ } else {
110
+ cellText = "";
111
+ }
102
112
  } else {
103
113
  cellText = "";
104
114
  }
105
- } else {
106
- cellText = "";
107
115
  }
108
116
 
109
117
  // Truncate and pad to column width