refactor tool-call detail contract for unknown tools

This commit is contained in:
Mohamed Boudra
2026-02-09 16:50:04 +07:00
parent ef29319baf
commit 7ec3f2d3cf
31 changed files with 228 additions and 177 deletions
@@ -106,23 +106,23 @@ function MergedToolCallItem({ item }: { item: MergedToolCall }) {
{isExpanded && (
<View style={stylesheet.toolContent}>
{item.rawInput && (
{item.input && (
<View style={stylesheet.section}>
<Text style={stylesheet.sectionTitle}>Input:</Text>
<Text style={stylesheet.code}>
{JSON.stringify(item.rawInput, null, 2)}
{JSON.stringify(item.input, null, 2)}
</Text>
</View>
)}
{item.rawOutput && (
{item.output && (
<View style={stylesheet.section}>
<Text style={stylesheet.sectionTitle}>Output:</Text>
<Text style={stylesheet.code}>
{JSON.stringify(item.rawOutput, null, 2)}
{JSON.stringify(item.output, null, 2)}
</Text>
</View>
)}
{!item.rawInput && !item.rawOutput && (
{!item.input && !item.output && (
<Text style={stylesheet.emptyText}>
No details available
</Text>
@@ -1101,8 +1101,8 @@ function PermissionRequestCard({
<ToolCallDetailsContent
detail={{
type: "unknown",
rawInput: request.input ?? null,
rawOutput: null,
input: request.input ?? null,
output: null,
}}
maxHeight={200}
/>
+6 -6
View File
@@ -1198,8 +1198,8 @@ export const ToolCall = memo(function ToolCall({
if (args !== undefined || result !== undefined) {
return {
type: "unknown",
rawInput: args ?? null,
rawOutput: result ?? null,
input: args ?? null,
output: result ?? null,
};
}
return undefined;
@@ -1208,8 +1208,8 @@ export const ToolCall = memo(function ToolCall({
const displayDetail =
effectiveDetail ?? {
type: "unknown",
rawInput: null,
rawOutput: null,
input: null,
output: null,
};
const displayModel = useMemo(
@@ -1235,8 +1235,8 @@ export const ToolCall = memo(function ToolCall({
Boolean(error) ||
(effectiveDetail
? effectiveDetail.type !== "unknown" ||
effectiveDetail.rawInput !== null ||
effectiveDetail.rawOutput !== null
effectiveDetail.input !== null ||
effectiveDetail.output !== null
: false);
const handleToggle = useCallback(() => {
@@ -139,8 +139,8 @@ export function ToolCallDetailsContent({
);
} else if (detail?.type === "unknown") {
const sectionsFromTopLevel = [
{ title: "Input", value: detail.rawInput },
{ title: "Output", value: detail.rawOutput },
{ title: "Input", value: detail.input },
{ title: "Output", value: detail.output },
].filter((entry) => entry.value !== null && entry.value !== undefined);
for (const section of sectionsFromTopLevel) {