feat(coding-agent): add user_bash event and theme API extensions

- user_bash event for intercepting ! and !! commands (#528)
- Extensions can return { operations } or { result } to redirect/replace
- executeBashWithOperations() for custom BashOperations execution
- session.recordBashResult() for extensions handling bash themselves
- Theme API: getAllThemes(), getTheme(), setTheme() on ctx.ui
- mac-system-theme.ts example: sync with macOS dark/light mode
- Updated ssh.ts to use user_bash event
This commit is contained in:
Mario Zechner 2026-01-08 21:50:56 +01:00
parent 16e142ef7d
commit 121823c74d
14 changed files with 405 additions and 36 deletions

View file

@ -15,7 +15,7 @@ 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 { theme } from "../interactive/theme/theme.js";
import { type Theme, theme } from "../interactive/theme/theme.js";
import type {
RpcCommand,
RpcExtensionUIRequest,
@ -229,6 +229,19 @@ export async function runRpcMode(session: AgentSession): Promise<never> {
get theme() {
return theme;
},
getAllThemes() {
return [];
},
getTheme(_name: string) {
return undefined;
},
setTheme(_theme: string | Theme) {
// Theme switching not supported in RPC mode
return { success: false, error: "Theme switching not supported in RPC mode" };
},
});
// Set up extensions with RPC-based UI context