Skip to content

A self-improving RLM agent for coding workflows and long-running autonomous tasks.

Rust

show typed command for local slash commands like /context (#270)

ktf97335a82c9f
diff --git a/packages/coding-agent/src/modes/interactive/interactive-mode.ts b/packages/coding-agent/src/modes/interactive/interactive-mode.ts
index 95d5bce0f8..84a12523af 100644
--- a/packages/coding-agent/src/modes/interactive/interactive-mode.ts
+++ b/packages/coding-agent/src/modes/interactive/interactive-mode.ts
@@ -3506,11 +3506,13 @@ export class InteractiveMode {
return;
}
if (commandName === "session" && !commandArgs) {
+ this.echoLocalCommand(text);
await this.handleSessionCommand();
this.editor.setText("");
return;
}
if (commandName === "system-prompt" && !commandArgs) {
+ this.echoLocalCommand(text);
await this.handleSystemPromptCommand();
this.editor.setText("");
return;
@@ -3521,16 +3523,19 @@ export class InteractiveMode {
return;
}
if (commandName === "context" && !commandArgs) {
+ this.echoLocalCommand(text);
await this.handleContextCommand();
this.editor.setText("");
return;
}
if (commandName === "logs" && !commandArgs) {
+ this.echoLocalCommand(text);
this.handleLogsCommand();
this.editor.setText("");
return;
}
if (commandName === "goal" && (!commandArgs || commandArgs === "status")) {
+ this.echoLocalCommand(text);
this.handleGoalStatusCommand();
this.editor.setText("");
return;
@@ -3541,11 +3546,13 @@ export class InteractiveMode {
return;
}
if (commandName === "changelog" && !commandArgs) {
+ this.echoLocalCommand(text);
this.handleChangelogCommand();
this.editor.setText("");
return;
}
if (commandName === "hotkeys" && !commandArgs) {
+ this.echoLocalCommand(text);
this.handleHotkeysCommand();
this.editor.setText("");
return;
@@ -4748,6 +4755,17 @@ export class InteractiveMode {
this.ui.requestRender();
}
+ // Local slash commands (/context, /system-prompt, …) print into the chat
+ // without round-tripping through the agent, so no user message event echoes
+ // the typed command. Render the turn ourselves, mirroring the "user" case
+ // above, so the output is anchored to a visible command instead of floating.
+ private echoLocalCommand(text: string): void {
+ if (this.chatContainer.children.length > 0) {
+ this.chatContainer.addChild(new Spacer(1));
+ }
+ this.chatContainer.addChild(new UserMessageComponent(text, this.getMarkdownThemeWithSettings()));
+ }
+
private addMessageToChat(message: AgentMessage, options?: { populateHistory?: boolean }): void {
switch (message.role) {
case "bashExecution": {