feat: add task duration tracking
This commit is contained in:
@@ -10,6 +10,7 @@ Hierarchical, session-local task tracking for [Pi](https://pi.dev), with atomic
|
||||
- Parent/child task trees with generated integer IDs and atomic append/replace modes
|
||||
- Atomic batch mutations: every requested change succeeds or none of it is applied
|
||||
- Four states: `pending`, `in-progress`, `blocked`, and `done`
|
||||
- Cumulative active-time tracking that pauses outside `in-progress` and survives session restore
|
||||
- Session-branch persistence across reload, resume, fork, tree navigation, and context compaction
|
||||
- A concise first-action workflow prompt plus a one-shot post-compaction recovery reminder
|
||||
- Compact Pi widget with hierarchy, status colors, and an adaptive progress bar
|
||||
@@ -56,7 +57,7 @@ After automatic or manual context compaction, the extension sends one short hidd
|
||||
| `update_task` | `{ tasks: [...] }` | Atomically patches multiple tasks. `parentId: null` moves to the root; `position` is a zero-based sibling index. |
|
||||
| `rm_task` | `{ ids: [...], reason }` | Removes only mistaken, duplicate, or canceled tasks. Removing a parent cascades through its descendants. |
|
||||
| `list_task` | `{}` | Returns the full tree as compact `id/status/name` lines. |
|
||||
| `get_task` | `{ ids: [...] }` | Returns complete task details, including parent and child IDs. |
|
||||
| `get_task` | `{ ids: [...] }` | Returns complete task details, including parent/child IDs and timing for tasks that have started. |
|
||||
|
||||
Example append call:
|
||||
|
||||
@@ -81,16 +82,18 @@ Example append call:
|
||||
|
||||
Descriptions are optional, but useful scope, constraints, and done criteria improve recovery through `get_task`. IDs are not reused by append/remove operations; `replace` deliberately rebuilds IDs from `1`. Replace forbids `parentId`, so new hierarchy must use nested `children`. Multiple tasks may be `in-progress`. A parent can be marked `done` only when all descendants are also `done`.
|
||||
|
||||
A task starts timing the first time it enters `in-progress`. Leaving that state records a stop and pauses the timer; entering it again resumes with a new active segment while preserving the cumulative duration. Repeated updates with the same status, as well as name, description, hierarchy, and position changes, do not reset timing. For started tasks, `get_task` includes the first `startedAt` timestamp, a `stoppedAt` timestamp while paused, and cumulative `durationMs`. Timestamps use ISO 8601.
|
||||
|
||||
## Pi Widget
|
||||
|
||||
The widget appears above Pi's editor while tasks exist. Run `/tasks` to hide or show it for the current Pi runtime.
|
||||
|
||||
```text
|
||||
Tasks 2/6 · !1 ━━━━━────────
|
||||
◉ 1. Build auth
|
||||
├─ ! 3. Resolve token issue
|
||||
◉ 1. Build auth · 12:08
|
||||
├─ ! 3. Resolve token issue · 03:41
|
||||
└─ ○ 4. Add middleware
|
||||
✓ 2. Define schema
|
||||
✓ 2. Define schema · 04:31
|
||||
```
|
||||
|
||||
Tool calls remain compact in the conversation. Expand a tool result with Pi's normal tool-output shortcut to inspect affected tasks or full descriptions.
|
||||
|
||||
Reference in New Issue
Block a user