import { type HostId, type HostRunner } from "../bootstrap/host-mcp.js"; /** * `jam update` - move this machine to the published release without redoing setup. * * What actually goes stale here is not a directory. JAM is launched by the * host from a registration line, and that line carries an exact pin: * * jam: npx --yes @jam-mcp/launcher@1.4.5 serve * * A newer JAM on the registry changes nothing until that line moves. Right * after 1.4.6 was published, this machine measured * `registration: HOST_REGISTRATION_STALE (registered 1.4.5)` - the agent was * still talking to the previous server. The command that fixed it was * `jam setup --agent`, which also binds the project, re-detects credentials * and re-plans everything else. Re-running setup is not what "update" means, * so this path never calls it. * * The order is the same one ASC uses, and for the same reason: the new build * is proven to answer *before* the registration is pointed at it. Nothing is * removed first - a failed update leaves the machine running what it was * running. */ export type UpdateStep = "install" | "verify-install" | "switch-registration" | "verify-health"; export declare const UPDATE_ORDER: readonly UpdateStep[]; export type UpdateState = /** Every registration this machine has runs the published release. */ "CURRENT" | "UPDATE_AVAILABLE" /** A registration exists whose version cannot be read - it may run anything. */ | "BROKEN" /** The registry could not be asked. Nothing is claimed about being up to date. */ | "UNKNOWN"; export type HostPlan = { id: HostId; from?: string; /** A bare `jam serve` entry: the version lives in the global install, not the line. */ bare: boolean; action: "repin" | "none" | "unreadable"; }; export type JamUpdatePlan = { state: UpdateState; latest?: string; running: string; hosts: HostPlan[]; steps: readonly UpdateStep[]; detail?: string; }; export type HostFacts = { id: HostId; cliAvailable: boolean; hasJamEntry: boolean; entryVersion?: string; entryBare?: boolean; }; /** * Decide, from what was measured. Pure - it runs nothing and writes nothing. * * A host with no `jam` entry is left alone. Registering JAM somewhere it was * never registered is adoption, not an update, and `jam setup` is where the * person says they want that. */ export declare function planJamUpdate(input: { latest?: string; hosts: HostFacts[]; }): JamUpdatePlan; export declare function updateLine(plan: JamUpdatePlan): string; export type UpdateOptions = { json?: boolean; /** Injected by tests. Nothing here may reach a real host CLI or npm unasked. */ run?: HostRunner; /** Injected by tests so a plan never depends on the registry. */ latest?: () => string | undefined; hosts?: () => HostFacts[]; }; export declare function jamUpdateCommand(command: string | undefined, options?: UpdateOptions): Promise;