lensmcp 1.24.2 → 1.24.3
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.
- package/bundled/dashboard-ui/app.js +1 -1
- package/bundled/dashboard.js +74 -72
- package/bundled/main.js +41 -39
- package/bundled/shim.js +45 -45
- package/lib/cli.js +18 -15
- package/lib/instance-command.d.ts +37 -4
- package/lib/instance-command.js +17 -8
- package/lib/instance-registry.d.ts +3 -0
- package/lib/instance-resources.d.ts +2 -0
- package/lib/instance-resources.js +5 -5
- package/lib/instance-worktree.d.ts +99 -0
- package/lib/instance-worktree.js +8 -0
- package/lib/mcp-restart.d.ts +5 -0
- package/lib/mcp-restart.js +1 -1
- package/lib/project-files.d.ts +4 -0
- package/lib/project-files.js +1 -0
- package/package.json +3 -3
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/README.md +3 -0
- package/plugin/skills/using-lensmcp/SKILL.md +1 -0
- package/plugin/skills/worktrees/SKILL.md +69 -0
- package/plugins/lensmcp/.codex-plugin/plugin.json +1 -1
- package/plugins/lensmcp/README.md +2 -1
- package/plugins/lensmcp/skills/lensmcp-worktrees/SKILL.md +48 -0
- package/plugins/lensmcp/skills/using-lensmcp/SKILL.md +1 -0
|
@@ -14,5 +14,5 @@ Error generating stack: `+X.message+`
|
|
|
14
14
|
`)[0])?(0,F.jsxs)("span",{className:"errors-now-msg",children:[" \u2014 ",ns.message.split(`
|
|
15
15
|
`)[0]]}):null]}),(0,F.jsx)("span",{className:"mono muted",children:ns.where??""}),(0,F.jsx)("span",{className:"mono",children:ns.ongoing?"now":`\xD7${z(ns.count)}`}),(0,F.jsx)("span",{className:"muted",children:ns.ongoing?"":(0,F.jsx)($t,{at:ns.lastSeenAt,now:ts.now})})]}),rs?.flowId?(0,F.jsxs)("button",{type:"button",className:"btn btn-sm errors-now-go",onClick:Y(()=>Xe(rs.flowId,rs.stepId??rs.id),"onClick"),children:["failing step ",(0,F.jsx)(Nt,{size:12})]}):(0,F.jsx)("span",{}),(0,F.jsx)("button",{type:"button",className:"errors-now-dismiss",onClick:Y(()=>{Gn([ns.id])},"onClick"),"aria-label":`Dismiss: ${ns.title}`,"data-tip":"Dismiss \u2014 hidden until it happens again",children:(0,F.jsx)(Tt,{size:14})})]},ns.id)})}),ts.ui.errorNotice?(0,F.jsx)("div",{className:"errors-notice",role:"alert",children:ts.ui.errorNotice}):null,K.length>5?(0,F.jsx)("div",{className:"errors-now-more",children:(0,F.jsxs)("button",{type:"button",className:"link",onClick:Y(()=>Qe(),"onClick"),children:["+",K.length-5," more"]})}):null]})}Y(Ja,"Ja");function Ya({earlier:K,dismissed:Z}){return(0,F.jsxs)("div",{className:"no-errors",children:[(0,F.jsx)("span",{className:"no-errors-glyph","aria-hidden":"true",children:"\u2713"}),(0,F.jsxs)("span",{children:[(0,F.jsx)("strong",{children:"No errors in the last 15 minutes."}),K?(0,F.jsxs)("span",{className:"muted",children:[" ",K," earlier this session."]}):null,Z?(0,F.jsxs)("span",{className:"muted",children:[" ",Z," dismissed."]}):null]}),(0,F.jsx)("span",{className:"grow"}),Z?(0,F.jsx)("button",{type:"button",className:"link",onClick:Y(()=>{P.ui.errorShowDismissed=!0,Qe()},"onClick"),children:"See dismissed \u2192"}):null,K?(0,F.jsx)("button",{type:"button",className:"link",onClick:Y(()=>{P.ui.errorWindow="all",Qe()},"onClick"),children:"See earlier errors \u2192"}):null]})}Y(Ya,"Ya");function Xa(){return(0,F.jsx)(L,{title:"No flows yet",kicker:"Latest flow",children:(0,F.jsxs)(Qt,{icon:(0,F.jsx)(pt,{size:26}),title:"Use your app to see what it does",children:[(0,F.jsxs)("p",{children:["Every click, page load and request becomes a ",(0,F.jsx)("strong",{children:"flow"}),": the lens follows it from the browser through the gateway into your services and the database, and back to the re-render."]}),(0,F.jsx)(Da,{})]})})}Y(Xa,"Xa");function Za({summary:K}){let Z=N(P);(0,M.useEffect)(()=>Nn(K.flowId),[K.flowId]);let ts=Z.details[K.flowId]?.detail,ns=(0,M.useMemo)(()=>ts?Ir(ts.events,{viewportWidth:900,hideBookkeeping:!0}):void 0,[ts]),rs=Z.errors?.groups,as=Z.errors?.recentMs??15*6e4,ls=Z.now-K.lastSeenAt>as,os=(0,M.useMemo)(()=>{if(!ts)return;let us=ts.events;return li(Yr(us,{visible:new Set(us.filter(fs=>!Dr(fs)).map(fs=>fs.id)),foldQuick:!0,summary:{originLabel:K.originLabel,originWhere:K.originWhere,originType:K.originType}}),us,{summary:K,messageFor:Y(fs=>rs?.find(vs=>vs.occurrences.some(ks=>fs.includes(ks.id)||ks.stepId!==void 0&&fs.includes(ks.stepId)))?.message,"messageFor")})},[ts,K.durationMs,K.originLabel,K.originWhere,K.originType,rs]),cs=(0,M.useMemo)(()=>ns?Sr(ns.nodes.map(us=>us.node)):void 0,[ns]);return(0,F.jsxs)(L,{kicker:"Latest flow",title:(0,F.jsxs)("button",{type:"button",className:"hero-title",onClick:Y(()=>Xe(K.flowId),"onClick"),children:[(0,F.jsx)("span",{className:"flowpane-glyph","aria-hidden":"true",children:Hi(K.originType)}),K.headline,(0,F.jsx)(Gt,{worst:K.worst})]}),actions:(0,F.jsx)($t,{at:K.lastSeenAt,now:Z.now}),children:[ls?(0,F.jsxs)("div",{className:`hero-stale${os?.outcome==="error"?" failed":""}`,children:[(0,F.jsx)("span",{"aria-hidden":"true",children:"\u25F7"}),(0,F.jsxs)("span",{children:["Ran ",(0,F.jsx)("strong",{children:tn(K.lastSeenAt,Z.now)})," \u2014 before the last ",Math.round(as/6e4)," minutes.",os?.outcome==="error"&&!Z.errors?.recentGroups?" Nothing has failed since.":" Nothing newer has run."]})]}):null,(0,F.jsxs)("div",{className:"hero-meta mono",children:[(0,F.jsxs)("span",{children:[z(K.eventCount)," events"]}),K.durationMs>0?(0,F.jsxs)("span",{children:[R(K.durationMs)," end to end"]}):null,K.projects.length?(0,F.jsx)("span",{className:"hero-services",children:K.projects.map(us=>(0,F.jsx)(cn,{project:us},us))}):null]}),ns&&ns.nodes.length?(0,F.jsx)(hr,{layout:ns,...cs?{focusId:cs.id}:{},onPick:Y(us=>Xe(K.flowId,us),"onPick")}):(0,F.jsx)("div",{className:"mini-trace placeholder"}),os?(0,F.jsx)(Ci,{story:os,onSelect:Y(us=>Xe(K.flowId,us),"onSelect")}):K.firstError?(0,F.jsxs)("div",{className:"hero-failed",children:["\u2717 Failed at ",K.firstError]}):null,(0,F.jsxs)("div",{className:"hero-actions",children:[(0,F.jsxs)("button",{type:"button",className:`btn ${cs?"btn-danger":"btn-primary"}`,onClick:Y(()=>Xe(K.flowId,cs?.id),"onClick"),children:[cs?"Open the trace at the failure":"Open the full trace"," ",(0,F.jsx)(Nt,{size:14})]}),(0,F.jsx)("button",{type:"button",className:"btn",onClick:Y(()=>Ye("flows"),"onClick"),children:"All flows"})]})]})}Y(Za,"Za");function Qa({problems:K}){let Z=K.slice(0,6);return(0,F.jsx)(L,{kicker:"Performance",title:K.length?`${K.length} slow or wasteful`:"Nothing slow",actions:(0,F.jsx)("button",{type:"button",className:"link",onClick:Y(()=>Ye("performance"),"onClick"),children:"All \u2192"}),pad:!1,children:Z.length?(0,F.jsx)("ul",{className:"attention",children:Z.map(ts=>(0,F.jsx)("li",{children:(0,F.jsxs)("button",{type:"button",className:"attention-item",onClick:Y(()=>ts.evidence?.flowId?Xe(ts.evidence.flowId,ts.evidence.nodeId):Ye("performance"),"onClick"),children:[(0,F.jsx)(Wt,{severity:ts.severity}),(0,F.jsxs)("span",{className:"attention-text",children:[(0,F.jsx)("span",{className:"attention-title",children:ts.title}),(0,F.jsxs)("span",{className:"attention-where",children:[un[ts.kind],ts.where?` \xB7 ${ts.where}`:""]})]}),(0,F.jsx)("span",{className:"attention-go","aria-hidden":"true",children:ts.evidence?.flowId?"trace \u2192":"\u2192"})]})},ts.id))}):(0,F.jsx)(Qt,{compact:!0,title:"No performance detector is firing",children:"Slow routes and queries, N+1s, render storms and leaks show up here the moment the lens sees them."})})}Y(Qa,"Qa");function $a(){let K=N(P),Z=K.cluster?.services??[],ts=new Map;for(let ns of K.errors?.groups??[])ns.project&&(ns.ongoing||K.now-ns.lastSeenAt<=Ka)&&ts.set(ns.project,(ts.get(ns.project)??0)+1);return(0,F.jsx)(L,{kicker:"Cluster",title:`${Z.length} service${Z.length===1?"":"s"}`,actions:(0,F.jsx)("button",{type:"button",className:"link",onClick:Y(()=>Ye("cluster"),"onClick"),children:"Cluster \u2192"}),pad:!1,children:(0,F.jsxs)("ul",{className:"svc-mini",children:[Z.map(ns=>(0,F.jsxs)("li",{children:[(0,F.jsx)(cn,{project:ns.project}),(0,F.jsx)("span",{className:"svc-mini-kind",children:ns.kind==="web"?"frontend":ns.kind==="eager"?"always warm":"scales from zero"}),ts.get(ns.project)?(0,F.jsxs)("button",{type:"button",className:"svc-mini-err",onClick:Y(()=>Qe(ns.project),"onClick"),"data-tip":`Errors in ${ns.project} in the last 15 minutes`,children:["\u2717 ",ts.get(ns.project)]}):(0,F.jsx)("span",{className:"svc-mini-pods mono","data-tip":"Pods running",children:ns.kind==="web"?"":`\xD7${ns.pods.running}`}),(0,F.jsx)(Ut,{state:ns.state,...ns.stateReason?{reason:ns.stateReason}:{}})]},ns.project)),Z.length?null:(0,F.jsx)("li",{className:"muted pad",children:"No services declared in this workspace\u2019s project.json files."})]})})}Y($a,"$a");function eo(){let K=N(P).logs.lines.filter(Z=>!Wa(Z)).slice(-8).reverse();return(0,F.jsx)(L,{kicker:"Live activity",title:"Latest log lines",actions:(0,F.jsx)("button",{type:"button",className:"link",onClick:Y(()=>tt(),"onClick"),children:"Open logs \u2192"}),pad:!1,children:(0,F.jsxs)("ul",{className:"activity",children:[K.map(Z=>(0,F.jsxs)("li",{className:`sev-row-${Z.severity}`,children:[(0,F.jsx)("span",{className:"mono muted",children:nn(Z.at)}),(0,F.jsx)("span",{className:"activity-src",children:(0,F.jsx)(cn,{project:Z.source})}),(0,F.jsx)("span",{className:"activity-title",children:Z.title}),Z.flowId?(0,F.jsx)("button",{type:"button",className:"link mono",onClick:Y(()=>Xe(Z.flowId),"onClick"),children:"flow \u2192"}):(0,F.jsx)("span",{})]},Z.seq)),K.length?null:(0,F.jsx)("li",{className:"muted pad",children:"Nothing yet \u2014 the stream shows every event the lens receives."})]})})}Y(eo,"eo");var to=[16,236,470,740],no=[170,170,200,190],ro=48,io=14,ao=34;function oo(K,Z){let ts=[],ns=[],rs=K.services.filter(xs=>xs.kind==="web"),as=K.services.filter(xs=>xs.kind!=="web");ts.push({id:"client",col:0,label:"Browser",sub:rs.length?rs.map(xs=>xs.host??xs.project).join(" \xB7 "):"your app",kind:"client",tone:"muted",x:0,y:0,w:0,h:0});let ls=K.routes.reduce((xs,As)=>xs+As.count,0);ts.push({id:"gateway",col:1,label:"Gateway",sub:K.gateway.ports.length?K.gateway.ports.map(xs=>`:${xs}`).join(" "):"front door",kind:"gateway",tone:K.gateway.state==="live"?"ok":K.gateway.state==="down"?"bad":"muted",metric:`${Z(ls)} req`,x:0,y:0,w:0,h:0});for(let xs of[...rs,...as])ts.push({id:`svc:${xs.project}`,col:2,label:xs.project,sub:xs.kind==="web"?"frontend":`${xs.kind==="eager"?"always warm":"scales from zero"} \xB7 \xD7${xs.pods.running}`,kind:"service",tone:xs.state==="up"?"ok":xs.state==="idle"?"idle":xs.state==="starting"?"warn":xs.state==="unknown"?"muted":"bad",metric:xs.traffic.count?`${Z(xs.traffic.count)} req`:void 0,ref:xs.project,x:0,y:0,w:0,h:0});for(let xs of K.backends)ts.push({id:`be:${xs.id}`,col:3,label:xs.name,sub:so(xs.kind),kind:"backend",tone:"muted",metric:`${Z(xs.ops)} ops`,ref:xs.id,x:0,y:0,w:0,h:0});let os=[];(rs.length||as.length)&&os.push({from:"client",to:"gateway",kind:"client",count:ls,errors:K.routes.reduce((xs,As)=>xs+As.errors,0),avgMs:null});let cs=new Map;for(let xs of K.routes){let As=cs.get(xs.project);cs.set(xs.project,{count:(As?.count??0)+xs.count,errors:(As?.errors??0)+xs.errors,avg:xs.avgMs??As?.avg??null})}for(let xs of K.services){let As=cs.get(xs.project);(As||xs.host)&&os.push({from:"gateway",to:`svc:${xs.project}`,kind:"public",count:As?.count??0,errors:As?.errors??0,avgMs:As?.avg??null})}for(let xs of K.edges)!ts.some(As=>As.id===`svc:${xs.caller}`)||!ts.some(As=>As.id===`svc:${xs.callee}`)||os.push({from:`svc:${xs.caller}`,to:`svc:${xs.callee}`,kind:"east-west",count:xs.count,errors:xs.errors,avgMs:xs.avgMs});for(let xs of K.backends)for(let As of xs.usedBy)ts.some(Us=>Us.id===`svc:${As}`)&&os.push({from:`svc:${As}`,to:`be:${xs.id}`,kind:"data",count:xs.ops,errors:0,avgMs:null});let us=Y(xs=>ts.filter(As=>As.col===xs),"l"),fs=Y(xs=>{us(xs).forEach((As,Us)=>{As.x=to[xs],As.w=no[xs],As.h=ro,As.y=ao+Us*62})},"u");fs(0),fs(1),fs(2);let vs=new Map(us(2).map(xs=>[xs.id,xs.y])),ks=us(3),ms=Y(xs=>{let As=os.filter(Us=>Us.to===xs.id&&vs.has(Us.from)).map(Us=>vs.get(Us.from));return As.length?As.reduce((Us,Gs)=>Us+Gs,0)/As.length:1/0},"p");ks.sort((xs,As)=>ms(xs)-ms(As));let Fs=ts.filter(xs=>xs.col!==3);ts.length=0,ts.push(...Fs,...ks),fs(3);let ws=Y(xs=>us(xs).length*62-io,"h"),Ss=Math.max(...[0,1,2,3].map(ws));for(let xs of[0,1,2,3]){let As=(Ss-ws(xs))/2;for(let Us of us(xs))Us.y+=Math.max(0,As)}let qs=new Map(ts.map(xs=>[xs.id,xs])),Bs=Math.max(1,...os.map(xs=>xs.count));for(let xs of os){let As=qs.get(xs.from),Us=qs.get(xs.to),Gs=xs.count>0?1.25+3*(Math.log(1+xs.count)/Math.log(1+Bs)):1,Ws;if(xs.kind==="east-west"){let ll=As.x+As.w,nl=As.y+As.h/2,Js=Us.y+Us.h/2,hl=36+Math.abs(Js-nl)*.18;Ws=`M${ll},${nl}C${ll+hl},${nl} ${ll+hl},${Js} ${ll},${Js}`}else{let ll=As.x+As.w,nl=As.y+As.h/2,Js=Us.x,hl=Us.y+Us.h/2,ml=(ll+Js)/2;Ws=`M${ll},${nl}C${ml},${nl} ${ml},${hl} ${Js},${hl}`}ns.push({...xs,d:Ws,width:Gs})}let Rs=ao+Ss+20;return{nodes:ts,edges:ns,width:to[3]+no[3]+16,height:Rs,columns:[{x:to[0],label:"Client"},{x:to[1],label:"Gateway"},{x:to[2],label:"Services"},{x:to[3],label:"Data & external"}]}}Y(oo,"oo");function so(K){return K==="db"?"database":K==="redis"?"cache (redis)":K==="queue"?"queue":K==="external"?"external API":K==="fs"?"file system":K==="exec"?"child processes":K}Y(so,"so");function co(){let K=N(P),Z=K.cluster;if(!Z)return(0,F.jsx)("div",{className:"view-loading",children:"Loading the cluster\u2026"});let ts=Z.services;return(0,F.jsxs)("div",{className:"view view-pad cluster",children:[(0,F.jsx)("header",{className:"view-head",children:(0,F.jsxs)("div",{children:[(0,F.jsx)(ln,{}),(0,F.jsxs)("div",{className:"kicker",children:["Cluster \xB7 ",K.hello?.workspace.name]}),(0,F.jsx)("h1",{children:"Services & topology"}),Z.instance?(0,F.jsxs)("p",{className:"lead",children:["A worktree of ",(0,F.jsx)("a",{href:`${Z.instance.baseDashboard}/cluster`,children:Z.instance.baseKey}),", named ",(0,F.jsx)("b",{children:Z.instance.name}),Z.instance.apex?(0,F.jsxs)(F.Fragment,{children:[" \u2014 its hosts are under ",(0,F.jsx)("span",{className:"mono",children:Z.instance.apex})]}):null,"."]}):null,(0,F.jsxs)("p",{className:"lead",children:["The dev gateway",Z.gateway.ports.length?` on ${Z.gateway.ports.map(ns=>`:${ns}`).join(" ")}`:""," routes ",Z.hosts.length," host",Z.hosts.length===1?"":"s"," to ",ts.length," service",ts.length===1?"":"s","."," ",(0,F.jsxs)("span",{className:"muted","data-tip":Z.gateway.evidence,children:["Gateway: ",Z.gateway.state==="live"?"live":Z.gateway.state==="down"?"down":"unknown"," ",(0,F.jsx)(Bt,{text:Z.gateway.evidence})]})]})]})}),(0,F.jsx)(mr,{}),(0,F.jsx)(fr,{}),ts.length===0?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(Qt,{title:"No services declared",children:["The gateway reads each project\u2019s ",(0,F.jsx)("code",{children:"cluster"})," block in project.json. Declare a host (and a service for a backend) to see it here."]}),(0,F.jsx)(W,{worktrees:Z.worktrees??[]})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(L,{kicker:"Signal path",title:"How a request travels",actions:(0,F.jsx)(Bt,{text:"Line thickness follows traffic since the dashboard started; a red line carried errors. Arcs on the right are service-to-service calls."}),pad:!1,children:(0,F.jsx)(G,{c:Z})}),(0,F.jsx)(uo,{services:ts}),(0,F.jsx)(W,{worktrees:Z.worktrees??[]}),(0,F.jsxs)("div",{className:"cluster-grid",children:[(0,F.jsx)(ho,{c:Z}),(0,F.jsx)(go,{c:Z}),(0,F.jsx)(_o,{c:Z}),(0,F.jsx)(vo,{c:Z})]}),(0,F.jsx)(yo,{c:Z})]})]})}Y(co,"co");function W({worktrees:K}){if(K.length===0)return null;let Z=K.filter(ts=>ts.live).length;return(0,F.jsx)(L,{kicker:"Worktrees",title:`${Z} running${K.length>Z?` \xB7 ${K.length-Z} stopped`:""}`,actions:(0,F.jsx)(Bt,{text:"Git worktrees of this project served beside it by `lensmcp instance start`: each under its own hosts (<name>.<apex>), with its own services, dashboard and data. `lensmcp instance list` shows the same."}),pad:!1,children:(0,F.jsxs)("table",{className:"tbl compact",children:[(0,F.jsx)("thead",{children:(0,F.jsxs)("tr",{children:[(0,F.jsx)("th",{children:"Worktree"}),(0,F.jsx)("th",{children:"State"}),(0,F.jsx)("th",{children:"Hosts"}),(0,F.jsx)("th",{children:"Branch"}),(0,F.jsx)("th",{children:"Data"}),(0,F.jsx)("th",{children:"Folder"}),(0,F.jsx)("th",{})]})}),(0,F.jsx)("tbody",{children:K.map(ts=>(0,F.jsxs)("tr",{children:[(0,F.jsx)("td",{className:"mono",children:(0,F.jsx)("b",{children:ts.name})}),(0,F.jsx)("td",{children:ts.live?(0,F.jsxs)(Yt,{tone:"ok",children:[(0,F.jsx)(Vt,{tone:"ok"})," running"]}):(0,F.jsx)(Yt,{children:"stopped"})}),(0,F.jsx)("td",{className:"mono",children:ts.apex?`*.${ts.apex}`:"\u2014"}),(0,F.jsx)("td",{className:"mono",children:ts.branch??"\u2014"}),(0,F.jsx)("td",{className:"mono",children:ts.data?.length?ts.data.join(", "):"\u2014"}),(0,F.jsx)("td",{className:"mono muted",children:ts.root}),(0,F.jsx)("td",{children:ts.live?(0,F.jsxs)("a",{className:"link",href:`${ts.dashboard}/cluster`,children:["Open ",(0,F.jsx)(Ot,{size:12})]}):null})]},ts.key))})]})})}Y(W,"W");function G({c:K}){let Z=(0,M.useMemo)(()=>oo(K,z),[K]),[ts,ns]=(0,M.useState)(null);return(0,F.jsxs)("div",{className:"topo-scroll",children:[(0,F.jsxs)("svg",{className:"topo",width:Z.width,height:Z.height,viewBox:`0 0 ${Z.width} ${Z.height}`,role:"img","aria-label":"Cluster topology: client, gateway, services, data",children:[Z.columns.map(rs=>(0,F.jsx)("text",{x:rs.x,y:18,className:"topo-col",children:rs.label},rs.label)),Z.edges.map((rs,as)=>{let ls=ts&&(rs.from===ts||rs.to===ts);return(0,F.jsx)("path",{d:rs.d,className:`topo-edge topo-${rs.kind}${lo(rs.count,rs.errors)}${rs.count===0?" idle":""}${ls?" hot":""}${ts&&!ls?" dim":""}`,strokeWidth:rs.width,"data-tip":`${rs.from.replace(/^\w+:/,"")} \u2192 ${rs.to.replace(/^\w+:/,"")}: ${z(rs.count)} ${rs.kind==="data"?"ops":"requests"}${rs.avgMs===null?"":` \xB7 ~${R(rs.avgMs)}`}${rs.errors?` \xB7 ${z(rs.errors)} errors`:""}`},as)}),Z.nodes.map(rs=>(0,F.jsxs)("g",{transform:`translate(${rs.x},${rs.y})`,className:`topo-node topo-${rs.kind} tone-${rs.tone}${ts&&ts!==rs.id?" dim":""}`,onPointerEnter:Y(()=>ns(rs.id),"onPointerEnter"),onPointerLeave:Y(()=>ns(null),"onPointerLeave"),children:[(0,F.jsx)("rect",{width:rs.w,height:rs.h,rx:2}),(0,F.jsx)("rect",{width:3,height:rs.h,className:"topo-mark"}),(0,F.jsx)("circle",{cx:14,cy:17,r:4,className:"topo-dot"}),(0,F.jsx)("text",{x:24,y:21,className:"topo-label",children:rs.label}),rs.metric?(0,F.jsx)("text",{x:rs.w-10,y:21,textAnchor:"end",className:"topo-metric",children:rs.metric}):null,(0,F.jsx)("text",{x:14,y:37,className:"topo-sub",children:rs.sub.length>30?`${rs.sub.slice(0,29)}\u2026`:rs.sub})]},rs.id))]}),(0,F.jsxs)("ul",{className:"topo-legend","aria-label":"How to read the lines",children:[(0,F.jsxs)("li",{children:[(0,F.jsx)("span",{className:"topo-key key-public"}),"request"]}),(0,F.jsxs)("li",{children:[(0,F.jsx)("span",{className:"topo-key key-east-west"}),"service \u2192 service"]}),(0,F.jsxs)("li",{children:[(0,F.jsx)("span",{className:"topo-key key-data"}),"data & external"]}),(0,F.jsxs)("li",{children:[(0,F.jsx)("span",{className:"topo-key key-idle"}),"no traffic yet"]}),(0,F.jsxs)("li",{children:[(0,F.jsx)("span",{className:"topo-key key-warn"}),"2\u201310% failed"]}),(0,F.jsxs)("li",{children:[(0,F.jsx)("span",{className:"topo-key key-bad"}),"\u226510% failed"]}),(0,F.jsx)("li",{className:"muted",children:"thicker = more traffic \xB7 counts are this session"})]})]})}Y(G,"G");function lo(K,Z){if(!K||!Z)return"";let ts=Z/K;return ts>=.1?" err-many":ts>=.02?" err-some":""}Y(lo,"lo");function uo({services:K}){let Z=N(P),[ts,ns]=(0,M.useState)(Z.route.svc??null),rs=(0,M.useRef)(null);(0,M.useEffect)(()=>{Z.route.svc&&(ns(Z.route.svc),requestAnimationFrame(()=>rs.current?.scrollIntoView({block:"center",behavior:"smooth"})))},[Z.route.svc]);let as=new Map;for(let ls of Z.errors?.groups??[])ls.project&&(ls.ongoing||Z.now-ls.lastSeenAt<=15*6e4)&&as.set(ls.project,(as.get(ls.project)??0)+1);return(0,F.jsx)(L,{kicker:"Services",title:`${K.length} service${K.length===1?"":"s"}`,pad:!1,children:(0,F.jsx)("div",{className:"tbl-scroll",children:(0,F.jsxs)("table",{className:"tbl services",children:[(0,F.jsx)("thead",{children:(0,F.jsxs)("tr",{children:[(0,F.jsx)("th",{children:"Service"}),(0,F.jsx)("th",{children:"State"}),(0,F.jsxs)("th",{children:["Pods ",(0,F.jsx)(Bt,{term:"pod"})]}),(0,F.jsx)("th",{children:"Host"}),(0,F.jsxs)("th",{className:"num",children:["Req / 60 s ",(0,F.jsx)(Bt,{term:"req60"})]}),(0,F.jsx)("th",{children:"Traffic (5 min)"}),(0,F.jsxs)("th",{className:"num",children:["p95 ",(0,F.jsx)(Bt,{term:"p95"})]}),(0,F.jsx)("th",{className:"num",children:"Errors"}),(0,F.jsxs)("th",{className:"num",children:["Cold start ",(0,F.jsx)(Bt,{term:"cold-start"})]}),(0,F.jsxs)("th",{className:"num",children:["Memory ",(0,F.jsx)(Bt,{term:"pod-memory"})]}),(0,F.jsx)("th",{})]})}),(0,F.jsx)("tbody",{children:K.map(ls=>{let os=ts===ls.project;return(0,F.jsxs)(M.Fragment,{children:[(0,F.jsxs)("tr",{className:`svc-row${os?" open":""}${Z.route.svc===ls.project?" focused":""}`,onClick:Y(()=>ns(os?null:ls.project),"onClick"),...Z.route.svc===ls.project?{ref:rs}:{},children:[(0,F.jsx)("td",{children:(0,F.jsxs)("div",{className:"svc-name",children:[(0,F.jsx)("span",{className:"mono strong",children:ls.project}),as.get(ls.project)?(0,F.jsxs)("button",{type:"button",className:"svc-err",onClick:Y(cs=>{cs.stopPropagation(),Qe(ls.project)},"onClick"),"data-tip":`Errors in ${ls.project} in the last 15 minutes`,children:["\u2717 ",as.get(ls.project)," error",as.get(ls.project)===1?"":"s"]}):null,(0,F.jsx)(Yt,{tip:ls.kind==="web"?"A frontend dev server (Vite) the gateway routes the app host to.":ls.kind==="eager"?"Always warm: started with the cluster and kept running.":"Scales from zero: started on its first request, stopped when idle.",children:ls.kind==="web"?"frontend":ls.kind==="eager"?"always warm":"scales from zero"}),ls.buildFailed?(0,F.jsx)(Yt,{tone:"bad",children:"build failed"}):null,ls.processError?(0,F.jsx)(Yt,{tone:"bad",children:"process error"}):null,ls.typeErrors?(0,F.jsx)(Yt,{tone:"warn",tip:"Its type check reports errors. The bundle built and the service still answers.",children:"type errors"}):null]})}),(0,F.jsx)("td",{children:(0,F.jsx)(Ut,{state:ls.state,...ls.stateReason?{reason:ls.stateReason}:{}})}),(0,F.jsx)("td",{className:"mono",children:ls.kind==="web"?"\u2014":(0,F.jsx)(po,{s:ls})}),(0,F.jsx)("td",{className:"mono host",children:ls.host?`${ls.host}${ls.path??""}`:"\u2014"}),(0,F.jsx)("td",{className:"num mono",children:ls.window?z(ls.window.req60):"\u2014"}),(0,F.jsx)("td",{children:ls.window?(0,F.jsx)(ur,{values:ls.window.spark,width:96,height:22,label:`${ls.project} requests`,format:Y(cs=>`${z(cs)} req`,"format"),bucketSec:Z.kpis?.sparkBucketSec??10}):(0,F.jsx)("span",{className:"muted",children:"\u2014"})}),(0,F.jsx)("td",{className:"num mono",children:ls.window?.p95==null?ls.traffic.avgMs==null?"\u2014":(0,F.jsxs)("span",{"data-tip":"No per-request samples \u2014 this is the latest window's average",children:["~",R(ls.traffic.avgMs)]}):R(ls.window.p95)}),(0,F.jsxs)("td",{className:`num mono${ls.traffic.errors?" bad-ink":""}`,children:[z(ls.traffic.errors),ls.traffic.count?(0,F.jsxs)("span",{className:"muted",children:[" \xB7 ",en(ls.traffic.errors/ls.traffic.count)]}):null]}),(0,F.jsx)("td",{className:"num mono",children:ls.lastColdStartMs===void 0?"\u2014":R(ls.lastColdStartMs)}),(0,F.jsx)("td",{className:"num mono",children:ls.kind==="web"?"\u2014":(0,F.jsx)(fo,{s:ls})}),(0,F.jsx)("td",{className:"expand","aria-hidden":"true",children:(0,F.jsx)(Pt,{size:14,className:os?"rot":""})})]}),os?(0,F.jsx)("tr",{className:"svc-detail",children:(0,F.jsx)("td",{colSpan:11,children:(0,F.jsx)(mo,{s:ls})})}):null]},ls.project)})})]})})})}Y(uo,"uo");function fo({s:K}){let Z=K.memory;return Z?(0,F.jsxs)("span",{className:"memcell","data-tip":`${rn(Z.live)} live after a full GC \xB7 ${rn(Z.reserved)} reserved \xB7 rss ${rn(Z.rss)}${Z.baseline?` \xB7 booted at ${rn(Z.baseline)}`:""} \xB7 ${Z.swaps} swap${Z.swaps===1?"":"s"} \xB7 ${Z.pods} pod${Z.pods===1?"":"s"} \xB7 last reading: ${Z.trigger}`,children:[rn(Z.live),(0,F.jsxs)("span",{className:"muted",children:[" / ",rn(Z.reserved)]}),Z.swaps?(0,F.jsxs)("span",{className:"muted",children:[" \xB7 ",Z.swaps,"\u21BB"]}):null,Z.retained.length?(0,F.jsxs)(F.Fragment,{children:[" ",(0,F.jsx)(Yt,{tone:"bad",tip:`Closed hot-swap generation${Z.retained.length===1?"":"s"} still in memory: ${Z.retained.map(ts=>`pod #${ts.pod} gen ${ts.gen}, ${Math.round(ts.ageMs/6e4)} min after close`).join("; ")}. See \`lensmcp mem ${Z.service??K.project} --snapshot --analyze\`.`,children:"retained"})]}):null]}):(0,F.jsx)("span",{className:"muted","data-tip":"No pod has reported its heap yet \u2014 pods report at boot and after every hot swap.",children:"\u2014"})}Y(fo,"fo");function po({s:K}){let Z=K.pods.max??Math.max(1,K.pods.running),ts=Math.min(100,K.pods.running/Math.max(1,Z)*100);return(0,F.jsxs)("span",{className:"podmeter","data-tip":`${K.pods.running} running${K.pods.min===void 0?"":` \xB7 autoscale ${K.pods.min}\u2013${Z}`}${K.pods.names.length?` \xB7 ${K.pods.names.join(", ")}`:""}`,children:[(0,F.jsx)("span",{className:"podmeter-n",children:K.pods.running}),K.pods.min===void 0?null:(0,F.jsxs)("span",{className:"muted",children:["/",K.pods.min,"\u2013",Z]}),(0,F.jsx)("span",{className:"podmeter-track",children:(0,F.jsx)("span",{style:{width:`${ts}%`}})})]})}Y(po,"po");function mo({s:K}){let Z=N(P);return(0,F.jsxs)("div",{className:"svc-more",children:[(0,F.jsxs)("dl",{className:"kv",children:[K.stateReason?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("dt",{children:"State"}),(0,F.jsx)("dd",{children:K.stateReason})]}):null,K.host?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("dt",{children:"Public route"}),(0,F.jsxs)("dd",{className:"mono",children:["https://",K.host,K.path??""," ",(0,F.jsx)("a",{className:"link",href:`https://${K.host}${K.path??""}`,target:"_blank",rel:"noreferrer",children:(0,F.jsx)(Ot,{size:12})})]})]}):null,K.internalHost?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)("dt",{children:["Internal host ",(0,F.jsx)(Bt,{term:"east-west"})]}),(0,F.jsx)("dd",{className:"mono",children:K.internalHost})]}):null,K.port===void 0?null:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("dt",{children:"Dev server port"}),(0,F.jsxs)("dd",{className:"mono",children:[K.port,K.internalPort===void 0?"":` (debug ${K.internalPort})`]})]}),K.pods.names.length?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("dt",{children:"Pods"}),(0,F.jsx)("dd",{className:"mono",children:K.pods.names.join(", ")})]}):null,K.workers.length?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("dt",{children:"Workers"}),(0,F.jsx)("dd",{className:"mono",children:K.workers.join(", ")})]}):null,K.auth?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("dt",{children:"Auth"}),(0,F.jsxs)("dd",{className:"mono",children:[K.auth.default??"default",K.auth.overrides?` \xB7 ${K.auth.overrides} override${K.auth.overrides===1?"":"s"}`:""]})]}):null,K.keyFingerprint?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("dt",{children:"Service key"}),(0,F.jsxs)("dd",{className:"mono","data-tip":"A fingerprint of the east-west key \u2014 never the key itself. It changes when the key rotates.",children:["#",K.keyFingerprint]})]}):null,(0,F.jsx)("dt",{children:"Restarts"}),(0,F.jsx)("dd",{className:"mono",children:K.restarts}),K.memory?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)("dt",{children:["Memory ",(0,F.jsx)(Bt,{term:"pod-memory"})]}),(0,F.jsxs)("dd",{className:"mono",children:[rn(K.memory.live)," live \xB7 ",rn(K.memory.reserved)," reserved \xB7 rss ",rn(K.memory.rss),K.memory.baseline?` \xB7 booted at ${rn(K.memory.baseline)} (${(K.memory.live/K.memory.baseline).toFixed(1)}\xD7)`:"",` \xB7 ${K.memory.swaps} swap${K.memory.swaps===1?"":"s"} \xB7 `,(0,F.jsx)($t,{at:K.memory.at,now:Z.now})]}),K.memory.retained.length?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("dt",{children:"Retained"}),(0,F.jsxs)("dd",{className:"bad-ink",children:[K.memory.retained.map(ts=>`pod #${ts.pod} generation ${ts.gen} (closed ${Math.round(ts.ageMs/6e4)} min ago)`).join(" \xB7 ")," \u2014 ",(0,F.jsxs)("code",{children:["lensmcp mem ",K.memory.service??K.project," --snapshot --analyze"]})]})]}):null]}):null,K.traffic.lastSeenAt?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("dt",{children:"Last request"}),(0,F.jsx)("dd",{children:(0,F.jsx)($t,{at:K.traffic.lastSeenAt,now:Z.now})})]}):null,K.lastEvent?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("dt",{children:"Last event"}),(0,F.jsxs)("dd",{children:[K.lastEvent.title," \xB7 ",(0,F.jsx)($t,{at:K.lastEvent.at,now:Z.now})]})]}):null]}),K.errorLines.length?(0,F.jsxs)("div",{children:[(0,F.jsx)("div",{className:"kicker",children:"Last error output"}),(0,F.jsx)("pre",{className:"code",children:K.errorLines.join(`
|
|
16
16
|
`)})]}):null,(0,F.jsxs)("div",{className:"svc-actions",children:[(0,F.jsxs)("button",{type:"button",className:"btn btn-sm",onClick:Y(()=>Qe(K.project),"onClick"),children:["\u2717 Errors in ",K.project]}),(0,F.jsxs)("button",{type:"button",className:"btn btn-sm",onClick:Y(()=>{P.ui.listQuery=K.project,P.ui.listFilter="all",Ye("flows")},"onClick"),children:["Flows through ",K.project]}),(0,F.jsxs)("button",{type:"button",className:"btn btn-sm",onClick:Y(()=>tt({q:K.project}),"onClick"),children:[(0,F.jsx)(gt,{size:13})," Logs mentioning ",K.project]})]})]})}Y(mo,"mo");function ho({c:K}){let Z=N(P);return(0,F.jsx)(L,{kicker:"Routes",title:"Public hosts \u2192 services",pad:!1,children:(0,F.jsxs)("table",{className:"tbl compact",children:[(0,F.jsx)("thead",{children:(0,F.jsxs)("tr",{children:[(0,F.jsx)("th",{children:"Host"}),(0,F.jsx)("th",{children:"Service"}),(0,F.jsx)("th",{className:"num",children:"Requests"}),(0,F.jsx)("th",{className:"num",children:"Avg"}),(0,F.jsx)("th",{className:"num",children:"Errors"}),(0,F.jsx)("th",{className:"num",children:"Last"})]})}),(0,F.jsx)("tbody",{children:K.routes.map(ts=>(0,F.jsxs)("tr",{children:[(0,F.jsx)("td",{className:"mono",children:ts.host}),(0,F.jsx)("td",{className:"mono",children:ts.project}),(0,F.jsx)("td",{className:"num mono",children:z(ts.count)}),(0,F.jsx)("td",{className:"num mono",children:ts.avgMs===null?"\u2014":R(ts.avgMs)}),(0,F.jsx)("td",{className:`num mono${ts.errors?" bad-ink":""}`,children:z(ts.errors)}),(0,F.jsx)("td",{className:"num",children:(0,F.jsx)($t,{at:ts.lastSeenAt,now:Z.now})})]},`${ts.host}\u2192${ts.project}`))})]})})}Y(ho,"ho");function go({c:K}){let Z=N(P);return(0,F.jsx)(L,{kicker:"Service \u2192 service",title:"East-west calls",actions:(0,F.jsx)(Bt,{term:"east-west"}),pad:!1,children:K.edges.length?(0,F.jsxs)("table",{className:"tbl compact",children:[(0,F.jsx)("thead",{children:(0,F.jsxs)("tr",{children:[(0,F.jsx)("th",{children:"Caller \u2192 callee"}),(0,F.jsx)("th",{className:"num",children:"Calls"}),(0,F.jsx)("th",{className:"num",children:"Avg"}),(0,F.jsx)("th",{className:"num",children:"Errors"}),(0,F.jsx)("th",{className:"num",children:"Last"})]})}),(0,F.jsx)("tbody",{children:K.edges.map(ts=>(0,F.jsxs)("tr",{children:[(0,F.jsxs)("td",{className:"mono",children:[ts.caller," \u2192 ",ts.callee]}),(0,F.jsx)("td",{className:"num mono",children:z(ts.count)}),(0,F.jsx)("td",{className:"num mono",children:ts.avgMs===null?"\u2014":R(ts.avgMs)}),(0,F.jsx)("td",{className:`num mono${ts.errors?" bad-ink":""}`,children:z(ts.errors)}),(0,F.jsx)("td",{className:"num",children:(0,F.jsx)($t,{at:ts.lastSeenAt,now:Z.now})})]},`${ts.caller}\u2192${ts.callee}`))})]}):(0,F.jsx)(Qt,{compact:!0,title:"No service-to-service calls yet"})})}Y(go,"go");function _o({c:K}){let Z=N(P);return(0,F.jsx)(L,{kicker:"Data",title:"Databases, caches, queues, external APIs",pad:!1,children:K.backends.length?(0,F.jsx)("ul",{className:"backends",children:K.backends.map(ts=>(0,F.jsxs)("li",{children:[(0,F.jsxs)("div",{className:"be-top",children:[(0,F.jsx)("span",{className:"be-kind",children:so(ts.kind)}),(0,F.jsx)("span",{className:"mono strong",children:ts.name}),(0,F.jsx)("span",{className:"muted",children:ts.usedBy.length?`used by ${ts.usedBy.join(", ")}`:""}),(0,F.jsxs)("span",{className:"mono be-ops",children:[z(ts.ops)," ops"]}),(0,F.jsx)($t,{at:ts.lastSeenAt,now:Z.now})]}),ts.queue?(0,F.jsxs)("div",{className:"be-queue",children:[Object.entries(ts.queue.counts).filter(([,ns])=>ns>0||["active","waiting","failed"].includes("")).map(([ns,rs])=>(0,F.jsxs)("span",{className:`qcount q-${ns}`,children:[(0,F.jsx)("strong",{className:"mono",children:z(rs)})," ",ns]},ns)),ts.queue.recent.length?(0,F.jsxs)("span",{className:"muted mono",children:["recent: ",ts.queue.recent.slice(0,4).map(ns=>`${ns.name??"job"}#${ns.id}${ns.state?` ${ns.state}`:""}`).join(" \xB7 ")]}):null]}):null]},ts.id))}):(0,F.jsx)(Qt,{compact:!0,title:"No data backends seen yet",children:"They appear the first time a service queries a database, cache, queue or external API."})})}Y(_o,"_o");function vo({c:K}){let Z=K.hosts.filter(ts=>!ts.v4||!ts.v6);return(0,F.jsxs)(L,{kicker:"Setup",title:Z.length?`${Z.length} host${Z.length===1?"":"s"} not resolving`:"Hosts resolve locally",pad:!1,children:[(0,F.jsxs)("table",{className:"tbl compact",children:[(0,F.jsx)("thead",{children:(0,F.jsxs)("tr",{children:[(0,F.jsx)("th",{children:"Host"}),(0,F.jsx)("th",{children:"IPv4"}),(0,F.jsx)("th",{children:"IPv6"})]})}),(0,F.jsx)("tbody",{children:K.hosts.map(ts=>(0,F.jsxs)("tr",{children:[(0,F.jsx)("td",{className:"mono",children:ts.host}),(0,F.jsxs)("td",{children:[(0,F.jsx)(Vt,{tone:ts.v4?"ok":"bad"})," ",ts.v4?"ok":"missing"]}),(0,F.jsxs)("td",{children:[(0,F.jsx)(Vt,{tone:ts.v6?"ok":"bad"})," ",ts.v6?"ok":"missing"]})]},ts.host))})]}),(0,F.jsxs)("div",{className:"pad setup-cmds",children:[K.hostsFix?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("div",{className:"kicker",children:"Add the missing hosts"}),(0,F.jsx)(Zt,{cmd:K.hostsFix})]}):null,(0,F.jsx)("div",{className:"kicker",children:"Trust the local CA and write every host (once, needs sudo)"}),(0,F.jsx)(Zt,{cmd:K.trustCommand}),(0,F.jsxs)("p",{className:"muted small",children:["Service keys are shown as fingerprints only ",(0,F.jsx)(Xt,{text:K.services.filter(ts=>ts.keyFingerprint).map(ts=>`${ts.project} #${ts.keyFingerprint}`).join(`
|
|
17
|
-
`),label:"Copy fingerprints"})]})]})]})}Y(vo,"vo");function yo({c:K}){let Z=N(P);return K.recent.length?(0,F.jsx)(L,{kicker:"Gateway",title:"Recent cluster events",pad:!1,children:(0,F.jsx)("ul",{className:"activity activity-2",children:K.recent.slice(0,12).map((ts,ns)=>(0,F.jsxs)("li",{className:`sev-row-${ts.severity}`,children:[(0,F.jsx)("span",{className:"muted",children:(0,F.jsx)($t,{at:ts.at,now:Z.now})}),(0,F.jsx)("span",{className:"activity-title",children:ts.title})]},ns))})}):null}Y(yo,"yo");var bo=[["overview","Overview","is anything wrong right now?"],["errors","Errors","what broke, where, and how often"],["flows","Flows","what one action did, step by step"],["performance","Performance","what is slow or wasteful"],["cluster","Cluster","services, pods, routes, DNS"]];function xo(K,Z){if(!Z.length)return 1;let ts=K.toLowerCase(),ns=0;for(let rs of Z){let as=ts.indexOf(rs);if(as<0)return 0;ns+=as===0?3:ts[as-1]===" "||ts[as-1]==="/"?2:1}return ns}Y(xo,"xo");function So(){let K=N(P),[Z,ts]=(0,M.useState)(""),[ns,rs]=(0,M.useState)(0),as=(0,M.useRef)(null),ls=(0,M.useRef)(null);(0,M.useEffect)(()=>as.current?.focus(),[]);let os=Y(()=>P.ui.paletteOpen=!1,"s"),cs=(0,M.useMemo)(()=>{let vs=[];for(let[Ss,qs,Bs]of bo)vs.push({group:"Go to",label:qs,sub:Bs,run:Y(()=>Ye(Ss),"run")});for(let Ss of K.errors?.groups??[])vs.push({group:"Errors",label:Ss.title,sub:`${Ss.where??Ss.kind} \xB7 \xD7${Ss.count}`,tone:Ss.ongoing||K.now-Ss.lastSeenAt<15*6e4?"bad":void 0,run:Y(()=>Ze(Ss.id),"run")});for(let Ss of K.flows)vs.push({group:"Flows",label:Ss.headline,sub:`${Ss.flowId}${Ss.firstError?` \xB7 \u2717 ${Ss.firstError}`:""}`,tone:Ss.worst==="error"?"bad":Ss.worst==="warn"?"warn":void 0,run:Y(()=>Xe(Ss.flowId),"run")});for(let Ss of K.cluster?.services??[])vs.push({group:"Services",label:Ss.project,sub:[Ss.host?`${Ss.host}${Ss.path??""}`:"",Ss.state].filter(Boolean).join(" \xB7 "),tone:Ss.state==="down"||Ss.state==="crash-looping"||Ss.state==="wedged"?"bad":void 0,run:Y(()=>$e(Ss.project),"run")});vs.push({group:"Actions",label:"Toggle the logs drawer",sub:"l",run:rt}),vs.push({group:"Actions",label:"Open raw signals",sub:"r",run:Y(()=>at(""),"run")}),vs.push({group:"Actions",label:"Switch theme",sub:"t",run:dt}),vs.push({group:"Actions",label:"Help and shortcuts",sub:"?",run:Y(()=>P.ui.helpOpen=!0,"run")});let ks=Z.toLowerCase().split(/\s+/).filter(Boolean),ms=vs.map((Ss,qs)=>({it:Ss,i:qs,s:xo(`${Ss.label} ${Ss.sub??""}`,ks)})).filter(Ss=>Ss.s>0);ks.length&&ms.sort((Ss,qs)=>qs.s-Ss.s||Ss.i-qs.i);let Fs=ks.length?40:6,ws=new Map;return ms.filter(({it:Ss})=>{let qs=ws.get(Ss.group)??0;return ws.set(Ss.group,qs+1),qs<Fs}).map(Ss=>Ss.it).sort((Ss,qs)=>Co.indexOf(Ss.group)-Co.indexOf(qs.group))},[Z,K.errors,K.flows,K.cluster,K.now]);(0,M.useEffect)(()=>rs(0),[Z]),(0,M.useEffect)(()=>{ls.current?.querySelector('[aria-selected="true"]')?.scrollIntoView({block:"nearest"})},[ns]);let us=Y(vs=>{vs&&(os(),vs.run())},"l"),fs="";return(0,F.jsx)("div",{className:"modal-back",onClick:os,children:(0,F.jsxs)("div",{className:"palette",role:"dialog","aria-modal":"true","aria-label":"Jump to",onClick:Y(vs=>vs.stopPropagation(),"onClick"),children:[(0,F.jsxs)("label",{className:"palette-input",children:[(0,F.jsx)(kt,{size:16}),(0,F.jsx)("input",{ref:as,value:Z,onChange:Y(vs=>ts(vs.target.value),"onChange"),placeholder:"Jump to an error, a flow, a service, a screen\u2026","aria-label":"Search","aria-controls":"palette-list","aria-activedescendant":cs[ns]?`pi-${ns}`:void 0,onKeyDown:Y(vs=>{vs.key==="ArrowDown"?(rs(ks=>Math.min(cs.length-1,ks+1)),vs.preventDefault()):vs.key==="ArrowUp"?(rs(ks=>Math.max(0,ks-1)),vs.preventDefault()):vs.key==="Enter"?(us(cs[ns]),vs.preventDefault()):vs.key==="Escape"&&(os(),vs.preventDefault())},"onKeyDown")}),(0,F.jsx)("kbd",{className:"kbd",children:"esc"})]}),(0,F.jsxs)("ul",{className:"palette-list",id:"palette-list",role:"listbox",ref:ls,children:[cs.map((vs,ks)=>{let ms=vs.group===fs?null:vs.group;return fs=vs.group,(0,F.jsxs)("li",{role:"presentation",children:[ms?(0,F.jsx)("div",{className:"palette-group",children:ms}):null,(0,F.jsxs)("button",{type:"button",id:`pi-${ks}`,role:"option","aria-selected":ks===ns,className:`palette-item${ks===ns?" active":""}${vs.tone?` tone-${vs.tone}`:""}`,onMouseMove:Y(()=>rs(ks),"onMouseMove"),onClick:Y(()=>us(vs),"onClick"),children:[(0,F.jsxs)("span",{className:"palette-label",children:[vs.tone==="bad"?(0,F.jsx)("span",{className:"palette-x",children:"\u2717"}):null,vs.label]}),vs.sub?(0,F.jsx)("span",{className:"palette-sub",children:vs.sub}):null]})]},`${vs.group}-${ks}`)}),cs.length?null:(0,F.jsxs)("li",{className:"palette-none",children:["Nothing matches \u201C",Z,"\u201D."]})]}),(0,F.jsxs)("div",{className:"palette-foot",children:[(0,F.jsx)("kbd",{className:"kbd",children:"\u2191\u2193"})," move ",(0,F.jsx)("kbd",{className:"kbd",children:"\u21B5"})," open ",(0,F.jsx)("kbd",{className:"kbd",children:"esc"})," close"]})]})})}Y(So,"So");var Co=["Go to","Errors","Flows","Services","Actions"],wo=26;function To(){let K=N(P),Z=K.ui.logFilter,ts=K.route.logs?.flow,ns=K.route.logs?.q,[rs,as]=(0,M.useState)(null),[ls,os]=(0,M.useState)(null);(0,M.useEffect)(()=>{ns!==void 0&&(P.ui.logFilter.text=ns)},[ns]),(0,M.useEffect)(()=>{if(!ts){as(null);return}let vs=!1;return On(ts).then(ks=>!vs&&as(ks),()=>!vs&&as([])),()=>{vs=!0}},[ts,ts?K.logs.seq:0]);let cs=ts?rs??[]:K.logs.lines,us=(0,M.useMemo)(()=>Ga(cs,{source:Z.source,text:Z.text,regex:Z.regex,errorsOnly:Z.errorsOnly}),[cs,Z.source,Z.text,Z.regex,Z.errorsOnly]),fs=ts?K.flows.find(vs=>vs.flowId===ts)?.headline??ts:void 0;return(0,F.jsxs)("section",{className:"logs","aria-label":"Logs",children:[(0,F.jsxs)("header",{className:"logs-head",children:[(0,F.jsxs)("div",{className:"logs-title",children:[(0,F.jsx)("span",{className:"dot dot-ok pulse","aria-hidden":"true"}),(0,F.jsx)("h2",{children:"Logs"}),(0,F.jsxs)("span",{className:"muted mono",children:[us.rows.length.toLocaleString()," rows \xB7 ",cs.length.toLocaleString()," lines"]})]}),(0,F.jsxs)("div",{className:"logs-controls",children:[(0,F.jsxs)("select",{value:Z.source,onChange:Y(vs=>P.ui.logFilter.source=vs.target.value,"onChange"),"aria-label":"Service",children:[(0,F.jsx)("option",{value:"all",children:"All sources"}),K.logs.sources.map(vs=>(0,F.jsx)("option",{value:vs,children:vs},vs))]}),(0,F.jsxs)("label",{className:`search${us.regexError?" invalid":""}`,children:[(0,F.jsx)(kt,{size:14}),(0,F.jsx)("input",{type:"search",value:Z.text,placeholder:Z.regex?"regular expression\u2026":"filter text, route, flow id\u2026",onChange:Y(vs=>P.ui.logFilter.text=vs.target.value,"onChange"),"aria-label":"Filter logs","aria-invalid":!!us.regexError}),(0,F.jsx)("button",{type:"button",className:`regex${Z.regex?" on":""}`,onClick:Y(()=>P.ui.logFilter.regex=!Z.regex,"onClick"),"aria-pressed":Z.regex,"data-tip":"Treat the filter as a regular expression",children:".*"})]}),us.regexError?(0,F.jsxs)("span",{className:"bad-ink small",role:"alert",children:["regex: ",us.regexError]}):null,(0,F.jsxs)("label",{className:"toggle",children:[(0,F.jsx)("input",{type:"checkbox",checked:Z.errorsOnly,onChange:Y(vs=>P.ui.logFilter.errorsOnly=vs.target.checked,"onChange")}),(0,F.jsx)("span",{children:"Errors & warnings"})]}),ts?(0,F.jsxs)("span",{className:"flow-pill","data-tip":ts,children:["flow: ",fs&&fs.length>42?`${fs.slice(0,41)}\u2026`:fs,(0,F.jsx)("button",{type:"button",onClick:Y(()=>it(void 0),"onClick"),"aria-label":"Stop filtering by flow",children:(0,F.jsx)(Tt,{size:12})})]}):null,(0,F.jsxs)("label",{className:"toggle","data-tip":"Keep the newest line in view",children:[(0,F.jsx)("input",{type:"checkbox",checked:K.ui.follow,onChange:Y(vs=>P.ui.follow=vs.target.checked,"onChange")}),(0,F.jsx)("span",{children:"Follow"})]}),(0,F.jsx)("button",{type:"button",className:"btn btn-quiet btn-icon",onClick:nt,"aria-label":"Close logs (Esc)",children:(0,F.jsx)(Tt,{})})]})]}),(0,F.jsx)(Eo,{rows:us.rows,follow:K.ui.follow,expanded:ls,onExpand:os,emptyText:ts&&rs!==null&&rs.length===0?"No log lines for this flow in the lens\u2019s window (the most recent 5,000 events). An older flow keeps its trace, not its log lines.":ts&&rs===null?"Loading this flow\u2019s lines\u2026":cs.length===0?"No events yet \u2014 every event the lens receives appears here.":"No lines match the filter."})]})}Y(To,"To");function Eo({rows:K,follow:Z,expanded:ts,onExpand:ns,emptyText:rs}){let as=(0,M.useRef)(null),[ls,os]=(0,M.useState)({top:0,h:300});(0,M.useEffect)(()=>{let ks=as.current;if(!ks)return;let ms=Y(()=>os({top:ks.scrollTop,h:ks.clientHeight}),"t");ms(),ks.addEventListener("scroll",ms,{passive:!0});let Fs=new ResizeObserver(ms);return Fs.observe(ks),()=>{ks.removeEventListener("scroll",ms),Fs.disconnect()}},[]),(0,M.useLayoutEffect)(()=>{let ks=as.current;!ks||!Z||(ks.scrollTop=ks.scrollHeight,os({top:ks.scrollTop,h:ks.clientHeight}))},[K.length,Z]);let cs=ts===null?0:120,us=Math.max(0,Math.floor(ls.top/wo)-10),fs=Math.min(K.length,Math.ceil((ls.top+ls.h)/wo)+10),vs=K.slice(us,fs);return(0,F.jsxs)("div",{className:"logs-list",ref:as,role:"log","aria-live":"off",children:[K.length?null:(0,F.jsx)("div",{className:"logs-empty muted",children:rs}),(0,F.jsx)("div",{style:{height:K.length*wo+cs,position:"relative"},children:(0,F.jsx)("div",{style:{position:"absolute",top:us*wo,left:0,right:0},children:vs.map(ks=>{let ms=ks.line,Fs=ts===ms.seq;return(0,F.jsxs)("div",{className:`logrow sev-row-${ms.severity}${Fs?" open":""}`,children:[(0,F.jsxs)("button",{type:"button",className:"logrow-main",onClick:Y(()=>ns(Fs?null:ms.seq),"onClick"),"aria-expanded":Fs,children:[(0,F.jsx)("span",{className:"mono muted logrow-t",children:nn(ms.at,!0)}),(0,F.jsx)("span",{className:"mono logrow-src",children:ms.source}),(0,F.jsx)("span",{className:`logrow-sev sev-word-${ms.severity}`,children:ms.severity==="warning"?"warn":ms.severity}),(0,F.jsxs)("span",{className:"logrow-title",children:[ms.title,ms.message&&ms.message!==ms.title?(0,F.jsxs)("span",{className:"muted",children:[" \u2014 ",ms.message]}):null]}),ks.repeat>1?(0,F.jsxs)("span",{className:"repeat mono","data-tip":`${ks.repeat} identical lines in a row`,children:["\xD7",ks.repeat]}):null]}),ms.flowId?(0,F.jsx)("button",{type:"button",className:"logrow-flow mono",onClick:Y(()=>Xe(ms.flowId),"onClick"),"data-tip":`Open flow ${ms.flowId}`,children:"flow \u2192"}):(0,F.jsx)("span",{className:"logrow-flow"}),Fs?(0,F.jsxs)("div",{className:"logrow-more mono",children:[(0,F.jsxs)("div",{children:[(0,F.jsx)("span",{className:"muted",children:"at"})," ",new Date(ms.at).toISOString()]}),(0,F.jsxs)("div",{children:[(0,F.jsx)("span",{className:"muted",children:"category"})," ",ms.category]}),ms.flowId?(0,F.jsxs)("div",{children:[(0,F.jsx)("span",{className:"muted",children:"flow"})," ",ms.flowId]}):null,ms.message?(0,F.jsx)("pre",{children:ms.message}):null]}):null]},ms.seq)})})})]})}Y(Eo,"Eo");var Do=4e5,Oo={agent:"the overall verdict",flow:"causal traces",story:"narratives",trace:"spans",perf:"timing",db:"queries",net:"outbound HTTP",runtime:"errors & console",memory:"heap & leaks",graph:"detectors",react:"renders",valtio:"state",nest:"requests",visual:"screenshots",build:"build & HMR",typecheck:"types",lint:"lint",bundle:"bundle size",browser:"tabs",process:"cluster health",events:"events",render:"render"};function ko(){let K=N(P),Z=K.route.raw??"",ts=K.ui.rawDoc,[ns,rs]=(0,M.useState)([]),[as,ls]=(0,M.useState)(""),[os,cs]=(0,M.useState)(null),[us,fs]=(0,M.useState)(""),[vs,ks]=(0,M.useState)(!1),ms=(0,M.useRef)(null);(0,M.useEffect)(()=>{Le("/api/resources").then(Rs=>rs(Rs.resources),()=>rs([])),ms.current?.focus()},[]);let Fs=Y(Rs=>{Rs&&(ks(!0),fs(""),Le("/api/resource",{uri:Rs}).then(xs=>cs(xs),xs=>fs(xs instanceof Error?xs.message:String(xs))).finally(()=>ks(!1)))},"m");(0,M.useEffect)(()=>{ts||Fs(Z)},[Z,ts]);let ws=(0,M.useMemo)(()=>{let Rs=new Map;for(let xs of ns)as&&!xs.uri.includes(as)||Rs.set(xs.scheme,[...Rs.get(xs.scheme)??[],xs]);return[...Rs.entries()]},[ns,as]),Ss=ts?ts.value:os?.value,qs=(0,M.useMemo)(()=>{if(Ss===void 0)return"";let Rs=JSON.stringify(Ss,null,2)??"";return Rs.length>Do?`${Rs.slice(0,Do)}
|
|
17
|
+
`),label:"Copy fingerprints"})]})]})]})}Y(vo,"vo");function yo({c:K}){let Z=N(P);return K.recent.length?(0,F.jsx)(L,{kicker:"Gateway",title:"Recent cluster events",pad:!1,children:(0,F.jsx)("ul",{className:"activity activity-2",children:K.recent.slice(0,12).map((ts,ns)=>(0,F.jsxs)("li",{className:`sev-row-${ts.severity}`,children:[(0,F.jsx)("span",{className:"muted",children:(0,F.jsx)($t,{at:ts.at,now:Z.now})}),(0,F.jsx)("span",{className:"activity-title",children:ts.title})]},ns))})}):null}Y(yo,"yo");var bo=[["overview","Overview","is anything wrong right now?"],["errors","Errors","what broke, where, and how often"],["flows","Flows","what one action did, step by step"],["performance","Performance","what is slow or wasteful"],["cluster","Cluster","services, pods, routes, DNS"]];function xo(K,Z){if(!Z.length)return 1;let ts=K.toLowerCase(),ns=0;for(let rs of Z){let as=ts.indexOf(rs);if(as<0)return 0;ns+=as===0?3:ts[as-1]===" "||ts[as-1]==="/"?2:1}return ns}Y(xo,"xo");function So(){let K=N(P),[Z,ts]=(0,M.useState)(""),[ns,rs]=(0,M.useState)(0),as=(0,M.useRef)(null),ls=(0,M.useRef)(null);(0,M.useEffect)(()=>as.current?.focus(),[]);let os=Y(()=>P.ui.paletteOpen=!1,"s"),cs=(0,M.useMemo)(()=>{let vs=[];for(let[Ss,qs,Bs]of bo)vs.push({group:"Go to",label:qs,sub:Bs,run:Y(()=>Ye(Ss),"run")});for(let Ss of K.errors?.groups??[])vs.push({group:"Errors",label:Ss.title,sub:`${Ss.where??Ss.kind} \xB7 \xD7${Ss.count}`,tone:Ss.ongoing||K.now-Ss.lastSeenAt<15*6e4?"bad":void 0,run:Y(()=>Ze(Ss.id),"run")});for(let Ss of K.flows)vs.push({group:"Flows",label:Ss.headline,sub:`${Ss.flowId}${Ss.firstError?` \xB7 \u2717 ${Ss.firstError}`:""}`,tone:Ss.worst==="error"?"bad":Ss.worst==="warn"?"warn":void 0,run:Y(()=>Xe(Ss.flowId),"run")});for(let Ss of K.cluster?.services??[])vs.push({group:"Services",label:Ss.project,sub:[Ss.host?`${Ss.host}${Ss.path??""}`:"",Ss.state].filter(Boolean).join(" \xB7 "),tone:Ss.state==="down"||Ss.state==="crash-looping"||Ss.state==="wedged"?"bad":void 0,run:Y(()=>$e(Ss.project),"run")});vs.push({group:"Actions",label:"Toggle the logs drawer",sub:"l",run:rt}),vs.push({group:"Actions",label:"Open raw signals",sub:"r",run:Y(()=>at(""),"run")}),vs.push({group:"Actions",label:"Switch theme",sub:"t",run:dt}),vs.push({group:"Actions",label:"Help and shortcuts",sub:"?",run:Y(()=>P.ui.helpOpen=!0,"run")});let ks=Z.toLowerCase().split(/\s+/).filter(Boolean),ms=vs.map((Ss,qs)=>({it:Ss,i:qs,s:xo(`${Ss.label} ${Ss.sub??""}`,ks)})).filter(Ss=>Ss.s>0);ks.length&&ms.sort((Ss,qs)=>qs.s-Ss.s||Ss.i-qs.i);let Fs=ks.length?40:6,ws=new Map;return ms.filter(({it:Ss})=>{let qs=ws.get(Ss.group)??0;return ws.set(Ss.group,qs+1),qs<Fs}).map(Ss=>Ss.it).sort((Ss,qs)=>Co.indexOf(Ss.group)-Co.indexOf(qs.group))},[Z,K.errors,K.flows,K.cluster,K.now]);(0,M.useEffect)(()=>rs(0),[Z]),(0,M.useEffect)(()=>{ls.current?.querySelector('[aria-selected="true"]')?.scrollIntoView({block:"nearest"})},[ns]);let us=Y(vs=>{vs&&(os(),vs.run())},"l"),fs="";return(0,F.jsx)("div",{className:"modal-back",onClick:os,children:(0,F.jsxs)("div",{className:"palette",role:"dialog","aria-modal":"true","aria-label":"Jump to",onClick:Y(vs=>vs.stopPropagation(),"onClick"),children:[(0,F.jsxs)("label",{className:"palette-input",children:[(0,F.jsx)(kt,{size:16}),(0,F.jsx)("input",{ref:as,value:Z,onChange:Y(vs=>ts(vs.target.value),"onChange"),placeholder:"Jump to an error, a flow, a service, a screen\u2026","aria-label":"Search","aria-controls":"palette-list","aria-activedescendant":cs[ns]?`pi-${ns}`:void 0,onKeyDown:Y(vs=>{vs.key==="ArrowDown"?(rs(ks=>Math.min(cs.length-1,ks+1)),vs.preventDefault()):vs.key==="ArrowUp"?(rs(ks=>Math.max(0,ks-1)),vs.preventDefault()):vs.key==="Enter"?(us(cs[ns]),vs.preventDefault()):vs.key==="Escape"&&(os(),vs.preventDefault())},"onKeyDown")}),(0,F.jsx)("kbd",{className:"kbd",children:"esc"})]}),(0,F.jsxs)("ul",{className:"palette-list",id:"palette-list",role:"listbox",ref:ls,children:[cs.map((vs,ks)=>{let ms=vs.group===fs?null:vs.group;return fs=vs.group,(0,F.jsxs)("li",{role:"presentation",children:[ms?(0,F.jsx)("div",{className:"palette-group",children:ms}):null,(0,F.jsxs)("button",{type:"button",id:`pi-${ks}`,role:"option","aria-selected":ks===ns,className:`palette-item${ks===ns?" active":""}${vs.tone?` tone-${vs.tone}`:""}`,onMouseMove:Y(()=>rs(ks),"onMouseMove"),onClick:Y(()=>us(vs),"onClick"),children:[(0,F.jsxs)("span",{className:"palette-label",children:[vs.tone==="bad"?(0,F.jsx)("span",{className:"palette-x",children:"\u2717"}):null,vs.label]}),vs.sub?(0,F.jsx)("span",{className:"palette-sub",children:vs.sub}):null]})]},`${vs.group}-${ks}`)}),cs.length?null:(0,F.jsxs)("li",{className:"palette-none",children:["Nothing matches \u201C",Z,"\u201D."]})]}),(0,F.jsxs)("div",{className:"palette-foot",children:[(0,F.jsx)("kbd",{className:"kbd",children:"\u2191\u2193"})," move ",(0,F.jsx)("kbd",{className:"kbd",children:"\u21B5"})," open ",(0,F.jsx)("kbd",{className:"kbd",children:"esc"})," close"]})]})})}Y(So,"So");var Co=["Go to","Errors","Flows","Services","Actions"],wo=26;function To(){let K=N(P),Z=K.ui.logFilter,ts=K.route.logs?.flow,ns=K.route.logs?.q,[rs,as]=(0,M.useState)(null),[ls,os]=(0,M.useState)(null);(0,M.useEffect)(()=>{ns!==void 0&&(P.ui.logFilter.text=ns)},[ns]),(0,M.useEffect)(()=>{if(!ts){as(null);return}let vs=!1;return On(ts).then(ks=>!vs&&as(ks),()=>!vs&&as([])),()=>{vs=!0}},[ts,ts?K.logs.seq:0]);let cs=ts?rs??[]:K.logs.lines,us=(0,M.useMemo)(()=>Ga(cs,{source:Z.source,text:Z.text,regex:Z.regex,errorsOnly:Z.errorsOnly}),[cs,Z.source,Z.text,Z.regex,Z.errorsOnly]),fs=ts?K.flows.find(vs=>vs.flowId===ts)?.headline??ts:void 0;return(0,F.jsxs)("section",{className:"logs","aria-label":"Logs",children:[(0,F.jsxs)("header",{className:"logs-head",children:[(0,F.jsxs)("div",{className:"logs-title",children:[(0,F.jsx)("span",{className:"dot dot-ok pulse","aria-hidden":"true"}),(0,F.jsx)("h2",{children:"Logs"}),(0,F.jsxs)("span",{className:"muted mono",children:[us.rows.length.toLocaleString()," rows \xB7 ",cs.length.toLocaleString()," lines"]})]}),(0,F.jsxs)("div",{className:"logs-controls",children:[(0,F.jsxs)("select",{value:Z.source,onChange:Y(vs=>P.ui.logFilter.source=vs.target.value,"onChange"),"aria-label":"Service",children:[(0,F.jsx)("option",{value:"all",children:"All sources"}),K.logs.sources.map(vs=>(0,F.jsx)("option",{value:vs,children:vs},vs))]}),(0,F.jsxs)("label",{className:`search${us.regexError?" invalid":""}`,children:[(0,F.jsx)(kt,{size:14}),(0,F.jsx)("input",{type:"search",value:Z.text,placeholder:Z.regex?"regular expression\u2026":"filter text, route, flow id\u2026",onChange:Y(vs=>P.ui.logFilter.text=vs.target.value,"onChange"),"aria-label":"Filter logs","aria-invalid":!!us.regexError}),(0,F.jsx)("button",{type:"button",className:`regex${Z.regex?" on":""}`,onClick:Y(()=>P.ui.logFilter.regex=!Z.regex,"onClick"),"aria-pressed":Z.regex,"data-tip":"Treat the filter as a regular expression",children:".*"})]}),us.regexError?(0,F.jsxs)("span",{className:"bad-ink small",role:"alert",children:["regex: ",us.regexError]}):null,(0,F.jsxs)("label",{className:"toggle",children:[(0,F.jsx)("input",{type:"checkbox",checked:Z.errorsOnly,onChange:Y(vs=>P.ui.logFilter.errorsOnly=vs.target.checked,"onChange")}),(0,F.jsx)("span",{children:"Errors & warnings"})]}),ts?(0,F.jsxs)("span",{className:"flow-pill","data-tip":ts,children:["flow: ",fs&&fs.length>42?`${fs.slice(0,41)}\u2026`:fs,(0,F.jsx)("button",{type:"button",onClick:Y(()=>it(void 0),"onClick"),"aria-label":"Stop filtering by flow",children:(0,F.jsx)(Tt,{size:12})})]}):null,(0,F.jsxs)("label",{className:"toggle","data-tip":"Keep the newest line in view",children:[(0,F.jsx)("input",{type:"checkbox",checked:K.ui.follow,onChange:Y(vs=>P.ui.follow=vs.target.checked,"onChange")}),(0,F.jsx)("span",{children:"Follow"})]}),(0,F.jsx)("button",{type:"button",className:"btn btn-quiet btn-icon",onClick:nt,"aria-label":"Close logs (Esc)",children:(0,F.jsx)(Tt,{})})]})]}),(0,F.jsx)(Eo,{rows:us.rows,follow:K.ui.follow,expanded:ls,onExpand:os,emptyText:ts&&rs!==null&&rs.length===0?"No log lines for this flow in the lens\u2019s window (the most recent 5,000 events). An older flow keeps its trace, not its log lines.":ts&&rs===null?"Loading this flow\u2019s lines\u2026":cs.length===0?"No events yet \u2014 every event the lens receives appears here.":"No lines match the filter."})]})}Y(To,"To");function Eo({rows:K,follow:Z,expanded:ts,onExpand:ns,emptyText:rs}){let as=(0,M.useRef)(null),[ls,os]=(0,M.useState)({top:0,h:300});(0,M.useEffect)(()=>{let ks=as.current;if(!ks)return;let ms=Y(()=>os({top:ks.scrollTop,h:ks.clientHeight}),"t");ms(),ks.addEventListener("scroll",ms,{passive:!0});let Fs=new ResizeObserver(ms);return Fs.observe(ks),()=>{ks.removeEventListener("scroll",ms),Fs.disconnect()}},[]),(0,M.useLayoutEffect)(()=>{let ks=as.current;!ks||!Z||(ks.scrollTop=ks.scrollHeight,os({top:ks.scrollTop,h:ks.clientHeight}))},[K.length,Z]);let cs=ts===null?0:120,us=Math.max(0,Math.floor(ls.top/wo)-10),fs=Math.min(K.length,Math.ceil((ls.top+ls.h)/wo)+10),vs=K.slice(us,fs);return(0,F.jsxs)("div",{className:"logs-list",ref:as,role:"log","aria-live":"off",children:[K.length?null:(0,F.jsx)("div",{className:"logs-empty muted",children:rs}),(0,F.jsx)("div",{style:{height:K.length*wo+cs,position:"relative"},children:(0,F.jsx)("div",{style:{position:"absolute",top:us*wo,left:0,right:0},children:vs.map(ks=>{let ms=ks.line,Fs=ts===ms.seq;return(0,F.jsxs)("div",{className:`logrow sev-row-${ms.severity}${Fs?" open":""}`,children:[(0,F.jsxs)("button",{type:"button",className:"logrow-main",onClick:Y(()=>ns(Fs?null:ms.seq),"onClick"),"aria-expanded":Fs,children:[(0,F.jsx)("span",{className:"mono muted logrow-t",children:nn(ms.at,!0)}),(0,F.jsx)("span",{className:"mono logrow-src",children:ms.source}),(0,F.jsx)("span",{className:`logrow-sev sev-word-${ms.severity}`,children:ms.severity==="warning"?"warn":ms.severity}),(0,F.jsxs)("span",{className:"logrow-title",children:[ms.title,ms.message&&ms.message!==ms.title?(0,F.jsxs)("span",{className:"muted",children:[" \u2014 ",ms.message]}):null]}),ks.repeat>1?(0,F.jsxs)("span",{className:"repeat mono","data-tip":`${ks.repeat} identical lines in a row`,children:["\xD7",ks.repeat]}):null]}),ms.flowId?(0,F.jsx)("button",{type:"button",className:"logrow-flow mono",onClick:Y(()=>Xe(ms.flowId),"onClick"),"data-tip":`Open flow ${ms.flowId}`,children:"flow \u2192"}):(0,F.jsx)("span",{className:"logrow-flow"}),Fs?(0,F.jsxs)("div",{className:"logrow-more mono",children:[(0,F.jsxs)("div",{children:[(0,F.jsx)("span",{className:"muted",children:"at"})," ",new Date(ms.at).toISOString()]}),(0,F.jsxs)("div",{children:[(0,F.jsx)("span",{className:"muted",children:"category"})," ",ms.category]}),ms.flowId?(0,F.jsxs)("div",{children:[(0,F.jsx)("span",{className:"muted",children:"flow"})," ",ms.flowId]}):null,ms.message?(0,F.jsx)("pre",{children:ms.message}):null,ms.detail?(0,F.jsx)("pre",{children:ms.detail}):null]}):null]},ms.seq)})})})]})}Y(Eo,"Eo");var Do=4e5,Oo={agent:"the overall verdict",flow:"causal traces",story:"narratives",trace:"spans",perf:"timing",db:"queries",net:"outbound HTTP",runtime:"errors & console",memory:"heap & leaks",graph:"detectors",react:"renders",valtio:"state",nest:"requests",visual:"screenshots",build:"build & HMR",typecheck:"types",lint:"lint",bundle:"bundle size",browser:"tabs",process:"cluster health",events:"events",render:"render"};function ko(){let K=N(P),Z=K.route.raw??"",ts=K.ui.rawDoc,[ns,rs]=(0,M.useState)([]),[as,ls]=(0,M.useState)(""),[os,cs]=(0,M.useState)(null),[us,fs]=(0,M.useState)(""),[vs,ks]=(0,M.useState)(!1),ms=(0,M.useRef)(null);(0,M.useEffect)(()=>{Le("/api/resources").then(Rs=>rs(Rs.resources),()=>rs([])),ms.current?.focus()},[]);let Fs=Y(Rs=>{Rs&&(ks(!0),fs(""),Le("/api/resource",{uri:Rs}).then(xs=>cs(xs),xs=>fs(xs instanceof Error?xs.message:String(xs))).finally(()=>ks(!1)))},"m");(0,M.useEffect)(()=>{ts||Fs(Z)},[Z,ts]);let ws=(0,M.useMemo)(()=>{let Rs=new Map;for(let xs of ns)as&&!xs.uri.includes(as)||Rs.set(xs.scheme,[...Rs.get(xs.scheme)??[],xs]);return[...Rs.entries()]},[ns,as]),Ss=ts?ts.value:os?.value,qs=(0,M.useMemo)(()=>{if(Ss===void 0)return"";let Rs=JSON.stringify(Ss,null,2)??"";return Rs.length>Do?`${Rs.slice(0,Do)}
|
|
18
18
|
\u2026 (${(Rs.length-Do).toLocaleString()} more characters \u2014 copy to see all)`:Rs},[Ss]),Bs=Y(Rs=>{P.ui.rawDoc=null,Ge({...P.route,raw:Rs},{replace:!0})},"v");return(0,F.jsx)("div",{className:"drawer-back",onClick:st,children:(0,F.jsxs)("aside",{className:"raw",role:"dialog","aria-label":"Raw signals",tabIndex:-1,ref:ms,onClick:Y(Rs=>Rs.stopPropagation(),"onClick"),children:[(0,F.jsxs)("header",{className:"raw-head",children:[(0,F.jsxs)("div",{children:[(0,F.jsx)("h2",{children:"Raw signals"}),(0,F.jsx)("p",{className:"muted small",children:"The live resources your coding agent reads over MCP \u2014 the same truth, unformatted."})]}),(0,F.jsx)("button",{type:"button",className:"btn btn-quiet btn-icon",onClick:st,"aria-label":"Close raw signals (Esc)",children:(0,F.jsx)(Tt,{})})]}),(0,F.jsxs)("div",{className:"raw-body",children:[(0,F.jsxs)("nav",{className:"raw-index","aria-label":"Resources",children:[(0,F.jsxs)("label",{className:"search",children:[(0,F.jsx)(kt,{size:14}),(0,F.jsx)("input",{type:"search",value:as,onChange:Y(Rs=>ls(Rs.target.value),"onChange"),placeholder:"filter uri\u2026","aria-label":"Filter resources"})]}),ws.map(([Rs,xs])=>(0,F.jsxs)("div",{className:"raw-group",children:[(0,F.jsxs)("div",{className:"raw-scheme",children:[(0,F.jsxs)("span",{className:"mono",children:[Rs,"://"]})," ",(0,F.jsx)("span",{className:"muted",children:Oo[Rs]??""})]}),xs.map(As=>(0,F.jsx)("button",{type:"button",className:`raw-uri mono${!ts&&As.uri===Z?" on":""}`,onClick:Y(()=>Bs(As.uri),"onClick"),children:As.uri.slice(Rs.length+3)},As.uri))]},Rs))]}),(0,F.jsxs)("div",{className:"raw-view",children:[(0,F.jsxs)("div",{className:"raw-view-head",children:[(0,F.jsx)("span",{className:"mono strong",children:ts?ts.title:Z||"Pick a resource"}),!ts&&os?.revision!==void 0&&os.uri===Z?(0,F.jsxs)("span",{className:"muted mono",children:["rev ",os.revision]}):null,(0,F.jsx)("span",{className:"grow"}),!ts&&Z?(0,F.jsxs)("button",{type:"button",className:"btn btn-sm btn-quiet",onClick:Y(()=>Fs(Z),"onClick"),children:[(0,F.jsx)(It,{size:13})," Reload"]}):null,qs?(0,F.jsx)(Xt,{text:JSON.stringify(Ss,null,2),label:"Copy JSON"}):null]}),us?(0,F.jsx)("div",{className:"bad-ink pad",children:us}):null,vs&&!qs?(0,F.jsx)("div",{className:"muted pad",children:"Loading\u2026"}):null,qs?(0,F.jsx)("pre",{className:"code raw-json",children:qs}):!us&&!vs?(0,F.jsxs)("div",{className:"muted pad",children:["Pick a resource on the left. ",(0,F.jsx)("span",{className:"mono",children:"agent://current-status"})," is the verdict the agent reads first."]}):null]})]})]})})}Y(ko,"ko");var Ao={overview:"Overview",errors:"Errors",flows:"Flows",performance:"Performance",cluster:"Cluster"};function jo(){let K=N(P),Z=K.route.view,ts=!!K.route.logs,ns=K.route.raw!==void 0,rs=K.hello?.workspace.name;(0,M.useEffect)(()=>{document.title=`${Ao[Z]}${rs?` \xB7 ${rs}`:""} \xB7 LensMCP`},[Z,rs]);let as=K.conn.everConnected;return(0,F.jsxs)("div",{className:`app${ts?" logs-open":""}`,children:[(0,F.jsx)("a",{className:"skip",href:"#main",children:"Skip to content"}),(0,F.jsx)(xn,{}),(0,F.jsx)(Sn,{}),(0,F.jsxs)("main",{id:"main",className:`main${K.conn.status==="reconnecting"?" stale":""}`,tabIndex:-1,children:[as?(0,F.jsx)(er,{}):null,as?Z==="overview"?(0,F.jsx)(qa,{}):Z==="flows"?(0,F.jsx)(Ea,{}):Z==="errors"?(0,F.jsx)(Pa,{}):Z==="cluster"?(0,F.jsx)(co,{}):(0,F.jsx)(mn,{}):(0,F.jsx)($n,{})]}),ts?(0,F.jsx)(To,{}):null,ns?(0,F.jsx)(ko,{}):null,K.ui.helpOpen?(0,F.jsx)(lr,{}):null,K.ui.paletteOpen?(0,F.jsx)(So,{}):null,(0,F.jsx)(De,{})]})}Y(jo,"jo"),Me(),We(),lt();try{let K=Number(localStorage.getItem("lensmcp.flowsSeenAt")??"");P.ui.flowsSeenAt=Number.isFinite(K)&&K>0?K:Date.now()}catch{P.ui.flowsSeenAt=Date.now()}var Mo="lensmcp.prefs",No=["listCollapsed","storyOpen","hideBookkeeping","follow"];try{let K=JSON.parse(localStorage.getItem(Mo)??"{}");for(let Z of No)typeof K[Z]=="boolean"&&(P.ui[Z]=K[Z]);(K.traceView==="steps"||K.traceView==="lanes")&&(P.ui.traceView=K.traceView)}catch{}ve(P.ui,()=>{try{let K=Object.fromEntries(No.map(Z=>[Z,P.ui[Z]]));K.traceView=P.ui.traceView,localStorage.setItem(Mo,JSON.stringify(K))}catch{}}),window.addEventListener("popstate",We),setInterval(()=>{P.now=Date.now()},1e3),or(),Zn();var Po=document.getElementById("root");Po&&(Po.textContent="",(0,Se.createRoot)(Po).render((0,F.jsx)(jo,{})));
|