[tab] crates/napi/index.d.ts (typescript)
/* tslint:disable */
/* eslint-disable */

/* auto-generated by NAPI-RS */

/** A message in the conversation. */
export interface ConversationMessage {
  from: string
  value: string
}
/** Configuration options for the ConversationStateManager. */
export interface ConversationStateManagerOptions {
  /** Viewport radius (lines above/below cursor to show). Default: 10 */
  viewportRadius?: number
  /** Coalesce radius for grouping nearby edits. Default: 5 */
  coalesceRadius?: number
  /** Maximum tokens per message. Default: 2048 */
  maxTokensPerMessage?: number
  /** Maximum tokens per terminal output. Default: 256 */
  maxTokensPerTerminalOutput?: number
}
/**
 * Helper function: estimate tokens using character approximation.
 * Uses ~4 characters per token as a rough approximation.
 */
export declare function estimateTokens(text: string): number
/** Helper function: clean text by normalizing line endings. */
export declare function cleanText(text: string): string
/** Helper function: create a fenced code block. */
export declare function fencedBlock(language: string | undefined | null, content: string): string
/** Helper function: normalize terminal output. */
export declare function normalizeTerminalOutput(raw: string): string
/** Helper function: generate line-numbered output. */
export declare function lineNumberedOutput(content: string, startLine?: number | undefined | null, endLine?: number | undefined | null): string
/**
 * Manages conversation state for serializing IDE events.
 *
 * Uses character-based token approximation for the VS Code extension runtime.
 * For accurate tokenization during preprocessing, use the Python bindings.
 */
export declare class ConversationStateManager {
  /**
   * Create a new ConversationStateManager with default character-based token approximation.
   *
   * @param options - Optional configuration options.
   */
  constructor(options?: ConversationStateManagerOptions | undefined | null)
  /** Reset all state. */
  reset(): void
  /** Get a copy of all messages. */
  getMessages(): Array<ConversationMessage>
  /** Get the current content of a file. */
  getFileContent(filePath: string): string
  /**
   * Handle a tab (file switch) event.
   *
   * @param filePath - The path to the file.
   * @param textContent - The file contents, or null if switching to an already-open file.
   */
  handleTabEvent(filePath: string, textContent?: string | undefined | null): void
  /**
   * Handle a content change event.
   *
   * @param filePath - The path to the file.
   * @param offset - The character offset where the change starts.
   * @param length - The number of characters being replaced.
   * @param newText - The new text being inserted.
   */
  handleContentEvent(filePath: string, offset: number, length: number, newText: string): void
  /**
   * Handle a selection event.
   *
   * @param filePath - The path to the file.
   * @param offset - The character offset of the selection start.
   */
  handleSelectionEvent(filePath: string, offset: number): void
  /**
   * Handle a terminal command event.
   *
   * @param command - The command that was executed.
   */
  handleTerminalCommandEvent(command: string): void
  /**
   * Handle a terminal output event.
   *
   * @param output - The terminal output.
   */
  handleTerminalOutputEvent(output: string): void
  /** Handle a terminal focus event. */
  handleTerminalFocusEvent(): void
  /**
   * Handle a git branch checkout event.
   *
   * @param branchInfo - The git checkout message containing the branch name.
   */
  handleGitBranchCheckoutEvent(branchInfo: string): void
  /** Finalize and get conversation ready for model. */
  finalizeForModel(): Array<ConversationMessage>
}