feat(coding-agent): Add widget placement option (#850)

* Add widget placement for extension widgets

* Remove changelog entry for widget placement

* Keep no-op widget signature

* Move widget render before attach
This commit is contained in:
Marc Krenn 2026-01-19 15:54:24 +01:00 committed by GitHub
parent 6327bfd3dc
commit abb1775ff7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 114 additions and 36 deletions

View file

@ -14,7 +14,11 @@
import * as crypto from "node:crypto";
import * as readline from "readline";
import type { AgentSession } from "../../core/agent-session.js";
import type { ExtensionUIContext, ExtensionUIDialogOptions } from "../../core/extensions/index.js";
import type {
ExtensionUIContext,
ExtensionUIDialogOptions,
ExtensionWidgetOptions,
} from "../../core/extensions/index.js";
import { type Theme, theme } from "../interactive/theme/theme.js";
import type {
RpcCommand,
@ -154,7 +158,7 @@ export async function runRpcMode(session: AgentSession): Promise<never> {
// Working message not supported in RPC mode - requires TUI loader access
},
setWidget(key: string, content: unknown): void {
setWidget(key: string, content: unknown, options?: ExtensionWidgetOptions): void {
// Only support string arrays in RPC mode - factory functions are ignored
if (content === undefined || Array.isArray(content)) {
output({
@ -163,6 +167,7 @@ export async function runRpcMode(session: AgentSession): Promise<never> {
method: "setWidget",
widgetKey: key,
widgetLines: content as string[] | undefined,
widgetPlacement: options?.placement,
} as RpcExtensionUIRequest);
}
// Component factories are not supported in RPC mode - would need TUI access

View file

@ -208,6 +208,7 @@ export type RpcExtensionUIRequest =
method: "setWidget";
widgetKey: string;
widgetLines: string[] | undefined;
widgetPlacement?: "aboveEditor" | "belowEditor";
}
| { type: "extension_ui_request"; id: string; method: "setTitle"; title: string }
| { type: "extension_ui_request"; id: string; method: "set_editor_text"; text: string };