@grackle-ai/web 0.85.1 → 0.85.2

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.
@@ -1 +1 @@
1
- import{a as z,j as w}from"./markdown-gcy1Jmzi.js";import{u as Z,s as q,t as tt,a as et,B as nt,K as rt}from"./index-CAQikL1U.js";import{t as it,b as st,z as at,s as D,c as H}from"./dagview-BA5TtMAQ.js";import"./grpc-DU5jMhZD.js";function ot(t,e){var n,l=1;t==null&&(t=0),e==null&&(e=0);function o(){var r,u=n.length,h,_=0,s=0;for(r=0;r<u;++r)h=n[r],_+=h.x,s+=h.y;for(_=(_/u-t)*l,s=(s/u-e)*l,r=0;r<u;++r)h=n[r],h.x-=_,h.y-=s}return o.initialize=function(r){n=r},o.x=function(r){return arguments.length?(t=+r,o):t},o.y=function(r){return arguments.length?(e=+r,o):e},o.strength=function(r){return arguments.length?(l=+r,o):l},o}function ct(t){const e=+this._x.call(null,t),n=+this._y.call(null,t);return J(this.cover(e,n),e,n,t)}function J(t,e,n,l){if(isNaN(e)||isNaN(n))return t;var o,r=t._root,u={data:l},h=t._x0,_=t._y0,s=t._x1,d=t._y1,y,m,f,p,a,i,c,g;if(!r)return t._root=u,t;for(;r.length;)if((a=e>=(y=(h+s)/2))?h=y:s=y,(i=n>=(m=(_+d)/2))?_=m:d=m,o=r,!(r=r[c=i<<1|a]))return o[c]=u,t;if(f=+t._x.call(null,r.data),p=+t._y.call(null,r.data),e===f&&n===p)return u.next=r,o?o[c]=u:t._root=u,t;do o=o?o[c]=new Array(4):t._root=new Array(4),(a=e>=(y=(h+s)/2))?h=y:s=y,(i=n>=(m=(_+d)/2))?_=m:d=m;while((c=i<<1|a)===(g=(p>=m)<<1|f>=y));return o[g]=r,o[c]=u,t}function lt(t){var e,n,l=t.length,o,r,u=new Array(l),h=new Array(l),_=1/0,s=1/0,d=-1/0,y=-1/0;for(n=0;n<l;++n)isNaN(o=+this._x.call(null,e=t[n]))||isNaN(r=+this._y.call(null,e))||(u[n]=o,h[n]=r,o<_&&(_=o),o>d&&(d=o),r<s&&(s=r),r>y&&(y=r));if(_>d||s>y)return this;for(this.cover(_,s).cover(d,y),n=0;n<l;++n)J(this,u[n],h[n],t[n]);return this}function ut(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var n=this._x0,l=this._y0,o=this._x1,r=this._y1;if(isNaN(n))o=(n=Math.floor(t))+1,r=(l=Math.floor(e))+1;else{for(var u=o-n||1,h=this._root,_,s;n>t||t>=o||l>e||e>=r;)switch(s=(e<l)<<1|t<n,_=new Array(4),_[s]=h,h=_,u*=2,s){case 0:o=n+u,r=l+u;break;case 1:n=o-u,r=l+u;break;case 2:o=n+u,l=r-u;break;case 3:n=o-u,l=r-u;break}this._root&&this._root.length&&(this._root=h)}return this._x0=n,this._y0=l,this._x1=o,this._y1=r,this}function ft(){var t=[];return this.visit(function(e){if(!e.length)do t.push(e.data);while(e=e.next)}),t}function ht(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function C(t,e,n,l,o){this.node=t,this.x0=e,this.y0=n,this.x1=l,this.y1=o}function dt(t,e,n){var l,o=this._x0,r=this._y0,u,h,_,s,d=this._x1,y=this._y1,m=[],f=this._root,p,a;for(f&&m.push(new C(f,o,r,d,y)),n==null?n=1/0:(o=t-n,r=e-n,d=t+n,y=e+n,n*=n);p=m.pop();)if(!(!(f=p.node)||(u=p.x0)>d||(h=p.y0)>y||(_=p.x1)<o||(s=p.y1)<r))if(f.length){var i=(u+_)/2,c=(h+s)/2;m.push(new C(f[3],i,c,_,s),new C(f[2],u,c,i,s),new C(f[1],i,h,_,c),new C(f[0],u,h,i,c)),(a=(e>=c)<<1|t>=i)&&(p=m[m.length-1],m[m.length-1]=m[m.length-1-a],m[m.length-1-a]=p)}else{var g=t-+this._x.call(null,f.data),N=e-+this._y.call(null,f.data),x=g*g+N*N;if(x<n){var b=Math.sqrt(n=x);o=t-b,r=e-b,d=t+b,y=e+b,l=f.data}}return l}function gt(t){if(isNaN(d=+this._x.call(null,t))||isNaN(y=+this._y.call(null,t)))return this;var e,n=this._root,l,o,r,u=this._x0,h=this._y0,_=this._x1,s=this._y1,d,y,m,f,p,a,i,c;if(!n)return this;if(n.length)for(;;){if((p=d>=(m=(u+_)/2))?u=m:_=m,(a=y>=(f=(h+s)/2))?h=f:s=f,e=n,!(n=n[i=a<<1|p]))return this;if(!n.length)break;(e[i+1&3]||e[i+2&3]||e[i+3&3])&&(l=e,c=i)}for(;n.data!==t;)if(o=n,!(n=n.next))return this;return(r=n.next)&&delete n.next,o?(r?o.next=r:delete o.next,this):e?(r?e[i]=r:delete e[i],(n=e[0]||e[1]||e[2]||e[3])&&n===(e[3]||e[2]||e[1]||e[0])&&!n.length&&(l?l[c]=n:this._root=n),this):(this._root=r,this)}function xt(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this}function _t(){return this._root}function mt(){var t=0;return this.visit(function(e){if(!e.length)do++t;while(e=e.next)}),t}function vt(t){var e=[],n,l=this._root,o,r,u,h,_;for(l&&e.push(new C(l,this._x0,this._y0,this._x1,this._y1));n=e.pop();)if(!t(l=n.node,r=n.x0,u=n.y0,h=n.x1,_=n.y1)&&l.length){var s=(r+h)/2,d=(u+_)/2;(o=l[3])&&e.push(new C(o,s,d,h,_)),(o=l[2])&&e.push(new C(o,r,d,s,_)),(o=l[1])&&e.push(new C(o,s,u,h,d)),(o=l[0])&&e.push(new C(o,r,u,s,d))}return this}function pt(t){var e=[],n=[],l;for(this._root&&e.push(new C(this._root,this._x0,this._y0,this._x1,this._y1));l=e.pop();){var o=l.node;if(o.length){var r,u=l.x0,h=l.y0,_=l.x1,s=l.y1,d=(u+_)/2,y=(h+s)/2;(r=o[0])&&e.push(new C(r,u,h,d,y)),(r=o[1])&&e.push(new C(r,d,h,_,y)),(r=o[2])&&e.push(new C(r,u,y,d,s)),(r=o[3])&&e.push(new C(r,d,y,_,s))}n.push(l)}for(;l=n.pop();)t(l.node,l.x0,l.y0,l.x1,l.y1);return this}function yt(t){return t[0]}function wt(t){return arguments.length?(this._x=t,this):this._x}function Nt(t){return t[1]}function bt(t){return arguments.length?(this._y=t,this):this._y}function U(t,e,n){var l=new P(e??yt,n??Nt,NaN,NaN,NaN,NaN);return t==null?l:l.addAll(t)}function P(t,e,n,l,o,r){this._x=t,this._y=e,this._x0=n,this._y0=l,this._x1=o,this._y1=r,this._root=void 0}function W(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var L=U.prototype=P.prototype;L.copy=function(){var t=new P(this._x,this._y,this._x0,this._y0,this._x1,this._y1),e=this._root,n,l;if(!e)return t;if(!e.length)return t._root=W(e),t;for(n=[{source:e,target:t._root=new Array(4)}];e=n.pop();)for(var o=0;o<4;++o)(l=e.source[o])&&(l.length?n.push({source:l,target:e.target[o]=new Array(4)}):e.target[o]=W(l));return t};L.add=ct;L.addAll=lt;L.cover=ut;L.data=ft;L.extent=ht;L.find=dt;L.remove=gt;L.removeAll=xt;L.root=_t;L.size=mt;L.visit=vt;L.visitAfter=pt;L.x=wt;L.y=bt;function $(t){return function(){return t}}function S(t){return(t()-.5)*1e-6}function kt(t){return t.x+t.vx}function jt(t){return t.y+t.vy}function zt(t){var e,n,l,o=1,r=1;typeof t!="function"&&(t=$(t==null?1:+t));function u(){for(var s,d=e.length,y,m,f,p,a,i,c=0;c<r;++c)for(y=U(e,kt,jt).visitAfter(h),s=0;s<d;++s)m=e[s],a=n[m.index],i=a*a,f=m.x+m.vx,p=m.y+m.vy,y.visit(g);function g(N,x,b,M,v){var k=N.data,I=N.r,A=a+I;if(k){if(k.index>m.index){var B=f-k.x-k.vx,T=p-k.y-k.vy,R=B*B+T*T;R<A*A&&(B===0&&(B=S(l),R+=B*B),T===0&&(T=S(l),R+=T*T),R=(A-(R=Math.sqrt(R)))/R*o,m.vx+=(B*=R)*(A=(I*=I)/(i+I)),m.vy+=(T*=R)*A,k.vx-=B*(A=1-A),k.vy-=T*A)}return}return x>f+A||M<f-A||b>p+A||v<p-A}}function h(s){if(s.data)return s.r=n[s.data.index];for(var d=s.r=0;d<4;++d)s[d]&&s[d].r>s.r&&(s.r=s[d].r)}function _(){if(e){var s,d=e.length,y;for(n=new Array(d),s=0;s<d;++s)y=e[s],n[y.index]=+t(y,s,e)}}return u.initialize=function(s,d){e=s,l=d,_()},u.iterations=function(s){return arguments.length?(r=+s,u):r},u.strength=function(s){return arguments.length?(o=+s,u):o},u.radius=function(s){return arguments.length?(t=typeof s=="function"?s:$(+s),_(),u):t},u}function At(t){return t.index}function Q(t,e){var n=t.get(e);if(!n)throw new Error("node not found: "+e);return n}function Mt(t){var e=At,n=y,l,o=$(30),r,u,h,_,s,d=1;t==null&&(t=[]);function y(i){return 1/Math.min(h[i.source.index],h[i.target.index])}function m(i){for(var c=0,g=t.length;c<d;++c)for(var N=0,x,b,M,v,k,I,A;N<g;++N)x=t[N],b=x.source,M=x.target,v=M.x+M.vx-b.x-b.vx||S(s),k=M.y+M.vy-b.y-b.vy||S(s),I=Math.sqrt(v*v+k*k),I=(I-r[N])/I*i*l[N],v*=I,k*=I,M.vx-=v*(A=_[N]),M.vy-=k*A,b.vx+=v*(A=1-A),b.vy+=k*A}function f(){if(u){var i,c=u.length,g=t.length,N=new Map(u.map((b,M)=>[e(b,M,u),b])),x;for(i=0,h=new Array(c);i<g;++i)x=t[i],x.index=i,typeof x.source!="object"&&(x.source=Q(N,x.source)),typeof x.target!="object"&&(x.target=Q(N,x.target)),h[x.source.index]=(h[x.source.index]||0)+1,h[x.target.index]=(h[x.target.index]||0)+1;for(i=0,_=new Array(g);i<g;++i)x=t[i],_[i]=h[x.source.index]/(h[x.source.index]+h[x.target.index]);l=new Array(g),p(),r=new Array(g),a()}}function p(){if(u)for(var i=0,c=t.length;i<c;++i)l[i]=+n(t[i],i,t)}function a(){if(u)for(var i=0,c=t.length;i<c;++i)r[i]=+o(t[i],i,t)}return m.initialize=function(i,c){u=i,s=c,f()},m.links=function(i){return arguments.length?(t=i,f(),m):t},m.id=function(i){return arguments.length?(e=i,m):e},m.iterations=function(i){return arguments.length?(d=+i,m):d},m.strength=function(i){return arguments.length?(n=typeof i=="function"?i:$(+i),p(),m):n},m.distance=function(i){return arguments.length?(o=typeof i=="function"?i:$(+i),a(),m):o},m}const Ct=1664525,Lt=1013904223,V=4294967296;function Et(){let t=1;return()=>(t=(Ct*t+Lt)%V)/V}function It(t){return t.x}function Rt(t){return t.y}var Dt=10,Bt=Math.PI*(3-Math.sqrt(5));function Tt(t){var e,n=1,l=.001,o=1-Math.pow(l,1/300),r=0,u=.6,h=new Map,_=it(y),s=st("tick","end"),d=Et();t==null&&(t=[]);function y(){m(),s.call("tick",e),n<l&&(_.stop(),s.call("end",e))}function m(a){var i,c=t.length,g;a===void 0&&(a=1);for(var N=0;N<a;++N)for(n+=(r-n)*o,h.forEach(function(x){x(n)}),i=0;i<c;++i)g=t[i],g.fx==null?g.x+=g.vx*=u:(g.x=g.fx,g.vx=0),g.fy==null?g.y+=g.vy*=u:(g.y=g.fy,g.vy=0);return e}function f(){for(var a=0,i=t.length,c;a<i;++a){if(c=t[a],c.index=a,c.fx!=null&&(c.x=c.fx),c.fy!=null&&(c.y=c.fy),isNaN(c.x)||isNaN(c.y)){var g=Dt*Math.sqrt(.5+a),N=a*Bt;c.x=g*Math.cos(N),c.y=g*Math.sin(N)}(isNaN(c.vx)||isNaN(c.vy))&&(c.vx=c.vy=0)}}function p(a){return a.initialize&&a.initialize(t,d),a}return f(),e={tick:m,restart:function(){return _.restart(y),e},stop:function(){return _.stop(),e},nodes:function(a){return arguments.length?(t=a,f(),h.forEach(p),e):t},alpha:function(a){return arguments.length?(n=+a,e):n},alphaMin:function(a){return arguments.length?(l=+a,e):l},alphaDecay:function(a){return arguments.length?(o=+a,e):+o},alphaTarget:function(a){return arguments.length?(r=+a,e):r},velocityDecay:function(a){return arguments.length?(u=1-a,e):1-u},randomSource:function(a){return arguments.length?(d=a,h.forEach(p),e):d},force:function(a,i){return arguments.length>1?(i==null?h.delete(a):h.set(a,p(i)),e):h.get(a)},find:function(a,i,c){var g=0,N=t.length,x,b,M,v,k;for(c==null?c=1/0:c*=c,g=0;g<N;++g)v=t[g],x=a-v.x,b=i-v.y,M=x*x+b*b,M<c&&(k=v,c=M);return k},on:function(a,i){return arguments.length>1?(s.on(a,i),e):s.on(a)}}}function St(){var t,e,n,l,o=$(-30),r,u=1,h=1/0,_=.81;function s(f){var p,a=t.length,i=U(t,It,Rt).visitAfter(y);for(l=f,p=0;p<a;++p)e=t[p],i.visit(m)}function d(){if(t){var f,p=t.length,a;for(r=new Array(p),f=0;f<p;++f)a=t[f],r[a.index]=+o(a,f,t)}}function y(f){var p=0,a,i,c=0,g,N,x;if(f.length){for(g=N=x=0;x<4;++x)(a=f[x])&&(i=Math.abs(a.value))&&(p+=a.value,c+=i,g+=i*a.x,N+=i*a.y);f.x=g/c,f.y=N/c}else{a=f,a.x=a.data.x,a.y=a.data.y;do p+=r[a.data.index];while(a=a.next)}f.value=p}function m(f,p,a,i){if(!f.value)return!0;var c=f.x-e.x,g=f.y-e.y,N=i-p,x=c*c+g*g;if(N*N/_<x)return x<h&&(c===0&&(c=S(n),x+=c*c),g===0&&(g=S(n),x+=g*g),x<u&&(x=Math.sqrt(u*x)),e.vx+=c*f.value*l/x,e.vy+=g*f.value*l/x),!0;if(f.length||x>=h)return;(f.data!==e||f.next)&&(c===0&&(c=S(n),x+=c*c),g===0&&(g=S(n),x+=g*g),x<u&&(x=Math.sqrt(u*x)));do f.data!==e&&(N=r[f.data.index]*l/x,e.vx+=c*N,e.vy+=g*N);while(f=f.next)}return s.initialize=function(f,p){t=f,n=p,d()},s.strength=function(f){return arguments.length?(o=typeof f=="function"?f:$(+f),d(),s):o},s.distanceMin=function(f){return arguments.length?(u=f*f,s):Math.sqrt(u)},s.distanceMax=function(f){return arguments.length?(h=f*f,s):Math.sqrt(h)},s.theta=function(f){return arguments.length?(_=f*f,s):Math.sqrt(_)},s}const $t="_graphContainer_zxmzw_1",Ot="_svg_zxmzw_10",Gt="_link_zxmzw_18",Ft="_node_zxmzw_30",Kt="_nodeCard_zxmzw_34",Ut="_nodeLabel_zxmzw_40",Pt="_selected_zxmzw_44",Ht="_dimmed_zxmzw_51",Wt="_dimmedLink_zxmzw_56",Qt="_nodeIndicator_zxmzw_68",Vt="_nodeBadge_zxmzw_82",E={graphContainer:$t,svg:Ot,link:Gt,node:Ft,nodeCard:Kt,nodeLabel:Ut,selected:Pt,dimmed:Ht,dimmedLink:Wt,nodeIndicator:Qt,nodeBadge:Vt},F={reference:"#4A9EFF",decision:"#22C55E",insight:"#EAB308",concept:"#A855F7",snippet:"#6B7280"};function X(t){return t.kind==="reference"?F.reference:F[t.category??"insight"]??F.insight}const O=200,G=52,Y=12;function Xt({graphData:t,selectedNodeId:e,onNodeClick:n,onNodeDoubleClick:l}){const o=z.useRef(null),r=z.useRef(null),u=z.useRef(void 0),h=z.useRef(void 0),_=z.useRef(void 0),s=z.useRef(void 0),[d,y]=z.useState({width:800,height:600});z.useEffect(()=>{var c;const a=((c=o.current)==null?void 0:c.parentElement)??null;if(!a)return;const i=new ResizeObserver(g=>{for(const N of g)y({width:N.contentRect.width,height:N.contentRect.height})});return i.observe(a),y({width:a.clientWidth,height:a.clientHeight}),()=>{i.disconnect()}},[]),z.useEffect(()=>{if(!o.current||!r.current)return;const a=o.current,i=r.current,c=at().scaleExtent([.1,4]).filter(g=>g.type!=="dblclick").on("zoom",g=>{D(i).attr("transform",String(g.transform))});return D(a).call(c),h.current=c,()=>{D(a).on(".zoom",null)}},[]);const m=z.useRef(n);m.current=n;const f=z.useRef(l);f.current=l,z.useEffect(()=>{if(!r.current)return;const a=r.current;if(u.current&&(u.current.stop(),u.current=void 0),t.nodes.length===0){D(a).selectAll("*").remove();return}const i=t.nodes.map(v=>({...v})),c=new Map(i.map(v=>[v.id,v])),g=t.links.filter(v=>c.has(v.source)&&c.has(v.target)).map(v=>({source:v.source,target:v.target,type:v.type}));D(a).selectAll("*").remove();const N=D(a).selectAll("line").data(g).enter().append("line").attr("class",E.link);N.append("title").text(v=>v.type),_.current=N;const x=D(a).selectAll("g.kg-node").data(i).enter().append("g").attr("class",`kg-node ${E.node}`).style("cursor","pointer").on("click",(v,k)=>{m.current(k.id)}).on("dblclick",(v,k)=>{f.current(k.id)});s.current=x,x.append("rect").attr("class",E.nodeCard).attr("width",O).attr("height",G).attr("rx",Y).attr("ry",Y).style("--node-color",v=>X(v)),x.append("rect").attr("class",E.nodeIndicator).attr("width",4).attr("height",G).attr("rx",2).attr("fill",v=>X(v)),x.append("text").attr("class",E.nodeLabel).attr("x",O/2).attr("y",G/2-4).attr("text-anchor","middle").attr("dominant-baseline","central").text(v=>v.label.length>26?v.label.substring(0,24)+"...":v.label),x.append("text").attr("class",E.nodeBadge).attr("x",O/2).attr("y",G-8).attr("text-anchor","middle").text(v=>(v.kind==="reference"?v.sourceType??"ref":v.category??"").toUpperCase());const b=Tt(i).force("link",Mt(g).id(v=>v.id).distance(140)).force("charge",St().strength(-400)).force("center",ot(d.width/2,d.height/2)).force("collide",zt(O/2+16)).on("tick",()=>{N.attr("x1",v=>v.source.x??0).attr("y1",v=>v.source.y??0).attr("x2",v=>v.target.x??0).attr("y2",v=>v.target.y??0),x.attr("transform",v=>`translate(${(v.x??0)-O/2},${(v.y??0)-G/2})`)});u.current=b;const M=setTimeout(()=>{if(o.current&&h.current){const v=h.current,k=H.translate(d.width/2,d.height/2).scale(.8).translate(-d.width/2,-d.height/2);D(o.current).transition().duration(500).call(v.transform,k)}},1200);return()=>{clearTimeout(M),b.stop()}},[t,d]),z.useEffect(()=>{if(!r.current||!s.current||!_.current)return;if(!e){s.current.classed(E.dimmed,!1).classed(E.selected,!1),_.current.classed(E.dimmedLink,!1);return}const a=new Set([e]);_.current.each(i=>{const c=i.source.id,g=i.target.id;(c===e||g===e)&&(a.add(c),a.add(g))}),s.current.classed(E.selected,i=>i.id===e).classed(E.dimmed,i=>!a.has(i.id)),_.current.classed(E.dimmedLink,i=>{const c=i.source.id,g=i.target.id;return!a.has(c)||!a.has(g)})},[e,t]);const p=z.useCallback(()=>{if(!e||!u.current||!o.current||!h.current)return;const a=u.current.nodes().find(i=>i.id===e);if(a&&Number.isFinite(a.x)&&Number.isFinite(a.y)){const i=h.current,c=H.translate(d.width/2,d.height/2).scale(1.2).translate(-(a.x??0),-(a.y??0));D(o.current).transition().duration(500).call(i.transform,c)}},[e,d]);return z.useEffect(()=>{p()},[p]),w.jsx("div",{className:E.graphContainer,"data-testid":"knowledge-graph",children:w.jsxs("svg",{ref:o,width:d.width,height:d.height,className:E.svg,children:[w.jsx("defs",{children:w.jsxs("filter",{id:"glow",children:[w.jsx("feGaussianBlur",{stdDeviation:"3",result:"coloredBlur"}),w.jsxs("feMerge",{children:[w.jsx("feMergeNode",{in:"coloredBlur"}),w.jsx("feMergeNode",{in:"SourceGraphic"})]})]})}),w.jsx("g",{ref:r})]})})}const Yt="_panel_1ml6r_1",Jt="_header_1ml6r_24",Zt="_title_1ml6r_32",qt="_closeButton_1ml6r_42",te="_body_1ml6r_55",ee="_badge_1ml6r_61",ne="_section_1ml6r_72",re="_sectionLabel_1ml6r_76",ie="_content_1ml6r_84",se="_tags_1ml6r_92",ae="_tag_1ml6r_92",oe="_viewLink_1ml6r_107",ce="_edgeList_1ml6r_121",le="_edgeItem_1ml6r_127",ue="_edgeType_1ml6r_136",fe="_edgeNodeLink_1ml6r_142",he="_timestamps_1ml6r_154",j={panel:Yt,header:Jt,title:Zt,closeButton:qt,body:te,badge:ee,section:ne,sectionLabel:re,content:ie,tags:se,tag:ae,viewLink:oe,edgeList:ce,edgeItem:le,edgeType:ue,edgeNodeLink:fe,timestamps:he};function de({detail:t,nodes:e,onClose:n,onSelectNode:l}){const o=Z(),{node:r,edges:u}=t,h=z.useMemo(()=>new Map(e.map(s=>[s.id,s])),[e]);function _(){if(!(r.kind!=="reference"||!r.sourceId))switch(r.sourceType){case"task":o(tt(r.sourceId));break;case"session":o(q(r.sourceId));break}}return w.jsxs("div",{className:j.panel,"data-testid":"knowledge-detail-panel",children:[w.jsxs("div",{className:j.header,children:[w.jsx("h3",{className:j.title,children:r.label}),w.jsx("button",{className:j.closeButton,onClick:n,"aria-label":"Close",children:"×"})]}),w.jsxs("div",{className:j.body,children:[w.jsx("div",{className:j.badge,children:r.kind==="reference"?`Reference (${r.sourceType})`:r.category}),r.content&&w.jsxs("div",{className:j.section,children:[w.jsx("div",{className:j.sectionLabel,children:"Content"}),w.jsx("p",{className:j.content,children:r.content})]}),r.tags&&r.tags.length>0&&w.jsxs("div",{className:j.section,children:[w.jsx("div",{className:j.sectionLabel,children:"Tags"}),w.jsx("div",{className:j.tags,children:r.tags.map(s=>w.jsx("span",{className:j.tag,children:s},s))})]}),r.kind==="reference"&&r.sourceId&&w.jsx("div",{className:j.section,children:w.jsx("button",{className:j.viewLink,onClick:_,children:"View in Grackle →"})}),u.length>0&&w.jsxs("div",{className:j.section,children:[w.jsxs("div",{className:j.sectionLabel,children:["Edges (",u.length,")"]}),w.jsx("ul",{className:j.edgeList,children:u.map(s=>{var m;const d=s.fromId===r.id?s.toId:s.fromId,y=`${s.fromId}:${s.toId}:${s.type}`;return w.jsxs("li",{className:j.edgeItem,"data-testid":"edge-item",children:[w.jsx("span",{className:j.edgeType,"data-testid":"edge-type",children:s.type}),w.jsx("button",{className:j.edgeNodeLink,"data-testid":"edge-node-link",onClick:()=>{l(d)},children:((m=h.get(d))==null?void 0:m.label)??`${d.substring(0,8)}...`})]},y)})})]}),w.jsxs("div",{className:j.timestamps,children:[r.createdAt&&w.jsxs("div",{children:["Created: ",new Date(r.createdAt).toLocaleDateString()]}),r.updatedAt&&w.jsxs("div",{children:["Updated: ",new Date(r.updatedAt).toLocaleDateString()]})]})]})]})}const ge="_layout_n9vg6_1",xe="_graphArea_n9vg6_8",_e="_empty_n9vg6_15",K={layout:ge,graphArea:xe,empty:_e};function we(){const{knowledge:t}=et(),e=z.useCallback(()=>{t.loadRecent()},[t.loadRecent]);z.useEffect(()=>{e()},[e]);const n=z.useCallback(u=>{t.selectNode(u)},[t]),l=z.useCallback(u=>{t.expandNode(u)},[t]),o=z.useCallback(()=>{t.clearSelection()},[t]),r=[{label:"Knowledge",url:rt}];return w.jsxs("div",{className:K.layout,"data-testid":"knowledge-page",children:[w.jsx(nt,{segments:r}),w.jsxs("div",{className:K.graphArea,children:[t.graphData.nodes.length===0&&!t.loading?w.jsxs("div",{className:K.empty,children:[w.jsx("p",{children:"No knowledge nodes found."}),w.jsx("p",{children:"Create knowledge via MCP tools or let agents discover it during tasks."})]}):w.jsx(Xt,{graphData:t.graphData,selectedNodeId:t.selectedId,onNodeClick:n,onNodeDoubleClick:l}),t.selectedNode&&t.selectedId&&w.jsx(de,{detail:t.selectedNode,nodes:t.graphData.nodes,onClose:o,onSelectNode:n})]})]})}export{we as KnowledgePage};
1
+ import{a as z,j as w}from"./markdown-gcy1Jmzi.js";import{u as Z,s as q,t as tt,a as et,B as nt,K as rt}from"./index-qSWpvSA-.js";import{t as it,b as st,z as at,s as D,c as H}from"./dagview-BA5TtMAQ.js";import"./grpc-DU5jMhZD.js";function ot(t,e){var n,l=1;t==null&&(t=0),e==null&&(e=0);function o(){var r,u=n.length,h,_=0,s=0;for(r=0;r<u;++r)h=n[r],_+=h.x,s+=h.y;for(_=(_/u-t)*l,s=(s/u-e)*l,r=0;r<u;++r)h=n[r],h.x-=_,h.y-=s}return o.initialize=function(r){n=r},o.x=function(r){return arguments.length?(t=+r,o):t},o.y=function(r){return arguments.length?(e=+r,o):e},o.strength=function(r){return arguments.length?(l=+r,o):l},o}function ct(t){const e=+this._x.call(null,t),n=+this._y.call(null,t);return J(this.cover(e,n),e,n,t)}function J(t,e,n,l){if(isNaN(e)||isNaN(n))return t;var o,r=t._root,u={data:l},h=t._x0,_=t._y0,s=t._x1,d=t._y1,y,m,f,p,a,i,c,g;if(!r)return t._root=u,t;for(;r.length;)if((a=e>=(y=(h+s)/2))?h=y:s=y,(i=n>=(m=(_+d)/2))?_=m:d=m,o=r,!(r=r[c=i<<1|a]))return o[c]=u,t;if(f=+t._x.call(null,r.data),p=+t._y.call(null,r.data),e===f&&n===p)return u.next=r,o?o[c]=u:t._root=u,t;do o=o?o[c]=new Array(4):t._root=new Array(4),(a=e>=(y=(h+s)/2))?h=y:s=y,(i=n>=(m=(_+d)/2))?_=m:d=m;while((c=i<<1|a)===(g=(p>=m)<<1|f>=y));return o[g]=r,o[c]=u,t}function lt(t){var e,n,l=t.length,o,r,u=new Array(l),h=new Array(l),_=1/0,s=1/0,d=-1/0,y=-1/0;for(n=0;n<l;++n)isNaN(o=+this._x.call(null,e=t[n]))||isNaN(r=+this._y.call(null,e))||(u[n]=o,h[n]=r,o<_&&(_=o),o>d&&(d=o),r<s&&(s=r),r>y&&(y=r));if(_>d||s>y)return this;for(this.cover(_,s).cover(d,y),n=0;n<l;++n)J(this,u[n],h[n],t[n]);return this}function ut(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var n=this._x0,l=this._y0,o=this._x1,r=this._y1;if(isNaN(n))o=(n=Math.floor(t))+1,r=(l=Math.floor(e))+1;else{for(var u=o-n||1,h=this._root,_,s;n>t||t>=o||l>e||e>=r;)switch(s=(e<l)<<1|t<n,_=new Array(4),_[s]=h,h=_,u*=2,s){case 0:o=n+u,r=l+u;break;case 1:n=o-u,r=l+u;break;case 2:o=n+u,l=r-u;break;case 3:n=o-u,l=r-u;break}this._root&&this._root.length&&(this._root=h)}return this._x0=n,this._y0=l,this._x1=o,this._y1=r,this}function ft(){var t=[];return this.visit(function(e){if(!e.length)do t.push(e.data);while(e=e.next)}),t}function ht(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function C(t,e,n,l,o){this.node=t,this.x0=e,this.y0=n,this.x1=l,this.y1=o}function dt(t,e,n){var l,o=this._x0,r=this._y0,u,h,_,s,d=this._x1,y=this._y1,m=[],f=this._root,p,a;for(f&&m.push(new C(f,o,r,d,y)),n==null?n=1/0:(o=t-n,r=e-n,d=t+n,y=e+n,n*=n);p=m.pop();)if(!(!(f=p.node)||(u=p.x0)>d||(h=p.y0)>y||(_=p.x1)<o||(s=p.y1)<r))if(f.length){var i=(u+_)/2,c=(h+s)/2;m.push(new C(f[3],i,c,_,s),new C(f[2],u,c,i,s),new C(f[1],i,h,_,c),new C(f[0],u,h,i,c)),(a=(e>=c)<<1|t>=i)&&(p=m[m.length-1],m[m.length-1]=m[m.length-1-a],m[m.length-1-a]=p)}else{var g=t-+this._x.call(null,f.data),N=e-+this._y.call(null,f.data),x=g*g+N*N;if(x<n){var b=Math.sqrt(n=x);o=t-b,r=e-b,d=t+b,y=e+b,l=f.data}}return l}function gt(t){if(isNaN(d=+this._x.call(null,t))||isNaN(y=+this._y.call(null,t)))return this;var e,n=this._root,l,o,r,u=this._x0,h=this._y0,_=this._x1,s=this._y1,d,y,m,f,p,a,i,c;if(!n)return this;if(n.length)for(;;){if((p=d>=(m=(u+_)/2))?u=m:_=m,(a=y>=(f=(h+s)/2))?h=f:s=f,e=n,!(n=n[i=a<<1|p]))return this;if(!n.length)break;(e[i+1&3]||e[i+2&3]||e[i+3&3])&&(l=e,c=i)}for(;n.data!==t;)if(o=n,!(n=n.next))return this;return(r=n.next)&&delete n.next,o?(r?o.next=r:delete o.next,this):e?(r?e[i]=r:delete e[i],(n=e[0]||e[1]||e[2]||e[3])&&n===(e[3]||e[2]||e[1]||e[0])&&!n.length&&(l?l[c]=n:this._root=n),this):(this._root=r,this)}function xt(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this}function _t(){return this._root}function mt(){var t=0;return this.visit(function(e){if(!e.length)do++t;while(e=e.next)}),t}function vt(t){var e=[],n,l=this._root,o,r,u,h,_;for(l&&e.push(new C(l,this._x0,this._y0,this._x1,this._y1));n=e.pop();)if(!t(l=n.node,r=n.x0,u=n.y0,h=n.x1,_=n.y1)&&l.length){var s=(r+h)/2,d=(u+_)/2;(o=l[3])&&e.push(new C(o,s,d,h,_)),(o=l[2])&&e.push(new C(o,r,d,s,_)),(o=l[1])&&e.push(new C(o,s,u,h,d)),(o=l[0])&&e.push(new C(o,r,u,s,d))}return this}function pt(t){var e=[],n=[],l;for(this._root&&e.push(new C(this._root,this._x0,this._y0,this._x1,this._y1));l=e.pop();){var o=l.node;if(o.length){var r,u=l.x0,h=l.y0,_=l.x1,s=l.y1,d=(u+_)/2,y=(h+s)/2;(r=o[0])&&e.push(new C(r,u,h,d,y)),(r=o[1])&&e.push(new C(r,d,h,_,y)),(r=o[2])&&e.push(new C(r,u,y,d,s)),(r=o[3])&&e.push(new C(r,d,y,_,s))}n.push(l)}for(;l=n.pop();)t(l.node,l.x0,l.y0,l.x1,l.y1);return this}function yt(t){return t[0]}function wt(t){return arguments.length?(this._x=t,this):this._x}function Nt(t){return t[1]}function bt(t){return arguments.length?(this._y=t,this):this._y}function U(t,e,n){var l=new P(e??yt,n??Nt,NaN,NaN,NaN,NaN);return t==null?l:l.addAll(t)}function P(t,e,n,l,o,r){this._x=t,this._y=e,this._x0=n,this._y0=l,this._x1=o,this._y1=r,this._root=void 0}function W(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var L=U.prototype=P.prototype;L.copy=function(){var t=new P(this._x,this._y,this._x0,this._y0,this._x1,this._y1),e=this._root,n,l;if(!e)return t;if(!e.length)return t._root=W(e),t;for(n=[{source:e,target:t._root=new Array(4)}];e=n.pop();)for(var o=0;o<4;++o)(l=e.source[o])&&(l.length?n.push({source:l,target:e.target[o]=new Array(4)}):e.target[o]=W(l));return t};L.add=ct;L.addAll=lt;L.cover=ut;L.data=ft;L.extent=ht;L.find=dt;L.remove=gt;L.removeAll=xt;L.root=_t;L.size=mt;L.visit=vt;L.visitAfter=pt;L.x=wt;L.y=bt;function $(t){return function(){return t}}function S(t){return(t()-.5)*1e-6}function kt(t){return t.x+t.vx}function jt(t){return t.y+t.vy}function zt(t){var e,n,l,o=1,r=1;typeof t!="function"&&(t=$(t==null?1:+t));function u(){for(var s,d=e.length,y,m,f,p,a,i,c=0;c<r;++c)for(y=U(e,kt,jt).visitAfter(h),s=0;s<d;++s)m=e[s],a=n[m.index],i=a*a,f=m.x+m.vx,p=m.y+m.vy,y.visit(g);function g(N,x,b,M,v){var k=N.data,I=N.r,A=a+I;if(k){if(k.index>m.index){var B=f-k.x-k.vx,T=p-k.y-k.vy,R=B*B+T*T;R<A*A&&(B===0&&(B=S(l),R+=B*B),T===0&&(T=S(l),R+=T*T),R=(A-(R=Math.sqrt(R)))/R*o,m.vx+=(B*=R)*(A=(I*=I)/(i+I)),m.vy+=(T*=R)*A,k.vx-=B*(A=1-A),k.vy-=T*A)}return}return x>f+A||M<f-A||b>p+A||v<p-A}}function h(s){if(s.data)return s.r=n[s.data.index];for(var d=s.r=0;d<4;++d)s[d]&&s[d].r>s.r&&(s.r=s[d].r)}function _(){if(e){var s,d=e.length,y;for(n=new Array(d),s=0;s<d;++s)y=e[s],n[y.index]=+t(y,s,e)}}return u.initialize=function(s,d){e=s,l=d,_()},u.iterations=function(s){return arguments.length?(r=+s,u):r},u.strength=function(s){return arguments.length?(o=+s,u):o},u.radius=function(s){return arguments.length?(t=typeof s=="function"?s:$(+s),_(),u):t},u}function At(t){return t.index}function Q(t,e){var n=t.get(e);if(!n)throw new Error("node not found: "+e);return n}function Mt(t){var e=At,n=y,l,o=$(30),r,u,h,_,s,d=1;t==null&&(t=[]);function y(i){return 1/Math.min(h[i.source.index],h[i.target.index])}function m(i){for(var c=0,g=t.length;c<d;++c)for(var N=0,x,b,M,v,k,I,A;N<g;++N)x=t[N],b=x.source,M=x.target,v=M.x+M.vx-b.x-b.vx||S(s),k=M.y+M.vy-b.y-b.vy||S(s),I=Math.sqrt(v*v+k*k),I=(I-r[N])/I*i*l[N],v*=I,k*=I,M.vx-=v*(A=_[N]),M.vy-=k*A,b.vx+=v*(A=1-A),b.vy+=k*A}function f(){if(u){var i,c=u.length,g=t.length,N=new Map(u.map((b,M)=>[e(b,M,u),b])),x;for(i=0,h=new Array(c);i<g;++i)x=t[i],x.index=i,typeof x.source!="object"&&(x.source=Q(N,x.source)),typeof x.target!="object"&&(x.target=Q(N,x.target)),h[x.source.index]=(h[x.source.index]||0)+1,h[x.target.index]=(h[x.target.index]||0)+1;for(i=0,_=new Array(g);i<g;++i)x=t[i],_[i]=h[x.source.index]/(h[x.source.index]+h[x.target.index]);l=new Array(g),p(),r=new Array(g),a()}}function p(){if(u)for(var i=0,c=t.length;i<c;++i)l[i]=+n(t[i],i,t)}function a(){if(u)for(var i=0,c=t.length;i<c;++i)r[i]=+o(t[i],i,t)}return m.initialize=function(i,c){u=i,s=c,f()},m.links=function(i){return arguments.length?(t=i,f(),m):t},m.id=function(i){return arguments.length?(e=i,m):e},m.iterations=function(i){return arguments.length?(d=+i,m):d},m.strength=function(i){return arguments.length?(n=typeof i=="function"?i:$(+i),p(),m):n},m.distance=function(i){return arguments.length?(o=typeof i=="function"?i:$(+i),a(),m):o},m}const Ct=1664525,Lt=1013904223,V=4294967296;function Et(){let t=1;return()=>(t=(Ct*t+Lt)%V)/V}function It(t){return t.x}function Rt(t){return t.y}var Dt=10,Bt=Math.PI*(3-Math.sqrt(5));function Tt(t){var e,n=1,l=.001,o=1-Math.pow(l,1/300),r=0,u=.6,h=new Map,_=it(y),s=st("tick","end"),d=Et();t==null&&(t=[]);function y(){m(),s.call("tick",e),n<l&&(_.stop(),s.call("end",e))}function m(a){var i,c=t.length,g;a===void 0&&(a=1);for(var N=0;N<a;++N)for(n+=(r-n)*o,h.forEach(function(x){x(n)}),i=0;i<c;++i)g=t[i],g.fx==null?g.x+=g.vx*=u:(g.x=g.fx,g.vx=0),g.fy==null?g.y+=g.vy*=u:(g.y=g.fy,g.vy=0);return e}function f(){for(var a=0,i=t.length,c;a<i;++a){if(c=t[a],c.index=a,c.fx!=null&&(c.x=c.fx),c.fy!=null&&(c.y=c.fy),isNaN(c.x)||isNaN(c.y)){var g=Dt*Math.sqrt(.5+a),N=a*Bt;c.x=g*Math.cos(N),c.y=g*Math.sin(N)}(isNaN(c.vx)||isNaN(c.vy))&&(c.vx=c.vy=0)}}function p(a){return a.initialize&&a.initialize(t,d),a}return f(),e={tick:m,restart:function(){return _.restart(y),e},stop:function(){return _.stop(),e},nodes:function(a){return arguments.length?(t=a,f(),h.forEach(p),e):t},alpha:function(a){return arguments.length?(n=+a,e):n},alphaMin:function(a){return arguments.length?(l=+a,e):l},alphaDecay:function(a){return arguments.length?(o=+a,e):+o},alphaTarget:function(a){return arguments.length?(r=+a,e):r},velocityDecay:function(a){return arguments.length?(u=1-a,e):1-u},randomSource:function(a){return arguments.length?(d=a,h.forEach(p),e):d},force:function(a,i){return arguments.length>1?(i==null?h.delete(a):h.set(a,p(i)),e):h.get(a)},find:function(a,i,c){var g=0,N=t.length,x,b,M,v,k;for(c==null?c=1/0:c*=c,g=0;g<N;++g)v=t[g],x=a-v.x,b=i-v.y,M=x*x+b*b,M<c&&(k=v,c=M);return k},on:function(a,i){return arguments.length>1?(s.on(a,i),e):s.on(a)}}}function St(){var t,e,n,l,o=$(-30),r,u=1,h=1/0,_=.81;function s(f){var p,a=t.length,i=U(t,It,Rt).visitAfter(y);for(l=f,p=0;p<a;++p)e=t[p],i.visit(m)}function d(){if(t){var f,p=t.length,a;for(r=new Array(p),f=0;f<p;++f)a=t[f],r[a.index]=+o(a,f,t)}}function y(f){var p=0,a,i,c=0,g,N,x;if(f.length){for(g=N=x=0;x<4;++x)(a=f[x])&&(i=Math.abs(a.value))&&(p+=a.value,c+=i,g+=i*a.x,N+=i*a.y);f.x=g/c,f.y=N/c}else{a=f,a.x=a.data.x,a.y=a.data.y;do p+=r[a.data.index];while(a=a.next)}f.value=p}function m(f,p,a,i){if(!f.value)return!0;var c=f.x-e.x,g=f.y-e.y,N=i-p,x=c*c+g*g;if(N*N/_<x)return x<h&&(c===0&&(c=S(n),x+=c*c),g===0&&(g=S(n),x+=g*g),x<u&&(x=Math.sqrt(u*x)),e.vx+=c*f.value*l/x,e.vy+=g*f.value*l/x),!0;if(f.length||x>=h)return;(f.data!==e||f.next)&&(c===0&&(c=S(n),x+=c*c),g===0&&(g=S(n),x+=g*g),x<u&&(x=Math.sqrt(u*x)));do f.data!==e&&(N=r[f.data.index]*l/x,e.vx+=c*N,e.vy+=g*N);while(f=f.next)}return s.initialize=function(f,p){t=f,n=p,d()},s.strength=function(f){return arguments.length?(o=typeof f=="function"?f:$(+f),d(),s):o},s.distanceMin=function(f){return arguments.length?(u=f*f,s):Math.sqrt(u)},s.distanceMax=function(f){return arguments.length?(h=f*f,s):Math.sqrt(h)},s.theta=function(f){return arguments.length?(_=f*f,s):Math.sqrt(_)},s}const $t="_graphContainer_zxmzw_1",Ot="_svg_zxmzw_10",Gt="_link_zxmzw_18",Ft="_node_zxmzw_30",Kt="_nodeCard_zxmzw_34",Ut="_nodeLabel_zxmzw_40",Pt="_selected_zxmzw_44",Ht="_dimmed_zxmzw_51",Wt="_dimmedLink_zxmzw_56",Qt="_nodeIndicator_zxmzw_68",Vt="_nodeBadge_zxmzw_82",E={graphContainer:$t,svg:Ot,link:Gt,node:Ft,nodeCard:Kt,nodeLabel:Ut,selected:Pt,dimmed:Ht,dimmedLink:Wt,nodeIndicator:Qt,nodeBadge:Vt},F={reference:"#4A9EFF",decision:"#22C55E",insight:"#EAB308",concept:"#A855F7",snippet:"#6B7280"};function X(t){return t.kind==="reference"?F.reference:F[t.category??"insight"]??F.insight}const O=200,G=52,Y=12;function Xt({graphData:t,selectedNodeId:e,onNodeClick:n,onNodeDoubleClick:l}){const o=z.useRef(null),r=z.useRef(null),u=z.useRef(void 0),h=z.useRef(void 0),_=z.useRef(void 0),s=z.useRef(void 0),[d,y]=z.useState({width:800,height:600});z.useEffect(()=>{var c;const a=((c=o.current)==null?void 0:c.parentElement)??null;if(!a)return;const i=new ResizeObserver(g=>{for(const N of g)y({width:N.contentRect.width,height:N.contentRect.height})});return i.observe(a),y({width:a.clientWidth,height:a.clientHeight}),()=>{i.disconnect()}},[]),z.useEffect(()=>{if(!o.current||!r.current)return;const a=o.current,i=r.current,c=at().scaleExtent([.1,4]).filter(g=>g.type!=="dblclick").on("zoom",g=>{D(i).attr("transform",String(g.transform))});return D(a).call(c),h.current=c,()=>{D(a).on(".zoom",null)}},[]);const m=z.useRef(n);m.current=n;const f=z.useRef(l);f.current=l,z.useEffect(()=>{if(!r.current)return;const a=r.current;if(u.current&&(u.current.stop(),u.current=void 0),t.nodes.length===0){D(a).selectAll("*").remove();return}const i=t.nodes.map(v=>({...v})),c=new Map(i.map(v=>[v.id,v])),g=t.links.filter(v=>c.has(v.source)&&c.has(v.target)).map(v=>({source:v.source,target:v.target,type:v.type}));D(a).selectAll("*").remove();const N=D(a).selectAll("line").data(g).enter().append("line").attr("class",E.link);N.append("title").text(v=>v.type),_.current=N;const x=D(a).selectAll("g.kg-node").data(i).enter().append("g").attr("class",`kg-node ${E.node}`).style("cursor","pointer").on("click",(v,k)=>{m.current(k.id)}).on("dblclick",(v,k)=>{f.current(k.id)});s.current=x,x.append("rect").attr("class",E.nodeCard).attr("width",O).attr("height",G).attr("rx",Y).attr("ry",Y).style("--node-color",v=>X(v)),x.append("rect").attr("class",E.nodeIndicator).attr("width",4).attr("height",G).attr("rx",2).attr("fill",v=>X(v)),x.append("text").attr("class",E.nodeLabel).attr("x",O/2).attr("y",G/2-4).attr("text-anchor","middle").attr("dominant-baseline","central").text(v=>v.label.length>26?v.label.substring(0,24)+"...":v.label),x.append("text").attr("class",E.nodeBadge).attr("x",O/2).attr("y",G-8).attr("text-anchor","middle").text(v=>(v.kind==="reference"?v.sourceType??"ref":v.category??"").toUpperCase());const b=Tt(i).force("link",Mt(g).id(v=>v.id).distance(140)).force("charge",St().strength(-400)).force("center",ot(d.width/2,d.height/2)).force("collide",zt(O/2+16)).on("tick",()=>{N.attr("x1",v=>v.source.x??0).attr("y1",v=>v.source.y??0).attr("x2",v=>v.target.x??0).attr("y2",v=>v.target.y??0),x.attr("transform",v=>`translate(${(v.x??0)-O/2},${(v.y??0)-G/2})`)});u.current=b;const M=setTimeout(()=>{if(o.current&&h.current){const v=h.current,k=H.translate(d.width/2,d.height/2).scale(.8).translate(-d.width/2,-d.height/2);D(o.current).transition().duration(500).call(v.transform,k)}},1200);return()=>{clearTimeout(M),b.stop()}},[t,d]),z.useEffect(()=>{if(!r.current||!s.current||!_.current)return;if(!e){s.current.classed(E.dimmed,!1).classed(E.selected,!1),_.current.classed(E.dimmedLink,!1);return}const a=new Set([e]);_.current.each(i=>{const c=i.source.id,g=i.target.id;(c===e||g===e)&&(a.add(c),a.add(g))}),s.current.classed(E.selected,i=>i.id===e).classed(E.dimmed,i=>!a.has(i.id)),_.current.classed(E.dimmedLink,i=>{const c=i.source.id,g=i.target.id;return!a.has(c)||!a.has(g)})},[e,t]);const p=z.useCallback(()=>{if(!e||!u.current||!o.current||!h.current)return;const a=u.current.nodes().find(i=>i.id===e);if(a&&Number.isFinite(a.x)&&Number.isFinite(a.y)){const i=h.current,c=H.translate(d.width/2,d.height/2).scale(1.2).translate(-(a.x??0),-(a.y??0));D(o.current).transition().duration(500).call(i.transform,c)}},[e,d]);return z.useEffect(()=>{p()},[p]),w.jsx("div",{className:E.graphContainer,"data-testid":"knowledge-graph",children:w.jsxs("svg",{ref:o,width:d.width,height:d.height,className:E.svg,children:[w.jsx("defs",{children:w.jsxs("filter",{id:"glow",children:[w.jsx("feGaussianBlur",{stdDeviation:"3",result:"coloredBlur"}),w.jsxs("feMerge",{children:[w.jsx("feMergeNode",{in:"coloredBlur"}),w.jsx("feMergeNode",{in:"SourceGraphic"})]})]})}),w.jsx("g",{ref:r})]})})}const Yt="_panel_1ml6r_1",Jt="_header_1ml6r_24",Zt="_title_1ml6r_32",qt="_closeButton_1ml6r_42",te="_body_1ml6r_55",ee="_badge_1ml6r_61",ne="_section_1ml6r_72",re="_sectionLabel_1ml6r_76",ie="_content_1ml6r_84",se="_tags_1ml6r_92",ae="_tag_1ml6r_92",oe="_viewLink_1ml6r_107",ce="_edgeList_1ml6r_121",le="_edgeItem_1ml6r_127",ue="_edgeType_1ml6r_136",fe="_edgeNodeLink_1ml6r_142",he="_timestamps_1ml6r_154",j={panel:Yt,header:Jt,title:Zt,closeButton:qt,body:te,badge:ee,section:ne,sectionLabel:re,content:ie,tags:se,tag:ae,viewLink:oe,edgeList:ce,edgeItem:le,edgeType:ue,edgeNodeLink:fe,timestamps:he};function de({detail:t,nodes:e,onClose:n,onSelectNode:l}){const o=Z(),{node:r,edges:u}=t,h=z.useMemo(()=>new Map(e.map(s=>[s.id,s])),[e]);function _(){if(!(r.kind!=="reference"||!r.sourceId))switch(r.sourceType){case"task":o(tt(r.sourceId));break;case"session":o(q(r.sourceId));break}}return w.jsxs("div",{className:j.panel,"data-testid":"knowledge-detail-panel",children:[w.jsxs("div",{className:j.header,children:[w.jsx("h3",{className:j.title,children:r.label}),w.jsx("button",{className:j.closeButton,onClick:n,"aria-label":"Close",children:"×"})]}),w.jsxs("div",{className:j.body,children:[w.jsx("div",{className:j.badge,children:r.kind==="reference"?`Reference (${r.sourceType})`:r.category}),r.content&&w.jsxs("div",{className:j.section,children:[w.jsx("div",{className:j.sectionLabel,children:"Content"}),w.jsx("p",{className:j.content,children:r.content})]}),r.tags&&r.tags.length>0&&w.jsxs("div",{className:j.section,children:[w.jsx("div",{className:j.sectionLabel,children:"Tags"}),w.jsx("div",{className:j.tags,children:r.tags.map(s=>w.jsx("span",{className:j.tag,children:s},s))})]}),r.kind==="reference"&&r.sourceId&&w.jsx("div",{className:j.section,children:w.jsx("button",{className:j.viewLink,onClick:_,children:"View in Grackle →"})}),u.length>0&&w.jsxs("div",{className:j.section,children:[w.jsxs("div",{className:j.sectionLabel,children:["Edges (",u.length,")"]}),w.jsx("ul",{className:j.edgeList,children:u.map(s=>{var m;const d=s.fromId===r.id?s.toId:s.fromId,y=`${s.fromId}:${s.toId}:${s.type}`;return w.jsxs("li",{className:j.edgeItem,"data-testid":"edge-item",children:[w.jsx("span",{className:j.edgeType,"data-testid":"edge-type",children:s.type}),w.jsx("button",{className:j.edgeNodeLink,"data-testid":"edge-node-link",onClick:()=>{l(d)},children:((m=h.get(d))==null?void 0:m.label)??`${d.substring(0,8)}...`})]},y)})})]}),w.jsxs("div",{className:j.timestamps,children:[r.createdAt&&w.jsxs("div",{children:["Created: ",new Date(r.createdAt).toLocaleDateString()]}),r.updatedAt&&w.jsxs("div",{children:["Updated: ",new Date(r.updatedAt).toLocaleDateString()]})]})]})]})}const ge="_layout_n9vg6_1",xe="_graphArea_n9vg6_8",_e="_empty_n9vg6_15",K={layout:ge,graphArea:xe,empty:_e};function we(){const{knowledge:t}=et(),e=z.useCallback(()=>{t.loadRecent()},[t.loadRecent]);z.useEffect(()=>{e()},[e]);const n=z.useCallback(u=>{t.selectNode(u)},[t]),l=z.useCallback(u=>{t.expandNode(u)},[t]),o=z.useCallback(()=>{t.clearSelection()},[t]),r=[{label:"Knowledge",url:rt}];return w.jsxs("div",{className:K.layout,"data-testid":"knowledge-page",children:[w.jsx(nt,{segments:r}),w.jsxs("div",{className:K.graphArea,children:[t.graphData.nodes.length===0&&!t.loading?w.jsxs("div",{className:K.empty,children:[w.jsx("p",{children:"No knowledge nodes found."}),w.jsx("p",{children:"Create knowledge via MCP tools or let agents discover it during tasks."})]}):w.jsx(Xt,{graphData:t.graphData,selectedNodeId:t.selectedId,onNodeClick:n,onNodeDoubleClick:l}),t.selectedNode&&t.selectedId&&w.jsx(de,{detail:t.selectedNode,nodes:t.graphData.nodes,onClose:o,onSelectNode:n})]})]})}export{we as KnowledgePage};
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/KnowledgePage-4d_6DFDB.js","assets/markdown-gcy1Jmzi.js","assets/dagview-BA5TtMAQ.js","assets/grpc-DU5jMhZD.js","assets/KnowledgePage-DMqJ4jlP.css"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/KnowledgePage-C39vVNnH.js","assets/markdown-gcy1Jmzi.js","assets/dagview-BA5TtMAQ.js","assets/grpc-DU5jMhZD.js","assets/KnowledgePage-DMqJ4jlP.css"])))=>i.map(i=>d[i]);
2
2
  import{r as YS,a as y,j as l,v as JS,b as WS,t as Jl,i as XS,f as QS,M as up,c as dp}from"./markdown-gcy1Jmzi.js";import{r as eT,d as Qv,H as e0,P as t0,i as tT,B as nT,a as sT,C as aT,M as iT}from"./dagview-BA5TtMAQ.js";import{c as oT,a as rT,G as lT,C as Ec,b as cT,e as ob,w as uT,t as dT,p as Wl,d as fT,f as pT,M as mT,R as nr,A as rb,D as lb,W as hT,O as gT,g as vT,S as n0}from"./grpc-DU5jMhZD.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))o(c);new MutationObserver(c=>{for(const u of c)if(u.type==="childList")for(const d of u.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&o(d)}).observe(document,{childList:!0,subtree:!0});function i(c){const u={};return c.integrity&&(u.integrity=c.integrity),c.referrerPolicy&&(u.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?u.credentials="include":c.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function o(c){if(c.ep)return;c.ep=!0;const u=i(c);fetch(c.href,u)}})();var Xd={exports:{}},sr={},Qd={exports:{}},ef={};/**
