refactor: removed the token calculator logic

The information given was not accurate for the model providers
This commit is contained in:
Haileyesus
2026-04-10 16:21:01 +03:00
parent a8dab0edcf
commit cc7f652044
19 changed files with 20 additions and 561 deletions

View File

@@ -129,8 +129,7 @@ function transformCodexEvent(event) {
case 'turn.completed':
return {
type: 'turn_complete',
usage: event.usage
type: 'turn_complete'
};
case 'turn.failed':
@@ -279,12 +278,6 @@ export async function queryCodex(command, options = {}, ws) {
error: terminalFailure
});
}
// Extract and send token usage if available (normalized to match Claude format)
if (event.type === 'turn.completed' && event.usage) {
const totalTokens = (event.usage.input_tokens || 0) + (event.usage.output_tokens || 0);
sendMessage(ws, createNormalizedMessage({ kind: 'status', text: 'token_budget', tokenBudget: { used: totalTokens, total: 200000 }, sessionId: currentSessionId, provider: 'codex' }));
}
}
// Send completion event