import { type WorkspaceConnectionTemplateUse } from "../connections/catalog.js"; import { type CredentialContext } from "../credentials/index.js"; import { type WebContentSearchOptions, type WebExtractMode, type WebResponseMode } from "../extensions/web-content.js"; import type { CustomProviderConfig } from "./custom-registry.js"; export type { CustomProviderConfig, CustomProviderScope, CustomProviderAuthKind, UpsertCustomProviderArgs, } from "./custom-registry.js"; export { upsertCustomProvider, deleteCustomProvider, listCustomProviders, getCustomProvider, validateCustomBaseUrl, assertCanMutateCustomProviderScope, CustomProviderAuthError, } from "./custom-registry.js"; export declare const PROVIDER_API_IDS: readonly ["amplitude", "apollo", "bigquery", "clay", "commonroom", "dataforseo", "dbt", "ga4", "gcloud", "github", "figma", "fullstory", "gmail", "gong", "google_calendar", "google_drive", "google_sheets", "google_slides", "granola", "grafana", "hubspot", "salesforce", "jira", "mixpanel", "notion", "posthog", "prometheus", "pylon", "sentry", "sigma", "slack", "stripe", "twitter"]; export type ProviderApiId = (typeof PROVIDER_API_IDS)[number]; export type ProviderApiMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD"; export interface FetchAllPagesConfig { cursorPath: string; cursorParam?: string; cursorBodyPath?: string; itemsPath?: string; maxPages?: number; } export interface ProviderApiRequestArgs { provider: ProviderApiId | string; method?: ProviderApiMethod; path: string; query?: unknown; headers?: Record; body?: unknown; auth?: "default" | "none"; timeoutMs?: number; signal?: AbortSignal; maxBytes?: number; connectionId?: string | null; accountId?: string | null; saveToFile?: string; fetchAllPages?: FetchAllPagesConfig; } export interface GitHubRepositoryRef { owner: string; repo: string; } export interface GitHubRepositoryFileEntry { name: string; path: string; type: "file" | "dir" | "symlink" | "submodule" | "unknown"; sha: string | null; size: number | null; url: string | null; htmlUrl: string | null; downloadUrl: string | null; } export interface GitHubRepositoryFileListArgs extends GitHubRepositoryRef { path?: string; ref?: string; recursive?: boolean; includeDirectories?: boolean; maxFiles?: number; connectionId?: string | null; timeoutMs?: number; maxBytes?: number; } export interface GitHubRepositoryFileSearchArgs extends GitHubRepositoryRef { query?: string; path?: string; filename?: string; extension?: string; language?: string; ref?: string; perPage?: number; page?: number; maxFiles?: number; includeTextMatches?: boolean; connectionId?: string | null; timeoutMs?: number; maxBytes?: number; } export interface GitHubRepositoryFileReadArgs extends GitHubRepositoryRef { path: string; ref?: string; connectionId?: string | null; timeoutMs?: number; maxBytes?: number; } export interface GitHubRepositoryFileWriteArgs extends GitHubRepositoryRef { path: string; content: string; message: string; branch?: string; sha?: string; overwriteExisting?: boolean; committer?: GitHubRepositoryCommitIdentity; author?: GitHubRepositoryCommitIdentity; connectionId?: string | null; timeoutMs?: number; maxBytes?: number; } export interface GitHubRepositoryFileDeleteArgs extends GitHubRepositoryRef { path: string; message: string; branch?: string; sha?: string; committer?: GitHubRepositoryCommitIdentity; author?: GitHubRepositoryCommitIdentity; connectionId?: string | null; timeoutMs?: number; maxBytes?: number; } export interface GitHubRepositoryCommitIdentity { name: string; email: string; date?: string; } export interface GitHubRepositoryFileListResult { repository: GitHubRepositoryRef; ref: string | null; path: string; recursive: boolean; entries: GitHubRepositoryFileEntry[]; totalCount: number; truncated: boolean; providerTruncated: boolean; response: Pick; } export interface GitHubRepositoryFileSearchResult { repository: GitHubRepositoryRef; mode: "code-search" | "tree-filter"; query: string | null; ref: string | null; items: GitHubRepositoryFileEntry[]; totalCount: number; truncated: boolean; incompleteResults: boolean; response: Pick; } export interface GitHubRepositoryFileReadResult { repository: GitHubRepositoryRef; path: string; ref: string | null; name: string; type: string; sha: string; size: number; encoding: string | null; content: string | null; contentBase64: string | null; url: string | null; htmlUrl: string | null; downloadUrl: string | null; response: Pick; } export interface GitHubRepositoryFileWriteResult { repository: GitHubRepositoryRef; path: string; branch: string | null; content: { name: string | null; path: string | null; sha: string | null; url: string | null; htmlUrl: string | null; }; commit: { sha: string | null; url: string | null; htmlUrl: string | null; message: string | null; }; response: Pick; } export interface GitHubRepositoryFileDeleteResult { repository: GitHubRepositoryRef; path: string; branch: string | null; commit: { sha: string | null; url: string | null; htmlUrl: string | null; message: string | null; }; response: Pick; } export interface ProviderApiDocsOptions { provider: ProviderApiId | string; url?: string; maxBytes?: number; maxChars?: number; responseMode?: WebResponseMode; extract?: WebExtractMode; includeLinks?: boolean; search?: WebContentSearchOptions; } export type ProviderApiAuthKind = { type: "none"; } | { type: "bearer"; keys: readonly string[]; workspaceProvider?: string; } | { type: "basic"; usernameKey: string; passwordKey: string; workspaceProvider?: string; } | { type: "basic-raw"; key: string; workspaceProvider?: string; } | { type: "api-key-header"; key: string; header: string; workspaceProvider?: string; } | { type: "google-service-account"; scopes: readonly string[]; oauthProvider?: string; workspaceProvider?: string; } | { type: "oauth-bearer"; oauthProvider: string; tokenLabel: string; workspaceProvider?: string; } | { type: "oauth-client-credentials"; clientIdKey: string; clientSecretKey: string; tokenPath: string; workspaceProvider: string; } | { type: "oauth-bearer-or-client-credentials"; oauthProvider: string; tokenLabel: string; clientIdKey: string; clientSecretKey: string; tokenPath: string; workspaceProvider: string; } | { type: "oauth-bearer-or-api-key-header"; oauthProvider: string; tokenLabel: string; key: string; fallbackKeys?: readonly string[]; header: string; workspaceProvider: string; } | { type: "oauth-bearer-or-bearer-key"; oauthProvider: string; tokenLabel: string; key: string; fallbackKeys?: readonly string[]; workspaceProvider: string; } | { type: "oauth-bearer-or-basic"; oauthProvider: string; tokenLabel: string; usernameKey: string; passwordKey: string; workspaceProvider: string; } | { type: "prometheus"; }; export interface ProviderApiConfig { id: ProviderApiId; label: string; defaultBaseUrl: string; requiresConnectionId?: boolean; requiresWorkspaceConnection?: boolean; baseUrlCredentialKey?: string; baseUrlConnectionConfigKey?: string; baseUrlMustMatchAllowedHost?: boolean; auth: ProviderApiAuthKind; credentialKeys: readonly string[]; docsUrls: readonly string[]; specUrls?: readonly string[]; allowedHostSuffixes?: readonly string[]; requireHttps?: boolean; defaultHeaders?: Record; placeholders?: readonly ProviderApiPlaceholder[]; examples?: readonly ProviderApiExample[]; notes?: readonly string[]; accessErrorGuidance?: string; corpusRecipes?: readonly ProviderApiCorpusRecipe[]; templateUses?: readonly WorkspaceConnectionTemplateUse[]; bodyOkField?: string; } export interface ProviderApiPlaceholder { name: string; credentialKey: string; label: string; } export interface ProviderApiExample { label: string; method: ProviderApiMethod; path: string; query?: unknown; body?: unknown; } export interface ProviderApiCorpusRecipe { label: string; useWhen: string; workflow: readonly string[]; request: { method: ProviderApiMethod; path: string; body?: unknown; query?: unknown; }; pagination?: { itemsPath?: string; nextCursorPath?: string; cursorParam?: string; cursorBodyPath?: string; pageParam?: string; offsetParam?: string; pageSize?: number; maxPages?: number; }; batch?: { inputValuePath?: string; itemBodyPath?: string; itemQueryParam?: string; responseItemsPath?: string; batchSize?: number; }; search?: { textPaths?: readonly string[]; idPaths?: readonly string[]; metadataPaths?: readonly string[]; }; } export interface ProviderApiResolvedCredential { key: string; value: string; source: string; provider: string; connectionId?: string; connectionLabel?: string; accountId?: string; accountLabel?: string | null; scope?: string; scopeId?: string; } export interface ProviderApiCredentialLookupOptions { appId: string; provider: string; key: string; ctx: CredentialContext; workspaceProvider?: string; connectionId?: string | null; localCredentialSource: string; } export type ProviderApiCredentialResolver = (options: ProviderApiCredentialLookupOptions) => Promise; export interface ProviderApiRuntimeOptions { appId: string; providerIds?: readonly (ProviderApiId | string)[]; providerOverrides?: readonly ProviderApiConfig[]; localCredentialSource?: string; getCredentialContext?: () => CredentialContext | null; resolveCredential?: ProviderApiCredentialResolver; oauthProviderOverrides?: Record; getCustomProviders?: () => Promise; } export interface ProviderApiRuntime { providerIds: readonly ProviderApiId[]; listCatalog(provider?: ProviderApiId | string): ReturnType | Promise; fetchDocs(options: ProviderApiDocsOptions): Promise; executeRequest(args: ProviderApiRequestArgs): Promise; resolveOAuthAccessToken(args: { provider: ProviderApiId; connectionId?: string | null; accountId?: string | null; }): Promise; listGitHubRepositoryFiles(args: GitHubRepositoryFileListArgs): Promise; searchGitHubRepositoryFiles(args: GitHubRepositoryFileSearchArgs): Promise; readGitHubRepositoryFile(args: GitHubRepositoryFileReadArgs): Promise; writeGitHubRepositoryFile(args: GitHubRepositoryFileWriteArgs): Promise; deleteGitHubRepositoryFile(args: GitHubRepositoryFileDeleteArgs): Promise; } export interface ProviderApiOAuthAccessToken { accessToken: string; accountId: string | null; accountLabel: string | null; connectionId: string | null; connectionLabel: string | null; } interface ProviderApiHttpResponse { status: number; statusText: string; ok: boolean; elapsedMs: number; headers: Record; contentType: string | null; size: number; /** `size` counts only what was read before the cap; the body was longer. */ sizeIsLowerBound?: true; /** The body was not read, so `size`, `text`, and `json` say nothing about it. */ bodyDiscarded?: true; truncated: boolean; text?: string; json?: unknown; quota?: { exhausted: boolean; providerId: string; retryAfterMs: number; retryAt: string; reason: string; }; } export declare function getProviderApiConfig(provider: ProviderApiId | string, overrides?: readonly ProviderApiConfig[]): ProviderApiConfig; export declare function isValidProviderApiBaseUrl(provider: ProviderApiId | string, value: string, overrides?: readonly ProviderApiConfig[]): boolean; export declare function mergeProviderApiConfigs(overrides?: readonly ProviderApiConfig[]): ProviderApiConfig[]; export declare function isProviderApiId(provider: string): provider is ProviderApiId; export declare function listProviderApiIdsForTemplateUse(templateUse: WorkspaceConnectionTemplateUse, overrides?: readonly ProviderApiConfig[]): ProviderApiId[]; export declare function listProviderApiCatalog(provider?: ProviderApiId | string, options?: { providerIds?: readonly (ProviderApiId | string)[]; providerOverrides?: readonly ProviderApiConfig[]; }): { id: "amplitude" | "apollo" | "bigquery" | "clay" | "commonroom" | "dataforseo" | "dbt" | "figma" | "fullstory" | "ga4" | "gcloud" | "github" | "gmail" | "gong" | "google_calendar" | "google_drive" | "google_sheets" | "google_slides" | "grafana" | "granola" | "hubspot" | "jira" | "mixpanel" | "notion" | "posthog" | "prometheus" | "pylon" | "salesforce" | "sentry" | "sigma" | "slack" | "stripe" | "twitter"; label: string; defaultBaseUrl: string; requiresConnectionId: boolean; baseUrlCredentialKey: string | null; auth: string; credentialKeys: readonly string[]; docsUrls: readonly string[]; specUrls: readonly string[]; allowedHostSuffixes: readonly string[]; placeholders: readonly ProviderApiPlaceholder[]; defaultHeaders: Record; examples: readonly ProviderApiExample[]; notes: readonly string[]; accessErrorGuidance: string | null; corpusRecipes: readonly ProviderApiCorpusRecipe[]; templateUses: readonly WorkspaceConnectionTemplateUse[]; }[]; export declare function createProviderApiRuntime(options: ProviderApiRuntimeOptions): ProviderApiRuntime; export declare function fetchProviderApiDocs(options: ProviderApiDocsOptions, runtime?: ProviderApiRuntimeOptions): Promise<{ provider: string; catalog: { id: "amplitude" | "apollo" | "bigquery" | "clay" | "commonroom" | "dataforseo" | "dbt" | "figma" | "fullstory" | "ga4" | "gcloud" | "github" | "gmail" | "gong" | "google_calendar" | "google_drive" | "google_sheets" | "google_slides" | "grafana" | "granola" | "hubspot" | "jira" | "mixpanel" | "notion" | "posthog" | "prometheus" | "pylon" | "salesforce" | "sentry" | "sigma" | "slack" | "stripe" | "twitter"; label: string; defaultBaseUrl: string; requiresConnectionId: boolean; baseUrlCredentialKey: string | null; auth: string; credentialKeys: readonly string[]; docsUrls: readonly string[]; specUrls: readonly string[]; allowedHostSuffixes: readonly string[]; placeholders: readonly ProviderApiPlaceholder[]; defaultHeaders: Record; examples: readonly ProviderApiExample[]; notes: readonly string[]; accessErrorGuidance: string | null; corpusRecipes: readonly ProviderApiCorpusRecipe[]; templateUses: readonly WorkspaceConnectionTemplateUse[]; } | { id: string; label: string; defaultBaseUrl: string; baseUrlCredentialKey: null; auth: string; credentialKeys: string[]; docsUrls: string[]; specUrls: string[]; allowedHostSuffixes: string[]; placeholders: unknown[]; defaultHeaders: Record; examples: unknown[]; notes: string[]; corpusRecipes: unknown[]; templateUses: string[]; custom: boolean; }; guidance: string; } | { guidance?: undefined; provider: string; catalog: { id: "amplitude" | "apollo" | "bigquery" | "clay" | "commonroom" | "dataforseo" | "dbt" | "figma" | "fullstory" | "ga4" | "gcloud" | "github" | "gmail" | "gong" | "google_calendar" | "google_drive" | "google_sheets" | "google_slides" | "grafana" | "granola" | "hubspot" | "jira" | "mixpanel" | "notion" | "posthog" | "prometheus" | "pylon" | "salesforce" | "sentry" | "sigma" | "slack" | "stripe" | "twitter"; label: string; defaultBaseUrl: string; requiresConnectionId: boolean; baseUrlCredentialKey: string | null; auth: string; credentialKeys: readonly string[]; docsUrls: readonly string[]; specUrls: readonly string[]; allowedHostSuffixes: readonly string[]; placeholders: readonly ProviderApiPlaceholder[]; defaultHeaders: Record; examples: readonly ProviderApiExample[]; notes: readonly string[]; accessErrorGuidance: string | null; corpusRecipes: readonly ProviderApiCorpusRecipe[]; templateUses: readonly WorkspaceConnectionTemplateUse[]; } | { id: string; label: string; defaultBaseUrl: string; baseUrlCredentialKey: null; auth: string; credentialKeys: string[]; docsUrls: string[]; specUrls: string[]; allowedHostSuffixes: string[]; placeholders: unknown[]; defaultHeaders: Record; examples: unknown[]; notes: string[]; corpusRecipes: unknown[]; templateUses: string[]; custom: boolean; }; request: { url: string; finalUrl: string; }; response: { status: number; statusText: string; ok: boolean; elapsedMs: number; headers: Record; contentType: string | null; size: number; sizeIsLowerBound?: true | undefined; truncated: boolean; }; content?: import("../extensions/web-content.js").WebContentResult | undefined; }>; export declare function executeProviderApiRequest(args: ProviderApiRequestArgs, runtime: ProviderApiRuntimeOptions): Promise; /** * Resolve a provider OAuth token for a trusted server-side integration bridge * such as a CRM adapter or Google Picker. Callers must keep the result out of * agent, MCP, A2A, logs, persistence, and extension/tool surfaces. The one * exception is the provider's own remote MCP endpoint, which may receive it as * a per-request bearer (`mcp-client/workspace-connection-servers.ts`); it is * still never stored on the server config or shown to the agent. */ export declare function resolveProviderApiOAuthAccessToken(args: { provider: ProviderApiId; connectionId?: string | null; accountId?: string | null; }, runtime: ProviderApiRuntimeOptions): Promise; export declare function listGitHubRepositoryFiles(args: GitHubRepositoryFileListArgs, runtime: ProviderApiRuntimeOptions): Promise; export declare function searchGitHubRepositoryFiles(args: GitHubRepositoryFileSearchArgs, runtime: ProviderApiRuntimeOptions): Promise; export declare function readGitHubRepositoryFile(args: GitHubRepositoryFileReadArgs, runtime: ProviderApiRuntimeOptions): Promise; export declare function writeGitHubRepositoryFile(args: GitHubRepositoryFileWriteArgs, runtime: ProviderApiRuntimeOptions): Promise; export declare function deleteGitHubRepositoryFile(args: GitHubRepositoryFileDeleteArgs, runtime: ProviderApiRuntimeOptions): Promise; export declare function defaultProviderApiCredentialResolver(options: ProviderApiCredentialLookupOptions): Promise; export declare function providerApiResponseOutcomeForUrl(url: string, response: Pick, body: string): Pick;