import { type OpenGeniText } from "../messages/runtime.js"; /** Local finished-at stamp for message footers: "Aug 2, 3:42 PM" / locale-equivalent. */ export declare function formatClockTime(t: OpenGeniText, iso: string): string; /** Compact relative time: "now", "42s", "7m", "3h", "2d", then a date. */ export declare function formatRelativeTime(t: OpenGeniText, iso: string, now?: Date): string; /** Human-readable byte size: "512 B", "8.0 KB", "1.4 MB", "3 GB". */ export declare function formatBytes(bytes: number): string; /** Single-line preview of arbitrary text, for tiles and collapsed rows. */ export declare function truncate(text: string, maxLength: number): string; /** Render an unknown payload as readable text (pretty JSON when possible). */ export declare function stringifyPayload(value: unknown): string; /** JSON.parse that returns `undefined` instead of throwing. */ export declare function tryParseJson(text: string): unknown; /** * The canonical credit-death sentence. Credit exhaustion is the one failure a * user can fix themselves — the copy must say what happened (the remaining * credit does not cover this model, though it may cover others), what to do * (choose a covered model or add credits), and what is safe (nothing was lost). Crucially it * must NOT say "send a message to revive": a revive turn burns credits the * workspace no longer has. */ export declare const CREDIT_EXHAUSTION_MESSAGE: (t: OpenGeniText) => string; /** A usage ceiling refused the send; the default allowance wording, plus what is safe. */ export declare const COMPOSER_MEMBER_ALLOWANCE_MESSAGE: (t: OpenGeniText) => string; export declare const COMPOSER_WORKSPACE_ALLOWANCE_MESSAGE: (t: OpenGeniText) => string; /** * Actionable composer copy for an edge rejection before a turn is accepted. * Unlike an in-flight credit exhaustion, this path has not consumed the * actor-private draft or any finalized attachment. */ export declare const COMPOSER_PAYMENT_REQUIRED_MESSAGE: (t: OpenGeniText) => string; /** Trusted, composer-owned guidance; unlike remote diagnostic prose, this is UI copy. */ export declare class ComposerStateError extends Error { } /** A restored request has omitted credentials and must be reconciled, not replayed. */ export declare class ComposerReconciliationRequiredError extends ComposerStateError { constructor(); } export declare class ComposerWorkspaceControlUnavailableError extends Error { constructor(); } /** * The send named a model that is no longer in the live catalog (retired or * removed). Retrying the same send cannot succeed; the person must choose * another model, and the typed message stays recoverable via Edit message. */ export declare const COMPOSER_MODEL_UNAVAILABLE_MESSAGE = "This chat's model is no longer available. Choose another model to continue. Your message is saved."; /** A rejected account is never silently replaced or retried with new authority. */ export declare const COMPOSER_ACCOUNT_UNAVAILABLE_MESSAGE = "A selected connector account is unavailable. Review accounts in + \u2192 Connectors, then edit and send your saved message."; export declare function isConnectionAccountSubmissionError(error: unknown): boolean; /** `details.code` the API sets on a 422 for a model missing from the live catalog. */ export declare const MODEL_UNAVAILABLE_DETAIL_CODE = "model_unavailable"; /** * A fresh Send or Steer refused because the task's own usage limit is reached. * The draft is kept and an unchanged retry is never offered. The one current * recovery action (raise or remove the limit, resume a goal) belongs to the * composer's `SessionUsageLimitNotice`, so this line only says what happened. */ export declare const COMPOSER_SESSION_USAGE_LIMIT_MESSAGE = "This task's usage limit is reached. Your message is saved."; /** * Is this send refusal the task's usage limit? Reads the typed SDK error code * (`OpenGeniSessionUsageLimitReachedError`), and also the composer's own * sentence so a refusal restored from storage after a reload is recognized. */ export declare function isSessionUsageLimitSubmissionError(error: Error): boolean; /** * Is this send refusal "the model is no longer available"? Reads the typed * `details.code`, and also the historical message so a refusal persisted * before a reload (only its text survives) or from an older API is recognized. */ export declare function isModelUnavailableSubmissionError(error: Error): boolean; /** * What a published Site's assistant tells a viewer it refused, by the * refusal's `details.code`. The draft is kept in every case. */ export declare const COMPOSER_SITE_REFUSAL_MESSAGES: (t: OpenGeniText) => Readonly>; /** The Site refusal code of a send refusal, if it is one. */ export declare function siteRefusalCode(error: Error): string | null; export declare function composerSubmissionErrorMessage(t: OpenGeniText, error: Error): string; /** These definitive refusals need a payment, allowance or model change, not an unchanged retry. */ export declare function composerSubmissionCanRetry(error: Error): boolean; export declare function isCreditExhaustion(input: { error?: string | null; detail?: string | null; segmentLimit?: string | null; } | string): boolean; /** * Humanize engine/provider failure text before it reaches the timeline or a * failure banner. Raw provider errors leak the wrong audience's instructions — * "Incorrect API key … find your API key at platform.openai.com" tells a * managed-deployment USER to fix credentials only an OPERATOR controls (and is * flatly wrong for Azure or subscription-backed engines). Auth, quota, and * credit-exhaustion failures collapse to one neutral, honest sentence; every * other reason passes through untouched. Raw payloads stay available in the * debug surfaces. */ export declare function humanizeFailureReason(t: OpenGeniText, reason: string | null): string | null; /** Project failure diagnostics without changing the stored event, including legacy retry wrappers. */ export declare function presentFailure(t: OpenGeniText, payload: Record): { reason: string | null; safetyRefusal: boolean; };