@mastra/core
Version:
51 lines • 2.41 kB
TypeScript
/**
* Resolution of a processor's declared span identity.
*
* A processor may declare the span type, name and attributes it should be
* traced as (see `Processor.spanType`). Spans for processors are created in two
* places — the legacy `ProcessorRunner` and the processor-workflow executor —
* so the resolution lives here and both call it. A declaration honoured by only
* one executor would apply or not depending on how the agent happened to run
* its processors.
*/
import type { ProcessorSpanPayloadPhase } from '../observability/index.js';
import type { Processor, ProcessorSpanPhase } from './index.js';
/** Map a processor-workflow phase string onto the declaration phase. */
export declare function toProcessorSpanPhase(phase: string): ProcessorSpanPhase;
/** The span type a processor declared, or `undefined` to use the default. */
export declare function resolveProcessorSpanType(processor: Pick<Processor, 'spanType'>): import("../observability").ProcessorSpanType | undefined;
/**
* Resolve a processor's declared span name for the phase the span is being
* created in, falling back to the caller's default label.
*/
export declare function resolveProcessorSpanName(processor: Pick<Processor, 'spanName'>, phase: ProcessorSpanPhase, fallback: string): string;
/**
* Resolve a processor's declared span attributes for this phase, with the phase
* itself recorded alongside them.
*
* The phase is applied last so a declaration cannot misreport which phase ran:
* readers narrow a processor span's payloads on this attribute, and a processor
* naming itself into another phase would hand them the wrong shape.
*/
export declare function resolveProcessorSpanAttributes(processor: Pick<Processor, 'spanAttributes'> | undefined, phase: ProcessorSpanPayloadPhase): {
processorPhase: ProcessorSpanPayloadPhase;
internalUsage?: import("../observability").UsageStats;
processorExecutor?: 'workflow' | 'legacy';
processorIndex?: number;
hookDurationMs?: number;
messageListMutations?: Array<{
type: 'add' | 'addSystem' | 'removeByIds' | 'clear';
source?: string;
count?: number;
ids?: string[];
text?: string;
tag?: string;
message?: any;
}>;
tripwireAbort?: {
reason?: string;
retry?: boolean;
metadata?: unknown;
};
};
//# sourceMappingURL=span-declaration.d.ts.map