fix: improve subagent UI display and interruption handling (#330)

Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
Charles Packer
2025-12-21 00:09:12 -08:00
committed by GitHub
parent 90d84482ef
commit 0852ce26fe
14 changed files with 161 additions and 29 deletions

View File

@@ -1,5 +1,6 @@
import { Box, Text } from "ink";
import { memo } from "react";
import { INTERRUPTED_BY_USER } from "../../constants";
import { clipToolReturn } from "../../tools/manager.js";
import { formatArgsDisplay } from "../helpers/formatArgsDisplay.js";
import {
@@ -46,8 +47,14 @@ export const ToolCallMessage = memo(({ line }: { line: ToolCallLine }) => {
const argsText = line.argsText ?? "...";
// Task tool - handled by SubagentGroupDisplay, don't render here
// Exception: Cancelled/rejected Task tools should be rendered inline
// since they won't appear in SubagentGroupDisplay
if (isTaskTool(rawName)) {
return null;
const isCancelledOrRejected =
line.phase === "finished" && line.resultOk === false;
if (!isCancelledOrRejected) {
return null;
}
}
// Apply tool name remapping
@@ -103,14 +110,14 @@ export const ToolCallMessage = memo(({ line }: { line: ToolCallLine }) => {
);
}
if (line.resultText === "Interrupted by user") {
if (line.resultText === INTERRUPTED_BY_USER) {
return (
<Box flexDirection="row">
<Box width={prefixWidth} flexShrink={0}>
<Text>{prefix}</Text>
</Box>
<Box flexGrow={1} width={contentWidth}>
<Text color={colors.status.interrupt}>Interrupted by user</Text>
<Text color={colors.status.interrupt}>{INTERRUPTED_BY_USER}</Text>
</Box>
</Box>
);