mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 09:04:26 +00:00
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:
parent
6327bfd3dc
commit
abb1775ff7
11 changed files with 114 additions and 36 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue