/**
 * GcsArtifactWriter — writes AILF run artifacts + manifest directly to GCS.
 *
 * Uses Application Default Credentials (ADC). Used when the CLI runs in CI or
 * anywhere ADC is configured — the client talks to GCS without the API Gateway
 * acting as a middleman.
 *
 * Paths come from `ARTIFACT_REGISTRY` so writers, signers, and readers agree.
 *
 * ## W0049 API surface
 *
 * - `emit(type, association, payload)` — the canonical single-shot write.
 *   Dispatch on `descriptor.layout` is internal; callers pass axis values
 *   and the writer resolves the path.
 * - `appendNdjson(type, association, rows)` — streaming-append for `traces`.
 *   Each call writes a numbered part object (`.ndjson.part-NNNN`); the
 *   parts are composed into the final object lazily at `writeManifest` time
 *   via GCS object compose. When a stream accumulates > 32 parts the writer
 *   rolls up parts into intermediate composites to stay under the GCS
 *   compose cap.
 * - `writeBulk` / `writePerEntry` — @deprecated legacy surface. Removal in W0052.
 *
 * Design principles:
 * - P5: Non-blocking — upload failure returns null, never throws.
 * - Lazy client — Storage created on first write.
 *
 * @see docs/decisions/D0032-run-anchored-artifact-store.md
 * @see docs/decisions/D0033-unified-run-anchored-artifact-capture.md
 */
import { Storage } from "@google-cloud/storage";
import { type ArtifactEntry, type ArtifactRef, type ArtifactType, type ArtifactWriter, type ArtifactWriterProgressOptions, type AssociationValues, type RunId, type RunManifest, type WriteSource } from "../_vendor/ailf-core/index.d.ts";
import { type UploadMetricsSink } from "./upload-metrics.js";
export interface GcsArtifactWriterOptions {
    /** GCS bucket name (e.g., "ailf-artifacts") */
    bucket: string;
    /**
     * Optional pre-constructed Storage client. When omitted the writer
     * constructs one lazily from Application Default Credentials. Test code
     * supplies a fake here to avoid real network calls.
     */
    storage?: Storage;
    /**
     * Optional progress reporter + phaseId (W0053). When set, the writer
     * publishes `phaseProgress` on every successful emit / appendNdjson /
     * writeManifest so the CLI can render per-batch updates during the
     * long artifact upload phase.
     */
    progress?: ArtifactWriterProgressOptions;
    /**
     * W0056 — optional metrics sink that receives per-phase timing events.
     * Defaults to a no-op so the hot path stays free when metrics are off.
     */
    metrics?: UploadMetricsSink;
    /**
     * Identifies what kind of execution context owns this writer instance.
     * The D0050 guard refuses to emit a descriptor whose `writePolicy` is
     * different from this value. `"pipeline"` (the default) is for writers
     * driven by an `ailf run` pipeline; `"post-hoc"` is for writers driven
     * by deferred commands like `ailf interpret` that emit descriptors
     * declared `writePolicy: "post-hoc"` (D0050).
     */
    writerSource?: WriteSource;
}
export declare class GcsArtifactWriter implements ArtifactWriter {
    private client;
    private readonly options;
    private readonly ndjsonStreams;
    private readonly metrics;
    /**
     * Bounds concurrent GCS PUTs.
     *
     * Producers after W0058 fire all emits synchronously and `Promise.all`
     * once at the end — without an internal limiter, a full-literacy run
     * would fan ~1,500 concurrent `file.save` calls, saturating the client
     * connection pool and GCS's per-prefix write quota. The limiter
     * preserves the pre-W0058 effective concurrency (8) that Prototype A
     * measured safe, without forcing the producer to own that knob.
     */
    private readonly limiter;
    private readonly writerSource;
    constructor(options: GcsArtifactWriterOptions);
    private reportProgress;
    emit<T extends ArtifactType>(type: T, association: AssociationValues, payload: unknown): Promise<ArtifactRef | null>;
    appendNdjson<T extends ArtifactType>(type: T, association: AssociationValues, rows: readonly unknown[]): Promise<ArtifactRef | null>;
    writeManifest(runId: RunId, manifest: RunManifest): Promise<ArtifactRef | null>;
    /** @deprecated Use `emit()` instead. Routes through the same GCS I/O. */
    writeBulk(type: ArtifactType, runId: RunId, data: unknown): Promise<ArtifactRef | null>;
    /** @deprecated Use `emit()` per entry instead. */
    writePerEntry(type: ArtifactType, runId: RunId, entries: readonly ArtifactEntry[]): Promise<ArtifactRef | null>;
    /**
     * Compose all buffered NDJSON streams into their final objects. Called
     * from `writeManifest` so the manifest is the single sync point for
     * NDJSON finalization.
     *
     * When `partCount > GCS_COMPOSE_MAX`, parts are rolled up in groups of
     * `GCS_COMPOSE_MAX` into intermediate composites, then composed. This
     * stays under the per-call source cap at the cost of one extra round
     * trip per 32 additional parts.
     */
    private finalizeNdjsonStreams;
    private putBody;
    private getClient;
}
