[codex] fix media skill profile auth and run events (#965)

* fix media skill profile auth and run events

* test bridge run profile context
This commit is contained in:
ekko
2026-05-24 12:52:14 +08:00
committed by GitHub
parent 3e8f84aa65
commit 634a622934
20 changed files with 368 additions and 97 deletions
+20
View File
@@ -91,6 +91,7 @@ const sessionEventHandlers = new Map<string, {
onReasoningAvailable: (event: RunEvent) => void
onToolStarted: (event: RunEvent) => void
onToolCompleted: (event: RunEvent) => void
onSubagentEvent?: (event: RunEvent) => void
onRunStarted: (event: RunEvent) => void
onRunCompleted: (event: RunEvent) => void
onRunFailed: (event: RunEvent) => void
@@ -187,6 +188,16 @@ function globalToolCompletedHandler(event: RunEvent): void {
}
}
function globalSubagentEventHandler(event: RunEvent): void {
const sid = event.session_id
if (!sid) return
const handlers = sessionEventHandlers.get(sid)
if (handlers?.onSubagentEvent) {
handlers.onSubagentEvent(event)
}
}
/**
* Global run.started event handler
*/
@@ -376,6 +387,7 @@ export function registerSessionHandlers(
onReasoningAvailable: (event: RunEvent) => void
onToolStarted: (event: RunEvent) => void
onToolCompleted: (event: RunEvent) => void
onSubagentEvent?: (event: RunEvent) => void
onRunStarted: (event: RunEvent) => void
onRunCompleted: (event: RunEvent) => void
onRunFailed: (event: RunEvent) => void
@@ -485,6 +497,10 @@ export function connectChatRun(requestedProfile?: string | null): Socket {
// Tool events
chatRunSocket.on('tool.started', globalToolStartedHandler)
chatRunSocket.on('tool.completed', globalToolCompletedHandler)
chatRunSocket.on('subagent.start', globalSubagentEventHandler)
chatRunSocket.on('subagent.tool', globalSubagentEventHandler)
chatRunSocket.on('subagent.progress', globalSubagentEventHandler)
chatRunSocket.on('subagent.complete', globalSubagentEventHandler)
// Run lifecycle events
chatRunSocket.on('run.started', globalRunStartedHandler)
@@ -622,6 +638,10 @@ export function startRunViaSocket(
if (closed) return
onEvent(evt)
},
onSubagentEvent: (evt: RunEvent) => {
if (closed) return
onEvent(evt)
},
onRunStarted: (evt: RunEvent) => {
if (closed) return
onEvent(evt)