feat(core): restore MessageBus optionality for soft migration (Phase 1) (#15774)

This commit is contained in:
Abhi
2026-01-04 14:59:35 -05:00
committed by GitHub
parent d3c206c677
commit eec5d5ebf8
16 changed files with 105 additions and 82 deletions
+12 -6
View File
@@ -172,7 +172,7 @@ Signal: Signal number or \`(none)\` if no signal was received.
protected createInvocation(
params: ToolParams,
_messageBus?: MessageBus,
messageBus?: MessageBus,
_toolName?: string,
_displayName?: string,
): ToolInvocation<ToolParams, ToolResult> {
@@ -181,7 +181,7 @@ Signal: Signal number or \`(none)\` if no signal was received.
this.originalName,
this.name,
params,
_messageBus,
messageBus,
);
}
}
@@ -194,11 +194,8 @@ export class ToolRegistry {
private config: Config;
private messageBus?: MessageBus;
constructor(config: Config) {
constructor(config: Config, messageBus?: MessageBus) {
this.config = config;
}
setMessageBus(messageBus: MessageBus): void {
this.messageBus = messageBus;
}
@@ -206,6 +203,15 @@ export class ToolRegistry {
return this.messageBus;
}
/**
* @deprecated migration only - will be removed in PR 3 (Enforcement)
* TODO: DELETE ME in PR 3. This is a temporary shim to allow for soft migration
* of tools while the core infrastructure is updated to require a MessageBus at birth.
*/
setMessageBus(messageBus: MessageBus): void {
this.messageBus = messageBus;
}
/**
* Registers a tool definition.
*