UNPKG

eve

Version:

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

92 lines (91 loc) 4.18 kB
import type { ModelAccessChange } from "#shared/model-connection.js"; import { runModelLogin } from "#setup/flows/model-login.js"; import { runDeployFlow } from "#setup/flows/deploy.js"; import { runInstallVercelCliFlow } from "#setup/flows/install-vercel-cli.js"; import { runModelFlow } from "#setup/flows/model.js"; import { runRegistryFlow } from "#setup/flows/registry.js"; import type { Prompter } from "#setup/prompter.js"; import { type TuiPrompterRenderer } from "./tui-prompter.js"; import type { PromptCommandExtensionName } from "./prompt-commands.js"; import type { SetupFlowRenderer } from "./setup-flow.js"; import type { VercelStatusEffect } from "./vercel-status.js"; export type TuiSetupCommand = PromptCommandExtensionName; /** * Panel title and loading indicator per command. The bordered panel never * repeats the echoed command verbatim, but it keeps a constant title as flows * move past their opening question. */ export declare const SETUP_FLOW_CONFIG: { login: { title: string; indicator: "pulse"; }; model: { title: string; indicator: "pulse"; }; add: { title: string; indicator: "pulse"; }; deploy: { title: string; indicator: "spinner"; }; }; export type TuiSetupCommandRenderer = TuiPrompterRenderer & Pick<SetupFlowRenderer, "readProviderPicker" | "readModelPicker" | "setNavigation" | "waitForInterrupt">; export type OnboardingScreenEvent = { screen: "model_provider" | "model_settings" | "registry_channels" | "registry_integrations" | "registry_review" | "registry_install"; registrySelectedCount?: number; }; export interface TuiSetupCommandInput { command: TuiSetupCommand; /** Project root for setup that changes shared dependencies, links, or environment files. */ appRoot: string; /** Selected agent root whose authored settings are changed by `/model`. */ agentRoot?: string; /** The renderer surface the TUI-native prompter drives. */ renderer: TuiSetupCommandRenderer; /** Initial model-flow step authorized by the runner's boot evidence. */ initialModelStep?: "provider"; /** Registry address supplied by `/add <item>`, confirmed and installed directly. */ initialRegistryAddress?: string; /** Presentation and navigation supplied by an enclosing setup journey. */ onOnboardingScreen?: (input: OnboardingScreenEvent) => void; /** Live ChatGPT identity shown only inside model configuration UI. */ chatGptAccountLabel?: string; /** Groups setup writes under one runtime update. */ withExclusiveTerminal?<T>(task: () => Promise<T>): Promise<T>; createPrompter?: (renderer: TuiPrompterRenderer) => Prompter; /** Test seam; defaults to the real setup flows. */ flows?: Partial<TuiSetupFlows>; } export interface TuiSetupFlows { runModelLogin?: typeof runModelLogin; runInstallVercelCliFlow: typeof runInstallVercelCliFlow; runModelFlow: typeof runModelFlow; runRegistryFlow: typeof runRegistryFlow; runDeployFlow: typeof runDeployFlow; } export interface TuiSetupCommandResult { message: string; /** The user dismissed this setup step without completing it. */ cancelled?: true; /** Keep settled batch results instead of replacing them with an interrupt notice. */ partial?: true; /** Promotes an outcome to a top-level status. */ tone?: "success" | "error"; /** Keep warning/error lines after the bordered panel closes. */ preserveFlowDiagnostics: boolean; /** Status refresh required after the command settles. */ effect?: VercelStatusEffect | ModelAccessChange; } /** * Runs one TUI setup command (/model, /add, /deploy) over the * shared setup flows, asking through the TUI's own bordered panel. Never throws: * every outcome — done, cancelled, failed — folds into the returned command * result. Ctrl-C or Esc on the working indicator (no question open) aborts the * active flow, then keeps command ownership until its subprocesses and setup * stack have unwound. */ export declare function runTuiSetupCommand(input: TuiSetupCommandInput): Promise<TuiSetupCommandResult>;