@buoy-gg/console 7.0.21 → 7.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,17 +28,19 @@ var _jsxRuntime = require("react/jsx-runtime");
28
28
  * kills the tree before FloatingDevTools' effects ever run, so mount-time
29
29
  * install (`ConsoleRoot`) captured nothing for exactly the crashes that most
30
30
  * need capturing. Importing the preset happens at bundle-eval, before any
31
- * rendering, so both the `console.*` patch and the `ErrorUtils` fatal hook are
32
- * live from the first line of app code.
31
+ * rendering, so the `console.*` patch and both fatal-error hooks (`ErrorUtils`
32
+ * and RN's native exception listener) are live from the first line of app code.
33
33
  *
34
34
  * Guards:
35
- * - `ErrorUtils` present = a real React Native runtime. The desktop dashboard
36
- * and web mirrors import this package too, and must never patch their OWN
37
- * console (they mirror device entries via `replaceEntries`).
35
+ * - `ErrorUtils` OR `RN$registerExceptionListener` present = a real React Native
36
+ * runtime. The desktop dashboard and web mirrors import this package too, and
37
+ * must never patch their OWN console (they mirror device entries via
38
+ * `replaceEntries`).
38
39
  * - Dev-only. In production the existing mount-time path still applies (the
39
40
  * tools only mount there for licensed users), so end-user builds are never
40
41
  * patched at import.
41
- */const isReactNativeRuntime = typeof globalThis.ErrorUtils?.setGlobalHandler === "function";
42
+ */const rnGlobals = globalThis;
43
+ const isReactNativeRuntime = typeof rnGlobals.ErrorUtils?.setGlobalHandler === "function" || typeof rnGlobals.RN$registerExceptionListener === "function";
42
44
  if (isReactNativeRuntime && typeof __DEV__ !== "undefined" && __DEV__) {
43
45
  (0, _consoleLogStore.installConsoleCapture)();
44
46
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_ConsoleIcon","require","_ConsoleModal","_consoleLogStore","_jsxRuntime","isReactNativeRuntime","globalThis","ErrorUtils","setGlobalHandler","__DEV__","installConsoleCapture","consoleToolPreset","exports","id","name","description","slot","icon","size","color","jsx","ConsoleIcon","CONSOLE_ICON_COLOR","component","ConsoleModal","createConsoleTool","options"],"sourceRoot":"../../src","sources":["preset.tsx"],"mappings":";;;;;;;AAWA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,gBAAA,GAAAF,OAAA;AAAgE,IAAAG,WAAA,GAAAH,OAAA;AAbhE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,MAAMI,oBAAoB,GACxB,OAAQC,UAAU,CACfC,UAAU,EAAEC,gBAAgB,KAAK,UAAU;AAChD,IAAIH,oBAAoB,IAAI,OAAOI,OAAO,KAAK,WAAW,IAAIA,OAAO,EAAE;EACrE,IAAAC,sCAAqB,EAAC,CAAC;AACzB;AAEO,MAAMC,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG;EAC/BE,EAAE,EAAE,SAAS;EACbC,IAAI,EAAE,SAAS;EACfC,WAAW,EAAE,2BAA2B;EACxCC,IAAI,EAAE,MAAe;EACrBC,IAAI,EAAEA,CAAC;IAAEC,IAAI;IAAEC;EAAwC,CAAC,kBACtD,IAAAf,WAAA,CAAAgB,GAAA,EAACpB,YAAA,CAAAqB,WAAW;IAACH,IAAI,EAAEA,IAAK;IAACC,KAAK,EAAEA,KAAK,IAAIG;EAAmB,CAAE,CAC/D;EACDC,SAAS,EAAEC;AACb,CAAC;;AAED;AACO,SAASC,iBAAiBA,CAC/BC,OAAgD,GAAG,CAAC,CAAC,EACrD;EACA,OAAO;IACL,GAAGf,iBAAiB;IACpBG,IAAI,EAAEY,OAAO,CAACZ,IAAI,IAAIH,iBAAiB,CAACG,IAAI;IAC5CC,WAAW,EAAEW,OAAO,CAACX,WAAW,IAAIJ,iBAAiB,CAACI;EACxD,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"names":["_ConsoleIcon","require","_ConsoleModal","_consoleLogStore","_jsxRuntime","rnGlobals","globalThis","isReactNativeRuntime","ErrorUtils","setGlobalHandler","RN$registerExceptionListener","__DEV__","installConsoleCapture","consoleToolPreset","exports","id","name","description","slot","icon","size","color","jsx","ConsoleIcon","CONSOLE_ICON_COLOR","component","ConsoleModal","createConsoleTool","options"],"sourceRoot":"../../src","sources":["preset.tsx"],"mappings":";;;;;;;AAWA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,gBAAA,GAAAF,OAAA;AAAgE,IAAAG,WAAA,GAAAH,OAAA;AAbhE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,MAAMI,SAAS,GAAGC,UAGjB;AACD,MAAMC,oBAAoB,GACxB,OAAOF,SAAS,CAACG,UAAU,EAAEC,gBAAgB,KAAK,UAAU,IAC5D,OAAOJ,SAAS,CAACK,4BAA4B,KAAK,UAAU;AAC9D,IAAIH,oBAAoB,IAAI,OAAOI,OAAO,KAAK,WAAW,IAAIA,OAAO,EAAE;EACrE,IAAAC,sCAAqB,EAAC,CAAC;AACzB;AAEO,MAAMC,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG;EAC/BE,EAAE,EAAE,SAAS;EACbC,IAAI,EAAE,SAAS;EACfC,WAAW,EAAE,2BAA2B;EACxCC,IAAI,EAAE,MAAe;EACrBC,IAAI,EAAEA,CAAC;IAAEC,IAAI;IAAEC;EAAwC,CAAC,kBACtD,IAAAjB,WAAA,CAAAkB,GAAA,EAACtB,YAAA,CAAAuB,WAAW;IAACH,IAAI,EAAEA,IAAK;IAACC,KAAK,EAAEA,KAAK,IAAIG;EAAmB,CAAE,CAC/D;EACDC,SAAS,EAAEC;AACb,CAAC;;AAED;AACO,SAASC,iBAAiBA,CAC/BC,OAAgD,GAAG,CAAC,CAAC,EACrD;EACA,OAAO;IACL,GAAGf,iBAAiB;IACpBG,IAAI,EAAEY,OAAO,CAACZ,IAAI,IAAIH,iBAAiB,CAACG,IAAI;IAC5CC,WAAW,EAAEW,OAAO,CAACX,WAAW,IAAIJ,iBAAiB,CAACI;EACxD,CAAC;AACH","ignoreList":[]}
@@ -124,10 +124,71 @@ function captureOwnerStack() {
124
124
  return undefined;
125
125
  }
126
126
  }
