ea53b4353fc9d444634ca9dc0b1a112be476cac5

Author
Pavle <29902467+TheEdgeOfRage@users.noreply.github.com>
Committer
GitHub <noreply@github.com>
Date

Message

Fix session complete notification (#2)

Diff

 1diff --git a/src/index.ts b/src/index.ts
 2index c1564715075c41fc7313aee7510191c12be72701..ee62791d871b6343402807f25beaf3c4e7cfc775 100644
 3--- a/src/index.ts
 4+++ b/src/index.ts
 5@@ -225,8 +225,10 @@ const server: Plugin = async (ctx, _options) => {
 6           if (idleSeq.get(sid) !== seq) return
 7           try {
 8             const resp = await client.session.get({ path: { id: sid } })
 9+            if (idleSeq.get(sid) !== seq) return
10             if (resp.data?.parentID) return // subagent — skip
11           } catch {}
12+          if (idleSeq.get(sid) !== seq) return
13           notify(title, "Session complete")
14         }, IDLE_DELAY_MS))
15         return