mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-17 10:02:23 +00:00
fix(coding-agent): bind extension UI context on startup
This commit is contained in:
parent
f86e3c3103
commit
5dbeadae05
4 changed files with 60 additions and 66 deletions
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
- Git extension updates now handle force-pushed remotes gracefully instead of failing ([#961](https://github.com/badlogic/pi-mono/pull/961) by [@aliou](https://github.com/aliou))
|
||||
- Extension `ctx.newSession({ setup })` now properly syncs agent state and renders messages after setup callback runs ([#968](https://github.com/badlogic/pi-mono/issues/968))
|
||||
- Fixed extension UI bindings not initializing when starting with no extensions, which broke UI methods after `/reload`
|
||||
|
||||
## [0.50.0] - 2026-01-26
|
||||
|
||||
|
|
|
|||
|
|
@ -976,13 +976,6 @@ export class InteractiveMode {
|
|||
* Initialize the extension system with TUI-based UI context.
|
||||
*/
|
||||
private async initExtensions(): Promise<void> {
|
||||
const extensionRunner = this.session.extensionRunner;
|
||||
if (!extensionRunner) {
|
||||
this.showLoadedResources({ extensionPaths: [], force: false });
|
||||
return;
|
||||
}
|
||||
|
||||
// Create extension UI context
|
||||
const uiContext = this.createExtensionUIContext();
|
||||
await this.session.bindExtensions({
|
||||
uiContext,
|
||||
|
|
@ -1057,6 +1050,12 @@ export class InteractiveMode {
|
|||
},
|
||||
});
|
||||
|
||||
const extensionRunner = this.session.extensionRunner;
|
||||
if (!extensionRunner) {
|
||||
this.showLoadedResources({ extensionPaths: [], force: false });
|
||||
return;
|
||||
}
|
||||
|
||||
this.setupExtensionShortcuts(extensionRunner);
|
||||
this.showLoadedResources({ extensionPaths: extensionRunner.getExtensionPaths(), force: false });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,8 +36,6 @@ export async function runPrintMode(session: AgentSession, options: PrintModeOpti
|
|||
}
|
||||
}
|
||||
// Set up extensions for print mode (no UI)
|
||||
const extensionRunner = session.extensionRunner;
|
||||
if (extensionRunner) {
|
||||
await session.bindExtensions({
|
||||
commandContextActions: {
|
||||
waitForIdle: () => session.agent.waitForIdle(),
|
||||
|
|
@ -66,7 +64,6 @@ export async function runPrintMode(session: AgentSession, options: PrintModeOpti
|
|||
console.error(`Extension error (${err.extensionPath}): ${err.error}`);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// Always subscribe to enable session persistence via _handleAgentEvent
|
||||
session.subscribe((event) => {
|
||||
|
|
|
|||
|
|
@ -254,8 +254,6 @@ export async function runRpcMode(session: AgentSession): Promise<never> {
|
|||
});
|
||||
|
||||
// Set up extensions with RPC-based UI context
|
||||
const extensionRunner = session.extensionRunner;
|
||||
if (extensionRunner) {
|
||||
await session.bindExtensions({
|
||||
uiContext: createExtensionUIContext(),
|
||||
commandContextActions: {
|
||||
|
|
@ -286,7 +284,6 @@ export async function runRpcMode(session: AgentSession): Promise<never> {
|
|||
output({ type: "extension_error", extensionPath: err.extensionPath, event: err.event, error: err.error });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// Output all agent events as JSON
|
||||
session.subscribe((event) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue