UNPKG

eve

Version:

Filesystem-first framework for durable backend AI agents that run anywhere.

72 lines (71 loc) 3.35 kB
import type { AgentInfoResult } from "#client/index.js"; /** One boot-time setup problem the TUI can point at a fixing command. */ export type SetupIssue = { /** Diagnostics never authorize a command by themselves. */ kind: "attention"; /** Short category label, e.g. "AI Gateway credentials". */ label: string; /** The slash command that fixes it, e.g. "/model". */ command: string; } | { /** Positive runtime evidence that no model provider is configured. */ kind: "model-provider-unconfigured"; label: string; command: "/model"; }; /** What a boot detection may inspect. */ export interface BootDetectionContext { /** The local project the in-process dev server is running. */ appRoot: string; /** `eve dev` loads the project env files before the TUI boots. */ env: Record<string, string | undefined>; /** Best-effort agent truth from the header fetch; undefined when unavailable. */ info?: AgentInfoResult; } /** * One installation-state check run at TUI boot, before the user hits the * failure mid-conversation. Detections must stay cheap and local (env reads, * a single fs stat) — they run between the header and the first prompt. */ export interface BootDetection { id: string; detect(context: BootDetectionContext): SetupIssue[] | Promise<SetupIssue[]>; } /** The built-in boot detections, run in order. */ export declare const BOOT_DETECTIONS: readonly BootDetection[]; /** * The logged-out hint. Deliberately not a {@link BootDetection}: confirming * Vercel login is a `vercel whoami` subprocess, too costly for the cheap, * local detections that run between the header and the first prompt. The * runner probes it off the critical path and renders this issue only when the * probe resolves logged-out. */ export declare const LOGIN_SETUP_ISSUE: SetupIssue; /** * The CLI-missing hint, surfaced by the same off-critical-path probe as * {@link LOGIN_SETUP_ISSUE}. When the `vercel` binary is absent the probe * reports this instead of the login hint, so the diagnostic points at its fix * command (`/vc`) rather than a logged-out state the probe can't determine. */ export declare const CLI_MISSING_SETUP_ISSUE: SetupIssue; /** * Runs the boot detections and aggregates their issues. Each detection is * individually guarded: one that throws contributes nothing and never blocks * the prompt. */ export declare function detectSetupIssues(context: BootDetectionContext, detections?: readonly BootDetection[]): Promise<SetupIssue[]>; /** Places the auth issue before boot-time setup issues. */ export declare function orderedSetupIssues(bootIssues: readonly SetupIssue[], authIssue: SetupIssue | undefined): SetupIssue[]; /** The command and entry step authorized by positive setup evidence. */ export interface AutomaticSetupCommand { prompt: "/model"; initialModelStep: "provider"; } /** Returns the only command authorized to run from positive setup evidence. */ export declare function automaticSetupCommand(issues: readonly SetupIssue[]): AutomaticSetupCommand | undefined; /** * The attention line's body, mirroring Claude Code's * `1 setup issue: MCP · /doctor` shape; the renderer prefixes the warning * glyph and paints the command blue. */ export declare function formatSetupIssuesLine(issues: readonly SetupIssue[]): string;