import http from "node:http";
import https from "node:https";
import { isSetupComplete } from "./setup-status.js";
export { isSetupComplete };
import { SessionManager } from "./agent/session-manager.js";
import { BgProcessManager } from "./agent/bg-process-manager.js";
import { ProjectContextManager } from "./agent/project-context-manager.js";
/** Max WebSocket frame the gateway will accept (S31). The ws default is 100 MiB;
 *  a multi-image prompt frame carries ~3x base64 per image and could silently
 *  trip a close-1009 teardown. Set an explicit, generous cap ABOVE the composer's
 *  aggregate-send guard (src/ui/components/MessageEditor.ts) so the composer
 *  rejects an oversized send with a clear error BEFORE it can tear down the socket. */
export declare const WS_MAX_PAYLOAD_BYTES: number;
type GhExecFileForTests = (args: readonly string[], opts: {
    cwd: string;
    timeout: number;
}) => Promise<string>;
export declare function buildGhPrViewArgs(branch?: string): string[];
export declare function __setGhExecFileForPrStatusTests(fn: GhExecFileForTests | undefined): void;
export declare function __resetPrStatusCachesForTests(): void;
export declare function __getCachedPrStatusForTests(cwd: string, branch?: string, fallbackCwd?: string): Promise<any | null>;
/** Git status result shape (+ optional partial/untrackedIncluded flags). */
export interface GitStatusResult {
    branch: string;
    primaryBranch: string;
    isOnPrimary: boolean;
    /**
     * Actual ref used for `aheadOfPrimary`/`behindPrimary` calculations.
     * Equals `origin/<primaryBranch>` when the remote ref exists, else the
     * bare local branch name `<primaryBranch>`. Surfaced separately from
     * `primaryBranch` so the UI can render the truthful target (a configured
     * `base_ref` of `MyUpstream` is a LOCAL branch — "Merged into
     * origin/MyUpstream" is misleading when origin has no such ref).
     */
    primaryRef: string;
    status: {
        file: string;
        status: string;
    }[];
    hasUpstream: boolean;
    ahead: number;
    behind: number;
    aheadOfPrimary: number;
    behindPrimary: number;
    mergedIntoPrimary: boolean;
    insertionsVsPrimary: number;
    deletionsVsPrimary: number;
    clean: boolean;
    summary: string;
    unpushed: boolean;
    /** true if porcelain (Phase B) was skipped or timed-out */
    partial?: boolean;
    /** true only when ?untracked=1 was passed (-uall); false on default -uno */
    untrackedIncluded?: boolean;
}
export declare function __getGitStatusInvocationCount(): number;
export declare function __resetGitStatusInvocationCount(): void;
/** Test-only hook: if set, replaces the real `runBatchGitStatus` git-spawn
 *  path with a fake. Used by `tests/e2e/git-status-caching.spec.ts` to
 *  exercise the TTL/single-flight/coalesce logic deterministically without
 *  spawning Git Bash under CI load (which fails unpredictably). Production
 *  code never sets this. */
declare let _gitStatusFake: ((cwd: string, containerId?: string, opts?: {
    untracked?: boolean;
    configuredBaseRef?: string;
}) => Promise<GitStatusResult | null>) | undefined;
export declare function __setGitStatusFake(fn: typeof _gitStatusFake): void;
export declare function __clearGitStatusFake(): void;
/** Invalidate both summary and untracked cache entries for a cwd (optionally
 *  scoped to a container). Call after any local git mutation (commit, pull,
 *  push, rebase, merge). */
export declare function invalidateGitStatusCache(cwd: string, containerId?: string): void;
/** Test-only: mark all cache entries for a cwd as TTL-expired without
 *  sleeping. Used by `tests/e2e/git-status-caching.spec.ts` to deterministically
 *  exercise the TTL re-run path without inflating wall-clock time. Sets
 *  `resolvedAt` to a timestamp older than `GIT_STATUS_TTL_MS` so the next
 *  call falls through to a fresh invocation. */
export declare function __forceGitStatusCacheExpiry(cwd: string, containerId?: string): void;
export interface TlsConfig {
    cert: string;
    key: string;
    caCert?: string;
}
export interface GatewayConfig {
    host: string;
    port: number;
    portExplicit?: boolean;
    authToken: string;
    defaultCwd: string;
    staticDir?: string;
    agentCliPath?: string;
    systemPromptPath?: string;
    tls?: TlsConfig;
    /** Force auth even on localhost (used by E2E tests). */
    forceAuth?: boolean;
}
export declare function createGateway(config: GatewayConfig): {
    server: http.Server<typeof http.IncomingMessage, typeof http.ServerResponse> | https.Server<typeof http.IncomingMessage, typeof http.ServerResponse>;
    sessionManager: SessionManager;
    bgProcessManager: BgProcessManager;
    projectContextManager: ProjectContextManager;
    start(): Promise<number>;
    shutdown(): Promise<void>;
};
//# sourceMappingURL=server.d.ts.map