/** * CleoOS Doctor — aggregated sovereignty diagnostics. * * Runs a full sovereignty probe across the CleoOS harness: provider matrix, * agent registry, memory policy configuration, and per-provider smoke checks. * Produces a human-readable report and exits non-zero if any issue is found. * * Invoked via `cleoos --doctor` or `cleoos doctor`. * * @see ADR-049 — CleoOS Sovereignty Invariants * @see ADR-050 — CleoOS Sovereign Harness: Distribution Binding Charter * @task T649 * @epic T636 * @packageDocumentation */ import type { MemoryItemType } from '../policies/memory-policy.js'; import type { AgentDefinition } from '../registry/agent-registry.js'; import type { ProviderMatrixRow } from '../registry/provider-matrix.js'; /** * Options used when CleoOS shells out to the `cleo` CLI for smoke checks. */ export interface SmokeExecOptions { /** Working directory used for the child `cleo` process. */ cwd: string; /** Environment passed to the child `cleo` process. */ env: NodeJS.ProcessEnv; } /** * Result for a single per-provider sovereignty smoke check. */ interface SmokeResult { /** Canonical provider ID (e.g. `"claude-code"`). */ providerId: string; /** Whether the smoke check passed. */ passed: boolean; /** Human-readable status message. */ message: string; } /** * Aggregated result of the full doctor probe. */ export interface DoctorReport { /** All rows from the provider matrix. */ providerRows: ProviderMatrixRow[]; /** All agents discovered in the registry. */ agents: AgentDefinition[]; /** Count of seed agents. */ seedCount: number; /** Count of user agents. */ userCount: number; /** Memory policy check results per item type. */ policyResults: Array<{ type: MemoryItemType; store: boolean; reason: string; }>; /** Per-provider smoke check results, or null when cleo CLI is unavailable. */ smokeResults: SmokeResult[] | null; /** Total number of issues found across all sections. */ issueCount: number; } /** * Walk upward from a start directory to find the nearest CLEO project root. * * @param startDir - Directory to begin searching from. * @returns The nearest marked `.cleo` ancestor, nearest `.cleo` fallback, or `startDir`. */ export declare function resolveSmokeProjectRoot(startDir?: string): string; /** * Resolve child-process options for provider smoke checks. * * `pnpm --filter exec ...` can change `process.cwd()` and even * `CLEO_ROOT` to the package directory. Prefer the best explicit candidate, * then normalize it through a `.cleo` ancestor walk so doctor checks run * against the user/project root instead of the cleo-os package root. * * @returns Child-process options for `cleo admin smoke`. */ export declare function resolveSmokeExecOptions(): SmokeExecOptions; /** * Run all CleoOS sovereignty diagnostic probes and return the aggregated report. * * Does not print output — callers are responsible for rendering. This keeps * the probe logic testable without capturing stdout. * * @returns Populated {@link DoctorReport}. */ export declare function runDoctor(): Promise; /** * Render source inventory and independent channel assessments without promoting source hints. * * @param rows - Matrix rows produced by the provider inspector. * @returns Human-readable source diagnostics and every verification stage. * @example * ```ts * const text = renderProviderMatrix(await new ProviderMatrix().getMatrix()); * ``` */ export declare function renderProviderMatrix(rows: readonly ProviderMatrixRow[]): string; /** * Render a {@link DoctorReport} to a human-readable string. * * Follows the canonical CleoOS Doctor output format. Does not include a * trailing newline after the summary line — callers append one if needed. * * @param report - The completed doctor report to render. * @returns Multi-line formatted string ready for `console.log`. */ export declare function renderDoctorReport(report: DoctorReport): string; export {}; //# sourceMappingURL=doctor.d.ts.map