fix(sdk-js): avoid sending run metadata in UI messages (#4467)

This commit is contained in:
David Duong
2025-04-30 00:41:12 +02:00
committed by GitHub
3 changed files with 7 additions and 11 deletions
+1 -2
View File
@@ -100,10 +100,9 @@ def push_ui_message(
"name": name,
"props": props,
"metadata": {
**(config.get("metadata") or {}),
"run_id": config.get("run_id", None),
"tags": config.get("tags", None),
"name": config.get("run_name", None),
"run_id": config.get("run_id", None),
**(metadata or {}),
**({"message_id": message_id} if message_id else {}),
},
+3 -8
View File
@@ -38,13 +38,6 @@ export const typedUi = <Decl extends Record<string, ElementType>>(
const runId = (config.metadata?.run_id as string | undefined) ?? config.runId;
if (!runId) throw new Error("run_id is required");
const metadata = {
...config.metadata,
tags: config.tags,
name: config.runName,
run_id: runId,
};
const handlePush = <K extends keyof PropMap & string>(
message: {
id?: string;
@@ -60,7 +53,9 @@ export const typedUi = <Decl extends Record<string, ElementType>>(
name: message?.name,
props: message?.props,
metadata: {
...metadata,
run_id: runId,
tags: config.tags,
name: config.runName,
...message?.metadata,
...(options?.message ? { message_id: options.message.id } : null),
},
+3 -1
View File
@@ -5,7 +5,9 @@ export interface UIMessage {
name: string;
props: Record<string, unknown>;
metadata: {
run_id: string;
run_id?: string;
name?: string;
tags?: string[];
message_id?: string;
[key: string]: unknown;
};