Add before/after session events with cancellation support
- Merge branch event into session with before_branch/branch reasons
- Add before_switch, before_clear, shutdown reasons
- before_* events can be cancelled with { cancel: true }
- Update RPC commands to return cancelled status
- Add shutdown event on process exit
- New example hooks: confirm-destructive, dirty-repo-guard, auto-commit-on-exit
fixes #278
This commit is contained in:
@@ -86,7 +86,7 @@ describe.skipIf(!API_KEY)("AgentSession branching", () => {
|
||||
// Branch from the first message
|
||||
const result = await session.branch(userMessages[0].entryIndex);
|
||||
expect(result.selectedText).toBe("Say hello");
|
||||
expect(result.skipped).toBe(false);
|
||||
expect(result.cancelled).toBe(false);
|
||||
|
||||
// After branching, conversation should be empty (branched before the first message)
|
||||
expect(session.messages.length).toBe(0);
|
||||
@@ -116,7 +116,7 @@ describe.skipIf(!API_KEY)("AgentSession branching", () => {
|
||||
// Branch from the first message
|
||||
const result = await session.branch(userMessages[0].entryIndex);
|
||||
expect(result.selectedText).toBe("Say hi");
|
||||
expect(result.skipped).toBe(false);
|
||||
expect(result.cancelled).toBe(false);
|
||||
|
||||
// After branching, conversation should be empty
|
||||
expect(session.messages.length).toBe(0);
|
||||
|
||||
Reference in New Issue
Block a user