Commit Graph

3 Commits

Author SHA1 Message Date
joakimp 202288784c feat(todo): add an edit action, so correcting one item needs no rebuild
The vendored upstream example exposes list/add/toggle/clear and no way to
change an item's text. On a long-lived list that leaves two bad options:
add a "patch" item that describes a DIFFERENT item, or clear and re-add
everything. Both were hit for real on 2026-08-17 while tracking a 17-item
fleet plan -- the list ended up with #18 correcting #17, which reads as
nonsense in a sidebar that truncates each item to a few words.

edit takes id + text, replaces the text, and KEEPS the id and the done
status. Id stability is the point: ids are the only handle the palace
snapshot of a plan can refer to, so a correction must not renumber
anything. nextId is untouched.

Error branches match the existing style: distinct messages for a missing
id, a missing text, and an unknown id, each returning the full todos array
in details so state stays consistent.

No pi-atelier change needed. Its tool_result hook only checks that
details.todos is a well-shaped array and ignores the action string, so the
new action flows through its normalizer and sidebar untouched.

Note renderResult's switch has no default case, so an action without a
render arm returns undefined; edit adds one.

The file is a verbatim vendored copy of upstream's example, so divergence
has a cost: the header now carries a numbered LOCAL DELTAS list (the
earlier ctx.mode -> ctx.hasUI API fix, and this) to keep reconciling a
future upstream version mechanical. Worth offering upstream as a PR -- the
example is arguably incomplete without it.

Verified live in-container by pointing ~/.pi/agent/extensions/todo.ts at
this copy for one session: edit on an unknown id and with no text both
error as intended, and editing a completed item preserved both its id and
its done state. Symlink since reverted to the image copy.
2026-08-17 22:48:48 +02:00
joakimp 1381a37115 Rename @mariozechner/pi-* to @earendil-works/pi-*
Pi moved to its new home at earendil-works on 2026-05-07
(https://pi.dev/news/2026/5/7/pi-has-a-new-home). Affected packages:

  @mariozechner/pi-coding-agent  -> @earendil-works/pi-coding-agent
  @mariozechner/pi-tui           -> @earendil-works/pi-tui
  @mariozechner/pi-ai            -> @earendil-works/pi-ai
  @mariozechner/pi-agent-core    -> @earendil-works/pi-agent-core

The old @mariozechner/* packages are deprecated on npm with the
explicit message 'please use @earendil-works/pi-coding-agent instead
going forward', and the version stream has moved on (old top-out
0.73.1; new currently 0.74.0). Anyone npm-installing the old names
gets a deprecation warning + a stale binary.

Sweep:
- All 7 extension TypeScript files: import statements updated.
- README, AGENTS, install.sh: textual references and the github.com/
  mariozechner/pi-coding-agent URL pointed at github.com/earendil-works/
  pi (the new monorepo root; coding-agent now lives at
  packages/coding-agent inside it).
- Bun build of mcp-loader, ext-toggle, ssh-controlmaster verified clean.

Brew install references (`brew install pi-coding-agent`) left as-is:
the homebrew formula still works at 0.73.1 and a tap update is
tracked upstream at earendil-works/pi#2755. Historical CHANGELOG
entries are untouched.
2026-05-09 17:56:15 +02:00
joakimp ba994014a7 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.
2026-05-07 21:10:00 +02:00