cascade-ai 0.3.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,10 +5,10 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>Cascade AI — Dashboard</title>
7
7
  <link rel="icon" type="image/svg+xml" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>◈</text></svg>" />
8
- <script type="module" crossorigin src="/assets/index-BvxaBI9b.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-BFrwdYDg.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/reactflow-B1e2RnXD.js">
10
10
  <link rel="modulepreload" crossorigin href="/assets/socketio-BcxXcwBL.js">
11
- <link rel="stylesheet" crossorigin href="/assets/index-DO_ICahS.css">
11
+ <link rel="stylesheet" crossorigin href="/assets/index-C6Nd1mOj.css">
12
12
  </head>
13
13
  <body>
14
14
  <div id="root"></div>
@@ -1,216 +0,0 @@
1
- var ys=Object.defineProperty;var ws=(e,t,s)=>t in e?ys(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var Te=(e,t,s)=>ws(e,typeof t!="symbol"?t+"":t,s);import{r as h,a as Ut,H as it,P as at,M as js,R as _s,B as Ss,b as Ns,C as Cs,c as ks}from"./reactflow-B1e2RnXD.js";import{l as Es}from"./socketio-BcxXcwBL.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))n(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function s(r){const i={};return r.integrity&&(i.integrity=r.integrity),r.referrerPolicy&&(i.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?i.credentials="include":r.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(r){if(r.ep)return;r.ep=!0;const i=s(r);fetch(r.href,i)}})();var Bt={exports:{}},je={};/**
2
- * @license React
3
- * react-jsx-runtime.production.min.js
4
- *
5
- * Copyright (c) Facebook, Inc. and its affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var Is=h,As=Symbol.for("react.element"),Ms=Symbol.for("react.fragment"),Ts=Object.prototype.hasOwnProperty,Os=Is.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Rs={key:!0,ref:!0,__self:!0,__source:!0};function Vt(e,t,s){var n,r={},i=null,o=null;s!==void 0&&(i=""+s),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(o=t.ref);for(n in t)Ts.call(t,n)&&!Rs.hasOwnProperty(n)&&(r[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps,t)r[n]===void 0&&(r[n]=t[n]);return{$$typeof:As,type:e,key:i,ref:o,props:r,_owner:Os.current}}je.Fragment=Ms;je.jsx=Vt;je.jsxs=Vt;Bt.exports=je;var a=Bt.exports,Ve={},ot=Ut;Ve.createRoot=ot.createRoot,Ve.hydrateRoot=ot.hydrateRoot;var Wt={exports:{}},Ht={};/**
10
- * @license React
11
- * use-sync-external-store-with-selector.production.js
12
- *
13
- * Copyright (c) Meta Platforms, Inc. and affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var te=h;function Ds(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var zs=typeof Object.is=="function"?Object.is:Ds,Ps=te.useSyncExternalStore,Ls=te.useRef,Fs=te.useEffect,$s=te.useMemo,Us=te.useDebugValue;Ht.useSyncExternalStoreWithSelector=function(e,t,s,n,r){var i=Ls(null);if(i.current===null){var o={hasValue:!1,value:null};i.current=o}else o=i.current;i=$s(function(){function c(f){if(!d){if(d=!0,u=f,f=n(f),r!==void 0&&o.hasValue){var g=o.value;if(r(g,f))return m=g}return m=f}if(g=m,zs(u,f))return g;var y=n(f);return r!==void 0&&r(g,y)?(u=f,g):(u=f,m=y)}var d=!1,u,m,p=s===void 0?null:s;return[function(){return c(t())},p===null?void 0:function(){return c(p())}]},[t,s,n,r]);var l=Ps(e,i[0],i[1]);return Fs(function(){o.hasValue=!0,o.value=l},[l]),Us(l),l};Wt.exports=Ht;var Bs=Wt.exports;function Vs(e){e()}function Ws(){let e=null,t=null;return{clear(){e=null,t=null},notify(){Vs(()=>{let s=e;for(;s;)s.callback(),s=s.next})},get(){const s=[];let n=e;for(;n;)s.push(n),n=n.next;return s},subscribe(s){let n=!0;const r=t={callback:s,next:null,prev:t};return r.prev?r.prev.next=r:e=r,function(){!n||e===null||(n=!1,r.next?r.next.prev=r.prev:t=r.prev,r.prev?r.prev.next=r.next:e=r.next)}}}}var lt={notify(){},get:()=>[]};function Hs(e,t){let s,n=lt,r=0,i=!1;function o(y){u();const v=n.subscribe(y);let x=!1;return()=>{x||(x=!0,v(),m())}}function l(){n.notify()}function c(){g.onStateChange&&g.onStateChange()}function d(){return i}function u(){r++,s||(s=e.subscribe(c),n=Ws())}function m(){r--,s&&r===0&&(s(),s=void 0,n.clear(),n=lt)}function p(){i||(i=!0,u())}function f(){i&&(i=!1,m())}const g={addNestedSub:o,notifyNestedSubs:l,handleChangeWrapper:c,isSubscribed:d,trySubscribe:p,tryUnsubscribe:f,getListeners:()=>n};return g}var qs=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Ks=qs(),Gs=()=>typeof navigator<"u"&&navigator.product==="ReactNative",Js=Gs(),Xs=()=>Ks||Js?h.useLayoutEffect:h.useEffect,Ys=Xs(),Oe=Symbol.for("react-redux-context"),Re=typeof globalThis<"u"?globalThis:{};function Zs(){if(!h.createContext)return{};const e=Re[Oe]??(Re[Oe]=new Map);let t=e.get(h.createContext);return t||(t=h.createContext(null),e.set(h.createContext,t)),t}var $=Zs();function Qs(e){const{children:t,context:s,serverState:n,store:r}=e,i=h.useMemo(()=>{const c=Hs(r);return{store:r,subscription:c,getServerState:n?()=>n:void 0}},[r,n]),o=h.useMemo(()=>r.getState(),[r]);Ys(()=>{const{subscription:c}=i;return c.onStateChange=c.notifyNestedSubs,c.trySubscribe(),o!==r.getState()&&c.notifyNestedSubs(),()=>{c.tryUnsubscribe(),c.onStateChange=void 0}},[i,o]);const l=s||$;return h.createElement(l.Provider,{value:i},t)}var en=Qs;function Ze(e=$){return function(){return h.useContext(e)}}var qt=Ze();function Kt(e=$){const t=e===$?qt:Ze(e),s=()=>{const{store:n}=t();return n};return Object.assign(s,{withTypes:()=>s}),s}var tn=Kt();function sn(e=$){const t=e===$?tn:Kt(e),s=()=>t().dispatch;return Object.assign(s,{withTypes:()=>s}),s}var nn=sn(),rn=(e,t)=>e===t;function an(e=$){const t=e===$?qt:Ze(e),s=(n,r={})=>{const{equalityFn:i=rn}=typeof r=="function"?{equalityFn:r}:r,o=t(),{store:l,subscription:c,getServerState:d}=o;h.useRef(!0);const u=h.useCallback({[n.name](p){return n(p)}}[n.name],[n]),m=Bs.useSyncExternalStoreWithSelector(c.addNestedSub,l.getState,d||l.getState,u,i);return h.useDebugValue(m),m};return Object.assign(s,{withTypes:()=>s}),s}var on=an();function E(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var ln=typeof Symbol=="function"&&Symbol.observable||"@@observable",ct=ln,De=()=>Math.random().toString(36).substring(7).split("").join("."),cn={INIT:`@@redux/INIT${De()}`,REPLACE:`@@redux/REPLACE${De()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${De()}`},me=cn;function Qe(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function Gt(e,t,s){if(typeof e!="function")throw new Error(E(2));if(typeof t=="function"&&typeof s=="function"||typeof s=="function"&&typeof arguments[3]=="function")throw new Error(E(0));if(typeof t=="function"&&typeof s>"u"&&(s=t,t=void 0),typeof s<"u"){if(typeof s!="function")throw new Error(E(1));return s(Gt)(e,t)}let n=e,r=t,i=new Map,o=i,l=0,c=!1;function d(){o===i&&(o=new Map,i.forEach((v,x)=>{o.set(x,v)}))}function u(){if(c)throw new Error(E(3));return r}function m(v){if(typeof v!="function")throw new Error(E(4));if(c)throw new Error(E(5));let x=!0;d();const b=l++;return o.set(b,v),function(){if(x){if(c)throw new Error(E(6));x=!1,d(),o.delete(b),i=null}}}function p(v){if(!Qe(v))throw new Error(E(7));if(typeof v.type>"u")throw new Error(E(8));if(typeof v.type!="string")throw new Error(E(17));if(c)throw new Error(E(9));try{c=!0,r=n(r,v)}finally{c=!1}return(i=o).forEach(b=>{b()}),v}function f(v){if(typeof v!="function")throw new Error(E(10));n=v,p({type:me.REPLACE})}function g(){const v=m;return{subscribe(x){if(typeof x!="object"||x===null)throw new Error(E(11));function b(){const w=x;w.next&&w.next(u())}return b(),{unsubscribe:v(b)}},[ct](){return this}}}return p({type:me.INIT}),{dispatch:p,subscribe:m,getState:u,replaceReducer:f,[ct]:g}}function dn(e){Object.keys(e).forEach(t=>{const s=e[t];if(typeof s(void 0,{type:me.INIT})>"u")throw new Error(E(12));if(typeof s(void 0,{type:me.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(E(13))})}function un(e){const t=Object.keys(e),s={};for(let i=0;i<t.length;i++){const o=t[i];typeof e[o]=="function"&&(s[o]=e[o])}const n=Object.keys(s);let r;try{dn(s)}catch(i){r=i}return function(o={},l){if(r)throw r;let c=!1;const d={};for(let u=0;u<n.length;u++){const m=n[u],p=s[m],f=o[m],g=p(f,l);if(typeof g>"u")throw l&&l.type,new Error(E(14));d[m]=g,c=c||g!==f}return c=c||n.length!==Object.keys(o).length,c?d:o}}function pe(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,s)=>(...n)=>t(s(...n)))}function fn(...e){return t=>(s,n)=>{const r=t(s,n);let i=()=>{throw new Error(E(15))};const o={getState:r.getState,dispatch:(c,...d)=>i(c,...d)},l=e.map(c=>c(o));return i=pe(...l)(r.dispatch),{...r,dispatch:i}}}function hn(e){return Qe(e)&&"type"in e&&typeof e.type=="string"}var Jt=Symbol.for("immer-nothing"),dt=Symbol.for("immer-draftable"),M=Symbol.for("immer-state");function R(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var O=Object,H=O.getPrototypeOf,xe="constructor",_e="prototype",We="configurable",ge="enumerable",fe="writable",Z="value",F=e=>!!e&&!!e[M];function D(e){var t;return e?Xt(e)||Ne(e)||!!e[dt]||!!((t=e[xe])!=null&&t[dt])||Ce(e)||ke(e):!1}var mn=O[_e][xe].toString(),ut=new WeakMap;function Xt(e){if(!e||!et(e))return!1;const t=H(e);if(t===null||t===O[_e])return!0;const s=O.hasOwnProperty.call(t,xe)&&t[xe];if(s===Object)return!0;if(!W(s))return!1;let n=ut.get(s);return n===void 0&&(n=Function.toString.call(s),ut.set(s,n)),n===mn}function Se(e,t,s=!0){se(e)===0?(s?Reflect.ownKeys(e):O.keys(e)).forEach(r=>{t(r,e[r],e)}):e.forEach((n,r)=>t(r,n,e))}function se(e){const t=e[M];return t?t.type_:Ne(e)?1:Ce(e)?2:ke(e)?3:0}var ft=(e,t,s=se(e))=>s===2?e.has(t):O[_e].hasOwnProperty.call(e,t),He=(e,t,s=se(e))=>s===2?e.get(t):e[t],ve=(e,t,s,n=se(e))=>{n===2?e.set(t,s):n===3?e.add(s):e[t]=s};function pn(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Ne=Array.isArray,Ce=e=>e instanceof Map,ke=e=>e instanceof Set,et=e=>typeof e=="object",W=e=>typeof e=="function",ze=e=>typeof e=="boolean";function xn(e){const t=+e;return Number.isInteger(t)&&String(t)===e}var P=e=>e.copy_||e.base_,tt=e=>e.modified_?e.copy_:e.base_;function qe(e,t){if(Ce(e))return new Map(e);if(ke(e))return new Set(e);if(Ne(e))return Array[_e].slice.call(e);const s=Xt(e);if(t===!0||t==="class_only"&&!s){const n=O.getOwnPropertyDescriptors(e);delete n[M];let r=Reflect.ownKeys(n);for(let i=0;i<r.length;i++){const o=r[i],l=n[o];l[fe]===!1&&(l[fe]=!0,l[We]=!0),(l.get||l.set)&&(n[o]={[We]:!0,[fe]:!0,[ge]:l[ge],[Z]:e[o]})}return O.create(H(e),n)}else{const n=H(e);if(n!==null&&s)return{...e};const r=O.create(n);return O.assign(r,e)}}function st(e,t=!1){return Ee(e)||F(e)||!D(e)||(se(e)>1&&O.defineProperties(e,{set:ae,add:ae,clear:ae,delete:ae}),O.freeze(e),t&&Se(e,(s,n)=>{st(n,!0)},!1)),e}function gn(){R(2)}var ae={[Z]:gn};function Ee(e){return e===null||!et(e)?!0:O.isFrozen(e)}var be="MapSet",Ke="Patches",ht="ArrayMethods",Yt={};function B(e){const t=Yt[e];return t||R(0,e),t}var mt=e=>!!Yt[e],Q,Zt=()=>Q,vn=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:mt(be)?B(be):void 0,arrayMethodsPlugin_:mt(ht)?B(ht):void 0});function pt(e,t){t&&(e.patchPlugin_=B(Ke),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ge(e){Je(e),e.drafts_.forEach(bn),e.drafts_=null}function Je(e){e===Q&&(Q=e.parent_)}var xt=e=>Q=vn(Q,e);function bn(e){const t=e[M];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function gt(e,t){t.unfinalizedDrafts_=t.drafts_.length;const s=t.drafts_[0];if(e!==void 0&&e!==s){s[M].modified_&&(Ge(t),R(4)),D(e)&&(e=vt(t,e));const{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(s[M].base_,e,t)}else e=vt(t,s);return yn(t,e,!0),Ge(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Jt?e:void 0}function vt(e,t){if(Ee(t))return t;const s=t[M];if(!s)return ye(t,e.handledSet_,e);if(!Ie(s,e))return t;if(!s.modified_)return s.base_;if(!s.finalized_){const{callbacks_:n}=s;if(n)for(;n.length>0;)n.pop()(e);ts(s,e)}return s.copy_}function yn(e,t,s=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&st(t,s)}function Qt(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Ie=(e,t)=>e.scope_===t,wn=[];function es(e,t,s,n){const r=P(e),i=e.type_;if(n!==void 0&&He(r,n,i)===t){ve(r,n,s,i);return}if(!e.draftLocations_){const l=e.draftLocations_=new Map;Se(r,(c,d)=>{if(F(d)){const u=l.get(d)||[];u.push(c),l.set(d,u)}})}const o=e.draftLocations_.get(t)??wn;for(const l of o)ve(r,l,s,i)}function jn(e,t,s){e.callbacks_.push(function(r){var l;const i=t;if(!i||!Ie(i,r))return;(l=r.mapSetPlugin_)==null||l.fixSetContents(i);const o=tt(i);es(e,i.draft_??i,o,s),ts(i,r)})}function ts(e,t){var n;if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(((n=e.assigned_)==null?void 0:n.size)??0)>0)){const{patchPlugin_:r}=t;if(r){const i=r.getPath(e);i&&r.generatePatches_(e,i,t)}Qt(e)}}function _n(e,t,s){const{scope_:n}=e;if(F(s)){const r=s[M];Ie(r,n)&&r.callbacks_.push(function(){he(e);const o=tt(r);es(e,s,o,t)})}else D(s)&&e.callbacks_.push(function(){const i=P(e);e.type_===3?i.has(s)&&ye(s,n.handledSet_,n):He(i,t,e.type_)===s&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&ye(He(e.copy_,t,e.type_),n.handledSet_,n)})}function ye(e,t,s){return!s.immer_.autoFreeze_&&s.unfinalizedDrafts_<1||F(e)||t.has(e)||!D(e)||Ee(e)||(t.add(e),Se(e,(n,r)=>{if(F(r)){const i=r[M];if(Ie(i,s)){const o=tt(i);ve(e,n,o,e.type_),Qt(i)}}else D(r)&&ye(r,t,s)})),e}function Sn(e,t){const s=Ne(e),n={type_:s?1:0,scope_:t?t.scope_:Zt(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let r=n,i=we;s&&(r=[n],i=ee);const{revoke:o,proxy:l}=Proxy.revocable(r,i);return n.draft_=l,n.revoke_=o,[l,n]}var we={get(e,t){if(t===M)return e;let s=e.scope_.arrayMethodsPlugin_;const n=e.type_===1&&typeof t=="string";if(n&&s!=null&&s.isArrayOperationMethod(t))return s.createMethodInterceptor(e,t);const r=P(e);if(!ft(r,t,e.type_))return Nn(e,r,t);const i=r[t];if(e.finalized_||!D(i)||n&&e.operationMethod&&(s!=null&&s.isMutatingArrayMethod(e.operationMethod))&&xn(t))return i;if(i===Pe(e.base_,t)){he(e);const o=e.type_===1?+t:t,l=Ye(e.scope_,i,e,o);return e.copy_[o]=l}return i},has(e,t){return t in P(e)},ownKeys(e){return Reflect.ownKeys(P(e))},set(e,t,s){const n=ss(P(e),t);if(n!=null&&n.set)return n.set.call(e.draft_,s),!0;if(!e.modified_){const r=Pe(P(e),t),i=r==null?void 0:r[M];if(i&&i.base_===s)return e.copy_[t]=s,e.assigned_.set(t,!1),!0;if(pn(s,r)&&(s!==void 0||ft(e.base_,t,e.type_)))return!0;he(e),Xe(e)}return e.copy_[t]===s&&(s!==void 0||t in e.copy_)||Number.isNaN(s)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=s,e.assigned_.set(t,!0),_n(e,t,s)),!0},deleteProperty(e,t){return he(e),Pe(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Xe(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const s=P(e),n=Reflect.getOwnPropertyDescriptor(s,t);return n&&{[fe]:!0,[We]:e.type_!==1||t!=="length",[ge]:n[ge],[Z]:s[t]}},defineProperty(){R(11)},getPrototypeOf(e){return H(e.base_)},setPrototypeOf(){R(12)}},ee={};for(let e in we){let t=we[e];ee[e]=function(){const s=arguments;return s[0]=s[0][0],t.apply(this,s)}}ee.deleteProperty=function(e,t){return ee.set.call(this,e,t,void 0)};ee.set=function(e,t,s){return we.set.call(this,e[0],t,s,e[0])};function Pe(e,t){const s=e[M];return(s?P(s):e)[t]}function Nn(e,t,s){var r;const n=ss(t,s);return n?Z in n?n[Z]:(r=n.get)==null?void 0:r.call(e.draft_):void 0}function ss(e,t){if(!(t in e))return;let s=H(e);for(;s;){const n=Object.getOwnPropertyDescriptor(s,t);if(n)return n;s=H(s)}}function Xe(e){e.modified_||(e.modified_=!0,e.parent_&&Xe(e.parent_))}function he(e){e.copy_||(e.assigned_=new Map,e.copy_=qe(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Cn=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,s,n)=>{if(W(t)&&!W(s)){const i=s;s=t;const o=this;return function(c=i,...d){return o.produce(c,u=>s.call(this,u,...d))}}W(s)||R(6),n!==void 0&&!W(n)&&R(7);let r;if(D(t)){const i=xt(this),o=Ye(i,t,void 0);let l=!0;try{r=s(o),l=!1}finally{l?Ge(i):Je(i)}return pt(i,n),gt(r,i)}else if(!t||!et(t)){if(r=s(t),r===void 0&&(r=t),r===Jt&&(r=void 0),this.autoFreeze_&&st(r,!0),n){const i=[],o=[];B(Ke).generateReplacementPatches_(t,r,{patches_:i,inversePatches_:o}),n(i,o)}return r}else R(1,t)},this.produceWithPatches=(t,s)=>{if(W(t))return(o,...l)=>this.produceWithPatches(o,c=>t(c,...l));let n,r;return[this.produce(t,s,(o,l)=>{n=o,r=l}),n,r]},ze(e==null?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),ze(e==null?void 0:e.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),ze(e==null?void 0:e.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){D(e)||R(8),F(e)&&(e=kn(e));const t=xt(this),s=Ye(t,e,void 0);return s[M].isManual_=!0,Je(t),s}finishDraft(e,t){const s=e&&e[M];(!s||!s.isManual_)&&R(9);const{scope_:n}=s;return pt(n,t),gt(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let s;for(s=t.length-1;s>=0;s--){const r=t[s];if(r.path.length===0&&r.op==="replace"){e=r.value;break}}s>-1&&(t=t.slice(s+1));const n=B(Ke).applyPatches_;return F(e)?n(e,t):this.produce(e,r=>n(r,t))}};function Ye(e,t,s,n){const[r,i]=Ce(t)?B(be).proxyMap_(t,s):ke(t)?B(be).proxySet_(t,s):Sn(t,s);return((s==null?void 0:s.scope_)??Zt()).drafts_.push(r),i.callbacks_=(s==null?void 0:s.callbacks_)??[],i.key_=n,s&&n!==void 0?jn(s,i,n):i.callbacks_.push(function(c){var u;(u=c.mapSetPlugin_)==null||u.fixSetContents(i);const{patchPlugin_:d}=c;i.modified_&&d&&d.generatePatches_(i,[],c)}),r}function kn(e){return F(e)||R(10,e),ns(e)}function ns(e){if(!D(e)||Ee(e))return e;const t=e[M];let s,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,s=qe(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else s=qe(e,!0);return Se(s,(r,i)=>{ve(s,r,ns(i))},n),t&&(t.finalized_=!1),s}var En=new Cn,rs=En.produce;function In(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function An(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function Mn(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(s=>typeof s=="function")){const s=e.map(n=>typeof n=="function"?`function ${n.name||"unnamed"}()`:typeof n).join(", ");throw new TypeError(`${t}[${s}]`)}}var bt=e=>Array.isArray(e)?e:[e];function Tn(e){const t=Array.isArray(e[0])?e[0]:e;return Mn(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function On(e,t){const s=[],{length:n}=e;for(let r=0;r<n;r++)s.push(e[r].apply(null,t));return s}var Rn=class{constructor(e){this.value=e}deref(){return this.value}},Dn=typeof WeakRef<"u"?WeakRef:Rn,zn=0,yt=1;function oe(){return{s:zn,v:void 0,o:null,p:null}}function is(e,t={}){let s=oe();const{resultEqualityCheck:n}=t;let r,i=0;function o(){var m;let l=s;const{length:c}=arguments;for(let p=0,f=c;p<f;p++){const g=arguments[p];if(typeof g=="function"||typeof g=="object"&&g!==null){let y=l.o;y===null&&(l.o=y=new WeakMap);const v=y.get(g);v===void 0?(l=oe(),y.set(g,l)):l=v}else{let y=l.p;y===null&&(l.p=y=new Map);const v=y.get(g);v===void 0?(l=oe(),y.set(g,l)):l=v}}const d=l;let u;if(l.s===yt)u=l.v;else if(u=e.apply(null,arguments),i++,n){const p=((m=r==null?void 0:r.deref)==null?void 0:m.call(r))??r;p!=null&&n(p,u)&&(u=p,i!==0&&i--),r=typeof u=="object"&&u!==null||typeof u=="function"?new Dn(u):u}return d.s=yt,d.v=u,u}return o.clearCache=()=>{s=oe(),o.resetResultsCount()},o.resultsCount=()=>i,o.resetResultsCount=()=>{i=0},o}function Pn(e,...t){const s=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...r)=>{let i=0,o=0,l,c={},d=r.pop();typeof d=="object"&&(c=d,d=r.pop()),In(d,`createSelector expects an output function after the inputs, but received: [${typeof d}]`);const u={...s,...c},{memoize:m,memoizeOptions:p=[],argsMemoize:f=is,argsMemoizeOptions:g=[]}=u,y=bt(p),v=bt(g),x=Tn(r),b=m(function(){return i++,d.apply(null,arguments)},...y),_=f(function(){o++;const j=On(x,arguments);return l=b.apply(null,j),l},...v);return Object.assign(_,{resultFunc:d,memoizedResultFunc:b,dependencies:x,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>l,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:m,argsMemoize:f})};return Object.assign(n,{withTypes:()=>n}),n}var q=Pn(is),Ln=Object.assign((e,t=q)=>{An(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const s=Object.keys(e),n=s.map(i=>e[i]);return t(n,(...i)=>i.reduce((o,l,c)=>(o[s[c]]=l,o),{}))},{withTypes:()=>Ln});function as(e){return({dispatch:s,getState:n})=>r=>i=>typeof i=="function"?i(s,n,e):r(i)}var Fn=as(),$n=as,Un=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?pe:pe.apply(null,arguments)},Bn=e=>e&&typeof e.match=="function";function X(e,t){function s(...n){if(t){let r=t(...n);if(!r)throw new Error(L(0));return{type:e,payload:r.payload,..."meta"in r&&{meta:r.meta},..."error"in r&&{error:r.error}}}return{type:e,payload:n[0]}}return s.toString=()=>`${e}`,s.type=e,s.match=n=>hn(n)&&n.type===e,s}var os=class G extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,G.prototype)}static get[Symbol.species](){return G}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new G(...t[0].concat(this)):new G(...t.concat(this))}};function wt(e){return D(e)?rs(e,()=>{}):e}function le(e,t,s){return e.has(t)?e.get(t):e.set(t,s(t)).get(t)}function Vn(e){return typeof e=="boolean"}var Wn=()=>function(t){const{thunk:s=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:i=!0}=t??{};let o=new os;return s&&(Vn(s)?o.push(Fn):o.push($n(s.extraArgument))),o},Hn="RTK_autoBatch",jt=e=>t=>{setTimeout(t,e)},qn=(e={type:"raf"})=>t=>(...s)=>{const n=t(...s);let r=!0,i=!1,o=!1;const l=new Set,c=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:jt(10):e.type==="callback"?e.queueNotification:jt(e.timeout),d=()=>{o=!1,i&&(i=!1,l.forEach(u=>u()))};return Object.assign({},n,{subscribe(u){const m=()=>r&&u(),p=n.subscribe(m);return l.add(u),()=>{p(),l.delete(u)}},dispatch(u){var m;try{return r=!((m=u==null?void 0:u.meta)!=null&&m[Hn]),i=!r,i&&(o||(o=!0,c(d))),n.dispatch(u)}finally{r=!0}}})},Kn=e=>function(s){const{autoBatch:n=!0}=s??{};let r=new os(e);return n&&r.push(qn(typeof n=="object"?n:void 0)),r};function Gn(e){const t=Wn(),{reducer:s=void 0,middleware:n,devTools:r=!0,preloadedState:i=void 0,enhancers:o=void 0}=e||{};let l;if(typeof s=="function")l=s;else if(Qe(s))l=un(s);else throw new Error(L(1));let c;typeof n=="function"?c=n(t):c=t();let d=pe;r&&(d=Un({trace:!1,...typeof r=="object"&&r}));const u=fn(...c),m=Kn(u);let p=typeof o=="function"?o(m):m();const f=d(...p);return Gt(l,i,f)}function ls(e){const t={},s=[];let n;const r={addCase(i,o){const l=typeof i=="string"?i:i.type;if(!l)throw new Error(L(28));if(l in t)throw new Error(L(29));return t[l]=o,r},addAsyncThunk(i,o){return o.pending&&(t[i.pending.type]=o.pending),o.rejected&&(t[i.rejected.type]=o.rejected),o.fulfilled&&(t[i.fulfilled.type]=o.fulfilled),o.settled&&s.push({matcher:i.settled,reducer:o.settled}),r},addMatcher(i,o){return s.push({matcher:i,reducer:o}),r},addDefaultCase(i){return n=i,r}};return e(r),[t,s,n]}function Jn(e){return typeof e=="function"}function Xn(e,t){let[s,n,r]=ls(t),i;if(Jn(e))i=()=>wt(e());else{const l=wt(e);i=()=>l}function o(l=i(),c){let d=[s[c.type],...n.filter(({matcher:u})=>u(c)).map(({reducer:u})=>u)];return d.filter(u=>!!u).length===0&&(d=[r]),d.reduce((u,m)=>{if(m)if(F(u)){const f=m(u,c);return f===void 0?u:f}else{if(D(u))return rs(u,p=>m(p,c));{const p=m(u,c);if(p===void 0){if(u===null)return u;throw Error("A case reducer on a non-draftable value must not return undefined")}return p}}return u},l)}return o.getInitialState=i,o}var Yn=(e,t)=>Bn(e)?e.match(t):e(t);function Zn(...e){return t=>e.some(s=>Yn(s,t))}var Qn="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",er=(e=21)=>{let t="",s=e;for(;s--;)t+=Qn[Math.random()*64|0];return t},tr=["name","message","stack","code"],Le=class{constructor(e,t){Te(this,"_type");this.payload=e,this.meta=t}},_t=class{constructor(e,t){Te(this,"_type");this.payload=e,this.meta=t}},sr=e=>{if(typeof e=="object"&&e!==null){const t={};for(const s of tr)typeof e[s]=="string"&&(t[s]=e[s]);return t}return{message:String(e)}},St="External signal was aborted",nr=(()=>{function e(t,s,n){const r=X(t+"/fulfilled",(c,d,u,m)=>({payload:c,meta:{...m||{},arg:u,requestId:d,requestStatus:"fulfilled"}})),i=X(t+"/pending",(c,d,u)=>({payload:void 0,meta:{...u||{},arg:d,requestId:c,requestStatus:"pending"}})),o=X(t+"/rejected",(c,d,u,m,p)=>({payload:m,error:(n&&n.serializeError||sr)(c||"Rejected"),meta:{...p||{},arg:u,requestId:d,rejectedWithValue:!!m,requestStatus:"rejected",aborted:(c==null?void 0:c.name)==="AbortError",condition:(c==null?void 0:c.name)==="ConditionError"}}));function l(c,{signal:d}={}){return(u,m,p)=>{const f=n!=null&&n.idGenerator?n.idGenerator(c):er(),g=new AbortController;let y,v;function x(_){v=_,g.abort()}d&&(d.aborted?x(St):d.addEventListener("abort",()=>x(St),{once:!0}));const b=async function(){var j,C;let _;try{let k=(j=n==null?void 0:n.condition)==null?void 0:j.call(n,c,{getState:m,extra:p});if(ir(k)&&(k=await k),k===!1||g.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const I=new Promise((S,T)=>{y=()=>{T({name:"AbortError",message:v||"Aborted"})},g.signal.addEventListener("abort",y,{once:!0})});u(i(f,c,(C=n==null?void 0:n.getPendingMeta)==null?void 0:C.call(n,{requestId:f,arg:c},{getState:m,extra:p}))),_=await Promise.race([I,Promise.resolve(s(c,{dispatch:u,getState:m,extra:p,requestId:f,signal:g.signal,abort:x,rejectWithValue:(S,T)=>new Le(S,T),fulfillWithValue:(S,T)=>new _t(S,T)})).then(S=>{if(S instanceof Le)throw S;return S instanceof _t?r(S.payload,f,c,S.meta):r(S,f,c)})])}catch(k){_=k instanceof Le?o(null,f,c,k.payload,k.meta):o(k,f,c)}finally{y&&g.signal.removeEventListener("abort",y)}return n&&!n.dispatchConditionRejection&&o.match(_)&&_.meta.condition||u(_),_}();return Object.assign(b,{abort:x,requestId:f,arg:c,unwrap(){return b.then(rr)}})}}return Object.assign(l,{pending:i,rejected:o,fulfilled:r,settled:Zn(o,r),typePrefix:t})}return e.withTypes=()=>e,e})();function rr(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function ir(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var ar=Symbol.for("rtk-slice-createasyncthunk");function or(e,t){return`${e}/${t}`}function lr({creators:e}={}){var s;const t=(s=e==null?void 0:e.asyncThunk)==null?void 0:s[ar];return function(r){const{name:i,reducerPath:o=i}=r;if(!i)throw new Error(L(11));const l=(typeof r.reducers=="function"?r.reducers(ur()):r.reducers)||{},c=Object.keys(l),d={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},u={addCase(w,j){const C=typeof w=="string"?w:w.type;if(!C)throw new Error(L(12));if(C in d.sliceCaseReducersByType)throw new Error(L(13));return d.sliceCaseReducersByType[C]=j,u},addMatcher(w,j){return d.sliceMatchers.push({matcher:w,reducer:j}),u},exposeAction(w,j){return d.actionCreators[w]=j,u},exposeCaseReducer(w,j){return d.sliceCaseReducersByName[w]=j,u}};c.forEach(w=>{const j=l[w],C={reducerName:w,type:or(i,w),createNotation:typeof r.reducers=="function"};hr(j)?pr(C,j,u,t):fr(C,j,u)});function m(){const[w={},j=[],C=void 0]=typeof r.extraReducers=="function"?ls(r.extraReducers):[r.extraReducers],k={...w,...d.sliceCaseReducersByType};return Xn(r.initialState,I=>{for(let S in k)I.addCase(S,k[S]);for(let S of d.sliceMatchers)I.addMatcher(S.matcher,S.reducer);for(let S of j)I.addMatcher(S.matcher,S.reducer);C&&I.addDefaultCase(C)})}const p=w=>w,f=new Map,g=new WeakMap;let y;function v(w,j){return y||(y=m()),y(w,j)}function x(){return y||(y=m()),y.getInitialState()}function b(w,j=!1){function C(I){let S=I[w];return typeof S>"u"&&j&&(S=le(g,C,x)),S}function k(I=p){const S=le(f,j,()=>new WeakMap);return le(S,I,()=>{const T={};for(const[N,z]of Object.entries(r.selectors??{}))T[N]=cr(z,I,()=>le(g,I,x),j);return T})}return{reducerPath:w,getSelectors:k,get selectors(){return k(C)},selectSlice:C}}const _={name:i,reducer:v,actions:d.actionCreators,caseReducers:d.sliceCaseReducersByName,getInitialState:x,...b(o),injectInto(w,{reducerPath:j,...C}={}){const k=j??o;return w.inject({reducerPath:k,reducer:v},C),{..._,...b(k,!0)}}};return _}}function cr(e,t,s,n){function r(i,...o){let l=t(i);return typeof l>"u"&&n&&(l=s()),e(l,...o)}return r.unwrapped=e,r}var dr=lr();function ur(){function e(t,s){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...s}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...s){return t(...s)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,s){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:s}},asyncThunk:e}}function fr({type:e,reducerName:t,createNotation:s},n,r){let i,o;if("reducer"in n){if(s&&!mr(n))throw new Error(L(17));i=n.reducer,o=n.prepare}else i=n;r.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,o?X(e,o):X(e))}function hr(e){return e._reducerDefinitionType==="asyncThunk"}function mr(e){return e._reducerDefinitionType==="reducerWithPrepare"}function pr({type:e,reducerName:t},s,n,r){if(!r)throw new Error(L(18));const{payloadCreator:i,fulfilled:o,pending:l,rejected:c,settled:d,options:u}=s,m=r(e,i,u);n.exposeAction(t,m),o&&n.addCase(m.fulfilled,o),l&&n.addCase(m.pending,l),c&&n.addCase(m.rejected,c),d&&n.addMatcher(m.settled,d),n.exposeCaseReducer(t,{fulfilled:o||ce,pending:l||ce,rejected:c||ce,settled:d||ce})}function ce(){}function L(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}const xr=nr("runtime/fetchHistory",async({sessionId:e,before:t,limit:s=100})=>{const n=localStorage.getItem("cascade_token")??"",r=`/api/runtime/logs/${e}?limit=${s}${t?`&before=${t}`:""}`,i=await fetch(r,{headers:{Authorization:`Bearer ${n}`}});if(!i.ok)throw new Error("Failed to fetch history");const o=await i.json();return{sessionId:e,logs:o}}),gr={sessions:{},nodes:{},logIds:{},logs:{},activeSessionId:null,scope:"workspace",connected:!1};function Nt(e,t,s){for(const n of t){const r=n.sessionId??s??"",i=`${r}:${n.tierId}`,o=e[i],l=n.output??(o==null?void 0:o.output);e[i]={...o,...n,sessionId:r,output:l}}}function de(e,t,s,n=1e3){e.logIds[t]||(e.logIds[t]=new Set),e.logs[t]||(e.logs[t]=[]);const r=e.logIds[t],i=e.logs[t];for(const o of s)r.has(o.id)||(r.add(o.id),i.push(o));if(i.length>n){const o=i.splice(0,i.length-n);for(const l of o)r.delete(l.id)}}const cs=dr({name:"runtime",initialState:gr,reducers:{setConnected(e,t){e.connected=t.payload},setScope(e,t){e.scope=t.payload},setActiveSession(e,t){e.activeSessionId=t.payload},updateRTKSnapshot(e,t){var o;const{sessions:s,nodes:n,logs:r,scope:i}=t.payload;(i==="workspace"||i==="global")&&(e.scope=i);for(const l of s)e.sessions[l.sessionId]={...e.sessions[l.sessionId]??{},...l};if(!e.activeSessionId&&s.length>0&&(e.activeSessionId=((o=s.find(l=>l.status==="ACTIVE"))==null?void 0:o.sessionId)??s[0].sessionId),n!=null&&n.length&&Nt(e.nodes,n),r!=null&&r.length)for(const l of r)l.sessionId&&de(e,l.sessionId,[l])},updateSessionDetails(e,t){var i;const{sessionId:s,nodes:n,logs:r}=t.payload;Nt(e.nodes,n,s),de(e,s,r),(i=e.logs[s])==null||i.sort((o,l)=>new Date(o.timestamp).getTime()-new Date(l.timestamp).getTime())},appendLog(e,t){const s=t.payload;de(e,s.sessionId,[s])},clearFrontendGraphs(e){e.nodes={},e.logIds={},e.logs={}},removeSessionsBulk(e,t){var s,n;for(const r of t.payload){delete e.sessions[r];for(const i of Object.keys(e.nodes))((s=e.nodes[i])==null?void 0:s.sessionId)===r&&delete e.nodes[i];delete e.logs[r],delete e.logIds[r]}if(e.activeSessionId&&t.payload.includes(e.activeSessionId)){const r=Object.values(e.sessions);e.activeSessionId=((n=r[0])==null?void 0:n.sessionId)??null}}},extraReducers(e){e.addCase(xr.fulfilled,(t,s)=>{var i;const{sessionId:n,logs:r}=s.payload;de(t,n,r,2e3),(i=t.logs[n])==null||i.sort((o,l)=>new Date(o.timestamp).getTime()-new Date(l.timestamp).getTime())})}}),{setConnected:Ct,setScope:Vi,setActiveSession:vr,updateRTKSnapshot:ds,updateSessionDetails:br,appendLog:yr,clearFrontendGraphs:kt,removeSessionsBulk:wr}=cs.actions,ne=e=>e.runtime,jr=q(ne,e=>Object.values(e.sessions).sort((t,s)=>new Date(s.updatedAt).getTime()-new Date(t.updatedAt).getTime())),nt=q(ne,e=>e.activeSessionId?e.sessions[e.activeSessionId]??null:null),_r=q(ne,e=>e.activeSessionId?Object.values(e.nodes).filter(t=>t.sessionId===e.activeSessionId):[]),Sr=q(ne,e=>e.activeSessionId?e.logs[e.activeSessionId]??[]:[]),Nr=q(ne,e=>e.connected),Cr=cs.reducer,kr=Gn({reducer:{runtime:Cr},middleware:e=>e({serializableCheck:{ignoredPaths:["runtime.logIds"]}})}),Ae=()=>nn(),U=on;var re={},rt={};function Er(e,t,s){for(var n=0,r=0,i=s.length;r<i;r++)n=s.charCodeAt(r),n<128?e.setUint8(t++,n):n<2048?(e.setUint8(t++,192|n>>6),e.setUint8(t++,128|n&63)):n<55296||n>=57344?(e.setUint8(t++,224|n>>12),e.setUint8(t++,128|n>>6&63),e.setUint8(t++,128|n&63)):(r++,n=65536+((n&1023)<<10|s.charCodeAt(r)&1023),e.setUint8(t++,240|n>>18),e.setUint8(t++,128|n>>12&63),e.setUint8(t++,128|n>>6&63),e.setUint8(t++,128|n&63))}function Ir(e){for(var t=0,s=0,n=0,r=e.length;n<r;n++)t=e.charCodeAt(n),t<128?s+=1:t<2048?s+=2:t<55296||t>=57344?s+=3:(n++,s+=4);return s}function J(e,t,s){var n=typeof s,r=0,i=0,o=0,l=0,c=0,d=0;if(n==="string"){if(c=Ir(s),c<32)e.push(c|160),d=1;else if(c<256)e.push(217,c),d=2;else if(c<65536)e.push(218,c>>8,c),d=3;else if(c<4294967296)e.push(219,c>>24,c>>16,c>>8,c),d=5;else throw new Error("String too long");return t.push({_str:s,_length:c,_offset:e.length}),d+c}if(n==="number")return Math.floor(s)!==s||!isFinite(s)?(e.push(203),t.push({_float:s,_length:8,_offset:e.length}),9):s>=0?s<128?(e.push(s),1):s<256?(e.push(204,s),2):s<65536?(e.push(205,s>>8,s),3):s<4294967296?(e.push(206,s>>24,s>>16,s>>8,s),5):(o=s/Math.pow(2,32)>>0,l=s>>>0,e.push(207,o>>24,o>>16,o>>8,o,l>>24,l>>16,l>>8,l),9):s>=-32?(e.push(s),1):s>=-128?(e.push(208,s),2):s>=-32768?(e.push(209,s>>8,s),3):s>=-2147483648?(e.push(210,s>>24,s>>16,s>>8,s),5):(o=Math.floor(s/Math.pow(2,32)),l=s>>>0,e.push(211,o>>24,o>>16,o>>8,o,l>>24,l>>16,l>>8,l),9);if(n==="object"){if(s===null)return e.push(192),1;if(Array.isArray(s)){if(c=s.length,c<16)e.push(c|144),d=1;else if(c<65536)e.push(220,c>>8,c),d=3;else if(c<4294967296)e.push(221,c>>24,c>>16,c>>8,c),d=5;else throw new Error("Array too large");for(r=0;r<c;r++)d+=J(e,t,s[r]);return d}if(s instanceof Date){var u=s.getTime();return o=Math.floor(u/Math.pow(2,32)),l=u>>>0,e.push(215,0,o>>24,o>>16,o>>8,o,l>>24,l>>16,l>>8,l),10}if(s instanceof ArrayBuffer){if(c=s.byteLength,c<256)e.push(196,c),d=2;else if(c<65536)e.push(197,c>>8,c),d=3;else if(c<4294967296)e.push(198,c>>24,c>>16,c>>8,c),d=5;else throw new Error("Buffer too large");return t.push({_bin:s,_length:c,_offset:e.length}),d+c}if(typeof s.toJSON=="function")return J(e,t,s.toJSON());var m=[],p="",f=Object.keys(s);for(r=0,i=f.length;r<i;r++)p=f[r],typeof s[p]!="function"&&m.push(p);if(c=m.length,c<16)e.push(c|128),d=1;else if(c<65536)e.push(222,c>>8,c),d=3;else if(c<4294967296)e.push(223,c>>24,c>>16,c>>8,c),d=5;else throw new Error("Object too large");for(r=0;r<c;r++)p=m[r],d+=J(e,t,p),d+=J(e,t,s[p]);return d}if(n==="boolean")return e.push(s?195:194),1;if(n==="undefined")return e.push(212,0,0),3;throw new Error("Could not encode")}function Ar(e){var t=[],s=[],n=J(t,s,e),r=new ArrayBuffer(n),i=new DataView(r),o=0,l=0,c=-1;s.length>0&&(c=s[0]._offset);for(var d,u=0,m=0,p=0,f=t.length;p<f;p++)if(i.setUint8(l+p,t[p]),p+1===c){if(d=s[o],u=d._length,m=l+c,d._bin)for(var g=new Uint8Array(d._bin),y=0;y<u;y++)i.setUint8(m+y,g[y]);else d._str?Er(i,m,d._str):d._float!==void 0&&i.setFloat64(m,d._float);o++,l+=u,s[o]&&(c=s[o]._offset)}return r}var Mr=Ar;function K(e){if(this._offset=0,e instanceof ArrayBuffer)this._buffer=e,this._view=new DataView(this._buffer);else if(ArrayBuffer.isView(e))this._buffer=e.buffer,this._view=new DataView(this._buffer,e.byteOffset,e.byteLength);else throw new Error("Invalid argument")}function Tr(e,t,s){for(var n="",r=0,i=t,o=t+s;i<o;i++){var l=e.getUint8(i);if(!(l&128)){n+=String.fromCharCode(l);continue}if((l&224)===192){n+=String.fromCharCode((l&31)<<6|e.getUint8(++i)&63);continue}if((l&240)===224){n+=String.fromCharCode((l&15)<<12|(e.getUint8(++i)&63)<<6|(e.getUint8(++i)&63)<<0);continue}if((l&248)===240){r=(l&7)<<18|(e.getUint8(++i)&63)<<12|(e.getUint8(++i)&63)<<6|(e.getUint8(++i)&63)<<0,r>=65536?(r-=65536,n+=String.fromCharCode((r>>>10)+55296,(r&1023)+56320)):n+=String.fromCharCode(r);continue}throw new Error("Invalid byte "+l.toString(16))}return n}K.prototype._array=function(e){for(var t=new Array(e),s=0;s<e;s++)t[s]=this._parse();return t};K.prototype._map=function(e){for(var t="",s={},n=0;n<e;n++)t=this._parse(),s[t]=this._parse();return s};K.prototype._str=function(e){var t=Tr(this._view,this._offset,e);return this._offset+=e,t};K.prototype._bin=function(e){var t=this._buffer.slice(this._offset,this._offset+e);return this._offset+=e,t};K.prototype._parse=function(){var e=this._view.getUint8(this._offset++),t,s=0,n=0,r=0,i=0;if(e<192)return e<128?e:e<144?this._map(e&15):e<160?this._array(e&15):this._str(e&31);if(e>223)return(255-e+1)*-1;switch(e){case 192:return null;case 194:return!1;case 195:return!0;case 196:return s=this._view.getUint8(this._offset),this._offset+=1,this._bin(s);case 197:return s=this._view.getUint16(this._offset),this._offset+=2,this._bin(s);case 198:return s=this._view.getUint32(this._offset),this._offset+=4,this._bin(s);case 199:return s=this._view.getUint8(this._offset),n=this._view.getInt8(this._offset+1),this._offset+=2,[n,this._bin(s)];case 200:return s=this._view.getUint16(this._offset),n=this._view.getInt8(this._offset+2),this._offset+=3,[n,this._bin(s)];case 201:return s=this._view.getUint32(this._offset),n=this._view.getInt8(this._offset+4),this._offset+=5,[n,this._bin(s)];case 202:return t=this._view.getFloat32(this._offset),this._offset+=4,t;case 203:return t=this._view.getFloat64(this._offset),this._offset+=8,t;case 204:return t=this._view.getUint8(this._offset),this._offset+=1,t;case 205:return t=this._view.getUint16(this._offset),this._offset+=2,t;case 206:return t=this._view.getUint32(this._offset),this._offset+=4,t;case 207:return r=this._view.getUint32(this._offset)*Math.pow(2,32),i=this._view.getUint32(this._offset+4),this._offset+=8,r+i;case 208:return t=this._view.getInt8(this._offset),this._offset+=1,t;case 209:return t=this._view.getInt16(this._offset),this._offset+=2,t;case 210:return t=this._view.getInt32(this._offset),this._offset+=4,t;case 211:return r=this._view.getInt32(this._offset)*Math.pow(2,32),i=this._view.getUint32(this._offset+4),this._offset+=8,r+i;case 212:if(n=this._view.getInt8(this._offset),this._offset+=1,n===0){this._offset+=1;return}return[n,this._bin(1)];case 213:return n=this._view.getInt8(this._offset),this._offset+=1,[n,this._bin(2)];case 214:return n=this._view.getInt8(this._offset),this._offset+=1,[n,this._bin(4)];case 215:return n=this._view.getInt8(this._offset),this._offset+=1,n===0?(r=this._view.getInt32(this._offset)*Math.pow(2,32),i=this._view.getUint32(this._offset+4),this._offset+=8,new Date(r+i)):[n,this._bin(8)];case 216:return n=this._view.getInt8(this._offset),this._offset+=1,[n,this._bin(16)];case 217:return s=this._view.getUint8(this._offset),this._offset+=1,this._str(s);case 218:return s=this._view.getUint16(this._offset),this._offset+=2,this._str(s);case 219:return s=this._view.getUint32(this._offset),this._offset+=4,this._str(s);case 220:return s=this._view.getUint16(this._offset),this._offset+=2,this._array(s);case 221:return s=this._view.getUint32(this._offset),this._offset+=4,this._array(s);case 222:return s=this._view.getUint16(this._offset),this._offset+=2,this._map(s);case 223:return s=this._view.getUint32(this._offset),this._offset+=4,this._map(s)}throw new Error("Could not parse")};function Or(e){var t=new K(e),s=t._parse();if(t._offset!==e.byteLength)throw new Error(e.byteLength-t._offset+" trailing bytes");return s}var Rr=Or;rt.encode=Mr;rt.decode=Rr;var us={exports:{}};(function(e){e.exports=t;function t(n){if(n)return s(n)}function s(n){for(var r in t.prototype)n[r]=t.prototype[r];return n}t.prototype.on=t.prototype.addEventListener=function(n,r){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(r),this},t.prototype.once=function(n,r){function i(){this.off(n,i),r.apply(this,arguments)}return i.fn=r,this.on(n,i),this},t.prototype.off=t.prototype.removeListener=t.prototype.removeAllListeners=t.prototype.removeEventListener=function(n,r){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var i=this._callbacks["$"+n];if(!i)return this;if(arguments.length==1)return delete this._callbacks["$"+n],this;for(var o,l=0;l<i.length;l++)if(o=i[l],o===r||o.fn===r){i.splice(l,1);break}return i.length===0&&delete this._callbacks["$"+n],this},t.prototype.emit=function(n){this._callbacks=this._callbacks||{};for(var r=new Array(arguments.length-1),i=this._callbacks["$"+n],o=1;o<arguments.length;o++)r[o-1]=arguments[o];if(i){i=i.slice(0);for(var o=0,l=i.length;o<l;++o)i[o].apply(this,r)}return this},t.prototype.listeners=function(n){return this._callbacks=this._callbacks||{},this._callbacks["$"+n]||[]},t.prototype.hasListeners=function(n){return!!this.listeners(n).length}})(us);var Dr=us.exports,fs=rt,zr=Dr;re.protocol=5;var Y=re.PacketType={CONNECT:0,DISCONNECT:1,EVENT:2,ACK:3,CONNECT_ERROR:4},Et=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e},hs=function(e){return typeof e=="string"},It=function(e){return Object.prototype.toString.call(e)==="[object Object]"};function ms(){}ms.prototype.encode=function(e){return[fs.encode(e)]};function ie(){}zr(ie.prototype);ie.prototype.add=function(e){var t=fs.decode(e);this.checkPacket(t),this.emit("decoded",t)};function Pr(e){switch(e.type){case Y.CONNECT:return e.data===void 0||It(e.data);case Y.DISCONNECT:return e.data===void 0;case Y.CONNECT_ERROR:return hs(e.data)||It(e.data);default:return Array.isArray(e.data)}}ie.prototype.checkPacket=function(e){var t=Et(e.type)&&e.type>=Y.CONNECT&&e.type<=Y.CONNECT_ERROR;if(!t)throw new Error("invalid packet type");if(!hs(e.nsp))throw new Error("invalid namespace");if(!Pr(e))throw new Error("invalid payload");var s=e.id===void 0||Et(e.id);if(!s)throw new Error("invalid packet id")};ie.prototype.destroy=function(){};re.Encoder=ms;re.Decoder=ie;function Lr({url:e="/",token:t,activeSessionId:s,onRuntimeRefresh:n,onStreamToken:r,onCostUpdate:i,onEscalation:o}={}){const[l,c]=h.useState(null),d=Ae(),u=h.useRef(n),m=h.useRef(r),p=h.useRef(i),f=h.useRef(o);u.current=n,m.current=r,p.current=i,f.current=o;const g=h.useRef(s);g.current=s;const y=h.useRef(null);return h.useEffect(()=>{const v=Es(e,{auth:t?{token:t}:{},transports:["websocket","polling"],reconnection:!0,reconnectionDelay:500,parser:re});return v.on("connect",()=>{d(Ct(!0)),v.emit("runtime:refresh",{scope:"workspace"});const x=g.current;x&&(v.emit("join:session",{sessionId:x}),y.current=x),c(v)}),v.on("disconnect",()=>{d(Ct(!1)),c(null)}),v.on("runtime:update",x=>{d(ds(x))}),v.on("session:details",x=>{d(br(x))}),v.on("log:new",x=>{d(yr(x))}),v.on("runtime:refresh",x=>{var _;const b=x;(_=u.current)==null||_.call(u,b==null?void 0:b.scope)}),v.on("stream:token",x=>{var b;(b=m.current)==null||b.call(m,x)}),v.on("cost:update",x=>{var b;(b=p.current)==null||b.call(p,x)}),v.on("permission:user-required",x=>{var b;(b=f.current)==null||b.call(f,x)}),()=>{v.disconnect(),c(null),y.current=null}},[e,t,d]),h.useEffect(()=>{l&&s!==y.current&&(y.current&&l.emit("leave:session",{sessionId:y.current}),s&&l.emit("join:session",{sessionId:s}),y.current=s??null)},[l,s]),{socket:l}}const Fr=h.memo(function({onLogin:t}){const[s,n]=h.useState(""),[r,i]=h.useState(""),[o,l]=h.useState(!1),c=async d=>{if(d.preventDefault(),!!s.trim()){l(!0),i("");try{const u=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:"admin",password:s})});if(u.ok){const m=await u.json();t(m.token)}else i("Invalid token — check your cascade dashboard config.")}catch{i("Cannot reach server. Is the dashboard running?")}finally{l(!1)}}};return a.jsxs("div",{className:"relative flex items-center justify-center w-full h-full bg-[var(--bg-base)] dot-grid overflow-hidden",children:[a.jsx("div",{className:"absolute top-[20%] left-[30%] w-[480px] h-[480px] rounded-full bg-[var(--accent)] opacity-[0.035] blur-[140px] pointer-events-none"}),a.jsx("div",{className:"absolute bottom-[20%] right-[25%] w-[320px] h-[320px] rounded-full bg-[var(--t3-color)] opacity-[0.03] blur-[120px] pointer-events-none"}),a.jsxs("form",{onSubmit:c,"aria-label":"Cascade AI login",className:`
18
- relative z-10 w-full max-w-[360px]
19
- glass-elevated rounded-[var(--radius-lg)]
20
- p-8 shadow-dialog animate-fade-in-up
21
- `,children:[a.jsxs("div",{className:"flex items-center gap-3 mb-8",children:[a.jsx("div",{className:`
22
- w-9 h-9 rounded-[var(--radius-sm)] bg-[var(--accent)]
23
- flex items-center justify-center flex-shrink-0
24
- shadow-[var(--shadow-glow-violet)]
25
- `,children:a.jsx("span",{className:"text-white font-black text-[14px] font-mono",children:"C"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-[15px] font-bold text-[var(--text-primary)] tracking-tight",children:"Cascade AI"}),a.jsx("p",{className:"section-label mt-0.5",children:"Dashboard"})]})]}),a.jsxs("div",{className:"mb-5",children:[a.jsx("label",{htmlFor:"token-input",className:"block section-label mb-2",children:"Access Token"}),a.jsx("input",{id:"token-input",type:"password",className:"input",placeholder:"paste your token here",value:s,onChange:d=>n(d.target.value),autoComplete:"current-password",autoFocus:!0}),r&&a.jsx("p",{role:"alert",className:"text-[11px] text-[var(--error)] mt-2 font-mono",children:r})]}),a.jsx("button",{type:"submit",disabled:o||!s.trim(),className:"btn btn-primary w-full justify-center py-2.5",children:o?a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"w-3 h-3 rounded-full border border-white/40 border-t-white animate-spin"}),"Connecting…"]}):"Connect"}),a.jsxs("p",{className:"text-center text-[10px] text-[var(--text-faint)] mt-5 font-mono",children:["No token?"," ",a.jsx("code",{className:"text-[var(--text-muted)]",children:"dashboard.auth: false"})]})]})]})});/**
26
- * @license lucide-react v0.460.0 - ISC
27
- *
28
- * This source code is licensed under the ISC license.
29
- * See the LICENSE file in the root directory of this source tree.
30
- */const $r=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ps=(...e)=>e.filter((t,s,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===s).join(" ").trim();/**
31
- * @license lucide-react v0.460.0 - ISC
32
- *
33
- * This source code is licensed under the ISC license.
34
- * See the LICENSE file in the root directory of this source tree.
35
- */var Ur={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
36
- * @license lucide-react v0.460.0 - ISC
37
- *
38
- * This source code is licensed under the ISC license.
39
- * See the LICENSE file in the root directory of this source tree.
40
- */const Br=h.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:s=2,absoluteStrokeWidth:n,className:r="",children:i,iconNode:o,...l},c)=>h.createElement("svg",{ref:c,...Ur,width:t,height:t,stroke:e,strokeWidth:n?Number(s)*24/Number(t):s,className:ps("lucide",r),...l},[...o.map(([d,u])=>h.createElement(d,u)),...Array.isArray(i)?i:[i]]));/**
41
- * @license lucide-react v0.460.0 - ISC
42
- *
43
- * This source code is licensed under the ISC license.
44
- * See the LICENSE file in the root directory of this source tree.
45
- */const A=(e,t)=>{const s=h.forwardRef(({className:n,...r},i)=>h.createElement(Br,{ref:i,iconNode:t,className:ps(`lucide-${$r(e)}`,n),...r}));return s.displayName=`${e}`,s};/**
46
- * @license lucide-react v0.460.0 - ISC
47
- *
48
- * This source code is licensed under the ISC license.
49
- * See the LICENSE file in the root directory of this source tree.
50
- */const xs=A("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
51
- * @license lucide-react v0.460.0 - ISC
52
- *
53
- * This source code is licensed under the ISC license.
54
- * See the LICENSE file in the root directory of this source tree.
55
- */const Vr=A("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
56
- * @license lucide-react v0.460.0 - ISC
57
- *
58
- * This source code is licensed under the ISC license.
59
- * See the LICENSE file in the root directory of this source tree.
60
- */const Wr=A("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
61
- * @license lucide-react v0.460.0 - ISC
62
- *
63
- * This source code is licensed under the ISC license.
64
- * See the LICENSE file in the root directory of this source tree.
65
- */const gs=A("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
66
- * @license lucide-react v0.460.0 - ISC
67
- *
68
- * This source code is licensed under the ISC license.
69
- * See the LICENSE file in the root directory of this source tree.
70
- */const At=A("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/**
71
- * @license lucide-react v0.460.0 - ISC
72
- *
73
- * This source code is licensed under the ISC license.
74
- * See the LICENSE file in the root directory of this source tree.
75
- */const Hr=A("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
76
- * @license lucide-react v0.460.0 - ISC
77
- *
78
- * This source code is licensed under the ISC license.
79
- * See the LICENSE file in the root directory of this source tree.
80
- */const qr=A("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
81
- * @license lucide-react v0.460.0 - ISC
82
- *
83
- * This source code is licensed under the ISC license.
84
- * See the LICENSE file in the root directory of this source tree.
85
- */const Kr=A("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/**
86
- * @license lucide-react v0.460.0 - ISC
87
- *
88
- * This source code is licensed under the ISC license.
89
- * See the LICENSE file in the root directory of this source tree.
90
- */const Gr=A("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
91
- * @license lucide-react v0.460.0 - ISC
92
- *
93
- * This source code is licensed under the ISC license.
94
- * See the LICENSE file in the root directory of this source tree.
95
- */const Jr=A("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/**
96
- * @license lucide-react v0.460.0 - ISC
97
- *
98
- * This source code is licensed under the ISC license.
99
- * See the LICENSE file in the root directory of this source tree.
100
- */const Xr=A("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
101
- * @license lucide-react v0.460.0 - ISC
102
- *
103
- * This source code is licensed under the ISC license.
104
- * See the LICENSE file in the root directory of this source tree.
105
- */const Yr=A("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/**
106
- * @license lucide-react v0.460.0 - ISC
107
- *
108
- * This source code is licensed under the ISC license.
109
- * See the LICENSE file in the root directory of this source tree.
110
- */const Mt=A("SquareCheckBig",[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
111
- * @license lucide-react v0.460.0 - ISC
112
- *
113
- * This source code is licensed under the ISC license.
114
- * See the LICENSE file in the root directory of this source tree.
115
- */const Tt=A("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
116
- * @license lucide-react v0.460.0 - ISC
117
- *
118
- * This source code is licensed under the ISC license.
119
- * See the LICENSE file in the root directory of this source tree.
120
- */const Zr=A("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
121
- * @license lucide-react v0.460.0 - ISC
122
- *
123
- * This source code is licensed under the ISC license.
124
- * See the LICENSE file in the root directory of this source tree.
125
- */const Qr=A("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),ei=[{id:"topology",icon:Jr,label:"Agent Topology"},{id:"sessions",icon:Kr,label:"Sessions"},{id:"logs",icon:Hr,label:"Telemetry"},{id:"settings",icon:Xr,label:"Settings"}];function Ot({label:e}){return a.jsx("div",{role:"tooltip",className:`
126
- absolute left-full ml-3 px-2.5 py-1.5
127
- text-[10px] font-medium font-mono text-[var(--text-primary)]
128
- bg-[var(--bg-overlay)] border border-[var(--border-strong)]
129
- rounded-[var(--radius-sm)] whitespace-nowrap pointer-events-none
130
- opacity-0 group-hover:opacity-100
131
- translate-x-[-4px] group-hover:translate-x-0
132
- transition-all duration-150 z-50
133
- shadow-[var(--shadow-panel)]
134
- `,children:e})}const ti=h.memo(function({activeTab:t,onTabChange:s,onLogout:n}){return a.jsxs("nav",{"aria-label":"Main navigation",className:`
135
- flex flex-col items-center py-5 gap-1
136
- w-[56px] flex-shrink-0 h-full z-20
137
- bg-[var(--bg-surface)]
138
- border-r border-[var(--border-subtle)]
139
- `,children:[a.jsx("div",{className:`
140
- mb-4 w-8 h-8 rounded-[var(--radius-sm)]
141
- bg-[var(--accent)] flex items-center justify-center
142
- shadow-[var(--shadow-glow-violet)] select-none
143
- `,children:a.jsx("span",{className:"text-white font-black text-[13px] font-mono tracking-tighter",children:"C"})}),a.jsx("div",{className:"divider w-8 mb-2"}),a.jsx("div",{className:"flex flex-col gap-0.5 flex-1 w-full px-1.5",children:ei.map(({id:r,icon:i,label:o})=>{const l=t===r;return a.jsxs("div",{className:"relative group",children:[a.jsx("button",{id:`nav-${r}`,"aria-label":o,"aria-current":l?"page":void 0,onClick:()=>s(r),className:`nav-rail-btn w-full ${l?"active":""}`,children:a.jsx(i,{size:17,strokeWidth:l?2:1.75})}),a.jsx(Ot,{label:o})]},r)})}),a.jsxs("div",{className:"relative group px-1.5 w-full",children:[a.jsx("button",{"aria-label":"Log out",onClick:n,className:"nav-rail-btn w-full text-[var(--text-faint)] hover:text-[var(--error)]",children:a.jsx(Gr,{size:15,strokeWidth:1.75})}),a.jsx(Ot,{label:"Log out"})]})]})});function si(e){const[t,s]=h.useState(null);return h.useEffect(()=>{if(!e){s(null);return}let n=!1;const r=async()=>{const o=Date.now();try{await fetch("/api/ping",{cache:"no-store"}),n||s(Date.now()-o)}catch{n||s(null)}};r();const i=setInterval(r,5e3);return()=>{n=!0,clearInterval(i)}},[e]),t}function ni(e){const[t,s]=h.useState("");return h.useEffect(()=>{if(!e){s("");return}const n=()=>{const i=Date.now()-new Date(e).getTime(),o=Math.floor(i/36e5).toString().padStart(2,"0"),l=Math.floor(i%36e5/6e4).toString().padStart(2,"0"),c=Math.floor(i%6e4/1e3).toString().padStart(2,"0");s(`${o}:${l}:${c}`)};n();const r=setInterval(n,1e3);return()=>clearInterval(r)},[e]),t}function ue({label:e,value:t,highlight:s}){return a.jsxs("div",{className:"metric-chip",children:[a.jsx("span",{className:"label",children:e}),a.jsx("span",{className:`value ${s?"text-[var(--warning)]":""}`,children:t})]})}const ri=h.memo(function({isConnected:t,totalCostUsd:s,totalTokens:n}){const r=U(nt),i=si(t),o=ni(r==null?void 0:r.startedAt);return a.jsxs("header",{"aria-label":"Dashboard header",className:`
144
- flex items-center justify-between px-5 h-11
145
- border-b border-[var(--border-subtle)]
146
- bg-[var(--bg-surface)] flex-shrink-0 z-10
147
- `,children:[a.jsxs("div",{className:"flex items-center gap-4 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[a.jsx("span",{"aria-label":t?"Connected":"Disconnected",className:`
148
- w-1.5 h-1.5 rounded-full transition-all duration-500
149
- ${t?"bg-[var(--success)] shadow-[var(--shadow-glow-green)]":"bg-[var(--text-faint)]"}
150
- `}),a.jsx("span",{className:"section-label",children:t?"Live":"Offline"})]}),r&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"divider-v h-4 flex-shrink-0"}),a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[a.jsx("span",{className:"text-[12px] font-medium text-[var(--text-primary)] truncate max-w-[200px]",children:r.title||"Untitled Session"}),a.jsx("span",{className:`badge badge-${r.status} flex-shrink-0`,children:r.status})]})]})]}),a.jsxs("div",{className:"flex items-center gap-5",children:[i!==null&&a.jsx(ue,{label:"Ping",value:`${i}ms`}),o&&a.jsx(ue,{label:"Uptime",value:o}),a.jsx("div",{className:"divider-v h-4"}),a.jsx(ue,{label:"Tokens",value:n>=1e3?`${(n/1e3).toFixed(1)}k`:n.toLocaleString()}),a.jsx(ue,{label:"Cost",value:`$${s.toFixed(4)}`,highlight:s>1})]})]})}),Fe={T1:"var(--t1-color)",T2:"var(--t2-color)",T3:"var(--t3-color)"},Rt={ACTIVE:"border-[var(--t3-color)] agent-node-ACTIVE",COMPLETED:"border-[var(--success)] agent-node-COMPLETED",FAILED:"border-[var(--error)] agent-node-FAILED",ESCALATED:"border-[var(--warning)] agent-node-ESCALATED",IDLE:"border-[var(--border-subtle)]"},ii=h.memo(function({data:t,selected:s}){const n=Rt[t.status]??Rt.IDLE;return a.jsxs("div",{"aria-label":`${t.role} agent: ${t.label}, status: ${t.status}`,className:`
151
- relative px-3.5 py-3 glass min-w-[170px] max-w-[210px]
152
- rounded-[var(--radius-md)] border transition-all duration-300
153
- ${n}
154
- ${s?"ring-2 ring-[var(--accent)] ring-offset-2 ring-offset-[var(--bg-base)]":""}
155
- `,children:[a.jsx(it,{type:"target",position:at.Top,className:"!w-1.5 !h-1.5 !bg-[var(--border-strong)] !border-none !top-[-4px]"}),a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("span",{className:"badge",style:{color:Fe[t.role],background:`color-mix(in srgb, ${Fe[t.role]} 10%, transparent)`,borderColor:`color-mix(in srgb, ${Fe[t.role]} 22%, transparent)`},children:t.role}),a.jsxs("div",{className:"flex items-center gap-1",children:[t.status==="ACTIVE"&&a.jsx("div",{className:"flex gap-[2px] items-center","aria-label":"Active",children:[0,100,200].map(r=>a.jsx("span",{className:"w-1 h-1 rounded-full bg-[var(--t3-color)]",style:{animation:`pulse-glow 1.4s ease-in-out ${r}ms infinite`}},r))}),t.status==="COMPLETED"&&a.jsx("span",{className:"text-[var(--success)] text-[10px] font-mono",children:"✓"}),t.status==="FAILED"&&a.jsx("span",{className:"text-[var(--error)] text-[10px] font-mono",children:"✗"}),t.status==="ESCALATED"&&a.jsx("span",{className:"text-[var(--warning)] text-[10px]",children:"⚠"})]})]}),a.jsx("p",{className:"text-[11px] font-semibold text-[var(--text-primary)] truncate leading-snug mb-0.5",children:t.label}),t.action&&a.jsx("p",{className:"text-[9px] text-[var(--text-muted)] truncate leading-snug font-mono",children:t.action}),t.progressPct!==void 0&&t.status==="ACTIVE"&&a.jsx("div",{className:"progress-track mt-2.5",children:a.jsx("div",{className:"progress-fill",style:{width:`${t.progressPct}%`}})}),a.jsx(it,{type:"source",position:at.Bottom,className:"!w-1.5 !h-1.5 !bg-[var(--border-strong)] !border-none !bottom-[-4px]"})]})}),ai={agent:ii};function oi(){return a.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-5 animate-fade-in select-none",children:[a.jsxs("div",{className:"relative w-16 h-16",children:[[0,1,2].map(e=>a.jsx("div",{className:"absolute inset-0 rounded-full border border-[var(--accent)]",style:{opacity:.12+e*.08,animation:`orbit ${3.5+e*.8}s linear infinite`,animationDelay:`${e*-1.2}s`}},e)),a.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-2xl",children:"⬡"})]}),a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"text-[13px] font-medium text-[var(--text-primary)]",children:"No active agents"}),a.jsx("p",{className:"text-[11px] text-[var(--text-muted)] mt-1",children:"Start a task to see the agent topology"})]})]})}const li=h.memo(function({nodes:t,edges:s,selectedNodeId:n,onSelectNode:r}){const i=h.useMemo(()=>{if(!t.length)return[];const c={T1:[],T2:[],T3:[]};t.forEach(p=>{var f;return(f=c[p.role])==null?void 0:f.push(p)});const d={T1:40,T2:210,T3:380},u=250,m=500;return t.map(p=>{const f=c[p.role],g=f.findIndex(b=>b.id===p.id),y=f.length,v=m-(y-1)*u/2+g*u,x=d[p.role]??40;return{id:p.id,type:"agent",position:{x:v,y:x},selected:n===p.id,data:{role:p.role,label:p.label,status:p.status,action:p.action,progressPct:p.progressPct}}})},[t,n]),o=h.useMemo(()=>s.map((c,d)=>({id:`e${d}`,source:c.from,target:c.to,animated:!0,style:{stroke:"rgba(124,106,247,0.28)",strokeWidth:1.5},markerEnd:{type:js.ArrowClosed,color:"rgba(124,106,247,0.45)",width:10,height:10}})),[s]),l=h.useCallback((c,d)=>{r(d.id===n?null:d.id)},[r,n]);return t.length?a.jsxs("div",{className:"w-full h-full relative","aria-label":"Agent topology graph",role:"img",children:[a.jsxs(_s,{nodes:i,edges:o,nodeTypes:ai,onNodeClick:l,onPaneClick:()=>r(null),fitView:!0,fitViewOptions:{padding:.18,maxZoom:1.2},minZoom:.25,maxZoom:2.5,proOptions:{hideAttribution:!0},children:[a.jsx(Ss,{variant:Ns.Dots,color:"rgba(255,255,255,0.03)",gap:24,size:1}),a.jsx(Cs,{showInteractive:!1,"aria-label":"Graph controls"})]}),a.jsx("div",{className:"absolute inset-x-0 top-0 h-14 bg-gradient-to-b from-[var(--bg-base)] to-transparent pointer-events-none"}),a.jsx("div",{className:"absolute inset-x-0 bottom-0 h-14 bg-gradient-to-t from-[var(--bg-base)] to-transparent pointer-events-none"})]}):a.jsx(oi,{})});function ci({pct:e}){return a.jsx("div",{className:"progress-track",children:a.jsx("div",{className:"progress-fill",style:{width:`${Math.min(Math.max(e,0),100)}%`}})})}function $e({icon:e,label:t,children:s}){return a.jsxs("div",{className:"px-4 py-3 border-b border-[var(--border-subtle)]",children:[a.jsxs("p",{className:"section-label flex items-center gap-1.5 mb-1.5",children:[a.jsx(e,{size:9}),t]}),s]})}const di=h.memo(function({node:t,streamLog:s,onClose:n}){const r=h.useRef(null);return h.useEffect(()=>{r.current&&(r.current.scrollTop=r.current.scrollHeight)},[s]),h.useEffect(()=>{const i=o=>{o.key==="Escape"&&n()};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[n]),a.jsxs("aside",{role:"complementary","aria-label":"Agent inspector",className:`
156
- flex flex-col w-[300px] flex-shrink-0 h-full
157
- border-l border-[var(--border-subtle)]
158
- bg-[var(--bg-surface)] animate-slide-in overflow-hidden
159
- `,children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 border-b border-[var(--border-subtle)] flex-shrink-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(At,{size:13,className:"text-[var(--accent)]"}),a.jsx("span",{className:"section-label",children:"Inspector"})]}),a.jsx("button",{"aria-label":"Close inspector",onClick:n,className:`
160
- w-6 h-6 rounded-[var(--radius-xs)] flex items-center justify-center
161
- text-[var(--text-faint)] hover:text-[var(--text-primary)]
162
- hover:bg-[var(--bg-elevated)] transition-all
163
- `,children:a.jsx(Qr,{size:13})})]}),t?a.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[a.jsxs("div",{className:"px-4 py-4 border-b border-[var(--border-subtle)]",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx("span",{className:`badge badge-${t.role}`,children:t.role}),a.jsx("span",{className:`badge badge-${t.status}`,children:t.status})]}),a.jsx("h2",{className:"text-[12px] font-semibold text-[var(--text-primary)] leading-snug",children:t.label}),a.jsx("p",{className:"text-[9px] text-[var(--text-muted)] font-mono mt-1 break-all opacity-60",children:t.tierId})]}),t.progressPct!==void 0&&a.jsxs($e,{icon:xs,label:"Progress",children:[a.jsx("div",{className:"flex items-center justify-between mb-1.5",children:a.jsxs("span",{className:"text-[10px] font-mono text-[var(--text-primary)]",children:[t.progressPct,"%"]})}),a.jsx(ci,{pct:t.progressPct})]}),t.currentAction&&a.jsx($e,{icon:Wr,label:"Current action",children:a.jsx("p",{className:"text-[11px] text-[var(--text-primary)] leading-snug",children:t.currentAction})}),a.jsx($e,{icon:gs,label:"Last update",children:a.jsx("p",{className:"text-[10px] font-mono text-[var(--text-muted)]",children:new Date(t.updatedAt).toLocaleTimeString()})}),a.jsxs("div",{className:"flex flex-col flex-1 min-h-0 px-3 py-3",children:[a.jsx("p",{className:"section-label mb-2 flex-shrink-0",children:"Live output"}),a.jsx("div",{ref:r,className:`
164
- flex-1 overflow-y-auto font-mono text-[9.5px]
165
- text-[var(--t3-color)] leading-[1.7]
166
- whitespace-pre-wrap break-words
167
- bg-[var(--bg-base)] rounded-[var(--radius-xs)]
168
- p-2.5 border border-[var(--border-subtle)]
169
- scrollbar-thin
170
- `,"aria-live":"polite","aria-label":"Live token stream",children:t.output?a.jsx("span",{children:t.output}):s&&t.status==="ACTIVE"?a.jsxs("span",{children:[s.slice(-4e3),a.jsx("span",{className:"animate-blink text-[var(--t3-color)]",children:"█"})]}):a.jsx("span",{className:"text-[var(--text-faint)] italic",children:t.status==="COMPLETED"?"No output recorded.":"Waiting for output…"})})]})]}):a.jsxs("div",{className:"flex flex-col items-center justify-center flex-1 gap-3 text-center p-6",children:[a.jsx("div",{className:"w-9 h-9 rounded-full bg-[var(--bg-elevated)] flex items-center justify-center",children:a.jsx(At,{size:16,className:"text-[var(--text-faint)]"})}),a.jsx("p",{className:"text-[11px] text-[var(--text-muted)]",children:"Select an agent node to inspect it"})]})]})});function Ue({icon:e,tier:t,label:s,isLast:n=!1}){return a.jsxs("div",{className:`flex items-start gap-3 py-2.5 ${n?"":"border-b border-[var(--border-subtle)]"}`,children:[a.jsx("div",{className:`
171
- flex-shrink-0 w-6 h-6 rounded-full
172
- bg-[var(--bg-overlay)] border border-[var(--border-subtle)]
173
- flex items-center justify-center text-[11px] mt-0.5
174
- `,children:e}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[a.jsx("span",{className:`badge badge-${t}`,children:t}),a.jsx("span",{className:"text-[10px] text-[var(--text-muted)] truncate",children:s})]}),a.jsx("p",{className:"text-[9px] font-mono text-[var(--warning)]",children:"⚠ Uncertain — escalated upward"})]}),a.jsx(Vr,{size:10,className:"text-[var(--text-faint)] mt-1.5 flex-shrink-0"})]})}const ui=h.memo(function({request:t,onDecide:s}){h.useEffect(()=>{const o=l=>{l.key==="y"&&s(!0,!1),l.key==="n"&&s(!1,!1)};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[s]);const n=h.useCallback(o=>s(!0,o),[s]),r=h.useCallback(o=>s(!1,o),[s]),i=t.input.path??t.input.command??JSON.stringify(t.input).slice(0,60);return a.jsx("div",{className:"fixed inset-0 bg-black/65 backdrop-blur-[6px] z-50 flex items-center justify-center p-4 animate-fade-in",role:"dialog","aria-modal":"true","aria-labelledby":"escalation-title",children:a.jsxs("div",{className:"w-full max-w-[460px] glass-elevated rounded-[var(--radius-lg)] shadow-dialog animate-fade-in-up",onClick:o=>o.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center gap-3 px-5 pt-5 pb-4 border-b border-[var(--border-subtle)]",children:[a.jsx("div",{className:`
175
- w-9 h-9 rounded-[var(--radius-sm)] flex-shrink-0
176
- bg-[rgba(245,166,35,0.1)] border border-[rgba(245,166,35,0.22)]
177
- flex items-center justify-center
178
- `,children:a.jsx(Yr,{size:18,className:"text-[var(--warning)]"})}),a.jsxs("div",{children:[a.jsx("h2",{id:"escalation-title",className:"text-[13px] font-bold text-[var(--text-primary)]",children:"Permission required"}),a.jsx("p",{className:"text-[10px] text-[var(--text-muted)] font-mono mt-0.5",children:"No tier could determine if this action is safe"})]})]}),a.jsxs("div",{className:"px-5 py-4 border-b border-[var(--border-subtle)]",children:[a.jsx("p",{className:"section-label mb-2",children:"Requested action"}),a.jsxs("div",{className:`
179
- flex items-center gap-2
180
- bg-[var(--bg-base)] rounded-[var(--radius-xs)]
181
- border border-[var(--border-subtle)] px-3 py-2
182
- `,children:[a.jsx("code",{className:"text-[var(--accent)] font-mono font-bold text-[11px] flex-shrink-0",children:t.toolName}),i&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-[var(--text-faint)] text-[11px]",children:"→"}),a.jsx("code",{className:"text-[var(--text-muted)] font-mono text-[10px] truncate flex-1 min-w-0",children:i})]}),t.isDangerous&&a.jsx("span",{className:"ml-auto badge badge-FAILED flex-shrink-0",children:"Dangerous"})]})]}),a.jsxs("div",{className:"px-5 py-4 border-b border-[var(--border-subtle)]",children:[a.jsx("p",{className:"section-label mb-2",children:"Escalation trail"}),a.jsx(Ue,{icon:"🔹",tier:"T3",label:`"${t.subtaskContext}" requested this`}),a.jsx(Ue,{icon:"🟣",tier:"T2",label:`Section "${t.sectionContext}" evaluated — uncertain`}),a.jsx(Ue,{icon:"🟡",tier:"T1",label:"Full task context evaluated — uncertain",isLast:!0}),a.jsxs("div",{className:"flex items-center gap-3 pt-3",children:[a.jsx("div",{className:"w-6 h-6 rounded-full bg-[var(--accent)] flex items-center justify-center flex-shrink-0",children:a.jsx("span",{className:"text-white text-[10px] font-bold",children:"?"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-[11px] font-semibold text-[var(--text-primary)]",children:"Your decision required"}),a.jsxs("p",{className:"text-[9px] font-mono text-[var(--text-muted)] mt-0.5",children:["Press"," ",a.jsx("kbd",{className:"px-1 py-0.5 rounded-[3px] bg-[var(--bg-overlay)] border border-[var(--border-strong)] font-mono text-[8px]",children:"Y"})," ","to approve,"," ",a.jsx("kbd",{className:"px-1 py-0.5 rounded-[3px] bg-[var(--bg-overlay)] border border-[var(--border-strong)] font-mono text-[8px]",children:"N"})," ","to deny"]})]})]})]}),a.jsxs("div",{className:"px-5 py-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-2 mb-2",children:[a.jsx("button",{className:"btn btn-danger justify-center",onClick:()=>r(!1),children:"Deny once"}),a.jsx("button",{className:"btn btn-success justify-center",onClick:()=>n(!1),children:"Approve once"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsx("button",{className:"btn btn-ghost justify-center",onClick:()=>r(!0),children:"Always deny"}),a.jsx("button",{className:"btn btn-ghost justify-center",onClick:()=>n(!0),children:"Always approve"})]})]})]})})});function fi(e){const t=Date.now()-new Date(e).getTime();return t<6e4?"just now":t<36e5?`${Math.floor(t/6e4)}m ago`:t<864e5?`${Math.floor(t/36e5)}h ago`:new Date(e).toLocaleDateString()}function hi(e,t){const s=new Date(t).getTime()-new Date(e).getTime();return s<1e3?"<1s":s<6e4?`${Math.round(s/1e3)}s`:`${Math.round(s/6e4)}m`}const mi=h.memo(function(){const t=Ae(),s=U(jr),n=U(nt),[r,i]=h.useState(new Set),[o,l]=h.useState(null),[c,d]=h.useState(!1),u=h.useCallback(x=>{r.size===0&&t(vr(x))},[t,r.size]),m=h.useCallback((x,b,_)=>{_.stopPropagation(),i(w=>{var C;const j=new Set(w);if(_.shiftKey&&o!==null){const[k,I]=[Math.min(o,b),Math.max(o,b)];for(let S=k;S<=I;S++){const T=(C=s[S])==null?void 0:C.sessionId;T&&j.add(T)}}else j.has(x)?j.delete(x):j.add(x);return j}),l(b)},[o,s]),p=h.useCallback(()=>{r.size===s.length?i(new Set):i(new Set(s.map(x=>x.sessionId)))},[r.size,s]),f=h.useCallback(async()=>{if(!(r.size===0||c)){d(!0);try{const x=Array.from(r);(await fetch("/api/sessions",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:x})})).ok&&(t(wr(x)),i(new Set),l(null))}finally{d(!1)}}},[r,c,t]),g=h.useCallback(()=>{i(new Set),l(null)},[]);if(!s.length)return a.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3 animate-fade-in",children:[a.jsx("div",{className:"w-11 h-11 rounded-full bg-[var(--bg-elevated)] flex items-center justify-center",children:a.jsx(xs,{size:18,className:"text-[var(--text-faint)]"})}),a.jsx("p",{className:"text-[12px] text-[var(--text-muted)]",children:"No sessions yet"}),a.jsx("p",{className:"text-[10px] font-mono text-[var(--text-faint)]",children:"Run a task to create the first session"})]});const y=r.size===s.length,v=r.size>0;return a.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[a.jsx("div",{className:"px-5 py-4 border-b border-[var(--border-subtle)] flex-shrink-0 bg-[var(--bg-surface)]",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"section-label",children:"Sessions"}),a.jsxs("p",{className:"text-[10px] font-mono text-[var(--text-faint)] mt-1",children:[s.length," session",s.length!==1?"s":"",v&&a.jsxs("span",{className:"text-[var(--accent)] ml-2",children:["· ",r.size," selected"]})]})]}),a.jsx("button",{onClick:p,title:y?"Deselect all":"Select all",className:"p-1.5 rounded hover:bg-[var(--bg-elevated)] transition-colors",children:y?a.jsx(Mt,{size:14,className:"text-[var(--accent)]"}):a.jsx(Tt,{size:14,className:"text-[var(--text-faint)]"})})]})}),a.jsx("div",{className:"flex-1 overflow-y-auto",children:s.map((x,b)=>{const _=x.sessionId===(n==null?void 0:n.sessionId),w=r.has(x.sessionId);return a.jsxs("button",{"aria-selected":_,"aria-label":`Session: ${x.title}, status: ${x.status}`,onClick:()=>u(x.sessionId),className:`
183
- w-full text-left px-5 py-3.5
184
- border-b border-[var(--border-subtle)]
185
- transition-all duration-150 relative
186
- animate-slide-up
187
- `,style:{animationDelay:`${b*25}ms`,background:w?"rgba(124,106,247,0.08)":_?"rgba(124,106,247,0.05)":void 0,borderLeft:w||_?"2px solid var(--accent)":"2px solid transparent",paddingLeft:_||w?"18px":"20px"},children:[a.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1",children:[a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[a.jsx("span",{role:"checkbox","aria-checked":w,onClick:j=>m(x.sessionId,b,j),className:"flex-shrink-0 cursor-pointer",children:w?a.jsx(Mt,{size:12,className:"text-[var(--accent)]"}):a.jsx(Tt,{size:12,className:"text-[var(--text-faint)] opacity-40 hover:opacity-100 transition-opacity"})}),a.jsx("span",{className:"text-[12px] font-semibold text-[var(--text-primary)] truncate",children:x.title||"Untitled Session"})]}),a.jsx("span",{className:`badge badge-${x.status} flex-shrink-0`,children:x.status})]}),x.workspacePath&&a.jsxs("div",{className:"flex items-center gap-1.5 mb-1 pl-5",children:[a.jsx(qr,{size:9,className:"text-[var(--text-faint)] flex-shrink-0"}),a.jsx("span",{className:"text-[9px] font-mono text-[var(--text-faint)] truncate",children:x.workspacePath.split("/").pop()})]}),x.latestPrompt&&a.jsxs("p",{className:"text-[10px] text-[var(--text-muted)] truncate mb-1.5 italic pl-5",children:['"',x.latestPrompt,'"']}),a.jsxs("div",{className:"flex items-center gap-3 pl-5",children:[a.jsxs("span",{className:"flex items-center gap-1 text-[9px] font-mono text-[var(--text-faint)]",children:[a.jsx(gs,{size:8}),fi(x.updatedAt)]}),a.jsx("span",{className:"text-[9px] font-mono text-[var(--text-faint)]",children:hi(x.startedAt,x.updatedAt)})]})]},x.sessionId)})}),v&&a.jsxs("div",{className:`
188
- absolute bottom-4 left-1/2 -translate-x-1/2
189
- flex items-center gap-3 px-4 py-2.5 rounded-xl
190
- bg-[var(--bg-elevated)] border border-[var(--border-subtle)]
191
- shadow-lg z-10 animate-slide-up
192
- `,children:[a.jsxs("span",{className:"text-[11px] font-mono text-[var(--text-muted)]",children:[r.size," selected"]}),a.jsxs("button",{onClick:f,disabled:c,className:`
193
- flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-[11px] font-medium
194
- bg-red-500/10 text-red-400 border border-red-500/20
195
- hover:bg-red-500/20 transition-colors disabled:opacity-50
196
- `,children:[a.jsx(Zr,{size:12}),c?"Deleting...":`Delete ${r.size}`]}),a.jsx("button",{onClick:g,className:"text-[11px] text-[var(--text-faint)] hover:text-[var(--text-muted)] transition-colors",children:"Cancel"})]})]})});function V(e,t,s){let n=s.initialDeps??[],r,i=!0;function o(){var l,c,d;let u;s.key&&((l=s.debug)!=null&&l.call(s))&&(u=Date.now());const m=e();if(!(m.length!==n.length||m.some((g,y)=>n[y]!==g)))return r;n=m;let f;if(s.key&&((c=s.debug)!=null&&c.call(s))&&(f=Date.now()),r=t(...m),s.key&&((d=s.debug)!=null&&d.call(s))){const g=Math.round((Date.now()-u)*100)/100,y=Math.round((Date.now()-f)*100)/100,v=y/16,x=(b,_)=>{for(b=String(b);b.length<_;)b=" "+b;return b};console.info(`%c⏱ ${x(y,5)} /${x(g,5)} ms`,`
197
- font-size: .6rem;
198
- font-weight: bold;
199
- color: hsl(${Math.max(0,Math.min(120-120*v,120))}deg 100% 31%);`,s==null?void 0:s.key)}return s!=null&&s.onChange&&!(i&&s.skipInitialOnChange)&&s.onChange(r),i=!1,r}return o.updateDeps=l=>{n=l},o}function Dt(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const pi=(e,t)=>Math.abs(e-t)<1.01,xi=(e,t,s)=>{let n;return function(...r){e.clearTimeout(n),n=e.setTimeout(()=>t.apply(this,r),s)}},zt=e=>{const{offsetWidth:t,offsetHeight:s}=e;return{width:t,height:s}},gi=e=>e,vi=e=>{const t=Math.max(e.startIndex-e.overscan,0),s=Math.min(e.endIndex+e.overscan,e.count-1),n=[];for(let r=t;r<=s;r++)n.push(r);return n},bi=(e,t)=>{const s=e.scrollElement;if(!s)return;const n=e.targetWindow;if(!n)return;const r=o=>{const{width:l,height:c}=o;t({width:Math.round(l),height:Math.round(c)})};if(r(zt(s)),!n.ResizeObserver)return()=>{};const i=new n.ResizeObserver(o=>{const l=()=>{const c=o[0];if(c!=null&&c.borderBoxSize){const d=c.borderBoxSize[0];if(d){r({width:d.inlineSize,height:d.blockSize});return}}r(zt(s))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()});return i.observe(s,{box:"border-box"}),()=>{i.unobserve(s)}},Pt={passive:!0},Lt=typeof window>"u"?!0:"onscrollend"in window,yi=(e,t)=>{const s=e.scrollElement;if(!s)return;const n=e.targetWindow;if(!n)return;let r=0;const i=e.options.useScrollendEvent&&Lt?()=>{}:xi(n,()=>{t(r,!1)},e.options.isScrollingResetDelay),o=u=>()=>{const{horizontal:m,isRtl:p}=e.options;r=m?s.scrollLeft*(p&&-1||1):s.scrollTop,i(),t(r,u)},l=o(!0),c=o(!1);s.addEventListener("scroll",l,Pt);const d=e.options.useScrollendEvent&&Lt;return d&&s.addEventListener("scrollend",c,Pt),()=>{s.removeEventListener("scroll",l),d&&s.removeEventListener("scrollend",c)}},wi=(e,t,s)=>{if(t!=null&&t.borderBoxSize){const n=t.borderBoxSize[0];if(n)return Math.round(n[s.options.horizontal?"inlineSize":"blockSize"])}return e[s.options.horizontal?"offsetWidth":"offsetHeight"]},ji=(e,{adjustments:t=0,behavior:s},n)=>{var r,i;const o=e+t;(i=(r=n.scrollElement)==null?void 0:r.scrollTo)==null||i.call(r,{[n.options.horizontal?"left":"top"]:o,behavior:s})};class _i{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var s,n,r;return((r=(n=(s=this.targetWindow)==null?void 0:s.performance)==null?void 0:n.now)==null?void 0:r.call(n))??Date.now()},this.observer=(()=>{let s=null;const n=()=>s||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:s=new this.targetWindow.ResizeObserver(r=>{r.forEach(i=>{const o=()=>{const l=i.target,c=this.indexFromElement(l);if(!l.isConnected){this.observer.unobserve(l);return}this.shouldMeasureDuringScroll(c)&&this.resizeItem(c,this.options.measureElement(l,i,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()})}));return{disconnect:()=>{var r;(r=n())==null||r.disconnect(),s=null},observe:r=>{var i;return(i=n())==null?void 0:i.observe(r,{box:"border-box"})},unobserve:r=>{var i;return(i=n())==null?void 0:i.unobserve(r)}}})(),this.range=null,this.setOptions=s=>{Object.entries(s).forEach(([n,r])=>{typeof r>"u"&&delete s[n]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:gi,rangeExtractor:vi,onChange:()=>{},measureElement:wi,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",...s}},this.notify=s=>{var n,r;(r=(n=this.options).onChange)==null||r.call(n,this,s)},this.maybeNotify=V(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),s=>{this.notify(s)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(s=>s()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var s;const n=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==n){if(this.cleanup(),!n){this.maybeNotify();return}this.scrollElement=n,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((s=this.scrollElement)==null?void 0:s.window)??null,this.elementsCache.forEach(r=>{this.observer.observe(r)}),this.unsubs.push(this.options.observeElementRect(this,r=>{this.scrollRect=r,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(r,i)=>{this.scrollAdjustments=0,this.scrollDirection=i?this.getScrollOffset()<r?"forward":"backward":null,this.scrollOffset=r,this.isScrolling=i,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(s,n)=>{const r=new Map,i=new Map;for(let o=n-1;o>=0;o--){const l=s[o];if(r.has(l.lane))continue;const c=i.get(l.lane);if(c==null||l.end>c.end?i.set(l.lane,l):l.end<c.end&&r.set(l.lane,!0),r.size===this.options.lanes)break}return i.size===this.options.lanes?Array.from(i.values()).sort((o,l)=>o.end===l.end?o.index-l.index:o.end-l.end)[0]:void 0},this.getMeasurementOptions=V(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(s,n,r,i,o,l,c)=>(this.prevLanes!==void 0&&this.prevLanes!==l&&(this.lanesChangedFlag=!0),this.prevLanes=l,this.pendingMeasuredCacheIndexes=[],{count:s,paddingStart:n,scrollMargin:r,getItemKey:i,enabled:o,lanes:l,laneAssignmentMode:c}),{key:!1}),this.getMeasurements=V(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:s,paddingStart:n,scrollMargin:r,getItemKey:i,enabled:o,lanes:l,laneAssignmentMode:c},d)=>{if(!o)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>s)for(const f of this.laneAssignments.keys())f>=s&&this.laneAssignments.delete(f);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(f=>{this.itemSizeCache.set(f.key,f.size)}));const u=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===s&&(this.lanesSettling=!1);const m=this.measurementsCache.slice(0,u),p=new Array(l).fill(void 0);for(let f=0;f<u;f++){const g=m[f];g&&(p[g.lane]=f)}for(let f=u;f<s;f++){const g=i(f),y=this.laneAssignments.get(f);let v,x;const b=c==="estimate"||d.has(g);if(y!==void 0&&this.options.lanes>1){v=y;const C=p[v],k=C!==void 0?m[C]:void 0;x=k?k.end+this.options.gap:n+r}else{const C=this.options.lanes===1?m[f-1]:this.getFurthestMeasurement(m,f);x=C?C.end+this.options.gap:n+r,v=C?C.lane:f%this.options.lanes,this.options.lanes>1&&b&&this.laneAssignments.set(f,v)}const _=d.get(g),w=typeof _=="number"?_:this.options.estimateSize(f),j=x+w;m[f]={index:f,start:x,size:w,end:j,key:g,lane:v},p[v]=f}return this.measurementsCache=m,m},{key:!1,debug:()=>this.options.debug}),this.calculateRange=V(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(s,n,r,i)=>this.range=s.length>0&&n>0?Si({measurements:s,outerSize:n,scrollOffset:r,lanes:i}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=V(()=>{let s=null,n=null;const r=this.calculateRange();return r&&(s=r.startIndex,n=r.endIndex),this.maybeNotify.updateDeps([this.isScrolling,s,n]),[this.options.rangeExtractor,this.options.overscan,this.options.count,s,n]},(s,n,r,i,o)=>i===null||o===null?[]:s({startIndex:i,endIndex:o,overscan:n,count:r}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=s=>{const n=this.options.indexAttribute,r=s.getAttribute(n);return r?parseInt(r,10):(console.warn(`Missing attribute name '${n}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=s=>{var n;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const r=this.scrollState.index??((n=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:n.index);if(r!==void 0&&this.range){const i=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),o=Math.max(0,r-i),l=Math.min(this.options.count-1,r+i);return s>=o&&s<=l}return!0},this.measureElement=s=>{if(!s){this.elementsCache.forEach((o,l)=>{o.isConnected||(this.observer.unobserve(o),this.elementsCache.delete(l))});return}const n=this.indexFromElement(s),r=this.options.getItemKey(n),i=this.elementsCache.get(r);i!==s&&(i&&this.observer.unobserve(i),this.observer.observe(s),this.elementsCache.set(r,s)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(s,void 0,this))},this.resizeItem=(s,n)=>{var r;const i=this.measurementsCache[s];if(!i)return;const o=this.itemSizeCache.get(i.key)??i.size,l=n-o;l!==0&&(((r=this.scrollState)==null?void 0:r.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(i,l,this):i.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=l,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(i.index),this.itemSizeCache=new Map(this.itemSizeCache.set(i.key,n)),this.notify(!1))},this.getVirtualItems=V(()=>[this.getVirtualIndexes(),this.getMeasurements()],(s,n)=>{const r=[];for(let i=0,o=s.length;i<o;i++){const l=s[i],c=n[l];r.push(c)}return r},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=s=>{const n=this.getMeasurements();if(n.length!==0)return Dt(n[vs(0,n.length-1,r=>Dt(n[r]).start,s)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const s=this.scrollElement.document.documentElement;return this.options.horizontal?s.scrollWidth-this.scrollElement.innerWidth:s.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(s,n,r=0)=>{if(!this.scrollElement)return 0;const i=this.getSize(),o=this.getScrollOffset();n==="auto"&&(n=s>=o+i?"end":"start"),n==="center"?s+=(r-i)/2:n==="end"&&(s-=i);const l=this.getMaxScrollOffset();return Math.max(Math.min(l,s),0)},this.getOffsetForIndex=(s,n="auto")=>{s=Math.max(0,Math.min(s,this.options.count-1));const r=this.getSize(),i=this.getScrollOffset(),o=this.measurementsCache[s];if(!o)return;if(n==="auto")if(o.end>=i+r-this.options.scrollPaddingEnd)n="end";else if(o.start<=i+this.options.scrollPaddingStart)n="start";else return[i,n];if(n==="end"&&s===this.options.count-1)return[this.getMaxScrollOffset(),n];const l=n==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(l,n,o.size),n]},this.scrollToOffset=(s,{align:n="start",behavior:r="auto"}={})=>{const i=this.getOffsetForAlignment(s,n),o=this.now();this.scrollState={index:null,align:n,behavior:r,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollToIndex=(s,{align:n="auto",behavior:r="auto"}={})=>{s=Math.max(0,Math.min(s,this.options.count-1));const i=this.getOffsetForIndex(s,n);if(!i)return;const[o,l]=i,c=this.now();this.scrollState={index:s,align:l,behavior:r,startedAt:c,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollBy=(s,{behavior:n="auto"}={})=>{const r=this.getScrollOffset()+s,i=this.now();this.scrollState={index:null,align:"start",behavior:n,startedAt:i,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var s;const n=this.getMeasurements();let r;if(n.length===0)r=this.options.paddingStart;else if(this.options.lanes===1)r=((s=n[n.length-1])==null?void 0:s.end)??0;else{const i=Array(this.options.lanes).fill(null);let o=n.length-1;for(;o>=0&&i.some(l=>l===null);){const l=n[o];i[l.lane]===null&&(i[l.lane]=l.end),o--}r=Math.max(...i.filter(l=>l!==null))}return Math.max(r-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(s,{adjustments:n,behavior:r})=>{this.options.scrollToFn(s,{behavior:r,adjustments:n},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(t)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const n=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,r=n?n[0]:this.scrollState.lastTargetOffset,i=1,o=r!==this.scrollState.lastTargetOffset;if(!o&&pi(r,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=i){this.scrollState=null;return}}else this.scrollState.stableFrames=0,o&&(this.scrollState.lastTargetOffset=r,this.scrollState.behavior="auto",this._scrollToOffset(r,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const vs=(e,t,s,n)=>{for(;e<=t;){const r=(e+t)/2|0,i=s(r);if(i<n)e=r+1;else if(i>n)t=r-1;else return r}return e>0?e-1:0};function Si({measurements:e,outerSize:t,scrollOffset:s,lanes:n}){const r=e.length-1,i=c=>e[c].start;if(e.length<=n)return{startIndex:0,endIndex:r};let o=vs(0,r,i,s),l=o;if(n===1)for(;l<r&&e[l].end<s+t;)l++;else if(n>1){const c=Array(n).fill(0);for(;l<r&&c.some(u=>u<s+t);){const u=e[l];c[u.lane]=u.end,l++}const d=Array(n).fill(s+t);for(;o>=0&&d.some(u=>u>=s);){const u=e[o];d[u.lane]=u.start,o--}o=Math.max(0,o-o%n),l=Math.min(r,l+(n-1-l%n))}return{startIndex:o,endIndex:l}}const Ft=typeof document<"u"?h.useLayoutEffect:h.useEffect;function Ni({useFlushSync:e=!0,...t}){const s=h.useReducer(()=>({}),{})[1],n={...t,onChange:(i,o)=>{var l;e&&o?Ut.flushSync(s):s(),(l=t.onChange)==null||l.call(t,i,o)}},[r]=h.useState(()=>new _i(n));return r.setOptions(n),Ft(()=>r._didMount(),[]),Ft(()=>r._willUpdate()),r}function Ci(e){return Ni({observeElementRect:bi,observeElementOffset:yi,scrollToFn:ji,...e})}function $t({label:e,active:t,onClick:s}){return a.jsx("button",{className:`
200
- px-2.5 py-1 rounded-[3px] text-[9px] font-mono font-bold
201
- uppercase tracking-wider transition-all duration-100 border
202
- ${t?"bg-[var(--accent)] text-white border-[var(--accent)]":"bg-transparent text-[var(--text-muted)] border-[var(--border-subtle)] hover:border-[var(--border-strong)] hover:text-[var(--text-primary)]"}
203
- `,onClick:s,children:e})}const ki=38,Ei=h.memo(function({log:t,style:s}){return a.jsxs("div",{style:s,className:`
204
- flex items-center gap-3 px-5
205
- border-b border-[var(--border-subtle)]
206
- hover:bg-[var(--bg-elevated)] transition-colors
207
- `,children:[a.jsx("span",{className:"text-[9px] font-mono text-[var(--text-faint)] flex-shrink-0 w-[64px] tabular-nums",children:new Date(t.timestamp).toLocaleTimeString("en-US",{hour12:!1})}),a.jsx("span",{className:`badge badge-${t.role} flex-shrink-0`,children:t.role}),a.jsx("span",{className:`badge badge-${t.status} flex-shrink-0`,children:t.status}),a.jsx("span",{className:"text-[10px] font-medium text-[var(--text-primary)] truncate flex-shrink-0 max-w-[120px]",children:t.label}),t.currentAction&&a.jsx("span",{className:"text-[9px] text-[var(--text-muted)] font-mono truncate flex-1 min-w-0",children:t.currentAction})]})}),Ii=h.memo(function(){const t=U(Sr),[s,n]=h.useState("ALL"),[r,i]=h.useState("ALL"),[o,l]=h.useState(!0),c=h.useRef(null),d=h.useMemo(()=>t.filter(f=>!(s!=="ALL"&&f.role!==s||r!=="ALL"&&f.status!==r)),[t,s,r]),u=Ci({count:d.length,getScrollElement:()=>c.current,estimateSize:()=>ki,overscan:12}),m=h.useCallback(()=>{d.length>0&&u.scrollToIndex(d.length-1,{behavior:"smooth"})},[d.length,u]);h.useEffect(()=>{o&&m()},[d.length,o]);const p=h.useCallback(()=>{const f=c.current;f&&l(f.scrollHeight-f.scrollTop<=f.clientHeight+60)},[]);return a.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-[var(--bg-base)]",children:[a.jsxs("div",{className:`
208
- flex items-center gap-2 px-5 py-2.5
209
- border-b border-[var(--border-subtle)] flex-shrink-0 flex-wrap
210
- bg-[var(--bg-surface)]
211
- `,children:[a.jsx("span",{className:"section-label mr-1",children:"Role"}),["ALL","T1","T2","T3"].map(f=>a.jsx($t,{label:f,active:s===f,onClick:()=>n(f)},f)),a.jsx("div",{className:"divider-v h-4 mx-1"}),a.jsx("span",{className:"section-label mr-1",children:"Status"}),["ALL","ACTIVE","COMPLETED","FAILED","ESCALATED"].map(f=>a.jsx($t,{label:f,active:r===f,onClick:()=>i(f)},f)),a.jsxs("div",{className:"ml-auto flex items-center gap-3",children:[a.jsxs("span",{className:"text-[9px] font-mono text-[var(--text-faint)] tabular-nums",children:[d.length.toLocaleString()," entries"]}),!o&&a.jsx("button",{className:"btn btn-ghost py-0.5 px-2",onClick:()=>{l(!0),m()},children:"↓ Jump to latest"})]})]}),a.jsxs("div",{className:`
212
- flex items-center gap-3 px-5 py-1.5
213
- border-b border-[var(--border-subtle)]
214
- bg-[var(--bg-surface)] flex-shrink-0
215
- `,children:[a.jsx("span",{className:"section-label w-[64px]",children:"Time"}),a.jsx("span",{className:"section-label w-[28px]",children:"Tier"}),a.jsx("span",{className:"section-label w-[72px]",children:"Status"}),a.jsx("span",{className:"section-label w-[120px]",children:"Agent"}),a.jsx("span",{className:"section-label",children:"Action"})]}),d.length===0?a.jsx("div",{className:"flex items-center justify-center flex-1 text-[var(--text-faint)] text-[11px] font-mono",children:t.length===0?"// no log entries":"// no entries match filter"}):a.jsx("div",{ref:c,onScroll:p,className:"flex-1 overflow-y-auto",role:"log","aria-label":"Activity log","aria-live":"polite",children:a.jsx("div",{style:{height:u.getTotalSize(),position:"relative"},children:u.getVirtualItems().map(f=>{const g=d[f.index];return a.jsx(Ei,{log:g,style:{position:"absolute",top:0,left:0,right:0,transform:`translateY(${f.start}px)`,height:`${f.size}px`}},g.id)})})})]})}),Ai=[{id:"identities",label:"Identities",icon:"◎"},{id:"tier-limits",label:"Tier Limits",icon:"⊟"},{id:"budget",label:"Budget",icon:"⟁"},{id:"danger",label:"Danger Zone",icon:"⚡"}];function Mi({token:e}){const t=Ae(),[s,n]=h.useState("identities");return a.jsxs("div",{className:"flex h-full overflow-hidden animate-fade-in",children:[a.jsxs("nav",{className:"w-44 flex-shrink-0 border-r border-[var(--border-base)] p-4 flex flex-col gap-1",children:[a.jsx("p",{className:"section-label mb-3",children:"Settings"}),Ai.map(r=>a.jsxs("button",{onClick:()=>n(r.id),className:`flex items-center gap-2.5 px-3 py-2 rounded-[var(--radius-sm)] text-sm transition-all text-left
216
- ${s===r.id?"bg-[var(--accent)]/15 text-[var(--accent)] font-medium":"text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-elevated)]"}`,children:[a.jsx("span",{className:"text-[11px] font-mono opacity-70",children:r.icon}),r.label]},r.id))]}),a.jsx("div",{className:"flex-1 overflow-y-auto p-8",children:a.jsxs("div",{className:"max-w-2xl mx-auto",children:[s==="identities"&&a.jsx(Ti,{token:e}),s==="tier-limits"&&a.jsx(Ri,{token:e}),s==="budget"&&a.jsx(Di,{token:e}),s==="danger"&&a.jsx(zi,{token:e,dispatch:t})]})})]})}function Ti({token:e}){const[t,s]=h.useState([]),[n,r]=h.useState(!0),[i,o]=h.useState(!1),[l,c]=h.useState(null),[d,u]=h.useState({name:"",description:"",systemPrompt:"",setDefault:!1}),[m,p]=h.useState(""),f=h.useCallback(async()=>{try{const b=await fetch("/api/identities",{headers:{Authorization:`Bearer ${e}`}});b.ok&&s(await b.json())}finally{r(!1)}},[e]);h.useEffect(()=>{f()},[f]);const g=()=>{u({name:"",description:"",systemPrompt:"",setDefault:!1}),p("")},y=async()=>{if(!d.name.trim()){p("Name is required");return}(await fetch("/api/identities",{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(d)})).ok?(g(),o(!1),await f()):p("Failed to create identity")},v=async(b,_)=>{await fetch(`/api/identities/${b}`,{method:"PUT",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(_)}),c(null),await f()},x=async b=>{await fetch(`/api/identities/${b}`,{method:"DELETE",headers:{Authorization:`Bearer ${e}`}}),await f()};return n?a.jsx(Pi,{}):a.jsxs("section",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-lg font-bold text-[var(--text-primary)]",children:"Identities"}),a.jsx("p",{className:"text-sm text-[var(--text-muted)] mt-1",children:"Persona profiles that shape how agents behave."})]}),a.jsx("button",{onClick:()=>{g(),o(!0)},className:"btn btn-primary h-8 text-sm px-3",children:"+ New Identity"})]}),i&&a.jsxs("div",{className:"glass-elevated rounded-[var(--radius-lg)] p-5 mb-6 border border-[var(--accent)]/30",children:[a.jsx("p",{className:"font-medium text-[var(--text-primary)] mb-4",children:"Create Identity"}),a.jsx(bs,{form:d,onChange:u,error:m}),a.jsxs("div",{className:"flex gap-2 mt-4",children:[a.jsx("button",{onClick:y,className:"btn btn-primary text-sm",children:"Create"}),a.jsx("button",{onClick:()=>{o(!1),g()},className:"btn glass text-sm",children:"Cancel"})]})]}),t.length===0&&!i&&a.jsxs("div",{className:"text-center py-12 text-[var(--text-muted)]",children:[a.jsx("p",{className:"text-2xl mb-2",children:"◎"}),a.jsx("p",{children:"No identities yet. Create one above."})]}),a.jsx("div",{className:"flex flex-col gap-3",children:t.map(b=>a.jsx(Oi,{identity:b,token:e,editing:l===b.id,onEdit:()=>c(l===b.id?null:b.id),onSave:_=>v(b.id,_),onDelete:()=>x(b.id),onSetDefault:()=>v(b.id,{setDefault:!0})},b.id))})]})}function bs({form:e,onChange:t,error:s}){return a.jsxs("div",{className:"flex flex-col gap-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"section-label mb-1 block",children:"Name *"}),a.jsx("input",{className:"input",placeholder:"e.g. Senior Engineer",value:e.name,onChange:n=>t({...e,name:n.target.value})})]}),a.jsxs("div",{children:[a.jsx("label",{className:"section-label mb-1 block",children:"Description"}),a.jsx("input",{className:"input",placeholder:"Short description",value:e.description,onChange:n=>t({...e,description:n.target.value})})]}),a.jsxs("div",{children:[a.jsx("label",{className:"section-label mb-1 block",children:"System Prompt"}),a.jsx("textarea",{className:"input resize-none",rows:3,placeholder:"You are a senior engineer who writes concise, maintainable code...",value:e.systemPrompt,onChange:n=>t({...e,systemPrompt:n.target.value})})]}),a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:e.setDefault,onChange:n=>t({...e,setDefault:n.target.checked}),className:"accent-[var(--accent)]"}),a.jsx("span",{className:"text-sm text-[var(--text-muted)]",children:"Set as default identity"})]}),s&&a.jsx("p",{className:"text-[11px] text-[var(--error)] font-mono",children:s})]})}function Oi({identity:e,editing:t,onEdit:s,onSave:n,onDelete:r,onSetDefault:i}){var u;const[o,l]=h.useState({name:e.name,description:e.description??"",systemPrompt:e.systemPrompt??"",setDefault:e.isDefault}),[c,d]=h.useState(!1);return a.jsxs("div",{className:`glass-elevated rounded-[var(--radius-lg)] p-4 border transition-all ${t?"border-[var(--accent)]/40":"border-[var(--border-base)]"}`,children:[a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[a.jsx("div",{className:"w-8 h-8 rounded-full bg-[var(--accent)]/20 flex items-center justify-center flex-shrink-0 text-[var(--accent)] font-bold text-sm",children:(u=e.name[0])==null?void 0:u.toUpperCase()}),a.jsxs("div",{className:"min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("p",{className:"font-medium text-[var(--text-primary)] truncate",children:e.name}),e.isDefault&&a.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-[var(--accent)]/20 text-[var(--accent)] font-mono",children:"Default"})]}),e.description&&a.jsx("p",{className:"text-xs text-[var(--text-muted)] mt-0.5 truncate",children:e.description})]})]}),a.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[!e.isDefault&&a.jsx("button",{onClick:i,className:"btn glass text-xs h-7 px-2",children:"Set Default"}),a.jsx("button",{onClick:s,className:"btn glass text-xs h-7 px-2",children:t?"Cancel":"Edit"}),c?a.jsx("button",{onClick:r,className:"btn text-xs h-7 px-2 bg-[var(--error)] border-transparent text-white",children:"Confirm"}):a.jsx("button",{onClick:()=>d(!0),className:"btn glass text-xs h-7 px-2 text-[var(--error)]",children:"Delete"})]})]}),t&&a.jsxs("div",{className:"mt-4 pt-4 border-t border-[var(--border-base)]",children:[a.jsx(bs,{form:o,onChange:l,error:""}),a.jsx("div",{className:"flex gap-2 mt-4",children:a.jsx("button",{onClick:()=>n(o),className:"btn btn-primary text-sm",children:"Save Changes"})})]})]})}function Ri({token:e}){const[t,s]=h.useState({}),[n,r]=h.useState(!1),[i,o]=h.useState(!1);h.useEffect(()=>{fetch("/api/config",{headers:{Authorization:`Bearer ${e}`}}).then(d=>d.json()).then(d=>{d.tierLimits&&s(d.tierLimits)})},[e]);const l=async()=>{r(!0);try{await fetch("/api/config",{method:"PUT",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({tierLimits:t})}),o(!0),setTimeout(()=>o(!1),2e3)}finally{r(!1)}},c=[{key:"t1MaxTokens",label:"T1 (Administrator)",desc:"Max output tokens for the planner tier",placeholder:"4096"},{key:"t2MaxTokens",label:"T2 (Manager)",desc:"Max output tokens for manager/coordinator",placeholder:"8192"},{key:"t3MaxTokens",label:"T3 (Worker)",desc:"Max output tokens for each task worker",placeholder:"32768"}];return a.jsxs("section",{children:[a.jsx("h2",{className:"text-lg font-bold text-[var(--text-primary)] mb-1",children:"Tier Token Limits"}),a.jsx("p",{className:"text-sm text-[var(--text-muted)] mb-6",children:"Cap the maximum output tokens per AI call for each tier. Leave blank to use model defaults."}),a.jsx("div",{className:"glass-elevated rounded-[var(--radius-lg)] divide-y divide-[var(--border-base)]",children:c.map(d=>a.jsxs("div",{className:"flex items-center justify-between p-5 gap-6",children:[a.jsxs("div",{children:[a.jsx("p",{className:"font-medium text-[var(--text-primary)]",children:d.label}),a.jsx("p",{className:"text-sm text-[var(--text-muted)] mt-0.5",children:d.desc})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{type:"number",min:128,max:2e5,step:128,placeholder:d.placeholder,value:t[d.key]??"",onChange:u=>s(m=>({...m,[d.key]:u.target.value?Number(u.target.value):void 0})),className:"input w-28 text-right font-mono text-sm"}),a.jsx("span",{className:"text-xs text-[var(--text-faint)] font-mono",children:"tokens"})]})]},d.key))}),a.jsxs("div",{className:"flex items-center gap-3 mt-4",children:[a.jsx("button",{onClick:l,disabled:n,className:"btn btn-primary",children:n?"Saving…":i?"✓ Saved":"Save Limits"}),i&&a.jsx("span",{className:"text-xs text-green-400 font-mono",children:"Persisted to .cascade/config.json"})]})]})}function Di({token:e}){var p;const[t,s]=h.useState({warnAtPct:80}),[n,r]=h.useState(null),[i,o]=h.useState(!1),[l,c]=h.useState(!1);h.useEffect(()=>{fetch("/api/config",{headers:{Authorization:`Bearer ${e}`}}).then(f=>f.json()).then(f=>{f.budget&&s(f.budget)}),fetch("/api/stats",{headers:{Authorization:`Bearer ${e}`}}).then(f=>f.json()).then(f=>r(f))},[e]);const d=async()=>{o(!0);try{await fetch("/api/config",{method:"PUT",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({budget:t})}),c(!0),setTimeout(()=>c(!1),2e3)}finally{o(!1)}},u=t.sessionBudgetUsd&&n?Math.min(100,n.totalCostUsd/t.sessionBudgetUsd*100):null,m=t.warnAtPct;return a.jsxs("section",{children:[a.jsx("h2",{className:"text-lg font-bold text-[var(--text-primary)] mb-1",children:"Cost Budget"}),a.jsx("p",{className:"text-sm text-[var(--text-muted)] mb-6",children:"Set spending limits. The agent will abort if a session budget is exceeded."}),a.jsxs("div",{className:"glass-elevated rounded-[var(--radius-lg)] divide-y divide-[var(--border-base)] mb-4",children:[a.jsxs("div",{className:"p-5",children:[a.jsxs("div",{className:"flex items-center justify-between gap-6",children:[a.jsxs("div",{children:[a.jsx("p",{className:"font-medium text-[var(--text-primary)]",children:"Session Budget"}),a.jsx("p",{className:"text-sm text-[var(--text-muted)] mt-0.5",children:"Max spend per REPL session. Exceeding this aborts the current run."})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[var(--text-faint)] font-mono text-sm",children:"$"}),a.jsx("input",{type:"number",min:0,step:.01,placeholder:"0.50",value:t.sessionBudgetUsd??"",onChange:f=>s(g=>({...g,sessionBudgetUsd:f.target.value?Number(f.target.value):void 0})),className:"input w-24 text-right font-mono text-sm"})]})]}),u!==null&&a.jsxs("div",{className:"mt-3",children:[a.jsxs("div",{className:"flex justify-between text-xs text-[var(--text-faint)] mb-1",children:[a.jsx("span",{children:"Session spend"}),a.jsxs("span",{children:["$",n==null?void 0:n.totalCostUsd.toFixed(4)," / $",(p=t.sessionBudgetUsd)==null?void 0:p.toFixed(2)]})]}),a.jsx("div",{className:"h-1.5 rounded-full bg-[var(--bg-base)] overflow-hidden",children:a.jsx("div",{className:`h-full rounded-full transition-all ${u>=100?"bg-[var(--error)]":u>=m?"bg-yellow-400":"bg-[var(--accent)]"}`,style:{width:`${u}%`}})})]})]}),a.jsx("div",{className:"p-5",children:a.jsxs("div",{className:"flex items-center justify-between gap-6",children:[a.jsxs("div",{children:[a.jsxs("p",{className:"font-medium text-[var(--text-primary)]",children:["Daily Budget ",a.jsx("span",{className:"text-xs text-[var(--text-faint)] ml-1",children:"(display only)"})]}),a.jsx("p",{className:"text-sm text-[var(--text-muted)] mt-0.5",children:"Informational limit shown in the dashboard for reference."})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[var(--text-faint)] font-mono text-sm",children:"$"}),a.jsx("input",{type:"number",min:0,step:.1,placeholder:"5.00",value:t.dailyBudgetUsd??"",onChange:f=>s(g=>({...g,dailyBudgetUsd:f.target.value?Number(f.target.value):void 0})),className:"input w-24 text-right font-mono text-sm"})]})]})}),a.jsxs("div",{className:"p-5",children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsxs("div",{children:[a.jsx("p",{className:"font-medium text-[var(--text-primary)]",children:"Warn at"}),a.jsx("p",{className:"text-sm text-[var(--text-muted)] mt-0.5",children:"Show a dashboard warning when spend reaches this % of limit."})]}),a.jsxs("span",{className:"text-sm font-mono text-[var(--accent)]",children:[t.warnAtPct,"%"]})]}),a.jsx("input",{type:"range",min:10,max:99,step:5,value:t.warnAtPct,onChange:f=>s(g=>({...g,warnAtPct:Number(f.target.value)})),className:"w-full accent-[var(--accent)]"}),a.jsxs("div",{className:"flex justify-between text-xs text-[var(--text-faint)] mt-1",children:[a.jsx("span",{children:"10%"}),a.jsx("span",{children:"50%"}),a.jsx("span",{children:"99%"})]})]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:d,disabled:i,className:"btn btn-primary",children:i?"Saving…":l?"✓ Saved":"Save Budget"}),l&&a.jsx("span",{className:"text-xs text-green-400 font-mono",children:"Persisted to .cascade/config.json"})]})]})}function zi({token:e,dispatch:t}){const[s,n]=h.useState(null),[r,i]=h.useState(!1),o=async l=>{n(l);try{await fetch(l,{method:"DELETE",headers:{Authorization:`Bearer ${e}`}})}finally{n(null),i(!1)}};return a.jsxs("section",{children:[a.jsx("h2",{className:"text-lg font-bold text-[var(--error)] mb-1",children:"Danger Zone"}),a.jsx("p",{className:"text-sm text-[var(--text-muted)] mb-6",children:"These actions are irreversible."}),a.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-[var(--error)]/30 divide-y divide-[var(--error)]/10 overflow-hidden",children:[a.jsx(Be,{title:"Clear All Sessions",desc:"Permanently delete all conversation sessions and messages.",action:r?a.jsx("button",{onClick:()=>o("/api/sessions"),disabled:!!s,className:"btn text-sm bg-[var(--error)] border-transparent text-white",children:s==="/api/sessions"?"Clearing…":"Confirm Delete"}):a.jsx("button",{onClick:()=>i(!0),className:"btn glass text-sm border-[var(--error)]/40 text-[var(--error)]",children:"Clear Sessions"})}),a.jsx(Be,{title:"Clear Graphs (Backend + Frontend)",desc:"Delete all runtime node logs from DB and reset the topology view.",action:a.jsx("button",{onClick:async()=>{await o("/api/runtime"),t(kt())},disabled:!!s,className:"btn glass text-sm border-[var(--error)]/40 text-[var(--error)]",children:s==="/api/runtime"?"Clearing…":"Clear DB Graphs"})}),a.jsx(Be,{title:"Clear Graphs (Frontend Only)",desc:"Reset the topology view locally without touching the server database.",action:a.jsx("button",{onClick:()=>t(kt()),className:"btn glass text-sm",children:"Clear View"})})]})]})}function Be({title:e,desc:t,action:s}){return a.jsxs("div",{className:"flex items-center justify-between gap-6 p-5 bg-[var(--error)]/[0.03]",children:[a.jsxs("div",{children:[a.jsx("p",{className:"font-medium text-[var(--text-primary)]",children:e}),a.jsx("p",{className:"text-sm text-[var(--text-muted)] mt-0.5",children:t})]}),a.jsx("div",{className:"flex-shrink-0",children:s})]})}function Pi(){return a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsx("div",{className:"w-6 h-6 rounded-full border-2 border-[var(--accent)] border-t-transparent animate-spin"})})}function Li(){const[e,t]=h.useState(()=>localStorage.getItem("cascade_token")),[s,n]=h.useState(e===null);h.useEffect(()=>{e===null&&(async()=>{try{(await fetch("/api/runtime?scope=workspace",{headers:{Authorization:"Bearer "}})).ok&&(t(""),localStorage.setItem("cascade_token",""))}catch{}finally{n(!1)}})()},[e]);const r=h.useCallback(o=>{t(o),localStorage.setItem("cascade_token",o)},[]),i=h.useCallback(()=>{t(null),localStorage.removeItem("cascade_token")},[]);return s?a.jsx("div",{className:"flex items-center justify-center w-full h-full bg-[var(--bg-base)]",children:a.jsxs("div",{className:"flex flex-col items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 rounded-full border-2 border-[var(--accent)] border-t-transparent animate-spin"}),a.jsx("p",{className:"section-label",children:"Connecting…"})]})}):e===null?a.jsx(Fr,{onLogin:r}):a.jsx(Fi,{token:e,onLogout:i,onNeedAuth:()=>{t(null),localStorage.removeItem("cascade_token")}})}function Fi({token:e,onLogout:t,onNeedAuth:s}){const n=Ae(),[r,i]=h.useState("topology"),[o,l]=h.useState(null),[c,d]=h.useState({}),[u,m]=h.useState(null),[p,f]=h.useState(0),[g,y]=h.useState(0),v=U(_r),x=U(nt),b=U(Nr),_=h.useRef(u);_.current=u;const w=h.useCallback(async(N="workspace")=>{try{const z=await fetch(`/api/runtime?scope=${N}`,{headers:{Authorization:`Bearer ${e}`},cache:"no-store"});if(z.status===401){s();return}if(z.ok){const Me=await z.json();n(ds(Me))}}catch{}},[e,n,s]),{socket:j}=Lr({url:"/",token:e,activeSessionId:x==null?void 0:x.sessionId,onRuntimeRefresh:N=>w(N??"workspace"),onStreamToken:N=>{d(z=>{const Me=z[N.tierId]||"";return{...z,[N.tierId]:(Me+N.text).slice(-8e3)}})},onCostUpdate:N=>{typeof N.totalCostUsd=="number"&&f(N.totalCostUsd),typeof N.totalTokens=="number"&&y(N.totalTokens)},onEscalation:N=>{_.current||m(N)}});h.useEffect(()=>{w()},[w]);const C=h.useMemo(()=>v.map(N=>({id:N.tierId,role:N.role,label:N.label,status:N.status,action:N.currentAction,progressPct:N.progressPct})),[v]),k=h.useMemo(()=>v.filter(N=>N.parentId).map(N=>({from:N.parentId,to:N.tierId})),[v]),I=h.useMemo(()=>v.find(N=>N.tierId===o)??null,[v,o]),S=h.useCallback((N,z)=>{!u||!j||(j.emit("permission:decision",{requestId:u.id,approved:N,always:z,decidedBy:"USER"}),m(null))},[u,j]),T=o!==null;return a.jsxs("div",{className:"flex h-full w-full overflow-hidden bg-[var(--bg-base)]",children:[a.jsx(ti,{activeTab:r,onTabChange:i,onLogout:t}),a.jsxs("div",{className:"flex flex-col flex-1 min-w-0 overflow-hidden",children:[a.jsx(ri,{isConnected:b,totalCostUsd:p,totalTokens:g}),a.jsxs("div",{className:"flex flex-1 min-h-0 overflow-hidden",children:[a.jsxs("main",{className:"flex-1 min-w-0 overflow-hidden relative dot-grid",children:[r==="topology"&&a.jsx(li,{nodes:C,edges:k,selectedNodeId:o??void 0,onSelectNode:l}),r==="sessions"&&a.jsx(mi,{}),r==="logs"&&a.jsx(Ii,{}),r==="settings"&&a.jsx(Mi,{token:e})]}),r==="topology"&&T&&a.jsx(di,{node:I,streamLog:o&&c[o]||"",onClose:()=>l(null)})]})]}),u&&a.jsx(ui,{request:u,onDecide:S})]})}Ve.createRoot(document.getElementById("root")).render(a.jsx(ks.StrictMode,{children:a.jsx(en,{store:kr,children:a.jsx(Li,{})})}));
@@ -1 +0,0 @@
1
- @import"https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;700&family=IBM+Plex+Sans:wght@300;400;500;600;700&display=swap";.react-flow{direction:ltr}.react-flow__container{position:absolute;width:100%;height:100%;top:0;left:0}.react-flow__pane{z-index:1;cursor:grab}.react-flow__pane.selection{cursor:pointer}.react-flow__pane.dragging{cursor:grabbing}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow .react-flow__edges{pointer-events:none;overflow:visible}.react-flow__edge-path,.react-flow__connection-path{stroke:#b1b1b7;stroke-width:1;fill:none}.react-flow__edge{pointer-events:visibleStroke;cursor:pointer}.react-flow__edge.animated path{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray:none;animation:none}.react-flow__edge.inactive{pointer-events:none}.react-flow__edge.selected,.react-flow__edge:focus,.react-flow__edge:focus-visible{outline:none}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge:focus .react-flow__edge-path,.react-flow__edge:focus-visible .react-flow__edge-path{stroke:#555}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge-textbg{fill:#fff}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__connectionline{z-index:1001}.react-flow__nodes{pointer-events:none;transform-origin:0 0}.react-flow__node{position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:grab}.react-flow__node.dragging{cursor:grabbing}.react-flow__nodesselection{z-index:3;transform-origin:left top;pointer-events:none}.react-flow__nodesselection-rect{position:absolute;pointer-events:all;cursor:grab}.react-flow__handle{position:absolute;pointer-events:none;min-width:5px;min-height:5px;width:6px;height:6px;background:#1a192b;border:1px solid white;border-radius:100%}.react-flow__handle.connectionindicator{pointer-events:all;cursor:crosshair}.react-flow__handle-bottom{top:auto;left:50%;bottom:-4px;transform:translate(-50%)}.react-flow__handle-top{left:50%;top:-4px;transform:translate(-50%)}.react-flow__handle-left{top:50%;left:-4px;transform:translateY(-50%)}.react-flow__handle-right{right:-4px;top:50%;transform:translateY(-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__panel{position:absolute;z-index:5;margin:15px}.react-flow__panel.top{top:0}.react-flow__panel.bottom{bottom:0}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.center{left:50%;transform:translate(-50%)}.react-flow__attribution{font-size:10px;background:#ffffff80;padding:2px 3px;margin:0}.react-flow__attribution a{text-decoration:none;color:#999}@keyframes dashdraw{0%{stroke-dashoffset:10}}.react-flow__edgelabel-renderer{position:absolute;width:100%;height:100%;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__edge.updating .react-flow__edge-path{stroke:#777}.react-flow__edge-text{font-size:10px}.react-flow__node.selectable:focus,.react-flow__node.selectable:focus-visible{outline:none}.react-flow__node-default,.react-flow__node-input,.react-flow__node-output,.react-flow__node-group{padding:10px;border-radius:3px;width:150px;font-size:12px;color:#222;text-align:center;border-width:1px;border-style:solid;border-color:#1a192b;background-color:#fff}.react-flow__node-default.selectable:hover,.react-flow__node-input.selectable:hover,.react-flow__node-output.selectable:hover,.react-flow__node-group.selectable:hover{box-shadow:0 1px 4px 1px #00000014}.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.selectable:focus-visible,.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-output.selectable:focus-visible,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus,.react-flow__node-group.selectable:focus-visible{box-shadow:0 0 0 .5px #1a192b}.react-flow__node-group{background-color:#f0f0f040}.react-flow__nodesselection-rect,.react-flow__selection{background:#0059dc14;border:1px dotted rgba(0,89,220,.8)}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible,.react-flow__selection:focus,.react-flow__selection:focus-visible{outline:none}.react-flow__controls{box-shadow:0 0 2px 1px #00000014}.react-flow__controls-button{border:none;background:#fefefe;border-bottom:1px solid #eee;box-sizing:content-box;display:flex;justify-content:center;align-items:center;width:16px;height:16px;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;padding:5px}.react-flow__controls-button:hover{background:#f4f4f4}.react-flow__controls-button svg{width:100%;max-width:12px;max-height:12px}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__minimap{background-color:#fff}.react-flow__minimap svg{display:block}.react-flow__resize-control{position:absolute}.react-flow__resize-control.left,.react-flow__resize-control.right{cursor:ew-resize}.react-flow__resize-control.top,.react-flow__resize-control.bottom{cursor:ns-resize}.react-flow__resize-control.top.left,.react-flow__resize-control.bottom.right{cursor:nwse-resize}.react-flow__resize-control.bottom.left,.react-flow__resize-control.top.right{cursor:nesw-resize}.react-flow__resize-control.handle{width:4px;height:4px;border:1px solid #fff;border-radius:1px;background-color:#3367d9;transform:translate(-50%,-50%)}.react-flow__resize-control.handle.left{left:0;top:50%}.react-flow__resize-control.handle.right{left:100%;top:50%}.react-flow__resize-control.handle.top{left:50%;top:0}.react-flow__resize-control.handle.bottom{left:50%;top:100%}.react-flow__resize-control.handle.top.left,.react-flow__resize-control.handle.bottom.left{left:0}.react-flow__resize-control.handle.top.right,.react-flow__resize-control.handle.bottom.right{left:100%}.react-flow__resize-control.line{border-color:#3367d9;border-width:0;border-style:solid}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{width:1px;transform:translate(-50%);top:0;height:100%}.react-flow__resize-control.line.left{left:0;border-left-width:1px}.react-flow__resize-control.line.right{left:100%;border-right-width:1px}.react-flow__resize-control.line.top,.react-flow__resize-control.line.bottom{height:1px;transform:translateY(-50%);left:0;width:100%}.react-flow__resize-control.line.top{top:0;border-top-width:1px}.react-flow__resize-control.line.bottom{border-bottom-width:1px;top:100%}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:JetBrains Mono,Fira Code,Cascadia Code,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.pointer-events-none{pointer-events:none}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.inset-x-0{left:0;right:0}.\!bottom-\[-4px\]{bottom:-4px!important}.\!top-\[-4px\]{top:-4px!important}.bottom-0{bottom:0}.bottom-4{bottom:1rem}.bottom-\[20\%\]{bottom:20%}.left-1\/2{left:50%}.left-\[30\%\]{left:30%}.left-full{left:100%}.right-\[25\%\]{right:25%}.top-0{top:0}.top-\[20\%\]{top:20%}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-auto{margin-left:auto;margin-right:auto}.mb-0\.5{margin-bottom:.125rem}.mb-1{margin-bottom:.25rem}.mb-1\.5{margin-bottom:.375rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-2\.5{margin-top:.625rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.block{display:block}.flex{display:flex}.grid{display:grid}.\!h-1\.5{height:.375rem!important}.h-1{height:.25rem}.h-1\.5{height:.375rem}.h-11{height:2.75rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-3{height:.75rem}.h-4{height:1rem}.h-6{height:1.5rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[320px\]{height:320px}.h-\[480px\]{height:480px}.h-full{height:100%}.min-h-0{min-height:0px}.\!w-1\.5{width:.375rem!important}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-11{width:2.75rem}.w-16{width:4rem}.w-24{width:6rem}.w-28{width:7rem}.w-3{width:.75rem}.w-44{width:11rem}.w-6{width:1.5rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-\[120px\]{width:120px}.w-\[28px\]{width:28px}.w-\[300px\]{width:300px}.w-\[320px\]{width:320px}.w-\[480px\]{width:480px}.w-\[56px\]{width:56px}.w-\[64px\]{width:64px}.w-\[72px\]{width:72px}.w-full{width:100%}.min-w-0{min-width:0px}.min-w-\[170px\]{min-width:170px}.max-w-2xl{max-width:42rem}.max-w-\[120px\]{max-width:120px}.max-w-\[200px\]{max-width:200px}.max-w-\[210px\]{max-width:210px}.max-w-\[360px\]{max-width:360px}.max-w-\[460px\]{max-width:460px}.flex-1{flex:1 1 0%}.flex-shrink-0{flex-shrink:0}.-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\[-4px\]{--tw-translate-x: -4px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-none{resize:none}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-2\.5{gap:.625rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-5{gap:1.25rem}.gap-6{gap:1.5rem}.gap-\[2px\]{gap:2px}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.divide-\[var\(--border-base\)\]>:not([hidden])~:not([hidden]){border-color:var(--border-base)}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-\[3px\]{border-radius:3px}.rounded-\[var\(--radius-lg\)\]{border-radius:var(--radius-lg)}.rounded-\[var\(--radius-md\)\]{border-radius:var(--radius-md)}.rounded-\[var\(--radius-sm\)\]{border-radius:var(--radius-sm)}.rounded-\[var\(--radius-xs\)\]{border-radius:var(--radius-xs)}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.\!border-none{border-style:none!important}.border-\[rgba\(245\,166\,35\,0\.22\)\]{border-color:#f5a62338}.border-\[var\(--accent\)\]{border-color:var(--accent)}.border-\[var\(--border-base\)\]{border-color:var(--border-base)}.border-\[var\(--border-strong\)\]{border-color:var(--border-strong)}.border-\[var\(--border-subtle\)\]{border-color:var(--border-subtle)}.border-\[var\(--error\)\]{border-color:var(--error)}.border-\[var\(--success\)\]{border-color:var(--success)}.border-\[var\(--t3-color\)\]{border-color:var(--t3-color)}.border-\[var\(--warning\)\]{border-color:var(--warning)}.border-red-500\/20{border-color:#ef444433}.border-transparent{border-color:transparent}.border-white\/40{border-color:#fff6}.border-t-transparent{border-top-color:transparent}.border-t-white{--tw-border-opacity: 1;border-top-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.\!bg-\[var\(--border-strong\)\]{background-color:var(--border-strong)!important}.bg-\[rgba\(245\,166\,35\,0\.1\)\]{background-color:#f5a6231a}.bg-\[var\(--accent\)\]{background-color:var(--accent)}.bg-\[var\(--bg-base\)\]{background-color:var(--bg-base)}.bg-\[var\(--bg-elevated\)\]{background-color:var(--bg-elevated)}.bg-\[var\(--bg-overlay\)\]{background-color:var(--bg-overlay)}.bg-\[var\(--bg-surface\)\]{background-color:var(--bg-surface)}.bg-\[var\(--error\)\]{background-color:var(--error)}.bg-\[var\(--success\)\]{background-color:var(--success)}.bg-\[var\(--t3-color\)\]{background-color:var(--t3-color)}.bg-\[var\(--text-faint\)\]{background-color:var(--text-faint)}.bg-black\/65{background-color:#000000a6}.bg-red-500\/10{background-color:#ef44441a}.bg-transparent{background-color:transparent}.bg-yellow-400{--tw-bg-opacity: 1;background-color:rgb(250 204 21 / var(--tw-bg-opacity, 1))}.bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--tw-gradient-stops))}.bg-gradient-to-t{background-image:linear-gradient(to top,var(--tw-gradient-stops))}.from-\[var\(--bg-base\)\]{--tw-gradient-from: var(--bg-base) var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-transparent{--tw-gradient-to: transparent var(--tw-gradient-to-position)}.p-1\.5{padding:.375rem}.p-2\.5{padding:.625rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-3\.5{padding-left:.875rem;padding-right:.875rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-16{padding-top:4rem;padding-bottom:4rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-3\.5{padding-top:.875rem;padding-bottom:.875rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.pb-4{padding-bottom:1rem}.pl-5{padding-left:1.25rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-5{padding-top:1.25rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:JetBrains Mono,Fira Code,Cascadia Code,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[12px\]{font-size:12px}.text-\[13px\]{font-size:13px}.text-\[14px\]{font-size:14px}.text-\[15px\]{font-size:15px}.text-\[8px\]{font-size:8px}.text-\[9\.5px\]{font-size:9.5px}.text-\[9px\]{font-size:9px}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-black{font-weight:900}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-\[1\.7\]{line-height:1.7}.leading-snug{line-height:1.375}.tracking-tight{letter-spacing:-.025em}.tracking-tighter{letter-spacing:-.05em}.tracking-wider{letter-spacing:.05em}.text-\[var\(--accent\)\]{color:var(--accent)}.text-\[var\(--error\)\]{color:var(--error)}.text-\[var\(--success\)\]{color:var(--success)}.text-\[var\(--t3-color\)\]{color:var(--t3-color)}.text-\[var\(--text-faint\)\]{color:var(--text-faint)}.text-\[var\(--text-muted\)\]{color:var(--text-muted)}.text-\[var\(--text-primary\)\]{color:var(--text-primary)}.text-\[var\(--warning\)\]{color:var(--warning)}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.accent-\[var\(--accent\)\]{accent-color:var(--accent)}.opacity-0{opacity:0}.opacity-40{opacity:.4}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-\[0\.035\]{opacity:.035}.opacity-\[0\.03\]{opacity:.03}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[var\(--shadow-glow-green\)\]{--tw-shadow-color: var(--shadow-glow-green);--tw-shadow: var(--tw-shadow-colored)}.shadow-\[var\(--shadow-glow-violet\)\]{--tw-shadow-color: var(--shadow-glow-violet);--tw-shadow: var(--tw-shadow-colored)}.shadow-\[var\(--shadow-panel\)\]{--tw-shadow-color: var(--shadow-panel);--tw-shadow: var(--tw-shadow-colored)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-\[var\(--accent\)\]{--tw-ring-color: var(--accent)}.ring-offset-2{--tw-ring-offset-width: 2px}.ring-offset-\[var\(--bg-base\)\]{--tw-ring-offset-color: var(--bg-base)}.blur-\[120px\]{--tw-blur: blur(120px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.blur-\[140px\]{--tw-blur: blur(140px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-\[6px\]{--tw-backdrop-blur: blur(6px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-100{transition-duration:.1s}.duration-150{transition-duration:.15s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}:root{--bg-base: #06080f;--bg-surface: #0b0e18;--bg-elevated: #111422;--bg-overlay: #191d2e;--bg-toast: #1e2235;--border-subtle: rgba(255, 255, 255, .055);--border-strong: rgba(255, 255, 255, .11);--border-accent: rgba(124, 106, 247, .3);--t1-color: #f5a623;--t2-color: #b87fff;--t3-color: #00d4e8;--t1-glow: rgba(245, 166, 35, .22);--t2-glow: rgba(184, 127, 255, .22);--t3-glow: rgba(0, 212, 232, .22);--accent: #7c6af7;--accent-dim: rgba(124, 106, 247, .18);--accent-glow: rgba(124, 106, 247, .32);--success: #22d47a;--warning: #f5a623;--error: #ff4d6a;--info: #3b82f6;--text-primary: #dce4f0;--text-secondary: #8b96aa;--text-muted: #556070;--text-faint: #2e3848;--radius-xs: 4px;--radius-sm: 6px;--radius-md: 10px;--radius-lg: 16px;--radius-xl: 22px;--shadow-glow-violet: 0 0 24px rgba(124, 106, 247, .35);--shadow-glow-cyan: 0 0 20px rgba(0, 212, 232, .3);--shadow-glow-green: 0 0 18px rgba(34, 212, 122, .28);--shadow-glow-red: 0 0 18px rgba(255, 77, 106, .28);--shadow-glow-amber: 0 0 18px rgba(245, 166, 35, .28);--shadow-glow-t2: 0 0 20px rgba(184, 127, 255, .28);--shadow-panel: 0 0 0 1px var(--border-subtle), 0 8px 32px rgba(0, 0, 0, .5);--shadow-dialog: 0 0 0 1px var(--border-strong), 0 28px 72px rgba(0, 0, 0, .75);--shadow-card: 0 2px 12px rgba(0, 0, 0, .4)}*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}html,body,#root{height:100%;width:100%;overflow:hidden}body{background:var(--bg-base);color:var(--text-primary);font-family:IBM Plex Sans,system-ui,sans-serif;font-size:13px;line-height:1.6;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility}::-webkit-scrollbar{width:4px;height:4px}::-webkit-scrollbar-track{background:transparent}::-webkit-scrollbar-thumb{background:var(--border-strong);border-radius:99px}::-webkit-scrollbar-thumb:hover{background:#7c6af773}.font-mono,code,kbd,pre{font-family:IBM Plex Mono,JetBrains Mono,monospace}.glass{background:#ffffff06;backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);border:1px solid var(--border-subtle)}.glass-elevated{background:#ffffff0b;backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px);border:1px solid var(--border-strong)}.dot-grid{background-image:radial-gradient(circle,rgba(255,255,255,.032) 1px,transparent 1px);background-size:24px 24px}.scanlines:before{content:"";position:absolute;top:0;right:0;bottom:0;left:0;background:repeating-linear-gradient(to bottom,transparent 0px,transparent 2px,rgba(0,0,0,.06) 2px,rgba(0,0,0,.06) 4px);pointer-events:none;z-index:1}@keyframes fade-in-up{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}@keyframes fade-in{0%{opacity:0}to{opacity:1}}@keyframes slide-in-right{0%{opacity:0;transform:translate(16px)}to{opacity:1;transform:translate(0)}}@keyframes slide-up{0%{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}@keyframes pulse-glow{0%,to{opacity:.5;transform:scale(.85)}50%{opacity:1;transform:scale(1.15)}}@keyframes orbit{0%{transform:rotate(0) translate(22px) rotate(0)}to{transform:rotate(360deg) translate(22px) rotate(-360deg)}}@keyframes blink{0%,to{opacity:1}50%{opacity:0}}@keyframes spin-slow{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes status-pulse{0%,to{box-shadow:0 0 4px currentColor}50%{box-shadow:0 0 12px currentColor}}@keyframes row-in{0%{opacity:0;transform:translate(-4px)}to{opacity:1;transform:translate(0)}}.animate-fade-in-up{animation:fade-in-up .35s cubic-bezier(.22,.68,0,1.1) both}.animate-fade-in{animation:fade-in .25s ease both}.animate-slide-in{animation:slide-in-right .28s cubic-bezier(.22,.68,0,1.1) both}.animate-slide-up{animation:slide-up .25s ease both}.animate-blink{animation:blink 1.1s step-start infinite}.animate-spin-slow{animation:spin-slow 2s linear infinite}.badge{display:inline-flex;align-items:center;gap:3px;padding:2px 7px;border-radius:3px;font-size:9px;font-weight:700;letter-spacing:.1em;text-transform:uppercase;font-family:IBM Plex Mono,monospace;border:1px solid transparent;white-space:nowrap}.badge-T1{background:#f5a6231a;color:var(--t1-color);border-color:#f5a62338}.badge-T2{background:#b87fff1a;color:var(--t2-color);border-color:#b87fff38}.badge-T3,.badge-ACTIVE{background:#00d4e814;color:var(--t3-color);border-color:#00d4e833}.badge-COMPLETED{background:#22d47a14;color:var(--success);border-color:#22d47a33}.badge-FAILED{background:#ff4d6a14;color:var(--error);border-color:#ff4d6a33}.badge-ESCALATED{background:#f5a6231a;color:var(--warning);border-color:#f5a62338}.badge-IDLE{background:#5560701a;color:var(--text-muted);border-color:var(--border-subtle)}.btn{display:inline-flex;align-items:center;gap:6px;padding:6px 14px;border-radius:var(--radius-sm);font-size:11px;font-weight:600;cursor:pointer;transition:all .12s ease;border:1px solid transparent;white-space:nowrap;letter-spacing:.02em;font-family:IBM Plex Mono,monospace}.btn:disabled{opacity:.45;cursor:not-allowed}.btn-primary{background:var(--accent);color:#fff;border-color:#7c6af799}.btn-primary:hover:not(:disabled){background:#9080f9;box-shadow:var(--shadow-glow-violet)}.btn-ghost{background:transparent;color:var(--text-secondary);border-color:var(--border-subtle)}.btn-ghost:hover:not(:disabled){background:var(--bg-elevated);color:var(--text-primary);border-color:var(--border-strong)}.btn-danger{background:#ff4d6a1a;color:var(--error);border-color:#ff4d6a40}.btn-danger:hover:not(:disabled){background:#ff4d6a2e}.btn-success{background:#22d47a1a;color:var(--success);border-color:#22d47a40}.btn-success:hover:not(:disabled){background:#22d47a2e}.nav-rail-btn{display:flex;align-items:center;justify-content:center;width:42px;height:42px;border-radius:var(--radius-sm);color:var(--text-faint);cursor:pointer;transition:all .12s ease;border:1px solid transparent;position:relative}.nav-rail-btn:hover{background:var(--bg-elevated);color:var(--text-secondary)}.nav-rail-btn.active{background:var(--accent-dim);color:var(--accent);border-color:var(--border-accent)}.nav-rail-btn.active:before{content:"";position:absolute;left:-1px;top:20%;height:60%;width:2px;background:var(--accent);border-radius:0 2px 2px 0;box-shadow:var(--shadow-glow-violet)}.input{background:var(--bg-elevated);border:1px solid var(--border-subtle);border-radius:var(--radius-sm);color:var(--text-primary);font-family:IBM Plex Mono,monospace;font-size:12px;padding:8px 12px;outline:none;transition:border-color .12s ease,box-shadow .12s ease;width:100%}.input:focus{border-color:var(--accent);box-shadow:0 0 0 3px #7c6af71f}.input::-moz-placeholder{color:var(--text-faint)}.input::placeholder{color:var(--text-faint)}.progress-track{height:2px;background:var(--bg-overlay);border-radius:99px;overflow:hidden}.progress-fill{height:100%;border-radius:99px;background:linear-gradient(90deg,var(--accent) 0%,var(--t3-color) 100%);transition:width .5s cubic-bezier(.4,0,.2,1);box-shadow:0 0 8px var(--accent-glow)}.divider{height:1px;background:var(--border-subtle)}.divider-v{width:1px;background:var(--border-subtle)}.shadow-panel{box-shadow:var(--shadow-panel)}.shadow-dialog{box-shadow:var(--shadow-dialog)}.shadow-card{box-shadow:var(--shadow-card)}.agent-node-ACTIVE{box-shadow:0 0 16px var(--t3-glow)}.agent-node-COMPLETED{box-shadow:0 0 14px #22d47a33}.agent-node-FAILED{box-shadow:0 0 14px #ff4d6a33}.agent-node-ESCALATED{box-shadow:0 0 14px var(--t1-glow)}.react-flow__background{background:var(--bg-base)!important}.react-flow__node{font-family:IBM Plex Sans,sans-serif!important}.react-flow__controls{background:var(--bg-elevated)!important;border:1px solid var(--border-subtle)!important;border-radius:var(--radius-sm)!important;box-shadow:none!important;gap:0!important}.react-flow__controls-button{background:transparent!important;border:none!important;border-bottom:1px solid var(--border-subtle)!important;color:var(--text-muted)!important;fill:var(--text-muted)!important;width:28px!important;height:28px!important}.react-flow__controls-button:last-child{border-bottom:none!important}.react-flow__controls-button:hover{background:var(--bg-overlay)!important;fill:var(--text-primary)!important}.react-flow__edge-path{stroke:#7c6af74d!important}.react-flow__edge.animated .react-flow__edge-path{stroke-dasharray:6 3}.terminal-cursor:after{content:"█";color:var(--t3-color);animation:blink 1.1s step-start infinite;font-size:.85em;margin-left:1px}.section-label{font-family:IBM Plex Mono,monospace;font-size:9px;font-weight:700;letter-spacing:.14em;text-transform:uppercase;color:var(--text-muted)}.metric-chip{display:flex;align-items:baseline;gap:5px}.metric-chip .label{font-family:IBM Plex Mono,monospace;font-size:9px;font-weight:500;letter-spacing:.1em;text-transform:uppercase;color:var(--text-faint)}.metric-chip .value{font-family:IBM Plex Mono,monospace;font-size:12px;font-weight:600;color:var(--text-primary)}.hover\:border-\[var\(--border-strong\)\]:hover{border-color:var(--border-strong)}.hover\:bg-\[var\(--bg-elevated\)\]:hover{background-color:var(--bg-elevated)}.hover\:bg-red-500\/20:hover{background-color:#ef444433}.hover\:text-\[var\(--error\)\]:hover{color:var(--error)}.hover\:text-\[var\(--text-muted\)\]:hover{color:var(--text-muted)}.hover\:text-\[var\(--text-primary\)\]:hover{color:var(--text-primary)}.hover\:opacity-100:hover{opacity:1}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:opacity-100{opacity:1}