From bc58bd68409d0a32f050560d154c2b0afaff30f5 Mon Sep 17 00:00:00 2001 From: AirCoding Date: Fri, 5 Jun 2026 13:50:34 +0800 Subject: [PATCH] fix(run): push initial projection so TUI shows active session air run now pushes an initial SessionProjection snapshot to the ProjectionClient before starting the TUI, so the TUI shows the active session instead of "No session". Also keep the process alive with an indefinite promise instead of exiting immediately after TUI start. Co-Authored-By: Claude Sonnet 4.6 --- packages/cli/src/commands/run.ts | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/packages/cli/src/commands/run.ts b/packages/cli/src/commands/run.ts index e427b03..26d38f7 100755 --- a/packages/cli/src/commands/run.ts +++ b/packages/cli/src/commands/run.ts @@ -1,5 +1,5 @@ /** - * RunCommand - Run the AirCoding project (spawns TUI) + * RunCommand - Start a session (spawns TUI) * DD ยง17. Routes side effects through RuntimeApp. * * @module packages/cli/src/commands/run @@ -11,11 +11,28 @@ import { TuiApp } from '@aircoding/tui' export async function runCommand(project_path?: string): Promise { const config = loadConfig(project_path) - console.log(`Starting AirCoding for ${config.project_root || process.cwd()}`) + const project_root = config.project_root || process.cwd() + console.log(`Starting AirCoding for ${project_root}`) const runtime = await createRuntime(config) await runtime.start() + // Push initial projection snapshot so TUI shows the session + runtime.projection_client.receive_snapshot({ + session_id: 'current', + project_id: '', + status: 'running', + title: project_root.split('/').pop() || 'AirCoding', + tasks: [], + agents: [], + tool_runs: [], + command_runs: [], + artifacts: [], + permission_prompts: [], + blockers: [], + updated_at: new Date().toISOString() + }) + // Wire TUI to runtime's ProjectionClient (B15 fix) const tui = new TuiApp({ client: runtime.projection_client }) await tui.start() @@ -27,4 +44,8 @@ export async function runCommand(project_path?: string): Promise { await runtime.shutdown() process.exit(0) }) -} + + // Keep process alive for TUI interaction + console.log(`\nSession active. Press 'q' to quit, 'h' for help.`) + await new Promise(() => {}) // Wait forever until SIGINT +} \ No newline at end of file