import { type ChannelSetupLog } from "#setup/cli/index.js"; /** Controls connector provisioning while adding a Connect-backed connection. */ export interface SetupConnectionConnectorOptions { /** Status and command output stream through this log (rail styling preserved). */ log: ChannelSetupLog; projectRoot: string; /** Connection slug; also the connector `--name`. */ slug: string; /** `vercel connect create ` identifier (e.g. `mcp.linear.app`). */ service: string; /** Generated `agent/connections/.ts` whose `connect("…")` is patched. */ connectionFilePath: string; /** * Links a Vercel project before Connect provisioning when the caller owns a * richer linking flow (e.g. shared team selection). Returns the linked * project id, or `undefined` when linking did not complete. When omitted, * falls back to a bare `vercel link`. */ linkProject?: () => Promise; } /** Outcome of the Connect create-and-patch sequence for a connection. */ export type SetupConnectionConnectorResult = { kind: "create-failed"; created: false; } | { kind: "connector-unresolved"; created: true; } | { kind: "patch-failed"; created: true; connectorUid: string; } | { kind: "patched"; created: true; connectorUid: string; }; /** Identifiers returned by Vercel Connect for an OAuth connector. */ export interface ConnectConnectorRef { uid: string; id: string; } /** * Reads the connector identifiers from `vercel connect create … -F json` * stdout. This is the authoritative source for the just-created connector's * UID — it avoids a follow-up `connect list`, which can momentarily 404/rate * limit right after creation and cannot disambiguate when a service already * has multiple connectors. Returns `undefined` when stdout is empty or not the * expected JSON (e.g. an older CLI without `-F json` support on `create`). */ export declare function parseCreatedConnector(stdout: string): ConnectConnectorRef | undefined; /** * Finds the connector to wire into the generated connection. The list is * expected to be scoped to the requested service server-side (via * `--service`), since `vercel connect list -F json` does not include a * `service` field per connector. Prefers, in order: the connector already * attached to this project, then the newest connector. When Connect does * report a `service` field, mismatches are still skipped defensively. */ export declare function pickConnectConnector(listJson: unknown, service: string, projectId: string | undefined): ConnectConnectorRef | undefined; /** * Creates a Vercel Connect OAuth connector for a connection and rewrites the * generated `connect("…")` call to the connector UID Connect assigns. The * `vercel connect create` step is interactive (it opens a browser to complete * the OAuth grant); callers should only invoke this from an interactive flow. */ export declare function setupConnectionConnector(options: SetupConnectionConnectorOptions): Promise;