import { type BindingId, type BindingResolution, type KeybindingDiagnostic, type SparseKeybindingOverrides } from '../../core/keybindings/index.js'; export type SetupPackageId = 'crtr-extensions' | 'mode-switch' | 'oauth-adapter' | 'capture-plugin'; export type SetupTool = 'tmux' | 'nvim'; /** `marketplace-plugin` installs a crtr plugin from a registered marketplace * (`installSource` is a `/` ref) instead of running the * bundled pi CLI. Offered in setup and NOT installed by first-run bootstrap: * an install that never runs setup — a Northlight guest image, CI — should not * carry a command whose external binary it lacks. */ export type SetupPackageSourceKind = 'local-path' | 'npm' | 'marketplace-plugin'; export type SetupPackageIdentity = string; export type PackageManager = 'brew' | 'apt-get' | 'dnf' | 'pacman' | 'manual'; export interface SetupPackageManifestEntry { id: SetupPackageId; name: string; sourceKind: SetupPackageSourceKind; installSource: string; shortDescription: string; longDescription: string; } export interface SetupSystemInstallPlan { tool: SetupTool; label: string; installed: boolean; checked: boolean; packageManager: PackageManager; command: string | null; hint: string; autoInstall: boolean; } export interface SetupSystemToolState { tool: SetupTool; installed: boolean; plan: SetupSystemInstallPlan; } export interface SetupStaticInstructions { headline: string; packageLines: string[]; systemLines: string[]; exaLine: string; footer: string; } export interface SetupSubmission { packages: SetupPackageManifestEntry[]; installedPackageIds: Set; systemDeps: SetupSystemInstallPlan[]; exaKey: string; exaKeyPath: string; } export interface SetupExecutionSummary { installed: string[]; skipped: string[]; exaKeyWritten: boolean; exaKeyPath: string; interactionRootsRegistered: number; } export interface SetupInitialState { manifest: SetupPackageManifestEntry[]; installedPackageIds: Set; systemTools: SetupSystemToolState[]; exaKeyPath: string; } export interface KeybindingEditResult { readonly ok: boolean; readonly diagnostics: readonly KeybindingDiagnostic[]; } /** Transactional sparse keybinding draft used by the full-screen setup tab. */ export declare class SetupKeybindingsDraft { private expected; private baseline; private current; private baselineInvalidRoot; private invalidRoot; private resolutionCache; constructor(rawKeybindings: unknown); get dirty(): boolean; overrides(): Record; expectedKeybindings(): unknown; resolution(): BindingResolution; /** True while the persisted `keybindings` root is a non-object (e.g. a string): * edits cannot be layered onto an invalid root, so the tab must reset-all first. */ hasInvalidRoot(): boolean; expression(id: BindingId): string; edit(id: BindingId, expression: string): KeybindingEditResult; unbind(id: BindingId): KeybindingEditResult; resetRow(id: BindingId): void; resetAll(): void; discard(): void; markSaved(overrides: SparseKeybindingOverrides): void; } export declare function buildSetupManifest(resolveBuiltinPackageDir?: (name: string) => string): SetupPackageManifestEntry[]; export declare function normalizePackageIdentity(source: string, settingsDir: string, homeDir: string): SetupPackageIdentity; export declare function detectInstalledSetupPackageIds(settingsJson: unknown, manifest?: SetupPackageManifestEntry[], settingsPath?: string, homeDir?: string): Set; export declare function detectCommandOnPath(command: string): boolean; export declare function detectPackageManager(platform?: NodeJS.Platform, commandExists?: (command: string) => boolean): PackageManager; export declare function buildSystemInstallPlan(tool: SetupTool, packageManager: PackageManager, installed: boolean): SetupSystemInstallPlan; export declare function buildSystemToolState(tool: SetupTool, packageManager: PackageManager, commandExists?: (command: string) => boolean): SetupSystemToolState; export declare function resolveSettingsPath(homeDir?: string): string; export declare function resolveExaKeyPath(homeDir?: string): string; /** Where an already-present API key is resolved from — env var wins over the * key file, matching the runtime resolver in search/exa.ts. */ export type ApiKeySource = 'env' | 'file'; export interface ApiKeyPresence { present: boolean; source?: ApiKeySource; } export declare function detectExaKey(homeDir?: string): ApiKeyPresence; export declare function buildSetupInitialState(opts?: { manifest?: SetupPackageManifestEntry[]; settingsPath?: string; homeDir?: string; packageManager?: PackageManager; commandExists?: (command: string) => boolean; }): SetupInitialState; export declare function buildSetupStaticInstructions(opts: { manifest: SetupPackageManifestEntry[]; installedPackageIds: Set; systemPlans: SetupSystemInstallPlan[]; exaKeyPath: string; }): SetupStaticInstructions; export declare function renderSetupStaticInstructions(state: Pick): string; export declare function writeExaKey(exaKeyPath: string, exaKey: string): Promise; /** Refresh crouter-owned tmux bindings and register the one canvas node root * with humanloop so every bridge ticket can call back into `human _deliver`. * Both are best-effort: setup must never fail because tmux or humanloop is unavailable. */ export declare function reconcileInboxFrontDoor(): Promise<{ interactionRootsRegistered: number; }>; export declare function summarizeSetupExecution(result: { installedPackages: string[]; skippedPackages: string[]; installedSystemDeps: string[]; skippedSystemDeps: string[]; exaKeyWritten: boolean; exaKeyPath: string; interactionRootsRegistered: number; }): SetupExecutionSummary; export declare function formatSetupExecutionSummary(summary: SetupExecutionSummary): string; export declare function executeSetupSubmission(submission: SetupSubmission): Promise;