mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-28 19:52:02 +00:00
remove hooks experimental and refactor hook Config
This commit is contained in:
parent
1b1a029fd7
commit
5221002831
33 changed files with 722 additions and 322 deletions
|
|
@ -418,12 +418,10 @@ export interface ConfigParameters {
|
|||
modelProvidersConfig?: ModelProvidersConfig;
|
||||
/** Multi-agent collaboration settings (Arena, Team, Swarm) */
|
||||
agents?: AgentsCollabSettings;
|
||||
/** Enable hook system for lifecycle events */
|
||||
enableHooks?: boolean;
|
||||
/** Disable all hooks (default: false, hooks enabled) */
|
||||
disableAllHooks?: boolean;
|
||||
/** Hooks configuration from settings */
|
||||
hooks?: Record<string, unknown>;
|
||||
/** Hooks config settings (enabled, disabled list) */
|
||||
hooksConfig?: Record<string, unknown>;
|
||||
/** Warnings generated during configuration resolution */
|
||||
warnings?: string[];
|
||||
/**
|
||||
|
|
@ -593,9 +591,8 @@ export class Config {
|
|||
private readonly eventEmitter?: EventEmitter;
|
||||
private readonly channel: string | undefined;
|
||||
private readonly defaultFileEncoding: FileEncodingType | undefined;
|
||||
private readonly enableHooks: boolean;
|
||||
private readonly disableAllHooks: boolean;
|
||||
private readonly hooks?: Record<string, unknown>;
|
||||
private readonly hooksConfig?: Record<string, unknown>;
|
||||
private hookSystem?: HookSystem;
|
||||
private messageBus?: MessageBus;
|
||||
|
||||
|
|
@ -759,9 +756,8 @@ export class Config {
|
|||
enabledExtensionOverrides: this.overrideExtensions,
|
||||
isWorkspaceTrusted: this.isTrustedFolder(),
|
||||
});
|
||||
this.enableHooks = params.enableHooks ?? false;
|
||||
this.disableAllHooks = params.disableAllHooks ?? false;
|
||||
this.hooks = params.hooks;
|
||||
this.hooksConfig = params.hooksConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -786,7 +782,7 @@ export class Config {
|
|||
this.debugLogger.debug('Extension manager initialized');
|
||||
|
||||
// Initialize hook system if enabled
|
||||
if (this.enableHooks) {
|
||||
if (!this.disableAllHooks) {
|
||||
this.hookSystem = new HookSystem(this);
|
||||
await this.hookSystem.initialize();
|
||||
this.debugLogger.debug('Hook system initialized');
|
||||
|
|
@ -1072,7 +1068,7 @@ export class Config {
|
|||
|
||||
// Fire auth_success notification hook (supports both interactive & non-interactive)
|
||||
const messageBus = this.getMessageBus();
|
||||
const hooksEnabled = this.getEnableHooks();
|
||||
const hooksEnabled = !this.getDisableAllHooks();
|
||||
if (hooksEnabled && messageBus) {
|
||||
fireNotificationHook(
|
||||
messageBus,
|
||||
|
|
@ -1779,10 +1775,10 @@ export class Config {
|
|||
}
|
||||
|
||||
/**
|
||||
* Check if hooks are enabled.
|
||||
* Check if all hooks are disabled.
|
||||
*/
|
||||
getEnableHooks(): boolean {
|
||||
return this.enableHooks;
|
||||
getDisableAllHooks(): boolean {
|
||||
return this.disableAllHooks;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1801,17 +1797,6 @@ export class Config {
|
|||
this.messageBus = messageBus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of disabled hook names.
|
||||
* This is used by the HookRegistry to filter out disabled hooks.
|
||||
*/
|
||||
getDisabledHooks(): string[] {
|
||||
const hooksConfig = this.hooksConfig;
|
||||
if (!hooksConfig) return [];
|
||||
const disabled = hooksConfig['disabled'];
|
||||
return Array.isArray(disabled) ? (disabled as string[]) : [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get project-level hooks configuration.
|
||||
* This is used by the HookRegistry to load project-specific hooks.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue