// Wrapped (server-only — intentionally omitted from browser.ts
// since it pulls in per-org repositories that the browser bundle doesn't
// need). The generic `wrapped/` barrel also re-exports the Claude Code
// type's surface, so consumers that only deal with claude_code today
// don't need to import from `wrapped/types/claude-code` directly.

export {
  SESSION_ID_MAX_LENGTH,
  SPAN_ID_LENGTH,
  TRACE_COHORT_SUMMARY_CACHE_TTL_SECONDS,
  TRACE_END_DEBOUNCE_MS,
  TRACE_ID_LENGTH,
  TRACE_SEARCH_CHARS_PER_TOKEN_ESTIMATE,
  TRACE_SEARCH_CHUNK_HEAD_BUDGET_CHARS,
  TRACE_SEARCH_CHUNK_MAX_CHARS,
  TRACE_SEARCH_CHUNK_OVERLAP_CHARS,
  TRACE_SEARCH_CHUNK_TAIL_BUDGET_CHARS,
  TRACE_SEARCH_DEFAULT_DAILY_EMBED_BUDGET_TOKENS,
  TRACE_SEARCH_DEFAULT_MONTHLY_EMBED_BUDGET_TOKENS,
  TRACE_SEARCH_DEFAULT_WEEKLY_EMBED_BUDGET_TOKENS,
  TRACE_SEARCH_DOCUMENT_LOOKBACK_DAYS,
  TRACE_SEARCH_DOCUMENT_MAX_ESTIMATED_TOKENS,
  TRACE_SEARCH_DOCUMENT_MAX_LENGTH,
  TRACE_SEARCH_EMBEDDING_DIMENSIONS,
  TRACE_SEARCH_EMBEDDING_LOOKBACK_DAYS,
  TRACE_SEARCH_EMBEDDING_MIN_LENGTH,
  TRACE_SEARCH_EMBEDDING_MODEL,
  TRACE_SEARCH_MIN_RELEVANCE_SCORE,
} from "./constants.ts"
export type { Session } from "./entities/session.ts"
export { sessionSchema } from "./entities/session.ts"
export type { Operation, Span, SpanDetail, SpanKind, SpanStatusCode, ToolDefinition } from "./entities/span.ts"
export {
  operationSchema,
  spanDetailSchema,
  spanKindSchema,
  spanSchema,
  spanStatusCodeSchema,
  toolDefinitionSchema,
} from "./entities/span.ts"
export type { Trace, TraceDetail } from "./entities/trace.ts"
export { traceDetailSchema, traceSchema } from "./entities/trace.ts"
export { SpanDecodingError } from "./errors.ts"
export {
  isLlmCompletionOperation,
  resolveLastLlmCompletionSpanId,
} from "./helpers/resolve-last-llm-completion-span.ts"
export { resolveScoreTraceContext } from "./helpers/resolve-score-trace-context.ts"
export {
  resolveTraceIdFromRef,
  resolveTraceIdsFromRef,
  type TraceRef,
  type TracesRef,
  traceRefSchema,
  tracesRefSchema,
} from "./helpers/trace-ref.ts"
export {
  alignUnixSecondsToHistogramBucket,
  denseTraceTimeHistogramBuckets,
  mergeTraceHistogramTimeFilters,
  parseStartTimeBoundsFromFilters,
  pickTraceHistogramBucketSeconds,
  resolveTraceHistogramRangeIso,
} from "./helpers.ts"
export type { EmbedBudgetLimits, EmbedBudgetResolverShape } from "./ports/embed-budget-resolver.ts"
export { EmbedBudgetResolver } from "./ports/embed-budget-resolver.ts"
export type {
  SessionDistinctColumn,
  SessionListCursor,
  SessionListOptions,
  SessionListPage,
  SessionMetrics,
  SessionRepositoryShape,
} from "./ports/session-repository.ts"
export { emptySessionMetrics, SessionRepository } from "./ports/session-repository.ts"
export type { SpanListOptions, SpanMessagesData, SpanRepositoryShape } from "./ports/span-repository.ts"
export { SpanRepository } from "./ports/span-repository.ts"
export type {
  NumericRollup,
  TraceDistinctColumn,
  TraceDistribution,
  TraceHistogramMetric,
  TraceListCursor,
  TraceListOptions,
  TraceListPage,
  TraceMetrics,
  TraceRepositoryShape,
  TraceTimeHistogramBucket,
} from "./ports/trace-repository.ts"
export {
  emptyTraceDistribution,
  emptyTraceMetrics,
  emptyTraceTimeHistogramBucket,
  isTraceHistogramMetric,
  TRACE_HISTOGRAM_METRICS,
  TraceRepository,
} from "./ports/trace-repository.ts"
export type { TraceSearchBudgetShape } from "./ports/trace-search-budget.ts"
export { TraceSearchBudget } from "./ports/trace-search-budget.ts"
export type {
  TraceSearchDocumentRow,
  TraceSearchEmbeddingRow,
  TraceSearchRepositoryShape,
} from "./ports/trace-search-repository.ts"
export { TraceSearchRepository } from "./ports/trace-search-repository.ts"
export {
  buildTraceCohortSummaryEntries,
  buildTraceMetricBaseline,
  buildTraceMetricBaselines,
  emptyTraceCohortSummaryEntry,
  evaluateTraceResourceOutliers,
  getTraceCohortMetricValue,
  getTraceMetricPercentileThreshold,
  isTraceCohortKeyAvailable,
  isTraceCohortMetricEligible,
  isTraceMetricPercentileAvailable,
  TRACE_COHORT_MEDIAN_X3_MIN_SAMPLES,
  TRACE_COHORT_P90_MIN_SAMPLES,
  TRACE_COHORT_P95_MIN_SAMPLES,
  TRACE_COHORT_P99_MIN_SAMPLES,
  TRACE_RESOURCE_OUTLIER_MULTIPLIER,
  type TraceCohortBaselineData,
  type TraceCohortKey,
  type TraceCohortMetric,
  type TraceCohortSummary,
  type TraceCohortSummaryEntry,
  type TraceCohortThresholdMode,
  type TraceCohortUnavailableReason,
  type TraceMetricBaseline,
  type TraceMetricPercentileLevel,
  type TraceMetricPercentiles,
  type TraceResourceOutlierEvaluation,
  type TraceResourceOutlierReason,
  traceCohortKeys,
  traceCohortMetrics,
  traceResourceOutlierSeverityRank,
} from "./trace-cohorts.ts"
export type {
  TraceSearchChunk,
  TraceSearchDocument,
  TraceSearchDocumentInput,
} from "./use-cases/build-trace-search-document.ts"
export { buildTraceSearchDocument } from "./use-cases/build-trace-search-document.ts"
export type {
  BuildTracesExportInput,
  BuildTracesExportResult,
} from "./use-cases/build-traces-export.ts"
export { buildTracesExportUseCase } from "./use-cases/build-traces-export.ts"
export type { GetTraceCohortSummaryByTagsInput } from "./use-cases/get-trace-cohort-summary-by-tags.ts"
export { getTraceCohortSummaryByTagsUseCase } from "./use-cases/get-trace-cohort-summary-by-tags.ts"
export type { IngestSpansInput } from "./use-cases/ingest-spans.ts"
export { ingestSpansUseCase } from "./use-cases/ingest-spans.ts"
export { ingestSpansWithBillingUseCase } from "./use-cases/ingest-spans-with-billing.ts"
export type {
  LoadTraceForTraceEndFound,
  LoadTraceForTraceEndResult,
  LoadTraceForTraceEndSkipped,
} from "./use-cases/load-trace-for-trace-end.ts"
export { loadTraceForTraceEndUseCase } from "./use-cases/load-trace-for-trace-end.ts"
export { buildConversationSpanMaps } from "./use-cases/map-conversation-to-spans.ts"
export type { ParsedSearchQuery } from "./use-cases/parse-search-query.ts"
export { parseSearchQuery } from "./use-cases/parse-search-query.ts"
export type { ProcessIngestedSpansDeps, ProcessIngestedSpansInput } from "./use-cases/process-ingested-spans.ts"
export { processIngestedSpansUseCase } from "./use-cases/process-ingested-spans.ts"
export type {
  SelectTraceEndItemsError,
  TraceEndSelectionDecision,
  TraceEndSelectionInput,
  TraceEndSelectionReason,
  TraceEndSelectionResult,
  TraceEndSelectionSpec,
} from "./use-cases/select-trace-end-items.ts"
export { selectTraceEndItemsUseCase } from "./use-cases/select-trace-end-items.ts"
export type { TraceEndItemDecisionCounts } from "./use-cases/summarize-trace-end-item-decisions.ts"
export { summarizeTraceEndItemDecisions } from "./use-cases/summarize-trace-end-item-decisions.ts"
export {
  type AssembleReportInput,
  type AssignPersonalityInput,
  assembleReport,
  assignPersonality,
  BASELINE_SHARE,
  type BashPatternRow,
  type BiggestWriteRow,
  type BranchRow,
  type BuildReportInput,
  type BusiestDayRow,
  buildReportUseCase,
  ClaudeCodeSpanReader,
  type ClaudeCodeSpanReaderShape,
  CURRENT_REPORT_VERSION,
  consultantGatePasses,
  type FileLine,
  type FileTouchesRow,
  type HeatmapCellRow,
  type LocStats,
  type LocStatsRow,
  listProjectsWithClaudeCodeSpansUseCase,
  type OrgProjectPair,
  PERSONALITY_KINDS,
  type Personality,
  type PersonalityKind,
  type ProjectWindowInput,
  pickReadAnchor,
  pickWrittenAnchor,
  REPORT_VERSIONS,
  type Report,
  type ReportV1,
  type ReportVersion,
  type RunWrappedInput,
  type RunWrappedResult,
  type RunWrappedSkippedReason,
  runWrappedUseCase,
  SCHEMA_BY_VERSION,
  type SessionDurationStatsRow,
  scholarGatePasses,
  shipperGatePasses,
  strategistGatePasses,
  TOOL_BUCKETS,
  type ToolBucket,
  type ToolMix,
  type ToolMixRow,
  type TopBashCommand,
  testerGatePasses,
  toolBucketFor,
  type WindowInput,
  type WorkspaceDeepDive,
  type WorkspaceDeepDiveRow,
  type WorkspaceRow,
  WRAPPED_REPORT_TYPES,
  type WrappedReportRecord,
  WrappedReportRepository,
  type WrappedReportRepositoryShape,
  type WrappedReportSummary,
  type WrappedReportType,
  type WrappedTotalsRow,
} from "./wrapped/index.ts"
