tuil
ReferencePackages

@mwillbanks/tuil-protocol

Versioned in-process and remote-ready runtime inspection protocol for tuil.

View rawEdit

Overview

Versioned in-process and remote-ready runtime inspection protocol for tuil.

@mwillbanks/tuil-protocol is independently installable and also participates in the umbrella @mwillbanks/tuil runtime where applicable.

Installation

npm install @mwillbanks/tuil-protocol

How it operates

The devtools protocol defines versioned messages, in-process transport, and safe-by-default session recording, import, export, and deterministic replay. Every recorded payload is recursively cloned and redacted before it can appear in a recorder snapshot or export.

Documentation flow diagram. connect; negotiate version; exchange; record/replay; close; S0 leads to S1; S1 leads to S2; S2 leads to S3
Documentation flow diagram. connect; negotiate version; exchange; record/replay; close; S0 leads to S1; S1 leads to S2; S2 leads to S3

API

APISignatureDescription
protocolLimitsconstant protocolLimitsPublic constant protocolLimits.
ProtocolMessageTypetype ProtocolMessageTypePublic type ProtocolMessageType.
protocolRedactedValueconstant protocolRedactedValuePublic constant protocolRedactedValue.
protocolVersionconstant protocolVersionPublic constant protocolVersion.

Events and lifecycle

Versioned envelopes distinguish requests, responses, notifications, and protocol errors. Validation fails closed on envelope fields, ids, timestamps, payload JSON shape, nesting, message count, and byte limits. Sensitive keys, credentials, JWTs, and URL userinfo are removed recursively; use redactProtocolValue for non-envelope devtools data and sanitizeProtocolMessage for complete messages.

All subscriptions and registrations return a disposer or belong to an owning runtime that disposes them in reverse order.

Example

import { InProcessProtocolTransport, redactProtocolValue } from "@mwillbanks/tuil-protocol";

const transport = new InProcessProtocolTransport();
const safeSnapshot = redactProtocolValue(runtimeSnapshot);

On this page