/** * Route the AI SDK's warning output through CLEO's logger instead of the * console (T12142 · GH #1223). * * Why this exists * --------------- * `ai@6`'s `logWarnings` writes its one-time banner with `console.info`, which * in Node goes to **stdout**: * * ```js * // node_modules/ai/dist/index.mjs * console.info(FIRST_WARNING_INFO_MESSAGE); // stdout <- breaks ADR-086 * for (const warning of options.warnings) { * console.warn(formatWarning({ … })); // stderr <- fine * } * ``` * * ADR-086 states stdout is ONE LAFS envelope per call and all logs go to * stderr. That banner lands AFTER the envelope, so parsing the whole of stdout * as JSON fails outright. Measured on `cleo update`: * * ``` * stdout line 0: {"success":true,"data":{"count":1,"updated":["T12142"],… * stdout line 1: AI SDK Warning System: To turn off warning logging, set the * AI_SDK_LOG_WARNINGS global to false. * -> json.loads(stdout): Extra data: line 2 column 1 * ``` * * Any consumer parsing stdout — which the `--field` contract actively * encourages — has to skip lines first, which is the exact * "pipe through tail/jq" anti-pattern ADR-086 forbids. * * Why a handler rather than `AI_SDK_LOG_WARNINGS = false` * ------------------------------------------------------ * Disabling would satisfy the contract by destroying the information. These * warnings are real — the one that surfaced this said * `responseFormat is not supported` for `ollama.chat/qwen2.5-coder:3b`, which * is worth knowing when a local model silently ignores a JSON-schema request. * The SDK's global accepts a FUNCTION, so the warnings are kept and merely * moved to where they belong. * * @task T12142 */ /** * Install the CLEO warning handler on `globalThis.AI_SDK_LOG_WARNINGS`. * * Idempotent, and never overwrites a handler an embedder has already set — * a host application that configured its own routing keeps it. * * @returns `true` when this call installed the handler. */ export declare function installAiSdkWarningHandler(): boolean; /** Test seam — forget that the handler was installed. @internal */ export declare function resetAiSdkWarningHandlerForTests(): void; //# sourceMappingURL=ai-sdk-warnings.d.ts.map