/**
 * emitExtensionEvent — translates an AgentLoopEvent into an ExtensionRunner event.
 *
 * Pure function. Only turn_start and turn_end are enriched (turnIndex, timestamp).
 * All other events pass through structurally unchanged.
 *
 * Part of the AgentSession event pipeline (step 2). Does not reference
 * AgentSession or any other pipeline handler.
 */
/**
 * Translate an agent event and emit it to the extension runner.
 *
 * @param runner The extension runner (may be undefined — no-ops if so).
 * @param event The agent event to translate.
 * @param turnIndex Current turn index, owned by the pipeline.
 */
export async function emitExtensionEvent(runner, event, turnIndex) {
    if (!runner)
        return;
    switch (event.type) {
        case 'turn_start':
            await runner.emit({ ...event, turnIndex, timestamp: Date.now() });
            break;
        case 'turn_end':
            await runner.emit({ ...event, turnIndex });
            break;
        default:
            // Passthrough: agent_start, agent_end, message_start/update/end,
            // tool_execution_start/update/end are structurally identical between
            // AgentLoopEvent and ExtensionEvent — only turn_start/turn_end differ
            // (enriched above).
            await runner.emit(event);
            break;
    }
}
//# sourceMappingURL=extension-emitter.js.map