/**
 * BootSelfKnowledge — the "what I already have" block injected at session start.
 *
 * Spec: docs/specs/session-boot-self-knowledge.md (converged 2026-06-05).
 *
 * Composes ONE bounded markdown block from two deterministic sources:
 *   1. Vault secret NAMES — the per-agent encrypted SecretStore flattened to
 *      dot-notation key paths via the SAME secretKeyPaths() helper that
 *      /secrets/sync-status uses. Values are NEVER serialized.
 *   2. Operational facts — `selfKnowledge.operationalFacts` from config.json,
 *      self-asserted per-machine hints (e.g. the logged-in Playwright seat).
 *
 * This is deterministic config/capability discovery injected as boot context —
 * a capability inventory, not memory, not an authority. It gates nothing.
 *
 * Hardening contract (every rendered name/fact is untrusted display content —
 * key names are writable by peers via secret-sync, facts by the agent itself):
 *   - control chars + ANSI stripped, `<`/`>` HTML-escaped (envelope-breakout
 *     structurally impossible), names clamped to 128 chars, facts to 256;
 *   - key paths depth-capped at 2 (`parent.child (+N nested)`) so structured
 *     credentials never leak their internal shape;
 *   - alphabetical ordering, 50-name cap, byte-bounded block with an
 *     actionable truncation marker (never silent truncation).
 *
 * Vault honesty (bifurcated-master-key lesson, 2026-06-05): absent file →
 * vaultState 'absent' (never an error); a read that throws is retried ONCE
 * (absorbs a benign master-key-rotation race) before reporting
 * 'decrypt-failed' — which is rendered as an explicit hands-off warning, never
 * as an empty vault.
 *
 * NOTE: distinct from the SelfKnowledgeTree (src/knowledge/) — that system is
 * LLM-assisted search over AGENT.md; this is a deterministic boot inventory.
 */
/** A stored operational fact. The writer route stamps updatedAt + machine; bare strings (hand-authored/legacy) are accepted too. */
export interface OperationalFact {
    fact: string;
    updatedAt?: string;
    machine?: string;
}
export interface BootSelfKnowledgeResult {
    present: boolean;
    block: string;
    names: string[];
    factCount: number;
    vaultState: 'ok' | 'absent' | 'decrypt-failed';
}
export interface BootSelfKnowledgeOptions {
    /** The agent's state dir (.instar) — locates the vault. */
    stateDir: string;
    /** Path to .instar/config.json — read FRESH per call (deliberate divergence
     *  from boot-frozen ctx.config: flag/fact edits take effect without a server
     *  restart — do not "consistency-fix" this back). */
    configPath: string;
}
/** Rendering caps (spec §Rendering hardening). */
export declare const MAX_NAME_CHARS = 128;
export declare const MAX_FACT_CHARS = 256;
export declare const MAX_NAMES_RENDERED = 50;
export declare const MAX_FACTS_STORED = 50;
export declare const DEFAULT_MAX_BYTES = 2000;
/** Test seam: clear the module-level cache between tests. */
export declare function clearBootSelfKnowledgeCache(): void;
/** Fresh-read the selfKnowledge.sessionContext flags from config.json (never ctx.config — see configPath doc). */
export declare function readSelfKnowledgeFlags(configPath: string): {
    enabled?: boolean;
    maxInjectedBytes?: number;
};
/**
 * Atomic config.json read-mutate-write for the facts writer routes: re-read
 * from disk inside the call (bounding the lost-update window vs the other,
 * pre-existing NON-atomic config writers to this function's own microseconds —
 * last-writer-wins semantics, spec §Writer path), apply the mutator, write to
 * a temp file, rename into place. The mutator returns either {value} (commit)
 * or {error} (abort — nothing is written).
 */
export declare function writeConfigAtomic<T>(configPath: string, mutate: (cfg: Record<string, unknown>) => {
    value?: T;
    error?: {
        status: number;
        message: string;
    };
}): {
    value?: T;
    error?: {
        status: number;
        message: string;
    };
};
/** Strip control chars + ANSI escapes, HTML-escape angle brackets, clamp length. */
export declare function sanitizeForBlock(input: string, maxChars: number): string;
/**
 * Collapse flat dot-notation leaf paths (secretKeyPaths output — the SAME
 * derivation sync-status uses; this is a post-process, never a re-derivation)
 * to depth-2 prefixes. N = count of distinct leaf paths collapsed under the
 * prefix. `telegram.bot.token` + `telegram.bot.chatId` → `telegram.bot (+2 nested)`.
 */
export declare function collapseToDepth2(leafPaths: string[]): string[];
export declare class BootSelfKnowledge {
    private readonly stateDir;
    private readonly configPath;
    constructor(opts: BootSelfKnowledgeOptions);
    private vaultPath;
    /**
     * Vault key NAMES + state, via the module cache. Production read path is
     * keychain-backed by default — NO hardcoded forceFileKey (a file-key here
     * would read a different/empty vault in production and recreate the exact
     * "vault looks empty" confusion this module exists to kill; test-safety
     * comes ONLY from the MasterKeyManager VITEST constructor guard).
     */
    private readNames;
    /** Operational facts, read FRESH from config.json (see configPath doc). */
    readFacts(): OperationalFact[];
    /**
     * Build the boot block. `full` bypasses the name-count cap and byte bound
     * (the `?full=1` recovery path the truncation marker points at).
     */
    sessionContext(maxBytes?: number, opts?: {
        full?: boolean;
    }): BootSelfKnowledgeResult;
}
//# sourceMappingURL=BootSelfKnowledge.d.ts.map