feat: 增加调试日志以跟踪活动执行状态和钩子事件

This commit is contained in:
catlog22
2026-01-21 11:15:53 +08:00
parent a602a46985
commit ffe9898fd3
2 changed files with 9 additions and 0 deletions

View File

@@ -87,6 +87,14 @@ export function updateActiveExecution(event: {
}): void {
const { type, executionId, tool, mode, prompt, output, success } = event;
// Debug log for troubleshooting
console.log(`[ActiveExec] ${type}: ${executionId} (current count: ${activeExecutions.size})`);
if (!executionId) {
console.warn('[ActiveExec] Missing executionId, skipping');
return;
}
if (type === 'started') {
// Create new active execution
activeExecutions.set(executionId, {

View File

@@ -268,6 +268,7 @@ export async function handleHooksRoutes(ctx: HooksRouteContext): Promise<boolean
// Update active executions state for CLI streaming events (terminal execution)
if (type === 'CLI_EXECUTION_STARTED' || type === 'CLI_OUTPUT' || type === 'CLI_EXECUTION_COMPLETED') {
console.log(`[Hooks] CLI event: ${type}, executionId: ${extraData.executionId}`);
try {
const { updateActiveExecution } = await import('./cli-routes.js');