UNPKG

@vibe-kit/grok-cli

Version:

An open-source AI agent that brings the power of Grok directly into your terminal.

54 lines (53 loc) 1.68 kB
/// <reference types="node" /> import { GrokToolCall } from "../grok/client"; import { ToolResult } from "../types"; import { EventEmitter } from "events"; export interface ChatEntry { type: "user" | "assistant" | "tool_result" | "tool_call"; content: string; timestamp: Date; toolCalls?: GrokToolCall[]; toolCall?: GrokToolCall; toolResult?: { success: boolean; output?: string; error?: string; }; isStreaming?: boolean; } export interface StreamingChunk { type: "content" | "tool_calls" | "tool_result" | "done" | "token_count"; content?: string; toolCalls?: GrokToolCall[]; toolCall?: GrokToolCall; toolResult?: ToolResult; tokenCount?: number; } export declare class GrokAgent extends EventEmitter { private grokClient; private textEditor; private bash; private todoTool; private confirmationTool; private search; private chatHistory; private messages; private tokenCounter; private abortController; private mcpInitialized; constructor(apiKey: string, baseURL?: string, model?: string); private initializeMCP; private waitForMCPInitialization; private isGrokModel; processUserMessage(message: string): Promise<ChatEntry[]>; private messageReducer; processUserMessageStream(message: string): AsyncGenerator<StreamingChunk, void, unknown>; private executeTool; private executeMCPTool; getChatHistory(): ChatEntry[]; getCurrentDirectory(): string; executeBashCommand(command: string): Promise<ToolResult>; getCurrentModel(): string; setModel(model: string): void; abortCurrentOperation(): void; }