@replayio/self-healing-capture
v0.1.8
Published
FullStory auxiliary capture for Self Healing and compatible session ingesters
Keywords
Readme
@replayio/self-healing-capture
Temporary browser capture support for Self Healing while Subtext gains the accessors needed for network exchanges, interactions, identity, metrics, and session context.
Direct capture for a Replay QA project
With a publishable lqc_ key from the project's Self Healing setup, install version
0.1.8 or later and the @fullstory/browser peer dependency, then initialize once
before rendering the application:
import { initCapture } from '@replayio/self-healing-capture';
const capture = initCapture({ publishableKey: 'lqc_...' });No application backend route, server secret, FullStory org ID, or configuration
bootstrap is required. QA resolves the key to its project and regional recording
organization. capture.identify(user), flush() and stop() retain their existing
contracts. For QA previews only, pass serviceUrl with the preview HTTPS origin.
This mode requires QA's key-only capture and artifact-registration endpoints.
The package includes the QA transport code; do not load qa-monitoring-v1.js too.
The upstream @fullstory/browser SDK loads its recorder from FullStory's CDN using
its default script setting. CSP must allow https://edge.fullstory.com in
script-src and the QA origin in connect-src. Preserve existing privacy/masking rules.
The publishable key grants ingestion only and is intentionally visible in browser
code. Uploads omit cookies, reject redirects and use the project's origin allowlist.
The fixed recorder alias is replay; actual FullStory routing stays on QA.
Direct capture accepts at most 2,000,000 bytes per network exchange (default
1,000,000) so batches fit QA's 3 MB limit. Existing same-origin forwarding mode
(initCapture({ orgId, endpoint })) remains supported and unchanged. Do not mix the
two option sets or run both recorders. Key rotation takes effect on the next page
load; repeated initialization with changed options throws.
Updating an existing installation
Agents: follow the public Self Healing update skill
and read the target release's UPGRADING.md before updating this dependency.
It ships in the npm package at
node_modules/@replayio/self-healing-capture/UPGRADING.md and covers changes to
application-owned initialization and forwarding code, not just the lockfile.
No original installer conversation is needed. In particular, old installations
may contain a 256 KiB forwarding check that a dependency update cannot remove.
Installation and integration instructions live in the Self Healing setup skill. Follow that skill for account provisioning, browser initialization, server forwarding, automatic reviews, and verification. This package is an implementation detail of that setup, not a separate installer.
QA consumes compatible versioned artifacts and recognizes the package/version provenance. Its ingestion and review code does not import this package. When Subtext supplies the required accessors, the Self Healing skills will describe the replacement and migration.
Oversized exchanges
maxNetworkCaptureBytes bounds each serialized exchange (default 1,000,000 bytes;
minimum 1,024). Oversized exchanges stay in the capture. Text retains a truncated
prefix ending in [qa_redacted]; JSON replaces the largest string values and, when
needed, object/array subtrees with that marker. Small fields are preserved when possible.
redacted.request_body, redacted.response_body, and redacted.metadata identify
modified fields. Extremely large headers or URLs are reduced as a last resort.
QA uses these records as evidence for session replay configuration, not exact responses.
Development and release
The capture implementation lives in packages/capture/src. Change producers here and keep QA’s
independent ingestion schemas and compatibility tests compatible. Initial installation instructions live in the Self Healing skills. Every release
that changes application integration requirements must add a versioned migration
to UPGRADING.md and include verification steps.
Publish locally with interactive npm authentication and 2FA:
npm ci && npm run capture:publishRun from a terminal using Node 22.14+ and an npm account with publishing access to @replayio.
The script checks whether the manifest version exists, runs tests and the production build, packs
the tested output into a temporary directory, logs into npm if necessary, and publishes that exact
artifact. npm owns the browser login/security-key/2FA prompts. Credentials and OTPs are not script
arguments or repository secrets. Follow npm's authentication prompt when it appears.
Use npm run capture:publish -- --dry-run to test building and packaging without login or publication.
Registry errors fail the version check; already-published versions are skipped. After npm accepts publication,
the script briefly checks registry visibility. Delayed processing or registry read failures report
visibility as pending without treating the accepted publication as a failure. Use the printed
npm view command to check later; do not republish. Existing versions are skipped, never overwritten. Temporary tarballs are removed when the script exits.
For later releases, update the package version and emitted producer metadata together, update the root lockfile, and run the script from the reviewed revision. The producer test checks that metadata matches the manifest. Installers receive updates through dependency upgrades and their lockfiles.
Capture failure behavior
Version 0.1.1 preserves valid UTF-8 body text exactly. Binary, invalid UTF-8, or NUL-containing
bodies are recorded as unavailable (null), retaining the exchange metadata. Both request and response
bodies follow this rule, including compressed requests advertised as text/plain.
An upload failure is reported through onError and retained for retry on the next capture upload or
explicit flush(). Later batches are still attempted. Retries preserve event IDs for server deduplication;
current session context and metrics are sent after retries so an older batch cannot leave stale counters.
flush() rejects while any batch remains undelivered, and succeeds once they have all been accepted.
Release tests and builds print concise progress; their full output is shown only if they fail.
Captured network exchanges include optional timing: { response_ms, total_ms? } in
milliseconds from dispatch. The producer measures response headers and cloned-body
completion with performance.now(), before waiting on request-body capture or
upload work. A failed body read omits total_ms; zero is a valid duration. These
are original-session measurements, independent of how long a reconstruction takes.
