feat(coding-agent,tui): add stacked autocomplete providers closes #2983

This commit is contained in:
Mario Zechner
2026-04-22 15:44:08 +02:00
parent 4e919868f6
commit 8234ebf9ee
16 changed files with 465 additions and 33 deletions

View File

@@ -29,6 +29,7 @@ export type {
AppendEntryHandler,
// App keybindings (for custom editors)
AppKeybinding,
AutocompleteProviderFactory,
// Events - Tool (ToolCallEvent types)
BashToolCallEvent,
BashToolResultEvent,

View File

@@ -204,6 +204,7 @@ const noOpUIContext: ExtensionUIContext = {
setEditorText: () => {},
getEditorText: () => "",
editor: async () => undefined,
addAutocompleteProvider: () => {},
setEditorComponent: () => {},
get theme() {
return theme;

View File

@@ -30,6 +30,7 @@ import type {
} from "@mariozechner/pi-ai";
import type {
AutocompleteItem,
AutocompleteProvider,
Component,
EditorComponent,
EditorTheme,
@@ -112,6 +113,9 @@ export interface WorkingIndicatorOptions {
intervalMs?: number;
}
/** Wrap the current autocomplete provider with additional behavior. */
export type AutocompleteProviderFactory = (current: AutocompleteProvider) => AutocompleteProvider;
/**
* UI context for extensions to request interactive UI.
* Each mode (interactive, RPC, print) provides its own implementation.
@@ -206,6 +210,9 @@ export interface ExtensionUIContext {
/** Show a multi-line editor for text editing. */
editor(title: string, prefill?: string): Promise<string | undefined>;
/** Stack additional autocomplete behavior on top of the built-in provider. */
addAutocompleteProvider(factory: AutocompleteProviderFactory): void;
/**
* Set a custom editor component via factory function.
* Pass undefined to restore the default editor.