/** * Cross-boundary trace-context propagation for the LangSmith Temporal plugin. * * The LangSmith run context travels across every Temporal boundary * (client→workflow, workflow→activity, workflow→child-workflow, * workflow→Nexus, continue-as-new) as a single Temporal {@link Header} * entry. The wire value is exactly the object produced by * `RunTree.toHeaders()` — `{ "langsmith-trace": , baggage: }` * — which the receiving side feeds straight back into * `RunTree.fromHeaders(...)` to reconstruct the parent run. * * Two encodings are supported because Temporal exposes two header shapes: * - The binary/Temporal path (`Headers = Record`): the * context is encoded with the default payload converter. * - The Nexus path (`Record`): Nexus headers are plain * strings with no Payload encoding, so the context is JSON-serialized. * * @module */ import { type Payload } from '@temporalio/common'; /** * Temporal header key under which the LangSmith trace context is carried. * * Must byte-match the Python plugin's key so trace context propagates across SDKs. */ export declare const HEADER_KEY = "_temporal-langsmith-context"; /** * The serialized LangSmith trace context that crosses a Temporal boundary. * * This is structurally the output of `RunTree.toHeaders()`. Keeping it as a * plain JSON object lets the same value ride either the Payload transport or * the Nexus plain-string transport unchanged. */ export interface LangSmithTraceContext extends Record { /** The parent run's dotted order — the LangSmith trace pointer. */ 'langsmith-trace': string; /** LangSmith baggage (metadata / tags / project), comma-encoded. */ baggage: string; } /** Return a shallow copy of `record` with all credential-bearing keys removed. */ export declare function scrubSensitive(record: Record | undefined): Record | undefined; /** Encode a trace context as a plain string for the Nexus header transport. */ export declare function encodeContextString(context: LangSmithTraceContext): string; /** Decode a trace context from a Nexus plain-string header; never throws. */ export declare function decodeContextString(value: string | undefined): LangSmithTraceContext | undefined; /** * Inject a trace context into a Payload-keyed Temporal header map, returning a * new map (interceptor inputs treat `headers` as immutable). Returns the input * unchanged when `context` is `undefined`. */ export declare function withContextHeader(headers: Record, context: LangSmithTraceContext | undefined): Record; export declare function readContextHeader(headers: Record | undefined): LangSmithTraceContext | undefined; /** * Temporal-internal query names that must NOT produce a LangSmith run: any * `__temporal`-prefixed query plus the stack-trace introspection queries. */ export declare function isInternalQuery(queryName: string): boolean;