A self-improving RLM agent for coding workflows and long-running autonomous tasks.
Rust
Tighten tool call spacing (#380)
eliee9ba2fe821ff
diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.mdindex 932a25918e..1832082f2d 100644--- a/packages/coding-agent/CHANGELOG.md+++ b/packages/coding-agent/CHANGELOG.md@@ -2,6 +2,7 @@## [Unreleased]+- Changed tool call groups to use one blank row above and below without blank rows between consecutive calls.- Changed the session tree to show only user messages by default.- Changed agent-to-agent messages to render as directional rows, with received messages expandable in chat and sent messages shown below their Python cell ([ENG-4531](https://linear.app/primeintellect/issue/ENG-4531/collapse-and-simplify-agent2agent-messages-in-chat-tui)).- Fixed IPython state restore notices rendering as full user messages when prompts were queued or restored ([ENG-4530](https://linear.app/primeintellect/issue/ENG-4530/collapse-ipython-state-restore-messages-in-chat-tui)).diff --git a/packages/coding-agent/src/modes/interactive/components/assistant-message.ts b/packages/coding-agent/src/modes/interactive/components/assistant-message.tsindex e8cd22cd0c..75c56a22f4 100644--- a/packages/coding-agent/src/modes/interactive/components/assistant-message.ts+++ b/packages/coding-agent/src/modes/interactive/components/assistant-message.ts@@ -264,6 +264,10 @@ export class AssistantMessageComponent extends Container {this.contentContainer.addChild(new Spacer(1));this.contentContainer.addChild(this.createErrorComponent(errorMsg, "Error"));}++ if (hasToolCalls && (hasVisibleContent || message.stopReason === "aborted")) {+ this.contentContainer.addChild(new Spacer(1));+ }}private createErrorComponent(message: string, prefix?: string): Component {diff --git a/packages/coding-agent/src/modes/interactive/components/tool-execution.ts b/packages/coding-agent/src/modes/interactive/components/tool-execution.tsindex bfe731bd34..ec73f5bd5b 100644--- a/packages/coding-agent/src/modes/interactive/components/tool-execution.ts+++ b/packages/coding-agent/src/modes/interactive/components/tool-execution.ts@@ -125,8 +125,6 @@ export class ToolExecutionComponent extends Container {this.ui = ui;this.cwd = cwd;- this.addChild(new Spacer(1));-// Always create both shell variants. contentPanel is the tool panel used// for default renderer-based composition (and the generic fallback when no// tool definition exists). selfRenderContainer is used when the tooldiff --git a/packages/coding-agent/test/assistant-message.test.ts b/packages/coding-agent/test/assistant-message.test.tsindex a18ebcc9d7..d25f37962f 100644--- a/packages/coding-agent/test/assistant-message.test.ts+++ b/packages/coding-agent/test/assistant-message.test.ts@@ -56,6 +56,35 @@ describe("AssistantMessageComponent", () => {expect(rendered.includes(OSC133_ZONE_FINAL)).toBe(false);});+ test("adds one trailing spacer between visible assistant content and its tool batch", () => {+ initTheme("dark");++ const component = new AssistantMessageComponent(+ createAssistantMessage([+ { type: "text", text: "calling tools" },+ { type: "toolCall", id: "tool-1", name: "bash", arguments: { command: "pwd" } },+ { type: "toolCall", id: "tool-2", name: "bash", arguments: { command: "ls" } },+ ]),+ );+ const lines = component.render(60);++ expect(stripAnsi(lines.at(-2) ?? "")).toContain("calling tools");+ expect(lines.at(-1)).toBe("");+ });++ test("does not add spacing for a tool-only assistant message", () => {+ initTheme("dark");++ const component = new AssistantMessageComponent(+ createAssistantMessage([+ { type: "toolCall", id: "tool-1", name: "bash", arguments: { command: "pwd" } },+ { type: "toolCall", id: "tool-2", name: "bash", arguments: { command: "ls" } },+ ]),+ );++ expect(component.render(60)).toEqual([]);+ });+test("renders an abort status for messages with tool calls", () => {initTheme("dark");diff --git a/packages/coding-agent/test/tool-execution-component.test.ts b/packages/coding-agent/test/tool-execution-component.test.tsindex be8ef531a8..cd1ac2955d 100644--- a/packages/coding-agent/test/tool-execution-component.test.ts+++ b/packages/coding-agent/test/tool-execution-component.test.ts@@ -482,7 +482,9 @@ describe("ToolExecutionComponent parity", () => {createFakeTui(),process.cwd(),);- expect(stripAnsi(component.render(100).join("\n"))).toContain("bash · queued");+ const queuedLines = component.render(100);+ expect(stripAnsi(queuedLines.join("\n"))).toContain("bash · queued");+ expect(stripAnsi(queuedLines[0])).toContain("bash · queued");component.markExecutionStarted();// Running status leads with the animated working glyph for the current frame.