/** A single harness's discovery rule. */ export interface HarnessDiscovery { /** * Documented env var name the harness exposes to MCP child processes. * Empty string means "no env-var path; file only" (rare). */ envVar: string; /** * Optional thunk returning a state file path. The file is expected to * contain a single line whose `parse()` produces a 32-hex context_id. * Function form (not static string) supports dynamic resolution like * per-parent-PID isolation (process.ppid). * * The writer responsibility lives outside this library: typically a * harness-specific SessionStart hook in the operator's hooks directory. * The file convention is documented per discovery entry. */ fallbackFile?: (env?: NodeJS.ProcessEnv) => string; /** * Parse a candidate value (from env or file) into a 32-hex context_id, * or return null if the value cannot produce one. Pure function; no * side effects. Whitespace already trimmed by the caller. */ parse(value: string): string | null; } /** * Registered harnesses, ordered most-canonical first. Adding a new entry * here is the implementation step for a new ยง9 integration pattern that * lands harness-aware context discovery; the ADR governing each entry * should be cross-referenced from the comment. */ export declare const KNOWN_HARNESS_DISCOVERIES: readonly HarnessDiscovery[]; /** * Resolve an effective context_id from environment and harness state * files, applying precedence: * * 1. ATRIB_CONTEXT_ID env (D078; explicit operator/harness intent) * 2. For each KNOWN_HARNESS_DISCOVERIES entry, in order: * 2a. discovery.envVar in env (D083 v1; per-session-spawn harnesses) * 2b. discovery.fallbackFile() readable + parseable (D083 v2; * startup-spawn harnesses like Claude Code MCP children) * 3. undefined (caller falls through to its own resolution chain; * typically synthesizes a fresh genesis chain_root + warning) * * Returns a validated 32-hex string or undefined. Never throws. * * The env-vs-file order within each discovery favors env when both are * set: env is more immediate (set by the process spawner explicitly) * while file is a fallback for cases env can't reach. If a harness * intentionally overrides via env, that should win over a stale file. */ export declare function resolveEnvContextId(env?: NodeJS.ProcessEnv): string | undefined; //# sourceMappingURL=harness-context.d.ts.map