/** * EventNormalizer — converts bridge-level AgentEvent (raw driver events) to * skaile-agent-types AgentEvent (normalized, human-readable events). * * Stateful: tracks active subagents and dev-server detection across a session. * Call reset() between sessions. */ import type { AgentEvent as NormalizedEvent } from "@skaile/workspaces/types"; import type { AgentEvent as BridgeEvent } from "./types.js"; /** * Converts raw bridge-level {@link BridgeEvent} payloads into normalized * `@skaile/workspaces/types` `AgentEvent` payloads consumed by the runner and transport. * * Stateful: tracks active subagents and dev-server detection across a session. * Call {@link EventNormalizer.reset} between sessions to clear accumulated state. * * @docLink packages/bridge/api-reference#normalizer */ export declare class EventNormalizer { private activeSubagents; private devServerStartingEmitted; private devServerReadyEmitted; /** True when message_update deltas have been emitted for the current message. */ private hasStreamedText; /** * Convert a single bridge event into zero or more normalized events. * One bridge event can produce multiple normalized events (e.g., a message_start * with text + tool_use blocks produces both text and tool_call events). */ normalize(event: BridgeEvent): NormalizedEvent[]; /** Clear all stateful tracking between sessions. */ reset(): void; private handleMessageStart; private handleToolUse; private handleAskUserQuestion; private handleAgentToolUse; private handleGenericToolUse; private handleMessageUpdate; private handleTurnEnd; private handleSubagentResult; private handleToolResult; private isSubagentResult; private resolveSubagentName; private handleResult; private detectDevServerStarting; private detectDevServerReady; private getContentBlocks; } /** * Produce a human-readable one-line summary of a tool call for the activity log. * * Returns a string like `$ git status` for Bash, `Read src/index.ts` for Read, etc. * Falls back to `ToolName({...input...})` for unrecognised tools. * * @param tool - Tool name (e.g. `"Bash"`, `"Write"`, `"Grep"`). * @param input - Tool input record passed to the call. * @returns A short display string suitable for the activity feed. * @docLink packages/bridge/api-reference#normalizer */ export declare function summarizeToolCall(tool: string, input: Record): string; /** * Produce a human-readable one-line summary of a tool result for the activity log. * * Handles Bash stdout/stderr, Write/Edit file paths, ApplyPatch change counts, and * Anthropic content-block arrays. Falls back to `JSON.stringify` for unknown shapes. * * @param tool - Tool name. * @param result - Raw tool result payload. * @returns A short display string, truncated to 200 characters. * @docLink packages/bridge/api-reference#normalizer */ export declare function summarizeToolResult(tool: string, result: unknown): string; /** * Detect file-change events from a tool result, returning zero or more `file_changed` events. * * Handles `Write` (single create/edit), `Edit` (single edit), and `ApplyPatch` (multi-file * patch with per-change `kind` classification). Returns an empty array for all other tools. * * @param toolName - Name of the tool that produced the result. * @param result - Raw tool result payload. * @returns Array of `file_changed` normalized events. * @docLink packages/bridge/api-reference#normalizer */ export declare function detectFileChanges(toolName: string, result: unknown): NormalizedEvent[]; /** * Backward-compatible single-event helper; returns the first `file_changed` event or `null`. * * Prefer {@link detectFileChanges} for multi-file patches (e.g. `ApplyPatch`). * * @param toolName - Name of the tool that produced the result. * @param result - Raw tool result payload. * @returns First detected `file_changed` event, or `null`. * @docLink packages/bridge/api-reference#normalizer */ export declare function detectFileChange(toolName: string, result: unknown): NormalizedEvent | null; //# sourceMappingURL=normalizer.d.ts.map