export declare const CONFIG_DIR: string; /** * A companies sign-in started but not finished: the emailed code (or legacy * magic link) may still be valid. Retained in the config shape so existing * config files keep parsing and clearAuth() can scrub the field. */ export interface PendingLogin { mode: 'magic-link' | 'workos'; /** Magic-link session being polled (absent for WorkOS code sign-ins). */ sessionId?: string; email: string; /** Epoch ms when the emailed link/code stops being valid. */ expiresAt: number; } /** Companies-door state. One session for both doors; only context lives here. */ export interface CompaniesConfig { /** OAuth-client mode new credentials are created in (UI says test/production). */ mode?: 'sandbox' | 'production'; /** Default company for `companies` commands (set via `companies use`). */ activeOrgId?: string; activeOrgName?: string; pendingLogin?: PendingLogin; } interface Config { email?: string; jwt?: string; accessToken?: string; refreshToken?: string; apiUrl?: string; mcpUrl?: string; companies?: CompaniesConfig; /** Set after adopting a session from ~/.agent-cards-admin.json, so it runs once. */ adminConfigMigrated?: boolean; /** CLI version that last refreshed the managed steering blocks (agents add). */ steeringRefreshedBy?: string; /** Custom --path steering installs, so the automatic refresh covers them. */ steeringPaths?: string[]; } export declare function readConfig(): Config; export declare function writeConfig(data: Partial): void; /** * Session-credential writes (login/logout: email + token pair) MUST go through * this instead of writeConfig: it takes the same cross-process session lock the * token rotation holds (lib/session-lock), so a login can never interleave with * an in-flight refresh — the refresh either finishes first (and the login then * overwrites it wholesale, correct) or observes the login and discards its * stale rotation. Never writes unlocked: on lock timeout this THROWS (a clear * "busy, try again" — see withSessionLock) rather than risking a mixed-identity * config. Dynamic import avoids a module-eval cycle (session-lock reads * CONFIG_DIR from here). */ export declare function writeSessionConfig(data: Partial): Promise; /** Merge updates into the companies section (context, not credentials). */ export declare function writeCompaniesConfig(data: Partial): void; export declare function getCompaniesConfig(): CompaniesConfig; export declare function getApiUrl(): string; /** * The bearer token for API calls. An explicit AGENT_CARDS_JWT env override wins * (CI/agents), then the WorkOS access token, then a legacy magic-link JWT. One * accessor so every caller works in both auth modes during the migration. */ export declare function getJwt(): string | undefined; /** The WorkOS refresh token, if this is a WorkOS session (used to rotate on 401). */ export declare function getRefreshToken(): string | undefined; export declare function getEmail(): string | undefined; /** * The AgentCard MCP server URL (Streamable HTTP, `/mcp`) the `buy` chat connects to as an MCP * client. Resolution order: stored config → AGENT_CARDS_MCP_URL env → derived from the API URL * (api.agentcard.sh → mcp.agentcard.sh/mcp) → prod default. Local dev runs the MCP HTTP server on * a separate port (`pnpm dev:mcp-http`), so set AGENT_CARDS_MCP_URL=http://localhost:3002/mcp there. */ export declare function getMcpUrl(): string; /** * Remove stored auth (email + tokens) so the user can log in as someone else. * Runs under the session lock: an UNLOCKED wipe could land inside an in-flight * token rotation's check-to-write window, and the rotation would then persist a * fresh pair — silently logging the user back in after they logged out. */ export declare function clearAuth(): Promise; export {}; //# sourceMappingURL=config.d.ts.map