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:
@@ -558,6 +558,10 @@ export class AgentSession {
|
||||
sessionManager: this.sessionManager,
|
||||
modelRegistry: this._modelRegistry,
|
||||
model: this.model,
|
||||
isIdle: () => !this.isStreaming,
|
||||
waitForIdle: () => this.agent.waitForIdle(),
|
||||
abort: () => this.abort(),
|
||||
hasQueuedMessages: () => this.queuedMessageCount > 0,
|
||||
};
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user