import type { RequestAttribution } from "@velum-labs/routekit-contracts"; import { type RouteKitPlatform } from "@velum-labs/routekit-runtime/effect"; import { Effect, Scope } from "effect"; import { HttpServerResponse } from "effect/unstable/http"; import type { BackendRequest, BackendRequestOptions } from "./providers/backend.js"; import type { GatewayDialect, ProvenanceSink } from "./observability/provenance.js"; export type ModelCallRoute = { dialect: GatewayDialect; body: unknown; defaultModel: string | undefined; requestedModel?: string; endpointId?: string; attribution?: Partial; /** Trusted data-plane principal from the switching proxy. */ principal?: NonNullable; invoke: (callId: string, signal: AbortSignal, onAttribution: NonNullable) => BackendRequest; }; export declare function collectAttribution(seed: Partial | undefined): { report: NonNullable; snapshot(): RequestAttribution | undefined; }; /** * Stream an upstream Fetch body as an Effect HTTP response, forwarding only * status and content-type (the historic `pipeUpstream` wire). */ export declare function streamFetchResponse(upstream: Response, extraHeaders?: Readonly>, options?: { collectBody?: boolean; onComplete?: (body: Buffer) => void; onFailure?: (error: unknown, body: Buffer) => void; }): HttpServerResponse.HttpServerResponse; export declare function handleModelCall(sink: ProvenanceSink | undefined, route: ModelCallRoute, extraHeaders?: Readonly>): Effect.Effect; /** Execute a buffered internal model call while preserving normal call accounting. */ export declare function invokeObservedModelCall(sink: ProvenanceSink | undefined, route: ModelCallRoute): BackendRequest;