import spawn from 'cross-spawn'; import { type AgentClient, type SupportedCommand } from './connect-runtime.js'; import { type HarnessSpec, type SkillAgent } from './harness/harness-spec.js'; export declare function openclawSkillInstallArgs(ackFlag: string | undefined): string[]; /** `openclaw skills` has no uninstall; ClawHub removes from the global dir. */ export declare function openclawSkillUninstall(): { command: string; args: string[]; /** npx fetches the package first; the 10s removal bound starves a cold cache. */ timeoutMs: number; }; export declare const DEFAULT_ONBOARDING_PROMPT: string; export declare const OPENCLAW_ONBOARDING_PROMPT: string; export declare const KEYLESS_ONBOARDING_PROMPT: string; export type { SkillAgent }; /** Cursor writes its own MCP config, so it has no descriptor to carry this. */ export declare const CURSOR_SKILL_TARGET: { readonly skillAgent: "cursor"; readonly displayName: string; }; /** The harness reads the key from its own store. */ interface SeededInstall { /** Reused by the plugin step, so a second probe cannot disagree. */ home: string; /** Pins the add child at the home the key landed in. */ env: typeof process.env; /** Answers prompts `mcp add` still asks once the key is seeded. */ stdinInput: string; /** Names the file it wrote, never the value. */ note: string; /** Undoes the seed, carrying the value it replaced. */ rollback: () => void; /** Writes the entry ourselves; false falls back to the harness command. */ register: (mcpUrl: string) => boolean; /** `mcp add` exits 0 even having saved nothing; the code lies. */ confirmRegistered: () => { ok: boolean; detail?: string; tag?: string; }; } interface BaseMcpClient extends SupportedCommand, Pick { connectClient: Exclude; /** Replaces `addArgs` when a stored key is available: key auth removes the OAuth hop. */ keyAuth?: { /** Which variable the client reads the key from. */ envVar?: string; addArgs: (mcpUrl: string, apiKey: string) => string[]; /** Writes into the harness's store, so connect verifies the key first. */ seedKey?: (apiKey: string) => SeededInstall; }; keylessAddArgs?: (mcpUrl: string) => string[]; prepareKeylessInstall?: () => DirectInstall; loginArgs?: string[]; removals: { args: string[]; label: string; }[]; /** Blocking terminal walkthrough; runs only behind the TTY gate. */ launchWalkthrough?: (prompt: string) => void; /** Own window, never inherits stdio; reports its own outcome. */ detachedLaunch?: (prompt: string) => WalkthroughOutcome; /** Post-install like the skill step: failures warn, never fail the attempt. */ extraPostInstall?: (options: { apiKey?: string; verbose: boolean; seededHome?: string; }) => string | undefined; /** Extra --uninstall row beyond `removals`; never runs pre-add. */ uninstallExtra?: { args: string[]; label: string; }; } /** Keyless installs use this argv; the harness signs itself in. */ interface OauthCapableMcpClient extends BaseMcpClient { keyRequired?: false; addArgs: (mcpUrl: string) => string[]; } /** No sign-in exists here, so connect refuses a keyless install (Hermes). */ interface KeyRequiredMcpClient extends BaseMcpClient { keyRequired: true; keyAuth: NonNullable; /** Restoring any of these three would restore the OAuth fallback. */ addArgs?: never; loginArgs?: never; } export type NativeMcpClient = OauthCapableMcpClient | KeyRequiredMcpClient; export interface DirectInstall { home?: string; register: (mcpUrl: string) => ReturnType; } /** * `cmd` re-parses its command line after `/c`, so an unquoted `&` in the query string ends the * command and truncates the URL. Quoting needs windowsVerbatimArguments, or Node escapes the * quotes back out. Untested on Windows. */ export declare function openExternalUrl(url: string): ReturnType; /** Writes exit 0 having saved nothing, a disabled entry, or a keyless one. */ export declare function hermesRegistrationEnabled(home: string, mode?: 'api-key' | 'keyless', expectedUrl?: string): { ok: boolean; detail?: string; tag?: string; }; export declare const NATIVE_MCP_CLIENTS: readonly NativeMcpClient[]; /** Native descriptor by harness id; Cursor and OpenClaw have none. */ export declare const NATIVE_BY_HARNESS: Map<"openclaw" | "omp" | "grok" | "cursor" | "codex" | "hermes" | "command-code" | "kilo" | "opencode" | "pi" | "cline" | "claude-code", NativeMcpClient>; export declare const OPENCLAW: SupportedCommand; /** "printed" = handed to the user to paste; the walkthrough was never started for them. */ export type WalkthroughOutcome = 'launched' | 'printed'; /** Awaited before the handover; track+flush must land pre-block. */ type OnWalkthroughDecided = (outcome: WalkthroughOutcome) => void | Promise; export declare function launchNativeMcpClient(client: NativeMcpClient, onDecided?: OnWalkthroughDecided, prompt?: string): Promise; export declare function launchOmpWalkthrough(onDecided?: OnWalkthroughDecided, prompt?: string): Promise; export declare function launchPiWalkthrough(onDecided?: OnWalkthroughDecided): Promise; export declare function launchOpenClawWalkthrough(onDecided?: OnWalkthroughDecided): Promise;