Skip to content

🀯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🎨 style(claude-code): tool inspector polish + unstick Read-on-image spinner (#14034)

Arvin Xue963c640b983
diff --git a/packages/builtin-tool-claude-code/src/client/Inspector/Agent.tsx b/packages/builtin-tool-claude-code/src/client/Inspector/Agent.tsx
index aa1986b6f8c..dea82825180 100644
--- a/packages/builtin-tool-claude-code/src/client/Inspector/Agent.tsx
+++ b/packages/builtin-tool-claude-code/src/client/Inspector/Agent.tsx
@@ -18,7 +18,6 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
align-items: center;
min-width: 0;
- max-width: 60%;
margin-inline-start: 6px;
padding-block: 2px;
padding-inline: 10px;
@@ -38,20 +37,21 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
`,
icon: css`
flex-shrink: 0;
- margin-inline-end: 6px;
+ margin-inline: 6px;
color: ${cssVar.colorTextDescription};
`,
label: css`
+ flex-shrink: 0;
color: ${cssVar.colorText};
`,
}));
/**
- * CC's subagent-spawn tool. `subagent_type` is the template ("Explore",
- * "general-purpose", ...) and becomes the primary label β€” saying "Agent"
- * is redundant once we're already rendering inside the Agent inspector.
- * `description` is the 3-5 word title the model writes ("Run pwd command")
- * and goes in the chip; the full `prompt` is too long for a collapsed header.
+ * CC's subagent-spawn tool. `subagent_type` ("Explore", "general-purpose", ...)
+ * is the variant; we prefix it with "Agent:" so the row visibly reads as a
+ * subagent dispatch rather than a regular tool β€” the icon alone isn't enough
+ * signal. `description` is the 3-5 word title the model writes and goes in the
+ * chip; the full `prompt` is too long for a collapsed header.
*/
export const AgentInspector = memo<BuiltinInspectorProps<AgentArgs>>(
({ args, partialArgs, isArgumentsStreaming, isLoading }) => {
@@ -70,6 +70,7 @@ export const AgentInspector = memo<BuiltinInspectorProps<AgentArgs>>(
return (
<div className={cx(inspectorTextStyles.root, isShiny && shinyTextStyles.shinyText)}>
+ <span className={styles.label}>Agent:</span>
<Icon className={styles.icon} size={14} />
<span className={styles.label}>{labelText}</span>
{description && (
diff --git a/packages/heterogeneous-agents/src/adapters/claudeCode.test.ts b/packages/heterogeneous-agents/src/adapters/claudeCode.test.ts
index 75318d5bd97..89d06beac0d 100644
--- a/packages/heterogeneous-agents/src/adapters/claudeCode.test.ts
+++ b/packages/heterogeneous-agents/src/adapters/claudeCode.test.ts
@@ -304,6 +304,83 @@ describe('ClaudeCodeAdapter', () => {
});
});
+ describe('Read tool image content (LOBE-7338)', () => {
+ // CC's `Read` on images returns a `tool_result` whose `content` is an
+ // `image` block (base64). The generic mapper had no branch for it so
+ // resultContent collapsed to '' and the UI's StatusIndicator stuck on the
+ // spinner. Minimal fix: emit a placeholder so the tool ends in completed
+ // state. Image echo (thumbnails) is deferred.
+ it('renders image blocks as a non-empty placeholder', () => {
+ const adapter = new ClaudeCodeAdapter();
+ adapter.adapt({ subtype: 'init', type: 'system' });
+ adapter.adapt({
+ message: {
+ id: 'msg_1',
+ content: [{ id: 'r1', input: { file_path: 'x.png' }, name: 'Read', type: 'tool_use' }],
+ },
+ type: 'assistant',
+ });
+
+ const events = adapter.adapt({
+ message: {
+ content: [
+ {
+ content: [
+ {
+ source: { data: 'AAAA', media_type: 'image/png', type: 'base64' },
+ type: 'image',
+ },
+ ],
+ tool_use_id: 'r1',
+ type: 'tool_result',
+ },
+ ],
+ role: 'user',
+ },
+ type: 'user',
+ });
+
+ const result = events.find((e) => e.type === 'tool_result');
+ expect(result).toBeDefined();
+ expect(result!.data.toolCallId).toBe('r1');
+ expect(result!.data.content).toBe('[Image: image/png]');
+ expect(result!.data.isError).toBe(false);
+
+ const end = events.find((e) => e.type === 'tool_end');
+ expect(end).toBeDefined();
+ expect(end!.data.toolCallId).toBe('r1');
+ });
+
+ it('falls back to generic label when media_type is missing', () => {
+ const adapter = new ClaudeCodeAdapter();
+ adapter.adapt({ subtype: 'init', type: 'system' });
+ adapter.adapt({
+ message: {
+ id: 'msg_1',
+ content: [{ id: 'r1', input: { file_path: 'x' }, name: 'Read', type: 'tool_use' }],
+ },
+ type: 'assistant',
+ });
+
+ const events = adapter.adapt({
+ message: {
+ content: [
+ {
+ content: [{ source: { data: 'AAAA', type: 'base64' }, type: 'image' }],
+ tool_use_id: 'r1',
+ type: 'tool_result',
+ },
+ ],
+ role: 'user',
+ },
+ type: 'user',
+ });
+
+ const result = events.find((e) => e.type === 'tool_result');
+ expect(result!.data.content).toBe('[Image: image]');
+ });
+ });
+
describe('TodoWrite pluginState synthesis', () => {
const driveTodoWrite = (adapter: ClaudeCodeAdapter, input: unknown, toolId = 't1') => {
adapter.adapt({ subtype: 'init', type: 'system' });
diff --git a/packages/heterogeneous-agents/src/adapters/claudeCode.ts b/packages/heterogeneous-agents/src/adapters/claudeCode.ts
index fb9690c89f0..627bfd2be18 100644
--- a/packages/heterogeneous-agents/src/adapters/claudeCode.ts
+++ b/packages/heterogeneous-agents/src/adapters/claudeCode.ts
@@ -529,6 +529,14 @@ export class ClaudeCodeAdapter implements AgentEventAdapter {
// and the tool message lands in DB with empty content β€” leaving
// the UI's StatusIndicator stuck on the spinner (LOBE-7369).
if (c?.type === 'tool_reference' && c.tool_name) return c.tool_name;
+ // `Read` on images yields `{type: 'image', source: {...}}` blocks
+ // with no text. Drop a minimal placeholder so the tool message
+ // has non-empty content (LOBE-7338); richer image echo is a
+ // follow-up that needs structured ToolResultData.
+ if (c?.type === 'image') {
+ const mediaType = c.source?.media_type || 'image';
+ return `[Image: ${mediaType}]`;
+ }
return c.text || c.content || '';
})
.filter(Boolean)