@lmnr-ai/lmnr 0.8.20 → 0.8.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/worker/build.cjs +1 -1
- package/dist/cli/worker/build.mjs +1 -1
- package/dist/cli/worker/index.cjs +1 -1
- package/dist/cli/worker/index.mjs +1 -1
- package/dist/cli.cjs +3 -3
- package/dist/cli.d.cts +1 -1
- package/dist/cli.d.mts +1 -1
- package/dist/cli.mjs +3 -3
- package/dist/{decorators-Cf0xs-v_.mjs → decorators-BDFgXfgI.mjs} +820 -139
- package/dist/decorators-BDFgXfgI.mjs.map +1 -0
- package/dist/{decorators-u7xFb_9W.cjs → decorators-CaTC0lJq.cjs} +831 -138
- package/dist/decorators-CaTC0lJq.cjs.map +1 -0
- package/dist/{dist-BwllJ__m.mjs → dist-B5CmOQ4s.mjs} +3 -3
- package/dist/{dist-BwllJ__m.mjs.map → dist-B5CmOQ4s.mjs.map} +1 -1
- package/dist/{dist-zDtQ_gVq.cjs → dist-B5cKzRzq.cjs} +3 -3
- package/dist/{dist-zDtQ_gVq.cjs.map → dist-B5cKzRzq.cjs.map} +1 -1
- package/dist/{evaluations-D2duRqbG.d.cts → evaluations-BJkIwpmH.d.cts} +15 -1
- package/dist/{evaluations-DEbBIXng.d.mts → evaluations-tqpNgp0P.d.mts} +15 -1
- package/dist/{file-utils-C-auksVC.mjs → file-utils-CHoR9VB8.mjs} +2 -2
- package/dist/{file-utils-C-auksVC.mjs.map → file-utils-CHoR9VB8.mjs.map} +1 -1
- package/dist/file-utils-IBEBwZxq.cjs +2 -0
- package/dist/{file-utils-0mVr0eIv.cjs → file-utils-yJ5ephze.cjs} +2 -2
- package/dist/{file-utils-0mVr0eIv.cjs.map → file-utils-yJ5ephze.cjs.map} +1 -1
- package/dist/index.cjs +563 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +125 -3
- package/dist/index.d.mts +125 -3
- package/dist/index.mjs +564 -11
- package/dist/index.mjs.map +1 -1
- package/dist/{utils-BmWNkeX5.cjs → utils-C8Tl1vKD.cjs} +23 -1
- package/dist/utils-C8Tl1vKD.cjs.map +1 -0
- package/dist/{utils-0WC6BVqs.mjs → utils-CHJ0KZUR.mjs} +12 -2
- package/dist/utils-CHJ0KZUR.mjs.map +1 -0
- package/package.json +4 -3
- package/dist/decorators-Cf0xs-v_.mjs.map +0 -1
- package/dist/decorators-u7xFb_9W.cjs.map +0 -1
- package/dist/file-utils-2hY2DP65.cjs +0 -2
- package/dist/utils-0WC6BVqs.mjs.map +0 -1
- package/dist/utils-BmWNkeX5.cjs.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as HumanEvaluator, c as InitializeOptions, d as LaminarClient, f as __exportAll, i as EvaluatorFunctionReturn, l as EvaluationDataset, o as evaluate, r as EvaluatorFunction, s as StringUUID, t as Datapoint, u as LaminarDataset } from "./evaluations-
|
|
1
|
+
import { a as HumanEvaluator, c as InitializeOptions, d as LaminarClient, f as __exportAll, i as EvaluatorFunctionReturn, l as EvaluationDataset, o as evaluate, r as EvaluatorFunction, s as StringUUID, t as Datapoint, u as LaminarDataset } from "./evaluations-BJkIwpmH.cjs";
|
|
2
2
|
import { a as Event, c as LaminarSpanContext, d as RolloutParam, f as SessionRecordingOptions, g as TracingLevel, h as TraceType, i as EvaluationDatapointDatasetLink, l as MaskInputOptions, n as Dataset, p as SpanType, r as EvaluationDatapoint, u as PushDatapointsResponse } from "./index-Bal29BRz.cjs";
|
|
3
3
|
import { ServerResponse } from "http";
|
|
4
4
|
import { ReadableSpan, SpanExporter, SpanProcessor, TimedEvent } from "@opentelemetry/sdk-trace-base";
|
|
@@ -4615,6 +4615,13 @@ declare class LaminarSpanProcessor implements SpanProcessor {
|
|
|
4615
4615
|
* @param spanIdsPath - The span IDs path (array of span ID UUIDs)
|
|
4616
4616
|
*/
|
|
4617
4617
|
setParentPathInfo(parentSpanId: string, spanPath: string[], spanIdsPath: StringUUID[]): void;
|
|
4618
|
+
/**
|
|
4619
|
+
* Drop cached path entries for a given span id. For exporters that stamp
|
|
4620
|
+
* their own span id over the SDK-allocated one after `startSpan` has fired
|
|
4621
|
+
* `onStart` — without this, `onEnd` reads the mutated id and its delete is
|
|
4622
|
+
* a no-op, so the original entry leaks one pair of map entries per span.
|
|
4623
|
+
*/
|
|
4624
|
+
dropPathInfo(spanId: string): void;
|
|
4618
4625
|
clear(): void;
|
|
4619
4626
|
}
|
|
4620
4627
|
//#endregion
|
|
@@ -4635,6 +4642,7 @@ declare const LaminarAttributes: {
|
|
|
4635
4642
|
declare class LaminarSpan implements Span$1, ReadableSpan {
|
|
4636
4643
|
private _span;
|
|
4637
4644
|
private _activated;
|
|
4645
|
+
private _globalActiveContext?;
|
|
4638
4646
|
constructor(span: Span$1, activated?: boolean);
|
|
4639
4647
|
name: string;
|
|
4640
4648
|
kind: SpanKind;
|
|
@@ -4661,6 +4669,7 @@ declare class LaminarSpan implements Span$1, ReadableSpan {
|
|
|
4661
4669
|
setStatus(status: SpanStatus): this;
|
|
4662
4670
|
updateName(name: string): this;
|
|
4663
4671
|
end(endTime?: TimeInput): void;
|
|
4672
|
+
setGlobalActiveContext(context: Context): void;
|
|
4664
4673
|
set activated(activated: boolean);
|
|
4665
4674
|
isRecording(): boolean;
|
|
4666
4675
|
recordException(exception: Exception, time?: TimeInput): void;
|
|
@@ -4967,6 +4976,14 @@ declare class Laminar {
|
|
|
4967
4976
|
* @param {string} options.userId - user ID to associate with the span.
|
|
4968
4977
|
* @param {string} options.sessionId - session ID to associate with the span.
|
|
4969
4978
|
* @param {Record<string, any>} options.metadata - metadata to associate with the span.
|
|
4979
|
+
* @param {boolean} options.global - when true, the span is registered on a
|
|
4980
|
+
* process-global context stack so that any subsequent `startSpan` /
|
|
4981
|
+
* `startActiveSpan` call (including from unrelated async tasks) uses it as
|
|
4982
|
+
* the parent. Use this for spans that span multiple disconnected async
|
|
4983
|
+
* callbacks — e.g. the root span of an OpenAI Agents trace, where child
|
|
4984
|
+
* spans are created from independent `TracingProcessor` callbacks that do
|
|
4985
|
+
* not share an async context. Defaults to false; the span still activates
|
|
4986
|
+
* within the current async context as usual.
|
|
4970
4987
|
* @returns The started span.
|
|
4971
4988
|
*
|
|
4972
4989
|
* @example
|
|
@@ -5007,7 +5024,8 @@ declare class Laminar {
|
|
|
5007
5024
|
userId,
|
|
5008
5025
|
sessionId,
|
|
5009
5026
|
metadata,
|
|
5010
|
-
startTime
|
|
5027
|
+
startTime,
|
|
5028
|
+
global
|
|
5011
5029
|
}: {
|
|
5012
5030
|
name: string;
|
|
5013
5031
|
input?: any;
|
|
@@ -5019,6 +5037,7 @@ declare class Laminar {
|
|
|
5019
5037
|
sessionId?: string;
|
|
5020
5038
|
metadata?: Record<string, any>;
|
|
5021
5039
|
startTime?: TimeInput;
|
|
5040
|
+
global?: boolean;
|
|
5022
5041
|
}): Span$1;
|
|
5023
5042
|
private static _startSpan;
|
|
5024
5043
|
/**
|
|
@@ -11744,6 +11763,109 @@ declare function wrapLanguageModel(languageModel: LanguageModelV2): LanguageMode
|
|
|
11744
11763
|
*/
|
|
11745
11764
|
declare function instrumentClaudeAgentQuery(originalQuery: any): any;
|
|
11746
11765
|
//#endregion
|
|
11766
|
+
//#region src/opentelemetry-lib/instrumentation/mastra/types.d.ts
|
|
11767
|
+
interface MastraSpanErrorInfo {
|
|
11768
|
+
message: string;
|
|
11769
|
+
name?: string;
|
|
11770
|
+
stack?: string;
|
|
11771
|
+
details?: Record<string, unknown>;
|
|
11772
|
+
}
|
|
11773
|
+
interface MastraExportedSpan {
|
|
11774
|
+
id: string;
|
|
11775
|
+
traceId: string;
|
|
11776
|
+
parentSpanId?: string;
|
|
11777
|
+
name: string;
|
|
11778
|
+
type: string;
|
|
11779
|
+
startTime: Date;
|
|
11780
|
+
endTime?: Date;
|
|
11781
|
+
attributes?: Record<string, any>;
|
|
11782
|
+
metadata?: Record<string, any>;
|
|
11783
|
+
tags?: string[];
|
|
11784
|
+
input?: unknown;
|
|
11785
|
+
output?: unknown;
|
|
11786
|
+
errorInfo?: MastraSpanErrorInfo;
|
|
11787
|
+
isEvent: boolean;
|
|
11788
|
+
isRootSpan: boolean;
|
|
11789
|
+
}
|
|
11790
|
+
interface MastraTracingEvent {
|
|
11791
|
+
type: "span_started" | "span_updated" | "span_ended";
|
|
11792
|
+
exportedSpan: MastraExportedSpan;
|
|
11793
|
+
}
|
|
11794
|
+
interface MastraExporterOptions {
|
|
11795
|
+
/**
|
|
11796
|
+
* Flush the underlying span processor after every span end. Useful for
|
|
11797
|
+
* short-lived processes that exit before the batch processor would drain
|
|
11798
|
+
* on its own.
|
|
11799
|
+
*/
|
|
11800
|
+
realtime?: boolean;
|
|
11801
|
+
/**
|
|
11802
|
+
* When true (default), reparent Mastra traces under the caller's active
|
|
11803
|
+
* OpenTelemetry span if one exists. This lets `observe()`-wrapped code that
|
|
11804
|
+
* calls a Mastra agent produce a single unified trace instead of two
|
|
11805
|
+
* disconnected ones (user's OTel trace + Mastra's own trace).
|
|
11806
|
+
*
|
|
11807
|
+
* Mastra does not propagate OTel context into its event bus, so without
|
|
11808
|
+
* this we'd emit under Mastra's self-assigned trace id with no parent.
|
|
11809
|
+
* Set to false to preserve Mastra's original trace id even when nested
|
|
11810
|
+
* inside `observe()`.
|
|
11811
|
+
*/
|
|
11812
|
+
linkToActiveContext?: boolean;
|
|
11813
|
+
}
|
|
11814
|
+
//#endregion
|
|
11815
|
+
//#region src/opentelemetry-lib/instrumentation/mastra/exporter.d.ts
|
|
11816
|
+
/**
|
|
11817
|
+
* Bridges Mastra's ObservabilityExporter contract to Laminar's OTLP ingestion.
|
|
11818
|
+
*
|
|
11819
|
+
* Span-type mapping:
|
|
11820
|
+
* - `model_step` → LLM (atomic LLM call; rendered with message history).
|
|
11821
|
+
* - `tool_call`, `mcp_tool_call` → TOOL.
|
|
11822
|
+
* - `model_chunk` → dropped (per-delta, noise).
|
|
11823
|
+
* - everything else → DEFAULT.
|
|
11824
|
+
*
|
|
11825
|
+
* Tool-call reconstruction: Mastra's `extractStepInput` collapses prior tool
|
|
11826
|
+
* calls/results into empty user messages on MODEL_STEP inputs, so we
|
|
11827
|
+
* reconstruct the full conversation by accumulating (baseMessages → step0's
|
|
11828
|
+
* assistant message → tool-result message(s) → step1's assistant message →
|
|
11829
|
+
* …) using the parent MODEL_GENERATION's input and the children TOOL_CALL
|
|
11830
|
+
* spans paired by arrival order with each step's declared toolCalls.
|
|
11831
|
+
*
|
|
11832
|
+
* For LLM spans we emit `ai.prompt.messages` (stringified AI SDK messages
|
|
11833
|
+
* with tool-call / tool-result content parts) and `ai.response.text` +
|
|
11834
|
+
* `ai.response.toolCalls` so Laminar's backend parser threads them into
|
|
11835
|
+
* the LLM message history view.
|
|
11836
|
+
*/
|
|
11837
|
+
declare class MastraExporter {
|
|
11838
|
+
readonly name = "laminar";
|
|
11839
|
+
private readonly config;
|
|
11840
|
+
private readonly traceMap;
|
|
11841
|
+
private readonly generationStateById;
|
|
11842
|
+
private readonly generationAttrsById;
|
|
11843
|
+
private readonly generationIdByStepId;
|
|
11844
|
+
private readonly stepIndexBySpanId;
|
|
11845
|
+
private readonly liveOtelSpanByMastraId;
|
|
11846
|
+
private warnedNotInitialized;
|
|
11847
|
+
constructor(options?: MastraExporterOptions);
|
|
11848
|
+
init(_options?: unknown): void;
|
|
11849
|
+
exportTracingEvent(event: MastraTracingEvent): Promise<void>;
|
|
11850
|
+
onTracingEvent(event: MastraTracingEvent): Promise<void>;
|
|
11851
|
+
flush(): Promise<void>;
|
|
11852
|
+
shutdown(): Promise<void>;
|
|
11853
|
+
private handleSpanStarted;
|
|
11854
|
+
private recordSpanPath;
|
|
11855
|
+
private handleSpanEnded;
|
|
11856
|
+
private initGenerationState;
|
|
11857
|
+
private captureReasoningChunk;
|
|
11858
|
+
private updateGenerationStateOnSpanEnd;
|
|
11859
|
+
private getOrCreateTraceState;
|
|
11860
|
+
private startOtelSpan;
|
|
11861
|
+
private warnNotInitializedOnce;
|
|
11862
|
+
private buildParentContext;
|
|
11863
|
+
private applyEndAttributes;
|
|
11864
|
+
private buildLaminarAttributes;
|
|
11865
|
+
private applyLlmAttributes;
|
|
11866
|
+
private applyToolAttributes;
|
|
11867
|
+
}
|
|
11868
|
+
//#endregion
|
|
11747
11869
|
//#region src/opentelemetry-lib/tracing/index.d.ts
|
|
11748
11870
|
/**
|
|
11749
11871
|
* Get the tracer provider. Returns Laminar's tracer provider if Laminar is initialized,
|
|
@@ -11811,5 +11933,5 @@ declare const initializeLaminarInstrumentations: (options?: {
|
|
|
11811
11933
|
sessionRecordingOptions?: SessionRecordingOptions;
|
|
11812
11934
|
}) => Instrumentation<_$_opentelemetry_instrumentation0.InstrumentationConfig>[];
|
|
11813
11935
|
//#endregion
|
|
11814
|
-
export { type Datapoint, EvaluationDataset as Dataset, type Dataset as DatasetType, type EvaluationDatapoint, type EvaluationDatapointDatasetLink, type EvaluatorFunction, type EvaluatorFunctionReturn, type Event, HumanEvaluator, Laminar, LaminarAttributes, LaminarClient, LaminarDataset, type LaminarSpanContext, LaminarSpanProcessor, type MaskInputOptions, type PushDatapointsResponse, type SessionRecordingOptions, type Span, TracingLevel, evaluate, getTracer, getTracerProvider, initializeLaminarInstrumentations, instrumentClaudeAgentQuery, observe, observeDecorator, observeExperimentalDecorator, withTracingLevel, wrapAISDK, wrapLanguageModel };
|
|
11936
|
+
export { type Datapoint, EvaluationDataset as Dataset, type Dataset as DatasetType, type EvaluationDatapoint, type EvaluationDatapointDatasetLink, type EvaluatorFunction, type EvaluatorFunctionReturn, type Event, HumanEvaluator, Laminar, LaminarAttributes, LaminarClient, LaminarDataset, type LaminarSpanContext, LaminarSpanProcessor, type MaskInputOptions, MastraExporter, type MastraExporterOptions, type PushDatapointsResponse, type SessionRecordingOptions, type Span, TracingLevel, evaluate, getTracer, getTracerProvider, initializeLaminarInstrumentations, instrumentClaudeAgentQuery, observe, observeDecorator, observeExperimentalDecorator, withTracingLevel, wrapAISDK, wrapLanguageModel };
|
|
11815
11937
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as Event, c as LaminarSpanContext, d as RolloutParam, f as SessionRecordingOptions, g as TracingLevel, h as TraceType, i as EvaluationDatapointDatasetLink, l as MaskInputOptions, n as Dataset, p as SpanType, r as EvaluationDatapoint, u as PushDatapointsResponse } from "./index-DSH1z3_q.mjs";
|
|
2
|
-
import { a as HumanEvaluator, c as InitializeOptions, d as LaminarClient, i as EvaluatorFunctionReturn, l as EvaluationDataset, o as evaluate, r as EvaluatorFunction, s as StringUUID, t as Datapoint, u as LaminarDataset } from "./evaluations-
|
|
2
|
+
import { a as HumanEvaluator, c as InitializeOptions, d as LaminarClient, i as EvaluatorFunctionReturn, l as EvaluationDataset, o as evaluate, r as EvaluatorFunction, s as StringUUID, t as Datapoint, u as LaminarDataset } from "./evaluations-tqpNgp0P.mjs";
|
|
3
3
|
import { AttributeValue, Attributes, Context, Exception, HrTime, Link, Span, Span as Span$1, SpanContext, SpanKind, SpanStatus, TimeInput, Tracer, TracerProvider } from "@opentelemetry/api";
|
|
4
4
|
import * as _$_opentelemetry_instrumentation0 from "@opentelemetry/instrumentation";
|
|
5
5
|
import { Instrumentation, InstrumentationBase } from "@opentelemetry/instrumentation";
|
|
@@ -4615,6 +4615,13 @@ declare class LaminarSpanProcessor implements SpanProcessor {
|
|
|
4615
4615
|
* @param spanIdsPath - The span IDs path (array of span ID UUIDs)
|
|
4616
4616
|
*/
|
|
4617
4617
|
setParentPathInfo(parentSpanId: string, spanPath: string[], spanIdsPath: StringUUID[]): void;
|
|
4618
|
+
/**
|
|
4619
|
+
* Drop cached path entries for a given span id. For exporters that stamp
|
|
4620
|
+
* their own span id over the SDK-allocated one after `startSpan` has fired
|
|
4621
|
+
* `onStart` — without this, `onEnd` reads the mutated id and its delete is
|
|
4622
|
+
* a no-op, so the original entry leaks one pair of map entries per span.
|
|
4623
|
+
*/
|
|
4624
|
+
dropPathInfo(spanId: string): void;
|
|
4618
4625
|
clear(): void;
|
|
4619
4626
|
}
|
|
4620
4627
|
//#endregion
|
|
@@ -4635,6 +4642,7 @@ declare const LaminarAttributes: {
|
|
|
4635
4642
|
declare class LaminarSpan implements Span$1, ReadableSpan {
|
|
4636
4643
|
private _span;
|
|
4637
4644
|
private _activated;
|
|
4645
|
+
private _globalActiveContext?;
|
|
4638
4646
|
constructor(span: Span$1, activated?: boolean);
|
|
4639
4647
|
name: string;
|
|
4640
4648
|
kind: SpanKind;
|
|
@@ -4661,6 +4669,7 @@ declare class LaminarSpan implements Span$1, ReadableSpan {
|
|
|
4661
4669
|
setStatus(status: SpanStatus): this;
|
|
4662
4670
|
updateName(name: string): this;
|
|
4663
4671
|
end(endTime?: TimeInput): void;
|
|
4672
|
+
setGlobalActiveContext(context: Context): void;
|
|
4664
4673
|
set activated(activated: boolean);
|
|
4665
4674
|
isRecording(): boolean;
|
|
4666
4675
|
recordException(exception: Exception, time?: TimeInput): void;
|
|
@@ -4967,6 +4976,14 @@ declare class Laminar {
|
|
|
4967
4976
|
* @param {string} options.userId - user ID to associate with the span.
|
|
4968
4977
|
* @param {string} options.sessionId - session ID to associate with the span.
|
|
4969
4978
|
* @param {Record<string, any>} options.metadata - metadata to associate with the span.
|
|
4979
|
+
* @param {boolean} options.global - when true, the span is registered on a
|
|
4980
|
+
* process-global context stack so that any subsequent `startSpan` /
|
|
4981
|
+
* `startActiveSpan` call (including from unrelated async tasks) uses it as
|
|
4982
|
+
* the parent. Use this for spans that span multiple disconnected async
|
|
4983
|
+
* callbacks — e.g. the root span of an OpenAI Agents trace, where child
|
|
4984
|
+
* spans are created from independent `TracingProcessor` callbacks that do
|
|
4985
|
+
* not share an async context. Defaults to false; the span still activates
|
|
4986
|
+
* within the current async context as usual.
|
|
4970
4987
|
* @returns The started span.
|
|
4971
4988
|
*
|
|
4972
4989
|
* @example
|
|
@@ -5007,7 +5024,8 @@ declare class Laminar {
|
|
|
5007
5024
|
userId,
|
|
5008
5025
|
sessionId,
|
|
5009
5026
|
metadata,
|
|
5010
|
-
startTime
|
|
5027
|
+
startTime,
|
|
5028
|
+
global
|
|
5011
5029
|
}: {
|
|
5012
5030
|
name: string;
|
|
5013
5031
|
input?: any;
|
|
@@ -5019,6 +5037,7 @@ declare class Laminar {
|
|
|
5019
5037
|
sessionId?: string;
|
|
5020
5038
|
metadata?: Record<string, any>;
|
|
5021
5039
|
startTime?: TimeInput;
|
|
5040
|
+
global?: boolean;
|
|
5022
5041
|
}): Span$1;
|
|
5023
5042
|
private static _startSpan;
|
|
5024
5043
|
/**
|
|
@@ -11744,6 +11763,109 @@ declare function wrapLanguageModel(languageModel: LanguageModelV2): LanguageMode
|
|
|
11744
11763
|
*/
|
|
11745
11764
|
declare function instrumentClaudeAgentQuery(originalQuery: any): any;
|
|
11746
11765
|
//#endregion
|
|
11766
|
+
//#region src/opentelemetry-lib/instrumentation/mastra/types.d.ts
|
|
11767
|
+
interface MastraSpanErrorInfo {
|
|
11768
|
+
message: string;
|
|
11769
|
+
name?: string;
|
|
11770
|
+
stack?: string;
|
|
11771
|
+
details?: Record<string, unknown>;
|
|
11772
|
+
}
|
|
11773
|
+
interface MastraExportedSpan {
|
|
11774
|
+
id: string;
|
|
11775
|
+
traceId: string;
|
|
11776
|
+
parentSpanId?: string;
|
|
11777
|
+
name: string;
|
|
11778
|
+
type: string;
|
|
11779
|
+
startTime: Date;
|
|
11780
|
+
endTime?: Date;
|
|
11781
|
+
attributes?: Record<string, any>;
|
|
11782
|
+
metadata?: Record<string, any>;
|
|
11783
|
+
tags?: string[];
|
|
11784
|
+
input?: unknown;
|
|
11785
|
+
output?: unknown;
|
|
11786
|
+
errorInfo?: MastraSpanErrorInfo;
|
|
11787
|
+
isEvent: boolean;
|
|
11788
|
+
isRootSpan: boolean;
|
|
11789
|
+
}
|
|
11790
|
+
interface MastraTracingEvent {
|
|
11791
|
+
type: "span_started" | "span_updated" | "span_ended";
|
|
11792
|
+
exportedSpan: MastraExportedSpan;
|
|
11793
|
+
}
|
|
11794
|
+
interface MastraExporterOptions {
|
|
11795
|
+
/**
|
|
11796
|
+
* Flush the underlying span processor after every span end. Useful for
|
|
11797
|
+
* short-lived processes that exit before the batch processor would drain
|
|
11798
|
+
* on its own.
|
|
11799
|
+
*/
|
|
11800
|
+
realtime?: boolean;
|
|
11801
|
+
/**
|
|
11802
|
+
* When true (default), reparent Mastra traces under the caller's active
|
|
11803
|
+
* OpenTelemetry span if one exists. This lets `observe()`-wrapped code that
|
|
11804
|
+
* calls a Mastra agent produce a single unified trace instead of two
|
|
11805
|
+
* disconnected ones (user's OTel trace + Mastra's own trace).
|
|
11806
|
+
*
|
|
11807
|
+
* Mastra does not propagate OTel context into its event bus, so without
|
|
11808
|
+
* this we'd emit under Mastra's self-assigned trace id with no parent.
|
|
11809
|
+
* Set to false to preserve Mastra's original trace id even when nested
|
|
11810
|
+
* inside `observe()`.
|
|
11811
|
+
*/
|
|
11812
|
+
linkToActiveContext?: boolean;
|
|
11813
|
+
}
|
|
11814
|
+
//#endregion
|
|
11815
|
+
//#region src/opentelemetry-lib/instrumentation/mastra/exporter.d.ts
|
|
11816
|
+
/**
|
|
11817
|
+
* Bridges Mastra's ObservabilityExporter contract to Laminar's OTLP ingestion.
|
|
11818
|
+
*
|
|
11819
|
+
* Span-type mapping:
|
|
11820
|
+
* - `model_step` → LLM (atomic LLM call; rendered with message history).
|
|
11821
|
+
* - `tool_call`, `mcp_tool_call` → TOOL.
|
|
11822
|
+
* - `model_chunk` → dropped (per-delta, noise).
|
|
11823
|
+
* - everything else → DEFAULT.
|
|
11824
|
+
*
|
|
11825
|
+
* Tool-call reconstruction: Mastra's `extractStepInput` collapses prior tool
|
|
11826
|
+
* calls/results into empty user messages on MODEL_STEP inputs, so we
|
|
11827
|
+
* reconstruct the full conversation by accumulating (baseMessages → step0's
|
|
11828
|
+
* assistant message → tool-result message(s) → step1's assistant message →
|
|
11829
|
+
* …) using the parent MODEL_GENERATION's input and the children TOOL_CALL
|
|
11830
|
+
* spans paired by arrival order with each step's declared toolCalls.
|
|
11831
|
+
*
|
|
11832
|
+
* For LLM spans we emit `ai.prompt.messages` (stringified AI SDK messages
|
|
11833
|
+
* with tool-call / tool-result content parts) and `ai.response.text` +
|
|
11834
|
+
* `ai.response.toolCalls` so Laminar's backend parser threads them into
|
|
11835
|
+
* the LLM message history view.
|
|
11836
|
+
*/
|
|
11837
|
+
declare class MastraExporter {
|
|
11838
|
+
readonly name = "laminar";
|
|
11839
|
+
private readonly config;
|
|
11840
|
+
private readonly traceMap;
|
|
11841
|
+
private readonly generationStateById;
|
|
11842
|
+
private readonly generationAttrsById;
|
|
11843
|
+
private readonly generationIdByStepId;
|
|
11844
|
+
private readonly stepIndexBySpanId;
|
|
11845
|
+
private readonly liveOtelSpanByMastraId;
|
|
11846
|
+
private warnedNotInitialized;
|
|
11847
|
+
constructor(options?: MastraExporterOptions);
|
|
11848
|
+
init(_options?: unknown): void;
|
|
11849
|
+
exportTracingEvent(event: MastraTracingEvent): Promise<void>;
|
|
11850
|
+
onTracingEvent(event: MastraTracingEvent): Promise<void>;
|
|
11851
|
+
flush(): Promise<void>;
|
|
11852
|
+
shutdown(): Promise<void>;
|
|
11853
|
+
private handleSpanStarted;
|
|
11854
|
+
private recordSpanPath;
|
|
11855
|
+
private handleSpanEnded;
|
|
11856
|
+
private initGenerationState;
|
|
11857
|
+
private captureReasoningChunk;
|
|
11858
|
+
private updateGenerationStateOnSpanEnd;
|
|
11859
|
+
private getOrCreateTraceState;
|
|
11860
|
+
private startOtelSpan;
|
|
11861
|
+
private warnNotInitializedOnce;
|
|
11862
|
+
private buildParentContext;
|
|
11863
|
+
private applyEndAttributes;
|
|
11864
|
+
private buildLaminarAttributes;
|
|
11865
|
+
private applyLlmAttributes;
|
|
11866
|
+
private applyToolAttributes;
|
|
11867
|
+
}
|
|
11868
|
+
//#endregion
|
|
11747
11869
|
//#region src/opentelemetry-lib/tracing/index.d.ts
|
|
11748
11870
|
/**
|
|
11749
11871
|
* Get the tracer provider. Returns Laminar's tracer provider if Laminar is initialized,
|
|
@@ -11811,5 +11933,5 @@ declare const initializeLaminarInstrumentations: (options?: {
|
|
|
11811
11933
|
sessionRecordingOptions?: SessionRecordingOptions;
|
|
11812
11934
|
}) => Instrumentation<_$_opentelemetry_instrumentation0.InstrumentationConfig>[];
|
|
11813
11935
|
//#endregion
|
|
11814
|
-
export { type Datapoint, EvaluationDataset as Dataset, type Dataset as DatasetType, type EvaluationDatapoint, type EvaluationDatapointDatasetLink, type EvaluatorFunction, type EvaluatorFunctionReturn, type Event, HumanEvaluator, Laminar, LaminarAttributes, LaminarClient, LaminarDataset, type LaminarSpanContext, LaminarSpanProcessor, type MaskInputOptions, type PushDatapointsResponse, type SessionRecordingOptions, type Span, TracingLevel, evaluate, getTracer, getTracerProvider, initializeLaminarInstrumentations, instrumentClaudeAgentQuery, observe, observeDecorator, observeExperimentalDecorator, withTracingLevel, wrapAISDK, wrapLanguageModel };
|
|
11936
|
+
export { type Datapoint, EvaluationDataset as Dataset, type Dataset as DatasetType, type EvaluationDatapoint, type EvaluationDatapointDatasetLink, type EvaluatorFunction, type EvaluatorFunctionReturn, type Event, HumanEvaluator, Laminar, LaminarAttributes, LaminarClient, LaminarDataset, type LaminarSpanContext, LaminarSpanProcessor, type MaskInputOptions, MastraExporter, type MastraExporterOptions, type PushDatapointsResponse, type SessionRecordingOptions, type Span, TracingLevel, evaluate, getTracer, getTracerProvider, initializeLaminarInstrumentations, instrumentClaudeAgentQuery, observe, observeDecorator, observeExperimentalDecorator, withTracingLevel, wrapAISDK, wrapLanguageModel };
|
|
11815
11937
|
//# sourceMappingURL=index.d.mts.map
|