Add todo.ts (verbatim copy of upstream examples/extensions/todo.ts)
Provides the agent with a 'todo' tool (list/add/toggle/clear) and registers /todos for the user. Useful for externalising multi-step plans during long arcs. State persists in tool result details rather than an external file, which means: pi --continue brings todos back with the session, and /fork forks the todo state along with the branch. Copied not symlinked because the upstream path lives under a homebrew-versioned Cellar dir that rotates on every pi upgrade. Refresh procedure documented in AGENTS.md.
This commit is contained in:
@@ -22,6 +22,7 @@ extensions/
|
||||
git-checkpoint.ts # Git stash checkpoint per turn, restorable on /fork
|
||||
notify.ts # Native terminal notification when agent finishes
|
||||
ext-toggle.ts # /ext slash command — list & toggle extensions at runtime
|
||||
todo.ts # `todo` tool for the agent + /todos for the user (copy of upstream example)
|
||||
install.sh # Idempotent installer — symlinks extensions/ into ~/.pi/agent/extensions/
|
||||
package.json # pi package manifest — enables `pi install /path` as an alternative
|
||||
README.md # User-facing docs.
|
||||
@@ -220,6 +221,31 @@ session.
|
||||
|
||||
No flags, no `agent_*` event handlers — fully passive until `/ext` is invoked.
|
||||
|
||||
### `todo.ts`
|
||||
|
||||
Unchanged copy of upstream `examples/extensions/todo.ts` from
|
||||
`pi-coding-agent` (the homebrew install at `/opt/homebrew/Cellar/...`).
|
||||
Provides the agent with a `todo` tool (actions: list/add/toggle/clear)
|
||||
and registers `/todos` for the user to inspect the list.
|
||||
|
||||
**Why copied, not symlinked:** symlinking would point at
|
||||
`/opt/homebrew/Cellar/pi-coding-agent/<version>/libexec/...` which
|
||||
rotates on every brew upgrade — fragile. Copy keeps it stable; we lose
|
||||
upstream updates but gain reproducibility.
|
||||
|
||||
**State persistence:** the agent stores todo state in tool result
|
||||
`details`, not an external file. Two useful properties: state survives
|
||||
`pi --continue`/`--resume` because it lives in the session JSONL, and
|
||||
`/fork` correctly forks the todo list along with the conversation.
|
||||
|
||||
**Refresh from upstream when needed:**
|
||||
|
||||
```bash
|
||||
cp /opt/homebrew/Cellar/pi-coding-agent/*/libexec/lib/node_modules/@mariozechner/pi-coding-agent/examples/extensions/todo.ts \
|
||||
~/src/src_local/pi-extensions/extensions/todo.ts
|
||||
# review diff, then commit
|
||||
```
|
||||
|
||||
No framework. Manual:
|
||||
|
||||
```bash
|
||||
|
||||
Reference in New Issue
Block a user