import { AmplitudeAIError, ConfigurationError, ProviderError, TrackingError, ValidationError } from "./exceptions.js";
import { TIER_FAST, TIER_REASONING, TIER_STANDARD, inferModelTier } from "./utils/model-tiers.js";
import { EVENT_AI_RESPONSE, EVENT_EMBEDDING, EVENT_SCORE, EVENT_SESSION_END, EVENT_SESSION_ENRICHMENT, EVENT_SPAN, EVENT_TOOL_CALL, EVENT_USER_MESSAGE, MAX_SERIALIZED_LENGTH, PROP_ABANDONMENT_TURN, PROP_AGENT_CHAIN, PROP_AGENT_DESCRIPTION, PROP_AGENT_ID, PROP_AGENT_VERSION, PROP_ATTACHMENTS, PROP_ATTACHMENT_COUNT, PROP_ATTACHMENT_TYPES, PROP_CACHE_CREATION_TOKENS, PROP_CACHE_READ_TOKENS, PROP_COMMENT, PROP_COMPONENT_TYPE, PROP_CONTEXT, PROP_COST_USD, PROP_CUSTOMER_ORG_ID, PROP_EDITED_MESSAGE_ID, PROP_EMBEDDING_DIMENSIONS, PROP_ENRICHMENTS, PROP_ENV, PROP_ERROR_MESSAGE, PROP_ERROR_TYPE, PROP_EVALUATION_SOURCE, PROP_FINISH_REASON, PROP_HAS_ATTACHMENTS, PROP_HAS_REASONING, PROP_IDLE_TIMEOUT_MINUTES, PROP_INPUT_STATE, PROP_INPUT_TOKENS, PROP_INVOCATION_ID, PROP_IS_EDIT, PROP_IS_ERROR, PROP_IS_REGENERATION, PROP_IS_STREAMING, PROP_LATENCY_MS, PROP_LOCALE, PROP_MAX_OUTPUT_TOKENS, PROP_MESSAGE_ID, PROP_MESSAGE_LABELS, PROP_MESSAGE_LABEL_MAP, PROP_MESSAGE_SOURCE, PROP_MODEL_NAME, PROP_MODEL_TIER, PROP_OUTPUT_STATE, PROP_OUTPUT_TOKENS, PROP_PARENT_AGENT_ID, PROP_PARENT_MESSAGE_ID, PROP_PARENT_SPAN_ID, PROP_PROMPT_ID, PROP_PROVIDER, PROP_QUALITY_SCORE, PROP_REASONING_CONTENT, PROP_REASONING_TOKENS, PROP_REQUEST_COMPLEXITY, PROP_ROOT_AGENT_NAME, PROP_RUNTIME, PROP_SCORE_NAME, PROP_SCORE_VALUE, PROP_SDK_VERSION, PROP_SENTIMENT_SCORE, PROP_SESSION_ID, PROP_SESSION_REPLAY_ID, PROP_SPAN_ID, PROP_SPAN_KIND, PROP_SPAN_NAME, PROP_SYSTEM_PROMPT, PROP_SYSTEM_PROMPT_LENGTH, PROP_TARGET_ID, PROP_TARGET_TYPE, PROP_TASK_FAILURE_REASON, PROP_TASK_FAILURE_TYPE, PROP_TEMPERATURE, PROP_TOOL_CALLS, PROP_TOOL_DEFINITIONS, PROP_TOOL_DEFINITIONS_COUNT, PROP_TOOL_DEFINITIONS_HASH, PROP_TOOL_INPUT, PROP_TOOL_NAME, PROP_TOOL_OUTPUT, PROP_TOOL_OWNER, PROP_TOOL_SUCCESS, PROP_TOOL_TYPE, PROP_TOP_P, PROP_TOTAL_ATTACHMENT_SIZE, PROP_TOTAL_TOKENS, PROP_TRACE_ID, PROP_TTFB_MS, PROP_TURN_ID, PROP_WAS_CACHED, PROP_WAS_COPIED, SDK_RUNTIME, SDK_VERSION } from "./core/constants.js";
import { PrivacyConfig, normalizeToolDefinitions } from "./core/privacy.js";
import { serializeToJsonString, trackAiMessage, trackConversation, trackEmbedding, trackScore, trackSessionEnd, trackSessionEnrichment, trackSpan, trackToolCall, trackUserMessage } from "./core/tracking.js";
import { SessionContext, getActiveContext, isTrackerManaged, pushContext, runWithContext, runWithContextAsync } from "./context.js";
import { isServerless } from "./serverless.js";
import { Session } from "./session.js";
import { BoundAgent } from "./bound-agent.js";
import { AIConfig, ContentMode } from "./config.js";
import { inferProviderFromModel } from "./utils/providers.js";
import { calculateCost, enableLivePriceUpdates, getGenaiPriceLookupCandidates, inferProvider, stripProviderPrefix } from "./utils/costs.js";
import { extractContext, injectContext } from "./propagation.js";
import { StreamingAccumulator } from "./utils/streaming.js";
import { resolveAmplitude } from "./types.js";
import { ANTHROPIC_AVAILABLE, Anthropic, extractAnthropicContent, extractAnthropicSystemPrompt } from "./providers/anthropic.js";
import { BEDROCK_AVAILABLE, Bedrock, extractBedrockResponse } from "./providers/bedrock.js";
import { GEMINI_AVAILABLE, Gemini, extractGeminiResponse } from "./providers/gemini.js";
import { MISTRAL_AVAILABLE, Mistral } from "./providers/mistral.js";
import { OPENAI_AVAILABLE, OpenAI, WrappedResponses, extractSystemPrompt } from "./providers/openai.js";
import { patch, patchAnthropic, patchAzureOpenAI, patchBedrock, patchGemini, patchMistral, patchOpenAI, patchedProviders, unpatch, unpatchAnthropic, unpatchAzureOpenAI, unpatchBedrock, unpatchGemini, unpatchMistral, unpatchOpenAI } from "./patching.js";
import { TenantHandle } from "./tenant.js";
import { _resetCache, getGitMetadata } from "./utils/git_metadata.js";
import { AmplitudeAI } from "./client.js";
import { ToolCallTracker, observe, tool } from "./decorators.js";
import { EvidenceQuote, MessageLabel, RubricScore, SessionEnrichments, TopicClassification } from "./core/enrichments.js";
import { MockAmplitudeAI } from "./testing.js";
import { GENERATED_FILES, MCP_PROMPTS, MCP_RESOURCES, MCP_SERVER_NAME, MCP_TOOLS } from "./mcp/contract.js";
import { generateVerifyTest } from "./mcp/generate-verify-test.js";
import { instrumentFile } from "./mcp/instrument-file.js";
import { createAmplitudeAIMiddleware } from "./middleware.js";
import { AzureOpenAI } from "./providers/azure-openai.js";
import { GOOGLE_GENAI_AVAILABLE, GoogleGenAI, extractGoogleGenAIResponse } from "./providers/google-genai.js";
import { AmplitudeAIWrapError, wrap } from "./wrappers.js";
import { AmplitudeCallbackHandler, createAmplitudeCallback } from "./integrations/langchain.js";
import { AmplitudeAgentExporter, AmplitudeGenAIExporter, AmplitudeSpanExporter } from "./integrations/opentelemetry.js";
import { AmplitudeLlamaIndexHandler, createAmplitudeLlamaIndexHandler } from "./integrations/llamaindex.js";
import { AmplitudeTracingProcessor } from "./integrations/openai-agents.js";
import { AmplitudeToolLoop } from "./integrations/anthropic-tools.js";
import { AmplitudeCrewAIHooks } from "./integrations/crewai.js";
import { countMessageTokens, countTokens, estimateTokens } from "./utils/tokens.js";

export { AIConfig, ANTHROPIC_AVAILABLE, OPENAI_AVAILABLE as AZURE_OPENAI_AVAILABLE, AmplitudeAI, AmplitudeAIError, AmplitudeAIWrapError, AmplitudeAgentExporter, AmplitudeCallbackHandler, AmplitudeCrewAIHooks, AmplitudeGenAIExporter, AmplitudeLlamaIndexHandler, AmplitudeSpanExporter, AmplitudeToolLoop, AmplitudeTracingProcessor, Anthropic, AzureOpenAI, BEDROCK_AVAILABLE, Bedrock, BoundAgent, ConfigurationError, ContentMode, EVENT_AI_RESPONSE, EVENT_EMBEDDING, EVENT_SCORE, EVENT_SESSION_END, EVENT_SESSION_ENRICHMENT, EVENT_SPAN, EVENT_TOOL_CALL, EVENT_USER_MESSAGE, EvidenceQuote, GEMINI_AVAILABLE, GENERATED_FILES, GOOGLE_GENAI_AVAILABLE, Gemini, GoogleGenAI, MAX_SERIALIZED_LENGTH, MCP_PROMPTS, MCP_RESOURCES, MCP_SERVER_NAME, MCP_TOOLS, MISTRAL_AVAILABLE, MessageLabel, Mistral, MockAmplitudeAI, OPENAI_AVAILABLE, OpenAI, PROP_ABANDONMENT_TURN, PROP_AGENT_CHAIN, PROP_AGENT_DESCRIPTION, PROP_AGENT_ID, PROP_AGENT_VERSION, PROP_ATTACHMENTS, PROP_ATTACHMENT_COUNT, PROP_ATTACHMENT_TYPES, PROP_CACHE_CREATION_TOKENS, PROP_CACHE_READ_TOKENS, PROP_COMMENT, PROP_COMPONENT_TYPE, PROP_CONTEXT, PROP_COST_USD, PROP_CUSTOMER_ORG_ID, PROP_EDITED_MESSAGE_ID, PROP_EMBEDDING_DIMENSIONS, PROP_ENRICHMENTS, PROP_ENV, PROP_ERROR_MESSAGE, PROP_ERROR_TYPE, PROP_EVALUATION_SOURCE, PROP_FINISH_REASON, PROP_HAS_ATTACHMENTS, PROP_HAS_REASONING, PROP_IDLE_TIMEOUT_MINUTES, PROP_INPUT_STATE, PROP_INPUT_TOKENS, PROP_INVOCATION_ID, PROP_IS_EDIT, PROP_IS_ERROR, PROP_IS_REGENERATION, PROP_IS_STREAMING, PROP_LATENCY_MS, PROP_LOCALE, PROP_MAX_OUTPUT_TOKENS, PROP_MESSAGE_ID, PROP_MESSAGE_LABELS, PROP_MESSAGE_LABEL_MAP, PROP_MESSAGE_SOURCE, PROP_MODEL_NAME, PROP_MODEL_TIER, PROP_OUTPUT_STATE, PROP_OUTPUT_TOKENS, PROP_PARENT_AGENT_ID, PROP_PARENT_MESSAGE_ID, PROP_PARENT_SPAN_ID, PROP_PROMPT_ID, PROP_PROVIDER, PROP_QUALITY_SCORE, PROP_REASONING_CONTENT, PROP_REASONING_TOKENS, PROP_REQUEST_COMPLEXITY, PROP_ROOT_AGENT_NAME, PROP_RUNTIME, PROP_SCORE_NAME, PROP_SCORE_VALUE, PROP_SDK_VERSION, PROP_SENTIMENT_SCORE, PROP_SESSION_ID, PROP_SESSION_REPLAY_ID, PROP_SPAN_ID, PROP_SPAN_KIND, PROP_SPAN_NAME, PROP_SYSTEM_PROMPT, PROP_SYSTEM_PROMPT_LENGTH, PROP_TARGET_ID, PROP_TARGET_TYPE, PROP_TASK_FAILURE_REASON, PROP_TASK_FAILURE_TYPE, PROP_TEMPERATURE, PROP_TOOL_CALLS, PROP_TOOL_DEFINITIONS, PROP_TOOL_DEFINITIONS_COUNT, PROP_TOOL_DEFINITIONS_HASH, PROP_TOOL_INPUT, PROP_TOOL_NAME, PROP_TOOL_OUTPUT, PROP_TOOL_OWNER, PROP_TOOL_SUCCESS, PROP_TOOL_TYPE, PROP_TOP_P, PROP_TOTAL_ATTACHMENT_SIZE, PROP_TOTAL_TOKENS, PROP_TRACE_ID, PROP_TTFB_MS, PROP_TURN_ID, PROP_WAS_CACHED, PROP_WAS_COPIED, PrivacyConfig, ProviderError, RubricScore, SDK_RUNTIME, SDK_VERSION, Session, SessionContext, SessionEnrichments, StreamingAccumulator, TIER_FAST, TIER_REASONING, TIER_STANDARD, TenantHandle, ToolCallTracker, TopicClassification, TrackingError, ValidationError, WrappedResponses, _resetCache as _resetGitCache, calculateCost, countMessageTokens, countTokens, createAmplitudeAIMiddleware, createAmplitudeCallback, createAmplitudeLlamaIndexHandler, enableLivePriceUpdates, estimateTokens, extractAnthropicContent, extractAnthropicSystemPrompt, extractBedrockResponse, extractContext, extractGeminiResponse, extractGoogleGenAIResponse, extractSystemPrompt, generateVerifyTest, getActiveContext, getGenaiPriceLookupCandidates, getGitMetadata, inferModelTier, inferProvider, inferProviderFromModel, injectContext, instrumentFile, isServerless, isTrackerManaged, normalizeToolDefinitions, observe, patch, patchAnthropic, patchAzureOpenAI, patchBedrock, patchGemini, patchMistral, patchOpenAI, patchedProviders, pushContext, resolveAmplitude, runWithContext, runWithContextAsync, serializeToJsonString, stripProviderPrefix, tool, trackAiMessage, trackConversation, trackEmbedding, trackScore, trackSessionEnd, trackSessionEnrichment, trackSpan, trackToolCall, trackUserMessage, unpatch, unpatchAnthropic, unpatchAzureOpenAI, unpatchBedrock, unpatchGemini, unpatchMistral, unpatchOpenAI, wrap };