@xynogen/pix-todo 0.1.20 → 0.1.23

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 +4 -2
  2. package/package.json +4 -4
  3. package/src/todo.ts +13 -8
package/README.md CHANGED
@@ -6,9 +6,11 @@ Pi tool — durable execution checklist (`todo`).
6
6
 
7
7
  Registers the `todo` tool, which gives the agent a persistent task checklist that survives context compaction and session restore. The checklist is seeded by the model via the `set` action and tracks items through four statuses: `pending` (○), `in_progress` (◐), `done` (●), and `blocked` (⊘). State is persisted via Pi's `appendEntry("todo-state")` so the agent can recover its position after long runs or compaction events. The agent calls `todo(action:"list")` to resume where it left off. Actions: `list`, `set`, `add`, `update`, `clear`.
8
8
 
9
+ Every 10 turns, if any item is still `pending` or `in_progress`, the current checklist summary is injected into the system prompt so the model stays aware of unfinished work and can't skip incomplete items.
10
+
9
11
  ## Auto-collapse
10
12
 
11
- The checklist card uses the shared `@xynogen/pix-data/collapse` state machine and auto-collapses after a configurable delay (default 10 seconds) to a row such as `✓ todo #2 release prep · 1/2 done`. Expanding an elapsed card restores the immutable checklist snapshot for that result, with its colored status glyphs, without restarting the timer. Failed actions keep their exact diagnostic instead of rendering a checklist. The delay and per-tool toggle are read from `~/.pi/agent/pix.json`:
13
+ The checklist card uses the shared `@xynogen/pix-runtime/collapse` state machine and auto-collapses after a configurable delay (default 10 seconds) to a row such as `✓ todo #2 release prep · 1/2 done`. Expanding an elapsed card restores the immutable checklist snapshot for that result, with its colored status glyphs, without restarting the timer. Failed actions keep their exact diagnostic instead of rendering a checklist. The delay and per-tool toggle are read from `~/.pi/agent/pix.json`:
12
14
 
13
15
  ```jsonc
14
16
  {
@@ -20,7 +22,7 @@ The checklist card uses the shared `@xynogen/pix-data/collapse` state machine an
20
22
  }
21
23
  ```
22
24
 
23
- Set `collapse.tools.todo: false` to keep the checklist always expanded. See `@xynogen/pix-data/collapse` for the full API.
25
+ Set `collapse.tools.todo: false` to keep the checklist always expanded. See `@xynogen/pix-runtime/collapse` for the full API.
24
26
 
25
27
  ## Install
26
28
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xynogen/pix-todo",
3
- "version": "0.1.20",
3
+ "version": "0.1.23",
4
4
  "description": "Pi tool — durable execution checklist (todo)",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -34,9 +34,9 @@
34
34
  "access": "public"
35
35
  },
36
36
  "dependencies": {
37
- "@xynogen/pix-data": "^0.4.0",
38
- "@xynogen/pix-pretty": "^1.7.20",
39
- "@xynogen/pix-runtime": "^0.4.0",
37
+ "@xynogen/pix-data": "^0.4.3",
38
+ "@xynogen/pix-pretty": "^1.11.2",
39
+ "@xynogen/pix-runtime": "^0.5.3",
40
40
  "typebox": "^1.1.38"
41
41
  },
42
42
  "peerDependencies": {
package/src/todo.ts CHANGED
@@ -11,6 +11,7 @@
11
11
 
12
12
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
13
13
  import { Text } from "@earendil-works/pi-tui";
14
+ import { icon } from "@xynogen/pix-pretty/icon-catalog";
14
15
  import { formatCollapsedToolRow } from "@xynogen/pix-pretty/utils";
15
16
  import { type CollapseState, tickCollapse } from "@xynogen/pix-runtime/collapse";
16
17
  import { once } from "@xynogen/pix-runtime/once";
@@ -33,12 +34,16 @@ interface TodoResultDetails {
33
34
  snapshot: TodoItem[];
34
35
  }
35
36
 
36
- const TODO_GLYPH: Record<TodoStatus, string> = {
37
- pending: "○",
38
- in_progress: "◐",
39
- done: "",
40
- blocked: "",
41
- };
37
+ /** Resolve the status glyph at render time so a live /pix mode switch applies. */
38
+ function todoGlyph(status: TodoStatus): string {
39
+ const key = {
40
+ pending: "status.pending",
41
+ in_progress: "status.running",
42
+ done: "status.done",
43
+ blocked: "status.blocked",
44
+ } as const;
45
+ return icon(key[status]);
46
+ }
42
47
 
43
48
  /** Theme color key per status — drives both glyph and (for active) row tint. */
44
49
  const TODO_COLOR: Record<TodoStatus, string> = {
@@ -77,7 +82,7 @@ export function renderTodoLines(items: TodoItem[], theme: TodoTheme): string {
77
82
  const head = theme.fg("accent", `Todos ${done}/${items.length} done:`);
78
83
  const lines = items.map((t) => {
79
84
  const color = TODO_COLOR[t.status];
80
- const glyph = theme.fg(color, TODO_GLYPH[t.status]);
85
+ const glyph = theme.fg(color, todoGlyph(t.status));
81
86
  const body = `${t.id}. ${t.text}`;
82
87
  // Highlight the in-flight task so the eye lands on it first.
83
88
  const label =
@@ -123,7 +128,7 @@ export default function registerTodo(pi: ExtensionAPI): void {
123
128
  function todoSummary(): string {
124
129
  if (!todos.length) return "(no todos)";
125
130
  const done = todos.filter((t) => t.status === "done").length;
126
- const lines = todos.map((t) => `${TODO_GLYPH[t.status]} ${t.id}. ${t.text}`);
131
+ const lines = todos.map((t) => `${todoGlyph(t.status)} ${t.id}. ${t.text}`);
127
132
  return `Todos ${done}/${todos.length} done:\n${lines.join("\n")}`;
128
133
  }
129
134