test: assert sessionKey in embedded after tool call hook context

This commit is contained in:
Vincent Koc
2026-03-02 12:23:41 -08:00
parent 44d9d13fcf
commit 4bb4983415

View File

@@ -114,7 +114,7 @@ describe("after_tool_call hook wiring", () => {
const event = firstCall?.[0] as
| { toolName?: string; params?: unknown; error?: unknown; durationMs?: unknown }
| undefined;
const context = firstCall?.[1] as { toolName?: string } | undefined;
const context = firstCall?.[1] as { toolName?: string; sessionKey?: string } | undefined;
expect(event).toBeDefined();
expect(context).toBeDefined();
if (!event || !context) {
@@ -125,6 +125,7 @@ describe("after_tool_call hook wiring", () => {
expect(event.error).toBeUndefined();
expect(typeof event.durationMs).toBe("number");
expect(context.toolName).toBe("read");
expect(context.sessionKey).toBe("test-session");
});
it("includes error in after_tool_call event on tool failure", async () => {