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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user