import type { PluginInput } from "@opencode-ai/plugin"; import type { AutoUpdateCheckerOptions } from "./types.js"; type OpenCodeEvent = { type: string; properties?: unknown; }; type CheckSlotLock = { release: () => void; }; /** * Auto-update checker. * * Trigger model (rewritten in v0.19.7): * * The check fires from plugin initialization itself via a `setTimeout` * scheduled when this hook is created. We do NOT gate on * `session.created` events — that gate was unreliable because: * * - TUI restart with a resumed session never fires `session.created` * (the event fires on session creation, not on plugin reload). * - Multi-project plugin reloads each get their own plugin lifetime * with `hasChecked = false`, so only whichever project happens to * create a fresh session first ever runs the check. * - Sidebar/status polling and idle TUI use also never fire * `session.created`. * * Multi-project coordination is now handled by an on-disk timestamp at * `/opencode/last-update-check.json`. Every plugin instance reads * the timestamp before checking; if it's within `checkIntervalMs` of * now, the check is skipped. The first instance to claim the slot * writes the timestamp atomically (temp + rename) so concurrent * instances don't all hit npm. * * The returned event hook is preserved as a no-op so existing tests * that pass synthetic events keep working — the hook itself never * triggers a check now. */ export declare function createAutoUpdateCheckerHook(ctx: PluginInput, options?: AutoUpdateCheckerOptions): (_input: { event: OpenCodeEvent; }) => Promise; /** * Try to claim the next check slot via the on-disk timestamp file plus an * atomic lockfile. The returned lock must be released after the check (and any * install) completes. * * The timestamp preserves the cross-process dedup window. The lock closes the * TOCTOU gap around that timestamp and, more importantly, stays held through * preparePackageUpdate() + runNpmInstallSafe() so one updater cannot roll back * another updater's successful install from a separate process. */ declare function claimCheckSlot(storageDir: string | null, intervalMs: number): CheckSlotLock | null; export declare function getAutoUpdateInstallDir(): string; export declare const __test__: { claimCheckSlot: typeof claimCheckSlot; }; export type { AutoUpdateCheckerOptions } from "./types.js"; //# sourceMappingURL=index.d.ts.map