import { isTelemetryDisabled } from './command-context.js'; export { annotateCommand, type CommandAnnotations } from './command-context.js'; export { isTelemetryDisabled }; /** * Cap on each request the report makes (the token refresh, when one is due, and * the POST itself). A pending fetch keeps Node alive, so an unbounded one would * hold a finished command open for as long as the network sulks. */ export declare const REPORT_TIMEOUT_MS = 1500; export declare const CLI_EVENTS_PATH = "/api/cli/v1/events"; export interface CommandReport { /** `finished` for every command's end; `started` for a long-running command once it is up. */ stage: 'started' | 'finished'; ok?: boolean; durationMs?: number; exitCode?: number; /** A category — `CliError.code`, `cli_error`, `crash:TypeError` — never a message. */ failure?: string; } export interface ReportDeps { fetch: typeof globalThis.fetch; env: Record; now?: () => number; /** Where credentials live; tests point this at a temp dir. */ baseDir?: string; /** Where to look for the project's `bitmagic.json`; defaults to `process.cwd()`. */ cwd?: string; } /** * The failure category for an error that is not a CliError — a genuine bug, not * a refusal we wrote a message for. `crash:TypeError`, `crash:RangeError`: the * error's class, which says what kind of bug without saying anything about the * creator's machine. Anything odd in the name is folded to `_` so the value * always fits the shape api-server accepts. */ export declare function crashCategory(error: unknown): string; /** * Report the running command's `report` to api-server. Resolves when the report * has been sent, refused, or given up on — always, and never by throwing. * * Callers `await` it (bounded, see above) rather than fire and forget: on the * failure path cli.ts calls `process.exit` next, which would otherwise cut the * request off mid-flight, and on the success path the pending fetch would keep * the process alive for the same time either way. */ export declare function reportCommandEvent(report: CommandReport, deps?: ReportDeps): Promise;