import { AssistantModeCapabilityConfig } from './modeCapabilities'; import { AssistantMode, BuiltInAssistantMode } from './types'; /** * How long the client streams progress before it stops polling a turn. * * Chat replies finish in seconds; a build is a multi-step pipeline that runs for * minutes, so it gets a much larger budget. Which modes build is a CAPABILITY * (`streamBudgetMs` on `AssistantModeConfig`, resolved in `modeCapabilities.ts`), * not a list of mode ids. The sandbox TTL is auto-extended every 30s during the * poll loop, so a longer budget never outlives the sandbox. * * ★★ THE BUDGET ELAPSING IS NOT AN ERROR. It used to be, for every mode except * the build mode: the poll loop `throw`ew, the catch wrote * `Sorry, an error occurred: …` into the assistant message, and that error was * PERSISTED — it survived a reload, so the turn was destroyed rather than * merely unfinished. Measured in production on 2026-09-12 with a 10.8 KB * markdown attachment: the turn produced no content for 206s, the client gave * up at ~3 minutes, and re-opening the conversation showed only the error. * * A client-side deadline is a statement about how long THIS CLIENT will wait. * It is not evidence that the turn failed, and it must never be allowed to * overwrite the conversation. So the budget elapsing now yields a normal * assistant message: whatever content arrived, plus an honest closing note. */ export declare const STREAM_BUDGET_MS: Record; export declare const DEFAULT_STREAM_BUDGET_MS: number; /** * Budget for `mode`, with the product's config for it applied. * * Exported as a function rather than leaving callers to index the record, so a * new mode cannot silently get `undefined` and a `NaN` deadline. */ export declare function streamBudgetMs(mode: AssistantMode, config?: AssistantModeCapabilityConfig | null): number; /** i18n key + English fallback for the note closing an unfinished turn. */ export interface IncompleteTurnNotice { key: string; fallback: string; } /** * Every note that can close an unfinished turn, whatever the mode. * * ★ Two keys for any number of modes: the copy is chosen by capability, so a * product declaring a new mode adds no notice keys to seed. */ export declare const INCOMPLETE_TURN_NOTICES: readonly IncompleteTurnNotice[]; export declare function incompleteTurnNotice(mode: AssistantMode, config?: AssistantModeCapabilityConfig | null): IncompleteTurnNotice; /** * Close an unfinished turn: keep every character the turn did produce, then * append the note for `mode`. * * Total function — it never throws, and never returns an empty string for a * turn that produced nothing, because an empty assistant bubble reads as a * silent failure. `translate` is injected rather than taken from a hook so this * is testable without a React tree or an i18n provider. */ export declare function withIncompleteTurnNotice(content: string, mode: AssistantMode, translate: (key: string, fallback: string) => string, config?: AssistantModeCapabilityConfig | null): string; //# sourceMappingURL=streamBudget.d.ts.map