Account for full context tokens in compression (#908)
* Account for full context tokens in compression * Fix group chat final context updates --------- Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
@@ -925,9 +925,7 @@ export class GroupChatServer {
|
||||
ack?.({ id: savedMsg.id })
|
||||
|
||||
const mentionDepth = normalizeMentionDepth(data.mentionDepth)
|
||||
const shouldRouteMentions =
|
||||
savedMsg.role === 'user' ||
|
||||
(savedMsg.role === 'assistant' && mentionDepth < 2)
|
||||
const shouldRouteMentions = savedMsg.role === 'user'
|
||||
|
||||
if (shouldRouteMentions) {
|
||||
// Server-side @mention routing — parse user mentions and invoke agents directly.
|
||||
@@ -1046,7 +1044,7 @@ export class GroupChatServer {
|
||||
})
|
||||
}
|
||||
|
||||
private handleContextStatus(socket: Socket, data: { roomId?: string; agentName?: string; status?: string }): void {
|
||||
private handleContextStatus(socket: Socket, data: { roomId?: string; agentName?: string; status?: string; totalTokens?: number }): void {
|
||||
const roomId = data.roomId || 'general'
|
||||
const agentName = data.agentName || ''
|
||||
const status = data.status || ''
|
||||
@@ -1072,6 +1070,11 @@ export class GroupChatServer {
|
||||
agentName,
|
||||
status,
|
||||
})
|
||||
|
||||
if (typeof data.totalTokens === 'number' && Number.isFinite(data.totalTokens) && data.totalTokens >= 0) {
|
||||
this.storage.updateRoomTotalTokens(roomId, Math.floor(data.totalTokens))
|
||||
this.nsp.to(roomId).emit('room_updated', { roomId, totalTokens: Math.floor(data.totalTokens) })
|
||||
}
|
||||
}
|
||||
|
||||
private async handleInterruptAgent(socket: Socket, data: { roomId?: string; agentName?: string }, ack?: (response?: unknown) => void): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user