import type { Args } from "../cli/args"; import { buildGjcTmuxExactSessionTarget, buildGjcTmuxProfileCommands, GJC_DEFAULT_TMUX_SESSION, GJC_TMUX_COMMAND_ENV, GJC_TMUX_MOUSE_ENV, GJC_TMUX_PROFILE_ENV, GJC_TMUX_SESSION_PREFIX, type GjcTmuxProfileCommand, type ProviderAuthority } from "./tmux-common"; import { type OwnerGenerationBaseline, type OwnerIsolationProbeSync } from "./tmux-owner-isolation"; import { buildWindowsPowerShellInnerCommand, GJC_TMUX_LAUNCHED_ENV, type WindowsPowerShellInnerCommandOptions } from "./windows-powershell-command"; export type { WindowsPowerShellInnerCommandOptions }; export { buildGjcTmuxExactSessionTarget, buildGjcTmuxProfileCommands, buildWindowsPowerShellInnerCommand, GJC_DEFAULT_TMUX_SESSION, GJC_TMUX_COMMAND_ENV, GJC_TMUX_LAUNCHED_ENV, GJC_TMUX_MOUSE_ENV, GJC_TMUX_PROFILE_ENV, GJC_TMUX_SESSION_PREFIX, }; export declare const GJC_LAUNCH_POLICY_ENV = "GJC_LAUNCH_POLICY"; export declare const GJC_TMUX_WINDOW_LABEL_MAX_WIDTH = 48; interface TtyState { stdin: boolean; stdout: boolean; columns?: number; rows?: number; } export interface TmuxLaunchContext { parsed: Args; rawArgs: string[]; cwd?: string; env?: NodeJS.ProcessEnv; argv?: string[]; execPath?: string; platform?: NodeJS.Platform; tty?: TtyState; spawnSync?: TmuxSpawnSync; /** * Provider authority boundaries. Production resolves, persists, and asserts * the durable psmux authority; tests may inject deterministic equivalents. */ providerAuthorityResolver?: (input: { platform: NodeJS.Platform; env: NodeJS.ProcessEnv; command: string; stateDir: string; sessionId: string; generation: string; }) => ProviderAuthority; providerAuthorityPersist?: (authority: ProviderAuthority) => void; /** Re-proves an immutable staged authority before generation publication. */ providerAuthorityStagedAssert?: (authority: ProviderAuthority) => void; /** Re-proves a current authority after generation publication. */ providerAuthorityAssert?: (authority: ProviderAuthority) => void; tmuxAvailable?: boolean; tmuxStatusLines?: number; worktreeBranch?: string | null; currentBranch?: string | null; existingBranchSessionName?: string | null; project?: string | null; diagnosticWriter?: (message: string) => void; /** * Synchronous owner-isolation proof boundary for managed tmux creation. * Production uses Linux /proc probes; callers may inject deterministic proofs. */ ownerIsolationProbe?: OwnerIsolationProbeSync; /** Test seam for deterministic default-probe caller cgroup classification. */ callerCgroupReader?: () => string | null; } export interface TmuxSpawnResult { exitCode: number | null; signalCode?: string | null; stderr?: string; stdout?: string; } export interface TmuxTerminalSize { columns: number; rows: number; } export type TmuxSpawnSync = (command: string, args: string[], options: TmuxSpawnOptions) => TmuxSpawnResult; export interface TmuxSpawnOptions { cwd: string; env: NodeJS.ProcessEnv; stdin: "inherit" | "pipe"; stdout: "inherit" | "pipe"; stderr: "inherit" | "pipe"; /** * Captures control-plane stderr for sanitized, bounded diagnostics. PTY-bound * commands retain inherited stderr for multiplexer compatibility. */ captureStderr?: boolean; /** Internal scoped-bootstrap input; never used for ordinary tmux commands. */ stdinLine?: string; } export interface TmuxLaunchPlan { tmuxCommand: string; sessionName: string; cwd: string; innerCommand: string; newSessionArgs: string[]; initialSize?: TmuxTerminalSize; branch?: string | null; attachSessionName?: string; project?: string | null; sessionId?: string | null; sessionStateFile?: string | null; /** Immutable Linux-managed owner provenance, assigned immediately before creation. */ ownerGeneration?: string; /** Immutable run and endpoint identities bound into the supervised command. */ ownerRunId?: string; ownerIncarnation?: string; /** Generation state captured before owner-isolation planning; required for publication CAS. */ ownerGenerationBaseline?: OwnerGenerationBaseline; /** One-shot coordinator signing bootstrap endpoint; key material never enters tmux argv or environment. */ coordinatorSidecarBootstrap?: { path: string; keyId: string; }; coordinatorSidecarBootstrapClose?: () => void; /** Native tmux session identity emitted atomically by `new-session -P -F`. */ createdSessionId?: string; /** Safe server identity proven immediately after creation. */ createdServerIdentity?: { pid: number; startTime: string; pidProven?: boolean; }; isPsmux: boolean; authority?: ProviderAuthority; platform: NodeJS.Platform; } export interface GjcTmuxProfileResult { skipped: boolean; commands: GjcTmuxProfileCommand[]; failures: Array<{ command: GjcTmuxProfileCommand; stderr?: string; }>; } export interface GjcTmuxProfileContext { tmuxCommand: string; target: string; cwd?: string; env?: NodeJS.ProcessEnv; spawnSync?: TmuxSpawnSync; branch?: string | null; branchSlug?: string | null; project?: string | null; sessionId?: string | null; sessionStateFile?: string | null; ownerGeneration?: string | null; ownerServerKey?: string | null; version?: string | null; psmuxIncarnation?: string | null; } export declare function applyGjcTmuxProfile(context: GjcTmuxProfileContext): GjcTmuxProfileResult; export declare function buildGjcTmuxWindowTitle(cwd: string, branch: string | null | undefined): string; export declare function buildDefaultTmuxLaunchPlan(context: TmuxLaunchContext): TmuxLaunchPlan | undefined; export declare function launchDefaultTmuxIfNeeded(context: TmuxLaunchContext): boolean;