import type { EnvironmentName } from '../config/environments.js'; /** * The unread-messages nudge. * * Bitmagic broadcasts reach web creators through the portal's notification bell. A CLI-lane * creator may never open the portal at all, so a command prints a one-line pointer instead — * the same shape as the update nudge next door, and for the same reason: a hint worth giving, * never worth failing or slowing a command over. * * The CLI never CONSUMES a message. Reading is an act, and the read receipt is what tells an * admin whether a broadcast actually landed — a terminal glancing at a count is not that. */ /** What is remembered between runs, so no command pays for the network. */ export interface UnreadMessagesCache { /** * Which environment the count is about. * * Credentials are per environment and a creator can hold a prod and a dev login at once, so * an answer about one says nothing about the other. Mirrors `UpdateCheckCache.tag`, including * the consequence: a cache for the other environment reads as absent and is refreshed. */ environment: EnvironmentName; /** The count, or null when the last check could not reach the server (a back-off marker). */ unread: number | null; /** Where to read them — the server hands this over; see check.ts. */ inboxUrl: string | null; /** Epoch ms of that check. */ checkedAt: number; } /** * How stale a count may be before it is refreshed. * * An hour, matching the release line's update check. Broadcasts are rare and never urgent to * the minute, and the cost of being wrong is one extra line of stderr. */ export declare const MESSAGES_CHECK_INTERVAL_MS: number; /** * How old a cached count may be and still be PRINTED. * * Separate from the refresh interval, and the thing that stops a laptop that has been offline * for a fortnight nagging every single command about a message read in a browser on day one. * Past this, the nudge goes quiet until a check succeeds again. */ export declare const MESSAGES_NOTICE_MAX_AGE_MS: number; /** Whether the cached answer should be refreshed in the background. */ export declare function isMessagesCacheStale(cache: UnreadMessagesCache | null, now: number): boolean; /** * The line to print, or null to stay quiet. * * Quiet for: no cache at all (a first-ever run pays one silent command, exactly as the update * notice does), a failed check (`unread: null` — an unreachable server is not evidence of * anything), nothing unread, no inbox URL to point at, and an answer past its max age. * * The wording is deliberately soft. The count can be up to an interval stale and the CLI cannot * know whether the message was read in a browser five minutes ago, so it reports rather than * instructs. */ export declare function unreadMessagesNotice(cache: UnreadMessagesCache | null, now: number): string | null;