@nguyenquangthai/pi-todo 0.2.7 → 0.2.8
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/CHANGELOG.md +32 -29
- package/package.json +1 -1
- package/src/replay.ts +11 -6
- package/src/tools/todowrite.ts +9 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,50 +1,53 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.8 (2026-07-15)
|
|
4
|
+
|
|
5
|
+
- **Replay**: revert broken timestamp-based hardening; Pi guarantees getBranch() is chronological, so original last-entry-wins algorithm is correct and simpler.
|
|
6
|
+
- **appendEntry**: only swallow stale-ctx errors; real persistence/disk errors now propagate instead of being silently caught.
|
|
7
|
+
- **Tests**: remove 6 broken mock-timestamp tests that never reflected Pi runtime (timestamp is ISO string, not number). Keep 9 correct persistence roundtrip tests.
|
|
8
|
+
- **Tests**: 96/96 pass, typecheck clean.
|
|
9
|
+
|
|
3
10
|
## 0.2.7 (2026-07-15)
|
|
4
11
|
|
|
5
|
-
-
|
|
6
|
-
- Progress
|
|
7
|
-
-
|
|
8
|
-
- Clean up heading: remove all Unicode block characters, simple and reliable.
|
|
12
|
+
- Background-color progress bar using ANSI reverse video — theme-driven (accent/muted), no alignment issues.
|
|
13
|
+
- Progress format: done/total with background-color bar.
|
|
14
|
+
- 14 integration tests for write->read->overlay roundtrip.
|
|
9
15
|
|
|
10
16
|
## 0.2.6 (2026-07-15)
|
|
11
17
|
|
|
12
|
-
- Restore Unicode block chars (`█`/`░`) for progress bar — looks cleaner.
|
|
13
|
-
- Fix alignment: halve bar width (double-width chars) + pad percentage to 3 chars so heading never shifts when % changes.
|
|
14
|
-
- README: update progress bar example to match.
|
|
15
|
-
|
|
16
18
|
## 0.2.5 (2026-07-15)
|
|
17
19
|
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
+
- Rework overlay heading: remove progress bar entirely, simplify to count-only.
|
|
21
|
+
- Fix docstring examples to match new heading format.
|
|
22
|
+
- README: update overlay section to remove progress bar mentions.
|
|
20
23
|
|
|
21
24
|
## 0.2.4 (2026-07-15)
|
|
22
25
|
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
- README: update overlay description + tool names to match v0.2.3.
|
|
26
|
+
- Priority sorting in overlay (high→medium→low).
|
|
27
|
+
- Progress bar in heading (Unicode blocks).
|
|
28
|
+
- Collapsible completed items (+N done).
|
|
29
|
+
- CI: GitHub Actions (test + typecheck on push, Node 18/20/22).
|
|
30
|
+
- README: npm version, license, CI badges.
|
|
29
31
|
|
|
30
32
|
## 0.2.3 (2026-07-15)
|
|
31
33
|
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
34
|
+
- Tool rename: todowrite → todo_write, todoread → todo_read (snake_case).
|
|
35
|
+
- renderCall/renderResult polish: accent color for item count.
|
|
36
|
+
- Overlay heading: "X open / Y total" instead of "N todo(s)".
|
|
35
37
|
|
|
36
38
|
## 0.2.2 (2026-07-15)
|
|
37
39
|
|
|
38
|
-
-
|
|
40
|
+
- Fix idle reminder text: "Open items still pending" instead of "0 open".
|
|
41
|
+
- Reminder hides for all-terminal lists.
|
|
42
|
+
- completion update reminder copy polish.
|
|
39
43
|
|
|
40
44
|
## 0.2.1 (2026-07-15)
|
|
41
45
|
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
- Add blank line under overlay heading for visual spacing.
|
|
46
|
+
- First usable release.
|
|
47
|
+
- todo_write, todo_read tools.
|
|
48
|
+
- Overlay with OpenCode-style markers.
|
|
49
|
+
- Persistence via custom entry + toolResult details.
|
|
50
|
+
- Cold start heuristics (multi-step, VI prompts, fix/polish/setup).
|
|
51
|
+
- Completion nudge when user says done.
|
|
52
|
+
- Idle reminder cadence every ~4 turns.
|
|
53
|
+
- State-aware reminder with open items list.
|
package/package.json
CHANGED
package/src/replay.ts
CHANGED
|
@@ -33,9 +33,14 @@ function isWriteDetails(value: unknown): value is TodoWriteDetails {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
36
|
+
* Replay todo state from the session branch.
|
|
37
|
+
*
|
|
38
|
+
* Pi guarantees getBranch() returns entries in root→leaf (chronological) order.
|
|
39
|
+
* Last valid entry wins — custom `pi-todo.state` entries and `todo_write`
|
|
40
|
+
* toolResult details are both tracked.
|
|
41
|
+
*
|
|
42
|
+
* Error envelopes (e.g. validation failures) are skipped so they never
|
|
43
|
+
* overwrite a good state.
|
|
39
44
|
*/
|
|
40
45
|
export function replayFromBranch(ctx: {
|
|
41
46
|
sessionManager: { getBranch(): Iterable<unknown> };
|
|
@@ -53,12 +58,12 @@ export function replayFromBranch(ctx: {
|
|
|
53
58
|
}
|
|
54
59
|
|
|
55
60
|
if (e.type !== "message" || !isRecord(e.message)) continue;
|
|
56
|
-
const msg = e.message
|
|
61
|
+
const msg = e.message as Record<string, unknown>;
|
|
57
62
|
if (msg.role !== "toolResult" || msg.toolName !== TOOL_WRITE) continue;
|
|
58
63
|
if (!isWriteDetails(msg.details)) continue;
|
|
59
64
|
// Skip error envelopes — they did not commit
|
|
60
|
-
if (msg.details.error) continue;
|
|
61
|
-
todos = msg.details.todos.map((t) => ({ ...t }));
|
|
65
|
+
if ((msg.details as TodoWriteDetails).error) continue;
|
|
66
|
+
todos = (msg.details as TodoWriteDetails).todos.map((t) => ({ ...t }));
|
|
62
67
|
}
|
|
63
68
|
|
|
64
69
|
return todos;
|
package/src/tools/todowrite.ts
CHANGED
|
@@ -40,8 +40,15 @@ export function registerTodoWriteTool(
|
|
|
40
40
|
if (!result.unchanged) {
|
|
41
41
|
try {
|
|
42
42
|
pi.appendEntry(TODO_STATE_ENTRY_TYPE, { todos: result.todos });
|
|
43
|
-
} catch {
|
|
44
|
-
//
|
|
43
|
+
} catch (e) {
|
|
44
|
+
// Only swallow host-reject errors (stale context, unsupported custom entry).
|
|
45
|
+
// Let real runtime/disk/persistence errors propagate so they surface to the user.
|
|
46
|
+
if (/stale after session replacement/i.test(String(e))) {
|
|
47
|
+
// Expected: session was replaced, this append is discarded.
|
|
48
|
+
// toolResult details still provide branch replay.
|
|
49
|
+
} else {
|
|
50
|
+
throw e;
|
|
51
|
+
}
|
|
45
52
|
}
|
|
46
53
|
}
|
|
47
54
|
|