UNPKG

@essentialai/cogent-bridge

Version:

Cogent Bridge — cross-agent comms for Claude Code, OpenAI Codex and Slack. Codex users: install with `curl -fsSL https://cogent.tools/install.sh | sh`, then start with `cogent-codex` for real-time peer wake.

51 lines • 2.86 kB
/** Parse a leading `x.y.z` into numbers; null if not a clean 3-part numeric version. */ export declare function parseVersion(v: string): [number, number, number] | null; /** True iff `latest` is strictly newer than `current` (major, then minor, then patch). */ export declare function isNewer(current: string, latest: string): boolean; export interface CheckForUpdateOptions { timeoutMs?: number; url?: string; fetchImpl?: typeof fetch; } /** * Record a check's result (the nudge string, or null when current/unchecked). * * A CHANGED nudge re-arms {@link consumeNudgeOnce}: a second release must still be announced even * though the first one already was. Re-setting the SAME text does not re-arm — that is what keeps * a periodic check from becoming a periodic nag. */ export declare function setLastNudge(nudge: string | null): void; /** * The pending nudge, returned EXACTLY ONCE per distinct nudge; null afterwards. * * 🔴 WHY "ONCE" IS PART OF THE CONTRACT. The surfacing path rides a message the agent is already * processing (auto-relay), so it costs no extra turn — but that also means it would otherwise fire * on EVERY inbound message. One line per release is information; the same line on every message is * noise, and noise is what teaches people to ignore the notice that matters. */ export declare function consumeNudgeOnce(): string | null; /** * Re-check for a newer published client on an interval, forever. * * 🔴 WHY A ONE-SHOT CHECK WAS NEARLY USELESS. The check ran once, at boot. Every bridge here is * long-lived — some run for weeks — so a version published after startup was invisible to the * running process no matter how many releases shipped. 3.21.4 through 3.21.8 all went out inside a * single day; an agent booted that morning would still have reported itself current that evening. * * Checks immediately, then every `intervalMs`. Never throws (checkForUpdate already swallows), and * the timer is `unref`'d so it can never hold the process open at shutdown. Returns a stop * function — used by tests, and available to any caller that needs a clean teardown. */ export declare function startUpdateCheckLoop(current: string, opts?: CheckForUpdateOptions & { intervalMs?: number; }): () => void; /** The most recent update nudge, or null. Read by health-check to surface it to the user. */ export declare function getLastNudge(): string | null; /** Test-only: clear the stored nudge between suites. @internal */ export declare function __resetLastNudgeForTest(): void; /** * Fetch the latest published cogent-bridge version; if newer than `current`, return a * one-line update nudge, else null. Never throws. */ export declare function checkForUpdate(current: string, opts?: CheckForUpdateOptions): Promise<string | null>; //# sourceMappingURL=npm-update-check.d.ts.map