1c84a70417
packages/ai: - feat: added OpenAI Codex stream test - fix: google-gemini-cli provider cleanup - fix: google-shared provider improvements - fix: amazon-bedrock provider fix - fix: openai-codex-responses provider fix - chore: regenerated models packages/coding-agent: - feat: extension API reload method and UI sub-protocol - feat: tilde expansion in custom skill directories - feat: RPC mode reload support - feat: tools-manager improvements - fix: CLI args updates - docs: extensions and RPC documentation updates packages/tui: - feat: kill-ring and undo-stack modules - feat: editor enhancements (kill/yank, undo/redo) - feat: input component improvements packages/agent: - test: agent test additions
72 lines
2.4 KiB
TypeScript
72 lines
2.4 KiB
TypeScript
import type { AutocompleteProvider } from "./autocomplete";
|
|
import type { Component } from "./tui";
|
|
|
|
/**
|
|
* Interface for custom editor components.
|
|
*
|
|
* This allows extensions to provide their own editor implementation
|
|
* (e.g., vim mode, emacs mode, custom keybindings) while maintaining
|
|
* compatibility with the core application.
|
|
*/
|
|
export interface EditorComponent extends Component {
|
|
// =========================================================================
|
|
// Core text access (required)
|
|
// =========================================================================
|
|
|
|
/** Get the current text content */
|
|
getText(): string;
|
|
|
|
/** Set the text content */
|
|
setText(text: string): void;
|
|
|
|
/** Handle raw terminal input (key presses, paste sequences, etc.) */
|
|
handleInput(data: string): void;
|
|
|
|
// =========================================================================
|
|
// Callbacks (required)
|
|
// =========================================================================
|
|
|
|
/** Called when user submits (e.g., Enter key) */
|
|
onSubmit?: (text: string) => void;
|
|
|
|
/** Called when text changes */
|
|
onChange?: (text: string) => void;
|
|
|
|
// =========================================================================
|
|
// History support (optional)
|
|
// =========================================================================
|
|
|
|
/** Add text to history for up/down navigation */
|
|
addToHistory?(text: string): void;
|
|
|
|
// =========================================================================
|
|
// Advanced text manipulation (optional)
|
|
// =========================================================================
|
|
|
|
/** Insert text at current cursor position */
|
|
insertTextAtCursor?(text: string): void;
|
|
|
|
/**
|
|
* Get text with any markers expanded (e.g., paste markers).
|
|
* Falls back to getText() if not implemented.
|
|
*/
|
|
getExpandedText?(): string;
|
|
|
|
// =========================================================================
|
|
// Autocomplete support (optional)
|
|
// =========================================================================
|
|
|
|
/** Set the autocomplete provider */
|
|
setAutocompleteProvider?(provider: AutocompleteProvider): void;
|
|
|
|
// =========================================================================
|
|
// Appearance (optional)
|
|
// =========================================================================
|
|
|
|
/** Border color function */
|
|
borderColor?: (str: string) => string;
|
|
|
|
/** Set horizontal padding */
|
|
setPaddingX?(padding: number): void;
|
|
}
|