feat(core): browser capture MVP — global handlers, breadcrumbs, transport, stack parser - #1
Merged
Merged
Conversation
What works now:
- window.onerror + window.onunhandledrejection auto-registered on Client.init,
composing with any prior handlers so we don't clobber app code.
- fetch wrapper produces breadcrumbs (method, url, status, duration) with the
url scrubbed for PII; XHR wrapper deferred.
- navigation breadcrumbs for pushState, replaceState, popstate, hashchange.
- Optional console.error tap (off by default).
- Batched transport: maxBatchSize=30, flushIntervalMs=1000, queue cap with
oldest-event drop on overflow. POST { type: 'error', events: [...] } to dsn
with keepalive:true.
- navigator.sendBeacon fallback on pagehide + visibilitychange:hidden so
events survive bfcache transitions.
- PII scrub: Bearer tokens, password=, token/api_key=, sk-... OpenAI keys,
sensitive headers (authorization, cookie, x-api-key, x-auth-token).
- Engine-agnostic stack parser (V8 + Spidermonkey/Safari).
- Error.cause chains captured as nested ExceptionInfo.
- SDK-internal frames stripped from captured stacks.
- Tests: stack-parser (5), transport (4), pii (4) — all pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: c0022cd The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Makes the SDK actually capture and ship events. Up until this commit, `Client.init` was a no-op for capture. Now it:
Optional console.error tap is wired but off by default — turn it on with autoInstrumentation flag.
What this unblocks
This is the piece that makes SmooAI/smooai dogfooding on smoo.ai possible. Backend ingest + dashboard pages live in SmooAI/smooai; this is the SDK side that ships the events.
Test plan
Versioning
Changeset: minor bump → `@smooai/observability@0.2.0`. React and Next wrappers unchanged (still 0.1.0).
Follow-ups
Tracked in SmooAI/smooai SMOODEV-1067 as separate pearls:
🤖 Generated with Claude Code