Skip to content

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

Rust

fix subagent summary typing focus (#348)

kta952e0115903
diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md
index 226a8d740c..3c7a921a1c 100644
--- a/packages/coding-agent/CHANGELOG.md
+++ b/packages/coding-agent/CHANGELOG.md
@@ -8,6 +8,7 @@
- Fixed `/heartbeat` guidance to show `stop` and the `every <duration> <instruction>` interval syntax ([ENG-4484](https://linear.app/primeintellect/issue/ENG-4484/improve-heartbeat-command-syntax-guidance-in-ui)).
- Fixed login dialogs in fullscreen so sign-in URLs can be selected natively ([ENG-4480](https://linear.app/primeintellect/issue/ENG-4480/new-fullscreen-tui-makes-it-impossible-to-copy-login-url)).
- Fixed provider auth failures leaving stale credentials shown as connected in `/login` ([ENG-4491](https://linear.app/primeintellect/issue/ENG-4491/mark-provider-stale-after-repeated-401s)).
+- Fixed typing into the prompt after highlighting an inline subagent ([ENG-4494](https://linear.app/primeintellect/issue/ENG-4494/allow-typing-after-highlighting-a-subagent)).
- Fixed session-targeted heartbeat jobs staying scheduled after sessions are killed or saved sessions are deleted ([#332](https://github.com/PrimeIntellect-ai/prime-agent/pull/332)).
## [0.2.6] - 2026-07-06
diff --git a/packages/coding-agent/src/modes/interactive/components/child-agent-inspector.ts b/packages/coding-agent/src/modes/interactive/components/child-agent-inspector.ts
index c134fa1d0c..fdb85e2d63 100644
--- a/packages/coding-agent/src/modes/interactive/components/child-agent-inspector.ts
+++ b/packages/coding-agent/src/modes/interactive/components/child-agent-inspector.ts
@@ -208,7 +208,8 @@ export class ChildAgentSummaryComponent implements Component, Focusable {
onExit?: () => void;
onOpenDetail?: (nodeId: string) => void;
// Chat actions that should still work while the list holds focus.
- onChatAction?: (data: string) => void;
+ onChatAction?: (data: string) => boolean | undefined;
+ onUnhandledInput?: (data: string) => void;
constructor(
private readonly getLocationLabel: () => string | undefined = () => undefined,
@@ -286,8 +287,10 @@ export class ChildAgentSummaryComponent implements Component, Focusable {
this.onCancel?.();
return;
}
- // Keys the list doesn't own fall through to chat actions (expand tools, etc.).
- this.onChatAction?.(data);
+ if (this.onChatAction?.(data)) {
+ return;
+ }
+ this.onUnhandledInput?.(data);
}
private isAtFirstRow(flat: readonly FlatChildAgentNode[]): boolean {
diff --git a/packages/coding-agent/src/modes/interactive/interactive-mode.ts b/packages/coding-agent/src/modes/interactive/interactive-mode.ts
index 80c2e0539a..ddf5398615 100644
--- a/packages/coding-agent/src/modes/interactive/interactive-mode.ts
+++ b/packages/coding-agent/src/modes/interactive/interactive-mode.ts
@@ -770,6 +770,7 @@ export class InteractiveMode {
this.childAgentSummary.onCancel = () => this.focusEditor();
this.childAgentSummary.onExit = () => this.handleSubagentSummaryExit();
this.childAgentSummary.onChatAction = (data) => this.handleSubagentSummaryChatAction(data);
+ this.childAgentSummary.onUnhandledInput = (data) => this.handleSubagentSummaryUnhandledInput(data);
this.footerDataProvider = new FooterDataProvider(this.uiServices.getInitialCwd());
this.footer = new FooterComponent(this.footerDataProvider);
this.footer.setAutoCompactEnabled(this.settingsManager.getCompactionEnabled());
@@ -4706,16 +4707,23 @@ export class InteractiveMode {
this.focusEditor();
}
+ private handleSubagentSummaryUnhandledInput(data: string): void {
+ this.focusEditor();
+ this.editor.handleInput(data);
+ }
+
// Chat actions stay live while the subagent list holds focus; the editor's
// own handlers are bypassed because input routes only to the focused list.
- private handleSubagentSummaryChatAction(data: string): void {
+ private handleSubagentSummaryChatAction(data: string): boolean {
if (this.keybindings.matches(data, "app.tools.expand")) {
this.toggleToolOutputExpansion();
- return;
+ return true;
}
if (this.keybindings.matches(data, "app.thinking.toggle")) {
this.toggleThinkingBlockVisibility();
+ return true;
}
+ return false;
}
private getTrayOverrideLabel(): string | undefined {
diff --git a/packages/coding-agent/test/child-agent-summary-list.test.ts b/packages/coding-agent/test/child-agent-summary-list.test.ts
index 215c6a41f3..2b4e9c9f96 100644
--- a/packages/coding-agent/test/child-agent-summary-list.test.ts
+++ b/packages/coding-agent/test/child-agent-summary-list.test.ts
@@ -1,5 +1,6 @@
-import { visibleWidth } from "@earendil-works/pi-tui";
+import { setKeybindings, visibleWidth } from "@earendil-works/pi-tui";
import { beforeAll, describe, expect, it } from "vitest";
+import { KeybindingsManager } from "../src/core/keybindings.js";
import {
type ChildAgentInspectorNode,
ChildAgentSummaryComponent,
@@ -17,6 +18,7 @@ function node(id: string, status: ChildAgentInspectorNode["status"] = "running")
describe("ChildAgentSummaryComponent inline list", () => {
beforeAll(() => {
+ setKeybindings(new KeybindingsManager());
initTheme("dark");
});
@@ -143,12 +145,55 @@ describe("ChildAgentSummaryComponent inline list", () => {
let forwarded: string | undefined;
summary.onChatAction = (data) => {
forwarded = data;
+ return undefined;
};
// Ctrl+O isn't a list key, so it should bubble to the chat action handler.
summary.handleInput("\x0f");
expect(forwarded).toBe("\x0f");
});
+ it("forwards text input to the unhandled input callback", () => {
+ const summary = new ChildAgentSummaryComponent();
+ summary.focused = true;
+ summary.setNodes([node("a")]);
+ let forwarded: string | undefined;
+ summary.onUnhandledInput = (data) => {
+ forwarded = data;
+ };
+ summary.handleInput("h");
+ expect(forwarded).toBe("h");
+ });
+
+ it("does not forward handled chat actions as unhandled input", () => {
+ const summary = new ChildAgentSummaryComponent();
+ summary.focused = true;
+ summary.setNodes([node("a")]);
+ let unhandled: string | undefined;
+ summary.onChatAction = () => true;
+ summary.onUnhandledInput = (data) => {
+ unhandled = data;
+ };
+ summary.handleInput("\x0f");
+ expect(unhandled).toBeUndefined();
+ });
+
+ it("routes back through onExit without forwarding input", () => {
+ const summary = new ChildAgentSummaryComponent();
+ summary.focused = true;
+ summary.setNodes([node("a")]);
+ let exited = false;
+ let unhandled: string | undefined;
+ summary.onExit = () => {
+ exited = true;
+ };
+ summary.onUnhandledInput = (data) => {
+ unhandled = data;
+ };
+ summary.handleInput("\x1b[D");
+ expect(exited).toBe(true);
+ expect(unhandled).toBeUndefined();
+ });
+
it("opens the selected subagent's detail on confirm", () => {
const summary = new ChildAgentSummaryComponent();
summary.focused = true;