import type { ConnectRenderer } from "./render/connect-renderer.js"; import { readCliState } from "../core/index.js"; import { type VanaNetworkName } from "../core/network.js"; import type { CliChannel, CliInstallMethod, CliStatus, SourceStatus } from "../core/cli-types.js"; import type { AvailableSource } from "../connectors/registry.js"; import type { PersonalServerTarget } from "../personal-server/index.js"; import { type CliServerDir } from "../personal-server/local/data-dir.js"; interface GlobalOptions { json?: boolean; noInput?: boolean; ipc?: boolean; yes?: boolean; quiet?: boolean; detach?: boolean; /** `--network` value; resolved via resolveNetwork() where needed. */ network?: VanaNetworkName; } interface SourceLabelMap { [source: string]: string; } interface SourceMetadataMap { [source: string]: { name: string; company?: string; description?: string; authMode?: "automated" | "interactive" | "legacy"; runtime?: "legacy" | "pdpp"; }; } type RenderTone = "accent" | "success" | "warning" | "error" | "muted" | "info"; export declare function runCli(argv?: string[]): Promise; export declare function withPhaseProgress(renderer: ConnectRenderer | null, label: string, work: () => Promise, delayMs?: number): Promise; /** * Where the running server keeps its data on this machine, when known: a * server vana started is the one whose data dir holds a live lock and the * key the server answers with, whoever is signed in now. */ export declare function localDataDir(target: PersonalServerTarget, network: VanaNetworkName | null, cliServers?: CliServerDir[]): { path: string; runBy: "cli" | "desktop"; owner: string | null; } | null; export declare function formatUptime(seconds: number): string; export declare function displaySource(source: string, labels?: SourceLabelMap): string; export declare function humanizeIssue(message: string): string; export declare function gatherSourceStatuses(storedSources: Record>["sources"][string]>, metadata?: SourceMetadataMap): Promise; export declare function listInstalledConnectorFiles(): Promise>; export declare function buildStatusNextSteps(sources: SourceStatus[], sourceLabels?: SourceLabelMap, runtime?: CliStatus["runtime"], availableSources?: Array<{ id: string; name: string; authMode?: string; }>): string[]; export declare function buildSourcesNextSteps(recommendedSource: { id: string; name: string; authMode?: "automated" | "interactive" | "legacy"; } | null | undefined, connectedCount: number): string[]; export declare function buildDataListNextSteps(datasetRecords: Array<{ source: string; name?: string | null; }>, registrySources: Array<{ id: string; authMode?: "automated" | "interactive" | "legacy"; }>): string[]; export declare function buildDataShowNextSteps(source: string, datasetCount: number, sourceLabels?: SourceLabelMap): string[]; /** Derive a human-readable message from a stored `connectionHealthReason`. */ export declare function formatHealthMessage(reason: string | undefined): string | null; export declare function getCliVersion(): string; export declare function getCliChannel(version?: string): "stable" | "canary"; export declare function getCliInstallMethod(execPath?: string, modulePath?: string): CliInstallMethod; export declare function getDoctorAppRootPath(installMethod: CliInstallMethod, execPath?: string): string | null; export declare function formatInstallMethodLabel(method: CliInstallMethod): string; export declare function getLifecycleCommands(installMethod: CliInstallMethod, channel: CliChannel, modulePath?: string): { upgrade: string; uninstall: string; }; export declare function createSourceLabelMap(sources: Array<{ id: string; name: string; }>): SourceLabelMap; export declare function createSourceMetadataMap(sources: Array<{ id: string; name: string; company?: string; description?: string; authMode?: "automated" | "interactive" | "legacy"; runtime?: "legacy" | "pdpp"; }>): SourceMetadataMap; export declare function getSourceStatusPresentation(source: SourceStatus): { label: string; tone: RenderTone; }; export declare function toneForRuntime(runtime: CliStatus["runtime"]): RenderTone; export declare function loadRegistrySources(): Promise; export declare function compareSourceStatusOrder(left: SourceStatus, right: SourceStatus): number; /** * Why a connector result holds no data despite recorded errors, or null when * it has data or recorded no error. A partial run (data plus errors) still * counts as collected; an empty result with no errors is an empty account. */ export declare function failedEmptyResult(result: unknown): string | null; export declare function browserStepMessage(message: string): string; export declare function isSourceAttention(source: SourceStatus): boolean; /** * A source whose connector is no longer in the catalog and that never * collected anything: a leftover state entry (an id that was renamed, like * `claude-code` to `claude-code-local`) nothing can act on. Without a * catalog to compare against, nothing counts as retired. */ export declare function isRetiredSource(source: SourceStatus, registrySources: ReadonlyArray<{ id: string; }>): boolean; /** Installed, or tried, but holds no data yet and needs nothing fixed. */ export declare function isSourceNotCollected(source: SourceStatus): boolean; export declare function rankSourceStatus(source: SourceStatus): number; export declare function readResultSummary(resultPath: string): Promise<{ lines: string[]; } | null>; export declare function summarizeResultData(data: Record): { lines: string[]; } | null; /** `1 playlists` -> `1 playlist`; other counts are left alone. */ export declare function fixSingularCounts(text: string): string; export declare function formatTimestamp(value: string): string; export declare function compareDatasetOrder(left: { lastRunAt: string | null; name: string | undefined; source: string; }, right: { lastRunAt: string | null; name: string | undefined; source: string; }): number; export declare function hasCollectedData(dataState: SourceStatus["dataState"] | null | undefined): boolean; /** * Everything the schedule commands touch outside this process, so tests run * them against a temp plist and a fake launchctl/crontab instead of the real * ~/Library/LaunchAgents. */ export interface ScheduleDeps { platform: NodeJS.Platform; /** Absolute path of the launchd plist. */ plistPath: string; /** The env the schedule is created from and compared against. */ env: Record; /** Runs a shell command and returns stdout; throws on a non-zero exit. */ exec: (command: string, input?: string) => string; /** The program argv the scheduler should start. */ resolveCommand: () => string[]; readFile: (filePath: string) => Promise; writeFile: (filePath: string, content: string) => Promise; mkdir: (dirPath: string) => Promise; unlink: (filePath: string) => Promise; } export declare function defaultScheduleDeps(): ScheduleDeps; export declare class ScheduleTargetUnstableError extends Error { } /** * The argv a scheduler should run, every element an absolute path. * * launchd, cron and Task Scheduler inherit none of the shell's PATH, so the * `vana` on `$PATH` is the wrong answer twice over: under npm it is a shim * whose `#!/usr/bin/env node` shebang cannot find a version-managed node, * and the scheduler only reports it as `env: node: No such file or * directory`. Naming the interpreter and the script outright removes the * lookup entirely. */ export declare function resolveScheduledCommand(installMethod?: CliInstallMethod, execPath?: string, entryScript?: string): string[]; /** * Install or refresh the scheduled collection. Re-running it is the repair * for a job written by an older CLI: the job is rewritten to pin the state * of the shell running `add`, with its log inside that state. * * @param interval - `--every`; when omitted an existing job keeps its own. */ export declare function runScheduleAdd(interval: string | undefined, options: GlobalOptions, deps?: ScheduleDeps): Promise; /** * Show the installed job: how often, which state it collects into, where it * logs, and whether it has drifted from what `schedule add` writes today. */ export declare function runScheduleList(options: GlobalOptions, deps?: ScheduleDeps): Promise; export declare function runScheduleRemove(options: GlobalOptions, deps?: ScheduleDeps): Promise; export {}; //# sourceMappingURL=index.d.ts.map