127
+
128
+ /**
129
+ * An error React Native decorated on its way through ExceptionsManager: a
130
+ * render/lifecycle crash carrying the component stack. `isComponentError` is
131
+ * set by RN's `getExtendedError`, so this identifies a REAL crash rather than
132
+ * an ordinary `console.error("...")` call.
133
+ */
134
+
135
+ /** Frames to keep from a component stack — the crash site plus its context. */
136
+ const COMPONENT_STACK_FRAMES = 8;
137
+
138
+ /**
139
+ * Squeeze a React component stack down to the part a human (or an agent
140
+ * reading this over a wire) actually uses: the component names nearest the
141
+ * crash.
142
+ *
143
+ * Raw component stacks in a Metro dev bundle append the full bundle URL with
144
+ * every query param to EVERY frame — one crash is ~15 KB of near-identical
145
+ * `http://192.168.x.x:8830/…&transform.routerRoot=src/app…` noise wrapped
146
+ * around the handful of names that matter. The complete error, componentStack
147
+ * included, is still on the entry's `args` for anyone who wants it.
148
+ */
149
+ function compactComponentStack(stack) {
150
+ const frames = stack.split("\n").map(line => line.trim()).filter(Boolean)
151
+ // Drop the "(url)" tail; keep a "Name(./file.tsx)" hint when RN provides one.
152
+ .map(line => line.replace(/\s*\((?:https?:|\/).*$/, ""));
153
+ const shown = frames.slice(0, COMPONENT_STACK_FRAMES);
154
+ const rest = frames.length - shown.length;
155
+ return shown.map(f => ` ${f}`).join("\n") + (rest > 0 ? `\n …+${rest} more frames` : "");
156
+ }
157
+ function asComponentError(arg) {
158
+ if (!(arg instanceof Error)) return null;
159
+ const e = arg;
160
+ return e.isComponentError || typeof e.componentStack === "string" ? e : null;
161
+ }
127
162
  function record(method, args) {
128
163
  // Capture the call site for every log so we can attribute its origin.
129
164
  const rawStack = new Error().stack;
130
165
  const origin = (0, _origin.parseOrigin)(rawStack, captureOwnerStack());
166
+
167
+ // React Native funnels an uncaught render error back through console.error
168
+ // (ExceptionsManager.reportException) so console monkey-patches still see it.
169
+ // That arrives as an ordinary error row, which badly under-sells it: the app
170
+ // is dead. Promote it to a tagged [FATAL] entry carrying the component stack.
171
+ const crash = method === "error" ? asComponentError(args[0]) : null;
172
+ if (crash) {
173
+ // Tagged [RENDER ERROR], not [FATAL]: React reports an error an
174
+ // ErrorBoundary CAUGHT and recovered from through this same path, with the
175
+ // same componentStack, and nothing here distinguishes the two. Claiming a
176
+ // healthy app "most likely CRASHED" is worse than under-claiming — the
177
+ // component stack, which is the useful part, is reported either way.
178
+ const headline = fatalKey(crash.name, crash.message);
179
+ const located = crash.componentStack ? `\n\nThis error is located at:\n${compactComponentStack(crash.componentStack)}` : "";
180
+ pushFatal({
181
+ id: nextId++,
182
+ method: "error",
183
+ level: "error",
184
+ args: ["[RENDER ERROR]", crash],
185
+ message: `[RENDER ERROR] ${headline}${located}`,
186
+ timestamp: Date.now(),
187
+ stack: crash.stack,
188
+ origin
189
+ }, isDuplicateFatal(`[RENDER ERROR] ${headline}`));
190
+ return;
191
+ }
131
192
  const entry = {
132
193
  id: nextId++,
133
194
  method,
@@ -141,21 +202,105 @@ function record(method, args) {
141
202
  entries = entries.length >= MAX_ENTRIES ? [...entries.slice(entries.length - MAX_ENTRIES + 1), entry] : [...entries, entry];
142
203
  emit();
143
204
  scheduleSave();
205
+ // Errors are the entries most likely to be the last thing an app ever logs,
206
+ // so they get pushed to any dashboard immediately instead of waiting on the
207
+ // throttle that a dying tree will never run. Rate-limited; ordinary logs
208
+ // still ride the normal throttled path.
209
+ if (entry.level === "error") flushConsoleSyncNow();
144
210
  }
145
211
 
146
212
  /** Minimal shape of React Native's global `ErrorUtils`. */
147
213
 
214
+ /**
215
+ * Two independent seams report the same crash on some setups (the C++ handler
216
+ * can also feed `console.error`). Suppress a repeat of the same headline within
217
+ * this window so a crash reads as ONE entry.
218
+ */
219
+ const FATAL_DEDUPE_MS = 2000;
220
+ let lastFatalKey = "";
221
+ let lastFatalAt = 0;
222
+
223
+ /**
224
+ * Normalize a crash headline so the same error reported through two different
225
+ * seams produces the same key. React Native often sets `error.message` to the
226
+ * ALREADY-prefixed string ("TypeError: x is not a function"), so one path
227
+ * builds "TypeError: TypeError: x…" and the other "TypeError: x…" — which
228
+ * defeats the de-duplication entirely.
229
+ */
230
+ function fatalKey(name, message) {
231
+ const body = message.trim();
232
+ if (name && body.startsWith(`${name}: `)) return body;
233
+ return name ? `${name}: ${body}` : body;
234
+ }
235
+
236
+ /**
237
+ * Has this crash already been recorded moments ago?
238
+ *
239
+ * Only ever used to suppress a duplicate PUSH to the dashboard — never to drop
240
+ * an entry. Two different components crashing with the same message inside the
241
+ * window are two crashes, and a tool whose pitch is "the app's last words"
242
+ * must not silently throw one away.
243
+ */
244
+ function isDuplicateFatal(key) {
245
+ const now = Date.now();
246
+ if (key === lastFatalKey && now - lastFatalAt < FATAL_DEDUPE_MS) return true;
247
+ lastFatalKey = key;
248
+ lastFatalAt = now;
249
+ return false;
250
+ }
251
+
252
+ /**
253
+ * The device sync bridge's "push this tool NOW" escape hatch
254
+ * (@buoy-gg/external-sync `crashFlush`). Reached through the global rather than
255
+ * an import because console deliberately has no dependency on external-sync.
256
+ */
257
+ let lastFlushAt = 0;
258
+ /** Floor between opportunistic flushes, so an error storm can't flood the socket. */
259
+ const FLUSH_MIN_INTERVAL_MS = 150;
260
+ const flushConsoleSyncNow = (force = false) => {
261
+ const now = Date.now();
262
+ // A fatal is the app's last word — it always goes out, rate limit or not.
263
+ if (!force && now - lastFlushAt < FLUSH_MIN_INTERVAL_MS) return;
264
+ lastFlushAt = now;
265
+ try {
266
+ const set = globalThis.__buoyFlushToolSync;
267
+ if (!set) return;
268
+ for (const flush of set) flush("console");
269
+ } catch {
270
+ // Best-effort: a crash path must never crash.
271
+ }
272
+ };
273
+
274
+ /**
275
+ * Append a pre-built fatal entry to the ring buffer, then push it to any
276
+ * connected dashboard IMMEDIATELY.
277
+ *
278
+ * A fatal render error unmounts the React tree microseconds later, taking the
279
+ * sync bridge — and the normal 200 ms throttled snapshot — with it. Flushing
280
+ * synchronously here is what makes a crashed app's last words readable from
281
+ * the desktop app and the MCP server instead of the app just going silent.
282
+ */
283
+ function pushFatal(entry, duplicate = false) {
284
+ entries = entries.length >= MAX_ENTRIES ? [...entries.slice(entries.length - MAX_ENTRIES + 1), entry] : [...entries, entry];
285
+ emit();
286
+ scheduleSave();
287
+ // A repeat within the dedupe window is still RECORDED (two crashes are two
288
+ // crashes); it just doesn't earn another forced push to the dashboard.
289
+ if (!duplicate) flushConsoleSyncNow(true);
290
+ }
291
+
148
292
  /** Record an uncaught JS error from the global handler as an error entry. */
149
293
  function recordFatalError(error, isFatal) {
150
294
  const err = error instanceof Error ? error : undefined;
151
295
  // RN passes isFatal:false for non-fatal uncaught errors (e.g. errors thrown
152
296
  // in event handlers on some setups); anything else is treated as fatal.
153
297
  const label = isFatal === false ? "[UNCAUGHT]" : "[FATAL]";
154
- const headline = err ? `${err.name}: ${err.message}` : formatArg(error);
298
+ const headline = err ? fatalKey(err.name, err.message) : formatArg(error);
299
+ const duplicate = isDuplicateFatal(`${label} ${headline}`);
155
300
  // The label leads the args (not just the pre-rendered message): the
156
301
  // DevTools-style row renders from args, so this is what makes the tag
157
302
  // visible in the UI — exactly like `console.error("[FATAL]", err)`.
158
- const entry = {
303
+ pushFatal({
159
304
  id: nextId++,
160
305
  method: "error",
161
306
  level: "error",
@@ -165,29 +310,105 @@ function recordFatalError(error, isFatal) {
165
310
  // The error's OWN stack — the crash site, not this handler's call site.
166
311
  stack: err?.stack,
167
312
  fatal: true
168
- };
169
- entries = entries.length >= MAX_ENTRIES ? [...entries.slice(entries.length - MAX_ENTRIES + 1), entry] : [...entries, entry];
170
- emit();
171
- scheduleSave();
313
+ }, duplicate);
172
314
  }
173
315
 
174
316
  /**
175
- * Hook React Native's global error handler (`ErrorUtils.setGlobalHandler`) so
176
- * FATAL/uncaught JS errors land in the console store. A fatal render error
177
- * kills the tree without ever calling `console.error` through our patch —
178
- * without this hook a crashing app reads as "0 entries captured", the most
179
- * misleading possible answer to "why is my app broken".
317
+ * The exception payload React Native's C++ error handler hands to listeners
318
+ * registered via `global.RN$registerExceptionListener` (JsErrorHandler.cpp).
319
+ */
320
+
321
+ /** Render the C++ handler's parsed frames back into a normal stack string. */
322
+ function formatNativeStack(data) {
323
+ const raw = data.extraData?.rawStack;
324
+ if (typeof raw === "string" && raw.length > 0) return raw;
325
+ if (!Array.isArray(data.stack) || data.stack.length === 0) return undefined;
326
+ return data.stack.map(f => {
327
+ const where = f.lineNumber != null ? `${f.file ?? "?"}:${f.lineNumber}:${f.column ?? 0}` : f.file ?? "?";
328
+ return ` at ${f.methodName || "<anonymous>"} (${where})`;
329
+ }).join("\n");
330
+ }
331
+
332
+ /** Record a crash reported by React Native's native (C++) error handler. */
333
+ function recordNativeException(data) {
334
+ const label = data.isFatal === false ? "[UNCAUGHT]" : "[FATAL]";
335
+ const headline = fatalKey(data.name ?? undefined, data.originalMessage ?? data.message ?? "Unknown error");
336
+ const duplicate = isDuplicateFatal(`${label} ${headline}`);
337
+ // The component stack is the single most useful line for "which component
338
+ // crashed" — RN puts it in the redbox, so put it in the console entry too.
339
+ const componentStack = typeof data.componentStack === "string" && data.componentStack.trim() ? `\n\nThis error is located at:\n${compactComponentStack(data.componentStack)}` : "";
340
+ const message = `${label} ${headline}${componentStack}`;
341
+ pushFatal({
342
+ id: nextId++,
343
+ method: "error",
344
+ level: "error",
345
+ args: [label, headline, ...(componentStack ? [componentStack.trim()] : [])],
346
+ message,
347
+ timestamp: Date.now(),
348
+ stack: formatNativeStack(data),
349
+ fatal: true
350
+ }, duplicate);
351
+ }
352
+
353
+ /**
354
+ * Register with React Native's native (C++) exception handler — the seam a
355
+ * RENDER crash actually travels through on the New Architecture.
356
+ *
357
+ * React 19 routes an uncaught render error to `onUncaughtError` →
358
+ * `ExceptionsManager.handleException`, which NEVER reaches
359
+ * `ErrorUtils.setGlobalHandler`. Where it goes from there depends on the build:
360
+ *
361
+ * - `useAlwaysAvailableJSErrorHandling` on: the C++ handler
362
+ * (`global.RN$handleException`) reports it and JS sees nothing — this
363
+ * listener is the only seam.
364
+ * - otherwise: JS `reportException` re-feeds `console.error(e)` "so any methods
365
+ * monkey patched on top of console.error are called", which the console patch
366
+ * catches and promotes to `[FATAL]` (see `record`).
367
+ *
368
+ * Both are covered, and a crash reported through both de-duplicates to one
369
+ * entry. `RN$registerExceptionListener` keeps a LIST of listeners (LogBox
370
+ * registers one too), so this is purely additive. We never call the payload's
371
+ * `preventDefault()`: suppressing RN's own redbox is not our call to make.
372
+ */
373
+ function installNativeExceptionCapture() {
374
+ const register = globalThis.RN$registerExceptionListener;
375
+ if (typeof register !== "function") return false;
376
+ register(data => {
377
+ try {
378
+ if (!captureDisabledByUser) recordNativeException(data);
379
+ } catch {
380
+ // Capture must never interfere with error reporting.
381
+ }
382
+ });
383
+ return true;
384
+ }
385
+
386
+ /**
387
+ * Hook React Native's error paths so FATAL/uncaught JS errors land in the
388
+ * console store: the classic `ErrorUtils.setGlobalHandler` (old architecture,
389
+ * native-module callbacks, promise rejections) AND the native C++ exception
390
+ * listener (New Architecture render crashes — see
391
+ * {@link installNativeExceptionCapture}). Both feed the same de-duplicated
392
+ * `[FATAL]` entry, so a crash reported through both seams shows up once.
180
393
  *
181
394
  * - Chains the previous handler (LogBox/redbox still fire; nothing swallowed).
182
- * - Idempotent, and a silent no-op off React Native (no `ErrorUtils` global) —
395
+ * - Idempotent, and a silent no-op off React Native (neither global present) —
183
396
  * which also keeps it inert on the desktop dashboard / web mirrors.
184
397
  * - Recording respects an explicit `uninstallConsoleCapture()` (user OFF), but
185
- * the hook itself stays chained — it can't be safely removed.
398
+ * the hooks themselves stay chained — they can't be safely removed.
186
399
  */
187
400
  function installFatalErrorCapture() {
188
401
  if (fatalInstalled) return;
402
+ // Latch only once a seam is actually attached. Setting the flag up front
403
+ // means an install that runs before `InitializeCore` has published
404
+ // `ErrorUtils` would latch anyway and never retry — silently losing promise
405
+ // rejections and native-callback errors, which travel ONLY that seam.
406
+ const nativeInstalled = installNativeExceptionCapture();
189
407
  const errorUtils = globalThis.ErrorUtils;
190
- if (typeof errorUtils?.setGlobalHandler !== "function") return;
408
+ if (typeof errorUtils?.setGlobalHandler !== "function") {
409
+ fatalInstalled = nativeInstalled;
410
+ return;
411
+ }
191
412
  fatalInstalled = true;
192
413
  const previous = typeof errorUtils.getGlobalHandler === "function" ? errorUtils.getGlobalHandler() : undefined;
193
414
  errorUtils.setGlobalHandler((error, isFatal) => {
@@ -1 +1 @@
1
- {"version":3,"names":["React","_interopRequireWildcard","require","_sharedUi","_sanitize","_origin","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","METHODS","STACK_METHODS","Set","METHOD_LEVEL","error","assert","warn","debug","log","info","trace","dir","table","group","groupCollapsed","groupEnd","MAX_ENTRIES","entries","nextId","installed","fatalInstalled","captureDisabledByUser","listeners","clearListeners","originals","emitScheduled","emit","requestAnimationFrame","listener","formatArg","arg","Error","stack","name","message","undefined","JSON","stringify","String","formatArgs","args","map","join","cleanStack","raw","split","slice","captureOwnerStack","fn","record","method","rawStack","origin","parseOrigin","entry","id","level","timestamp","Date","now","length","scheduleSave","recordFatalError","isFatal","err","label","headline","fatal","installFatalErrorCapture","errorUtils","globalThis","ErrorUtils","setGlobalHandler","previous","getGlobalHandler","installConsoleCapture","original","console","buoyConsoleProxy","apply","uninstallConsoleCapture","subscribe","add","delete","getEntries","clearEntries","clearSavedBuffer","replaceEntries","next","onClear","PRESERVE_KEY","BUFFER_KEY","SAVE_DEBOUNCE_MS","preserveLog","persistenceReady","preserveListeners","saveTimer","emitPreserve","clearTimeout","setTimeout","saveBuffer","serializable","sanitizeArgs","persistentStorage","setItem","removeItem","initConsolePersistence","getItem","saved","parse","Array","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E,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,IAAIA,KAAK,CAAChD,MAAM,EAAE;QACxC;QACA3C,OAAO,GAAG,CAAC,GAAG2F,KAAK,EAAE,GAAG3F,OAAO,CAAC,CAAC6B,KAAK,CAAC,CAAC9B,WAAW,CAAC;QACpDE,MAAM,GAAG8F,IAAI,CAACC,GAAG,CAAC/F,MAAM,EAAE,GAAG0F,KAAK,CAACnE,GAAG,CAAE5D,CAAC,IAAKA,CAAC,CAAC0E,EAAE,GAAG,CAAC,CAAC,CAAC;QACxD7B,IAAI,CAAC,CAAC;MACR;IACF;EACF,CAAC,CAAC,MAAM;IACN;EAAA;AAEJ;;AAEA;AACO,SAASwF,cAAcA,CAAA,EAAY;EACxC,OAAOrB,WAAW;AACpB;;AAEA;AACO,SAASsB,cAAcA,CAAC3B,IAAa,EAAQ;EAClD,IAAIK,WAAW,KAAKL,IAAI,EAAE;EAC1BK,WAAW,GAAGL,IAAI;EAClBS,YAAY,CAAC,CAAC;EACdM,2BAAiB,CAACC,OAAO,CAACd,YAAY,EAAEpD,MAAM,CAACkD,IAAI,CAAC,CAAC,CAAC4B,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;EACrE,IAAI5B,IAAI,EAAEY,UAAU,CAAC,CAAC,CAAC,KAClBd,gBAAgB,CAAC,CAAC;AACzB;;AAEA;AACO,SAAS+B,oBAAoBA,CAACzF,QAAkB,EAAc;EACnEmE,iBAAiB,CAACb,GAAG,CAACtD,QAAQ,CAAC;EAC/B,OAAO,MAAM;IACXmE,iBAAiB,CAACZ,MAAM,CAACvD,QAAQ,CAAC;EACpC,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"names":["React","_interopRequireWildcard","require","_sharedUi","_sanitize","_origin","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","METHODS","STACK_METHODS","Set","METHOD_LEVEL","error","assert","warn","debug","log","info","trace","dir","table","group","groupCollapsed","groupEnd","MAX_ENTRIES","entries","nextId","installed","fatalInstalled","captureDisabledByUser","listeners","clearListeners","originals","emitScheduled","emit","requestAnimationFrame","listener","formatArg","arg","Error","stack","name","message","undefined","JSON","stringify","String","formatArgs","args","map","join","cleanStack","raw","split","slice","captureOwnerStack","fn","COMPONENT_STACK_FRAMES","compactComponentStack","frames","line","trim","filter","Boolean","replace","shown","rest","length","asComponentError","isComponentError","componentStack","record","method","rawStack","origin","parseOrigin","crash","headline","fatalKey","located","pushFatal","id","level","timestamp","Date","now","isDuplicateFatal","entry","scheduleSave","flushConsoleSyncNow","FATAL_DEDUPE_MS","lastFatalKey","lastFatalAt","body","startsWith","key","lastFlushAt","FLUSH_MIN_INTERVAL_MS","force","globalThis","__buoyFlushToolSync","flush","duplicate","recordFatalError","isFatal","err","label","fatal","formatNativeStack","data","extraData","Array","isArray","where","lineNumber","file","column","methodName","recordNativeException","originalMessage","installNativeExceptionCapture","register","RN$registerExceptionListener","installFatalErrorCapture","nativeInstalled","errorUtils","ErrorUtils","setGlobalHandler","previous","getGlobalHandler","installConsoleCapture","original","console","buoyConsoleProxy","apply","uninstallConsoleCapture","subscribe","add","delete","getEntries","clearEntries","clearSavedBuffer","replaceEntries","next","onClear","PRESERVE_KEY","BUFFER_KEY","SAVE_DEBOUNCE_MS","preserveLog","persistenceReady","preserveListeners","saveTimer","emitPreserve","clearTimeout","setTimeout","saveBuffer","serializable","sanitizeArgs","persistentStorage","setItem","removeItem","initConsolePersistence","getItem","saved","parse","Math","max","getPreserveLog","setPreserveLog","catch","subscribePreserveLog"],"sourceRoot":"../../../src","sources":["store/consoleLogStore.ts"],"mappings":";;;;;;;;;;;;;;;;;AAcA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAAiE,SAAAD,wBAAAK,CAAA,EAAAC,CAAA,6BAA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;EAClBS,YAAY,CAAC,CAAC;EACdM,2BAAiB,CAACC,OAAO,CAACd,YAAY,EAAEnG,MAAM,CAACiG,IAAI,CAAC,CAAC,CAAC0B,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;EACrE,IAAI1B,IAAI,EAAEY,UAAU,CAAC,CAAC,CAAC,KAClBd,gBAAgB,CAAC,CAAC;AACzB;;AAEA;AACO,SAAS6B,oBAAoBA,CAACtI,QAAkB,EAAc;EACnEkH,iBAAiB,CAACb,GAAG,CAACrG,QAAQ,CAAC;EAC/B,OAAO,MAAM;IACXkH,iBAAiB,CAACZ,MAAM,CAACtG,QAAQ,CAAC;EACpC,CAAC;AACH","ignoreList":[]}
@@ -23,19 +23,21 @@ import { installConsoleCapture } from "./store/consoleLogStore";
23
23
  * kills the tree before FloatingDevTools' effects ever run, so mount-time
24
24
  * install (`ConsoleRoot`) captured nothing for exactly the crashes that most
25
25
  * need capturing. Importing the preset happens at bundle-eval, before any
26
- * rendering, so both the `console.*` patch and the `ErrorUtils` fatal hook are
27
- * live from the first line of app code.
26
+ * rendering, so the `console.*` patch and both fatal-error hooks (`ErrorUtils`
27
+ * and RN's native exception listener) are live from the first line of app code.
28
28
  *
29
29
  * Guards:
30
- * - `ErrorUtils` present = a real React Native runtime. The desktop dashboard
31
- * and web mirrors import this package too, and must never patch their OWN
32
- * console (they mirror device entries via `replaceEntries`).
30
+ * - `ErrorUtils` OR `RN$registerExceptionListener` present = a real React Native
31
+ * runtime. The desktop dashboard and web mirrors import this package too, and
32
+ * must never patch their OWN console (they mirror device entries via
33
+ * `replaceEntries`).
33
34
  * - Dev-only. In production the existing mount-time path still applies (the
34
35
  * tools only mount there for licensed users), so end-user builds are never
35
36
  * patched at import.
36
37
  */
37
38
  import { jsx as _jsx } from "react/jsx-runtime";
38
- const isReactNativeRuntime = typeof globalThis.ErrorUtils?.setGlobalHandler === "function";
39
+ const rnGlobals = globalThis;
40
+ const isReactNativeRuntime = typeof rnGlobals.ErrorUtils?.setGlobalHandler === "function" || typeof rnGlobals.RN$registerExceptionListener === "function";
39
41
  if (isReactNativeRuntime && typeof __DEV__ !== "undefined" && __DEV__) {
40
42
  installConsoleCapture();
41
43
  }
@@ -1 +1 @@
1
- {"version":3,"names":["ConsoleIcon","CONSOLE_ICON_COLOR","ConsoleModal","installConsoleCapture","jsx","_jsx","isReactNativeRuntime","globalThis","ErrorUtils","setGlobalHandler","__DEV__","consoleToolPreset","id","name","description","slot","icon","size","color","component","createConsoleTool","options"],"sourceRoot":"../../src","sources":["preset.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,WAAW,EAAEC,kBAAkB,QAAQ,0BAA0B;AAC1E,SAASC,YAAY,QAAQ,2BAA2B;AACxD,SAASC,qBAAqB,QAAQ,yBAAyB;;AAE/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAlBA,SAAAC,GAAA,IAAAC,IAAA;AAmBA,MAAMC,oBAAoB,GACxB,OAAQC,UAAU,CACfC,UAAU,EAAEC,gBAAgB,KAAK,UAAU;AAChD,IAAIH,oBAAoB,IAAI,OAAOI,OAAO,KAAK,WAAW,IAAIA,OAAO,EAAE;EACrEP,qBAAqB,CAAC,CAAC;AACzB;AAEA,OAAO,MAAMQ,iBAAiB,GAAG;EAC/BC,EAAE,EAAE,SAAS;EACbC,IAAI,EAAE,SAAS;EACfC,WAAW,EAAE,2BAA2B;EACxCC,IAAI,EAAE,MAAe;EACrBC,IAAI,EAAEA,CAAC;IAAEC,IAAI;IAAEC;EAAwC,CAAC,kBACtDb,IAAA,CAACL,WAAW;IAACiB,IAAI,EAAEA,IAAK;IAACC,KAAK,EAAEA,KAAK,IAAIjB;EAAmB,CAAE,CAC/D;EACDkB,SAAS,EAAEjB;AACb,CAAC;;AAED;AACA,OAAO,SAASkB,iBAAiBA,CAC/BC,OAAgD,GAAG,CAAC,CAAC,EACrD;EACA,OAAO;IACL,GAAGV,iBAAiB;IACpBE,IAAI,EAAEQ,OAAO,CAACR,IAAI,IAAIF,iBAAiB,CAACE,IAAI;IAC5CC,WAAW,EAAEO,OAAO,CAACP,WAAW,IAAIH,iBAAiB,CAACG;EACxD,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"names":["ConsoleIcon","CONSOLE_ICON_COLOR","ConsoleModal","installConsoleCapture","jsx","_jsx","rnGlobals","globalThis","isReactNativeRuntime","ErrorUtils","setGlobalHandler","RN$registerExceptionListener","__DEV__","consoleToolPreset","id","name","description","slot","icon","size","color","component","createConsoleTool","options"],"sourceRoot":"../../src","sources":["preset.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,WAAW,EAAEC,kBAAkB,QAAQ,0BAA0B;AAC1E,SAASC,YAAY,QAAQ,2BAA2B;AACxD,SAASC,qBAAqB,QAAQ,yBAAyB;;AAE/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnBA,SAAAC,GAAA,IAAAC,IAAA;AAoBA,MAAMC,SAAS,GAAGC,UAGjB;AACD,MAAMC,oBAAoB,GACxB,OAAOF,SAAS,CAACG,UAAU,EAAEC,gBAAgB,KAAK,UAAU,IAC5D,OAAOJ,SAAS,CAACK,4BAA4B,KAAK,UAAU;AAC9D,IAAIH,oBAAoB,IAAI,OAAOI,OAAO,KAAK,WAAW,IAAIA,OAAO,EAAE;EACrET,qBAAqB,CAAC,CAAC;AACzB;AAEA,OAAO,MAAMU,iBAAiB,GAAG;EAC/BC,EAAE,EAAE,SAAS;EACbC,IAAI,EAAE,SAAS;EACfC,WAAW,EAAE,2BAA2B;EACxCC,IAAI,EAAE,MAAe;EACrBC,IAAI,EAAEA,CAAC;IAAEC,IAAI;IAAEC;EAAwC,CAAC,kBACtDf,IAAA,CAACL,WAAW;IAACmB,IAAI,EAAEA,IAAK;IAACC,KAAK,EAAEA,KAAK,IAAInB;EAAmB,CAAE,CAC/D;EACDoB,SAAS,EAAEnB;AACb,CAAC;;AAED;AACA,OAAO,SAASoB,iBAAiBA,CAC/BC,OAAgD,GAAG,CAAC,CAAC,EACrD;EACA,OAAO;IACL,GAAGV,iBAAiB;IACpBE,IAAI,EAAEQ,OAAO,CAACR,IAAI,IAAIF,iBAAiB,CAACE,IAAI;IAC5CC,WAAW,EAAEO,OAAO,CAACP,WAAW,IAAIH,iBAAiB,CAACG;EACxD,CAAC;AACH","ignoreList":[]}
@@ -109,10 +109,71 @@ function captureOwnerStack() {
109
109
  return undefined;
110
110
  }
111
111
  }
112
+
113
+ /**
114
+ * An error React Native decorated on its way through ExceptionsManager: a
115
+ * render/lifecycle crash carrying the component stack. `isComponentError` is
116
+ * set by RN's `getExtendedError`, so this identifies a REAL crash rather than
117
+ * an ordinary `console.error("...")` call.
118
+ */
119
+
120
+ /** Frames to keep from a component stack — the crash site plus its context. */
121
+ const COMPONENT_STACK_FRAMES = 8;
122
+
123
+ /**
124
+ * Squeeze a React component stack down to the part a human (or an agent
125
+ * reading this over a wire) actually uses: the component names nearest the
126
+ * crash.
127
+ *
128
+ * Raw component stacks in a Metro dev bundle append the full bundle URL with
129
+ * every query param to EVERY frame — one crash is ~15 KB of near-identical
130
+ * `http://192.168.x.x:8830/…&transform.routerRoot=src/app…` noise wrapped
131
+ * around the handful of names that matter. The complete error, componentStack
132
+ * included, is still on the entry's `args` for anyone who wants it.
133
+ */
134
+ function compactComponentStack(stack) {
135
+ const frames = stack.split("\n").map(line => line.trim()).filter(Boolean)
136
+ // Drop the "(url)" tail; keep a "Name(./file.tsx)" hint when RN provides one.
137
+ .map(line => line.replace(/\s*\((?:https?:|\/).*$/, ""));
138
+ const shown = frames.slice(0, COMPONENT_STACK_FRAMES);
139
+ const rest = frames.length - shown.length;
140
+ return shown.map(f => ` ${f}`).join("\n") + (rest > 0 ? `\n …+${rest} more frames` : "");
141
+ }
142
+ function asComponentError(arg) {
143
+ if (!(arg instanceof Error)) return null;
144
+ const e = arg;
145
+ return e.isComponentError || typeof e.componentStack === "string" ? e : null;
146
+ }
112
147
  function record(method, args) {
113
148
  // Capture the call site for every log so we can attribute its origin.
114
149
  const rawStack = new Error().stack;
115
150
  const origin = parseOrigin(rawStack, captureOwnerStack());
151
+
152
+ // React Native funnels an uncaught render error back through console.error
153
+ // (ExceptionsManager.reportException) so console monkey-patches still see it.
154
+ // That arrives as an ordinary error row, which badly under-sells it: the app
155
+ // is dead. Promote it to a tagged [FATAL] entry carrying the component stack.
156
+ const crash = method === "error" ? asComponentError(args[0]) : null;
157
+ if (crash) {
158
+ // Tagged [RENDER ERROR], not [FATAL]: React reports an error an
159
+ // ErrorBoundary CAUGHT and recovered from through this same path, with the
160
+ // same componentStack, and nothing here distinguishes the two. Claiming a
161
+ // healthy app "most likely CRASHED" is worse than under-claiming — the
162
+ // component stack, which is the useful part, is reported either way.
163
+ const headline = fatalKey(crash.name, crash.message);
164
+ const located = crash.componentStack ? `\n\nThis error is located at:\n${compactComponentStack(crash.componentStack)}` : "";
165
+ pushFatal({
166
+ id: nextId++,
167
+ method: "error",
168
+ level: "error",
169
+ args: ["[RENDER ERROR]", crash],
170
+ message: `[RENDER ERROR] ${headline}${located}`,
171
+ timestamp: Date.now(),
172
+ stack: crash.stack,
173
+ origin
174
+ }, isDuplicateFatal(`[RENDER ERROR] ${headline}`));
175
+ return;
176
+ }
116
177
  const entry = {
117
178
  id: nextId++,
118
179
  method,
@@ -126,21 +187,105 @@ function record(method, args) {
126
187
  entries = entries.length >= MAX_ENTRIES ? [...entries.slice(entries.length - MAX_ENTRIES + 1), entry] : [...entries, entry];
127
188
  emit();
128
189
  scheduleSave();
190
+ // Errors are the entries most likely to be the last thing an app ever logs,
191
+ // so they get pushed to any dashboard immediately instead of waiting on the
192
+ // throttle that a dying tree will never run. Rate-limited; ordinary logs
193
+ // still ride the normal throttled path.
194
+ if (entry.level === "error") flushConsoleSyncNow();
129
195
  }
130
196
 
131
197
  /** Minimal shape of React Native's global `ErrorUtils`. */
132
198
 
199
+ /**
200
+ * Two independent seams report the same crash on some setups (the C++ handler
201
+ * can also feed `console.error`). Suppress a repeat of the same headline within
202
+ * this window so a crash reads as ONE entry.
203
+ */
204
+ const FATAL_DEDUPE_MS = 2000;
205
+ let lastFatalKey = "";
206
+ let lastFatalAt = 0;
207
+
208
+ /**
209
+ * Normalize a crash headline so the same error reported through two different
210
+ * seams produces the same key. React Native often sets `error.message` to the
211
+ * ALREADY-prefixed string ("TypeError: x is not a function"), so one path
212
+ * builds "TypeError: TypeError: x…" and the other "TypeError: x…" — which
213
+ * defeats the de-duplication entirely.
214
+ */
215
+ function fatalKey(name, message) {
216
+ const body = message.trim();
217
+ if (name && body.startsWith(`${name}: `)) return body;
218
+ return name ? `${name}: ${body}` : body;
219
+ }
220
+
221
+ /**
222
+ * Has this crash already been recorded moments ago?
223
+ *
224
+ * Only ever used to suppress a duplicate PUSH to the dashboard — never to drop
225
+ * an entry. Two different components crashing with the same message inside the
226
+ * window are two crashes, and a tool whose pitch is "the app's last words"
227
+ * must not silently throw one away.
228
+ */
229
+ function isDuplicateFatal(key) {
230
+ const now = Date.now();
231
+ if (key === lastFatalKey && now - lastFatalAt < FATAL_DEDUPE_MS) return true;
232
+ lastFatalKey = key;
233
+ lastFatalAt = now;
234
+ return false;
235
+ }
236
+
237
+ /**
238
+ * The device sync bridge's "push this tool NOW" escape hatch
239
+ * (@buoy-gg/external-sync `crashFlush`). Reached through the global rather than
240
+ * an import because console deliberately has no dependency on external-sync.
241
+ */
242
+ let lastFlushAt = 0;
243
+ /** Floor between opportunistic flushes, so an error storm can't flood the socket. */
244
+ const FLUSH_MIN_INTERVAL_MS = 150;
245
+ const flushConsoleSyncNow = (force = false) => {
246
+ const now = Date.now();
247
+ // A fatal is the app's last word — it always goes out, rate limit or not.
248
+ if (!force && now - lastFlushAt < FLUSH_MIN_INTERVAL_MS) return;
249
+ lastFlushAt = now;
250
+ try {
251
+ const set = globalThis.__buoyFlushToolSync;
252
+ if (!set) return;
253
+ for (const flush of set) flush("console");
254
+ } catch {
255
+ // Best-effort: a crash path must never crash.
256
+ }
257
+ };
258
+
259
+ /**
260
+ * Append a pre-built fatal entry to the ring buffer, then push it to any
261
+ * connected dashboard IMMEDIATELY.
262
+ *
263
+ * A fatal render error unmounts the React tree microseconds later, taking the
264
+ * sync bridge — and the normal 200 ms throttled snapshot — with it. Flushing
265
+ * synchronously here is what makes a crashed app's last words readable from
266
+ * the desktop app and the MCP server instead of the app just going silent.
267
+ */
268
+ function pushFatal(entry, duplicate = false) {
269
+ entries = entries.length >= MAX_ENTRIES ? [...entries.slice(entries.length - MAX_ENTRIES + 1), entry] : [...entries, entry];
270
+ emit();
271
+ scheduleSave();
272
+ // A repeat within the dedupe window is still RECORDED (two crashes are two
273
+ // crashes); it just doesn't earn another forced push to the dashboard.
274
+ if (!duplicate) flushConsoleSyncNow(true);
275
+ }
276
+
133
277
  /** Record an uncaught JS error from the global handler as an error entry. */
134
278
  function recordFatalError(error, isFatal) {
135
279
  const err = error instanceof Error ? error : undefined;
136
280
  // RN passes isFatal:false for non-fatal uncaught errors (e.g. errors thrown
137
281
  // in event handlers on some setups); anything else is treated as fatal.
138
282
  const label = isFatal === false ? "[UNCAUGHT]" : "[FATAL]";
139
- const headline = err ? `${err.name}: ${err.message}` : formatArg(error);
283
+ const headline = err ? fatalKey(err.name, err.message) : formatArg(error);
284
+ const duplicate = isDuplicateFatal(`${label} ${headline}`);
140
285
  // The label leads the args (not just the pre-rendered message): the
141
286
  // DevTools-style row renders from args, so this is what makes the tag
142
287
  // visible in the UI — exactly like `console.error("[FATAL]", err)`.
143
- const entry = {
288
+ pushFatal({
144
289
  id: nextId++,
145
290
  method: "error",
146
291
  level: "error",
@@ -150,29 +295,105 @@ function recordFatalError(error, isFatal) {
150
295
  // The error's OWN stack — the crash site, not this handler's call site.
151
296
  stack: err?.stack,
152
297
  fatal: true
153
- };
154
- entries = entries.length >= MAX_ENTRIES ? [...entries.slice(entries.length - MAX_ENTRIES + 1), entry] : [...entries, entry];
155
- emit();
156
- scheduleSave();
298
+ }, duplicate);
157
299
  }
158
300
 
159
301
  /**
160
- * Hook React Native's global error handler (`ErrorUtils.setGlobalHandler`) so
161
- * FATAL/uncaught JS errors land in the console store. A fatal render error
162
- * kills the tree without ever calling `console.error` through our patch —
163
- * without this hook a crashing app reads as "0 entries captured", the most
164
- * misleading possible answer to "why is my app broken".
302
+ * The exception payload React Native's C++ error handler hands to listeners
303
+ * registered via `global.RN$registerExceptionListener` (JsErrorHandler.cpp).
304
+ */
305
+
306
+ /** Render the C++ handler's parsed frames back into a normal stack string. */
307
+ function formatNativeStack(data) {
308
+ const raw = data.extraData?.rawStack;
309
+ if (typeof raw === "string" && raw.length > 0) return raw;
310
+ if (!Array.isArray(data.stack) || data.stack.length === 0) return undefined;
311
+ return data.stack.map(f => {
312
+ const where = f.lineNumber != null ? `${f.file ?? "?"}:${f.lineNumber}:${f.column ?? 0}` : f.file ?? "?";
313
+ return ` at ${f.methodName || "<anonymous>"} (${where})`;
314
+ }).join("\n");
315
+ }
316
+
317
+ /** Record a crash reported by React Native's native (C++) error handler. */
318
+ function recordNativeException(data) {
319
+ const label = data.isFatal === false ? "[UNCAUGHT]" : "[FATAL]";
320
+ const headline = fatalKey(data.name ?? undefined, data.originalMessage ?? data.message ?? "Unknown error");
321
+ const duplicate = isDuplicateFatal(`${label} ${headline}`);
322
+ // The component stack is the single most useful line for "which component
323
+ // crashed" — RN puts it in the redbox, so put it in the console entry too.
324
+ const componentStack = typeof data.componentStack === "string" && data.componentStack.trim() ? `\n\nThis error is located at:\n${compactComponentStack(data.componentStack)}` : "";
325
+ const message = `${label} ${headline}${componentStack}`;
326
+ pushFatal({
327
+ id: nextId++,
328
+ method: "error",
329
+ level: "error",
330
+ args: [label, headline, ...(componentStack ? [componentStack.trim()] : [])],
331
+ message,
332
+ timestamp: Date.now(),
333
+ stack: formatNativeStack(data),
334
+ fatal: true
335
+ }, duplicate);
336
+ }
337
+
338
+ /**
339
+ * Register with React Native's native (C++) exception handler — the seam a
340
+ * RENDER crash actually travels through on the New Architecture.
341
+ *
342
+ * React 19 routes an uncaught render error to `onUncaughtError` →
343
+ * `ExceptionsManager.handleException`, which NEVER reaches
344
+ * `ErrorUtils.setGlobalHandler`. Where it goes from there depends on the build:
345
+ *
346
+ * - `useAlwaysAvailableJSErrorHandling` on: the C++ handler
347
+ * (`global.RN$handleException`) reports it and JS sees nothing — this
348
+ * listener is the only seam.
349
+ * - otherwise: JS `reportException` re-feeds `console.error(e)` "so any methods
350
+ * monkey patched on top of console.error are called", which the console patch
351
+ * catches and promotes to `[FATAL]` (see `record`).
352
+ *
353
+ * Both are covered, and a crash reported through both de-duplicates to one
354
+ * entry. `RN$registerExceptionListener` keeps a LIST of listeners (LogBox
355
+ * registers one too), so this is purely additive. We never call the payload's
356
+ * `preventDefault()`: suppressing RN's own redbox is not our call to make.
357
+ */
358
+ function installNativeExceptionCapture() {
359
+ const register = globalThis.RN$registerExceptionListener;
360
+ if (typeof register !== "function") return false;
361
+ register(data => {
362
+ try {
363
+ if (!captureDisabledByUser) recordNativeException(data);
364
+ } catch {
365
+ // Capture must never interfere with error reporting.
366
+ }
367
+ });
368
+ return true;
369
+ }
370
+
371
+ /**
372
+ * Hook React Native's error paths so FATAL/uncaught JS errors land in the
373
+ * console store: the classic `ErrorUtils.setGlobalHandler` (old architecture,
374
+ * native-module callbacks, promise rejections) AND the native C++ exception
375
+ * listener (New Architecture render crashes — see
376
+ * {@link installNativeExceptionCapture}). Both feed the same de-duplicated
377
+ * `[FATAL]` entry, so a crash reported through both seams shows up once.
165
378
  *
166
379
  * - Chains the previous handler (LogBox/redbox still fire; nothing swallowed).
167
- * - Idempotent, and a silent no-op off React Native (no `ErrorUtils` global) —
380
+ * - Idempotent, and a silent no-op off React Native (neither global present) —
168
381
  * which also keeps it inert on the desktop dashboard / web mirrors.
169
382
  * - Recording respects an explicit `uninstallConsoleCapture()` (user OFF), but
170
- * the hook itself stays chained — it can't be safely removed.
383
+ * the hooks themselves stay chained — they can't be safely removed.
171
384
  */
172
385
  export function installFatalErrorCapture() {
173
386
  if (fatalInstalled) return;
387
+ // Latch only once a seam is actually attached. Setting the flag up front
388
+ // means an install that runs before `InitializeCore` has published
389
+ // `ErrorUtils` would latch anyway and never retry — silently losing promise
390
+ // rejections and native-callback errors, which travel ONLY that seam.
391
+ const nativeInstalled = installNativeExceptionCapture();
174
392
  const errorUtils = globalThis.ErrorUtils;
175
- if (typeof errorUtils?.setGlobalHandler !== "function") return;
393
+ if (typeof errorUtils?.setGlobalHandler !== "function") {
394
+ fatalInstalled = nativeInstalled;
395
+ return;
396
+ }
176
397
  fatalInstalled = true;
177
398
  const previous = typeof errorUtils.getGlobalHandler === "function" ? errorUtils.getGlobalHandler() : undefined;
178
399
  errorUtils.setGlobalHandler((error, isFatal) => {
@@ -1 +1 @@
1
- {"version":3,"names":["React","persistentStorage","sanitizeArgs","parseOrigin","METHODS","STACK_METHODS","Set","METHOD_LEVEL","error","assert","warn","debug","log","info","trace","dir","table","group","groupCollapsed","groupEnd","MAX_ENTRIES","entries","nextId","installed","fatalInstalled","captureDisabledByUser","listeners","clearListeners","originals","emitScheduled","emit","requestAnimationFrame","listener","formatArg","arg","Error","stack","name","message","undefined","JSON","stringify","String","formatArgs","args","map","join","cleanStack","raw","split","slice","captureOwnerStack","fn","record","method","rawStack","origin","entry","id","level","timestamp","Date","now","has","length","scheduleSave","recordFatalError","isFatal","err","label","headline","fatal","installFatalErrorCapture","errorUtils","globalThis","ErrorUtils","setGlobalHandler","previous","getGlobalHandler","installConsoleCapture","original","console","buoyConsoleProxy","apply","uninstallConsoleCapture","subscribe","add","delete","getEntries","clearEntries","clearSavedBuffer","replaceEntries","next","onClear","PRESERVE_KEY","BUFFER_KEY","SAVE_DEBOUNCE_MS","preserveLog","persistenceReady","preserveListeners","saveTimer","emitPreserve","clearTimeout","setTimeout","saveBuffer","serializable","setItem","removeItem","initConsolePersistence","getItem","saved","parse","Array","isArray","Math","max","e","getPreserveLog","setPreserveLog","catch","subscribePreserveLog"],"sourceRoot":"../../../src","sources":["store/consoleLogStore.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,iBAAiB,QAAQ,oBAAoB;AACtD,SAASC,YAAY,QAAQ,YAAY;AACzC,SAASC,WAAW,QAAwB,oBAAoB;;AAEhE;;AAeA;;AA4BA;AACA,MAAMC,OAAwB,GAAG,CAC/B,KAAK,EACL,MAAM,EACN,MAAM,EACN,OAAO,EACP,OAAO,EACP,OAAO,EACP,KAAK,EACL,OAAO,EACP,QAAQ,EACR,OAAO,EACP,gBAAgB,EAChB,UAAU,CACX;;AAED;AACA,MAAMC,aAAa,GAAG,IAAIC,GAAG,CAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;;AAElF;AACA,MAAMC,YAAiD,GAAG;EACxDC,KAAK,EAAE,OAAO;EACdC,MAAM,EAAE,OAAO;EACfC,IAAI,EAAE,SAAS;EACfC,KAAK,EAAE,SAAS;EAChBC,GAAG,EAAE,MAAM;EACXC,IAAI,EAAE,MAAM;EACZC,KAAK,EAAE,MAAM;EACbC,GAAG,EAAE,MAAM;EACXC,KAAK,EAAE,MAAM;EACbC,KAAK,EAAE,MAAM;EACbC,cAAc,EAAE,MAAM;EACtBC,QAAQ,EAAE;AACZ,CAAC;;AAED;AACA,MAAMC,WAAW,GAAG,IAAI;AAIxB,IAAIC,OAA0B,GAAG,EAAE;AACnC,IAAIC,MAAM,GAAG,CAAC;AACd,IAAIC,SAAS,GAAG,KAAK;AACrB,IAAIC,cAAc,GAAG,KAAK;AAC1B;AACA;AACA;AACA;AACA;AACA,IAAIC,qBAAqB,GAAG,KAAK;AAEjC,MA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;AACA,OAAO,SAAS8B,oBAAoBA,CAACxF,QAAkB,EAAc;EACnEmE,iBAAiB,CAACb,GAAG,CAACtD,QAAQ,CAAC;EAC/B,OAAO,MAAM;IACXmE,iBAAiB,CAACZ,MAAM,CAACvD,QAAQ,CAAC;EACpC,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"names":["React","persistentStorage","sanitizeArgs","parseOrigin","METHODS","STACK_METHODS","Set","METHOD_LEVEL","error","assert","warn","debug","log","info","trace","dir","table","group","groupCollapsed","groupEnd","MAX_ENTRIES","entries","nextId","installed","fatalInstalled","captureDisabledByUser","listeners","clearListeners","originals","emitScheduled","emit","requestAnimationFrame","listener","formatArg","arg","Error","stack","name","message","undefined","JSON","stringify","String","formatArgs","args","map","join","cleanStack","raw","split","slice","captureOwnerStack","fn","COMPONENT_STACK_FRAMES","compactComponentStack","frames","line","trim","filter","Boolean","replace","shown","rest","length","f","asComponentError","e","isComponentError","componentStack","record","method","rawStack","origin","crash","headline","fatalKey","located","pushFatal","id","level","timestamp","Date","now","isDuplicateFatal","entry","has","scheduleSave","flushConsoleSyncNow","FATAL_DEDUPE_MS","lastFatalKey","lastFatalAt","body","startsWith","key","lastFlushAt","FLUSH_MIN_INTERVAL_MS","force","set","globalThis","__buoyFlushToolSync","flush","duplicate","recordFatalError","isFatal","err","label","fatal","formatNativeStack","data","extraData","Array","isArray","where","lineNumber","file","column","methodName","recordNativeException","originalMessage","installNativeExceptionCapture","register","RN$registerExceptionListener","installFatalErrorCapture","nativeInstalled","errorUtils","ErrorUtils","setGlobalHandler","previous","getGlobalHandler","installConsoleCapture","original","console","buoyConsoleProxy","apply","uninstallConsoleCapture","subscribe","add","delete","getEntries","clearEntries","clearSavedBuffer","replaceEntries","next","onClear","PRESERVE_KEY","BUFFER_KEY","SAVE_DEBOUNCE_MS","preserveLog","persistenceReady","preserveListeners","saveTimer","emitPreserve","clearTimeout","setTimeout","saveBuffer","serializable","setItem","removeItem","initConsolePersistence","getItem","saved","parse","Math","max","getPreserveLog","setPreserveLog","catch","subscribePreserveLog"],"sourceRoot":"../../../src","sources":["store/consoleLogStore.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,iBAAiB,QAAQ,oBAAoB;AACtD,SAASC,YAAY,QAAQ,YAAY;AACzC,SAASC,WAAW,QAAwB,oBAAoB;;AAEhE;;AAeA;;AA4BA;AACA,MAAMC,OAAwB,GAAG,CAC/B,KAAK,EACL,MAAM,EACN,MAAM,EACN,OAAO,EACP,OAAO,EACP,OAAO,EACP,KAAK,EACL,OAAO,EACP,QAAQ,EACR,OAAO,EACP,gBAAgB,EAChB,UAAU,CACX;;AAED;AACA,MAAMC,aAAa,GAAG,IAAIC,GAAG,CAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;;AAElF;AACA,MAAMC,YAAiD,GAAG;EACxDC,KAAK,EAAE,OAAO;EACdC,MAAM,EAAE,OAAO;EACfC,IAAI,EAAE,SAAS;EACfC,KAAK,EAAE,SAAS;EAChBC,GAAG,EAAE,MAAM;EACXC,IAAI,EAAE,MAAM;EACZC,KAAK,EAAE,MAAM;EACbC,GAAG,EAAE,MAAM;EACXC,KAAK,EAAE,MAAM;EACbC,KAAK,EAAE,MAAM;EACbC,cAAc,EAAE,MAAM;EACtBC,QAAQ,EAAE;AACZ,CAAC;;AAED;AACA,MAAMC,WAAW,GAAG,IAAI;AAIxB,IAAIC,OAA0B,GAAG,EAAE;AACnC,IAAIC,MAAM,GAAG,CAAC;AACd,IAAIC,SAAS,GAAG,KAAK;AACrB,IAAIC,cAAc,GAAG,KAAK;AAC1B;AACA;AACA;AACA;AACA;AACA,IAAIC,qBAAqB,GAAG,KAAK;AAEjC,MAAMC,SAAS,GAAG,IAAIpB,GAAG,CAAW,CAAC;AACrC,MAAMqB,cAAc,GAAG,IAAIr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BAKJ;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;;CAIzD,CAAC;AAEF,kDAAkD;AAClD,wBAAgB,iBAAiB,CAC/B,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAO;;;;;4BAR7B;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;;EAezD"}
1
+ {"version":3,"file":"preset.d.ts","sourceRoot":"","sources":["../../src/preset.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAkCzD,eAAO,MAAM,iBAAiB;;;;;4BAKJ;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;;CAIzD,CAAC;AAEF,kDAAkD;AAClD,wBAAgB,iBAAiB,CAC/B,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAO;;;;;4BAR7B;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;;EAezD"}
@@ -42,17 +42,18 @@ export interface ConsoleLogEntry {
42
42
  }
43
43
  type Listener = () => void;
44
44
  /**
45
- * Hook React Native's global error handler (`ErrorUtils.setGlobalHandler`) so
46
- * FATAL/uncaught JS errors land in the console store. A fatal render error
47
- * kills the tree without ever calling `console.error` through our patch —
48
- * without this hook a crashing app reads as "0 entries captured", the most
49
- * misleading possible answer to "why is my app broken".
45
+ * Hook React Native's error paths so FATAL/uncaught JS errors land in the
46
+ * console store: the classic `ErrorUtils.setGlobalHandler` (old architecture,
47
+ * native-module callbacks, promise rejections) AND the native C++ exception
48
+ * listener (New Architecture render crashes — see
49
+ * {@link installNativeExceptionCapture}). Both feed the same de-duplicated
50
+ * `[FATAL]` entry, so a crash reported through both seams shows up once.
50
51
  *
51
52
  * - Chains the previous handler (LogBox/redbox still fire; nothing swallowed).
52
- * - Idempotent, and a silent no-op off React Native (no `ErrorUtils` global) —
53
+ * - Idempotent, and a silent no-op off React Native (neither global present) —
53
54
  * which also keeps it inert on the desktop dashboard / web mirrors.
54
55
  * - Recording respects an explicit `uninstallConsoleCapture()` (user OFF), but
55
- * the hook itself stays chained — it can't be safely removed.
56
+ * the hooks themselves stay chained — they can't be safely removed.
56
57
  */
57
58
  export declare function installFatalErrorCapture(): void;
58
59
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"consoleLogStore.d.ts","sourceRoot":"","sources":["../../../src/store/consoleLogStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEjE,iDAAiD;AACjD,MAAM,MAAM,aAAa,GACrB,KAAK,GACL,MAAM,GACN,MAAM,GACN,OAAO,GACP,OAAO,GACP,OAAO,GACP,KAAK,GACL,OAAO,GACP,QAAQ,GACR,OAAO,GACP,gBAAgB,GAChB,UAAU,CAAC;AAEf,wDAAwD;AACxD,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;AAEpE,MAAM,WAAW,eAAe;IAC9B,+CAA+C;IAC/C,EAAE,EAAE,MAAM,CAAC;IACX,mDAAmD;IACnD,MAAM,EAAE,aAAa,CAAC;IACtB,+CAA+C;IAC/C,KAAK,EAAE,YAAY,CAAC;IACpB,sDAAsD;IACtD,IAAI,EAAE,OAAO,EAAE,CAAC;IAChB,4EAA4E;IAC5E,OAAO,EAAE,MAAM,CAAC;IAChB,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,qEAAqE;IACrE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kEAAkE;IAClE,MAAM,CAAC,EAAE,SAAS,CA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;;GAIG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC,CA4B5D;AAED,0CAA0C;AAC1C,wBAAgB,cAAc,IAAI,OAAO,CAExC;AAED,yEAAyE;AACzE,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAOlD;AAED,0EAA0E;AAC1E,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,IAAI,CAKnE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buoy-gg/console",
3
- "version": "7.0.21",
3
+ "version": "7.0.22",
4
4
  "description": "Chrome DevTools-style console for React Native — captures every console.* on device, even in release builds. Part of Buoy devtools.",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -13,7 +13,7 @@
13
13
  ],
14
14
  "sideEffects": false,
15
15
  "dependencies": {
16
- "@buoy-gg/shared-ui": "^7.0.21"
16
+ "@buoy-gg/shared-ui": "^7.0.22"
17
17
  },
18
18
  "peerDependencies": {
19
19
  "react": "*",
package/src/preset.tsx CHANGED
@@ -21,20 +21,25 @@ import { installConsoleCapture } from "./store/consoleLogStore";
21
21
  * kills the tree before FloatingDevTools' effects ever run, so mount-time
22
22
  * install (`ConsoleRoot`) captured nothing for exactly the crashes that most
23
23
  * need capturing. Importing the preset happens at bundle-eval, before any
24
- * rendering, so both the `console.*` patch and the `ErrorUtils` fatal hook are
25
- * live from the first line of app code.
24
+ * rendering, so the `console.*` patch and both fatal-error hooks (`ErrorUtils`
25
+ * and RN's native exception listener) are live from the first line of app code.
26
26
  *
27
27
  * Guards:
28
- * - `ErrorUtils` present = a real React Native runtime. The desktop dashboard
29
- * and web mirrors import this package too, and must never patch their OWN
30
- * console (they mirror device entries via `replaceEntries`).
28
+ * - `ErrorUtils` OR `RN$registerExceptionListener` present = a real React Native
29
+ * runtime. The desktop dashboard and web mirrors import this package too, and
30
+ * must never patch their OWN console (they mirror device entries via
31
+ * `replaceEntries`).
31
32
  * - Dev-only. In production the existing mount-time path still applies (the
32
33
  * tools only mount there for licensed users), so end-user builds are never
33
34
  * patched at import.
34
35
  */
36
+ const rnGlobals = globalThis as {
37
+ ErrorUtils?: { setGlobalHandler?: unknown };
38
+ RN$registerExceptionListener?: unknown;
39
+ };
35
40
  const isReactNativeRuntime =
36
- typeof (globalThis as { ErrorUtils?: { setGlobalHandler?: unknown } })
37
- .ErrorUtils?.setGlobalHandler === "function";
41
+ typeof rnGlobals.ErrorUtils?.setGlobalHandler === "function" ||
42
+ typeof rnGlobals.RN$registerExceptionListener === "function";
38
43
  if (isReactNativeRuntime && typeof __DEV__ !== "undefined" && __DEV__) {
39
44
  installConsoleCapture();
40
45
  }
@@ -166,10 +166,87 @@ function captureOwnerStack(): string | undefined {
166
166
  }
167
167
  }
168
168
 
169
+ /**
170
+ * An error React Native decorated on its way through ExceptionsManager: a
171
+ * render/lifecycle crash carrying the component stack. `isComponentError` is
172
+ * set by RN's `getExtendedError`, so this identifies a REAL crash rather than
173
+ * an ordinary `console.error("...")` call.
174
+ */
175
+ type ComponentError = Error & {
176
+ componentStack?: string;
177
+ isComponentError?: boolean;
178
+ };
179
+
180
+ /** Frames to keep from a component stack — the crash site plus its context. */
181
+ const COMPONENT_STACK_FRAMES = 8;
182
+
183
+ /**
184
+ * Squeeze a React component stack down to the part a human (or an agent
185
+ * reading this over a wire) actually uses: the component names nearest the
186
+ * crash.
187
+ *
188
+ * Raw component stacks in a Metro dev bundle append the full bundle URL with
189
+ * every query param to EVERY frame — one crash is ~15 KB of near-identical
190
+ * `http://192.168.x.x:8830/…&transform.routerRoot=src/app…` noise wrapped
191
+ * around the handful of names that matter. The complete error, componentStack
192
+ * included, is still on the entry's `args` for anyone who wants it.
193
+ */
194
+ function compactComponentStack(stack: string): string {
195
+ const frames = stack
196
+ .split("\n")
197
+ .map((line) => line.trim())
198
+ .filter(Boolean)
199
+ // Drop the "(url)" tail; keep a "Name(./file.tsx)" hint when RN provides one.
200
+ .map((line) => line.replace(/\s*\((?:https?:|\/).*$/, ""));
201
+ const shown = frames.slice(0, COMPONENT_STACK_FRAMES);
202
+ const rest = frames.length - shown.length;
203
+ return (
204
+ shown.map((f) => ` ${f}`).join("\n") +
205
+ (rest > 0 ? `\n …+${rest} more frames` : "")
206
+ );
207
+ }
208
+ function asComponentError(arg: unknown): ComponentError | null {
209
+ if (!(arg instanceof Error)) return null;
210
+ const e = arg as ComponentError;
211
+ return e.isComponentError || typeof e.componentStack === "string" ? e : null;
212
+ }
213
+
169
214
  function record(method: ConsoleMethod, args: unknown[]): void {
170
215
  // Capture the call site for every log so we can attribute its origin.
171
216
  const rawStack = new Error().stack;
172
217
  const origin = parseOrigin(rawStack, captureOwnerStack());
218
+
219
+ // React Native funnels an uncaught render error back through console.error
220
+ // (ExceptionsManager.reportException) so console monkey-patches still see it.
221
+ // That arrives as an ordinary error row, which badly under-sells it: the app
222
+ // is dead. Promote it to a tagged [FATAL] entry carrying the component stack.
223
+ const crash = method === "error" ? asComponentError(args[0]) : null;
224
+ if (crash) {
225
+ // Tagged [RENDER ERROR], not [FATAL]: React reports an error an
226
+ // ErrorBoundary CAUGHT and recovered from through this same path, with the
227
+ // same componentStack, and nothing here distinguishes the two. Claiming a
228
+ // healthy app "most likely CRASHED" is worse than under-claiming — the
229
+ // component stack, which is the useful part, is reported either way.
230
+ const headline = fatalKey(crash.name, crash.message);
231
+ const located = crash.componentStack
232
+ ? `\n\nThis error is located at:\n${compactComponentStack(crash.componentStack)}`
233
+ : "";
234
+ pushFatal(
235
+ {
236
+ id: nextId++,
237
+ method: "error",
238
+ level: "error",
239
+ args: ["[RENDER ERROR]", crash],
240
+ message: `[RENDER ERROR] ${headline}${located}`,
241
+ timestamp: Date.now(),
242
+ stack: crash.stack,
243
+ origin,
244
+ },
245
+ isDuplicateFatal(`[RENDER ERROR] ${headline}`)
246
+ );
247
+ return;
248
+ }
249
+
173
250
  const entry: ConsoleLogEntry = {
174
251
  id: nextId++,
175
252
  method,
@@ -186,6 +263,11 @@ function record(method: ConsoleMethod, args: unknown[]): void {
186
263
  : [...entries, entry];
187
264
  emit();
188
265
  scheduleSave();
266
+ // Errors are the entries most likely to be the last thing an app ever logs,
267
+ // so they get pushed to any dashboard immediately instead of waiting on the
268
+ // throttle that a dying tree will never run. Rate-limited; ordinary logs
269
+ // still ride the normal throttled path.
270
+ if (entry.level === "error") flushConsoleSyncNow();
189
271
  }
190
272
 
191
273
  /** Minimal shape of React Native's global `ErrorUtils`. */
@@ -198,52 +280,244 @@ interface RNErrorUtils {
198
280
  ) => void;
199
281
  }
200
282
 
283
+ /**
284
+ * Two independent seams report the same crash on some setups (the C++ handler
285
+ * can also feed `console.error`). Suppress a repeat of the same headline within
286
+ * this window so a crash reads as ONE entry.
287
+ */
288
+ const FATAL_DEDUPE_MS = 2000;
289
+ let lastFatalKey = "";
290
+ let lastFatalAt = 0;
291
+
292
+ /**
293
+ * Normalize a crash headline so the same error reported through two different
294
+ * seams produces the same key. React Native often sets `error.message` to the
295
+ * ALREADY-prefixed string ("TypeError: x is not a function"), so one path
296
+ * builds "TypeError: TypeError: x…" and the other "TypeError: x…" — which
297
+ * defeats the de-duplication entirely.
298
+ */
299
+ function fatalKey(name: string | undefined, message: string): string {
300
+ const body = message.trim();
301
+ if (name && body.startsWith(`${name}: `)) return body;
302
+ return name ? `${name}: ${body}` : body;
303
+ }
304
+
305
+ /**
306
+ * Has this crash already been recorded moments ago?
307
+ *
308
+ * Only ever used to suppress a duplicate PUSH to the dashboard — never to drop
309
+ * an entry. Two different components crashing with the same message inside the
310
+ * window are two crashes, and a tool whose pitch is "the app's last words"
311
+ * must not silently throw one away.
312
+ */
313
+ function isDuplicateFatal(key: string): boolean {
314
+ const now = Date.now();
315
+ if (key === lastFatalKey && now - lastFatalAt < FATAL_DEDUPE_MS) return true;
316
+ lastFatalKey = key;
317
+ lastFatalAt = now;
318
+ return false;
319
+ }
320
+
321
+ /**
322
+ * The device sync bridge's "push this tool NOW" escape hatch
323
+ * (@buoy-gg/external-sync `crashFlush`). Reached through the global rather than
324
+ * an import because console deliberately has no dependency on external-sync.
325
+ */
326
+ let lastFlushAt = 0;
327
+ /** Floor between opportunistic flushes, so an error storm can't flood the socket. */
328
+ const FLUSH_MIN_INTERVAL_MS = 150;
329
+ const flushConsoleSyncNow = (force = false): void => {
330
+ const now = Date.now();
331
+ // A fatal is the app's last word — it always goes out, rate limit or not.
332
+ if (!force && now - lastFlushAt < FLUSH_MIN_INTERVAL_MS) return;
333
+ lastFlushAt = now;
334
+ try {
335
+ const set = (globalThis as { __buoyFlushToolSync?: Set<(toolId: string) => void> })
336
+ .__buoyFlushToolSync;
337
+ if (!set) return;
338
+ for (const flush of set) flush("console");
339
+ } catch {
340
+ // Best-effort: a crash path must never crash.
341
+ }
342
+ };
343
+
344
+ /**
345
+ * Append a pre-built fatal entry to the ring buffer, then push it to any
346
+ * connected dashboard IMMEDIATELY.
347
+ *
348
+ * A fatal render error unmounts the React tree microseconds later, taking the
349
+ * sync bridge — and the normal 200 ms throttled snapshot — with it. Flushing
350
+ * synchronously here is what makes a crashed app's last words readable from
351
+ * the desktop app and the MCP server instead of the app just going silent.
352
+ */
353
+ function pushFatal(entry: ConsoleLogEntry, duplicate = false): void {
354
+ entries =
355
+ entries.length >= MAX_ENTRIES
356
+ ? [...entries.slice(entries.length - MAX_ENTRIES + 1), entry]
357
+ : [...entries, entry];
358
+ emit();
359
+ scheduleSave();
360
+ // A repeat within the dedupe window is still RECORDED (two crashes are two
361
+ // crashes); it just doesn't earn another forced push to the dashboard.
362
+ if (!duplicate) flushConsoleSyncNow(true);
363
+ }
364
+
201
365
  /** Record an uncaught JS error from the global handler as an error entry. */
202
366
  function recordFatalError(error: unknown, isFatal?: boolean): void {
203
367
  const err = error instanceof Error ? error : undefined;
204
368
  // RN passes isFatal:false for non-fatal uncaught errors (e.g. errors thrown
205
369
  // in event handlers on some setups); anything else is treated as fatal.
206
370
  const label = isFatal === false ? "[UNCAUGHT]" : "[FATAL]";
207
- const headline = err ? `${err.name}: ${err.message}` : formatArg(error);
371
+ const headline = err ? fatalKey(err.name, err.message) : formatArg(error);
372
+ const duplicate = isDuplicateFatal(`${label} ${headline}`);
208
373
  // The label leads the args (not just the pre-rendered message): the
209
374
  // DevTools-style row renders from args, so this is what makes the tag
210
375
  // visible in the UI — exactly like `console.error("[FATAL]", err)`.
211
- const entry: ConsoleLogEntry = {
212
- id: nextId++,
213
- method: "error",
214
- level: "error",
215
- args: [label, error],
216
- message: `${label} ${headline}`,
217
- timestamp: Date.now(),
218
- // The error's OWN stack — the crash site, not this handler's call site.
219
- stack: err?.stack,
220
- fatal: true,
221
- };
222
- entries =
223
- entries.length >= MAX_ENTRIES
224
- ? [...entries.slice(entries.length - MAX_ENTRIES + 1), entry]
225
- : [...entries, entry];
226
- emit();
227
- scheduleSave();
376
+ pushFatal(
377
+ {
378
+ id: nextId++,
379
+ method: "error",
380
+ level: "error",
381
+ args: [label, error],
382
+ message: `${label} ${headline}`,
383
+ timestamp: Date.now(),
384
+ // The error's OWN stack — the crash site, not this handler's call site.
385
+ stack: err?.stack,
386
+ fatal: true,
387
+ },
388
+ duplicate
389
+ );
228
390
  }
229
391
 
230
392
  /**
231
- * Hook React Native's global error handler (`ErrorUtils.setGlobalHandler`) so
232
- * FATAL/uncaught JS errors land in the console store. A fatal render error
233
- * kills the tree without ever calling `console.error` through our patch —
234
- * without this hook a crashing app reads as "0 entries captured", the most
235
- * misleading possible answer to "why is my app broken".
393
+ * The exception payload React Native's C++ error handler hands to listeners
394
+ * registered via `global.RN$registerExceptionListener` (JsErrorHandler.cpp).
395
+ */
396
+ interface NativeExceptionData {
397
+ message?: string;
398
+ originalMessage?: string | null;
399
+ name?: string | null;
400
+ componentStack?: string | null;
401
+ stack?: Array<{
402
+ file?: string;
403
+ methodName?: string;
404
+ lineNumber?: number;
405
+ column?: number;
406
+ }>;
407
+ id?: number;
408
+ isFatal?: boolean;
409
+ isComponentError?: boolean;
410
+ extraData?: { rawStack?: string } & Record<string, unknown>;
411
+ /** Suppresses RN's own redbox. We never call it — we only observe. */
412
+ preventDefault?: () => unknown;
413
+ }
414
+
415
+ /** Render the C++ handler's parsed frames back into a normal stack string. */
416
+ function formatNativeStack(data: NativeExceptionData): string | undefined {
417
+ const raw = data.extraData?.rawStack;
418
+ if (typeof raw === "string" && raw.length > 0) return raw;
419
+ if (!Array.isArray(data.stack) || data.stack.length === 0) return undefined;
420
+ return data.stack
421
+ .map((f) => {
422
+ const where =
423
+ f.lineNumber != null ? `${f.file ?? "?"}:${f.lineNumber}:${f.column ?? 0}` : f.file ?? "?";
424
+ return ` at ${f.methodName || "<anonymous>"} (${where})`;
425
+ })
426
+ .join("\n");
427
+ }
428
+
429
+ /** Record a crash reported by React Native's native (C++) error handler. */
430
+ function recordNativeException(data: NativeExceptionData): void {
431
+ const label = data.isFatal === false ? "[UNCAUGHT]" : "[FATAL]";
432
+ const headline = fatalKey(data.name ?? undefined, data.originalMessage ?? data.message ?? "Unknown error");
433
+ const duplicate = isDuplicateFatal(`${label} ${headline}`);
434
+ // The component stack is the single most useful line for "which component
435
+ // crashed" — RN puts it in the redbox, so put it in the console entry too.
436
+ const componentStack =
437
+ typeof data.componentStack === "string" && data.componentStack.trim()
438
+ ? `\n\nThis error is located at:\n${compactComponentStack(data.componentStack)}`
439
+ : "";
440
+ const message = `${label} ${headline}${componentStack}`;
441
+ pushFatal(
442
+ {
443
+ id: nextId++,
444
+ method: "error",
445
+ level: "error",
446
+ args: [label, headline, ...(componentStack ? [componentStack.trim()] : [])],
447
+ message,
448
+ timestamp: Date.now(),
449
+ stack: formatNativeStack(data),
450
+ fatal: true,
451
+ },
452
+ duplicate
453
+ );
454
+ }
455
+
456
+ /**
457
+ * Register with React Native's native (C++) exception handler — the seam a
458
+ * RENDER crash actually travels through on the New Architecture.
459
+ *
460
+ * React 19 routes an uncaught render error to `onUncaughtError` →
461
+ * `ExceptionsManager.handleException`, which NEVER reaches
462
+ * `ErrorUtils.setGlobalHandler`. Where it goes from there depends on the build:
463
+ *
464
+ * - `useAlwaysAvailableJSErrorHandling` on: the C++ handler
465
+ * (`global.RN$handleException`) reports it and JS sees nothing — this
466
+ * listener is the only seam.
467
+ * - otherwise: JS `reportException` re-feeds `console.error(e)` "so any methods
468
+ * monkey patched on top of console.error are called", which the console patch
469
+ * catches and promotes to `[FATAL]` (see `record`).
470
+ *
471
+ * Both are covered, and a crash reported through both de-duplicates to one
472
+ * entry. `RN$registerExceptionListener` keeps a LIST of listeners (LogBox
473
+ * registers one too), so this is purely additive. We never call the payload's
474
+ * `preventDefault()`: suppressing RN's own redbox is not our call to make.
475
+ */
476
+ function installNativeExceptionCapture(): boolean {
477
+ const register = (
478
+ globalThis as {
479
+ RN$registerExceptionListener?: (
480
+ listener: (data: NativeExceptionData) => void
481
+ ) => void;
482
+ }
483
+ ).RN$registerExceptionListener;
484
+ if (typeof register !== "function") return false;
485
+ register((data) => {
486
+ try {
487
+ if (!captureDisabledByUser) recordNativeException(data);
488
+ } catch {
489
+ // Capture must never interfere with error reporting.
490
+ }
491
+ });
492
+ return true;
493
+ }
494
+
495
+ /**
496
+ * Hook React Native's error paths so FATAL/uncaught JS errors land in the
497
+ * console store: the classic `ErrorUtils.setGlobalHandler` (old architecture,
498
+ * native-module callbacks, promise rejections) AND the native C++ exception
499
+ * listener (New Architecture render crashes — see
500
+ * {@link installNativeExceptionCapture}). Both feed the same de-duplicated
501
+ * `[FATAL]` entry, so a crash reported through both seams shows up once.
236
502
  *
237
503
  * - Chains the previous handler (LogBox/redbox still fire; nothing swallowed).
238
- * - Idempotent, and a silent no-op off React Native (no `ErrorUtils` global) —
504
+ * - Idempotent, and a silent no-op off React Native (neither global present) —
239
505
  * which also keeps it inert on the desktop dashboard / web mirrors.
240
506
  * - Recording respects an explicit `uninstallConsoleCapture()` (user OFF), but
241
- * the hook itself stays chained — it can't be safely removed.
507
+ * the hooks themselves stay chained — they can't be safely removed.
242
508
  */
243
509
  export function installFatalErrorCapture(): void {
244
510
  if (fatalInstalled) return;
511
+ // Latch only once a seam is actually attached. Setting the flag up front
512
+ // means an install that runs before `InitializeCore` has published
513
+ // `ErrorUtils` would latch anyway and never retry — silently losing promise
514
+ // rejections and native-callback errors, which travel ONLY that seam.
515
+ const nativeInstalled = installNativeExceptionCapture();
245
516
  const errorUtils = (globalThis as { ErrorUtils?: RNErrorUtils }).ErrorUtils;
246
- if (typeof errorUtils?.setGlobalHandler !== "function") return;
517
+ if (typeof errorUtils?.setGlobalHandler !== "function") {
518
+ fatalInstalled = nativeInstalled;
519
+ return;
520
+ }
247
521
  fatalInstalled = true;
248
522
  const previous =
249
523
  typeof errorUtils.getGlobalHandler === "function"