import { ExecutionStore } from '../application/execution-store.js'; import { startDaemonDetached, type DaemonControlDeps } from './daemon-control.js'; import { runSyncSkills } from './sync-skills.js'; export declare const UpdateExitCode: { readonly SUCCESS: 0; readonly ERR_INSTALL: 1; readonly ERR_MANAGER_UNKNOWN: 2; readonly ERR_DAEMON: 3; }; export type PackageManager = 'npm' | 'pnpm' | 'bun'; export interface ManagerDetection { manager: PackageManager | null; /** False when the caller must be told to install by hand. */ certain: boolean; /** The exact argv to run, for executing or for printing. */ command: string[]; /** Why detection landed where it did — printed when uncertain. */ reason: string; } /** * Work out which package manager owns this installation. * * Inferred from the path this module was loaded from, because that is the one * piece of evidence that is always true: whatever installed the package chose * where it lives. Environment variables are not usable — `npm_config_user_agent` * is set only inside a package manager's own lifecycle scripts, and `mma update` * runs outside them. * * Returning `certain: false` is a real outcome, not a failure mode to avoid. * Guessing wrong installs to a location the user's shell does not resolve, and * the user is then told the update succeeded while the old binary still runs. * Stopping and printing the command is strictly better than that. */ export declare function detectPackageManager(deps?: { modulePath?: string; hasCommand?: (cmd: string) => boolean; override?: PackageManager; }): ManagerDetection; export interface UpdateDeps extends DaemonControlDeps { cliVersion: string; homeDir: string; /** Absolute path to the CLI entry point, used to re-execute and to spawn the daemon. */ cliPath: string; /** Where a restarted daemon writes its output. */ logPath: string; /** Passed through to `serve` when starting the replacement. */ serveArgs?: string[]; /** Skip the package install (the user manages the package another way). */ noInstall?: boolean; /** Force a package manager instead of inferring one. */ packageManager?: PackageManager; /** Internal: this process IS the re-executed one, so skip straight to phase 2. */ postInstall?: boolean; /** Version recorded before the install, threaded through the re-execution. */ previousVersion?: string; json?: boolean; stdout?: (s: string) => boolean; stderr?: (s: string) => boolean; detect?: typeof detectPackageManager; runInstall?: (command: string[]) => { ok: boolean; output: string; }; reexec?: (argv: string[]) => number; startDaemon?: typeof startDaemonDetached; syncSkills?: typeof runSyncSkills; updatePlugin?: (pluginKey: string) => { ran: boolean; ok: boolean; output: string; }; openStore?: (dbPath: string) => Pick; now?: () => number; } export declare function runUpdate(deps: UpdateDeps): Promise; //# sourceMappingURL=update.d.ts.map