Add extension mode context

This commit is contained in:
Mario Zechner
2026-06-01 18:31:44 +02:00
parent 335e09ba0d
commit e56521e323
25 changed files with 98 additions and 25 deletions

View File

@@ -1508,6 +1508,7 @@ export class InteractiveMode {
const uiContext = this.createExtensionUIContext();
await this.session.bindExtensions({
uiContext,
mode: "tui",
abortHandler: () => {
this.restoreQueuedMessagesToEditor({ abort: true });
},
@@ -1654,6 +1655,7 @@ export class InteractiveMode {
// Create a context for shortcut handlers
const createContext = (): ExtensionContext => ({
ui: this.createExtensionUIContext(),
mode: "tui",
hasUI: true,
cwd: this.sessionManager.getCwd(),
sessionManager: this.sessionManager,

View File

@@ -71,6 +71,7 @@ export async function runPrintMode(runtimeHost: AgentSessionRuntime, options: Pr
const rebindSession = async (): Promise<void> => {
session = runtimeHost.session;
await session.bindExtensions({
mode: mode === "json" ? "json" : "print",
commandContextActions: {
waitForIdle: () => session.agent.waitForIdle(),
newSession: async (newSessionOptions) => runtimeHost.newSession(newSessionOptions),

View File

@@ -317,6 +317,7 @@ export async function runRpcMode(runtimeHost: AgentSessionRuntime): Promise<neve
session = runtimeHost.session;
await session.bindExtensions({
uiContext: createExtensionUIContext(),
mode: "rpc",
commandContextActions: {
waitForIdle: () => session.agent.waitForIdle(),
newSession: async (options) => runtimeHost.newSession(options),