mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-17 08:00:59 +00:00
feat: add setToolsExpanded and getToolsExpanded to ExtensionsUIContext
This commit is contained in:
parent
df5b0f76c0
commit
ca62c44775
4 changed files with 25 additions and 2 deletions
|
|
@ -146,6 +146,8 @@ const noOpUIContext: ExtensionUIContext = {
|
||||||
getAllThemes: () => [],
|
getAllThemes: () => [],
|
||||||
getTheme: () => undefined,
|
getTheme: () => undefined,
|
||||||
setTheme: (_theme: string | Theme) => ({ success: false, error: "UI not available" }),
|
setTheme: (_theme: string | Theme) => ({ success: false, error: "UI not available" }),
|
||||||
|
getToolsExpanded: () => false,
|
||||||
|
setToolsExpanded: () => {},
|
||||||
};
|
};
|
||||||
|
|
||||||
export class ExtensionRunner {
|
export class ExtensionRunner {
|
||||||
|
|
|
||||||
|
|
@ -218,6 +218,12 @@ export interface ExtensionUIContext {
|
||||||
|
|
||||||
/** Set the current theme by name or Theme object. */
|
/** Set the current theme by name or Theme object. */
|
||||||
setTheme(theme: string | Theme): { success: boolean; error?: string };
|
setTheme(theme: string | Theme): { success: boolean; error?: string };
|
||||||
|
|
||||||
|
/** Get current tool output expansion state. */
|
||||||
|
getToolsExpanded(): boolean;
|
||||||
|
|
||||||
|
/** Set tool output expansion state. */
|
||||||
|
setToolsExpanded(expanded: boolean): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
|
||||||
|
|
@ -1396,6 +1396,8 @@ export class InteractiveMode {
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
getToolsExpanded: () => this.toolOutputExpanded,
|
||||||
|
setToolsExpanded: (expanded) => this.setToolsExpanded(expanded),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2658,10 +2660,14 @@ export class InteractiveMode {
|
||||||
}
|
}
|
||||||
|
|
||||||
private toggleToolOutputExpansion(): void {
|
private toggleToolOutputExpansion(): void {
|
||||||
this.toolOutputExpanded = !this.toolOutputExpanded;
|
this.setToolsExpanded(!this.toolOutputExpanded);
|
||||||
|
}
|
||||||
|
|
||||||
|
private setToolsExpanded(expanded: boolean): void {
|
||||||
|
this.toolOutputExpanded = expanded;
|
||||||
for (const child of this.chatContainer.children) {
|
for (const child of this.chatContainer.children) {
|
||||||
if (isExpandable(child)) {
|
if (isExpandable(child)) {
|
||||||
child.setExpanded(this.toolOutputExpanded);
|
child.setExpanded(expanded);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.ui.requestRender();
|
this.ui.requestRender();
|
||||||
|
|
|
||||||
|
|
@ -252,6 +252,15 @@ export async function runRpcMode(session: AgentSession): Promise<never> {
|
||||||
// Theme switching not supported in RPC mode
|
// Theme switching not supported in RPC mode
|
||||||
return { success: false, error: "Theme switching not supported in RPC mode" };
|
return { success: false, error: "Theme switching not supported in RPC mode" };
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getToolsExpanded() {
|
||||||
|
// Tool expansion not supported in RPC mode - no TUI
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
|
||||||
|
setToolsExpanded(_expanded: boolean) {
|
||||||
|
// Tool expansion not supported in RPC mode - no TUI
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set up extensions with RPC-based UI context
|
// Set up extensions with RPC-based UI context
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue