mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 20:03:05 +00:00
feat(coding-agent): add timeout option to extension dialogs with live countdown
Extension UI dialogs (select, confirm, input) now support a timeout option that auto-dismisses with a live countdown display. Simpler alternative to manually managing AbortSignal for timed dialogs. Also adds ExtensionUIDialogOptions type export and updates RPC mode to forward timeout to clients.
This commit is contained in:
parent
fcb3b4aa72
commit
77477f6166
12 changed files with 262 additions and 191 deletions
|
|
@ -36,6 +36,7 @@ export type {
|
|||
ExtensionHandler,
|
||||
ExtensionShortcut,
|
||||
ExtensionUIContext,
|
||||
ExtensionUIDialogOptions,
|
||||
FindToolResultEvent,
|
||||
GetActiveToolsHandler,
|
||||
GetAllToolsHandler,
|
||||
|
|
|
|||
|
|
@ -46,19 +46,27 @@ export type { AgentToolResult, AgentToolUpdateCallback };
|
|||
// UI Context
|
||||
// ============================================================================
|
||||
|
||||
/** Options for extension UI dialogs. */
|
||||
export interface ExtensionUIDialogOptions {
|
||||
/** AbortSignal to programmatically dismiss the dialog. */
|
||||
signal?: AbortSignal;
|
||||
/** Timeout in milliseconds. Dialog auto-dismisses with live countdown display. */
|
||||
timeout?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* UI context for extensions to request interactive UI.
|
||||
* Each mode (interactive, RPC, print) provides its own implementation.
|
||||
*/
|
||||
export interface ExtensionUIContext {
|
||||
/** Show a selector and return the user's choice. */
|
||||
select(title: string, options: string[], opts?: { signal?: AbortSignal }): Promise<string | undefined>;
|
||||
select(title: string, options: string[], opts?: ExtensionUIDialogOptions): Promise<string | undefined>;
|
||||
|
||||
/** Show a confirmation dialog. */
|
||||
confirm(title: string, message: string, opts?: { signal?: AbortSignal }): Promise<boolean>;
|
||||
confirm(title: string, message: string, opts?: ExtensionUIDialogOptions): Promise<boolean>;
|
||||
|
||||
/** Show a text input dialog. */
|
||||
input(title: string, placeholder?: string, opts?: { signal?: AbortSignal }): Promise<string | undefined>;
|
||||
input(title: string, placeholder?: string, opts?: ExtensionUIDialogOptions): Promise<string | undefined>;
|
||||
|
||||
/** Show a notification to the user. */
|
||||
notify(message: string, type?: "info" | "warning" | "error"): void;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue