DebugModel overview
Core Debug service types and tagged errors.
Added in v0.0.0
Table of contents
Command
Command (interface)
Command envelope describing a debugger request.
Signature
export interface Command<A, I = unknown> {
readonly transport: Transport
readonly command: string
readonly params?: I | undefined
readonly sessionId?: string | undefined
readonly targetId?: string | undefined
readonly response: Schema.Schema<A>
}
Added in v0.0.0
cdpCommand
Construct a CDP command envelope using the transport from context. This is a convenience function that automatically uses CurrentTransport.
Signature
export declare const cdpCommand: <A, I = unknown>(
options: Omit<Command<A, I>, "transport">
) => Effect.Effect<Command<A, I>, never, Transport>
Example
import { Debug, cdpCommand } from "@effect-native/debug"
import * as Effect from "effect/Effect"
import * as Schema from "effect/Schema"
const EnableDebugger = cdpCommand({
command: "Debugger.enable",
response: Schema.Struct({ debuggerId: Schema.String })
})
// Use with layerCdp which provides CurrentTransport
const program = (wsUrl: string) =>
Effect.gen(function* () {
const debug = yield* Debug
const session = yield* debug.connect({ endpoint: wsUrl })
const cmd = yield* EnableDebugger
yield* debug.sendCommand(session, cmd)
})
Added in v0.0.0
command
Construct a typed command envelope.
Signature
export declare const command: <A, I = unknown>(options: Command<A, I>) => Command<A, I>
Added in v0.0.0
Connection
ConnectOptions (interface)
Connection options for establishing a Debug session.
Signature
export interface ConnectOptions {
readonly endpoint: string
readonly transport?: Transport
}
Added in v0.0.0
Errors
DebugCommandError (class)
Error produced when the remote protocol reports a failure.
Signature
export declare class DebugCommandError
Added in v0.0.0
DebugDecodeError (class)
Error produced when decoding a command response fails.
Signature
export declare class DebugDecodeError
Added in v0.0.0
DebugError (type alias)
Union of errors emitted by the Debug service.
Signature
export type DebugError =
| DebugStateError
| DebugTransportError
| DebugCommandError
| DebugDecodeError
| DebugInvalidMessage
Added in v0.0.0
DebugInvalidMessage (class)
Error produced when incoming protocol data is malformed.
Signature
export declare class DebugInvalidMessage
Added in v0.0.0
DebugStateError (class)
Error produced when a session reference is invalid.
Signature
export declare class DebugStateError
Added in v0.0.0
DebugTransportError (class)
Error produced when the underlying transport fails.
Signature
export declare class DebugTransportError
Added in v0.0.0
Events
Event (interface)
Event emitted by a Debug session.
Signature
export interface Event {
readonly transport: Transport
readonly method: string
readonly params?: unknown
readonly sessionId?: string | undefined
readonly targetId?: string | undefined
}
Added in v0.0.0
Identifiers
SessionTypeId
Unique symbol for Debug sessions.
Signature
export declare const SessionTypeId: typeof SessionTypeId
Added in v0.0.0
Service
Debug
Debug service tag.
Signature
export declare const Debug: Context.Tag<Service, Service>
Added in v0.0.0
Service (interface)
Debug service interface exposing protocol-agnostic operations.
Signature
export interface Service {
readonly connect: (options: ConnectOptions) => Effect.Effect<Session, DebugError, Scope.Scope | Transport>
readonly disconnect: (session: Session) => Effect.Effect<void, DebugError>
readonly sendCommand: <A, I = unknown>(session: Session, cmd: Command<A, I>) => Effect.Effect<A, DebugError>
readonly subscribe: (session: Session) => Effect.Effect<Stream.Stream<Event>, DebugError, Scope.Scope>
}
Added in v0.0.0
Session
Session (interface)
Represents an active Debug session.
Signature
export interface Session {
readonly [SessionTypeId]: typeof SessionTypeId
readonly transport: Transport
readonly endpoint: string
}
Added in v0.0.0
Transport
CdpTransport (interface)
Transport descriptor for debugger protocols.
Signature
export interface CdpTransport {
readonly _tag: "Cdp"
readonly label?: string | undefined
}
Added in v0.0.0
CurrentTransport
Context tag for the current transport. Automatically provided by layer implementations (e.g., layerCdp).
Signature
export declare const CurrentTransport: Context.Tag<CdpTransport, CdpTransport>
Added in v0.0.0
Transport
Helpers for constructing transport descriptors.
Signature
export declare const Transport: { readonly cdp: (options?: { readonly label?: string | undefined }) => CdpTransport }
Added in v0.0.0
Transport (type alias)
Union of supported transports.
Signature
export type Transport = CdpTransport
Added in v0.0.0