#!/usr/bin/env node import { type RuntimeEnvironment } from "./version.js"; export declare const DEFAULT_PREFLIGHT_TIMEOUT_MS = 120000; export interface RestartWorkerDependencies { verifySharedPackage?: (packageDirectory: string, version: string) => void | Promise; } export declare function runRestartWorker(env?: NodeJS.ProcessEnv, dependencies?: RestartWorkerDependencies): Promise; /** 话题内才带原消息锚点,避免新开话题;私聊/普通群不 reply,避免飞书收成回复话题。 */ export declare function buildRestartNotificationBody(context: { wakeReplyTo?: string; notifyThreadId?: string; }, text: string): Record; export declare function buildInstallArgs(preferOffline?: boolean): string[]; /** npm pack 产物文件名(如 @yuanzhangjing/niubot@1.2.3 → yuanzhangjing-niubot-1.2.3.tgz)。 */ export declare function npmPackFilenameForPackage(packageSpec: string): string | undefined; export declare function parseNpmPackFilename(output: string): string; export declare function resolvePreflightTimeoutMs(env?: NodeJS.ProcessEnv): number; export declare function resolveRestartSourceDirectory(options: { niubotHome: string; workerRuntimePath: string; env: NodeJS.ProcessEnv; }): string; /** * 新产物按版本号判定。后面的环境变量和源码目录判断只用于把旧版 * stable-source home 迁成首个 x.y.z-dev.N,迁完后不再参与选择。 */ export declare function resolveRuntimeEnvironment(env: NodeJS.ProcessEnv, sourceDirectory: string, runtimePath?: string): RuntimeEnvironment; /** npm 全局包路径必然包含 node_modules 段(如 /opt/homebrew/lib/node_modules/@xxx/pkg) */ export declare function isNpmInstalledPath(runtimePath: string): boolean; export declare function buildRestartRuntimeEnvironment(sourceDirectory: string, environment: RuntimeEnvironment, inheritedEnvironment?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;