import type { ReactNode } from "react"; import type { LatencyMode, ReasoningEffort } from "@opengeni/sdk"; import { type PickerModelRow } from "../../model-policy.js"; /** * Why Send cannot run right now: the one source of truth shared by the new * chat and open chat composers. Every blocker either shows one short visible * line (composerSendBlockerNotice) or is explained by a surface the host * already renders. A disabled Send button is never the only signal. */ export type ComposerSendBlocker = "upload" | "repository" | "policy" | "personal_decision" | "machine_permission" | "personal_loading" /** Something Send needs is still loading; an early Send waits for it. */ | "loading" | "model_catalog" | "no_model" | "model_not_connected" | "model_unavailable" | "private_session" | "accounts" /** The person may not read the chat's connected accounts; an admin must grant it. */ | "accounts_denied" /** Opengeni is briefly unreachable; the page reconnects on its own. */ | "updating" | "account_choice" | "resources" | "compute"; export declare function getComposerSendBlocker(input: { uploadPending: boolean; repositoryError: string | null; policyValid: boolean; personalDecision: boolean; personalLoading: boolean; /** * Something Send needs failed to load (the chat's connected accounts): * a failure Retry may fix, a permission denial, or a brief outage the page * reconnects from by itself. */ loadFailed?: false | "failed" | "denied" | "updating" | undefined; machineAccessDenied?: boolean | undefined; }): ComposerSendBlocker | null; /** Whether a model choice can run: the row is selectable and offers the effort and speed. */ export declare function pickerPolicyRunnable(row: PickerModelRow | null | undefined, effort: ReasoningEffort, latencyMode: LatencyMode): boolean; /** Everything the new-chat composer's Send depends on, apart from the text. */ export type NewSessionSendState = { /** A failed create left a session to retry into. */ created: boolean; /** A voice launch does not bind connected-tool accounts. */ voice?: boolean | undefined; draftLoading: boolean; catalogLoading: boolean; catalogFailed: boolean; /** The composer is switching away from an unavailable model. */ replacingModel: boolean; policyValid: boolean; anyModelSelectable: boolean; selectedModelNotConnected: boolean; selectedModelSelectable: boolean; /** Whether this workspace can create the chat's private visibility is still loading. */ privateSessionLoading?: boolean | undefined; privateSessionUnavailable: boolean; toolsLoading: boolean; accountsLoading: boolean; accountsFailed: boolean; accountChoice: boolean; resourcesLoading: boolean; resourcesResolved: boolean; uploadPending: boolean; computeLoading: boolean; computeReady: boolean; }; /** * The new-chat Send guard. Send's enabled state, the guard Send runs, the * early-Send hold and the visible line all read this one answer, so a Send * that looks available can never do nothing. */ export declare function getNewSessionSendBlocker(input: NewSessionSendState): ComposerSendBlocker | null; /** Blockers that clear on their own once loading finishes. */ export declare function composerSendBlockerIsLoading(blocker: ComposerSendBlocker | null): boolean; /** The one action a blocker's line may offer. */ export type ComposerSendBlockerAction = "fix_model_settings" | "retry"; /** * One short line for a blocker, with at most one action. Blockers whose own * surface always explains them (the upload chip, the personal access card, * the machine access notice, the picker's Connect state) and loading return * null; a host that explains another one itself passes it as explained. */ export declare function composerSendBlockerNotice(blocker: ComposerSendBlocker | null): { message: string; action: { kind: ComposerSendBlockerAction; label: string; } | null; } | null; /** * The analytics reason for a blocked new-chat Send. Reasons recorded before * this guard existed keep their names; blockers that were not recorded before * (for example accounts, account_choice and resources) report their own name, * and the order of checks changed (private chat comes before uploads). */ export declare function newSessionStartBlockerReason(blocker: ComposerSendBlocker | null): string | null; /** The visible line under a composer whose Send is blocked. */ export declare function ComposerSendBlockerNotice({ blocker, explained, onAction, className, }: { blocker: ComposerSendBlocker | null; /** Blockers another surface on this page already explains. */ explained?: readonly ComposerSendBlocker[] | undefined; onAction?: ((action: ComposerSendBlockerAction) => void) | undefined; className?: string | undefined; }): ReactNode; /** * A new chat the server refused to start. The chat does not exist yet, so the * line under the composer is the only place that can say why; a toast alone * disappears before it is read and leaves the person looking at nothing. The * line stays until the person changes what they send (text, model, reasoning * level or speed), sends successfully, or dismisses it. */ export type NewSessionCreateFailure = { workspaceId: string; /** What was sent when the start was refused (see newSessionSendSignature). */ signature: string; message: string; }; /** What a Send carries that a refusal is about: the text and the model choice. */ export declare function newSessionSendSignature(input: { text: string; model: string; reasoningEffort: ReasoningEffort; latencyMode: LatencyMode; }): string; /** The refusal message to show now, or null once the person changed what they send. */ export declare function visibleNewSessionCreateFailure(failure: NewSessionCreateFailure | null, current: { workspaceId: string; signature: string; }): string | null; /** * The refusal to keep under the composer, or null when the composer no longer * holds what was sent (typing or a model change landed while the start was in * flight). On null the caller keeps its toast, so a refused start is never * silent. */ export declare function newSessionCreateFailureRecord(input: { workspaceId: string; /** newSessionSendSignature of the values the request actually carried. */ sent: string; /** newSessionSendSignature of what the composer holds now. */ current: string; message: string; }): NewSessionCreateFailure | null; /** The persistent line for a refused new chat. */ export declare function NewSessionCreateFailureNotice({ message, onDismiss, className, }: { message: string | null; onDismiss?: (() => void) | undefined; className?: string | undefined; }): ReactNode;