---
title: "Utilities & Runtime"
description: "Use Blyp's runtime detector, color helpers, config helpers, and log directory utilities."
canonical_url: "https://www.blyp.dev/docs/reference"
markdown_url: "https://www.blyp.dev/docs/reference.md"
last_updated: "2018-10-20"
x_farming_labs_generated_preamble: true
---

# Utilities & Runtime
URL: /docs/reference
LLM index: /llms.txt
Description: Use Blyp's runtime detector, color helpers, config helpers, and log directory utilities.

# Utilities & Runtime

## Runtime detection

```ts
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:

- `file.existsSync`
- `file.mkdirSync`
- `file.writeFileSync`
- `path.join`
- `env.get`
- `cwd()`

## Color helpers

```ts
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

```ts
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

```ts
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:

```ts
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:

```ts
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](/docs/ai), [AI Tracing](/docs/ai/tracing), and [AI Privacy & Capture](/docs/ai/privacy-and-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:

```ts
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.

## Sitemap

See the full [sitemap](/sitemap.md) for all pages.
Docs-scoped sitemap: [/docs/sitemap.md](/docs/sitemap.md).
Well-known sitemap: [/.well-known/sitemap.md](/.well-known/sitemap.md).
