@@ -1452,31 +1452,15 @@ export class Client {
14521452 unsubscribeComplete = this . webSocket . subscribe (
14531453 'prompt-response' ,
14541454 async ( action ) => {
1455- const parsedAction = PromptResponseSchema . safeParse ( action )
1456- if ( ! parsedAction . success ) {
1457- const message = [
1458- 'Received invalid prompt response from server:' ,
1459- JSON . stringify ( parsedAction . error . issues ) ,
1460- 'If this issues persists, please contact support@codebuff.com' ,
1461- ] . join ( '\n' )
1462- console . error ( message )
1463- logger . error (
1464- {
1465- errorMessage : message ,
1466- action,
1467- eventId : AnalyticsEvent . MALFORMED_PROMPT_RESPONSE ,
1468- } ,
1469- 'Malformed prompt response' ,
1470- )
1471- return
1472- }
1455+ // Stop enforcing prompt response schema (e.g. PromptResponseSchema.parse(action))!
1456+ // It's a black box we will pass back to the server.
1457+
14731458 if ( action . promptId !== userInputId ) return
1474- const a = parsedAction . data
14751459 this . responseComplete = true
14761460
14771461 Spinner . get ( ) . stop ( )
14781462
1479- this . sessionState = a . sessionState
1463+ this . sessionState = action . sessionState
14801464 const toolResults : ToolResultPart [ ] = [ ]
14811465
14821466 stepsCount ++
@@ -1543,8 +1527,8 @@ Go to https://www.codebuff.com/config for more information.`) +
15431527 }
15441528
15451529 // Print structured output as JSON if available
1546- if ( a . output ?. type === 'structuredOutput' ) {
1547- console . log ( '\n' + JSON . stringify ( a . output . value , null , 2 ) )
1530+ if ( action . output ?. type === 'structuredOutput' ) {
1531+ console . log ( '\n' + JSON . stringify ( action . output . value , null , 2 ) )
15481532 }
15491533
15501534 if ( DiffManager . getChanges ( ) . length > 0 ) {
@@ -1586,7 +1570,7 @@ Go to https://www.codebuff.com/config for more information.`) +
15861570 // Clear the onChunk callback when response is complete
15871571 this . currentOnChunk = undefined
15881572
1589- resolveResponse ( { ...a , wasStoppedByUser : false } )
1573+ resolveResponse ( { ...action , wasStoppedByUser : false } )
15901574 } ,
15911575 )
15921576
0 commit comments