import { type LogStore } from "@skaile/workspaces/core/logging"; import type { LogEntry, LogEntryEvent, LogQuery, LogQueryResult, LogSink } from "@skaile/workspaces/types"; /** * Pre-init log sink. Active before the LogStore boots — i.e. during the * window between process start and `session_init` processing. * * Writes every entry to `process.stdout` (so early-boot operators / container * log shippers still see it). Entries are also captured in a bounded * in-memory ring (default cap 200 entries) so that, once the LogStore boots, * subscribers can read them via {@link entries} for diagnostic purposes. * * NOTE: backfilling the buffered entries into the LogStore's SQLite trail is * not done in v3.0 because `LogStore.record()` re-stamps id/timestamp/ * sessionId, which would corrupt the original entries. A follow-up * (`AF-PV3 / F-LOG-BACKFILL`) will add a `replay()` API to LogStore so the * boot logs land in the persistent trail alongside the live stream. * * Spec: `_devlog/specs/2026-05-10-deterministic-session-bootstrap.md` § * Pre-init logging. */ export declare class PreInitRingSink implements LogSink { private readonly ring; private readonly cap; constructor(cap?: number); write(entry: LogEntry): void; writeBatch(entries: LogEntry[]): void; /** Optional query (no-op) — satisfies the LogSink contract. */ query(_q: LogQuery): LogQueryResult; /** Close hook — clears the ring so subsequent writes are dropped. */ close(): void; /** Number of entries currently buffered (capped at {@link cap}). */ size(): number; /** Snapshot of the currently-buffered entries. Used for diagnostics. */ entries(): readonly LogEntry[]; /** Discard all buffered entries. Called by `bootstrapRunnerLogStore`. */ clear(): void; } /** * Install (or return the existing) process-wide pre-init sink. Idempotent * so the first import wins; later calls reuse the same ring. * * Called from the top of every runner entry point (CLI, serve.ts) before * any other code emits structured logs. */ export declare function installPreInitRingSink(cap?: number): PreInitRingSink; /** Currently-installed pre-init sink, or `null` if none has been installed. */ export declare function getPreInitRingSink(): PreInitRingSink | null; /** Drop the reference to the installed sink. Used in tests + on dispose. */ export declare function clearPreInitRingSink(): void; /** * Options for {@link bootstrapRunnerLogStore}. * * @docLink packages/runner/logging#bootstrap-options */ export interface BootstrapOptions { sessionId: string; projectDir: string; /** `skaile.yaml`'s `logging:` block, if pre-loaded. */ yamlBlock?: unknown; /** Back-compat callback — every entry mirrored as a formatted line. */ onLog?: (line: string) => void; /** * Transport send callback. When provided, a `WsLogSink` is installed so * every recorded LogEntry flows to the connected client as a `log_entry` * AgentEvent. Drops silently when the transport is disconnected — that * gating happens inside the transport's `send()`. */ transportSend?: (event: LogEntryEvent) => void; } /** * Result from {@link bootstrapRunnerLogStore}. * * @docLink packages/runner/logging#bootstrap-result */ export interface BootstrapResult { store: LogStore; dispose: () => void; } /** * Idempotent bootstrap. If the same sessionId is re-used, returns the existing * registered store. If a different sessionId arrives, the previous store is * closed and replaced. * @docLink packages/runner/logging#bootstrap-runner-log-store */ export declare function bootstrapRunnerLogStore(opts: BootstrapOptions): BootstrapResult; /** * Reset the runner's process-singleton LogStore. * * @docLink packages/runner/logging#reset-runner-log-store */ export declare function resetRunnerLogStore(): void; //# sourceMappingURL=logging-bootstrap.d.ts.map