Skip to content

Commit ddcfc51

Browse files
authored
Update @runt/schema to commit 8d3bd82 with proper type validation (#205)
* Update @runt/schema to commit 14c2c60f5576eebc509ed76b5cde0c3cab4246a4 * Fix type safety issues with updated @runt/schema - Update RichOutput to use proper MediaContainer types - Fix AI tool output components to use correct schema field names - Remove unused imports and fix linter errors - Update output index to re-export schema types - All tests passing (58/58) * Use exported MIME type constants from @runt/schema - Replace raw strings with AI_TOOL_CALL_MIME_TYPE and AI_TOOL_RESULT_MIME_TYPE - Use TEXT_MIME_TYPES, APPLICATION_MIME_TYPES, IMAGE_MIME_TYPES arrays - Add support for Jupyter MIME types (Plotly, Vega-Lite, etc.) - Improve type safety and consistency with schema definitions * Fix AI tool result validation to handle actual runtime data structure - Use flexible validation instead of strict schema type guard - Handle actual data structure: {tool_call_id, result, status} - Remove unused imports - Tool results now display correctly with success/error icons * Update @runt/schema to commit 8d3bd82a1c2e54cf46b0f133d327d4ca6de6acdc - Use proper schema validation with fixed AiToolResultData interface - Restore isAiToolResultData type guard usage - Remove flexible workaround now that schema matches runtime behavior - Clean up component types to use proper AiToolResultData interface - All tests passing with proper type safety
1 parent 2201772 commit ddcfc51

4 files changed

Lines changed: 11 additions & 30 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"@radix-ui/react-separator": "^1.1.7",
6161
"@radix-ui/react-slot": "^1.2.3",
6262
"@radix-ui/react-tooltip": "^1.1.6",
63-
"@runt/schema": "github:runtimed/runt#14c2c60f5576eebc509ed76b5cde0c3cab4246a4&path:/packages/schema",
63+
"@runt/schema": "github:runtimed/runt#8d3bd82a1c2e54cf46b0f133d327d4ca6de6acdc&path:/packages/schema",
6464
"@tanstack/react-virtual": "^3.13.12",
6565
"@types/react-syntax-highlighter": "^15.5.13",
6666
"@uiw/codemirror-theme-github": "^4.23.14",

pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/notebook/RichOutput.tsx

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
isInlineContainer,
66
isArtifactContainer,
77
isAiToolCallData,
8+
isAiToolResultData,
89
AI_TOOL_CALL_MIME_TYPE,
910
AI_TOOL_RESULT_MIME_TYPE,
1011
TEXT_MIME_TYPES,
@@ -195,18 +196,10 @@ export const RichOutput: React.FC<RichOutputProps> = ({
195196

196197
case AI_TOOL_RESULT_MIME_TYPE: {
197198
const resultData = outputData[mediaType];
198-
// Handle actual runtime data structure (more flexible than strict schema)
199-
if (
200-
resultData &&
201-
typeof resultData === "object" &&
202-
"tool_call_id" in resultData &&
203-
"status" in resultData &&
204-
typeof (resultData as any).tool_call_id === "string" &&
205-
typeof (resultData as any).status === "string"
206-
) {
199+
if (isAiToolResultData(resultData)) {
207200
return (
208201
<Suspense fallback={<LoadingSpinner />}>
209-
<AiToolResultOutput resultData={resultData as any} />
202+
<AiToolResultOutput resultData={resultData} />
210203
</Suspense>
211204
);
212205
}

src/components/outputs/AiToolResultOutput.tsx

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
11
import React from "react";
22
import { CheckCircle, XCircle, Clock, Info } from "lucide-react";
3+
import { AiToolResultData } from "@runt/schema";
34

45
interface AiToolResultOutputProps {
5-
resultData: {
6-
tool_call_id: string;
7-
result?: string;
8-
status: string;
9-
// Optional fields from full schema
10-
tool_name?: string;
11-
arguments?: Record<string, unknown>;
12-
timestamp?: string;
13-
};
6+
resultData: AiToolResultData;
147
}
158

169
// Tool icon and message mapping for AI tool results
@@ -57,11 +50,6 @@ export const AiToolResultOutput: React.FC<AiToolResultOutputProps> = ({
5750
{resultData.result}
5851
</div>
5952
)}
60-
{!resultData.result && (
61-
<div className="text-muted-foreground text-sm italic">
62-
{config.label}
63-
</div>
64-
)}
6553
</div>
6654
);
6755
};

0 commit comments

Comments
 (0)