import type { FabricEvent, SubmissionTelemetrySink } from '@fabric-harness/sdk'; /** * Serving usage capture (v2 migration, workstream C7): attribute model/serving * spend to submissions through the ambient submission context. */ export interface ServingUsageCaptureOptions { /** Telemetry sink receiving `submission_usage` events (e.g. `databricksTelemetry().sink`). */ sink: SubmissionTelemetrySink; /** Failure reporter for sink errors (default: silent, matching fire-and-forget telemetry). */ onError?: (error: unknown) => void; } /** * Build an `onEvent` fan-in that turns model-usage events into * `submission_usage` telemetry. For every {@link FabricEvent} carrying * `data.usage` (`{ inputTokens?, outputTokens?, costUsd? }`, at least one * numeric field) — and optionally `data.model` — while an ambient * {@link currentSubmissionContext} is set, it emits one `submission_usage` * event stamped with the submission correlation (submission/attempt ids, * agent identity, tenant, actor). * * Events observed outside a submission context are dropped silently — not * every session turn belongs to a submission. The submission context does not * carry the submission kind, so emitted events use `kind: 'unknown'`. */ export declare function servingUsageCapture(options: ServingUsageCaptureOptions): (event: FabricEvent) => void; export interface InferenceTableUsageQueryOptions { /** Fully-qualified inference/payload table, `catalog.schema.table`. */ fullTableName: string; /** Only aggregate requests at or after this ISO-8601 instant. */ sinceIso?: string; } /** * SQL aggregating a serving endpoint's inference/payload table by * `client_request_id` — one row per submission with the request count and the * first/last request timestamps — for offline joins against * `fh_submission_telemetry.submission_id`. * * Join contract: callers MUST send the submission id as the serving request's * `client_request_id` (e.g. the `client_request_id` field on the * serving-endpoint invocation) — the inference table records it verbatim, and * this query's `submission_id` column only joins when that convention holds. * Rows without a `client_request_id` (traffic from other callers) are * excluded. Assumes the AI Gateway payload-table schema (`request_time` * timestamp column); adapt the projection for classic inference tables that * use `timestamp_ms`. */ export declare function inferenceTableUsageQuery(options: InferenceTableUsageQueryOptions): string; //# sourceMappingURL=serving-usage.d.ts.map