@mwillbanks/tuil-protocol
Versioned in-process and remote-ready runtime inspection protocol for tuil.
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-protocolHow 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.
API
| API | Signature | Description |
|---|---|---|
protocolLimits | constant protocolLimits | Public constant protocolLimits. |
ProtocolMessageType | type ProtocolMessageType | Public type ProtocolMessageType. |
protocolRedactedValue | constant protocolRedactedValue | Public constant protocolRedactedValue. |
protocolVersion | constant protocolVersion | Public 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);