mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-29 04:00:36 +00:00
add singal abort for hooks
This commit is contained in:
parent
a0041191a7
commit
8bd7cf2cda
16 changed files with 344 additions and 52 deletions
|
|
@ -41,6 +41,7 @@ import {
|
|||
Storage,
|
||||
SessionEndReason,
|
||||
SessionStartSource,
|
||||
type PermissionMode,
|
||||
} from '@qwen-code/qwen-code-core';
|
||||
import { buildResumedHistoryItems } from './utils/resumeHistoryUtils.js';
|
||||
import { validateAuthMethod } from '../config/auth.js';
|
||||
|
|
@ -308,7 +309,11 @@ export const AppContainer = (props: AppContainerProps) => {
|
|||
|
||||
if (hookSystem) {
|
||||
hookSystem
|
||||
.fireSessionStartEvent(sessionStartSource, config.getModel() ?? '')
|
||||
.fireSessionStartEvent(
|
||||
sessionStartSource,
|
||||
config.getModel() ?? '',
|
||||
String(config.getApprovalMode()) as PermissionMode,
|
||||
)
|
||||
.then(() => {
|
||||
debugLogger.debug('SessionStart event completed successfully');
|
||||
})
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ describe('clearCommand', () => {
|
|||
}),
|
||||
getModel: () => 'test-model',
|
||||
getToolRegistry: () => undefined,
|
||||
getApprovalMode: () => 'default',
|
||||
},
|
||||
},
|
||||
session: {
|
||||
|
|
@ -108,6 +109,7 @@ describe('clearCommand', () => {
|
|||
expect(mockFireSessionStartEvent).toHaveBeenCalledWith(
|
||||
SessionStartSource.Clear,
|
||||
'test-model',
|
||||
expect.any(String), // permissionMode
|
||||
);
|
||||
|
||||
// SessionEnd should be called before SessionStart
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import {
|
|||
SessionStartSource,
|
||||
ToolNames,
|
||||
SkillTool,
|
||||
type PermissionMode,
|
||||
} from '@qwen-code/qwen-code-core';
|
||||
|
||||
export const clearCommand: SlashCommand = {
|
||||
|
|
@ -72,6 +73,7 @@ export const clearCommand: SlashCommand = {
|
|||
?.fireSessionStartEvent(
|
||||
SessionStartSource.Clear,
|
||||
config.getModel() ?? '',
|
||||
String(config.getApprovalMode()) as PermissionMode,
|
||||
);
|
||||
} catch (err) {
|
||||
config.getDebugLogger().warn(`SessionStart hook failed: ${err}`);
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import {
|
|||
SessionService,
|
||||
type Config,
|
||||
SessionStartSource,
|
||||
type PermissionMode,
|
||||
} from '@qwen-code/qwen-code-core';
|
||||
import { buildResumedHistoryItems } from '../utils/resumeHistoryUtils.js';
|
||||
import type { UseHistoryManagerReturn } from './useHistoryManager.js';
|
||||
|
|
@ -78,6 +79,7 @@ export function useResumeCommand(
|
|||
?.fireSessionStartEvent(
|
||||
SessionStartSource.Resume,
|
||||
config.getModel() ?? '',
|
||||
String(config.getApprovalMode()) as PermissionMode,
|
||||
);
|
||||
} catch (err) {
|
||||
config.getDebugLogger().warn(`SessionStart hook failed: ${err}`);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue