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:
@@ -90,6 +90,14 @@ export interface AgentBridgeRunResult extends AgentBridgeResponse {
|
||||
error?: string | null
|
||||
}
|
||||
|
||||
export interface AgentBridgeContextEstimate extends AgentBridgeResponse {
|
||||
session_id: string
|
||||
token_count?: number | null
|
||||
message_count: number
|
||||
tool_count: number
|
||||
system_prompt_chars: number
|
||||
}
|
||||
|
||||
export interface AgentBridgeCommandResult extends AgentBridgeResponse {
|
||||
session_id: string
|
||||
command: string
|
||||
@@ -372,6 +380,24 @@ export class AgentBridgeClient {
|
||||
})
|
||||
}
|
||||
|
||||
contextEstimate(
|
||||
sessionId: string,
|
||||
messages: unknown[],
|
||||
instructions?: string,
|
||||
profile?: string,
|
||||
options: Pick<AgentBridgeChatOptions, 'model' | 'provider'> = {},
|
||||
): Promise<AgentBridgeContextEstimate> {
|
||||
return this.request<AgentBridgeContextEstimate>({
|
||||
action: 'context_estimate',
|
||||
session_id: sessionId,
|
||||
messages,
|
||||
...(instructions ? { instructions } : {}),
|
||||
...(profile ? { profile } : {}),
|
||||
...(options.model ? { model: options.model } : {}),
|
||||
...(options.provider ? { provider: options.provider } : {}),
|
||||
})
|
||||
}
|
||||
|
||||
command(sessionId: string, command: string): Promise<AgentBridgeCommandResult> {
|
||||
return this.request<AgentBridgeCommandResult>({
|
||||
action: 'command',
|
||||
|
||||
Reference in New Issue
Block a user