From f509e336010207301bf884756af4d040f14b2e63 Mon Sep 17 00:00:00 2001 From: Vikhyath Mondreti Date: Thu, 9 Apr 2026 17:28:16 -0700 Subject: [PATCH] fix payload accesses --- apps/sim/app/workspace/[workspaceId]/home/hooks/use-chat.ts | 2 +- apps/sim/lib/copilot/request/go/stream.ts | 5 +---- apps/sim/lib/copilot/request/handlers/types.ts | 2 +- apps/sim/lib/copilot/request/tools/executor.ts | 4 ++-- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/apps/sim/app/workspace/[workspaceId]/home/hooks/use-chat.ts b/apps/sim/app/workspace/[workspaceId]/home/hooks/use-chat.ts index 2fa506bb0c..e1ac3b04ee 100644 --- a/apps/sim/app/workspace/[workspaceId]/home/hooks/use-chat.ts +++ b/apps/sim/app/workspace/[workspaceId]/home/hooks/use-chat.ts @@ -1033,7 +1033,7 @@ export function useChat( if (previewPhase === 'file_preview_complete') { const fileId = typeof payload.fileId === 'string' ? payload.fileId : prevSession.fileId - const resultData = asPayloadRecord(payload.data) + const resultData = asPayloadRecord(payload.output) sessions.delete(id) activeFilePreviewToolCallIdRef.current = null diff --git a/apps/sim/lib/copilot/request/go/stream.ts b/apps/sim/lib/copilot/request/go/stream.ts index 7953c2b3f9..fecd6e787d 100644 --- a/apps/sim/lib/copilot/request/go/stream.ts +++ b/apps/sim/lib/copilot/request/go/stream.ts @@ -418,10 +418,7 @@ export async function runStreamLoop( toolName: 'workspace_file', previewPhase: 'file_preview_complete', fileId: context.activeFileIntent.target.fileId, - data: - streamEvent.payload.result !== undefined - ? streamEvent.payload.result - : streamEvent.payload.data, + output: streamEvent.payload.output, }, ...(streamEvent.scope ? { scope: streamEvent.scope } : {}), }) diff --git a/apps/sim/lib/copilot/request/handlers/types.ts b/apps/sim/lib/copilot/request/handlers/types.ts index b98f2dcffe..444d0dbb3c 100644 --- a/apps/sim/lib/copilot/request/handlers/types.ts +++ b/apps/sim/lib/copilot/request/handlers/types.ts @@ -209,7 +209,7 @@ export async function emitSyntheticToolResult( mode: MothershipStreamV1ToolMode.async, phase: MothershipStreamV1ToolPhase.result, success, - result: resultPayload, + output: resultPayload, ...(completion?.status ? { status: completion.status } : {}), ...(!success && completion?.message ? { error: completion.message } : {}), }, diff --git a/apps/sim/lib/copilot/request/tools/executor.ts b/apps/sim/lib/copilot/request/tools/executor.ts index 4c3c90d0ae..66681dee55 100644 --- a/apps/sim/lib/copilot/request/tools/executor.ts +++ b/apps/sim/lib/copilot/request/tools/executor.ts @@ -423,7 +423,7 @@ export async function executeToolAndReport( mode: MothershipStreamV1ToolMode.async, phase: MothershipStreamV1ToolPhase.result, success: result.success, - result: result.output, + output: result.output, ...(result.success ? { status: MothershipStreamV1ToolOutcome.success } : { status: MothershipStreamV1ToolOutcome.error }), @@ -527,7 +527,7 @@ export async function executeToolAndReport( phase: MothershipStreamV1ToolPhase.result, status: MothershipStreamV1ToolOutcome.error, error: toolCall.error, - result: { error: toolCall.error }, + output: { error: toolCall.error }, }, } await options?.onEvent?.(errorEvent)