@xiaolei.shawn/mcp-server 0.4.0 → 0.4.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.
package/README.md
CHANGED
|
@@ -48,6 +48,15 @@ MCP mode (for Cursor/Codex MCP config):
|
|
|
48
48
|
agentlens mcp
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
+
## Recommended: use the agent skill
|
|
52
|
+
|
|
53
|
+
**Using the [mcp-gateway-audit](https://github.com/Xiaolei-Shawn/AgentLens/tree/main/skills/mcp-gateway-audit) skill is highly recommended when using this MCP server.** The skill instructs the agent to follow a strict tracing contract so every run produces a complete canonical event trace (session_start, intent, file_op, tool_call, decision, assumption, verification, session_end) for replay and analysis in the AgentLens dashboard.
|
|
54
|
+
|
|
55
|
+
- **Install the skill** in Cursor or Codex from the repo: copy [skills/mcp-gateway-audit](https://github.com/Xiaolei-Shawn/AgentLens/tree/main/skills/mcp-gateway-audit) into your `.cursor/skills/` or `.codex/skills/` directory, or add the repo skill path if your editor supports it.
|
|
56
|
+
- **Trigger in chat:** include *"Use MCP gateway audit mode for this task."* in your prompt; the agent will then apply the tracing rules automatically.
|
|
57
|
+
|
|
58
|
+
Without the skill, the agent may still call the gateway tools, but sessions are often incomplete. With the skill, you get consistent, dashboard-ready traces.
|
|
59
|
+
|
|
51
60
|
## MCP Tools
|
|
52
61
|
|
|
53
62
|
### Canonical recorders
|
|
@@ -9,7 +9,7 @@ Error generating stack: `+l.message+`
|
|
|
9
9
|
`).replace(hp,"")}function sh(t,e){return e=ih(e),ih(t)===e}function Zt(t,e,n,l,a,s){switch(n){case"children":typeof l=="string"?e==="body"||e==="textarea"&&l===""||Wl(t,l):(typeof l=="number"||typeof l=="bigint")&&e!=="body"&&Wl(t,""+l);break;case"className":on(t,"class",l);break;case"tabIndex":on(t,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":on(t,n,l);break;case"style":ir(t,l,s);break;case"data":if(e!=="object"){on(t,"data",l);break}case"src":case"href":if(l===""&&(e!=="a"||n!=="href")){t.removeAttribute(n);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){t.removeAttribute(n);break}l=Xi(""+l),t.setAttribute(n,l);break;case"action":case"formAction":if(typeof l=="function"){t.setAttribute(n,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof s=="function"&&(n==="formAction"?(e!=="input"&&Zt(t,e,"name",a.name,a,null),Zt(t,e,"formEncType",a.formEncType,a,null),Zt(t,e,"formMethod",a.formMethod,a,null),Zt(t,e,"formTarget",a.formTarget,a,null)):(Zt(t,e,"encType",a.encType,a,null),Zt(t,e,"method",a.method,a,null),Zt(t,e,"target",a.target,a,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){t.removeAttribute(n);break}l=Xi(""+l),t.setAttribute(n,l);break;case"onClick":l!=null&&(t.onclick=Un);break;case"onScroll":l!=null&&Tt("scroll",t);break;case"onScrollEnd":l!=null&&Tt("scrollend",t);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(o(61));if(n=l.__html,n!=null){if(a.children!=null)throw Error(o(60));t.innerHTML=n}}break;case"multiple":t.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":t.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){t.removeAttribute("xlink:href");break}n=Xi(""+l),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?t.setAttribute(n,""+l):t.removeAttribute(n);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?t.setAttribute(n,""):t.removeAttribute(n);break;case"capture":case"download":l===!0?t.setAttribute(n,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?t.setAttribute(n,l):t.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?t.setAttribute(n,l):t.removeAttribute(n);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?t.removeAttribute(n):t.setAttribute(n,l);break;case"popover":Tt("beforetoggle",t),Tt("toggle",t),il(t,"popover",l);break;case"xlinkActuate":_e(t,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":_e(t,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":_e(t,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":_e(t,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":_e(t,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":_e(t,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":_e(t,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":_e(t,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":_e(t,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":il(t,"is",l);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=Ym.get(n)||n,il(t,n,l))}}function uo(t,e,n,l,a,s){switch(n){case"style":ir(t,l,s);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(o(61));if(n=l.__html,n!=null){if(a.children!=null)throw Error(o(60));t.innerHTML=n}}break;case"children":typeof l=="string"?Wl(t,l):(typeof l=="number"||typeof l=="bigint")&&Wl(t,""+l);break;case"onScroll":l!=null&&Tt("scroll",t);break;case"onScrollEnd":l!=null&&Tt("scrollend",t);break;case"onClick":l!=null&&(t.onclick=Un);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Rn.hasOwnProperty(n))t:{if(n[0]==="o"&&n[1]==="n"&&(a=n.endsWith("Capture"),e=n.slice(2,a?n.length-7:void 0),s=t[Nt]||null,s=s!=null?s[n]:null,typeof s=="function"&&t.removeEventListener(e,s,a),typeof l=="function")){typeof s!="function"&&s!==null&&(n in t?t[n]=null:t.hasAttribute(n)&&t.removeAttribute(n)),t.addEventListener(e,l,a);break t}n in t?t[n]=l:l===!0?t.setAttribute(n,""):il(t,n,l)}}}function we(t,e,n){switch(e){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Tt("error",t),Tt("load",t);var l=!1,a=!1,s;for(s in n)if(n.hasOwnProperty(s)){var f=n[s];if(f!=null)switch(s){case"src":l=!0;break;case"srcSet":a=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,e));default:Zt(t,e,s,f,n,null)}}a&&Zt(t,e,"srcSet",n.srcSet,n,null),l&&Zt(t,e,"src",n.src,n,null);return;case"input":Tt("invalid",t);var h=s=f=a=null,b=null,T=null;for(l in n)if(n.hasOwnProperty(l)){var q=n[l];if(q!=null)switch(l){case"name":a=q;break;case"type":f=q;break;case"checked":b=q;break;case"defaultChecked":T=q;break;case"value":s=q;break;case"defaultValue":h=q;break;case"children":case"dangerouslySetInnerHTML":if(q!=null)throw Error(o(137,e));break;default:Zt(t,e,l,q,n,null)}}er(t,s,h,b,T,f,a,!1);return;case"select":Tt("invalid",t),l=f=s=null;for(a in n)if(n.hasOwnProperty(a)&&(h=n[a],h!=null))switch(a){case"value":s=h;break;case"defaultValue":f=h;break;case"multiple":l=h;default:Zt(t,e,a,h,n,null)}e=s,n=f,t.multiple=!!l,e!=null?Fl(t,!!l,e,!1):n!=null&&Fl(t,!!l,n,!0);return;case"textarea":Tt("invalid",t),s=a=l=null;for(f in n)if(n.hasOwnProperty(f)&&(h=n[f],h!=null))switch(f){case"value":l=h;break;case"defaultValue":a=h;break;case"children":s=h;break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(o(91));break;default:Zt(t,e,f,h,n,null)}lr(t,l,a,s);return;case"option":for(b in n)n.hasOwnProperty(b)&&(l=n[b],l!=null)&&(b==="selected"?t.selected=l&&typeof l!="function"&&typeof l!="symbol":Zt(t,e,b,l,n,null));return;case"dialog":Tt("beforetoggle",t),Tt("toggle",t),Tt("cancel",t),Tt("close",t);break;case"iframe":case"object":Tt("load",t);break;case"video":case"audio":for(l=0;l<hi.length;l++)Tt(hi[l],t);break;case"image":Tt("error",t),Tt("load",t);break;case"details":Tt("toggle",t);break;case"embed":case"source":case"link":Tt("error",t),Tt("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(T in n)if(n.hasOwnProperty(T)&&(l=n[T],l!=null))switch(T){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,e));default:Zt(t,e,T,l,n,null)}return;default:if(Sc(e)){for(q in n)n.hasOwnProperty(q)&&(l=n[q],l!==void 0&&uo(t,e,q,l,n,void 0));return}}for(h in n)n.hasOwnProperty(h)&&(l=n[h],l!=null&&Zt(t,e,h,l,n,null))}function mp(t,e,n,l){switch(e){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var a=null,s=null,f=null,h=null,b=null,T=null,q=null;for(z in n){var G=n[z];if(n.hasOwnProperty(z)&&G!=null)switch(z){case"checked":break;case"value":break;case"defaultValue":b=G;default:l.hasOwnProperty(z)||Zt(t,e,z,null,l,G)}}for(var k in l){var z=l[k];if(G=n[k],l.hasOwnProperty(k)&&(z!=null||G!=null))switch(k){case"type":s=z;break;case"name":a=z;break;case"checked":T=z;break;case"defaultChecked":q=z;break;case"value":f=z;break;case"defaultValue":h=z;break;case"children":case"dangerouslySetInnerHTML":if(z!=null)throw Error(o(137,e));break;default:z!==G&&Zt(t,e,k,z,l,G)}}bc(t,f,h,b,T,q,s,a);return;case"select":z=f=h=k=null;for(s in n)if(b=n[s],n.hasOwnProperty(s)&&b!=null)switch(s){case"value":break;case"multiple":z=b;default:l.hasOwnProperty(s)||Zt(t,e,s,null,l,b)}for(a in l)if(s=l[a],b=n[a],l.hasOwnProperty(a)&&(s!=null||b!=null))switch(a){case"value":k=s;break;case"defaultValue":h=s;break;case"multiple":f=s;default:s!==b&&Zt(t,e,a,s,l,b)}e=h,n=f,l=z,k!=null?Fl(t,!!n,k,!1):!!l!=!!n&&(e!=null?Fl(t,!!n,e,!0):Fl(t,!!n,n?[]:"",!1));return;case"textarea":z=k=null;for(h in n)if(a=n[h],n.hasOwnProperty(h)&&a!=null&&!l.hasOwnProperty(h))switch(h){case"value":break;case"children":break;default:Zt(t,e,h,null,l,a)}for(f in l)if(a=l[f],s=n[f],l.hasOwnProperty(f)&&(a!=null||s!=null))switch(f){case"value":k=a;break;case"defaultValue":z=a;break;case"children":break;case"dangerouslySetInnerHTML":if(a!=null)throw Error(o(91));break;default:a!==s&&Zt(t,e,f,a,l,s)}nr(t,k,z);return;case"option":for(var st in n)k=n[st],n.hasOwnProperty(st)&&k!=null&&!l.hasOwnProperty(st)&&(st==="selected"?t.selected=!1:Zt(t,e,st,null,l,k));for(b in l)k=l[b],z=n[b],l.hasOwnProperty(b)&&k!==z&&(k!=null||z!=null)&&(b==="selected"?t.selected=k&&typeof k!="function"&&typeof k!="symbol":Zt(t,e,b,k,l,z));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var vt in n)k=n[vt],n.hasOwnProperty(vt)&&k!=null&&!l.hasOwnProperty(vt)&&Zt(t,e,vt,null,l,k);for(T in l)if(k=l[T],z=n[T],l.hasOwnProperty(T)&&k!==z&&(k!=null||z!=null))switch(T){case"children":case"dangerouslySetInnerHTML":if(k!=null)throw Error(o(137,e));break;default:Zt(t,e,T,k,l,z)}return;default:if(Sc(e)){for(var Qt in n)k=n[Qt],n.hasOwnProperty(Qt)&&k!==void 0&&!l.hasOwnProperty(Qt)&&uo(t,e,Qt,void 0,l,k);for(q in l)k=l[q],z=n[q],!l.hasOwnProperty(q)||k===z||k===void 0&&z===void 0||uo(t,e,q,k,l,z);return}}for(var N in n)k=n[N],n.hasOwnProperty(N)&&k!=null&&!l.hasOwnProperty(N)&&Zt(t,e,N,null,l,k);for(G in l)k=l[G],z=n[G],!l.hasOwnProperty(G)||k===z||k==null&&z==null||Zt(t,e,G,k,l,z)}function ch(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function _p(){if(typeof performance.getEntriesByType=="function"){for(var t=0,e=0,n=performance.getEntriesByType("resource"),l=0;l<n.length;l++){var a=n[l],s=a.transferSize,f=a.initiatorType,h=a.duration;if(s&&h&&ch(f)){for(f=0,h=a.responseEnd,l+=1;l<n.length;l++){var b=n[l],T=b.startTime;if(T>h)break;var q=b.transferSize,G=b.initiatorType;q&&ch(G)&&(b=b.responseEnd,f+=q*(b<h?1:(h-T)/(b-T)))}if(--l,e+=8*(s+f)/(a.duration/1e3),t++,10<t)break}}if(0<t)return e/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var oo=null,ro=null;function Ls(t){return t.nodeType===9?t:t.ownerDocument}function uh(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function oh(t,e){if(t===0)switch(e){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&e==="foreignObject"?0:t}function fo(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.children=="bigint"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var ho=null;function pp(){var t=window.event;return t&&t.type==="popstate"?t===ho?!1:(ho=t,!0):(ho=null,!1)}var rh=typeof setTimeout=="function"?setTimeout:void 0,vp=typeof clearTimeout=="function"?clearTimeout:void 0,fh=typeof Promise=="function"?Promise:void 0,yp=typeof queueMicrotask=="function"?queueMicrotask:typeof fh<"u"?function(t){return fh.resolve(null).then(t).catch(gp)}:rh;function gp(t){setTimeout(function(){throw t})}function jl(t){return t==="head"}function dh(t,e){var n=e,l=0;do{var a=n.nextSibling;if(t.removeChild(n),a&&a.nodeType===8)if(n=a.data,n==="/$"||n==="/&"){if(l===0){t.removeChild(a),Ta(e);return}l--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")l++;else if(n==="html")_i(t.ownerDocument.documentElement);else if(n==="head"){n=t.ownerDocument.head,_i(n);for(var s=n.firstChild;s;){var f=s.nextSibling,h=s.nodeName;s[Ve]||h==="SCRIPT"||h==="STYLE"||h==="LINK"&&s.rel.toLowerCase()==="stylesheet"||n.removeChild(s),s=f}}else n==="body"&&_i(t.ownerDocument.body);n=a}while(n);Ta(e)}function hh(t,e){var n=t;t=0;do{var l=n.nextSibling;if(n.nodeType===1?e?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",n.getAttribute("style")===""&&n.removeAttribute("style")):n.nodeType===3&&(e?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),l&&l.nodeType===8)if(n=l.data,n==="/$"){if(t===0)break;t--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||t++;n=l}while(n)}function mo(t){var e=t.firstChild;for(e&&e.nodeType===10&&(e=e.nextSibling);e;){var n=e;switch(e=e.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":mo(n),On(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}t.removeChild(n)}}function bp(t,e,n,l){for(;t.nodeType===1;){var a=n;if(t.nodeName.toLowerCase()!==e.toLowerCase()){if(!l&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(l){if(!t[Ve])switch(e){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(s=t.getAttribute("rel"),s==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(s!==a.rel||t.getAttribute("href")!==(a.href==null||a.href===""?null:a.href)||t.getAttribute("crossorigin")!==(a.crossOrigin==null?null:a.crossOrigin)||t.getAttribute("title")!==(a.title==null?null:a.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(s=t.getAttribute("src"),(s!==(a.src==null?null:a.src)||t.getAttribute("type")!==(a.type==null?null:a.type)||t.getAttribute("crossorigin")!==(a.crossOrigin==null?null:a.crossOrigin))&&s&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(e==="input"&&t.type==="hidden"){var s=a.name==null?null:""+a.name;if(a.type==="hidden"&&t.getAttribute("name")===s)return t}else return t;if(t=vn(t.nextSibling),t===null)break}return null}function xp(t,e,n){if(e==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!n||(t=vn(t.nextSibling),t===null))return null;return t}function mh(t,e){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!e||(t=vn(t.nextSibling),t===null))return null;return t}function _o(t){return t.data==="$?"||t.data==="$~"}function po(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function Sp(t,e){var n=t.ownerDocument;if(t.data==="$~")t._reactRetry=e;else if(t.data!=="$?"||n.readyState!=="loading")e();else{var l=function(){e(),n.removeEventListener("DOMContentLoaded",l)};n.addEventListener("DOMContentLoaded",l),t._reactRetry=l}}function vn(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?"||e==="$~"||e==="&"||e==="F!"||e==="F")break;if(e==="/$"||e==="/&")return null}}return t}var vo=null;function _h(t){t=t.nextSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="/$"||n==="/&"){if(e===0)return vn(t.nextSibling);e--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||e++}t=t.nextSibling}return null}function ph(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"){if(e===0)return t;e--}else n!=="/$"&&n!=="/&"||e++}t=t.previousSibling}return null}function vh(t,e,n){switch(e=Ls(n),t){case"html":if(t=e.documentElement,!t)throw Error(o(452));return t;case"head":if(t=e.head,!t)throw Error(o(453));return t;case"body":if(t=e.body,!t)throw Error(o(454));return t;default:throw Error(o(451))}}function _i(t){for(var e=t.attributes;e.length;)t.removeAttributeNode(e[0]);On(t)}var yn=new Map,yh=new Set;function Bs(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var In=I.d;I.d={f:jp,r:wp,D:Np,C:Mp,L:Ep,m:Tp,X:Ap,S:kp,M:zp};function jp(){var t=In.f(),e=zs();return t||e}function wp(t){var e=Pt(t);e!==null&&e.tag===5&&e.type==="form"?Rf(e):In.r(t)}var Na=typeof document>"u"?null:document;function gh(t,e,n){var l=Na;if(l&&typeof e=="string"&&e){var a=rn(e);a='link[rel="'+t+'"][href="'+a+'"]',typeof n=="string"&&(a+='[crossorigin="'+n+'"]'),yh.has(a)||(yh.add(a),t={rel:t,crossOrigin:n,href:e},l.querySelector(a)===null&&(e=l.createElement("link"),we(e,"link",t),Jt(e),l.head.appendChild(e)))}}function Np(t){In.D(t),gh("dns-prefetch",t,null)}function Mp(t,e){In.C(t,e),gh("preconnect",t,e)}function Ep(t,e,n){In.L(t,e,n);var l=Na;if(l&&t&&e){var a='link[rel="preload"][as="'+rn(e)+'"]';e==="image"&&n&&n.imageSrcSet?(a+='[imagesrcset="'+rn(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(a+='[imagesizes="'+rn(n.imageSizes)+'"]')):a+='[href="'+rn(t)+'"]';var s=a;switch(e){case"style":s=Ma(t);break;case"script":s=Ea(t)}yn.has(s)||(t=w({rel:"preload",href:e==="image"&&n&&n.imageSrcSet?void 0:t,as:e},n),yn.set(s,t),l.querySelector(a)!==null||e==="style"&&l.querySelector(pi(s))||e==="script"&&l.querySelector(vi(s))||(e=l.createElement("link"),we(e,"link",t),Jt(e),l.head.appendChild(e)))}}function Tp(t,e){In.m(t,e);var n=Na;if(n&&t){var l=e&&typeof e.as=="string"?e.as:"script",a='link[rel="modulepreload"][as="'+rn(l)+'"][href="'+rn(t)+'"]',s=a;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":s=Ea(t)}if(!yn.has(s)&&(t=w({rel:"modulepreload",href:t},e),yn.set(s,t),n.querySelector(a)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(vi(s)))return}l=n.createElement("link"),we(l,"link",t),Jt(l),n.head.appendChild(l)}}}function kp(t,e,n){In.S(t,e,n);var l=Na;if(l&&t){var a=Ke(l).hoistableStyles,s=Ma(t);e=e||"default";var f=a.get(s);if(!f){var h={loading:0,preload:null};if(f=l.querySelector(pi(s)))h.loading=5;else{t=w({rel:"stylesheet",href:t,"data-precedence":e},n),(n=yn.get(s))&&yo(t,n);var b=f=l.createElement("link");Jt(b),we(b,"link",t),b._p=new Promise(function(T,q){b.onload=T,b.onerror=q}),b.addEventListener("load",function(){h.loading|=1}),b.addEventListener("error",function(){h.loading|=2}),h.loading|=4,Ys(f,e,l)}f={type:"stylesheet",instance:f,count:1,state:h},a.set(s,f)}}}function Ap(t,e){In.X(t,e);var n=Na;if(n&&t){var l=Ke(n).hoistableScripts,a=Ea(t),s=l.get(a);s||(s=n.querySelector(vi(a)),s||(t=w({src:t,async:!0},e),(e=yn.get(a))&&go(t,e),s=n.createElement("script"),Jt(s),we(s,"link",t),n.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},l.set(a,s))}}function zp(t,e){In.M(t,e);var n=Na;if(n&&t){var l=Ke(n).hoistableScripts,a=Ea(t),s=l.get(a);s||(s=n.querySelector(vi(a)),s||(t=w({src:t,async:!0,type:"module"},e),(e=yn.get(a))&&go(t,e),s=n.createElement("script"),Jt(s),we(s,"link",t),n.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},l.set(a,s))}}function bh(t,e,n,l){var a=(a=at.current)?Bs(a):null;if(!a)throw Error(o(446));switch(t){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(e=Ma(n.href),n=Ke(a).hoistableStyles,l=n.get(e),l||(l={type:"style",instance:null,count:0,state:null},n.set(e,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){t=Ma(n.href);var s=Ke(a).hoistableStyles,f=s.get(t);if(f||(a=a.ownerDocument||a,f={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},s.set(t,f),(s=a.querySelector(pi(t)))&&!s._p&&(f.instance=s,f.state.loading=5),yn.has(t)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},yn.set(t,n),s||Cp(a,t,n,f.state))),e&&l===null)throw Error(o(528,""));return f}if(e&&l!==null)throw Error(o(529,""));return null;case"script":return e=n.async,n=n.src,typeof n=="string"&&e&&typeof e!="function"&&typeof e!="symbol"?(e=Ea(n),n=Ke(a).hoistableScripts,l=n.get(e),l||(l={type:"script",instance:null,count:0,state:null},n.set(e,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,t))}}function Ma(t){return'href="'+rn(t)+'"'}function pi(t){return'link[rel="stylesheet"]['+t+"]"}function xh(t){return w({},t,{"data-precedence":t.precedence,precedence:null})}function Cp(t,e,n,l){t.querySelector('link[rel="preload"][as="style"]['+e+"]")?l.loading=1:(e=t.createElement("link"),l.preload=e,e.addEventListener("load",function(){return l.loading|=1}),e.addEventListener("error",function(){return l.loading|=2}),we(e,"link",n),Jt(e),t.head.appendChild(e))}function Ea(t){return'[src="'+rn(t)+'"]'}function vi(t){return"script[async]"+t}function Sh(t,e,n){if(e.count++,e.instance===null)switch(e.type){case"style":var l=t.querySelector('style[data-href~="'+rn(n.href)+'"]');if(l)return e.instance=l,Jt(l),l;var a=w({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return l=(t.ownerDocument||t).createElement("style"),Jt(l),we(l,"style",a),Ys(l,n.precedence,t),e.instance=l;case"stylesheet":a=Ma(n.href);var s=t.querySelector(pi(a));if(s)return e.state.loading|=4,e.instance=s,Jt(s),s;l=xh(n),(a=yn.get(a))&&yo(l,a),s=(t.ownerDocument||t).createElement("link"),Jt(s);var f=s;return f._p=new Promise(function(h,b){f.onload=h,f.onerror=b}),we(s,"link",l),e.state.loading|=4,Ys(s,n.precedence,t),e.instance=s;case"script":return s=Ea(n.src),(a=t.querySelector(vi(s)))?(e.instance=a,Jt(a),a):(l=n,(a=yn.get(s))&&(l=w({},n),go(l,a)),t=t.ownerDocument||t,a=t.createElement("script"),Jt(a),we(a,"link",l),t.head.appendChild(a),e.instance=a);case"void":return null;default:throw Error(o(443,e.type))}else e.type==="stylesheet"&&(e.state.loading&4)===0&&(l=e.instance,e.state.loading|=4,Ys(l,n.precedence,t));return e.instance}function Ys(t,e,n){for(var l=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),a=l.length?l[l.length-1]:null,s=a,f=0;f<l.length;f++){var h=l[f];if(h.dataset.precedence===e)s=h;else if(s!==a)break}s?s.parentNode.insertBefore(t,s.nextSibling):(e=n.nodeType===9?n.head:n,e.insertBefore(t,e.firstChild))}function yo(t,e){t.crossOrigin==null&&(t.crossOrigin=e.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=e.referrerPolicy),t.title==null&&(t.title=e.title)}function go(t,e){t.crossOrigin==null&&(t.crossOrigin=e.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=e.referrerPolicy),t.integrity==null&&(t.integrity=e.integrity)}var $s=null;function jh(t,e,n){if($s===null){var l=new Map,a=$s=new Map;a.set(n,l)}else a=$s,l=a.get(n),l||(l=new Map,a.set(n,l));if(l.has(t))return l;for(l.set(t,null),n=n.getElementsByTagName(t),a=0;a<n.length;a++){var s=n[a];if(!(s[Ve]||s[bt]||t==="link"&&s.getAttribute("rel")==="stylesheet")&&s.namespaceURI!=="http://www.w3.org/2000/svg"){var f=s.getAttribute(e)||"";f=t+f;var h=l.get(f);h?h.push(s):l.set(f,[s])}}return l}function wh(t,e,n){t=t.ownerDocument||t,t.head.insertBefore(n,e==="title"?t.querySelector("head > title"):null)}function Op(t,e,n){if(n===1||e.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof e.precedence!="string"||typeof e.href!="string"||e.href==="")break;return!0;case"link":if(typeof e.rel!="string"||typeof e.href!="string"||e.href===""||e.onLoad||e.onError)break;return e.rel==="stylesheet"?(t=e.disabled,typeof e.precedence=="string"&&t==null):!0;case"script":if(e.async&&typeof e.async!="function"&&typeof e.async!="symbol"&&!e.onLoad&&!e.onError&&e.src&&typeof e.src=="string")return!0}return!1}function Nh(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function Dp(t,e,n,l){if(n.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var a=Ma(l.href),s=e.querySelector(pi(a));if(s){e=s._p,e!==null&&typeof e=="object"&&typeof e.then=="function"&&(t.count++,t=Gs.bind(t),e.then(t,t)),n.state.loading|=4,n.instance=s,Jt(s);return}s=e.ownerDocument||e,l=xh(l),(a=yn.get(a))&&yo(l,a),s=s.createElement("link"),Jt(s);var f=s;f._p=new Promise(function(h,b){f.onload=h,f.onerror=b}),we(s,"link",l),n.instance=s}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(n,e),(e=n.state.preload)&&(n.state.loading&3)===0&&(t.count++,n=Gs.bind(t),e.addEventListener("load",n),e.addEventListener("error",n))}}var bo=0;function Rp(t,e){return t.stylesheets&&t.count===0&&Zs(t,t.stylesheets),0<t.count||0<t.imgCount?function(n){var l=setTimeout(function(){if(t.stylesheets&&Zs(t,t.stylesheets),t.unsuspend){var s=t.unsuspend;t.unsuspend=null,s()}},6e4+e);0<t.imgBytes&&bo===0&&(bo=62500*_p());var a=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&Zs(t,t.stylesheets),t.unsuspend)){var s=t.unsuspend;t.unsuspend=null,s()}},(t.imgBytes>bo?50:800)+e);return t.unsuspend=n,function(){t.unsuspend=null,clearTimeout(l),clearTimeout(a)}}:null}function Gs(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Zs(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Xs=null;function Zs(t,e){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Xs=new Map,e.forEach(Up,t),Xs=null,Gs.call(t))}function Up(t,e){if(!(e.state.loading&4)){var n=Xs.get(t);if(n)var l=n.get(null);else{n=new Map,Xs.set(t,n);for(var a=t.querySelectorAll("link[data-precedence],style[data-precedence]"),s=0;s<a.length;s++){var f=a[s];(f.nodeName==="LINK"||f.getAttribute("media")!=="not all")&&(n.set(f.dataset.precedence,f),l=f)}l&&n.set(null,l)}a=e.instance,f=a.getAttribute("data-precedence"),s=n.get(f)||l,s===l&&n.set(null,a),n.set(f,a),this.count++,l=Gs.bind(this),a.addEventListener("load",l),a.addEventListener("error",l),s?s.parentNode.insertBefore(a,s.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(a,t.firstChild)),e.state.loading|=4}}var yi={$$typeof:j,Provider:null,Consumer:null,_currentValue:rt,_currentValue2:rt,_threadCount:0};function qp(t,e,n,l,a,s,f,h,b){this.tag=1,this.containerInfo=t,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=za(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=za(0),this.hiddenUpdates=za(null),this.identifierPrefix=l,this.onUncaughtError=a,this.onCaughtError=s,this.onRecoverableError=f,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=b,this.incompleteTransitions=new Map}function Mh(t,e,n,l,a,s,f,h,b,T,q,G){return t=new qp(t,e,n,f,b,T,q,G,h),e=1,s===!0&&(e|=24),s=Ie(3,null,null,e),t.current=s,s.stateNode=t,e=Ic(),e.refCount++,t.pooledCache=e,e.refCount++,s.memoizedState={element:l,isDehydrated:n,cache:e},nu(s),t}function Eh(t){return t?(t=aa,t):aa}function Th(t,e,n,l,a,s){a=Eh(a),l.context===null?l.context=a:l.pendingContext=a,l=dl(e),l.payload={element:n},s=s===void 0?null:s,s!==null&&(l.callback=s),n=hl(t,l,e),n!==null&&(Ze(n,t,e),Fa(n,t,e))}function kh(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function xo(t,e){kh(t,e),(t=t.alternate)&&kh(t,e)}function Ah(t){if(t.tag===13||t.tag===31){var e=Dl(t,67108864);e!==null&&Ze(e,t,67108864),xo(t,67108864)}}function zh(t){if(t.tag===13||t.tag===31){var e=ln();e=O(e);var n=Dl(t,e);n!==null&&Ze(n,t,e),xo(t,e)}}var Qs=!0;function Hp(t,e,n,l){var a=A.T;A.T=null;var s=I.p;try{I.p=2,So(t,e,n,l)}finally{I.p=s,A.T=a}}function Lp(t,e,n,l){var a=A.T;A.T=null;var s=I.p;try{I.p=8,So(t,e,n,l)}finally{I.p=s,A.T=a}}function So(t,e,n,l){if(Qs){var a=jo(l);if(a===null)co(t,e,l,Vs,n),Oh(t,l);else if(Yp(a,t,e,n,l))l.stopPropagation();else if(Oh(t,l),e&4&&-1<Bp.indexOf(t)){for(;a!==null;){var s=Pt(a);if(s!==null)switch(s.tag){case 3:if(s=s.stateNode,s.current.memoizedState.isDehydrated){var f=Cn(s.pendingLanes);if(f!==0){var h=s;for(h.pendingLanes|=2,h.entangledLanes|=2;f;){var b=1<<31-ne(f);h.entanglements[1]|=b,f&=~b}Tn(s),(Bt&6)===0&&(ks=Ce()+500,di(0))}}break;case 31:case 13:h=Dl(s,2),h!==null&&Ze(h,s,2),zs(),xo(s,2)}if(s=jo(l),s===null&&co(t,e,l,Vs,n),s===a)break;a=s}a!==null&&l.stopPropagation()}else co(t,e,l,null,n)}}function jo(t){return t=wc(t),wo(t)}var Vs=null;function wo(t){if(Vs=null,t=le(t),t!==null){var e=d(t);if(e===null)t=null;else{var n=e.tag;if(n===13){if(t=p(e),t!==null)return t;t=null}else if(n===31){if(t=y(e),t!==null)return t;t=null}else if(n===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null)}}return Vs=t,null}function Ch(t){switch(t){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(_c()){case qi:return 2;case nl:return 8;case Vl:case pc:return 32;case Hi:return 268435456;default:return 32}default:return 32}}var No=!1,wl=null,Nl=null,Ml=null,gi=new Map,bi=new Map,El=[],Bp="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Oh(t,e){switch(t){case"focusin":case"focusout":wl=null;break;case"dragenter":case"dragleave":Nl=null;break;case"mouseover":case"mouseout":Ml=null;break;case"pointerover":case"pointerout":gi.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":bi.delete(e.pointerId)}}function xi(t,e,n,l,a,s){return t===null||t.nativeEvent!==s?(t={blockedOn:e,domEventName:n,eventSystemFlags:l,nativeEvent:s,targetContainers:[a]},e!==null&&(e=Pt(e),e!==null&&Ah(e)),t):(t.eventSystemFlags|=l,e=t.targetContainers,a!==null&&e.indexOf(a)===-1&&e.push(a),t)}function Yp(t,e,n,l,a){switch(e){case"focusin":return wl=xi(wl,t,e,n,l,a),!0;case"dragenter":return Nl=xi(Nl,t,e,n,l,a),!0;case"mouseover":return Ml=xi(Ml,t,e,n,l,a),!0;case"pointerover":var s=a.pointerId;return gi.set(s,xi(gi.get(s)||null,t,e,n,l,a)),!0;case"gotpointercapture":return s=a.pointerId,bi.set(s,xi(bi.get(s)||null,t,e,n,l,a)),!0}return!1}function Dh(t){var e=le(t.target);if(e!==null){var n=d(e);if(n!==null){if(e=n.tag,e===13){if(e=p(n),e!==null){t.blockedOn=e,_t(t.priority,function(){zh(n)});return}}else if(e===31){if(e=y(n),e!==null){t.blockedOn=e,_t(t.priority,function(){zh(n)});return}}else if(e===3&&n.stateNode.current.memoizedState.isDehydrated){t.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Js(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=jo(t.nativeEvent);if(n===null){n=t.nativeEvent;var l=new n.constructor(n.type,n);jc=l,n.target.dispatchEvent(l),jc=null}else return e=Pt(n),e!==null&&Ah(e),t.blockedOn=n,!1;e.shift()}return!0}function Rh(t,e,n){Js(t)&&n.delete(e)}function $p(){No=!1,wl!==null&&Js(wl)&&(wl=null),Nl!==null&&Js(Nl)&&(Nl=null),Ml!==null&&Js(Ml)&&(Ml=null),gi.forEach(Rh),bi.forEach(Rh)}function Ks(t,e){t.blockedOn===e&&(t.blockedOn=null,No||(No=!0,i.unstable_scheduleCallback(i.unstable_NormalPriority,$p)))}var Fs=null;function Uh(t){Fs!==t&&(Fs=t,i.unstable_scheduleCallback(i.unstable_NormalPriority,function(){Fs===t&&(Fs=null);for(var e=0;e<t.length;e+=3){var n=t[e],l=t[e+1],a=t[e+2];if(typeof l!="function"){if(wo(l||n)===null)continue;break}var s=Pt(n);s!==null&&(t.splice(e,3),e-=3,Su(s,{pending:!0,data:a,method:n.method,action:l},l,a))}}))}function Ta(t){function e(b){return Ks(b,t)}wl!==null&&Ks(wl,t),Nl!==null&&Ks(Nl,t),Ml!==null&&Ks(Ml,t),gi.forEach(e),bi.forEach(e);for(var n=0;n<El.length;n++){var l=El[n];l.blockedOn===t&&(l.blockedOn=null)}for(;0<El.length&&(n=El[0],n.blockedOn===null);)Dh(n),n.blockedOn===null&&El.shift();if(n=(t.ownerDocument||t).$$reactFormReplay,n!=null)for(l=0;l<n.length;l+=3){var a=n[l],s=n[l+1],f=a[Nt]||null;if(typeof s=="function")f||Uh(n);else if(f){var h=null;if(s&&s.hasAttribute("formAction")){if(a=s,f=s[Nt]||null)h=f.formAction;else if(wo(a)!==null)continue}else h=f.action;typeof h=="function"?n[l+1]=h:(n.splice(l,3),l-=3),Uh(n)}}}function qh(){function t(s){s.canIntercept&&s.info==="react-transition"&&s.intercept({handler:function(){return new Promise(function(f){return a=f})},focusReset:"manual",scroll:"manual"})}function e(){a!==null&&(a(),a=null),l||setTimeout(n,20)}function n(){if(!l&&!navigation.transition){var s=navigation.currentEntry;s&&s.url!=null&&navigation.navigate(s.url,{state:s.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,a=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",e),navigation.addEventListener("navigateerror",e),setTimeout(n,100),function(){l=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",e),navigation.removeEventListener("navigateerror",e),a!==null&&(a(),a=null)}}}function Mo(t){this._internalRoot=t}Ws.prototype.render=Mo.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(o(409));var n=e.current,l=ln();Th(n,l,t,e,null,null)},Ws.prototype.unmount=Mo.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;Th(t.current,2,null,t,null,null),zs(),e[St]=null}};function Ws(t){this._internalRoot=t}Ws.prototype.unstable_scheduleHydration=function(t){if(t){var e=nt();t={blockedOn:null,target:t,priority:e};for(var n=0;n<El.length&&e!==0&&e<El[n].priority;n++);El.splice(n,0,t),n===0&&Dh(t)}};var Hh=c.version;if(Hh!=="19.2.4")throw Error(o(527,Hh,"19.2.4"));I.findDOMNode=function(t){var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(o(188)):(t=Object.keys(t).join(","),Error(o(268,t)));return t=v(e),t=t!==null?_(t):null,t=t===null?null:t.stateNode,t};var Gp={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:A,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Is=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Is.isDisabled&&Is.supportsFiber)try{bn=Is.inject(Gp),Oe=Is}catch{}}return ji.createRoot=function(t,e){if(!m(t))throw Error(o(299));var n=!1,l="",a=Zf,s=Qf,f=Vf;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(l=e.identifierPrefix),e.onUncaughtError!==void 0&&(a=e.onUncaughtError),e.onCaughtError!==void 0&&(s=e.onCaughtError),e.onRecoverableError!==void 0&&(f=e.onRecoverableError)),e=Mh(t,1,!1,null,null,n,l,null,a,s,f,qh),t[St]=e.current,so(t),new Mo(e)},ji.hydrateRoot=function(t,e,n){if(!m(t))throw Error(o(299));var l=!1,a="",s=Zf,f=Qf,h=Vf,b=null;return n!=null&&(n.unstable_strictMode===!0&&(l=!0),n.identifierPrefix!==void 0&&(a=n.identifierPrefix),n.onUncaughtError!==void 0&&(s=n.onUncaughtError),n.onCaughtError!==void 0&&(f=n.onCaughtError),n.onRecoverableError!==void 0&&(h=n.onRecoverableError),n.formState!==void 0&&(b=n.formState)),e=Mh(t,1,!0,e,n??null,l,a,b,s,f,h,qh),e.context=Eh(null),n=e.current,l=ln(),l=O(l),a=dl(l),a.callback=null,hl(n,a,l),n=l,e.current.lanes=n,Qe(e,n),Tn(e),t[St]=e.current,so(t),new Ws(e)},ji.version="19.2.4",ji}var Jh;function Pp(){if(Jh)return ko.exports;Jh=1;function i(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(c){console.error(c)}}return i(),ko.exports=Ip(),ko.exports}var tv=Pp();function Kh(i,c="/"){return{success:!1,errors:[{instancePath:c,keyword:"validation",message:i}]}}function $o(i){if(!i||typeof i!="object")return!1;const c=i;return typeof c.id=="string"&&typeof c.session_id=="string"&&typeof c.seq=="number"&&typeof c.ts=="string"&&typeof c.kind=="string"&&typeof c.schema_version=="number"&&!!c.actor&&typeof c.actor.type=="string"&&!!c.payload&&typeof c.payload=="object"}function ev(i,c){return i&&i.trim()?i.trim():c?`Session ${c}`:"Session Replay"}function nv(i){const c=[...i].reverse().find(o=>o.kind==="session_end"),r=typeof c?.payload?.outcome=="string"?c.payload.outcome:"unknown";return r==="completed"||r==="partial"||r==="failed"||r==="aborted"?r:"unknown"}function ki(i,c){const r=[...i].sort((p,y)=>p.seq===y.seq?p.ts.localeCompare(y.ts):p.seq-y.seq),o=r[0],m=c?.session_id??o?.session_id??"unknown-session",d=c?.goal;return{id:m,started_at:c?.started_at??r[0]?.ts,title:ev(d,m),user_message:c?.user_prompt??"",goal:d,outcome:nv(r),events:r}}function Fh(i){const c=i.split(`
|
|
10
10
|
`).map(o=>o.trim()).filter(o=>o.length>0),r=[];for(const[o,m]of c.entries()){let d;try{d=JSON.parse(m)}catch{throw new Error(`Invalid JSONL at line ${o+1}`)}if(!$o(d))throw new Error(`Invalid canonical event shape at line ${o+1}`);r.push(d)}return r}function Ps(i,c){if(typeof i!="string"||i.trim()==="")return c;const r=new Date(i);return Number.isNaN(r.getTime())?c:r.toISOString()}function tc(i){return i&&typeof i=="object"&&!Array.isArray(i)?i:{}}function ye(i,c=500){if(typeof i!="string")return;const r=i.trim();if(r)return r.length>c?`${r.slice(0,c)}...`:r}function Wh(i){const c=i.split(`
|
|
11
11
|
`).map(Y=>Y.trim()).filter(Y=>Y.length>0),r=[];for(const[Y,R]of c.entries()){let $;try{$=JSON.parse(R)}catch{throw new Error(`Invalid JSONL at line ${Y+1}`)}if(!$||typeof $!="object")throw new Error(`Invalid JSONL object at line ${Y+1}`);r.push($)}const o=r.find(Y=>Y.type==="session_meta");if(!o)throw new Error("No session_meta found in JSONL.");const m=new Date().toISOString(),d=tc(o.payload),p=d.id,y=typeof p=="string"&&p.trim()!==""?p:"codex-session",g=Ps(d.timestamp,Ps(o.timestamp,m)),v=[],_=`intent_${y}_main`;let w=1;v.push({id:`${y}:${w}:session_start`,session_id:y,seq:w,ts:g,kind:"session_start",actor:{type:"system",id:"codex"},payload:{goal:ye(d.user_goal)??ye(d.goal)??"Codex session import",user_prompt:ye(d.user_prompt),source:"codex_jsonl",originator:ye(d.originator),model:ye(d.model)},visibility:"review",schema_version:1});for(const Y of r){const R=Y.type,$=tc(Y.payload),Q=Ps(Y.timestamp,m);if(R==="event_msg"&&$.type==="user_message"){const ht=ye($.message,4e3);if(!ht)continue;w+=1,v.push({id:`${y}:${w}:intent`,session_id:y,seq:w,ts:Q,kind:"intent",actor:{type:"user",id:"codex-user"},scope:{intent_id:_},payload:{intent_id:_,title:ht.split(`
|
|
12
|
-
`)[0]?.slice(0,120)||"User message",description:ht,source:"codex_user_message"},visibility:"review",schema_version:1});continue}if(R!=="response_item")continue;const J=typeof $.type=="string"?$.type:"unknown";if(J==="function_call"||J==="custom_tool_call"||J==="web_search_call"){const ht=ye($.name)??ye(tc($.action).type)??J,j=ye($.arguments,1200)??ye($.input,1200)??ye(JSON.stringify(tc($.action)),1200);w+=1,v.push({id:`${y}:${w}:tool_call`,session_id:y,seq:w,ts:Q,kind:"tool_call",actor:{type:"agent",id:"codex"},scope:{intent_id:_},payload:{category:J==="web_search_call"?"search":"tool",action:ht,target:j,details:{call_id:ye($.call_id),status:ye($.status),source:"codex_response_item"}},visibility:"raw",schema_version:1});continue}(J==="function_call_output"||J==="custom_tool_call_output")&&(w+=1,v.push({id:`${y}:${w}:execution`,session_id:y,seq:w,ts:Q,kind:"tool_call",actor:{type:"tool",id:"codex-tool"},scope:{intent_id:_},payload:{category:"execution",action:J,target:ye($.call_id),details:{output:ye($.output,4e3),source:"codex_response_item"}},visibility:"raw",schema_version:1}))}const H=Ps(r[r.length-1]?.timestamp,m);return w+=1,v.push({id:`${y}:${w}:session_end`,session_id:y,seq:w,ts:H,kind:"session_end",actor:{type:"system",id:"codex"},payload:{outcome:"unknown",summary:"Imported from Codex JSONL",source:"codex_jsonl"},visibility:"review",schema_version:1}),ki(v,{session_id:y,goal:ye(d.user_goal)??ye(d.goal),user_prompt:ye(d.user_prompt,4e3),started_at:g})}function wm(i){if(typeof i=="string"){const c=i.trim();if(!c)throw new Error("Empty input");if(c.startsWith("{")||c.startsWith("["))try{return wm(JSON.parse(c))}catch{try{return ki(Fh(c))}catch{return Wh(c)}}try{return ki(Fh(c))}catch{return Wh(c)}}if(Array.isArray(i)){if(!i.every(c=>$o(c)))throw new Error("Array input must contain canonical events");return ki(i)}if(i&&typeof i=="object"){const c=i;if(Array.isArray(c.events)&&c.events.every(r=>$o(r)))return ki(c.events,c)}throw new Error("Unsupported session file format. Provide canonical JSON, JSON array, or JSONL events.")}function Oo(i){try{const c=wm(i);return c.events.length===0?Kh("Session contains no events."):{success:!0,data:c}}catch(c){return Kh(c instanceof Error?c.message:"Invalid session input")}}const wi="",lv="0.4.
|
|
12
|
+
`)[0]?.slice(0,120)||"User message",description:ht,source:"codex_user_message"},visibility:"review",schema_version:1});continue}if(R!=="response_item")continue;const J=typeof $.type=="string"?$.type:"unknown";if(J==="function_call"||J==="custom_tool_call"||J==="web_search_call"){const ht=ye($.name)??ye(tc($.action).type)??J,j=ye($.arguments,1200)??ye($.input,1200)??ye(JSON.stringify(tc($.action)),1200);w+=1,v.push({id:`${y}:${w}:tool_call`,session_id:y,seq:w,ts:Q,kind:"tool_call",actor:{type:"agent",id:"codex"},scope:{intent_id:_},payload:{category:J==="web_search_call"?"search":"tool",action:ht,target:j,details:{call_id:ye($.call_id),status:ye($.status),source:"codex_response_item"}},visibility:"raw",schema_version:1});continue}(J==="function_call_output"||J==="custom_tool_call_output")&&(w+=1,v.push({id:`${y}:${w}:execution`,session_id:y,seq:w,ts:Q,kind:"tool_call",actor:{type:"tool",id:"codex-tool"},scope:{intent_id:_},payload:{category:"execution",action:J,target:ye($.call_id),details:{output:ye($.output,4e3),source:"codex_response_item"}},visibility:"raw",schema_version:1}))}const H=Ps(r[r.length-1]?.timestamp,m);return w+=1,v.push({id:`${y}:${w}:session_end`,session_id:y,seq:w,ts:H,kind:"session_end",actor:{type:"system",id:"codex"},payload:{outcome:"unknown",summary:"Imported from Codex JSONL",source:"codex_jsonl"},visibility:"review",schema_version:1}),ki(v,{session_id:y,goal:ye(d.user_goal)??ye(d.goal),user_prompt:ye(d.user_prompt,4e3),started_at:g})}function wm(i){if(typeof i=="string"){const c=i.trim();if(!c)throw new Error("Empty input");if(c.startsWith("{")||c.startsWith("["))try{return wm(JSON.parse(c))}catch{try{return ki(Fh(c))}catch{return Wh(c)}}try{return ki(Fh(c))}catch{return Wh(c)}}if(Array.isArray(i)){if(!i.every(c=>$o(c)))throw new Error("Array input must contain canonical events");return ki(i)}if(i&&typeof i=="object"){const c=i;if(Array.isArray(c.events)&&c.events.every(r=>$o(r)))return ki(c.events,c)}throw new Error("Unsupported session file format. Provide canonical JSON, JSON array, or JSONL events.")}function Oo(i){try{const c=wm(i);return c.events.length===0?Kh("Session contains no events."):{success:!0,data:c}}catch(c){return Kh(c instanceof Error?c.message:"Invalid session input")}}const wi="",lv="0.4.1".trim()||"0.0.0";function Do(i){return new Promise((c,r)=>{const o=new FileReader;o.onerror=()=>r(new Error(`Failed to read ${i.name}`)),o.onload=()=>c(String(o.result??"")),o.readAsText(i)})}function av(i){return(i.session_id||i.key||"").trim()}async function Ih(i){const c=await i.text();if(!c.trim())return{};try{const r=JSON.parse(c);return r&&typeof r=="object"&&!Array.isArray(r)?r:{}}catch{return{error:`Non-JSON response (${i.status}).`}}}function iv({onLoad:i,onError:c}){const r=X.useRef(null),o=X.useRef(null),[m,d]=X.useState(!1),[p,y]=X.useState(null),[g,v]=X.useState([]),[_,w]=X.useState(null),[H,Y]=X.useState([]),[R,$]=X.useState(null),[Q,J]=X.useState(null),[ht,j]=X.useState(""),[Z,W]=X.useState(!1),[F,V]=X.useState([]),[lt,ft]=X.useState(!1),dt=X.useCallback(async C=>{if(C)try{const K=await fetch(`${wi}/api/sessions/${encodeURIComponent(C)}`,{method:"GET"});if(!K.ok)throw new Error(`Failed to open session (${K.status})`);const at=await K.json(),D=Oo(at);if(!D.success)throw new Error(D.errors.map(et=>`${et.instancePath}: ${et.message??et.keyword}`).join(`
|
|
13
13
|
`));i(D.data)}catch(K){c(K instanceof Error?K.message:"Failed to open imported session.")}},[c,i]),ot=X.useCallback(async()=>{d(!0),y(null);try{const C=await fetch(`${wi}/api/sessions`,{method:"GET"});if(!C.ok)throw new Error(`Session API returned ${C.status}`);const K=await C.json(),at=Array.isArray(K.sessions)?K.sessions:[];v(at)}catch(C){v([]),y(C instanceof Error?C.message:"Failed to load local sessions.")}finally{d(!1)}},[]);X.useEffect(()=>{ot()},[ot]);const it=X.useCallback(async C=>{try{const K=await fetch(`${wi}/api/sessions/${encodeURIComponent(C)}`,{method:"GET"});if(!K.ok)throw new Error(`Failed to load session (${K.status})`);const at=await K.json(),D=Oo(at);if(D.success){i(D.data);return}c(D.errors.map(et=>`${et.instancePath}: ${et.message??et.keyword}`).join(`
|
|
14
14
|
`))}catch(K){c(K instanceof Error?K.message:"Failed to load local session.")}},[c,i]),ct=X.useCallback(async(C,K)=>{const at=C?Array.isArray(C)?C:Array.from(C):[];if(at.length===0)return null;const D=K?.allowLocalLoadFallback??!0;try{$("Importing canonical MCP logs...");const et=await Promise.all(at.map(async Me=>({name:Me.name,content:await Do(Me)}))),tt=await fetch(`${wi}/api/import/mcp`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({files:et})}),yt=await Ih(tt);if(!tt.ok)throw new Error(yt.error??`MCP import failed (${tt.status}). Ensure dashboard API is running and reachable.`);if(!yt.import_set_id)throw new Error("MCP import response missing `import_set_id`.");const wt=Array.isArray(yt.sessions)?yt.sessions:[];w(yt.import_set_id),Y(wt);const se=wt[0]?av(wt[0]):"";j(se);const Ae=Array.isArray(yt.rejected_files)?yt.rejected_files:[],be=typeof yt.accepted_file_count=="number"?yt.accepted_file_count:wt.length,ze=typeof yt.total_event_count=="number"?yt.total_event_count:wt[0]?.event_count,Dt=be>1?`${be} session logs merged into 1 session`:"1 session log imported",It=typeof ze=="number"?` (${ze} events)`:"",He=Ae.length>0?`. ${Ae.length} file(s) rejected: ${Ae.map(Me=>`${Me.name}: ${Me.error}`).join("; ")}`:"";return $(`${Dt}${It}${He}`),V([]),ft(!1),await ot(),se||null}catch(et){try{const tt=at[0];if(!tt||!D)throw et;const yt=await Do(tt),wt=Oo(yt);if(!wt.success)throw new Error(wt.errors.map(se=>`${se.instancePath}: ${se.message??se.keyword}`).join(`
|
|
15
15
|
`));return i(wt.data),$("Loaded canonical MCP session locally (API import unavailable). Restart dashboard server to persist import sets."),V([]),ft(!1),wt.data.id}catch{const tt=et instanceof Error?et.message:"Failed to import MCP sessions.";return $(tt),c(tt),null}}},[ot,c,i]),Ht=X.useCallback(C=>{const K=C?Array.isArray(C)?C:Array.from(C):[];K.length!==0&&(V(at=>{const D=new Set(at.map(tt=>tt.name)),et=K.filter(tt=>!D.has(tt.name));return at.concat(et)}),ft(!0))},[]),pt=X.useCallback(C=>{V(K=>K.filter((at,D)=>D!==C))},[]),A=X.useCallback(()=>{F.length!==0&&ct(F,{allowLocalLoadFallback:!0})},[F,ct]),I=X.useCallback(async C=>{if(!(!C||C.length===0)){if(!_||!ht){c("Import canonical MCP sessions first, then select a target session for raw merge.");return}try{J("Merging raw log...");const K=await Do(C[0]),at=await fetch(`${wi}/api/import/raw-merge`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({import_set_id:_,target_session_id:ht,raw:K,adapter:"auto",dedupe:!0})}),D=await Ih(at);if(!at.ok)throw new Error(D.error??`Raw merge failed (${at.status})`);const et=D.filtered_out_by_time_window!=null&&D.filtered_out_by_time_window>0?`, ${D.filtered_out_by_time_window} outside session time window`:"";J(`Merged raw log. Inserted ${D.inserted??0} event(s), skipped ${D.skipped_duplicates??0} duplicate(s)${et}.`),await ot()}catch(K){const at=K instanceof Error?K.message:"Failed to merge raw log.";J(at),c(at)}}},[ot,_,c,ht]),rt="Follow the guided steps below to initialize your animation workflow. AgentLens processes your MCP logs into visual timelines.",Ct="Recommended: import only relevant or consecutive sessions from the same conversation/thread.",Ot="Raw merge is available only after MCP import and only merges into an imported target session.",x=!!(_&&ht),U=x||F.length>0,P=!!(ht||F.length>0);return u.jsxs("div",{className:"load-session",children:[u.jsx("div",{className:"load-session__stars","aria-hidden":!0}),u.jsx("div",{className:"load-session__nebula load-session__nebula--one","aria-hidden":!0}),u.jsx("div",{className:"load-session__nebula load-session__nebula--two","aria-hidden":!0}),u.jsx("div",{className:"load-session__workflow-bg-pulse","aria-hidden":!0}),u.jsxs("header",{className:"load-session__header",children:[u.jsxs("div",{className:"load-session__brand",children:[u.jsxs("div",{className:"load-session__logo","aria-hidden":!0,children:[u.jsx("span",{className:"load-session__logo-outer"}),u.jsx("span",{className:"load-session__logo-inner"})]}),u.jsx("span",{className:"load-session__brand-name",children:"AgentLens"})]}),u.jsx("div",{className:"load-session__workflow-status",children:u.jsx("span",{className:"load-session__workflow-label",children:"AGENTLENS FUSION CONSOLE"})})]}),u.jsxs("div",{className:"load-session__hero",children:[u.jsxs("h1",{className:"load-session__hero-title",children:["Import"," ",u.jsx("span",{className:"load-session__hero-title-accent",children:"Your Session"})]}),u.jsx("p",{className:"load-session__hero-subtitle",children:rt})]}),u.jsxs("div",{className:"load-session__workflow",children:[u.jsxs("div",{className:"load-session__workflow-left",children:[u.jsxs("section",{className:"load-session__step load-session__step--inline",role:"region","aria-label":"Session Logs",children:[u.jsx("div",{className:"load-session__step-badge load-session__step-badge--active",children:"1"}),u.jsxs("div",{className:"load-session__step-content",children:[u.jsx("h2",{className:"load-session__step-title",children:"Session Logs"}),u.jsxs("div",{className:`load-session__dropzone load-session__dropzone--primary ${F.length===0?"load-session__dropzone--browse":""}`,onClick:F.length===0?()=>r.current?.click():void 0,onKeyDown:F.length===0?C=>C.key==="Enter"&&r.current?.click():void 0,role:F.length===0?"button":void 0,tabIndex:F.length===0?0:void 0,"aria-label":F.length===0?"Import canonical MCP files":void 0,children:[F.length===0?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"load-session__drop-icon load-session__drop-icon--doc","aria-hidden":!0,children:u.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[u.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),u.jsx("polyline",{points:"14 2 14 8 20 8"}),u.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),u.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),u.jsx("polyline",{points:"10 9 9 9 8 9"})]})}),u.jsx("div",{className:"load-session__drop-title",children:"Import Canonical MCP Files"}),u.jsx("p",{className:"load-session__drop-desc",children:Ct}),u.jsxs("button",{type:"button",onClick:C=>{C.stopPropagation(),r.current?.click()},className:"load-session__browse-btn",children:[u.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:u.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})}),"Browse Files"]}),u.jsx("p",{className:"load-session__drop-formats",children:"Supported formats: .jsonl"})]}):u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"load-session__drop-title",children:"Import Canonical MCP Files"}),u.jsxs("div",{className:"load-session__selection-summary",children:[u.jsxs("span",{className:"load-session__selection-count",children:[F.length," file",F.length!==1?"s":""," selected"]}),u.jsx("button",{type:"button",className:"load-session__selection-change",onClick:C=>{C.stopPropagation(),ft(K=>!K)},children:lt?"Collapse":"Change"})]}),lt&&u.jsxs("div",{className:"load-session__selection-list",children:[u.jsx("ul",{className:"load-session__selection-ul",children:F.map((C,K)=>u.jsxs("li",{className:"load-session__selection-li",children:[u.jsx("span",{className:"load-session__selection-filename",title:C.name,children:C.name}),u.jsx("button",{type:"button",className:"load-session__selection-remove",onClick:at=>{at.stopPropagation(),pt(K)},"aria-label":`Remove ${C.name}`,children:"×"})]},`${C.name}-${K}`))}),u.jsxs("div",{className:"load-session__selection-actions",children:[u.jsx("button",{type:"button",className:"load-session__browse-btn load-session__browse-btn--secondary",onClick:C=>{C.stopPropagation(),r.current?.click()},children:"Add more"}),u.jsx("button",{type:"button",className:"load-session__browse-btn load-session__import-btn",onClick:C=>{C.stopPropagation(),A()},children:"Import selected"})]})]}),u.jsx("p",{className:"load-session__drop-formats",children:"Supported formats: .jsonl"})]}),R?u.jsx("p",{className:"load-session__drop-status",children:R}):null]})]})]}),u.jsxs("section",{className:`load-session__step load-session__step--optional load-session__step--inline ${_?"load-session__step--enabled":""}`,role:"region","aria-label":"Raw Logs Optional",children:[u.jsx("div",{className:"load-session__step-badge",children:"2"}),u.jsxs("div",{className:"load-session__step-content",children:[u.jsx("h2",{className:"load-session__step-title",children:"Raw Logs (Optional)"}),u.jsxs("div",{className:"load-session__raw-section",children:[u.jsx("div",{className:"load-session__raw-icon","aria-hidden":!0,children:u.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[u.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),u.jsx("circle",{cx:"12",cy:"7",r:"4"}),u.jsx("path",{d:"M14 11h6v6h-6z"})]})}),u.jsxs("div",{className:"load-session__raw-text",children:[u.jsx("span",{className:"load-session__raw-label",children:"Merge Supplemental Data"}),u.jsx("p",{className:"load-session__raw-desc",children:Ot})]}),u.jsx("button",{type:"button",onClick:()=>{if(x){o.current?.click();return}F.length>0&&(async()=>{const C=await ct(F,{allowLocalLoadFallback:!1});C&&(j(C),o.current?.click())})()},className:"load-session__browse-btn load-session__browse-btn--secondary",disabled:!U,children:"Select Raw Logs"})]}),H.length>0?u.jsxs("p",{className:"load-session__raw-target-name","aria-live":"polite",children:["Session: ",H[0].goal??H[0].session_id??H[0].key]}):null,Q?u.jsx("p",{className:"load-session__drop-status",children:Q}):null]})]})]}),u.jsxs("div",{className:"load-session__workflow-connector","aria-hidden":!0,children:[u.jsx("span",{className:"load-session__workflow-line"}),u.jsx("span",{className:"load-session__workflow-arrow"})]}),u.jsx("div",{className:"load-session__workflow-right",children:u.jsxs("button",{type:"button",onClick:()=>{if(ht){dt(ht);return}F.length>0&&(async()=>{const C=await ct(F,{allowLocalLoadFallback:!0});C&&await dt(C)})()},className:`load-session__open-cta ${P?"load-session__open-cta--ready":""}`,disabled:!P,title:P?"Launch session":"Select or import session logs first",children:[u.jsx("span",{className:"load-session__open-cta-glow","aria-hidden":!0}),u.jsx("span",{className:"load-session__open-cta-text",children:"Launch Session"})]})})]}),u.jsxs("section",{className:"load-session__local",role:"region","aria-label":"Local Sessions",children:[u.jsxs("div",{className:"load-session__local-head",children:[u.jsxs("div",{className:"load-session__local-title-wrap",children:[u.jsxs("svg",{className:"load-session__local-icon",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[u.jsx("circle",{cx:"12",cy:"12",r:"10"}),u.jsx("polyline",{points:"12 6 12 12 16 14"})]}),u.jsx("h2",{className:"load-session__local-heading",children:"Local Sessions"})]}),u.jsx("button",{type:"button",onClick:()=>{ot()},className:"load-session__clear-history",disabled:m,children:"Clear History"})]}),p?u.jsxs("p",{className:"load-session__local-error",children:["Local dashboard API unavailable (",p,")."]}):null,!p&&g.length===0?u.jsx("p",{className:"load-session__local-empty",children:"No session files found in local storage."}):null,u.jsx("div",{className:"load-session__local-list",children:g.slice(0,Z?100:6).map(C=>u.jsxs("button",{type:"button",className:"load-session__local-card",onClick:()=>{it(C.key)},title:C.goal??C.session_id,children:[u.jsx("span",{className:"load-session__local-card-icon","aria-hidden":!0,children:"{}"}),u.jsx("span",{className:"load-session__local-card-name",children:C.goal??C.session_id}),u.jsxs("p",{className:"load-session__local-card-desc",children:[C.event_count," events · ",C.outcome??"unknown"," ·"," ",new Date(C.updated_at).toLocaleString()]}),u.jsx("span",{className:"load-session__local-card-chevron","aria-hidden":!0,children:">"})]},`${C.key}-${C.updated_at}`))}),u.jsxs("button",{type:"button",className:"load-session__view-all",onClick:()=>W(C=>!C),children:[u.jsx("span",{"aria-hidden":!0,children:"+"})," ",Z?"Show fewer":"View All Sessions"]})]}),u.jsxs("footer",{className:"load-session__footer",children:[u.jsxs("span",{className:"load-session__footer-copy",children:["©",new Date().getFullYear()," AgentLens Engine. Built for high-performance animation workflows."]}),u.jsxs("div",{className:"load-session__footer-links",children:[u.jsx("a",{href:"https://github.com/Xiaolei-Shawn/AgentLens",className:"load-session__footer-link",target:"_blank",rel:"noreferrer",children:"Documentation"}),u.jsxs("span",{className:"load-session__footer-version",children:["v",lv]})]})]}),u.jsx("input",{ref:r,type:"file",multiple:!0,accept:".json,.jsonl,.log,application/json",className:"file-input",onChange:C=>{const K=C.target.files;if(K&&K.length>0){const at=Array.from(K);Ht(at)}C.target.value=""},"aria-label":"Choose canonical MCP session files"}),u.jsx("input",{ref:o,type:"file",accept:".json,.jsonl,.txt,text/plain,application/json",className:"file-input",onChange:C=>{I(C.target.files),C.target.value=""},"aria-label":"Choose raw log file to merge"})]})}const Nm=3,sv=5;function Ph(i){return i==="high"?3:i==="medium"?2:1}function Mm(i){return[...new Set(i)]}function cv(i,c=220){return i.length<=c?i:`${i.slice(0,c-3)}...`}function uv(i){return i?.files?.find(c=>typeof c=="string"&&c.trim()!=="")}function ov(i){return uv(i.scope)??i.scope?.modules?.[0]}function an(i,c,r,o,m,d,p,y){return{id:`${i}_${c}_${o.toLowerCase().replace(/[^a-z0-9]+/g,"_")}`.slice(0,120),source_id:c,source_type:i,category:r,title:o,description:y?cv(y):void 0,actions:m,priority:d,confidence:Math.max(0,Math.min(1,Number(p.toFixed(2))))}}function rv(i){const c=[],r=Mm(i.reasons).slice(0,3),o=ov(i);return i.level==="low"?(r.some(d=>/(no verification|failed|schema|api|security)/i.test(d))&&c.push(an("risk",i.id,"verification","Run targeted verification",[{type:"run_verification",label:"Run targeted checks",payload:{scope:o??"changed area"}}],"medium",.7,`Risk is low but contains sensitive signal: ${r.join("; ")}.`)),c):i.level==="high"?(c.push(an("risk",i.id,"verification","Run full verification before merge",[{type:"run_verification",label:"Run full test/lint/typecheck suite",payload:{scope:"full"}}],"high",.92,`High risk due to: ${r.join("; ")}.`)),o&&c.push(an("risk",i.id,"mitigation","Review critical diff in impacted area",[{type:"open_diff",label:`Open diff for ${o}`,payload:{path:o}},{type:"jump_to_event",label:"Jump to risk event",payload:{id:i.id}}],"high",.88,"Critical areas should be reviewed before acceptance.")),c.push(an("risk",i.id,"mitigation","Ask agent to harden implementation",[{type:"prompt_agent",label:"Request hardening pass",payload:{prompt:`Harden the implementation for risk ${i.id}. Focus on: ${r.join("; ")}. Add defensive validation and robust error handling.`}}],"high",.84,"Targeted hardening addresses the highest-risk failure modes.")),c.slice(0,Nm)):(o&&c.push(an("risk",i.id,"investigation","Inspect changed area tied to medium risk",[{type:"open_diff",label:`Open diff for ${o}`,payload:{path:o}}],"medium",.78,`Medium risk signals: ${r.join("; ")}.`)),c.push(an("risk",i.id,"verification","Run targeted verification",[{type:"run_verification",label:"Run targeted checks",payload:{scope:o??"changed modules"}}],"medium",.8)),c.push(an("risk",i.id,"investigation","Request focused risk analysis",[{type:"request_analysis",label:"Ask agent for risk-focused review",payload:{prompt:`Analyze risk ${i.id} and identify the top failure paths plus the minimum fixes. Context: ${r.join("; ")}.`}}],"medium",.74)),c.slice(0,2))}function fv(i){const c=[];return c.push(an("hotspot",i.id,"investigation","Inspect hotspot file",[{type:"open_file",label:`Open ${i.file}`,payload:{path:i.file}}],i.score>=10?"high":"medium",.86,`Hotspot score ${i.score}. Reasons: ${Mm(i.reasons).slice(0,2).join("; ")}.`)),c.push(an("hotspot",i.id,"investigation","Replay file evolution",[{type:"replay_file",label:`Replay ${i.file}`,payload:{path:i.file}}],"medium",.82)),c.push(an("hotspot",i.id,"investigation","Ask agent to explain hotspot changes",[{type:"request_analysis",label:"Request change explanation",payload:{prompt:`Explain the highest-risk edits in ${i.file}, why they were needed, and what regression checks are still missing.`}}],"medium",.74)),c.slice(0,2)}function dv(i){const c=[];if(!(i.validated===!1||i.validated==="unknown"))return c;const o=i.risk==="high"?"high":"medium";c.push(an("assumption",i.id,"verification","Validate unresolved assumption",[{type:"request_analysis",label:"Ask agent to validate assumption",payload:{prompt:`Validate assumption: "${i.statement}". Provide evidence, edge cases, and whether this should be converted into a concrete check.`}}],o,i.risk==="high"?.87:.78));const m=i.related_files?.[0];return c.push(an("assumption",i.id,"verification",m?"Generate tests for assumption-affected file":"Generate tests for assumption path",[{type:"generate_tests",label:m?`Generate tests for ${m}`:"Generate tests for assumption scenario",payload:{target:m??i.statement}}],o,m?.8:.72)),i.risk==="high"&&c.push(an("assumption",i.id,"mitigation","Add defensive fallback checks",[{type:"prompt_agent",label:"Add defensive checks",payload:{prompt:`Add defensive checks and fallback handling for assumption "${i.statement}"${m?` in ${m}`:""}.`}}],"high",.76)),c.slice(0,2)}function hv(i){const c=new Set,r=[];for(const o of i){const m=o.actions.map(p=>`${p.type}:${JSON.stringify(p.payload??{})}`).join("|"),d=`${o.source_type}|${o.source_id}|${o.category}|${m}`;c.has(d)||(c.add(d),r.push(o))}return r}function mv(i){const c=[...i].sort((m,d)=>{const p=Ph(d.priority)-Ph(m.priority);return p!==0?p:d.confidence-m.confidence}),r=[],o=new Map;for(const m of c){if(r.length>=sv)break;const d=o.get(m.category)??0;d>=3||(r.push(m),o.set(m.category,d+1))}return r}function _v(i){const c=i.risks??[],r=i.hotspots??[],o=i.assumptions??[];if(c.length===0&&r.length===0&&o.length===0)return[];const m=new Map,d=[],p=(g,v)=>{let _=m.get(g)??0;for(const w of v){if(_>=Nm)break;d.push(w),_+=1}m.set(g,_)};for(const g of c)p(`risk:${g.id}`,rv(g));for(const g of r)p(`hotspot:${g.id}`,fv(g));for(const g of o)p(`assumption:${g.id}`,dv(g));const y=hv(d);return mv(y)}function pv(i){return i.filter(c=>c.kind==="assumption").map(c=>({event_id:c.id,intent_id:c.scope?.intent_id,statement:typeof c.payload.statement=="string"?c.payload.statement:"Assumption",validated:c.payload.validated===!0||c.payload.validated===!1||c.payload.validated==="unknown"?c.payload.validated:"unknown",risk:c.payload.risk==="low"||c.payload.risk==="medium"||c.payload.risk==="high"?c.payload.risk:void 0,ts:c.ts}))}function vv(i,c,r,o,m,d){return[]}function yv(i,c,r){return[]}function gv(i,c){let r=c.coverage==="full"?.8:c.coverage==="partial"?.6:.4;return i.verifications.some(o=>o.result==="fail")&&(r-=.1),Math.max(0,Math.min(1,Number(r.toFixed(2))))}function bv(i){const c=i.risks.map(m=>({id:m.id,level:m.level,reasons:m.reasons})),r=i.hotspots.map(m=>({id:m.id,file:m.file,score:m.score,reasons:["hotspot"]})),o=i.assumptions.map(m=>({id:m.event_id,statement:m.statement,validated:m.validated,risk:m.risk}));return _v({risks:c,hotspots:r,assumptions:o})}const Em={repeatedEditThreshold:3,largeChangeLineThreshold:120,recentChangeWindowMs:600*1e3,enableProInsights:!0};function sn(i){if(typeof i=="number")return Number.isFinite(i)?i:0;if(typeof i=="string"&&i.trim()!==""){const c=Number(i);return Number.isFinite(c)?c:0}return 0}function Ne(i){return typeof i=="string"&&i.trim()!==""?i:void 0}function qe(i){return i.payload??{}}function Pn(i){const c=Ne(qe(i).intent_id);return i.scope?.intent_id??c}function Tm(i){if(i.kind!=="file_op")return;const c=qe(i);return Ne(c.target)??i.scope?.file}function xv(i){const c=i.split("/").filter(Boolean);return c.length===0?"root":c[0]}function Sv(i){const c=qe(i),r=c.usage,o=c.details,m=o&&typeof o=="object"?o.llm_usage:void 0,d=r&&typeof r=="object"?r:m&&typeof m=="object"?m:null;if(!d)return null;const p=sn(d.prompt_tokens),y=sn(d.completion_tokens),g=sn(d.total_tokens),v=g>0?g:p+y;if(v<=0&&p<=0&&y<=0)return null;const _=sn(d.estimated_cost_usd);return{model:Ne(d.model),prompt_tokens:p,completion_tokens:y,total_tokens:v,estimated_cost_usd:_>0?_:void 0}}function jv(i){let c=0,r=0,o=0,m=0,d=!1;const p=new Map,y=new Map;for(const _ of i){const w=Sv(_);if(!w)continue;d=!0,c+=w.prompt_tokens,r+=w.completion_tokens,o+=w.total_tokens,w.estimated_cost_usd!=null&&(m+=w.estimated_cost_usd);const H=qe(_),Y=_.kind==="tool_call"||_.kind==="file_op"?Ne(H.category)??(_.kind==="file_op"?"file":"tool"):_.kind;p.set(Y,(p.get(Y)??0)+w.total_tokens);const R=Pn(_)??"session";y.set(R,(y.get(R)??0)+w.total_tokens)}if(!d)return;const g=[...p.entries()].map(([_,w])=>({category:_,total_tokens:w})).sort((_,w)=>w.total_tokens-_.total_tokens),v=[...y.entries()].map(([_,w])=>({intent_id:_==="session"?void 0:_,total_tokens:w})).sort((_,w)=>w.total_tokens-_.total_tokens);return{prompt_tokens:c,completion_tokens:r,total_tokens:o,estimated_cost_usd:m>0?Number(m.toFixed(6)):void 0,by_category:g,by_intent:v}}function wv(i){const c=[...i].reverse().find(o=>o.kind==="session_end");if(!c)return"unknown";const r=Ne(qe(c).outcome);return r==="completed"||r==="partial"||r==="failed"||r==="aborted"?r:"unknown"}function Nv(i){return[...i].sort((c,r)=>c.seq!==r.seq?c.seq-r.seq:c.ts.localeCompare(r.ts))}function Mv(i){const c=[];for(let r=0;r<i.length;r++){const o=i[r];if(o.kind!=="intent")continue;const m=qe(o),d=Pn(o)??`intent_auto_${o.seq}`;c.push({intentId:d,eventIndex:r}),m.intent_id||(m.intent_id=d)}return c}function Ev(i,c,r,o){const m=Pn(i);if(m)return m;let d;for(const p of r)if(p.eventIndex<=c)d=p;else break;return d?.intentId??o}function Tv(i,c,r){const o=i.some(d=>d.kind==="file_op"||d.kind==="tool_call");return i.some(d=>d.kind==="verification"&&Ne(qe(d).result)==="pass")?"completed":c&&o?"abandoned":o||r==="completed"?"partial":"abandoned"}function kv(i){return i.filter(c=>c.kind==="decision").map(c=>{const r=qe(c);return{event_id:c.id,intent_id:Pn(c),summary:Ne(r.summary)??"Decision",rationale:Ne(r.rationale),options:Array.isArray(r.options)?r.options.map(String):void 0,chosen_option:Ne(r.chosen_option),reversibility:r.reversibility==="easy"||r.reversibility==="medium"||r.reversibility==="hard"?r.reversibility:void 0,ts:c.ts}})}function Av(i){return pv(i)}function zv(i){return i.filter(c=>c.kind==="verification").map(c=>{const r=qe(c),o=r.type==="test"||r.type==="lint"||r.type==="typecheck"||r.type==="manual"?r.type:"manual",m=r.result==="pass"||r.result==="fail"||r.result==="unknown"?r.result:"unknown";return{event_id:c.id,intent_id:Pn(c),type:o,result:m,details:Ne(r.details),ts:c.ts}})}function Cv(i,c,r){const o=[],m=i.filter(p=>p.kind==="file_op"),d=new Map;for(const p of m){const y=Tm(p);if(!y)continue;const g=d.get(y)??[];g.push(p),d.set(y,g)}for(const[p,y]of d.entries()){y.length>r.repeatedEditThreshold&&o.push({id:`rev_repeat_${p}`,intent_id:Pn(y[0]),type:"repeat_file_edits",file:p,related_event_ids:y.map(_=>_.id),explanation:`${p} was modified ${y.length} times (threshold ${r.repeatedEditThreshold}).`,confidence:.82});const g=y.find(_=>Ne(qe(_).action)==="create"),v=y.find(_=>Ne(qe(_).action)==="delete");g&&v&&o.push({id:`rev_create_delete_${p}`,intent_id:Pn(v)??Pn(g),type:"create_then_delete",file:p,related_event_ids:[g.id,v.id],explanation:`${p} was created and later deleted in the same session.`,confidence:.92});for(let _=1;_<y.length;_++){const w=y[_-1],H=y[_],Y=qe(H),R=sn(Y.lines_added)+sn(Y.lines_removed)+sn(Y.added)+sn(Y.removed),$=new Date(H.ts).getTime()-new Date(w.ts).getTime();R>=r.largeChangeLineThreshold&&$>=0&&$<=r.recentChangeWindowMs&&o.push({id:`rev_large_quick_${p}_${H.seq}`,intent_id:Pn(H),type:"large_change_after_recent_change",file:p,related_event_ids:[w.id,H.id],explanation:`${p} had a large change (${R} lines) shortly after an earlier change (${Math.round($/1e3)}s).`,confidence:.76})}}for(let p=0;p<c.length-1;p++){const y=c[p],g=c[p+1];(y.status==="abandoned"||y.status==="partial")&&o.push({id:`rev_supersede_${y.id}`,intent_id:y.id,type:"intent_superseded",related_event_ids:[...y.event_ids,...g.event_ids].slice(0,12),explanation:`Intent "${y.title}" was superseded by "${g.title}" before completion.`,confidence:.72})}return o}function Ov(i){const c=i.files.size;return i.publicApi||i.schema||c>=10?"large":i.dependency||c>=4?"medium":"small"}function tm(i,c,r){const o=new Set,m=new Set;let d=!1,p=!1,y=!1,g=0,v=0;for(const w of r){if(w.kind!=="file_op")continue;const H=qe(w),Y=Tm(w);if(!Y)continue;o.add(Y),m.add(xv(Y));const R=Y.toLowerCase();(R.includes("/api/")||R.includes("/routes/")||R.includes("/controller")||R.endsWith("/index.ts"))&&(d=!0),(R.endsWith("/package.json")||R.endsWith("/pnpm-lock.yaml")||R.endsWith("/package-lock.json")||R.endsWith("/yarn.lock"))&&(p=!0),(R.includes("/migrations/")||R.includes("/migration/")||R.endsWith(".sql")||R.includes("schema.prisma"))&&(y=!0),H.dependency_added===!0&&(p=!0),g+=sn(H.lines_added)+sn(H.added),v+=sn(H.lines_removed)+sn(H.removed)}const _=Ov({files:o,publicApi:d,dependency:p,schema:y});return{id:i,intent_id:c,files_touched:[...o],modules_affected:[...m],public_api_changed:d,dependency_added:p,schema_changed:y,lines_added:g,lines_removed:v,blast_radius:_}}function Dv(i,c,r,o,m,d){return vv()}function Rv(i,c,r){return yv()}function Uv(i){const c=i.filter(d=>d.result==="pass").length,r=i.filter(d=>d.result==="fail").length,o=i.filter(d=>d.result==="unknown").length,m=i.length===0?"none":r>0||o>0?"partial":"full";return{pass:c,fail:r,unknown:o,coverage:m}}function qv(i,c={}){const r={...Em,...c},o=Nv(i),m=o[0],d=o.find(W=>W.kind==="session_start"),p=d?qe(d):{},y=wv(o),g="intent_fallback",v=Mv(o),_=new Map;for(let W=0;W<o.length;W++){const F=o[W];if(F.kind==="session_start"||F.kind==="session_end")continue;const V=Ev(F,W,v,g),lt=_.get(V)??[];lt.push(F),_.set(V,lt)}const w=[...new Set([...v.map(W=>W.intentId),..._.keys()])],H=w.map((W,F)=>{const V=_.get(W)??[],lt=V.find(ct=>ct.kind==="intent"),ft=lt?qe(lt):{},dt=V[0]?.seq??v[F]?.eventIndex??0,ot=V[V.length-1]?.seq??dt,it=F<w.length-1;return{id:W,title:Ne(ft.title)??(W===g?"Fallback intent":W),description:Ne(ft.description),priority:sn(ft.priority)||void 0,start_seq:dt,end_seq:ot,status:Tv(V,it,y),event_ids:V.map(ct=>ct.id)}}),Y=kv(o),R=r.enableProInsights?Av(o):[],$=zv(o),Q=Cv(o,H,r),J=[];for(const W of H){const F=(_.get(W.id)??[]).filter(V=>V.kind==="file_op");J.push(tm(`impact_${W.id}`,W.id,F))}J.push(tm("impact_session_total",void 0,o.filter(W=>W.kind==="file_op")));const ht=r.enableProInsights?Dv():[],j=r.enableProInsights?Rv():[],Z=jv(o);return{metadata:{session_id:m?.session_id??"unknown",goal:Ne(p.goal)??"Unknown goal",started_at:d?.ts,ended_at:[...o].reverse().find(W=>W.kind==="session_end")?.ts,outcome:y,repo:Ne(p.repo),branch:Ne(p.branch),token_usage:Z,schema_version:m?.schema_version??1},intents:H,decisions:Y,assumptions:R,revisions:Q,impacts:J,risks:ht,verifications:$,hotspots:j,raw_events:o}}function Hv(i,c={}){const r=c.enableProInsights??!0,o=Uv(i.verifications),m=i.intents.map(y=>{const g=i.impacts.find(_=>_.intent_id===y.id),v=r?i.risks.filter(_=>_.intent_id===y.id).map(_=>_.level):[];return{intent_id:y.id,title:y.title,status:y.status,files_touched:g?.files_touched.length??0,risks:v}}),d=r?i.risks.filter(y=>y.level==="high").sort((y,g)=>g.score-y.score).map(y=>({intent_id:y.intent_id,level:y.level,score:y.score,reasons:y.reasons,mitigations:y.mitigations})):[],p=r?bv(i):[];return{goal:i.metadata.goal,outcome:i.metadata.outcome,key_decisions:i.decisions.slice(0,5).map(y=>({summary:y.summary,rationale:y.rationale,intent_id:y.intent_id})),high_risk_items:d,hotspots:r?i.hotspots.slice(0,8).map(y=>({file:y.file,score:y.score})):[],intent_summaries:m,verification_summary:o,token_summary:i.metadata.token_usage,recommended_actions:p,confidence_estimate:r?gv(i,o):o.coverage==="full"?.8:o.coverage==="partial"?.6:.4}}function km(i,c){const r=qv(i,c),o=Hv(r,{enableProInsights:Em.enableProInsights});return{normalized:r,reviewer:o}}const Lv=[{id:"e1",session_id:"sess_demo",seq:1,ts:"2026-02-15T10:00:00.000Z",kind:"session_start",actor:{type:"agent"},payload:{goal:"Refactor audit pipeline",repo:"AL/webapp",branch:"codex/audit"},schema_version:1},{id:"e2",session_id:"sess_demo",seq:2,ts:"2026-02-15T10:01:00.000Z",kind:"intent",actor:{type:"agent"},scope:{intent_id:"intent_a"},payload:{intent_id:"intent_a",title:"Build normalization layer",priority:1},schema_version:1},{id:"e3",session_id:"sess_demo",seq:3,ts:"2026-02-15T10:02:00.000Z",kind:"file_op",actor:{type:"agent"},scope:{intent_id:"intent_a",file:"src/lib/auditPipeline.ts"},payload:{category:"file",action:"edit",target:"src/lib/auditPipeline.ts",lines_added:220,lines_removed:5},schema_version:1},{id:"e4",session_id:"sess_demo",seq:4,ts:"2026-02-15T10:03:00.000Z",kind:"decision",actor:{type:"agent"},scope:{intent_id:"intent_a"},payload:{summary:"Use rule-based scoring first",rationale:"Predictable reviewer UX"},schema_version:1},{id:"e5",session_id:"sess_demo",seq:5,ts:"2026-02-15T10:04:00.000Z",kind:"verification",actor:{type:"agent"},scope:{intent_id:"intent_a"},payload:{type:"test",result:"pass",details:"npm run build"},schema_version:1},{id:"e6",session_id:"sess_demo",seq:6,ts:"2026-02-15T10:05:00.000Z",kind:"session_end",actor:{type:"agent"},payload:{outcome:"completed",summary:"pipeline implemented"},schema_version:1}];km(Lv);function rc(i){return i.kind==="intent"}function Oi(i){return i.kind==="file_op"}function fc(i){return i.kind==="tool_call"}function dc(i){return i.kind==="decision"}function Io(i){return i.kind==="assumption"}function Di(i){return i.kind==="verification"}function Go(i){return i.ts}function qt(i,c){const r=i.payload?.[c];return typeof r=="string"&&r.trim()!==""?r:void 0}function Po(i){if(!Oi(i))return;const c=qt(i,"target");return c||i.scope?.file}function em(i,c,r){return i.kind==="session_start"||c===0||i.kind==="session_end"||c===r?!0:rc(i)||dc(i)||Di(i)}function Bv(i,c,r){return i.kind==="session_start"||c===0?"start":i.kind==="session_end"||c===r?"end":rc(i)?"intent":dc(i)?"decision":Io(i)?"assumption":Di(i)?"verification":fc(i)?"tool":Oi(i)?"file":"other"}function Yv(i){const r={start:"M 0,-7 a 7,7 0 1 1 0,14 a 7,7 0 1 1 0,-14",intent:"M 0,-7 L 7,0 L 0,7 L -7,0 Z",decision:"M -7,0 L 0,-7 L 7,0 L 0,7 Z",assumption:"M 0,-7 L 7,7 L -7,7 Z",verification:"M -7,-7 L 7,-7 L 7,7 L -7,7 Z",tool:"M 0,-7 L 7,7 L -7,7 Z",file:"M -7,-7 L 7,-7 L 7,7 L -7,7 Z",end:`M 0,-7 L ${6.6499999999999995},${-2.17} L ${4.13},${5.67} L ${-4.13},${5.67} L ${-6.6499999999999995},${-2.17} Z`,other:"M 0,-7 a 7,7 0 1 1 0,14 a 7,7 0 1 1 0,-14"};return r[i]??r.other}function $v(i){if(i.kind==="session_start")return"Start";if(i.kind==="session_end")return"End";if(rc(i))return qt(i,"title")??"Intent";if(dc(i))return"Decision";if(Io(i))return"Assumption";if(Di(i)){const c=qt(i,"result");return c?`Verify:${c}`:"Verification"}if(fc(i))return qt(i,"action")??"Tool";if(Oi(i)){const c=Po(i)??"file",r=c.split("/").pop()??c;return r.slice(0,18)+(r.length>18?"…":"")}return i.kind}function Ni(i){if(i.kind==="session_start")return`Session started: ${qt(i,"goal")??"goal unknown"}`;if(i.kind==="session_end")return`Session ended: ${qt(i,"outcome")??"unknown outcome"}`;if(rc(i)){const c=qt(i,"title")??"Intent",r=qt(i,"description");return r?`${c} — ${r}`:c}if(dc(i))return qt(i,"summary")??"Decision recorded";if(Io(i))return qt(i,"statement")??"Assumption recorded";if(Di(i)){const c=qt(i,"type")??"verification",r=qt(i,"result")??"unknown";return`${c}: ${r}`}if(fc(i)){const c=qt(i,"action")??"tool call",r=qt(i,"category");return r?`${r}: ${c}`:c}if(Oi(i)){const c=qt(i,"action")??"edit",r=Po(i)??"(unknown file)";return`${c}: ${r}`}return i.kind}function Gv(i,c){const r=Go(i),o=r?new Date(r).toLocaleTimeString(void 0,{hour12:!1}):"--:--:--",m=$v(i);return`[${o}] ${i.kind}: ${m}`}function Mi(i,c,r){if(c<0||r>=i.length||c>=r)return null;const o=Go(i[c]),m=Go(i[r]);if(!o||!m)return null;const d=new Date(o).getTime(),p=new Date(m).getTime();return Number.isNaN(d)||Number.isNaN(p)?null:p-d}function Ei(i){return i==null||i<0?"—":i<1e3?`${i}ms`:`${(i/1e3).toFixed(1)}s`}function An(){}An.prototype={diff:function(c,r){var o,m=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},d=m.callback;typeof m=="function"&&(d=m,m={});var p=this;function y(Z){return Z=p.postProcess(Z,m),d?(setTimeout(function(){d(Z)},0),!0):Z}c=this.castInput(c,m),r=this.castInput(r,m),c=this.removeEmpty(this.tokenize(c,m)),r=this.removeEmpty(this.tokenize(r,m));var g=r.length,v=c.length,_=1,w=g+v;m.maxEditLength!=null&&(w=Math.min(w,m.maxEditLength));var H=(o=m.timeout)!==null&&o!==void 0?o:1/0,Y=Date.now()+H,R=[{oldPos:-1,lastComponent:void 0}],$=this.extractCommon(R[0],r,c,0,m);if(R[0].oldPos+1>=v&&$+1>=g)return y(nm(p,R[0].lastComponent,r,c,p.useLongestToken));var Q=-1/0,J=1/0;function ht(){for(var Z=Math.max(Q,-_);Z<=Math.min(J,_);Z+=2){var W=void 0,F=R[Z-1],V=R[Z+1];F&&(R[Z-1]=void 0);var lt=!1;if(V){var ft=V.oldPos-Z;lt=V&&0<=ft&&ft<g}var dt=F&&F.oldPos+1<v;if(!lt&&!dt){R[Z]=void 0;continue}if(!dt||lt&&F.oldPos<V.oldPos?W=p.addToPath(V,!0,!1,0,m):W=p.addToPath(F,!1,!0,1,m),$=p.extractCommon(W,r,c,Z,m),W.oldPos+1>=v&&$+1>=g)return y(nm(p,W.lastComponent,r,c,p.useLongestToken));R[Z]=W,W.oldPos+1>=v&&(J=Math.min(J,Z-1)),$+1>=g&&(Q=Math.max(Q,Z+1))}_++}if(d)(function Z(){setTimeout(function(){if(_>w||Date.now()>Y)return d();ht()||Z()},0)})();else for(;_<=w&&Date.now()<=Y;){var j=ht();if(j)return j}},addToPath:function(c,r,o,m,d){var p=c.lastComponent;return p&&!d.oneChangePerToken&&p.added===r&&p.removed===o?{oldPos:c.oldPos+m,lastComponent:{count:p.count+1,added:r,removed:o,previousComponent:p.previousComponent}}:{oldPos:c.oldPos+m,lastComponent:{count:1,added:r,removed:o,previousComponent:p}}},extractCommon:function(c,r,o,m,d){for(var p=r.length,y=o.length,g=c.oldPos,v=g-m,_=0;v+1<p&&g+1<y&&this.equals(o[g+1],r[v+1],d);)v++,g++,_++,d.oneChangePerToken&&(c.lastComponent={count:1,previousComponent:c.lastComponent,added:!1,removed:!1});return _&&!d.oneChangePerToken&&(c.lastComponent={count:_,previousComponent:c.lastComponent,added:!1,removed:!1}),c.oldPos=g,v},equals:function(c,r,o){return o.comparator?o.comparator(c,r):c===r||o.ignoreCase&&c.toLowerCase()===r.toLowerCase()},removeEmpty:function(c){for(var r=[],o=0;o<c.length;o++)c[o]&&r.push(c[o]);return r},castInput:function(c){return c},tokenize:function(c){return Array.from(c)},join:function(c){return c.join("")},postProcess:function(c){return c}};function nm(i,c,r,o,m){for(var d=[],p;c;)d.push(c),p=c.previousComponent,delete c.previousComponent,c=p;d.reverse();for(var y=0,g=d.length,v=0,_=0;y<g;y++){var w=d[y];if(w.removed)w.value=i.join(o.slice(_,_+w.count)),_+=w.count;else{if(!w.added&&m){var H=r.slice(v,v+w.count);H=H.map(function(Y,R){var $=o[_+R];return $.length>Y.length?$:Y}),w.value=i.join(H)}else w.value=i.join(r.slice(v,v+w.count));v+=w.count,w.added||(_+=w.count)}}return d}function lm(i,c){var r;for(r=0;r<i.length&&r<c.length;r++)if(i[r]!=c[r])return i.slice(0,r);return i.slice(0,r)}function am(i,c){var r;if(!i||!c||i[i.length-1]!=c[c.length-1])return"";for(r=0;r<i.length&&r<c.length;r++)if(i[i.length-(r+1)]!=c[c.length-(r+1)])return i.slice(-r);return i.slice(-r)}function Xo(i,c,r){if(i.slice(0,c.length)!=c)throw Error("string ".concat(JSON.stringify(i)," doesn't start with prefix ").concat(JSON.stringify(c),"; this is a bug"));return r+i.slice(c.length)}function Zo(i,c,r){if(!c)return i+r;if(i.slice(-c.length)!=c)throw Error("string ".concat(JSON.stringify(i)," doesn't end with suffix ").concat(JSON.stringify(c),"; this is a bug"));return i.slice(0,-c.length)+r}function Ti(i,c){return Xo(i,c,"")}function ec(i,c){return Zo(i,c,"")}function im(i,c){return c.slice(0,Xv(i,c))}function Xv(i,c){var r=0;i.length>c.length&&(r=i.length-c.length);var o=c.length;i.length<c.length&&(o=i.length);var m=Array(o),d=0;m[0]=0;for(var p=1;p<o;p++){for(c[p]==c[d]?m[p]=m[d]:m[p]=d;d>0&&c[p]!=c[d];)d=m[d];c[p]==c[d]&&d++}d=0;for(var y=r;y<i.length;y++){for(;d>0&&i[y]!=c[d];)d=m[d];i[y]==c[d]&&d++}return d}var cc="a-zA-Z0-9_\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",Zv=new RegExp("[".concat(cc,"]+|\\s+|[^").concat(cc,"]"),"ug"),hc=new An;hc.equals=function(i,c,r){return r.ignoreCase&&(i=i.toLowerCase(),c=c.toLowerCase()),i.trim()===c.trim()};hc.tokenize=function(i){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r;if(c.intlSegmenter){if(c.intlSegmenter.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');r=Array.from(c.intlSegmenter.segment(i),function(d){return d.segment})}else r=i.match(Zv)||[];var o=[],m=null;return r.forEach(function(d){/\s/.test(d)?m==null?o.push(d):o.push(o.pop()+d):/\s/.test(m)?o[o.length-1]==m?o.push(o.pop()+d):o.push(m+d):o.push(d),m=d}),o};hc.join=function(i){return i.map(function(c,r){return r==0?c:c.replace(/^\s+/,"")}).join("")};hc.postProcess=function(i,c){if(!i||c.oneChangePerToken)return i;var r=null,o=null,m=null;return i.forEach(function(d){d.added?o=d:d.removed?m=d:((o||m)&&sm(r,m,o,d),r=d,o=null,m=null)}),(o||m)&&sm(r,m,o,null),i};function sm(i,c,r,o){if(c&&r){var m=c.value.match(/^\s*/)[0],d=c.value.match(/\s*$/)[0],p=r.value.match(/^\s*/)[0],y=r.value.match(/\s*$/)[0];if(i){var g=lm(m,p);i.value=Zo(i.value,p,g),c.value=Ti(c.value,g),r.value=Ti(r.value,g)}if(o){var v=am(d,y);o.value=Xo(o.value,y,v),c.value=ec(c.value,v),r.value=ec(r.value,v)}}else if(r)i&&(r.value=r.value.replace(/^\s*/,"")),o&&(o.value=o.value.replace(/^\s*/,""));else if(i&&o){var _=o.value.match(/^\s*/)[0],w=c.value.match(/^\s*/)[0],H=c.value.match(/\s*$/)[0],Y=lm(_,w);c.value=Ti(c.value,Y);var R=am(Ti(_,Y),H);c.value=ec(c.value,R),o.value=Xo(o.value,_,R),i.value=Zo(i.value,_,_.slice(0,_.length-R.length))}else if(o){var $=o.value.match(/^\s*/)[0],Q=c.value.match(/\s*$/)[0],J=im(Q,$);c.value=ec(c.value,J)}else if(i){var ht=i.value.match(/\s*$/)[0],j=c.value.match(/^\s*/)[0],Z=im(ht,j);c.value=Ti(c.value,Z)}}var Qv=new An;Qv.tokenize=function(i){var c=new RegExp("(\\r?\\n)|[".concat(cc,"]+|[^\\S\\n\\r]+|[^").concat(cc,"]"),"ug");return i.match(c)||[]};var mc=new An;mc.tokenize=function(i,c){c.stripTrailingCr&&(i=i.replace(/\r\n/g,`
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>AgentLens</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-D58B6Vu8.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/assets/index-BZZF-5Ek.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xiaolei.shawn/mcp-server",
|
|
3
|
-
"version": "0.4.
|
|
4
|
-
"description": "Local-first MCP server for AI agent session auditing, with embedded dashboard.",
|
|
3
|
+
"version": "0.4.1",
|
|
4
|
+
"description": "Local-first MCP server for AI agent session auditing, with embedded dashboard. Using the mcp-gateway-audit agent skill is highly recommended for complete canonical event traces.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"exports": {
|