@lensmcp/core 1.22.6 → 1.23.1

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.
@@ -26,6 +26,10 @@ export declare function trimFlowEvent(event: BaseEvent, opts?: FlowShapeOptions)
26
26
  fetchStartedAt?: number | undefined;
27
27
  durationMs?: number | undefined;
28
28
  project?: string | undefined;
29
+ renderTotal?: number | undefined;
30
+ renderPublished?: number | undefined;
31
+ cleanup?: boolean | undefined;
32
+ hook?: string | undefined;
29
33
  why?: string[] | undefined;
30
34
  phase?: string | undefined;
31
35
  component?: string | undefined;
@@ -59,6 +63,10 @@ export declare function buildFlowDetail(rawEvents: BaseEvent[], opts?: FlowShape
59
63
  fetchStartedAt?: number | undefined;
60
64
  durationMs?: number | undefined;
61
65
  project?: string | undefined;
66
+ renderTotal?: number | undefined;
67
+ renderPublished?: number | undefined;
68
+ cleanup?: boolean | undefined;
69
+ hook?: string | undefined;
62
70
  why?: string[] | undefined;
63
71
  phase?: string | undefined;
64
72
  component?: string | undefined;
package/lib/flow-shape.js CHANGED
@@ -1 +1 @@
1
- "use strict";var Z=Object.defineProperty;var x=(a,m)=>Z(a,"name",{value:m,configurable:!0});var _=Object.defineProperty,M=x((a,m)=>_(a,"name",{value:m,configurable:!0}),"k");import{redactDeep as tt,redactText as J}from"./redact.js";import{boundedClone as et}from"@lensmcp/protocol-types";export function areaOf(a){const{source:m,category:r,title:y,kind:c}=a;return m==="ai"?"ai":c?.startsWith("memory")||c==="db-query"?"data":m==="gateway"||c==="gateway-request"?"gateway":c==="queue-process"||c==="queue-active"||c==="queue-completed"||c==="queue-failed"?"services":m==="db"||m==="redis"||m==="queue"||c==="redis-op"||c?.startsWith("queue-")?"data":m==="external"||c==="egress"?"network":m==="nestjs"||m==="nest"?/(?:Repository|Repo|Dao|Store)\./.test(y)?"data":"services":m==="valtio"?"state":r==="network"?"network":"browser"}x(areaOf,"areaOf"),M(areaOf,"areaOf");const U=240,rt=new Set(["systemPrompt","prompt","prompts","messages","completion","completions","input","output","draft","text","content","result","arguments","params"]),st=new Set(["tenantId","caller","userId","accountId","email","subject"]),nt=8;function H(a){const m=z(a,0);return et(tt({redacted:!0,...m}),{rawByteLimit:16*1024}).value}x(H,"tt"),M(H,"aiProjection");function z(a,m){if(typeof a=="string")return Q(a);if(a===null||typeof a!="object")return a;if(m>=nt)return;if(Array.isArray(a))return a.slice(0,32).map(y=>z(y,m+1));const r={};for(const[y,c]of Object.entries(a))if(!st.has(y)){if(rt.has(y)){typeof c=="string"?r[`${y}Chars`]=c.length:Array.isArray(c)?r[`${y}Count`]=c.length:c!=null&&(r[`${y}Present`]=!0);continue}r[y]=z(c,m+1)}return r}x(z,"W"),M(z,"projectAi");function Q(a){return a.length<=U?J(a):`${J(a.slice(0,U))}\u2026`}x(Q,"et"),M(Q,"clipText");export function trimFlowEvent(a,m={}){const r=a.raw??{},y=r.render??{},c=r.span??{},C=r.request??{},l=M(o=>typeof o=="number"?o:void 0,"num"),I=r.loop??{},B=l(r.durationMs)??l(c.durationMs)??l(C.durationMs)??l(I.durationMs)??l(y.actualDurationMs),p=typeof r.kind=="string"?r.kind:void 0,L=p==="fetch-done"||p==="fetch-error",G=L?a.timestamp:l(r.startedAt)??l(c.startTime)??l(C.startedAt)??l(I.startedAt)??(B!==void 0?a.timestamp-B:a.timestamp);let w;if(typeof r.query=="string"){const o=Array.isArray(r.params)?` [${r.params.join(", ")}]`:"",g=typeof r.result=="string"?` \u2192 ${r.result}`:"";w=r.query+o+g}else if(typeof r.command=="string"){const o=typeof r.value=="string"?` \u2192 ${r.value}`:r.hit===!1?" \u2192 (miss)":"";w=r.command+o}else if(p==="state-update"){const o=r.update??{};let g="";try{g=JSON.stringify(o.preview)}catch{}w=`${o.storeId??""}.${o.path??""} = ${g}`}else p==="queue-completed"&&typeof r.returned=="string"?w=`returned ${r.returned}`:p==="queue-enqueued"&&(w=`${r.job??"job"}#${r.jobId??"?"} \u2192 ${r.queue??""}${typeof r.data=="string"?" "+r.data:""}`);let S;if(p==="gateway-request")S=`${r.host??""}${String(r.url??"").split("?")[0]}`;else if(p==="fetch-start"||p==="fetch-done"||p==="fetch-error")try{const o=new URL(String(r.href??r.url??""));S=`${o.hostname}${o.pathname}`}catch{}let D;if(p==="gateway-request"&&Array.isArray(r.steps))D=r.steps.map(o=>{const g=[String(o.step)];return o.project&&g.push(String(o.project)),o.prefix&&g.push(String(o.prefix)),o.mode&&g.push(String(o.mode)+(o.ok===!1?" \u2717":o.ok===!0?" \u2713":"")),o.caller&&g.push("by "+String(o.caller)),o.pod&&g.push(String(o.pod)),typeof o.atMs=="number"&&g.push(`@${o.atMs}ms`),g.join(" ")}),w=D.map(o=>o.replace(/ @\d+ms$/,"")).join(" \u2192 ");else if(p==="egress")w=`${r.method??"GET"} ${r.host??""} \u2192 ${r.status??"?"}`;else if(a.source==="ai"){if(p==="ai-round"){const o=r.model??{},g=r.usage??{},v=Array.isArray(r.toolCalls)?r.toolCalls:[],F=`${l(g.promptTokens)??"?"}\u2192${l(g.completionTokens)??"?"} tok`,W=v.length?` \xB7 ${v.length} tool call${v.length===1?"":"s"}`:"",t=l(r.durationMs)!==void 0?` \xB7 ${(l(r.durationMs)/1e3).toFixed(1)}s`:"";w=`${o.provider??""}/${o.model??""} \xB7 ${F}${W}${t}`}else if(p==="ai-turn-start"){const o=Array.isArray(r.tools)?r.tools:[];w=`skill ${r.skill??""} \xB7 ${r.output??""}${o.length?" \xB7 tools: "+o.join(", "):""}`}else if(p==="ai-tool-call"){const o=r.call??{},g=r.result??{},v=l(r.durationMs)!==void 0?` \xB7 ${(l(r.durationMs)/1e3).toFixed(1)}s`:"";w=`${o.name??"tool"} ${g.error!=null?"\u2717 "+String(g.error):"\u2713"}${v}`}else if(p==="ai-turn-end"){const o=r.usage??{},g=l(r.rounds)!==void 0?` \xB7 ${l(r.rounds)} round${l(r.rounds)===1?"":"s"}`:"",v=l(r.durationMs)!==void 0?` \xB7 ${(l(r.durationMs)/1e3).toFixed(1)}s`:"";w=`${r.ok===!1?"FAILED":"ok"} \xB7 ${l(o.promptTokens)??"?"}+${l(o.completionTokens)??"?"} tok${g}${v}`}}let j;p==="db-query"&&typeof r.query=="string"?j=r.query:p==="redis-op"?j=`${r.op??""} ${String(r.key??"").replace(/\d+/g,"#")}`:p==="egress"?j=`${r.method??"GET"} ${r.host??""}`:p==="queue-enqueued"?j=`enqueue ${r.queue??""}`:p==="span"&&typeof c.name=="string"&&(j=c.name);const b=a.context??{},O=r.effect??{},P=y.commitId??O.commitId??r.commitId,K=Array.isArray(y.why)?y.why.map(o=>typeof o?.type=="string"?o.type:void 0).filter(o=>!!o):[];return{id:a.id,t:a.timestamp,start:G,...j?{sig:j}:{},...S?{urlKey:S}:{},...typeof r.queue=="string"?{queue:r.queue}:{},...r.jobId!=null?{jobId:String(r.jobId)}:{},source:a.source,category:a.category,severity:a.severity,title:a.title,kind:p,area:areaOf({source:a.source,category:a.category,title:a.title,kind:p}),...typeof c.role=="string"?{role:c.role}:{},...typeof b.requestId=="string"?{requestId:b.requestId}:{},...typeof b.parentRequestId=="string"?{parentRequestId:b.parentRequestId}:{},...typeof P=="string"?{commitId:P}:{},...typeof y.componentName=="string"?{component:y.componentName}:{},...typeof y.phase=="string"?{phase:y.phase}:{},...K.length?{why:K}:{},...typeof b.projectName=="string"?{project:b.projectName}:typeof r.project=="string"?{project:r.project}:{},...B!==void 0?{durationMs:B}:{},...L&&l(r.startedAt)!==void 0?{fetchStartedAt:l(r.startedAt)}:{},...a.source==="ai"?{ai:m.includeRaw?r:H(r)}:{},...w?{detail:w}:{},...D?{steps:D}:{}}}x(trimFlowEvent,"trimFlowEvent"),M(trimFlowEvent,"trimFlowEvent");const V=1;function X(a){return a==="flow-origin"?0:a?.endsWith("-start")?1:a==="gateway-request"?2:a==="server-request"?3:a==="span"?4:5}x(X,"nt"),M(X,"kindRank");function N(a){return a.kind==="span"&&a.role==="controller"?3.5:a.kind==="queue-process"?3:X(a.kind)}x(N,"O"),M(N,"causalRank");export function buildFlowDetail(a,m={}){const r=a.slice().filter(t=>{const s=t.raw??{},n=typeof s.kind=="string"?s.kind:"";if(n==="subscription-added"||n==="subscription-removed"||n==="hook-run"||n==="store-created"||n==="singleton-instance")return!1;const e=s.span;return!(typeof e?.name=="string"&&e.name.startsWith("nest.request "))}).map(t=>trimFlowEvent(t,m)),y=new Set;for(let t=r.length-1;t>=0;t--)y.has(r[t].id)?r.splice(t,1):y.add(r[t].id);const c=new Map;for(const t of r)(t.kind==="gateway-request"||t.kind==="queue-process")&&t.requestId&&!c.has(t.requestId)&&c.set(t.requestId,t.start);const C=M(t=>t.source!=="react"&&t.source!=="valtio"&&t.requestId&&c.has(t.requestId)?c.get(t.requestId):t.start,"anchorOf");r.sort((t,s)=>C(t)-C(s)||t.start-s.start||N(t)-N(s)||(s.durationMs??0)-(t.durationMs??0)||t.t-s.t);const l=M(t=>(t.kind==="span"||t.kind==="server-request"||t.kind==="gateway-request"||t.kind==="queue-process")&&(t.durationMs??0)>0,"spanLike"),I=r;for(const t of I)t.group=t.source==="react"||t.source==="valtio"||t.source==="client-runtime"||t.source==="visual"?"browser":"server";const B=new Map;for(const t of I)(t.kind==="gateway-request"||t.kind==="queue-process")&&t.requestId&&t.project&&B.set(t.requestId,t.project);for(const t of I)if(!t.project&&t.source==="nestjs"&&t.requestId){const s=B.get(t.requestId);s&&(t.project=s)}for(const t of I){let s;const n=t.requestId;for(const e of I){if(e===t||!l(e)||e.group!==t.group||e.requestId!==n)continue;const i=e.project,d=t.project;if(e.kind!=="gateway-request"&&t.kind!=="gateway-request"&&i!==void 0&&d!==void 0&&i!==d)continue;const q=e.durationMs??0,h=t.durationMs??0,$=Math.abs(e.start-t.start)<=V,u=N(e),k=N(t),T=e.start<=t.start;if(!(e.start+q>t.start&&(T||$&&u<k)&&(!$||(u!==k?u<k:T&&q>h))))continue;const R=s?N(s):-1,A=s?Math.abs(e.start-s.start)<=V:!1;(!s||!A&&e.start>s.start||A&&u>R||A&&u===R&&(e.durationMs??0)<(s.durationMs??0))&&(s=e)}s&&(t.parent=s.id)}const p=new Map;for(const t of I){if(!t.requestId)continue;const s=p.get(t.requestId);s?s.push(t):p.set(t.requestId,[t])}const L=new Map(I.map(t=>[t.id,t])),G=M((t,s)=>{const n=(p.get(t)??[]).filter(e=>l(e)&&e.start<=s&&e.start+(e.durationMs??0)>=s);if(n.length!==0)return n.sort((e,i)=>i.start-e.start||(e.durationMs??0)-(i.durationMs??0)),n[0]},"callerNodeFor");for(const t of I){if(!t.parentRequestId||t.kind!=="server-request"&&t.kind!=="gateway-request")continue;const s=t.parent?L.get(t.parent):void 0;if(s&&s.requestId===t.requestId)continue;const n=G(t.parentRequestId,t.start);n&&n!==t&&n.start<=t.start&&(t.parent=n.id)}const w=I,S=new Map;for(const t of w)t.kind==="gateway-request"&&t.requestId&&!S.has(t.requestId)&&S.set(t.requestId,t);for(const t of w)if(t.group==="server"&&!t.parent&&t.requestId&&t.kind!=="gateway-request"){const s=S.get(t.requestId);s&&s!==t&&s.start<=t.start&&(t.parent=s.id)}const D=new Set,j=new Set,b=[];for(const t of w){if(t.kind!=="gateway-request")continue;if(!t.requestId){b.push(t);continue}const s=p.get(t.requestId)??[];if(s.filter(i=>i.kind==="gateway-request").sort((i,d)=>i.start-d.start)[0]!==t)continue;const n=s.find(i=>i.kind==="fetch-start"),e=s.find(i=>i.kind==="fetch-done"||i.kind==="fetch-error");if(!n&&!e){b.push(t);continue}n&&(t.fetchStartId=n.id,D.add(n.id)),e&&(t.fetchDoneId=e.id,j.add(e.id))}const O=new Map;for(const t of w){if(!t.urlKey)continue;const s=O.get(t.urlKey)??{gws:[],starts:[],dones:[]};t.kind==="gateway-request"?b.includes(t)&&s.gws.push(t):t.kind==="fetch-start"?D.has(t.id)||s.starts.push(t):(t.kind==="fetch-done"||t.kind==="fetch-error")&&(j.has(t.id)||s.dones.push(t)),O.set(t.urlKey,s)}for(const{gws:t,starts:s,dones:n}of O.values()){t.sort((i,d)=>i.start-d.start),s.sort((i,d)=>i.start-d.start);const e=new Set;t.forEach((i,d)=>{const q=s[d];q&&(i.fetchStartId=q.id);const h=q?q.t:i.start;let $,u=1/0;for(const k of n){if(e.has(k.id))continue;const T=k.fetchStartedAt??k.start-(k.durationMs??0),R=Math.abs(T-h);R<u&&(u=R,$=k)}$&&(i.fetchDoneId=$.id,e.add($.id))})}const P=new Map,K=new Map;for(const t of w)!t.queue||!t.jobId||(t.kind==="queue-enqueued"&&P.set(`${t.queue}#${t.jobId}`,t),t.kind==="queue-process"&&K.set(`${t.queue}#${t.jobId}`,t));for(const t of w){if(!t.queue||!t.jobId)continue;const s=`${t.queue}#${t.jobId}`;if(t.kind==="queue-process"&&!t.parent){const n=P.get(s);n&&n!==t&&n.start<=t.start&&(t.parent=n.id)}else if(t.kind==="queue-active"||t.kind==="queue-completed"||t.kind==="queue-failed"){const n=K.get(s);n&&n!==t&&n.start<=t.start&&(t.parent=n.id)}}let o=I;{const t=new Map;for(const n of o)n.kind==="fetch-start"&&t.set(n.id,n);const s=new Map;for(const n of o){if(n.kind!=="fetch-done"&&n.kind!=="fetch-error")continue;const e=[...t.values()].find(q=>q.requestId&&q.requestId===n.requestId)?.id,i=e?t.get(e):void 0;if(!i)continue;const d=n.fetchStartedAt??i.start;i.title=n.title,i.severity=n.severity,i.durationMs=n.durationMs??Math.max(0,n.t-d),i.kind="fetch",n.detail&&!i.detail&&(i.detail=n.detail),s.set(n.id,i.id)}if(s.size>0){o=o.filter(n=>!s.has(n.id));for(const n of o)for(n.fetchDoneId&&s.has(n.fetchDoneId)&&(n.fetchDoneId=s.get(n.fetchDoneId));n.parent&&s.has(n.parent);)n.parent=s.get(n.parent)}}const g=M(t=>!!t.commitId&&(t.kind==="render"||t.kind==="effect-run"),"commitMember"),v=[],F=new Map;for(let t=0;t<o.length;){const s=o[t];if(!g(s)){v.push(s),t+=1;continue}let n=t+1;for(;n<o.length;){const f=o[n];if(!g(f)||f.commitId!==s.commitId)break;n+=1}const e=o.slice(t,n);if(t=n,e.length<2){v.push(...e);continue}const i=e.filter(f=>f.kind==="render"),d=e.filter(f=>f.kind==="effect-run"),q=i.filter(f=>!(f.why??[]).includes("parent-render")),h=[...new Set(q.flatMap(f=>f.why??[]))],$=[...new Set(q.map(f=>f.component).filter(Boolean))],u=[...new Set(i.map(f=>f.component).filter(Boolean))],k=Math.min(...e.map(f=>f.start)),T=Math.max(...e.map(f=>f.start+(f.durationMs??0))),R=$.length===1?$[0]:$.length>1?`${$.length} roots`:u[0]??"view",A=h.length===1?h[0]:h.length>1?h.join(" + "):void 0,Y=i.some(f=>f.phase==="mount"),E={...s,kind:"view-update",title:`view update \xB7 ${R}${A?` \u2190 ${A}`:""}`,start:k,durationMs:T-k,commitId:s.commitId,cause:A,components:u,effects:d.length,memberIds:e.map(f=>f.id),sig:`commit:${A??"-"}:${$.join(",")}:${u.slice().sort().join(",")}`,detail:[`${u.length} component${u.length===1?"":"s"}${Y?" (mount)":""}`,d.length?`${d.length} effect${d.length===1?"":"s"}`:"",u.join(", ")].filter(Boolean).join(" \xB7 "),severity:e.some(f=>f.severity==="error")?"error":s.severity};delete E.component,delete E.why,delete E.phase;for(const f of e)f.id!==E.id&&F.set(f.id,E.id);v.push(E)}if(F.size>0){o=v;for(const t of o)for(;t.parent&&F.has(t.parent);)t.parent=F.get(t.parent)}for(let t=1;t<o.length;t++){const s=o[t-1],n=o[t];n.kind!=="view-update"||s.kind!=="view-update"||n.sig&&n.sig===s.sig&&(s.redundant=!0,n.redundant=!0)}{const t=new Map(o.map(s=>[s.id,s]));for(const s of o){const n=new Set([s.id]);let e=s;for(;e?.parent;){if(n.has(e.parent)){e.parent=void 0;break}n.add(e.parent),e=t.get(e.parent)}}}const W=M(t=>{const s=new Map;for(const e of o){if(!e.sig||l(e)!==t||e.kind==="server-request"||e.kind==="gateway-request")continue;const i=`${e.parent??"root"}|${e.kind}|${e.sig}`,d=s.get(i);d?d.push(e):s.set(i,[e])}const n=new Map;for(const e of s.values()){if(e.length<3)continue;e.sort((u,k)=>u.start-k.start);const i=e[0];let d=!1;for(let u=0;u+1<e.length;u++)if(e[u+1].start<e[u].start+(e[u].durationMs??0)){d=!0;break}const q=i.start,h=Math.max(...e.map(u=>u.start+(u.durationMs??0))),$=e.reduce((u,k)=>u+(k.durationMs??0),0);if(i.count=e.length,i.parallel=d,i.avgMs=Math.round($/e.length*10)/10,i.wallMs=h-q,i.durationMs=h-q,i.title=`\xD7${e.length} ${i.title.replace(/\s*\((?:\d+ rows?, )?\d+ms\)$/,"")}`,i.kind==="view-update"){const u=i.redundant===!0;i.detail=[`${e.length} commits \xB7 avg ${i.avgMs}ms \xB7 wall ${i.wallMs}ms`,u?`no state change between them \u2014 ${e.length-1} of these had nothing new to render`:"one per update \u2014 expected for this many changes",i.components?.join(", ")??""].filter(Boolean).join(" \xB7 ")}else i.detail=`${i.sig} \xD7${e.length} ${d?"\u2016 parallel":"\u21BB sequential loop"} \xB7 avg ${i.avgMs}ms \xB7 wall ${i.wallMs}ms`;i.items=e.slice(0,12).map(u=>({start:u.start-q,...u.durationMs!=null?{durationMs:u.durationMs}:{}})),i.memberIds=e.flatMap(u=>u.memberIds??[u.id]),e.some(u=>u.severity==="error")&&(i.severity="error");for(const u of e.slice(1))n.set(u.id,i.id)}if(n.size!==0){o=o.filter(e=>!n.has(e.id));for(const e of o)for(;e.parent&&n.has(e.parent);)e.parent=n.get(e.parent)}},"aggregatePass");W(!0),W(!1);for(const t of o){if(!l(t))continue;const s=t.durationMs??0;if(s<40)continue;const n=o.filter(h=>h.parent===t.id&&(h.durationMs??0)>0).map(h=>[h.start,h.start+(h.durationMs??0)]).sort((h,$)=>h[0]-$[0]);let e=0,i=-1,d=-1;for(const[h,$]of n)h>d?(d>i&&(e+=d-i),i=h,d=$):$>d&&(d=$);d>i&&(e+=d-i);const q=Math.max(0,s-e);(q>=50||q/s>=.7&&s>=40)&&(t.selfMs=q,t.detail=`\u26A0 cpu-heavy: ${q}ms self-time of ${s}ms${t.detail?" \xB7 "+t.detail:""}`)}return{events:o}}x(buildFlowDetail,"buildFlowDetail"),M(buildFlowDetail,"buildFlowDetail");
1
+ "use strict";var ge=Object.defineProperty;var B=(d,w)=>ge(d,"name",{value:w,configurable:!0});var $e=Object.defineProperty,g=B((d,w)=>$e(d,"name",{value:w,configurable:!0}),"h");import{redactDeep as ye,redactText as de}from"./redact.js";import{boundedClone as ke}from"@lensmcp/protocol-types";export function areaOf(d){const{source:w,category:o,title:M,kind:y}=d;return w==="ai"?"ai":y?.startsWith("memory")||y==="db-query"?"data":w==="gateway"||y==="gateway-request"?"gateway":y==="queue-process"||y==="queue-active"||y==="queue-completed"||y==="queue-failed"?"services":w==="db"||w==="redis"||w==="queue"||y==="redis-op"||y?.startsWith("queue-")?"data":w==="external"||y==="egress"?"network":w==="nestjs"||w==="nest"?/(?:Repository|Repo|Dao|Store)\./.test(M)?"data":"services":w==="valtio"?"state":o==="network"?"network":"browser"}B(areaOf,"areaOf"),g(areaOf,"areaOf");const ue=240,qe=new Set(["systemPrompt","prompt","prompts","messages","completion","completions","input","output","draft","text","content","result","arguments","params"]),we=new Set(["tenantId","caller","userId","accountId","email","subject"]),Me=8;function ce(d){const w=Q(d,0);return ke(ye({redacted:!0,...w}),{rawByteLimit:16*1024}).value}B(ce,"$t"),g(ce,"aiProjection");function Q(d,w){if(typeof d=="string")return fe(d);if(d===null||typeof d!="object")return d;if(w>=Me)return;if(Array.isArray(d))return d.slice(0,32).map(M=>Q(M,w+1));const o={};for(const[M,y]of Object.entries(d))if(!we.has(M)){if(qe.has(M)){typeof y=="string"?o[`${M}Chars`]=y.length:Array.isArray(y)?o[`${M}Count`]=y.length:y!=null&&(o[`${M}Present`]=!0);continue}o[M]=Q(y,w+1)}return o}B(Q,"tt"),g(Q,"projectAi");function fe(d){return d.length<=ue?de(d):`${de(d.slice(0,ue))}\u2026`}B(fe,"wt"),g(fe,"clipText");export function trimFlowEvent(d,w={}){const o=d.raw??{},M=o.render??{},y=o.span??{},E=o.request??{},p=g(c=>typeof c=="number"?c:void 0,"num"),x=o.loop??{},D=o.effect??{},O=p(o.durationMs)??p(y.durationMs)??p(E.durationMs)??p(x.durationMs)??p(M.actualDurationMs)??p(D.durationMs),m=typeof o.kind=="string"?o.kind:void 0,U=m==="fetch-done"||m==="fetch-error",z=p(M.commitTime),T=m==="render"&&z!==void 0&&Math.abs(z-d.timestamp)<6e4,K=U?d.timestamp:T?z:p(o.startedAt)??p(y.startTime)??p(E.startedAt)??p(x.startedAt)??(O!==void 0?d.timestamp-O:d.timestamp);let b;if(typeof o.query=="string"){const c=Array.isArray(o.params)?` [${o.params.join(", ")}]`:"",q=typeof o.result=="string"?` \u2192 ${o.result}`:"";b=o.query+c+q}else if(typeof o.command=="string"){const c=typeof o.value=="string"?` \u2192 ${o.value}`:o.hit===!1?" \u2192 (miss)":"";b=o.command+c}else if(m==="state-update"){const c=o.update??{};let q="";try{q=JSON.stringify(c.preview)}catch{}b=`${c.storeId??""}.${c.path??""} = ${q}`}else m==="queue-completed"&&typeof o.returned=="string"?b=`returned ${o.returned}`:m==="queue-enqueued"&&(b=`${o.job??"job"}#${o.jobId??"?"} \u2192 ${o.queue??""}${typeof o.data=="string"?" "+o.data:""}`);let F;if(m==="gateway-request")F=`${o.host??""}${String(o.url??"").split("?")[0]}`;else if(m==="fetch-start"||m==="fetch-done"||m==="fetch-error")try{const c=new URL(String(o.href??o.url??""));F=`${c.hostname}${c.pathname}`}catch{}let P;if(m==="gateway-request"&&Array.isArray(o.steps))P=o.steps.map(c=>{const q=[String(c.step)];return c.project&&q.push(String(c.project)),c.prefix&&q.push(String(c.prefix)),c.mode&&q.push(String(c.mode)+(c.ok===!1?" \u2717":c.ok===!0?" \u2713":"")),c.caller&&q.push("by "+String(c.caller)),c.pod&&q.push(String(c.pod)),typeof c.atMs=="number"&&q.push(`@${c.atMs}ms`),q.join(" ")}),b=P.map(c=>c.replace(/ @\d+ms$/,"")).join(" \u2192 ");else if(m==="egress")b=`${o.method??"GET"} ${o.host??""} \u2192 ${o.status??"?"}`;else if(d.source==="ai"){if(m==="ai-round"){const c=o.model??{},q=o.usage??{},A=Array.isArray(o.toolCalls)?o.toolCalls:[],V=`${p(q.promptTokens)??"?"}\u2192${p(q.completionTokens)??"?"} tok`,H=A.length?` \xB7 ${A.length} tool call${A.length===1?"":"s"}`:"",X=p(o.durationMs)!==void 0?` \xB7 ${(p(o.durationMs)/1e3).toFixed(1)}s`:"";b=`${c.provider??""}/${c.model??""} \xB7 ${V}${H}${X}`}else if(m==="ai-turn-start"){const c=Array.isArray(o.tools)?o.tools:[];b=`skill ${o.skill??""} \xB7 ${o.output??""}${c.length?" \xB7 tools: "+c.join(", "):""}`}else if(m==="ai-tool-call"){const c=o.call??{},q=o.result??{},A=p(o.durationMs)!==void 0?` \xB7 ${(p(o.durationMs)/1e3).toFixed(1)}s`:"";b=`${c.name??"tool"} ${q.error!=null?"\u2717 "+String(q.error):"\u2713"}${A}`}else if(m==="ai-turn-end"){const c=o.usage??{},q=p(o.rounds)!==void 0?` \xB7 ${p(o.rounds)} round${p(o.rounds)===1?"":"s"}`:"",A=p(o.durationMs)!==void 0?` \xB7 ${(p(o.durationMs)/1e3).toFixed(1)}s`:"";b=`${o.ok===!1?"FAILED":"ok"} \xB7 ${p(c.promptTokens)??"?"}+${p(c.completionTokens)??"?"} tok${q}${A}`}}let S;m==="db-query"&&typeof o.query=="string"?S=o.query:m==="redis-op"?S=`${o.op??""} ${String(o.key??"").replace(/\d+/g,"#")}`:m==="egress"?S=`${o.method??"GET"} ${o.host??""}`:m==="queue-enqueued"?S=`enqueue ${o.queue??""}`:m==="span"&&typeof y.name=="string"?S=y.name:m==="memory-mutation"&&(S=d.title);const R=d.context??{},G=M.commitId??D.commitId??o.commitId,h=Array.isArray(M.why)?M.why.map(c=>typeof c?.type=="string"?c.type:void 0).filter(c=>!!c):[];return{id:d.id,t:d.timestamp,start:K,...S?{sig:S}:{},...F?{urlKey:F}:{},...typeof o.queue=="string"?{queue:o.queue}:{},...o.jobId!=null?{jobId:String(o.jobId)}:{},source:d.source,category:d.category,severity:d.severity,title:d.title,kind:m,area:areaOf({source:d.source,category:d.category,title:d.title,kind:m}),...typeof y.role=="string"?{role:y.role}:{},...typeof R.requestId=="string"?{requestId:R.requestId}:{},...typeof R.parentRequestId=="string"?{parentRequestId:R.parentRequestId}:{},...typeof G=="string"?{commitId:G}:{},...typeof M.componentName=="string"?{component:M.componentName}:{},...typeof M.phase=="string"?{phase:M.phase}:{},...h.length?{why:h}:{},...m==="effect-run"&&typeof D.hookLogicalId=="string"?{hook:D.hookLogicalId}:{},...m==="effect-run"&&D.cleanupRan===!0?{cleanup:!0}:{},...m==="render-commit-truncated"?{renderTotal:p(o.total),renderPublished:p(o.published)}:{},...typeof R.projectName=="string"?{project:R.projectName}:typeof o.project=="string"?{project:o.project}:{},...O!==void 0?{durationMs:O}:{},...U&&p(o.startedAt)!==void 0?{fetchStartedAt:p(o.startedAt)}:{},...d.source==="ai"?{ai:w.includeRaw?o:ce(o)}:{},...b?{detail:b}:{},...P?{steps:P}:{}}}B(trimFlowEvent,"trimFlowEvent"),g(trimFlowEvent,"trimFlowEvent");const le=1;function pe(d){return d==="flow-origin"?0:d?.endsWith("-start")?1:d==="gateway-request"?2:d==="server-request"?3:d==="span"?4:d==="render"||d==="render-commit-truncated"?6:d==="effect-run"?7:5}B(pe,"kt"),g(pe,"kindRank");function C(d){return d.kind==="span"&&d.role==="controller"?3.5:d.kind==="queue-process"?3:pe(d.kind)}B(C,"W"),g(C,"causalRank");export function buildFlowDetail(d,w={}){const o=d.slice().filter(e=>{const t=e.raw??{},r=typeof t.kind=="string"?t.kind:"";if(r==="subscription-added"||r==="subscription-removed"||r==="hook-run"||r==="store-created"||r==="singleton-instance")return!1;const n=t.span;return!(typeof n?.name=="string"&&n.name.startsWith("nest.request "))}).map(e=>trimFlowEvent(e,w)),M=new Set;for(let e=o.length-1;e>=0;e--)M.has(o[e].id)?o.splice(e,1):M.add(o[e].id);const y=new Map;for(const e of o)(e.kind==="gateway-request"||e.kind==="queue-process")&&e.requestId&&!y.has(e.requestId)&&y.set(e.requestId,e.start);const E=g(e=>e.source!=="react"&&e.source!=="valtio"&&e.requestId&&y.has(e.requestId)?y.get(e.requestId):e.start,"anchorOf");o.sort((e,t)=>E(e)-E(t)||e.start-t.start||C(e)-C(t)||(t.durationMs??0)-(e.durationMs??0)||e.t-t.t);const p=g(e=>(e.kind==="span"||e.kind==="server-request"||e.kind==="gateway-request"||e.kind==="queue-process")&&(e.durationMs??0)>0,"spanLike"),x=o;for(const e of x)e.group=e.source==="react"||e.source==="valtio"||e.source==="client-runtime"||e.source==="visual"?"browser":"server";const D=new Map;for(const e of x)if((e.kind==="gateway-request"||e.kind==="queue-process")&&e.requestId&&e.project){const t=D.get(e.requestId)??[];t.push({project:e.project,start:e.start,end:e.start+(e.durationMs??0)}),D.set(e.requestId,t)}const O=g((e,t)=>{const r=D.get(e);if(r?.length)return r.every(n=>n.project===r[0].project)?r[0].project:r.filter(n=>n.start<=t+1&&n.end>=t-1).sort((n,s)=>s.start-n.start)[0]?.project},"projectOf");for(const e of x)if(!e.project&&e.source==="nestjs"&&e.requestId){const t=O(e.requestId,e.start);t&&(e.project=t)}for(const e of x){let t;const r=e.requestId;for(const n of x){if(n===e||!p(n)||n.group!==e.group||n.requestId!==r)continue;const s=n.project,u=e.project;if(n.kind!=="gateway-request"&&e.kind!=="gateway-request"&&s!==void 0&&u!==void 0&&s!==u)continue;const l=n.durationMs??0,$=e.durationMs??0,a=Math.abs(n.start-e.start)<=le,i=C(n),f=C(e),k=n.start<=e.start;if(!(n.start+l>e.start&&(k||a&&i<f)&&(!a||(i!==f?i<f:k&&l>$))))continue;const j=t?C(t):-1,I=t?Math.abs(n.start-t.start)<=le:!1;(!t||!I&&n.start>t.start||I&&i>j||I&&i===j&&(n.durationMs??0)<(t.durationMs??0))&&(t=n)}t&&(e.parent=t.id)}const m=new Map;for(const e of x){if(!e.requestId)continue;const t=m.get(e.requestId);t?t.push(e):m.set(e.requestId,[e])}const U=new Map(x.map(e=>[e.id,e])),z=g((e,t)=>{const r=(m.get(e)??[]).filter(n=>p(n)&&n.start<=t&&n.start+(n.durationMs??0)>=t);if(r.length!==0)return r.sort((n,s)=>s.start-n.start||(n.durationMs??0)-(s.durationMs??0)),r[0]},"callerNodeFor");for(const e of x){if(!e.parentRequestId||e.kind!=="server-request"&&e.kind!=="gateway-request")continue;const t=e.parent?U.get(e.parent):void 0;if(t&&t.requestId===e.requestId)continue;const r=z(e.parentRequestId,e.start);r&&r!==e&&r.start<=e.start&&(e.parent=r.id)}const T=x,K=new Map;for(const e of T)e.kind==="gateway-request"&&e.requestId&&!K.has(e.requestId)&&K.set(e.requestId,e);for(const e of T)if(e.group==="server"&&!e.parent&&e.requestId&&e.kind!=="gateway-request"){const t=K.get(e.requestId);t&&t!==e&&t.start<=e.start&&(e.parent=t.id)}const b=new Set,F=new Set,P=[];for(const e of T){if(e.kind!=="gateway-request")continue;if(!e.requestId){P.push(e);continue}const t=m.get(e.requestId)??[];if(t.filter(s=>s.kind==="gateway-request").sort((s,u)=>s.start-u.start)[0]!==e)continue;const r=t.find(s=>s.kind==="fetch-start"),n=t.find(s=>s.kind==="fetch-done"||s.kind==="fetch-error");if(!r&&!n){P.push(e);continue}r&&(e.fetchStartId=r.id,b.add(r.id)),n&&(e.fetchDoneId=n.id,F.add(n.id))}const S=new Map;for(const e of T){if(!e.urlKey)continue;const t=S.get(e.urlKey)??{gws:[],starts:[],dones:[]};e.kind==="gateway-request"?P.includes(e)&&t.gws.push(e):e.kind==="fetch-start"?b.has(e.id)||t.starts.push(e):(e.kind==="fetch-done"||e.kind==="fetch-error")&&(F.has(e.id)||t.dones.push(e)),S.set(e.urlKey,t)}for(const{gws:e,starts:t,dones:r}of S.values()){e.sort((s,u)=>s.start-u.start),t.sort((s,u)=>s.start-u.start);const n=new Set;e.forEach((s,u)=>{const l=t[u];l&&(s.fetchStartId=l.id);const $=l?l.t:s.start;let a,i=1/0;for(const f of r){if(n.has(f.id))continue;const k=f.fetchStartedAt??f.start-(f.durationMs??0),j=Math.abs(k-$);j<i&&(i=j,a=f)}a&&(s.fetchDoneId=a.id,n.add(a.id))})}const R=new Map,G=new Map;for(const e of T)!e.queue||!e.jobId||(e.kind==="queue-enqueued"&&R.set(`${e.queue}#${e.jobId}`,e),e.kind==="queue-process"&&G.set(`${e.queue}#${e.jobId}`,e));for(const e of T){if(!e.queue||!e.jobId)continue;const t=`${e.queue}#${e.jobId}`;if(e.kind==="queue-process"&&!e.parent){const r=R.get(t);r&&r!==e&&r.start<=e.start&&(e.parent=r.id)}else if(e.kind==="queue-active"||e.kind==="queue-completed"||e.kind==="queue-failed"){const r=G.get(t);r&&r!==e&&r.start<=e.start&&(e.parent=r.id)}}let h=x;{const e=new Map;for(const r of h)r.kind==="fetch-start"&&e.set(r.id,r);const t=new Map;for(const r of h){if(r.kind!=="fetch-done"&&r.kind!=="fetch-error")continue;const n=[...e.values()].find(l=>l.requestId&&l.requestId===r.requestId)?.id,s=n?e.get(n):void 0;if(!s)continue;const u=r.fetchStartedAt??s.start;s.title=r.title,s.severity=r.severity,s.durationMs=r.durationMs??Math.max(0,r.t-u),s.kind="fetch",r.detail&&!s.detail&&(s.detail=r.detail),t.set(r.id,s.id)}if(t.size>0){h=h.filter(r=>!t.has(r.id));for(const r of h)for(r.fetchDoneId&&t.has(r.fetchDoneId)&&(r.fetchDoneId=t.get(r.fetchDoneId));r.parent&&t.has(r.parent);)r.parent=t.get(r.parent)}}const c=g(e=>!!e.commitId&&(e.kind==="render"||e.kind==="effect-run"||e.kind==="render-commit-truncated"),"commitMember"),q=g(e=>[...new Set(e)],"uniq"),A=g(e=>q(e.map(t=>t.component).filter(t=>!!t)),"named"),V=g(e=>e.length<=2?e.join(" + "):`${e[0]} + ${e.length-1} more`,"nameList"),H=g(e=>{const t=new Map;for(const r of e)r.component&&t.set(r.component,(t.get(r.component)??0)+1);return[...t].map(([r,n])=>n>1?`${r} \xD7${n}`:r).join(", ")},"tally"),X=g(e=>{if(!e)return"effect";const t=/([^/\\]+?):(\d+)(?::\d+)?$/.exec(e);return t?`${t[1]}:${t[2]}`:e},"shortHook"),Y=g(e=>`${X(e.hook)}${e.cleanup?" (cleanup)":""}`,"hookLabel"),Z=g(e=>{const t=Math.min(...e.map(n=>n.start)),r=Math.max(...e.map(n=>n.start+(n.durationMs??0)));return{start:t,durationMs:r-t}},"extent"),ee=g(e=>(delete e.component,delete e.why,delete e.phase,delete e.hook,delete e.cleanup,delete e.renderTotal,delete e.renderPublished,e),"asGroup");function te(e){const t=e[0],r=e.filter(v=>v.kind==="render"),n=e.filter(v=>v.kind==="effect-run"),s=e.find(v=>v.kind==="render-commit-truncated"),u=[...r].sort((v,W)=>(W.durationMs??0)-(v.durationMs??0)),l=u.filter(v=>(v.why??[]).some(W=>W!=="parent-render")),$=q(l.flatMap(v=>(v.why??[]).filter(W=>W!=="parent-render"))),a=A(l),i=r.filter(v=>v.phase==="mount"),f=r.filter(v=>v.phase!=="mount"&&!l.includes(v)),k=u[0]?.component??"view",j=r.length>0&&i.length===r.length,I=$.length?$.join(" + "):void 0,L=j?"mount":"update",N=a.length?`view update \xB7 ${V(a)} \u2190 ${I}`:j?`view mount \xB7 ${k}`:`view update \xB7 ${k}`,ae=s?.renderTotal??r.length,he=[i.length?`mounted ${H(i)}`:"",f.length?`re-rendered ${H(f)}`:"",!a.length&&!j&&r.length?"trigger not recorded \u2014 every captured render came from its parent":"",s?`${ae} renders, ${s.renderPublished??r.length} recorded (per-commit cap)`:`${r.length} render${r.length===1?"":"s"}`,n.length?`${n.length} effect${n.length===1?"":"s"}: ${n.map(Y).join(", ")}`:""].filter(Boolean).join(" \xB7 "),ie=A(r);return ee({...t,...Z(e),kind:"view-update",title:N,detail:he,commitId:t.commitId,viewPhase:L,...I?{cause:I}:{},causeComponents:a,components:ie,mounted:A(i),renderCount:ae,recordedRenders:r.length,effects:n.length,effectHooks:n.map(Y),memberIds:e.map(v=>v.id),sig:`commit:${L}:${I??"-"}:${a.join(",")}:${ie.slice().sort().join(",")}`,severity:e.some(v=>v.severity==="error")?"error":t.severity})}B(te,"ct"),g(te,"viewUpdateNode");function re(e){const t=e[0],r=e.map(Y);return ee({...t,...Z(e),kind:"commit-effects",title:e.length===1?`effect \xB7 ${r[0]}`:`effects \xB7 ${r[0]} + ${e.length-1} more`,detail:r.join(", "),commitId:t.commitId,effects:e.length,effectHooks:r,memberIds:e.map(n=>n.id),sig:`effects:${r.slice().sort().join(",")}`})}B(re,"dt"),g(re,"effectsNode");const me=g(e=>q(e.map(t=>t==="state-update"?"state update":t==="fetch-start"?"request":t==="flow-origin"?"interaction":"response")).join(" + "),"describeInputs");function ne(e,t){const r=e[0],n=e[e.length-1],s=e.length,u=r.detail,l=Math.min(...e.map(f=>f.start)),$=Math.max(...e.map(f=>f.start+(f.durationMs??0))),a=Math.round(e.reduce((f,k)=>f+(k.durationMs??0),0)/s*10)/10,i=Math.round(($-l)*10)/10;r.count=s,r.avgMs=a,r.wallMs=i,r.durationMs=$-l,r.items=e.slice(0,12).map(f=>({start:f.start-l,...f.durationMs!=null?{durationMs:f.durationMs}:{}})),r.memberIds=e.flatMap(f=>f.memberIds??[f.id]),r.title=`\xD7${s} ${r.title}`,e.some(f=>f.severity==="error")&&(r.severity="error"),r.kind==="view-update"?r.detail=[`${s} commits, ${t.length?`one per ${me(t)}`:"back to back"}`,`avg ${a}ms \xB7 wall ${i}ms`,u??""].filter(Boolean).join(" \xB7 "):r.kind==="state-update"&&u&&n.detail?r.detail=`${s} updates in a row \xB7 wall ${i}ms \xB7 first ${u} \xB7 last ${n.detail}`:r.detail=[`${s} in a row \xB7 wall ${i}ms`,u??""].filter(Boolean).join(" \xB7 ")}B(ne,"ft"),g(ne,"collapseRepeat");const J=[],_=new Map,oe=new Set;for(let e=0;e<h.length;e++){if(oe.has(e))continue;const t=h[e];if(!c(t)){J.push(t);continue}const r=[e];for(let u=e+1;u<h.length;u++){const l=h[u];if(l.group==="browser"){if(!c(l)||l.commitId!==t.commitId)break;r.push(u)}}for(const u of r)oe.add(u);const n=r.map(u=>h[u]),s=n.some(u=>u.kind!=="effect-run")?te(n):re(n);for(const u of n)u.id!==s.id&&_.set(u.id,s.id);J.push(s)}if(_.size>0||J.some(e=>e.kind==="view-update"||e.kind==="commit-effects")){h=J;for(const e of h)for(;e.parent&&_.has(e.parent);)e.parent=_.get(e.parent)}{const e=new Map;for(const t of h)t.kind==="view-update"&&t.commitId&&!e.has(t.commitId)&&e.set(t.commitId,t);for(const t of h){if(t.kind!=="commit-effects"||t.parent||!t.commitId)continue;const r=e.get(t.commitId);r&&r.start<=t.start&&(t.parent=r.id)}}{const e=new Set(["state-update","fetch","fetch-start","fetch-done","fetch-error","flow-origin"]),t=h.map((a,i)=>a.group==="browser"?i:-1).filter(a=>a>=0),r=g(a=>`${a.kind}|${a.sig??a.title}`,"keyOf"),n=t.map(a=>r(h[a])),s=g((a,i,f)=>{for(let k=0;k<f;k++)if(n[a+k]!==n[i+k])return!1;return!0},"sameBlock"),u=g(a=>n[a].split("|")[0],"kindAt"),l=g(a=>{let i=0,f=1;for(let k=1;k<=4&&a+k<=n.length;k++){let j=1;for(;a+(j+1)*k<=n.length&&s(a,a+j*k,k);)j+=1;j>=3&&k*j>i*f&&(i=k,f=j)}return{k:i,r:f}},"bestBlockAt"),$=new Map;for(let a=0;a<n.length;){const{k:i,r:f}=l(a);if(i===0){a+=1;continue}const k=[...Array(i).keys()].find(I=>e.has(u(a+I)));if(k!==void 0&&k>0){const I=l(a+k);if(I.k===i&&I.r>=3&&I.r>=f-1){a+=k;continue}}const j=n.slice(a,a+i).map(I=>I.split("|")[0]).filter(I=>e.has(I));for(let I=0;I<i;I++){const L=[];for(let N=0;N<f;N++)L.push(h[t[a+I+N*i]]);ne(L,j);for(const N of L.slice(1))$.set(N.id,L[0].id)}a+=i*f}if($.size>0){h=h.filter(a=>!$.has(a.id));for(const a of h)for(;a.parent&&$.has(a.parent);)a.parent=$.get(a.parent)}}{const e=new Map(h.map(t=>[t.id,t]));for(const t of h){const r=new Set([t.id]);let n=t;for(;n?.parent;){if(r.has(n.parent)){n.parent=void 0;break}r.add(n.parent),n=e.get(n.parent)}}}const se=g(e=>{const t=new Map;for(const n of h){if(!n.sig||p(n)!==e||n.kind==="server-request"||n.kind==="gateway-request"||n.group==="browser")continue;const s=`${n.parent??"root"}|${n.kind}|${n.sig}`,u=t.get(s);u?u.push(n):t.set(s,[n])}const r=new Map;for(const n of t.values()){if(n.length<3)continue;n.sort((i,f)=>i.start-f.start);const s=n[0];let u=!1;for(let i=0;i+1<n.length;i++)if(n[i+1].start<n[i].start+(n[i].durationMs??0)){u=!0;break}const l=s.start,$=Math.max(...n.map(i=>i.start+(i.durationMs??0))),a=n.reduce((i,f)=>i+(f.durationMs??0),0);s.count=n.length,s.parallel=u,s.avgMs=Math.round(a/n.length*10)/10,s.wallMs=$-l,s.durationMs=$-l,s.title=`\xD7${n.length} ${s.title.replace(/\s*\((?:\d+ rows?, )?\d+ms\)$/,"")}`,s.detail=`${s.sig} \xD7${n.length} ${u?"\u2016 parallel":"\u21BB sequential loop"} \xB7 avg ${s.avgMs}ms \xB7 wall ${s.wallMs}ms`,s.items=n.slice(0,12).map(i=>({start:i.start-l,...i.durationMs!=null?{durationMs:i.durationMs}:{}})),s.memberIds=n.flatMap(i=>i.memberIds??[i.id]),n.some(i=>i.severity==="error")&&(s.severity="error");for(const i of n.slice(1))r.set(i.id,s.id)}if(r.size!==0){h=h.filter(n=>!r.has(n.id));for(const n of h)for(;n.parent&&r.has(n.parent);)n.parent=r.get(n.parent)}},"aggregatePass");se(!0),se(!1);for(const e of h){if(!p(e))continue;const t=e.durationMs??0;if(t<40)continue;const r=h.filter($=>$.parent===e.id&&($.durationMs??0)>0).map($=>[$.start,$.start+($.durationMs??0)]).sort(($,a)=>$[0]-a[0]);let n=0,s=-1,u=-1;for(const[$,a]of r)$>u?(u>s&&(n+=u-s),s=$,u=a):a>u&&(u=a);u>s&&(n+=u-s);const l=Math.max(0,t-n);(l>=50||l/t>=.7&&t>=40)&&(e.selfMs=l,e.detail=`\u26A0 cpu-heavy: ${l}ms self-time of ${t}ms${e.detail?" \xB7 "+e.detail:""}`)}return{events:h}}B(buildFlowDetail,"buildFlowDetail"),g(buildFlowDetail,"buildFlowDetail");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lensmcp/core",
3
- "version": "1.22.6",
3
+ "version": "1.23.1",
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.22.6",
22
+ "@lensmcp/protocol-types": "1.23.1",
23
23
  "tslib": "^2.3.0"
24
24
  },
25
25
  "license": "Apache-2.0",