From b4ae98ecc8ed25091347ce82735c42dff8b10742 Mon Sep 17 00:00:00 2001 From: uinstinct <61635505+uinstinct@users.noreply.github.com> Date: Fri, 6 Feb 2026 18:22:48 +0530 Subject: [PATCH 1/6] add background job manager and output display --- .../cli/src/services/BackgroundJobManager.ts | 220 ++++++++++++++++++ extensions/cli/src/services/types.ts | 5 + extensions/cli/src/slashCommands.ts | 32 +++ 3 files changed, 257 insertions(+) create mode 100644 extensions/cli/src/services/BackgroundJobManager.ts diff --git a/extensions/cli/src/services/BackgroundJobManager.ts b/extensions/cli/src/services/BackgroundJobManager.ts new file mode 100644 index 00000000000..83816362c6c --- /dev/null +++ b/extensions/cli/src/services/BackgroundJobManager.ts @@ -0,0 +1,220 @@ +import { ChildProcess, spawn } from "child_process"; +import { EventEmitter } from "events"; + +import { logger } from "../util/logger.js"; + +export type BackgroundJobStatus = + | "pending" + | "running" + | "completed" + | "failed" + | "cancelled"; + +export interface BackgroundJob { + id: string; + status: BackgroundJobStatus; + command: string; + output: string; + exitCode: number | null; + startTime: Date; + endTime: Date | null; + error?: string; +} + +const MAX_CONCURRENT_JOBS = 5; + +export class BackgroundJobManager extends EventEmitter { + private jobs: Map = new Map(); + private processes: Map = new Map(); + private jobCounter = 0; + + createJob(command: string): BackgroundJob | null { + const runningCount = this.getRunningJobCount(); + if (runningCount >= MAX_CONCURRENT_JOBS) { + logger.warn( + `Cannot create background job: limit of ${MAX_CONCURRENT_JOBS} reached`, + ); + return null; + } + + const id = `bg-${++this.jobCounter}-${Date.now()}`; + const job: BackgroundJob = { + id, + status: "pending", + command, + output: "", + exitCode: null, + startTime: new Date(), + endTime: null, + }; + + this.jobs.set(id, job); + this.emit("jobCreated", job); + return job; + } + + startJob(jobId: string, shell: string, args: string[]): ChildProcess | null { + const job = this.jobs.get(jobId); + if (!job) { + logger.error(`Cannot start job ${jobId}: job not found`); + return null; + } + + job.status = "running"; + this.emit("jobStarted", job); + + const child = spawn(shell, args, { stdio: "pipe" }); + this.processes.set(jobId, child); + + child.stdout?.on("data", (data: Buffer) => { + this.appendOutput(jobId, data.toString()); + }); + + child.stderr?.on("data", (data: Buffer) => { + this.appendOutput(jobId, data.toString()); + }); + + child.on("close", (code: number | null) => { + this.completeJob(jobId, code ?? 0); + }); + + child.on("error", (error: Error) => { + this.failJob(jobId, error.message); + }); + + return child; + } + + createJobWithProcess( + command: string, + child: ChildProcess, + existingOutput: string = "", + ): BackgroundJob | null { + const runningCount = this.getRunningJobCount(); + if (runningCount >= MAX_CONCURRENT_JOBS) { + logger.warn( + `Cannot create background job: limit of ${MAX_CONCURRENT_JOBS} reached`, + ); + return null; + } + + const id = `bg-${++this.jobCounter}-${Date.now()}`; + const job: BackgroundJob = { + id, + status: "running", + command, + output: existingOutput, + exitCode: null, + startTime: new Date(), + endTime: null, + }; + + this.jobs.set(id, job); + this.processes.set(id, child); + this.emit("jobCreated", job); + + child.stdout?.on("data", (data: Buffer) => { + this.appendOutput(id, data.toString()); + }); + + child.stderr?.on("data", (data: Buffer) => { + this.appendOutput(id, data.toString()); + }); + + child.on("close", (code: number | null) => { + this.completeJob(id, code ?? 0); + }); + + child.on("error", (error: Error) => { + this.failJob(id, error.message); + }); + + return job; + } + + appendOutput(jobId: string, data: string): void { + const job = this.jobs.get(jobId); + if (job) { + job.output += data; + this.emit("jobOutput", job, data); + } + } + + completeJob(jobId: string, exitCode: number): void { + const job = this.jobs.get(jobId); + if (job) { + job.status = exitCode === 0 ? "completed" : "failed"; + job.exitCode = exitCode; + job.endTime = new Date(); + this.processes.delete(jobId); + this.emit("jobCompleted", job); + } + } + + failJob(jobId: string, error: string): void { + const job = this.jobs.get(jobId); + if (job) { + job.status = "failed"; + job.error = error; + job.endTime = new Date(); + this.processes.delete(jobId); + this.emit("jobFailed", job); + } + } + + cancelJob(jobId: string): boolean { + const job = this.jobs.get(jobId); + const process = this.processes.get(jobId); + + if (!job) return false; + + if (process) { + process.kill(); + this.processes.delete(jobId); + } + + job.status = "cancelled"; + job.endTime = new Date(); + this.emit("jobCancelled", job); + return true; + } + + getJob(jobId: string): BackgroundJob | undefined { + return this.jobs.get(jobId); + } + + getRunningJobs(): BackgroundJob[] { + return Array.from(this.jobs.values()).filter( + (job) => job.status === "running" || job.status === "pending", + ); + } + + getAllJobs(): BackgroundJob[] { + return Array.from(this.jobs.values()); + } + + getRunningJobCount(): number { + return this.getRunningJobs().length; + } + + killAllJobs(): void { + for (const [jobId, process] of this.processes) { + process.kill(); + const job = this.jobs.get(jobId); + if (job) { + job.status = "cancelled"; + job.endTime = new Date(); + } + } + this.processes.clear(); + this.emit("allJobsKilled"); + } + + reset(): void { + this.killAllJobs(); + this.jobs.clear(); + this.jobCounter = 0; + } +} + +export const backgroundJobManager = new BackgroundJobManager(); diff --git a/extensions/cli/src/services/types.ts b/extensions/cli/src/services/types.ts index b9804bcd26b..9965a8fabec 100644 --- a/extensions/cli/src/services/types.ts +++ b/extensions/cli/src/services/types.ts @@ -130,6 +130,10 @@ export interface ArtifactUploadServiceState { lastError: string | null; } +export type { + BackgroundJob, + BackgroundJobStatus, +} from "./BackgroundJobManager.js"; export type { ChatHistoryState } from "./ChatHistoryService.js"; export type { FileIndexServiceState } from "./FileIndexService.js"; export type { GitAiIntegrationServiceState } from "./GitAiIntegrationService.js"; @@ -153,6 +157,7 @@ export const SERVICE_NAMES = { AGENT_FILE: "agentFile", ARTIFACT_UPLOAD: "artifactUpload", GIT_AI_INTEGRATION: "gitAiIntegration", + BACKGROUND_JOBS: "backgroundJobs", } as const; /** diff --git a/extensions/cli/src/slashCommands.ts b/extensions/cli/src/slashCommands.ts index c28390d0cec..d00b82bfb4f 100644 --- a/extensions/cli/src/slashCommands.ts +++ b/extensions/cli/src/slashCommands.ts @@ -9,6 +9,7 @@ import { import { getAllSlashCommands } from "./commands/commands.js"; import { handleInit } from "./commands/init.js"; import { handleInfoSlashCommand } from "./infoScreen.js"; +import { backgroundJobManager } from "./services/BackgroundJobManager.js"; import { reloadService, SERVICE_NAMES, services } from "./services/index.js"; import { getCurrentSession, updateSessionTitle } from "./session.js"; import { posthogService } from "./telemetry/posthogService.js"; @@ -169,6 +170,36 @@ function handleTitle(args: string[]) { } } +function handleJobs() { + const allJobs = backgroundJobManager.getAllJobs(); + if (allJobs.length === 0) { + return { + exit: false, + output: chalk.dim("No background jobs"), + }; + } + + const lines = [chalk.bold("Background Jobs:")]; + for (const job of allJobs) { + const statusColor = + job.status === "running" || job.status === "pending" + ? chalk.yellow + : job.status === "completed" + ? chalk.green + : chalk.red; + const duration = job.endTime + ? `${Math.round((job.endTime.getTime() - job.startTime.getTime()) / 1000)}s` + : `${Math.round((Date.now() - job.startTime.getTime()) / 1000)}s`; + lines.push( + ` ${statusColor(job.status.padEnd(10))} ${chalk.cyan(job.id)} ${chalk.dim(`(${duration})`)} ${job.command.substring(0, 40)}${job.command.length > 40 ? "..." : ""}`, + ); + } + return { + exit: false, + output: lines.join("\n"), + }; +} + const commandHandlers: Record = { help: handleHelp, clear: () => { @@ -203,6 +234,7 @@ const commandHandlers: Record = { update: () => { return { openUpdateSelector: true }; }, + jobs: handleJobs, }; export async function handleSlashCommands( From 5a479ca427091805ff7f000091d84f1fae421a8c Mon Sep 17 00:00:00 2001 From: uinstinct <61635505+uinstinct@users.noreply.github.com> Date: Fri, 6 Feb 2026 18:26:09 +0530 Subject: [PATCH 2/6] added checkBackgroundJob tool --- extensions/cli/src/services/index.ts | 2 + .../cli/src/tools/checkBackgroundJob.ts | 64 +++++++++++++++++++ extensions/cli/src/tools/index.tsx | 2 + 3 files changed, 68 insertions(+) create mode 100644 extensions/cli/src/tools/checkBackgroundJob.ts diff --git a/extensions/cli/src/services/index.ts b/extensions/cli/src/services/index.ts index 56a5d4e938a..6ca30e4a040 100644 --- a/extensions/cli/src/services/index.ts +++ b/extensions/cli/src/services/index.ts @@ -10,6 +10,7 @@ import { AgentFileService } from "./AgentFileService.js"; import { ApiClientService } from "./ApiClientService.js"; import { ArtifactUploadService } from "./ArtifactUploadService.js"; import { AuthService } from "./AuthService.js"; +import { backgroundJobManager } from "./BackgroundJobManager.js"; import { ChatHistoryService } from "./ChatHistoryService.js"; import { ConfigService } from "./ConfigService.js"; import { FileIndexService } from "./FileIndexService.js"; @@ -387,6 +388,7 @@ export const services = { toolPermissions: toolPermissionService, artifactUpload: artifactUploadService, gitAiIntegration: gitAiIntegrationService, + backgroundJobs: backgroundJobManager, } as const; export type ServicesType = typeof services; diff --git a/extensions/cli/src/tools/checkBackgroundJob.ts b/extensions/cli/src/tools/checkBackgroundJob.ts new file mode 100644 index 00000000000..08968b91fb8 --- /dev/null +++ b/extensions/cli/src/tools/checkBackgroundJob.ts @@ -0,0 +1,64 @@ +import { services } from "../services/index.js"; + +import { Tool } from "./types.js"; + +export const checkBackgroundJobTool: Tool = { + name: "CheckBackgroundJob", + displayName: "Check Background Job", + description: `Check the status and output of a background job. +Returns the current status, exit code (if finished), and all available output. +If the job is still running, returns partial output with "running" status.`, + parameters: { + type: "object", + required: ["job_id"], + properties: { + job_id: { + type: "string", + description: + "The ID of the background job to check (e.g., bg-1-1234567890)", + }, + }, + }, + readonly: true, + isBuiltIn: true, + run: async ({ job_id }: { job_id: string }): Promise => { + const job = services.backgroundJobs.getJob(job_id); + + if (!job) { + return JSON.stringify({ + error: `Job ${job_id} not found`, + available_jobs: services.backgroundJobs.getAllJobs().map((j) => ({ + id: j.id, + status: j.status, + command: + j.command.substring(0, 50) + (j.command.length > 50 ? "..." : ""), + })), + }); + } + + const result: Record = { + job_id: job.id, + status: job.status, + command: job.command, + output: job.output, + started_at: job.startTime.toISOString(), + }; + + if (job.endTime) { + result.ended_at = job.endTime.toISOString(); + result.duration_seconds = Math.round( + (job.endTime.getTime() - job.startTime.getTime()) / 1000, + ); + } + + if (job.exitCode !== null) { + result.exit_code = job.exitCode; + } + + if (job.error) { + result.error = job.error; + } + + return JSON.stringify(result, null, 2); + }, +}; diff --git a/extensions/cli/src/tools/index.tsx b/extensions/cli/src/tools/index.tsx index 20d37d6d365..eb10d870d62 100644 --- a/extensions/cli/src/tools/index.tsx +++ b/extensions/cli/src/tools/index.tsx @@ -19,6 +19,7 @@ import { telemetryService } from "../telemetry/telemetryService.js"; import { logger } from "../util/logger.js"; import { ALL_BUILT_IN_TOOLS } from "./allBuiltIns.js"; +import { checkBackgroundJobTool } from "./checkBackgroundJob.js"; import { editTool } from "./edit.js"; import { exitTool } from "./exit.js"; import { fetchTool } from "./fetch.js"; @@ -68,6 +69,7 @@ const BASE_BUILTIN_TOOLS: Tool[] = [ runTerminalCommandTool, fetchTool, writeChecklistTool, + checkBackgroundJobTool, ]; const BUILTIN_SEARCH_TOOLS: Tool[] = [searchCodeTool]; From 561f85e95caecc08c80cab1859b35f573c5678c5 Mon Sep 17 00:00:00 2001 From: uinstinct <61635505+uinstinct@users.noreply.github.com> Date: Fri, 6 Feb 2026 18:36:45 +0530 Subject: [PATCH 3/6] move process to background with ctrl+b --- .../src/services/BackgroundSignalManager.ts | 9 +++ .../cli/src/tools/runTerminalCommand.ts | 67 ++++++++++++++++++- extensions/cli/src/ui/hooks/useUserInput.ts | 7 ++ 3 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 extensions/cli/src/services/BackgroundSignalManager.ts diff --git a/extensions/cli/src/services/BackgroundSignalManager.ts b/extensions/cli/src/services/BackgroundSignalManager.ts new file mode 100644 index 00000000000..b183ea30ba4 --- /dev/null +++ b/extensions/cli/src/services/BackgroundSignalManager.ts @@ -0,0 +1,9 @@ +import { EventEmitter } from "events"; + +export class BackgroundSignalManager extends EventEmitter { + signalBackground(): void { + this.emit("backgroundRequested"); + } +} + +export const backgroundSignalManager = new BackgroundSignalManager(); diff --git a/extensions/cli/src/tools/runTerminalCommand.ts b/extensions/cli/src/tools/runTerminalCommand.ts index 5b7f08b30fc..57d1d0e5291 100644 --- a/extensions/cli/src/tools/runTerminalCommand.ts +++ b/extensions/cli/src/tools/runTerminalCommand.ts @@ -1,4 +1,4 @@ -import { spawn } from "child_process"; +import { ChildProcess, spawn } from "child_process"; import fs from "fs"; import { @@ -6,6 +6,8 @@ import { type ToolPolicy, } from "@continuedev/terminal-security"; +import { backgroundJobManager } from "../services/BackgroundJobManager.js"; +import { backgroundSignalManager } from "../services/BackgroundSignalManager.js"; import { telemetryService } from "../telemetry/telemetryService.js"; import { isGitCommitCommand, @@ -82,6 +84,35 @@ function getShellCommand(command: string): { shell: string; args: string[] } { return { shell: userShell, args: ["-l", "-c", command] }; } +export function runCommandInBackground(command: string): { + success: boolean; + jobId?: string; + error?: string; +} { + const job = backgroundJobManager.createJob(command); + if (!job) { + return { + success: false, + error: "Cannot create background job: limit of 5 concurrent jobs reached", + }; + } + + const { shell, args } = getShellCommand(command); + const child = backgroundJobManager.startJob(job.id, shell, args); + + if (!child) { + return { + success: false, + error: `Failed to start background job ${job.id}`, + }; + } + + return { + success: true, + jobId: job.id, + }; +} + export const runTerminalCommandTool: Tool = { name: "Bash", displayName: "Bash", @@ -187,6 +218,34 @@ IMPORTANT: To edit files, use Edit/MultiEdit tools instead of bash commands (sed return output; }; + const moveToBackground = () => { + if (isResolved) return; + isResolved = true; + + if (timeoutId) { + clearTimeout(timeoutId); + } + backgroundSignalManager.off("backgroundRequested", moveToBackground); + + const job = backgroundJobManager.createJobWithProcess( + command, + child as ChildProcess, + stdout, + ); + + if (job) { + resolve( + `Command moved to background. Job ID: ${job.id}\nOutput so far:\n${stdout}\nUse CheckBackgroundJob("${job.id}") to check status.`, + ); + } else { + resolve( + `Failed to move to background (job limit reached). Command continues in foreground.\nOutput so far: ${stdout}`, + ); + } + }; + + backgroundSignalManager.on("backgroundRequested", moveToBackground); + const resetTimeout = () => { if (timeoutId) { clearTimeout(timeoutId); @@ -230,6 +289,11 @@ IMPORTANT: To edit files, use Edit/MultiEdit tools instead of bash commands (sed clearTimeout(timeoutId); } + backgroundSignalManager.removeListener( + "backgroundRequested", + moveToBackground, + ); + // Only reject on non-zero exit code if there's also stderr if (code !== 0 && stderr) { reject(`Error (exit code ${code}): ${stderr}`); @@ -267,6 +331,7 @@ IMPORTANT: To edit files, use Edit/MultiEdit tools instead of bash commands (sed if (timeoutId) { clearTimeout(timeoutId); } + backgroundSignalManager.off("backgroundRequested", moveToBackground); reject(`Error: ${error.message}`); }); }); diff --git a/extensions/cli/src/ui/hooks/useUserInput.ts b/extensions/cli/src/ui/hooks/useUserInput.ts index 334d23fc304..366522ff15e 100644 --- a/extensions/cli/src/ui/hooks/useUserInput.ts +++ b/extensions/cli/src/ui/hooks/useUserInput.ts @@ -1,4 +1,5 @@ import type { PermissionMode } from "../../permissions/types.js"; +import { backgroundSignalManager } from "../../services/BackgroundSignalManager.js"; import { checkClipboardForImage, getClipboardImage, @@ -85,6 +86,12 @@ export function handleControlKeys(options: ControlKeysOptions): boolean { return true; } + // Handle Ctrl+B to send current tool execution to background + if (key.ctrl && input === "b") { + backgroundSignalManager.signalBackground(); + return true; + } + // Handle Shift+Tab to cycle through modes if (key.tab && key.shift && !showSlashCommands && !showFileSearch) { cycleModes().catch((error) => { From 60bef4b4d4aca88f033866962af4d8b784b71467 Mon Sep 17 00:00:00 2001 From: uinstinct <61635505+uinstinct@users.noreply.github.com> Date: Fri, 6 Feb 2026 18:39:17 +0530 Subject: [PATCH 4/6] add the jobs slash command --- extensions/cli/src/commands/commands.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/extensions/cli/src/commands/commands.ts b/extensions/cli/src/commands/commands.ts index e04849c587d..0c85f2228c1 100644 --- a/extensions/cli/src/commands/commands.ts +++ b/extensions/cli/src/commands/commands.ts @@ -2,11 +2,11 @@ import { type AssistantConfig } from "@continuedev/sdk"; // Export command functions export { chat } from "./chat.js"; -export { review } from "./review.js"; export { login } from "./login.js"; export { logout } from "./logout.js"; export { listSessionsCommand } from "./ls.js"; export { remote } from "./remote.js"; +export { review } from "./review.js"; export { serve } from "./serve.js"; export interface SlashCommand { @@ -101,6 +101,11 @@ export const SYSTEM_SLASH_COMMANDS: SystemCommand[] = [ description: "Exit the chat", category: "system", }, + { + name: "jobs", + description: "List background jobs", + category: "system", + }, ]; // Remote mode specific commands From 007094609f8d077b194b0c17943e77e75b68d6df Mon Sep 17 00:00:00 2001 From: uinstinct <61635505+uinstinct@users.noreply.github.com> Date: Fri, 6 Feb 2026 18:48:18 +0530 Subject: [PATCH 5/6] kill all background jobs on exit --- extensions/cli/src/util/exit.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/extensions/cli/src/util/exit.ts b/extensions/cli/src/util/exit.ts index a378cd8de64..3642669974e 100644 --- a/extensions/cli/src/util/exit.ts +++ b/extensions/cli/src/util/exit.ts @@ -1,6 +1,7 @@ import type { ChatHistoryItem } from "core/index.js"; import { sentryService } from "../sentry.js"; +import { backgroundJobManager } from "../services/BackgroundJobManager.js"; import { getSessionUsage } from "../session.js"; import { telemetryService } from "../telemetry/telemetryService.js"; @@ -194,6 +195,17 @@ export async function gracefulExit(code: number = 0): Promise { // Display session usage breakdown in verbose mode displaySessionUsage(); + try { + // todo: rename backgroundJobManager to backgroundCommandService + const runningJobs = backgroundJobManager.getRunningJobCount(); + if (runningJobs > 0) { + logger.debug(`Killing ${runningJobs} background job(s) on exit`); + backgroundJobManager.killAllJobs(); + } + } catch (err) { + logger.debug("Background job cleanup error (ignored)", err as any); + } + try { // Flush metrics (forceFlush + shutdown inside service) await telemetryService.shutdown(); From 149a27c988737981f39c58070a7a70f65db8e0b3 Mon Sep 17 00:00:00 2001 From: uinstinct <61635505+uinstinct@users.noreply.github.com> Date: Fri, 6 Feb 2026 19:19:12 +0530 Subject: [PATCH 6/6] show ctrl+b to move to background --- .../cli/src/tools/runTerminalCommand.ts | 9 ++++++++- extensions/cli/src/ui/TUIChat.tsx | 20 +++++++++++++++++++ .../cli/src/ui/components/ActionStatus.tsx | 6 +++++- extensions/cli/src/util/cli.ts | 10 ++++++++++ 4 files changed, 43 insertions(+), 2 deletions(-) diff --git a/extensions/cli/src/tools/runTerminalCommand.ts b/extensions/cli/src/tools/runTerminalCommand.ts index 57d1d0e5291..3826ffcf36d 100644 --- a/extensions/cli/src/tools/runTerminalCommand.ts +++ b/extensions/cli/src/tools/runTerminalCommand.ts @@ -13,6 +13,7 @@ import { isGitCommitCommand, isPullRequestCommand, } from "../telemetry/utils.js"; +import { emitBashToolEnded, emitBashToolStarted } from "../util/cli.js"; import { parseEnvNumber, truncateOutputFromStart, @@ -182,7 +183,9 @@ IMPORTANT: To edit files, use Edit/MultiEdit tools instead of bash commands (sed const maxChars = Math.floor(baseMaxChars / parallelCount); const maxLines = Math.floor(baseMaxLines / parallelCount); - return new Promise((resolve, reject) => { + emitBashToolStarted(); + + const terminalOutput: string = await new Promise((resolve, reject) => { // Use same shell logic as core implementation const { shell, args } = getShellCommand(command); const child = spawn(shell, args); @@ -335,5 +338,9 @@ IMPORTANT: To edit files, use Edit/MultiEdit tools instead of bash commands (sed reject(`Error: ${error.message}`); }); }); + + emitBashToolEnded(); + + return terminalOutput; }, }; diff --git a/extensions/cli/src/ui/TUIChat.tsx b/extensions/cli/src/ui/TUIChat.tsx index b20d4db122d..f28b20a5bc1 100644 --- a/extensions/cli/src/ui/TUIChat.tsx +++ b/extensions/cli/src/ui/TUIChat.tsx @@ -20,6 +20,7 @@ import { UpdateServiceState, } from "../services/types.js"; import { getTotalSessionCost } from "../session.js"; +import { bashToolEvents } from "../util/cli.js"; import { logger } from "../util/logger.js"; import { ActionStatus } from "./components/ActionStatus.js"; @@ -341,6 +342,22 @@ const TUIChat: React.FC = ({ // Fetch organization name based on auth state const organizationName = useOrganizationName(services.auth?.organizationId); + // Track if a Bash tool is currently running via events + const [isBashToolRunning, setIsBashToolRunning] = useState(false); + + useEffect(() => { + const handleStarted = () => setIsBashToolRunning(true); + const handleEnded = () => setIsBashToolRunning(false); + + bashToolEvents.on("started", handleStarted); + bashToolEvents.on("ended", handleEnded); + + return () => { + bashToolEvents.off("started", handleStarted); + bashToolEvents.off("ended", handleEnded); + }; + }, []); + return ( {/* Chat history - takes up all available space above input */} @@ -379,6 +396,9 @@ const TUIChat: React.FC = ({ startTime={responseStartTime || 0} message="" showSpinner={true} + additionalHint={ + isBashToolRunning ? "ctrl+b to background" : undefined + } /> {/* Compaction Status */} diff --git a/extensions/cli/src/ui/components/ActionStatus.tsx b/extensions/cli/src/ui/components/ActionStatus.tsx index a12b3d6497c..84f17b313bc 100644 --- a/extensions/cli/src/ui/components/ActionStatus.tsx +++ b/extensions/cli/src/ui/components/ActionStatus.tsx @@ -11,6 +11,7 @@ interface ActionStatusProps { showSpinner?: boolean; color?: string; loadingColor?: string; + additionalHint?: string; } const ActionStatus: React.FC = ({ @@ -20,6 +21,7 @@ const ActionStatus: React.FC = ({ showSpinner = false, color = "dim", loadingColor = "green", + additionalHint, }) => { if (!visible) return null; @@ -29,7 +31,9 @@ const ActionStatus: React.FC = ({ {message} ( - • esc to interrupt ) + • esc to interrupt + {additionalHint && • {additionalHint}} + ) ); }; diff --git a/extensions/cli/src/util/cli.ts b/extensions/cli/src/util/cli.ts index b8e359a1d7f..563b9405777 100644 --- a/extensions/cli/src/util/cli.ts +++ b/extensions/cli/src/util/cli.ts @@ -94,3 +94,13 @@ export function hasSuppliedPrompt(): boolean { } export const escapeEvents = new EventEmitter(); + +export const bashToolEvents = new EventEmitter(); + +export function emitBashToolStarted(): void { + bashToolEvents.emit("started"); +} + +export function emitBashToolEnded(): void { + bashToolEvents.emit("ended"); +}