feat(cli): migrate console calls to debugLogger and stdioHelpers (M3 Phase 7-9)

Route CLI console.* calls to structured logging:
- Debug/internal diagnostics → debugLogger (logfile)
- User-facing output → writeStdoutLine/writeStderrLine/clearScreen (stdioHelpers)
- Add stdioHelpers.ts with writeStdoutLine, writeStderrLine, clearScreen
- Migrate pre-session files (gemini.tsx, sandbox.ts, config.ts) to stdioHelpers
- Migrate extension/MCP commands to stdioHelpers
- Migrate non-interactive session/control to debugLogger
- Migrate UI hooks and components to debugLogger
This commit is contained in:
tanzhenxin 2026-01-26 15:02:37 +08:00
parent 45df0e8b82
commit 7995c65571
82 changed files with 606 additions and 485 deletions

View file

@ -17,6 +17,7 @@ import type {
import {
SubAgentEventType,
ToolConfirmationOutcome,
createDebugLogger,
} from '@qwen-code/qwen-code-core';
import { z } from 'zod';
import type { SessionContext } from './types.js';
@ -24,6 +25,8 @@ import { ToolCallEmitter } from './emitters/ToolCallEmitter.js';
import { MessageEmitter } from './emitters/MessageEmitter.js';
import type * as acp from '../acp.js';
const debugLogger = createDebugLogger('ACP_SUBAGENT_TRACKER');
/**
* Permission option kind type matching ACP schema.
*/
@ -135,7 +138,7 @@ export class SubAgentTracker {
invocation = tool.build(event.args);
} catch (e) {
// If building fails, continue with defaults
console.warn(`Failed to build subagent tool ${event.name}:`, e);
debugLogger.warn(`Failed to build subagent tool ${event.name}:`, e);
}
}
@ -250,7 +253,7 @@ export class SubAgentTracker {
await event.respond(outcome);
} catch (error) {
// If permission request fails, cancel the tool call
console.error(
debugLogger.error(
`Permission request failed for subagent tool ${event.name}:`,
error,
);