DevToolsClient
Low-level devtools client and tracer wiring over the current Socket.
DevToolsClient speaks the devtools NDJSON protocol used by the unstable devtools integration. It sends span starts, span events, span completions, ping messages, and metric snapshots through a socket, then exposes tracer layers that forward telemetry while preserving the current tracer's behavior.
Constructors
Signature
declare const make: Effect.Effect<DevToolsClient["Service"], never, Scope.Scope | Socket.Socket>;makeTracer
Creates a tracer that delegates to the current tracer while sending span starts, span events, and span ends to DevToolsClient.
Signature
declare const makeTracer: Effect.Effect<Tracer.Tracer, never, DevToolsClient>;Layers
Layer that provides DevToolsClient using the current Socket.
When to use
Use to provide the low-level DevToolsClient service over an existing Socket for custom devtools integrations that send telemetry through the client directly.
Details
It delegates to make, so it speaks the devtools NDJSON protocol over the provided Socket, sends periodic pings, responds to metrics snapshot requests, and finalizes its background fibers when the layer scope closes.
Gotchas
This layer only provides the client. It does not install the devtools tracer by itself.
See
makefor constructing the client as a scoped effect instead of a layerlayerTracerfor a higher-level layer that creates the client and installs the devtools tracer
Signature
declare const layer: Layer.Layer<DevToolsClient, never, Socket.Socket>;layerTracer
Layer that creates a DevToolsClient from the current Socket and installs the devtools tracer.
Signature
declare const layerTracer: Layer.Layer<never, never, Socket.Socket>;Services
DevToolsClient
Service for sending span and span-event telemetry to the Effect devtools connection.
Signature
declare class DevToolsClient extends Shape<
"effect/devtools/DevToolsClient",
{
readonly sendUnsafe: (
_:
| Span
| {
readonly _tag: "SpanEvent";
readonly attributes:
| {
[key: string]: any;
}
| undefined;
readonly name: string;
readonly spanId: string;
readonly startTime: bigint;
readonly traceId: string;
},
) => void;
},
this
> {
constructor(_: never);
}
Creates a devtools client over the current
Socket, speaking the devtools NDJSON protocol, sending periodic pings, and responding to metrics snapshot requests.When to use
Use when you already have a
Socketand need the low-levelDevToolsClientservice to exchange devtools telemetry directly.Details
The effect requires
Scopebecause it starts background fibers for the socket stream and heartbeat.Gotchas
makecreates only the client service; tracing is installed separately.See
layerfor providing the client as a layermakeTracerfor creating a tracer after aDevToolsClientis availablelayerTracerfor creating the client from the currentSocketand installing the tracer as a layer