import type { ContainerRuntimeInfo, ContainerState } from "../types.js"; import type { UpdateCheckResult, UpdateRegistration, UpdateServiceApi } from "./types.js"; import type { UpdateCache } from "./cache.js"; export interface AppDeps { debug: (msg: string, ...args: unknown[]) => void; error: (msg: string, ...args: unknown[]) => void; /** Emit a Signal K notification (notifications.plugins..updateAvailable). */ handleMessage?: (pluginId: string, delta: unknown) => void; } export interface ContainerDeps { getRuntime(): ContainerRuntimeInfo | null; getState(name: string): Promise; pullImage(image: string): Promise; /** Returns local image digest (image ID) for an image:tag or container name. */ getImageDigest(imageOrContainer: string): Promise; } export interface ClockDeps { now(): number; /** Schedule fn to run after delayMs. Returns an opaque handle. */ setTimer(fn: () => void, delayMs: number): unknown; clearTimer(handle: unknown): void; } export interface UpdateServiceOptions { app: AppDeps; containers: ContainerDeps; clock: ClockDeps; cache: UpdateCache; /** Default check interval if registration doesn't specify. */ defaultCheckIntervalMs?: number; /** Run scheduled checks at all? Manual checks always work. */ backgroundChecks?: boolean; /** Number of consecutive REAL errors before auto-unregister. */ errorStrikeLimit?: number; } /** * Centralized update detection service. Owned by signalk-container, * exposed to consumer plugins via containers.updates. */ export declare class UpdateService implements UpdateServiceApi { private readonly opts; private readonly registrations; private readonly cachedResults; private readonly defaultIntervalMs; private readonly backgroundChecks; private readonly strikeLimit; private stopped; readonly sources: { githubReleases: (repo: string, options?: { allowPrerelease?: boolean; tagPrefix?: string; }) => import("./types.js").VersionSource; dockerHubTags: (image: string, options?: { filter?: (tag: string) => boolean; }) => import("./types.js").VersionSource; }; constructor(opts: UpdateServiceOptions); register(reg: UpdateRegistration): void; unregister(pluginId: string): void; getLastResult(pluginId: string): UpdateCheckResult | null; /** List all currently-registered plugin IDs. */ listRegistrations(): string[]; checkOne(pluginId: string): Promise; checkAll(): Promise; /** * Stop all timers and flush the cache. Called from the plugin's stop(). */ stop(): void; private scheduleNext; private runCheck; private handleOffline; private handleRealError; private buildUnknownResult; private commitSuccess; private emitNotification; } /** * Parse "24h", "12h", "1h", "30m" → milliseconds. Returns null on parse fail. */ export declare function parseDuration(input: string | undefined): number | null; //# sourceMappingURL=service.d.ts.map