import { type FetchDistTagsOptions } from './registry.js'; export type SuppressionInput = { /** * Whether the process is fully attached to a terminal — **both** streams. * * stderr alone is not enough. In `auden status | consumer` stderr is still a * terminal while stdout is a pipe, which means a programmatic consumer on * the other end; running the check there contradicts the documented "skipped * for pipes" guarantee and makes scripted invocations pay the network delay. */ isTTY: boolean; env: NodeJS.ProcessEnv; /** `updateCheck` from ~/.auden/config.json; true when unset. */ configEnabled: boolean; }; export type SuppressionResult = { suppressed: boolean; /** Why, for `auden update --check` to explain itself. Empty when not suppressed. */ reason: string; }; /** * Decide whether the update check may run at all. * * Pure and exported so the full matrix (TTY × each env var × config flag) is * unit-testable — a regression here means writing into an agent hook's output * or an MCP stream. */ export declare function evaluateSuppression(input: SuppressionInput): SuppressionResult; export type AvailableUpdate = { current: string; latest: string; /** The dist-tag the comparison used ('latest', 'alpha', …). */ channel: string; /** The upgrade command for the detected install manager. */ command: string; }; /** * Compare the running version against the dist-tags, on the running version's * own channel. * * Channel matters twice over: a user on `0.2.0-alpha.1` must be compared * against the `alpha` tag, not `latest` — otherwise every alpha tester is told * to "update" to an older stable release — and the command they are handed * must name that channel too, or running it moves them onto stable. * * `commandFor` maps a package spec to the display command, injected so this * stays pure and testable without touching the filesystem. Returns null when * there is nothing to report (up to date, ahead of the registry, or the tag is * missing). */ export declare function resolveAvailableUpdate(currentVersion: string, tags: Record, commandFor: (packageSpec: string) => string): AvailableUpdate | null; /** * The `current → latest` line, naming the channel unless it is plain stable. * * Shared by the ambient nudge and `auden update`'s own report so the two * cannot describe the same available release differently. */ export declare function formatUpdateHeadline(update: AvailableUpdate): string; /** The one-line nudge, formatted. */ export declare function formatUpdateNotice(update: AvailableUpdate): string; export type CheckOptions = { /** Injected in tests; defaults to the real environment. */ isTTY?: boolean; env?: NodeJS.ProcessEnv; now?: number; currentVersion?: string; cachePath?: string; fetchOptions?: FetchDistTagsOptions; /** * Someone asked for this check explicitly (`auden update`). * * Skips both gates, which are separate: the suppression gate, so the check * runs even when piped or non-interactive, and the cache gate, so the answer * comes from the registry rather than from a lookup up to * `UPDATE_CACHE_TTL_MS` old. Skipping only the first is what let a machine * answer "up to date" about a release that already existed. */ force?: boolean; }; export type UpdateCheckOutcome = /** The check did not run (suppressed by TTY, env, or config). */ { status: 'skipped'; } /** No release information could be obtained — offline, blocked, or 404. */ | { status: 'unavailable'; } | { status: 'current'; current: string; } | { status: 'available'; update: AvailableUpdate; }; /** * Resolve the update state, using the cache and refreshing it when stale. * * Returns a discriminated outcome rather than a nullable update because * "nothing to report" and "could not find out" are different facts: an * explicit `auden update` must not answer "you are up to date" when it never * reached the registry. * * On a cache miss this awaits the registry read (bounded to * `DIST_TAGS_TIMEOUT_MS`) rather than deferring the answer to the next run: * the fetch only ever happens in an interactive, non-suppressed context, so * the cost lands on a user sitting at a terminal, at most once a day — and * deferring would mean a fresh install never sees a notice on the run where * it would matter most. Hooks, MCP, and CI never reach this code. */ export declare function resolveUpdateOutcome(options?: CheckOptions): Promise; /** * Convenience wrapper for callers that only care whether an update exists. * Collapses skipped/unavailable/current to null. */ export declare function checkForUpdate(options?: CheckOptions): Promise; /** * Print the update notice to **stderr** if one is due. Never throws. * * stderr, not stdout: a user piping `auden status` into another tool should * get only the status output. */ export declare function notifyUpdateIfDue(options?: CheckOptions): Promise; //# sourceMappingURL=notice.d.ts.map