@buoy-gg/agent-core 7.0.46 → 7.0.47

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.SNAPSHOT_ACTION=void 0;exports.projectSnapshot=projectSnapshot;var _redact=require("../policy/redact");const SNAPSHOT_ACTION=exports.SNAPSHOT_ACTION="getSnapshot";const SEVERITY={verbose:0,debug:0,trace:0,log:1,info:1,warn:2,warning:2,error:3};function asArray(r){return Array.isArray(r)?r:[]}function rec(r){return r&&typeof r==="object"?r:{}}function num(r,t){return typeof r==="number"&&r>0?r:t}function newest(r,t){return r.length<=t?r:r.slice(0,t)}function projectConsole(r,t){const s=asArray(rec(r).entries);const a=typeof t.level==="string"?SEVERITY[t.level]??0:0;const u=typeof t.pattern==="string"?t.pattern.toLowerCase():void 0;const d=s.filter(c=>{const n=rec(c);const o=String(n.level??"log");if((SEVERITY[o]??1)<a)return false;if(!u)return true;return String(n.message??"").toLowerCase().includes(u)});const e=newest(d,num(t.limit,40));return{totalCaptured:s.length,shown:e.length,entries:e.map(c=>{const n=rec(c);return{at:n.timestamp,level:n.level,message:n.message}})}}function projectNetwork(r,t){const s=rec(r);const a=asArray(s.events).filter(n=>!(0,_redact.isSelfTraffic)(rec(n).url));const u=t.failedOnly===true;const d=typeof t.pattern==="string"?t.pattern.toLowerCase():void 0;const e=a.filter(n=>{const o=rec(n);const i=typeof o.status==="number"?o.status:void 0;if(u&&!(o.error||i!==void 0&&i>=400))return false;if(!d)return true;return String(o.url??"").toLowerCase().includes(d)});const c=newest(e,num(t.limit,25));return{totalCaptured:a.length,shown:c.length,requests:c.map(n=>{const o=rec(n);return{id:o.id,method:o.method,url:o.url,status:o.status,durationMs:o.duration,error:o.error,overridden:o.override?true:void 0}}),hint:"Read one response with network.getEventBody({ id })."}}function flattenRoutes(r,t=[],s=80){for(const a of asArray(r)){if(t.length>=s)break;const u=rec(a);if(u.isInternal!==true&&typeof u.path==="string")t.push(u.path);flattenRoutes(u.children,t,s)}return t}function projectStorage(r,t){const s=e=>typeof e==="string"&&e.length>300?`${e.slice(0,300)}\u2026`:e;const a=typeof t.key==="string"?t.key.toLowerCase():void 0;const u=asArray(r).map(rec).map(e=>{const c=rec(e.data);return{id:e.id,at:e.timestamp,action:e.action,storage:e.storageType,key:c.key??c.keys,value:s(c.value),prevValue:s(c.prevValue)}}).filter(e=>!a||JSON.stringify(e.key??"").toLowerCase().includes(a)).sort((e,c)=>String(c.at).localeCompare(String(e.at)));const d=num(t.limit,20);return{events:u.slice(0,d),total:u.length,returned:Math.min(d,u.length)}}function projectRedux(r,t){const s=e=>{if(e===void 0)return void 0;const c=typeof e==="string"?e:JSON.stringify(e);return c&&c.length>400?`${c.slice(0,400)}\u2026`:e};const a=typeof t.type==="string"?t.type.toLowerCase():void 0;const u=asArray(r).map(rec).filter(e=>e.category!=="internal").map(e=>({id:e.id,at:e.timestamp,type:e.type,payload:s(e.payload),meta:s(e.meta),error:s(e.error),changed:e.diffSummary||void 0})).filter(e=>!a||String(e.type).toLowerCase().includes(a)).sort((e,c)=>Number(c.at)-Number(e.at));const d=num(t.limit,20);return{actions:u.slice(0,d),total:u.length,returned:Math.min(d,u.length)}}function projectStoreChanges(r,t,s,a){const u=n=>{if(n===void 0)return void 0;const o=typeof n==="string"?n:JSON.stringify(n);return o&&o.length>400?`${o.slice(0,400)}\u2026`:n};const d=typeof t[a]==="string"?String(t[a]).toLowerCase():void 0;const e=asArray(rec(r).changes).map(rec).map(n=>({id:n.id,at:n.timestamp,[a]:n[s],changed:n.changedKeys,summary:n.diffSummary||void 0,...s==="storeName"?{partial:u(n.partial)}:{value:u(n.valuePreview)}})).filter(n=>!d||String(n[a]??"").toLowerCase().includes(d)).sort((n,o)=>Number(o.at)-Number(n.at));const c=num(t.limit,20);return{changes:e.slice(0,c),total:e.length,returned:Math.min(c,e.length)}}function projectRoutes(r,t){const s=rec(r);const a=rec(s.sitemap);const u=asArray(s.stack).map(rec);const d=asArray(s.events).map(rec);const e=u.map(i=>({name:i.name,path:i.pathname,focused:i.isFocused===true?true:void 0}));const c=d.slice(0,num(t.limit,15)).map(i=>({at:i.timestamp,from:i.previousPathname,to:i.pathname}));const n=u.find(i=>i.isFocused===true)??u[u.length-1];const o=d.length?{path:d[0].pathname,source:"event"}:typeof n?.pathname==="string"?{path:n.pathname,source:"stack"}:void 0;return{currentRoute:o,stack:e,routes:flattenRoutes(a.routes),sitemapSource:a.source,recentNavigations:c}}function projectEnv(r){const t=rec(r);return{env:t.env??t.variables,requiredEnvVars:t.requiredEnvVars,...Array.isArray(t.checks)?{checks:t.checks}:{}}}function projectSentry(r,t){const s=rec(r);const a=asArray(s.envelopes).map(rec);const u=typeof t.type==="string"?t.type:void 0;const d=typeof t.pattern==="string"?t.pattern.toLowerCase():void 0;const e=a.filter(n=>{const o=asArray(n.items).map(rec);if(u&&!o.some(i=>i.type===u))return false;if(!d)return true;return o.some(i=>String(i.summary??"").toLowerCase().includes(d))});const c=newest(e,num(t.limit,10));return{status:s.status,totalCaptured:a.length,shown:c.length,envelopes:c.map(n=>({id:n.id,at:n.timestamp,origin:n.origin,eventId:n.eventId,totalBytes:n.totalBytes,items:asArray(n.items).map(o=>{const i=rec(o);return{type:i.type,summary:i.summary,spanCount:i.spanCount,bytes:i.bytes}})})),drops:(()=>{const n=rec(s.drops);const o=newest(asArray(n.recent).map(rec),8).map(i=>({at:i.timestamp,reason:i.reason,category:i.category,quantity:i.quantity,detail:typeof i.detail==="string"?i.detail.slice(0,200):i.detail}));return o.length||n.summary?{summary:n.summary,recent:o}:void 0})(),hint:"For crash stack traces, console's [FATAL] entries carry the component stacks. `drops` lists events the SDK discarded before sending, with the reason."}}function projectSnapshot(r,t,s={}){switch(r){case"console":return projectConsole(t,s);case"network":return projectNetwork(t,s);case"route-events":return projectRoutes(t,s);case"storage":return projectStorage(t,s);case"redux":return projectRedux(t,s);case"zustand":return projectStoreChanges(t,s,"storeName","store");case"jotai":return projectStoreChanges(t,s,"atomLabel","atom");case"env":return projectEnv(t);case"sentry":return projectSentry(t,s);default:return t}}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.SNAPSHOT_ACTION=void 0;exports.projectSnapshot=projectSnapshot;var _redact=require("../policy/redact");const SNAPSHOT_ACTION=exports.SNAPSHOT_ACTION="getSnapshot";const SEVERITY={verbose:0,debug:0,trace:0,log:1,info:1,warn:2,warning:2,error:3};function asArray(r){return Array.isArray(r)?r:[]}function rec(r){return r&&typeof r==="object"?r:{}}function num(r,t){return typeof r==="number"&&r>0?r:t}function newest(r,t){return r.length<=t?r:r.slice(0,t)}function projectConsole(r,t){const s=asArray(rec(r).entries);const u=typeof t.level==="string"?SEVERITY[t.level]??0:0;const i=typeof t.pattern==="string"?t.pattern.toLowerCase():void 0;const d=s.filter(c=>{const n=rec(c);const o=String(n.level??"log");if((SEVERITY[o]??1)<u)return false;if(!i)return true;return String(n.message??"").toLowerCase().includes(i)});const e=newest(d,num(t.limit,40));return{totalCaptured:s.length,shown:e.length,entries:e.map(c=>{const n=rec(c);return{at:n.timestamp,level:n.level,message:n.message}})}}function projectNetwork(r,t){const s=rec(r);const u=asArray(s.events).filter(n=>!(0,_redact.isSelfTraffic)(rec(n).url));const i=t.failedOnly===true;const d=typeof t.pattern==="string"?t.pattern.toLowerCase():void 0;const e=u.filter(n=>{const o=rec(n);const a=typeof o.status==="number"?o.status:void 0;if(i&&!(o.error||a!==void 0&&a>=400))return false;if(!d)return true;return String(o.url??"").toLowerCase().includes(d)});const c=newest(e,num(t.limit,25));return{totalCaptured:u.length,shown:c.length,requests:c.map(n=>{const o=rec(n);return{id:o.id,method:o.method,url:o.url,status:o.status,durationMs:o.duration,error:o.error,overridden:o.override?true:void 0}}),hint:"Read one response with network.getEventBody({ id })."}}function flattenRoutes(r,t=[],s=80){for(const u of asArray(r)){if(t.length>=s)break;const i=rec(u);if(i.isInternal!==true&&typeof i.path==="string")t.push(i.path);flattenRoutes(i.children,t,s)}return t}function projectStorage(r,t){const s=e=>typeof e==="string"&&e.length>300?`${e.slice(0,300)}\u2026`:e;const u=typeof t.key==="string"?t.key.toLowerCase():void 0;const i=asArray(r).map(rec).map(e=>{const c=rec(e.data);return{id:e.id,at:e.timestamp,action:e.action,storage:e.storageType,key:c.key??c.keys,value:s(c.value),prevValue:s(c.prevValue)}}).filter(e=>!u||JSON.stringify(e.key??"").toLowerCase().includes(u)).sort((e,c)=>String(c.at).localeCompare(String(e.at)));const d=num(t.limit,20);return{events:i.slice(0,d),total:i.length,returned:Math.min(d,i.length)}}function projectRedux(r,t){const s=e=>{if(e===void 0)return void 0;const c=typeof e==="string"?e:JSON.stringify(e);return c&&c.length>400?`${c.slice(0,400)}\u2026`:e};const u=typeof t.type==="string"?t.type.toLowerCase():void 0;const i=asArray(r).map(rec).filter(e=>e.category!=="internal").map(e=>({id:e.id,at:e.timestamp,type:e.type,payload:s(e.payload),meta:s(e.meta),error:s(e.error),changed:e.diffSummary||void 0})).filter(e=>!u||String(e.type).toLowerCase().includes(u)).sort((e,c)=>Number(c.at)-Number(e.at));const d=num(t.limit,20);return{actions:i.slice(0,d),total:i.length,returned:Math.min(d,i.length)}}function projectStoreChanges(r,t,s,u){const i=n=>{if(n===void 0)return void 0;const o=typeof n==="string"?n:JSON.stringify(n);return o&&o.length>400?`${o.slice(0,400)}\u2026`:n};const d=typeof t[u]==="string"?String(t[u]).toLowerCase():void 0;const e=asArray(rec(r).changes).map(rec).map(n=>({id:n.id,at:n.timestamp,[u]:n[s],changed:n.changedKeys,summary:n.diffSummary||void 0,...s==="storeName"?{partial:i(n.partial)}:{value:i(n.valuePreview)}})).filter(n=>!d||String(n[u]??"").toLowerCase().includes(d)).sort((n,o)=>Number(o.at)-Number(n.at));const c=num(t.limit,20);return{changes:e.slice(0,c),total:e.length,returned:Math.min(c,e.length)}}function projectRoutes(r,t){const s=rec(r);const u=rec(s.sitemap);const i=asArray(s.stack).map(rec);const d=asArray(s.events).map(rec);const e=i.map(a=>({name:a.name,path:a.pathname,focused:a.isFocused===true?true:void 0}));const c=d.slice(0,num(t.limit,15)).map(a=>({at:a.timestamp,from:a.previousPathname,to:a.pathname}));const n=i.find(a=>a.isFocused===true)??i[i.length-1];const o=d.length?{path:d[0].pathname,source:"event"}:typeof n?.pathname==="string"?{path:n.pathname,source:"stack"}:void 0;return{currentRoute:o,stack:e,routes:flattenRoutes(u.routes),sitemapSource:u.source,recentNavigations:c}}function projectEnv(r){const t=rec(r);return{env:t.env??t.variables,requiredEnvVars:t.requiredEnvVars,...Array.isArray(t.checks)?{checks:t.checks}:{}}}function projectSentry(r,t){const s=rec(r);const u=asArray(s.envelopes).map(rec);const i=typeof t.type==="string"?t.type:void 0;const d=typeof t.pattern==="string"?t.pattern.toLowerCase():void 0;const e=u.filter(n=>{const o=asArray(n.items).map(rec);if(i&&!o.some(a=>a.type===i))return false;if(!d)return true;return o.some(a=>String(a.summary??"").toLowerCase().includes(d))});const c=newest(e,num(t.limit,10));return{status:s.status,totalCaptured:u.length,shown:c.length,envelopes:c.map(n=>({id:n.id,at:n.timestamp,origin:n.origin,eventId:n.eventId,totalBytes:n.totalBytes,items:asArray(n.items).map(o=>{const a=rec(o);return{type:a.type,summary:a.summary,spanCount:a.spanCount,bytes:a.bytes}})})),drops:(()=>{const n=rec(s.drops);const o=asArray(n.recent).map(rec);const a=l=>l.category==="span"||l.category==="transaction";const p=[...newest(o.filter(l=>!a(l)),8),...newest(o.filter(a),3)];const f=p.map(l=>({at:l.timestamp,reason:l.reason,category:l.category,quantity:l.quantity,detail:typeof l.detail==="string"?l.detail.slice(0,200):l.detail}));return f.length||n.summary?{summary:n.summary,recent:f}:void 0})(),hint:"For crash stack traces, console's [FATAL] entries carry the component stacks. `drops` lists events the SDK discarded before sending, with the reason."}}function projectSnapshot(r,t,s={}){switch(r){case"console":return projectConsole(t,s);case"network":return projectNetwork(t,s);case"route-events":return projectRoutes(t,s);case"storage":return projectStorage(t,s);case"redux":return projectRedux(t,s);case"zustand":return projectStoreChanges(t,s,"storeName","store");case"jotai":return projectStoreChanges(t,s,"atomLabel","atom");case"env":return projectEnv(t);case"sentry":return projectSentry(t,s);default:return t}}
@@ -1 +1 @@
1
- "use strict";import{isSelfTraffic as w}from"../policy/redact";export const SNAPSHOT_ACTION="getSnapshot";const g={verbose:0,debug:0,trace:0,log:1,info:1,warn:2,warning:2,error:3};function f(r){return Array.isArray(r)?r:[]}function a(r){return r&&typeof r==="object"?r:{}}function p(r,t){return typeof r==="number"&&r>0?r:t}function m(r,t){return r.length<=t?r:r.slice(0,t)}function S(r,t){const s=f(a(r).entries);const d=typeof t.level==="string"?g[t.level]??0:0;const u=typeof t.pattern==="string"?t.pattern.toLowerCase():void 0;const l=s.filter(c=>{const n=a(c);const o=String(n.level??"log");if((g[o]??1)<d)return false;if(!u)return true;return String(n.message??"").toLowerCase().includes(u)});const e=m(l,p(t.limit,40));return{totalCaptured:s.length,shown:e.length,entries:e.map(c=>{const n=a(c);return{at:n.timestamp,level:n.level,message:n.message}})}}function v(r,t){const s=a(r);const d=f(s.events).filter(n=>!w(a(n).url));const u=t.failedOnly===true;const l=typeof t.pattern==="string"?t.pattern.toLowerCase():void 0;const e=d.filter(n=>{const o=a(n);const i=typeof o.status==="number"?o.status:void 0;if(u&&!(o.error||i!==void 0&&i>=400))return false;if(!l)return true;return String(o.url??"").toLowerCase().includes(l)});const c=m(e,p(t.limit,25));return{totalCaptured:d.length,shown:c.length,requests:c.map(n=>{const o=a(n);return{id:o.id,method:o.method,url:o.url,status:o.status,durationMs:o.duration,error:o.error,overridden:o.override?true:void 0}}),hint:"Read one response with network.getEventBody({ id })."}}function h(r,t=[],s=80){for(const d of f(r)){if(t.length>=s)break;const u=a(d);if(u.isInternal!==true&&typeof u.path==="string")t.push(u.path);h(u.children,t,s)}return t}function C(r,t){const s=e=>typeof e==="string"&&e.length>300?`${e.slice(0,300)}\u2026`:e;const d=typeof t.key==="string"?t.key.toLowerCase():void 0;const u=f(r).map(a).map(e=>{const c=a(e.data);return{id:e.id,at:e.timestamp,action:e.action,storage:e.storageType,key:c.key??c.keys,value:s(c.value),prevValue:s(c.prevValue)}}).filter(e=>!d||JSON.stringify(e.key??"").toLowerCase().includes(d)).sort((e,c)=>String(c.at).localeCompare(String(e.at)));const l=p(t.limit,20);return{events:u.slice(0,l),total:u.length,returned:Math.min(l,u.length)}}function k(r,t){const s=e=>{if(e===void 0)return void 0;const c=typeof e==="string"?e:JSON.stringify(e);return c&&c.length>400?`${c.slice(0,400)}\u2026`:e};const d=typeof t.type==="string"?t.type.toLowerCase():void 0;const u=f(r).map(a).filter(e=>e.category!=="internal").map(e=>({id:e.id,at:e.timestamp,type:e.type,payload:s(e.payload),meta:s(e.meta),error:s(e.error),changed:e.diffSummary||void 0})).filter(e=>!d||String(e.type).toLowerCase().includes(d)).sort((e,c)=>Number(c.at)-Number(e.at));const l=p(t.limit,20);return{actions:u.slice(0,l),total:u.length,returned:Math.min(l,u.length)}}function y(r,t,s,d){const u=n=>{if(n===void 0)return void 0;const o=typeof n==="string"?n:JSON.stringify(n);return o&&o.length>400?`${o.slice(0,400)}\u2026`:n};const l=typeof t[d]==="string"?String(t[d]).toLowerCase():void 0;const e=f(a(r).changes).map(a).map(n=>({id:n.id,at:n.timestamp,[d]:n[s],changed:n.changedKeys,summary:n.diffSummary||void 0,...s==="storeName"?{partial:u(n.partial)}:{value:u(n.valuePreview)}})).filter(n=>!l||String(n[d]??"").toLowerCase().includes(l)).sort((n,o)=>Number(o.at)-Number(n.at));const c=p(t.limit,20);return{changes:e.slice(0,c),total:e.length,returned:Math.min(c,e.length)}}function b(r,t){const s=a(r);const d=a(s.sitemap);const u=f(s.stack).map(a);const l=f(s.events).map(a);const e=u.map(i=>({name:i.name,path:i.pathname,focused:i.isFocused===true?true:void 0}));const c=l.slice(0,p(t.limit,15)).map(i=>({at:i.timestamp,from:i.previousPathname,to:i.pathname}));const n=u.find(i=>i.isFocused===true)??u[u.length-1];const o=l.length?{path:l[0].pathname,source:"event"}:typeof n?.pathname==="string"?{path:n.pathname,source:"stack"}:void 0;return{currentRoute:o,stack:e,routes:h(d.routes),sitemapSource:d.source,recentNavigations:c}}function L(r){const t=a(r);return{env:t.env??t.variables,requiredEnvVars:t.requiredEnvVars,...Array.isArray(t.checks)?{checks:t.checks}:{}}}function N(r,t){const s=a(r);const d=f(s.envelopes).map(a);const u=typeof t.type==="string"?t.type:void 0;const l=typeof t.pattern==="string"?t.pattern.toLowerCase():void 0;const e=d.filter(n=>{const o=f(n.items).map(a);if(u&&!o.some(i=>i.type===u))return false;if(!l)return true;return o.some(i=>String(i.summary??"").toLowerCase().includes(l))});const c=m(e,p(t.limit,10));return{status:s.status,totalCaptured:d.length,shown:c.length,envelopes:c.map(n=>({id:n.id,at:n.timestamp,origin:n.origin,eventId:n.eventId,totalBytes:n.totalBytes,items:f(n.items).map(o=>{const i=a(o);return{type:i.type,summary:i.summary,spanCount:i.spanCount,bytes:i.bytes}})})),drops:(()=>{const n=a(s.drops);const o=m(f(n.recent).map(a),8).map(i=>({at:i.timestamp,reason:i.reason,category:i.category,quantity:i.quantity,detail:typeof i.detail==="string"?i.detail.slice(0,200):i.detail}));return o.length||n.summary?{summary:n.summary,recent:o}:void 0})(),hint:"For crash stack traces, console's [FATAL] entries carry the component stacks. `drops` lists events the SDK discarded before sending, with the reason."}}export function projectSnapshot(r,t,s={}){switch(r){case"console":return S(t,s);case"network":return v(t,s);case"route-events":return b(t,s);case"storage":return C(t,s);case"redux":return k(t,s);case"zustand":return y(t,s,"storeName","store");case"jotai":return y(t,s,"atomLabel","atom");case"env":return L(t);case"sentry":return N(t,s);default:return t}}
1
+ "use strict";import{isSelfTraffic as C}from"../policy/redact";export const SNAPSHOT_ACTION="getSnapshot";const y={verbose:0,debug:0,trace:0,log:1,info:1,warn:2,warning:2,error:3};function p(r){return Array.isArray(r)?r:[]}function u(r){return r&&typeof r==="object"?r:{}}function m(r,t){return typeof r==="number"&&r>0?r:t}function g(r,t){return r.length<=t?r:r.slice(0,t)}function k(r,t){const s=p(u(r).entries);const d=typeof t.level==="string"?y[t.level]??0:0;const i=typeof t.pattern==="string"?t.pattern.toLowerCase():void 0;const l=s.filter(c=>{const n=u(c);const o=String(n.level??"log");if((y[o]??1)<d)return false;if(!i)return true;return String(n.message??"").toLowerCase().includes(i)});const e=g(l,m(t.limit,40));return{totalCaptured:s.length,shown:e.length,entries:e.map(c=>{const n=u(c);return{at:n.timestamp,level:n.level,message:n.message}})}}function b(r,t){const s=u(r);const d=p(s.events).filter(n=>!C(u(n).url));const i=t.failedOnly===true;const l=typeof t.pattern==="string"?t.pattern.toLowerCase():void 0;const e=d.filter(n=>{const o=u(n);const a=typeof o.status==="number"?o.status:void 0;if(i&&!(o.error||a!==void 0&&a>=400))return false;if(!l)return true;return String(o.url??"").toLowerCase().includes(l)});const c=g(e,m(t.limit,25));return{totalCaptured:d.length,shown:c.length,requests:c.map(n=>{const o=u(n);return{id:o.id,method:o.method,url:o.url,status:o.status,durationMs:o.duration,error:o.error,overridden:o.override?true:void 0}}),hint:"Read one response with network.getEventBody({ id })."}}function w(r,t=[],s=80){for(const d of p(r)){if(t.length>=s)break;const i=u(d);if(i.isInternal!==true&&typeof i.path==="string")t.push(i.path);w(i.children,t,s)}return t}function L(r,t){const s=e=>typeof e==="string"&&e.length>300?`${e.slice(0,300)}\u2026`:e;const d=typeof t.key==="string"?t.key.toLowerCase():void 0;const i=p(r).map(u).map(e=>{const c=u(e.data);return{id:e.id,at:e.timestamp,action:e.action,storage:e.storageType,key:c.key??c.keys,value:s(c.value),prevValue:s(c.prevValue)}}).filter(e=>!d||JSON.stringify(e.key??"").toLowerCase().includes(d)).sort((e,c)=>String(c.at).localeCompare(String(e.at)));const l=m(t.limit,20);return{events:i.slice(0,l),total:i.length,returned:Math.min(l,i.length)}}function N(r,t){const s=e=>{if(e===void 0)return void 0;const c=typeof e==="string"?e:JSON.stringify(e);return c&&c.length>400?`${c.slice(0,400)}\u2026`:e};const d=typeof t.type==="string"?t.type.toLowerCase():void 0;const i=p(r).map(u).filter(e=>e.category!=="internal").map(e=>({id:e.id,at:e.timestamp,type:e.type,payload:s(e.payload),meta:s(e.meta),error:s(e.error),changed:e.diffSummary||void 0})).filter(e=>!d||String(e.type).toLowerCase().includes(d)).sort((e,c)=>Number(c.at)-Number(e.at));const l=m(t.limit,20);return{actions:i.slice(0,l),total:i.length,returned:Math.min(l,i.length)}}function S(r,t,s,d){const i=n=>{if(n===void 0)return void 0;const o=typeof n==="string"?n:JSON.stringify(n);return o&&o.length>400?`${o.slice(0,400)}\u2026`:n};const l=typeof t[d]==="string"?String(t[d]).toLowerCase():void 0;const e=p(u(r).changes).map(u).map(n=>({id:n.id,at:n.timestamp,[d]:n[s],changed:n.changedKeys,summary:n.diffSummary||void 0,...s==="storeName"?{partial:i(n.partial)}:{value:i(n.valuePreview)}})).filter(n=>!l||String(n[d]??"").toLowerCase().includes(l)).sort((n,o)=>Number(o.at)-Number(n.at));const c=m(t.limit,20);return{changes:e.slice(0,c),total:e.length,returned:Math.min(c,e.length)}}function j(r,t){const s=u(r);const d=u(s.sitemap);const i=p(s.stack).map(u);const l=p(s.events).map(u);const e=i.map(a=>({name:a.name,path:a.pathname,focused:a.isFocused===true?true:void 0}));const c=l.slice(0,m(t.limit,15)).map(a=>({at:a.timestamp,from:a.previousPathname,to:a.pathname}));const n=i.find(a=>a.isFocused===true)??i[i.length-1];const o=l.length?{path:l[0].pathname,source:"event"}:typeof n?.pathname==="string"?{path:n.pathname,source:"stack"}:void 0;return{currentRoute:o,stack:e,routes:w(d.routes),sitemapSource:d.source,recentNavigations:c}}function A(r){const t=u(r);return{env:t.env??t.variables,requiredEnvVars:t.requiredEnvVars,...Array.isArray(t.checks)?{checks:t.checks}:{}}}function R(r,t){const s=u(r);const d=p(s.envelopes).map(u);const i=typeof t.type==="string"?t.type:void 0;const l=typeof t.pattern==="string"?t.pattern.toLowerCase():void 0;const e=d.filter(n=>{const o=p(n.items).map(u);if(i&&!o.some(a=>a.type===i))return false;if(!l)return true;return o.some(a=>String(a.summary??"").toLowerCase().includes(l))});const c=g(e,m(t.limit,10));return{status:s.status,totalCaptured:d.length,shown:c.length,envelopes:c.map(n=>({id:n.id,at:n.timestamp,origin:n.origin,eventId:n.eventId,totalBytes:n.totalBytes,items:p(n.items).map(o=>{const a=u(o);return{type:a.type,summary:a.summary,spanCount:a.spanCount,bytes:a.bytes}})})),drops:(()=>{const n=u(s.drops);const o=p(n.recent).map(u);const a=f=>f.category==="span"||f.category==="transaction";const v=[...g(o.filter(f=>!a(f)),8),...g(o.filter(a),3)];const h=v.map(f=>({at:f.timestamp,reason:f.reason,category:f.category,quantity:f.quantity,detail:typeof f.detail==="string"?f.detail.slice(0,200):f.detail}));return h.length||n.summary?{summary:n.summary,recent:h}:void 0})(),hint:"For crash stack traces, console's [FATAL] entries carry the component stacks. `drops` lists events the SDK discarded before sending, with the reason."}}export function projectSnapshot(r,t,s={}){switch(r){case"console":return k(t,s);case"network":return b(t,s);case"route-events":return j(t,s);case"storage":return L(t,s);case"redux":return N(t,s);case"zustand":return S(t,s,"storeName","store");case"jotai":return S(t,s,"atomLabel","atom");case"env":return A(t);case"sentry":return R(t,s);default:return t}}