841
return [];
842
}
844
clearReasoningForItem(state, params.item.id);
845
return [];
846
}
848
>
// drain the host-decline flag here, once, so all completion paths treat a
849
>
// declined tool uniformly (reported as `userCancelled` via
850
>
// `error.code = 'denied'`) instead of depending on which tool type completed.
851
>
const entry = state.itemToToolCall.get(params.item.id);
852
>
if (!entry) {
853
return [];
854
}
856
>
const declined = state.declinedToolCalls.delete(entry.toolCallId);
857
>
if (params.item.type === 'commandExecution') {
858
const success = params.item.status === 'completed' && (params.item.exitCode === 0 || params.item.exitCode === null);
859
const output = params.item.aggregatedOutput ?? entry.output;