3
3
  * @license React
4
4
  * scheduler.production.js
@@ -500,4 +500,4 @@ const grackle = await host.mcpServer({
500
500
  url: env.vars.GRACKLE_MCP_URL,
501
501
  });
502
502
 
503
- $\`Summarize the current tasks.\`;`,ariaLabel:"Persona script","data-testid":"persona-script-editor"})]}),E==="agent"&&l.jsxs("div",{children:[l.jsx("label",{children:"Allowed MCP Tools"}),l.jsx(eb,{selectedTools:F,onChange:I=>{Q(I);const Ne=I.length===0?["__clear__"]:I;me(()=>c(n.id,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,Ne),()=>{},"MCP tools updated","Failed to update MCP tools").catch(()=>{})}})]})]}),!Se&&!we&&l.jsx("p",{style:{fontSize:"var(--font-size-xs)",color:"var(--text-tertiary)",marginTop:"var(--space-xs)"},children:"Only agent personas with a runtime and model can be set as app default."})]}):null,l.jsx(Ja,{isOpen:ae,title:"Delete Persona?",description:`"${n==null?void 0:n.name}" will be permanently removed.`,confirmLabel:"Delete",onConfirm:fe,onCancel:()=>pe(!1)})]})}function lU({themeId:n,resolvedThemeId:s,onSetTheme:i,preferSystem:o,onSetPreferSystem:c}){return l.jsxs("section",{className:he.section,children:[l.jsx("h3",{className:he.sectionTitle,children:"Appearance"}),l.jsx("p",{className:he.sectionDescription,children:"Choose how Grackle looks across the app."}),l.jsx("div",{className:he.themeOptions,children:Oc.filter(u=>!u.hidden).map(u=>{const d=!!(u.variantLightId&&u.variantDarkId),m=d?n===u.id||n===u.variantLightId||n===u.variantDarkId:n===u.id,h=d&&s===u.variantLightId;return l.jsxs("button",{type:"button",className:`${he.themeOption} ${m?he.themeOptionSelected:""}`,"aria-pressed":m,onClick:()=>i(u.id),children:[l.jsxs("span",{className:he.themeOptionHeader,children:[l.jsxs("span",{children:[l.jsx("span",{className:he.themeOptionLabel,children:u.label}),l.jsx("span",{className:he.themeOptionDesc,children:u.description})]}),d&&l.jsxs("span",{className:he.variantToggle,children:[l.jsx("span",{role:"button",tabIndex:0,className:`${he.variantButton} ${m&&h?he.variantActive:""}`,onClick:g=>{g.stopPropagation(),c(!1),i(u.variantLightId)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),c(!1),i(u.variantLightId))},"aria-label":"Light variant","aria-pressed":m&&h,children:"☼"}),l.jsx("span",{role:"button",tabIndex:0,className:`${he.variantButton} ${m&&!h?he.variantActive:""}`,onClick:g=>{g.stopPropagation(),c(!1),i(u.variantDarkId)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),c(!1),i(u.variantDarkId))},"aria-label":"Dark variant","aria-pressed":m&&!h,children:"☾"})]})]}),u.swatches&&l.jsx("span",{className:he.themeSwatches,children:u.swatches.map((g,v)=>l.jsx("span",{className:he.themeSwatch,style:{background:g}},v))})]},u.id)})}),l.jsxs("label",{className:he.systemToggle,children:[l.jsx("input",{type:"checkbox",checked:o,onChange:u=>c(u.target.checked)}),l.jsx("span",{children:"Match system light/dark preference"})]}),l.jsx("p",{className:he.systemToggleHint,children:"Automatically switches between light and dark variants when available."}),l.jsxs("p",{className:he.themeActive,children:["Active theme: ",l.jsx("strong",{children:s})]})]})}function cU(){const{themeId:n,resolvedThemeId:s,setTheme:i,preferSystem:o,setPreferSystem:c}=Hb();return l.jsx(lU,{themeId:n,resolvedThemeId:s,onSetTheme:i,preferSystem:o,onSetPreferSystem:c})}function uU({connected:n,environments:s,sessions:i}){const o=s.filter(d=>d.status==="connected").length,c=s.length,u=i.filter(d=>["running","idle"].includes(d.status)).length;return l.jsxs("section",{className:he.section,"data-testid":"about-panel",children:[l.jsx("h3",{className:he.sectionTitle,children:"About"}),l.jsx("p",{className:he.sectionDescription,children:"Connection status and application information."}),l.jsxs("div",{className:he.aboutGrid,children:[l.jsxs("div",{className:he.aboutItem,children:[l.jsx("span",{className:he.aboutLabel,children:"Connection"}),l.jsxs("span",{className:he.aboutValue,children:[l.jsx("span",{className:`${he.aboutDot} ${n?he.aboutDotConnected:he.aboutDotDisconnected}`}),n?"Connected":"Disconnected"]})]}),l.jsxs("div",{className:he.aboutItem,children:[l.jsx("span",{className:he.aboutLabel,children:"Environments"}),l.jsxs("span",{className:he.aboutValue,children:[o,"/",c," connected"]})]}),l.jsxs("div",{className:he.aboutItem,children:[l.jsx("span",{className:he.aboutLabel,children:"Active Sessions"}),l.jsx("span",{className:he.aboutValue,children:u})]}),l.jsxs("div",{className:he.aboutItem,children:[l.jsx("span",{className:he.aboutLabel,children:"Version"}),l.jsx("span",{className:he.aboutValue,children:"0.85.0"})]})]})]})}function dU({currentVersion:n,latestVersion:s,updateAvailable:i,isDocker:o}){if(!i)return l.jsx(l.Fragment,{});const c=o?"docker pull ghcr.io/nick-pape/grackle:latest && docker restart grackle":`npm install -g @grackle-ai/cli@${s}`;return l.jsx("div",{"data-testid":"update-banner",children:l.jsxs(ZD,{variant:"info",dismissible:!0,children:[l.jsxs("strong",{children:["Grackle v",s]})," is available (you have v",n,")."," ","Run: ",l.jsx("code",{children:c})]})})}function fU(){const[n,s]=y.useState(void 0);return y.useEffect(()=>{let i=!1;return ke.getVersionStatus({}).then(o=>{i||s({currentVersion:o.currentVersion,latestVersion:o.latestVersion,updateAvailable:o.updateAvailable,isDocker:o.isDocker})},()=>{}),()=>{i=!0}},[]),n}function pU(){const{connected:n,environments:s,sessions:i}=pt(),o=fU();return l.jsxs(l.Fragment,{children:[o&&l.jsx(dU,{currentVersion:o.currentVersion,latestVersion:o.latestVersion,updateAvailable:o.updateAvailable,isDocker:o.isDocker}),l.jsx(uU,{connected:n,environments:s,sessions:i})]})}const mU="_group_1iprv_1",hU="_groupTitle_1iprv_8",gU="_shortcutList_1iprv_17",vU="_shortcutRow_1iprv_23",yU="_keys_1iprv_36",bU="_kbd_1iprv_43",_U="_description_1iprv_60",qa={group:mU,groupTitle:hU,shortcutList:gU,shortcutRow:vU,keys:yU,kbd:bU,description:_U},xU=[{title:"Global",shortcuts:[{keys:["?"],description:"Open keyboard shortcuts reference"},{keys:["N"],description:"Create a new task"},{keys:["Escape"],description:"Close dialog or cancel editing"}]},{title:"Task Page",shortcuts:[{keys:["1"],description:"Switch to Overview tab"},{keys:["2"],description:"Switch to Stream tab"},{keys:["3"],description:"Switch to Findings tab"}]},{title:"Workspace Page",shortcuts:[{keys:["1"],description:"Switch to Graph view"},{keys:["2"],description:"Switch to Board view"},{keys:["3"],description:"Switch to Tasks view"}]},{title:"Navigation Lists",shortcuts:[{keys:["←"],description:"Previous tab (horizontal nav)"},{keys:["→"],description:"Next tab (horizontal nav)"},{keys:["↑"],description:"Previous item (vertical nav)"},{keys:["↓"],description:"Next item (vertical nav)"},{keys:["J"],description:"Next item (alias for arrow down/right)"},{keys:["K"],description:"Previous item (alias for arrow up/left)"},{keys:["Home"],description:"Jump to first item"},{keys:["End"],description:"Jump to last item"}]},{title:"Editing",shortcuts:[{keys:["Enter"],description:"Activate / save inline edit"},{keys:["Space"],description:"Activate button or start editing"},{keys:["Escape"],description:"Cancel edit and discard changes"}]},{title:"Chat",shortcuts:[{keys:["Enter"],description:"Send message (when input is focused)"}]}];function SU(){return l.jsxs("section",{className:he.section,"data-testid":"keyboard-shortcuts-panel",children:[l.jsx("h3",{className:he.sectionTitle,children:"Keyboard Shortcuts"}),l.jsx("p",{className:he.sectionDescription,children:"Keyboard shortcuts for navigating and interacting with Grackle. Global shortcuts are suppressed while typing in text fields."}),xU.map(n=>l.jsxs("div",{className:qa.group,children:[l.jsx("h4",{className:qa.groupTitle,children:n.title}),l.jsx("div",{className:qa.shortcutList,children:n.shortcuts.map(s=>l.jsxs("div",{className:qa.shortcutRow,children:[l.jsx("span",{className:qa.keys,children:s.keys.map(i=>l.jsx("kbd",{className:qa.kbd,children:i},i))}),l.jsx("span",{className:qa.description,children:s.description})]},s.description))})]},n.title))]})}function TU(){return l.jsx(SU,{})}const ab=ei();function kU(){const n=St();return Ms({key:"?"},()=>{n(u2)}),Ms({key:"n"},()=>{n(ab)}),Ms({key:"N"},()=>{n(ab)}),l.jsx(l.Fragment,{})}const wU="_wizard_1260s_1",NU="_container_1260s_10",jU="_stepContent_1260s_19",CU="_logoArea_1260s_28",EU="_logoImage_1260s_32",AU="_heading_1260s_41",DU="_tagline_1260s_49",RU="_subtitle_1260s_56",MU="_featureList_1260s_64",OU="_runtimeGrid_1260s_89",IU="_runtimeCard_1260s_101",BU="_runtimeName_1260s_133",LU="_runtimeDescription_1260s_139",UU="_buttonRow_1260s_144",zU="_primaryButton_1260s_151",PU="_ghostButton_1260s_185",VU="_dots_1260s_213",HU="_dot_1260s_213",rt={wizard:wU,container:NU,stepContent:jU,logoArea:CU,logoImage:EU,heading:AU,tagline:DU,subtitle:RU,featureList:MU,runtimeGrid:OU,runtimeCard:IU,runtimeName:BU,runtimeDescription:LU,buttonRow:UU,primaryButton:zU,ghostButton:PU,dots:VU,dot:HU};function qU({onNext:n}){return l.jsxs("div",{className:rt.stepContent,"data-testid":"setup-welcome",children:[l.jsx("div",{className:rt.logoArea,children:l.jsx("img",{src:"/grackle-logo.png",alt:"Grackle",className:rt.logoImage})}),l.jsx("h1",{className:rt.heading,children:"Welcome to Grackle"}),l.jsx("p",{className:rt.tagline,children:"Multi-agent orchestration for software teams"}),l.jsx("button",{type:"button",className:rt.primaryButton,onClick:n,"data-testid":"setup-get-started",children:"Get Started"})]})}function GU({onNext:n,onBack:s}){return l.jsxs("div",{className:rt.stepContent,"data-testid":"setup-about",children:[l.jsx("h2",{className:rt.heading,children:"What is Grackle?"}),l.jsxs("ul",{className:rt.featureList,children:[l.jsx("li",{children:"Run Claude, Copilot, and Codex agents side by side"}),l.jsx("li",{children:"Provision and control dev environments — SSH, Codespaces, or local"}),l.jsx("li",{children:"Organize work into workspaces with agent-executable tasks"}),l.jsx("li",{children:"Customize agent behavior with personas, tools, and MCP servers"}),l.jsx("li",{children:"Live-stream agent sessions with full terminal replay"})]}),l.jsxs("div",{className:rt.buttonRow,children:[l.jsx("button",{type:"button",className:rt.ghostButton,onClick:s,children:"Back"}),l.jsx("button",{type:"button",className:rt.primaryButton,onClick:n,"data-testid":"setup-about-next",children:"Next"})]})]})}const $U=[{id:"claude-code",name:"Claude Code",description:"Anthropic's agentic coding tool"},{id:"copilot",name:"Copilot Coding Agent",description:"GitHub's AI pair programmer"},{id:"codex",name:"Codex CLI",description:"OpenAI's coding agent"},{id:"goose",name:"Goose",description:"Block's open-source AI coding agent"}];function FU({currentRuntime:n,onFinish:s,onBack:i,finishDisabled:o}){const[c,u]=y.useState(n||"claude-code");return y.useEffect(()=>{n&&u(n)},[n]),l.jsxs("div",{className:rt.stepContent,"data-testid":"setup-runtime",children:[l.jsx("h2",{className:rt.heading,children:"Choose Your Runtime"}),l.jsx("p",{className:rt.subtitle,children:"Select the primary agent runtime for your workspace. You can change this later."}),l.jsx("div",{className:rt.runtimeGrid,children:$U.map(d=>l.jsxs("button",{type:"button",className:rt.runtimeCard,"data-selected":c===d.id,"aria-pressed":c===d.id,"data-testid":`runtime-card-${d.id}`,onClick:()=>u(d.id),children:[l.jsx("span",{className:rt.runtimeName,children:d.name}),l.jsx("span",{className:rt.runtimeDescription,children:d.description})]},d.id))}),l.jsxs("div",{className:rt.buttonRow,children:[l.jsx("button",{type:"button",className:rt.ghostButton,onClick:i,children:"Back"}),l.jsx("button",{type:"button",className:rt.primaryButton,onClick:()=>{s(c)},disabled:o,"data-testid":"setup-finish",children:"Finish"})]})]})}const ZU=3,ib={"claude-code":"sonnet",copilot:"gpt-4o",codex:"o3",goose:""};function KU(){const{personas:n,updatePersona:s,completeOnboarding:i,onboardingCompleted:o}=pt(),{showToast:c}=dn(),u=St(),[d,m]=y.useState(0),[h,g]=y.useState(!1),v=n.find(_=>_.id==="claude-code"),b=y.useCallback(_=>{g(!0);const S=[];if(v&&_!==v.runtime){const N=ib[_]??"sonnet";S.push(s(v.id,void 0,void 0,void 0,_,N))}const T=n.find(N=>N.id===n0);if(T&&_!==T.runtime){const N=ib[_]??"sonnet";S.push(s(n0,void 0,void 0,void 0,_,N))}Promise.all(S).then(()=>i()).then(()=>{u("/",{replace:!0})},()=>{c("Failed to update runtime -- please try again","error"),g(!1)})},[v,n,s,i,u,c]);return o===!0?l.jsx(Kn,{to:"/",replace:!0}):l.jsx("div",{className:rt.wizard,"data-testid":"setup-wizard",children:l.jsxs("div",{className:rt.container,children:[l.jsx(rs,{mode:"wait",children:l.jsxs(Ot.div,{initial:{opacity:0,x:40},animate:{opacity:1,x:0},exit:{opacity:0,x:-40},transition:{duration:.2,ease:"easeInOut"},children:[d===0&&l.jsx(qU,{onNext:()=>m(1)}),d===1&&l.jsx(GU,{onNext:()=>m(2),onBack:()=>m(0)}),d===2&&l.jsx(FU,{currentRuntime:(v==null?void 0:v.runtime)??"claude-code",onFinish:b,onBack:()=>m(1),finishDisabled:!v||h})]},d)}),l.jsx("div",{className:rt.dots,children:Array.from({length:ZU},(_,S)=>l.jsx("span",{className:rt.dot,"data-active":S===d},S))})]})})}const YU="_root_zndgp_1",JU="_body_zndgp_7",WU="_main_zndgp_19",XU="_sidebarWrapper_zndgp_26",QU="_overlay_zndgp_51",pr={root:YU,body:JU,main:WU,sidebarWrapper:XU,overlay:QU},ez=y.lazy(()=>wT(()=>import("./KnowledgePage-4d_6DFDB.js"),__vite__mapDeps([0,1,2,3,4])).then(n=>({default:n.KnowledgePage}))),Lx=typeof window<"u"&&new URLSearchParams(window.location.search).has("mock");function tz(){const{connected:n,environments:s,sessions:i,tasks:o}=pt(),{toasts:c,dismissToast:u}=dn(),d=Lt(),m=jw(),h=m!==void 0,[g,v]=y.useState(!1),b=y.useCallback(()=>v(_=>!_),[]);return y.useEffect(()=>{v(!1)},[d.pathname]),y.useEffect(()=>{if(!g)return;const _=S=>{S.key==="Escape"&&v(!1)};return document.addEventListener("keydown",_),()=>{document.removeEventListener("keydown",_)}},[g]),l.jsxs(l.Fragment,{children:[l.jsx(fw,{connected:n,environments:s,sessions:i,onToggleSidebar:h?b:void 0,sidebarOpen:g}),l.jsx(bw,{}),l.jsxs("div",{className:pr.body,children:[h&&l.jsx("div",{className:pr.sidebarWrapper,"data-sidebar-open":g,children:l.jsx(ww,{content:m})}),h&&g&&l.jsx("div",{className:pr.overlay,"data-testid":"drawer-overlay",onClick:()=>v(!1)}),l.jsxs("div",{className:pr.main,children:[l.jsx(Qa,{}),l.jsx(kD,{sessions:i,tasks:o,environments:s})]})]}),l.jsx(LD,{toasts:c,onDismiss:u}),l.jsx(kU,{})]})}function nz(){const{lastSpawnedId:n,environments:s,tasks:i,connected:o,onboardingCompleted:c}=pt(),{showToast:u}=dn();$3(s,u),Y3(i,u);const d=St(),m=Lt();return y.useEffect(()=>{n&&!m.pathname.includes("/tasks/")&&d(jb(n),{replace:!0})},[n,d,m.pathname]),o&&c===!1?l.jsx(Kn,{to:"/setup",replace:!0}):l.jsx(Nw,{children:l.jsxs("div",{className:pr.root,children:[Lx&&l.jsx(gR,{}),l.jsx(tz,{})]})})}function Bf(){const{workspaceId:n}=va(),{workspaces:s}=pt(),i=Lt(),o=s.find(h=>h.id===n);if(!(o!=null&&o.environmentId))return s.length===0?void 0:l.jsx(Kn,{to:"/environments",replace:!0});const c=encodeURIComponent(n),u=`/workspaces/${c}`,d=i.pathname.startsWith(u)?i.pathname.slice(u.length):"",m=`/environments/${encodeURIComponent(o.environmentId)}/workspaces/${c}${d}${i.search}${i.hash}`;return l.jsx(Kn,{to:m,replace:!0})}function sz(){return l.jsxs(wk,{children:[l.jsx(je,{path:"setup",element:l.jsx(KU,{})}),l.jsxs(je,{element:l.jsx(nz,{}),children:[l.jsx(je,{index:!0,element:l.jsx(SI,{})}),l.jsx(je,{path:"chat",element:l.jsx(XI,{})}),l.jsx(je,{path:"sessions/new",element:l.jsx(o5,{})}),l.jsx(je,{path:"sessions/:sessionId",element:l.jsx(c5,{})}),l.jsx(je,{element:l.jsx(gD,{}),children:l.jsx(je,{path:"knowledge",element:l.jsx(y.Suspense,{fallback:l.jsx(Ax,{}),children:l.jsx(ez,{})})})}),l.jsxs(je,{element:l.jsx(pD,{}),children:[l.jsx(je,{path:"tasks",element:l.jsx(_I,{})}),l.jsx(je,{path:"tasks/new",element:l.jsx(Wy,{})}),l.jsx(je,{path:"tasks/:taskId",element:l.jsx(fa,{})}),l.jsx(je,{path:"tasks/:taskId/edit",element:l.jsx(fa,{})}),l.jsx(je,{path:"tasks/:taskId/stream",element:l.jsx(fa,{})}),l.jsx(je,{path:"tasks/:taskId/findings",element:l.jsx(fa,{})})]}),l.jsxs(je,{element:l.jsx(mD,{}),children:[l.jsx(je,{path:"workspaces",element:l.jsx(Kn,{to:"/environments",replace:!0})}),l.jsx(je,{path:"workspaces/new",element:l.jsx(dB,{})}),l.jsx(je,{path:"workspaces/:workspaceId",element:l.jsx(Bf,{})}),l.jsx(je,{path:"workspaces/:workspaceId/tasks/:taskId",element:l.jsx(Bf,{})}),l.jsx(je,{path:"workspaces/:workspaceId/tasks/:taskId/*",element:l.jsx(Bf,{})}),l.jsx(je,{path:"environments/:environmentId/workspaces/:workspaceId",element:l.jsx(E4,{})}),l.jsx(je,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/new",element:l.jsx(Wy,{})}),l.jsx(je,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId",element:l.jsx(fa,{})}),l.jsx(je,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit",element:l.jsx(fa,{})}),l.jsx(je,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream",element:l.jsx(fa,{})}),l.jsx(je,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/findings",element:l.jsx(fa,{})}),l.jsxs(je,{path:"environments",element:l.jsx(iL,{}),children:[l.jsx(je,{index:!0,element:l.jsx(xI,{})}),l.jsx(je,{path:"new",element:l.jsx(eL,{})}),l.jsx(je,{path:":environmentId",element:l.jsx(ML,{})}),l.jsx(je,{path:":environmentId/edit",element:l.jsx(tL,{})})]})]}),l.jsx(je,{element:l.jsx(hD,{}),children:l.jsxs(je,{path:"settings",element:l.jsx(BL,{}),children:[l.jsx(je,{index:!0,element:l.jsx(Kn,{to:"credentials",replace:!0})}),l.jsx(je,{path:"environments",element:l.jsx(Kn,{to:"/environments",replace:!0})}),l.jsx(je,{path:"credentials",element:l.jsx(T8,{})}),l.jsx(je,{path:"tokens",element:l.jsx(Kn,{to:"../credentials",replace:!0})}),l.jsx(je,{path:"personas",element:l.jsx(q8,{})}),l.jsx(je,{path:"personas/new",element:l.jsx(sb,{})}),l.jsx(je,{path:"personas/:personaId",element:l.jsx(sb,{})}),l.jsx(je,{path:"appearance",element:l.jsx(cU,{})}),l.jsx(je,{path:"shortcuts",element:l.jsx(TU,{})}),l.jsx(je,{path:"about",element:l.jsx(pU,{})})]})}),l.jsx(je,{path:"*",element:l.jsx(Kn,{to:"/",replace:!0})})]})]})}const az=1e4;function iz(){const{onboardingCompleted:n}=pt(),[s,i]=y.useState(!1);y.useEffect(()=>{if(n!==void 0)return;const c=setTimeout(()=>i(!0),az);return()=>clearTimeout(c)},[n]);const o=n===void 0&&!s;return l.jsx(rs,{mode:"wait",children:o?l.jsx(Ot.div,{initial:{opacity:1},exit:{opacity:0},transition:{duration:.25},children:l.jsx(Ax,{})},"splash"):l.jsx(Ot.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.25},style:{minHeight:"100vh"},children:l.jsx(Jk,{basename:"/".replace(/\/$/,""),children:l.jsx(sz,{})})},"app")})}function oz(){const n=Lx?J2:P2;return l.jsx(nw,{children:l.jsx(X2,{children:l.jsx(n,{children:l.jsx(iz,{})})})})}ST.createRoot(document.getElementById("root")).render(l.jsx(y.StrictMode,{children:l.jsx(oz,{})}));export{ba as B,Db as K,pt as a,jb as s,os as t,St as u};
503
+ $\`Summarize the current tasks.\`;`,ariaLabel:"Persona script","data-testid":"persona-script-editor"})]}),E==="agent"&&l.jsxs("div",{children:[l.jsx("label",{children:"Allowed MCP Tools"}),l.jsx(eb,{selectedTools:F,onChange:I=>{Q(I);const Ne=I.length===0?["__clear__"]:I;me(()=>c(n.id,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,Ne),()=>{},"MCP tools updated","Failed to update MCP tools").catch(()=>{})}})]})]}),!Se&&!we&&l.jsx("p",{style:{fontSize:"var(--font-size-xs)",color:"var(--text-tertiary)",marginTop:"var(--space-xs)"},children:"Only agent personas with a runtime and model can be set as app default."})]}):null,l.jsx(Ja,{isOpen:ae,title:"Delete Persona?",description:`"${n==null?void 0:n.name}" will be permanently removed.`,confirmLabel:"Delete",onConfirm:fe,onCancel:()=>pe(!1)})]})}function lU({themeId:n,resolvedThemeId:s,onSetTheme:i,preferSystem:o,onSetPreferSystem:c}){return l.jsxs("section",{className:he.section,children:[l.jsx("h3",{className:he.sectionTitle,children:"Appearance"}),l.jsx("p",{className:he.sectionDescription,children:"Choose how Grackle looks across the app."}),l.jsx("div",{className:he.themeOptions,children:Oc.filter(u=>!u.hidden).map(u=>{const d=!!(u.variantLightId&&u.variantDarkId),m=d?n===u.id||n===u.variantLightId||n===u.variantDarkId:n===u.id,h=d&&s===u.variantLightId;return l.jsxs("button",{type:"button",className:`${he.themeOption} ${m?he.themeOptionSelected:""}`,"aria-pressed":m,onClick:()=>i(u.id),children:[l.jsxs("span",{className:he.themeOptionHeader,children:[l.jsxs("span",{children:[l.jsx("span",{className:he.themeOptionLabel,children:u.label}),l.jsx("span",{className:he.themeOptionDesc,children:u.description})]}),d&&l.jsxs("span",{className:he.variantToggle,children:[l.jsx("span",{role:"button",tabIndex:0,className:`${he.variantButton} ${m&&h?he.variantActive:""}`,onClick:g=>{g.stopPropagation(),c(!1),i(u.variantLightId)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),c(!1),i(u.variantLightId))},"aria-label":"Light variant","aria-pressed":m&&h,children:"☼"}),l.jsx("span",{role:"button",tabIndex:0,className:`${he.variantButton} ${m&&!h?he.variantActive:""}`,onClick:g=>{g.stopPropagation(),c(!1),i(u.variantDarkId)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),c(!1),i(u.variantDarkId))},"aria-label":"Dark variant","aria-pressed":m&&!h,children:"☾"})]})]}),u.swatches&&l.jsx("span",{className:he.themeSwatches,children:u.swatches.map((g,v)=>l.jsx("span",{className:he.themeSwatch,style:{background:g}},v))})]},u.id)})}),l.jsxs("label",{className:he.systemToggle,children:[l.jsx("input",{type:"checkbox",checked:o,onChange:u=>c(u.target.checked)}),l.jsx("span",{children:"Match system light/dark preference"})]}),l.jsx("p",{className:he.systemToggleHint,children:"Automatically switches between light and dark variants when available."}),l.jsxs("p",{className:he.themeActive,children:["Active theme: ",l.jsx("strong",{children:s})]})]})}function cU(){const{themeId:n,resolvedThemeId:s,setTheme:i,preferSystem:o,setPreferSystem:c}=Hb();return l.jsx(lU,{themeId:n,resolvedThemeId:s,onSetTheme:i,preferSystem:o,onSetPreferSystem:c})}function uU({connected:n,environments:s,sessions:i}){const o=s.filter(d=>d.status==="connected").length,c=s.length,u=i.filter(d=>["running","idle"].includes(d.status)).length;return l.jsxs("section",{className:he.section,"data-testid":"about-panel",children:[l.jsx("h3",{className:he.sectionTitle,children:"About"}),l.jsx("p",{className:he.sectionDescription,children:"Connection status and application information."}),l.jsxs("div",{className:he.aboutGrid,children:[l.jsxs("div",{className:he.aboutItem,children:[l.jsx("span",{className:he.aboutLabel,children:"Connection"}),l.jsxs("span",{className:he.aboutValue,children:[l.jsx("span",{className:`${he.aboutDot} ${n?he.aboutDotConnected:he.aboutDotDisconnected}`}),n?"Connected":"Disconnected"]})]}),l.jsxs("div",{className:he.aboutItem,children:[l.jsx("span",{className:he.aboutLabel,children:"Environments"}),l.jsxs("span",{className:he.aboutValue,children:[o,"/",c," connected"]})]}),l.jsxs("div",{className:he.aboutItem,children:[l.jsx("span",{className:he.aboutLabel,children:"Active Sessions"}),l.jsx("span",{className:he.aboutValue,children:u})]}),l.jsxs("div",{className:he.aboutItem,children:[l.jsx("span",{className:he.aboutLabel,children:"Version"}),l.jsx("span",{className:he.aboutValue,children:"0.85.1"})]})]})]})}function dU({currentVersion:n,latestVersion:s,updateAvailable:i,isDocker:o}){if(!i)return l.jsx(l.Fragment,{});const c=o?"docker pull ghcr.io/nick-pape/grackle:latest && docker restart grackle":`npm install -g @grackle-ai/cli@${s}`;return l.jsx("div",{"data-testid":"update-banner",children:l.jsxs(ZD,{variant:"info",dismissible:!0,children:[l.jsxs("strong",{children:["Grackle v",s]})," is available (you have v",n,")."," ","Run: ",l.jsx("code",{children:c})]})})}function fU(){const[n,s]=y.useState(void 0);return y.useEffect(()=>{let i=!1;return ke.getVersionStatus({}).then(o=>{i||s({currentVersion:o.currentVersion,latestVersion:o.latestVersion,updateAvailable:o.updateAvailable,isDocker:o.isDocker})},()=>{}),()=>{i=!0}},[]),n}function pU(){const{connected:n,environments:s,sessions:i}=pt(),o=fU();return l.jsxs(l.Fragment,{children:[o&&l.jsx(dU,{currentVersion:o.currentVersion,latestVersion:o.latestVersion,updateAvailable:o.updateAvailable,isDocker:o.isDocker}),l.jsx(uU,{connected:n,environments:s,sessions:i})]})}const mU="_group_1iprv_1",hU="_groupTitle_1iprv_8",gU="_shortcutList_1iprv_17",vU="_shortcutRow_1iprv_23",yU="_keys_1iprv_36",bU="_kbd_1iprv_43",_U="_description_1iprv_60",qa={group:mU,groupTitle:hU,shortcutList:gU,shortcutRow:vU,keys:yU,kbd:bU,description:_U},xU=[{title:"Global",shortcuts:[{keys:["?"],description:"Open keyboard shortcuts reference"},{keys:["N"],description:"Create a new task"},{keys:["Escape"],description:"Close dialog or cancel editing"}]},{title:"Task Page",shortcuts:[{keys:["1"],description:"Switch to Overview tab"},{keys:["2"],description:"Switch to Stream tab"},{keys:["3"],description:"Switch to Findings tab"}]},{title:"Workspace Page",shortcuts:[{keys:["1"],description:"Switch to Graph view"},{keys:["2"],description:"Switch to Board view"},{keys:["3"],description:"Switch to Tasks view"}]},{title:"Navigation Lists",shortcuts:[{keys:["←"],description:"Previous tab (horizontal nav)"},{keys:["→"],description:"Next tab (horizontal nav)"},{keys:["↑"],description:"Previous item (vertical nav)"},{keys:["↓"],description:"Next item (vertical nav)"},{keys:["J"],description:"Next item (alias for arrow down/right)"},{keys:["K"],description:"Previous item (alias for arrow up/left)"},{keys:["Home"],description:"Jump to first item"},{keys:["End"],description:"Jump to last item"}]},{title:"Editing",shortcuts:[{keys:["Enter"],description:"Activate / save inline edit"},{keys:["Space"],description:"Activate button or start editing"},{keys:["Escape"],description:"Cancel edit and discard changes"}]},{title:"Chat",shortcuts:[{keys:["Enter"],description:"Send message (when input is focused)"}]}];function SU(){return l.jsxs("section",{className:he.section,"data-testid":"keyboard-shortcuts-panel",children:[l.jsx("h3",{className:he.sectionTitle,children:"Keyboard Shortcuts"}),l.jsx("p",{className:he.sectionDescription,children:"Keyboard shortcuts for navigating and interacting with Grackle. Global shortcuts are suppressed while typing in text fields."}),xU.map(n=>l.jsxs("div",{className:qa.group,children:[l.jsx("h4",{className:qa.groupTitle,children:n.title}),l.jsx("div",{className:qa.shortcutList,children:n.shortcuts.map(s=>l.jsxs("div",{className:qa.shortcutRow,children:[l.jsx("span",{className:qa.keys,children:s.keys.map(i=>l.jsx("kbd",{className:qa.kbd,children:i},i))}),l.jsx("span",{className:qa.description,children:s.description})]},s.description))})]},n.title))]})}function TU(){return l.jsx(SU,{})}const ab=ei();function kU(){const n=St();return Ms({key:"?"},()=>{n(u2)}),Ms({key:"n"},()=>{n(ab)}),Ms({key:"N"},()=>{n(ab)}),l.jsx(l.Fragment,{})}const wU="_wizard_1260s_1",NU="_container_1260s_10",jU="_stepContent_1260s_19",CU="_logoArea_1260s_28",EU="_logoImage_1260s_32",AU="_heading_1260s_41",DU="_tagline_1260s_49",RU="_subtitle_1260s_56",MU="_featureList_1260s_64",OU="_runtimeGrid_1260s_89",IU="_runtimeCard_1260s_101",BU="_runtimeName_1260s_133",LU="_runtimeDescription_1260s_139",UU="_buttonRow_1260s_144",zU="_primaryButton_1260s_151",PU="_ghostButton_1260s_185",VU="_dots_1260s_213",HU="_dot_1260s_213",rt={wizard:wU,container:NU,stepContent:jU,logoArea:CU,logoImage:EU,heading:AU,tagline:DU,subtitle:RU,featureList:MU,runtimeGrid:OU,runtimeCard:IU,runtimeName:BU,runtimeDescription:LU,buttonRow:UU,primaryButton:zU,ghostButton:PU,dots:VU,dot:HU};function qU({onNext:n}){return l.jsxs("div",{className:rt.stepContent,"data-testid":"setup-welcome",children:[l.jsx("div",{className:rt.logoArea,children:l.jsx("img",{src:"/grackle-logo.png",alt:"Grackle",className:rt.logoImage})}),l.jsx("h1",{className:rt.heading,children:"Welcome to Grackle"}),l.jsx("p",{className:rt.tagline,children:"Multi-agent orchestration for software teams"}),l.jsx("button",{type:"button",className:rt.primaryButton,onClick:n,"data-testid":"setup-get-started",children:"Get Started"})]})}function GU({onNext:n,onBack:s}){return l.jsxs("div",{className:rt.stepContent,"data-testid":"setup-about",children:[l.jsx("h2",{className:rt.heading,children:"What is Grackle?"}),l.jsxs("ul",{className:rt.featureList,children:[l.jsx("li",{children:"Run Claude, Copilot, and Codex agents side by side"}),l.jsx("li",{children:"Provision and control dev environments — SSH, Codespaces, or local"}),l.jsx("li",{children:"Organize work into workspaces with agent-executable tasks"}),l.jsx("li",{children:"Customize agent behavior with personas, tools, and MCP servers"}),l.jsx("li",{children:"Live-stream agent sessions with full terminal replay"})]}),l.jsxs("div",{className:rt.buttonRow,children:[l.jsx("button",{type:"button",className:rt.ghostButton,onClick:s,children:"Back"}),l.jsx("button",{type:"button",className:rt.primaryButton,onClick:n,"data-testid":"setup-about-next",children:"Next"})]})]})}const $U=[{id:"claude-code",name:"Claude Code",description:"Anthropic's agentic coding tool"},{id:"copilot",name:"Copilot Coding Agent",description:"GitHub's AI pair programmer"},{id:"codex",name:"Codex CLI",description:"OpenAI's coding agent"},{id:"goose",name:"Goose",description:"Block's open-source AI coding agent"}];function FU({currentRuntime:n,onFinish:s,onBack:i,finishDisabled:o}){const[c,u]=y.useState(n||"claude-code");return y.useEffect(()=>{n&&u(n)},[n]),l.jsxs("div",{className:rt.stepContent,"data-testid":"setup-runtime",children:[l.jsx("h2",{className:rt.heading,children:"Choose Your Runtime"}),l.jsx("p",{className:rt.subtitle,children:"Select the primary agent runtime for your workspace. You can change this later."}),l.jsx("div",{className:rt.runtimeGrid,children:$U.map(d=>l.jsxs("button",{type:"button",className:rt.runtimeCard,"data-selected":c===d.id,"aria-pressed":c===d.id,"data-testid":`runtime-card-${d.id}`,onClick:()=>u(d.id),children:[l.jsx("span",{className:rt.runtimeName,children:d.name}),l.jsx("span",{className:rt.runtimeDescription,children:d.description})]},d.id))}),l.jsxs("div",{className:rt.buttonRow,children:[l.jsx("button",{type:"button",className:rt.ghostButton,onClick:i,children:"Back"}),l.jsx("button",{type:"button",className:rt.primaryButton,onClick:()=>{s(c)},disabled:o,"data-testid":"setup-finish",children:"Finish"})]})]})}const ZU=3,ib={"claude-code":"sonnet",copilot:"gpt-4o",codex:"o3",goose:""};function KU(){const{personas:n,updatePersona:s,completeOnboarding:i,onboardingCompleted:o}=pt(),{showToast:c}=dn(),u=St(),[d,m]=y.useState(0),[h,g]=y.useState(!1),v=n.find(_=>_.id==="claude-code"),b=y.useCallback(_=>{g(!0);const S=[];if(v&&_!==v.runtime){const N=ib[_]??"sonnet";S.push(s(v.id,void 0,void 0,void 0,_,N))}const T=n.find(N=>N.id===n0);if(T&&_!==T.runtime){const N=ib[_]??"sonnet";S.push(s(n0,void 0,void 0,void 0,_,N))}Promise.all(S).then(()=>i()).then(()=>{u("/",{replace:!0})},()=>{c("Failed to update runtime -- please try again","error"),g(!1)})},[v,n,s,i,u,c]);return o===!0?l.jsx(Kn,{to:"/",replace:!0}):l.jsx("div",{className:rt.wizard,"data-testid":"setup-wizard",children:l.jsxs("div",{className:rt.container,children:[l.jsx(rs,{mode:"wait",children:l.jsxs(Ot.div,{initial:{opacity:0,x:40},animate:{opacity:1,x:0},exit:{opacity:0,x:-40},transition:{duration:.2,ease:"easeInOut"},children:[d===0&&l.jsx(qU,{onNext:()=>m(1)}),d===1&&l.jsx(GU,{onNext:()=>m(2),onBack:()=>m(0)}),d===2&&l.jsx(FU,{currentRuntime:(v==null?void 0:v.runtime)??"claude-code",onFinish:b,onBack:()=>m(1),finishDisabled:!v||h})]},d)}),l.jsx("div",{className:rt.dots,children:Array.from({length:ZU},(_,S)=>l.jsx("span",{className:rt.dot,"data-active":S===d},S))})]})})}const YU="_root_zndgp_1",JU="_body_zndgp_7",WU="_main_zndgp_19",XU="_sidebarWrapper_zndgp_26",QU="_overlay_zndgp_51",pr={root:YU,body:JU,main:WU,sidebarWrapper:XU,overlay:QU},ez=y.lazy(()=>wT(()=>import("./KnowledgePage-C39vVNnH.js"),__vite__mapDeps([0,1,2,3,4])).then(n=>({default:n.KnowledgePage}))),Lx=typeof window<"u"&&new URLSearchParams(window.location.search).has("mock");function tz(){const{connected:n,environments:s,sessions:i,tasks:o}=pt(),{toasts:c,dismissToast:u}=dn(),d=Lt(),m=jw(),h=m!==void 0,[g,v]=y.useState(!1),b=y.useCallback(()=>v(_=>!_),[]);return y.useEffect(()=>{v(!1)},[d.pathname]),y.useEffect(()=>{if(!g)return;const _=S=>{S.key==="Escape"&&v(!1)};return document.addEventListener("keydown",_),()=>{document.removeEventListener("keydown",_)}},[g]),l.jsxs(l.Fragment,{children:[l.jsx(fw,{connected:n,environments:s,sessions:i,onToggleSidebar:h?b:void 0,sidebarOpen:g}),l.jsx(bw,{}),l.jsxs("div",{className:pr.body,children:[h&&l.jsx("div",{className:pr.sidebarWrapper,"data-sidebar-open":g,children:l.jsx(ww,{content:m})}),h&&g&&l.jsx("div",{className:pr.overlay,"data-testid":"drawer-overlay",onClick:()=>v(!1)}),l.jsxs("div",{className:pr.main,children:[l.jsx(Qa,{}),l.jsx(kD,{sessions:i,tasks:o,environments:s})]})]}),l.jsx(LD,{toasts:c,onDismiss:u}),l.jsx(kU,{})]})}function nz(){const{lastSpawnedId:n,environments:s,tasks:i,connected:o,onboardingCompleted:c}=pt(),{showToast:u}=dn();$3(s,u),Y3(i,u);const d=St(),m=Lt();return y.useEffect(()=>{n&&!m.pathname.includes("/tasks/")&&d(jb(n),{replace:!0})},[n,d,m.pathname]),o&&c===!1?l.jsx(Kn,{to:"/setup",replace:!0}):l.jsx(Nw,{children:l.jsxs("div",{className:pr.root,children:[Lx&&l.jsx(gR,{}),l.jsx(tz,{})]})})}function Bf(){const{workspaceId:n}=va(),{workspaces:s}=pt(),i=Lt(),o=s.find(h=>h.id===n);if(!(o!=null&&o.environmentId))return s.length===0?void 0:l.jsx(Kn,{to:"/environments",replace:!0});const c=encodeURIComponent(n),u=`/workspaces/${c}`,d=i.pathname.startsWith(u)?i.pathname.slice(u.length):"",m=`/environments/${encodeURIComponent(o.environmentId)}/workspaces/${c}${d}${i.search}${i.hash}`;return l.jsx(Kn,{to:m,replace:!0})}function sz(){return l.jsxs(wk,{children:[l.jsx(je,{path:"setup",element:l.jsx(KU,{})}),l.jsxs(je,{element:l.jsx(nz,{}),children:[l.jsx(je,{index:!0,element:l.jsx(SI,{})}),l.jsx(je,{path:"chat",element:l.jsx(XI,{})}),l.jsx(je,{path:"sessions/new",element:l.jsx(o5,{})}),l.jsx(je,{path:"sessions/:sessionId",element:l.jsx(c5,{})}),l.jsx(je,{element:l.jsx(gD,{}),children:l.jsx(je,{path:"knowledge",element:l.jsx(y.Suspense,{fallback:l.jsx(Ax,{}),children:l.jsx(ez,{})})})}),l.jsxs(je,{element:l.jsx(pD,{}),children:[l.jsx(je,{path:"tasks",element:l.jsx(_I,{})}),l.jsx(je,{path:"tasks/new",element:l.jsx(Wy,{})}),l.jsx(je,{path:"tasks/:taskId",element:l.jsx(fa,{})}),l.jsx(je,{path:"tasks/:taskId/edit",element:l.jsx(fa,{})}),l.jsx(je,{path:"tasks/:taskId/stream",element:l.jsx(fa,{})}),l.jsx(je,{path:"tasks/:taskId/findings",element:l.jsx(fa,{})})]}),l.jsxs(je,{element:l.jsx(mD,{}),children:[l.jsx(je,{path:"workspaces",element:l.jsx(Kn,{to:"/environments",replace:!0})}),l.jsx(je,{path:"workspaces/new",element:l.jsx(dB,{})}),l.jsx(je,{path:"workspaces/:workspaceId",element:l.jsx(Bf,{})}),l.jsx(je,{path:"workspaces/:workspaceId/tasks/:taskId",element:l.jsx(Bf,{})}),l.jsx(je,{path:"workspaces/:workspaceId/tasks/:taskId/*",element:l.jsx(Bf,{})}),l.jsx(je,{path:"environments/:environmentId/workspaces/:workspaceId",element:l.jsx(E4,{})}),l.jsx(je,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/new",element:l.jsx(Wy,{})}),l.jsx(je,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId",element:l.jsx(fa,{})}),l.jsx(je,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit",element:l.jsx(fa,{})}),l.jsx(je,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream",element:l.jsx(fa,{})}),l.jsx(je,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/findings",element:l.jsx(fa,{})}),l.jsxs(je,{path:"environments",element:l.jsx(iL,{}),children:[l.jsx(je,{index:!0,element:l.jsx(xI,{})}),l.jsx(je,{path:"new",element:l.jsx(eL,{})}),l.jsx(je,{path:":environmentId",element:l.jsx(ML,{})}),l.jsx(je,{path:":environmentId/edit",element:l.jsx(tL,{})})]})]}),l.jsx(je,{element:l.jsx(hD,{}),children:l.jsxs(je,{path:"settings",element:l.jsx(BL,{}),children:[l.jsx(je,{index:!0,element:l.jsx(Kn,{to:"credentials",replace:!0})}),l.jsx(je,{path:"environments",element:l.jsx(Kn,{to:"/environments",replace:!0})}),l.jsx(je,{path:"credentials",element:l.jsx(T8,{})}),l.jsx(je,{path:"tokens",element:l.jsx(Kn,{to:"../credentials",replace:!0})}),l.jsx(je,{path:"personas",element:l.jsx(q8,{})}),l.jsx(je,{path:"personas/new",element:l.jsx(sb,{})}),l.jsx(je,{path:"personas/:personaId",element:l.jsx(sb,{})}),l.jsx(je,{path:"appearance",element:l.jsx(cU,{})}),l.jsx(je,{path:"shortcuts",element:l.jsx(TU,{})}),l.jsx(je,{path:"about",element:l.jsx(pU,{})})]})}),l.jsx(je,{path:"*",element:l.jsx(Kn,{to:"/",replace:!0})})]})]})}const az=1e4;function iz(){const{onboardingCompleted:n}=pt(),[s,i]=y.useState(!1);y.useEffect(()=>{if(n!==void 0)return;const c=setTimeout(()=>i(!0),az);return()=>clearTimeout(c)},[n]);const o=n===void 0&&!s;return l.jsx(rs,{mode:"wait",children:o?l.jsx(Ot.div,{initial:{opacity:1},exit:{opacity:0},transition:{duration:.25},children:l.jsx(Ax,{})},"splash"):l.jsx(Ot.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.25},style:{minHeight:"100vh"},children:l.jsx(Jk,{basename:"/".replace(/\/$/,""),children:l.jsx(sz,{})})},"app")})}function oz(){const n=Lx?J2:P2;return l.jsx(nw,{children:l.jsx(X2,{children:l.jsx(n,{children:l.jsx(iz,{})})})})}ST.createRoot(document.getElementById("root")).render(l.jsx(y.StrictMode,{children:l.jsx(oz,{})}));export{ba as B,Db as K,pt as a,jb as s,os as t,St as u};
package/dist/index.html CHANGED
@@ -10,7 +10,7 @@
10
10
  <link rel="icon" type="image/x-icon" href="/favicon.ico" />
11
11
  <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
12
12
  <link rel="manifest" href="/manifest.json" />
13
- <script type="module" crossorigin src="/assets/index-CAQikL1U.js"></script>
13
+ <script type="module" crossorigin src="/assets/index-qSWpvSA-.js"></script>
14
14
  <link rel="modulepreload" crossorigin href="/assets/markdown-gcy1Jmzi.js">
15
15
  <link rel="modulepreload" crossorigin href="/assets/dagview-BA5TtMAQ.js">
16
16
  <link rel="modulepreload" crossorigin href="/assets/grpc-DU5jMhZD.js">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grackle-ai/web",
3
- "version": "0.85.1",
3
+ "version": "0.85.2",
4
4
  "description": "React web UI for the Grackle multi-agent coordination platform",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -42,7 +42,7 @@
42
42
  "rehype-prism-plus": "^2.0.0",
43
43
  "remark-gfm": "^4.0.0",
44
44
  "react-router": "^7.0.0",
45
- "@grackle-ai/common": "0.85.1"
45
+ "@grackle-ai/common": "0.85.2"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@rushstack/heft": "1.2.7",