Blyp Docs

Utilities & Runtime

Runtime detection

import { runtime, createRuntimeAdapter, createLogDir } from "@blyp/core";

console.log(runtime.type);   // "bun" or "node"
console.log(runtime.isBun);  // boolean
console.log(runtime.isNode); // boolean

runtime exposes a RuntimeAdapter with:

Color helpers

import {
  getMethodColor,
  getStatusColor,
  getArrowForMethod,
  getResponseTimeColor,
  getColoredLevel,
  colors,
} from "@blyp/core";

These helpers power Blyp's pretty console output and are useful in custom CLIs or reporting tools.

Config helpers

import {
  DEFAULT_CONFIG,
  DEFAULT_CLIENT_LOGGING_CONFIG,
  DEFAULT_CONNECTOR_DELIVERY_CONFIG,
  DEFAULT_CONNECTOR_RETRY_CONFIG,
  DEFAULT_DATABASE_DELIVERY_CONFIG,
  DEFAULT_DATABASE_RETRY_CONFIG,
  DEFAULT_FILE_CONFIG,
  DEFAULT_REDACTION_CONFIG,
  DEFAULT_ROTATION_CONFIG,
  clearConnectorDeadLetters,
  connectorQueueExists,
  getConnectorDeliveryStatusSummary,
  getConnectorQueuePath,
  getConfig,
  listConnectorDeadLetters,
  loadConfig,
  mergeBlypConfig,
  resolveConfig,
  retryConnectorDeadLetters,
  resetConfigCache,
  type ResolvedBlypConfig,
} from "@blyp/core";

Use them when you want to inspect defaults, merge overrides manually, or reset config state in tests.

loadConfig(), resolveConfig(), and getConfig() return ResolvedBlypConfig, which means the returned object already has normalized destination, file, clientLogging, and connector/database state.

The connector queue helpers let Studio or custom operational tooling find the queue path, inspect delivery status, list dead letters, retry them, or clear them after recovery.

Database helpers

import {
  createDrizzleDatabaseAdapter,
  createPrismaDatabaseAdapter,
  type DatabaseAdapterConfig,
  type DatabaseDialect,
  type DatabaseLoggerConfig,
  type ResolvedDatabaseLoggerConfig,
} from "@blyp/core/database";

Use these when destination: "database" is the primary sink and you want typed adapter configuration for Prisma or Drizzle.

AI tracing exports

AI tracing is split across dedicated entrypoints:

import { blypPlugin, createBetterAgentTracker } from "@blyp/core/ai/better-agent";
import { blypMiddleware, blypModel } from "@blyp/core/ai/vercel";
import { blypFetch } from "@blyp/core/ai/fetch";
import { createOpenAITracker, wrapOpenAI } from "@blyp/core/ai/openai";
import { wrapAnthropic } from "@blyp/core/ai/anthropic";

Relevant public types include:

import type {
  BlypBetterAgentOptions,
  BlypBetterAgentRunResolver,
  BlypBetterAgentTracker,
} from "@blyp/core/ai/better-agent";

import type { BlypMiddlewareContext } from "@blyp/core/ai/vercel";

import type {
  BlypCaptureOptions,
  BlypExcludeOptions,
  BlypLimitOptions,
  BlypLLMTrace,
  BlypProviderOptions,
  BlypAIProvider,
  BlypSDKContext,
  BlypTraceEvent,
} from "@blyp/core/ai/shared";

Use AI, AI Tracing, and AI Privacy & Capture for the supported setup patterns and privacy defaults.

Structured log exports

The root package also exports the structured log helper and its public types:

import {
  createStructuredLog,
  type StructuredLog,
  type StructuredLogEmitOptions,
  type StructuredLogError,
  type StructuredLogEvent,
  type StructuredLogLevel,
  type StructuredLogPayload,
} from "@blyp/core";

Use these when you want to type helper functions around batched request logs, inspect emitted payloads in tests, or build wrappers on top of Blyp's structured logging flow.