/** * `r.buzz.doctor()` — the zero-mutation Buzz setup preflight * (`run402.buzz-doctor.v1`), owned by the Node SDK: the managed session's * shell and Node runtime, the Run402 CLI, the managed Buzz CLI sidecar and * its capabilities, the public agent identity, the Run402 API and console * origins (measured with `r.diagnostics.probeOrigin`), the Buzz relay (a * DNS-pinned NIP-11 read), and the explicit wallet profile. Every check's * status is `ok | warning | blocked`; a blocked or warning check carries * exactly one repair action from the frozen matrix below. * * `run402 doctor --buzz` is a shim over this. The Run402 CLI facts (its * version, how it was installed, whether it is current) are the calling * program's own, supplied as hooks; without them the `run402_cli` check * reports the CLI unavailable. */ import { Buzz } from "../namespaces/buzz.js"; import type { Client } from "../kernel.js"; import { Diagnostics, type OriginProbeResult } from "./diagnostics.js"; export declare const BUZZ_DOCTOR_TIMEOUT_MS = 3000; export declare const BUZZ_DOCTOR_MAX_RESPONSE_BYTES: number; export declare const BUZZ_DOCTOR_MIN_NODE_MAJOR = 22; export declare const BUZZ_DOCTOR_MIN_RUN402_VERSION = "4.17.2"; export declare const BUZZ_DOCTOR_REPAIR_MATRIX: Readonly<{ BUZZ_PREFLIGHT_SHELL_UNAVAILABLE: { type: string; surface: string; }; BUZZ_PREFLIGHT_NODE_UNAVAILABLE: { type: string; surface: string; }; BUZZ_PREFLIGHT_NODE_INCOMPATIBLE: { type: string; surface: string; }; BUZZ_PREFLIGHT_RUN402_UNAVAILABLE: { type: string; surface: string; }; BUZZ_PREFLIGHT_RUN402_INCOMPATIBLE: { type: string[]; surface: string; }; BUZZ_PREFLIGHT_RUN402_UPDATE_AVAILABLE: { type: string; surface: string; }; BUZZ_PREFLIGHT_BUZZ_CLI_UNAVAILABLE: { type: string; surface: string; }; BUZZ_PREFLIGHT_BUZZ_CLI_INCOMPATIBLE: { type: string; surface: string; }; BUZZ_AGENT_TARGET_REQUIRED: { type: string; surface: string; }; BUZZ_AGENT_TARGET_UNVERIFIED: { type: string[]; surface: string[]; }; BUZZ_AGENT_TARGET_MISMATCH: { type: string; surface: string; }; BUZZ_PREFLIGHT_API_UNREACHABLE: { type: string; surface: string; }; BUZZ_PREFLIGHT_CONSOLE_UNREACHABLE: { type: string; surface: string; }; BUZZ_PREFLIGHT_RELAY_UNSAFE: { type: string; surface: string; }; BUZZ_PREFLIGHT_RELAY_UNREACHABLE: { type: string[]; surface: string; }; BUZZ_PREFLIGHT_WALLET_PROFILE_REQUIRED: { type: string; surface: string; }; BUZZ_PREFLIGHT_WALLET_PROFILE_NOT_FOUND: { type: string; surface: string; }; BUZZ_PREFLIGHT_WALLET_PROFILE_MISMATCH: { type: string; surface: string; }; }>; export declare function normalizeNostrSubject(value: any): string | null; /** What the Run402 CLI knows about itself, supplied by the CLI when it runs the preflight. */ export interface BuzzDoctorRun402CliHooks { /** The executing CLI's version. */ currentVersion: () => string; /** How the executing CLI was installed: `{ kind, confidence, package_manager }`. */ detectInstall: (ctx: { cwd: string; env: Record; argv: string[]; execPath: string; }) => any; /** The CLI's own update check (a doctor check; `status: "warning"` offers an upgrade). */ updateCheck?: (opts: Record) => Promise; } export interface BuzzDoctorOptions { /** The intended managed agent's public key, hex (see {@link normalizeNostrSubject}). */ expectedSubjectHex?: string | null; /** The Run402 CLI's facts; absent, the `run402_cli` check reports the CLI unavailable. */ run402Cli?: BuzzDoctorRun402CliHooks; env?: Record; argv?: string[]; execPath?: string; cliExecutable?: string | null; cwd?: string; platform?: NodeJS.Platform; now?: number; runCommand?: (command: string, args: string[], options?: Record) => any; lookup?: (hostname: string, options: any) => Promise; pinnedRelayRead?: (relay: any, record: any, options: { timeoutMs: number; maxBytes: number; }) => Promise; /** Measures an origin; defaults to `r.diagnostics.probeOrigin`. */ originProbe?: (url: URL, options: { timeoutMs: number; maxBytes: number; }) => Promise; getActiveProfile?: () => string; profileExistsImpl?: (name: string) => boolean; readMetaImpl?: (name: string) => any; apiOrigin?: string; consoleOrigin?: string; } export declare function buildBuzzDoctorReport({ expectedSubjectHex, run402Cli, env, argv, execPath, cliExecutable, cwd, platform, now, runCommand, lookup, pinnedRelayRead, originProbe, getActiveProfile, profileExistsImpl, readMetaImpl, apiOrigin, consoleOrigin, }?: BuzzDoctorOptions): Promise; export declare function defaultPinnedRelayRead(relay: any, record: any, { timeoutMs, maxBytes }?: any): Promise; export declare function isPublicAddress(address: any): boolean; export declare function pinnedLookup(record: any, expectedHostname: any): (hostname: any, options: any, callback: any) => void; /** * `r.buzz` on the Node entry: the isomorphic Buzz workflows plus the * zero-mutation setup preflight. */ export declare class NodeBuzz extends Buzz { #private; constructor(client: Client, diagnostics: Diagnostics); /** The `run402.buzz-doctor.v1` report. Read-only: nothing is created, signed, or published. */ doctor(opts?: BuzzDoctorOptions): Promise; } //# sourceMappingURL=buzz-doctor.d.ts.map