MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / isWithheldMaxOutputTokens

Function isWithheldMaxOutputTokens

source code/query.ts:177–181  ·  view source on GitHub ↗

* Is this a max_output_tokens error message? If so, the streaming loop should * withhold it from SDK callers until we know whether the recovery loop can * continue. Yielding early leaks an intermediate error to SDK callers (e.g. * cowork/desktop) that terminate the session on any `error` field —

(
  msg: Message | StreamEvent | undefined,
)

Source from the content-addressed store, hash-verified

175 * Mirrors reactiveCompact.isWithheldPromptTooLong.
176 */
177function isWithheldMaxOutputTokens(
178 msg: Message | StreamEvent | undefined,
179): msg is AssistantMessage {
180 return msg?.type === 'assistant' && msg.apiError === 'max_output_tokens'
181}
182
183export type QueryParams = {
184 messages: Message[]

Callers 1

queryLoopFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected