/**
 * Shared helpers for orchestrator entry points (server.ts and standalone.ts).
 *
 * Extracted to eliminate code duplication between the two entry points.
 * Both entry points import these helpers instead of maintaining separate copies.
 */
import { type SourceProvider, SourceSubtype } from '@kici-dev/engine';
import { ProviderRegistry } from './provider-registry.js';
/**
 * A provider source for Platform registration.
 *
 * `provider` is the coarse-grained Platform-routing family (`github` /
 * `gitlab` / `bitbucket` / `generic`). `subtype` is the fine-grained
 * source kind that survives all the way to the dashboard so universal-git,
 * generic_webhook, and internal sources stay distinguishable. `name` is
 * the human-readable label shown in the runs view + sources tab.
 */
export interface ProviderSource {
    provider: SourceProvider;
    routingKey: string;
    name: string;
    subtype: SourceSubtype;
}
/**
 * Map a generic_webhook_sources `provider_type` (plus optional `git_config`
 * presence) to the canonical {@link SourceSubtype}.
 *
 * Single source of truth for the orchestrator-side mapping — both the
 * boot-time bulk registration (`server.ts`) and any future per-source
 * register/update path (`platform-client.ts`) go through here so the
 * subtype emitted to Platform stays consistent with what the dashboard
 * eventually renders.
 */
export declare function genericProviderTypeToSubtype(providerType: string, options: {
    hasGitConfig: boolean;
}): SourceSubtype;
/**
 * Extract repo identifier (owner/repo) from a git clone URL.
 * e.g., "https://github.com/myorg/myrepo.git" -> "myorg/myrepo"
 */
export declare function extractRepoIdentifier(repoUrl: string): string;
/**
 * Diff two provider source arrays by routingKey.
 * Returns which sources were added and which were removed.
 *
 * Used during config reload to determine which source.register and
 * source.deregister messages to send.
 */
export declare function diffProviderSources(oldSources: ProviderSource[], newSources: ProviderSource[]): {
    added: ProviderSource[];
    removed: ProviderSource[];
};
/**
 * Register the internal provider bundle for E2E testing when the
 * `internalProviderRepoPath` config field (KICI_INTERNAL_PROVIDER_REPO_PATH)
 * is set.
 *
 * When the field is present, this overwrites the previously-registered
 * `generic:default` bundle with one that has a lockFileFetcher and
 * repoUrlBuilder (needed for the webhook pipeline to match triggers and
 * dispatch jobs).
 *
 * When the field is not set, does nothing (leaves `generic:default` as-is).
 *
 * @returns true if the internal provider was registered, false otherwise
 */
export declare function registerInternalProviderIfConfigured(registry: ProviderRegistry, config: {
    internalProviderRepoPath?: string;
    internalProviderCloneUrl?: string;
}): boolean;
/**
 * Decide whether the local orchestrator can serve a `generic_webhook_sources`
 * row with the given `provider_type`. Used at boot (and any future reload) to
 * filter the source.register payload sent to Platform — if a peer can't serve
 * the row, advertising it would invite Platform's least-loaded relay to pick
 * this peer and drop the webhook silently in a pipeline whose lock-file
 * fetcher returns null.
 *
 * - `'generic'` / `'universal-git'` → always servable (the bundles register
 *   without filesystem dependencies; per-row failures during universal-git
 *   bundle registration are already isolated in orchestrator-core.ts).
 * - `'internal'` → only servable when `internalProviderRepoPath` is set, the
 *   path exists on disk, and is a directory. This mirrors the fail-fast
 *   guard in `registerInternalProviderIfConfigured`. The check is binary
 *   per peer: a single `KICI_INTERNAL_PROVIDER_REPO_PATH` backs every
 *   internal source on that peer (per-source `repoIdentifier`s nest under
 *   the same base dir).
 * - Any unknown provider_type returns false to fail closed.
 */
export declare function canServeGenericProviderType(providerType: string, config: {
    internalProviderRepoPath?: string;
}): boolean;
//# sourceMappingURL=entry-helpers.d.ts.map