move move notification auth_success from useAuth to config to support both interactive and non-interactive

This commit is contained in:
DennisYu07 2026-03-10 20:50:03 -07:00
parent 4b80e4a3b7
commit d5d7187479
4 changed files with 97 additions and 28 deletions

View file

@ -94,9 +94,10 @@ import {
} from '../confirmation-bus/types.js';
import {
PermissionMode,
type NotificationType,
NotificationType,
type PermissionSuggestion,
} from '../hooks/types.js';
import { fireNotificationHook } from '../core/toolHookTriggers.js';
// Utils
import { shouldAttemptBrowserLaunch } from '../utils/browser.js';
@ -982,6 +983,21 @@ export class Config {
// Initialize BaseLlmClient now that the ContentGenerator is available
this.baseLlmClient = new BaseLlmClient(this.contentGenerator, this);
// Fire auth_success notification hook (supports both interactive & non-interactive)
const messageBus = this.getMessageBus();
const hooksEnabled = this.getEnableHooks();
if (hooksEnabled && messageBus) {
fireNotificationHook(
messageBus,
`Successfully authenticated with ${authMethod}`,
NotificationType.AuthSuccess,
'Authentication successful',
).catch(() => {
// Silently ignore errors - fireNotificationHook has internal error handling
// and notification hooks should not block the auth flow
});
}
}
/**