failproofai 0.0.9-beta.2 → 0.0.10-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/standalone/.cursor/hooks.json +47 -0
- package/.next/standalone/.gemini/settings.json +147 -0
- package/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/build-manifest.json +3 -3
- package/.next/standalone/.next/prerender-manifest.json +3 -3
- package/.next/standalone/.next/required-server-files.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page.js +1 -1
- package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/.next/server/app/_global-error.rsc +7 -7
- package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +7 -7
- package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/_not-found/page.js +1 -1
- package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +2 -2
- package/.next/standalone/.next/server/app/_not-found.rsc +17 -17
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +17 -17
- package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
- package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +11 -11
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/api/download/[project]/[session]/route.js +2 -1
- package/.next/standalone/.next/server/app/api/download/[project]/[session]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/index.html +1 -1
- package/.next/standalone/.next/server/app/index.rsc +16 -16
- package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +16 -16
- package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +4 -4
- package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +11 -11
- package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/page.js +1 -1
- package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/policies/page/server-reference-manifest.json +8 -8
- package/.next/standalone/.next/server/app/policies/page.js +1 -1
- package/.next/standalone/.next/server/app/policies/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/policies/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page.js +2 -2
- package/.next/standalone/.next/server/app/project/[name]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/react-loadable-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/server-reference-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js +5 -5
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/projects/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/projects/page.js +2 -2
- package/.next/standalone/.next/server/app/projects/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0.~nmr9._.js +3 -0
- package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0yspgjy._.js → [root-of-the-server]__010i6f5._.js} +2 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__08px0ym._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0b57.gk._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0dtn9lr._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0kjo7d_._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0vlhtkc._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0wu7fr7._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0yfq1yr._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0z4c5dj._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0zso~62._.js +3 -0
- package/.next/standalone/.next/server/chunks/package_json_[json]_cjs_0z7w.hh._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0-2wr.c._.js +4 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0.~m-w2._.js +4 -0
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__09icjsf._.js → [root-of-the-server]__0709m8.._.js} +3 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0bz245.._.js +4 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0dl0kgt._.js +4 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0gmhxyo._.js +4 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0mup1hi._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0ohb3gc._.js +4 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0qbpe_v._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0s~gy6y._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0t5l7a5._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0ymlddl._.js +152 -6
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0vrlxf2._.js → [root-of-the-server]__0ymn496._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0eu4j_n._.js → [root-of-the-server]__10h.ggz._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_03d7qyt._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/{_07a1g.3._.js → _0zx~s__._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_10lm7or._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/app_0cdqd9w._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_0xerkr6._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_0q-m0y-._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/lib_codex-projects_ts_0eosib~._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/lib_copilot-projects_ts_0r8xkn8._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/lib_cursor-projects_ts_0qt1scg._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/lib_gemini-projects_ts_0sl~yqr._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/lib_opencode-projects_ts_0op9gyp._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/lib_pi-projects_ts_103tsh1._.js +3 -0
- package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
- package/.next/standalone/.next/server/pages/404.html +2 -2
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.json +9 -9
- package/.next/standalone/.next/static/chunks/{06j6c0ofqjy0v.js → 00ay03h8bq4b~.js} +2 -2
- package/.next/standalone/.next/static/chunks/{15_mi91qaeieu.js → 0agmlhk5ml7x5.js} +1 -1
- package/.next/standalone/.next/static/chunks/0bi2r.m~yokoo.js +1 -0
- package/.next/standalone/.next/static/chunks/0en4v5k2nnxks.js +1 -0
- package/.next/standalone/.next/static/chunks/0q5bmqop--9yk.js +1 -0
- package/.next/standalone/.next/static/chunks/{0zdn~84f58hvf.js → 0s6nux54y~l~r.js} +1 -1
- package/.next/standalone/.next/static/chunks/{10mlwc4y_kqo2.js → 0tpse0wu2wwo0.js} +1 -1
- package/.next/standalone/.next/static/chunks/12po2vpc-4_c1.css +1 -0
- package/.next/standalone/.next/static/chunks/{0e8c_1f7-8e7t.js → 1400rtd5ywbt..js} +2 -2
- package/.next/standalone/.next/static/chunks/{0mumk7h5i.1xd.js → 14lmf8boay-zu.js} +1 -1
- package/.next/standalone/.next/static/chunks/{18a9xv2p3~x.9.js → 17htukxga7bil.js} +1 -1
- package/.next/standalone/.opencode/opencode.json +4 -0
- package/.next/standalone/.opencode/plugins/failproofai.mjs +131 -0
- package/.next/standalone/.pi/settings.json +5 -0
- package/.next/standalone/app/components/cli-badge.tsx +7 -11
- package/.next/standalone/app/components/project-list.tsx +32 -4
- package/.next/standalone/app/policies/hooks-client.tsx +31 -15
- package/.next/standalone/app/project/[name]/page.tsx +52 -16
- package/.next/standalone/app/project/[name]/session/[sessionId]/page.tsx +92 -15
- package/.next/standalone/assets/logos/copilot-dark.svg +1 -0
- package/.next/standalone/assets/logos/copilot-light.svg +1 -0
- package/.next/standalone/assets/logos/cursor-dark.svg +1 -0
- package/.next/standalone/assets/logos/cursor-light.svg +1 -0
- package/.next/standalone/assets/logos/gemini-dark.svg +13 -0
- package/.next/standalone/assets/logos/gemini-light.svg +13 -0
- package/.next/standalone/assets/logos/opencode-dark.svg +1 -0
- package/.next/standalone/assets/logos/opencode-light.svg +1 -0
- package/.next/standalone/assets/logos/pi-dark.svg +7 -0
- package/.next/standalone/assets/logos/pi-light.svg +7 -0
- package/.next/standalone/lib/cli-registry.ts +107 -0
- package/.next/standalone/lib/codex-projects.ts +3 -3
- package/.next/standalone/lib/copilot-projects.ts +224 -0
- package/.next/standalone/lib/copilot-sessions.ts +395 -0
- package/.next/standalone/lib/cursor-projects.ts +312 -0
- package/.next/standalone/lib/cursor-sessions.ts +467 -0
- package/.next/standalone/lib/gemini-projects.ts +203 -0
- package/.next/standalone/lib/gemini-sessions.ts +365 -0
- package/.next/standalone/lib/opencode-projects.ts +232 -0
- package/.next/standalone/lib/opencode-sessions.ts +237 -0
- package/.next/standalone/lib/pi-projects.ts +230 -0
- package/.next/standalone/lib/pi-sessions.ts +325 -0
- package/.next/standalone/lib/projects.ts +67 -31
- package/.next/standalone/next.config.ts +5 -4
- package/.next/standalone/package.json +2 -1
- package/.next/standalone/pi-extension/index.ts +373 -0
- package/.next/standalone/pi-extension/package.json +12 -0
- package/.next/standalone/server.js +1 -1
- package/README.md +37 -3
- package/bin/failproofai.mjs +61 -21
- package/dist/cli.mjs +2248 -246
- package/lib/cli-registry.ts +107 -0
- package/lib/codex-projects.ts +3 -3
- package/lib/copilot-projects.ts +224 -0
- package/lib/copilot-sessions.ts +395 -0
- package/lib/cursor-projects.ts +312 -0
- package/lib/cursor-sessions.ts +467 -0
- package/lib/gemini-projects.ts +203 -0
- package/lib/gemini-sessions.ts +365 -0
- package/lib/opencode-projects.ts +232 -0
- package/lib/opencode-sessions.ts +237 -0
- package/lib/pi-projects.ts +230 -0
- package/lib/pi-sessions.ts +325 -0
- package/lib/projects.ts +67 -31
- package/package.json +2 -1
- package/pi-extension/index.ts +373 -0
- package/pi-extension/package.json +12 -0
- package/scripts/translate-docs/mdx-translator.ts +56 -2
- package/scripts/translate-docs/translator.ts +1 -1
- package/src/hooks/builtin-policies.ts +84 -14
- package/src/hooks/handler.ts +67 -5
- package/src/hooks/install-prompt.ts +33 -10
- package/src/hooks/integrations.ts +1007 -6
- package/src/hooks/policy-evaluator.ts +299 -3
- package/src/hooks/resolve-permission-mode.ts +23 -0
- package/src/hooks/types.ts +307 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0g72weg._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0su~k6f._.js +0 -3
- package/.next/standalone/.next/server/chunks/lib_codex-projects_ts_07qqk1g._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__01743wx._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__092s1ta._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0g.lg8b._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0gs6wz4._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0h..k-e._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0it81ys._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0u4a9jq._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__11pa2ra._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__12.h2mg._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__12t-wym._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/_04w00cm._.js +0 -3
- package/.next/standalone/.next/static/chunks/0.rk1iwdt1d7c.css +0 -1
- package/.next/standalone/.next/static/chunks/03egp37o1l629.js +0 -1
- package/.next/standalone/.next/static/chunks/06x4-d1~o-opr.js +0 -1
- package/.next/standalone/.next/static/chunks/0n~s0gafwnp2y.js +0 -1
- /package/.next/standalone/.next/static/{SyaO-J1hupjAiRCG-Syzg → 68TLSFdjAQYIulNHfP0QY}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{SyaO-J1hupjAiRCG-Syzg → 68TLSFdjAQYIulNHfP0QY}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{SyaO-J1hupjAiRCG-Syzg → 68TLSFdjAQYIulNHfP0QY}/_ssgManifest.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,36406,e=>{"use strict";var t=e.i(43476),s=e.i(71645),r=e.i(74080);function n(e,t,s){let r,n=s.initialDeps??[],i=!0;function o(){var o,a,l;let d,c;s.key&&(null==(o=s.debug)?void 0:o.call(s))&&(d=Date.now());let u=e();if(!(u.length!==n.length||u.some((e,t)=>n[t]!==e)))return r;if(n=u,s.key&&(null==(a=s.debug)?void 0:a.call(s))&&(c=Date.now()),r=t(...u),s.key&&(null==(l=s.debug)?void 0:l.call(s))){let e=Math.round((Date.now()-d)*100)/100,t=Math.round((Date.now()-c)*100)/100,r=t/16,n=(e,t)=>{for(e=String(e);e.length<t;)e=" "+e;return e};console.info(`%c⏱ ${n(t,5)} /${n(e,5)} ms`,`
|
|
2
2
|
font-size: .6rem;
|
|
3
3
|
font-weight: bold;
|
|
4
|
-
color: hsl(${Math.max(0,Math.min(120-120*r,120))}deg 100% 31%);`,null==s?void 0:s.key)}return(null==s?void 0:s.onChange)&&!(i&&s.skipInitialOnChange)&&s.onChange(r),i=!1,r}return o.updateDeps=e=>{n=e},o}function i(e,t){if(void 0!==e)return e;throw Error(`Unexpected undefined${t?`: ${t}`:""}`)}e.i(47167);let o=e=>e,a=e=>{let t=Math.max(e.startIndex-e.overscan,0),s=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let e=t;e<=s;e++)r.push(e);return r},l={passive:!0},d=(e,t)=>{let s=e.scrollElement;if(!s)return;let r=()=>{t({width:s.innerWidth,height:s.innerHeight})};return r(),s.addEventListener("resize",r,l),()=>{s.removeEventListener("resize",r)}},c="u"<typeof window||"onscrollend"in window,u=(e,t)=>{var s,r;let n,i=e.scrollElement;if(!i)return;let o=e.targetWindow;if(!o)return;let a=0,d=e.options.useScrollendEvent&&c?()=>void 0:(s=()=>{t(a,!1)},r=e.options.isScrollingResetDelay,function(...e){o.clearTimeout(n),n=o.setTimeout(()=>s.apply(this,e),r)}),u=s=>()=>{a=i[e.options.horizontal?"scrollX":"scrollY"],d(),t(a,s)},h=u(!0),m=u(!1);i.addEventListener("scroll",h,l);let p=e.options.useScrollendEvent&&c;return p&&i.addEventListener("scrollend",m,l),()=>{i.removeEventListener("scroll",h),p&&i.removeEventListener("scrollend",m)}},h=(e,t,s)=>{if(null==t?void 0:t.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[s.options.horizontal?"inlineSize":"blockSize"])}return e[s.options.horizontal?"offsetWidth":"offsetHeight"]},m=(e,{adjustments:t=0,behavior:s},r)=>{var n,i;null==(i=null==(n=r.scrollElement)?void 0:n.scrollTo)||i.call(n,{[r.options.horizontal?"left":"top"]:e+t,behavior:s})};class p{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var e,t,s;return(null==(s=null==(t=null==(e=this.targetWindow)?void 0:e.performance)?void 0:t.now)?void 0:s.call(t))??Date.now()},this.observer=(()=>{let e=null,t=()=>e||(this.targetWindow&&this.targetWindow.ResizeObserver?e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{let t=()=>{let t=e.target,s=this.indexFromElement(t);t.isConnected?this.shouldMeasureDuringScroll(s)&&this.resizeItem(s,this.options.measureElement(t,e,this)):this.observer.unobserve(t)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()})}):null);return{disconnect:()=>{var s;null==(s=t())||s.disconnect(),e=null},observe:e=>{var s;return null==(s=t())?void 0:s.observe(e,{box:"border-box"})},unobserve:e=>{var s;return null==(s=t())?void 0:s.unobserve(e)}}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach(([t,s])=>{void 0===s&&delete e[t]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:o,rangeExtractor:a,onChange:()=>{},measureElement:h,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",...e}},this.notify=e=>{var t,s;null==(s=(t=this.options).onChange)||s.call(t,this,e)},this.maybeNotify=n(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),null!=this.rafId&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var e;let t=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==t){if(this.cleanup(),!t)return void this.maybeNotify();this.scrollElement=t,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=(null==(e=this.scrollElement)?void 0:e.window)??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{this.scrollAdjustments=0,this.scrollDirection=t?this.getScrollOffset()<e?"forward":"backward":null,this.scrollOffset=e,this.isScrolling=t,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??("function"==typeof this.options.initialOffset?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(e,t)=>{let s=new Map,r=new Map;for(let n=t-1;n>=0;n--){let t=e[n];if(s.has(t.lane))continue;let i=r.get(t.lane);if(null==i||t.end>i.end?r.set(t.lane,t):t.end<i.end&&s.set(t.lane,!0),s.size===this.options.lanes)break}return r.size===this.options.lanes?Array.from(r.values()).sort((e,t)=>e.end===t.end?e.index-t.index:e.end-t.end)[0]:void 0},this.getMeasurementOptions=n(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(e,t,s,r,n,i,o)=>(void 0!==this.prevLanes&&this.prevLanes!==i&&(this.lanesChangedFlag=!0),this.prevLanes=i,this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:t,scrollMargin:s,getItemKey:r,enabled:n,lanes:i,laneAssignmentMode:o}),{key:!1}),this.getMeasurements=n(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:e,paddingStart:t,scrollMargin:s,getItemKey:r,enabled:n,lanes:i,laneAssignmentMode:o},a)=>{if(!n)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),0!==this.measurementsCache.length||this.lanesSettling||(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let l=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1);let d=this.measurementsCache.slice(0,l),c=Array(i).fill(void 0);for(let e=0;e<l;e++){let t=d[e];t&&(c[t.lane]=e)}for(let n=l;n<e;n++){let e,i,l=r(n),u=this.laneAssignments.get(n),h="estimate"===o||a.has(l);if(void 0!==u&&this.options.lanes>1){let r=c[e=u],n=void 0!==r?d[r]:void 0;i=n?n.end+this.options.gap:t+s}else{let r=1===this.options.lanes?d[n-1]:this.getFurthestMeasurement(d,n);i=r?r.end+this.options.gap:t+s,e=r?r.lane:n%this.options.lanes,this.options.lanes>1&&h&&this.laneAssignments.set(n,e)}let m=a.get(l),p="number"==typeof m?m:this.options.estimateSize(n),x=i+p;d[n]={index:n,start:i,size:p,end:x,key:l,lane:e},c[e]=n}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=n(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,s,r)=>this.range=e.length>0&&t>0?function({measurements:e,outerSize:t,scrollOffset:s,lanes:r}){let n=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:n};let i=x(0,n,t=>e[t].start,s),o=i;if(1===r)for(;o<n&&e[o].end<s+t;)o++;else if(r>1){let a=Array(r).fill(0);for(;o<n&&a.some(e=>e<s+t);){let t=e[o];a[t.lane]=t.end,o++}let l=Array(r).fill(s+t);for(;i>=0&&l.some(e=>e>=s);){let t=e[i];l[t.lane]=t.start,i--}i=Math.max(0,i-i%r),o=Math.min(n,o+(r-1-o%r))}return{startIndex:i,endIndex:o}}({measurements:e,outerSize:t,scrollOffset:s,lanes:r}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=n(()=>{let e=null,t=null,s=this.calculateRange();return s&&(e=s.startIndex,t=s.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]},(e,t,s,r,n)=>null===r||null===n?[]:e({startIndex:r,endIndex:n,overscan:t,count:s}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,s=e.getAttribute(t);return s?parseInt(s,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{var t;if(!this.scrollState||"smooth"!==this.scrollState.behavior)return!0;let s=this.scrollState.index??(null==(t=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))?void 0:t.index);if(void 0!==s&&this.range){let t=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,s-t),n=Math.min(this.options.count-1,s+t);return e>=r&&e<=n}return!0},this.measureElement=e=>{if(!e)return void this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});let t=this.indexFromElement(e),s=this.options.getItemKey(t),r=this.elementsCache.get(s);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(s,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{var s;let r=this.measurementsCache[e];if(!r)return;let n=t-(this.itemSizeCache.get(r.key)??r.size);0!==n&&((null==(s=this.scrollState)?void 0:s.behavior)!=="smooth"&&(void 0!==this.shouldAdjustScrollPositionOnItemSizeChange?this.shouldAdjustScrollPositionOnItemSizeChange(r,n,this):r.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=n,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(r.index),this.itemSizeCache=new Map(this.itemSizeCache.set(r.key,t)),this.notify(!1))},this.getVirtualItems=n(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{let s=[];for(let r=0,n=e.length;r<n;r++){let n=t[e[r]];s.push(n)}return s},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(0!==t.length)return i(t[x(0,t.length-1,e=>i(t[e]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(e,t,s=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),n=this.getScrollOffset();return"auto"===t&&(t=e>=n+r?"end":"start"),"center"===t?e+=(s-r)/2:"end"===t&&(e-=r),Math.max(Math.min(this.getMaxScrollOffset(),e),0)},this.getOffsetForIndex=(e,t="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));let s=this.getSize(),r=this.getScrollOffset(),n=this.measurementsCache[e];if(!n)return;if("auto"===t)if(n.end>=r+s-this.options.scrollPaddingEnd)t="end";else{if(!(n.start<=r+this.options.scrollPaddingStart))return[r,t];t="start"}if("end"===t&&e===this.options.count-1)return[this.getMaxScrollOffset(),t];let i="end"===t?n.end+this.options.scrollPaddingEnd:n.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(i,t,n.size),t]},this.scrollToOffset=(e,{align:t="start",behavior:s="auto"}={})=>{let r=this.getOffsetForAlignment(e,t),n=this.now();this.scrollState={index:null,align:t,behavior:s,startedAt:n,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:t="auto",behavior:s="auto"}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[n,i]=r,o=this.now();this.scrollState={index:e,align:i,behavior:s,startedAt:o,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:t="auto"}={})=>{let s=this.getScrollOffset()+e,r=this.now();this.scrollState={index:null,align:"start",behavior:t,startedAt:r,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var e;let t,s=this.getMeasurements();if(0===s.length)t=this.options.paddingStart;else if(1===this.options.lanes)t=(null==(e=s[s.length-1])?void 0:e.end)??0;else{let e=Array(this.options.lanes).fill(null),r=s.length-1;for(;r>=0&&e.some(e=>null===e);){let t=s[r];null===e[t.lane]&&(e[t.lane]=t.end),r--}t=Math.max(...e.filter(e=>null!==e))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(e,{adjustments:t,behavior:s})=>{this.options.scrollToFn(e,{behavior:s,adjustments:t},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(e)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}null==this.rafId&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let e=null!=this.scrollState.index?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,t=e?e[0]:this.scrollState.lastTargetOffset,s=t!==this.scrollState.lastTargetOffset;if(!s&&1.01>Math.abs(t-this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1){this.scrollState=null;return}}else this.scrollState.stableFrames=0,s&&(this.scrollState.lastTargetOffset=t,this.scrollState.behavior="auto",this._scrollToOffset(t,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}let x=(e,t,s,r)=>{for(;e<=t;){let n=(e+t)/2|0,i=s(n);if(i<r)e=n+1;else{if(!(i>r))return n;t=n-1}}return e>0?e-1:0},g="u">typeof document?s.useLayoutEffect:s.useEffect;var f=e.i(16327),y=e.i(56420);let b=(0,y.default)("wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]),v=(0,y.default)("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]),j=(0,y.default)("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]),w=(0,y.default)("cpu",[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]),N=(0,y.default)("clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]]);var S=e.i(68590);let M=(0,y.default)("workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]);var k=e.i(34713);let C=s.default.memo(function({entries:e,compact:r=!1}){let n=(0,s.useMemo)(()=>(function(e){let t=0,s=0,r=0,n=0,i=0,o=new Set;for(let a of e)if("user"===a.type&&t++,"queue-operation"===a.type&&i++,"assistant"===a.type){for(let e of(s++,a.message.content))"tool_use"===e.type&&("Task"===e.name&&(e.subagentType||e.subagentId)?n++:r++);a.message.model&&o.add(a.message.model)}let a="";if(e.length>=2){let t=e[e.length-1].timestampMs-e[0].timestampMs;a=(0,k.formatDuration)(t)}return{turnCount:i,userCount:t,assistantCount:s,toolCallCount:r,subagentCount:n,duration:a,models:Array.from(o)}})(e),[e]),i=r?"w-3.5 h-3.5":"w-4 h-4",o=r?"text-xs font-medium":"text-sm font-medium",a=r?"text-[10px] text-muted-foreground":"text-xs text-muted-foreground",l=[...r?[]:[{Icon:S.MessageSquare,color:"text-primary",v:n.turnCount,l:"Turns"}],{Icon:v,color:"text-[color:var(--chart-1)]",v:n.userCount,l:"User"},{Icon:j,color:"text-[color:var(--chart-2)]",v:n.assistantCount,l:"Assistant"},{Icon:b,color:"text-[color:var(--chart-3)]",v:n.toolCallCount,l:r?"Tools":"Tool Calls"},{Icon:M,color:"text-[color:var(--chart-5)]",v:n.subagentCount,l:"Subagents"},{Icon:N,color:"text-[color:var(--chart-4)]",v:n.duration||"—",l:"Duration"},{Icon:w,color:"text-[color:var(--chart-5)]",v:n.models.length>0?n.models.join(", "):"—",l:r?"Model":"Model(s)"}];return(0,t.jsx)("div",{className:r?"bg-muted/30 border border-border/50 rounded-lg p-3 mb-3":"bg-card border border-border rounded-lg p-4",children:(0,t.jsx)("div",{className:`grid grid-cols-2 ${r?"sm:grid-cols-6 gap-3":"sm:grid-cols-4 lg:grid-cols-7 gap-4"}`,children:l.map(({Icon:e,color:s,v:r,l:n})=>(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(e,{className:`${i} ${s}`}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:`${o} truncate max-w-[120px]`,children:r}),(0,t.jsx)("div",{className:a,children:n})]})]},n))})})}),E=(0,y.default)("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);var I=e.i(67927);function T(e){return JSON.stringify(e.raw,null,2)}let O=new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit",hour12:!0});function A(e){let t=new Date(e),s=O.format(t),r=t.getMilliseconds().toString().padStart(3,"0");return`${s}.${r}`}let z=s.default.memo(function({entry:e,isCollapsed:s,entryCount:r,onToggle:n}){let i="function"==typeof n,o=(0,t.jsxs)("div",{className:`flex items-center gap-2 px-3 py-1 rounded-full bg-primary/10 border border-primary/20 text-primary text-xs font-medium${i?" group-hover:bg-primary/20 transition-colors":""}`,children:[i?(0,t.jsx)(I.ChevronRight,{className:`w-3 h-3 transition-transform ${s?"":"rotate-90"}`}):(0,t.jsx)(E,{className:"w-3 h-3"}),(0,t.jsx)("span",{children:e.label}),(0,t.jsx)("span",{className:"text-muted-foreground",children:A(e.timestampMs)}),i&&s&&"number"==typeof r&&(0,t.jsxs)("span",{className:"ml-1 px-1.5 py-0.5 rounded bg-primary/20 text-[10px] leading-none",children:[r," ",1===r?"entry":"entries"]})]});return i?(0,t.jsxs)("button",{type:"button",onClick:n,className:"group flex items-center gap-3 py-3 px-4 w-full cursor-pointer",children:[(0,t.jsx)("div",{className:"flex-1 h-px bg-primary/30"}),o,(0,t.jsx)("div",{className:"flex-1 h-px bg-primary/30"})]}):(0,t.jsxs)("div",{className:"flex items-center gap-3 py-3 px-4",children:[(0,t.jsx)("div",{className:"flex-1 h-px bg-primary/30"}),o,(0,t.jsx)("div",{className:"flex-1 h-px bg-primary/30"})]})});var F=e.i(47163);let $={user:"User",assistant:"Assistant","file-history-snapshot":"Snapshot",progress:"Progress",system:"System","queue-operation":"Queue"},D={user:"bg-[color:var(--chart-1)]/20 text-[color:var(--chart-1)] border-[color:var(--chart-1)]/30",assistant:"bg-[color:var(--chart-2)]/20 text-[color:var(--chart-2)] border-[color:var(--chart-2)]/30","file-history-snapshot":"bg-[color:var(--chart-3)]/20 text-[color:var(--chart-3)] border-[color:var(--chart-3)]/30",progress:"bg-[color:var(--chart-5)]/20 text-[color:var(--chart-5)] border-[color:var(--chart-5)]/30",system:"bg-[color:var(--chart-4)]/20 text-[color:var(--chart-4)] border-[color:var(--chart-4)]/30","queue-operation":"bg-primary/20 text-primary border-primary/30"},R={user:"border-l-[color:var(--chart-1)]",assistant:"border-l-[color:var(--chart-2)]","file-history-snapshot":"border-l-[color:var(--chart-3)]",progress:"border-l-[color:var(--chart-5)]",system:"border-l-[color:var(--chart-4)]","queue-operation":"border-l-primary"},U=(0,y.default)("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]),q=(0,y.default)("activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);var P=e.i(66794);function W({type:e}){let s="w-4 h-4";switch(e){case"user":return(0,t.jsx)(v,{className:s});case"assistant":return(0,t.jsx)(j,{className:s});case"file-history-snapshot":return(0,t.jsx)(U,{className:s});case"progress":return(0,t.jsx)(q,{className:s});case"system":return(0,t.jsx)(P.Settings,{className:s});case"queue-operation":return(0,t.jsx)(E,{className:s})}}function H({type:e}){return(0,t.jsxs)("span",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 text-xs font-mono rounded border ${D[e]}`,children:[(0,t.jsx)(W,{type:e}),$[e]]})}var L=e.i(24380);function _({block:e}){let r=(0,s.useMemo)(()=>JSON.stringify(e.input,null,2),[e]);return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("details",{open:!0,children:[(0,t.jsx)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground transition-colors",children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:["Input",(0,t.jsx)(L.CopyButton,{text:r})]})}),(0,t.jsx)("pre",{className:"mt-1 p-2 bg-muted/50 rounded text-xs whitespace-pre-wrap break-words max-h-64 overflow-y-auto",children:r})]}),e.result?(0,t.jsxs)("div",{className:"border-l-2 border-primary/50 pl-3 space-y-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"inline-block px-2 py-0.5 text-xs font-mono rounded border bg-primary/20 text-primary border-primary/30",children:"Result"}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:A(new Date(e.result.timestamp).getTime())})]}),e.result.content&&(0,t.jsxs)("details",{open:!0,children:[(0,t.jsx)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground transition-colors",children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:["Output",(0,t.jsx)(L.CopyButton,{text:e.result.content})]})}),(0,t.jsx)("pre",{className:"mt-1 p-2 bg-muted/50 rounded text-xs whitespace-pre-wrap break-words max-h-48 overflow-y-auto",children:e.result.content})]}),e.result.images?.map((e,s)=>(0,t.jsx)("img",{src:`data:${e.mediaType};base64,${e.base64}`,alt:`Tool result image ${s+1}`,className:"mt-2 max-w-full rounded border border-border"},s))]}):(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:"Tool did not return a result"})]})}let B=(0,y.default)("brain",[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]]),V=s.default.memo(function({block:e,entriesBySource:s,projectName:r,sessionId:n,highlightedUuid:i,autoExpandForUuid:o}){switch(e.type){case"text":return(0,t.jsx)("p",{className:"whitespace-pre-wrap text-sm",children:e.text});case"tool_use":if("Task"===e.name&&(e.subagentType||e.subagentId)){let a=e.subagentId&&s?s.get(`agent-${e.subagentId}`):void 0;return(0,t.jsx)(Z,{block:e,subagentEntries:a,projectName:r,sessionId:n,highlightedUuid:i,autoExpandForUuid:o})}return(0,t.jsxs)("div",{className:"border border-border/50 rounded-lg p-3 bg-muted/10",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,t.jsx)(b,{className:"w-4 h-4 text-primary flex-shrink-0"}),(0,t.jsx)("span",{className:"font-mono text-sm text-primary truncate min-w-0",children:e.name}),e.result&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground ml-auto flex-shrink-0",children:e.result.durationFormatted})]}),(0,t.jsx)(_,{block:e})]});case"thinking":return(0,t.jsx)("div",{className:"border border-[color:var(--chart-5)]/30 rounded-lg p-3 bg-[color:var(--chart-5)]/5",children:(0,t.jsxs)("details",{children:[(0,t.jsxs)("summary",{className:"flex items-center gap-2 text-xs cursor-pointer hover:text-foreground transition-colors text-[color:var(--chart-5)]",children:[(0,t.jsx)(B,{className:"w-4 h-4"}),(0,t.jsx)("span",{children:"Thinking"}),(0,t.jsxs)("span",{className:"text-muted-foreground ml-1",children:["(",e.thinking.length.toLocaleString()," chars)"]})]}),(0,t.jsx)("p",{className:"mt-2 whitespace-pre-wrap text-xs text-muted-foreground p-2 bg-muted/30 rounded max-h-64 overflow-y-auto",children:e.thinking})]})})}});function K({entry:e}){return(0,t.jsx)("div",{children:e.message.content&&(0,t.jsx)("p",{className:"whitespace-pre-wrap text-sm",children:e.message.content})})}let J=s.default.memo(function({entry:e,entriesBySource:s,projectName:r,sessionId:n,highlightedUuid:i,autoExpandForUuid:o}){let{content:a}=e.message;return(0,t.jsx)("div",{className:"space-y-3",children:a.map((e,a)=>(0,t.jsx)(V,{block:e,entriesBySource:s,projectName:r,sessionId:n,highlightedUuid:i,autoExpandForUuid:o},a))})}),Y=s.default.memo(function({entry:e}){let r=(0,s.useMemo)(()=>{if("progress"===e.type){let t=e.raw.data,s=t?.agentId;return[t?.type,s&&`agent:${s}`].filter(Boolean).join(" | ")}return"file-history-snapshot"===e.type?"File history snapshot":e.type},[e.type,e.raw]);return(0,t.jsxs)("div",{className:"text-sm",children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:r}),(0,t.jsxs)("details",{className:"mt-1",children:[(0,t.jsx)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground transition-colors",children:"Show raw JSON"}),(0,t.jsx)("pre",{className:"mt-1 p-2 bg-muted/50 rounded text-xs whitespace-pre-wrap break-words max-h-64 overflow-y-auto",children:T(e)})]})]})}),X=(0,y.default)("link-2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);var Q=e.i(55574);function G({uuid:e}){let r=(0,s.useCallback)(async()=>{window.history.replaceState(null,"",`#entry-${e}`);try{await navigator.clipboard.writeText(window.location.href)}catch{let e=document.createElement("textarea");e.value=window.location.href,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)}(0,Q.toast)("Link copied")},[e]);return(0,t.jsx)("button",{onClick:r,title:"Copy link to entry",className:"inline-flex items-center justify-center rounded p-1 text-muted-foreground hover:text-foreground hover:bg-muted/80 transition-colors opacity-0 group-hover:opacity-100 transition-opacity",children:(0,t.jsx)(X,{className:"w-3.5 h-3.5"})})}function Z({block:e,subagentEntries:r,projectName:n,sessionId:i,highlightedUuid:o,autoExpandForUuid:a}){let l=!!(a&&r?.some(e=>e.uuid===a)),[d,c]=(0,s.useState)(l);(0,s.useEffect)(()=>{if(!l)return;let e=requestAnimationFrame(()=>c(!0));return()=>cancelAnimationFrame(e)},[l]);let u=(0,s.useCallback)(()=>{c(e=>!e)},[]),h=r&&r.length>0;return(0,t.jsxs)("div",{className:"border border-border/50 rounded-lg p-3 bg-muted/10",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,t.jsx)(M,{className:"w-4 h-4 text-[color:var(--chart-5)]"}),(0,t.jsx)("span",{className:"font-mono text-sm text-[color:var(--chart-5)]",children:"Subagent"}),e.subagentType&&(0,t.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 text-xs font-mono rounded border bg-[color:var(--chart-5)]/20 text-[color:var(--chart-5)] border-[color:var(--chart-5)]/30",children:e.subagentType}),e.result&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground ml-auto",children:e.result.durationFormatted})]}),e.subagentDescription&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground mb-2",children:e.subagentDescription}),e.subagentId&&r&&(0,t.jsxs)("button",{onClick:u,className:"inline-flex items-center gap-1.5 px-2.5 py-1 text-xs font-medium rounded border border-primary/30 bg-primary/10 text-primary hover:bg-primary/20 transition-colors mb-2",children:[(0,t.jsx)(I.ChevronRight,{className:(0,F.cn)("w-3 h-3 transition-transform",d&&"rotate-90")}),(0,t.jsxs)("span",{children:["agent-",e.subagentId]}),(0,t.jsx)("span",{className:"text-muted-foreground",children:d?"Collapse":"View subagent log"})]}),d&&(0,t.jsxs)("div",{className:"ml-4 pl-3 border-l-2 border-primary/30 mt-2 space-y-2",children:[r&&0===r.length&&(0,t.jsx)("div",{className:"text-xs text-muted-foreground py-2",children:"No entries found in subagent log."}),h&&(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(C,{entries:r,compact:!0})}),r&&r.map(e=>"queue-operation"===e.type?(0,t.jsx)(z,{entry:e},e.uuid||e.timestamp):(0,t.jsx)(et,{entry:e,projectName:n,sessionId:i,isHighlighted:!!o&&e.uuid===o},e.uuid||e.timestamp))]}),(0,t.jsx)(_,{block:e})]})}function ee({entry:e,entriesBySource:s,projectName:r,sessionId:n,highlightedUuid:i,autoExpandForUuid:o}){switch(e.type){case"user":return(0,t.jsx)(K,{entry:e});case"assistant":return(0,t.jsx)(J,{entry:e,entriesBySource:s,projectName:r,sessionId:n,highlightedUuid:i,autoExpandForUuid:o});case"file-history-snapshot":case"progress":case"system":return(0,t.jsx)(Y,{entry:e})}}let et=s.default.memo(function({entry:e,entriesBySource:s,projectName:r,sessionId:n,isHighlighted:i,highlightedUuid:o,autoExpandForUuid:a}){return(0,t.jsxs)("div",{id:e.uuid?`entry-${e.uuid}`:void 0,className:(0,F.cn)(`group border-l-4 ${R[e.type]} bg-card/50 rounded-r-lg mb-2 hover:bg-muted/30 transition-colors`,i&&"entry-highlighted"),children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border/30",children:[(0,t.jsx)(H,{type:e.type}),(0,t.jsxs)("div",{className:"flex items-center gap-1 ml-auto",children:[e.uuid&&(0,t.jsx)(G,{uuid:e.uuid}),(0,t.jsx)(L.CopyButton,{text:function(e){switch(e.type){case"user":return e.message.content;case"assistant":return e.message.content.filter(e=>"text"===e.type).map(e=>e.text).join("\n");case"file-history-snapshot":case"progress":case"system":return T(e);case"queue-operation":return e.label}}(e)}),(0,t.jsx)("span",{className:"text-xs font-mono text-muted-foreground whitespace-nowrap",children:A(e.timestampMs)})]})]}),(0,t.jsx)("div",{className:"px-4 py-3",children:(0,t.jsx)(ee,{entry:e,entriesBySource:s,projectName:r,sessionId:n,highlightedUuid:o,autoExpandForUuid:a})})]})},(e,t)=>e.entry===t.entry&&e.entriesBySource===t.entriesBySource&&e.projectName===t.projectName&&e.sessionId===t.sessionId&&e.isHighlighted===t.isHighlighted&&e.highlightedUuid===t.highlightedUuid&&e.autoExpandForUuid===t.autoExpandForUuid);var es=e.i(99631),er=e.i(84026),en=e.i(29407),ei=e.i(16306),eo=e.i(82954),ea=e.i(73520),el=e.i(85881);function ed({decision:e}){return"deny"===e?(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[0.65rem] font-semibold tracking-wide uppercase bg-red-500/10 text-red-400 border border-red-500/20",children:[(0,t.jsx)(en.ShieldX,{className:"h-3 w-3"}),"Deny"]}):"instruct"===e?(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[0.65rem] font-semibold tracking-wide uppercase bg-amber-500/10 text-amber-400 border border-amber-500/20",children:[(0,t.jsx)(ei.ShieldAlert,{className:"h-3 w-3"}),"Instruct"]}):(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[0.65rem] font-semibold tracking-wide uppercase bg-emerald-500/10 text-emerald-400 border border-emerald-500/20",children:[(0,t.jsx)(er.ShieldCheck,{className:"h-3 w-3"}),"Allow"]})}function ec({eventType:e}){return(0,t.jsx)("span",{className:"inline-flex items-center rounded px-1.5 py-0.5 text-[0.6rem] font-medium bg-muted text-muted-foreground border border-border/50",children:e})}function eu({mode:e}){let s="default"===e;return(0,t.jsx)("span",{className:`inline-flex items-center rounded px-1.5 py-0.5 text-[0.6rem] font-medium border ${s?"bg-sky-500/10 text-sky-400 border-sky-500/20":"bg-amber-500/10 text-amber-400 border-amber-500/20"}`,children:e})}function eh({ms:e}){return(0,t.jsx)("span",{className:`font-mono text-[0.7rem] ${e>500?"text-red-400":e>100?"text-amber-400":"text-muted-foreground"}`,children:e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`})}function em({value:e,onChange:s}){return(0,t.jsx)("div",{className:"inline-flex items-center rounded-md border border-border bg-muted/30 p-0.5",children:[{label:"All",value:""},{label:"Allow",value:"allow"},{label:"Instruct",value:"instruct"},{label:"Deny",value:"deny"}].map(r=>(0,t.jsx)("button",{onClick:()=>s(r.value),className:`px-2.5 py-1 text-[0.65rem] font-medium rounded transition-all ${e===r.value?"deny"===r.value?"bg-red-500/15 text-red-400 shadow-sm":"allow"===r.value?"bg-emerald-500/15 text-emerald-400 shadow-sm":"instruct"===r.value?"bg-amber-500/15 text-amber-400 shadow-sm":"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:r.label},r.value))})}function ep({item:e}){return(0,t.jsx)("tr",{children:(0,t.jsx)("td",{colSpan:9,className:"px-0 py-0",children:(0,t.jsxs)("div",{className:"px-6 py-3 bg-muted/20 border-t border-border/30 space-y-2 text-xs animate-expand",children:[(0,t.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-x-8 gap-y-1.5",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:"Session ID: "}),(0,t.jsx)("span",{className:"font-mono text-foreground",children:e.sessionId??"—"}),e.sessionId&&(0,t.jsx)(L.CopyButton,{text:e.sessionId})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:"CWD: "}),(0,t.jsx)("span",{className:"font-mono text-foreground",children:e.cwd??"—"}),e.cwd&&(0,t.jsx)(L.CopyButton,{text:e.cwd})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:"Transcript: "}),(0,t.jsx)("span",{className:"font-mono text-foreground break-all",children:e.transcriptPath??"—"})]})]}),e.policyNames&&e.policyNames.length>1&&(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:"Policies: "}),(0,t.jsx)("span",{className:"font-mono text-foreground",children:e.policyNames.join(", ")})]}),e.reason&&(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:"Full reason: "}),(0,t.jsx)("span",{className:"text-foreground",children:e.reason})]})]})})})}function ex({sessionId:e,initialData:r}){let{intervalSec:n}=(0,el.useAutoRefresh)(),[i,o]=(0,s.useState)(!1),[a,l]=(0,s.useState)(1),[d,c]=(0,s.useState)(r),[u,h]=(0,s.useState)(null),[m,p]=(0,s.useState)(""),[x,g]=(0,s.useState)(""),[y,b]=(0,s.useState)(""),v=(0,s.useRef)(null),j=(0,s.useRef)({filterDecision:m,filterEventType:x,filterPolicy:y});j.current={filterDecision:m,filterEventType:x,filterPolicy:y};let w=""!==m||""!==x||""!==y,N=(0,s.useCallback)(async t=>{try{let{filterDecision:s,filterEventType:r,filterPolicy:n}=j.current,i=await (0,es.searchHookActivityAction)({sessionId:e,decision:s||void 0,eventType:r||void 0,policyName:n||void 0},t);c(i)}catch{}},[e]);(0,s.useEffect)(()=>{N(a);let e=setInterval(()=>N(a),n>0?1e3*n:5e3);return()=>clearInterval(e)},[a,N,n]),(0,s.useEffect)(()=>(v.current&&clearTimeout(v.current),v.current=setTimeout(()=>{l(1),h(null),N(1)},300),()=>{v.current&&clearTimeout(v.current)}),[m,x,y]);let S=d.entries,M=d.totalPages;return(0,t.jsxs)("div",{children:[(0,t.jsxs)("button",{onClick:()=>o(e=>!e),className:"flex items-center gap-2 hover:opacity-80 transition-opacity",children:[(0,t.jsx)(f.ChevronDown,{className:`w-4 h-4 text-muted-foreground transition-transform ${i?"-rotate-90":""}`}),(0,t.jsx)("span",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:"Hook Logs"})]}),!i&&(0,t.jsxs)("div",{className:"mt-2 bg-card border border-border rounded-lg overflow-hidden shadow-sm",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3 px-4 py-2.5 border-b border-border bg-muted/20",children:[(0,t.jsx)(em,{value:m,onChange:p}),(0,t.jsxs)("select",{value:x,onChange:e=>g(e.target.value),className:"h-7 rounded-md border border-border bg-background px-2 text-xs text-foreground focus:outline-none focus:ring-2 focus:ring-primary/40 focus:border-primary/40 transition-shadow",children:[(0,t.jsx)("option",{value:"",children:"All Events"}),(0,t.jsx)("option",{value:"PreToolUse",children:"PreToolUse"}),(0,t.jsx)("option",{value:"PostToolUse",children:"PostToolUse"}),(0,t.jsx)("option",{value:"SessionStart",children:"SessionStart"}),(0,t.jsx)("option",{value:"SessionEnd",children:"SessionEnd"}),(0,t.jsx)("option",{value:"UserPromptSubmit",children:"UserPromptSubmit"}),(0,t.jsx)("option",{value:"PermissionRequest",children:"PermissionRequest"})]}),(0,t.jsx)("div",{className:"relative",children:(0,t.jsx)("input",{type:"text",value:y,onChange:e=>b(e.target.value),placeholder:"Filter by policy…",className:"h-7 rounded-md border border-border bg-background px-2.5 text-xs text-foreground placeholder:text-muted-foreground w-44 focus:outline-none focus:ring-2 focus:ring-primary/40 focus:border-primary/40 transition-shadow"})})]}),0===S.length?(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 px-4",children:[(0,t.jsx)(eo.Shield,{className:"h-10 w-10 text-muted-foreground/30"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground mt-3",children:w?"No matching hook events.":"No hook events found."})]}):(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"w-full text-xs",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"text-left text-muted-foreground border-b border-border bg-muted/30",children:[(0,t.jsx)("th",{className:"px-4 py-2.5 font-medium w-6"}),(0,t.jsx)("th",{className:"px-3 py-2.5 font-medium",children:"Decision"}),(0,t.jsx)("th",{className:"px-3 py-2.5 font-medium",children:"Event"}),(0,t.jsx)("th",{className:"px-3 py-2.5 font-medium",children:"Tool"}),(0,t.jsx)("th",{className:"px-3 py-2.5 font-medium",children:"Policy"}),(0,t.jsx)("th",{className:"px-3 py-2.5 font-medium",children:"Reason"}),(0,t.jsx)("th",{className:"px-3 py-2.5 font-medium",children:"Duration"}),(0,t.jsx)("th",{className:"px-3 py-2.5 font-medium",children:"Mode"}),(0,t.jsx)("th",{className:"px-3 py-2.5 font-medium text-right",children:"Time"})]})}),(0,t.jsx)("tbody",{className:"divide-y divide-border/30",children:S.map((e,r)=>{let n="deny"===e.decision,i=u===r,o="instruct"===e.decision;return(0,t.jsxs)(s.default.Fragment,{children:[(0,t.jsxs)("tr",{onClick:()=>{h(e=>e===r?null:r)},className:`cursor-pointer transition-colors ${n?"bg-red-500/[0.03] hover:bg-red-500/[0.07] border-l-2 border-l-red-500/40":o?"bg-amber-500/[0.03] hover:bg-amber-500/[0.07] border-l-2 border-l-amber-500/40":r%2==0?"hover:bg-muted/30":"bg-muted/[0.04] hover:bg-muted/30"} ${i?"bg-muted/20":""}`,children:[(0,t.jsx)("td",{className:"px-4 py-2",children:(0,t.jsx)(f.ChevronDown,{className:`h-3.5 w-3.5 text-muted-foreground transition-transform duration-150 ${i?"rotate-0":"-rotate-90"}`})}),(0,t.jsx)("td",{className:"px-3 py-2",children:(0,t.jsx)(ed,{decision:e.decision})}),(0,t.jsx)("td",{className:"px-3 py-2",children:(0,t.jsx)(ec,{eventType:e.eventType})}),(0,t.jsx)("td",{className:"px-3 py-2 font-mono text-foreground",children:e.toolName??"—"}),(0,t.jsx)("td",{className:"px-3 py-2 font-mono text-foreground",children:e.policyNames&&e.policyNames.length>1?(0,t.jsxs)("span",{title:e.policyNames.join(", "),children:[e.policyNames[0],(0,t.jsxs)("span",{className:"text-muted-foreground text-[0.6rem]",children:[" +",e.policyNames.length-1]})]}):e.policyName??"—"}),(0,t.jsx)("td",{className:"px-3 py-2 text-muted-foreground truncate max-w-[240px]",title:e.reason??"",children:e.reason??"—"}),(0,t.jsx)("td",{className:"px-3 py-2",children:(0,t.jsx)(eh,{ms:e.durationMs})}),(0,t.jsx)("td",{className:"px-3 py-2",children:e.permissionMode?(0,t.jsx)(eu,{mode:e.permissionMode}):"—"}),(0,t.jsx)("td",{className:"px-3 py-2 text-right text-muted-foreground whitespace-nowrap",title:new Date(e.timestamp).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}),children:(0,k.formatRelativeTime)(e.timestamp)})]}),i&&(0,t.jsx)(ep,{item:e})]},`${e.timestamp}-${r}`)})})]})}),(0,t.jsx)(ea.default,{currentPage:a,totalPages:M,onPageChange:e=>{l(e),h(null)}})]})]})}function eg(e){let t=new Map;for(let s of e)if("assistant"===s.type)for(let e of s.message.content){if("tool_use"!==e.type||"Task"===e.name&&(e.subagentType||e.subagentId))continue;let s=t.get(e.name)||{count:0,totalDurationMs:0};s.count++,e.result?.durationMs&&(s.totalDurationMs+=e.result.durationMs),t.set(e.name,s)}return Array.from(t.entries()).map(([e,t])=>({name:e,...t})).sort((e,t)=>t.count-e.count)}function ef({tools:e,compact:s}){return(0,t.jsx)("div",{className:`bg-card border border-border rounded-lg ${s?"p-3":"p-4"}`,children:(0,t.jsx)("div",{className:`grid grid-cols-[repeat(auto-fit,minmax(200px,1fr))] ${s?"gap-2":"gap-3"}`,children:e.map(e=>(0,t.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,t.jsx)(b,{className:"w-3.5 h-3.5 text-muted-foreground flex-shrink-0"}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("div",{className:`${s?"text-xs":"text-sm"} font-mono font-medium truncate`,children:e.name}),(0,t.jsxs)("div",{className:"text-xs text-muted-foreground truncate",children:[e.count," call",1!==e.count?"s":"",e.totalDurationMs>0&&` \xb7 ${(e.totalDurationMs/1e3).toFixed(1)}s`]})]})]},e.name))})})}function ey(e){return`${e.uuid}-${e.timestampMs}`}function eb(){let e=window.location.hash;return e.startsWith("#entry-")?e.slice(7):null}function ev({entries:e,entriesBySource:n,projectName:i,sessionId:o}){let a=(0,s.useMemo)(()=>Array.from(n.values()).flat(),[n]),[l,c]=(0,s.useState)(new Set),[h,x]=(0,s.useState)(0),[f,y]=(0,s.useState)(()=>eb()),b=(0,s.useRef)(void 0),v=(0,s.useRef)(!1),j=(0,s.useCallback)(e=>{e&&x(e.offsetTop)},[]),w=(0,s.useMemo)(()=>(function(e){let t=new Map,s=null,r=0;for(let n of e)"queue-operation"===n.type?(null!==s&&t.set(s,r),s=ey(n),r=0):null!==s&&r++;return null!==s&&t.set(s,r),t})(e),[e]),N=(0,s.useMemo)(()=>{let t;return t=!1,e.filter(e=>"queue-operation"===e.type?(t=l.has(ey(e)),!0):!t)},[e,l]),S=(0,s.useMemo)(()=>{let e=new Map;return N.forEach((t,s)=>{t.uuid&&e.set(t.uuid,s)}),e},[N]),M=(0,s.useMemo)(()=>(function(e){let t=new Map;for(let s of e)if("assistant"===s.type&&s.uuid)for(let e of s.message.content)"tool_use"===e.type&&"Task"===e.name&&e.subagentId&&t.set(e.subagentId,s.uuid);let s=new Map;for(let r of e){if(!r._source?.startsWith("agent-")||!r.uuid)continue;let e=r._source.slice(6),n=t.get(e);n&&s.set(r.uuid,n)}return s})(a),[a]),k=(0,s.useMemo)(()=>f&&M.has(f)?f:null,[f,M]),C=k?M.get(k)??null:null;(0,s.useEffect)(()=>{if(f)return b.current=setTimeout(()=>y(null),4e3),()=>{b.current&&clearTimeout(b.current)}},[]),(0,s.useEffect)(()=>{let e=()=>{let e=eb();y(e),v.current=!1,b.current&&clearTimeout(b.current),e&&(b.current=setTimeout(()=>y(null),4e3))};return window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)},[]);let E=(0,s.useMemo)(()=>{if(!f)return null;let t=C??f,s=e.some(e=>e.uuid===t),r=S.has(t);if(s&&!r){let s=null;for(let r of e)if("queue-operation"===r.type)s=ey(r);else if(r.uuid===t&&s)return s}return null},[f,C,e,S]);(0,s.useEffect)(()=>{if(!E)return;let e=requestAnimationFrame(()=>{c(e=>{if(!e.has(E))return e;let t=new Set(e);return t.delete(E),t})});return()=>cancelAnimationFrame(e)},[E]);let I=(0,s.useCallback)(e=>{c(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},[]),T=function({useFlushSync:e=!0,...t}){let n=s.useReducer(()=>({}),{})[1],i={...t,onChange:(s,i)=>{var o;e&&i?(0,r.flushSync)(n):n(),null==(o=t.onChange)||o.call(t,s,i)}},[o]=s.useState(()=>new p(i));return o.setOptions(i),g(()=>o._didMount(),[]),g(()=>o._willUpdate()),o}({getScrollElement:()=>"u">typeof document?window:null,observeElementRect:d,observeElementOffset:u,scrollToFn:m,initialOffset:()=>"u">typeof document?window.scrollY:0,...{count:N.length,estimateSize:e=>(function(e){switch(e.type){case"queue-operation":return 48;case"user":return 90;case"assistant":return 80+120*e.message.content.length;default:return 100}})(N[e]),overscan:5,scrollMargin:h}});return(0,s.useEffect)(()=>{if(!f||v.current)return;let e=C??f,t=S.get(e);null!=t&&(v.current=!0,requestAnimationFrame(()=>{T.scrollToIndex(t,{align:"center"})}))},[f,C,S,T]),(0,t.jsx)("div",{ref:j,children:(0,t.jsx)("div",{style:{height:`${T.getTotalSize()}px`,width:"100%",position:"relative"},children:T.getVirtualItems().map(e=>{let s=N[e.index],r=!!f&&s.uuid===(C??f);return(0,t.jsx)("div",{"data-index":e.index,ref:T.measureElement,style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${e.start-T.options.scrollMargin}px)`},children:"queue-operation"===s.type?(0,t.jsx)(z,{entry:s,isCollapsed:l.has(ey(s)),entryCount:w.get(ey(s))??0,onToggle:()=>I(ey(s))}):(0,t.jsx)(et,{entry:s,entriesBySource:n,projectName:i,sessionId:o,isHighlighted:!k&&r,highlightedUuid:k,autoExpandForUuid:k})},"queue-operation"===s.type?ey(s):s.uuid||s.timestamp)})})})}let ej=[];e.s([],76248),e.i(76248),e.s(["default",0,function({entries:e,projectName:r,sessionId:n}){let i=(0,s.useMemo)(()=>{let t=new Map;for(let s of e){let e=t.get(s._source);e?e.push(s):t.set(s._source,[s])}return t},[e]),o=i.get("session")??ej,a=(0,s.useMemo)(()=>(function(e){let t=new Map;for(let s of e)if("assistant"===s.type)for(let e of s.message.content)"tool_use"===e.type&&"Task"===e.name&&e.subagentId&&(t.has(e.subagentId)||t.set(e.subagentId,{id:e.subagentId,type:e.subagentType||"unknown",description:e.subagentDescription||""}));return Array.from(t.values())})(e),[e]),l=(0,s.useMemo)(()=>eg(o),[o]),[d,c]=(0,s.useState)(!1),[u,h]=(0,s.useState)(new Set),[m,p]=(0,s.useState)(!1),[x,g]=(0,s.useState)(null);(0,s.useEffect)(()=>{(0,es.searchHookActivityAction)({sessionId:n},1).then(e=>{e.entries.length>0&&g(e)}).catch(()=>{})},[n]),(0,s.useEffect)(()=>{let e=()=>{window.location.hash.startsWith("#entry-")&&p(!1)};return window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)},[]);let y=(0,s.useCallback)(e=>{h(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},[]);return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(C,{entries:o}),x&&(0,t.jsx)(ex,{sessionId:n,initialData:x},n),a.length>0&&(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("button",{onClick:()=>c(e=>!e),className:"flex items-center gap-2 hover:opacity-80 transition-opacity",children:[(0,t.jsx)(f.ChevronDown,{className:`w-4 h-4 text-muted-foreground transition-transform ${d?"-rotate-90":""}`}),(0,t.jsx)("span",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:"Subagents"}),(0,t.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",a.length,")"]})]}),!d&&a.map(e=>{let s;return(0,t.jsxs)("div",{className:"pl-3 border-l-2 border-primary/30 space-y-2",children:[(0,t.jsxs)("button",{onClick:()=>y(e.id),className:"flex items-center gap-2 hover:opacity-80 transition-opacity",children:[(0,t.jsx)(f.ChevronDown,{className:`w-3.5 h-3.5 text-muted-foreground transition-transform ${u.has(e.id)?"-rotate-90":""}`}),(0,t.jsx)("span",{className:"text-sm font-bold",children:e.type}),e.description&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground truncate max-w-[400px]",children:e.description})]}),!u.has(e.id)&&(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(C,{entries:i.get(`agent-${e.id}`)||[],compact:!0}),(s=eg(i.get(`agent-${e.id}`)||[])).length>0?(0,t.jsx)(ef,{tools:s,compact:!0}):null]})]},e.id)})]}),l.length>0&&(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:"Tools"}),(0,t.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",l.reduce((e,t)=>e+t.count,0),")"]})]}),(0,t.jsx)(ef,{tools:l})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("button",{onClick:()=>p(e=>!e),className:"flex items-center gap-2 hover:opacity-80 transition-opacity",children:[(0,t.jsx)(f.ChevronDown,{className:`w-4 h-4 text-muted-foreground transition-transform ${m?"-rotate-90":""}`}),(0,t.jsx)("span",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:"Logs"})]}),!m&&(0,t.jsx)("div",{className:"mt-2 bg-card border border-border rounded-lg p-4 shadow-sm",children:0===o.length?(0,t.jsx)("p",{className:"text-muted-foreground text-center py-8",children:"No entries found."}):(0,t.jsx)(ev,{entries:o,entriesBySource:i,projectName:r,sessionId:n})})]})]})}],36406)},5780,e=>{e.n(e.i(36406))}]);
|
|
4
|
+
color: hsl(${Math.max(0,Math.min(120-120*r,120))}deg 100% 31%);`,null==s?void 0:s.key)}return(null==s?void 0:s.onChange)&&!(i&&s.skipInitialOnChange)&&s.onChange(r),i=!1,r}return o.updateDeps=e=>{n=e},o}function i(e,t){if(void 0!==e)return e;throw Error(`Unexpected undefined${t?`: ${t}`:""}`)}e.i(47167);let o=e=>e,a=e=>{let t=Math.max(e.startIndex-e.overscan,0),s=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let e=t;e<=s;e++)r.push(e);return r},l={passive:!0},d=(e,t)=>{let s=e.scrollElement;if(!s)return;let r=()=>{t({width:s.innerWidth,height:s.innerHeight})};return r(),s.addEventListener("resize",r,l),()=>{s.removeEventListener("resize",r)}},c="u"<typeof window||"onscrollend"in window,u=(e,t)=>{var s,r;let n,i=e.scrollElement;if(!i)return;let o=e.targetWindow;if(!o)return;let a=0,d=e.options.useScrollendEvent&&c?()=>void 0:(s=()=>{t(a,!1)},r=e.options.isScrollingResetDelay,function(...e){o.clearTimeout(n),n=o.setTimeout(()=>s.apply(this,e),r)}),u=s=>()=>{a=i[e.options.horizontal?"scrollX":"scrollY"],d(),t(a,s)},h=u(!0),m=u(!1);i.addEventListener("scroll",h,l);let p=e.options.useScrollendEvent&&c;return p&&i.addEventListener("scrollend",m,l),()=>{i.removeEventListener("scroll",h),p&&i.removeEventListener("scrollend",m)}},h=(e,t,s)=>{if(null==t?void 0:t.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[s.options.horizontal?"inlineSize":"blockSize"])}return e[s.options.horizontal?"offsetWidth":"offsetHeight"]},m=(e,{adjustments:t=0,behavior:s},r)=>{var n,i;null==(i=null==(n=r.scrollElement)?void 0:n.scrollTo)||i.call(n,{[r.options.horizontal?"left":"top"]:e+t,behavior:s})};class p{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var e,t,s;return(null==(s=null==(t=null==(e=this.targetWindow)?void 0:e.performance)?void 0:t.now)?void 0:s.call(t))??Date.now()},this.observer=(()=>{let e=null,t=()=>e||(this.targetWindow&&this.targetWindow.ResizeObserver?e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{let t=()=>{let t=e.target,s=this.indexFromElement(t);t.isConnected?this.shouldMeasureDuringScroll(s)&&this.resizeItem(s,this.options.measureElement(t,e,this)):this.observer.unobserve(t)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()})}):null);return{disconnect:()=>{var s;null==(s=t())||s.disconnect(),e=null},observe:e=>{var s;return null==(s=t())?void 0:s.observe(e,{box:"border-box"})},unobserve:e=>{var s;return null==(s=t())?void 0:s.unobserve(e)}}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach(([t,s])=>{void 0===s&&delete e[t]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:o,rangeExtractor:a,onChange:()=>{},measureElement:h,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",...e}},this.notify=e=>{var t,s;null==(s=(t=this.options).onChange)||s.call(t,this,e)},this.maybeNotify=n(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),null!=this.rafId&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var e;let t=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==t){if(this.cleanup(),!t)return void this.maybeNotify();this.scrollElement=t,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=(null==(e=this.scrollElement)?void 0:e.window)??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{this.scrollAdjustments=0,this.scrollDirection=t?this.getScrollOffset()<e?"forward":"backward":null,this.scrollOffset=e,this.isScrolling=t,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??("function"==typeof this.options.initialOffset?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(e,t)=>{let s=new Map,r=new Map;for(let n=t-1;n>=0;n--){let t=e[n];if(s.has(t.lane))continue;let i=r.get(t.lane);if(null==i||t.end>i.end?r.set(t.lane,t):t.end<i.end&&s.set(t.lane,!0),s.size===this.options.lanes)break}return r.size===this.options.lanes?Array.from(r.values()).sort((e,t)=>e.end===t.end?e.index-t.index:e.end-t.end)[0]:void 0},this.getMeasurementOptions=n(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(e,t,s,r,n,i,o)=>(void 0!==this.prevLanes&&this.prevLanes!==i&&(this.lanesChangedFlag=!0),this.prevLanes=i,this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:t,scrollMargin:s,getItemKey:r,enabled:n,lanes:i,laneAssignmentMode:o}),{key:!1}),this.getMeasurements=n(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:e,paddingStart:t,scrollMargin:s,getItemKey:r,enabled:n,lanes:i,laneAssignmentMode:o},a)=>{if(!n)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),0!==this.measurementsCache.length||this.lanesSettling||(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let l=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1);let d=this.measurementsCache.slice(0,l),c=Array(i).fill(void 0);for(let e=0;e<l;e++){let t=d[e];t&&(c[t.lane]=e)}for(let n=l;n<e;n++){let e,i,l=r(n),u=this.laneAssignments.get(n),h="estimate"===o||a.has(l);if(void 0!==u&&this.options.lanes>1){let r=c[e=u],n=void 0!==r?d[r]:void 0;i=n?n.end+this.options.gap:t+s}else{let r=1===this.options.lanes?d[n-1]:this.getFurthestMeasurement(d,n);i=r?r.end+this.options.gap:t+s,e=r?r.lane:n%this.options.lanes,this.options.lanes>1&&h&&this.laneAssignments.set(n,e)}let m=a.get(l),p="number"==typeof m?m:this.options.estimateSize(n),x=i+p;d[n]={index:n,start:i,size:p,end:x,key:l,lane:e},c[e]=n}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=n(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,s,r)=>this.range=e.length>0&&t>0?function({measurements:e,outerSize:t,scrollOffset:s,lanes:r}){let n=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:n};let i=x(0,n,t=>e[t].start,s),o=i;if(1===r)for(;o<n&&e[o].end<s+t;)o++;else if(r>1){let a=Array(r).fill(0);for(;o<n&&a.some(e=>e<s+t);){let t=e[o];a[t.lane]=t.end,o++}let l=Array(r).fill(s+t);for(;i>=0&&l.some(e=>e>=s);){let t=e[i];l[t.lane]=t.start,i--}i=Math.max(0,i-i%r),o=Math.min(n,o+(r-1-o%r))}return{startIndex:i,endIndex:o}}({measurements:e,outerSize:t,scrollOffset:s,lanes:r}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=n(()=>{let e=null,t=null,s=this.calculateRange();return s&&(e=s.startIndex,t=s.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]},(e,t,s,r,n)=>null===r||null===n?[]:e({startIndex:r,endIndex:n,overscan:t,count:s}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,s=e.getAttribute(t);return s?parseInt(s,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{var t;if(!this.scrollState||"smooth"!==this.scrollState.behavior)return!0;let s=this.scrollState.index??(null==(t=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))?void 0:t.index);if(void 0!==s&&this.range){let t=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,s-t),n=Math.min(this.options.count-1,s+t);return e>=r&&e<=n}return!0},this.measureElement=e=>{if(!e)return void this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});let t=this.indexFromElement(e),s=this.options.getItemKey(t),r=this.elementsCache.get(s);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(s,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{var s;let r=this.measurementsCache[e];if(!r)return;let n=t-(this.itemSizeCache.get(r.key)??r.size);0!==n&&((null==(s=this.scrollState)?void 0:s.behavior)!=="smooth"&&(void 0!==this.shouldAdjustScrollPositionOnItemSizeChange?this.shouldAdjustScrollPositionOnItemSizeChange(r,n,this):r.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=n,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(r.index),this.itemSizeCache=new Map(this.itemSizeCache.set(r.key,t)),this.notify(!1))},this.getVirtualItems=n(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{let s=[];for(let r=0,n=e.length;r<n;r++){let n=t[e[r]];s.push(n)}return s},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(0!==t.length)return i(t[x(0,t.length-1,e=>i(t[e]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(e,t,s=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),n=this.getScrollOffset();return"auto"===t&&(t=e>=n+r?"end":"start"),"center"===t?e+=(s-r)/2:"end"===t&&(e-=r),Math.max(Math.min(this.getMaxScrollOffset(),e),0)},this.getOffsetForIndex=(e,t="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));let s=this.getSize(),r=this.getScrollOffset(),n=this.measurementsCache[e];if(!n)return;if("auto"===t)if(n.end>=r+s-this.options.scrollPaddingEnd)t="end";else{if(!(n.start<=r+this.options.scrollPaddingStart))return[r,t];t="start"}if("end"===t&&e===this.options.count-1)return[this.getMaxScrollOffset(),t];let i="end"===t?n.end+this.options.scrollPaddingEnd:n.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(i,t,n.size),t]},this.scrollToOffset=(e,{align:t="start",behavior:s="auto"}={})=>{let r=this.getOffsetForAlignment(e,t),n=this.now();this.scrollState={index:null,align:t,behavior:s,startedAt:n,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:t="auto",behavior:s="auto"}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[n,i]=r,o=this.now();this.scrollState={index:e,align:i,behavior:s,startedAt:o,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:t="auto"}={})=>{let s=this.getScrollOffset()+e,r=this.now();this.scrollState={index:null,align:"start",behavior:t,startedAt:r,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var e;let t,s=this.getMeasurements();if(0===s.length)t=this.options.paddingStart;else if(1===this.options.lanes)t=(null==(e=s[s.length-1])?void 0:e.end)??0;else{let e=Array(this.options.lanes).fill(null),r=s.length-1;for(;r>=0&&e.some(e=>null===e);){let t=s[r];null===e[t.lane]&&(e[t.lane]=t.end),r--}t=Math.max(...e.filter(e=>null!==e))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(e,{adjustments:t,behavior:s})=>{this.options.scrollToFn(e,{behavior:s,adjustments:t},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(e)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}null==this.rafId&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let e=null!=this.scrollState.index?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,t=e?e[0]:this.scrollState.lastTargetOffset,s=t!==this.scrollState.lastTargetOffset;if(!s&&1.01>Math.abs(t-this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1){this.scrollState=null;return}}else this.scrollState.stableFrames=0,s&&(this.scrollState.lastTargetOffset=t,this.scrollState.behavior="auto",this._scrollToOffset(t,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}let x=(e,t,s,r)=>{for(;e<=t;){let n=(e+t)/2|0,i=s(n);if(i<r)e=n+1;else{if(!(i>r))return n;t=n-1}}return e>0?e-1:0},g="u">typeof document?s.useLayoutEffect:s.useEffect;var f=e.i(16327),y=e.i(56420);let b=(0,y.default)("wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]),v=(0,y.default)("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]),j=(0,y.default)("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]),w=(0,y.default)("cpu",[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]),N=(0,y.default)("clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]]);var S=e.i(68590);let M=(0,y.default)("workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]);var k=e.i(34713);let C=s.default.memo(function({entries:e,compact:r=!1}){let n=(0,s.useMemo)(()=>(function(e){let t=0,s=0,r=0,n=0,i=0,o=new Set;for(let a of e)if("user"===a.type&&t++,"queue-operation"===a.type&&i++,"assistant"===a.type){for(let e of(s++,a.message.content))"tool_use"===e.type&&("Task"===e.name&&(e.subagentType||e.subagentId)?n++:r++);a.message.model&&o.add(a.message.model)}let a="";if(e.length>=2){let t=e[e.length-1].timestampMs-e[0].timestampMs;a=(0,k.formatDuration)(t)}return{turnCount:i,userCount:t,assistantCount:s,toolCallCount:r,subagentCount:n,duration:a,models:Array.from(o)}})(e),[e]),i=r?"w-3.5 h-3.5":"w-4 h-4",o=r?"text-xs font-medium":"text-sm font-medium",a=r?"text-[10px] text-muted-foreground":"text-xs text-muted-foreground",l=[...r?[]:[{Icon:S.MessageSquare,color:"text-primary",v:n.turnCount,l:"Turns"}],{Icon:v,color:"text-[color:var(--chart-1)]",v:n.userCount,l:"User"},{Icon:j,color:"text-[color:var(--chart-2)]",v:n.assistantCount,l:"Assistant"},{Icon:b,color:"text-[color:var(--chart-3)]",v:n.toolCallCount,l:r?"Tools":"Tool Calls"},{Icon:M,color:"text-[color:var(--chart-5)]",v:n.subagentCount,l:"Subagents"},{Icon:N,color:"text-[color:var(--chart-4)]",v:n.duration||"—",l:"Duration"},{Icon:w,color:"text-[color:var(--chart-5)]",v:n.models.length>0?n.models.join(", "):"—",l:r?"Model":"Model(s)"}];return(0,t.jsx)("div",{className:r?"bg-muted/30 border border-border/50 rounded-lg p-3 mb-3":"bg-card border border-border rounded-lg p-4",children:(0,t.jsx)("div",{className:`grid grid-cols-2 ${r?"sm:grid-cols-6 gap-3":"sm:grid-cols-4 lg:grid-cols-7 gap-4"}`,children:l.map(({Icon:e,color:s,v:r,l:n})=>(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(e,{className:`${i} ${s}`}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:`${o} truncate max-w-[120px]`,children:r}),(0,t.jsx)("div",{className:a,children:n})]})]},n))})})}),E=(0,y.default)("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);var I=e.i(67927);function T(e){return JSON.stringify(e.raw,null,2)}let O=new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit",hour12:!0});function A(e){let t=new Date(e),s=O.format(t),r=t.getMilliseconds().toString().padStart(3,"0");return`${s}.${r}`}let z=s.default.memo(function({entry:e,isCollapsed:s,entryCount:r,onToggle:n}){let i="function"==typeof n,o=(0,t.jsxs)("div",{className:`flex items-center gap-2 px-3 py-1 rounded-full bg-primary/10 border border-primary/20 text-primary text-xs font-medium${i?" group-hover:bg-primary/20 transition-colors":""}`,children:[i?(0,t.jsx)(I.ChevronRight,{className:`w-3 h-3 transition-transform ${s?"":"rotate-90"}`}):(0,t.jsx)(E,{className:"w-3 h-3"}),(0,t.jsx)("span",{children:e.label}),(0,t.jsx)("span",{className:"text-muted-foreground",children:A(e.timestampMs)}),i&&s&&"number"==typeof r&&(0,t.jsxs)("span",{className:"ml-1 px-1.5 py-0.5 rounded bg-primary/20 text-[10px] leading-none",children:[r," ",1===r?"entry":"entries"]})]});return i?(0,t.jsxs)("button",{type:"button",onClick:n,className:"group flex items-center gap-3 py-3 px-4 w-full cursor-pointer",children:[(0,t.jsx)("div",{className:"flex-1 h-px bg-primary/30"}),o,(0,t.jsx)("div",{className:"flex-1 h-px bg-primary/30"})]}):(0,t.jsxs)("div",{className:"flex items-center gap-3 py-3 px-4",children:[(0,t.jsx)("div",{className:"flex-1 h-px bg-primary/30"}),o,(0,t.jsx)("div",{className:"flex-1 h-px bg-primary/30"})]})});var F=e.i(47163);let $={user:"User",assistant:"Assistant","file-history-snapshot":"Snapshot",progress:"Progress",system:"System","queue-operation":"Queue"},D={user:"bg-[color:var(--chart-1)]/20 text-[color:var(--chart-1)] border-[color:var(--chart-1)]/30",assistant:"bg-[color:var(--chart-2)]/20 text-[color:var(--chart-2)] border-[color:var(--chart-2)]/30","file-history-snapshot":"bg-[color:var(--chart-3)]/20 text-[color:var(--chart-3)] border-[color:var(--chart-3)]/30",progress:"bg-[color:var(--chart-5)]/20 text-[color:var(--chart-5)] border-[color:var(--chart-5)]/30",system:"bg-[color:var(--chart-4)]/20 text-[color:var(--chart-4)] border-[color:var(--chart-4)]/30","queue-operation":"bg-primary/20 text-primary border-primary/30"},R={user:"border-l-[color:var(--chart-1)]",assistant:"border-l-[color:var(--chart-2)]","file-history-snapshot":"border-l-[color:var(--chart-3)]",progress:"border-l-[color:var(--chart-5)]",system:"border-l-[color:var(--chart-4)]","queue-operation":"border-l-primary"},U=(0,y.default)("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]),q=(0,y.default)("activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);var P=e.i(66794);function W({type:e}){let s="w-4 h-4";switch(e){case"user":return(0,t.jsx)(v,{className:s});case"assistant":return(0,t.jsx)(j,{className:s});case"file-history-snapshot":return(0,t.jsx)(U,{className:s});case"progress":return(0,t.jsx)(q,{className:s});case"system":return(0,t.jsx)(P.Settings,{className:s});case"queue-operation":return(0,t.jsx)(E,{className:s})}}function H({type:e}){return(0,t.jsxs)("span",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 text-xs font-mono rounded border ${D[e]}`,children:[(0,t.jsx)(W,{type:e}),$[e]]})}var L=e.i(24380);function _({block:e}){let r=(0,s.useMemo)(()=>JSON.stringify(e.input,null,2),[e]);return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("details",{open:!0,children:[(0,t.jsx)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground transition-colors",children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:["Input",(0,t.jsx)(L.CopyButton,{text:r})]})}),(0,t.jsx)("pre",{className:"mt-1 p-2 bg-muted/50 rounded text-xs whitespace-pre-wrap break-words max-h-64 overflow-y-auto",children:r})]}),e.result?(0,t.jsxs)("div",{className:"border-l-2 border-primary/50 pl-3 space-y-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"inline-block px-2 py-0.5 text-xs font-mono rounded border bg-primary/20 text-primary border-primary/30",children:"Result"}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:A(new Date(e.result.timestamp).getTime())})]}),e.result.content&&(0,t.jsxs)("details",{open:!0,children:[(0,t.jsx)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground transition-colors",children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:["Output",(0,t.jsx)(L.CopyButton,{text:e.result.content})]})}),(0,t.jsx)("pre",{className:"mt-1 p-2 bg-muted/50 rounded text-xs whitespace-pre-wrap break-words max-h-48 overflow-y-auto",children:e.result.content})]}),e.result.images?.map((e,s)=>(0,t.jsx)("img",{src:`data:${e.mediaType};base64,${e.base64}`,alt:`Tool result image ${s+1}`,className:"mt-2 max-w-full rounded border border-border"},s))]}):(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:"Tool did not return a result"})]})}let B=(0,y.default)("brain",[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]]),V=s.default.memo(function({block:e,entriesBySource:s,projectName:r,sessionId:n,highlightedUuid:i,autoExpandForUuid:o}){switch(e.type){case"text":return(0,t.jsx)("p",{className:"whitespace-pre-wrap text-sm",children:e.text});case"tool_use":if("Task"===e.name&&(e.subagentType||e.subagentId)){let a=e.subagentId&&s?s.get(`agent-${e.subagentId}`):void 0;return(0,t.jsx)(Z,{block:e,subagentEntries:a,projectName:r,sessionId:n,highlightedUuid:i,autoExpandForUuid:o})}return(0,t.jsxs)("div",{className:"border border-border/50 rounded-lg p-3 bg-muted/10",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,t.jsx)(b,{className:"w-4 h-4 text-primary flex-shrink-0"}),(0,t.jsx)("span",{className:"font-mono text-sm text-primary truncate min-w-0",children:e.name}),e.result&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground ml-auto flex-shrink-0",children:e.result.durationFormatted})]}),(0,t.jsx)(_,{block:e})]});case"thinking":return(0,t.jsx)("div",{className:"border border-[color:var(--chart-5)]/30 rounded-lg p-3 bg-[color:var(--chart-5)]/5",children:(0,t.jsxs)("details",{children:[(0,t.jsxs)("summary",{className:"flex items-center gap-2 text-xs cursor-pointer hover:text-foreground transition-colors text-[color:var(--chart-5)]",children:[(0,t.jsx)(B,{className:"w-4 h-4"}),(0,t.jsx)("span",{children:"Thinking"}),(0,t.jsxs)("span",{className:"text-muted-foreground ml-1",children:["(",e.thinking.length.toLocaleString()," chars)"]})]}),(0,t.jsx)("p",{className:"mt-2 whitespace-pre-wrap text-xs text-muted-foreground p-2 bg-muted/30 rounded max-h-64 overflow-y-auto",children:e.thinking})]})})}});function K({entry:e}){return(0,t.jsx)("div",{children:e.message.content&&(0,t.jsx)("p",{className:"whitespace-pre-wrap text-sm",children:e.message.content})})}let J=s.default.memo(function({entry:e,entriesBySource:s,projectName:r,sessionId:n,highlightedUuid:i,autoExpandForUuid:o}){let{content:a}=e.message;return(0,t.jsx)("div",{className:"space-y-3",children:a.map((e,a)=>(0,t.jsx)(V,{block:e,entriesBySource:s,projectName:r,sessionId:n,highlightedUuid:i,autoExpandForUuid:o},a))})}),Y=s.default.memo(function({entry:e}){let r=(0,s.useMemo)(()=>{if("progress"===e.type){let t=e.raw.data,s=t?.agentId;return[t?.type,s&&`agent:${s}`].filter(Boolean).join(" | ")}return"file-history-snapshot"===e.type?"File history snapshot":e.type},[e.type,e.raw]);return(0,t.jsxs)("div",{className:"text-sm",children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:r}),(0,t.jsxs)("details",{className:"mt-1",children:[(0,t.jsx)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground transition-colors",children:"Show raw JSON"}),(0,t.jsx)("pre",{className:"mt-1 p-2 bg-muted/50 rounded text-xs whitespace-pre-wrap break-words max-h-64 overflow-y-auto",children:T(e)})]})]})}),X=(0,y.default)("link-2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);var Q=e.i(55574);function G({uuid:e}){let r=(0,s.useCallback)(async()=>{window.history.replaceState(null,"",`#entry-${e}`);try{await navigator.clipboard.writeText(window.location.href)}catch{let e=document.createElement("textarea");e.value=window.location.href,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)}(0,Q.toast)("Link copied")},[e]);return(0,t.jsx)("button",{onClick:r,title:"Copy link to entry",className:"inline-flex items-center justify-center rounded p-1 text-muted-foreground hover:text-foreground hover:bg-muted/80 transition-colors opacity-0 group-hover:opacity-100 transition-opacity",children:(0,t.jsx)(X,{className:"w-3.5 h-3.5"})})}function Z({block:e,subagentEntries:r,projectName:n,sessionId:i,highlightedUuid:o,autoExpandForUuid:a}){let l=!!(a&&r?.some(e=>e.uuid===a)),[d,c]=(0,s.useState)(l);(0,s.useEffect)(()=>{if(!l)return;let e=requestAnimationFrame(()=>c(!0));return()=>cancelAnimationFrame(e)},[l]);let u=(0,s.useCallback)(()=>{c(e=>!e)},[]),h=r&&r.length>0;return(0,t.jsxs)("div",{className:"border border-border/50 rounded-lg p-3 bg-muted/10",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,t.jsx)(M,{className:"w-4 h-4 text-[color:var(--chart-5)]"}),(0,t.jsx)("span",{className:"font-mono text-sm text-[color:var(--chart-5)]",children:"Subagent"}),e.subagentType&&(0,t.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 text-xs font-mono rounded border bg-[color:var(--chart-5)]/20 text-[color:var(--chart-5)] border-[color:var(--chart-5)]/30",children:e.subagentType}),e.result&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground ml-auto",children:e.result.durationFormatted})]}),e.subagentDescription&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground mb-2",children:e.subagentDescription}),e.subagentId&&r&&(0,t.jsxs)("button",{onClick:u,className:"inline-flex items-center gap-1.5 px-2.5 py-1 text-xs font-medium rounded border border-primary/30 bg-primary/10 text-primary hover:bg-primary/20 transition-colors mb-2",children:[(0,t.jsx)(I.ChevronRight,{className:(0,F.cn)("w-3 h-3 transition-transform",d&&"rotate-90")}),(0,t.jsxs)("span",{children:["agent-",e.subagentId]}),(0,t.jsx)("span",{className:"text-muted-foreground",children:d?"Collapse":"View subagent log"})]}),d&&(0,t.jsxs)("div",{className:"ml-4 pl-3 border-l-2 border-primary/30 mt-2 space-y-2",children:[r&&0===r.length&&(0,t.jsx)("div",{className:"text-xs text-muted-foreground py-2",children:"No entries found in subagent log."}),h&&(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(C,{entries:r,compact:!0})}),r&&r.map(e=>"queue-operation"===e.type?(0,t.jsx)(z,{entry:e},e.uuid||e.timestamp):(0,t.jsx)(et,{entry:e,projectName:n,sessionId:i,isHighlighted:!!o&&e.uuid===o},e.uuid||e.timestamp))]}),(0,t.jsx)(_,{block:e})]})}function ee({entry:e,entriesBySource:s,projectName:r,sessionId:n,highlightedUuid:i,autoExpandForUuid:o}){switch(e.type){case"user":return(0,t.jsx)(K,{entry:e});case"assistant":return(0,t.jsx)(J,{entry:e,entriesBySource:s,projectName:r,sessionId:n,highlightedUuid:i,autoExpandForUuid:o});case"file-history-snapshot":case"progress":case"system":return(0,t.jsx)(Y,{entry:e})}}let et=s.default.memo(function({entry:e,entriesBySource:s,projectName:r,sessionId:n,isHighlighted:i,highlightedUuid:o,autoExpandForUuid:a}){return(0,t.jsxs)("div",{id:e.uuid?`entry-${e.uuid}`:void 0,className:(0,F.cn)(`group border-l-4 ${R[e.type]} bg-card/50 rounded-r-lg mb-2 hover:bg-muted/30 transition-colors`,i&&"entry-highlighted"),children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border/30",children:[(0,t.jsx)(H,{type:e.type}),(0,t.jsxs)("div",{className:"flex items-center gap-1 ml-auto",children:[e.uuid&&(0,t.jsx)(G,{uuid:e.uuid}),(0,t.jsx)(L.CopyButton,{text:function(e){switch(e.type){case"user":return e.message.content;case"assistant":return e.message.content.filter(e=>"text"===e.type).map(e=>e.text).join("\n");case"file-history-snapshot":case"progress":case"system":return T(e);case"queue-operation":return e.label}}(e)}),(0,t.jsx)("span",{className:"text-xs font-mono text-muted-foreground whitespace-nowrap",children:A(e.timestampMs)})]})]}),(0,t.jsx)("div",{className:"px-4 py-3",children:(0,t.jsx)(ee,{entry:e,entriesBySource:s,projectName:r,sessionId:n,highlightedUuid:o,autoExpandForUuid:a})})]})},(e,t)=>e.entry===t.entry&&e.entriesBySource===t.entriesBySource&&e.projectName===t.projectName&&e.sessionId===t.sessionId&&e.isHighlighted===t.isHighlighted&&e.highlightedUuid===t.highlightedUuid&&e.autoExpandForUuid===t.autoExpandForUuid);var es=e.i(61364),er=e.i(84026),en=e.i(29407),ei=e.i(16306),eo=e.i(82954),ea=e.i(73520),el=e.i(85881);function ed({decision:e}){return"deny"===e?(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[0.65rem] font-semibold tracking-wide uppercase bg-red-500/10 text-red-400 border border-red-500/20",children:[(0,t.jsx)(en.ShieldX,{className:"h-3 w-3"}),"Deny"]}):"instruct"===e?(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[0.65rem] font-semibold tracking-wide uppercase bg-amber-500/10 text-amber-400 border border-amber-500/20",children:[(0,t.jsx)(ei.ShieldAlert,{className:"h-3 w-3"}),"Instruct"]}):(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[0.65rem] font-semibold tracking-wide uppercase bg-emerald-500/10 text-emerald-400 border border-emerald-500/20",children:[(0,t.jsx)(er.ShieldCheck,{className:"h-3 w-3"}),"Allow"]})}function ec({eventType:e}){return(0,t.jsx)("span",{className:"inline-flex items-center rounded px-1.5 py-0.5 text-[0.6rem] font-medium bg-muted text-muted-foreground border border-border/50",children:e})}function eu({mode:e}){let s="default"===e;return(0,t.jsx)("span",{className:`inline-flex items-center rounded px-1.5 py-0.5 text-[0.6rem] font-medium border ${s?"bg-sky-500/10 text-sky-400 border-sky-500/20":"bg-amber-500/10 text-amber-400 border-amber-500/20"}`,children:e})}function eh({ms:e}){return(0,t.jsx)("span",{className:`font-mono text-[0.7rem] ${e>500?"text-red-400":e>100?"text-amber-400":"text-muted-foreground"}`,children:e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`})}function em({value:e,onChange:s}){return(0,t.jsx)("div",{className:"inline-flex items-center rounded-md border border-border bg-muted/30 p-0.5",children:[{label:"All",value:""},{label:"Allow",value:"allow"},{label:"Instruct",value:"instruct"},{label:"Deny",value:"deny"}].map(r=>(0,t.jsx)("button",{onClick:()=>s(r.value),className:`px-2.5 py-1 text-[0.65rem] font-medium rounded transition-all ${e===r.value?"deny"===r.value?"bg-red-500/15 text-red-400 shadow-sm":"allow"===r.value?"bg-emerald-500/15 text-emerald-400 shadow-sm":"instruct"===r.value?"bg-amber-500/15 text-amber-400 shadow-sm":"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:r.label},r.value))})}function ep({item:e}){return(0,t.jsx)("tr",{children:(0,t.jsx)("td",{colSpan:9,className:"px-0 py-0",children:(0,t.jsxs)("div",{className:"px-6 py-3 bg-muted/20 border-t border-border/30 space-y-2 text-xs animate-expand",children:[(0,t.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-x-8 gap-y-1.5",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:"Session ID: "}),(0,t.jsx)("span",{className:"font-mono text-foreground",children:e.sessionId??"—"}),e.sessionId&&(0,t.jsx)(L.CopyButton,{text:e.sessionId})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:"CWD: "}),(0,t.jsx)("span",{className:"font-mono text-foreground",children:e.cwd??"—"}),e.cwd&&(0,t.jsx)(L.CopyButton,{text:e.cwd})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:"Transcript: "}),(0,t.jsx)("span",{className:"font-mono text-foreground break-all",children:e.transcriptPath??"—"})]})]}),e.policyNames&&e.policyNames.length>1&&(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:"Policies: "}),(0,t.jsx)("span",{className:"font-mono text-foreground",children:e.policyNames.join(", ")})]}),e.reason&&(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:"Full reason: "}),(0,t.jsx)("span",{className:"text-foreground",children:e.reason})]})]})})})}function ex({sessionId:e,initialData:r}){let{intervalSec:n}=(0,el.useAutoRefresh)(),[i,o]=(0,s.useState)(!1),[a,l]=(0,s.useState)(1),[d,c]=(0,s.useState)(r),[u,h]=(0,s.useState)(null),[m,p]=(0,s.useState)(""),[x,g]=(0,s.useState)(""),[y,b]=(0,s.useState)(""),v=(0,s.useRef)(null),j=(0,s.useRef)({filterDecision:m,filterEventType:x,filterPolicy:y});j.current={filterDecision:m,filterEventType:x,filterPolicy:y};let w=""!==m||""!==x||""!==y,N=(0,s.useCallback)(async t=>{try{let{filterDecision:s,filterEventType:r,filterPolicy:n}=j.current,i=await (0,es.searchHookActivityAction)({sessionId:e,decision:s||void 0,eventType:r||void 0,policyName:n||void 0},t);c(i)}catch{}},[e]);(0,s.useEffect)(()=>{N(a);let e=setInterval(()=>N(a),n>0?1e3*n:5e3);return()=>clearInterval(e)},[a,N,n]),(0,s.useEffect)(()=>(v.current&&clearTimeout(v.current),v.current=setTimeout(()=>{l(1),h(null),N(1)},300),()=>{v.current&&clearTimeout(v.current)}),[m,x,y]);let S=d.entries,M=d.totalPages;return(0,t.jsxs)("div",{children:[(0,t.jsxs)("button",{onClick:()=>o(e=>!e),className:"flex items-center gap-2 hover:opacity-80 transition-opacity",children:[(0,t.jsx)(f.ChevronDown,{className:`w-4 h-4 text-muted-foreground transition-transform ${i?"-rotate-90":""}`}),(0,t.jsx)("span",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:"Hook Logs"})]}),!i&&(0,t.jsxs)("div",{className:"mt-2 bg-card border border-border rounded-lg overflow-hidden shadow-sm",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3 px-4 py-2.5 border-b border-border bg-muted/20",children:[(0,t.jsx)(em,{value:m,onChange:p}),(0,t.jsxs)("select",{value:x,onChange:e=>g(e.target.value),className:"h-7 rounded-md border border-border bg-background px-2 text-xs text-foreground focus:outline-none focus:ring-2 focus:ring-primary/40 focus:border-primary/40 transition-shadow",children:[(0,t.jsx)("option",{value:"",children:"All Events"}),(0,t.jsx)("option",{value:"PreToolUse",children:"PreToolUse"}),(0,t.jsx)("option",{value:"PostToolUse",children:"PostToolUse"}),(0,t.jsx)("option",{value:"SessionStart",children:"SessionStart"}),(0,t.jsx)("option",{value:"SessionEnd",children:"SessionEnd"}),(0,t.jsx)("option",{value:"UserPromptSubmit",children:"UserPromptSubmit"}),(0,t.jsx)("option",{value:"PermissionRequest",children:"PermissionRequest"})]}),(0,t.jsx)("div",{className:"relative",children:(0,t.jsx)("input",{type:"text",value:y,onChange:e=>b(e.target.value),placeholder:"Filter by policy…",className:"h-7 rounded-md border border-border bg-background px-2.5 text-xs text-foreground placeholder:text-muted-foreground w-44 focus:outline-none focus:ring-2 focus:ring-primary/40 focus:border-primary/40 transition-shadow"})})]}),0===S.length?(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 px-4",children:[(0,t.jsx)(eo.Shield,{className:"h-10 w-10 text-muted-foreground/30"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground mt-3",children:w?"No matching hook events.":"No hook events found."})]}):(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"w-full text-xs",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"text-left text-muted-foreground border-b border-border bg-muted/30",children:[(0,t.jsx)("th",{className:"px-4 py-2.5 font-medium w-6"}),(0,t.jsx)("th",{className:"px-3 py-2.5 font-medium",children:"Decision"}),(0,t.jsx)("th",{className:"px-3 py-2.5 font-medium",children:"Event"}),(0,t.jsx)("th",{className:"px-3 py-2.5 font-medium",children:"Tool"}),(0,t.jsx)("th",{className:"px-3 py-2.5 font-medium",children:"Policy"}),(0,t.jsx)("th",{className:"px-3 py-2.5 font-medium",children:"Reason"}),(0,t.jsx)("th",{className:"px-3 py-2.5 font-medium",children:"Duration"}),(0,t.jsx)("th",{className:"px-3 py-2.5 font-medium",children:"Mode"}),(0,t.jsx)("th",{className:"px-3 py-2.5 font-medium text-right",children:"Time"})]})}),(0,t.jsx)("tbody",{className:"divide-y divide-border/30",children:S.map((e,r)=>{let n="deny"===e.decision,i=u===r,o="instruct"===e.decision;return(0,t.jsxs)(s.default.Fragment,{children:[(0,t.jsxs)("tr",{onClick:()=>{h(e=>e===r?null:r)},className:`cursor-pointer transition-colors ${n?"bg-red-500/[0.03] hover:bg-red-500/[0.07] border-l-2 border-l-red-500/40":o?"bg-amber-500/[0.03] hover:bg-amber-500/[0.07] border-l-2 border-l-amber-500/40":r%2==0?"hover:bg-muted/30":"bg-muted/[0.04] hover:bg-muted/30"} ${i?"bg-muted/20":""}`,children:[(0,t.jsx)("td",{className:"px-4 py-2",children:(0,t.jsx)(f.ChevronDown,{className:`h-3.5 w-3.5 text-muted-foreground transition-transform duration-150 ${i?"rotate-0":"-rotate-90"}`})}),(0,t.jsx)("td",{className:"px-3 py-2",children:(0,t.jsx)(ed,{decision:e.decision})}),(0,t.jsx)("td",{className:"px-3 py-2",children:(0,t.jsx)(ec,{eventType:e.eventType})}),(0,t.jsx)("td",{className:"px-3 py-2 font-mono text-foreground",children:e.toolName??"—"}),(0,t.jsx)("td",{className:"px-3 py-2 font-mono text-foreground",children:e.policyNames&&e.policyNames.length>1?(0,t.jsxs)("span",{title:e.policyNames.join(", "),children:[e.policyNames[0],(0,t.jsxs)("span",{className:"text-muted-foreground text-[0.6rem]",children:[" +",e.policyNames.length-1]})]}):e.policyName??"—"}),(0,t.jsx)("td",{className:"px-3 py-2 text-muted-foreground truncate max-w-[240px]",title:e.reason??"",children:e.reason??"—"}),(0,t.jsx)("td",{className:"px-3 py-2",children:(0,t.jsx)(eh,{ms:e.durationMs})}),(0,t.jsx)("td",{className:"px-3 py-2",children:e.permissionMode?(0,t.jsx)(eu,{mode:e.permissionMode}):"—"}),(0,t.jsx)("td",{className:"px-3 py-2 text-right text-muted-foreground whitespace-nowrap",title:new Date(e.timestamp).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}),children:(0,k.formatRelativeTime)(e.timestamp)})]}),i&&(0,t.jsx)(ep,{item:e})]},`${e.timestamp}-${r}`)})})]})}),(0,t.jsx)(ea.default,{currentPage:a,totalPages:M,onPageChange:e=>{l(e),h(null)}})]})]})}function eg(e){let t=new Map;for(let s of e)if("assistant"===s.type)for(let e of s.message.content){if("tool_use"!==e.type||"Task"===e.name&&(e.subagentType||e.subagentId))continue;let s=t.get(e.name)||{count:0,totalDurationMs:0};s.count++,e.result?.durationMs&&(s.totalDurationMs+=e.result.durationMs),t.set(e.name,s)}return Array.from(t.entries()).map(([e,t])=>({name:e,...t})).sort((e,t)=>t.count-e.count)}function ef({tools:e,compact:s}){return(0,t.jsx)("div",{className:`bg-card border border-border rounded-lg ${s?"p-3":"p-4"}`,children:(0,t.jsx)("div",{className:`grid grid-cols-[repeat(auto-fit,minmax(200px,1fr))] ${s?"gap-2":"gap-3"}`,children:e.map(e=>(0,t.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,t.jsx)(b,{className:"w-3.5 h-3.5 text-muted-foreground flex-shrink-0"}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("div",{className:`${s?"text-xs":"text-sm"} font-mono font-medium truncate`,children:e.name}),(0,t.jsxs)("div",{className:"text-xs text-muted-foreground truncate",children:[e.count," call",1!==e.count?"s":"",e.totalDurationMs>0&&` \xb7 ${(e.totalDurationMs/1e3).toFixed(1)}s`]})]})]},e.name))})})}function ey(e){return`${e.uuid}-${e.timestampMs}`}function eb(){let e=window.location.hash;return e.startsWith("#entry-")?e.slice(7):null}function ev({entries:e,entriesBySource:n,projectName:i,sessionId:o}){let a=(0,s.useMemo)(()=>Array.from(n.values()).flat(),[n]),[l,c]=(0,s.useState)(new Set),[h,x]=(0,s.useState)(0),[f,y]=(0,s.useState)(()=>eb()),b=(0,s.useRef)(void 0),v=(0,s.useRef)(!1),j=(0,s.useCallback)(e=>{e&&x(e.offsetTop)},[]),w=(0,s.useMemo)(()=>(function(e){let t=new Map,s=null,r=0;for(let n of e)"queue-operation"===n.type?(null!==s&&t.set(s,r),s=ey(n),r=0):null!==s&&r++;return null!==s&&t.set(s,r),t})(e),[e]),N=(0,s.useMemo)(()=>{let t;return t=!1,e.filter(e=>"queue-operation"===e.type?(t=l.has(ey(e)),!0):!t)},[e,l]),S=(0,s.useMemo)(()=>{let e=new Map;return N.forEach((t,s)=>{t.uuid&&e.set(t.uuid,s)}),e},[N]),M=(0,s.useMemo)(()=>(function(e){let t=new Map;for(let s of e)if("assistant"===s.type&&s.uuid)for(let e of s.message.content)"tool_use"===e.type&&"Task"===e.name&&e.subagentId&&t.set(e.subagentId,s.uuid);let s=new Map;for(let r of e){if(!r._source?.startsWith("agent-")||!r.uuid)continue;let e=r._source.slice(6),n=t.get(e);n&&s.set(r.uuid,n)}return s})(a),[a]),k=(0,s.useMemo)(()=>f&&M.has(f)?f:null,[f,M]),C=k?M.get(k)??null:null;(0,s.useEffect)(()=>{if(f)return b.current=setTimeout(()=>y(null),4e3),()=>{b.current&&clearTimeout(b.current)}},[]),(0,s.useEffect)(()=>{let e=()=>{let e=eb();y(e),v.current=!1,b.current&&clearTimeout(b.current),e&&(b.current=setTimeout(()=>y(null),4e3))};return window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)},[]);let E=(0,s.useMemo)(()=>{if(!f)return null;let t=C??f,s=e.some(e=>e.uuid===t),r=S.has(t);if(s&&!r){let s=null;for(let r of e)if("queue-operation"===r.type)s=ey(r);else if(r.uuid===t&&s)return s}return null},[f,C,e,S]);(0,s.useEffect)(()=>{if(!E)return;let e=requestAnimationFrame(()=>{c(e=>{if(!e.has(E))return e;let t=new Set(e);return t.delete(E),t})});return()=>cancelAnimationFrame(e)},[E]);let I=(0,s.useCallback)(e=>{c(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},[]),T=function({useFlushSync:e=!0,...t}){let n=s.useReducer(()=>({}),{})[1],i={...t,onChange:(s,i)=>{var o;e&&i?(0,r.flushSync)(n):n(),null==(o=t.onChange)||o.call(t,s,i)}},[o]=s.useState(()=>new p(i));return o.setOptions(i),g(()=>o._didMount(),[]),g(()=>o._willUpdate()),o}({getScrollElement:()=>"u">typeof document?window:null,observeElementRect:d,observeElementOffset:u,scrollToFn:m,initialOffset:()=>"u">typeof document?window.scrollY:0,...{count:N.length,estimateSize:e=>(function(e){switch(e.type){case"queue-operation":return 48;case"user":return 90;case"assistant":return 80+120*e.message.content.length;default:return 100}})(N[e]),overscan:5,scrollMargin:h}});return(0,s.useEffect)(()=>{if(!f||v.current)return;let e=C??f,t=S.get(e);null!=t&&(v.current=!0,requestAnimationFrame(()=>{T.scrollToIndex(t,{align:"center"})}))},[f,C,S,T]),(0,t.jsx)("div",{ref:j,children:(0,t.jsx)("div",{style:{height:`${T.getTotalSize()}px`,width:"100%",position:"relative"},children:T.getVirtualItems().map(e=>{let s=N[e.index],r=!!f&&s.uuid===(C??f);return(0,t.jsx)("div",{"data-index":e.index,ref:T.measureElement,style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${e.start-T.options.scrollMargin}px)`},children:"queue-operation"===s.type?(0,t.jsx)(z,{entry:s,isCollapsed:l.has(ey(s)),entryCount:w.get(ey(s))??0,onToggle:()=>I(ey(s))}):(0,t.jsx)(et,{entry:s,entriesBySource:n,projectName:i,sessionId:o,isHighlighted:!k&&r,highlightedUuid:k,autoExpandForUuid:k})},"queue-operation"===s.type?ey(s):s.uuid||s.timestamp)})})})}let ej=[];e.s([],76248),e.i(76248),e.s(["default",0,function({entries:e,projectName:r,sessionId:n}){let i=(0,s.useMemo)(()=>{let t=new Map;for(let s of e){let e=t.get(s._source);e?e.push(s):t.set(s._source,[s])}return t},[e]),o=i.get("session")??ej,a=(0,s.useMemo)(()=>(function(e){let t=new Map;for(let s of e)if("assistant"===s.type)for(let e of s.message.content)"tool_use"===e.type&&"Task"===e.name&&e.subagentId&&(t.has(e.subagentId)||t.set(e.subagentId,{id:e.subagentId,type:e.subagentType||"unknown",description:e.subagentDescription||""}));return Array.from(t.values())})(e),[e]),l=(0,s.useMemo)(()=>eg(o),[o]),[d,c]=(0,s.useState)(!1),[u,h]=(0,s.useState)(new Set),[m,p]=(0,s.useState)(!1),[x,g]=(0,s.useState)(null);(0,s.useEffect)(()=>{(0,es.searchHookActivityAction)({sessionId:n},1).then(e=>{e.entries.length>0&&g(e)}).catch(()=>{})},[n]),(0,s.useEffect)(()=>{let e=()=>{window.location.hash.startsWith("#entry-")&&p(!1)};return window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)},[]);let y=(0,s.useCallback)(e=>{h(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},[]);return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(C,{entries:o}),x&&(0,t.jsx)(ex,{sessionId:n,initialData:x},n),a.length>0&&(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("button",{onClick:()=>c(e=>!e),className:"flex items-center gap-2 hover:opacity-80 transition-opacity",children:[(0,t.jsx)(f.ChevronDown,{className:`w-4 h-4 text-muted-foreground transition-transform ${d?"-rotate-90":""}`}),(0,t.jsx)("span",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:"Subagents"}),(0,t.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",a.length,")"]})]}),!d&&a.map(e=>{let s;return(0,t.jsxs)("div",{className:"pl-3 border-l-2 border-primary/30 space-y-2",children:[(0,t.jsxs)("button",{onClick:()=>y(e.id),className:"flex items-center gap-2 hover:opacity-80 transition-opacity",children:[(0,t.jsx)(f.ChevronDown,{className:`w-3.5 h-3.5 text-muted-foreground transition-transform ${u.has(e.id)?"-rotate-90":""}`}),(0,t.jsx)("span",{className:"text-sm font-bold",children:e.type}),e.description&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground truncate max-w-[400px]",children:e.description})]}),!u.has(e.id)&&(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(C,{entries:i.get(`agent-${e.id}`)||[],compact:!0}),(s=eg(i.get(`agent-${e.id}`)||[])).length>0?(0,t.jsx)(ef,{tools:s,compact:!0}):null]})]},e.id)})]}),l.length>0&&(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:"Tools"}),(0,t.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",l.reduce((e,t)=>e+t.count,0),")"]})]}),(0,t.jsx)(ef,{tools:l})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("button",{onClick:()=>p(e=>!e),className:"flex items-center gap-2 hover:opacity-80 transition-opacity",children:[(0,t.jsx)(f.ChevronDown,{className:`w-4 h-4 text-muted-foreground transition-transform ${m?"-rotate-90":""}`}),(0,t.jsx)("span",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:"Logs"})]}),!m&&(0,t.jsx)("div",{className:"mt-2 bg-card border border-border rounded-lg p-4 shadow-sm",children:0===o.length?(0,t.jsx)("p",{className:"text-muted-foreground text-center py-8",children:"No entries found."}):(0,t.jsx)(ev,{entries:o,entriesBySource:i,projectName:r,sessionId:n})})]})]})}],36406)},5780,e=>{e.n(e.i(36406))}]);
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
// AUTO-GENERATED by failproofai. __failproofai_hook__
|
|
2
|
+
// Re-generate via: failproofai policies --install --cli opencode
|
|
3
|
+
//
|
|
4
|
+
// DEV variant: this repo's contributors run failproofai from source via
|
|
5
|
+
// `bun bin/failproofai.mjs ...` instead of `npx -y failproofai`. This file
|
|
6
|
+
// is the project-scope shim with that dev path baked in. The production
|
|
7
|
+
// shape (npx-based) is generated by `src/hooks/integrations.ts` on install
|
|
8
|
+
// for end users — see `buildOpenCodePluginShim` there.
|
|
9
|
+
//
|
|
10
|
+
// Do NOT install this repo via `failproofai policies --install --cli
|
|
11
|
+
// opencode --scope project` — it would overwrite this dev path with the
|
|
12
|
+
// portable npx form.
|
|
13
|
+
import { spawnSync } from "node:child_process";
|
|
14
|
+
import { resolve } from "node:path";
|
|
15
|
+
|
|
16
|
+
const REPO_ROOT = resolve(import.meta.dirname, "..", "..");
|
|
17
|
+
const FAILPROOFAI_DEV_BIN = resolve(REPO_ROOT, "bin", "failproofai.mjs");
|
|
18
|
+
|
|
19
|
+
const BUS_EVENT_MAP = {
|
|
20
|
+
"session.created": "SessionStart",
|
|
21
|
+
"session.deleted": "SessionEnd",
|
|
22
|
+
"session.idle": "Stop",
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
function runFailproofai(eventName, payload, directory) {
|
|
26
|
+
const r = spawnSync("bun", [FAILPROOFAI_DEV_BIN, "--hook", eventName, "--cli", "opencode"], {
|
|
27
|
+
input: JSON.stringify(payload),
|
|
28
|
+
encoding: "utf8",
|
|
29
|
+
timeout: 60_000,
|
|
30
|
+
cwd: directory,
|
|
31
|
+
});
|
|
32
|
+
return { exitCode: r.status ?? 0, stdout: r.stdout ?? "", stderr: r.stderr ?? "" };
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function applyDecision(result, ctx) {
|
|
36
|
+
if (result.exitCode === 2) {
|
|
37
|
+
throw new Error((result.stderr || "").trim() || "Blocked by failproofai");
|
|
38
|
+
}
|
|
39
|
+
let parsed = null;
|
|
40
|
+
try { parsed = JSON.parse(result.stdout); } catch { /* fail-open allow */ }
|
|
41
|
+
if (!parsed) return;
|
|
42
|
+
const out = parsed.hookSpecificOutput;
|
|
43
|
+
if (out && out.permissionDecision === "deny") {
|
|
44
|
+
throw new Error(out.permissionDecisionReason || "Blocked by failproofai");
|
|
45
|
+
}
|
|
46
|
+
if (out && out.decision && out.decision.behavior === "deny") {
|
|
47
|
+
throw new Error((out.decision.message) || "Blocked by failproofai");
|
|
48
|
+
}
|
|
49
|
+
const ctxText = out && out.additionalContext;
|
|
50
|
+
if (ctxText && ctx && ctx.client && ctx.sessionID) {
|
|
51
|
+
Promise.resolve(ctx.client.session.prompt({
|
|
52
|
+
path: { id: ctx.sessionID },
|
|
53
|
+
body: { parts: [{ type: "text", text: ctxText }] },
|
|
54
|
+
})).catch(() => {});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export default async function failproofaiPlugin({ client, directory }) {
|
|
59
|
+
return {
|
|
60
|
+
event: async ({ event }) => {
|
|
61
|
+
if (!event || !event.type) return;
|
|
62
|
+
if (event.type === "message.updated") {
|
|
63
|
+
const props = event.properties || {};
|
|
64
|
+
const info = props.info || props.message || {};
|
|
65
|
+
const role = info.role || props.role;
|
|
66
|
+
if (role !== "user") return;
|
|
67
|
+
const sessionID = info.sessionID || info.sessionId || info.session_id || props.sessionID;
|
|
68
|
+
// Reconstruct the user prompt text so prompt-based policies see it.
|
|
69
|
+
let prompt = "";
|
|
70
|
+
const parts = info.parts || props.parts || [];
|
|
71
|
+
if (Array.isArray(parts)) {
|
|
72
|
+
for (const p of parts) {
|
|
73
|
+
if (p && typeof p === "object" && typeof p.text === "string") prompt += p.text;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (!prompt) prompt = (info.text || info.content || props.text || "").toString();
|
|
77
|
+
const r = runFailproofai("UserPromptSubmit", {
|
|
78
|
+
session_id: sessionID, cwd: directory, hook_event_name: "UserPromptSubmit", prompt,
|
|
79
|
+
}, directory);
|
|
80
|
+
applyDecision(r, { client, sessionID });
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const claudeEvent = BUS_EVENT_MAP[event.type];
|
|
84
|
+
if (!claudeEvent) return;
|
|
85
|
+
const props = event.properties || {};
|
|
86
|
+
const sessionID = props.sessionID || (props.session && props.session.id) || props.id;
|
|
87
|
+
const r = runFailproofai(claudeEvent, {
|
|
88
|
+
session_id: sessionID, cwd: directory, hook_event_name: claudeEvent,
|
|
89
|
+
}, directory);
|
|
90
|
+
applyDecision(r, { client, sessionID });
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
"tool.execute.before": async (input, output) => {
|
|
94
|
+
const r = runFailproofai("PreToolUse", {
|
|
95
|
+
session_id: input.sessionID,
|
|
96
|
+
cwd: directory,
|
|
97
|
+
tool_name: input.tool,
|
|
98
|
+
tool_input: output.args,
|
|
99
|
+
hook_event_name: "PreToolUse",
|
|
100
|
+
}, directory);
|
|
101
|
+
applyDecision(r, { client, sessionID: input.sessionID });
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
"tool.execute.after": async (input, output) => {
|
|
105
|
+
const r = runFailproofai("PostToolUse", {
|
|
106
|
+
session_id: input.sessionID,
|
|
107
|
+
cwd: directory,
|
|
108
|
+
tool_name: input.tool,
|
|
109
|
+
tool_input: input.args,
|
|
110
|
+
tool_response: { title: output.title, output: output.output, metadata: output.metadata },
|
|
111
|
+
hook_event_name: "PostToolUse",
|
|
112
|
+
}, directory);
|
|
113
|
+
applyDecision(r, { client, sessionID: input.sessionID });
|
|
114
|
+
},
|
|
115
|
+
|
|
116
|
+
"permission.ask": async (input, output) => {
|
|
117
|
+
const r = runFailproofai("PermissionRequest", {
|
|
118
|
+
session_id: input.sessionID,
|
|
119
|
+
cwd: directory,
|
|
120
|
+
tool_name: input.tool || input.command || "permission",
|
|
121
|
+
tool_input: input,
|
|
122
|
+
hook_event_name: "PermissionRequest",
|
|
123
|
+
}, directory);
|
|
124
|
+
try {
|
|
125
|
+
applyDecision(r, { client, sessionID: input.sessionID });
|
|
126
|
+
} catch {
|
|
127
|
+
output.status = "deny";
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
}
|
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Tiny CLI-origin badge
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* and session viewer.
|
|
2
|
+
* Tiny CLI-origin badge. Visual style and label are sourced from
|
|
3
|
+
* `lib/cli-registry.ts` so adding a new agent CLI = one registry entry, no UI
|
|
4
|
+
* changes here.
|
|
6
5
|
*/
|
|
7
6
|
import type { ProjectCli } from "@/lib/projects";
|
|
7
|
+
import { getCliLabel, getCliBadgeClasses } from "@/lib/cli-registry";
|
|
8
8
|
|
|
9
9
|
export function CliBadge({ cli }: { cli: ProjectCli }) {
|
|
10
|
-
const
|
|
11
|
-
const
|
|
10
|
+
const label = getCliLabel(cli);
|
|
11
|
+
const classes = getCliBadgeClasses(cli);
|
|
12
12
|
return (
|
|
13
13
|
<span
|
|
14
|
-
className={`inline-flex items-center rounded px-1.5 py-0.5 text-[0.6rem] font-medium border ${
|
|
15
|
-
isCodex
|
|
16
|
-
? "bg-purple-500/10 text-purple-400 border-purple-500/20"
|
|
17
|
-
: "bg-orange-500/10 text-orange-400 border-orange-500/20"
|
|
18
|
-
}`}
|
|
14
|
+
className={`inline-flex items-center rounded px-1.5 py-0.5 text-[0.6rem] font-medium border ${classes}`}
|
|
19
15
|
title={`Agent CLI: ${label}`}
|
|
20
16
|
>
|
|
21
17
|
{label}
|
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
keywordsToParam, paramToKeywords,
|
|
24
24
|
pageToParam, paramToPage,
|
|
25
25
|
} from "@/lib/url-filter-serializers";
|
|
26
|
+
import { KNOWN_CLI_IDS, getCliLabel, isKnownCli, type CliId } from "@/lib/cli-registry";
|
|
26
27
|
import { Folder, Search, X } from "lucide-react";
|
|
27
28
|
import Link from "next/link";
|
|
28
29
|
import PaginationControls from "./pagination-controls";
|
|
@@ -50,6 +51,10 @@ export default function ProjectList({ folders }: ProjectListProps) {
|
|
|
50
51
|
// Read initial state from URL
|
|
51
52
|
const [keywords, setKeywords] = useState<string[]>(() => paramToKeywords(url.get("q")));
|
|
52
53
|
const [keywordInput, setKeywordInput] = useState("");
|
|
54
|
+
const [filterCli, setFilterCli] = useState<"" | CliId>(() => {
|
|
55
|
+
const v = url.get("cli");
|
|
56
|
+
return isKnownCli(v) ? v : "";
|
|
57
|
+
});
|
|
53
58
|
|
|
54
59
|
const {
|
|
55
60
|
filterPreset, dateRange, currentPage, setCurrentPage,
|
|
@@ -72,9 +77,10 @@ export default function ProjectList({ folders }: ProjectListProps) {
|
|
|
72
77
|
...dateRangeToParams(dateRange),
|
|
73
78
|
q: keywordsToParam(keywords),
|
|
74
79
|
page: pageToParam(currentPage),
|
|
80
|
+
cli: filterCli || undefined,
|
|
75
81
|
});
|
|
76
82
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
77
|
-
}, [filterPreset, dateRange, keywords, currentPage]);
|
|
83
|
+
}, [filterPreset, dateRange, keywords, currentPage, filterCli]);
|
|
78
84
|
|
|
79
85
|
const addKeyword = (keyword: string) => {
|
|
80
86
|
const trimmed = keyword.trim();
|
|
@@ -96,6 +102,7 @@ export default function ProjectList({ folders }: ProjectListProps) {
|
|
|
96
102
|
const clearFilters = () => {
|
|
97
103
|
clearDateFilters();
|
|
98
104
|
clearKeywords();
|
|
105
|
+
setFilterCli("");
|
|
99
106
|
};
|
|
100
107
|
|
|
101
108
|
const normalizedFolders = useMemo(() => rehydrateDates(folders), [folders]);
|
|
@@ -113,8 +120,12 @@ export default function ProjectList({ folders }: ProjectListProps) {
|
|
|
113
120
|
});
|
|
114
121
|
}
|
|
115
122
|
|
|
123
|
+
if (filterCli) {
|
|
124
|
+
filtered = filtered.filter((folder) => folder.cli.includes(filterCli));
|
|
125
|
+
}
|
|
126
|
+
|
|
116
127
|
return filtered.sort((a, b) => b.lastModified.getTime() - a.lastModified.getTime());
|
|
117
|
-
}, [normalizedFolders, filterPreset, dateRange, keywords]);
|
|
128
|
+
}, [normalizedFolders, filterPreset, dateRange, keywords, filterCli]);
|
|
118
129
|
|
|
119
130
|
const totalPages = Math.max(1, Math.ceil(filteredFolders.length / ITEMS_PER_PAGE));
|
|
120
131
|
useEffect(() => {
|
|
@@ -129,7 +140,7 @@ export default function ProjectList({ folders }: ProjectListProps) {
|
|
|
129
140
|
{/* Filter Bar */}
|
|
130
141
|
<div className="bg-card border border-border rounded-lg p-4">
|
|
131
142
|
<div className="flex flex-col gap-4">
|
|
132
|
-
{/* Preset Filters +
|
|
143
|
+
{/* Preset Filters + CLI filter */}
|
|
133
144
|
<div className="flex flex-wrap items-center gap-2">
|
|
134
145
|
<span className="text-sm font-medium text-foreground">Filter by:</span>
|
|
135
146
|
{FILTER_PRESETS.map((preset) => (
|
|
@@ -146,6 +157,23 @@ export default function ProjectList({ folders }: ProjectListProps) {
|
|
|
146
157
|
</button>
|
|
147
158
|
))}
|
|
148
159
|
|
|
160
|
+
<span className="ml-2 text-sm font-medium text-foreground">CLI:</span>
|
|
161
|
+
<select
|
|
162
|
+
aria-label="Filter by CLI"
|
|
163
|
+
value={filterCli}
|
|
164
|
+
onChange={(e) => {
|
|
165
|
+
const v = e.target.value;
|
|
166
|
+
setFilterCli(v === "" || isKnownCli(v) ? v : "");
|
|
167
|
+
}}
|
|
168
|
+
className="px-2 py-1.5 text-sm bg-input border border-border rounded-md text-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent"
|
|
169
|
+
>
|
|
170
|
+
<option value="">All CLIs</option>
|
|
171
|
+
{KNOWN_CLI_IDS.map((id) => (
|
|
172
|
+
<option key={id} value={id}>
|
|
173
|
+
{getCliLabel(id)}
|
|
174
|
+
</option>
|
|
175
|
+
))}
|
|
176
|
+
</select>
|
|
149
177
|
</div>
|
|
150
178
|
|
|
151
179
|
{/* Keyword Search */}
|
|
@@ -227,7 +255,7 @@ export default function ProjectList({ folders }: ProjectListProps) {
|
|
|
227
255
|
aria-label="Filter to date"
|
|
228
256
|
/>
|
|
229
257
|
</div>
|
|
230
|
-
{(filterPreset !== "all" || dateRange.from !== null || dateRange.to !== null || keywords.length > 0) && (
|
|
258
|
+
{(filterPreset !== "all" || dateRange.from !== null || dateRange.to !== null || keywords.length > 0 || filterCli !== "") && (
|
|
231
259
|
<button
|
|
232
260
|
onClick={clearFilters}
|
|
233
261
|
className="px-3 py-2 text-sm bg-muted text-muted-foreground hover:bg-muted/80 rounded-md transition-colors"
|