export type ClientMessage = { type: "message"; content: string; id: string; } | { type: "abort"; reason?: string; } | { type: "reset"; } | { type: "answer_question"; request_id: string; answers: Record; }; export type ServerMessage = { type: "connected"; session_id: string; skills: string[]; version: string; } | { type: "processing"; message_id: string; } | { type: "skill_loaded"; skill: string; expanded: boolean; timestamp: string; } | { type: "tool_call"; tool: string; command: string; timestamp: string; } | { type: "tool_result"; tool: string; status: "success" | "error"; output: string; timestamp: string; } | { type: "text_delta"; content: string; timestamp: string; } | { type: "progress"; message_id: string; progress: ProgressInfo; } | { type: "finish"; message_id: string; stats: MessageStats; } | { type: "error"; code: string; message: string; } | { type: "ask_question"; request_id: string; questions: Array<{ question: string; header: string; options: Array<{ label: string; description: string; }>; multiSelect: boolean; }>; }; /** * Token 使用统计信息 * * 注意:这个事件在每次 API 调用完成(收到 assistant 消息)时发送, * 不是实时增量更新。根据 Claude API 限制,message_delta 事件只在 * 消息结束时发送一次,工具参数生成期间不会有 token 更新。 */ export interface ProgressInfo { total_input_tokens: number; total_output_tokens: number; current_input_tokens: number; current_output_tokens: number; by_model: Record; timestamp: number; } export interface MessageStats { tokens: { total: { input: number; output: number; }; by_model: Record; }; context: { used: number; total: number; }; duration_ms: number; skills: { loaded: string[]; expanded: string[]; }; tools_called: number; } export interface ServerOptions { port: number; token?: string; cwd?: string; } //# sourceMappingURL=types.d.ts.map