getWinner
codebolt.agentDeliberation.getWinner(params: IGetWinnerParams): Promise<IGetWinnerResponse>
Gets the winning response of a completed deliberation based on vote count.
Parameters
params(IGetWinnerParams): Parameters including the deliberation ID.
Returns
Promise<[IGetWinnerResponse](/docs/reference/type-reference/codeboltjs/interfaces/IGetWinnerResponse)>: A promise that resolves to the winning response and vote details.
Examples
const winner = await codebolt.agentDeliberation.getWinner({
deliberationId: 'delib-123'
});
if (winner.payload.winner) {
console.log('Winning response:', winner.payload.winner.body);
console.log('Votes:', winner.payload.winner.voteCount);
}
Notes
- Returns null if deliberation hasn't completed
- In case of ties, may return multiple winners
- Includes all vote details for transparency