feat(plugins): expose agent closed lifecycle event (#5971)

* feat(plugins): expose agent closed lifecycle event

Emit the event when a live agent reaches its closed state so plugins can release agent-scoped resources. Keep archive and close notifications distinct.

Co-authored-by: ilteoood <6383527+ilteoood@users.noreply.github.com>

* fix(plugins): finish close hooks during daemon shutdown

Wait briefly for pending lifecycle events before stopping plugins so agent close hooks can release their resources during shutdown.

Co-authored-by: ilteoood <6383527+ilteoood@users.noreply.github.com>

---------

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
Co-authored-by: ilteoood <6383527+ilteoood@users.noreply.github.com>
This commit is contained in:
paseo-bot[bot]
2026-10-03 11:36:19 +01:00
committed by GitHub
co-authored by ilteoood
parent 8aec0787d2
commit 5375f43a05
10 changed files with 97 additions and 10 deletions
@@ -29,6 +29,10 @@ export default function contribute(server: PluginServerContext) {
logHook("agent.created", event);
});
server.on("agent.closed", (event) => {
logHook("agent.closed", event);
});
server.on("agent.turn_started", (event) => {
logHook("agent.turn_started", event);
});