mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-17 03:03:44 +00:00
Add session management and agent state methods to hooks API
HookAPI additions: - pi.newSession(options?) - create new session with optional setup callback - pi.branch(entryId) - branch from a specific entry - pi.navigateTree(targetId, options?) - navigate the session tree HookContext additions: - ctx.isIdle() - check if agent is streaming - ctx.waitForIdle() - wait for agent to finish - ctx.abort() - abort current operation - ctx.hasQueuedMessages() - check for queued user messages These enable hooks to programmatically manage sessions (handoff, templates) and check agent state before showing interactive UI. Fixes #388
This commit is contained in:
parent
484d7e06bb
commit
ccdd7bd283
9 changed files with 355 additions and 14 deletions
|
|
@ -35,6 +35,10 @@ The hooks API has been restructured with more granular events and better session
|
|||
- New `pi.appendEntry(customType, data?)` for hook state persistence (not in LLM context)
|
||||
- New `pi.registerCommand(name, options)` for custom slash commands
|
||||
- New `pi.registerMessageRenderer(customType, renderer)` for custom TUI rendering
|
||||
- New `pi.newSession(options?)` to create new sessions with optional setup callback
|
||||
- New `pi.branch(entryId)` to branch from a specific entry
|
||||
- New `pi.navigateTree(targetId, options?)` to navigate the session tree
|
||||
- New `ctx.isIdle()`, `ctx.waitForIdle()`, `ctx.abort()`, `ctx.hasQueuedMessages()` for agent state access
|
||||
- New `ctx.ui.custom(component)` for full TUI component rendering with keyboard focus
|
||||
- New `ctx.ui.setStatus(key, text)` for persistent status text in footer (multiple hooks can set their own)
|
||||
- New `ctx.ui.theme` getter for styling text with theme colors
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue