import { f as IntegrationActionRisk, g as IntegrationDataClass, d as IntegrationConnectorCategory, e as IntegrationConnectorAction, G as IntegrationConnectorTrigger, b as IntegrationConnector } from './core-types-CjWifQOf.js';
import './types-Bxg-wJkW.js';

type IntegrationAuthMode = 'oauth2' | 'api_key' | 'hmac' | 'none' | 'custom';
type IntegrationSpecStatus = 'catalog' | 'executable' | 'deprecated';
type IntegrationFamilyId = 'google' | 'microsoft-graph' | 'atlassian' | 'salesforce' | 'hubspot' | 'slack' | 'notion' | 'standard-oauth2' | 'api-key' | 'hmac' | 'none';
type NormalizedPermission = `${string}.read` | `${string}.write` | `${string}.delete` | `${string}.admin`;
interface IntegrationSpec {
    kind: string;
    title: string;
    category: IntegrationConnectorCategory;
    status: IntegrationSpecStatus;
    family: IntegrationFamilyId;
    auth: IntegrationAuthSpec;
    permissions: PermissionDescriptor[];
    actions: IntegrationConnectorAction[];
    triggers?: IntegrationConnectorTrigger[];
    setup: IntegrationSetupSpec;
    lifecycle?: IntegrationLifecycleSpec;
    plannerHints?: IntegrationPlannerHints;
    metadata?: Record<string, unknown>;
}
type IntegrationAuthSpec = OAuth2AuthSpec | ApiKeyAuthSpec | HmacAuthSpec | NoneAuthSpec | CustomAuthSpec;
interface OAuth2AuthSpec {
    mode: 'oauth2';
    authorizationUrl: string;
    tokenUrl: string;
    clientIdEnv?: string;
    clientSecretEnv?: string;
    scopes: ScopeDescriptor[];
    extraAuthParams?: Record<string, string>;
    redirectUriTemplate: string;
    pkce?: 'required' | 'supported' | 'unsupported';
}
interface ApiKeyAuthSpec {
    mode: 'api_key';
    credential: CredentialFieldSpec;
    placement?: 'bearer' | 'header' | 'query' | 'basic';
}
interface HmacAuthSpec {
    mode: 'hmac';
    credential: CredentialFieldSpec;
    signatureHeader?: string;
}
interface NoneAuthSpec {
    mode: 'none';
}
interface CustomAuthSpec {
    mode: 'custom';
    description: string;
}
interface ScopeDescriptor {
    normalized: NormalizedPermission;
    providerScope: string;
    title: string;
    reason: string;
    risk: IntegrationActionRisk;
    dataClass: IntegrationDataClass;
}
interface PermissionDescriptor {
    normalized: NormalizedPermission;
    providerScopes: string[];
    title: string;
    risk: IntegrationActionRisk;
    dataClass: IntegrationDataClass;
    reason: string;
}
interface CredentialFieldSpec {
    label: string;
    description: string;
    env?: string;
    example?: string;
    regex?: string;
    secret: boolean;
}
interface ConsoleStep {
    id: string;
    title: string;
    detail: string;
    copyValue?: string;
}
interface Quirk {
    id: string;
    severity: 'info' | 'warning' | 'critical';
    message: string;
}
interface PostSetupCheck {
    id: string;
    title: string;
    detail: string;
}
interface HealthcheckSpec {
    id: string;
    level: 'client_config' | 'connection' | 'webhook' | 'static';
    method?: 'GET' | 'POST';
    url?: string;
    expectedStatus?: number[];
    description: string;
}
interface IntegrationSetupSpec {
    consoleUrl?: string;
    consoleSteps: ConsoleStep[];
    credentialFields: CredentialFieldSpec[];
    redirectUriTemplate?: string;
    knownQuirks?: Quirk[];
    postSetup?: PostSetupCheck[];
    healthcheck?: HealthcheckSpec;
}
interface IntegrationLifecycleSpec {
    supportsRefresh: boolean;
    supportsRevoke: boolean;
    supportsIncrementalAuth: boolean;
    recommendedHealthcheckIntervalHours?: number;
    freshnessSloMinutes?: number;
}
interface IntegrationPlannerHints {
    useFor: string[];
    avoidFor?: string[];
    dataFreshness: 'realtime' | 'near_realtime' | 'eventual' | 'manual';
    writeRisk: 'low' | 'medium' | 'high';
}
interface IntegrationFamilySpec {
    id: IntegrationFamilyId;
    title: string;
    authMode: IntegrationAuthMode;
    consoleUrl?: string;
    authorizationUrl?: string;
    tokenUrl?: string;
    redirectUriTemplate?: string;
    credentialFields: CredentialFieldSpec[];
    consoleSteps: ConsoleStep[];
    knownQuirks?: Quirk[];
    lifecycle: IntegrationLifecycleSpec;
}
interface IntegrationSpecValidationIssue {
    path: string;
    message: string;
}
interface IntegrationSpecValidationResult {
    ok: boolean;
    issues: IntegrationSpecValidationIssue[];
}
interface RenderSpecOptions {
    host: string;
    callbackPath?: string;
}
interface RenderedConsoleStep extends ConsoleStep {
    detail: string;
    copyValue?: string;
}
interface CredentialValidationInput {
    field: CredentialFieldSpec;
    value: string;
}
interface CredentialValidationResult {
    ok: boolean;
    field: string;
    message?: string;
}
interface HealthcheckPlan {
    kind: string;
    healthcheck: HealthcheckSpec;
    requires: Array<'client_id' | 'client_secret' | 'api_key' | 'hmac_secret' | 'connection_credentials'>;
    message: string;
}
declare function specAuthToConnectorAuth(auth: IntegrationAuthSpec): IntegrationConnector['auth'];

declare const INTEGRATION_FAMILIES: Record<IntegrationFamilyId, IntegrationFamilySpec>;
declare function getIntegrationFamily(id: IntegrationFamilyId): IntegrationFamilySpec;

declare function listIntegrationSpecs(): IntegrationSpec[];
declare function getIntegrationSpec(kind: string): IntegrationSpec | undefined;
/** Auth-driving descriptor the hub uses to start a connect flow per provider
 *  instead of hard-coding scopes/auth kind. Derived from the spec catalog
 *  ({@link getIntegrationSpec}); undefined when the kind is not in the
 *  catalog. */
interface ConnectorAuthSpec {
    kind: string;
    authKind: 'oauth2' | 'api_key' | 'none' | 'custom';
    /** Provider scopes to request in the authorization grant. Empty for
     *  api_key / none / custom. */
    requestedScopes: string[];
    /** OAuth-only: authorization + token endpoints and PKCE posture. Present
     *  only when authKind === 'oauth2'. */
    authorizationUrl?: string;
    tokenUrl?: string;
    pkce?: 'required' | 'supported' | 'unsupported';
    redirectUriTemplate?: string;
    clientIdEnv?: string;
    clientSecretEnv?: string;
    extraAuthParams?: Record<string, string>;
}
declare function resolveConnectorAuthSpec(kind: string): ConnectorAuthSpec | undefined;
declare function listExecutableIntegrationSpecs(): IntegrationSpec[];
declare function integrationSpecToConnector(spec: IntegrationSpec, providerId?: string): IntegrationConnector;

declare function renderConsoleSteps(spec: IntegrationSpec, options: RenderSpecOptions): RenderedConsoleStep[];
declare function renderRunbookMarkdown(spec: IntegrationSpec, options: RenderSpecOptions): string;
declare function renderAgentToolDescription(spec: IntegrationSpec): string;
declare function buildHealthcheckPlan(spec: IntegrationSpec): HealthcheckPlan;
declare function consoleStepsToText(steps: ConsoleStep[]): string;

declare function validateIntegrationSpec(spec: IntegrationSpec): IntegrationSpecValidationResult;
declare function assertValidIntegrationSpec(spec: IntegrationSpec): void;
declare function validateCredentialFormat(field: CredentialFieldSpec, value: string): CredentialValidationResult;
declare function validateCredentialSet(spec: IntegrationSpec, values: Record<string, string>): CredentialValidationResult[];

export { type ApiKeyAuthSpec, type ConnectorAuthSpec, type ConsoleStep, type CredentialFieldSpec, type CredentialValidationInput, type CredentialValidationResult, type CustomAuthSpec, type HealthcheckPlan, type HealthcheckSpec, type HmacAuthSpec, INTEGRATION_FAMILIES, type IntegrationAuthMode, type IntegrationAuthSpec, type IntegrationFamilyId, type IntegrationFamilySpec, type IntegrationLifecycleSpec, type IntegrationPlannerHints, type IntegrationSetupSpec, type IntegrationSpec, type IntegrationSpecStatus, type IntegrationSpecValidationIssue, type IntegrationSpecValidationResult, type NoneAuthSpec, type NormalizedPermission, type OAuth2AuthSpec, type PermissionDescriptor, type PostSetupCheck, type Quirk, type RenderSpecOptions, type RenderedConsoleStep, type ScopeDescriptor, assertValidIntegrationSpec, buildHealthcheckPlan, consoleStepsToText, getIntegrationFamily, getIntegrationSpec, integrationSpecToConnector, listExecutableIntegrationSpecs, listIntegrationSpecs, renderAgentToolDescription, renderConsoleSteps, renderRunbookMarkdown, resolveConnectorAuthSpec, specAuthToConnectorAuth, validateCredentialFormat, validateCredentialSet, validateIntegrationSpec };
