/** * Keep this machine's cloud presence fresh during normal CLI use (T13289). * * Presence (`PUT /v1/projects/:id/replicas/:id/presence`) used to be sent only * when a project was linked, so `cleo cloud status` reported a linked machine * as stale 24 hours later. This refresh piggybacks on ordinary commands: at * most once an hour per project, best-effort, with a short timeout, started * alongside the command and never awaited by it. No daemon, timer or * background process — the cloud features need nothing but the CLI and * Cleo Nexus. * * It only ever sends for a project this machine linked: the link's replica * attached from THIS device's credential. Nothing else is read or sent; the * body is the same path-free presence the attach sends. * * @task T13289 * @epic T12322 */ import type { FetchLike } from './http.js'; import { NexusDeviceStore } from './nexus-device.js'; /** At most one presence refresh per project per hour. */ export declare const NEXUS_PRESENCE_REFRESH_INTERVAL_MS: number; /** The refresh's request timeout: short, so a slow network never holds a command up. */ export declare const NEXUS_PRESENCE_REFRESH_TIMEOUT_MS = 3000; /** Environment switch that turns the refresh off (`1`). */ export declare const NEXUS_PRESENCE_REFRESH_ENV = "CLEO_DISABLE_PRESENCE_REFRESH"; /** How one refresh attempt ended. */ export type NexusPresenceRefreshOutcome = 'disabled' | 'not-linked' | 'throttled' | 'no-credential' | 'sent' | 'failed'; /** Options for {@link refreshProjectPresence}. */ export interface RefreshProjectPresenceOptions { /** The project root (the CLI passes the resolved current project). */ projectRoot: string; /** CLEO version reported in presence. */ cliVersion: string; /** CLEO home (throttle stamps). @defaultValue getCleoHome() */ cleoHome?: string; /** Clock. */ now?: () => Date; /** `fetch` override. */ fetch?: FetchLike; /** Device store override. */ deviceStore?: Pick; /** Environment. @defaultValue process.env */ env?: NodeJS.ProcessEnv; } /** * Refresh the cloud presence of this machine's linked project once, if due. * Never throws: every failure is an outcome. The throttle stamp is written * before the request, so a failing network is retried an hour later, not on * every command. * * @param opts - Project root, CLI version and overrides. * @returns How it ended. */ export declare function refreshProjectPresence(opts: RefreshProjectPresenceOptions): Promise; /** * Start {@link refreshProjectPresence} in the background, alongside the * command, without awaiting it: registered with the background-op registry * so the CLI's teardown can drain it within its deadline instead of * abandoning a half-sent request. * * @param opts - As for {@link refreshProjectPresence}. */ export declare function startProjectPresenceRefresh(opts: RefreshProjectPresenceOptions): void; //# sourceMappingURL=nexus-presence-refresh.d.ts.map