import { type ProviderAuthority } from "./tmux-common"; import { type OwnerIsolationProbeSync, type OwnerVerdict, type PlanResponse, type TmuxOwnerIsolationExecutionDependencies, type TmuxOwnerIsolationExecutionResult } from "./tmux-owner-isolation"; export interface GjcTmuxSessionStatus { name: string; attached: boolean; windows: number; panes: number; bindings: string; createdAt: string; branch?: string; branchSlug?: string; project?: string; sessionId?: string; sessionStateFile?: string; version?: string; ownerGeneration?: string; nativeSessionId?: string; psmuxIncarnation?: string; /** Exact durable provider binding used to discover this psmux session. */ providerAuthority?: ProviderAuthority; panePids: number[]; profile?: string; } export interface GjcTmuxSessionTagsForGc { profile?: string; project?: string; branch?: string; branchSlug?: string; sessionId?: string; sessionStateFile?: string; version?: string; ownerGeneration?: string; nativeSessionId?: string; psmuxIncarnation?: string; createdAt?: string; attached?: boolean; panePids?: number[]; } export interface GjcTmuxSessionsForGc { tagged: GjcTmuxSessionStatus[]; untagged: GjcTmuxSessionStatus[]; } export interface ProvenTmuxSessionIdentity { nativeSessionId: string; serverPid: number; serverStartTime: string; psmuxIncarnation?: string; } export interface ExpectedGjcTmuxSessionIdentity { nativeSessionId: string; ownerGeneration: string; sessionId: string; sessionStateFile: string; project: string; createdAt: string; psmuxIncarnation?: string; } export interface ExactOwnerIdentity { sessionId: string; stateDir: string; socketKey: string; generation: string; pid: number; startTime: string; } export interface ForceCloseOwnerDependencies { resolveOwner(sessionName: string, env: NodeJS.ProcessEnv): Promise; signalTerm(pid: number): void; readProcessStartTime(pid: number): Promise; cleanupSession(sessionTarget: string, env: NodeJS.ProcessEnv): void; now(): Date; sleep(ms: number): Promise; listPanePids(sessionName: string, env: NodeJS.ProcessEnv): number[]; /** Test/runtime seam for an exact owner-exit observer; durable validation remains authoritative. */ waitForOwnerExitVerdict?(): Promise; } export interface CreateGjcTmuxSessionOptions { platform?: NodeJS.Platform; } export type CreateOwnerIsolationTestDependencies = { probe?: Partial; execute?: (plan: PlanResponse, deps: TmuxOwnerIsolationExecutionDependencies) => TmuxOwnerIsolationExecutionResult; }; /** @internal Test-only seam; production create always uses live fail-closed probes. */ export declare function __setCreateOwnerIsolationForTests(dependencies: CreateOwnerIsolationTestDependencies | null): void; /** @internal Test-only seam; production mutations always use live fail-closed proofs. */ export declare function __setMutationServerProofForTests(dependency: ((tmuxCommand: string, env: NodeJS.ProcessEnv) => unknown) | null): void; export declare function listGjcTmuxSessions(env?: NodeJS.ProcessEnv): GjcTmuxSessionStatus[]; /** @internal */ export declare function listTmuxSessionsForGc(env?: NodeJS.ProcessEnv): GjcTmuxSessionsForGc; export declare function findGjcTmuxSessionByBranch(branch: string, env?: NodeJS.ProcessEnv, project?: string | null): GjcTmuxSessionStatus | undefined; export declare function findGjcTmuxSessionByName(sessionName: string, env?: NodeJS.ProcessEnv): GjcTmuxSessionStatus | undefined; export declare function findGjcTmuxSessionByScope(project: string, branch: string | null | undefined, env?: NodeJS.ProcessEnv): GjcTmuxSessionStatus | undefined; export declare function statusGjcTmuxSession(sessionName: string, env?: NodeJS.ProcessEnv): GjcTmuxSessionStatus; export declare function createGjcTmuxSession(env?: NodeJS.ProcessEnv, options?: CreateGjcTmuxSessionOptions): GjcTmuxSessionStatus; /** Proves a managed reusable name still resolves to one immutable session on one server. */ export declare function proveGjcTmuxSessionMutationTarget(sessionName: string, env?: NodeJS.ProcessEnv, provisionalAuthority?: ProviderAuthority): ProvenTmuxSessionIdentity; /** @internal */ export declare function readTmuxSessionTagsForGc(sessionName: string, env?: NodeJS.ProcessEnv): GjcTmuxSessionTagsForGc; export declare function removeGjcTmuxSession(sessionName: string, env?: NodeJS.ProcessEnv, expectedIdentity?: ExpectedGjcTmuxSessionIdentity): GjcTmuxSessionStatus; /** * Requests an exact tagged owner shutdown. Session cleanup is compatibility-only * and follows a validated SIGTERM verdict; it never authorizes the close. */ export declare function forceCloseGjcTmuxSession(sessionName: string, env?: NodeJS.ProcessEnv, expectedSessionId?: string, expectedStateFile?: string, deps?: Partial): Promise; export declare function attachGjcTmuxSession(sessionName: string, env?: NodeJS.ProcessEnv): never;