fix(coding-agent): add session_shutdown reasons closes #2863

This commit is contained in:
Mario Zechner
2026-04-20 23:10:49 +02:00
parent 1891b9ac01
commit 12d7161884
10 changed files with 75 additions and 30 deletions

View File

@@ -45,6 +45,7 @@ import type {
SessionBeforeForkResult,
SessionBeforeSwitchResult,
SessionBeforeTreeResult,
SessionShutdownEvent,
ToolCallEvent,
ToolCallEventResult,
ToolResultEvent,
@@ -168,11 +169,12 @@ export type ShutdownHandler = () => void;
* Helper function to emit session_shutdown event to extensions.
* Returns true if the event was emitted, false if there were no handlers.
*/
export async function emitSessionShutdownEvent(extensionRunner: ExtensionRunner): Promise<boolean> {
export async function emitSessionShutdownEvent(
extensionRunner: ExtensionRunner,
event: SessionShutdownEvent,
): Promise<boolean> {
if (extensionRunner.hasHandlers("session_shutdown")) {
await extensionRunner.emit({
type: "session_shutdown",
});
await extensionRunner.emit(event);
return true;
}
return false;