fix(plugin): normalize event session ids

Handle OpenCode session events that carry the session ID under properties.info.id or properties.info.sessionID so background tasks and continuation hooks do not miss idle/error/delete events.

Add regression coverage for nested session.idle events completing background tasks and waking continuation hooks.
This commit is contained in:
YeonGyu-Kim
2026-05-12 11:48:18 +09:00
parent 67f90a819e
commit 4da48555ee
51 changed files with 740 additions and 254 deletions
+3 -1
View File
@@ -1,3 +1,5 @@
import { resolveSessionEventID } from "../shared/event-session-id"
type EventInput = { event: { type: string; properties?: Record<string, unknown> } }
type SessionStatus = { type: string }
@@ -10,7 +12,7 @@ export function normalizeSessionStatusToIdle(input: EventInput): EventInput | nu
const status = props.status as SessionStatus | undefined
if (!status || status.type !== "idle") return null
const sessionID = props.sessionID as string | undefined
const sessionID = resolveSessionEventID(props)
if (!sessionID) return null
return {