/**
 * @license
 * Copyright 2026 HopCode Team
 * SPDX-License-Identifier: Apache-2.0
 */
import type { Config } from '@hoptrendy/hopcode-core';
import type { Part } from '@google/genai';
import type { SessionUpdate, ToolCallLocation, ToolKind } from '@agentclientprotocol/sdk';
import type { MessageRewriteMiddleware } from './rewrite/index.js';
export type ApprovalModeValue = 'plan' | 'default' | 'auto-edit' | 'izn';
/**
 * Interface for sending session updates to the ACP client.
 * Implemented by Session class and used by all emitters.
 */
export interface SessionUpdateSender {
    sendUpdate(update: SessionUpdate): Promise<void>;
}
/**
 * Session context shared across all emitters.
 * Provides access to session state and configuration.
 */
export interface SessionContext extends SessionUpdateSender {
    readonly sessionId: string;
    readonly config: Config;
    /** Optional message rewrite middleware for ACP message transformation.
     *  Installed after history replay to avoid rewriting historical messages. */
    messageRewriter?: MessageRewriteMiddleware;
}
/**
 * Subagent metadata for tracking parent tool call context.
 */
export interface SubagentMeta {
    /** ID of the parent AgentTool call that created this subagent */
    parentToolCallId?: string;
    /** Type of subagent (from AgentParams.subagent_type) */
    subagentType?: string;
}
/**
 * Parameters for emitting a tool call start event.
 */
export interface ToolCallStartParams {
    /** Name of the tool being called */
    toolName: string;
    /** Unique identifier for this tool call */
    callId: string;
    /** Arguments passed to the tool */
    args?: Record<string, unknown>;
    /** Status of the tool call */
    status?: 'pending' | 'in_progress' | 'completed' | 'failed';
    /** Optional subagent metadata */
    subagentMeta?: SubagentMeta;
    /** Server-side timestamp (ISO string or ms) for message ordering */
    timestamp?: string | number;
}
/**
 * Parameters for emitting a tool call result event.
 */
export interface ToolCallResultParams {
    /** Name of the tool that was called */
    toolName: string;
    /** Unique identifier for this tool call */
    callId: string;
    /** Whether the tool execution succeeded */
    success: boolean;
    /** The response parts from tool execution (maps to content in update event) */
    message: Part[];
    /** Display result from tool execution (maps to rawOutput in update event) */
    resultDisplay?: unknown;
    /** Error if tool execution failed */
    error?: Error;
    /** Original args (fallback for TodoWriteTool todos extraction) */
    args?: Record<string, unknown>;
    /** Optional subagent metadata */
    subagentMeta?: SubagentMeta;
    /** Server-side timestamp (ISO string or ms) for message ordering */
    timestamp?: string | number;
}
/**
 * Todo item structure for plan updates.
 */
export interface TodoItem {
    id: string;
    content: string;
    status: 'pending' | 'in_progress' | 'completed';
}
/**
 * Resolved tool metadata from the registry.
 */
export interface ResolvedToolMetadata {
    title: string;
    locations: ToolCallLocation[];
    kind: ToolKind;
}
