import type { RuntimeEventBus } from '../events/index.js'; import type { EmitterContext } from './index.js'; import type { TurnInputOrigin } from '../../../events/turn.js'; import type { PartialToolCall } from '../../providers/interface.js'; /** Emit TURN_SUBMITTED when a user prompt is submitted. */ export declare function emitTurnSubmitted(bus: RuntimeEventBus, ctx: EmitterContext, data: { turnId: string; prompt: string; origin?: TurnInputOrigin; }): void; /** Emit PREFLIGHT_OK when preflight checks pass. */ export declare function emitPreflightOk(bus: RuntimeEventBus, ctx: EmitterContext, data: { turnId: string; }): void; /** Emit PREFLIGHT_FAIL when preflight checks fail. */ export declare function emitPreflightFail(bus: RuntimeEventBus, ctx: EmitterContext, data: { turnId: string; reason: string; stopReason: 'preflight_failed' | 'context_overflow'; }): void; /** Emit STREAM_START when a provider stream iteration begins. */ export declare function emitStreamStart(bus: RuntimeEventBus, ctx: EmitterContext, data: { turnId: string; scope?: 'provider'; terminal?: false; }): void; /** Emit STREAM_DELTA for each incremental content chunk. */ export declare function emitStreamDelta(bus: RuntimeEventBus, ctx: EmitterContext, data: { turnId: string; content: string; accumulated: string; reasoning?: string; toolCalls?: PartialToolCall[]; }): void; /** Emit STREAM_END when a provider stream iteration ends. */ export declare function emitStreamEnd(bus: RuntimeEventBus, ctx: EmitterContext, data: { turnId: string; scope?: 'provider'; terminal?: false; }): void; /** Emit STREAM_RETRY when an in-flight provider chat call retries after a transport error. */ export declare function emitStreamRetry(bus: RuntimeEventBus, ctx: EmitterContext, data: { turnId: string; provider: string; attempt: number; maxAttempts: number; delayMs: number; reason: string; }): void; /** Emit LLM_REQUEST_STARTED when a provider chat request is about to be dispatched. */ export declare function emitLlmRequestStarted(bus: RuntimeEventBus, ctx: EmitterContext, data: { turnId: string; provider: string; model: string; promptSummary: { length: number; sha256: string; first100chars: string; } | string; }): void; /** Emit LLM_RESPONSE_RECEIVED when a provider chat call completes within a turn iteration. */ export declare function emitLlmResponseReceived(bus: RuntimeEventBus, ctx: EmitterContext, data: { turnId: string; provider: string; model: string; contentSummary: { length: number; sha256: string; first100chars: string; } | string; toolCallCount: number; inputTokens: number; outputTokens: number; cacheReadTokens?: number | undefined; cacheWriteTokens?: number | undefined; /** LLM request enrichments */ durationMs?: number | undefined; retries?: number | undefined; costUsdCents?: number | undefined; costSource?: 'user' | 'provider' | 'catalog' | 'subscription' | 'unknown' | undefined; finishReason?: string | undefined; providerRequestId?: string | undefined; originTool?: string | undefined; originCallId?: string | undefined; originHook?: string | undefined; originMcpServer?: string | undefined; rateLimit?: { limit?: number | undefined; remaining?: number | undefined; resetAt?: number | undefined; retryAfterMs?: number | undefined; } | undefined; }): void; /** Emit TOOL_BATCH_READY when a set of tool calls is ready for execution. */ export declare function emitToolBatchReady(bus: RuntimeEventBus, ctx: EmitterContext, data: { turnId: string; toolCalls: string[]; }): void; /** Emit TOOLS_DONE when all tool calls in the current batch have completed. */ export declare function emitToolsDone(bus: RuntimeEventBus, ctx: EmitterContext, data: { turnId: string; }): void; /** Emit POST_HOOKS_DONE when post-processing hooks have completed. */ export declare function emitPostHooksDone(bus: RuntimeEventBus, ctx: EmitterContext, data: { turnId: string; }): void; /** * Emit TURN_COMPLETED when the turn finishes successfully. * * `memoryRecordIds`, the turn's MEMORY-sourced injected knowledge-record ids * (TurnInjectionRecord filtered to source 'memory'). When non-empty they are * stamped as `metadata.memory.recordIds` (the published provenance convention * surfaces read); when absent/empty the event carries NO metadata field, * honest absence, never an empty array. */ export declare function emitTurnCompleted(bus: RuntimeEventBus, ctx: EmitterContext, data: { turnId: string; response: string; stopReason: 'completed' | 'empty_response'; memoryRecordIds?: readonly string[] | undefined; }): void; /** Emit TURN_ERROR when the turn fails. */ export declare function emitTurnError(bus: RuntimeEventBus, ctx: EmitterContext, data: { turnId: string; error: string; stopReason: 'preflight_failed' | 'context_overflow' | 'provider_exhausted' | 'provider_error' | 'hook_denied' | 'tool_loop_circuit_breaker' | 'unexpected_error'; }): void; /** Emit TURN_CANCEL when the turn is cancelled. */ export declare function emitTurnCancel(bus: RuntimeEventBus, ctx: EmitterContext, data: { turnId: string; reason?: string; stopReason: 'cancelled'; }): void; //# sourceMappingURL=turn.d.ts.map