import type { Kysely } from "kysely";
/**
 * Minimal Kubernetes surface for service rollout-restarts. Defined as an
 * interface so the resolver can be unit-tested with a stub and the
 * production implementation can be lazy-loaded (avoids paying the
 * @kubernetes/client-node import cost in tests).
 */
export interface RestartK8sClient {
    /** Names of Deployments in `namespace` matching the label selector. */
    listDeploymentNames(namespace: string, labelSelector: string): Promise<string[]>;
    /**
     * Trigger a rolling restart of one Deployment by stamping the standard
     * `kubectl.kubernetes.io/restartedAt` pod-template annotation (same
     * mechanism as `kubectl rollout restart`). Throws DEPLOYMENT_NOT_FOUND
     * if the Deployment is gone (404).
     */
    restartDeployment(namespace: string, name: string, restartedAt: string): Promise<void>;
}
export type RestartResolverDeps = {
    /** Kysely handle for the processor's `vetra-cloud-environments` namespace. */
    envDb: Kysely<any>;
    k8s: RestartK8sClient;
};
/** Auth context shape injected by reactor-api into resolver `context`. */
type Caller = {
    user?: {
        address: string;
    };
    isAdmin?: (address: string) => boolean;
};
/**
 * Build the Deployment label selector for a service. Agents (CLINT) are
 * disambiguated by their prefix via the chart's `clint.vetra.io/agent`
 * label; CONNECT/SWITCHBOARD select by the chart's component label. There
 * is exactly one Deployment per (env, component) and per (env, agent),
 * so the caller treats >1 match as AMBIGUOUS_SERVICE.
 */
export declare function deploymentSelector(service: string, agentPrefix: string | null | undefined): string;
/**
 * `restartEnvironmentService` resolver. Owner-or-admin gated. Resolves the
 * target Deployment by label (robust to the chart's 63-char name
 * truncation) and triggers a rolling restart. The env's k8s namespace is
 * its `tenantId` (the chart deploys each environment into a namespace named
 * for its tenantId).
 *
 * Errors (plain `Error("CODE")`, matching the subgraph convention):
 * RESTART_NOT_CONFIGURED, UNAUTHENTICATED, ENV_NOT_FOUND, FORBIDDEN,
 * AMBIGUOUS_SERVICE, DEPLOYMENT_NOT_FOUND.
 */
export declare function createRestartResolver(deps?: RestartResolverDeps): {
    Mutation: {
        restartEnvironmentService: (_parent: unknown, { tenantId, service, agentPrefix, }: {
            tenantId: string;
            service: string;
            agentPrefix?: string | null;
        }, ctx: Caller) => Promise<{
            ok: boolean;
            deploymentName: string;
            message: null;
        }>;
    };
};
/**
 * Production implementation. Uses the in-cluster ServiceAccount via
 * `loadFromCluster()` (the subgraph runs in-cluster). RBAC grants
 * `apps/deployments: get, list, patch` cluster-wide.
 */
export declare function createDefaultRestartK8sClient(): Promise<RestartK8sClient>;
export {};
//# sourceMappingURL=restart.d.ts.map