@lensmcp/react-instrumentation 1.23.12 → 1.24.0

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.
@@ -40,7 +40,7 @@ export interface LensmcpBabelOptions {
40
40
  /**
41
41
  * The path stamped into `data-agent-source` and into a flow's `originNodeId`.
42
42
  *
43
- * issues/codex-security/39: this used to be `file.slice(rootDir.length)` when the file was under the
43
+ * issues/closed/codex-security-39: this used to be `file.slice(rootDir.length)` when the file was under the
44
44
  * root and **the raw absolute path otherwise** — so a monorepo app (every file outside the Vite root
45
45
  * is) shipped `/Users/<name>/work/acme/libs/ui/Button.tsx` into the DOM and, until the same finding's
46
46
  * origin gate landed in `flow-fetch.ts`, into third-party request headers. The username and the
@@ -1 +1 @@
1
- "use strict";var v=Object.defineProperty;var a=(o,e)=>v(o,"name",{value:e,configurable:!0});var j=Object.defineProperty,d=a((o,e)=>j(o,"name",{value:e,configurable:!0}),"c");const X=4;export function displaySourcePath(o,e){const n=d(p=>p.replace(/\\/g,"/").replace(/\/+$/,"").split("/"),"segments"),t=n(o),i=n(e);let r=0;for(;r<t.length&&r<i.length&&t[r]===i[r];)r++;const l=i.length-r;if(r===0||l>4)return`<external>/${t[t.length-1]??"unknown"}`;const s=t.slice(r);return s.length===0?"<external>/unknown":[...new Array(l).fill(".."),...s].join("/")}a(displaySourcePath,"displaySourcePath"),d(displaySourcePath,"displaySourcePath");const h="@lensmcp/react-instrumentation",b={useEffect:"tracedUseEffect",useMemo:"tracedUseMemo",useCallback:"tracedUseCallback"},C=["onClick","onDoubleClick","onContextMenu","onSubmit","onChange"],R={onSubmit:"form-submit",onChange:"input-change"};export default function w(o){const e=o.types;return{name:"@lensmcp/react-instrumentation/babel-plugin",visitor:{Program:{enter(n,t){if(t.needHelpers=new Set,t.needRoot=!1,t.hookIndex=0,t.flowEvents=new Set(t.opts.flowEvents??C),t.rootVars=new Set,t.opts.production??process.env.NODE_ENV==="production"){t.fileIgnored=!0;return}(n.node.body[0]?.leadingComments??n.node.directives.flatMap(r=>r.leadingComments??[])??[]).some(r=>r.value.includes("@lensmcp-ignore"))&&(t.fileIgnored=!0);const i=t.file?.opts?.filename;i&&(t.relativePath=displaySourcePath(i,t.opts.rootDir??process.cwd()))},exit(n,t){if(t.fileIgnored)return;const i=[...t.needHelpers??[]];if(t.needRoot&&i.push("LensmcpRoot","installFlowFetch"),i.length===0)return;const r=x(n.node.body,h,e),l=i.filter(s=>!r.has(s));if(l.length>0&&n.node.body.unshift(e.importDeclaration(l.map(s=>e.importSpecifier(e.identifier(s),e.identifier(s))),e.stringLiteral(h))),t.needRoot){const s=n.node.body.findIndex(c=>!e.isImportDeclaration(c)),p=e.expressionStatement(e.callExpression(e.identifier("installFlowFetch"),[]));n.node.body.splice(s<0?n.node.body.length:s,0,p)}}},VariableDeclarator(n,t){t.fileIgnored||t.opts.autoWrapRoot!==!1&&e.isIdentifier(n.node.id)&&n.node.init&&f(n.node.init,e)&&t.rootVars.add(n.node.id.name)},CallExpression(n,t){if(t.fileIgnored)return;const i=n.node.callee;if(t.opts.autoWrapHooks!==!1&&e.isIdentifier(i)&&b[i.name]){const r=b[i.name],l=`${t.relativePath??"(anon)"}:${n.node.loc?.start.line??0}:${t.hookIndex++}`;n.node.callee=e.identifier(r),n.node.arguments.unshift(e.stringLiteral(l)),t.needHelpers.add(r);return}if(t.opts.autoWrapRoot!==!1&&e.isMemberExpression(i)&&e.isIdentifier(i.property,{name:"render"})&&(f(i.object,e)||e.isIdentifier(i.object)&&t.rootVars?.has(i.object.name))&&n.node.arguments.length>=1){const r=n.node.arguments[0];r&&!I(r,e)&&(n.node.arguments[0]=e.jsxElement(e.jsxOpeningElement(e.jsxIdentifier("LensmcpRoot"),[],!1),e.jsxClosingElement(e.jsxIdentifier("LensmcpRoot")),[e.jsxExpressionContainer(r)],!1),t.needRoot=!0)}},JSXOpeningElement(n,t){if(t.fileIgnored)return;const i=n.node.attributes;if(m(i,"data-agent-component")||m(i,"data-lensmcp-ignore")||(n.parent.leadingComments??n.node.leadingComments??[]).some(s=>s.value.includes("@lensmcp-ignore")))return;if(t.opts.autoFlowHandlers!==!1){const s=n.node.loc?.start.line??0,p=t.relativePath??"(anon)";for(const c of n.node.attributes){if(c.type!=="JSXAttribute"||c.name.type!=="JSXIdentifier"||!t.flowEvents.has(c.name.name)||!c.value||c.value.type!=="JSXExpressionContainer")continue;const u=c.value.expression;if(u.type==="JSXEmptyExpression"||y(u,e))continue;const g=c.name.name;c.value.expression=e.callExpression(e.identifier("withFlow"),[u,e.objectExpression([e.objectProperty(e.identifier("originType"),e.stringLiteral(R[g]??"user-click")),e.objectProperty(e.identifier("originNodeId"),e.stringLiteral(`ui:${p}:${s}:${g}`))])]),t.needHelpers.add("withFlow")}}const r=E(n.node.name);if(!r||S(r))return;const l=[e.jsxAttribute(e.jsxIdentifier("data-agent-component"),e.stringLiteral(r))];if(t.opts.includeSource!==!1){const s=n.node.loc?.start.line??0,p=t.relativePath??"(anon)";l.push(e.jsxAttribute(e.jsxIdentifier("data-agent-source"),e.stringLiteral(`${p}:${s}`)))}n.node.attributes.push(...l)}}}}a(w,"y"),d(w,"lensmcpBabelPlugin");function m(o,e){return o.some(n=>n.type==="JSXAttribute"&&n.name.type==="JSXIdentifier"&&n.name.name===e)}a(m,"S"),d(m,"hasAttr");function x(o,e,n){const t=new Set;for(const i of o)if(n.isImportDeclaration(i)&&i.source.value===e)for(const r of i.specifiers)n.isImportSpecifier(r)&&n.isIdentifier(r.imported)&&t.add(r.imported.name);return t}a(x,"h"),d(x,"collectImported");function f(o,e){if(!e.isCallExpression(o))return!1;const n=o.callee,t=new Set(["createRoot","hydrateRoot"]);return e.isIdentifier(n)?t.has(n.name):e.isMemberExpression(n)&&e.isIdentifier(n.property)?t.has(n.property.name):!1}a(f,"b"),d(f,"isRootFactoryCall");function y(o,e){return e.isCallExpression(o)&&e.isIdentifier(o.callee,{name:"withFlow"})}a(y,"C"),d(y,"isAlreadyWithFlow");function I(o,e){return e.isJSXElement(o)&&e.isJSXIdentifier(o.openingElement.name,{name:"LensmcpRoot"})}a(I,"j"),d(I,"isAlreadyLensmcpRoot");const J=new Set(["Fragment","StrictMode","Suspense","SuspenseList","Profiler"]);function S(o){const e=o.split(".").pop()??o;return J.has(e)?!0:e.endsWith("Provider")||e.endsWith("Consumer")}a(S,"P"),d(S,"isUnstampableElement");function E(o){switch(o.type){case"JSXIdentifier":return o.name;case"JSXMemberExpression":{const e=[];let n=o;for(;n.type==="JSXMemberExpression";)e.unshift(n.property.name),n=n.object;return n.type==="JSXIdentifier"&&e.unshift(n.name),e.join(".")}case"JSXNamespacedName":return`${o.namespace.name}:${o.name.name}`;default:return}}a(E,"A"),d(E,"describeElementName");
1
+ "use strict";var C=Object.defineProperty;var a=(o,e)=>C(o,"name",{value:e,configurable:!0});var L=Object.defineProperty,l=a((o,e)=>L(o,"name",{value:e,configurable:!0}),"c");const $=4;export function displaySourcePath(o,e){const n=l(p=>p.replace(/\\/g,"/").replace(/\/+$/,"").split("/"),"segments"),t=n(o),i=n(e);let r=0;for(;r<t.length&&r<i.length&&t[r]===i[r];)r++;const c=i.length-r;if(r===0||c>4)return`<external>/${t[t.length-1]??"unknown"}`;const s=t.slice(r);return s.length===0?"<external>/unknown":[...new Array(c).fill(".."),...s].join("/")}a(displaySourcePath,"displaySourcePath"),l(displaySourcePath,"displaySourcePath");const y="@lensmcp/react-instrumentation",m={useEffect:"tracedUseEffect",useMemo:"tracedUseMemo",useCallback:"tracedUseCallback"};function f(o){return`useLensmcp_${o}`}a(f,"S"),l(f,"tracedHookLocalName");function g(o){return Object.values(m).includes(o)?f(o):o}a(g,"b"),l(g,"helperLocalName");const X=["onClick","onDoubleClick","onContextMenu","onSubmit","onChange"],J={onSubmit:"form-submit",onChange:"input-change"};export default function j(o){const e=o.types;return{name:"@lensmcp/react-instrumentation/babel-plugin",visitor:{Program:{enter(n,t){if(t.needHelpers=new Set,t.needRoot=!1,t.hookIndex=0,t.flowEvents=new Set(t.opts.flowEvents??X),t.rootVars=new Set,t.opts.production??process.env.NODE_ENV==="production"){t.fileIgnored=!0;return}(n.node.body[0]?.leadingComments??n.node.directives.flatMap(r=>r.leadingComments??[])??[]).some(r=>r.value.includes("@lensmcp-ignore"))&&(t.fileIgnored=!0);const i=t.file?.opts?.filename;i&&(t.relativePath=displaySourcePath(i,t.opts.rootDir??process.cwd()))},exit(n,t){if(t.fileIgnored)return;const i=[...t.needHelpers??[]];if(t.needRoot&&i.push("LensmcpRoot","installFlowFetch"),i.length===0)return;const r=I(n.node.body,y,e),c=i.filter(s=>r.get(g(s))!==s);if(c.length>0&&n.node.body.unshift(e.importDeclaration(c.map(s=>e.importSpecifier(e.identifier(g(s)),e.identifier(s))),e.stringLiteral(y))),t.needRoot){const s=n.node.body.findIndex(d=>!e.isImportDeclaration(d)),p=e.expressionStatement(e.callExpression(e.identifier("installFlowFetch"),[]));n.node.body.splice(s<0?n.node.body.length:s,0,p)}}},VariableDeclarator(n,t){t.fileIgnored||t.opts.autoWrapRoot!==!1&&e.isIdentifier(n.node.id)&&n.node.init&&b(n.node.init,e)&&t.rootVars.add(n.node.id.name)},CallExpression(n,t){if(t.fileIgnored)return;const i=n.node.callee;if(t.opts.autoWrapHooks!==!1&&e.isIdentifier(i)&&m[i.name]){const r=m[i.name],c=`${t.relativePath??"(anon)"}:${n.node.loc?.start.line??0}:${t.hookIndex++}`;n.node.callee=e.identifier(f(r)),n.node.arguments.unshift(e.stringLiteral(c)),t.needHelpers.add(r);return}if(t.opts.autoWrapRoot!==!1&&e.isMemberExpression(i)&&e.isIdentifier(i.property,{name:"render"})&&(b(i.object,e)||e.isIdentifier(i.object)&&t.rootVars?.has(i.object.name))&&n.node.arguments.length>=1){const r=n.node.arguments[0];r&&!E(r,e)&&(n.node.arguments[0]=e.jsxElement(e.jsxOpeningElement(e.jsxIdentifier("LensmcpRoot"),[],!1),e.jsxClosingElement(e.jsxIdentifier("LensmcpRoot")),[e.jsxExpressionContainer(r)],!1),t.needRoot=!0)}},JSXOpeningElement(n,t){if(t.fileIgnored)return;const i=n.node.attributes;if(h(i,"data-agent-component")||h(i,"data-lensmcp-ignore")||(n.parent.leadingComments??n.node.leadingComments??[]).some(s=>s.value.includes("@lensmcp-ignore")))return;if(t.opts.autoFlowHandlers!==!1){const s=n.node.loc?.start.line??0,p=t.relativePath??"(anon)";for(const d of n.node.attributes){if(d.type!=="JSXAttribute"||d.name.type!=="JSXIdentifier"||!t.flowEvents.has(d.name.name)||!d.value||d.value.type!=="JSXExpressionContainer")continue;const u=d.value.expression;if(u.type==="JSXEmptyExpression"||S(u,e))continue;const x=d.name.name;d.value.expression=e.callExpression(e.identifier("withFlow"),[u,e.objectExpression([e.objectProperty(e.identifier("originType"),e.stringLiteral(J[x]??"user-click")),e.objectProperty(e.identifier("originNodeId"),e.stringLiteral(`ui:${p}:${s}:${x}`))])]),t.needHelpers.add("withFlow")}}const r=v(n.node.name);if(!r||w(r))return;const c=[e.jsxAttribute(e.jsxIdentifier("data-agent-component"),e.stringLiteral(r))];if(t.opts.includeSource!==!1){const s=n.node.loc?.start.line??0,p=t.relativePath??"(anon)";c.push(e.jsxAttribute(e.jsxIdentifier("data-agent-source"),e.stringLiteral(`${p}:${s}`)))}n.node.attributes.push(...c)}}}}a(j,"h"),l(j,"lensmcpBabelPlugin");function h(o,e){return o.some(n=>n.type==="JSXAttribute"&&n.name.type==="JSXIdentifier"&&n.name.name===e)}a(h,"x"),l(h,"hasAttr");function I(o,e,n){const t=new Map;for(const i of o)if(n.isImportDeclaration(i)&&i.source.value===e)for(const r of i.specifiers)n.isImportSpecifier(r)&&n.isIdentifier(r.imported)&&t.set(r.local.name,r.imported.name);return t}a(I,"j"),l(I,"collectImported");function b(o,e){if(!e.isCallExpression(o))return!1;const n=o.callee,t=new Set(["createRoot","hydrateRoot"]);return e.isIdentifier(n)?t.has(n.name):e.isMemberExpression(n)&&e.isIdentifier(n.property)?t.has(n.property.name):!1}a(b,"I"),l(b,"isRootFactoryCall");function S(o,e){return e.isCallExpression(o)&&e.isIdentifier(o.callee,{name:"withFlow"})}a(S,"v"),l(S,"isAlreadyWithFlow");function E(o,e){return e.isJSXElement(o)&&e.isJSXIdentifier(o.openingElement.name,{name:"LensmcpRoot"})}a(E,"L"),l(E,"isAlreadyLensmcpRoot");const P=new Set(["Fragment","StrictMode","Suspense","SuspenseList","Profiler"]);function w(o){const e=o.split(".").pop()??o;return P.has(e)?!0:e.endsWith("Provider")||e.endsWith("Consumer")}a(w,"A"),l(w,"isUnstampableElement");function v(o){switch(o.type){case"JSXIdentifier":return o.name;case"JSXMemberExpression":{const e=[];let n=o;for(;n.type==="JSXMemberExpression";)e.unshift(n.property.name),n=n.object;return n.type==="JSXIdentifier"&&e.unshift(n.name),e.join(".")}case"JSXNamespacedName":return`${o.namespace.name}:${o.name.name}`;default:return}}a(v,"M"),l(v,"describeElementName");
package/lib/flow-fetch.js CHANGED
@@ -1 +1 @@
1
- "use strict";var v=Object.defineProperty;var c=(t,e)=>v(t,"name",{value:e,configurable:!0});var N=Object.defineProperty,l=c((t,e)=>N(t,"name",{value:e,configurable:!0}),"f");import{beginBackgroundFlow as H,extendFlowWindow as b,flowForNewActivity as P,publish as p}from"./publish.js";import{installRouteFlows as R}from"./route-flows.js";export function mayPropagateTo(t,e=[]){const d=typeof location<"u"?location.href:void 0;let f;try{f=new URL(t,d)}catch{return!1}if(typeof location<"u"&&f.origin===location.origin||I(f.hostname))return!0;for(const n of e){let r;try{r=new URL(n).origin}catch{continue}if(r===f.origin)return!0}return!1}c(mayPropagateTo,"mayPropagateTo"),l(mayPropagateTo,"mayPropagateTo");const S=new Set(["localhost","[::1]","::1"]);function I(t){const e=t.toLowerCase();return S.has(e)||/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(e)}c(I,"S"),l(I,"isLoopbackHost");function x(){const t=globalThis.__LENSMCP_FLOW_PROPAGATE__;return Array.isArray(t)?t.filter(e=>typeof e=="string"):typeof t=="string"?t.split(",").map(e=>e.trim()).filter(Boolean):[]}c(x,"N"),l(x,"globalPropagateList");function F(){return Date.now().toString(36)+Math.random().toString(36).slice(2,12)}c(F,"O"),l(F,"newRequestId");function w(t){return typeof t=="string"?t:t instanceof URL?t.href:t.url??String(t)}c(w,"$"),l(w,"urlOf");let L=!1;export function installFlowFetch(t={}){const e=globalThis;if(typeof e.fetch!="function")return()=>{};!L&&typeof location<"u"&&typeof document<"u"&&(L=!0,H({originType:"page-load",originNodeId:`page:${location.pathname}`}));const d=t.flowHeader??"x-lensmcp-flow-id",f=t.originHeader??"x-lensmcp-origin-node-id",n=t.requestHeader??"x-request-id",r=t.propagateTo??[],s=e.fetch.bind(globalThis);globalThis.__LENSMCP_FLOW_FETCH__=!0;const a=l(((i,o)=>{const g=P();if(!g?.flowId)return s(i,o);if(!mayPropagateTo(w(i),[...r,...x()])){const $=s(i,o);return y(g,i,o,$,void 0),$}const k=typeof i=="object"&&i!==null&&"headers"in i?i.headers:void 0,u=new Headers(o?.headers??k??void 0);u.has(d)||u.set(d,g.flowId),g.originNodeId&&!u.has(f)&&u.set(f,g.originNodeId);const m=u.get(n)??F();u.has(n)||u.set(n,m);const T=s(i,{...o,headers:u});return y(g,i,o,T,m),T}),"patched");e.fetch=a;const h=t.routeFlows===!1?()=>{}:R();return()=>{h(),e.fetch=s}}c(installFlowFetch,"installFlowFetch"),l(installFlowFetch,"installFlowFetch");function _(t){const e=typeof location<"u"?location.href:void 0;try{return new URL(t,e).href}catch{return}}c(_,"R"),l(_,"absoluteHref");function y(t,e,d,f,n){const r=w(e),s=_(r),a=d?.method??(typeof e=="object"&&e!==null&&"method"in e?e.method??"GET":"GET"),h=Date.now(),i={flowId:t.flowId,...t.originType?{originType:t.originType}:{},...t.originNodeId?{originNodeId:t.originNodeId}:{},...n?{requestId:n}:{}};p({source:"react",category:"network",severity:"info",title:`fetch ${a} ${r}`,fingerprint:`flow-fetch:${a}:${r}`,context:i,raw:{kind:"fetch-start",url:r,method:a,...s?{href:s}:{},...n?{requestId:n}:{}}}),f.then(o=>{b(t),p({source:"react",category:"network",severity:o.ok||o.status===304?"info":"error",title:`fetch ${a} ${r} \u2192 ${o.status}${o.statusText?` ${o.statusText}`:""}`,fingerprint:`flow-fetch:${a}:${r}:${o.status}`,context:i,raw:{kind:"fetch-done",url:r,...s?{href:s}:{},...n?{requestId:n}:{},method:a,status:o.status,statusText:o.statusText,ok:o.ok,startedAt:h,durationMs:Date.now()-h}})},o=>{b(t),p({source:"react",category:"network",severity:"error",title:`fetch ${a} ${r} failed`,message:o instanceof Error?o.message:String(o),fingerprint:`flow-fetch:${a}:${r}:error`,context:i,raw:{kind:"fetch-error",url:r,...s?{href:s}:{},...n?{requestId:n}:{},method:a,startedAt:h,durationMs:Date.now()-h}})})}c(y,"b"),l(y,"publishFetchLeg");
1
+ "use strict";var R=Object.defineProperty;var c=(t,e)=>R(t,"name",{value:e,configurable:!0});var A=Object.defineProperty,f=c((t,e)=>A(t,"name",{value:e,configurable:!0}),"s");import{beginBackgroundFlow as E,extendFlowWindow as I,flowForNewActivity as H,publish as p}from"./publish.js";import{installRouteFlows as P}from"./route-flows.js";export function mayPropagateTo(t,e=[]){const d=typeof location<"u"?location.href:void 0;let l;try{l=new URL(t,d)}catch{return!1}if(typeof location<"u"&&l.origin===location.origin||x(l.hostname))return!0;for(const i of e){let r;try{r=new URL(i).origin}catch{continue}if(r===l.origin)return!0}return!1}c(mayPropagateTo,"mayPropagateTo"),f(mayPropagateTo,"mayPropagateTo");const q=new Set(["localhost","[::1]","::1"]);function x(t){const e=t.toLowerCase();return q.has(e)||/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(e)}c(x,"O"),f(x,"isLoopbackHost");function F(){const t=globalThis.__LENSMCP_FLOW_PROPAGATE__;return Array.isArray(t)?t.filter(e=>typeof e=="string"):typeof t=="string"?t.split(",").map(e=>e.trim()).filter(Boolean):[]}c(F,"N"),f(F,"globalPropagateList");function k(){return Date.now().toString(36)+Math.random().toString(36).slice(2,12)}c(k,"A"),f(k,"newRequestId");function w(t){return typeof t=="string"?t:t instanceof URL?t.href:t.url??String(t)}c(w,"p"),f(w,"urlOf");const L=Symbol.for("lensmcp.flow-fetch"),_=Symbol.for("lensmcp.flow-fetch.recorded-leg");function y(t){return{...t,[_]:!0}}c(y,"L"),f(y,"markRecorded");let v=!1;export function installFlowFetch(t={}){const e=globalThis;if(typeof e.fetch!="function")return()=>{};if(e.fetch[L])return()=>{};!v&&typeof location<"u"&&typeof document<"u"&&(v=!0,E({originType:"page-load",originNodeId:`page:${location.pathname}`}));const d=t.flowHeader??"x-lensmcp-flow-id",l=t.originHeader??"x-lensmcp-origin-node-id",i=t.requestHeader??"x-request-id",r=t.propagateTo??[],s=e.fetch.bind(globalThis);globalThis.__LENSMCP_FLOW_FETCH__=!0;const a=f(((n,o)=>{if(o?.[_])return s(n,o);const g=H();if(!g?.flowId)return s(n,o);if(!mayPropagateTo(w(n),[...r,...F()])){const b=s(n,y(o));return m(g,n,o,b,void 0),b}const S=typeof n=="object"&&n!==null&&"headers"in n?n.headers:void 0,u=new Headers(o?.headers??S??void 0);u.has(d)||u.set(d,g.flowId),g.originNodeId&&!u.has(l)&&u.set(l,g.originNodeId);const T=u.get(i)??k();u.has(i)||u.set(i,T);const $=s(n,{...y(o),headers:u});return m(g,n,o,$,T),$}),"patched");a[L]=!0,e.fetch=a;const h=t.routeFlows===!1?()=>{}:P();return()=>{h(),e.fetch=s}}c(installFlowFetch,"installFlowFetch"),f(installFlowFetch,"installFlowFetch");function N(t){const e=typeof location<"u"?location.href:void 0;try{return new URL(t,e).href}catch{return}}c(N,"C"),f(N,"absoluteHref");function m(t,e,d,l,i){const r=w(e),s=N(r),a=d?.method??(typeof e=="object"&&e!==null&&"method"in e?e.method??"GET":"GET"),h=Date.now(),n={flowId:t.flowId,...t.originType?{originType:t.originType}:{},...t.originNodeId?{originNodeId:t.originNodeId}:{},...i?{requestId:i}:{}};p({source:"react",category:"network",severity:"info",title:`fetch ${a} ${r}`,fingerprint:`flow-fetch:${a}:${r}`,context:n,raw:{kind:"fetch-start",url:r,method:a,...s?{href:s}:{},...i?{requestId:i}:{}}}),l.then(o=>{I(t),p({source:"react",category:"network",severity:o.ok||o.status===304?"info":"error",title:`fetch ${a} ${r} \u2192 ${o.status}${o.statusText?` ${o.statusText}`:""}`,fingerprint:`flow-fetch:${a}:${r}:${o.status}`,context:n,raw:{kind:"fetch-done",url:r,...s?{href:s}:{},...i?{requestId:i}:{},method:a,status:o.status,statusText:o.statusText,ok:o.ok,startedAt:h,durationMs:Date.now()-h}})},o=>{I(t),p({source:"react",category:"network",severity:"error",title:`fetch ${a} ${r} failed`,message:o instanceof Error?o.message:String(o),fingerprint:`flow-fetch:${a}:${r}:error`,context:n,raw:{kind:"fetch-error",url:r,...s?{href:s}:{},...i?{requestId:i}:{},method:a,startedAt:h,durationMs:Date.now()-h}})})}c(m,"x"),f(m,"publishFetchLeg");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lensmcp/react-instrumentation",
3
- "version": "1.23.12",
3
+ "version": "1.24.0",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "module": "./index.js",
@@ -19,7 +19,7 @@
19
19
  }
20
20
  },
21
21
  "dependencies": {
22
- "@lensmcp/protocol-types": "1.23.12",
22
+ "@lensmcp/protocol-types": "1.24.0",
23
23
  "tslib": "^2.3.0"
24
24
  },
25
25
  "peerDependencies": {