Repository navigation
feat(web): tool calls show as a live card that settles to one line (Beta) #26196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
125d5d6
ee1bb23
34be187
8c8dbae
47df888
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2966,6 +2966,14 @@ function claudeCommandOutputText(output: ClaudeNativeToolOutput): string { | |
| return claudeNativeToolOutputText(output); | ||
| } | ||
|
|
||
| // Claude reports a failed Bash command only as text that starts "Error: Exit code N". | ||
| const CLAUDE_BASH_EXIT_CODE = /^Error: Exit code (\d+)\b/; | ||
|
|
||
| function claudeBashExitCode(outputText: string): { exitCode?: number } { | ||
| const match = CLAUDE_BASH_EXIT_CODE.exec(outputText); | ||
| return match ? { exitCode: Number(match[1]) } : {}; | ||
| } | ||
|
|
||
| function claudeSubagentResultText(output: ClaudeNativeToolOutput): string { | ||
| const value = claudeNativeToolOutputValue(output); | ||
| const content = Array.isArray(value) | ||
|
|
@@ -5489,6 +5497,7 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* ( | |
| type: "command_execution", | ||
| input: commandInputFromClaudeTool(input.toolName, input.toolInput), | ||
| ...(outputText.length === 0 ? {} : { output: outputText }), | ||
| ...claudeBashExitCode(outputText), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Parse exit codes only for failed commands. If a successful Bash command prints
|
||
| } | ||
| : itemType === "file_change" | ||
| ? { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -563,6 +563,7 @@ type MessagesTimelineRowContent = | |
| toolIcon?: WorkLogEntry["toolIcon"]; | ||
| summaryToolIcon?: "browser" | "device" | "t3-code" | "pull-request"; | ||
| hasFailure: boolean; | ||
| groupedEntries: WorkLogEntry[]; | ||
| } | ||
| | { | ||
| kind: "turn-fold"; | ||
|
|
@@ -1396,6 +1397,8 @@ export function deriveMessagesTimelineRows(input: { | |
| availableRevertTurnCounts?: ReadonlySet<number> | undefined; | ||
| liveAgentTaskIds?: ReadonlySet<string> | undefined; | ||
| worktreeSetup?: WorktreeSetupSnapshot | null; | ||
| /** Beta tool call cards: the working run's calls share one card below its text. */ | ||
| toolCallCards?: boolean; | ||
| }): MessagesTimelineRow[] { | ||
| const timelineEntries = timelineRowEntries(input.timelineEntries); | ||
| const turnDiffSummaryByAssistantMessageId = new Map<MessageId, TurnDiffSummary>(); | ||
|
|
@@ -1479,6 +1482,14 @@ export function deriveMessagesTimelineRows(input: { | |
| let tailAttemptId: string | null | undefined; | ||
| for (let index = timelineEntries.length - 1; index >= activeTurnHeaderIndex; index -= 1) { | ||
| const entry = timelineEntries[index]!; | ||
| if ( | ||
| input.toolCallCards && | ||
| entry.kind === "message" && | ||
| entry.message.role === "assistant" && | ||
| runIdIsActiveResponse(entry.message.runId) | ||
| ) { | ||
| continue; | ||
| } | ||
|
Comment on lines
+1485
to
+1492
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| if ( | ||
| entry.kind !== "work" || | ||
| entry.entry.tone === "error" || | ||
|
|
@@ -1516,7 +1527,9 @@ export function deriveMessagesTimelineRows(input: { | |
| latestRunningToolEntry !== undefined || | ||
| (latestVisibleToolEntry !== undefined && | ||
| workEntryIndicatesToolSuccess(latestVisibleToolEntry.entry)); | ||
| // A card keeps showing its failed call; the old rows swap it for a thinking row. | ||
| const latestToolFailed = | ||
| input.toolCallCards !== true && | ||
| latestRunningToolEntry === undefined && | ||
| latestVisibleToolEntry !== undefined && | ||
| latestVisibleToolEntry.entry.toolLifecycleStatus !== "declined" && | ||
|
|
@@ -1660,7 +1673,7 @@ export function deriveMessagesTimelineRows(input: { | |
| appendWorkingRow(); | ||
| } | ||
|
|
||
| if (timelineEntry.id === activeWorkPlacementEntryId) { | ||
| if (timelineEntry.id === activeWorkPlacementEntryId && !input.toolCallCards) { | ||
| appendActiveWorkRows(); | ||
| } | ||
|
|
||
|
|
@@ -1892,6 +1905,7 @@ export function deriveMessagesTimelineRows(input: { | |
| hasFailure: | ||
| latestToolEntry !== undefined && | ||
| workEntryDisplayIndicatesToolFailure(latestToolEntry), | ||
| groupedEntries: visibleGroupedEntries, | ||
| }); | ||
| if (expanded) { | ||
| nextRows.push( | ||
|
|
@@ -2022,6 +2036,8 @@ export function deriveMessagesTimelineRows(input: { | |
| : undefined, | ||
| }); | ||
| } | ||
| // Only the run's own text can follow its calls, so the end is the bottom of the run. | ||
| if (input.toolCallCards) appendActiveWorkRows(); | ||
|
|
||
| const setupHandedOff = | ||
| input.worktreeSetup !== null && | ||
|
|
@@ -2444,7 +2460,8 @@ function isRowUnchanged(a: MessagesTimelineRow, b: MessagesTimelineRow): boolean | |
| a.summaryKind === bw.summaryKind && | ||
| a.toolSurface === bw.toolSurface && | ||
| Equal.equals(a.toolIcon, bw.toolIcon) && | ||
| a.hasFailure === bw.hasFailure | ||
| a.hasFailure === bw.hasFailure && | ||
| Equal.equals(a.groupedEntries, bw.groupedEntries) | ||
| ); | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟠 High
Adapters/ClaudeAdapterV2.ts:5500A successful command that prints
Error: Exit code 3is recorded withexitCode: 3, even though the tool result succeeded.claudeBashExitCodeparsesoutputTextunconditionally; gate it onisClaudeToolResultError(input.output)so ordinary successful output is not treated as exit metadata.🚀 Reply "fix it for me" or copy this AI Prompt for your agent: