codesesh 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/{chunk-NBJJGH5P.js → chunk-4ND6AT6W.js} +116 -72
- package/dist/chunk-4ND6AT6W.js.map +1 -0
- package/dist/{chunk-PAP2Q3WV.js → chunk-4QFNZCBR.js} +2 -2
- package/dist/{chunk-FCYCBGEL.js → chunk-A3MT6L6Z.js} +3 -3
- package/dist/{chunk-YQFEGFWD.js → chunk-COZSWVCH.js} +2 -2
- package/dist/{chunk-WUYSZAYR.js → chunk-L3DDWTYV.js} +9 -4
- package/dist/chunk-L3DDWTYV.js.map +1 -0
- package/dist/{chunk-TS3IWH5U.js → chunk-XQDYKKRC.js} +30 -14
- package/dist/chunk-XQDYKKRC.js.map +1 -0
- package/dist/{chunk-XKZSX5BM.js → chunk-YZ6XCSVQ.js} +3 -3
- package/dist/{discovery-D23RV7FY.js → discovery-ADSQARBV.js} +5 -5
- package/dist/index.js +185 -144
- package/dist/index.js.map +1 -1
- package/dist/project-identity-worker.js +4 -4
- package/dist/scan-refresh-worker.js +6 -6
- package/dist/search-index-worker.js +6 -6
- package/dist/session-detail-worker.js +6 -6
- package/dist/smart-tag-worker.js +3 -3
- package/dist/web/assets/CustomTimeWindowDialog-D2bx7uDv.js +1 -0
- package/dist/web/assets/InteractiveReceipt-BFpIdno8.js +1 -0
- package/dist/web/assets/OverviewScreen-D_KXfiJi.js +1 -0
- package/dist/web/assets/{PrismHighlighter-LWITDffT.js → PrismHighlighter-BgVkYu_S.js} +1 -1
- package/dist/web/assets/Projects-CN44UpuR.js +1 -0
- package/dist/web/assets/SearchResultsPanel-CWD01v-a.js +1 -0
- package/dist/web/assets/SessionDetail-D8taQ6Tl.js +53 -0
- package/dist/web/assets/api-B9lJtVbO.js +1 -0
- package/dist/web/assets/index-XpolWMY4.js +1423 -0
- package/dist/web/assets/index-xbEEMszv.css +1 -0
- package/dist/web/assets/session-indexes-fib48ZKn.js +4 -0
- package/dist/web/assets/translate-Dmym1ZDl.js +2 -0
- package/dist/web/assets/utils-Bk66u8b3.js +1 -0
- package/dist/web/index.html +7 -7
- package/package.json +3 -3
- package/dist/chunk-NBJJGH5P.js.map +0 -1
- package/dist/chunk-TS3IWH5U.js.map +0 -1
- package/dist/chunk-WUYSZAYR.js.map +0 -1
- package/dist/web/assets/CustomTimeWindowDialog-C9XTZRm0.js +0 -1
- package/dist/web/assets/InteractiveReceipt-Sca1smpv.js +0 -1
- package/dist/web/assets/OverviewScreen-Vq6BQR9_.js +0 -1
- package/dist/web/assets/Projects-CwicV3Dk.js +0 -1
- package/dist/web/assets/SearchResultsPanel-DCO0Ak0c.js +0 -1
- package/dist/web/assets/SessionDetail-mdmTQgo1.js +0 -53
- package/dist/web/assets/api-CXVT9XcZ.js +0 -1
- package/dist/web/assets/contract-BS78VBCV.js +0 -2
- package/dist/web/assets/index-C5cyw58A.css +0 -1
- package/dist/web/assets/index-H2cT-6c6.js +0 -1423
- package/dist/web/assets/session-indexes-yyyWpKLf.js +0 -4
- package/dist/web/assets/utils-C7BqyxxV.js +0 -1
- /package/dist/{chunk-PAP2Q3WV.js.map → chunk-4QFNZCBR.js.map} +0 -0
- /package/dist/{chunk-FCYCBGEL.js.map → chunk-A3MT6L6Z.js.map} +0 -0
- /package/dist/{chunk-YQFEGFWD.js.map → chunk-COZSWVCH.js.map} +0 -0
- /package/dist/{chunk-XKZSX5BM.js.map → chunk-YZ6XCSVQ.js.map} +0 -0
- /package/dist/{discovery-D23RV7FY.js.map → discovery-ADSQARBV.js.map} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import "./chunk-
|
|
3
|
-
import "./chunk-
|
|
2
|
+
import "./chunk-A3MT6L6Z.js";
|
|
3
|
+
import "./chunk-4QFNZCBR.js";
|
|
4
4
|
import {
|
|
5
5
|
computeIdentityProjection
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-YZ6XCSVQ.js";
|
|
7
|
+
import "./chunk-4ND6AT6W.js";
|
|
8
8
|
|
|
9
9
|
// src/project-identity-worker.ts
|
|
10
10
|
import { parentPort } from "worker_threads";
|
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
} from "./chunk-RF3EEWPH.js";
|
|
5
5
|
import {
|
|
6
6
|
acknowledgeWorkerLogDrain
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-COZSWVCH.js";
|
|
8
8
|
import "./chunk-QH2HOXJH.js";
|
|
9
9
|
import {
|
|
10
10
|
appLogger
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-4QFNZCBR.js";
|
|
12
12
|
import {
|
|
13
13
|
attachMissingProjectIdentities,
|
|
14
14
|
buildAgentCacheMeta,
|
|
@@ -18,14 +18,14 @@ import {
|
|
|
18
18
|
hasStaleSessionTags,
|
|
19
19
|
planAgentScan,
|
|
20
20
|
sortSessions
|
|
21
|
-
} from "./chunk-
|
|
22
|
-
import "./chunk-
|
|
21
|
+
} from "./chunk-XQDYKKRC.js";
|
|
22
|
+
import "./chunk-YZ6XCSVQ.js";
|
|
23
23
|
import {
|
|
24
24
|
createRegisteredAgents
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-L3DDWTYV.js";
|
|
26
26
|
import {
|
|
27
27
|
synchronizePricingGeneration
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-4ND6AT6W.js";
|
|
29
29
|
|
|
30
30
|
// src/scan-refresh-worker.ts
|
|
31
31
|
import { parentPort, workerData } from "worker_threads";
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
acknowledgeWorkerLogDrain
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-COZSWVCH.js";
|
|
5
5
|
import "./chunk-QH2HOXJH.js";
|
|
6
6
|
import {
|
|
7
7
|
appLogger
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-4QFNZCBR.js";
|
|
9
9
|
import {
|
|
10
10
|
commitDurableSessionPublication,
|
|
11
11
|
markAgentCacheInitialized,
|
|
12
12
|
sessionDetailVersion,
|
|
13
13
|
syncSessionSearchIndex,
|
|
14
14
|
syncSessionSearchIndexChanges
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import "./chunk-
|
|
15
|
+
} from "./chunk-XQDYKKRC.js";
|
|
16
|
+
import "./chunk-YZ6XCSVQ.js";
|
|
17
17
|
import {
|
|
18
18
|
createRegisteredAgents
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-L3DDWTYV.js";
|
|
20
20
|
import {
|
|
21
21
|
synchronizePricingGeneration
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-4ND6AT6W.js";
|
|
23
23
|
|
|
24
24
|
// src/search-index-worker.ts
|
|
25
25
|
import { randomUUID } from "crypto";
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
acknowledgeWorkerLogDrain
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-COZSWVCH.js";
|
|
5
5
|
import "./chunk-QH2HOXJH.js";
|
|
6
6
|
import {
|
|
7
7
|
appLogger
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-4QFNZCBR.js";
|
|
9
9
|
import {
|
|
10
10
|
closeCacheStorage,
|
|
11
11
|
materializeSessionDetailResponse
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-XQDYKKRC.js";
|
|
13
|
+
import "./chunk-YZ6XCSVQ.js";
|
|
14
14
|
import {
|
|
15
15
|
createRegisteredAgents
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-L3DDWTYV.js";
|
|
17
17
|
import {
|
|
18
18
|
synchronizePricingGeneration
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-4ND6AT6W.js";
|
|
20
20
|
|
|
21
21
|
// src/session-detail-worker.ts
|
|
22
22
|
import { parentPort, workerData } from "worker_threads";
|
package/dist/smart-tag-worker.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import "./chunk-QH2HOXJH.js";
|
|
3
|
-
import "./chunk-
|
|
3
|
+
import "./chunk-4QFNZCBR.js";
|
|
4
4
|
import {
|
|
5
5
|
createRegisteredAgents
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-L3DDWTYV.js";
|
|
7
7
|
import {
|
|
8
8
|
classifySessionTags,
|
|
9
9
|
getSmartTagSourceTimestamp,
|
|
10
10
|
synchronizePricingGeneration
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-4ND6AT6W.js";
|
|
12
12
|
|
|
13
13
|
// src/smart-tag-worker.ts
|
|
14
14
|
import { parentPort, workerData } from "worker_threads";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-B-hcVAMW.js";import{Kt as r,On as i,t as a,v as o,w as s,x as c,y as l}from"./utils-Bk66u8b3.js";import{n as u,t as d}from"./translate-Dmym1ZDl.js";import{o as f}from"./api-B9lJtVbO.js";var p=e(t(),1),m=n(),h=p.createContext(void 0),g=e=>{let t=p.useContext(h);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},_=({client:e,children:t})=>(p.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,m.jsx)(h.Provider,{value:e,children:t})),v={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},y=new class{#e=v;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function b(e){setTimeout(e,0)}var ee=typeof window>`u`||`Deno`in globalThis;function x(){}function te(e,t){return typeof e==`function`?e(t):e}function S(e){return typeof e==`number`&&e>=0&&e!==1/0}function C(e,t){return Math.max(e+(t||0)-Date.now(),0)}function w(e,t){return typeof e==`function`?e(t):e}function ne(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==T(o,t.options))return!1}else if(!D(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function re(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(E(t.options.mutationKey)!==E(a))return!1}else if(!D(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function T(e,t){return(t?.queryKeyHashFn||E)(e)}function E(e){return JSON.stringify(e,(e,t)=>j(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function D(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){for(let n=0;n<t.length;n++)if(!D(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!D(e[r],t[r]))return!1;return!0}return!1}var ie=Object.prototype.hasOwnProperty;function O(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=A(e)&&A(t);if(!r&&!(j(e)&&j(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:ie.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=O(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function k(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function A(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function j(e){if(!M(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!M(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function M(e){return Object.prototype.toString.call(e)===`[object Object]`}function ae(e){return new Promise(t=>{y.setTimeout(t,e)})}function N(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:O(e,t)}function oe(e){return e}function se(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function ce(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var P=Symbol();function F(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===P?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function I(e,t){return typeof e==`function`?e(...t):!!e}function le(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var ue=()=>ee,L=()=>ue(),R=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},z=new class extends R{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},de=b;function fe(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=de,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var B=fe(),V=new class extends R{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function pe(e){return Math.min(1e3*2**e,3e4)}function H(e){return(e??`online`)!==`online`||V.isOnline()}var U=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function W(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(x);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new U(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>z.isFocused()&&(e.networkMode===`always`||V.isOnline())&&e.canRun(),p=()=>H(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=()=>new Promise(t=>{r=e=>{(c()||f())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(L()?0:3),a=e.retryDelay??pe,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!s){h(r);return}n++,e.onFail?.(n,r),ae(o).then(()=>f()?void 0:g()).then(()=>{t?h(r):_()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g().then(_),s)}}var G=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),S(this.gcTime)&&(this.#e=y.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(L()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(y.clearTimeout(this.#e),this.#e=void 0)}};function me(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{le(e,()=>t.signal,()=>n=!0)},u=F(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?ce:se;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?he:K,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:K(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function K(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function he(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var ge=class extends G{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Y(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Y(this.options);e.data!==void 0&&(this.setState(J(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=N(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(x).catch(x):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>w(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===P||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>w(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!C(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=F(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?me(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=W({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof U&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof U){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...q(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...J(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),B.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function q(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:H(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function J(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Y(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var _e=class extends R{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),ye(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return X(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return X(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof w(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!k(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&be(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||w(this.options.enabled,this.#t)!==w(t.enabled,this.#t)||w(this.options.staleTime,this.#t)!==w(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||w(this.options.enabled,this.#t)!==w(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return k(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(x)),t}#h(e){return!L()&&w(this.options.enabled,this.#t)!==!1&&S(e)}#g(){this.#b();let e=w(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=C(this.#r.dataUpdatedAt,e)+1;this.#u=y.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#f=e,!(this.#f===0||!this.#h(this.#f))&&(this.#d=y.setInterval(()=>{(this.options.refetchIntervalInBackground||z.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(y.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(y.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&ye(e,t),o=i&&be(e,n,t,r);(a||o)&&(l={...l,...q(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=N(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=N(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Z(e,t),refetch:this.refetch,isEnabled:w(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),k(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();B.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function ve(e,t){return w(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||w(t.retryOnMount,e)!==!1)}function ye(e,t){return ve(e,t)||e.state.data!==void 0&&X(e,t,t.refetchOnMount)}function X(e,t,n){if(w(t.enabled,e)!==!1&&w(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Z(e,t)}return!1}function be(e,t,n,r){return(e!==t||w(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Z(e,n)}function Z(e,t){return w(t.enabled,e)!==!1&&e.isStaleByTime(w(t.staleTime,e))}var xe=p.createContext(!1),Se=()=>p.useContext(xe);xe.Provider;function Ce(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var we=p.createContext(Ce()),Te=()=>p.useContext(we),Ee=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?I(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},De=e=>{p.useEffect(()=>{e.clearReset()},[e])},Oe=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||I(n,[e.error,r])),ke=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},Ae=(e,t)=>e?.suspense&&t.isPending,je=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Me(e,t,n){let r=Se(),i=Te(),a=g(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,ke(o),Ee(o,i,s),De(i);let[l]=p.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(p.useSyncExternalStore(p.useCallback(e=>{let t=d?l.subscribe(B.batchCalls(e)):x;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),p.useEffect(()=>{l.setOptions(o)},[o,l]),Ae(o,u))throw je(o,l,i);if(Oe({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function Ne(e,t){return Me(e,_e,t)}function Pe(e){return e}function Q(e){return{days:e.days,from:e.from,to:e.to}}function Fe(e){return{...e.project?{project:e.project}:{},...e.agent?{agent:e.agent}:{}}}var Ie={bookmarks:[`bookmarks`],config:[`config`],dashboards:[`dashboard`],dashboard:(e,t)=>[`dashboard`,Q(e),Fe(t)],agentCatalogs:[`agent-catalog`],agentCatalog:e=>[`agent-catalog`,Q(e)],projects:[`projects`],projectWindow:e=>[`projects`,Q(e)],projectPage:(e,t)=>[`projects`,Q(e),`page`,t??null],projectDetail:(e,t)=>[`projects`,Q(e),`detail`,t],search:(e,t)=>[`search`,e,t],searches:[`search`],sessionDetails:[`session-detail`],sessionDetail:(e,t)=>[`session-detail`,e,t],sessionProjections:[`session-projection`],sessionProjection:e=>[`session-projection`,Q(e)]},Le=2e3;function Re(e,t){return Pe({queryKey:Ie.dashboard(e,t),staleTime:Le,queryFn:async({signal:n})=>{try{return await f(e,t,{signal:n})}catch(e){throw n.aborted||console.error(`Failed to load dashboard:`,e),e}}})}var ze=(0,p.createContext)(`light`),Be=`(prefers-color-scheme: dark)`;function Ve(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(Be).matches}function He(e){let[t,n]=(0,p.useState)(Ve);(0,p.useEffect)(()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let e=window.matchMedia(Be),t=e=>n(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let r=e===`system`?t?`dark`:`light`:e;return(0,p.useEffect)(()=>{document.documentElement.classList.toggle(`dark`,r===`dark`)},[r]),r}function Ue({title:e,message:t,onRetry:n,className:r=``}){return u(),(0,m.jsxs)(`div`,{role:`alert`,className:`rounded-sm border border-[var(--console-error-border)] bg-[var(--console-error-bg)] p-4 text-[var(--console-error)] ${r}`,children:[(0,m.jsx)(`p`,{className:`text-sm font-medium`,children:e}),(0,m.jsx)(`p`,{className:`console-mono mt-1 break-words text-[11px]`,children:t}),(0,m.jsx)(`button`,{type:`button`,onClick:n,className:`console-mono mt-3 rounded-sm border border-[var(--console-error-border)] bg-[var(--console-surface)] px-2.5 py-1 text-[11px] font-semibold motion-hover hover:bg-[var(--console-error-bg)] focus-visible:ring-2 focus-visible:ring-[var(--brand)] focus-visible:outline-none`,children:d(`Retry`)})]})}function We({className:e,children:t,...n}){return(0,m.jsx)(`section`,{className:a(`rounded-lg border border-[var(--console-border)] bg-[var(--console-surface)] shadow-[var(--shadow-raised)]`,e),...n,children:t})}function Ge({title:e,meta:t,action:n}){return(0,m.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,m.jsx)(`h3`,{className:`console-display min-w-0 truncate text-[15px] font-semibold text-[var(--console-text)]`,children:e}),(0,m.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-3`,children:[t===void 0?null:(0,m.jsx)(`span`,{className:`console-mono text-[10.5px] text-[var(--console-muted)]`,children:t}),n]})]})}function Ke(e){let t=e.sourceFailureCount;return[t==null?null:d(`{0} source{1} failed`,[t,t===1?``:`s`]),e.sourceFailureSummary].filter(e=>e!=null).join(` · `)}function qe(e){return(e.sourceFailureCount??0)>0||e.sourceFailureSummary!=null}function $(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function Je(e){if(!e)return null;let{from:t,to:n,days:r}=e.window;if(r===0||t==null)return d(`All time`);let i=$(t),a=$(n??Date.now());return r?d(`Last {0}d · {1} → {2}`,[r,i,a]):`${i} → ${a}`}function Ye(e,t,n){return t?e?d(`Searching for "{0}"`,[e]):d(`Loading recent sessions`):e?d(`{0} matches for "{1}"`,[n,e]):d(`{0} recent sessions`,[n])}function Xe(e){if(!e)return null;if(e.backfill?.active){let t=e.backfill.currentAgent,n=e.backfill.pendingAgents.length,r=e.backfill.progress,i=(r?.phase==null||r.phase===`scanning`||r.phase===`finalizing`)&&r?.total&&r.processed!=null?` · ${r.processed}/${r.total}`:``,a=r?.phase===`publish-queued`?d(`Full-history publication queued`):r?.phase===`committing`?d(`Committing full-history publication`):r?.phase===`indexing`?d(`Writing full-history search index`):r?.phase===`publishing`?d(`Preparing full-history publication`):r?.phase===`finalizing`?d(`Finalizing full-history metadata`):d(`Scanning full session history`);return t?`${a} · ${t}${i}${n>0?d(` · {0} history scan queued`,[n]):``}`:`${a}${i}`}if(e.backfill?.failedAgents.length)return d(`Full-history refresh failed · {0}`,[e.backfill.failedAgents.join(`, `)]);let t=Object.values(e.agentStatuses??{}).find(e=>e.status===`failed`);if(t)return d(`Session refresh failed · {0}{1}`,[t.agentName,t.error?` · ${t.error}`:``]);if(e.active&&e.phase===`initializing`)return d(`Initializing recent sessions`);let n=Object.entries(e.backfill?.partialAgents??{}).find(([,e])=>e.completeness===`partial`&&qe(e));if(n){let[e,t]=n,r=Ke(t);return d(`Full-history refresh completed with partial data · {0}{1}`,[e,r?` · ${r}`:``])}let r=Object.values(e.agentStatuses??{}).find(e=>e.status===`complete`&&e.completeness===`partial`&&qe(e));if(r){let e=Ke(r);return d(`Session refresh completed with partial data · {0}{1}`,[r.agentName,e?` · ${e}`:``])}return e.searchIndexMaintenance?.failedAgents.length?d(`Background search index maintenance paused · {0}`,[e.searchIndexMaintenance.failedAgents.join(`, `)]):null}function Ze({open:e,onOpenChange:t,window:n,customFrom:r,customTo:i,onSelectCustom:a}){u();let o=r??(n?.from==null?``:$(n.from)),s=i??(n?.to==null?null:$(n.to));return(0,m.jsx)(l,{open:e,onOpenChange:t,children:e?(0,m.jsx)(Qe,{initialFrom:o,initialTo:s,onOpenChange:t,onSelectCustom:a}):null})}function Qe({initialFrom:e,initialTo:t,onOpenChange:n,onSelectCustom:a}){u();let[l,f]=(0,p.useState)(e),[h,g]=(0,p.useState)(()=>t??$(Date.now()));return(0,m.jsxs)(c,{children:[(0,m.jsx)(i,{className:`motion-backdrop fixed inset-0 z-50 bg-[var(--scrim)]`}),(0,m.jsxs)(s,{className:`motion-modal fixed top-1/2 left-1/2 z-50 w-[calc(100%-2rem)] max-w-sm -translate-x-1/2 -translate-y-1/2 rounded-lg border border-[var(--console-border)] bg-[var(--console-surface)] p-5 shadow-[var(--shadow-overlay)] outline-none`,children:[(0,m.jsx)(o,{className:`console-mono text-sm font-semibold text-[var(--console-text)]`,children:d(`Custom time range`)}),(0,m.jsx)(`p`,{className:`mt-1 text-xs text-[var(--console-muted)]`,children:d(`Both dates are included.`)}),(0,m.jsxs)(`div`,{className:`mt-4 grid grid-cols-2 gap-3`,children:[(0,m.jsxs)(`label`,{className:`console-mono text-[11px] uppercase tracking-wide text-[var(--console-muted)]`,children:[d(`From`),` `,(0,m.jsx)(`input`,{type:`date`,value:l,max:h||void 0,onChange:e=>f(e.target.value),className:`mt-1.5 w-full rounded-sm border border-[var(--console-border-strong)] bg-[var(--console-surface)] px-2 py-2 text-xs normal-case tracking-normal text-[var(--console-text)] outline-none focus:border-[var(--brand)] focus:ring-2 focus:ring-[var(--brand)]/25`})]}),(0,m.jsxs)(`label`,{className:`console-mono text-[11px] uppercase tracking-wide text-[var(--console-muted)]`,children:[d(`To`),` `,(0,m.jsx)(`input`,{type:`date`,value:h,min:l||void 0,onChange:e=>g(e.target.value),className:`mt-1.5 w-full rounded-sm border border-[var(--console-border-strong)] bg-[var(--console-surface)] px-2 py-2 text-xs normal-case tracking-normal text-[var(--console-text)] outline-none focus:border-[var(--brand)] focus:ring-2 focus:ring-[var(--brand)]/25`})]})]}),(0,m.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,m.jsx)(r,{className:`rounded-sm border border-[var(--console-border)] px-3 py-1.5 text-xs text-[var(--console-text)] hover:bg-[var(--console-surface-muted)]`,children:d(`Cancel`)}),(0,m.jsx)(`button`,{type:`button`,disabled:!l||!h||l>h,onClick:()=>{a(l,h),n(!1)},className:`rounded-sm border border-[var(--console-accent)] bg-[var(--console-accent)] px-3 py-1.5 text-xs text-[var(--console-accent-fg)] hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-40`,children:d(`Apply range`)})]})]})]})}export{O as A,E as C,ne as D,re as E,_ as F,g as I,k as M,I as N,x as O,P,te as S,oe as T,W as _,We as a,z as b,ze as c,Re as d,Ie as f,G as g,ge as h,Je as i,w as j,D as k,He as l,Ne as m,Xe as n,Ge as o,Pe as p,Ye as r,Ue as s,Ze as t,Le as u,V as v,T as w,R as x,B as y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-B-hcVAMW.js";import{D as r,i,n as a,t as o}from"./translate-Dmym1ZDl.js";import{H as s}from"./index-XpolWMY4.js";var c=e(t(),1);function l(e,t){return t===0||e-t>=15.666666666666668}function u(e,t,n){return!e&&t<=.12?n+1:0}function d(e,t){return e?0:t+1}function f(){let e=typeof document>`u`?void 0:document.fonts;return e?e.ready.then(()=>void 0):Promise.resolve()}function p(e,t,n){return e>=2&&(t>=8||n>=300)}function m(e,t){return!e||Math.abs(e.receiptWidth-t.receiptWidth)>.5||Math.abs(e.receiptHeight-t.receiptHeight)>.5||Math.abs(e.startX-t.startX)>.5||Math.abs(e.startY-t.startY)>.5}var h=18,g=42,ee=5,_=270,v=500,y=2,b=.035;function te(e){let t=window.getComputedStyle(e),n=(e,n)=>t.getPropertyValue(e).trim()||n;return{paperTop:n(`--console-surface`,`white`),paperBottom:n(`--console-surface-sunken`,`whitesmoke`),ink:n(`--console-text`,`black`),inkMuted:n(`--console-text-secondary`,`dimgray`),line:n(`--console-border-strong`,`silver`),shadow:n(`--scrim`,`gray`)}}function ne(e){return window.getComputedStyle(e).getPropertyValue(`--font-mono`).trim()||`monospace`}function x(e){return Math.round(e??0).toLocaleString(i())}function S(e){return`$${(e??0).toFixed(4)}`}function C(e){return new Date(e).toLocaleString(i(),{month:`short`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function w(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function T(e){let t=e||1;return()=>(t=Math.imul(t^t>>>15,1|t),t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296)}function E(e,t,n,r,i){let a=t.toUpperCase(),o=n.toUpperCase();e.fillText(a,18,r),e.fillText(o,i-18-e.measureText(o).width,r)}function D(e,t,n){if(e.measureText(t).width<=n)return t;let r=t;for(;r.length>1&&e.measureText(`${r}...`).width>n;)r=r.slice(0,-1);return`${r}...`}function O(e,t,n,r){let i=t.toUpperCase().split(/\s+/).filter(Boolean),a=[],o=``;for(let t of i){let i=o?`${o} ${t}`:t;if(e.measureText(i).width<=n){o=i;continue}if(o?(a.push(o),o=t):(a.push(D(e,t,n)),o=``),a.length===r)break}return a.length<r&&o&&a.push(o),a.length>0&&a.length===r&&(a[a.length-1]=D(e,a[a.length-1]??``,n)),a.slice(0,r)}function re(e,t,n){let r=document.createElement(`canvas`);r.width=_*y,r.height=v*y;let i=r.getContext(`2d`);if(!i)return r;i.scale(y,y);let a=e=>`${e} ${n}`,s=i.createLinearGradient(0,0,_,v);s.addColorStop(0,t.paperTop),s.addColorStop(1,t.paperBottom),i.fillStyle=s,i.fillRect(0,0,_,v);let c=T(w(e.id));i.fillStyle=t.ink;for(let e=0;e<1200;e+=1)i.globalAlpha=b*(.12+c()*.14),i.fillRect(c()*_,c()*v,.7,.7);i.globalAlpha=1,i.fillStyle=t.ink,i.font=a(`700 18px`),i.textAlign=`center`,i.fillText(`CODESESH MART`,_/2,34),i.fillStyle=t.inkMuted,i.font=a(`11px`),i.fillText(D(i,e.subtitle.toUpperCase(),234),_/2,51),i.strokeStyle=t.line,i.lineWidth=1,i.setLineDash([4,4]),i.beginPath(),i.moveTo(18,66),i.lineTo(252,66),i.stroke(),i.setLineDash([]),i.textAlign=`left`,i.fillStyle=t.ink,i.font=a(`11px`),E(i,o(`Agent`),e.agent,88,_),E(i,o(`Updated`),C(e.updatedAt),104,_),E(i,o(`Session`),`#${e.id.slice(0,8)}`,120,_),i.setLineDash([2,3]),i.beginPath(),i.moveTo(18,140),i.lineTo(252,140),i.stroke(),i.setLineDash([]),i.font=a(`700 12px`),i.fillText(o(`SESSION TOC RECEIPT LIST`),18,163),i.font=a(`11px`);let l=185;for(let t of e.items){let e=x(t.count);i.fillText(D(i,t.label,168),18,l),i.fillText(e,252-i.measureText(e).width,l),l+=17}return i.strokeStyle=t.line,i.lineWidth=1.5,i.beginPath(),i.moveTo(18,l+5),i.lineTo(252,l+5),i.stroke(),l+=26,E(i,o(`Input tokens`),x(e.inputTokens),l,_),l+=16,E(i,o(`Output tokens`),x(e.outputTokens),l,_),l+=16,E(i,o(`Messages`),x(e.messageCount),l,_),l+=22,i.font=a(`700 13px`),E(i,o(`TOTAL COST`),S(e.totalCost),l,_),i.strokeStyle=t.line,i.setLineDash([4,4]),i.beginPath(),i.moveTo(18,l+18),i.lineTo(252,l+18),i.stroke(),i.setLineDash([]),i.font=a(`10px`),i.textAlign=`center`,i.fillStyle=t.inkMuted,O(i,e.title,234,2).forEach((e,t)=>{i.fillText(e,_/2,l+38+t*13)}),r}function k(e,t){return e*h+t}function A(e){let{receiptWidth:t,receiptHeight:n,startX:r,startY:i}=e,a=t/17,o=n/41,s=[],c=[];for(let e=0;e<g;e+=1)for(let t=0;t<h;t+=1){let n=r+t*a,c=i+e*o;s.push({x:n,y:c,oldX:n,oldY:c,fixedX:e===0?n:null,fixedY:e===0?c:null})}let l=(e,t,n)=>{let r=s[e],i=s[t];!r||!i||c.push({a:e,b:t,length:Math.hypot(i.x-r.x,i.y-r.y),stiffness:n})};for(let e=0;e<g;e+=1)for(let t=0;t<h;t+=1){let n=k(e,t);t<17&&l(n,k(e,t+1),.98),e<41&&l(n,k(e+1,t),.92),e<41&&t<17&&(l(n,k(e+1,t+1),.46),l(k(e+1,t),k(e,t+1),.46)),t<16&&l(n,k(e,t+2),.35),e<40&&l(n,k(e+2,t),.28)}return{particles:s,constraints:c,receiptWidth:t,receiptHeight:n}}function ie(e,t){let n=t.receiptWidth/17;for(let r=0;r<h;r+=1){let i=e[r];i&&(i.fixedX=t.startX+r*n,i.fixedY=t.startY)}}function j(e){for(let t=0;t<h;t+=1){let n=e[t];!n||n.fixedX==null||n.fixedY==null||(n.x=n.fixedX,n.y=n.fixedY,n.oldX=n.fixedX,n.oldY=n.fixedY)}}function ae(e,t){let n=e[t.a],r=e[t.b];if(!n||!r)return;let i=r.x-n.x,a=r.y-n.y,o=Math.hypot(i,a);if(o<1e-4)return;let s=(o-t.length)/o*t.stiffness,c=n.fixedX!=null&&n.fixedY!=null,l=r.fixedX!=null&&r.fixedY!=null,u=c?0:l?1:.5,d=l?0:c?1:.5,f=i*s,p=a*s;c||(n.x+=f*u,n.y+=p*u),l||(r.x-=f*d,r.y-=p*d)}function M(e,t,n,r,i,a){let o=r[k(i,a)],s=r[k(i,a+1)],c=r[k(i+1,a)],l=r[k(i+1,a+1)];if(!o||!s||!c||!l)return;let u=a/17*t.width,d=i/41*t.height,f=t.width/17,p=t.height/41;e.save(),e.beginPath(),e.moveTo(o.x,o.y),e.lineTo(s.x,s.y),e.lineTo(l.x,l.y),e.lineTo(c.x,c.y),e.closePath(),e.clip(),e.transform((s.x-o.x)/f,(s.y-o.y)/f,(c.x-o.x)/p,(c.y-o.y)/p,o.x,o.y),e.drawImage(t,u,d,f+1,p+1,0,0,f+1,p+1),e.restore();let m=Math.atan2(s.y-o.y,s.x-o.x),h=Math.hypot(c.x-o.x,c.y-o.y)/(v/41),g=Math.sin(m)*.08+(h-1)*.16;Math.abs(g)<.01||(e.save(),e.beginPath(),e.moveTo(o.x,o.y),e.lineTo(s.x,s.y),e.lineTo(l.x,l.y),e.lineTo(c.x,c.y),e.closePath(),e.globalAlpha=Math.abs(g),e.fillStyle=g>0?n.paperTop:n.shadow,e.fill(),e.restore())}function N(e,t,n){let r=null,i=44;for(let a=h;a<e.length;a+=1){let o=e[a];if(!o)continue;let s=Math.hypot(o.x-t,o.y-n);s<i&&(i=s,r=a)}return r}function oe(e){let t=0;for(let n=h;n<e.length;n+=1){let r=e[n];r&&(t=Math.max(t,Math.hypot(r.x-r.oldX,r.y-r.oldY)))}return t}function P({canvas:e,anchor:t,hitSurface:n,payload:r,minWidthQuery:i}){let a=e.getContext(`2d`,{alpha:!0});if(!a)return null;let o=r,s={id:null,x:0,y:0,prevX:0,prevY:0,vx:0,vy:0,grabbedIndex:null},c=null,g=!1,y=0,b=0,x=0,S=A({receiptWidth:_,receiptHeight:v,startX:0,startY:32}),C=performance.now(),w=null,T=0,E=0,D=0,O=0,k=!1,P=!1,F=window.matchMedia(i),I=window.matchMedia(`(prefers-reduced-motion: reduce)`),L=()=>c!=null&&F.matches&&document.visibilityState===`visible`,R=()=>{let e=te(t);c={texture:re(o,e,ne(t)),palette:e}},z=()=>{let e=t.getBoundingClientRect(),n=Math.max(280,e.width||320),r=Math.min(_,n-34);return{receiptWidth:r,receiptHeight:Math.min(v,Math.max(320,x-42)),startX:(n-r)/2,startY:32}},B=t=>{k!==t&&(k=t,e.style.visibility=t?`visible`:`hidden`,n.style.visibility=t&&!I.matches?`visible`:`hidden`)},V=()=>{P=!1,y&&=(window.cancelAnimationFrame(y),0),B(!1)},H=(e,t=performance.now())=>{S=A(e),w=e,C=t},U=()=>{let n=window.devicePixelRatio||1,r=t.getBoundingClientRect();b=Math.max(1,r.width),x=Math.max(1,r.height),e.width=Math.floor(b*n),e.height=Math.floor(x*n),a.setTransform(n,0,0,n,0,0),T=0,E=0,D=0,O=0,B(!1),H(z()),L()&&W()},W=()=>{P||!L()||(P=!0,y=window.requestAnimationFrame(Z))},G=()=>{L()?U():V()},K=e=>{let n=t.getBoundingClientRect();return{x:e.clientX-n.left,y:e.clientY-n.top}},q=e=>{if(e.button!==0||I.matches)return;let t=K(e),r=N(S.particles,t.x,t.y);r!=null&&(e.preventDefault(),n.setPointerCapture(e.pointerId),s.id=e.pointerId,s.x=t.x,s.y=t.y,s.prevX=t.x,s.prevY=t.y,s.vx=0,s.vy=0,s.grabbedIndex=r,E=0,D=0,W())},J=e=>{if(s.id!==e.pointerId)return;let t=K(e);s.vx=t.x-s.prevX,s.vy=t.y-s.prevY,s.prevX=t.x,s.prevY=t.y,s.x=t.x,s.y=t.y},Y=e=>{if(s.id!==e.pointerId)return;let t=s.grabbedIndex==null?null:S.particles[s.grabbedIndex];t&&(t.oldX=t.x-s.vx*.9,t.oldY=t.y-s.vy*.9),s.id=null,s.grabbedIndex=null},se=e=>{let t=(e-C)/1e3;for(let e=h;e<S.particles.length;e+=1){let n=S.particles[e];if(!n)continue;let r=(n.x-n.oldX)*.985,i=(n.y-n.oldY)*.985;n.oldX=n.x,n.oldY=n.y,n.x+=r+Math.sin(t*1.7+e*.19)*.018,n.y+=i+.22}let n=s.grabbedIndex==null?null:S.particles[s.grabbedIndex];n&&(n.x+=(s.x-n.x)*.72,n.y+=(s.y-n.y)*.72)},ce=()=>{for(let e=0;e<ee;e+=1){j(S.particles);for(let e of S.constraints)ae(S.particles,e)}j(S.particles)},le=()=>{let e=1/0,t=1/0,r=-1/0,i=-1/0;for(let n of S.particles)e=Math.min(e,n.x),t=Math.min(t,n.y),r=Math.max(r,n.x),i=Math.max(i,n.y);n.style.transform=`translate3d(${e-20}px, ${t-20}px, 0)`,n.style.width=`${r-e+40}px`,n.style.height=`${i-t+40}px`},ue=e=>{let t=S.particles[0],n=S.particles[17],r=S.particles[755],i=S.particles[738];!t||!n||!r||!i||(a.save(),a.shadowColor=e.shadow,a.shadowBlur=24,a.shadowOffsetY=16,a.fillStyle=e.shadow,a.beginPath(),a.moveTo(t.x,t.y),a.lineTo(n.x,n.y),a.lineTo(r.x,r.y),a.lineTo(i.x,i.y),a.closePath(),a.fill(),a.restore())},de=e=>{let t=S.particles[0],n=S.particles[17];!t||!n||(a.save(),a.strokeStyle=e.ink,a.lineWidth=4,a.lineCap=`round`,a.beginPath(),a.moveTo(t.x-10,t.y-3),a.lineTo(n.x+10,n.y-3),a.stroke(),a.strokeStyle=e.paperTop,a.lineWidth=1,a.beginPath(),a.moveTo(t.x-8,t.y-5),a.lineTo(n.x+8,n.y-5),a.stroke(),a.restore())},X=()=>{if(c){a.clearRect(0,0,b,x),ue(c.palette);for(let e=0;e<41;e+=1)for(let t=0;t<17;t+=1)M(a,c.texture,c.palette,S.particles,e,t);de(c.palette),le()}},Z=e=>{if(!P)return;if(!L()){V();return}if(!l(e,O)){y=window.requestAnimationFrame(Z);return}O=e;let t=z();m(w,t)&&s.id==null?(T=0,B(!1),H(t,e)):(T+=1,w=t),ie(S.particles,t),I.matches||(se(e),ce()),X();let n=s.id!=null;E=u(n,oe(S.particles),E),D=d(n,D);let r=I.matches;if((r||T>=2)&&B(!0),r||p(T,E,D)){r||(H(t,e),X()),P=!1,y=0;return}y=window.requestAnimationFrame(Z)};B(!1),f().then(()=>{g||(R(),G())});let Q=new ResizeObserver(U);Q.observe(t);let $=new MutationObserver(()=>{R(),X()});return $.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}),F.addEventListener(`change`,G),I.addEventListener(`change`,G),document.addEventListener(`visibilitychange`,G),window.addEventListener(`resize`,G),n.addEventListener(`pointerdown`,q),n.addEventListener(`pointermove`,J),n.addEventListener(`pointerup`,Y),n.addEventListener(`pointercancel`,Y),{updatePayload(e){o=e,!(g||!c)&&(R(),X())},destroy(){g||(g=!0,V(),Q.disconnect(),$.disconnect(),F.removeEventListener(`change`,G),I.removeEventListener(`change`,G),document.removeEventListener(`visibilitychange`,G),window.removeEventListener(`resize`,G),n.removeEventListener(`pointerdown`,q),n.removeEventListener(`pointermove`,J),n.removeEventListener(`pointerup`,Y),n.removeEventListener(`pointercancel`,Y))}}}var F=n();function I(e){let t=[{label:o(`User`),count:e.counts.user},{label:o(`Agent Responses`),count:e.counts.agent_message},{label:o(`Thinking`),count:e.counts.thinking},{label:o(`Plans`),count:e.counts.plan},{label:o(`Tools`),count:e.counts.tools_all}].filter(e=>e.count>0),n=e.tools.map(e=>({label:e.label,count:e.count})),r=Math.max(0,9-t.length),i=n.length>r?n.slice(0,Math.max(0,r-1)):n,a=n.slice(i.length).reduce((e,t)=>e+t.count,0);return a>0&&i.push({label:o(`Other tools`),count:a}),[...t,...i].slice(0,9)}function L(e){return!e||e.length===0?o(`SESSION ACTIVITY RECEIPT`):e.map(e=>o(e)).join(` / `)}function R(e,t){return{id:e.reference.sessionId,title:s(e)||o(`Untitled session`),agent:r(e),updatedAt:e.time_updated??e.time_created,subtitle:L(e.smart_tags),inputTokens:e.stats.total_input_tokens??0,outputTokens:e.stats.total_output_tokens??0,messageCount:e.stats.message_count??0,totalCost:e.stats.total_cost??0,items:I(t)}}function z({session:e,toc:t,minWidthQuery:n=`(min-width: 1025px)`}){let r=a(),i=(0,c.useRef)(null),s=(0,c.useRef)(null),l=(0,c.useRef)(null),u=(0,c.useRef)(null),d=(0,c.useMemo)(()=>R(e,t),[r,e,t]),f=(0,c.useRef)(d);return(0,c.useLayoutEffect)(()=>{let e=i.current,t=s.current,r=l.current;if(!e||!t||!r)return;let a=P({canvas:e,anchor:t,hitSurface:r,payload:f.current,minWidthQuery:n});return u.current=a,()=>{a?.destroy(),u.current===a&&(u.current=null)}},[n]),(0,c.useLayoutEffect)(()=>{f.current=d,u.current?.updatePayload(d)},[d]),(0,F.jsxs)(`div`,{ref:s,className:`relative h-[calc(100dvh-5.5rem)] min-h-[420px]`,children:[(0,F.jsx)(`canvas`,{ref:i,className:`invisible pointer-events-none absolute inset-0 z-[61] block h-full w-full touch-none`,"aria-hidden":`true`}),(0,F.jsx)(`div`,{ref:l,className:`invisible absolute left-0 top-0 z-[62] cursor-grab touch-none active:cursor-grabbing`,"aria-label":o(`Interactive thermal receipt with Verlet paper simulation`)})]})}export{z as InteractiveReceipt};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-B-hcVAMW.js";import{_ as r,f as i,g as a,i as o,n as s,o as c,p as l,s as u,t as d,u as f}from"./utils-Bk66u8b3.js";import{a as p,c as m,d as h,m as g,o as _,s as v,t as y}from"./CustomTimeWindowDialog-D2bx7uDv.js";import{n as b,t as x}from"./translate-Dmym1ZDl.js";var S=e(t(),1);function C(e,t){let n=e!==null,r=g({...h(e??{},t),enabled:n}),i=r.refetch,a=(0,S.useCallback)(async()=>{await i()},[i]);return{dashboard:n?r.data??null:null,loading:n&&r.isPending,error:n&&r.isError?r.error instanceof Error?r.error.message:x(`Unable to load dashboard.`):null,retry:a}}var w=n();function T({index:e,count:t,children:n}){let r=(e+.5)/t*100;return(0,w.jsx)(`div`,{role:`tooltip`,className:`console-mono pointer-events-none absolute top-2 z-10 w-max max-w-full rounded-md border border-[var(--console-border)] bg-[var(--console-surface)] px-2.5 py-2 text-[10.5px] break-words text-[var(--console-text)] shadow-[var(--shadow-overlay)]`,style:{left:`${r}%`,transform:`translateX(-${r}%)`},children:n})}var E=Math.PI*2;function D(e){return e<0?0:e>1?1:e}function O(e){let t=D(e);return t*t*(3-2*t)}function k(e,t){let n=Math.imul(Math.round(e*16)^2654435769,2246822507);return n=Math.imul(n^n>>>13^Math.round(t*16),3266489909),((n^n>>>16)>>>0)/4294967296}function A(e,t,n){return O((Math.sin(e*.09+n)+Math.sin(t*.075-n*.83)+Math.sin((e+t)*.045+n*1.31)+2)/4)}function j(e){if(e<=0)return 1;let t=10**Math.floor(Math.log10(e)),n=e/t;return(n<=1?1:n<=2?2:n<=5?5:10)*t}var M=/^var\((--[\w-]+)\)$/;function N(e,t){let n=M.exec(t)?.[1];return n&&e.getPropertyValue(n).trim()||t}function P(e,t){let n=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e)?.[1];if(!n)return e;let r=n.length===3?n.replace(/./g,e=>e+e):n,i=parseInt(r,16);return`rgba(${i>>16&255}, ${i>>8&255}, ${i&255}, ${t})`}var F=50;function ee(){let e=!1,t=null,n=0,r=0,i=()=>{n&&cancelAnimationFrame(n),r&&window.clearTimeout(r),n=0,r=0},a=()=>{!e||t===null||n||(r&&=(window.clearTimeout(r),0),n=requestAnimationFrame(s))},o=()=>{!e||t===null||r||n||(r=window.setTimeout(()=>{r=0,a()},F))};function s(r){if(n=0,!e||t===null)return;let i=t(r);i===`active`?a():i===`idle`&&o()}return{api:{requestFrame:a,setFrameHandler:e=>{t=e,e===null?i():a()}},setEnabled:t=>{e!==t&&(e=t,e?a():i())}}}function I(e,t){let[n]=(0,S.useState)(ee);return(0,S.useEffect)(()=>{let r=e.current;if(!r||t){n.setEnabled(!1);return}let i=!0,a=document.visibilityState===`visible`,o=()=>n.setEnabled(i&&a),s=()=>{a=document.visibilityState===`visible`,o()},c=typeof IntersectionObserver>`u`?null:new IntersectionObserver(([e])=>{i=e?.isIntersecting??!1,o()});return c?.observe(r),document.addEventListener(`visibilitychange`,s),o(),()=>{n.setEnabled(!1),c?.disconnect(),document.removeEventListener(`visibilitychange`,s)}},[n,t,e]),n.api}var te=2,L=5,ne=8,re=7,ie=620,ae=.05,oe=.8,se=.0018,ce=.3,le=.48,ue={barRatio:.62,barMax:76,bandGap:4,minBand:6};function de(e,t,n){let r=Math.max(1,t-1),i=Math.min(ae,oe/r),a=1-(t-1)*i;return 1-(1-D((n-e*i)/a))**3}function fe(e,{values:t,axisMax:n,colors:r,highlight:i,hovered:a,layout:o,reducedMotion:s}){let c=(0,S.useContext)(m),l=I(e,s),u=r.join(`\0`),d=(0,S.useRef)({values:t,axisMax:n,hovered:a,layout:o}),f=(0,S.useRef)(new Map),p=(0,S.useRef)(new Map),h=(0,S.useRef)({startedAt:0,running:!1}),g=(0,S.useRef)({w:0,h:0}),_=(0,S.useRef)(()=>{});return(0,S.useEffect)(()=>{d.current={values:t,axisMax:n,hovered:a,layout:o},s?_.current():l.requestFrame()},[n,l,a,o,s,t]),(0,S.useEffect)(()=>{p.current=new Map(f.current),s?(h.current.running=!1,_.current()):(h.current={startedAt:performance.now(),running:!0},l.requestFrame())},[n,l,s,t]),(0,S.useEffect)(()=>{let t=e.current,n=t?.parentElement,r=t?.getContext(`2d`);if(!t||!n||!r)return;let a=getComputedStyle(t),o=(u?u.split(`\0`):[]).map(e=>N(a,e)),c=N(a,i),m=()=>{let e=n.clientWidth,i=n.clientHeight;if(!e||!i)return;let a=Math.min(te,window.devicePixelRatio||1);t.width=Math.round(e*a),t.height=Math.round(i*a),t.style.width=`${e}px`,t.style.height=`${i}px`,r.setTransform(a,0,0,a,0,0),g.current={w:e,h:i}},v=0,y=(e,t,n)=>{if(!h.current.running)return 1;let r=D((n-h.current.startedAt)/ie);return r>=1&&(h.current.running=!1),de(e,t,r)},b=(e,t,n,i,a,o,s,c,l,u,d)=>{let f=[l?ne:L,l?ne:L,u?re:L,u?re:L],p=()=>{r.beginPath(),r.roundRect(e,t,n,i,f)};r.save(),p(),r.clip(),r.globalAlpha=s,r.fillStyle=a;let m=c?.5:.36,h=Math.min(d,i)/2;r.beginPath();for(let a=e+d/2;a<e+n;a+=d)for(let e=t+h;e<t+i;e+=d){let n=O(1-(e-t)/i),o=A(a,e,v),s=d*(m+.34*n+.26*o)*(.8+.4*k(a,e));r.rect(a-s/2,e-s/2,s,s)}r.fill(),r.restore(),c&&(r.save(),p(),r.strokeStyle=o,r.lineWidth=1.75,r.shadowColor=o,r.shadowBlur=10,r.stroke(),r.restore())},x=e=>{v=e*se;let{w:t,h:n}=g.current;if(!t||!n)return;let i=d.current;if(r.clearRect(0,0,t,n),!i.values.length||i.axisMax<=0){h.current.running=!1;return}let{barRatio:a,barMax:s,bandGap:l,minBand:u}=i.layout,m=i.values.length,_=t/m,x=Math.min(_*a,s),S=Math.max(3,Math.round(t/200)),C=n/i.axisMax,w=i.hovered;i.values.forEach((t,r)=>{let i=y(r,m,e),a=r*_+(_-x)/2,s=n;t.forEach((e,n)=>{let d=`${r}:${n}`,m=e>0?Math.max(u,e*C):0,h=p.current.get(d)??0,g=h+(m-h)*i;f.current.set(d,g);let _=w?.column===r&&w.band===n,v=w==null?1:w.column===r?w.band===null||_?1:le:ce;g>0&&b(a,s-g,x,g,o[n]??o[0]??c,c,v,_,n===t.length-1,n===0,S),s-=g+l})})};_.current=()=>{m(),x(performance.now())},l.setFrameHandler(e=>(x(e),h.current.running?`active`:d.current.hovered===null?`stop`:`idle`)),m();let S=new ResizeObserver(()=>{m(),s?x(performance.now()):l.requestFrame()});return S.observe(n),s&&x(performance.now()),()=>{l.setFrameHandler(null),S.disconnect()}},[e,u,l,i,s,c]),{hitTest:(t,n)=>{let r=e.current,{w:i,h:a}=g.current;if(!r||!i)return null;let o=r.getBoundingClientRect(),s=(t-o.left)/o.width*i,c=(n-o.top)/o.height*a,{values:l,layout:u}=d.current,p=l.length,m=i/p,h=Math.floor(s/m);if(h<0||h>=p)return null;let _=Math.min(m*u.barRatio,u.barMax),v=h*m+(m-_)/2;if(s<v||s>v+_)return{column:h,band:null};let y=a;for(let e=0;e<l[h].length;e++){let t=f.current.get(`${h}:${e}`)??0;if(t>0&&c<=y&&c>=y-t)return{column:h,band:e};y-=t+u.bandGap}return{column:h,band:null}}}}var pe=`(prefers-reduced-motion: reduce)`;function R(){let[e,t]=(0,S.useState)(()=>globalThis.matchMedia?.(pe).matches??!1);return(0,S.useEffect)(()=>{let e=globalThis.matchMedia?.(pe);if(!e)return;let n=()=>t(e.matches);return n(),e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function me(e,t,n){return e===`ArrowLeft`?Math.max(0,t-1):e===`ArrowRight`?Math.min(n,t+1):e===`Home`?0:e===`End`?n:null}function he({label:e,itemLabels:t,activeIndex:n,onActiveIndexChange:r,layout:i}){let a=(0,S.useRef)([]),[o,s]=(0,S.useState)(0),c=t.length-1,l=Math.min(o,Math.max(0,c)),u=(e,t)=>{if(e.key===`Escape`){e.preventDefault(),r(null);return}let n=me(e.key,t,c);n!==null&&(e.preventDefault(),s(n),a.current[n]?.focus())};return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`div`,{role:`listbox`,"aria-label":e,"aria-orientation":`horizontal`,className:d(`pointer-events-none absolute inset-0 z-[1]`,i===`columns`?`flex`:null),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||r(null)},children:t.map((e,t)=>(0,w.jsx)(`div`,{ref:e=>{a.current[t]=e},role:`option`,"aria-label":e,"aria-selected":n===t,tabIndex:t===l?0:-1,className:d(`pointer-events-none focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-[var(--brand)]`,i===`columns`?`h-full min-w-0 flex-1 rounded-sm`:`absolute inset-0 rounded-full`),onFocus:()=>{s(t),r(t)},onKeyDown:e=>u(e,t)},t))}),(0,w.jsx)(`span`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`sr-only`,children:n===null?``:t[n]})]})}var ge=[1,.75,.5,.25,0];function _e(e,t){return e===t||e!==null&&t!==null&&e.column===t.column&&e.band===t.band}function ve({values:e,axisMax:t,colors:n,highlight:r=`var(--brand)`,hovered:i,onHover:a,layout:o,height:s,formatTick:c,ariaLabel:l,itemLabels:u,className:f}){let p=(0,S.useRef)(null),m=(0,S.useRef)(i),h=R(),{hitTest:g}=fe(p,{values:e,axisMax:t,colors:n,highlight:r,hovered:i,layout:{...ue,...o},reducedMotion:h});(0,S.useEffect)(()=>{m.current=i},[i]);let _=e=>{_e(m.current,e)||(m.current=e,a(e))};return(0,w.jsxs)(`div`,{className:d(`flex`,f),children:[c?(0,w.jsx)(`div`,{className:`relative shrink-0`,style:{height:s,width:38},"aria-hidden":!0,children:ge.map(e=>(0,w.jsx)(`span`,{className:`console-mono absolute right-2 -translate-y-1/2 text-[9.5px] whitespace-nowrap text-[var(--console-muted)]`,style:{top:`${(1-e)*100}%`},children:c(t*e)},e))}):null,(0,w.jsxs)(`div`,{className:`chart-hatch relative min-w-0 flex-1 touch-none`,style:{height:s},onPointerMove:e=>_(g(e.clientX,e.clientY)),onPointerLeave:()=>_(null),children:[ge.map(e=>(0,w.jsx)(`span`,{"aria-hidden":!0,className:d(`pointer-events-none absolute inset-x-0`,e===0?`h-px bg-[var(--console-border-strong)]`:`border-t border-dashed border-[var(--console-border)]`),style:{top:`${(1-e)*100}%`}},e)),(0,w.jsx)(`canvas`,{ref:p,"aria-hidden":!0,className:`absolute inset-0 block`}),(0,w.jsx)(he,{label:l,itemLabels:u,activeIndex:i?.column??null,onActiveIndexChange:e=>_(e===null?null:{column:e,band:null}),layout:`columns`})]})]})}var z=6,ye=118,be={barRatio:.52,barMax:34,bandGap:0,minBand:4},xe=[`var(--brand)`];function Se({perAgent:e}){let t=b(),[n,r]=(0,S.useState)(null),{byCost:i,visible:c,values:l,axisMax:f,itemLabels:m}=(0,S.useMemo)(()=>{let t=e.some(e=>e.cost>0),n=e=>t?e.cost:e.sessions,r=[...e].sort((e,t)=>n(t)-n(e)).slice(0,z),i=r.map(e=>[n(e)]),o=r.map(e=>t?x(`{0}: {1}, {2} sessions`,[e.displayName,a(e.cost),u(e.sessions)]):x(`{0}: {1} sessions`,[e.displayName,u(e.sessions)]));return{byCost:t,visible:r,values:i,axisMax:Math.max(...i.flat(),0),itemLabels:o}},[t,e]),h=n===null?void 0:c[n.column];return(0,w.jsxs)(p,{role:`region`,"aria-label":x(`Agents`),className:`p-4`,children:[(0,w.jsx)(_,{title:x(`Agents`),meta:x(`{0} · {1} total`,[x(i?`by cost`:`by sessions`),e.length])}),c.length===0?(0,w.jsx)(`p`,{className:`console-mono mt-3 text-[11px] text-[var(--console-muted)]`,children:x(`No data`)}):(0,w.jsxs)(`div`,{className:`relative mt-[14px]`,children:[(0,w.jsx)(ve,{values:l,axisMax:f,colors:xe,hovered:n,onHover:r,layout:be,height:ye,ariaLabel:x(`Agent distribution chart`),itemLabels:m}),h&&n?(0,w.jsxs)(T,{index:n.column,count:c.length,children:[(0,w.jsx)(`div`,{children:h.displayName}),(0,w.jsxs)(`div`,{children:[o(h.tokens),` `,x(`tok ·`),` `,(0,w.jsx)(`span`,{className:`text-[var(--brand)]`,children:a(h.cost)})]}),(0,w.jsxs)(`div`,{children:[u(h.sessions),` `,x(`sessions ·`),` `,u(h.messages),` `,x(`messages`)]})]}):null,(0,w.jsx)(`div`,{className:`mt-2 grid`,style:{gridTemplateColumns:`repeat(${c.length}, minmax(0, 1fr))`},children:c.map((e,t)=>(0,w.jsxs)(`div`,{"data-testid":`overview-agent-row`,className:`flex min-w-0 flex-col items-center gap-[5px]`,children:[(0,w.jsx)(`span`,{className:`flex size-[18px] items-center justify-center rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)]`,children:(0,w.jsx)(s,{icon:e.icon,iconColored:e.iconColored,alt:e.displayName,className:`size-[10px]`})}),(0,w.jsx)(`span`,{className:d(`console-mono max-w-full truncate text-[9.5px]`,n?.column===t?`text-[var(--console-text)]`:`text-[var(--console-muted)]`),children:e.displayName}),(0,w.jsx)(`span`,{className:`console-mono text-[9.5px] text-[var(--console-text)]`,children:i?a(e.cost):u(e.sessions)}),i?(0,w.jsx)(`span`,{className:`console-mono text-[9.5px] text-[var(--console-muted)]`,children:u(e.sessions)}):null]},e.name))})]}),e.length>z?(0,w.jsxs)(`p`,{className:`console-mono mt-3 text-[10.5px] text-[var(--console-muted)]`,children:[`+ `,e.length-z,` `,x(`more`)]}):null]})}var B=200,V=100,H=100,U=86,W=55,Ce=-Math.PI/2,we=.07,Te=6,G=4.6,Ee=2,De=.0018,Oe=500,ke=6,Ae=.72,je=.3,Me=(()=>{let e=[];for(let t=14;t<=186;t+=G)for(let n=14;n<=186;n+=G){let r=t-V,i=n-H,a=Math.hypot(r,i);a<50.4||a>90.6||e.push({x:t,y:n,angle:Math.atan2(i,r),fullness:.62+.38*O((a-W)/31),jitter:k(t,n)})}return e})();function Ne(e,{a0:t,a1:n}){let r=n-t,i=Math.min(Te,31*.45,W*r*.45),a=i/U,o=i/W,s=(e,t)=>[V+Math.cos(t)*e,H+Math.sin(t)*e],[c,l]=s(U,t+a);e.beginPath(),e.moveTo(c,l),e.arc(V,H,U,t+a,n-a),e.arcTo(...s(U,n),...s(W,n),i),e.arcTo(...s(W,n),...s(W,n-o),i),e.arc(V,H,W,n-o,t+o,!0),e.arcTo(...s(W,t),...s(U,t),i),e.arcTo(...s(U,t),c,l,i),e.closePath()}function Pe(e){let t=Ce;return e.map(e=>{let n=e*E,r={a0:t+we/2,a1:t+n-we/2};return t+=n,r})}function Fe(e,{shares:t,colors:n,hovered:r,reducedMotion:i}){let a=(0,S.useContext)(m),o=I(e,i),s=n.join(`\0`),c=(0,S.useRef)(r),l=(0,S.useRef)({displayed:t.slice(),from:t.slice(),target:t.slice(),startedAt:0,running:!1}),u=(0,S.useRef)(Pe(t)),d=(0,S.useRef)(()=>{});return(0,S.useEffect)(()=>{let e=l.current;e.from=e.displayed.slice(),e.target=t.slice(),i?(e.displayed=t.slice(),e.running=!1,d.current()):(e.startedAt=performance.now(),e.running=!0,o.requestFrame())},[o,i,t]),(0,S.useEffect)(()=>{c.current=r,i?d.current():o.requestFrame()},[o,r,i]),(0,S.useEffect)(()=>{let t=e.current,n=t?.parentElement,r=t?.getContext(`2d`);if(!t||!n||!r)return;let a=getComputedStyle(t),f=(s?s.split(`\0`):[]).map(e=>N(a,e)),p=1,m=()=>{let e=n.clientWidth;if(!e)return;let r=Math.min(Ee,window.devicePixelRatio||1);t.width=Math.ceil(e*r),t.height=Math.ceil(e*r),t.style.width=`${e}px`,t.style.height=`${e}px`,p=e/B*r},h=0,g=e=>{let t=l.current;if(!t.running)return;let n=D((e-t.startedAt)/Oe),r=1-2**(-10*n);t.displayed=t.target.map((e,n)=>{let i=t.from[n]??0;return i+(e-i)*r}),n>=1&&(t.displayed=t.target.slice(),t.running=!1)},_=(e,t,n,i)=>{if(t.a1-t.a0<=.004)return;if(r.save(),n){let n=(t.a0+t.a1)/2;r.translate(Math.cos(n)*ke,Math.sin(n)*ke),r.shadowColor=P(e,.55),r.shadowBlur=5}Ne(r,t),r.clip(),r.globalAlpha=i?n?1:je*Ae:Ae,r.fillStyle=e;let a=n?.46:.34,o=t.a0-.06,s=t.a1+.06;r.beginPath();for(let e of Me){let t=e.angle;for(;t<o;)t+=E;for(;t>=o+E;)t-=E;if(t>s)continue;let n=A(e.x,e.y,h),i=G*(a+.36*e.fullness+.26*n)*(.78+.42*e.jitter);r.rect(e.x-i/2,e.y-i/2,i,i)}r.fill(),r.restore()},v=e=>{h=e*De,r.setTransform(p,0,0,p,0,0),r.clearRect(0,0,B,B);let t=Pe(l.current.displayed);u.current=t;let n=c.current,i=n!==null;t.forEach((e,t)=>{t!==n&&_(f[t]??f[0]??``,e,!1,i)});let a=n===null?void 0:t[n];a&&_(f[n]??``,a,!0,!0)};d.current=()=>{m(),v(performance.now())},o.setFrameHandler(e=>(g(e),v(e),l.current.running?`active`:c.current===null?`stop`:`idle`)),m();let y=new ResizeObserver(()=>{m(),i?v(performance.now()):o.requestFrame()});return y.observe(n),i&&v(performance.now()),()=>{o.setFrameHandler(null),y.disconnect()}},[e,s,o,i,a]),{hitTest:(t,n)=>{let r=e.current;if(!r)return null;let i=r.getBoundingClientRect();if(!i.width)return null;let a=(t-i.left)/i.width*B-V,o=(n-i.top)/i.height*B-H,s=Math.hypot(a,o);if(s<W||s>U)return null;let c=Math.atan2(o,a);for(let e=0;e<u.current.length;e++){let{a0:t,a1:n}=u.current[e],r=c;for(;r<t;)r+=E;for(;r>=t+E;)r-=E;if(r<=n)return e}return null}}}function Ie({shares:e,colors:t,hovered:n,onHover:r,size:i,ariaLabel:a,itemLabels:o,children:s}){let c=(0,S.useRef)(null),{hitTest:l}=Fe(c,{shares:e,colors:t,hovered:n,reducedMotion:R()});return(0,w.jsxs)(`div`,{className:`relative shrink-0 touch-none`,style:{width:i,height:i},onPointerMove:e=>r(l(e.clientX,e.clientY)),onPointerLeave:()=>r(null),children:[(0,w.jsx)(`canvas`,{ref:c,"aria-hidden":!0,className:`block size-full`}),(0,w.jsx)(`div`,{className:`pointer-events-none absolute inset-0 flex flex-col items-center justify-center`,children:s}),(0,w.jsx)(he,{label:a,itemLabels:o,activeIndex:n,onActiveIndexChange:r,layout:`surface`})]})}var Le=5,Re=142,ze=.01;function Be(e){return e!==null&&e.some(e=>e.cost>0)}function Ve(e,t){let n=[...e].sort((e,t)=>t.cost-e.cost).slice(0,Le),i=n.map((e,t)=>({key:e.model,label:e.model,value:e.cost,color:`var(--chart-${t+1})`,display:r(e.cost)})),a=t-n.reduce((e,t)=>e+t.cost,0);return t>0&&a>t*ze&&i.push({key:`__remainder`,label:x(`Other`),value:a,color:`var(--console-border-strong)`,display:r(a)}),i}function He(e){return[...e].sort((e,t)=>t.tokens-e.tokens).slice(0,Le).map((e,t)=>({key:e.model,label:e.model,value:e.tokens,color:`var(--chart-${t+1})`,display:o(e.tokens)}))}function Ue({modelCost:e,modelDistribution:t,totals:n}){let s=b(),[c,l]=(0,S.useState)(null),{byCost:u,entries:f}=(0,S.useMemo)(()=>{let r=Be(e);return{byCost:r,entries:r?Ve(e,n.cost):He(t)}},[s,e,t,n.cost]),m=f.reduce((e,t)=>e+t.value,0),h=(0,S.useMemo)(()=>f.map(e=>m>0?e.value/m:1/f.length),[f,m]),g=x(u?`Cost by Model`:`Models`),v=f.map(e=>`${e.label}: ${i(m>0?e.value/m:0)}, ${e.display}`);return(0,w.jsxs)(p,{role:`region`,"aria-label":g,className:`p-4`,children:[(0,w.jsx)(_,{title:g,meta:x(u?`by cost`:`by tokens`)}),f.length===0?(0,w.jsx)(`p`,{className:`console-mono mt-3 text-[11px] text-[var(--console-muted)]`,children:x(`No model data`)}):(0,w.jsxs)(`div`,{className:`mt-[14px] flex items-center gap-[18px]`,children:[(0,w.jsxs)(Ie,{shares:h,colors:f.map(e=>e.color),hovered:c,onHover:l,size:Re,ariaLabel:x(`{0} chart`,[g]),itemLabels:v,children:[(0,w.jsx)(`span`,{className:`console-mono text-[16px] font-semibold text-[var(--console-text)]`,children:u?r(n.cost):o(n.tokens)}),(0,w.jsx)(`span`,{className:`console-mono mt-0.5 text-[9px] text-[var(--console-muted)]`,children:x(u?`total cost`:`total tokens`)})]}),(0,w.jsx)(`ul`,{className:`flex min-w-0 flex-1 flex-col gap-[7px]`,children:f.map((e,t)=>(0,w.jsxs)(`li`,{className:d(`flex min-w-0 items-center gap-2 transition-opacity`,c!==null&&c!==t?`opacity-45`:null),onPointerEnter:()=>l(t),onPointerLeave:()=>l(null),children:[(0,w.jsx)(`span`,{className:`size-2 shrink-0 rounded-[2px]`,style:{background:e.color},"aria-hidden":!0}),(0,w.jsx)(`span`,{className:`console-mono min-w-0 flex-1 truncate text-[10.5px] text-[var(--console-text)]`,children:e.label}),(0,w.jsx)(`span`,{className:`console-mono w-[34px] shrink-0 text-right text-[10.5px] text-[var(--console-muted)]`,children:i(m>0?e.value/m:0)}),(0,w.jsx)(`span`,{className:`console-mono w-[54px] shrink-0 text-right text-[10.5px] text-[var(--console-text)]`,children:e.display})]},e.key))})]}),(0,w.jsx)(`p`,{className:`console-mono mt-3 border-t border-dashed border-[var(--console-border)] pt-3 text-[10.5px] text-[var(--console-muted)]`,children:u?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`span`,{className:`mr-1.5 rounded-sm bg-[var(--brand-soft)] px-1.5 py-0.5 text-[var(--brand)]`,children:x(`Estimated`)}),a(n.costEstimated),` `,x(`from model unit price,`),` `,a(n.costRecorded),` `,x(`from agent records`)]}):x(`Per-model cost needs the message cache, which is unavailable here; showing token share instead.`)})]})}var We=[{value:`7d`,label:`7d`},{value:`30d`,label:`30d`},{value:`90d`,label:`90d`},{value:`all`,label:`All`},{value:`custom`,label:`Custom`}],K=`__all__`;function Ge({agent:e,onAgentChange:t,agentCatalog:n,scopeCounts:r,window:i,rangePreset:a,onRangeChange:o,onSelectCustom:s}){b();let[c,l]=(0,S.useState)(!1);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[t?(0,w.jsxs)(`select`,{"aria-label":x(`Filter by agent`),value:e??K,onChange:e=>t(e.target.value===K?void 0:e.target.value),className:`console-mono max-w-[220px] rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] px-2 py-1.5 text-xs text-[var(--console-text)] focus-visible:ring-2 focus-visible:ring-[var(--brand)] focus-visible:outline-none`,children:[(0,w.jsx)(`option`,{value:K,children:x(`All agents`)}),n.active.map(e=>(0,w.jsx)(`option`,{value:e.name.toLowerCase(),children:e.displayName},e.name))]}):null,r?(0,w.jsx)(`span`,{className:`console-mono text-[11px] text-[var(--console-muted)]`,children:x(`{0} projects · {1} agents in scope`,[r.projects,r.agents])}):null,(0,w.jsx)(`div`,{className:`ml-auto flex items-center gap-1.5`,children:We.map(e=>{let t=e.value===a;return(0,w.jsx)(`button`,{type:`button`,"aria-pressed":t,onClick:()=>{e.value===`custom`?l(!0):o(e.value)},className:d(`console-mono motion-hover rounded-full border px-[13px] py-[5px] text-[11px] focus-visible:ring-2 focus-visible:ring-[var(--brand)] focus-visible:outline-none`,t?`border-[var(--brand)] bg-[var(--brand)] text-[var(--brand-fg)]`:`border-[var(--console-border)] bg-[var(--console-surface)] text-[var(--console-muted)]`),children:x(e.label)},e.value)})})]}),(0,w.jsx)(y,{open:c,onOpenChange:l,window:i,onSelectCustom:s})]})}function Ke(e){return e.toFixed(1)}var qe={neutral:`text-[var(--console-muted)]`,warning:`text-[var(--brand)]`,positive:`text-[var(--positive)]`};function q({label:e,value:t,trend:n,trendTone:r=`neutral`,hint:i,emphasis:a=!1}){return b(),(0,w.jsxs)(p,{className:d(`px-4 py-[14px]`,a?`border-[var(--brand-line)]`:null),children:[(0,w.jsx)(`p`,{className:`console-eyebrow`,children:e}),(0,w.jsx)(`p`,{className:d(`console-mono mt-[9px] text-[27px] font-semibold tracking-[-0.02em]`,a?`text-[var(--brand)]`:`text-[var(--console-text)]`),children:t}),(0,w.jsxs)(`div`,{className:`mt-[7px] flex items-center gap-[7px]`,children:[n===void 0?null:(0,w.jsx)(`span`,{"data-testid":`overview-kpi-trend`,className:d(`console-mono text-[10.5px]`,qe[r]),children:n}),i===void 0?null:(0,w.jsx)(`span`,{className:`console-mono truncate text-[10.5px] text-[var(--console-muted)]`,children:i})]})]})}function Je(e){return e.costEstimated===0?x(`All recorded by agents`):e.costEstimated===e.cost&&e.cost>0?x(`All estimated from unit price`):x(`{0} estimated`,[a(e.costEstimated)])}function Ye(e){let t=[e.latestActivityProject,e.latestActivityAgent].filter(e=>!!e);return t.length>0?t.join(` · `):void 0}function Xe({totals:e,rangeDays:t}){b();let n=e.previous,r=(e,t)=>t===void 0?null:c(e,t),s=r(e.sessions,n?.sessions),d=r(e.messages,n?.messages),f=r(e.tokens,n?.tokens),p=r(e.cost,n?.cost),m=n?.cost!==void 0&&e.cost>n.cost;return(0,w.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 md:grid-cols-3 xl:grid-cols-5`,children:[(0,w.jsx)(q,{label:x(`Sessions`),value:u(e.sessions),trend:s??void 0,hint:t?x(`{0}/day`,[Ke(e.sessions/t)]):void 0}),(0,w.jsx)(q,{label:x(`Messages`),value:u(e.messages),trend:d??void 0,hint:e.sessions>0?x(`{0}/session`,[Ke(e.messages/e.sessions)]):void 0}),(0,w.jsx)(q,{label:x(`Tokens`),value:o(e.tokens),trend:f??void 0,hint:x(`Cache hit {0}`,[i(e.cacheReadTokens/e.tokens)])}),(0,w.jsx)(q,{label:x(`Cost`),value:a(e.cost),trend:p??void 0,trendTone:m?`warning`:`positive`,hint:Je(e),emphasis:!0}),(0,w.jsx)(q,{label:x(`Last activity`),value:e.latestActivity===void 0?x(`No activity`):l(e.latestActivity),trend:e.latestActivity===void 0?void 0:`●`,trendTone:`positive`,hint:e.latestActivity===void 0?void 0:Ye(e)})]})}var Ze=[0,1,2,3,4];function J({className:e}){return b(),(0,w.jsx)(`span`,{className:`skeleton-shimmer block rounded-sm ${e}`})}function Y({bodyClassName:e}){return b(),(0,w.jsxs)(p,{className:`p-4`,children:[(0,w.jsx)(J,{className:`h-[15px] w-28`}),(0,w.jsx)(J,{className:`mt-3 ${e}`})]})}function Qe(){return b(),(0,w.jsxs)(`div`,{className:`space-y-4`,"aria-hidden":!0,"data-testid":`overview-skeleton`,children:[(0,w.jsx)(`div`,{className:`grid grid-cols-2 gap-3 md:grid-cols-3 xl:grid-cols-5`,children:Ze.map(e=>(0,w.jsxs)(p,{className:`px-4 py-[14px]`,children:[(0,w.jsx)(J,{className:`h-[10px] w-16`}),(0,w.jsx)(J,{className:`mt-[9px] h-[27px] w-24`}),(0,w.jsx)(J,{className:`mt-[7px] h-[11px] w-20`})]},e))}),(0,w.jsxs)(p,{className:`p-4`,children:[(0,w.jsx)(J,{className:`h-[15px] w-28`}),(0,w.jsx)(J,{className:`mt-[14px] h-[168px] w-full`})]}),(0,w.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[1.45fr_1fr]`,children:[(0,w.jsx)(Y,{bodyClassName:`h-[248px] w-full`}),(0,w.jsxs)(`div`,{className:`grid content-start gap-4`,children:[(0,w.jsx)(Y,{bodyClassName:`h-[116px] w-full`}),(0,w.jsx)(Y,{bodyClassName:`h-[100px] w-full`})]})]})]})}var $e=.16;function et(e){return e*e*(3-2*e)}function tt(e,t,n){return e<t?t:e>n?n:e}function X(e,t=new Float32Array(512)){let n=e.length;if(n===0)return t.fill(0),t;for(let r=0;r<512;r++){let i=tt(r/511*n-.5,0,n-1),a=Math.min(n-2,Math.floor(i));if(a<0){t[r]=e[0];continue}let o=et(i-a);t[r]=e[a]*(1-o)+e[a+1]*o}return t}function nt(e,t){let n=tt(t,0,1)*511,r=Math.min(510,Math.floor(n)),i=n-r;return e[r]*(1-i)+e[r+1]*i}function rt(e,t){return 1-(t>0?Math.min(1,e/t):0)*.84}var it=2,at=460,ot=180,Z=32,st=.06,ct=.24,lt=/oklch\(\s*([\d.]+)\s+([\d.]+)\s+([\d.]+)/;function ut(e){let t=Math.imul(e^2654435769,2246822507);return t=Math.imul(t^t>>>13,3266489909),((t^t>>>16)>>>0)/4294967296}function dt(e,t){let n=lt.exec(e),r=lt.exec(t);if(!n||!r)return Array.from({length:33},()=>t);let[i,a,o]=[Number(n[1]),Number(n[2]),Number(n[3])],[s,c,l]=[Number(r[1]),Number(r[2]),Number(r[3])];return Array.from({length:33},(e,t)=>{let n=t/Z,r=i+(s-i)*n,u=a+(c-a)*n,d=o+(l-o)*n;return`oklch(${r.toFixed(3)} ${u.toFixed(3)} ${d.toFixed(1)})`})}function ft(e,{values:t,max:n,reducedMotion:r}){let i=(0,S.useContext)(m),a=I(e,r),o=(0,S.useRef)({from:X(t),to:X(t),current:X(t),fromMax:n,toMax:n,currentMax:n,startedAt:0,duration:0}),s=(0,S.useRef)(null),c=(0,S.useRef)(()=>{}),l=(0,S.useRef)({x:-1e4,y:-1e4,smoothX:-1e4,smoothY:-1e4,speed:0,inside:!1});(0,S.useEffect)(()=>{let e=o.current;e.from.set(e.current),e.fromMax=e.currentMax,X(t,e.to),e.toMax=n,e.startedAt=performance.now(),e.duration=r?0:at,r?c.current():a.requestFrame()},[a,n,r,t]),(0,S.useEffect)(()=>{let t=e.current,n=t?.parentElement,i=t?.getContext(`2d`);if(!t||!n||!i)return;let u=l.current,d=getComputedStyle(t),f=d.getPropertyValue(`--tile-rest`).trim(),p=dt(d.getPropertyValue(`--tile-wash`).trim(),d.getPropertyValue(`--tile-ink`).trim()),m=()=>{let e=n.clientWidth,r=n.clientHeight;if(!e||!r)return;let a=n.getBoundingClientRect(),o=Math.min(it,window.devicePixelRatio||1);t.width=Math.round(e*o),t.height=Math.round(r*o),t.style.width=`${e}px`,t.style.height=`${r}px`,i.setTransform(o,0,0,o,0,0),i.imageSmoothingEnabled=!1;let c=Math.max(3,Math.round(e/ot)),l=Math.ceil(e/c),u=Math.ceil(r/c),d=l*u,f=new Uint8Array(d);for(let e=0;e<d;e++)f[e]=+(ut(e)<st);s.current={cell:c,cols:l,rows:u,width:e,height:r,left:a.left,top:a.top,step:1/o,glow:new Float32Array(d),spark:f}},h=e=>{let t=o.current,n=t.duration>0?Math.min(1,(e-t.startedAt)/t.duration):1;for(let e=0;e<512;e++)t.current[e]=t.from[e]+(t.to[e]-t.from[e])*n;return t.currentMax=t.fromMax+(t.toMax-t.fromMax)*n,n>=1&&(t.duration=0),n<1},g=e=>{let t=l.current,n=t.smoothX,r=t.smoothY,i=1-.72**e;t.smoothX+=(t.x-n)*i,t.smoothY+=(t.y-r)*i,t.speed=Math.hypot(t.smoothX-n,t.smoothY-r)},_=(e,t=1)=>{let n=s.current;if(!n)return!1;let a=o.current,{cell:c,cols:u,rows:d,width:m,height:h,step:g,glow:_,spark:v}=n,y=e=>Math.round(e/g)*g,b=Math.max(g,y(c*.34)),x=y((c-b)/2);i.clearRect(0,0,m,h),i.fillStyle=f;for(let e=0;e<u;e++){let t=e*c+x;for(let e=0;e<d;e++)i.fillRect(t,e*c+x,b,b)}let S=l.current,C=h*(ct+Math.min(1,S.speed/25)*.26),w=!r&&S.inside,T=1-.78**t,E=1-.95**t,D=e*.0018,O=-1,k=!1;for(let t=0;t<u;t++){let n=u>1?(t+.5)/u:.5,o=rt(nt(a.current,n),a.currentMax),s=Math.max(.001,1-o),l=t*c,m=l+c/2;for(let n=0;n<d;n++){let a=t*d+n,u=n*c,b=(u+c/2)/h,x=0;b>=o&&(x=1-.55*((b-o)/s));let A=_[a];if(w){let e=Math.hypot(m-S.smoothX,u+c/2-S.smoothY),t=e<C?1-e/C:0;A+=(t-A)*(t>A?T:E),_[a]=A}else A>0&&(A*=1-E,_[a]=A<.002?0:A);_[a]>0&&(k=!0);let j=Math.min(1,x+A*.5);if(j<=.02)continue;let M=j;r||(M*=1+.07*Math.sin(b*Math.PI*3-D),v[a]&&A>.02&&(M*=1+.25*A*Math.sin(e*.012+a)),M=Math.min(1,M));let N=Math.max(g,y(c*(.28+.42*j))),P=y((c-N)/2),F=Math.round(M*Z);F!==O&&(O=F,i.fillStyle=p[O]??p[Z]??f),i.fillRect(l+P,u+P,N,N)}}return k},v=()=>{m(),h(performance.now()),_(performance.now())};c.current=v;let y=e=>{let t=s.current;if(!t)return;let r=l.current;if(!r.inside){let e=n.getBoundingClientRect();t.left=e.left,t.top=e.top}r.x=e.clientX-t.left,r.y=e.clientY-t.top,r.inside||(r.smoothX=r.x,r.smoothY=r.y),r.inside=!0,a.requestFrame()},b=()=>{l.current.inside=!1,a.requestFrame()},x=0;a.setFrameHandler(e=>{let t=x===0?1:Math.min(3,(e-x)/(1e3/60));x=e;let n=h(e);g(t);let r=_(e,t);return n?`active`:l.current.inside||r?`idle`:(x=0,`stop`)}),m();let S=new ResizeObserver(()=>{m(),r?(h(performance.now()),_(performance.now())):a.requestFrame()});return S.observe(n),r?v():(n.addEventListener(`pointermove`,y,{passive:!0}),n.addEventListener(`pointerleave`,b)),()=>{a.setFrameHandler(null),S.disconnect(),n.removeEventListener(`pointermove`,y),n.removeEventListener(`pointerleave`,b),u.inside=!1}},[e,a,r,i])}var pt=[1,.66,.33,0],mt=e=>`${(1-e*(1-$e))*100}%`,ht=(e,t)=>(e+.5)/t*100;function gt({values:e,max:t,labels:n,formatValue:r}){let[i,a]=(0,S.useState)(null),o=(0,S.useRef)(null),s=R(),c=t=>{let n=o.current?.getBoundingClientRect();if(!n?.width)return;let r=(t-n.left)/n.width,i=Math.round(r*e.length-.5);a(Math.min(e.length-1,Math.max(0,i)))},l=i!==null,u=i??0,f=e[u]??0,p=s?void 0:`left 260ms ease-out, top 260ms ease-out`;return(0,w.jsxs)(`div`,{ref:o,className:`absolute inset-0 cursor-crosshair touch-none`,onPointerMove:e=>c(e.clientX),onPointerLeave:()=>a(null),children:[(0,w.jsx)(`span`,{className:d(`pointer-events-none absolute inset-y-0 w-px -translate-x-1/2 bg-[var(--brand-line)] transition-opacity duration-150`,l?`opacity-100`:`opacity-0`),style:{left:`${ht(u,e.length)}%`,transition:p}}),(0,w.jsxs)(`div`,{className:d(`pointer-events-none absolute size-0 transition-opacity duration-150`,l?`opacity-100`:`opacity-0`),style:{left:`${ht(u,e.length)}%`,top:`${rt(f,t)*100}%`,transition:p},children:[(0,w.jsx)(`span`,{className:`absolute size-[9px] -translate-x-1/2 -translate-y-1/2 rounded-full bg-[var(--brand)] ring-2 ring-[var(--console-surface)]`}),(0,w.jsxs)(`span`,{className:`console-mono absolute bottom-3 flex -translate-x-1/2 items-baseline gap-1.5 rounded-md border border-[var(--console-border)] bg-[var(--console-surface)] px-2 py-1 whitespace-nowrap shadow-[var(--shadow-overlay)]`,children:[(0,w.jsx)(`span`,{className:`text-[10px] text-[var(--console-muted)]`,children:n[u]}),(0,w.jsx)(`span`,{className:`text-[12px] font-semibold text-[var(--console-text)]`,children:r(f)})]})]})]})}function _t({values:e,max:t,labels:n,height:r,formatValue:i,formatTick:a,className:o}){let s=(0,S.useRef)(null);return ft(s,{values:e,max:t,reducedMotion:R()}),(0,w.jsxs)(`div`,{className:d(`flex`,o),"aria-hidden":!0,children:[a?(0,w.jsx)(`div`,{className:`relative shrink-0`,style:{height:r,width:38},children:pt.map(e=>(0,w.jsx)(`span`,{className:`console-mono absolute right-2 -translate-y-1/2 text-[9.5px] whitespace-nowrap text-[var(--console-muted)]`,style:{top:mt(e)},children:a(t*e)},e))}):null,(0,w.jsxs)(`div`,{className:`chart-hatch relative min-w-0 flex-1`,style:{height:r},children:[pt.map(e=>(0,w.jsx)(`span`,{className:d(`pointer-events-none absolute inset-x-0`,e===0?`h-px bg-[var(--console-border-strong)]`:`border-t border-dashed border-[var(--console-border)]`),style:{top:mt(e)}},e)),(0,w.jsx)(`canvas`,{ref:s,className:`absolute inset-0 block`}),e.length>0?(0,w.jsx)(gt,{values:e,max:t,labels:n,formatValue:i}):null]})]})}var vt=168,yt=132,bt=6,xt={barRatio:.86,barMax:46,bandGap:2,minBand:3},Q=[{key:`input`,label:`Input`,color:`var(--token-input)`},{key:`output`,label:`Output`,color:`var(--token-output)`},{key:`cache_read`,label:`Cache read`,color:`var(--token-cache-read)`},{key:`cache_create`,label:`Cache write`,color:`var(--token-cache-write)`}],St=Q.map(e=>e.color);function Ct(e){return e>=1e3?`$${o(e)}`:`$${Math.round(e)}`}function $(e){return e.input+e.output+e.cache_read+e.cache_create}function wt(e){return x(`{0}: {1} tokens, {2}, {3} sessions, {4} messages, input {5}, output {6}, cache read {7}, cache write {8}`,[f(e.date),o($(e)),a(e.cost),u(e.sessions),u(e.messages),o(e.input),o(e.output),o(e.cache_read),o(e.cache_create)])}function Tt({daily:e}){b();let t=(0,S.useMemo)(()=>e.map(e=>e.cost),[e]),n=(0,S.useMemo)(()=>e.map(e=>f(e.date)),[e]),r=t.reduce((e,t)=>e+t,0),i=t.reduce((e,t)=>Math.max(e,t),0);return i<=0?null:(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{className:`mt-[14px] flex items-baseline justify-between border-t border-dashed border-[var(--console-border)] pt-[11px]`,children:[(0,w.jsx)(`span`,{className:`console-mono text-[10.5px] text-[var(--console-text)]`,children:x(`Daily cost`)}),(0,w.jsxs)(`span`,{className:`console-mono text-[10px] text-[var(--console-muted)]`,children:[x(`Peak`),` `,a(i),` `,x(`· Avg`),` `,a(r/e.length),` `,x(`· Total`),` `,a(r)]})]}),(0,w.jsx)(_t,{values:t,max:i,labels:n,height:yt,formatValue:a,formatTick:Ct,className:`mt-[7px]`})]})}function Et({bucket:e,index:t,count:n}){return b(),(0,w.jsxs)(T,{index:t,count:n,children:[(0,w.jsx)(`div`,{children:f(e.date)}),(0,w.jsxs)(`div`,{children:[o($(e)),` `,x(`tok ·`),` `,(0,w.jsx)(`span`,{className:`text-[var(--brand)]`,children:a(e.cost)})]}),(0,w.jsxs)(`div`,{children:[u(e.sessions),` `,x(`sessions ·`),` `,u(e.messages),` `,x(`messages`)]}),(0,w.jsxs)(`div`,{className:`text-[var(--console-muted)]`,children:[x(`In`),` `,o(e.input),` `,x(`· Out`),` `,o(e.output),` `,x(`· Read`),` `,o(e.cache_read),` `,x(`· Write`),` `,o(e.cache_create)]})]})}function Dt({daily:e}){let t=b(),[n,r]=(0,S.useState)(null),i=(0,S.useMemo)(()=>e.map(e=>Q.map(t=>e[t.key])),[e]),a=(0,S.useMemo)(()=>e.map(wt),[t,e]),s=(0,S.useMemo)(()=>j(e.reduce((e,t)=>Math.max(e,$(t)),0)),[e]),c=n===null?void 0:e[n.column];return(0,w.jsxs)(`div`,{className:`relative mt-[14px]`,children:[(0,w.jsx)(ve,{values:i,axisMax:s,colors:St,hovered:n,onHover:r,layout:xt,height:vt,formatTick:o,ariaLabel:x(`Daily usage chart`),itemLabels:a}),c&&n?(0,w.jsx)(`div`,{className:`absolute inset-x-0 top-0`,style:{left:38},children:(0,w.jsx)(Et,{bucket:c,index:n.column,count:e.length})}):null]})}function Ot({daily:e}){b();let t=e[0],n=e[e.length-1],r=t&&n?` · ${f(t.date)} → ${f(n.date)}`:``,i=Math.max(1,Math.ceil(e.length/bt));return(0,w.jsxs)(p,{role:`region`,"aria-label":x(`Daily usage`),className:`p-4`,children:[(0,w.jsx)(_,{title:x(`Daily usage`),action:(0,w.jsx)(`div`,{className:`console-mono flex flex-wrap items-center gap-x-3 gap-y-1 text-[10px] text-[var(--console-muted)]`,children:Q.map(e=>(0,w.jsxs)(`span`,{"data-testid":`overview-legend-token`,className:`flex items-center gap-1`,children:[(0,w.jsx)(`span`,{className:`size-2 rounded-[2px]`,style:{background:e.color},"aria-hidden":!0}),x(e.label)]},e.key))})}),(0,w.jsxs)(`p`,{className:`console-mono mt-1 text-[10.5px] text-[var(--console-muted)]`,children:[x(`Stacked bars = token mix · Area below = daily cost`),r]}),e.length===0?(0,w.jsx)(`p`,{className:`console-mono mt-[14px] text-[11px] text-[var(--console-muted)]`,children:x(`No usage data`)}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Dt,{daily:e}),(0,w.jsx)(Tt,{daily:e}),(0,w.jsx)(`div`,{style:{paddingLeft:38},children:(0,w.jsx)(`div`,{className:`console-mono mt-2 flex text-[10px] text-[var(--console-muted)]`,children:e.map((t,n)=>(0,w.jsx)(`span`,{className:`flex-1 text-center`,children:n%i===0||n===e.length-1?f(t.date):``},t.date))})})]}),(0,w.jsxs)(`table`,{className:`sr-only`,"aria-label":x(`Daily usage data`),children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{children:[(0,w.jsx)(`th`,{children:x(`Date`)}),(0,w.jsx)(`th`,{children:x(`Sessions`)}),(0,w.jsx)(`th`,{children:x(`Messages`)}),(0,w.jsx)(`th`,{children:x(`Tokens`)}),(0,w.jsx)(`th`,{children:x(`Cost`)})]})}),(0,w.jsx)(`tbody`,{children:e.map(e=>(0,w.jsxs)(`tr`,{children:[(0,w.jsx)(`td`,{children:f(e.date)}),(0,w.jsx)(`td`,{children:u(e.sessions)}),(0,w.jsx)(`td`,{children:u(e.messages)}),(0,w.jsx)(`td`,{children:u($(e))}),(0,w.jsx)(`td`,{children:a(e.cost)})]},e.date))})]})]})}function kt({project:e,agent:t,onAgentChange:n,window:r,agentCatalog:i,rangePreset:a,onRangeChange:o,onSelectCustom:s}){b();let[c,l]=(0,S.useState)(void 0),u=n?t:c,{dashboard:d,error:f,retry:p}=C(r,{project:e,agent:u});return(0,w.jsxs)(`div`,{"data-testid":`dashboard`,className:`mx-auto max-w-6xl space-y-4`,children:[(0,w.jsx)(Ge,{agent:u,onAgentChange:n?void 0:l,agentCatalog:i,scopeCounts:d?.scopeCounts,window:r,rangePreset:a,onRangeChange:o,onSelectCustom:s}),f?(0,w.jsx)(v,{title:x(`Couldn't load the dashboard.`),message:f,onRetry:()=>void p()}):null,d?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Xe,{totals:d.totals,rangeDays:d.window.days}),(0,w.jsx)(Ot,{daily:d.dailyActivity}),(0,w.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,w.jsx)(Se,{perAgent:d.perAgent}),(0,w.jsx)(Ue,{modelCost:d.modelCost,modelDistribution:d.modelDistribution,totals:d.totals})]})]}):f?null:(0,w.jsx)(Qe,{})]})}export{kt as OverviewScreen};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e,n as t,t as n}from"./jsx-runtime-B-hcVAMW.js";import{a as r,c as i,i as a,n as o,o as s,r as c,s as l,t as u}from"./SessionDetail-
|
|
1
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-B-hcVAMW.js";import{a as r,c as i,i as a,n as o,o as s,r as c,s as l,t as u}from"./SessionDetail-D8taQ6Tl.js";function d(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function f(e,t){if(e==null)return{};var n,r,i=d(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function p(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function m(e){if(Array.isArray(e))return p(e)}function h(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function g(e,t){if(e){if(typeof e==`string`)return p(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(e,t):void 0}}function _(){throw TypeError(`Invalid attempt to spread non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function v(e){return m(e)||h(e)||g(e)||_()}function y(e){"@babel/helpers - typeof";return y=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},y(e)}function b(e,t){if(y(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(y(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function x(e){var t=b(e,`string`);return y(t)==`symbol`?t:t+``}function S(e,t,n){return(t=x(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var C=e(t());function w(){return w=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},w.apply(null,arguments)}function T(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function E(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?T(Object(n),!0).forEach(function(t){S(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):T(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function D(e){var t=e.length;if(t===0||t===1)return e;if(t===2)return[e[0],e[1],`${e[0]}.${e[1]}`,`${e[1]}.${e[0]}`];if(t===3)return[e[0],e[1],e[2],`${e[0]}.${e[1]}`,`${e[0]}.${e[2]}`,`${e[1]}.${e[0]}`,`${e[1]}.${e[2]}`,`${e[2]}.${e[0]}`,`${e[2]}.${e[1]}`,`${e[0]}.${e[1]}.${e[2]}`,`${e[0]}.${e[2]}.${e[1]}`,`${e[1]}.${e[0]}.${e[2]}`,`${e[1]}.${e[2]}.${e[0]}`,`${e[2]}.${e[0]}.${e[1]}`,`${e[2]}.${e[1]}.${e[0]}`];if(t>=4)return[e[0],e[1],e[2],e[3],`${e[0]}.${e[1]}`,`${e[0]}.${e[2]}`,`${e[0]}.${e[3]}`,`${e[1]}.${e[0]}`,`${e[1]}.${e[2]}`,`${e[1]}.${e[3]}`,`${e[2]}.${e[0]}`,`${e[2]}.${e[1]}`,`${e[2]}.${e[3]}`,`${e[3]}.${e[0]}`,`${e[3]}.${e[1]}`,`${e[3]}.${e[2]}`,`${e[0]}.${e[1]}.${e[2]}`,`${e[0]}.${e[1]}.${e[3]}`,`${e[0]}.${e[2]}.${e[1]}`,`${e[0]}.${e[2]}.${e[3]}`,`${e[0]}.${e[3]}.${e[1]}`,`${e[0]}.${e[3]}.${e[2]}`,`${e[1]}.${e[0]}.${e[2]}`,`${e[1]}.${e[0]}.${e[3]}`,`${e[1]}.${e[2]}.${e[0]}`,`${e[1]}.${e[2]}.${e[3]}`,`${e[1]}.${e[3]}.${e[0]}`,`${e[1]}.${e[3]}.${e[2]}`,`${e[2]}.${e[0]}.${e[1]}`,`${e[2]}.${e[0]}.${e[3]}`,`${e[2]}.${e[1]}.${e[0]}`,`${e[2]}.${e[1]}.${e[3]}`,`${e[2]}.${e[3]}.${e[0]}`,`${e[2]}.${e[3]}.${e[1]}`,`${e[3]}.${e[0]}.${e[1]}`,`${e[3]}.${e[0]}.${e[2]}`,`${e[3]}.${e[1]}.${e[0]}`,`${e[3]}.${e[1]}.${e[2]}`,`${e[3]}.${e[2]}.${e[0]}`,`${e[3]}.${e[2]}.${e[1]}`,`${e[0]}.${e[1]}.${e[2]}.${e[3]}`,`${e[0]}.${e[1]}.${e[3]}.${e[2]}`,`${e[0]}.${e[2]}.${e[1]}.${e[3]}`,`${e[0]}.${e[2]}.${e[3]}.${e[1]}`,`${e[0]}.${e[3]}.${e[1]}.${e[2]}`,`${e[0]}.${e[3]}.${e[2]}.${e[1]}`,`${e[1]}.${e[0]}.${e[2]}.${e[3]}`,`${e[1]}.${e[0]}.${e[3]}.${e[2]}`,`${e[1]}.${e[2]}.${e[0]}.${e[3]}`,`${e[1]}.${e[2]}.${e[3]}.${e[0]}`,`${e[1]}.${e[3]}.${e[0]}.${e[2]}`,`${e[1]}.${e[3]}.${e[2]}.${e[0]}`,`${e[2]}.${e[0]}.${e[1]}.${e[3]}`,`${e[2]}.${e[0]}.${e[3]}.${e[1]}`,`${e[2]}.${e[1]}.${e[0]}.${e[3]}`,`${e[2]}.${e[1]}.${e[3]}.${e[0]}`,`${e[2]}.${e[3]}.${e[0]}.${e[1]}`,`${e[2]}.${e[3]}.${e[1]}.${e[0]}`,`${e[3]}.${e[0]}.${e[1]}.${e[2]}`,`${e[3]}.${e[0]}.${e[2]}.${e[1]}`,`${e[3]}.${e[1]}.${e[0]}.${e[2]}`,`${e[3]}.${e[1]}.${e[2]}.${e[0]}`,`${e[3]}.${e[2]}.${e[0]}.${e[1]}`,`${e[3]}.${e[2]}.${e[1]}.${e[0]}`]}var O={};function k(e){if(e.length===0||e.length===1)return e;var t=e.join(`.`);return O[t]||(O[t]=D(e)),O[t]}function A(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;return k(e.filter(function(e){return e!==`token`})).reduce(function(e,t){return E(E({},e),n[t])},t)}function j(e){return e.join(` `)}function M(e,t){var n=0;return function(r){return n+=1,r.map(function(r,i){return N({node:r,stylesheet:e,useInlineStyles:t,key:`code-segment-${n}-${i}`})})}}function N(e){var t=e.node,n=e.stylesheet,r=e.style,i=r===void 0?{}:r,a=e.useInlineStyles,o=e.key,s=t.properties,c=t.type,l=t.tagName,u=t.value;if(c===`text`)return u;if(l){var d=M(n,a),f;if(!a)f=E(E({},s),{},{className:j(s.className)});else{var p=Object.keys(n).reduce(function(e,t){return t.split(`.`).forEach(function(t){e.includes(t)||e.push(t)}),e},[]),m=s.className&&s.className.includes(`token`)?[`token`]:[],h=s.className&&m.concat(s.className.filter(function(e){return!p.includes(e)}));f=E(E({},s),{},{className:j(h)||void 0,style:A(s.className,Object.assign({},s.style,i),n)})}var g=d(t.children);return C.createElement(l,w({key:o},f),g)}}var ee=(function(e,t){return e.listLanguages().indexOf(t)!==-1}),te=[`language`,`children`,`style`,`customStyle`,`codeTagProps`,`useInlineStyles`,`showLineNumbers`,`showInlineLineNumbers`,`startingLineNumber`,`lineNumberContainerStyle`,`lineNumberStyle`,`wrapLines`,`wrapLongLines`,`lineProps`,`renderer`,`PreTag`,`CodeTag`,`code`,`astGenerator`];function P(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function F(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?P(Object(n),!0).forEach(function(t){S(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):P(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var I=/\n/g;function L(e){return e.match(I)}function ne(e){var t=e.lines,n=e.startingLineNumber,r=e.style;return t.map(function(e,t){var i=t+n;return C.createElement(`span`,{key:`line-${t}`,className:`react-syntax-highlighter-line-number`,style:typeof r==`function`?r(i):r},`${i}
|
|
3
3
|
`)})}function re(e){var t=e.codeString,n=e.codeStyle,r=e.containerStyle,i=r===void 0?{float:`left`,paddingRight:`10px`}:r,a=e.numberStyle,o=a===void 0?{}:a,s=e.startingLineNumber;return C.createElement(`code`,{style:Object.assign({},n,i)},ne({lines:t.replace(/\n$/,``).split(`
|
|
4
4
|
`),style:o,startingLineNumber:s}))}function ie(e){return`${e.toString().length}.25em`}function R(e,t){return{type:`element`,tagName:`span`,properties:{key:`line-number--${e}`,className:[`comment`,`linenumber`,`react-syntax-highlighter-line-number`],style:t},children:[{type:`text`,value:e}]}}function z(e,t,n){var r={display:`inline-block`,minWidth:ie(n),paddingRight:`1em`,textAlign:`right`,userSelect:`none`},i=typeof e==`function`?e(t):e;return F(F({},r),i)}function B(e){var t=e.children,n=e.lineNumber,r=e.lineNumberStyle,i=e.largestLineNumber,a=e.showInlineLineNumbers,o=e.lineProps,s=o===void 0?{}:o,c=e.className,l=c===void 0?[]:c,u=e.showLineNumbers,d=e.wrapLongLines,f=e.wrapLines,p=f!==void 0&&f?F({},typeof s==`function`?s(n):s):{};if(p.className=p.className?[].concat(v(p.className.trim().split(/\s+/)),v(l)):l,n&&a){var m=z(r,n,i);t.unshift(R(n,m))}return d&u&&(p.style=F({display:`flex`},p.style)),{type:`element`,tagName:`span`,properties:p,children:t}}function V(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];e.length===void 0&&(e=[e]);for(var r=0;r<e.length;r++){var i=e[r];if(i.type===`text`)n.push(B({children:[i],className:v(new Set(t))}));else if(i.children){var a=t.concat(i.properties?.className||[]);V(i.children,a).forEach(function(e){return n.push(e)})}}return n}function ae(e,t,n,r,i,a,o,s,c){var l,u=V(e.value),d=[],f=-1,p=0;function m(e,a){return B({children:e,lineNumber:a,lineNumberStyle:s,largestLineNumber:o,showInlineLineNumbers:i,lineProps:n,className:arguments.length>2&&arguments[2]!==void 0?arguments[2]:[],showLineNumbers:r,wrapLongLines:c,wrapLines:t})}function h(e,t){if(r&&t&&i){var n=z(s,t,o);e.unshift(R(t,n))}return e}function g(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return t||r.length>0?m(e,n,r):h(e,n)}for(var _=function(){var e=u[p],t=e.children[0].value;if(L(t)){var n=t.split(`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-B-hcVAMW.js";import{d as r,g as i,i as a,l as o,m as s,n as c,r as l,s as u,t as d,u as f}from"./utils-Bk66u8b3.js";import{a as p,s as m}from"./CustomTimeWindowDialog-D2bx7uDv.js";import{S as h,_ as g,c as _,j as v,n as y,t as b,u as x,v as S}from"./translate-Dmym1ZDl.js";import{a as C,o as w,p as T}from"./session-indexes-fib48ZKn.js";import{H as E,U as D,W as O}from"./index-XpolWMY4.js";import{OverviewScreen as k}from"./OverviewScreen-D_KXfiJi.js";var A=e(t(),1);function j(e){return e.time_updated??e.time_created}function M(e){return e.reference}function N(e,t){let n=h(t);if(e===n)return b(`Today`);if(e===_(n,-1))return b(`Yesterday`);let r=new Date(e);return f(r.getTime())}function P(e){let{session:t}=e,n=M(t);return{routeKey:g(n.agentName,n.sessionId),reference:n,time:j(t),title:E(t),messageCount:t.stats.message_count,cost:t.stats.total_cost??0}}function F(e,t){if(t.length===1){e.push(t[0]);return}let n=t.toSorted((e,t)=>j(e.session)-j(t.session));for(let t=n.length-1;t>=0;--t)e.push(n[t])}function I(e,t,n){if(!Number.isSafeInteger(e)||e<0)throw RangeError(`page total must be a non-negative safe integer`);if(!Number.isSafeInteger(n)||n<=0)throw RangeError(`page limit must be a positive safe integer`);if(e===0)return{offset:0,end:0};let r=Number.isSafeInteger(t)&&t>0?t:0,i=r-r%n,a=Math.floor((e-1)/n)*n,o=Math.min(i,a);return{offset:o,end:o+Math.min(n,e-o)}}function L(e,t){let{session:n,inclusiveStats:r}=e,i=M(n);return{routeKey:g(i.agentName,i.sessionId),reference:i,time:j(n),title:E(n),agentKey:i.agentName,childCount:e.descendantCount,childRoots:e.children,messageCount:r.messageCount,tokens:r.totalTokens,cost:r.cost,isOrphan:t}}function R(e,t=0,n=40){let{offset:r,end:i}=I(e.childCount,t,n),a=[],o=[];F(o,e.childRoots);let s=0;for(;o.length>0&&s<i;){let e=o.pop();s>=r&&a.push(P(e)),s+=1,F(o,e.children)}return{rows:a,offset:r,pageNumber:Math.floor(r/n)+1,hasPrevious:r>0,hasNext:i<e.childCount}}function z(e,t=0,n=40){let{offset:r,end:i}=I(e.mainCount,t,n),a=i-r,o=[],s=0,c=0;for(let t of e.days){if(c===a)break;let e=Math.max(0,r-s);if(s+=t.nodes.length,e>=t.nodes.length)continue;let n=t.nodes.slice(e,e+a-c);if(n.length===0)continue;let i=n.map(e=>L(e,e.session.parent_reference!=null));o.push({dayKey:t.dayKey,dayStart:t.dayStart,label:t.label,mainCount:t.mainCount,subCount:t.subCount,rows:i}),c+=i.length}return{days:o,offset:r,pageNumber:Math.floor(r/n)+1,shown:c,hasPrevious:r>0,hasNext:i<e.mainCount}}function B(e,t){let n=x(e),r=t?.now??Date.now();return{days:S(n.entries).map(e=>({dayKey:e.dayKey,dayStart:e.dayStart,label:N(e.dayStart,r),mainCount:e.mainCount,subCount:e.subCount,nodes:e.nodes})),orphanCount:n.orphans.length,mainCount:n.entries.length,subCount:n.entries.reduce((e,t)=>e+t.descendantCount,0),totalTokens:n.entries.reduce((e,t)=>e+t.inclusiveStats.totalTokens,0)}}function V(e,t,n){return t===`hidden`||e.childCount===0?!1:t===`expanded`||n.has(e.routeKey)}var H=n(),U={sm:`px-2 py-[3px] text-[10.5px]`,md:`px-3 py-[5px] text-xs`};function W({options:e,value:t,onChange:n,size:r=`md`,ariaLabel:i}){let a=(0,A.useRef)([]),o=e.findIndex(e=>e.value===t),s=o<0?0:o,c=(t,r)=>{let i=(t+r+e.length)%e.length;n(e[i].value),a.current[i]?.focus()};return(0,H.jsx)(`div`,{role:`radiogroup`,"aria-label":i,className:`inline-flex rounded-md border border-[var(--console-border)] bg-[var(--console-surface)] p-[3px]`,children:e.map((e,t)=>{let i=t===o;return(0,H.jsx)(`button`,{ref:e=>{a.current[t]=e},type:`button`,role:`radio`,"aria-checked":i,tabIndex:t===s?0:-1,onClick:()=>n(e.value),onKeyDown:e=>{e.key===`ArrowRight`||e.key===`ArrowDown`?(e.preventDefault(),c(t,1)):(e.key===`ArrowLeft`||e.key===`ArrowUp`)&&(e.preventDefault(),c(t,-1))},className:d(`console-mono motion-hover rounded-sm border border-transparent whitespace-nowrap focus-visible:ring-2 focus-visible:ring-[var(--brand)] focus-visible:outline-none`,U[r],i?`bg-[var(--brand)] text-[var(--brand-fg)]`:`text-[var(--console-muted)] hover:text-[var(--console-text)]`),children:e.label},e.value)})})}var G=[{value:`collapsed`,label:`Collapsed`},{value:`expanded`,label:`Expand all`},{value:`hidden`,label:`Hidden`}];function K({mode:e,onChange:t}){return y(),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`console-eyebrow`,children:b(`Sub-sessions`)}),(0,H.jsx)(W,{options:G.map(e=>({...e,label:b(e.label)})),value:e,onChange:t,size:`sm`,ariaLabel:b(`Sub-session display`)})]})}function q({id:e,row:t,onOpen:n}){y();let[r,a]=(0,A.useState)(0),o=(0,A.useMemo)(()=>R(t,r),[r,t]);return(0,H.jsxs)(`div`,{id:e,className:`border-t border-dashed border-[var(--console-border-strong)] bg-[var(--console-surface-muted)] p-[10px_16px_12px_66px]`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,H.jsx)(`span`,{className:`console-eyebrow`,children:b(`Sub-sessions · derived from this session`)}),t.childCount>40?(0,H.jsx)(`span`,{className:`console-mono text-[10px] text-[var(--console-muted)]`,children:b(`Page {0} · {1} shown`,[o.pageNumber,o.rows.length])}):null]}),(0,H.jsx)(`div`,{className:`mt-2 flex flex-col gap-1.5 border-l border-dashed border-[var(--console-border-strong)] pl-[14px]`,children:o.rows.map(e=>(0,H.jsxs)(`button`,{type:`button`,onClick:()=>n(e.reference),className:`motion-hover flex items-center gap-[11px] rounded-md border border-[var(--console-border)] bg-[var(--console-surface)] p-[9px_12px] text-left hover:border-[var(--console-border-strong)] focus-visible:ring-2 focus-visible:ring-[var(--brand)] focus-visible:outline-none`,children:[(0,H.jsx)(`span`,{className:`console-mono w-[34px] shrink-0 text-[10px] text-[var(--console-muted)]`,children:l(e.time)}),e.kind==null?null:(0,H.jsx)(`span`,{className:`console-mono shrink-0 rounded-sm border border-[var(--console-border)] px-1.5 text-[9.5px] text-[var(--console-muted)]`,children:e.kind}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[12.5px] text-[var(--console-text)]`,children:e.title}),(0,H.jsxs)(`span`,{className:`console-mono shrink-0 text-[10px] text-[var(--console-muted)]`,children:[u(e.messageCount),` `,b(`msgs ·`),` `,i(e.cost)]})]},e.routeKey))}),o.hasPrevious||o.hasNext?(0,H.jsxs)(`div`,{className:`mt-2 flex justify-end gap-2`,children:[(0,H.jsx)(`button`,{type:`button`,"aria-label":b(`Previous sub-session page`),disabled:!o.hasPrevious,onClick:()=>a(o.offset-40),className:`console-mono rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] px-2 py-1 text-[10px] text-[var(--console-text)] motion-hover hover:bg-[var(--console-surface-muted)] focus-visible:ring-2 focus-visible:ring-[var(--brand)] focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-40`,children:b(`Previous`)}),(0,H.jsx)(`button`,{type:`button`,"aria-label":b(`Next sub-session page`),disabled:!o.hasNext,onClick:()=>a(o.offset+40),className:`console-mono rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] px-2 py-1 text-[10px] text-[var(--console-text)] motion-hover hover:bg-[var(--console-surface-muted)] focus-visible:ring-2 focus-visible:ring-[var(--brand)] focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-40`,children:b(`Next`)})]}):null]})}function J({row:e,mode:t,expanded:n,agentCatalog:r,onToggle:o,onOpen:s}){y();let d=(0,A.useId)(),f=O(r,e.agentKey),p=f?.displayName??e.agentKey,m=e.childCount>0;return(0,H.jsxs)(`article`,{className:`overflow-hidden rounded-lg border bg-[var(--console-surface)] shadow-[var(--shadow-raised)] ${n?`border-[var(--brand-line)]`:`border-[var(--console-border)]`}`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-[13px] p-[13px_16px]`,children:[(0,H.jsx)(`span`,{className:`console-mono w-[38px] shrink-0 text-[11px] text-[var(--console-muted)]`,children:l(e.time)}),e.isOrphan?(0,H.jsx)(`span`,{className:`console-mono shrink-0 rounded-sm border border-[var(--console-border-strong)] px-1.5 text-[9.5px] text-[var(--console-muted)]`,children:b(`Unmounted`)}):null,(0,H.jsx)(`span`,{className:`inline-flex size-6 shrink-0 items-center justify-center rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)]`,children:f?.icon?(0,H.jsx)(c,{icon:f.icon,iconColored:f.iconColored,alt:p,className:`size-[13px] object-contain`}):null}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>s(e.reference),className:`min-w-0 flex-1 text-left focus-visible:ring-2 focus-visible:ring-[var(--brand)] focus-visible:outline-none`,children:[(0,H.jsx)(`span`,{className:`block truncate text-[13.5px] font-medium text-[var(--console-text)]`,children:e.title}),(0,H.jsxs)(`span`,{className:`console-mono mt-[3px] block truncate text-[10.5px] text-[var(--console-muted)]`,children:[p,` · `,u(e.messageCount),` `,b(`msgs ·`),` `,a(e.tokens),` `,b(`tok`),` `,m?b(` · {0} sub-sessions`,[e.childCount]):``]})]}),m&&t!==`hidden`?(0,H.jsxs)(`button`,{type:`button`,"aria-expanded":n,"aria-controls":d,onClick:()=>o(e.routeKey),className:`console-mono motion-hover inline-flex shrink-0 items-center gap-1.5 rounded-full border border-[var(--brand-line)] bg-[var(--brand-soft)] px-2.5 py-[3px] text-[10.5px] text-[var(--brand)] focus-visible:ring-2 focus-visible:ring-[var(--brand)] focus-visible:outline-none`,children:[(0,H.jsx)(`span`,{className:`text-[11px]`,children:`⑂`}),e.childCount,` `,b(`sub`),` `,(0,H.jsx)(`span`,{className:`opacity-70`,children:n?`▾`:`▸`})]}):null,(0,H.jsxs)(`span`,{className:`console-mono w-[76px] shrink-0 text-right text-[11px] text-[var(--console-muted)]`,children:[i(e.cost),m?b(` incl. sub`):``]})]}),n?(0,H.jsx)(q,{id:d,row:e,onOpen:s}):null]})}function Y({day:e,mode:t,openIds:n,agentCatalog:r,onToggle:i,onOpen:a}){return y(),(0,H.jsxs)(`div`,{className:`flex gap-5`,children:[(0,H.jsxs)(`div`,{className:`w-[84px] shrink-0 pt-[14px] text-right`,children:[(0,H.jsx)(`div`,{className:`console-display text-[15px] font-semibold text-[var(--console-text)]`,children:e.label}),(0,H.jsxs)(`div`,{className:`console-mono mt-0.5 text-[10px] text-[var(--console-muted)]`,children:[e.mainCount,` `,b(`main ·`),` `,e.subCount,` `,b(`sub`)]})]}),(0,H.jsxs)(`div`,{className:`relative flex min-w-0 flex-1 flex-col gap-2.5 border-l border-[var(--console-border)] py-2.5 pr-0 pl-[22px]`,children:[(0,H.jsx)(`span`,{className:`absolute top-[18px] -left-[4px] size-[7px] rounded-full bg-[var(--brand)]`}),e.rows.map(e=>(0,H.jsx)(J,{row:e,mode:t,expanded:V(e,t,n),agentCatalog:r,onToggle:i,onOpen:a},e.routeKey))]})]})}function X({sessions:e,projectName:t,agentCatalog:n,onOpenSession:r}){let i=y(),[o,s]=(0,A.useState)(`collapsed`),[c,l]=(0,A.useState)(()=>new Set),[u,d]=(0,A.useState)(0),f=(0,A.useMemo)(()=>B(e),[i,e]),p=(0,A.useMemo)(()=>z(f,u),[u,f]),m=(0,A.useCallback)(e=>{l(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n})},[]);return(0,H.jsxs)(`section`,{"aria-label":b(`{0} timeline`,[t]),className:`flex flex-col gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,H.jsx)(`span`,{className:`console-mono text-[11px] text-[var(--console-muted)]`,children:b(`{0} sessions · {1} sub-sessions · {2} tokens`,[f.mainCount,f.subCount,a(f.totalTokens)])}),(0,H.jsx)(`div`,{className:`ml-auto`,children:(0,H.jsx)(K,{mode:o,onChange:s})})]}),f.mainCount>40?(0,H.jsxs)(`div`,{className:`console-mono flex items-center justify-between gap-3 text-[11px] text-[var(--console-muted)]`,children:[(0,H.jsx)(`span`,{children:b(`Page {0} · {1} shown`,[p.pageNumber,p.shown])}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`button`,{type:`button`,"aria-label":b(`Previous timeline page`),disabled:!p.hasPrevious,onClick:()=>d(p.offset-40),className:`rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] px-2.5 py-1.5 text-[var(--console-text)] motion-hover hover:bg-[var(--console-surface-muted)] focus-visible:ring-2 focus-visible:ring-[var(--brand)] focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-40`,children:b(`Previous`)}),(0,H.jsx)(`button`,{type:`button`,"aria-label":b(`Next timeline page`),disabled:!p.hasNext,onClick:()=>d(p.offset+40),className:`rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] px-2.5 py-1.5 text-[var(--console-text)] motion-hover hover:bg-[var(--console-surface-muted)] focus-visible:ring-2 focus-visible:ring-[var(--brand)] focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-40`,children:b(`Next`)})]})]}):null,(0,H.jsx)(`div`,{className:`flex flex-col gap-3`,children:p.days.map(e=>(0,H.jsx)(Y,{day:e,mode:o,openIds:c,agentCatalog:n,onToggle:m,onOpen:r},e.dayKey))}),f.orphanCount>0?(0,H.jsxs)(`p`,{className:`console-mono text-[10.5px] text-[var(--console-muted)]`,children:[f.orphanCount,` `,b(`unmounted sub-sessions · parent file is gone`)]}):null]})}function Z({label:e,value:t,hint:n}){return y(),(0,H.jsxs)(p,{className:`p-[14px_16px]`,children:[(0,H.jsx)(`p`,{className:`console-eyebrow`,children:e}),(0,H.jsx)(`p`,{className:`console-mono mt-[9px] text-[27px] font-semibold tracking-[-0.02em] text-[var(--console-text)]`,children:t}),n?(0,H.jsx)(`p`,{className:`console-mono mt-[7px] text-[10.5px] text-[var(--console-muted)]`,children:n}):null]})}function Q({agents:e,agentCatalog:t}){return y(),e.length===0?null:(0,H.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:e.slice(0,4).map(e=>{let n=O(t,e.name);return(0,H.jsxs)(`span`,{className:`console-mono inline-flex items-center gap-1 rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] px-1.5 py-0.5 text-[10px] text-[var(--console-muted)]`,children:[n?.icon?(0,H.jsx)(c,{icon:n.icon,iconColored:n.iconColored,alt:n.displayName,className:`size-3 object-contain`}):null,n?.displayName??e.name,` · `,e.sessions]},e.name)})})}function $({project:e,agentCatalog:t}){return y(),(0,H.jsx)(`li`,{children:(0,H.jsxs)(w,{to:C({kind:e.identityKind,key:e.identityKey}),className:`block rounded-lg border border-[var(--console-border)] bg-[var(--console-surface)] p-4 shadow-[var(--shadow-raised)] motion-hover hover:border-[var(--brand-line)] focus-visible:ring-2 focus-visible:ring-[var(--brand)] focus-visible:outline-none`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-3 md:flex-row md:items-start md:justify-between`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`h2`,{className:`line-clamp-1 text-[13px] font-medium text-[var(--console-text)]`,children:e.displayName}),(0,H.jsx)(`p`,{className:`console-mono mt-[5px] break-all text-[10.5px] text-[var(--console-muted)]`,children:e.identityKey})]}),(0,H.jsxs)(`div`,{className:`console-mono flex shrink-0 flex-wrap gap-2 text-[11px] text-[var(--console-text-secondary)]`,children:[(0,H.jsxs)(`span`,{children:[r(e.sessionCount),` `,b(`sessions`)]}),(0,H.jsxs)(`span`,{children:[a(e.tokens),` `,b(`tokens`)]}),(0,H.jsx)(`span`,{className:`text-[var(--brand)]`,children:o(e.cost)}),(0,H.jsx)(`span`,{className:`text-[var(--console-muted)]`,children:s(e.lastActivity)})]})]}),(0,H.jsxs)(`div`,{className:`mt-3 flex flex-col gap-2 md:flex-row md:items-center md:justify-between`,children:[(0,H.jsx)(Q,{agents:e.agentStats,agentCatalog:t}),(0,H.jsx)(`span`,{className:`console-eyebrow`,children:e.identityKind})]})]})})}function ee({initialPage:e,window:t,agentCatalog:n,loading:i,error:c,onRetry:l}){y();let u=D(t,e),d=u.page??e,f=d.projects.slice(0,250),h=u.error??c,g=u.error?()=>void u.retry():l;return d.summary.projects===0?h?(0,H.jsx)(`div`,{className:`mx-auto max-w-6xl`,children:(0,H.jsx)(m,{title:b(`Couldn't load projects.`),message:h,onRetry:g})}):i||u.loading?(0,H.jsx)(p,{className:`mx-auto max-w-6xl p-6 text-sm text-[var(--console-muted)]`,children:b(`Loading projects...`)}):(0,H.jsx)(p,{className:`mx-auto max-w-6xl p-6 text-sm text-[var(--console-muted)]`,children:b(`No projects found`)}):(0,H.jsxs)(`div`,{className:`mx-auto max-w-6xl space-y-4`,children:[h?(0,H.jsx)(m,{title:b(`Couldn't refresh projects.`),message:h,onRetry:g}):null,(0,H.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-4`,children:[(0,H.jsx)(Z,{label:b(`Projects`),value:r(d.summary.projects)}),(0,H.jsx)(Z,{label:b(`Sessions`),value:r(d.summary.sessions)}),(0,H.jsx)(Z,{label:b(`Tokens`),value:a(d.summary.tokens)}),(0,H.jsx)(Z,{label:b(`Total Cost`),value:o(d.summary.cost),hint:d.summary.latestActivity?b(`Latest {0}`,[s(d.summary.latestActivity)]):void 0})]}),(0,H.jsxs)(`div`,{className:`console-mono flex items-center justify-between gap-3 text-[11px] text-[var(--console-muted)]`,children:[(0,H.jsx)(`span`,{children:b(`Page {0} · {1} shown`,[u.pageNumber,r(f.length)])}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`button`,{type:`button`,disabled:!u.canPrevious,onClick:u.previous,className:`rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] px-2.5 py-1.5 text-[var(--console-text)] motion-hover hover:bg-[var(--console-surface-muted)] focus-visible:ring-2 focus-visible:ring-[var(--brand)] focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-40`,children:b(`Previous`)}),(0,H.jsx)(`button`,{type:`button`,disabled:!u.canNext,onClick:u.next,className:`rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] px-2.5 py-1.5 text-[var(--console-text)] motion-hover hover:bg-[var(--console-surface-muted)] focus-visible:ring-2 focus-visible:ring-[var(--brand)] focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-40`,children:b(`Next`)})]})]}),(0,H.jsx)(`ul`,{className:`grid gap-3`,children:f.map(e=>(0,H.jsx)($,{project:e,agentCatalog:n},`${e.identityKind}:${e.identityKey}`))})]})}function te({agents:e,agentCatalog:t,activeAgent:n,onChange:r}){y();let i=e=>`console-mono inline-flex items-center gap-1 rounded-full border px-[13px] py-[5px] text-[11px] motion-hover focus-visible:ring-2 focus-visible:ring-[var(--brand)] focus-visible:outline-none ${e?`border-[var(--brand)] bg-[var(--brand)] text-[var(--brand-fg)]`:`border-[var(--console-border)] bg-[var(--console-surface)] text-[var(--console-muted)] hover:border-[var(--brand-line)]`}`;return(0,H.jsx)(p,{className:`p-3`,children:(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`console-eyebrow`,children:b(`Agent`)}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>r(void 0),className:i(!n),children:b(`All Agents`)}),e.map(e=>{let a=O(t,e.name),o=n===e.name;return(0,H.jsxs)(`button`,{type:`button`,onClick:()=>r(o?void 0:e.name),className:i(o),children:[a?.icon?(0,H.jsx)(c,{icon:a.icon,iconColored:a.iconColored,alt:a.displayName,className:`size-3 object-contain`}):null,a?.displayName??e.name,` · `,e.sessions]},e.name)})]})})}function ne({project:e}){return y(),(0,H.jsxs)(p,{className:`p-4`,children:[(0,H.jsx)(`h2`,{className:`console-display text-[19px] font-semibold text-[var(--console-text)]`,children:e.displayName}),(0,H.jsxs)(`p`,{className:`console-mono mt-1 break-all text-[10.5px] text-[var(--console-muted)]`,children:[e.identityKind,`: `,e.identityKey]})]})}function re({project:e,loading:t,error:n,onRetry:r,agentCatalog:i,projectKey:a,sessions:o,activeAgent:s,onChangeAgent:c,timeWindow:l,rangePreset:u,onRangeChange:d,onSelectCustom:f}){y();let h=T();if(t)return(0,H.jsx)(p,{className:`mx-auto max-w-4xl p-6 text-sm text-[var(--console-muted)]`,children:b(`Loading project...`)});if(n)return(0,H.jsx)(`div`,{className:`mx-auto max-w-4xl`,children:(0,H.jsx)(m,{title:b(`Couldn't load project.`),message:n,onRetry:r})});if(!e)return(0,H.jsxs)(p,{className:`mx-auto max-w-4xl p-6`,children:[(0,H.jsx)(`h2`,{className:`console-display text-[15px] font-semibold text-[var(--console-text)]`,children:b(`Project Not Found`)}),(0,H.jsx)(`p`,{className:`console-mono mt-2 break-all text-xs text-[var(--console-muted)]`,children:a}),(0,H.jsx)(w,{to:`/projects`,className:`console-mono mt-4 inline-flex rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-2 py-1 text-xs text-[var(--console-text)] motion-hover hover:bg-[var(--console-surface)] focus-visible:ring-2 focus-visible:ring-[var(--brand)] focus-visible:outline-none`,children:b(`Back to Projects`)})]});let g=s?o.filter(e=>e.reference.agentName===s):o;return(0,H.jsxs)(`div`,{className:`mx-auto max-w-6xl space-y-4`,children:[(0,H.jsx)(ne,{project:e}),(0,H.jsx)(te,{agents:e.agentStats,agentCatalog:i,activeAgent:s,onChange:c}),(0,H.jsx)(k,{project:{kind:e.identityKind,key:e.identityKey},agent:s,onAgentChange:c,window:l,agentCatalog:i,rangePreset:u,onRangeChange:d,onSelectCustom:f},`${e.identityKind}:${e.identityKey}`),(0,H.jsx)(X,{sessions:g,projectName:e.displayName,agentCatalog:i,onOpenSession:e=>h(v(e))},`${e.identityKind}:${e.identityKey}:${s??`all`}`)]})}export{re as ProjectDashboardView,ee as ProjectsOverview};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./jsx-runtime-B-hcVAMW.js";import{j as t,n,t as r}from"./translate-Dmym1ZDl.js";import{o as i}from"./session-indexes-fib48ZKn.js";import{G as a,H as o,V as s}from"./index-XpolWMY4.js";var c=e(),l={recent:`Recent`,title:`Title`,user_message:`User message`,assistant_reply:`Assistant reply`,tool_output:`Tool output`,file_path:`File path`};function u(e,t){let n=[],r=0;for(let{start:i,end:a}of t)i<r||a<=i||a>e.length||(i>r&&n.push(e.slice(r,i)),n.push((0,c.jsx)(`mark`,{children:e.slice(i,a)},`${i}-${a}`)),r=a);return r<e.length&&n.push(e.slice(r)),n}function d({query:e,state:d,agentNameMap:f,agents:p,projects:m,filters:h,onChangeFilters:g,onOpenResult:_,onRetry:v,selectedIndex:y,registerResultRef:b}){n();let x=d.status===`loaded`?d.results:[],S=(0,c.jsx)(a,{agents:p,projects:m,filters:h,onChangeFilters:g});return d.status===`loading`?(0,c.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[S,(0,c.jsx)(`p`,{className:`sr-only`,"aria-live":`polite`,children:r(`Searching…`)}),(0,c.jsx)(`div`,{className:`grid gap-3`,children:Array.from({length:4}).map((e,t)=>(0,c.jsxs)(`div`,{"data-testid":`search-result-skeleton`,className:`rounded-lg border border-[var(--console-border)] bg-[var(--console-surface)] p-4 shadow-[var(--shadow-raised)]`,children:[(0,c.jsx)(`div`,{className:`skeleton-shimmer h-3 w-32 rounded-sm`}),(0,c.jsx)(`div`,{className:`skeleton-shimmer mt-3 h-4 w-2/3 rounded-sm`}),(0,c.jsx)(`div`,{className:`skeleton-shimmer mt-2 h-3 w-full rounded-sm`}),(0,c.jsx)(`div`,{className:`skeleton-shimmer mt-1 h-3 w-5/6 rounded-sm`})]},t))})]}):d.status===`failed`?(0,c.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[S,(0,c.jsxs)(`div`,{className:`rounded-lg border border-[var(--console-error-border)] bg-[var(--console-error-bg)] p-6`,"aria-live":`polite`,children:[(0,c.jsx)(`h2`,{className:`console-display text-[15px] font-semibold text-[var(--console-error)]`,children:r(`Search Failed`)}),(0,c.jsxs)(`p`,{className:`console-mono mt-2 break-words text-xs text-[var(--console-error)]`,children:[d.error,r(`. Check the server connection, then try again.`)]}),(0,c.jsx)(`button`,{type:`button`,onClick:v,className:`console-mono motion-hover motion-press mt-4 rounded-sm border border-[var(--console-error-border)] bg-[var(--console-surface)] px-3 py-1.5 text-xs font-semibold text-[var(--console-error)] hover:bg-[var(--console-error-bg)] focus-visible:ring-2 focus-visible:ring-[var(--brand)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--console-bg)] focus-visible:outline-none`,children:r(`Retry Search`)})]})]}):x.length===0?(0,c.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[S,(0,c.jsxs)(`div`,{className:`rounded-lg border border-[var(--console-border)] bg-[var(--console-surface)] p-6 shadow-[var(--shadow-raised)]`,children:[(0,c.jsx)(`h2`,{className:`console-display text-[15px] font-semibold text-[var(--console-text)]`,children:r(e?`No matches`:`No recent sessions`)}),e?(0,c.jsxs)(`p`,{className:`console-mono mt-2 text-xs text-[var(--console-muted)]`,children:[r(`Query:`),` `,e]}):null]})]}):(0,c.jsxs)(`div`,{className:`grid gap-3`,children:[S,(0,c.jsx)(`div`,{className:`console-mono text-[11px] text-[var(--console-muted)]`,children:r(`Navigate j k · Open Enter · Exit Esc`)}),x.map((n,a)=>{let d=n.reference.agentName.toLowerCase(),p=f.get(d)??n.reference.agentName,m=`${n.reference.agentName}/${n.reference.sessionId}`,h=a===y,g=!!n.session.parent_reference&&!n.parent;return(0,c.jsxs)(i,{ref:e=>b(m,e),to:t(n.reference),state:{searchQuery:e},onClick:_,"data-selected":h?`true`:void 0,className:`rounded-lg border bg-[var(--console-surface)] p-4 shadow-[var(--shadow-raised)] motion-hover hover:border-[var(--console-border-strong)] focus-visible:ring-2 focus-visible:ring-[var(--brand)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--console-bg)] focus-visible:outline-none ${h?`border-[var(--brand)]`:`border-[var(--console-border)]`}`,children:[(0,c.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,c.jsx)(`span`,{className:`console-mono rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-1.5 py-0.5 text-[10px] uppercase text-[var(--console-muted)]`,children:p}),(0,c.jsx)(`span`,{className:`console-mono rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] px-1.5 py-0.5 text-[10px] uppercase text-[var(--console-muted)]`,children:r(l[n.matchType])}),g?(0,c.jsx)(`span`,{className:`console-mono rounded-sm border border-[var(--console-border-strong)] px-1.5 py-0.5 text-[10px] text-[var(--console-muted)]`,children:r(`Unmounted`)}):null,(0,c.jsx)(`span`,{className:`console-mono text-[11px] text-[var(--console-muted)]`,children:n.session.directory})]}),n.parent?(0,c.jsx)(`p`,{className:`console-mono mt-3 line-clamp-1 text-[11px] text-[var(--console-muted)]`,children:n.parent.title}):null,(0,c.jsxs)(`h2`,{className:`text-[13px] font-semibold text-[var(--console-text)] ${n.parent?`mt-1 flex items-center gap-1.5 pl-3`:`mt-3`}`,children:[n.parent?(0,c.jsx)(`span`,{"aria-hidden":`true`,className:`console-mono text-[var(--brand)]`,children:`›`}):null,o(n.session)]}),(0,c.jsx)(s,{tags:n.session.smart_tags,className:`mt-2`}),(0,c.jsx)(`p`,{className:`mt-2 text-xs leading-6 text-[var(--console-text-secondary)]`,children:u(n.snippet||o(n.session),n.snippet?n.snippetHighlights:[])})]},m)})]})}export{d as SearchResultsPanel};
|