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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cascade-ai",
3
- "version": "0.3.0",
3
+ "version": "0.5.1",
4
4
  "description": "Multi-tier AI orchestration CLI — T1/T2/T3 hierarchical agent system",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -0,0 +1,225 @@
1
+ var Ts=Object.defineProperty;var Ms=(e,t,s)=>t in e?Ts(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var De=(e,t,s)=>Ms(e,typeof t!="symbol"?t+"":t,s);import{r as m,a as qt,H as dt,P as ut,M as ft,R as As,B as Os,b as Rs,C as Ps,c as Ds}from"./reactflow-B1e2RnXD.js";import{l as zs}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 a of r)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function s(r){const a={};return r.integrity&&(a.integrity=r.integrity),r.referrerPolicy&&(a.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?a.credentials="include":r.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function n(r){if(r.ep)return;r.ep=!0;const a=s(r);fetch(r.href,a)}})();var Kt={exports:{}},Ce={};/**
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 Ls=m,$s=Symbol.for("react.element"),Fs=Symbol.for("react.fragment"),Us=Object.prototype.hasOwnProperty,Bs=Ls.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Vs={key:!0,ref:!0,__self:!0,__source:!0};function Gt(e,t,s){var n,r={},a=null,o=null;s!==void 0&&(a=""+s),t.key!==void 0&&(a=""+t.key),t.ref!==void 0&&(o=t.ref);for(n in t)Us.call(t,n)&&!Vs.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:$s,type:e,key:a,ref:o,props:r,_owner:Bs.current}}Ce.Fragment=Fs;Ce.jsx=Gt;Ce.jsxs=Gt;Kt.exports=Ce;var i=Kt.exports,Ge={},ht=qt;Ge.createRoot=ht.createRoot,Ge.hydrateRoot=ht.hydrateRoot;var Jt={exports:{}},Xt={};/**
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 oe=m;function Ws(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Hs=typeof Object.is=="function"?Object.is:Ws,qs=oe.useSyncExternalStore,Ks=oe.useRef,Gs=oe.useEffect,Js=oe.useMemo,Xs=oe.useDebugValue;Xt.useSyncExternalStoreWithSelector=function(e,t,s,n,r){var a=Ks(null);if(a.current===null){var o={hasValue:!1,value:null};a.current=o}else o=a.current;a=Js(function(){function c(h){if(!d){if(d=!0,u=h,h=n(h),r!==void 0&&o.hasValue){var g=o.value;if(r(g,h))return f=g}return f=h}if(g=f,Hs(u,h))return g;var x=n(h);return r!==void 0&&r(g,x)?(u=h,g):(u=h,f=x)}var d=!1,u,f,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=qs(e,a[0],a[1]);return Gs(function(){o.hasValue=!0,o.value=l},[l]),Xs(l),l};Jt.exports=Xt;var Ys=Jt.exports;function Zs(e){e()}function Qs(){let e=null,t=null;return{clear(){e=null,t=null},notify(){Zs(()=>{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 mt={notify(){},get:()=>[]};function en(e,t){let s,n=mt,r=0,a=!1;function o(x){u();const v=n.subscribe(x);let y=!1;return()=>{y||(y=!0,v(),f())}}function l(){n.notify()}function c(){g.onStateChange&&g.onStateChange()}function d(){return a}function u(){r++,s||(s=e.subscribe(c),n=Qs())}function f(){r--,s&&r===0&&(s(),s=void 0,n.clear(),n=mt)}function p(){a||(a=!0,u())}function h(){a&&(a=!1,f())}const g={addNestedSub:o,notifyNestedSubs:l,handleChangeWrapper:c,isSubscribed:d,trySubscribe:p,tryUnsubscribe:h,getListeners:()=>n};return g}var tn=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",sn=tn(),nn=()=>typeof navigator<"u"&&navigator.product==="ReactNative",rn=nn(),an=()=>sn||rn?m.useLayoutEffect:m.useEffect,on=an(),ze=Symbol.for("react-redux-context"),Le=typeof globalThis<"u"?globalThis:{};function ln(){if(!m.createContext)return{};const e=Le[ze]??(Le[ze]=new Map);let t=e.get(m.createContext);return t||(t=m.createContext(null),e.set(m.createContext,t)),t}var V=ln();function cn(e){const{children:t,context:s,serverState:n,store:r}=e,a=m.useMemo(()=>{const c=en(r);return{store:r,subscription:c,getServerState:n?()=>n:void 0}},[r,n]),o=m.useMemo(()=>r.getState(),[r]);on(()=>{const{subscription:c}=a;return c.onStateChange=c.notifyNestedSubs,c.trySubscribe(),o!==r.getState()&&c.notifyNestedSubs(),()=>{c.tryUnsubscribe(),c.onStateChange=void 0}},[a,o]);const l=s||V;return m.createElement(l.Provider,{value:a},t)}var dn=cn;function nt(e=V){return function(){return m.useContext(e)}}var Yt=nt();function Zt(e=V){const t=e===V?Yt:nt(e),s=()=>{const{store:n}=t();return n};return Object.assign(s,{withTypes:()=>s}),s}var un=Zt();function fn(e=V){const t=e===V?un:Zt(e),s=()=>t().dispatch;return Object.assign(s,{withTypes:()=>s}),s}var hn=fn(),mn=(e,t)=>e===t;function pn(e=V){const t=e===V?Yt:nt(e),s=(n,r={})=>{const{equalityFn:a=mn}=typeof r=="function"?{equalityFn:r}:r,o=t(),{store:l,subscription:c,getServerState:d}=o;m.useRef(!0);const u=m.useCallback({[n.name](p){return n(p)}}[n.name],[n]),f=Ys.useSyncExternalStoreWithSelector(c.addNestedSub,l.getState,d||l.getState,u,a);return m.useDebugValue(f),f};return Object.assign(s,{withTypes:()=>s}),s}var xn=pn();function T(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 gn=typeof Symbol=="function"&&Symbol.observable||"@@observable",pt=gn,$e=()=>Math.random().toString(36).substring(7).split("").join("."),vn={INIT:`@@redux/INIT${$e()}`,REPLACE:`@@redux/REPLACE${$e()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${$e()}`},be=vn;function rt(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 Qt(e,t,s){if(typeof e!="function")throw new Error(T(2));if(typeof t=="function"&&typeof s=="function"||typeof s=="function"&&typeof arguments[3]=="function")throw new Error(T(0));if(typeof t=="function"&&typeof s>"u"&&(s=t,t=void 0),typeof s<"u"){if(typeof s!="function")throw new Error(T(1));return s(Qt)(e,t)}let n=e,r=t,a=new Map,o=a,l=0,c=!1;function d(){o===a&&(o=new Map,a.forEach((v,y)=>{o.set(y,v)}))}function u(){if(c)throw new Error(T(3));return r}function f(v){if(typeof v!="function")throw new Error(T(4));if(c)throw new Error(T(5));let y=!0;d();const b=l++;return o.set(b,v),function(){if(y){if(c)throw new Error(T(6));y=!1,d(),o.delete(b),a=null}}}function p(v){if(!rt(v))throw new Error(T(7));if(typeof v.type>"u")throw new Error(T(8));if(typeof v.type!="string")throw new Error(T(17));if(c)throw new Error(T(9));try{c=!0,r=n(r,v)}finally{c=!1}return(a=o).forEach(b=>{b()}),v}function h(v){if(typeof v!="function")throw new Error(T(10));n=v,p({type:be.REPLACE})}function g(){const v=f;return{subscribe(y){if(typeof y!="object"||y===null)throw new Error(T(11));function b(){const j=y;j.next&&j.next(u())}return b(),{unsubscribe:v(b)}},[pt](){return this}}}return p({type:be.INIT}),{dispatch:p,subscribe:f,getState:u,replaceReducer:h,[pt]:g}}function bn(e){Object.keys(e).forEach(t=>{const s=e[t];if(typeof s(void 0,{type:be.INIT})>"u")throw new Error(T(12));if(typeof s(void 0,{type:be.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(T(13))})}function yn(e){const t=Object.keys(e),s={};for(let a=0;a<t.length;a++){const o=t[a];typeof e[o]=="function"&&(s[o]=e[o])}const n=Object.keys(s);let r;try{bn(s)}catch(a){r=a}return function(o={},l){if(r)throw r;let c=!1;const d={};for(let u=0;u<n.length;u++){const f=n[u],p=s[f],h=o[f],g=p(h,l);if(typeof g>"u")throw l&&l.type,new Error(T(14));d[f]=g,c=c||g!==h}return c=c||n.length!==Object.keys(o).length,c?d:o}}function ye(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,s)=>(...n)=>t(s(...n)))}function wn(...e){return t=>(s,n)=>{const r=t(s,n);let a=()=>{throw new Error(T(15))};const o={getState:r.getState,dispatch:(c,...d)=>a(c,...d)},l=e.map(c=>c(o));return a=ye(...l)(r.dispatch),{...r,dispatch:a}}}function jn(e){return rt(e)&&"type"in e&&typeof e.type=="string"}var es=Symbol.for("immer-nothing"),xt=Symbol.for("immer-draftable"),A=Symbol.for("immer-state");function D(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var R=Object,X=R.getPrototypeOf,we="constructor",Ee="prototype",Je="configurable",je="enumerable",ge="writable",re="value",F=e=>!!e&&!!e[A];function z(e){var t;return e?ts(e)||Te(e)||!!e[xt]||!!((t=e[we])!=null&&t[xt])||Me(e)||Ae(e):!1}var Sn=R[Ee][we].toString(),gt=new WeakMap;function ts(e){if(!e||!it(e))return!1;const t=X(e);if(t===null||t===R[Ee])return!0;const s=R.hasOwnProperty.call(t,we)&&t[we];if(s===Object)return!0;if(!J(s))return!1;let n=gt.get(s);return n===void 0&&(n=Function.toString.call(s),gt.set(s,n)),n===Sn}function Ie(e,t,s=!0){le(e)===0?(s?Reflect.ownKeys(e):R.keys(e)).forEach(r=>{t(r,e[r],e)}):e.forEach((n,r)=>t(r,n,e))}function le(e){const t=e[A];return t?t.type_:Te(e)?1:Me(e)?2:Ae(e)?3:0}var vt=(e,t,s=le(e))=>s===2?e.has(t):R[Ee].hasOwnProperty.call(e,t),Xe=(e,t,s=le(e))=>s===2?e.get(t):e[t],Se=(e,t,s,n=le(e))=>{n===2?e.set(t,s):n===3?e.add(s):e[t]=s};function _n(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Te=Array.isArray,Me=e=>e instanceof Map,Ae=e=>e instanceof Set,it=e=>typeof e=="object",J=e=>typeof e=="function",Fe=e=>typeof e=="boolean";function Nn(e){const t=+e;return Number.isInteger(t)&&String(t)===e}var L=e=>e.copy_||e.base_,at=e=>e.modified_?e.copy_:e.base_;function Ye(e,t){if(Me(e))return new Map(e);if(Ae(e))return new Set(e);if(Te(e))return Array[Ee].slice.call(e);const s=ts(e);if(t===!0||t==="class_only"&&!s){const n=R.getOwnPropertyDescriptors(e);delete n[A];let r=Reflect.ownKeys(n);for(let a=0;a<r.length;a++){const o=r[a],l=n[o];l[ge]===!1&&(l[ge]=!0,l[Je]=!0),(l.get||l.set)&&(n[o]={[Je]:!0,[ge]:!0,[je]:l[je],[re]:e[o]})}return R.create(X(e),n)}else{const n=X(e);if(n!==null&&s)return{...e};const r=R.create(n);return R.assign(r,e)}}function ot(e,t=!1){return Oe(e)||F(e)||!z(e)||(le(e)>1&&R.defineProperties(e,{set:ue,add:ue,clear:ue,delete:ue}),R.freeze(e),t&&Ie(e,(s,n)=>{ot(n,!0)},!1)),e}function kn(){D(2)}var ue={[re]:kn};function Oe(e){return e===null||!it(e)?!0:R.isFrozen(e)}var _e="MapSet",Ze="Patches",bt="ArrayMethods",ss={};function W(e){const t=ss[e];return t||D(0,e),t}var yt=e=>!!ss[e],ie,ns=()=>ie,Cn=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:yt(_e)?W(_e):void 0,arrayMethodsPlugin_:yt(bt)?W(bt):void 0});function wt(e,t){t&&(e.patchPlugin_=W(Ze),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Qe(e){et(e),e.drafts_.forEach(En),e.drafts_=null}function et(e){e===ie&&(ie=e.parent_)}var jt=e=>ie=Cn(ie,e);function En(e){const t=e[A];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function St(e,t){t.unfinalizedDrafts_=t.drafts_.length;const s=t.drafts_[0];if(e!==void 0&&e!==s){s[A].modified_&&(Qe(t),D(4)),z(e)&&(e=_t(t,e));const{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(s[A].base_,e,t)}else e=_t(t,s);return In(t,e,!0),Qe(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==es?e:void 0}function _t(e,t){if(Oe(t))return t;const s=t[A];if(!s)return Ne(t,e.handledSet_,e);if(!Re(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);as(s,e)}return s.copy_}function In(e,t,s=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&ot(t,s)}function rs(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Re=(e,t)=>e.scope_===t,Tn=[];function is(e,t,s,n){const r=L(e),a=e.type_;if(n!==void 0&&Xe(r,n,a)===t){Se(r,n,s,a);return}if(!e.draftLocations_){const l=e.draftLocations_=new Map;Ie(r,(c,d)=>{if(F(d)){const u=l.get(d)||[];u.push(c),l.set(d,u)}})}const o=e.draftLocations_.get(t)??Tn;for(const l of o)Se(r,l,s,a)}function Mn(e,t,s){e.callbacks_.push(function(r){var l;const a=t;if(!a||!Re(a,r))return;(l=r.mapSetPlugin_)==null||l.fixSetContents(a);const o=at(a);is(e,a.draft_??a,o,s),as(a,r)})}function as(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 a=r.getPath(e);a&&r.generatePatches_(e,a,t)}rs(e)}}function An(e,t,s){const{scope_:n}=e;if(F(s)){const r=s[A];Re(r,n)&&r.callbacks_.push(function(){ve(e);const o=at(r);is(e,s,o,t)})}else z(s)&&e.callbacks_.push(function(){const a=L(e);e.type_===3?a.has(s)&&Ne(s,n.handledSet_,n):Xe(a,t,e.type_)===s&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Ne(Xe(e.copy_,t,e.type_),n.handledSet_,n)})}function Ne(e,t,s){return!s.immer_.autoFreeze_&&s.unfinalizedDrafts_<1||F(e)||t.has(e)||!z(e)||Oe(e)||(t.add(e),Ie(e,(n,r)=>{if(F(r)){const a=r[A];if(Re(a,s)){const o=at(a);Se(e,n,o,e.type_),rs(a)}}else z(r)&&Ne(r,t,s)})),e}function On(e,t){const s=Te(e),n={type_:s?1:0,scope_:t?t.scope_:ns(),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,a=ke;s&&(r=[n],a=ae);const{revoke:o,proxy:l}=Proxy.revocable(r,a);return n.draft_=l,n.revoke_=o,[l,n]}var ke={get(e,t){if(t===A)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=L(e);if(!vt(r,t,e.type_))return Rn(e,r,t);const a=r[t];if(e.finalized_||!z(a)||n&&e.operationMethod&&(s!=null&&s.isMutatingArrayMethod(e.operationMethod))&&Nn(t))return a;if(a===Ue(e.base_,t)){ve(e);const o=e.type_===1?+t:t,l=st(e.scope_,a,e,o);return e.copy_[o]=l}return a},has(e,t){return t in L(e)},ownKeys(e){return Reflect.ownKeys(L(e))},set(e,t,s){const n=os(L(e),t);if(n!=null&&n.set)return n.set.call(e.draft_,s),!0;if(!e.modified_){const r=Ue(L(e),t),a=r==null?void 0:r[A];if(a&&a.base_===s)return e.copy_[t]=s,e.assigned_.set(t,!1),!0;if(_n(s,r)&&(s!==void 0||vt(e.base_,t,e.type_)))return!0;ve(e),tt(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),An(e,t,s)),!0},deleteProperty(e,t){return ve(e),Ue(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),tt(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const s=L(e),n=Reflect.getOwnPropertyDescriptor(s,t);return n&&{[ge]:!0,[Je]:e.type_!==1||t!=="length",[je]:n[je],[re]:s[t]}},defineProperty(){D(11)},getPrototypeOf(e){return X(e.base_)},setPrototypeOf(){D(12)}},ae={};for(let e in ke){let t=ke[e];ae[e]=function(){const s=arguments;return s[0]=s[0][0],t.apply(this,s)}}ae.deleteProperty=function(e,t){return ae.set.call(this,e,t,void 0)};ae.set=function(e,t,s){return ke.set.call(this,e[0],t,s,e[0])};function Ue(e,t){const s=e[A];return(s?L(s):e)[t]}function Rn(e,t,s){var r;const n=os(t,s);return n?re in n?n[re]:(r=n.get)==null?void 0:r.call(e.draft_):void 0}function os(e,t){if(!(t in e))return;let s=X(e);for(;s;){const n=Object.getOwnPropertyDescriptor(s,t);if(n)return n;s=X(s)}}function tt(e){e.modified_||(e.modified_=!0,e.parent_&&tt(e.parent_))}function ve(e){e.copy_||(e.assigned_=new Map,e.copy_=Ye(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Pn=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,s,n)=>{if(J(t)&&!J(s)){const a=s;s=t;const o=this;return function(c=a,...d){return o.produce(c,u=>s.call(this,u,...d))}}J(s)||D(6),n!==void 0&&!J(n)&&D(7);let r;if(z(t)){const a=jt(this),o=st(a,t,void 0);let l=!0;try{r=s(o),l=!1}finally{l?Qe(a):et(a)}return wt(a,n),St(r,a)}else if(!t||!it(t)){if(r=s(t),r===void 0&&(r=t),r===es&&(r=void 0),this.autoFreeze_&&ot(r,!0),n){const a=[],o=[];W(Ze).generateReplacementPatches_(t,r,{patches_:a,inversePatches_:o}),n(a,o)}return r}else D(1,t)},this.produceWithPatches=(t,s)=>{if(J(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]},Fe(e==null?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Fe(e==null?void 0:e.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Fe(e==null?void 0:e.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){z(e)||D(8),F(e)&&(e=Dn(e));const t=jt(this),s=st(t,e,void 0);return s[A].isManual_=!0,et(t),s}finishDraft(e,t){const s=e&&e[A];(!s||!s.isManual_)&&D(9);const{scope_:n}=s;return wt(n,t),St(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=W(Ze).applyPatches_;return F(e)?n(e,t):this.produce(e,r=>n(r,t))}};function st(e,t,s,n){const[r,a]=Me(t)?W(_e).proxyMap_(t,s):Ae(t)?W(_e).proxySet_(t,s):On(t,s);return((s==null?void 0:s.scope_)??ns()).drafts_.push(r),a.callbacks_=(s==null?void 0:s.callbacks_)??[],a.key_=n,s&&n!==void 0?Mn(s,a,n):a.callbacks_.push(function(c){var u;(u=c.mapSetPlugin_)==null||u.fixSetContents(a);const{patchPlugin_:d}=c;a.modified_&&d&&d.generatePatches_(a,[],c)}),r}function Dn(e){return F(e)||D(10,e),ls(e)}function ls(e){if(!z(e)||Oe(e))return e;const t=e[A];let s,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,s=Ye(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else s=Ye(e,!0);return Ie(s,(r,a)=>{Se(s,r,ls(a))},n),t&&(t.finalized_=!1),s}var zn=new Pn,cs=zn.produce;function Ln(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function $n(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function Fn(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 Nt=e=>Array.isArray(e)?e:[e];function Un(e){const t=Array.isArray(e[0])?e[0]:e;return Fn(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function Bn(e,t){const s=[],{length:n}=e;for(let r=0;r<n;r++)s.push(e[r].apply(null,t));return s}var Vn=class{constructor(e){this.value=e}deref(){return this.value}},Wn=typeof WeakRef<"u"?WeakRef:Vn,Hn=0,kt=1;function fe(){return{s:Hn,v:void 0,o:null,p:null}}function ds(e,t={}){let s=fe();const{resultEqualityCheck:n}=t;let r,a=0;function o(){var f;let l=s;const{length:c}=arguments;for(let p=0,h=c;p<h;p++){const g=arguments[p];if(typeof g=="function"||typeof g=="object"&&g!==null){let x=l.o;x===null&&(l.o=x=new WeakMap);const v=x.get(g);v===void 0?(l=fe(),x.set(g,l)):l=v}else{let x=l.p;x===null&&(l.p=x=new Map);const v=x.get(g);v===void 0?(l=fe(),x.set(g,l)):l=v}}const d=l;let u;if(l.s===kt)u=l.v;else if(u=e.apply(null,arguments),a++,n){const p=((f=r==null?void 0:r.deref)==null?void 0:f.call(r))??r;p!=null&&n(p,u)&&(u=p,a!==0&&a--),r=typeof u=="object"&&u!==null||typeof u=="function"?new Wn(u):u}return d.s=kt,d.v=u,u}return o.clearCache=()=>{s=fe(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function qn(e,...t){const s=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...r)=>{let a=0,o=0,l,c={},d=r.pop();typeof d=="object"&&(c=d,d=r.pop()),Ln(d,`createSelector expects an output function after the inputs, but received: [${typeof d}]`);const u={...s,...c},{memoize:f,memoizeOptions:p=[],argsMemoize:h=ds,argsMemoizeOptions:g=[]}=u,x=Nt(p),v=Nt(g),y=Un(r),b=f(function(){return a++,d.apply(null,arguments)},...x),w=h(function(){o++;const _=Bn(y,arguments);return l=b.apply(null,_),l},...v);return Object.assign(w,{resultFunc:d,memoizedResultFunc:b,dependencies:y,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>l,recomputations:()=>a,resetRecomputations:()=>{a=0},memoize:f,argsMemoize:h})};return Object.assign(n,{withTypes:()=>n}),n}var H=qn(ds),Kn=Object.assign((e,t=H)=>{$n(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(a=>e[a]);return t(n,(...a)=>a.reduce((o,l,c)=>(o[s[c]]=l,o),{}))},{withTypes:()=>Kn});function us(e){return({dispatch:s,getState:n})=>r=>a=>typeof a=="function"?a(s,n,e):r(a)}var Gn=us(),Jn=us,Xn=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?ye:ye.apply(null,arguments)},Yn=e=>e&&typeof e.match=="function";function se(e,t){function s(...n){if(t){let r=t(...n);if(!r)throw new Error($(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=>jn(n)&&n.type===e,s}var fs=class ee extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,ee.prototype)}static get[Symbol.species](){return ee}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new ee(...t[0].concat(this)):new ee(...t.concat(this))}};function Ct(e){return z(e)?cs(e,()=>{}):e}function he(e,t,s){return e.has(t)?e.get(t):e.set(t,s(t)).get(t)}function Zn(e){return typeof e=="boolean"}var Qn=()=>function(t){const{thunk:s=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:a=!0}=t??{};let o=new fs;return s&&(Zn(s)?o.push(Gn):o.push(Jn(s.extraArgument))),o},er="RTK_autoBatch",Et=e=>t=>{setTimeout(t,e)},tr=(e={type:"raf"})=>t=>(...s)=>{const n=t(...s);let r=!0,a=!1,o=!1;const l=new Set,c=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:Et(10):e.type==="callback"?e.queueNotification:Et(e.timeout),d=()=>{o=!1,a&&(a=!1,l.forEach(u=>u()))};return Object.assign({},n,{subscribe(u){const f=()=>r&&u(),p=n.subscribe(f);return l.add(u),()=>{p(),l.delete(u)}},dispatch(u){var f;try{return r=!((f=u==null?void 0:u.meta)!=null&&f[er]),a=!r,a&&(o||(o=!0,c(d))),n.dispatch(u)}finally{r=!0}}})},sr=e=>function(s){const{autoBatch:n=!0}=s??{};let r=new fs(e);return n&&r.push(tr(typeof n=="object"?n:void 0)),r};function nr(e){const t=Qn(),{reducer:s=void 0,middleware:n,devTools:r=!0,preloadedState:a=void 0,enhancers:o=void 0}=e||{};let l;if(typeof s=="function")l=s;else if(rt(s))l=yn(s);else throw new Error($(1));let c;typeof n=="function"?c=n(t):c=t();let d=ye;r&&(d=Xn({trace:!1,...typeof r=="object"&&r}));const u=wn(...c),f=sr(u);let p=typeof o=="function"?o(f):f();const h=d(...p);return Qt(l,a,h)}function hs(e){const t={},s=[];let n;const r={addCase(a,o){const l=typeof a=="string"?a:a.type;if(!l)throw new Error($(28));if(l in t)throw new Error($(29));return t[l]=o,r},addAsyncThunk(a,o){return o.pending&&(t[a.pending.type]=o.pending),o.rejected&&(t[a.rejected.type]=o.rejected),o.fulfilled&&(t[a.fulfilled.type]=o.fulfilled),o.settled&&s.push({matcher:a.settled,reducer:o.settled}),r},addMatcher(a,o){return s.push({matcher:a,reducer:o}),r},addDefaultCase(a){return n=a,r}};return e(r),[t,s,n]}function rr(e){return typeof e=="function"}function ir(e,t){let[s,n,r]=hs(t),a;if(rr(e))a=()=>Ct(e());else{const l=Ct(e);a=()=>l}function o(l=a(),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,f)=>{if(f)if(F(u)){const h=f(u,c);return h===void 0?u:h}else{if(z(u))return cs(u,p=>f(p,c));{const p=f(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=a,o}var ar=(e,t)=>Yn(e)?e.match(t):e(t);function or(...e){return t=>e.some(s=>ar(s,t))}var lr="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",cr=(e=21)=>{let t="",s=e;for(;s--;)t+=lr[Math.random()*64|0];return t},dr=["name","message","stack","code"],Be=class{constructor(e,t){De(this,"_type");this.payload=e,this.meta=t}},It=class{constructor(e,t){De(this,"_type");this.payload=e,this.meta=t}},ur=e=>{if(typeof e=="object"&&e!==null){const t={};for(const s of dr)typeof e[s]=="string"&&(t[s]=e[s]);return t}return{message:String(e)}},Tt="External signal was aborted",fr=(()=>{function e(t,s,n){const r=se(t+"/fulfilled",(c,d,u,f)=>({payload:c,meta:{...f||{},arg:u,requestId:d,requestStatus:"fulfilled"}})),a=se(t+"/pending",(c,d,u)=>({payload:void 0,meta:{...u||{},arg:d,requestId:c,requestStatus:"pending"}})),o=se(t+"/rejected",(c,d,u,f,p)=>({payload:f,error:(n&&n.serializeError||ur)(c||"Rejected"),meta:{...p||{},arg:u,requestId:d,rejectedWithValue:!!f,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,f,p)=>{const h=n!=null&&n.idGenerator?n.idGenerator(c):cr(),g=new AbortController;let x,v;function y(w){v=w,g.abort()}d&&(d.aborted?y(Tt):d.addEventListener("abort",()=>y(Tt),{once:!0}));const b=async function(){var _,N;let w;try{let k=(_=n==null?void 0:n.condition)==null?void 0:_.call(n,c,{getState:f,extra:p});if(mr(k)&&(k=await k),k===!1||g.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const E=new Promise((C,O)=>{x=()=>{O({name:"AbortError",message:v||"Aborted"})},g.signal.addEventListener("abort",x,{once:!0})});u(a(h,c,(N=n==null?void 0:n.getPendingMeta)==null?void 0:N.call(n,{requestId:h,arg:c},{getState:f,extra:p}))),w=await Promise.race([E,Promise.resolve(s(c,{dispatch:u,getState:f,extra:p,requestId:h,signal:g.signal,abort:y,rejectWithValue:(C,O)=>new Be(C,O),fulfillWithValue:(C,O)=>new It(C,O)})).then(C=>{if(C instanceof Be)throw C;return C instanceof It?r(C.payload,h,c,C.meta):r(C,h,c)})])}catch(k){w=k instanceof Be?o(null,h,c,k.payload,k.meta):o(k,h,c)}finally{x&&g.signal.removeEventListener("abort",x)}return n&&!n.dispatchConditionRejection&&o.match(w)&&w.meta.condition||u(w),w}();return Object.assign(b,{abort:y,requestId:h,arg:c,unwrap(){return b.then(hr)}})}}return Object.assign(l,{pending:a,rejected:o,fulfilled:r,settled:or(o,r),typePrefix:t})}return e.withTypes=()=>e,e})();function hr(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function mr(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var pr=Symbol.for("rtk-slice-createasyncthunk");function xr(e,t){return`${e}/${t}`}function gr({creators:e}={}){var s;const t=(s=e==null?void 0:e.asyncThunk)==null?void 0:s[pr];return function(r){const{name:a,reducerPath:o=a}=r;if(!a)throw new Error($(11));const l=(typeof r.reducers=="function"?r.reducers(yr()):r.reducers)||{},c=Object.keys(l),d={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},u={addCase(j,_){const N=typeof j=="string"?j:j.type;if(!N)throw new Error($(12));if(N in d.sliceCaseReducersByType)throw new Error($(13));return d.sliceCaseReducersByType[N]=_,u},addMatcher(j,_){return d.sliceMatchers.push({matcher:j,reducer:_}),u},exposeAction(j,_){return d.actionCreators[j]=_,u},exposeCaseReducer(j,_){return d.sliceCaseReducersByName[j]=_,u}};c.forEach(j=>{const _=l[j],N={reducerName:j,type:xr(a,j),createNotation:typeof r.reducers=="function"};jr(_)?_r(N,_,u,t):wr(N,_,u)});function f(){const[j={},_=[],N=void 0]=typeof r.extraReducers=="function"?hs(r.extraReducers):[r.extraReducers],k={...j,...d.sliceCaseReducersByType};return ir(r.initialState,E=>{for(let C in k)E.addCase(C,k[C]);for(let C of d.sliceMatchers)E.addMatcher(C.matcher,C.reducer);for(let C of _)E.addMatcher(C.matcher,C.reducer);N&&E.addDefaultCase(N)})}const p=j=>j,h=new Map,g=new WeakMap;let x;function v(j,_){return x||(x=f()),x(j,_)}function y(){return x||(x=f()),x.getInitialState()}function b(j,_=!1){function N(E){let C=E[j];return typeof C>"u"&&_&&(C=he(g,N,y)),C}function k(E=p){const C=he(h,_,()=>new WeakMap);return he(C,E,()=>{const O={};for(const[U,q]of Object.entries(r.selectors??{}))O[U]=vr(q,E,()=>he(g,E,y),_);return O})}return{reducerPath:j,getSelectors:k,get selectors(){return k(N)},selectSlice:N}}const w={name:a,reducer:v,actions:d.actionCreators,caseReducers:d.sliceCaseReducersByName,getInitialState:y,...b(o),injectInto(j,{reducerPath:_,...N}={}){const k=_??o;return j.inject({reducerPath:k,reducer:v},N),{...w,...b(k,!0)}}};return w}}function vr(e,t,s,n){function r(a,...o){let l=t(a);return typeof l>"u"&&n&&(l=s()),e(l,...o)}return r.unwrapped=e,r}var br=gr();function yr(){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 wr({type:e,reducerName:t,createNotation:s},n,r){let a,o;if("reducer"in n){if(s&&!Sr(n))throw new Error($(17));a=n.reducer,o=n.prepare}else a=n;r.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?se(e,o):se(e))}function jr(e){return e._reducerDefinitionType==="asyncThunk"}function Sr(e){return e._reducerDefinitionType==="reducerWithPrepare"}function _r({type:e,reducerName:t},s,n,r){if(!r)throw new Error($(18));const{payloadCreator:a,fulfilled:o,pending:l,rejected:c,settled:d,options:u}=s,f=r(e,a,u);n.exposeAction(t,f),o&&n.addCase(f.fulfilled,o),l&&n.addCase(f.pending,l),c&&n.addCase(f.rejected,c),d&&n.addMatcher(f.settled,d),n.exposeCaseReducer(t,{fulfilled:o||me,pending:l||me,rejected:c||me,settled:d||me})}function me(){}function $(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 Nr=fr("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}`:""}`,a=await fetch(r,{headers:{Authorization:`Bearer ${n}`}});if(!a.ok)throw new Error("Failed to fetch history");const o=await a.json();return{sessionId:e,logs:o}}),kr={sessions:{},nodes:{},logIds:{},logs:{},activeSessionId:null,scope:"workspace",connected:!1,peerMessages:[]};function Mt(e,t,s){for(const n of t){const r=n.sessionId??s??"",a=`${r}:${n.tierId}`,o=e[a],l=n.output??(o==null?void 0:o.output);e[a]={...o,...n,sessionId:r,output:l}}}function pe(e,t,s,n=1e3){e.logIds[t]||(e.logIds[t]=new Set),e.logs[t]||(e.logs[t]=[]);const r=e.logIds[t],a=e.logs[t];for(const o of s)r.has(o.id)||(r.add(o.id),a.push(o));if(a.length>n){const o=a.splice(0,a.length-n);for(const l of o)r.delete(l.id)}}const ms=br({name:"runtime",initialState:kr,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:a}=t.payload;(a==="workspace"||a==="global")&&(e.scope=a);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&&Mt(e.nodes,n),r!=null&&r.length)for(const l of r)l.sessionId&&pe(e,l.sessionId,[l])},updateSessionDetails(e,t){var a;const{sessionId:s,nodes:n,logs:r}=t.payload;Mt(e.nodes,n,s),pe(e,s,r),(a=e.logs[s])==null||a.sort((o,l)=>new Date(o.timestamp).getTime()-new Date(l.timestamp).getTime())},appendLog(e,t){const s=t.payload;pe(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 a of Object.keys(e.nodes))((s=e.nodes[a])==null?void 0:s.sessionId)===r&&delete e.nodes[a];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}},addPeerMessage(e,t){e.peerMessages.push(t.payload),e.peerMessages.length>200&&(e.peerMessages=e.peerMessages.slice(-200))}},extraReducers(e){e.addCase(Nr.fulfilled,(t,s)=>{var a;const{sessionId:n,logs:r}=s.payload;pe(t,n,r,2e3),(a=t.logs[n])==null||a.sort((o,l)=>new Date(o.timestamp).getTime()-new Date(l.timestamp).getTime())})}}),{setConnected:At,setScope:ta,setActiveSession:Cr,updateRTKSnapshot:ps,updateSessionDetails:Er,appendLog:Ir,clearFrontendGraphs:Ot,removeSessionsBulk:Tr,addPeerMessage:Mr}=ms.actions,Y=e=>e.runtime,Ar=H(Y,e=>Object.values(e.sessions).sort((t,s)=>new Date(s.updatedAt).getTime()-new Date(t.updatedAt).getTime())),lt=H(Y,e=>e.activeSessionId?e.sessions[e.activeSessionId]??null:null),Or=H(Y,e=>e.activeSessionId?Object.values(e.nodes).filter(t=>t.sessionId===e.activeSessionId):[]),Rr=H(Y,e=>e.activeSessionId?e.logs[e.activeSessionId]??[]:[]),Pr=H(Y,e=>e.connected),Dr=H(Y,e=>e.peerMessages),zr=ms.reducer,Lr=nr({reducer:{runtime:zr},middleware:e=>e({serializableCheck:{ignoredPaths:["runtime.logIds"]}})}),Pe=()=>hn(),B=xn;var ce={},ct={};function $r(e,t,s){for(var n=0,r=0,a=s.length;r<a;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 Fr(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 te(e,t,s){var n=typeof s,r=0,a=0,o=0,l=0,c=0,d=0;if(n==="string"){if(c=Fr(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+=te(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 te(e,t,s.toJSON());var f=[],p="",h=Object.keys(s);for(r=0,a=h.length;r<a;r++)p=h[r],typeof s[p]!="function"&&f.push(p);if(c=f.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=f[r],d+=te(e,t,p),d+=te(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 Ur(e){var t=[],s=[],n=te(t,s,e),r=new ArrayBuffer(n),a=new DataView(r),o=0,l=0,c=-1;s.length>0&&(c=s[0]._offset);for(var d,u=0,f=0,p=0,h=t.length;p<h;p++)if(a.setUint8(l+p,t[p]),p+1===c){if(d=s[o],u=d._length,f=l+c,d._bin)for(var g=new Uint8Array(d._bin),x=0;x<u;x++)a.setUint8(f+x,g[x]);else d._str?$r(a,f,d._str):d._float!==void 0&&a.setFloat64(f,d._float);o++,l+=u,s[o]&&(c=s[o]._offset)}return r}var Br=Ur;function Z(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 Vr(e,t,s){for(var n="",r=0,a=t,o=t+s;a<o;a++){var l=e.getUint8(a);if(!(l&128)){n+=String.fromCharCode(l);continue}if((l&224)===192){n+=String.fromCharCode((l&31)<<6|e.getUint8(++a)&63);continue}if((l&240)===224){n+=String.fromCharCode((l&15)<<12|(e.getUint8(++a)&63)<<6|(e.getUint8(++a)&63)<<0);continue}if((l&248)===240){r=(l&7)<<18|(e.getUint8(++a)&63)<<12|(e.getUint8(++a)&63)<<6|(e.getUint8(++a)&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}Z.prototype._array=function(e){for(var t=new Array(e),s=0;s<e;s++)t[s]=this._parse();return t};Z.prototype._map=function(e){for(var t="",s={},n=0;n<e;n++)t=this._parse(),s[t]=this._parse();return s};Z.prototype._str=function(e){var t=Vr(this._view,this._offset,e);return this._offset+=e,t};Z.prototype._bin=function(e){var t=this._buffer.slice(this._offset,this._offset+e);return this._offset+=e,t};Z.prototype._parse=function(){var e=this._view.getUint8(this._offset++),t,s=0,n=0,r=0,a=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),a=this._view.getUint32(this._offset+4),this._offset+=8,r+a;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),a=this._view.getUint32(this._offset+4),this._offset+=8,r+a;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),a=this._view.getUint32(this._offset+4),this._offset+=8,new Date(r+a)):[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 Wr(e){var t=new Z(e),s=t._parse();if(t._offset!==e.byteLength)throw new Error(e.byteLength-t._offset+" trailing bytes");return s}var Hr=Wr;ct.encode=Br;ct.decode=Hr;var xs={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 a(){this.off(n,a),r.apply(this,arguments)}return a.fn=r,this.on(n,a),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 a=this._callbacks["$"+n];if(!a)return this;if(arguments.length==1)return delete this._callbacks["$"+n],this;for(var o,l=0;l<a.length;l++)if(o=a[l],o===r||o.fn===r){a.splice(l,1);break}return a.length===0&&delete this._callbacks["$"+n],this},t.prototype.emit=function(n){this._callbacks=this._callbacks||{};for(var r=new Array(arguments.length-1),a=this._callbacks["$"+n],o=1;o<arguments.length;o++)r[o-1]=arguments[o];if(a){a=a.slice(0);for(var o=0,l=a.length;o<l;++o)a[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}})(xs);var qr=xs.exports,gs=ct,Kr=qr;ce.protocol=5;var ne=ce.PacketType={CONNECT:0,DISCONNECT:1,EVENT:2,ACK:3,CONNECT_ERROR:4},Rt=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e},vs=function(e){return typeof e=="string"},Pt=function(e){return Object.prototype.toString.call(e)==="[object Object]"};function bs(){}bs.prototype.encode=function(e){return[gs.encode(e)]};function de(){}Kr(de.prototype);de.prototype.add=function(e){var t=gs.decode(e);this.checkPacket(t),this.emit("decoded",t)};function Gr(e){switch(e.type){case ne.CONNECT:return e.data===void 0||Pt(e.data);case ne.DISCONNECT:return e.data===void 0;case ne.CONNECT_ERROR:return vs(e.data)||Pt(e.data);default:return Array.isArray(e.data)}}de.prototype.checkPacket=function(e){var t=Rt(e.type)&&e.type>=ne.CONNECT&&e.type<=ne.CONNECT_ERROR;if(!t)throw new Error("invalid packet type");if(!vs(e.nsp))throw new Error("invalid namespace");if(!Gr(e))throw new Error("invalid payload");var s=e.id===void 0||Rt(e.id);if(!s)throw new Error("invalid packet id")};de.prototype.destroy=function(){};ce.Encoder=bs;ce.Decoder=de;function Jr({url:e="/",token:t,activeSessionId:s,onRuntimeRefresh:n,onStreamToken:r,onCostUpdate:a,onEscalation:o}={}){const[l,c]=m.useState(null),d=Pe(),u=m.useRef(n),f=m.useRef(r),p=m.useRef(a),h=m.useRef(o);u.current=n,f.current=r,p.current=a,h.current=o;const g=m.useRef(s);g.current=s;const x=m.useRef(null);return m.useEffect(()=>{const v=zs(e,{auth:t?{token:t}:{},transports:["websocket","polling"],reconnection:!0,reconnectionDelay:500,parser:ce});return v.on("connect",()=>{d(At(!0)),v.emit("runtime:refresh",{scope:"workspace"});const y=g.current;y&&(v.emit("join:session",{sessionId:y}),x.current=y),c(v)}),v.on("disconnect",()=>{d(At(!1)),c(null)}),v.on("runtime:update",y=>{d(ps(y))}),v.on("session:details",y=>{d(Er(y))}),v.on("log:new",y=>{d(Ir(y))}),v.on("runtime:refresh",y=>{var w;const b=y;(w=u.current)==null||w.call(u,b==null?void 0:b.scope)}),v.on("stream:token",y=>{var b;(b=f.current)==null||b.call(f,y)}),v.on("cost:update",y=>{var b;(b=p.current)==null||b.call(p,y)}),v.on("permission:user-required",y=>{var b;(b=h.current)==null||b.call(h,y)}),v.on("peer:message",y=>{d(Mr(y))}),()=>{v.disconnect(),c(null),x.current=null}},[e,t,d]),m.useEffect(()=>{l&&s!==x.current&&(x.current&&l.emit("leave:session",{sessionId:x.current}),s&&l.emit("join:session",{sessionId:s}),x.current=s??null)},[l,s]),{socket:l}}const Xr=m.memo(function({onLogin:t}){const[s,n]=m.useState(""),[r,a]=m.useState(""),[o,l]=m.useState(!1),c=async d=>{d.preventDefault();const u=s.trim();if(u){l(!0),a("");try{const f=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:"admin",password:u})});if(f.ok){const p=await f.json();t(p.token)}else a("Invalid token — check your cascade dashboard config.")}catch{a("Cannot reach server. Is the dashboard running?")}finally{l(!1)}}};return i.jsxs("div",{className:"relative flex items-center justify-center w-full h-full bg-[var(--bg-base)] dot-grid overflow-hidden",children:[i.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"}),i.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"}),i.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:[i.jsxs("div",{className:"flex items-center gap-3 mb-8",children:[i.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:i.jsx("span",{className:"text-white font-black text-[14px] font-mono",children:"C"})}),i.jsxs("div",{children:[i.jsx("h1",{className:"text-[15px] font-bold text-[var(--text-primary)] tracking-tight",children:"Cascade AI"}),i.jsx("p",{className:"section-label mt-0.5",children:"Dashboard"})]})]}),i.jsxs("div",{className:"mb-5",children:[i.jsx("label",{htmlFor:"token-input",className:"block section-label mb-2",children:"Access Token"}),i.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&&i.jsx("p",{role:"alert",className:"text-[11px] text-[var(--error)] mt-2 font-mono",children:r})]}),i.jsx("button",{type:"submit",disabled:o||!s.trim(),className:"btn btn-primary w-full justify-center py-2.5",children:o?i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"w-3 h-3 rounded-full border border-white/40 border-t-white animate-spin"}),"Connecting…"]}):"Connect"}),i.jsxs("p",{className:"text-center text-[10px] text-[var(--text-faint)] mt-5 font-mono",children:["No token?"," ",i.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 Yr=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ys=(...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 Zr={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 Qr=m.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:s=2,absoluteStrokeWidth:n,className:r="",children:a,iconNode:o,...l},c)=>m.createElement("svg",{ref:c,...Zr,width:t,height:t,stroke:e,strokeWidth:n?Number(s)*24/Number(t):s,className:ys("lucide",r),...l},[...o.map(([d,u])=>m.createElement(d,u)),...Array.isArray(a)?a:[a]]));/**
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 M=(e,t)=>{const s=m.forwardRef(({className:n,...r},a)=>m.createElement(Qr,{ref:a,iconNode:t,className:ys(`lucide-${Yr(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 ws=M("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 ei=M("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 ti=M("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 js=M("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 Ve=M("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 si=M("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 ni=M("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 ri=M("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 ii=M("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 ai=M("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
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 oi=M("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"}]]);/**
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 li=M("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"}]]);/**
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 ci=M("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"}]]);/**
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 Dt=M("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"}]]);/**
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 zt=M("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
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 di=M("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"}]]);/**
126
+ * @license lucide-react v0.460.0 - ISC
127
+ *
128
+ * This source code is licensed under the ISC license.
129
+ * See the LICENSE file in the root directory of this source tree.
130
+ */const ui=M("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),fi=[{id:"topology",icon:oi,label:"Agent Topology"},{id:"sessions",icon:ri,label:"Sessions"},{id:"logs",icon:si,label:"Telemetry"},{id:"settings",icon:li,label:"Settings"}];function Lt({label:e}){return i.jsx("div",{role:"tooltip",className:`
131
+ absolute left-full ml-3 px-2.5 py-1.5
132
+ text-[10px] font-medium font-mono text-[var(--text-primary)]
133
+ bg-[var(--bg-overlay)] border border-[var(--border-strong)]
134
+ rounded-[var(--radius-sm)] whitespace-nowrap pointer-events-none
135
+ opacity-0 group-hover:opacity-100
136
+ translate-x-[-4px] group-hover:translate-x-0
137
+ transition-all duration-150 z-50
138
+ shadow-[var(--shadow-panel)]
139
+ `,children:e})}const hi=m.memo(function({activeTab:t,onTabChange:s,onLogout:n}){return i.jsxs("nav",{"aria-label":"Main navigation",className:`
140
+ flex flex-col items-center py-5 gap-1
141
+ w-[56px] flex-shrink-0 h-full z-20
142
+ bg-[var(--bg-surface)]
143
+ border-r border-[var(--border-subtle)]
144
+ `,children:[i.jsx("div",{className:`
145
+ mb-4 w-8 h-8 rounded-[var(--radius-sm)]
146
+ bg-[var(--accent)] flex items-center justify-center
147
+ shadow-[var(--shadow-glow-violet)] select-none
148
+ `,children:i.jsx("span",{className:"text-white font-black text-[13px] font-mono tracking-tighter",children:"C"})}),i.jsx("div",{className:"divider w-8 mb-2"}),i.jsx("div",{className:"flex flex-col gap-0.5 flex-1 w-full px-1.5",children:fi.map(({id:r,icon:a,label:o})=>{const l=t===r;return i.jsxs("div",{className:"relative group",children:[i.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:i.jsx(a,{size:17,strokeWidth:l?2:1.75})}),i.jsx(Lt,{label:o})]},r)})}),i.jsxs("div",{className:"relative group px-1.5 w-full",children:[i.jsx("button",{"aria-label":"Log out",onClick:n,className:"nav-rail-btn w-full text-[var(--text-faint)] hover:text-[var(--error)]",children:i.jsx(ii,{size:15,strokeWidth:1.75})}),i.jsx(Lt,{label:"Log out"})]})]})});function mi(e){const[t,s]=m.useState(null);return m.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 a=setInterval(r,5e3);return()=>{n=!0,clearInterval(a)}},[e]),t}function pi(e){const[t,s]=m.useState("");return m.useEffect(()=>{if(!e){s("");return}const n=()=>{const a=Date.now()-new Date(e).getTime(),o=Math.floor(a/36e5).toString().padStart(2,"0"),l=Math.floor(a%36e5/6e4).toString().padStart(2,"0"),c=Math.floor(a%6e4/1e3).toString().padStart(2,"0");s(`${o}:${l}:${c}`)};n();const r=setInterval(n,1e3);return()=>clearInterval(r)},[e]),t}function xe({label:e,value:t,highlight:s}){return i.jsxs("div",{className:"metric-chip",children:[i.jsx("span",{className:"label",children:e}),i.jsx("span",{className:`value ${s?"text-[var(--warning)]":""}`,children:t})]})}const xi=m.memo(function({isConnected:t,totalCostUsd:s,totalTokens:n}){const r=B(lt),a=mi(t),o=pi(r==null?void 0:r.startedAt);return i.jsxs("header",{"aria-label":"Dashboard header",className:`
149
+ flex items-center justify-between px-5 h-11
150
+ border-b border-[var(--border-subtle)]
151
+ bg-[var(--bg-surface)] flex-shrink-0 z-10
152
+ `,children:[i.jsxs("div",{className:"flex items-center gap-4 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[i.jsx("span",{"aria-label":t?"Connected":"Disconnected",className:`
153
+ w-1.5 h-1.5 rounded-full transition-all duration-500
154
+ ${t?"bg-[var(--success)] shadow-[var(--shadow-glow-green)]":"bg-[var(--text-faint)]"}
155
+ `}),i.jsx("span",{className:"section-label",children:t?"Live":"Offline"})]}),r&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"divider-v h-4 flex-shrink-0"}),i.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[i.jsx("span",{className:"text-[12px] font-medium text-[var(--text-primary)] truncate max-w-[200px]",children:r.title||"Untitled Session"}),i.jsx("span",{className:`badge badge-${r.status} flex-shrink-0`,children:r.status})]})]})]}),i.jsxs("div",{className:"flex items-center gap-5",children:[a!==null&&i.jsx(xe,{label:"Ping",value:`${a}ms`}),o&&i.jsx(xe,{label:"Uptime",value:o}),i.jsx("div",{className:"divider-v h-4"}),i.jsx(xe,{label:"Tokens",value:n>=1e3?`${(n/1e3).toFixed(1)}k`:n.toLocaleString()}),i.jsx(xe,{label:"Cost",value:`$${s.toFixed(4)}`,highlight:s>1})]})]})}),We={T1:"var(--t1-color)",T2:"var(--t2-color)",T3:"var(--t3-color)"},$t={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)]"},gi=m.memo(function({data:t,selected:s}){const n=$t[t.status]??$t.IDLE;return i.jsxs("div",{"aria-label":`${t.role} agent: ${t.label}, status: ${t.status}`,className:`
156
+ relative px-3.5 py-3 glass min-w-[170px] max-w-[210px]
157
+ rounded-[var(--radius-md)] border transition-all duration-300
158
+ ${n}
159
+ ${s?"ring-2 ring-[var(--accent)] ring-offset-2 ring-offset-[var(--bg-base)]":""}
160
+ `,children:[i.jsx(dt,{type:"target",position:ut.Top,className:"!w-1.5 !h-1.5 !bg-[var(--border-strong)] !border-none !top-[-4px]"}),i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("span",{className:"badge",style:{color:We[t.role],background:`color-mix(in srgb, ${We[t.role]} 10%, transparent)`,borderColor:`color-mix(in srgb, ${We[t.role]} 22%, transparent)`},children:t.role}),i.jsxs("div",{className:"flex items-center gap-1",children:[t.status==="ACTIVE"&&i.jsx("div",{className:"flex gap-[2px] items-center","aria-label":"Active",children:[0,100,200].map(r=>i.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"&&i.jsx("span",{className:"text-[var(--success)] text-[10px] font-mono",children:"✓"}),t.status==="FAILED"&&i.jsx("span",{className:"text-[var(--error)] text-[10px] font-mono",children:"✗"}),t.status==="ESCALATED"&&i.jsx("span",{className:"text-[var(--warning)] text-[10px]",children:"⚠"})]})]}),i.jsx("p",{className:"text-[11px] font-semibold text-[var(--text-primary)] truncate leading-snug mb-0.5",children:t.label}),t.action&&i.jsx("p",{className:"text-[9px] text-[var(--text-muted)] truncate leading-snug font-mono",children:t.action}),t.progressPct!==void 0&&t.status==="ACTIVE"&&i.jsx("div",{className:"progress-track mt-2.5",children:i.jsx("div",{className:"progress-fill",style:{width:`${t.progressPct}%`}})}),i.jsx(dt,{type:"source",position:ut.Bottom,className:"!w-1.5 !h-1.5 !bg-[var(--border-strong)] !border-none !bottom-[-4px]"})]})}),vi={agent:gi};function bi(){return i.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-5 animate-fade-in select-none",children:[i.jsxs("div",{className:"relative w-16 h-16",children:[[0,1,2].map(e=>i.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)),i.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-2xl",children:"⬡"})]}),i.jsxs("div",{className:"text-center",children:[i.jsx("p",{className:"text-[13px] font-medium text-[var(--text-primary)]",children:"No active agents"}),i.jsx("p",{className:"text-[11px] text-[var(--text-muted)] mt-1",children:"Start a task to see the agent topology"})]})]})}const yi=m.memo(function({nodes:t,edges:s,peerEdges:n=[],selectedNodeId:r,onSelectNode:a}){const o=m.useMemo(()=>{if(!t.length)return[];const d={T1:[],T2:[],T3:[]};t.forEach(h=>{var g;return(g=d[h.role])==null?void 0:g.push(h)});const u={T1:40,T2:210,T3:380},f=250,p=500;return t.map(h=>{const g=d[h.role],x=g.findIndex(w=>w.id===h.id),v=g.length,y=p-(v-1)*f/2+x*f,b=u[h.role]??40;return{id:h.id,type:"agent",position:{x:y,y:b},selected:r===h.id,data:{role:h.role,label:h.label,status:h.status,action:h.action,progressPct:h.progressPct}}})},[t,r]),l=m.useMemo(()=>{const d=s.map((f,p)=>({id:`e${p}`,source:f.from,target:f.to,animated:!0,style:{stroke:"rgba(124,106,247,0.28)",strokeWidth:1.5},markerEnd:{type:ft.ArrowClosed,color:"rgba(124,106,247,0.45)",width:10,height:10}})),u=n.map(f=>({id:f.id,source:f.from,target:f.to,animated:!0,label:f.syncType,labelStyle:{fontSize:9,fill:"rgba(255,165,0,0.85)"},labelBgStyle:{fill:"var(--bg-base)",fillOpacity:.7},style:{stroke:"rgba(255,140,0,0.7)",strokeWidth:1.5,strokeDasharray:"5,3"},markerEnd:{type:ft.ArrowClosed,color:"rgba(255,140,0,0.7)",width:8,height:8}}));return[...d,...u]},[s,n]),c=m.useCallback((d,u)=>{a(u.id===r?null:u.id)},[a,r]);return t.length?i.jsxs("div",{className:"w-full h-full relative","aria-label":"Agent topology graph",role:"img",children:[i.jsxs(As,{nodes:o,edges:l,nodeTypes:vi,onNodeClick:c,onPaneClick:()=>a(null),fitView:!0,fitViewOptions:{padding:.18,maxZoom:1.2},minZoom:.25,maxZoom:2.5,proOptions:{hideAttribution:!0},children:[i.jsx(Os,{variant:Rs.Dots,color:"rgba(255,255,255,0.03)",gap:24,size:1}),i.jsx(Ps,{showInteractive:!1,"aria-label":"Graph controls"})]}),i.jsx("div",{className:"absolute inset-x-0 top-0 h-14 bg-gradient-to-b from-[var(--bg-base)] to-transparent pointer-events-none"}),i.jsx("div",{className:"absolute inset-x-0 bottom-0 h-14 bg-gradient-to-t from-[var(--bg-base)] to-transparent pointer-events-none"})]}):i.jsx(bi,{})});function wi({pct:e}){return i.jsx("div",{className:"progress-track",children:i.jsx("div",{className:"progress-fill",style:{width:`${Math.min(Math.max(e,0),100)}%`}})})}function He({icon:e,label:t,children:s}){return i.jsxs("div",{className:"px-4 py-3 border-b border-[var(--border-subtle)]",children:[i.jsxs("p",{className:"section-label flex items-center gap-1.5 mb-1.5",children:[i.jsx(e,{size:9}),t]}),s]})}const ji=m.memo(function({node:t,streamLog:s,peerMessages:n=[],onClose:r}){const a=m.useRef(null),[o,l]=m.useState("output");return m.useEffect(()=>{a.current&&(a.current.scrollTop=a.current.scrollHeight)},[s]),m.useEffect(()=>{const c=d=>{d.key==="Escape"&&r()};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[r]),i.jsxs("aside",{role:"complementary","aria-label":"Agent inspector",className:`
161
+ flex flex-col w-[300px] flex-shrink-0 h-full
162
+ border-l border-[var(--border-subtle)]
163
+ bg-[var(--bg-surface)] animate-slide-in overflow-hidden
164
+ `,children:[i.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 border-b border-[var(--border-subtle)] flex-shrink-0",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Ve,{size:13,className:"text-[var(--accent)]"}),i.jsx("span",{className:"section-label",children:"Inspector"})]}),i.jsx("button",{"aria-label":"Close inspector",onClick:r,className:`
165
+ w-6 h-6 rounded-[var(--radius-xs)] flex items-center justify-center
166
+ text-[var(--text-faint)] hover:text-[var(--text-primary)]
167
+ hover:bg-[var(--bg-elevated)] transition-all
168
+ `,children:i.jsx(ui,{size:13})})]}),t?i.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[i.jsxs("div",{className:"px-4 py-4 border-b border-[var(--border-subtle)]",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx("span",{className:`badge badge-${t.role}`,children:t.role}),i.jsx("span",{className:`badge badge-${t.status}`,children:t.status})]}),i.jsx("h2",{className:"text-[12px] font-semibold text-[var(--text-primary)] leading-snug",children:t.label}),i.jsx("p",{className:"text-[9px] text-[var(--text-muted)] font-mono mt-1 break-all opacity-60",children:t.tierId})]}),t.progressPct!==void 0&&i.jsxs(He,{icon:ws,label:"Progress",children:[i.jsx("div",{className:"flex items-center justify-between mb-1.5",children:i.jsxs("span",{className:"text-[10px] font-mono text-[var(--text-primary)]",children:[t.progressPct,"%"]})}),i.jsx(wi,{pct:t.progressPct})]}),t.currentAction&&i.jsx(He,{icon:ti,label:"Current action",children:i.jsx("p",{className:"text-[11px] text-[var(--text-primary)] leading-snug",children:t.currentAction})}),i.jsx(He,{icon:js,label:"Last update",children:i.jsx("p",{className:"text-[10px] font-mono text-[var(--text-muted)]",children:new Date(t.updatedAt).toLocaleTimeString()})}),i.jsx("div",{className:"flex gap-0 px-3 pt-2 flex-shrink-0 border-b border-[var(--border-subtle)]",children:["output","comms"].map(c=>i.jsxs("button",{onClick:()=>l(c),className:`
169
+ flex items-center gap-1 px-2.5 py-1.5 text-[9.5px] font-medium rounded-t-sm
170
+ transition-colors border-b-2 -mb-px
171
+ ${o===c?"text-[var(--accent)] border-[var(--accent)]":"text-[var(--text-muted)] border-transparent hover:text-[var(--text-primary)]"}
172
+ `,children:[c==="output"?i.jsx(Ve,{size:9}):i.jsx(ai,{size:9}),c==="output"?"Output":`Comms${n.length?` (${n.length})`:""}`]},c))}),o==="output"&&i.jsx("div",{className:"flex flex-col flex-1 min-h-0 px-3 py-3",children:i.jsx("div",{ref:a,className:`
173
+ flex-1 overflow-y-auto font-mono text-[9.5px]
174
+ text-[var(--t3-color)] leading-[1.7]
175
+ whitespace-pre-wrap break-words
176
+ bg-[var(--bg-base)] rounded-[var(--radius-xs)]
177
+ p-2.5 border border-[var(--border-subtle)]
178
+ scrollbar-thin
179
+ `,"aria-live":"polite","aria-label":"Live token stream",children:t.output?i.jsx("span",{children:t.output}):s&&t.status==="ACTIVE"?i.jsxs("span",{children:[s.slice(-4e3),i.jsx("span",{className:"animate-blink text-[var(--t3-color)]",children:"█"})]}):i.jsx("span",{className:"text-[var(--text-faint)] italic",children:t.status==="COMPLETED"?"No output recorded.":"Waiting for output…"})})}),o==="comms"&&i.jsx("div",{className:"flex flex-col flex-1 min-h-0 px-3 py-3",children:i.jsx("div",{className:"flex-1 overflow-y-auto scrollbar-thin space-y-1.5",children:n.length===0?i.jsx("p",{className:"text-[10px] text-[var(--text-faint)] italic text-center py-6",children:"No peer communications yet"}):[...n].reverse().map((c,d)=>i.jsxs("div",{className:"text-[9.5px] rounded-[var(--radius-xs)] bg-[var(--bg-base)] border border-[var(--border-subtle)] px-2.5 py-2",children:[i.jsxs("div",{className:"flex items-center justify-between mb-1",children:[i.jsx("span",{className:"font-mono text-[var(--warning)] font-medium",children:c.syncType}),i.jsx("span",{className:"text-[var(--text-faint)]",children:new Date(c.timestamp).toLocaleTimeString()})]}),i.jsxs("div",{className:"text-[var(--text-muted)] font-mono",children:[i.jsx("span",{className:"text-[var(--text-primary)]",children:c.fromId.slice(0,12)})," → ",i.jsx("span",{className:"text-[var(--text-primary)]",children:c.toId?c.toId.slice(0,12):"all"})]}),c.payload&&i.jsx("p",{className:"mt-1 text-[var(--text-faint)] truncate",children:c.payload.slice(0,80)})]},d))})})]}):i.jsxs("div",{className:"flex flex-col items-center justify-center flex-1 gap-3 text-center p-6",children:[i.jsx("div",{className:"w-9 h-9 rounded-full bg-[var(--bg-elevated)] flex items-center justify-center",children:i.jsx(Ve,{size:16,className:"text-[var(--text-faint)]"})}),i.jsx("p",{className:"text-[11px] text-[var(--text-muted)]",children:"Select an agent node to inspect it"})]})]})});function qe({icon:e,tier:t,label:s,isLast:n=!1}){return i.jsxs("div",{className:`flex items-start gap-3 py-2.5 ${n?"":"border-b border-[var(--border-subtle)]"}`,children:[i.jsx("div",{className:`
180
+ flex-shrink-0 w-6 h-6 rounded-full
181
+ bg-[var(--bg-overlay)] border border-[var(--border-subtle)]
182
+ flex items-center justify-center text-[11px] mt-0.5
183
+ `,children:e}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[i.jsx("span",{className:`badge badge-${t}`,children:t}),i.jsx("span",{className:"text-[10px] text-[var(--text-muted)] truncate",children:s})]}),i.jsx("p",{className:"text-[9px] font-mono text-[var(--warning)]",children:"⚠ Uncertain — escalated upward"})]}),i.jsx(ei,{size:10,className:"text-[var(--text-faint)] mt-1.5 flex-shrink-0"})]})}const Si=m.memo(function({request:t,onDecide:s}){m.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=m.useCallback(o=>s(!0,o),[s]),r=m.useCallback(o=>s(!1,o),[s]),a=t.input.path??t.input.command??JSON.stringify(t.input).slice(0,60);return i.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:i.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:[i.jsxs("div",{className:"flex items-center gap-3 px-5 pt-5 pb-4 border-b border-[var(--border-subtle)]",children:[i.jsx("div",{className:`
184
+ w-9 h-9 rounded-[var(--radius-sm)] flex-shrink-0
185
+ bg-[rgba(245,166,35,0.1)] border border-[rgba(245,166,35,0.22)]
186
+ flex items-center justify-center
187
+ `,children:i.jsx(ci,{size:18,className:"text-[var(--warning)]"})}),i.jsxs("div",{children:[i.jsx("h2",{id:"escalation-title",className:"text-[13px] font-bold text-[var(--text-primary)]",children:"Permission required"}),i.jsx("p",{className:"text-[10px] text-[var(--text-muted)] font-mono mt-0.5",children:"No tier could determine if this action is safe"})]})]}),i.jsxs("div",{className:"px-5 py-4 border-b border-[var(--border-subtle)]",children:[i.jsx("p",{className:"section-label mb-2",children:"Requested action"}),i.jsxs("div",{className:`
188
+ flex items-center gap-2
189
+ bg-[var(--bg-base)] rounded-[var(--radius-xs)]
190
+ border border-[var(--border-subtle)] px-3 py-2
191
+ `,children:[i.jsx("code",{className:"text-[var(--accent)] font-mono font-bold text-[11px] flex-shrink-0",children:t.toolName}),a&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"text-[var(--text-faint)] text-[11px]",children:"→"}),i.jsx("code",{className:"text-[var(--text-muted)] font-mono text-[10px] truncate flex-1 min-w-0",children:a})]}),t.isDangerous&&i.jsx("span",{className:"ml-auto badge badge-FAILED flex-shrink-0",children:"Dangerous"})]})]}),i.jsxs("div",{className:"px-5 py-4 border-b border-[var(--border-subtle)]",children:[i.jsx("p",{className:"section-label mb-2",children:"Escalation trail"}),i.jsx(qe,{icon:"🔹",tier:"T3",label:`"${t.subtaskContext}" requested this`}),i.jsx(qe,{icon:"🟣",tier:"T2",label:`Section "${t.sectionContext}" evaluated — uncertain`}),i.jsx(qe,{icon:"🟡",tier:"T1",label:"Full task context evaluated — uncertain",isLast:!0}),i.jsxs("div",{className:"flex items-center gap-3 pt-3",children:[i.jsx("div",{className:"w-6 h-6 rounded-full bg-[var(--accent)] flex items-center justify-center flex-shrink-0",children:i.jsx("span",{className:"text-white text-[10px] font-bold",children:"?"})}),i.jsxs("div",{children:[i.jsx("p",{className:"text-[11px] font-semibold text-[var(--text-primary)]",children:"Your decision required"}),i.jsxs("p",{className:"text-[9px] font-mono text-[var(--text-muted)] mt-0.5",children:["Press"," ",i.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,"," ",i.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"]})]})]})]}),i.jsxs("div",{className:"px-5 py-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-2 mb-2",children:[i.jsx("button",{className:"btn btn-danger justify-center",onClick:()=>r(!1),children:"Deny once"}),i.jsx("button",{className:"btn btn-success justify-center",onClick:()=>n(!1),children:"Approve once"})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[i.jsx("button",{className:"btn btn-ghost justify-center",onClick:()=>r(!0),children:"Always deny"}),i.jsx("button",{className:"btn btn-ghost justify-center",onClick:()=>n(!0),children:"Always approve"})]})]})]})})});function _i(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 Ni(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 ki=m.memo(function(){const t=Pe(),s=B(Ar),n=B(lt),[r,a]=m.useState(new Set),[o,l]=m.useState(null),[c,d]=m.useState(!1),[u,f]=m.useState(""),p=m.useCallback(w=>{r.size===0&&t(Cr(w))},[t,r.size]),h=m.useCallback((w,j,_)=>{_.stopPropagation(),a(N=>{var E;const k=new Set(N);if(_.shiftKey&&o!==null){const[C,O]=[Math.min(o,j),Math.max(o,j)];for(let U=C;U<=O;U++){const q=(E=s[U])==null?void 0:E.sessionId;q&&k.add(q)}}else k.has(w)?k.delete(w):k.add(w);return k}),l(j)},[o,s]),g=m.useCallback(()=>{r.size===s.length?a(new Set):a(new Set(s.map(w=>w.sessionId)))},[r.size,s]),x=m.useCallback(async()=>{if(!(r.size===0||c)){d(!0),f("");try{const w=Array.from(r);(await fetch("/api/sessions",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:w})})).ok?(t(Tr(w)),a(new Set),l(null)):f("Delete failed. Please try again.")}catch{f("Network error. Please try again.")}finally{d(!1)}}},[r,c,t]),v=m.useCallback(()=>{a(new Set),l(null)},[]);if(!s.length)return i.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3 animate-fade-in",children:[i.jsx("div",{className:"w-11 h-11 rounded-full bg-[var(--bg-elevated)] flex items-center justify-center",children:i.jsx(ws,{size:18,className:"text-[var(--text-faint)]"})}),i.jsx("p",{className:"text-[12px] text-[var(--text-muted)]",children:"No sessions yet"}),i.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,b=r.size>0;return i.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[i.jsx("div",{className:"px-5 py-4 border-b border-[var(--border-subtle)] flex-shrink-0 bg-[var(--bg-surface)]",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"section-label",children:"Sessions"}),i.jsxs("p",{className:"text-[10px] font-mono text-[var(--text-faint)] mt-1",children:[s.length," session",s.length!==1?"s":"",b&&i.jsxs("span",{className:"text-[var(--accent)] ml-2",children:["· ",r.size," selected"]})]})]}),i.jsx("button",{onClick:g,title:y?"Deselect all":"Select all",className:"p-1.5 rounded hover:bg-[var(--bg-elevated)] transition-colors",children:y?i.jsx(Dt,{size:14,className:"text-[var(--accent)]"}):i.jsx(zt,{size:14,className:"text-[var(--text-faint)]"})})]})}),i.jsx("div",{className:"flex-1 overflow-y-auto",children:s.map((w,j)=>{const _=w.sessionId===(n==null?void 0:n.sessionId),N=r.has(w.sessionId);return i.jsxs("button",{"aria-selected":_,"aria-label":`Session: ${w.title}, status: ${w.status}`,onClick:()=>p(w.sessionId),className:`
192
+ w-full text-left px-5 py-3.5
193
+ border-b border-[var(--border-subtle)]
194
+ transition-all duration-150 relative
195
+ animate-slide-up
196
+ `,style:{animationDelay:`${j*25}ms`,background:N?"rgba(124,106,247,0.08)":_?"rgba(124,106,247,0.05)":void 0,borderLeft:N||_?"2px solid var(--accent)":"2px solid transparent",paddingLeft:_||N?"18px":"20px"},children:[i.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1",children:[i.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[i.jsx("span",{role:"checkbox","aria-checked":N,onClick:k=>h(w.sessionId,j,k),className:"flex-shrink-0 cursor-pointer",children:N?i.jsx(Dt,{size:12,className:"text-[var(--accent)]"}):i.jsx(zt,{size:12,className:"text-[var(--text-faint)] opacity-40 hover:opacity-100 transition-opacity"})}),i.jsx("span",{className:"text-[12px] font-semibold text-[var(--text-primary)] truncate",children:w.title||"Untitled Session"})]}),i.jsx("span",{className:`badge badge-${w.status} flex-shrink-0`,children:w.status})]}),w.workspacePath&&i.jsxs("div",{className:"flex items-center gap-1.5 mb-1 pl-5",children:[i.jsx(ni,{size:9,className:"text-[var(--text-faint)] flex-shrink-0"}),i.jsx("span",{className:"text-[9px] font-mono text-[var(--text-faint)] truncate",children:w.workspacePath.split("/").pop()})]}),w.latestPrompt&&i.jsxs("p",{className:"text-[10px] text-[var(--text-muted)] truncate mb-1.5 italic pl-5",children:['"',w.latestPrompt,'"']}),i.jsxs("div",{className:"flex items-center gap-3 pl-5",children:[i.jsxs("span",{className:"flex items-center gap-1 text-[9px] font-mono text-[var(--text-faint)]",children:[i.jsx(js,{size:8}),_i(w.updatedAt)]}),i.jsx("span",{className:"text-[9px] font-mono text-[var(--text-faint)]",children:Ni(w.startedAt,w.updatedAt)})]})]},w.sessionId)})}),b&&i.jsxs("div",{className:`
197
+ absolute bottom-4 left-1/2 -translate-x-1/2
198
+ flex items-center gap-3 px-4 py-2.5 rounded-xl
199
+ bg-[var(--bg-elevated)] border border-[var(--border-subtle)]
200
+ shadow-lg z-10 animate-slide-up
201
+ `,children:[i.jsxs("span",{className:"text-[11px] font-mono text-[var(--text-muted)]",children:[r.size," selected"]}),u&&i.jsx("span",{className:"text-[11px] font-mono text-[var(--error)]",children:u}),i.jsxs("button",{onClick:x,disabled:c,className:`
202
+ flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-[11px] font-medium
203
+ bg-red-500/10 text-red-400 border border-red-500/20
204
+ hover:bg-red-500/20 transition-colors disabled:opacity-50
205
+ `,children:[i.jsx(di,{size:12}),c?"Deleting...":`Delete ${r.size}`]}),i.jsx("button",{onClick:v,className:"text-[11px] text-[var(--text-faint)] hover:text-[var(--text-muted)] transition-colors",children:"Cancel"})]})]})});function G(e,t,s){let n=s.initialDeps??[],r,a=!0;function o(){var l,c,d;let u;s.key&&((l=s.debug)!=null&&l.call(s))&&(u=Date.now());const f=e();if(!(f.length!==n.length||f.some((g,x)=>n[x]!==g)))return r;n=f;let h;if(s.key&&((c=s.debug)!=null&&c.call(s))&&(h=Date.now()),r=t(...f),s.key&&((d=s.debug)!=null&&d.call(s))){const g=Math.round((Date.now()-u)*100)/100,x=Math.round((Date.now()-h)*100)/100,v=x/16,y=(b,w)=>{for(b=String(b);b.length<w;)b=" "+b;return b};console.info(`%c⏱ ${y(x,5)} /${y(g,5)} ms`,`
206
+ font-size: .6rem;
207
+ font-weight: bold;
208
+ 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&&!(a&&s.skipInitialOnChange)&&s.onChange(r),a=!1,r}return o.updateDeps=l=>{n=l},o}function Ft(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const Ci=(e,t)=>Math.abs(e-t)<1.01,Ei=(e,t,s)=>{let n;return function(...r){e.clearTimeout(n),n=e.setTimeout(()=>t.apply(this,r),s)}},Ut=e=>{const{offsetWidth:t,offsetHeight:s}=e;return{width:t,height:s}},Ii=e=>e,Ti=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},Mi=(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(Ut(s)),!n.ResizeObserver)return()=>{};const a=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(Ut(s))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()});return a.observe(s,{box:"border-box"}),()=>{a.unobserve(s)}},Bt={passive:!0},Vt=typeof window>"u"?!0:"onscrollend"in window,Ai=(e,t)=>{const s=e.scrollElement;if(!s)return;const n=e.targetWindow;if(!n)return;let r=0;const a=e.options.useScrollendEvent&&Vt?()=>{}:Ei(n,()=>{t(r,!1)},e.options.isScrollingResetDelay),o=u=>()=>{const{horizontal:f,isRtl:p}=e.options;r=f?s.scrollLeft*(p&&-1||1):s.scrollTop,a(),t(r,u)},l=o(!0),c=o(!1);s.addEventListener("scroll",l,Bt);const d=e.options.useScrollendEvent&&Vt;return d&&s.addEventListener("scrollend",c,Bt),()=>{s.removeEventListener("scroll",l),d&&s.removeEventListener("scrollend",c)}},Oi=(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"]},Ri=(e,{adjustments:t=0,behavior:s},n)=>{var r,a;const o=e+t;(a=(r=n.scrollElement)==null?void 0:r.scrollTo)==null||a.call(r,{[n.options.horizontal?"left":"top"]:o,behavior:s})};class Pi{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(a=>{const o=()=>{const l=a.target,c=this.indexFromElement(l);if(!l.isConnected){this.observer.unobserve(l);return}this.shouldMeasureDuringScroll(c)&&this.resizeItem(c,this.options.measureElement(l,a,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()})}));return{disconnect:()=>{var r;(r=n())==null||r.disconnect(),s=null},observe:r=>{var a;return(a=n())==null?void 0:a.observe(r,{box:"border-box"})},unobserve:r=>{var a;return(a=n())==null?void 0:a.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:Ii,rangeExtractor:Ti,onChange:()=>{},measureElement:Oi,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=G(()=>(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,a)=>{this.scrollAdjustments=0,this.scrollDirection=a?this.getScrollOffset()<r?"forward":"backward":null,this.scrollOffset=r,this.isScrolling=a,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,a=new Map;for(let o=n-1;o>=0;o--){const l=s[o];if(r.has(l.lane))continue;const c=a.get(l.lane);if(c==null||l.end>c.end?a.set(l.lane,l):l.end<c.end&&r.set(l.lane,!0),r.size===this.options.lanes)break}return a.size===this.options.lanes?Array.from(a.values()).sort((o,l)=>o.end===l.end?o.index-l.index:o.end-l.end)[0]:void 0},this.getMeasurementOptions=G(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(s,n,r,a,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:a,enabled:o,lanes:l,laneAssignmentMode:c}),{key:!1}),this.getMeasurements=G(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:s,paddingStart:n,scrollMargin:r,getItemKey:a,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 h of this.laneAssignments.keys())h>=s&&this.laneAssignments.delete(h);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(h=>{this.itemSizeCache.set(h.key,h.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 f=this.measurementsCache.slice(0,u),p=new Array(l).fill(void 0);for(let h=0;h<u;h++){const g=f[h];g&&(p[g.lane]=h)}for(let h=u;h<s;h++){const g=a(h),x=this.laneAssignments.get(h);let v,y;const b=c==="estimate"||d.has(g);if(x!==void 0&&this.options.lanes>1){v=x;const N=p[v],k=N!==void 0?f[N]:void 0;y=k?k.end+this.options.gap:n+r}else{const N=this.options.lanes===1?f[h-1]:this.getFurthestMeasurement(f,h);y=N?N.end+this.options.gap:n+r,v=N?N.lane:h%this.options.lanes,this.options.lanes>1&&b&&this.laneAssignments.set(h,v)}const w=d.get(g),j=typeof w=="number"?w:this.options.estimateSize(h),_=y+j;f[h]={index:h,start:y,size:j,end:_,key:g,lane:v},p[v]=h}return this.measurementsCache=f,f},{key:!1,debug:()=>this.options.debug}),this.calculateRange=G(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(s,n,r,a)=>this.range=s.length>0&&n>0?Di({measurements:s,outerSize:n,scrollOffset:r,lanes:a}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=G(()=>{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,a,o)=>a===null||o===null?[]:s({startIndex:a,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 a=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),o=Math.max(0,r-a),l=Math.min(this.options.count-1,r+a);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),a=this.elementsCache.get(r);a!==s&&(a&&this.observer.unobserve(a),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 a=this.measurementsCache[s];if(!a)return;const o=this.itemSizeCache.get(a.key)??a.size,l=n-o;l!==0&&(((r=this.scrollState)==null?void 0:r.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(a,l,this):a.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=l,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(a.index),this.itemSizeCache=new Map(this.itemSizeCache.set(a.key,n)),this.notify(!1))},this.getVirtualItems=G(()=>[this.getVirtualIndexes(),this.getMeasurements()],(s,n)=>{const r=[];for(let a=0,o=s.length;a<o;a++){const l=s[a],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 Ft(n[Ss(0,n.length-1,r=>Ft(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 a=this.getSize(),o=this.getScrollOffset();n==="auto"&&(n=s>=o+a?"end":"start"),n==="center"?s+=(r-a)/2:n==="end"&&(s-=a);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(),a=this.getScrollOffset(),o=this.measurementsCache[s];if(!o)return;if(n==="auto")if(o.end>=a+r-this.options.scrollPaddingEnd)n="end";else if(o.start<=a+this.options.scrollPaddingStart)n="start";else return[a,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 a=this.getOffsetForAlignment(s,n),o=this.now();this.scrollState={index:null,align:n,behavior:r,startedAt:o,lastTargetOffset:a,stableFrames:0},this._scrollToOffset(a,{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 a=this.getOffsetForIndex(s,n);if(!a)return;const[o,l]=a,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,a=this.now();this.scrollState={index:null,align:"start",behavior:n,startedAt:a,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 a=Array(this.options.lanes).fill(null);let o=n.length-1;for(;o>=0&&a.some(l=>l===null);){const l=n[o];a[l.lane]===null&&(a[l.lane]=l.end),o--}r=Math.max(...a.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,a=1,o=r!==this.scrollState.lastTargetOffset;if(!o&&Ci(r,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=a){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 Ss=(e,t,s,n)=>{for(;e<=t;){const r=(e+t)/2|0,a=s(r);if(a<n)e=r+1;else if(a>n)t=r-1;else return r}return e>0?e-1:0};function Di({measurements:e,outerSize:t,scrollOffset:s,lanes:n}){const r=e.length-1,a=c=>e[c].start;if(e.length<=n)return{startIndex:0,endIndex:r};let o=Ss(0,r,a,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 Wt=typeof document<"u"?m.useLayoutEffect:m.useEffect;function zi({useFlushSync:e=!0,...t}){const s=m.useReducer(()=>({}),{})[1],n={...t,onChange:(a,o)=>{var l;e&&o?qt.flushSync(s):s(),(l=t.onChange)==null||l.call(t,a,o)}},[r]=m.useState(()=>new Pi(n));return r.setOptions(n),Wt(()=>r._didMount(),[]),Wt(()=>r._willUpdate()),r}function Li(e){return zi({observeElementRect:Mi,observeElementOffset:Ai,scrollToFn:Ri,...e})}function Ht({label:e,active:t,onClick:s}){return i.jsx("button",{className:`
209
+ px-2.5 py-1 rounded-[3px] text-[9px] font-mono font-bold
210
+ uppercase tracking-wider transition-all duration-100 border
211
+ ${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)]"}
212
+ `,onClick:s,children:e})}const $i=38,Fi=m.memo(function({log:t,style:s}){return i.jsxs("div",{style:s,className:`
213
+ flex items-center gap-3 px-5
214
+ border-b border-[var(--border-subtle)]
215
+ hover:bg-[var(--bg-elevated)] transition-colors
216
+ `,children:[i.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})}),i.jsx("span",{className:`badge badge-${t.role} flex-shrink-0`,children:t.role}),i.jsx("span",{className:`badge badge-${t.status} flex-shrink-0`,children:t.status}),i.jsx("span",{className:"text-[10px] font-medium text-[var(--text-primary)] truncate flex-shrink-0 max-w-[120px]",children:t.label}),t.currentAction&&i.jsx("span",{className:"text-[9px] text-[var(--text-muted)] font-mono truncate flex-1 min-w-0",children:t.currentAction})]})}),Ui=m.memo(function(){const t=B(Rr),[s,n]=m.useState("ALL"),[r,a]=m.useState("ALL"),[o,l]=m.useState(!0),c=m.useRef(null),d=m.useMemo(()=>t.filter(h=>!(s!=="ALL"&&h.role!==s||r!=="ALL"&&h.status!==r)),[t,s,r]),u=Li({count:d.length,getScrollElement:()=>c.current,estimateSize:()=>$i,overscan:12}),f=m.useCallback(()=>{d.length>0&&u.scrollToIndex(d.length-1,{behavior:"smooth"})},[d.length,u]);m.useEffect(()=>{o&&f()},[d.length,o]);const p=m.useCallback(()=>{const h=c.current;h&&l(h.scrollHeight-h.scrollTop<=h.clientHeight+60)},[]);return i.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-[var(--bg-base)]",children:[i.jsxs("div",{className:`
217
+ flex items-center gap-2 px-5 py-2.5
218
+ border-b border-[var(--border-subtle)] flex-shrink-0 flex-wrap
219
+ bg-[var(--bg-surface)]
220
+ `,children:[i.jsx("span",{className:"section-label mr-1",children:"Role"}),["ALL","T1","T2","T3"].map(h=>i.jsx(Ht,{label:h,active:s===h,onClick:()=>n(h)},h)),i.jsx("div",{className:"divider-v h-4 mx-1"}),i.jsx("span",{className:"section-label mr-1",children:"Status"}),["ALL","ACTIVE","COMPLETED","FAILED","ESCALATED"].map(h=>i.jsx(Ht,{label:h,active:r===h,onClick:()=>a(h)},h)),i.jsxs("div",{className:"ml-auto flex items-center gap-3",children:[i.jsxs("span",{className:"text-[9px] font-mono text-[var(--text-faint)] tabular-nums",children:[d.length.toLocaleString()," entries"]}),!o&&i.jsx("button",{className:"btn btn-ghost py-0.5 px-2",onClick:()=>{l(!0),f()},children:"↓ Jump to latest"})]})]}),i.jsxs("div",{className:`
221
+ flex items-center gap-3 px-5 py-1.5
222
+ border-b border-[var(--border-subtle)]
223
+ bg-[var(--bg-surface)] flex-shrink-0
224
+ `,children:[i.jsx("span",{className:"section-label w-[64px]",children:"Time"}),i.jsx("span",{className:"section-label w-[28px]",children:"Tier"}),i.jsx("span",{className:"section-label w-[72px]",children:"Status"}),i.jsx("span",{className:"section-label w-[120px]",children:"Agent"}),i.jsx("span",{className:"section-label",children:"Action"})]}),d.length===0?i.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"}):i.jsx("div",{ref:c,onScroll:p,className:"flex-1 overflow-y-auto",role:"log","aria-label":"Activity log","aria-live":"polite",children:i.jsx("div",{style:{height:u.getTotalSize(),position:"relative"},children:u.getVirtualItems().map(h=>{const g=d[h.index];return i.jsx(Fi,{log:g,style:{position:"absolute",top:0,left:0,right:0,transform:`translateY(${h.start}px)`,height:`${h.size}px`}},g.id)})})})]})}),Bi=[{id:"identities",label:"Identities",icon:"◎"},{id:"tier-limits",label:"Tier Limits",icon:"⊟"},{id:"budget",label:"Budget",icon:"⟁"},{id:"danger",label:"Danger Zone",icon:"⚡"}];function Vi({token:e}){const t=Pe(),[s,n]=m.useState("identities");return i.jsxs("div",{className:"flex h-full overflow-hidden animate-fade-in",children:[i.jsxs("nav",{className:"w-44 flex-shrink-0 border-r border-[var(--border-base)] p-4 flex flex-col gap-1",children:[i.jsx("p",{className:"section-label mb-3",children:"Settings"}),Bi.map(r=>i.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
225
+ ${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:[i.jsx("span",{className:"text-[11px] font-mono opacity-70",children:r.icon}),r.label]},r.id))]}),i.jsx("div",{className:"flex-1 overflow-y-auto p-8",children:i.jsxs("div",{className:"max-w-2xl mx-auto",children:[s==="identities"&&i.jsx(Wi,{token:e}),s==="tier-limits"&&i.jsx(qi,{token:e}),s==="budget"&&i.jsx(Ki,{token:e}),s==="danger"&&i.jsx(Gi,{token:e,dispatch:t})]})})]})}function Wi({token:e}){const[t,s]=m.useState([]),[n,r]=m.useState(!0),[a,o]=m.useState(!1),[l,c]=m.useState(null),[d,u]=m.useState({name:"",description:"",systemPrompt:"",setDefault:!1}),[f,p]=m.useState(""),h=m.useCallback(async()=>{try{const b=await fetch("/api/identities",{headers:{Authorization:`Bearer ${e}`}});b.ok&&s(await b.json())}finally{r(!1)}},[e]);m.useEffect(()=>{h()},[h]);const g=()=>{u({name:"",description:"",systemPrompt:"",setDefault:!1}),p("")},x=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 h()):p("Failed to create identity")},v=async(b,w)=>{await fetch(`/api/identities/${b}`,{method:"PUT",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(w)}),c(null),await h()},y=async b=>{await fetch(`/api/identities/${b}`,{method:"DELETE",headers:{Authorization:`Bearer ${e}`}}),await h()};return n?i.jsx(Ji,{}):i.jsxs("section",{children:[i.jsxs("div",{className:"flex items-center justify-between mb-6",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-lg font-bold text-[var(--text-primary)]",children:"Identities"}),i.jsx("p",{className:"text-sm text-[var(--text-muted)] mt-1",children:"Persona profiles that shape how agents behave."})]}),i.jsx("button",{onClick:()=>{g(),o(!0)},className:"btn btn-primary h-8 text-sm px-3",children:"+ New Identity"})]}),a&&i.jsxs("div",{className:"glass-elevated rounded-[var(--radius-lg)] p-5 mb-6 border border-[var(--accent)]/30",children:[i.jsx("p",{className:"font-medium text-[var(--text-primary)] mb-4",children:"Create Identity"}),i.jsx(_s,{form:d,onChange:u,error:f}),i.jsxs("div",{className:"flex gap-2 mt-4",children:[i.jsx("button",{onClick:x,className:"btn btn-primary text-sm",children:"Create"}),i.jsx("button",{onClick:()=>{o(!1),g()},className:"btn glass text-sm",children:"Cancel"})]})]}),t.length===0&&!a&&i.jsxs("div",{className:"text-center py-12 text-[var(--text-muted)]",children:[i.jsx("p",{className:"text-2xl mb-2",children:"◎"}),i.jsx("p",{children:"No identities yet. Create one above."})]}),i.jsx("div",{className:"flex flex-col gap-3",children:t.map(b=>i.jsx(Hi,{identity:b,token:e,editing:l===b.id,onEdit:()=>c(l===b.id?null:b.id),onSave:w=>v(b.id,w),onDelete:()=>y(b.id),onSetDefault:()=>v(b.id,{setDefault:!0})},b.id))})]})}function _s({form:e,onChange:t,error:s}){return i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"section-label mb-1 block",children:"Name *"}),i.jsx("input",{className:"input",placeholder:"e.g. Senior Engineer",value:e.name,onChange:n=>t({...e,name:n.target.value})})]}),i.jsxs("div",{children:[i.jsx("label",{className:"section-label mb-1 block",children:"Description"}),i.jsx("input",{className:"input",placeholder:"Short description",value:e.description,onChange:n=>t({...e,description:n.target.value})})]}),i.jsxs("div",{children:[i.jsx("label",{className:"section-label mb-1 block",children:"System Prompt"}),i.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})})]}),i.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:e.setDefault,onChange:n=>t({...e,setDefault:n.target.checked}),className:"accent-[var(--accent)]"}),i.jsx("span",{className:"text-sm text-[var(--text-muted)]",children:"Set as default identity"})]}),s&&i.jsx("p",{className:"text-[11px] text-[var(--error)] font-mono",children:s})]})}function Hi({identity:e,editing:t,onEdit:s,onSave:n,onDelete:r,onSetDefault:a}){var u;const[o,l]=m.useState({name:e.name,description:e.description??"",systemPrompt:e.systemPrompt??"",setDefault:e.isDefault}),[c,d]=m.useState(!1);return i.jsxs("div",{className:`glass-elevated rounded-[var(--radius-lg)] p-4 border transition-all ${t?"border-[var(--accent)]/40":"border-[var(--border-base)]"}`,children:[i.jsxs("div",{className:"flex items-start justify-between gap-3",children:[i.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[i.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()}),i.jsxs("div",{className:"min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("p",{className:"font-medium text-[var(--text-primary)] truncate",children:e.name}),e.isDefault&&i.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&&i.jsx("p",{className:"text-xs text-[var(--text-muted)] mt-0.5 truncate",children:e.description})]})]}),i.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[!e.isDefault&&i.jsx("button",{onClick:a,className:"btn glass text-xs h-7 px-2",children:"Set Default"}),i.jsx("button",{onClick:s,className:"btn glass text-xs h-7 px-2",children:t?"Cancel":"Edit"}),c?i.jsx("button",{onClick:r,className:"btn text-xs h-7 px-2 bg-[var(--error)] border-transparent text-white",children:"Confirm"}):i.jsx("button",{onClick:()=>d(!0),className:"btn glass text-xs h-7 px-2 text-[var(--error)]",children:"Delete"})]})]}),t&&i.jsxs("div",{className:"mt-4 pt-4 border-t border-[var(--border-base)]",children:[i.jsx(_s,{form:o,onChange:l,error:""}),i.jsx("div",{className:"flex gap-2 mt-4",children:i.jsx("button",{onClick:()=>n(o),className:"btn btn-primary text-sm",children:"Save Changes"})})]})]})}function qi({token:e}){const[t,s]=m.useState({}),[n,r]=m.useState(!1),[a,o]=m.useState(!1),[l,c]=m.useState("");m.useEffect(()=>{fetch("/api/config",{headers:{Authorization:`Bearer ${e}`}}).then(f=>{if(!f.ok)throw new Error(`HTTP ${f.status}`);return f.json()}).then(f=>{f.tierLimits&&s(f.tierLimits)}).catch(()=>c("Failed to load tier limits."))},[e]);const d=async()=>{r(!0),c("");try{const f=await fetch("/api/config",{method:"PUT",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({tierLimits:t})});if(!f.ok)throw new Error(`HTTP ${f.status}`);o(!0),setTimeout(()=>o(!1),2e3)}catch{c("Failed to save tier limits.")}finally{r(!1)}},u=[{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 i.jsxs("section",{children:[i.jsx("h2",{className:"text-lg font-bold text-[var(--text-primary)] mb-1",children:"Tier Token Limits"}),i.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."}),i.jsx("div",{className:"glass-elevated rounded-[var(--radius-lg)] divide-y divide-[var(--border-base)]",children:u.map(f=>i.jsxs("div",{className:"flex items-center justify-between p-5 gap-6",children:[i.jsxs("div",{children:[i.jsx("p",{className:"font-medium text-[var(--text-primary)]",children:f.label}),i.jsx("p",{className:"text-sm text-[var(--text-muted)] mt-0.5",children:f.desc})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("input",{type:"number",min:128,max:2e5,step:128,placeholder:f.placeholder,value:t[f.key]??"",onChange:p=>s(h=>({...h,[f.key]:p.target.value?Number(p.target.value):void 0})),className:"input w-28 text-right font-mono text-sm"}),i.jsx("span",{className:"text-xs text-[var(--text-faint)] font-mono",children:"tokens"})]})]},f.key))}),i.jsxs("div",{className:"flex items-center gap-3 mt-4",children:[i.jsx("button",{onClick:d,disabled:n,className:"btn btn-primary",children:n?"Saving…":a?"✓ Saved":"Save Limits"}),a&&i.jsx("span",{className:"text-xs text-green-400 font-mono",children:"Persisted to .cascade/config.json"}),l&&i.jsx("span",{className:"text-xs text-[var(--error)] font-mono",children:l})]})]})}function Ki({token:e}){var g;const[t,s]=m.useState({warnAtPct:80}),[n,r]=m.useState(null),[a,o]=m.useState(!1),[l,c]=m.useState(!1),[d,u]=m.useState("");m.useEffect(()=>{fetch("/api/config",{headers:{Authorization:`Bearer ${e}`}}).then(x=>{if(!x.ok)throw new Error(`HTTP ${x.status}`);return x.json()}).then(x=>{x.budget&&s(x.budget)}).catch(()=>u("Failed to load budget config.")),fetch("/api/stats",{headers:{Authorization:`Bearer ${e}`}}).then(x=>{if(!x.ok)throw new Error(`HTTP ${x.status}`);return x.json()}).then(x=>r(x)).catch(()=>{})},[e]);const f=async()=>{o(!0),u("");try{const x=await fetch("/api/config",{method:"PUT",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({budget:t})});if(!x.ok)throw new Error(`HTTP ${x.status}`);c(!0),setTimeout(()=>c(!1),2e3)}catch{u("Failed to save budget.")}finally{o(!1)}},p=t.sessionBudgetUsd&&n?Math.min(100,n.totalCostUsd/t.sessionBudgetUsd*100):null,h=t.warnAtPct;return i.jsxs("section",{children:[i.jsx("h2",{className:"text-lg font-bold text-[var(--text-primary)] mb-1",children:"Cost Budget"}),i.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."}),i.jsxs("div",{className:"glass-elevated rounded-[var(--radius-lg)] divide-y divide-[var(--border-base)] mb-4",children:[i.jsxs("div",{className:"p-5",children:[i.jsxs("div",{className:"flex items-center justify-between gap-6",children:[i.jsxs("div",{children:[i.jsx("p",{className:"font-medium text-[var(--text-primary)]",children:"Session Budget"}),i.jsx("p",{className:"text-sm text-[var(--text-muted)] mt-0.5",children:"Max spend per REPL session. Exceeding this aborts the current run."})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-[var(--text-faint)] font-mono text-sm",children:"$"}),i.jsx("input",{type:"number",min:0,step:.01,placeholder:"0.50",value:t.sessionBudgetUsd??"",onChange:x=>s(v=>({...v,sessionBudgetUsd:x.target.value?Number(x.target.value):void 0})),className:"input w-24 text-right font-mono text-sm"})]})]}),p!==null&&i.jsxs("div",{className:"mt-3",children:[i.jsxs("div",{className:"flex justify-between text-xs text-[var(--text-faint)] mb-1",children:[i.jsx("span",{children:"Session spend"}),i.jsxs("span",{children:["$",n==null?void 0:n.totalCostUsd.toFixed(4)," / $",(g=t.sessionBudgetUsd)==null?void 0:g.toFixed(2)]})]}),i.jsx("div",{className:"h-1.5 rounded-full bg-[var(--bg-base)] overflow-hidden",children:i.jsx("div",{className:`h-full rounded-full transition-all ${p>=100?"bg-[var(--error)]":p>=h?"bg-yellow-400":"bg-[var(--accent)]"}`,style:{width:`${p}%`}})})]})]}),i.jsx("div",{className:"p-5",children:i.jsxs("div",{className:"flex items-center justify-between gap-6",children:[i.jsxs("div",{children:[i.jsxs("p",{className:"font-medium text-[var(--text-primary)]",children:["Daily Budget ",i.jsx("span",{className:"text-xs text-[var(--text-faint)] ml-1",children:"(display only)"})]}),i.jsx("p",{className:"text-sm text-[var(--text-muted)] mt-0.5",children:"Informational limit shown in the dashboard for reference."})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-[var(--text-faint)] font-mono text-sm",children:"$"}),i.jsx("input",{type:"number",min:0,step:.1,placeholder:"5.00",value:t.dailyBudgetUsd??"",onChange:x=>s(v=>({...v,dailyBudgetUsd:x.target.value?Number(x.target.value):void 0})),className:"input w-24 text-right font-mono text-sm"})]})]})}),i.jsxs("div",{className:"p-5",children:[i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsxs("div",{children:[i.jsx("p",{className:"font-medium text-[var(--text-primary)]",children:"Warn at"}),i.jsx("p",{className:"text-sm text-[var(--text-muted)] mt-0.5",children:"Show a dashboard warning when spend reaches this % of limit."})]}),i.jsxs("span",{className:"text-sm font-mono text-[var(--accent)]",children:[t.warnAtPct,"%"]})]}),i.jsx("input",{type:"range",min:10,max:99,step:5,value:t.warnAtPct,onChange:x=>s(v=>({...v,warnAtPct:Number(x.target.value)})),className:"w-full accent-[var(--accent)]"}),i.jsxs("div",{className:"flex justify-between text-xs text-[var(--text-faint)] mt-1",children:[i.jsx("span",{children:"10%"}),i.jsx("span",{children:"50%"}),i.jsx("span",{children:"99%"})]})]})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("button",{onClick:f,disabled:a,className:"btn btn-primary",children:a?"Saving…":l?"✓ Saved":"Save Budget"}),l&&i.jsx("span",{className:"text-xs text-green-400 font-mono",children:"Persisted to .cascade/config.json"}),d&&i.jsx("span",{className:"text-xs text-[var(--error)] font-mono",children:d})]})]})}function Gi({token:e,dispatch:t}){const[s,n]=m.useState(null),[r,a]=m.useState(!1),o=async l=>{n(l);try{await fetch(l,{method:"DELETE",headers:{Authorization:`Bearer ${e}`}})}finally{n(null),a(!1)}};return i.jsxs("section",{children:[i.jsx("h2",{className:"text-lg font-bold text-[var(--error)] mb-1",children:"Danger Zone"}),i.jsx("p",{className:"text-sm text-[var(--text-muted)] mb-6",children:"These actions are irreversible."}),i.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-[var(--error)]/30 divide-y divide-[var(--error)]/10 overflow-hidden",children:[i.jsx(Ke,{title:"Clear All Sessions",desc:"Permanently delete all conversation sessions and messages.",action:r?i.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"}):i.jsx("button",{onClick:()=>a(!0),className:"btn glass text-sm border-[var(--error)]/40 text-[var(--error)]",children:"Clear Sessions"})}),i.jsx(Ke,{title:"Clear Graphs (Backend + Frontend)",desc:"Delete all runtime node logs from DB and reset the topology view.",action:i.jsx("button",{onClick:async()=>{await o("/api/runtime"),t(Ot())},disabled:!!s,className:"btn glass text-sm border-[var(--error)]/40 text-[var(--error)]",children:s==="/api/runtime"?"Clearing…":"Clear DB Graphs"})}),i.jsx(Ke,{title:"Clear Graphs (Frontend Only)",desc:"Reset the topology view locally without touching the server database.",action:i.jsx("button",{onClick:()=>t(Ot()),className:"btn glass text-sm",children:"Clear View"})})]})]})}function Ke({title:e,desc:t,action:s}){return i.jsxs("div",{className:"flex items-center justify-between gap-6 p-5 bg-[var(--error)]/[0.03]",children:[i.jsxs("div",{children:[i.jsx("p",{className:"font-medium text-[var(--text-primary)]",children:e}),i.jsx("p",{className:"text-sm text-[var(--text-muted)] mt-0.5",children:t})]}),i.jsx("div",{className:"flex-shrink-0",children:s})]})}function Ji(){return i.jsx("div",{className:"flex items-center justify-center py-16",children:i.jsx("div",{className:"w-6 h-6 rounded-full border-2 border-[var(--accent)] border-t-transparent animate-spin"})})}function Xi(){const[e,t]=m.useState(()=>localStorage.getItem("cascade_token")),[s,n]=m.useState(e===null);m.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=m.useCallback(o=>{t(o),localStorage.setItem("cascade_token",o)},[]),a=m.useCallback(()=>{t(null),localStorage.removeItem("cascade_token")},[]);return s?i.jsx("div",{className:"flex items-center justify-center w-full h-full bg-[var(--bg-base)]",children:i.jsxs("div",{className:"flex flex-col items-center gap-3",children:[i.jsx("div",{className:"w-8 h-8 rounded-full border-2 border-[var(--accent)] border-t-transparent animate-spin"}),i.jsx("p",{className:"section-label",children:"Connecting…"})]})}):e===null?i.jsx(Xr,{onLogin:r}):i.jsx(Yi,{token:e,onLogout:a,onNeedAuth:()=>{t(null),localStorage.removeItem("cascade_token")}})}function Yi({token:e,onLogout:t,onNeedAuth:s}){const n=Pe(),r=()=>{const S=window.location.hash.slice(1);return["topology","sessions","logs","settings"].includes(S)?S:"topology"},[a,o]=m.useState(r),l=m.useCallback(S=>{o(S),window.location.hash=S},[]);m.useLayoutEffect(()=>{const S=()=>o(r());return window.addEventListener("popstate",S),()=>window.removeEventListener("popstate",S)},[]);const[c,d]=m.useState(null),[u,f]=m.useState({}),[p,h]=m.useState(null),[g,x]=m.useState(0),[v,y]=m.useState(0),[b,w]=m.useState([]),j=B(Or),_=B(lt),N=B(Pr),k=B(Dr),E=m.useRef(p);E.current=p;const C=m.useCallback(async(S="workspace")=>{try{const P=await fetch(`/api/runtime?scope=${S}`,{headers:{Authorization:`Bearer ${e}`},cache:"no-store"});if(P.status===401){s();return}if(P.ok){const Q=await P.json();n(ps(Q))}}catch{}},[e,n,s]),{socket:O}=Jr({url:"/",token:e,activeSessionId:_==null?void 0:_.sessionId,onRuntimeRefresh:S=>C(S??"workspace"),onStreamToken:S=>{f(P=>{const Q=P[S.tierId]||"";return{...P,[S.tierId]:(Q+S.text).slice(-8e3)}})},onCostUpdate:S=>{typeof S.totalCostUsd=="number"&&x(S.totalCostUsd),typeof S.totalTokens=="number"&&y(S.totalTokens)},onEscalation:S=>{E.current||h(S)}});m.useEffect(()=>{C()},[C]);const U=m.useRef(0);m.useEffect(()=>{const S=k.slice(U.current);if(U.current=k.length,!S.length)return;const P=S.filter(I=>I.fromId&&(I.toId||j.some(K=>K.tierId!==I.fromId))).map(I=>{var K;return{id:`peer-${I.timestamp}-${I.fromId}`,from:I.fromId,to:I.toId??((K=j.find(Is=>Is.tierId!==I.fromId))==null?void 0:K.tierId)??"",syncType:I.syncType}}).filter(I=>I.to);if(!P.length)return;w(I=>[...I,...P]);const Q=new Set(P.map(I=>I.id));setTimeout(()=>w(I=>I.filter(K=>!Q.has(K.id))),3e3)},[k,j]);const q=m.useMemo(()=>j.map(S=>({id:S.tierId,role:S.role,label:S.label,status:S.status,action:S.currentAction,progressPct:S.progressPct})),[j]),Ns=m.useMemo(()=>j.filter(S=>S.parentId).map(S=>({from:S.parentId,to:S.tierId})),[j]),ks=m.useMemo(()=>j.find(S=>S.tierId===c)??null,[j,c]),Cs=m.useCallback((S,P)=>{!p||!O||(O.emit("permission:decision",{requestId:p.id,approved:S,always:P,decidedBy:"USER"}),h(null))},[p,O]),Es=c!==null;return i.jsxs("div",{className:"flex h-full w-full overflow-hidden bg-[var(--bg-base)]",children:[i.jsx(hi,{activeTab:a,onTabChange:l,onLogout:t}),i.jsxs("div",{className:"flex flex-col flex-1 min-w-0 overflow-hidden",children:[i.jsx(xi,{isConnected:N,totalCostUsd:g,totalTokens:v}),i.jsxs("div",{className:"flex flex-1 min-h-0 overflow-hidden",children:[i.jsxs("main",{className:"flex-1 min-w-0 overflow-hidden relative dot-grid",children:[a==="topology"&&i.jsx(yi,{nodes:q,edges:Ns,peerEdges:b,selectedNodeId:c??void 0,onSelectNode:d}),a==="sessions"&&i.jsx(ki,{}),a==="logs"&&i.jsx(Ui,{}),a==="settings"&&i.jsx(Vi,{token:e})]}),a==="topology"&&Es&&i.jsx(ji,{node:ks,streamLog:c&&u[c]||"",peerMessages:k.filter(S=>S.fromId===c||S.toId===c),onClose:()=>d(null)})]})]}),p&&i.jsx(Si,{request:p,onDecide:Cs})]})}Ge.createRoot(document.getElementById("root")).render(i.jsx(Ds.StrictMode,{children:i.jsx(dn,{store:Lr,children:i.jsx(Xi,{})})}));
@@ -0,0 +1 @@
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-px{margin-bottom:-1px}.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{gap:0px}.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}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.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}.rounded-t-sm{border-top-left-radius:.125rem;border-top-right-radius:.125rem}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.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}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.pb-4{padding-bottom:1rem}.pl-5{padding-left:1.25rem}.pt-2{padding-top:.5rem}.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}