MCPcopy Create free account
hub / github.com/freecodexyz/free-code / isWithheldMaxOutputTokens

Function isWithheldMaxOutputTokens

src/query.ts:175–179  ·  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

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

Callers 1

queryLoopFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected