/**
 * SelfUnblockProbeProviders — the PRODUCTION probe providers that wire
 * SelfUnblockChecklist to the real world. This is the PRODUCER half of
 * "Self-Unblock Before Escalating" (docs/specs/self-unblock-before-escalating.md):
 * SelfUnblockChecklist (the runner), DurableVaultSession (the warm org-vault
 * session), and BlockerLedger (the verifier) already exist — but until this file
 * NOTHING in production instantiates the checklist with REAL providers, so a
 * credential-blocker could never be settled (the gate demands a run that could
 * not be produced). This closes that gap.
 *
 * The checklist runner owns the deterministic relevance match and the per-class
 * timeout; a provider's ONLY job is to (a) reach its source and (b) report the
 * NON-SECRET scope tags that source ADVERTISES, so the runner can match them.
 *
 * HARD SAFETY RULES (a violation is a bug — the prior incident spiked machine
 * load to ~70 from a recursive grep; never repeat that):
 *   (a) A provider NEVER returns or logs a secret VALUE. It returns ONLY
 *       `{ reachable, advertisedScopeTags?, detail? }`, where advertisedScopeTags
 *       are non-secret scope strings (zone/project/service names).
 *   (b) Each provider does AT MOST ONE bounded call — a single CLI exec with a
 *       small explicit timeout, or a single fetch. NEVER a recursive/unbounded
 *       filesystem scan or `grep -r` over a large tree. The runner's per-class
 *       timeout is the backstop; every execFile here ALSO carries its own timeout.
 *   (c) Relevance is OPERATOR-DECLARED + fail-closed. A provider NEVER infers
 *       which credential is relevant; advertised scope tags come from the
 *       `credentialScopeTags` config map (keyed by source name and/or vault key).
 *       A source with no declared tags advertises an EMPTY tag list → the runner's
 *       `relevantScopeTags` never matches it → it is never surfaced. Nothing
 *       declared ⇒ every probe non-matching ⇒ runs exhaust ⇒ behaves like today
 *       (under-self-unblock, never mis-apply — the safe direction).
 *
 * Everything external is INJECTED via `deps`, so unit tests never shell out.
 */
import type { DurableVaultSession } from './DurableVaultSession.js';
import type { ProbeProviders } from './SelfUnblockChecklist.js';
/**
 * The result of a single bounded child-process call. `code` 0 = success.
 * `stdout` is the captured output (a provider parses NON-SECRET tags from it; it
 * MUST NOT return raw stdout as a tag without scrubbing).
 */
export interface BoundedExecResult {
    code: number | null;
    stdout: string;
    stderr: string;
    timedOut: boolean;
}
/**
 * A single, timeout-bounded `execFile`. Always pass an explicit `timeoutMs`
 * (rule (b)) — never rely on the runner's class timeout alone. Returns a
 * non-throwing result (a non-zero exit is `{ code: !=0 }`, not an exception) so
 * a provider stays a single bounded call with no surprise rejections.
 */
export type ExecFileBounded = (file: string, args: string[], opts: {
    timeoutMs: number;
    env?: NodeJS.ProcessEnv;
}) => Promise<BoundedExecResult>;
/** The default bounded execFile — one child process, hard timeout, captured output. */
export declare const defaultExecFileBounded: ExecFileBounded;
export interface SelfUnblockProbeDeps {
    /**
     * OPERATOR-DECLARED scope tags, keyed by source name (e.g. `org-bitwarden`,
     * `cloud-vercel`) AND/OR by vault key name. A source with no entry advertises an
     * EMPTY tag list → it is never surfaced (rule (c), fail-closed). The values are
     * non-secret `service:scope` strings (e.g. `["cloudflare:dawn-tunnel.dev"]`).
     */
    credentialScopeTags?: Record<string, string[]>;
    /**
     * The flag-gated warm org-Bitwarden session (§5.3). When absent the org-vault
     * probe reports unreachable with a clear detail (never a throw-stub).
     */
    durableVaultSession?: DurableVaultSession;
    /**
     * Returns the NAMES of secrets in the agent's own vault (NEVER values). Used by
     * the own-vault probe to decide reachability + which declared tags to advertise.
     * Absent (or a thrown read) → own-vault reports unreachable, fail-closed.
     */
    getVaultKeys?: () => string[];
    /**
     * Returns the Cloudflare API token VALUE for the single bounded zones fetch, or
     * null when none is configured. The VALUE is used in-process only (an
     * Authorization header) — NEVER logged, NEVER returned. Absent/null → the
     * cloudflare probe reports unreachable.
     */
    getCloudflareToken?: () => string | null;
    /** Injectable bounded execFile (tests pass a fake; production uses the default). */
    execFileBounded?: ExecFileBounded;
    /** Injectable fetch (tests pass a fake; production uses global fetch). */
    fetchImpl?: typeof fetch;
}
/** The minimal BitwardenProvider surface the session derivation needs. */
export interface BitwardenUnlockSurface {
    unlock(masterPassword: string): boolean;
    getSessionKey(): string | null;
}
/**
 * Derive a fresh org-Bitwarden session value for `DurableVaultSession.deriveSession`,
 * TESTABLY. The AgentServer closure that wires this is otherwise untestable — which
 * is exactly how a `process.env.BW_SESSION` read (wrong: `unlock()` stores the
 * session in a PRIVATE field, never the env) slipped past the injected-fake tests.
 *
 * Reads the operator-held master password from the agent's own vault (an EXISTING
 * key — no new on-disk secret) via the injected getter, unlocks via the injected
 * BitwardenProvider surface, and returns the live session from `getSessionKey()`.
 * The password and the session are used in-process ONLY and NEVER logged or returned
 * through any other surface.
 */
export declare function deriveBitwardenSession(opts: {
    getMasterPassword: () => string | null;
    bw: BitwardenUnlockSurface;
}): string | null;
/**
 * Build the full production provider set — a REAL provider for EVERY one of the 9
 * sources in `SELF_UNBLOCK_PROBE_SOURCES`. No source is left unwired.
 */
export declare function buildProductionProbeProviders(deps: SelfUnblockProbeDeps): ProbeProviders;
//# sourceMappingURL=SelfUnblockProbeProviders.d.ts.map