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", "ga4", "gcloud", "github", "figma", "gmail", "gong", "google_calendar", "google_drive", "google_slides", "granola", "grafana", "hubspot", "salesforce", "jira", "mixpanel", "notion", "posthog", "prometheus", "pylon", "sentry", "slack", "stripe", "twitter"]; export type ProviderApiId = (typeof PROVIDER_API_IDS)[number]; export type ProviderApiMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD"; /** Cursor-pagination config for fetchAllPages. */ export interface FetchAllPagesConfig { /** * Dot-path into the JSON response body where the next-page cursor lives, * e.g. "meta.next_cursor" or "pagination.next_page_token". */ cursorPath: string; /** * Query parameter name to pass the cursor on the next request, * e.g. "cursor" or "page_token". */ cursorParam?: string; /** * Dot-path in the JSON request body to set to the cursor on the next request. * Use this for POST-body pagination, e.g. Gong's top-level `cursor`. */ cursorBodyPath?: string; /** * Dot-path to the items array in each response body. * When omitted, the whole response body is appended to the items array. */ itemsPath?: string; /** * Maximum number of pages to fetch. Default 10, max 50. */ maxPages?: number; } export interface ProviderApiRequestArgs { provider: ProviderApiId | string; method?: ProviderApiMethod; path: string; query?: unknown; headers?: Record; body?: unknown; auth?: "default" | "none"; timeoutMs?: number; maxBytes?: number; connectionId?: string | null; accountId?: string | null; /** * When set, write the full response body to this workspace file path instead * of returning it in context. Returns a compact summary with status, bytes, * path, and a preview. Allows up to 20 MB (vs the normal 4 MB context limit). */ saveToFile?: string; /** * When set, automatically paginate by cursor until the cursor field is empty * or maxPages is reached. Accumulates items from itemsPath (or whole bodies) * across all pages. Combine with saveToFile to write the full dataset. */ 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[]; } | { type: "oauth-bearer"; oauthProvider: string; tokenLabel: 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; baseUrlCredentialKey?: string; auth: ProviderApiAuthKind; credentialKeys: readonly string[]; docsUrls: readonly string[]; specUrls?: readonly string[]; allowedHostSuffixes?: readonly string[]; defaultHeaders?: Record; placeholders?: readonly ProviderApiPlaceholder[]; examples?: readonly ProviderApiExample[]; notes?: readonly string[]; accessErrorGuidance?: string; corpusRecipes?: readonly ProviderApiCorpusRecipe[]; templateUses?: readonly WorkspaceConnectionTemplateUse[]; } 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; } 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)[]; /** App-owned definitions replace matching built-ins by id without dropping other providers. */ providerOverrides?: readonly ProviderApiConfig[]; localCredentialSource?: string; getCredentialContext?: () => CredentialContext | null; resolveCredential?: ProviderApiCredentialResolver; /** * Template-specific OAuth token provider overrides for built-in provider API * configs. Use when an app stores a provider's OAuth grant under a narrower * local provider id, e.g. Google Drive scoped to a "google-docs" connection. */ oauthProviderOverrides?: Record; /** * Optional loader for custom providers registered at runtime. When provided, * custom providers are merged with the static built-in registry for catalog, * docs, and request operations. Custom providers cannot shadow built-in ids. */ 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; 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 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" | "figma" | "ga4" | "gcloud" | "github" | "gmail" | "gong" | "google_calendar" | "google_drive" | "google_slides" | "grafana" | "granola" | "hubspot" | "jira" | "mixpanel" | "notion" | "posthog" | "prometheus" | "pylon" | "salesforce" | "sentry" | "slack" | "stripe" | "twitter"; label: string; defaultBaseUrl: string; requiresConnectionId: boolean; baseUrlCredentialKey: string; 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; 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" | "figma" | "ga4" | "gcloud" | "github" | "gmail" | "gong" | "google_calendar" | "google_drive" | "google_slides" | "grafana" | "granola" | "hubspot" | "jira" | "mixpanel" | "notion" | "posthog" | "prometheus" | "pylon" | "salesforce" | "sentry" | "slack" | "stripe" | "twitter"; label: string; defaultBaseUrl: string; requiresConnectionId: boolean; baseUrlCredentialKey: string; 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; corpusRecipes: readonly ProviderApiCorpusRecipe[]; templateUses: readonly WorkspaceConnectionTemplateUse[]; } | { id: string; label: string; defaultBaseUrl: string; baseUrlCredentialKey: any; 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" | "figma" | "ga4" | "gcloud" | "github" | "gmail" | "gong" | "google_calendar" | "google_drive" | "google_slides" | "grafana" | "granola" | "hubspot" | "jira" | "mixpanel" | "notion" | "posthog" | "prometheus" | "pylon" | "salesforce" | "sentry" | "slack" | "stripe" | "twitter"; label: string; defaultBaseUrl: string; requiresConnectionId: boolean; baseUrlCredentialKey: string; 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; corpusRecipes: readonly ProviderApiCorpusRecipe[]; templateUses: readonly WorkspaceConnectionTemplateUse[]; } | { id: string; label: string; defaultBaseUrl: string; baseUrlCredentialKey: any; 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; }; response: { status: number; statusText: string; ok: boolean; elapsedMs: number; headers: Record; contentType: string; size: number; truncated: boolean; }; content?: import("../extensions/web-content.js").WebContentResult; }>; 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. */ 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; //# sourceMappingURL=index.d.ts.map