
Company News
Socket Partners with Replit to Block Malicious Packages in AI-Powered Development
Replit is integrating Socket Firewall into its AI-powered development experience to help protect builders from malicious open source packages.
@webblackbox/protocol
Advanced tools
Shared event types, schemas, IDs, and configuration defaults for the WebBlackbox ecosystem.
The foundational protocol package for WebBlackbox. Defines all event types, message formats, configuration schemas, and validation logic shared across the entire system.
This package provides:
pnpm add @webblackbox/protocol
WebBlackbox currently defines 57 event types, organized by category:
meta.session.start — Session initialization with URL, title, viewport, and permissionsmeta.session.end — Session terminationmeta.config — Configuration snapshotsys.debugger.attach / sys.debugger.detach — CDP debugger lifecyclesys.notice — Internal system noticesnav.commit — Page navigation committednav.history.push / nav.history.replace — History API callsnav.hash — Hash changenav.reload — Page reloaduser.click / user.dblclick — Click events with target infouser.keydown — Keyboard eventsuser.input — Form input changesuser.submit — Form submissionsuser.scroll — Scroll position changes (sampled)user.mousemove — Mouse position (sampled)user.focus / user.blur — Focus changesuser.marker — User-defined markers (Ctrl+Shift+M)user.visibility — Page visibility changesuser.resize — Viewport resizeconsole.entry — Console log/info/warn/error/debug with args, stack traces, and source infoerror.exception — Uncaught exceptions with stack traceserror.unhandledrejection — Unhandled promise rejectionserror.resource — Resource loading errorserror.assert — Console assertion failuresnetwork.request — HTTP request initiated (URL, method, headers, initiator)network.response — HTTP response received (status, headers, timing)network.finished — Request completed (encoded data length)network.failed — Request failed (error text)network.redirect — Request redirectednetwork.body — Captured request/response body (hash reference)network.ws.open / network.ws.frame / network.ws.close — WebSocket lifecyclenetwork.sse.message — Server-Sent Event messagesdom.mutation.batch — Batched DOM mutationsdom.snapshot — Full DOM snapshot (content-addressable blob)dom.diff — DOM diff between snapshotsdom.rrweb.event — rrweb-compatible events (currently emitted as lite mutation summaries)screen.screenshot — Page screenshot with pointer positionscreen.viewport — Viewport dimension changesstorage.cookie.snapshot / storage.local.snapshot — Full storage snapshotsstorage.local.op / storage.session.op — localStorage/sessionStorage operationsstorage.idb.op / storage.idb.snapshot — IndexedDB operations and snapshotsstorage.cache.op — Cache API operationsstorage.sw.lifecycle — Service Worker lifecycle eventsperf.vitals — Web Vitals and related runtime metricsperf.longtask — Long task detection (>50ms)perf.trace — Performance trace dataperf.cpu.profile — CPU profile snapshotsperf.heap.snapshot — Heap snapshotstype WebBlackboxEvent<TData = unknown> = {
v: 1; // Protocol version
sid: string; // Session ID (S-{timestamp}-{token})
tab: number; // Browser tab ID
nav?: string; // Navigation ID
frame?: string; // Frame ID (for iframes)
tgt?: string; // Target ID
cdp?: string; // CDP session ID
t: number; // Wall-clock timestamp (ms since epoch)
mono: number; // Monotonic timestamp (ms)
dt?: number; // Duration (ms)
type: WebBlackboxEventType; // Event type string
id: string; // Unique event ID (E-{sequence})
lvl?: EventLevel; // "debug" | "info" | "warn" | "error"
ref?: EventReference; // Cross-references
data: TData; // Event-specific payload
};
Links events across different dimensions:
type EventReference = {
act?: string; // Action span ID
req?: string; // Network request ID
mut?: string; // Mutation batch ID
shot?: string; // Screenshot ID
err?: string; // Error ID
task?: string; // Long task ID
prev?: string; // Previous event ID
};
type RecorderConfig = {
mode: CaptureMode; // "lite" | "full"
ringBufferMinutes: number; // Ring buffer window
freezeOnError: boolean; // Freeze on uncaught errors
freezeOnNetworkFailure: boolean; // Freeze on network failures
freezeOnLongTaskSpike: boolean; // Freeze on long tasks
sampling: SamplingProfile; // Sampling rates
redaction: RedactionProfile; // Privacy redaction rules
sitePolicies: SiteCapturePolicy[]; // Per-origin overrides
};
type ExportManifest = {
protocolVersion: 1;
createdAt: string; // ISO 8601 datetime
mode: CaptureMode;
site: { origin: string; title?: string };
chunkCodec: ChunkCodec; // "none" | "br" | "zst" | "gzip"
redactionProfile: RedactionProfile;
stats: ExportStats;
encryption?: ExportEncryption; // AES-GCM encryption metadata
};
All types have corresponding Zod schemas for runtime validation:
import {
validateEvent,
validateEventData,
validateMessage,
eventEnvelopeSchema,
recorderConfigSchema,
exportManifestSchema,
getEventPayloadSchema
} from "@webblackbox/protocol";
// Validate a full event (envelope + payload)
const result = validateEvent(unknownEvent);
if (result.success) {
console.log("Valid event:", result.data);
}
// Validate just the payload for a known type
const payloadResult = validateEventData("network.request", payload);
// Get the schema for a specific event type
const schema = getEventPayloadSchema("error.exception");
import {
createSessionId,
createActionId,
createChunkId,
EventIdFactory
} from "@webblackbox/protocol";
const sid = createSessionId(); // "S-1706000000000-a1b2c3d4e5"
const actId = createActionId(1); // "A-000001"
const chunkId = createChunkId(1); // "C-000001"
const idFactory = new EventIdFactory();
const eid1 = idFactory.next(); // "E-00000001"
const eid2 = idFactory.next(); // "E-00000002"
import { DEFAULT_EXPORT_POLICY, DEFAULT_RECORDER_CONFIG } from "@webblackbox/protocol";
// Defaults:
// - mode: "lite"
// - ringBufferMinutes: 10
// - freezeOnError: true
// - mousemoveHz: 20, scrollHz: 15
// - screenshotIdleMs: 8000
// - bodyCaptureMaxBytes: 262144 (256 KiB base profile)
// - Redacts: authorization, cookie, set-cookie headers
// - Blocks: .secret, [data-sensitive], input[type='password']
//
// Export policy defaults:
// - includeScreenshots: true
// - maxArchiveBytes: 100 * 1024 * 1024
// - recentWindowMs: 20 * 60 * 1000
DEFAULT_RECORDER_CONFIG is a shared baseline. Runtime products may apply product-specific
overrides for sampling or freeze policies, but should document those overrides explicitly.
Inter-component communication uses typed messages:
| Message | Direction | Purpose |
|---|---|---|
CTRL.START_SESSION | SW → Pipeline | Start recording session |
CTRL.STOP_SESSION | SW → Pipeline | Stop recording session |
CTRL.FREEZE | Recorder → SW | Freeze notification |
CTRL.EXPORT | UI → SW | Export request |
EVT.BATCH | SW → Pipeline | Batch of recorded events |
PIPE.BLOB_PUT | Pipeline → Storage | Store binary blob |
PIPE.CHUNK_PUT | Pipeline → Storage | Store event chunk |
PIPE.BUILD_INDEX | Pipeline → Indexer | Build search indexes |
PIPE.EXPORT_DONE | Pipeline → SW | Export complete |
FAQs
Shared event types, schemas, IDs, and configuration defaults for the WebBlackbox ecosystem.
The npm package @webblackbox/protocol receives a total of 49 weekly downloads. As such, @webblackbox/protocol popularity was classified as not popular.
We found that @webblackbox/protocol demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Replit is integrating Socket Firewall into its AI-powered development experience to help protect builders from malicious open source packages.

Security News
npm confirmed a tooling bug incorrectly marked several one-character packages as security holders and said it was working on a rollback.

Research
/Security News
Newer packages in this compromise use native extensions and .pth loaders to execute JavaScript stealers in developer environments.