@@ -1179,25 +1179,25 @@ export function embeddedTerminalIdsFromSessionUpdate(
11791179 return terminalIds . length === 0 ? undefined : { toolCallId : update . toolCallId , terminalIds } ;
11801180}
11811181
1182- /** ACP lets a permission request name its tool call by ID only; omitted fields come from the tracked call. */
1182+ /** ACP lets a permission request name its tool call by ID only; omitted (not null) fields come from the tracked call. */
11831183export function withTrackedPermissionToolCall (
11841184 params : EffectAcpSchema . RequestPermissionRequest ,
11851185 tracked : AcpToolCallState | undefined ,
11861186) : EffectAcpSchema . RequestPermissionRequest {
11871187 if ( tracked === undefined ) return params ;
1188- const title =
1189- params . toolCall . title ??
1190- ( typeof tracked . data . title === "string" ? tracked . data . title : undefined ) ;
1191- // Unrecognised kinds map to command approvals, so only a tracked execute kind may grant execution.
1192- const kind = params . toolCall . kind ?? ( tracked . kind === "execute" ? "execute" : undefined ) ;
1193- const rawInput = params . toolCall . rawInput ?? tracked . data . rawInput ;
1188+ const { title, kind, rawInput } = params . toolCall ;
11941189 return {
11951190 ...params ,
11961191 toolCall : {
11971192 ...params . toolCall ,
1198- ...( title === undefined ? { } : { title } ) ,
1199- ...( kind === undefined ? { } : { kind } ) ,
1200- ...( rawInput === undefined ? { } : { rawInput } ) ,
1193+ ...( title === undefined && typeof tracked . data . title === "string"
1194+ ? { title : tracked . data . title }
1195+ : { } ) ,
1196+ // Unrecognised kinds map to command approvals, so only a tracked execute kind may grant execution.
1197+ ...( kind === undefined && tracked . kind === "execute" ? { kind : "execute" as const } : { } ) ,
1198+ ...( rawInput === undefined && tracked . data . rawInput !== undefined
1199+ ? { rawInput : tracked . data . rawInput }
1200+ : { } ) ,
12011201 } ,
12021202 } ;
12031203}
0 commit comments