import { PrivacyConfig } from "./core/privacy.js"; import { AmplitudeLike } from "./types.js"; //#region src/decorators.d.ts declare class ToolCallTracker { static _amplitude: AmplitudeLike | null; static _userId: string | null; static _sessionId: string | null; static _traceId: string | null; static _turnId: number; static _env: string | null; static _agentId: string | null; static _parentAgentId: string | null; static _customerOrgId: string | null; static _agentVersion: string | null; static _context: Record | null; static _privacyConfig: PrivacyConfig | null; static _eventProperties: Record | null; static _userProperties: Record | null; static _groups: Record | null; static setAmplitude(amplitude: AmplitudeLike, userId: string, opts?: { sessionId?: string | null; traceId?: string | null; turnId?: number; env?: string | null; agentId?: string | null; parentAgentId?: string | null; customerOrgId?: string | null; agentVersion?: string | null; context?: Record | null; privacyConfig?: PrivacyConfig | null; eventProperties?: Record | null; userProperties?: Record | null; groups?: Record | null; }): void; static clear(): void; static isConfigured(): boolean; } interface ToolOptions { name?: string; toolType?: string | null; toolOwner?: string | null; amplitude?: AmplitudeLike | null; userId?: string | null; sessionId?: string | null; traceId?: string | null; turnId?: number | null; env?: string | null; agentId?: string | null; parentAgentId?: string | null; customerOrgId?: string | null; agentVersion?: string | null; context?: Record | null; privacyConfig?: PrivacyConfig | null; eventProperties?: Record | null; userProperties?: Record | null; groups?: Record | null; inputSchema?: Record | null; timeoutMs?: number | null; onError?: ((error: Error, toolName: string) => void) | null; } type AnyFn = (...args: any[]) => any; /** * Converts a function's return type to Promise-wrapped if not already. * Reflects the fact that tool() always returns an async wrapper. */ type ToolWrapped = T extends ((...args: infer A) => infer R) ? R extends Promise ? (...args: A) => R : (...args: A) => Promise : T; /** * Wraps a function and emits one `[Agent] Tool Call` event per invocation. * * Supports both forms: * - `tool(fn, opts?)` * - `tool(opts)(fn)` * * Resolution order for tracking context is: * runtime overrides > decorator opts > active session context > `ToolCallTracker`. * If tracking is not configured (`amplitude`/`userId` missing), the wrapped function * still executes and no tracking event is emitted. */ declare function tool(fn: T, opts?: ToolOptions): ToolWrapped; declare function tool(opts: ToolOptions): (fn: T) => ToolWrapped; type ObserveSpanType = 'span' | 'tool' | 'agent' | 'llm'; interface ObserveOptions { name?: string; type?: ObserveSpanType; amplitude?: AmplitudeLike | null; userId?: string | null; agentId?: string | null; env?: string | null; privacyConfig?: PrivacyConfig | null; } /** * Converts a function's return type to Promise-wrapped if not already. * Reflects the fact that observe() always returns an async wrapper. */ type ObserveWrapped = T extends ((...args: infer A) => infer R) ? R extends Promise ? (...args: A) => R : (...args: A) => Promise : T; /** * Wraps a function and emits one `[Agent] Span` event per invocation. * * Supports both forms: * - `observe(fn, opts?)` * - `observe(opts)(fn)` * * If called inside an active session context, spans attach to that session. * If no context is active, observe creates a short-lived session boundary and * emits a session-end event when the wrapped function completes. */ declare function observe(fn: T, opts?: ObserveOptions): ObserveWrapped; declare function observe(opts: ObserveOptions): (fn: T) => ObserveWrapped; //#endregion export { ObserveSpanType, ObserveWrapped, ToolCallTracker, ToolWrapped, observe, tool }; //# sourceMappingURL=decorators.d.ts.map