export { mergeStreamingChunk } from "@steipete/summarize-core/runtime";
export function isGoogleStreamingUnsupportedError(error) {
    if (!error || typeof error !== "object")
        return false;
    const maybe = error;
    const message = typeof maybe.message === "string" ? maybe.message : "";
    const url = typeof maybe.url === "string" ? maybe.url : "";
    const responseBody = typeof maybe.responseBody === "string" ? maybe.responseBody : "";
    const errorText = `${message}\n${responseBody}`;
    const isStreamEndpoint = url.includes(":streamGenerateContent") || errorText.includes("streamGenerateContent");
    if (!isStreamEndpoint)
        return false;
    return (/does not support/i.test(errorText) ||
        /not supported/i.test(errorText) ||
        /Call ListModels/i.test(errorText) ||
        /supported methods/i.test(errorText));
}
export function isStreamingTimeoutError(error) {
    if (!error)
        return false;
    const message = typeof error === "string"
        ? error
        : error instanceof Error
            ? error.message
            : typeof error.message === "string"
                ? String(error.message)
                : "";
    return /timed out/i.test(message);
}
export function canStream({ provider, prompt, transport, }) {
    if (transport === "cli")
        return false;
    const attachments = prompt.attachments ?? [];
    if (attachments.some((attachment) => attachment.kind === "document"))
        return false;
    const streamableProviders = new Set([
        "xai",
        "openai",
        "google",
        "anthropic",
        "zai",
        "nvidia",
        "minimax",
        "github-copilot",
    ]);
    return streamableProviders.has(provider);
}
//# sourceMappingURL=streaming.js.map