UNPKG

eve

Version:

Filesystem-first framework for durable backend AI agents that run anywhere.

37 lines (36 loc) 1.93 kB
import type { ModelMessage, SystemModelMessage } from "ai"; import type { ChannelInstrumentationProjection, SessionAuthContext, SessionParent } from "#channel/types.js"; import type { AlsContext } from "#context/container.js"; import type { HarnessEmissionState } from "#harness/emission.js"; import type { HarnessSession } from "#harness/types.js"; import type { RuntimeContextResolver } from "#tracing/otel-declaration.js"; import type { InstrumentationEvents } from "#public/instrumentation/index.js"; export interface BuildTelemetryRuntimeContextInput { readonly capturesContent: boolean; readonly context?: InstrumentationRuntimeContextSnapshot; readonly eveVersion: string; readonly emissionState: HarnessEmissionState; readonly environment: string; readonly modelInput: { readonly instructions: string | SystemModelMessage | undefined; readonly messages: readonly ModelMessage[]; }; readonly providerResolvers?: readonly RuntimeContextResolver[]; readonly session: HarnessSession; readonly stepStartedResolver: InstrumentationEvents["step.started"]; } export interface InstrumentationRuntimeContextSnapshot { readonly channel?: ChannelInstrumentationProjection; readonly currentAuth: SessionAuthContext | null; readonly initiatorAuth: SessionAuthContext | null; readonly parent?: SessionParent; } export declare function snapshotInstrumentationRuntimeContext(context: AlsContext | undefined): InstrumentationRuntimeContextSnapshot; /** * Builds per-model-call runtime context for AI SDK telemetry spans. * * Authored runtime context is parsed defensively. Invalid event results, * reserved `eve.*` keys, and callback failures are warning-only so * instrumentation cannot compromise the normal turn flow. */ export declare function buildTelemetryRuntimeContext(input: BuildTelemetryRuntimeContextInput): Record<string, unknown> | undefined;