Update plan: mark before_agent_start as complete

This commit is contained in:
Mario Zechner 2025-12-28 14:50:45 +01:00
parent 57146de202
commit f43969b31a
2 changed files with 7 additions and 5 deletions

View file

@ -10,7 +10,7 @@ export default function (pi: HookAPI) {
// Register a custom message renderer for our "test-info" type
pi.registerMessageRenderer("test-info", (message, options, theme) => {
const box = new Box(0, 0, (t) => theme.bg("success", t));
const box = new Box(0, 0, (t) => theme.bg("customMessageBg", t));
const label = theme.fg("successText", "[TEST INFO]");
box.addChild(new Text(label, 0, 0));

View file

@ -285,7 +285,7 @@ Benefits:
- Works with branching (pruning entries are part of the tree)
- Trade-off: cache busting on first submission after pruning
### Investigate: `context` event vs `before_agent_start`
### Investigate: `context` event vs `before_agent_start`
References:
- [#324](https://github.com/badlogic/pi-mono/issues/324) - `before_agent_start` proposal
@ -329,9 +329,11 @@ Questions:
| Cache impact | Can bust cache | Append-only, cache-safe |
| Use case | Transient manipulation | Persistent context injection |
**Design questions:**
- [ ] Should `before_agent_start` create a new message type (`SystemMessage` with `role: "system"`)?
- [ ] How should it render in TUI? (label when collapsed, full content when expanded)
**Implementation (completed):**
- Reuses `HookMessage` type (no new message type needed)
- Handler returns `{ message: Pick<HookMessage, "customType" | "content" | "display" | "details"> }`
- Message is appended to agent state AND persisted to session before `agent.prompt()` is called
- Renders using existing `HookMessageComponent` (or custom renderer if registered)
- [ ] How does it interact with compaction? (treated like user messages?)
- [ ] Can hook return multiple messages or just one?