dsh-hive-swarm 2.1.1 → 2.1.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.
package/client/dist.js CHANGED
@@ -1,898 +1,898 @@
1
- // Generated by scripts/build-dsh-client.mjs. Host React is intentionally external.
2
- window.__ModuleLoader__.load({id:"dsh-hive-swarm",factory(require){
3
- var module={exports:{}};var exports=module.exports;
4
- var Xt=Object.create;var Ke=Object.defineProperty;var Kt=Object.getOwnPropertyDescriptor;var Qt=Object.getOwnPropertyNames;var Zt=Object.getPrototypeOf,Rt=Object.prototype.hasOwnProperty;var nt=(o,i)=>()=>(i||o((i={exports:{}}).exports,i),i.exports),eo=(o,i)=>{for(var d in i)Ke(o,d,{get:i[d],enumerable:!0})},ft=(o,i,d,p)=>{if(i&&typeof i=="object"||typeof i=="function")for(let m of Qt(i))!Rt.call(o,m)&&m!==d&&Ke(o,m,{get:()=>i[m],enumerable:!(p=Kt(i,m))||p.enumerable});return o};var Je=(o,i,d)=>(d=o!=null?Xt(Zt(o)):{},ft(i||!o||!o.__esModule?Ke(d,"default",{value:o,enumerable:!0}):d,o)),to=o=>ft(Ke({},"__esModule",{value:!0}),o);var wt=nt((Ko,xt)=>{var at={};(()=>{"use strict";let o=Math.sqrt(3),i=new Set(["for","in","on","to","with","of","by","at","from","into","onto","about","as","and","or","the","a","an","via","per","within"]);function d(t){return t.kind==="brief"||t.kind==="message"||!t.kind&&t.author!=="system"}function p(t,{live:l=!1,now:u=Date.now()}={}){let v=t.map(j=>Date.parse(j.time)).filter(Number.isFinite);if(!v.length)return"<1m";let E=Math.max(0,Math.floor(((l?u:v.at(-1))-v[0])/6e4));return E?E<60?E+"m":Math.floor(E/60)+"h"+(E%60?" "+E%60+"m":""):"<1m"}function m(t){return!!(t.unmentioned&&!t.mentions&&!t.broadcasts)}function n(t){let l=t&&typeof t=="object",u=l?String(t.taskLabel??"").trim():"";if(u)return u;let v=String(l?t.brief??t.task??"":t??""),E=l&&t.name?String(t.name).trim():"";if(!v.trim())return E||"Swarm task";let j=v.replace(/```[\s\S]*?```/g," ").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[`*_~>#]/g," ").replace(/^\s*(?:[-*+]|\d+[.)])\s+/gm,""),ee=/^(?:strict\s+file\s+ownership|do\s+not\s+touch|reference\s+screenshots|requirements?|first\s*\(|deliverables?)\b/i,Q=(j.split(/\r?\n+/).map(s=>s.trim()).filter(s=>s&&!ee.test(s)).slice(0,8).join(" ")||j).replace(/\s+/g," ").trim(),se=[/^you\s+have\s+just\s+started[.:!]*\s*/i,/^your\s+assignment(?:\s*\([^)]*\))?[:.\s-]*/i,/^you\s+are(?:\s+(?:a|an|the))?\s+(?:hive\s+swarm\s+)?(?:member|agent|worker|owner)(?:\s+['"]?@?[a-z0-9_-]+['"]?)?(?:\s+(?:for|on|in)\s+hive\s+swarm(?:\s+\d+(?:\.\d+)*)?)?[.,:;\s-]*/i,/^as(?:\s+(?:a|an|the))?\s+[a-z0-9 _-]+,\s*/i,/^(?:your\s+)?(?:task|goal|role|mission|assignment)\s*(?:is\s+to|is|:)\s*/i,/^you\s+(?:own|will\s+own|are\s+responsible\s+for|need\s+to|should|must)\s+(?:the\s+)?/i,/^please\s+/i,/^for\s+hive\s+swarm(?:\s+\d+(?:\.\d+)*)?[.,:;\s-]*/i];for(let s=0;s<3;s++){let D=!1;for(let S of se){let I=Q.replace(S,"").trim();I!==Q&&(Q=I,D=!0)}if(!D)break}if(Q=Q.replace(/\s+(?:in|on)\s+(?:your|the)\s+(?:shared\s+)?worktree.*$/i,"").replace(/\s+for\s+hive\s+swarm(?:\s+\d+(?:\.\d+)*)?\.?$/i,"").replace(/\s+/g," ").trim(),Q.length>64){let s=/^(.{18,64}?)[.!?](?:\s|$)/.exec(Q);s&&(Q=s[1])}let B=Q.replace(/[.,:;!?-]+$/g,"").split(/\s+/).filter(Boolean);B.length>10&&(B=B.slice(0,10));let H=B.join(" ");for(;H.length>64&&B.length>1;)B.pop(),H=B.join(" ");let ce=H.lastIndexOf("("),_=H.lastIndexOf(")");if(ce!==-1&&ce>_){let s=H.slice(0,ce).replace(/[,:;-\s]+$/,"").trim();s.split(/\s+/).length>=2?(H=s,B=H.split(/\s+/).filter(Boolean)):(H=H.replace(/\(/g,""),B=H.split(/\s+/).filter(Boolean))}for(;B.length>2&&i.has(B.at(-1).replace(/[,:;!?-]+$/g,"").toLowerCase());)B.pop();return H=B.join(" ").replace(/[,:;!?-]+$/g,"").trim(),H.length>64&&(H=H.slice(0,64).replace(/\s+\S*$/,"").replace(/[,:;!?-]+$/g,"").trim()),H?H[0].toUpperCase()+H.slice(1):E||"Swarm task"}function N(t){let l=t??[],u=l.some(E=>(E.role==="coordinator"||E.name==="coordinator")&&!E.external),v=l.some(E=>E.name==="user");return!u&&!v}function k(t,l,u,{hideInactive:v=!1,expandBroadcast:E=!1}={}){let j=N(l),ee=_=>j&&_==="user"?"coordinator":_,oe=new Map([["coordinator",{name:"coordinator",role:"coordinator",status:"waiting"}]]);for(let _ of l)oe.set(_.name,_);let Q=new Set,se=new Map,B=new Map,H=0;function ce(_){oe.has(_)||oe.set(_,{name:_,status:"observer"}),Q.add(_)}for(let _ of t){if(_.seq>u||!d(_))continue;let s=ee(_.author),D=[...new Set([...(_.targets??[]).map(ee),..._.coordinatorMention?["coordinator"]:[]])];ce(s);let S=se.get(s)??{posts:0,mentions:0,broadcasts:0,unmentioned:0,lastSeq:0};S.posts++,S.lastSeq=_.seq,se.set(s,S);let I=_.broadcast??/(?:^|[^a-z0-9_])@all(?![a-z0-9_-])/i.test(_.text??"");I&&(S.broadcasts++,H++),!I&&!D.some(F=>F!==s)&&S.unmentioned++;for(let F of new Set(D)){if(F===s||(ce(F),I&&!E))continue;let V=s+">"+F,ie=B.get(V)??{from:s,to:F,count:0,direct:0,broadcast:0,lastSeq:0};ie.count++,I?ie.broadcast++:ie.direct++,ie.lastSeq=_.seq,S.mentions++,B.set(V,ie)}}return{nodes:[...oe.values()].filter(_=>!v||Q.has(_.name)).map(_=>({..._,...se.get(_.name)})),links:[...B.values()],broadcasts:H}}function C(t,l){return t>6||t>3&&l<440}function y(t){return Math.max(1,Math.floor(t/120))}function c(t,l){if(C(t,l)){let u=Math.ceil(t/y(l));return Math.max(340,u*124+44)}return t>=6?470:t===5?450:t===4?400:0}function x(t,l,u){let v=new Map;if(!t.length)return v;if(C(t.length,l)){let ce=y(l),_=Math.ceil(t.length/ce),s=l/ce,D=56,S=66,I=Math.max(0,u-D-S);return t.forEach((F,V)=>{let ie=Math.floor(V/ce),X=Math.min(ce,t.length-ie*ce),de=_===1?Math.max(D,Math.min(u-S,u/2-8)):D+ie/(_-1)*I;v.set(F.name,{x:s*(V%ce+.5+(ce-X)/2),y:de})}),v}let E=t.find(ce=>ce.role==="coordinator")??t[0];if(!E)return v;let j=t.filter(ce=>ce!==E),ee=56,oe=66,Q=(ee+(u-oe))/2,se=Math.max(48,(u-ee-oe)/2),B=Math.min(68,Math.max(54,l*.1)),H=Math.max(44,Math.min(l*.4,l/2-B));if(!j.length)return v.set(E.name,{x:l/2,y:Q}),v;if(j.length===1){let ce=Math.max(54,Math.min(H*.72,l/2-B));return v.set(E.name,{x:l/2-ce,y:Q}),v.set(j[0].name,{x:l/2+ce,y:Q}),v}if(j.length===2){let ce=Math.max(ee,Q-se*.78),_=Math.min(u-oe,Q+se*.72),s=Math.max(54,Math.min(H*.85,l/2-B));return v.set(E.name,{x:l/2,y:ce}),v.set(j[0].name,{x:l/2-s,y:_}),v.set(j[1].name,{x:l/2+s,y:_}),v}return v.set(E.name,{x:l/2,y:Q}),j.forEach((ce,_)=>{let s=-Math.PI/2+_*Math.PI*2/j.length;v.set(ce.name,{x:l/2+Math.cos(s)*H,y:Q+Math.sin(s)*se})}),v}function w(t,l){return t>12||t>5&&l<380||t>8&&l<465}function b(t,l){if(w(t,l)){let u=Math.max(1,Math.floor(Math.max(l-24,140)/145)),v=Math.ceil(t/u);return Math.max(360,v*68+80)}return t>=11?680:t>=9?560:t>=7?470:t>=5?400:360}function P(t,l,u){let v=new Map;if(!t?.length)return v;let E=l<465,j=[],ee=t.find(S=>S.role==="coordinator"||S.name==="coordinator");ee&&j.push(ee);for(let S of t)S!==ee&&j.push(S);if(w(j.length,l)){let S=Math.max(...j.map(K=>z(K,{variant:"pill",narrow:E}).halfW*2),116),I=Math.max(1,Math.floor((l-24)/(S+14))),F=Math.ceil(j.length/I),V=l/I,ie=42,de=Math.max(40,u-ie-46);return j.forEach((K,le)=>{let he=Math.floor(le/I),me=Math.min(I,j.length-he*I),Se=F===1?u/2:ie+he/(F-1)*de,ue=V*(le%I+.5+(I-me)/2);v.set(K.name,{x:ue,y:Se})}),v}if(j.length===1)return v.set(j[0].name,{x:l/2,y:u/2}),v;let oe=Math.max(...j.map(S=>z(S,{variant:"pill",narrow:E}).halfW),56),Q=Math.max(...j.map(S=>z(S,{variant:"pill",narrow:E}).halfH),17),se=Q+18,B=Q+22,H=Math.min(l*.28,oe+18),ce=l/2,_=(se+(u-B))/2,s=Math.max(48,Math.min(l*.42,l/2-H)),D=Math.max(44,(u-se-B)/2);return j.forEach((S,I)=>{let F=-Math.PI/2+I*Math.PI*2/j.length;v.set(S.name,{x:ce+Math.cos(F)*s,y:_+Math.sin(F)*D})}),v}function q(t,l){let u=String(t??"").trim();if(!u)return 1;let v=Math.max(6,l),E=u.match(/[^-\s_/]+[-\s_/]*|[-\s_/]+/g)??[u],j=1,ee=0;for(let oe of E){let Q=oe;for(;Q.length>v;)ee>0&&(j++,ee=0),Q=Q.slice(v),j++;ee>0&&ee+Q.length>v?(j++,ee=Q.length):ee+=Q.length}return Math.max(1,j)}function z(t,{variant:l="card",cardWidth:u,narrow:v=!1}={}){if(l==="pill"){let Q=String(t?.name??""),se=Q==="user"?"You":Q==="system"?"System":Q,B=v?16:18,H=v?156:210,ce=v?88:104,_=v?6.4:7.2;return{halfW:Math.min(H,Math.max(ce,(v?38:46)+se.length*_))/2,halfH:B,offsetX:0,offsetY:0,radius:B}}if(l==="hex"){let Q=v?84:128,se=String(t?.name??""),B=se==="user"?"You":se==="system"?"System":"@"+se,H=Math.max(8,Math.floor((Q-12)/6.3)),ce=q(B,H),_=Math.min(Q,Math.max(38,12+B.length*6.3)),s=m(t??{}),D=Math.max(s?32:28,_/2),S=s?32:t?.broadcasts?29:24,I=29+ce*15+4;return{halfW:D,halfH:(S+I)/2,offsetX:0,offsetY:(I-S)/2,radius:10}}let E=u??(v?92:112),j=Math.max(7,Math.floor((E-20)/7.4)),oe=64+q(t?.name??"",j)*16;return{halfW:E/2,halfH:oe/2,offsetX:0,offsetY:0,radius:10}}function J(t,l){if(!l)return{cx:t.x,cy:t.y,halfW:26,halfH:26,radius:10};if(Number.isFinite(l.left)&&Number.isFinite(l.right)&&Number.isFinite(l.top)&&Number.isFinite(l.bottom))return{cx:t.x+(l.right-l.left)/2,cy:t.y+(l.bottom-l.top)/2,halfW:(l.left+l.right)/2,halfH:(l.top+l.bottom)/2,radius:Math.max(0,l.radius??8)};let u=Number.isFinite(l.halfW)?l.halfW:Number.isFinite(l.width)?l.width/2:26,v=Number.isFinite(l.halfH)?l.halfH:Number.isFinite(l.height)?l.height/2:26;return{cx:Number.isFinite(l.cx)?l.cx:t.x+(l.offsetX??0),cy:Number.isFinite(l.cy)?l.cy:t.y+(l.offsetY??0),halfW:Math.max(1,u),halfH:Math.max(1,v),radius:Math.max(0,l.radius??8)}}function g(t,l,u){let v=Math.max(0,Math.min(u.radius??0,u.halfW,u.halfH)),E=Math.abs(t-u.cx)-(u.halfW-v),j=Math.abs(l-u.cy)-(u.halfH-v);return Math.hypot(Math.max(E,0),Math.max(j,0))+Math.min(Math.max(E,j),0)-v}function T(t,l,u,v){let E=1-v;return{x:E*E*t.x+2*E*v*l.x+v*v*u.x,y:E*E*t.y+2*E*v*l.y+v*v*u.y}}function G(t,l,u,v,E){let j=(1-v)*(1-E),ee=(1-v)*E+v*(1-E),oe=v*E;return{x:j*t.x+ee*l.x+oe*u.x,y:j*t.y+ee*l.y+oe*u.y}}function $(t,l,u,v,E,j,ee,oe){let se=-1;for(let ue=0;ue<=32;ue++){let U=T(t,l,u,ue/32);g(U.x,U.y,v)<=j&&(se=ue)}if(se>=32)return null;let B=0;if(se>=0){let ue=se/32,U=(se+1)/32;for(let ve=0;ve<22;ve++){let be=(ue+U)/2,ye=T(t,l,u,be);g(ye.x,ye.y,v)<=j?ue=be:U=be}B=U}let H=-1,ce=Math.max(0,se+1);for(let ue=ce;ue<=32;ue++){let U=T(t,l,u,ue/32);if(g(U.x,U.y,E)<=ee){H=ue;break}}if(H<=0)return null;let _=(H-1)/32,s=H/32;for(let ue=0;ue<22;ue++){let U=(_+s)/2,ve=T(t,l,u,U);g(ve.x,ve.y,E)<=ee?s=U:_=U}let D=_;if(D<=B+1e-4)return null;let S=T(t,l,u,B),I=T(t,l,u,D),F=Math.hypot(I.x-S.x,I.y-S.y);if(F<oe)return null;let V=G(t,l,u,B,D),ie=T(t,l,u,(B+D)/2),X=I.x-V.x,de=I.y-V.y,K=V.x-S.x,le=V.y-S.y,he=Math.hypot(X,de)>1e-4?Math.atan2(de,X):Math.atan2(I.y-S.y,I.x-S.x),me=Math.hypot(K,le)>1e-4?Math.atan2(le,K):Math.atan2(I.y-S.y,I.x-S.x),Se="M"+S.x.toFixed(1)+" "+S.y.toFixed(1)+" Q"+V.x.toFixed(1)+" "+V.y.toFixed(1)+" "+I.x.toFixed(1)+" "+I.y.toFixed(1);return{start:S,control:V,end:I,mid:ie,startAngle:me,endAngle:he,length:F,tStart:B,tEnd:D,d:Se}}function O(t,l){if(!l.length)return 1/0;let u=1/0;for(let v=0;v<=24;v++){let E=T(t.start,t.control,t.end,v/24);for(let j of l){let ee=g(E.x,E.y,j);ee<u&&(u=ee)}}for(let v of l){let E=g(t.mid.x,t.mid.y,v)-10;E<u&&(u=E)}return u}function h(t,l,u,v,{marginStart:E=6,marginEnd:j=7,bidirectional:ee=!1,bend:oe,obstacles:Q=[],obstacleMargin:se=8,minLength:B=8}={}){if(!t||!l)return null;let H=J(t,u),ce=J(l,v),_={x:H.cx,y:H.cy},s={x:ce.cx,y:ce.cy},D=s.x-_.x,S=s.y-_.y,I=Math.hypot(D,S);if(I<1)return null;let F=D/I,ie=-(S/I),X=F,de=Q.map(he=>he?.box?J(he,he.box):J(he,he)),K=[];if(Number.isFinite(oe))K.push(oe);else if(ee){let he=Math.min(34,Math.max(18,I*.145));K.push(he,Math.min(54,he*1.45),Math.max(10,he*.55),Math.min(72,I*.3),Math.max(6,he*.3))}else{let he=Math.min(20,Math.max(8,I*.065)),me=Math.min(82,I*.34);K.push(he,-he,0,Math.min(me,he*2),-Math.min(me,he*2),Math.min(me,he*3.2),-Math.min(me,he*3.2),me,-me)}let le=(he,me,Se)=>{let ue=null,U=-1/0;for(let ve of K){let be={x:(_.x+s.x)/2+ie*ve,y:(_.y+s.y)/2+X*ve},ye=$(_,be,s,H,ce,he,me,Se);if(!ye)continue;let ke=O(ye,de),qe={...ye,bend:ve,clearance:ke};if(ke>=se)return qe;ke>U&&(U=ke,ue=qe)}return ue};return le(E,j,B)??le(Math.min(E,2),Math.min(j,3),Math.min(B,4))}function W(t,l,{variant:u="card",boxes:v,cardWidth:E,narrow:j=!1,marginStart:ee=6,marginEnd:oe=7,obstacleMargin:Q=8,minLength:se=8}={}){let B=new Map;for(let F of t.nodes??[]){let V=v?.get?.(F.name);B.set(F.name,V??z(F,{variant:u,cardWidth:E,narrow:j}))}let H=new Set((t.links??[]).map(F=>F.from+">"+F.to)),ce=new Map,_=[],s=(F,V)=>{let ie=[];for(let X of t.nodes??[]){if(X.name===F||X.name===V)continue;let de=l.get(X.name);de&&ie.push({x:de.x,y:de.y,box:B.get(X.name)})}return ie};for(let F of t.links??[]){let V=l.get(F.from),ie=l.get(F.to);if(!V||!ie)continue;let X=B.get(F.from)??z({name:F.from},{variant:u,cardWidth:E,narrow:j}),de=B.get(F.to)??z({name:F.to},{variant:u,cardWidth:E,narrow:j}),K=s(F.from,F.to),le=H.has(F.to+">"+F.from),he=h(V,ie,X,de,{marginStart:ee,marginEnd:oe,bidirectional:le,obstacles:K,obstacleMargin:Q,minLength:se});if(he){let me={link:F,edge:he,bidirectional:le,fromBox:X,toBox:de,obstacles:K};_.push(me),ce.set(F.from+">"+F.to,me)}}for(let F of _){if(!F.bidirectional||F.edge.clearance>=Math.min(Q,16))continue;let V=ce.get(F.link.to+">"+F.link.from);if(!V||V.edge.clearance<Math.min(Q,16))continue;let ie=l.get(F.link.from),X=l.get(F.link.to);for(let de of[-18,-26,-36,-48]){let K=h(ie,X,F.fromBox,F.toBox,{marginStart:ee,marginEnd:oe,bidirectional:!0,bend:de,obstacles:F.obstacles,obstacleMargin:Q,minLength:se});if(!K||K.clearance<10)continue;let le=Math.max(V.edge.bend,Math.abs(de)+28),he=h(X,ie,V.fromBox,V.toBox,{marginStart:ee,marginEnd:oe,bidirectional:!0,bend:le,obstacles:V.obstacles,obstacleMargin:Q,minLength:se});if(he&&he.clearance>=10&&Math.hypot(K.mid.x-he.mid.x,K.mid.y-he.mid.y)>=12){F.edge=K,V.edge=he;break}}}let D=[],S=(F,V,ie)=>{for(let X of V){let de=X?.box?J(X,X.box):J(X,X);if(g(F.x,F.y,de)<ie)return!1}for(let X of D)if(Math.hypot(F.x-X.x,F.y-X.y)<26)return!1;return!0},I=[];for(let F of t.nodes??[]){let V=l.get(F.name);V&&I.push({x:V.x,y:V.y,box:B.get(F.name)})}for(let F of _){let{edge:V,link:ie}=F;if(V.length<40)continue;let X=V.start,de=V.control,K=V.end,le=V.mid;if(!S(le,I,12))for(let he of[.38,.62,.32,.68,.44,.56]){let me=T(X,de,K,he);if(S(me,I,12)){le=me;break}}V.mid=le,ie.count>1&&D.push(le)}return _.map(({link:F,edge:V,bidirectional:ie})=>({link:F,edge:V,bidirectional:ie}))}function Z(t,l,u){let v=N(l),E=U=>v&&U==="user"?"coordinator":U,j=u==null?1/0:Number(u),ee=(t??[]).filter(U=>d(U)&&Number.isFinite(U.seq)).slice().sort((U,ve)=>U.seq-ve.seq),oe=ee.reduce((U,ve)=>Math.max(U,ve.seq),0),Q=j>=oe,se=ee.filter(U=>U.seq<=j),B=se.at(-1)??null,H=new Map,ce=new Map,_=new Map,s=new Map;for(let U of se){let ve=E(U.author);ce.set(ve,U.seq),H.set(ve,U);let be=new Set([...(U.targets??[]).map(E),...U.coordinatorMention?["coordinator"]:[]]);for(let ye of be)U.kind==="brief"&&_.set(ye,U.seq),s.set(ye,U.seq)}let D=l??[],S=D.find(U=>U.role==="coordinator"||U.name==="coordinator")??{name:"coordinator",role:"coordinator",status:"waiting"},I=D.filter(U=>U.role!=="coordinator"&&U.name!=="coordinator"),F=[{id:"working",label:"Working",tone:"working"},{id:"waiting",label:"Waiting",tone:"waiting"},{id:"needs",label:"Needs you",tone:"needs"},{id:"done",label:"Done",tone:"done"}],V=new Map(F.map(U=>[U.id,{...U,count:0,members:[]}])),ie=new Map([["coordinator","coordinator"]]);for(let U of I){let ve=ce.get(U.name)??0,be,ye=!1,ke=[];if(Q)be=U.status??"waiting",ye=!!U.recoveryRequired,ke=[...U.pendingWaitFor??U.waitFor??[]];else{let Ye=H.get(U.name),Xe=_.get(U.name)??0,Be=s.get(U.name)??0;j<=0?be="waiting":Ye&&/\[done\]/i.test(String(Ye.text??""))?be="done":E(B?.author)===U.name||Math.max(Xe,Be)>(Ye?.seq??0)?be="working":be="waiting"}let qe;ye||be==="failed"||be==="quota"?qe="needs":be==="working"?qe="working":be==="done"||be==="retired"?qe="done":qe="waiting";let ze=qe==="done",Pe={name:U.name,status:be,role:U.role??"worker",tint:U.tint,muted:ze,latestSeq:ve,pendingWaitFor:ke},He=V.get(qe);He.members.push(Pe),He.count=He.members.length,ie.set(U.name,qe)}let X=F.map(U=>V.get(U.id)).filter(U=>U.count>0),de=I.length,K=V.get("done").count,le;V.get("needs").count>0?le="stalled":V.get("working").count>0||Q&&S.status==="working"?le="working":de>0&&K===de?le="done":le="waiting";let he={name:"coordinator",status:Q?S.status??le:E(B?.author)==="coordinator"?"working":le,role:"coordinator",doneCount:K,totalWorkers:de,phase:le,latestSeq:ce.get("coordinator")??0,tint:S.tint},me=[],Se=new Set,ue=U=>{let ve=`${U.from}>${U.to}>${U.kind}`;Se.has(ve)||(Se.add(ve),me.push(U))};if(V.get("done").count>0&&ue({from:"done",to:"coordinator",kind:"done",label:"Tasks done"}),B&&(j===1/0||B.seq===j||!Q)){let U=ie.get(E(B.author));if(U){let ve=B.broadcast??/(?:^|[^a-z0-9_])@all(?![a-z0-9_-])/i.test(B.text??""),be=[...(B.targets??[]).map(E),...B.coordinatorMention?["coordinator"]:[]];if(ve){for(let ye of X)ye.id!==U&&ue({from:U,to:ye.id,kind:"message",label:"Message just sent",seq:B.seq});U!=="coordinator"&&ue({from:U,to:"coordinator",kind:"message",label:"Message just sent",seq:B.seq})}else for(let ye of be){let ke=ie.get(ye);ke&&ke!==U&&ue({from:U,to:ke,kind:"message",label:"Message just sent",seq:B.seq})}}}for(let U of X)for(let ve of U.members)for(let be of ve.pendingWaitFor??[]){let ye=ie.get(be);ye&&ue({from:U.id,to:ye,kind:"waiting",label:"Waiting on"})}return{currentSeq:B?.seq??0,lastPost:B,coordinator:he,clusters:X,connectors:me}}function re(t,l,u){let v=[];for(let E=0;E<6;E++){let j=E*Math.PI/3;v.push({x:t+u*Math.cos(j),y:l+u*Math.sin(j)})}return v}function pe(t){if(t<=0)return[];if(t<=3)return[t];if(t===4)return[2,2];if(t===5)return[3,2];if(t===6)return[3,3];if(t===7)return[4,3];if(t===8)return[4,4];if(t===9)return[3,4,2];if(t===10)return[4,4,2];if(t===11)return[4,4,3];if(t===12)return[4,4,4];let l=[],u=t;for(;u>0;){let v=Math.min(4,u);l.push(v),u-=v}return l}function ne(t,l,u,v){let E=v.length;if(!E)return[];let j=o/2*u,ee=pe(E),oe=ee.length,Q=-j*.14,se=j*.5,B=oe===1?j*.1:(Q+se)/2,H=se-Q,ce=E>6?Math.max(.7,Math.min(.98,u/106)):Math.max(.82,Math.min(1.08,u/98)),_=[],s=0;for(let D=0;D<oe;D++){let S=ee[D],I=oe===1?l+B:l+Q+D/(oe-1)*H,F=I-l,V=Math.max(18,u-Math.max(Math.abs(F-15),Math.abs(F+18))/o-8),ie=E>6?42:52,X=S===1?0:Math.min(ie,(V*2-4)/S),de=S===1?Math.min(88,V*1.85):Math.max(30,X-2);for(let K=0;K<S;K++){let le=t+(K-(S-1)/2)*X;_.push({member:v[s++],x:le,y:I,slotWidth:de,beeScale:ce})}}return _}function L(t,l){return t<=1?l<420?380:440:t===2?l<420?440:430:490}function R(t,l=680,u=460){let v=t?.clusters??[],E=34,j=14,oe=Math.max(200,l-16*2),Q=Math.max(220,u-j-E),se,B=[];if(v.length===0)se=Math.max(48,Math.min(oe/2.2,Q/(o*1.15),114)),B.push({id:"coordinator",ux:0,uy:0,isCoord:!0});else if(v.length===1){let ue=Math.max(12,Math.min(20,Q*.036));se=Math.max(46,Math.min(oe/2.15,(Q-ue)/(2*o),112));let U=o*se+ue,ve=l/2,be=j+Q/2,ye=new Map,ke={x:ve,y:be-U/2},qe={x:ve,y:be+U/2},ze=v[0],Pe={id:ze.id,label:ze.label,tone:ze.tone,count:ze.count,x:ke.x,y:ke.y,radius:se,vertices:re(ke.x,ke.y,se),slots:ne(ke.x,ke.y,se,ze.members??[])},He={id:"coordinator",x:qe.x,y:qe.y,radius:se,vertices:re(qe.x,qe.y,se),model:t.coordinator};return ye.set(Pe.id,Pe),ye.set("coordinator",He),{width:l,height:u,radius:se,coordinator:He,clusters:[Pe],cellsById:ye}}else if(v.length===2)B.push({id:"coordinator",ux:0,uy:.35,isCoord:!0}),oe>=Q*.85?(B.push({id:v[0].id,cluster:v[0],ux:-o/2,uy:-.15}),B.push({id:v[1].id,cluster:v[1],ux:o/2,uy:-.15})):(B.push({id:v[0].id,cluster:v[0],ux:0,uy:-.65}),B.push({id:v[1].id,cluster:v[1],ux:0,uy:1.35}));else if(v.length===3)B.push({id:"coordinator",ux:0,uy:0,isCoord:!0}),B.push({id:v[0].id,cluster:v[0],ux:0,uy:-1}),B.push({id:v[1].id,cluster:v[1],ux:-o/2,uy:.5}),B.push({id:v[2].id,cluster:v[2],ux:o/2,uy:.5});else{B.push({id:"coordinator",ux:0,uy:0,isCoord:!0}),B.push({id:v[0].id,cluster:v[0],ux:-o/2,uy:-.5}),B.push({id:v[1].id,cluster:v[1],ux:o/2,uy:-.5}),B.push({id:v[2].id,cluster:v[2],ux:-o/2,uy:.5}),B.push({id:v[3].id,cluster:v[3],ux:o/2,uy:.5});for(let ue=4;ue<v.length;ue++)B.push({id:v[ue].id,cluster:v[ue],ux:0,uy:ue===4?-1:1})}let H=Math.min(...B.map(ue=>ue.ux)),ce=Math.max(...B.map(ue=>ue.ux)),_=Math.min(...B.map(ue=>ue.uy)),s=Math.max(...B.map(ue=>ue.uy)),D=ce-H,S=s-_,I=Math.max(10,Math.min(18,Q*.03)),F=(oe-D*I)/(D*o+2),V=(Q-S*I)/(S*o+o);se=Math.max(40,Math.min(F,V,108));let ie=o*se+I,X=(H+ce)/2,de=(_+s)/2,K=l/2-X*ie,le=j+Q/2-de*ie,he=new Map,me=null,Se=[];for(let ue of B){let U=K+ue.ux*ie,ve=le+ue.uy*ie,be=re(U,ve,se);if(ue.isCoord)me={id:"coordinator",x:U,y:ve,radius:se,vertices:be,model:t?.coordinator},he.set("coordinator",me);else{let ye=ue.cluster,ke={id:ye.id,label:ye.label,tone:ye.tone,count:ye.count,x:U,y:ve,radius:se,vertices:be,slots:ne(U,ve,se,ye.members??[])};Se.push(ke),he.set(ke.id,ke)}}return{width:l,height:u,radius:se,coordinator:me,clusters:Se,cellsById:he}}function a(t,l,u){let v=o/2*t.radius,E=Math.abs(u),j=Math.abs(.8660254037844386*l+.5*u),ee=Math.abs(.8660254037844386*l-.5*u);return v/Math.max(E,j,ee,1e-6)}function A(t,l,u,v){let j=Math.sqrt(3)*22;t.strokeStyle=v,t.lineWidth=.8,t.beginPath();for(let ee=-1;ee<l/(22*1.5)+1;ee++)for(let oe=-1;oe<u/j+1;oe++){let Q=ee*1.5*22,se=oe*j+ee%2*j/2;for(let B=0;B<6;B++){let H=B*Math.PI/3,ce=Q+22*Math.cos(H),_=se+22*Math.sin(H);B===0?t.moveTo(ce,_):t.lineTo(ce,_)}t.closePath()}t.stroke()}function r(t,l,u,v,E,j){let ee=Math.min(j,v/2,E/2),oe=l-v/2,Q=u-E/2,se=l+v/2,B=u+E/2;t.beginPath(),t.moveTo(oe+ee,Q),t.lineTo(se-ee,Q),t.quadraticCurveTo(se,Q,se,Q+ee),t.lineTo(se,B-ee),t.quadraticCurveTo(se,B,se-ee,B),t.lineTo(oe+ee,B),t.quadraticCurveTo(oe,B,oe,B-ee),t.lineTo(oe,Q+ee),t.quadraticCurveTo(oe,Q,oe+ee,Q),t.closePath()}function M(t,l,u,v,E,j){let ee=t.clientWidth,oe=t.clientHeight;if(!ee||!oe)return;let Q=Math.min(devicePixelRatio||1,2),se=Math.round(ee*Q),B=Math.round(oe*Q);(t.width!==se||t.height!==B)&&(t.width=se,t.height=B);let H=t.getContext("2d");H.setTransform(Q,0,0,Q,0,0),H.clearRect(0,0,ee,oe),A(H,ee,oe,j.grid),H.strokeStyle=j.accent,H.lineWidth=1.4,H.setLineDash([3,3]);for(let _ of l.nodes){let s=u.get(_.name);!s||!m(_)||(H.globalAlpha=!v||v===_.name?.85:.2,H.beginPath(),H.arc(s.x,s.y,31,0,Math.PI*2),H.stroke())}H.setLineDash([]),H.font="600 10px ui-monospace, monospace",H.textAlign="center",H.textBaseline="middle";let ce=W(l,u,{variant:"hex",narrow:ee<465,marginStart:6,marginEnd:6,obstacleMargin:ee<465?14:24});for(let{link:_,edge:s}of ce){let{start:D,control:S,end:I,mid:F,endAngle:V}=s,ie=_.lastSeq===E,X=!v||_.from===v||_.to===v,de=ie&&X?j.accent:j.link;H.globalAlpha=X?ie?1:.78:.16,H.strokeStyle=H.fillStyle=de,H.lineWidth=Math.min(3.8,1.1+Math.sqrt(_.count)*.65),H.lineCap="round",H.setLineDash(_.direct?[]:[4,4]);let K=Math.min(4.5,s.length*.25),le=I.x-Math.cos(V)*K,he=I.y-Math.sin(V)*K;H.beginPath(),H.moveTo(D.x,D.y),H.quadraticCurveTo(S.x,S.y,le,he),H.stroke(),H.setLineDash([]);let me=9;if(H.beginPath(),H.moveTo(I.x,I.y),H.lineTo(I.x-me*Math.cos(V-.44),I.y-me*Math.sin(V-.44)),H.lineTo(I.x-me*.72*Math.cos(V),I.y-me*.72*Math.sin(V)),H.lineTo(I.x-me*Math.cos(V+.44),I.y-me*Math.sin(V+.44)),H.closePath(),H.fill(),X&&s.length>=40&&(_.count>1||ie||v)){let Se=String(_.count),ue=Math.max(20,Se.length*6.5+10);H.globalAlpha=.98,r(H,F.x,F.y,ue,15,7.5),H.fillStyle=j.paper,H.fill(),H.lineWidth=1,H.strokeStyle=ie?j.accent:j.link,H.stroke(),H.fillStyle=ie?j.accent:j.text,H.fillText(Se,F.x,F.y+.25)}}H.globalAlpha=1}function f(t){return t==="dark"?{bg:"#17140f",surface:"#221d16",ink:"#f5eddd",muted:"#bdb19a",border:"#43392b",edge:"#8c785c",pulse:"#c297ff",accent:"#f0b84b",doneFill:"#18281c",doneStroke:"#6ac47e",workingFill:"#2a2213",workingStroke:"#f0b84b",waitingFill:"#192133",waitingStroke:"#7da3f0",needsFill:"#2d1919",needsStroke:"#ef766e"}:{bg:"#f8f9fb",surface:"#ffffff",ink:"#24292f",muted:"#6e7781",border:"#d0d7de",edge:"#b4bcc6",pulse:"#8250df",accent:"#bf8700",doneFill:"#eef6ee",doneStroke:"#55943c",workingFill:"#fdf6e7",workingStroke:"#d18d22",waitingFill:"#eef3fc",waitingStroke:"#4d78cc",needsFill:"#fdf0ef",needsStroke:"#cf483f"}}function te(t,l){return t==="done"?{fill:l.doneFill,stroke:l.doneStroke}:t==="working"?{fill:l.workingFill,stroke:l.workingStroke}:t==="needs"||t==="stalled"?{fill:l.needsFill,stroke:l.needsStroke}:{fill:l.waitingFill,stroke:l.waitingStroke}}function Y(t,l){return t==="working"?l.doneStroke:t==="failed"||t==="quota"?l.needsStroke:t==="waiting"||t==="queued"?l.waitingStroke:l.muted}function Me(t){return t||(typeof window<"u"&&window.HiveBee?window.HiveBee:at.HiveBee)}function fe(t,l,u,v,E,j){if(j?.drawSprite){j.drawSprite(t,l,u,v,E);return}if(j?.sprite&&typeof document<"u"){let ee=j.sprite(v,E),oe=E?.scale??1;t.drawImage?.(ee,l,u,ee.width*oe,ee.height*oe)}}function ae(t,l){let u=String(t??"");return u.length<=l?u:l<=3?u.slice(0,l):u.slice(0,l-1)+"\u2026"}function xe(t,l,u,v,E=8){t.beginPath(),t.moveTo(l,u),t.lineTo(l-E*Math.cos(v-.44),u-E*Math.sin(v-.44)),t.lineTo(l-E*.7*Math.cos(v),u-E*.7*Math.sin(v)),t.lineTo(l-E*Math.cos(v+.44),u-E*Math.sin(v+.44)),t.closePath(),t.fill()}function Ce(t,l){t.beginPath(),l.forEach((u,v)=>{v===0?t.moveTo(u.x,u.y):t.lineTo(u.x,u.y)}),t.closePath()}function Ne(t,l,u,v){let{posts:E=[],members:j=[],cursor:ee=null,phase:oe,width:Q=680,height:se=460,focus:B=null}=l,H=Z(E,j,ee);oe&&ee==null&&(oe==="done"&&H.coordinator.totalWorkers>0&&H.coordinator.doneCount===H.coordinator.totalWorkers?H.coordinator.phase="done":(oe==="stalled"||oe==="budget")&&(H.coordinator.phase="stalled"));let ce=R(H,Q,se);for(let S of H.connectors){let I=ce.cellsById.get(S.from),F=ce.cellsById.get(S.to);if(!I||!F)continue;let V=S.kind==="message"?u.pulse:S.kind==="waiting"?u.workingStroke:u.doneStroke;if(t.strokeStyle=V,t.fillStyle=V,t.lineWidth=S.kind==="message"?2.2:1.5,t.setLineDash?.(S.kind==="waiting"?[4,4]:[]),I===F){let qe=I.x+I.radius*.72,ze=I.y-o/2*I.radius*.4;t.beginPath(),t.arc(qe+8,ze,10,-Math.PI*.8,Math.PI*.8),t.stroke(),t.setLineDash?.([]);continue}let ie=F.x-I.x,X=F.y-I.y,de=Math.hypot(ie,X);if(de<1)continue;let K=ie/de,le=X/de,he=a(I,K,le),me=a(F,-K,-le),Se=S.kind==="message"?8:S.kind==="waiting"?-8:0,ue=-le,U=K,ve=I.x+K*(he+2)+ue*Se,be=I.y+le*(he+2)+U*Se,ye=F.x-K*(me+2)+ue*Se,ke=F.y-le*(me+2)+U*Se;t.beginPath(),t.moveTo(ve,be),t.lineTo(ye,ke),t.stroke(),t.setLineDash?.([]),S.kind!=="done"&&xe(t,ye,ke,Math.atan2(ke-be,ye-ve),7)}t.textAlign="center",t.textBaseline="middle";for(let S of ce.clusters){let I=te(S.tone,u),F=!!B,V=!F||S.slots.some(X=>X.member.name===B);t.globalAlpha=V?1:.38,Ce(t,S.vertices),t.fillStyle=I.fill,t.fill(),t.lineWidth=2,t.strokeStyle=I.stroke,t.stroke();let ie=o/2*S.radius;t.fillStyle=u.ink,t.font='600 12px "Segoe UI", system-ui, sans-serif',t.fillText(S.label,S.x,S.y-ie*.68),t.fillStyle=u.muted,t.font='500 11px "Segoe UI", system-ui, sans-serif',t.fillText(String(S.count),S.x,S.y-ie*.5);for(let X of S.slots){let de=X.beeScale,K=20*de,le=18*de,he=F&&B!==X.member.name;t.globalAlpha=he?.35:1,F&&B===X.member.name&&(t.strokeStyle=u.accent,t.lineWidth=1.5,t.beginPath(),t.arc(X.x,X.y-2,Math.max(K,le)*.72,0,Math.PI*2),t.stroke()),fe(t,X.x-K/2,X.y-le*.68,X.member.name,{status:X.member.status,coordinator:!1,tint:X.member.tint,muted:X.member.muted,scale:de},v),t.fillStyle=X.member.muted?u.muted:u.ink,t.font='500 9.5px "Segoe UI", system-ui, sans-serif';let me=Math.max(6,Math.floor(X.slotWidth/4.6));t.fillText(ae(X.member.name,me),X.x,X.y+le*.62)}}let _=ce.coordinator;if(_){let S=te(_.model?.phase??"waiting",u);t.globalAlpha=!B||B==="coordinator"?1:.45,Ce(t,_.vertices),t.fillStyle=S.fill,t.fill(),t.lineWidth=2,t.strokeStyle=S.stroke,t.stroke();let I=Math.max(1.2,Math.min(2.1,_.radius/48)),F=20*I,V=18*I;fe(t,_.x-F/2,_.y-V*.78,"coordinator",{status:_.model?.status??"waiting",coordinator:!0,tint:_.model?.tint,muted:!1,scale:I},v);let ie=o/2*_.radius;t.fillStyle=u.ink,t.font='650 12px "Segoe UI", system-ui, sans-serif',t.fillText("Coordinator",_.x,_.y+ie*.34),t.fillStyle=u.muted,t.font='500 11px "Segoe UI", system-ui, sans-serif',t.fillText(`${_.model?.doneCount??0} of ${_.model?.totalWorkers??0} done`,_.x,_.y+ie*.56)}t.globalAlpha=1;let s=se-16,D=24;t.textAlign="left",t.textBaseline="middle",t.font='500 11px "Segoe UI", system-ui, sans-serif',t.strokeStyle=u.doneStroke,t.lineWidth=1.6,t.beginPath(),t.moveTo(D,s),t.lineTo(D+16,s),t.stroke(),t.fillStyle=u.muted,t.fillText("Tasks done",D+22,s),D+=102,t.strokeStyle=u.pulse,t.beginPath(),t.moveTo(D,s),t.lineTo(D+16,s),t.stroke(),t.fillText("Message just sent",D+22,s),D+=136,t.strokeStyle=u.workingStroke,t.fillStyle=u.workingStroke,t.setLineDash?.([3,3]),t.beginPath(),t.moveTo(D,s),t.lineTo(D+16,s),t.stroke(),t.setLineDash?.([]),xe(t,D+20,s,0,5),t.fillStyle=u.muted,t.fillText("Waiting on",D+26,s)}function ge(t,l,u,v){let{posts:E=[],members:j=[],cursor:ee=null,width:oe=680,height:Q=460,hideInactive:se=!1,expandBroadcast:B=!1,focus:H=null}=l,ce=(E??[]).filter(d).slice().sort((K,le)=>K.seq-le.seq),_=ee==null?ce.at(-1)?.seq??1/0:Number(ee),s=ce.filter(K=>K.seq<=_).at(-1)??null,D=k(E,j,_,{hideInactive:se,expandBroadcast:B}),S=Math.max(220,Q-42),I=oe<465,F=P(D.nodes,oe,S),V=new Map;for(let K of D.nodes)V.set(K.name,z(K,{variant:"pill",narrow:I}));let ie=W(D,F,{variant:"pill",boxes:V,narrow:I,marginStart:4,marginEnd:6,obstacleMargin:10});t.textAlign="center",t.textBaseline="middle";for(let{link:K,edge:le}of ie){let{start:he,control:me,end:Se,mid:ue,endAngle:U}=le,ve=!!(s&&K.lastSeq===s.seq),be=!H||K.from===H||K.to===H,ye=ve&&be?u.pulse:u.edge;t.globalAlpha=be?ve?.96:.72:.16,t.strokeStyle=t.fillStyle=ye,t.lineWidth=Math.min(4.2,1.2+Math.sqrt(K.count)*.72),t.setLineDash?.(K.direct?[]:[4,4]);let ke=Math.min(4.5,le.length*.25),qe=Se.x-Math.cos(U)*ke,ze=Se.y-Math.sin(U)*ke;if(t.beginPath(),t.moveTo(he.x,he.y),t.quadraticCurveTo(me.x,me.y,qe,ze),t.stroke(),t.setLineDash?.([]),xe(t,Se.x,Se.y,U,8),be&&le.length>=36&&(K.count>1||ve||H)){let Pe=String(K.count),He=Math.max(16,Pe.length*6.5+8);t.globalAlpha=.96,r(t,ue.x,ue.y,He,14,7),t.fillStyle=u.bg,t.fill(),t.fillStyle=ve?u.pulse:u.ink,t.font="600 10px ui-monospace, monospace",t.fillText(Pe,ue.x,ue.y+.5)}}for(let K of D.nodes){let le=F.get(K.name),he=V.get(K.name);if(!le||!he)continue;let me=K.role==="coordinator"||K.name==="coordinator",Se=K.status==="retired",ue=K.status==="done"||Se,U=!H||H===K.name||D.links.some(Be=>Be.from===H&&Be.to===K.name||Be.to===H&&Be.from===K.name);t.globalAlpha=U?Se?.56:1:.24;let ve=m(K);r(t,le.x,le.y,he.halfW*2,he.halfH*2,he.radius),t.fillStyle=u.surface,t.fill(),t.lineWidth=H===K.name?1.8:1.1,t.strokeStyle=H===K.name?u.pulse:u.border,t.setLineDash?.(ve?[3,3]:[]),t.stroke(),t.setLineDash?.([]);let be=le.x-he.halfW,ye=le.x+he.halfW,ke=I?.85:.92,qe=20*ke,ze=18*ke;fe(t,be+10,le.y-ze/2,K.name,{status:K.status??"observer",coordinator:me,tint:K.tint,muted:!me&&ue,scale:ke},v);let Pe=K.name==="user"?"You":K.name==="system"?"System":K.name,He=(be+10+qe+6+ye-14)/2;t.fillStyle=Se?u.muted:u.ink,t.font='600 11px "Segoe UI", system-ui, sans-serif';let Ye=Math.max(5,Math.floor((he.halfW*2-qe-28)/6.2)),Xe=ae(Pe,Ye);if(t.fillText(Xe,He,le.y+.5),Se){let Be=Math.min(he.halfW*2-qe-28,Xe.length*6.2);t.strokeStyle=u.muted,t.lineWidth=1,t.beginPath(),t.moveTo(He-Be/2,le.y+.5),t.lineTo(He+Be/2,le.y+.5),t.stroke()}t.fillStyle=Y(K.status,u),t.beginPath(),t.arc(ye-10,le.y,3,0,Math.PI*2),t.fill()}t.globalAlpha=1;let X=Q-22,de=24;if(t.textAlign="left",t.textBaseline="middle",t.font='500 11px "Segoe UI", system-ui, sans-serif',t.strokeStyle=u.edge,t.fillStyle=u.edge,t.lineWidth=1.4,t.beginPath(),t.moveTo(de,X),t.lineTo(de+14,X),t.stroke(),xe(t,de+18,X,0,5),t.fillStyle=u.muted,t.fillText("@mention, width = count",de+24,X),de+=168,t.strokeStyle=u.edge,t.fillStyle=u.edge,t.setLineDash?.([3,3]),t.beginPath(),t.moveTo(de,X),t.lineTo(de+14,X),t.stroke(),t.setLineDash?.([]),xe(t,de+18,X,0,5),t.fillStyle=u.muted,t.fillText("via @all",de+24,X),de+=78,t.strokeStyle=u.border,t.setLineDash?.([2,2]),r(t,de+8,X,16,10,5),t.stroke(),t.setLineDash?.([]),t.fillStyle=u.muted,t.fillText("posted with no mention",de+22,X),D.broadcasts>0&&Q>=60){let K="@all "+D.broadcasts,le=Q-7;r(t,40,le-1,36,14,7),t.fillStyle=u.border,t.fill(),t.fillStyle=u.ink,t.font="600 9.5px ui-monospace, monospace",t.textAlign="center",t.fillText(K,40,le),t.textAlign="left",t.fillStyle=u.muted,t.font='500 10.5px "Segoe UI", system-ui, sans-serif',t.fillText("@all posts, drawn by Expand @all",64,le)}}function we(t,l={}){if(!t)return;let u=l.width??680,v=l.height??460,E=l.theme==="dark"?"dark":"light",j=l.mode==="mentions"?"mentions":"hive",ee=f(E),oe=Me(l.bees);t.save?.(),t.clearRect?.(0,0,u,v),t.fillStyle=ee.bg,t.fillRect(0,0,u,v),j==="mentions"?ge(t,l,ee,oe):Ne(t,l,ee,oe),t.restore?.()}at.HiveGraph=Object.freeze({isPost:d,shouldMergeUserToCoordinator:N,project:k,elapsedSpan:p,unmentionedNode:m,minimumHeight:c,layout:x,nodeBox:z,roundedRectSignedDistance:g,clipEdge:h,routeEdges:W,draw:M,smartTaskLabel:n,mentionsMinimumHeight:b,layoutMentions:P,projectHive:Z,hiveMinimumHeight:L,layoutHive:R,renderGraphFrame:we})})();xt.exports=at.HiveGraph});var St=nt((Qo,Mt)=>{var kt={};(()=>{"use strict";let o=[["#efac37","#ffe18d","#bb641d"],["#75baef","#cdefff","#3974bb"],["#55cbb2","#b8f8df","#268c7d"],["#e68db3","#ffcee2","#a24275"],["#b3ce64","#e9f6a1","#6c9137"],["#ad9ce8","#e3d4ff","#6d58af"],["#f09a71","#ffd3b7","#af5833"],["#95cbd1","#defbfa","#4a8d9d"],["#d1a76a","#ffe2a9","#987044"]],i=["#aaafb6","#d6dae0","#848991"];function d(C,y,c){if(y)return o[0];if(Number.isInteger(c))return o[1+Math.abs(c)%(o.length-1)];let x=[...String(C??"")].reduce((w,b)=>w*31+b.charCodeAt(0),0)>>>0;return o[x%o.length]}function p(C){let y=String(C).replace("#",""),c=Number.parseInt(y,16);return[c>>16&255,c>>8&255,c&255]}function m(C,y,c){let[x,w,b]=d(C,y,c),[P,q,z]=p(x),[J,g,T]=p(b),G=Math.round(J*.78),$=Math.round(g*.78),O=Math.round(T*.78),h="#"+[G,$,O].map(W=>W.toString(16).padStart(2,"0")).join("");return{base:x,highlight:w,shade:b,bg:`rgba(${P}, ${q}, ${z}, 0.14)`,border:`rgba(${P}, ${q}, ${z}, 0.42)`,text:h}}function n(C,y,c,x=0,w=0,b=1){C.fillStyle=y;for(let[P,q,z,J]of c)x===0&&w===0&&b===1?C.fillRect(P,q,z,J):C.fillRect(x+P*b,w+q*b,z*b,J*b)}function N(C,y,c,x,{status:w="working",coordinator:b=!1,tint:P,muted:q=!1,scale:z=1}={}){if(!C)return;let[J,g,T]=q?i:d(x,b,P),G=!q&&["waiting","quota","retired","done"].includes(w),$=q?"#727880":"#201915",O=q?"#828a94":"#24313d",h=q?"#ced3d9":"#a9c6db",W=q?"#eef1f4":"#e7f2fa",Z=q?"#767c84":"#2c221c";n(C,$,[[3,2,1,3],[6,3,1,2],[5,1,2,1],[2,3,1,1],[5,5,10,8],[3,7,13,5],[4,12,11,2],[6,14,7,1],[16,9,2,2],[7,14,1,2],[12,14,1,2]],y,c,z),n(C,O,[[7,3,6,4],[8,2,4,6],[12,3,4,4],[13,2,2,1]],y,c,z),n(C,h,[[8,3,3,4],[12,4,3,2],[9,7,2,1]],y,c,z),n(C,W,[[9,3,2,2],[12,4,2,1],[8,4,1,2]],y,c,z),n(C,J,[[4,7,8,5],[5,6,6,7],[12,7,3,5],[13,12,1,1],[6,13,1,1]],y,c,z),n(C,g,[[5,7,3,1],[4,9,2,2],[10,7,2,1],[13,8,1,2],[5,12,2,1]],y,c,z),n(C,T,[[6,12,7,1],[12,11,3,1],[13,12,1,1]],y,c,z),n(C,Z,[[8,6,2,7],[12,7,1,6],[15,9,2,1]],y,c,z),G?(n(C,$,[[4,10,2,1]],y,c,z),n(C,"#d7dcff",b?[[0,0,2,1],[1,1,1,1],[0,2,2,1],[15,0,4,1],[17,1,1,2],[15,3,4,1]]:[[1,1,3,1],[2,2,1,1],[1,3,3,1],[15,0,4,1],[17,1,1,2],[15,3,4,1]],y,c,z)):(n(C,q?"#555b63":"#201915",[[5,8,1,2]],y,c,z),n(C,q?"#e5e8ec":"#fff6d7",[[5,8,1,1]],y,c,z)),b&&(n(C,q?"#727880":"#6d4219",[[2,1,1,4],[8,1,1,4],[2,4,7,1]],y,c,z),n(C,q?"#c7cbd1":"#ffd86b",[[2,0,1,2],[5,0,1,3],[8,0,1,2],[3,2,5,2],[4,1,3,1]],y,c,z),n(C,q?"#9da3ab":"#e7a52f",[[3,4,5,1],[3,3,5,1]],y,c,z),n(C,q?"#eceef1":"#fff3bf",[[3,2,1,1],[7,2,1,1],[5,3,1,1]],y,c,z))}function k(C,{status:y="working",coordinator:c=!1,tint:x,muted:w=!1}={}){let b=document.createElement("canvas");b.className="bee-pixel",b.width=20,b.height=18,b.setAttribute("aria-hidden","true");let P=!w&&["waiting","quota","retired","done"].includes(y);b.dataset.pose=w?"muted":P?"sleeping":"awake",w&&(b.dataset.muted="true");let q=b.getContext("2d");return N(q,0,0,C,{status:y,coordinator:c,tint:x,muted:w,scale:1}),b}kt.HiveBee=Object.freeze({sprite:k,colors:d,tintStyle:m,drawSprite:N})})();Mt.exports=kt.HiveBee});var Ct=nt((Zo,Nt)=>{var Ze={};(()=>{"use strict";function o(c){return c||(typeof window<"u"&&window.HiveGraph?window.HiveGraph:Ze.HiveGraph)}function i(c){return c||(typeof window<"u"&&window.HiveBee?window.HiveBee:Ze.HiveBee)}function d(c,x=128){let w=Math.max(2,Math.min(256,x|0)),b=new Map,P=Math.min(c.length,16),q=c.length<=P?1:(c.length-1)/(P-1),z=new Set;for(let ne=0;ne<P;ne++)z.add(Math.round(ne*q));z.add(0),z.add(c.length-1);let J=c[0].rgba,g=J.length>=4&&J[3]>=128?J[0]<<16|J[1]<<8|J[2]:16777215;for(let ne of z){let L=c[ne].rgba,R=-1,a=0;for(let A=0;A+3<L.length;A+=4){let r=L[A+3]<128?g:L[A]<<16|L[A+1]<<8|L[A+2];r===R?a++:(R!==-1&&b.set(R,(b.get(R)??0)+a),R=r,a=1)}R!==-1&&b.set(R,(b.get(R)??0)+a)}let T;if(b.size<=w)T=[...b.keys()];else{let ne=[...b.entries()].sort((M,f)=>f[1]-M[1]),L=Math.min(ne.length,Math.max(2,Math.floor(w*.48)));T=ne.slice(0,L).map(M=>M[0]);let R=new Set(T),a=new Map;for(let M=L;M<ne.length;M++){let[f,te]=ne[M],Y=f>>19&31,Me=f>>11&31,fe=f>>3&31,ae=Y<<10|Me<<5|fe,xe=a.get(ae);xe||(xe={rSum:0,gSum:0,bSum:0,w:0},a.set(ae,xe)),xe.rSum+=(f>>16&255)*te,xe.gSum+=(f>>8&255)*te,xe.bSum+=(f&255)*te,xe.w+=te}let A=[];for(let M of a.values())A.push({r:Math.round(M.rSum/M.w),g:Math.round(M.gSum/M.w),b:Math.round(M.bSum/M.w),w:M.w});let r=w-T.length;if(A.length<=r)for(let M of A){let f=M.r<<16|M.g<<8|M.b;R.has(f)||(R.add(f),T.push(f))}else{let M=te=>{let Y=255,Me=0,fe=255,ae=0,xe=255,Ce=0,Ne=0;for(let u of te)u.r<Y&&(Y=u.r),u.r>Me&&(Me=u.r),u.g<fe&&(fe=u.g),u.g>ae&&(ae=u.g),u.b<xe&&(xe=u.b),u.b>Ce&&(Ce=u.b),Ne+=u.w;let ge=Me-Y,we=ae-fe,t=Ce-xe,l=we>=ge&&we>=t?"g":ge>=t?"r":"b";return{list:te,span:Math.max(ge,we,t),axis:l,totalW:Ne}},f=[M(A)];for(;f.length<r;){let te=-1,Y=-1;for(let Ne=0;Ne<f.length;Ne++){let ge=f[Ne];if(ge.list.length>1&&ge.span>0){let we=ge.span*Math.log2(ge.totalW+2);we>Y&&(Y=we,te=Ne)}}if(te===-1)break;let Me=f.splice(te,1)[0],fe=Me.axis;Me.list.sort((Ne,ge)=>Ne[fe]-ge[fe]);let ae=Me.totalW/2,xe=0,Ce=1;for(let Ne=0;Ne<Me.list.length-1;Ne++)if(xe+=Me.list[Ne].w,xe>=ae){Ce=Ne+1;break}f.push(M(Me.list.slice(0,Ce)),M(Me.list.slice(Ce)))}for(let te of f){let Y=0,Me=0,fe=0,ae=0;for(let we of te.list)Y+=we.r*we.w,Me+=we.g*we.w,fe+=we.b*we.w,ae+=we.w;let xe=Math.round(Y/ae),Ce=Math.round(Me/ae),Ne=Math.round(fe/ae),ge=xe<<16|Ce<<8|Ne;R.has(ge)||(R.add(ge),T.push(ge))}}}T.length||(T=[16777215]);let G=1;for(;1<<G<T.length&&G<8;)G++;let $=1<<G,O=Math.max(2,G),h=G-1,W=new Uint8Array(T.length),Z=new Uint8Array(T.length),re=new Uint8Array(T.length),pe=new Map;for(let ne=0;ne<T.length;ne++){let L=T[ne];W[ne]=L>>16&255,Z[ne]=L>>8&255,re[ne]=L&255,pe.set(L,ne)}return{colors:T,paletteR:W,paletteG:Z,paletteB:re,tableLength:$,minCodeSize:O,tableSizeFlag:h,bgRgb:g,exactLookup:pe}}function p(c,x,w){let{paletteR:b,paletteG:P,paletteB:q,bgRgb:z,exactLookup:J}=w,g=b.length,T=new Uint8Array(x),G=-1,$=0;for(let O=0,h=0;O<x;O++,h+=4){let W=c[h+3]<128?z:c[h]<<16|c[h+1]<<8|c[h+2];if(W===G){T[O]=$;continue}let Z=J.get(W);if(Z===void 0){let re=W>>16&255,pe=W>>8&255,ne=W&255,L=1/0;Z=0;for(let R=0;R<g;R++){let a=re-b[R],A=pe-P[R],r=ne-q[R],M=a*a+A*A+r*r;if(M<L&&(L=M,Z=R,M===0))break}J.size<65536&&J.set(W,Z)}G=W,$=Z,T[O]=Z}return T}class m{constructor(x=32768){this.buf=new Uint8Array(x),this.pos=0}ensure(x){if(this.pos+x<=this.buf.length)return;let w=this.buf.length*2;for(;w<this.pos+x;)w*=2;let b=new Uint8Array(w);b.set(this.buf.subarray(0,this.pos)),this.buf=b}byte(x){this.ensure(1),this.buf[this.pos++]=x&255}u16(x){this.ensure(2),this.buf[this.pos++]=x&255,this.buf[this.pos++]=x>>8&255}bytes(x){this.ensure(x.length),this.buf.set(x,this.pos),this.pos+=x.length}ascii(x){this.ensure(x.length);for(let w=0;w<x.length;w++)this.buf[this.pos++]=x.charCodeAt(w)}finish(){return this.buf.slice(0,this.pos)}}function n(c,x,w){let b=1<<x,P=b+1,q=8192,z=q-1,J=new Int32Array(q).fill(-1),g=new Int16Array(q),T=new Uint8Array(255),G=0,$=0,O=0;function h(){G&&(w.byte(G),w.bytes(T.subarray(0,G)),G=0)}function W(L,R){for($|=L<<O,O+=R;O>=8;)T[G++]=$&255,G===255&&h(),$>>>=8,O-=8}let Z=x+1,re=P+1,pe=1<<Z;if(W(b,Z),!c.length){W(P,Z),O>0&&(T[G++]=$&255),h(),w.byte(0);return}let ne=c[0];for(let L=1;L<c.length;L++){let R=c[L],a=ne<<8|R,A=(ne<<5^R^ne>>>3)&z,r=(ne^R<<3|1)&z,M=!1;for(;J[A]!==-1;){if(J[A]===a){ne=g[A],M=!0;break}A=A+r&z}M||(W(ne,Z),re<4096?(J[A]=a,g[A]=re++,re>pe&&Z<12&&(Z++,pe=1<<Z)):(W(b,Z),J.fill(-1),Z=x+1,re=P+1,pe=1<<Z),ne=R)}W(ne,Z),W(P,Z),O>0&&(T[G++]=$&255,G===255&&h()),h(),w.byte(0)}function N(c,{width:x,height:w,loop:b=0,maxColors:P=128}={}){if(!Array.isArray(c)||!c.length)throw new Error("encodeGif requires at least one frame.");let q=Math.floor(Number(x)),z=Math.floor(Number(w));if(!Number.isFinite(q)||q<=0||q>65535||!Number.isFinite(z)||z<=0||z>65535)throw new Error("encodeGif requires valid width and height (1..65535).");let J=q*z;for(let G=0;G<c.length;G++)if(!c[G]?.rgba||c[G].rgba.length<J*4)throw new Error(`Frame ${G} RGBA buffer is smaller than ${q}x${z}x4 bytes.`);let g=d(c,P),T=new m(Math.max(16384,J));T.ascii("GIF89a"),T.u16(q),T.u16(z),T.byte(240|g.tableSizeFlag),T.byte(0),T.byte(0);for(let G=0;G<g.tableLength;G++)G<g.colors.length?(T.byte(g.paletteR[G]),T.byte(g.paletteG[G]),T.byte(g.paletteB[G])):(T.byte(0),T.byte(0),T.byte(0));if(b!==!1&&b!==null&&b!==void 0){let G=Math.max(0,Math.min(65535,Math.floor(Number(b))));T.byte(33),T.byte(255),T.byte(11),T.ascii("NETSCAPE2.0"),T.byte(3),T.byte(1),T.u16(G),T.byte(0)}for(let G of c){let $=Math.max(1,Math.min(65535,Math.round(G.delayCs??50)));T.byte(33),T.byte(249),T.byte(4),T.byte(4),T.u16($),T.byte(0),T.byte(0),T.byte(44),T.u16(0),T.u16(0),T.u16(q),T.u16(z),T.byte(0),T.byte(g.minCodeSize);let O=p(G.rgba,J,g);n(O,g.minCodeSize,T)}return T.byte(59),T.finish()}function k(c){let x=String(c??"").trim();if(x.startsWith("#")){let b=x.slice(1);if(b.length===3)return[Number.parseInt(b[0]+b[0],16),Number.parseInt(b[1]+b[1],16),Number.parseInt(b[2]+b[2],16),255];if(b.length>=6)return[Number.parseInt(b.slice(0,2),16),Number.parseInt(b.slice(2,4),16),Number.parseInt(b.slice(4,6),16),b.length===8?Number.parseInt(b.slice(6,8),16):255]}let w=/^rgba?\(([^)]+)\)$/i.exec(x);if(w){let b=w[1].split(",").map(P=>Number.parseFloat(P.trim()));return[b[0]||0,b[1]||0,b[2]||0,b.length>=4?Math.round(b[3]*255):255]}return[0,0,0,255]}function C(c,x){let w=new Uint8ClampedArray(c*x*4),b=[],P={fillStyle:"#000000",strokeStyle:"#000000",lineWidth:1,globalAlpha:1},q=[],z=0,J=0,g=0,T=0;function G(h,W,Z){let re=Math.round(h),pe=Math.round(W);if(re<0||re>=c||pe<0||pe>=x)return;let ne=Z[3]/255*P.globalAlpha;if(ne<=0)return;let L=(pe*c+re)*4;if(ne>=.995)w[L]=Z[0],w[L+1]=Z[1],w[L+2]=Z[2],w[L+3]=255;else{let R=1-ne;w[L]=Math.round(w[L]*R+Z[0]*ne),w[L+1]=Math.round(w[L+1]*R+Z[1]*ne),w[L+2]=Math.round(w[L+2]*R+Z[2]*ne),w[L+3]=255}}function $(h,W,Z,re,pe,ne){let L=Math.max(1,Math.ceil(Math.hypot(Z-h,re-W))),R=Math.max(0,Math.floor((ne-1)/2));for(let a=0;a<=L;a++){let A=h+(Z-h)*a/L,r=W+(re-W)*a/L;for(let M=-R;M<=R;M++)for(let f=-R;f<=R;f++)G(A+f,r+M,pe)}}let O={get fillStyle(){return P.fillStyle},set fillStyle(h){P.fillStyle=h},get strokeStyle(){return P.strokeStyle},set strokeStyle(h){P.strokeStyle=h},get lineWidth(){return P.lineWidth},set lineWidth(h){P.lineWidth=h},get globalAlpha(){return P.globalAlpha},set globalAlpha(h){P.globalAlpha=h},font:"",textAlign:"left",textBaseline:"alphabetic",lineCap:"butt",save(){b.push({...P})},restore(){b.length&&(P=b.pop())},setLineDash(){},clearRect(h,W,Z,re){let pe=Math.max(0,Math.floor(h)),ne=Math.max(0,Math.floor(W)),L=Math.min(c,Math.ceil(h+Z)),R=Math.min(x,Math.ceil(W+re));for(let a=ne;a<R;a++)for(let A=pe;A<L;A++){let r=(a*c+A)*4;w[r]=w[r+1]=w[r+2]=w[r+3]=0}},fillRect(h,W,Z,re){let pe=k(P.fillStyle),ne=Math.max(0,Math.floor(h)),L=Math.max(0,Math.floor(W)),R=Math.min(c,Math.ceil(h+Z)),a=Math.min(x,Math.ceil(W+re));for(let A=L;A<a;A++)for(let r=ne;r<R;r++)G(r,A,pe)},beginPath(){q=[]},moveTo(h,W){z=g=h,J=T=W,q.push([{x:h,y:W}])},lineTo(h,W){q.length||q.push([{x:z,y:J}]),q[q.length-1].push({x:h,y:W}),z=h,J=W},quadraticCurveTo(h,W,Z,re){q.length||q.push([{x:z,y:J}]);let pe=q[q.length-1],ne=z,L=J;for(let R=1;R<=12;R++){let a=R/12,A=1-a;pe.push({x:A*A*ne+2*A*a*h+a*a*Z,y:A*A*L+2*A*a*W+a*a*re})}z=Z,J=re},arc(h,W,Z,re,pe){let ne=[];for(let R=0;R<=18;R++){let a=re+(pe-re)*R/18;ne.push({x:h+Z*Math.cos(a),y:W+Z*Math.sin(a)})}q.push(ne),ne.length&&(z=ne.at(-1).x,J=ne.at(-1).y,g=ne[0].x,T=ne[0].y)},closePath(){q.length&&q[q.length-1].length&&(q[q.length-1].push({x:g,y:T}),z=g,J=T)},fill(){let h=k(P.fillStyle);for(let W of q){if(W.length<3)continue;let Z=x,re=0;for(let L of W)L.y<Z&&(Z=L.y),L.y>re&&(re=L.y);let pe=Math.max(0,Math.floor(Z)),ne=Math.min(x-1,Math.ceil(re));for(let L=pe;L<=ne;L++){let R=[];for(let a=0,A=W.length-1;a<W.length;A=a++){let r=W[a],M=W[A];(r.y<=L&&M.y>L||M.y<=L&&r.y>L)&&R.push(r.x+(L-r.y)/(M.y-r.y)*(M.x-r.x))}R.sort((a,A)=>a-A);for(let a=0;a+1<R.length;a+=2){let A=Math.max(0,Math.ceil(R[a])),r=Math.min(c-1,Math.floor(R[a+1]));for(let M=A;M<=r;M++)G(M,L,h)}}}},stroke(){let h=k(P.strokeStyle),W=P.lineWidth||1;for(let Z of q)for(let re=1;re<Z.length;re++)$(Z[re-1].x,Z[re-1].y,Z[re].x,Z[re].y,h,W)},fillText(h,W,Z){let re=String(h??"");if(!re)return;let pe=k(P.fillStyle),ne=Math.min(re.length*5,120),L=P.textAlign==="center"?W-ne/2:P.textAlign==="right"?W-ne:W,R=Z-3;for(let a=Math.max(0,Math.floor(L));a<Math.min(c,Math.ceil(L+ne));a+=2)for(let A=Math.max(0,Math.floor(R));A<Math.min(x,Math.ceil(R+5));A+=2)G(a,A,pe)},drawImage(){},getImageData(h,W,Z,re){return h===0&&W===0&&Z===c&&re===x?{data:new Uint8ClampedArray(w),width:c,height:x}:{data:new Uint8ClampedArray(Z*re*4),width:Z,height:re}}};return{width:c,height:x,getContext:()=>O}}function y({mode:c="hive",posts:x=[],members:w=[],phase:b="done",pacing:P="even",speed:q=1,hideInactive:z=!1,expandBroadcast:J=!1,focus:g=null,theme:T="light",width:G=680,height:$=460,graph:O,bees:h,createCanvas:W,maxFrames:Z=90}={}){let re=o(O),pe=i(h);if(typeof re?.renderGraphFrame!="function")throw new Error("HiveGraph.renderGraphFrame is required to export a graph replay GIF.");let ne=re.isPost??(fe=>fe&&(fe.kind==="brief"||fe.kind==="message"||!fe.kind&&fe.author!=="system")),L=(x??[]).filter(ne).slice().sort((fe,ae)=>(fe.seq??0)-(ae.seq??0)),R=[{seq:0,post:null}],a=Math.max(2,Math.floor(Number(Z)||90));if(L.length>0)if(L.length+1<=a)for(let fe of L)R.push({seq:fe.seq,post:fe});else{let fe=a-1,ae=new Set([0,L.length-1]);for(let xe=1;xe<fe-1;xe++)ae.add(Math.round(xe*(L.length-1)/(fe-1)));for(let xe of[...ae].sort((Ce,Ne)=>Ce-Ne))R.push({seq:L[xe].seq,post:L[xe]})}let r=(W??(typeof document<"u"?(fe,ae)=>{let xe=document.createElement("canvas");return xe.width=fe,xe.height=ae,xe}:C))(G,$);r.width!==G&&(r.width=G),r.height!==$&&(r.height=$);let M=r.getContext("2d");if(!M)throw new Error("Could not obtain 2D canvas context for GIF export.");let f=Math.max(.25,Number(q)||1),te=[];for(let fe=0;fe<R.length;fe++){let ae=R[fe],xe=fe===R.length-1,Ce=fe>0?R[fe-1].post:null,Ne=620;if(P==="real"&&ae.post?.time&&Ce?.time){let l=Date.parse(ae.post.time)-Date.parse(Ce.time);Number.isFinite(l)&&(Ne=Math.max(110,Math.min(l,2e3)))}let ge=Math.round(Ne/f/10),we=xe?Math.max(150,ge):Math.max(4,Math.min(300,ge));re.renderGraphFrame(M,{mode:c,posts:x,members:w,cursor:xe&&L.length?null:ae.seq,phase:xe?b:"working",width:G,height:$,theme:T,hideInactive:z,expandBroadcast:J,focus:g,bees:pe});let t=M.getImageData(0,0,G,$);te.push({rgba:t.data instanceof Uint8ClampedArray?t.data:new Uint8ClampedArray(t.data),delayCs:we})}let Y=N(te,{width:G,height:$,loop:0}),Me=typeof Blob<"u"?new Blob([Y],{type:"image/gif"}):void 0;return{bytes:Y,blob:Me,frameCount:te.length,width:G,height:$}}Ze.HiveGif=Object.freeze({encodeGif:N,exportGraphReplayGif:y})})();Nt.exports=Ze.HiveGif});var $o={};eo($o,{apply:()=>Jo,inject:()=>Uo,name:()=>Ge});module.exports=to($o);var oo={snapshot:"hive-swarm/v1/snapshot",command:"hive-swarm/v1/command",wait:"hive-swarm/v1/events"},Qe="deepseek-harness",rt=o=>(o?.events??[]).reduce((i,d)=>Math.max(i,d.seq),o?.head??0),Fe=o=>({message:typeof o=="string"?o:o?.message??"The Swarm connection is unavailable.",code:typeof o?.code=="string"?o.code:"connection"}),mt=()=>globalThis.crypto.randomUUID(),Le=o=>o?.session?.host===Qe?o.session.id:void 0;function io(o,i){let d=Le(i);return d?i?.executionMode==="subagent"&&typeof o?.parentSessionId=="string"&&o.parentSessionId.trim()?{parentSessionId:o.parentSessionId.trim(),childSessionId:d,mode:"continuable"}:d:(i?.role==="coordinator"||i?.name==="coordinator")&&typeof o?.parentSessionId=="string"&&o.parentSessionId.trim()?o.parentSessionId.trim():null}async function vt(o,i,d,p){if(typeof o?.rpc?.call!="function")throw Error("DSH Connection RPC is unavailable. Enable the Connection capability and reload Hive Swarm.");let m=await o.rpc.call("/api",oo[i],d,p);if(p.aborted)throw p.reason??new DOMException("Cancelled","AbortError");if(!m?.ok){let n=Error(Fe(m?.error).message);throw n.code=m?.error?.code,n}return m.value}async function gt(o,i,d){let{team:p}=await vt(o,"snapshot",{teamId:i},d)??{};if(p?.id!==i||p.host!==Qe||typeof p.cwd!="string"||!p.cwd.trim())throw Error("The Swarm team is unavailable in this Host. Check its workspace and access.");return p}function no(o){return Array.isArray(o)?o.map((i,d)=>{let p=Array.isArray(i.items)?i.items:[],m=Number(i.turn??i.id);return{turn:Number.isSafeInteger(m)&&m>0?m:d+1,status:i.status,steps:i.steps??p.filter(n=>n.type==="activity"),report:i.report??p.findLast(n=>n.type==="agentMessage"&&n.phase==="final")?.text}}):[]}function st(o){return typeof o!="string"||!o?null:(/^(?:[a-z]:[\\/]|\\\\)/i.test(o)?o.replaceAll("\\","/").toLowerCase():o).replace(/\/+$/,"")||"/"}function bt({connection:o,teamId:i=null,sessionId:d=null,workspace:p=null,openSession:m}={}){let n=st(p),N=r=>!n||st(r.cwd)===n,k=i||null,C=0,y=!1,c=0,x=null,w=null,b=null,P=0,q=null,z=!1,J=null,g={teams:[],team:null,selectedId:k,sessionId:d,workspace:p,loading:!1,connection:"idle",error:null,pending:!1,models:[],modelsLoading:!1,journal:null,history:[],hasMoreHistory:!1,historyLoading:!1,version:null,update:null},T=new Set,G=new Set,$=r=>{if(!y){g={...g,...r};for(let M of T)M()}},O=(r,M)=>!y&&C>0&&r===c&&!M.aborted;function h(){c++,x?.abort(),x=null,clearTimeout(J),J=null;for(let r of G)r.abort();G.clear()}let W=(r,M,f)=>vt(o,r,M,f);function Z(r){let M=new Map(g.history.map(f=>[f.seq,f]));for(let f of r)M.set(f.seq,f);return[...M.values()].sort((f,te)=>f.seq-te.seq)}function re(r){if(!r||r.id!==k)throw Error("The Host returned a different team. Select the team again.");if(r.host!==Qe)throw Error("This team does not belong to the native DSH Host.");if(!N(r))throw Error("This team is outside the parent workspace. Choose a team from this workspace.");w??=rt(r),!(g.team&&rt(r)<rt(g.team))&&$({team:r,history:Z(r.events??[])})}async function pe(r,M){let f=await W("snapshot",k?{teamId:k}:{},r);if(!O(M,r))return;if(!Array.isArray(f?.teams))throw Error("The Swarm snapshot is invalid. Refresh to reconnect.");let te=f.teams.filter(Y=>Y.host===Qe&&N(Y));if(k){try{re(f.team)}catch(Y){throw $({teams:te,team:null}),Y}te.some(Y=>Y.id===k)||te.push(f.team)}else $({team:null});$({teams:te,loading:!1,error:g.error?.action?g.error:null,connection:"connected",...typeof f.version=="string"&&f.version.trim()?{version:f.version.trim()}:{},...f.update&&typeof f.update=="object"?{update:f.update}:{}}),f.update?.checked===!1&&!z&&(z=!0,J=setTimeout(()=>{J=null,O(M,r)&&g.update?.checked===!1&&pe(r,M).catch(()=>{})},2500),J.unref?.())}async function ne(r,M){try{for(;k&&O(M,r);){let f=w??0,te=g.team?.revision,Y=await W("wait",{teamId:k,since:f,...te?{revision:te}:{},timeoutSec:50},r);if(!O(M,r))return;if(!Number.isSafeInteger(Y?.head)||Y.head<0)throw Error("The Swarm event cursor is invalid. Refresh to reconnect.");let Me=Array.isArray(Y.posts)?Y.posts:[];if(Y.hasMore){let fe=Me.at(-1)?.seq;if(!Number.isSafeInteger(fe)||fe<=f||fe>Y.head)throw Error("The Swarm history page has an invalid cursor. Refresh to reconnect.");w=fe}else w=Math.max(f,Y.head);Me.length&&$({history:Z(Me)}),!(Y.wokeBy==="timeout"&&w===f&&Y.revision===te&&!Me.length)&&await pe(r,M)}}catch(f){O(M,r)&&$({loading:!1,connection:"disconnected",error:Fe(f)})}}async function L(){if(x?.abort(),x=null,y||!C)return;let r=new AbortController;x=r;let M=c,f=r.signal;$({loading:g.team===null,connection:"connecting",error:g.error?.action?g.error:null});try{await pe(f,M),O(M,f)&&k&&ne(f,M)}catch(te){O(M,f)&&$({loading:!1,connection:"disconnected",error:Fe(te)})}}async function R(r,M={},f=new AbortController){G.add(f);let te=c;try{let Y=await W("command",{action:r,args:k?{...M,teamId:k}:M,requestId:mt()},f.signal);if(y||te!==c)throw new DOMException("Selection changed","AbortError");return Y}finally{G.delete(f)}}async function a(r){if(y||!k||!g.team)throw Error("Select a team before changing it.");if(g.connection!=="connected")throw Error("Refresh the connection before changing the team.");if(g.pending)throw Error("Wait for the current action to finish.");let M=new AbortController;G.add(M);let f=c;$({pending:!0,error:null});try{let te=await W("command",r,M.signal);if(y||f!==c)throw new DOMException("Selection changed","AbortError");return b=null,te?.id?re(te):await pe(x.signal,f),$({pending:!1,error:null}),te}catch(te){if(!y&&f===c){let Y=Fe(te),Me=!Y.code.startsWith("hive-swarm/")||/outcome unconfirmed/i.test(Y.message);b=Me?r:null,$({pending:!1,error:{...Y,action:Me}})}throw te}finally{G.delete(M)}}let A={getSnapshot:()=>g,subscribe:r=>(T.add(r),()=>T.delete(r)),retain(){if(y)return()=>{};C++,C===1&&L();let r=!1;return()=>{r||(r=!0,--C===0&&(h(),$({connection:"idle",loading:!1,pending:!1,modelsLoading:!1,historyLoading:!1,journal:null})))}},async selectTeam(r){h(),k=r||null,w=null,P=0,b=null,$({team:null,selectedId:k,journal:null,history:[],hasMoreHistory:!1,historyLoading:!1,modelsLoading:!1,error:null,pending:!1,loading:!!C}),await L()},refresh:()=>{L()},showTeams:()=>A.selectTeam(null),command(r,M={}){let f={...M,teamId:k},te=b?.action===r&&JSON.stringify(b.args)===JSON.stringify(f);return a(te?b:{action:r,args:f,requestId:mt()})},retryCommand:()=>b?a(b):Promise.reject(Error("There is no action to retry.")),async loadModels(){$({modelsLoading:!0});try{let r=await R("list_models");$({models:r.models??[],modelsLoading:!1})}catch(r){r?.name!=="AbortError"&&$({modelsLoading:!1,error:Fe(r)})}},async openJournal(r){let M=g.team?.members.find(Y=>Y.name===r),f=Le(M);if(!f){$({error:{message:"This member has no owned session yet."}});return}q?.abort();let te=new AbortController;q=te,$({journal:{member:r,loading:!0,turns:[],error:null}});try{let Y=await R("read_journal",{member:r},te);if(Y.threadId&&Y.threadId!==f)throw Error("The member\u2019s session changed. Refresh its Journal to continue.");q===te&&g.journal?.member===r&&$({journal:{...Y,member:r,turns:no(Y.turns),loading:!1}})}catch(Y){Y?.name!=="AbortError"&&q===te&&g.journal?.member===r&&$({journal:{...g.journal,loading:!1,error:Fe(Y)}})}},closeJournal:()=>{q?.abort(),q=null,$({journal:null})},async loadHistory({reset:r=!1}={}){if(!(g.historyLoading||!k)){$({historyLoading:!0});try{let M=r?0:P,f=await R("board_history",{after:M,limit:200}),te=f.posts??f.events??[];P=te.at(-1)?.seq??M,$({history:Z(te),historyLoading:!1,hasMoreHistory:f.hasMore===!0})}catch(M){M?.name!=="AbortError"&&$({historyLoading:!1,error:Fe(M)})}}},async openSession(r,{fallbackToJournal:M=!0}={}){let f=g.team?.members.find(Y=>Y.name===r)??(r==="coordinator"?{name:"coordinator",role:"coordinator"}:void 0),te=io(g.team,f);if(!te)return $({error:{message:"This member has no owned session yet."}}),"none";if(typeof m=="function")try{return await m(te),"session"}catch{return M?(await A.openJournal(r),"journal"):"fallback"}return M?(await A.openJournal(r),"journal"):"fallback"},setError:r=>$({error:Fe(r)}),dispose(){y||(h(),clearTimeout(J),J=null,y=!0,T.clear())}};return A}function yt(o){let i=new Map,d=new Set,p=null,m=(N,k,C)=>{let y=JSON.stringify([N??null,k??null,st(C)]);return i.has(y)||i.set(y,o(N,k,C)),i.get(y)},n=m(null);return{forSession:m,getSnapshot:()=>p??n,subscribe:N=>(d.add(N),()=>d.delete(N)),select(N){p=N;for(let k of d)k()},reconnect(){for(let N of i.values())N.refresh()},dispose(){for(let N of i.values())N.dispose();i.clear(),d.clear()}}}var e=Je(require("react"),1),Te=Je(wt(),1),We=Je(St(),1),Bt=Je(Ct(),1);var Tt=`<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 256 256" role="img" aria-labelledby="title"><title id="title">Hive Swarm crowned bee</title>
5
- <rect x="2" y="2" width="252" height="252" rx="48" fill="#281d10" stroke="#9a7138" stroke-width="4"/>
6
- <g transform="translate(28 48) scale(10)" shape-rendering="crispEdges"><rect x="3" y="2" width="1" height="3" fill="#201915"/><rect x="6" y="3" width="1" height="2" fill="#201915"/><rect x="5" y="1" width="2" height="1" fill="#201915"/><rect x="2" y="3" width="1" height="1" fill="#201915"/><rect x="5" y="5" width="10" height="8" fill="#201915"/><rect x="3" y="7" width="13" height="5" fill="#201915"/><rect x="4" y="12" width="11" height="2" fill="#201915"/><rect x="6" y="14" width="7" height="1" fill="#201915"/><rect x="16" y="9" width="2" height="2" fill="#201915"/><rect x="7" y="14" width="1" height="2" fill="#201915"/><rect x="12" y="14" width="1" height="2" fill="#201915"/><rect x="7" y="3" width="6" height="4" fill="#24313d"/><rect x="8" y="2" width="4" height="6" fill="#24313d"/><rect x="12" y="3" width="4" height="4" fill="#24313d"/><rect x="13" y="2" width="2" height="1" fill="#24313d"/><rect x="8" y="3" width="3" height="4" fill="#a9c6db"/><rect x="12" y="4" width="3" height="2" fill="#a9c6db"/><rect x="9" y="7" width="2" height="1" fill="#a9c6db"/><rect x="9" y="3" width="2" height="2" fill="#e7f2fa"/><rect x="12" y="4" width="2" height="1" fill="#e7f2fa"/><rect x="8" y="4" width="1" height="2" fill="#e7f2fa"/><rect x="4" y="7" width="8" height="5" fill="#efac37"/><rect x="5" y="6" width="6" height="7" fill="#efac37"/><rect x="12" y="7" width="3" height="5" fill="#efac37"/><rect x="13" y="12" width="1" height="1" fill="#efac37"/><rect x="6" y="13" width="1" height="1" fill="#efac37"/><rect x="5" y="7" width="3" height="1" fill="#ffe18d"/><rect x="4" y="9" width="2" height="2" fill="#ffe18d"/><rect x="10" y="7" width="2" height="1" fill="#ffe18d"/><rect x="13" y="8" width="1" height="2" fill="#ffe18d"/><rect x="5" y="12" width="2" height="1" fill="#ffe18d"/><rect x="6" y="12" width="7" height="1" fill="#bb641d"/><rect x="12" y="11" width="3" height="1" fill="#bb641d"/><rect x="13" y="12" width="1" height="1" fill="#bb641d"/><rect x="8" y="6" width="2" height="7" fill="#2c221c"/><rect x="12" y="7" width="1" height="6" fill="#2c221c"/><rect x="15" y="9" width="2" height="1" fill="#2c221c"/><rect x="5" y="8" width="1" height="2" fill="#201915"/><rect x="5" y="8" width="1" height="1" fill="#fff6d7"/><rect x="2" y="1" width="1" height="4" fill="#6d4219"/><rect x="8" y="1" width="1" height="4" fill="#6d4219"/><rect x="2" y="4" width="7" height="1" fill="#6d4219"/><rect x="2" y="0" width="1" height="2" fill="#ffd86b"/><rect x="5" y="0" width="1" height="3" fill="#ffd86b"/><rect x="8" y="0" width="1" height="2" fill="#ffd86b"/><rect x="3" y="2" width="5" height="2" fill="#ffd86b"/><rect x="4" y="1" width="3" height="1" fill="#ffd86b"/><rect x="3" y="4" width="5" height="1" fill="#e7a52f"/><rect x="3" y="3" width="5" height="1" fill="#e7a52f"/><rect x="3" y="2" width="1" height="1" fill="#fff3bf"/><rect x="7" y="2" width="1" height="1" fill="#fff3bf"/><rect x="5" y="3" width="1" height="1" fill="#fff3bf"/></g></svg>
7
- `;var qt=`.dsh-hive {
8
- --hive-surface: var(--dsw-alias-bg-base);
9
- --hive-layer: var(--dsw-alias-bg-layer-2);
10
- --hive-card: color-mix(in oklab, var(--hive-layer) 76%, var(--hive-surface));
11
- --hive-ink: var(--dsw-alias-label-primary);
12
- --hive-muted: var(--dsw-alias-label-secondary);
13
- --hive-border: var(--dsw-alias-border-l2);
14
- --hive-focus: var(--dsw-alias-brand-primary);
15
- --hive-gold: light-dark(#855d24, #e8b552);
16
- --hive-good: light-dark(#1f6b40, #6fd89c);
17
- --hive-good-fill: light-dark(#4d9938, #5ec26a);
18
- --hive-working: light-dark(#2268b8, #63a4ff);
19
- --hive-wait: light-dark(#345299, #9fb5f0);
20
- --hive-amber: light-dark(#b07014, #e8ad44);
21
- --hive-pulse: light-dark(#7c5ce6, #a78bfa);
22
- --hive-danger: var(--dsw-alias-state-error-primary);
23
- --hive-gold-soft: color-mix(in oklab, var(--hive-gold) 13%, transparent);
24
- --hive-good-soft: color-mix(in oklab, var(--hive-good-fill) 13%, transparent);
25
- --hive-working-soft: color-mix(in oklab, var(--hive-working) 12%, transparent);
26
- --hive-wait-soft: color-mix(in oklab, var(--hive-wait) 13%, transparent);
27
- --hive-amber-soft: color-mix(in oklab, var(--hive-amber) 14%, transparent);
28
- --hive-error-soft: color-mix(in oklab, var(--hive-danger) 12%, transparent);
29
- --hive-mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
30
- container-type: inline-size;
31
- min-width: 0;
32
- width: 100%;
33
- height: 100%;
34
- overflow: auto;
35
- scrollbar-gutter: stable;
36
- overscroll-behavior: contain;
37
- color: var(--hive-ink);
38
- background: var(--hive-surface);
39
- font: inherit;
40
- line-height: 1.5;
41
- color-scheme: inherit;
42
- scrollbar-color: var(--hive-border) var(--hive-surface);
43
- scrollbar-width: thin;
44
- box-sizing: border-box;
45
- }
46
- .dsh-hive :where(*, *::before, *::after) { box-sizing: border-box; }
47
- .dsh-hive ::selection { color: var(--hive-ink); background: var(--dsw-alias-interactive-bg-hover); }
48
- .dsh-hive h1, .dsh-hive h2, .dsh-hive h3, .dsh-hive h4, .dsh-hive h5, .dsh-hive p { margin: 0; }
49
- .dsh-hive h1 { font-size: 1.08em; font-weight: 660; letter-spacing: -0.018em; overflow-wrap: anywhere; }
50
- .dsh-hive h2 { font-size: .96em; font-weight: 640; letter-spacing: -0.01em; color: var(--hive-ink); }
51
- .dsh-hive h3 { font-size: .94em; font-weight: 620; }
52
- .dsh-hive-sr-only {
53
- position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
54
- overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
55
- }
56
- .dsh-hive button, .dsh-hive input, .dsh-hive select, .dsh-hive textarea { font: inherit; color: inherit; }
57
- .dsh-hive button, .dsh-hive input, .dsh-hive select, .dsh-hive textarea {
58
- border: 1px solid var(--hive-border);
59
- background: var(--hive-layer);
60
- border-radius: 7px;
61
- min-height: 30px;
62
- padding: 4px 10px;
63
- max-width: 100%;
64
- caret-color: var(--hive-ink);
65
- transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
66
- }
67
- .dsh-hive button { cursor: pointer; }
68
- .dsh-hive button:hover:not(:disabled) {
69
- background: var(--dsw-alias-interactive-bg-hover);
70
- border-color: color-mix(in oklab, var(--hive-ink) 26%, var(--hive-border));
71
- }
72
- .dsh-hive button:active:not(:disabled) {
73
- background: var(--dsw-alias-interactive-bg-active, var(--dsw-alias-interactive-bg-hover));
74
- }
75
- .dsh-hive button:disabled { cursor: default; opacity: .52; }
76
- .dsh-hive button[aria-pressed="true"] { border-color: var(--hive-gold); background: var(--hive-gold-soft); color: var(--hive-ink); }
77
- .dsh-hive .dsh-hive-primary { border-color: var(--hive-gold); background: var(--hive-gold-soft); color: var(--hive-ink); font-weight: 620; }
78
- .dsh-hive .dsh-hive-primary:hover:not(:disabled) { background: color-mix(in oklab, var(--hive-gold) 22%, transparent); border-color: var(--hive-gold); }
79
- .dsh-hive .dsh-hive-ghost-btn {
80
- border-color: transparent; background: transparent; color: var(--hive-muted);
81
- min-height: 26px; padding: 2px 8px; font-size: .88em;
82
- }
83
- .dsh-hive .dsh-hive-ghost-btn:hover:not(:disabled) { color: var(--hive-ink); background: var(--dsw-alias-interactive-bg-hover); border-color: transparent; }
84
- .dsh-hive :focus-visible { outline: 2px solid var(--hive-focus); outline-offset: 2px; }
85
- .dsh-hive textarea { width: 100%; resize: vertical; }
86
- .dsh-hive input::placeholder, .dsh-hive textarea::placeholder { color: var(--hive-muted); opacity: 1; }
87
- .dsh-hive label { display: grid; gap: 4px; min-width: 0; color: var(--hive-muted); font-size: .92em; }
88
- .dsh-hive input, .dsh-hive select, .dsh-hive textarea { color: var(--hive-ink); font-size: .95rem; }
89
- .dsh-hive-mono { font-family: var(--hive-mono); font-variant-numeric: tabular-nums; font-size: .88em; }
90
-
91
- /* Header */
92
- .dsh-hive-header { padding: 12px 16px 8px; display: grid; gap: 8px; }
93
- .dsh-hive[data-dsh-hive-swarm="main"] .dsh-hive-header { padding-inline-start: max(20px, var(--dsh-frame-leading-clearance, 0px)); }
94
- .dsh-hive-header-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; min-width: 0; }
95
- .dsh-hive-title-wrap { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; padding-top: 1px; }
96
- .dsh-hive-header-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; position: relative; }
97
- .dsh-hive-header-status-row { display: inline-flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
98
- .dsh-hive-version-tag {
99
- font-family: var(--hive-mono); font-variant-numeric: tabular-nums; font-size: .78em; font-weight: 580;
100
- color: var(--hive-muted); padding: 1px 7px; border-radius: 999px;
101
- border: 1px solid color-mix(in oklab, var(--hive-border) 85%, transparent);
102
- background: color-mix(in oklab, var(--hive-layer) 75%, transparent);
103
- white-space: nowrap;
104
- }
105
- .dsh-hive-update-wrap { position: relative; display: flex; justify-content: flex-end; }
106
- .dsh-hive .dsh-hive-update-pill {
107
- min-height: 22px; padding: 1px 8px; border-radius: 999px; font-size: .76em; font-weight: 620;
108
- color: var(--hive-gold); background: var(--hive-gold-soft);
109
- border-color: color-mix(in oklab, var(--hive-gold) 48%, var(--hive-border));
110
- white-space: nowrap;
111
- }
112
- .dsh-hive .dsh-hive-update-pill:hover:not(:disabled) {
113
- background: color-mix(in oklab, var(--hive-gold) 22%, transparent);
114
- border-color: var(--hive-gold);
115
- }
116
- .dsh-hive-update-popover {
117
- position: absolute; top: calc(100% + 6px); inset-inline-end: 0; z-index: 40;
118
- width: min(300px, calc(100cqi - 32px)); padding: 10px 12px; border-radius: 10px;
119
- border: 1px solid var(--hive-border); background: var(--hive-surface);
120
- box-shadow: 0 12px 28px rgba(0, 0, 0, .28); display: grid; gap: 8px; font-size: .86em;
121
- }
122
- .dsh-hive-update-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
123
- .dsh-hive-update-head .dsh-hive-mono { color: var(--hive-gold); font-weight: 620; }
124
- .dsh-hive-update-cmd {
125
- display: block; padding: 6px 8px; border-radius: 7px;
126
- background: var(--hive-layer); border: 1px solid var(--hive-border);
127
- font-family: var(--hive-mono); font-size: .88em; color: var(--hive-ink);
128
- overflow-wrap: anywhere; user-select: all;
129
- }
130
- .dsh-hive-update-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
131
- .dsh-hive-update-actions a { color: var(--hive-gold); font-size: .92em; text-underline-offset: 3px; }
132
- .dsh-hive-header-status {
133
- display: inline-flex; align-items: center; gap: 6px;
134
- font-size: .86em; font-weight: 560; color: var(--hive-muted); white-space: nowrap; flex: none;
135
- }
136
- .dsh-hive-header-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-width: 0; }
137
- .dsh-hive-header-actions select {
138
- flex: 1 1 150px; min-width: 0; max-width: 280px; min-height: 28px; padding: 2px 8px; font-size: .86em;
139
- background: transparent; border-color: color-mix(in oklab, var(--hive-border) 80%, transparent);
140
- }
141
- .dsh-hive .dsh-hive-compact-btn {
142
- flex: 0 0 auto; min-height: 28px; padding: 2px 9px; font-size: .84em;
143
- background: transparent; border-color: color-mix(in oklab, var(--hive-border) 80%, transparent); color: var(--hive-muted);
144
- }
145
- .dsh-hive .dsh-hive-compact-btn:hover:not(:disabled) { color: var(--hive-ink); background: var(--dsw-alias-interactive-bg-hover); }
146
- .dsh-hive-rename { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
147
- .dsh-hive-rename input { flex: 1 1 180px; min-height: 30px; }
148
- .dsh-hive-line, .dsh-hive-actions, .dsh-hive-pill-group { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; }
149
- .dsh-hive-pill-group { margin-inline-start: auto; gap: 6px; }
150
- .dsh-hive-line time { margin-inline-start: auto; color: var(--hive-muted); font-family: var(--hive-mono); font-variant-numeric: tabular-nums; font-size: .84em; }
151
- .dsh-hive-secondary { color: var(--hive-muted); }
152
- .dsh-hive-context { font-size: .84em; overflow-wrap: anywhere; }
153
-
154
- /* Status Badges */
155
- .dsh-hive-status {
156
- display: inline-flex; align-items: center; gap: 5px;
157
- border: 1px solid var(--hive-border); border-radius: 999px; padding: 1px 8px;
158
- font-size: .82em; font-weight: 600; background: var(--hive-surface); white-space: nowrap;
159
- }
160
- .dsh-hive-status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--hive-muted); flex: none; }
161
- [data-status="working"] .dsh-hive-status-dot,
162
- [data-status="active"] .dsh-hive-status-dot,
163
- [data-status="done"] .dsh-hive-status-dot,
164
- [data-status="completed"] .dsh-hive-status-dot { background: var(--hive-good-fill); }
165
- [data-status="waiting"] .dsh-hive-status-dot,
166
- [data-status="queued"] .dsh-hive-status-dot { background: var(--hive-wait); }
167
- [data-status="paused"] .dsh-hive-status-dot,
168
- [data-status="budget"] .dsh-hive-status-dot { background: var(--hive-amber); }
169
- [data-status="quota"] .dsh-hive-status-dot,
170
- [data-status="stalled"] .dsh-hive-status-dot,
171
- [data-status="failed"] .dsh-hive-status-dot,
172
- [data-status="blocked"] .dsh-hive-status-dot { background: var(--hive-danger); }
173
-
174
- .dsh-hive-status[data-status="working"], .dsh-hive-status[data-status="active"] { border-color: color-mix(in oklab, var(--hive-good-fill) 45%, var(--hive-border)); background: var(--hive-good-soft); }
175
- .dsh-hive-status[data-status="waiting"], .dsh-hive-status[data-status="queued"] { border-color: color-mix(in oklab, var(--hive-wait) 40%, var(--hive-border)); background: var(--hive-wait-soft); }
176
- .dsh-hive-status[data-status="done"], .dsh-hive-status[data-status="completed"] { border-color: color-mix(in oklab, var(--hive-good-fill) 32%, var(--hive-border)); }
177
- .dsh-hive-status[data-status="paused"], .dsh-hive-status[data-status="budget"] { border-color: color-mix(in oklab, var(--hive-amber) 50%, var(--hive-border)); background: var(--hive-amber-soft); }
178
- .dsh-hive-status[data-status="quota"], .dsh-hive-status[data-status="stalled"], .dsh-hive-status[data-status="failed"], .dsh-hive-status[data-status="blocked"] {
179
- color: var(--hive-danger); border-color: color-mix(in oklab, var(--hive-danger) 45%, var(--hive-border)); background: var(--hive-error-soft);
180
- }
181
- .dsh-hive-mode { display: inline-flex; align-items: center; border: 1px solid var(--hive-border); border-radius: 999px; padding: 1px 8px; font-family: var(--hive-mono); font-size: .78em; font-weight: 600; color: var(--hive-muted); background: var(--hive-surface); white-space: nowrap; }
182
- .dsh-hive-mode[data-mode="subagent"] { color: var(--hive-gold); border-color: color-mix(in oklab, var(--hive-gold) 45%, var(--hive-border)); background: var(--hive-gold-soft); }
183
- .dsh-hive-mode[data-mode="attached"] { color: var(--hive-wait); border-color: color-mix(in oklab, var(--hive-wait) 42%, var(--hive-border)); background: var(--hive-wait-soft); }
184
-
185
- /* Underlined Tabs (dimensions never shift on selection) */
186
- .dsh-hive-tabs {
187
- display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
188
- padding: 0 16px; gap: 18px; border-bottom: 1px solid var(--hive-border);
189
- }
190
- .dsh-hive-tabs::-webkit-scrollbar { display: none; }
191
- .dsh-hive-tabs button {
192
- position: relative; flex: none; white-space: nowrap;
193
- background: transparent; border: 0; border-radius: 0;
194
- min-height: 36px; padding: 8px 2px; font-weight: 560; color: var(--hive-muted);
195
- }
196
- .dsh-hive-tabs button:hover:not(:disabled) { color: var(--hive-ink); background: transparent; border-color: transparent; }
197
- .dsh-hive-tabs button[aria-selected="true"] { color: var(--hive-ink); background: transparent; }
198
- .dsh-hive-tabs button[aria-selected="true"]::after {
199
- content: ""; position: absolute; inset: auto 0 0; border-block-end: 2px solid var(--hive-ink);
200
- }
201
- .dsh-hive-tab-count {
202
- margin-inline-start: 5px; font-size: .88em; font-weight: 500;
203
- color: var(--hive-muted); font-variant-numeric: tabular-nums;
204
- }
205
-
206
- .dsh-hive-content { padding: 16px 16px 28px; }
207
- .dsh-hive-content > *, .dsh-hive-overview { min-width: 0; }
208
-
209
- /* Antigravity-Style Overview */
210
- .dsh-hive-overview { display: grid; gap: 18px; align-items: start; max-width: 860px; margin-inline: auto; }
211
- .dsh-hive-section { display: grid; gap: 10px; align-content: start; min-width: 0; }
212
- .dsh-hive-goal-line { color: var(--hive-muted); font-size: .94em; overflow-wrap: anywhere; }
213
- .dsh-hive-details summary { cursor: pointer; color: var(--hive-gold); font-weight: 600; width: max-content; max-width: 100%; font-size: .9em; }
214
- .dsh-hive-details[open] summary { margin-bottom: 8px; }
215
-
216
- /* State Glyphs */
217
- .dsh-hive-glyph {
218
- display: inline-grid; place-items: center; flex: none;
219
- width: 20px; height: 20px; border-radius: 50%; font-size: 11px; font-weight: 700; line-height: 1;
220
- }
221
- .dsh-hive-glyph[data-tone="done"] {
222
- background: color-mix(in oklab, var(--hive-good-fill) 18%, transparent);
223
- color: var(--hive-good-fill);
224
- border: 1px solid color-mix(in oklab, var(--hive-good-fill) 42%, transparent);
225
- }
226
- .dsh-hive-glyph[data-tone="active"] {
227
- background: color-mix(in oklab, var(--hive-working) 16%, transparent);
228
- border: 1px solid color-mix(in oklab, var(--hive-working) 45%, transparent);
229
- }
230
- .dsh-hive-glyph[data-tone="active"] .dsh-hive-glyph-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--hive-working); }
231
- .dsh-hive-glyph[data-tone="idle"] {
232
- background: color-mix(in oklab, var(--hive-muted) 12%, transparent);
233
- border: 1px solid color-mix(in oklab, var(--hive-muted) 32%, transparent);
234
- }
235
- .dsh-hive-glyph[data-tone="idle"] .dsh-hive-glyph-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--hive-muted); }
236
- .dsh-hive-glyph[data-tone="danger"] {
237
- background: var(--hive-error-soft); color: var(--hive-danger);
238
- border: 1px solid color-mix(in oklab, var(--hive-danger) 48%, transparent);
239
- }
240
-
241
- /* Collapsible Task Summary Card & Thread Cards */
242
- .dsh-hive-task-card, .dsh-hive-thread-card {
243
- border: 1px solid var(--hive-border); border-radius: 10px;
244
- background: var(--hive-card); overflow: clip;
245
- }
246
- .dsh-hive-task-summary, .dsh-hive-thread-head {
247
- list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px;
248
- padding: 11px 14px; min-height: 44px; user-select: none;
249
- }
250
- .dsh-hive-task-summary::-webkit-details-marker,
251
- .dsh-hive-thread-head::-webkit-details-marker { display: none; }
252
- .dsh-hive-task-summary:hover, .dsh-hive-thread-head:hover { background: var(--dsw-alias-interactive-bg-hover); }
253
- .dsh-hive-task-count { font-size: .95em; color: var(--hive-muted); flex: 1; min-width: 0; }
254
- .dsh-hive-task-count strong { color: var(--hive-ink); font-weight: 650; }
255
- .dsh-hive-task-turns { font-family: var(--hive-mono); font-variant-numeric: tabular-nums; font-size: .82em; color: var(--hive-muted); white-space: nowrap; }
256
- .dsh-hive-chevron { color: var(--hive-muted); flex: none; }
257
- details[open] > summary .dsh-hive-chevron { rotate: 180deg; }
258
-
259
- .dsh-hive-task-body, .dsh-hive-thread-body { border-top: 1px solid color-mix(in oklab, var(--hive-border) 75%, transparent); }
260
- .dsh-hive-task-list, .dsh-hive-thread-rows { list-style: none; margin: 0; padding: 6px 14px; display: grid; gap: 0; }
261
- .dsh-hive-task-empty { padding: 12px 14px; font-size: .9em; }
262
- .dsh-hive-task-row {
263
- display: flex; align-items: center; gap: 10px; padding: 8px 0; min-width: 0;
264
- border-bottom: 1px solid color-mix(in oklab, var(--hive-border) 55%, transparent);
265
- }
266
- .dsh-hive-task-row:last-child { border-bottom: 0; }
267
- .dsh-hive-task-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
268
- .dsh-hive-task-title {
269
- font-weight: 620; font-size: .94em; color: var(--hive-ink);
270
- white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
271
- }
272
- .dsh-hive-task-sub {
273
- font-size: .85em; color: var(--hive-muted);
274
- white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
275
- }
276
- .dsh-hive-inline-actions { margin-top: 4px; }
277
-
278
- /* Colored Bee Pill */
279
- .dsh-hive .dsh-hive-bee-pill {
280
- display: inline-flex; align-items: center; gap: 6px; flex: none;
281
- min-height: 24px; padding: 2px 10px 2px 6px; border-radius: 999px;
282
- border: 1px solid var(--bee-pill-border, var(--hive-border));
283
- background: var(--bee-pill-bg, var(--hive-surface));
284
- color: var(--hive-ink); font-size: .84em; font-weight: 580; white-space: nowrap;
285
- }
286
- .dsh-hive button.dsh-hive-bee-pill:hover:not(:disabled) {
287
- filter: brightness(1.06);
288
- border-color: color-mix(in oklab, var(--hive-ink) 35%, var(--bee-pill-border, var(--hive-border)));
289
- }
290
-
291
- /* Threads */
292
- .dsh-hive-threads { display: grid; gap: 10px; }
293
- .dsh-hive-thread-left { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
294
- .dsh-hive-thread-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--hive-muted); }
295
- .dsh-hive-thread-dot[data-status="done"], .dsh-hive-thread-dot[data-status="active"] { background: var(--hive-good-fill); }
296
- .dsh-hive-thread-dot[data-status="queued"], .dsh-hive-thread-dot[data-status="waiting"] { background: var(--hive-wait); }
297
- .dsh-hive-thread-dot[data-status="blocked"] { background: var(--hive-danger); }
298
- .dsh-hive-thread-title { font-weight: 640; color: var(--hive-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
299
- .dsh-hive-thread-state { color: var(--hive-muted); font-size: .88em; white-space: nowrap; }
300
- .dsh-hive-thread-right { display: inline-flex; align-items: center; gap: 8px; flex: none; }
301
- .dsh-hive-mini-progress {
302
- width: 44px; height: 6px; border: 0; border-radius: 999px; overflow: hidden;
303
- accent-color: var(--hive-good-fill); background: color-mix(in oklab, var(--hive-border) 85%, transparent);
304
- }
305
- @supports not (accent-color: red) {
306
- .dsh-hive-mini-progress { -webkit-appearance: none; -moz-appearance: none; appearance: none; }
307
- .dsh-hive-mini-progress::-webkit-progress-bar { background: color-mix(in oklab, var(--hive-border) 85%, transparent); border-radius: 999px; }
308
- .dsh-hive-mini-progress::-webkit-progress-value { background: var(--hive-good-fill); border-radius: 999px; }
309
- .dsh-hive-mini-progress::-moz-progress-bar { background: var(--hive-good-fill); border-radius: 999px; }
310
- }
311
- .dsh-hive-thread-ratio { font-family: var(--hive-mono); font-variant-numeric: tabular-nums; font-size: .84em; color: var(--hive-muted); }
312
- .dsh-hive-thread-goal { padding: 8px 14px 2px; font-size: .88em; color: var(--hive-muted); }
313
- .dsh-hive-thread-task {
314
- display: flex; align-items: center; gap: 10px; padding: 6px 0; min-width: 0;
315
- }
316
- .dsh-hive-thread-task-title {
317
- flex: 1; min-width: 0; font-size: .92em; color: var(--hive-muted);
318
- white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
319
- }
320
-
321
- /* Screenshots Strip + Lightbox */
322
- .dsh-hive-screenshots-strip {
323
- list-style: none; margin: 0; padding: 2px 0 6px;
324
- display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: thin;
325
- }
326
- .dsh-hive-shot-card {
327
- flex: 0 0 min(240px, 78%); scroll-snap-align: start;
328
- border: 1px solid var(--hive-border); border-radius: 10px; background: var(--hive-card);
329
- padding: 8px; display: grid; gap: 8px;
330
- }
331
- .dsh-hive .dsh-hive-shot-thumb {
332
- display: block; width: 100%; padding: 0; border: 0; background: transparent;
333
- border-radius: 7px; overflow: hidden; min-height: 0;
334
- }
335
- .dsh-hive-shot-thumb img { width: 100%; height: 132px; object-fit: cover; display: block; border-radius: 7px; }
336
- .dsh-hive-shot-meta { display: grid; gap: 6px; min-width: 0; }
337
- .dsh-hive-shot-caption {
338
- font-size: .88em; color: var(--hive-ink); overflow-wrap: anywhere;
339
- display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-clamp: 2; overflow: hidden;
340
- }
341
- .dsh-hive-shot-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
342
- .dsh-hive-lightbox { width: min(860px, calc(100vw - 32px)); }
343
- .dsh-hive-lightbox-figure { margin: 0; display: grid; gap: 12px; }
344
- .dsh-hive-lightbox-img { max-width: 100%; max-height: 68dvh; width: auto; margin-inline: auto; border-radius: 8px; display: block; object-fit: contain; }
345
- .dsh-hive-lightbox-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: .92em; color: var(--hive-muted); }
346
-
347
- /* The team card */
348
- .dsh-hive-team-card {
349
- display: flex; align-items: flex-start; gap: 14px; padding: 14px 16px;
350
- border: 1px solid var(--hive-border); border-radius: 12px; background: var(--hive-card);
351
- }
352
- .dsh-hive-coordinator-tile {
353
- width: 58px; height: 58px; flex: none; border-radius: 10px; display: grid; place-items: center;
354
- background-color: #191c22;
355
- background-image:
356
- radial-gradient(circle at 50% 42%, rgb(246 188 85 / 16%), transparent 70%),
357
- linear-gradient(30deg, rgb(255 255 255 / 5%) 12%, transparent 12.5%, transparent 87%, rgb(255 255 255 / 5%) 87.5%),
358
- linear-gradient(150deg, rgb(255 255 255 / 5%) 12%, transparent 12.5%, transparent 87%, rgb(255 255 255 / 5%) 87.5%),
359
- linear-gradient(60deg, rgb(255 255 255 / 4%) 25%, transparent 25.5%, transparent 75%, rgb(255 255 255 / 4%) 75%);
360
- background-size: 100% 100%, 16px 28px, 16px 28px, 16px 28px;
361
- border: 1px solid rgb(255 255 255 / 10%);
362
- }
363
- .dsh-hive-team-body { flex: 1; min-width: 0; display: grid; gap: 6px; }
364
- .dsh-hive-team-name { font-size: .98em; font-weight: 660; color: var(--hive-ink); }
365
- .dsh-hive-team-summary { font-size: .92em; color: var(--hive-muted); overflow-wrap: anywhere; }
366
- .dsh-hive-exec { margin-top: 2px; }
367
-
368
- /* Prose & Markdown */
369
- .dsh-hive-prose { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 72ch; }
370
- .dsh-hive-rich { display: grid; gap: 6px; min-width: 0; }
371
- .dsh-hive-rich code { background: var(--hive-layer); border: 1px solid color-mix(in oklab, var(--hive-border) 65%, transparent); border-radius: 4px; padding: 1px 5px; font-family: var(--hive-mono); font-size: .9em; overflow-wrap: anywhere; }
372
- .dsh-hive-rich a { color: var(--hive-focus); text-decoration: underline; text-underline-offset: 2px; }
373
- .dsh-hive-code { margin: 4px 0; padding: 10px 12px; border: 1px solid var(--hive-border); border-radius: 8px; background: var(--hive-layer); overflow: auto; font-size: .88em; }
374
- .dsh-hive-code code { background: none; border: 0; padding: 0; }
375
- .dsh-hive-list { margin: 0; padding-inline-start: 20px; display: grid; gap: 3px; }
376
- .dsh-hive-mention { color: var(--hive-gold); font-weight: 620; }
377
- .dsh-hive-targets { display: inline-flex; align-items: center; color: var(--hive-gold); background: var(--hive-gold-soft); border: 1px solid color-mix(in oklab, var(--hive-gold) 35%, transparent); border-radius: 999px; padding: 0 8px; font-size: .85em; font-weight: 600; }
378
- .dsh-hive-badge { display: inline-block; border: 1px solid var(--hive-border); border-radius: 5px; padding: 0 6px; font-family: var(--hive-mono); font-size: .84em; font-weight: 600; }
379
- .dsh-hive-badge[data-badge="done"] { color: var(--hive-good); border-color: color-mix(in oklab, var(--hive-good-fill) 42%, var(--hive-border)); background: var(--hive-good-soft); }
380
- .dsh-hive-badge[data-badge="stall"] { color: var(--hive-danger); border-color: color-mix(in oklab, var(--hive-danger) 42%, var(--hive-border)); background: var(--hive-error-soft); }
381
- .dsh-hive .dsh-hive-ref { display: inline; min-height: 0; padding: 0 3px; border: 0; background: transparent; color: var(--hive-gold); font-family: var(--hive-mono); font-variant-numeric: tabular-nums; text-decoration: underline; text-underline-offset: 2px; vertical-align: baseline; }
382
- .dsh-hive .dsh-hive-ref:hover:not(:disabled) { background: var(--hive-gold-soft); border-color: transparent; }
383
- .dsh-hive-facts { margin: 0; display: grid; gap: 7px; padding: 10px 12px; border: 1px solid var(--hive-border); border-radius: 8px; background: var(--hive-surface); }
384
- .dsh-hive-facts > div { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 10px; font-size: .92em; }
385
- .dsh-hive-facts dt { color: var(--hive-muted); }
386
- .dsh-hive-facts dd { margin: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
387
-
388
- .dsh-hive-feed, .dsh-hive-members, .dsh-hive-attention, .dsh-hive-journal { list-style: none; margin: 0; padding: 0; }
389
- .dsh-hive-feed-wrap { position: relative; min-width: 0; }
390
- .dsh-hive-feed { display: grid; gap: 4px; max-height: min(54dvh, 520px); overflow: auto; scrollbar-gutter: stable; overscroll-behavior: contain; padding-inline-end: 2px; }
391
- .dsh-hive-post {
392
- padding: 12px 10px; border-radius: 10px;
393
- display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; align-items: start;
394
- transition: background-color 140ms ease;
395
- }
396
- .dsh-hive-post:hover { background: color-mix(in oklab, var(--hive-layer) 55%, transparent); }
397
- .dsh-hive-post[data-kind="monitor"], .dsh-hive-post[data-kind="checkpoint"] {
398
- border-inline-start: 3px solid var(--hive-gold); background: var(--hive-gold-soft);
399
- }
400
- .dsh-hive-post[data-focused="true"] {
401
- background: var(--hive-layer); outline: 2px solid var(--hive-gold); outline-offset: -2px;
402
- }
403
- .dsh-hive .dsh-hive-post-avatar-btn {
404
- padding: 0; border: 0; background: transparent; min-height: 0; border-radius: 9px; cursor: pointer;
405
- }
406
- .dsh-hive .dsh-hive-post-avatar-btn:hover:not(:disabled) { filter: brightness(1.06); background: transparent; border-color: transparent; }
407
- .dsh-hive-post-tile {
408
- width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none;
409
- background: var(--tile-bg, var(--hive-layer));
410
- border: 1px solid var(--tile-border, var(--hive-border));
411
- }
412
- .dsh-hive-post-tile.dsh-hive-coord-mini {
413
- background-color: #191c22; border-color: rgb(255 255 255 / 14%);
414
- background-image: radial-gradient(circle at 50% 42%, rgb(246 188 85 / 18%), transparent 72%);
415
- }
416
- .dsh-hive-post-tile.dsh-hive-system-tile { color: var(--hive-muted); font-size: .88em; }
417
- .dsh-hive-post-main { min-width: 0; display: grid; gap: 5px; }
418
- .dsh-hive-post-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: .9em; }
419
- .dsh-hive-post-who { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; min-width: 0; }
420
- .dsh-hive-targets-inline { color: var(--hive-muted); font-size: .9em; overflow-wrap: anywhere; }
421
- .dsh-hive-channel-pill {
422
- padding: 0 6px; border-radius: 5px; border: 1px solid var(--hive-border);
423
- background: var(--hive-layer); color: var(--hive-gold); font-family: var(--hive-mono); font-size: .82em; font-weight: 600;
424
- }
425
- .dsh-hive-post-stamp { color: var(--hive-muted); font-size: .82em; white-space: nowrap; margin-inline-start: auto; font-variant-numeric: tabular-nums; }
426
- .dsh-hive-post-body { min-width: 0; font-size: .94em; color: var(--hive-ink); }
427
- .dsh-hive-post-body[data-clamped="true"] {
428
- max-height: 132px; overflow: hidden; cursor: pointer;
429
- mask-image: linear-gradient(to bottom, #000 60%, transparent 100%);
430
- -webkit-mask-image: linear-gradient(to bottom, #000 60%, transparent 100%);
431
- }
432
- .dsh-hive .dsh-hive-expand-btn {
433
- justify-self: start; min-height: 0; padding: 1px 0; border: 0; background: transparent;
434
- color: var(--hive-gold); font-size: .82em; font-weight: 600;
435
- }
436
- .dsh-hive .dsh-hive-expand-btn:hover:not(:disabled) { text-decoration: underline; background: transparent; border-color: transparent; }
437
- .dsh-hive .dsh-hive-latest-pill {
438
- position: sticky; bottom: 10px; float: right; margin: 4px 8px 4px auto; z-index: 2;
439
- min-height: 28px; padding: 3px 11px; border-radius: 999px;
440
- border: 1px solid var(--hive-border); background: var(--hive-surface); color: var(--hive-ink);
441
- font-size: .84em; font-weight: 600; box-shadow: 0 4px 14px rgb(0 0 0 / 22%);
442
- }
443
- .dsh-hive .dsh-hive-latest-pill:hover:not(:disabled) { border-color: var(--hive-gold); }
444
-
445
- .dsh-hive-attention { display: grid; gap: 8px; }
446
- .dsh-hive-alert-card { display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--hive-border); border-inline-start: 3px solid var(--hive-amber); border-radius: 8px; background: var(--hive-card); }
447
- .dsh-hive-alert-card[data-kind="recovery"], .dsh-hive-alert-card[data-kind="failed"], .dsh-hive-alert-card[data-kind="quota"] { border-inline-start-color: var(--hive-danger); }
448
- .dsh-hive-live { padding: 10px 13px; border: 1px solid color-mix(in oklab, var(--hive-good-fill) 38%, var(--hive-border)); border-radius: 9px; background: var(--hive-layer); display: grid; gap: 6px; }
449
- .dsh-hive-live ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
450
- .dsh-hive-live li { display: flex; gap: 8px; flex-wrap: wrap; font-size: .92em; }
451
-
452
- /* Board & Members */
453
- .dsh-hive-board { display: grid; gap: 12px; }
454
- .dsh-hive-toolbar { display: grid; gap: 10px; }
455
- .dsh-hive-board-bar { display: flex; align-items: center; gap: 8px; }
456
- .dsh-hive-search-box {
457
- flex: 1 1 auto; min-width: 0; display: flex !important; align-items: center; gap: 8px;
458
- padding: 0 11px; min-height: 34px; border-radius: 999px;
459
- border: 1px solid var(--hive-border); background: var(--hive-layer); color: var(--hive-muted);
460
- }
461
- .dsh-hive-search-box:focus-within { border-color: var(--hive-focus); color: var(--hive-ink); }
462
- .dsh-hive-search-box input {
463
- flex: 1 1 auto; min-width: 0; width: 100%; border: 0 !important; background: transparent !important;
464
- padding: 4px 0 !important; min-height: 28px !important; outline: none; font-size: .9em; color: var(--hive-ink);
465
- }
466
- .dsh-hive .dsh-hive-filter-btn {
467
- position: relative; flex: 0 0 auto; width: 34px; height: 34px; min-height: 34px; padding: 0;
468
- display: inline-grid; place-items: center; border-radius: 10px;
469
- border: 1px solid transparent; background: transparent; color: var(--hive-muted);
470
- }
471
- .dsh-hive .dsh-hive-filter-btn:hover:not(:disabled),
472
- .dsh-hive .dsh-hive-filter-btn[aria-expanded="true"] {
473
- background: var(--hive-layer); border-color: var(--hive-border); color: var(--hive-ink);
474
- }
475
- .dsh-hive .dsh-hive-filter-btn[data-active="true"]::after {
476
- content: ""; position: absolute; top: 5px; right: 5px; width: 6px; height: 6px;
477
- border-radius: 50%; background: var(--hive-gold);
478
- }
479
- .dsh-hive-filter-drawer {
480
- display: grid; gap: 10px; padding: 12px; border: 1px solid var(--hive-border);
481
- border-radius: 10px; background: var(--hive-layer);
482
- }
483
- .dsh-hive-filter-drawer[hidden] { display: none; }
484
-
485
- .dsh-hive-members-view { display: grid; gap: 12px; }
486
- .dsh-hive-member-bar { display: flex; align-items: center; gap: 8px; }
487
- .dsh-hive-members { display: grid; gap: 2px; }
488
- .dsh-hive-member {
489
- display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 12px; align-items: start;
490
- padding: 10px 10px; border-radius: 10px; border: 1px solid transparent; position: relative;
491
- transition: background-color 140ms ease;
492
- }
493
- .dsh-hive-member[data-clickable="true"] { cursor: pointer; }
494
- .dsh-hive-member:hover { background: var(--hive-layer); }
495
- .dsh-hive-member[data-menu-open="true"] { z-index: 6; background: var(--hive-layer); }
496
- .dsh-hive-member[data-status="retired"] { opacity: .76; }
497
- .dsh-hive-member-avatar { position: relative; width: 40px; height: 40px; flex: none; margin-top: 1px; }
498
- .dsh-hive-member-tile {
499
- width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
500
- background: var(--tile-bg, var(--hive-layer));
501
- border: 1px solid var(--tile-border, var(--hive-border));
502
- }
503
- .dsh-hive-member-tile.is-coordinator {
504
- background-color: #191c22; border-color: rgb(255 255 255 / 14%);
505
- background-image:
506
- radial-gradient(circle at 50% 42%, rgb(246 188 85 / 18%), transparent 72%),
507
- linear-gradient(30deg, rgb(255 255 255 / 5%) 12%, transparent 12.5%, transparent 87%, rgb(255 255 255 / 5%) 87.5%);
508
- background-size: 100% 100%, 14px 24px;
509
- }
510
- .dsh-hive-avatar-dot {
511
- position: absolute; right: -2px; bottom: -2px; width: 9px; height: 9px; border-radius: 50%;
512
- border: 2px solid var(--hive-surface); background: var(--hive-good-fill);
513
- }
514
- .dsh-hive-avatar-dot[data-tone="danger"] { background: var(--hive-danger); }
515
- .dsh-hive-member-main { min-width: 0; display: grid; gap: 4px; }
516
- .dsh-hive-member-line1 { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: nowrap; min-width: 0; }
517
- .dsh-hive-member-ident { display: flex; align-items: baseline; gap: 7px; min-width: 0; flex: 1 1 auto; }
518
- .dsh-hive-member-ident h2 { font-size: .96em; font-weight: 660; flex: none; color: var(--hive-ink); }
519
- .dsh-hive-member-sub { font-size: .88em; color: var(--hive-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
520
- .dsh-hive-member-meta { display: inline-flex; align-items: center; gap: 6px; flex: none; font-size: .82em; color: var(--hive-muted); }
521
- .dsh-hive-member-model { font-family: var(--hive-mono); font-size: .92em; color: var(--hive-muted); max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
522
- .dsh-hive-member-preview {
523
- font-size: .89em; color: var(--hive-muted); overflow-wrap: anywhere;
524
- display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-clamp: 2; overflow: hidden;
525
- }
526
- .dsh-hive-member-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 1px; }
527
- .dsh-hive-member-workspace { margin: 0; display: inline-flex; max-width: min(100%, 380px); }
528
- .dsh-hive-member-workspace > div {
529
- display: inline-flex; align-items: center; gap: 5px; max-width: 100%;
530
- padding: 1px 8px; border-radius: 999px; border: 1px solid var(--hive-border);
531
- background: color-mix(in oklab, var(--hive-layer) 82%, transparent);
532
- font-family: var(--hive-mono); font-size: .78em; color: var(--hive-muted);
533
- }
534
- .dsh-hive-member-workspace dt { display: none; }
535
- .dsh-hive-member-workspace dd { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: rtl; text-align: left; }
536
- .dsh-hive-chip {
537
- display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px;
538
- border: 1px solid var(--hive-border); background: color-mix(in oklab, var(--hive-layer) 82%, transparent);
539
- font-size: .78em; color: var(--hive-muted);
540
- }
541
- .dsh-hive-chip[data-tone="wait"] { color: var(--hive-wait); border-color: color-mix(in oklab, var(--hive-wait) 36%, var(--hive-border)); }
542
- .dsh-hive-row-menu { position: relative; flex: none; }
543
- .dsh-hive .dsh-hive-row-menu-btn {
544
- min-height: 24px; min-width: 24px; padding: 0 5px; border: 0; background: transparent;
545
- color: var(--hive-muted); font-size: 1em; line-height: 1; border-radius: 6px; opacity: .48;
546
- }
547
- .dsh-hive-member:hover .dsh-hive-row-menu-btn,
548
- .dsh-hive-member:focus-within .dsh-hive-row-menu-btn,
549
- .dsh-hive .dsh-hive-row-menu-btn[aria-expanded="true"] { opacity: 1; }
550
- .dsh-hive .dsh-hive-row-menu-btn:hover:not(:disabled),
551
- .dsh-hive .dsh-hive-row-menu-btn[aria-expanded="true"] { background: var(--dsw-alias-interactive-bg-hover); color: var(--hive-ink); border-color: transparent; }
552
- .dsh-hive-row-menu-pop {
553
- display: none; position: absolute; right: 0; top: calc(100% + 4px); min-width: 162px; z-index: 20;
554
- padding: 5px; border-radius: 10px; border: 1px solid var(--hive-border); background: var(--hive-surface);
555
- box-shadow: 0 10px 28px rgb(0 0 0 / 28%);
556
- }
557
- .dsh-hive-row-menu-pop[data-open="true"] { display: grid; gap: 2px; }
558
- .dsh-hive .dsh-hive-menu-item {
559
- width: 100%; justify-content: flex-start; text-align: left; display: flex; align-items: center;
560
- min-height: 28px; padding: 4px 9px; border: 0; border-radius: 6px; background: transparent;
561
- color: var(--hive-ink); font-size: .88em;
562
- }
563
- .dsh-hive .dsh-hive-menu-item:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover); border-color: transparent; }
564
- .dsh-hive-menu-brief { padding: 4px 6px 2px; font-size: .84em; }
565
- .dsh-hive-inline-actions { margin-top: 2px; }
566
- .dsh-hive-retired-group { margin-top: 6px; border-top: 1px solid var(--hive-border); padding-top: 6px; }
567
- .dsh-hive-retired-summary {
568
- list-style: none; display: flex; align-items: center; gap: 6px; width: 100%; padding: 6px 8px;
569
- cursor: pointer; user-select: none; font-size: .78em; font-weight: 680; letter-spacing: .04em; color: var(--hive-muted);
570
- }
571
- .dsh-hive-retired-summary .dsh-hive-chevron { margin-left: auto; }
572
- .dsh-hive-retired-summary::-webkit-details-marker { display: none; }
573
- .dsh-hive-retired-count { font-family: var(--hive-mono); color: var(--hive-muted); }
574
-
575
- .dsh-hive-filters { display: flex; gap: 10px 12px; flex-wrap: wrap; align-items: flex-end; }
576
- .dsh-hive-filters > label { flex: 1 1 130px; }
577
- .dsh-hive-filters > button { flex: 0 0 auto; align-self: flex-end; }
578
- .dsh-hive-compose {
579
- display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--hive-border);
580
- border-radius: 12px; background: var(--hive-layer);
581
- }
582
- .dsh-hive-compose textarea { min-height: 52px; border: 0 !important; background: transparent !important; padding: 2px 4px !important; resize: vertical; }
583
- .dsh-hive-compose-foot { justify-content: space-between; align-items: center; }
584
- .dsh-hive-channel-pick { display: inline-flex !important; flex-direction: row; align-items: center; gap: 6px; font-size: .84em !important; }
585
- .dsh-hive-channel-pick select { min-height: 26px !important; padding: 2px 6px !important; font-size: .88em !important; }
586
- .dsh-hive-form { display: grid; gap: 14px; }
587
- .dsh-hive .dsh-hive-check { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; color: var(--hive-ink); font-size: .92em; cursor: pointer; }
588
- .dsh-hive .dsh-hive-check input { min-height: 16px; width: 16px; height: 16px; padding: 0; accent-color: var(--hive-gold); }
589
- .dsh-hive-empty { padding: 36px 20px; display: grid; gap: 10px; }
590
- .dsh-hive-error { margin: 12px 16px; padding: 12px 14px; border: 1px solid var(--hive-danger); border-radius: 8px; background: var(--hive-error-soft); display: grid; gap: 8px; overflow-wrap: anywhere; }
591
-
592
- /* Dialogs & Journal */
593
- .dsh-hive-dialog { color: var(--hive-ink); background: var(--hive-surface); border: 1px solid var(--hive-border); border-radius: 12px; padding: 20px; width: min(660px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); overflow: auto; scrollbar-gutter: stable; }
594
- .dsh-hive-dialog:modal { overscroll-behavior: contain; }
595
- .dsh-hive-dialog[open] { display: grid; gap: 16px; }
596
- .dsh-hive-dialog::backdrop { overflow: hidden; overscroll-behavior: contain; background: rgb(0 0 0 / 48%); }
597
- .dsh-hive-dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--hive-border); }
598
- .dsh-hive-journal-bar { justify-content: space-between; }
599
- .dsh-hive-journal { overflow-wrap: anywhere; display: grid; gap: 12px; padding-inline-start: 16px; border-inline-start: 2px solid var(--hive-border); }
600
- .dsh-hive-journal-turn { position: relative; padding: 12px 14px; border: 1px solid var(--hive-border); border-radius: 10px; background: var(--hive-layer); display: grid; gap: 8px; }
601
- .dsh-hive-journal-turn::before { content: ""; position: absolute; inset-inline-start: -22px; top: 15px; width: 9px; height: 9px; border-radius: 50%; background: var(--hive-gold); border: 2px solid var(--hive-surface); }
602
- .dsh-hive-journal-steps { margin: 0; padding-inline-start: 18px; display: grid; gap: 4px; font-size: .92em; color: var(--hive-muted); }
603
- .dsh-hive-route-item { list-style: none; margin-inline-start: -18px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
604
- .dsh-hive-route-badge { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 5px; padding: 3px 9px; border-radius: 999px; border: 1px solid color-mix(in oklab, var(--hive-good-fill) 44%, var(--hive-border)); background: var(--hive-good-soft); color: var(--hive-good); font-size: .88em; font-weight: 600; }
605
- .dsh-hive-route-badge code { background: transparent; border: 0; padding: 0; color: var(--hive-ink); font-family: var(--hive-mono); font-weight: 620; }
606
- .dsh-hive-route-check { font-weight: 700; }
607
-
608
- /* Pixel Bee Sizes */
609
- .dsh-hive-bee { display: block; width: 24px; height: 22px; image-rendering: pixelated; flex: none; }
610
- .dsh-hive-bee[data-size="xs"] { width: 18px; height: 16px; }
611
- .dsh-hive-bee[data-size="sm"] { width: 20px; height: 18px; }
612
- .dsh-hive-bee[data-size="hive"] { width: 32px; height: 29px; }
613
- .dsh-hive-bee[data-size="lg"] { width: 42px; height: 38px; }
614
- .dsh-hive-bee[data-muted="true"] { filter: grayscale(1) opacity(.68); }
615
-
616
- /* Dual-Mode Graph Controls */
617
- .dsh-hive-graph-view { display: grid; gap: 10px; }
618
- .dsh-hive-graph-controls { display: grid; gap: 10px; padding-bottom: 4px; }
619
- .dsh-hive-replay-row1 { display: flex; align-items: center; gap: 10px; min-width: 0; }
620
- .dsh-hive-transport { gap: 4px; flex: 0 0 auto; }
621
- .dsh-hive .dsh-hive-transport button {
622
- min-width: 30px; min-height: 28px; padding: 2px 7px; border-radius: 6px;
623
- background: transparent; border-color: transparent; color: var(--hive-muted);
624
- font-family: var(--hive-mono); font-weight: 650;
625
- }
626
- .dsh-hive .dsh-hive-transport button:hover:not(:disabled) { color: var(--hive-ink); background: var(--dsw-alias-interactive-bg-hover); }
627
- .dsh-hive .dsh-hive-transport button[aria-label="Replay"],
628
- .dsh-hive .dsh-hive-transport button[aria-label="Pause replay"] {
629
- background: var(--hive-layer); border-color: var(--hive-border); color: var(--hive-ink);
630
- }
631
- .dsh-hive .dsh-hive-scrubber {
632
- flex: 1; min-width: 80px; min-height: 24px; padding: 0; border: 0; background: transparent;
633
- accent-color: var(--hive-ink); cursor: pointer;
634
- }
635
- .dsh-hive .dsh-hive-live-btn {
636
- display: inline-flex; align-items: center; gap: 6px; flex: none;
637
- min-height: 26px; padding: 2px 10px; border-radius: 999px; font-size: .85em; font-weight: 580;
638
- border-color: transparent; background: transparent; color: var(--hive-muted);
639
- }
640
- .dsh-hive .dsh-hive-live-btn[aria-pressed="true"] {
641
- border-color: color-mix(in oklab, var(--hive-good-fill) 42%, var(--hive-border));
642
- background: var(--hive-good-soft); color: var(--hive-ink);
643
- }
644
- .dsh-hive .dsh-hive-live-btn[aria-pressed="true"] .dsh-hive-status-dot { background: var(--hive-good-fill); }
645
-
646
- .dsh-hive-replay-row2 { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; min-width: 0; }
647
- .dsh-hive-graph-stat { font-size: .88em; color: var(--hive-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
648
- .dsh-hive-graph-stat strong { color: var(--hive-ink); font-weight: 640; }
649
-
650
- /* Segmented Control [ Hive | Mentions ] */
651
- .dsh-hive-segmented {
652
- display: inline-flex; align-items: center; padding: 2px; border-radius: 8px;
653
- background: var(--hive-layer); border: 1px solid var(--hive-border); gap: 2px;
654
- }
655
- .dsh-hive .dsh-hive-segmented button {
656
- min-height: 26px; padding: 2px 12px; border: 0; border-radius: 6px;
657
- background: transparent; color: var(--hive-muted); font-size: .88em; font-weight: 560;
658
- }
659
- .dsh-hive .dsh-hive-segmented button[aria-pressed="true"] {
660
- background: var(--hive-surface); color: var(--hive-ink); font-weight: 620;
661
- box-shadow: 0 1px 2px light-dark(rgb(0 0 0 / 8%), rgb(0 0 0 / 30%));
662
- }
663
-
664
- .dsh-hive-graph-options { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-inline-start: auto; }
665
- .dsh-hive-inline-select { display: inline-block; }
666
- .dsh-hive-inline-select select {
667
- min-height: 26px; padding: 2px 8px; font-size: .86em; border-color: transparent;
668
- background: transparent; color: var(--hive-muted);
669
- }
670
- .dsh-hive-inline-select select:hover { color: var(--hive-ink); background: var(--dsw-alias-interactive-bg-hover); }
671
-
672
- /* Pill Switch Toggles */
673
- .dsh-hive-graph-toggles { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
674
- .dsh-hive .dsh-hive-switch {
675
- display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
676
- color: var(--hive-muted); font-size: .86em; white-space: nowrap; position: relative;
677
- }
678
- .dsh-hive .dsh-hive-switch-input {
679
- position: absolute; opacity: 0; width: 30px; height: 18px; margin: 0; min-height: 0; padding: 0; cursor: pointer;
680
- }
681
- .dsh-hive-switch-track {
682
- position: relative; width: 30px; height: 18px; border-radius: 999px; flex: none;
683
- background: color-mix(in oklab, var(--hive-border) 90%, transparent);
684
- border: 1px solid var(--hive-border);
685
- transition: background-color 140ms ease, border-color 140ms ease;
686
- }
687
- .dsh-hive-switch-track::before {
688
- content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px;
689
- border-radius: 50%; background: var(--hive-surface);
690
- box-shadow: 0 1px 2px rgb(0 0 0 / 24%);
691
- }
692
- .dsh-hive .dsh-hive-switch-input:checked + .dsh-hive-switch-track {
693
- background: var(--hive-gold); border-color: var(--hive-gold);
694
- }
695
- .dsh-hive .dsh-hive-switch-input:checked + .dsh-hive-switch-track::before {
696
- transform: translateX(12px);
697
- }
698
- .dsh-hive .dsh-hive-switch-input:focus-visible + .dsh-hive-switch-track {
699
- outline: 2px solid var(--hive-focus); outline-offset: 2px;
700
- }
701
-
702
- .dsh-hive .dsh-hive-export-gif {
703
- display: inline-flex; align-items: center; gap: 5px;
704
- min-height: 26px; padding: 2px 10px; font-size: .86em;
705
- background: transparent; border-color: transparent; color: var(--hive-muted);
706
- }
707
- .dsh-hive .dsh-hive-export-gif:hover:not(:disabled) {
708
- color: var(--hive-ink); background: var(--dsw-alias-interactive-bg-hover); border-color: var(--hive-border);
709
- }
710
- .dsh-hive-gif-error { color: var(--hive-danger); font-size: .86em; }
711
-
712
- /* Graph Stage (Hive + Mentions) */
713
- .dsh-hive-graph {
714
- position: relative; min-width: 280px; overflow: clip;
715
- border-radius: 12px; background: transparent;
716
- color: color-mix(in oklab, var(--hive-ink) 45%, transparent);
717
- }
718
- .dsh-hive-graph > svg { display: block; position: absolute; inset: 0; pointer-events: none; }
719
-
720
- /* Hive Mode Honeycomb Hexes & Bee Slots */
721
- .dsh-hive-hex-poly {
722
- fill: color-mix(in oklab, var(--hive-layer) 75%, var(--hive-surface));
723
- stroke: var(--hive-border); stroke-width: 2.2; stroke-linejoin: round;
724
- }
725
- .dsh-hive-hex-cell[data-tone="done"] .dsh-hive-hex-poly {
726
- fill: color-mix(in oklab, var(--hive-good-fill) 7%, var(--hive-surface));
727
- stroke: var(--hive-good-fill);
728
- }
729
- .dsh-hive-hex-cell[data-tone="working"] .dsh-hive-hex-poly {
730
- fill: color-mix(in oklab, var(--hive-working) 7%, var(--hive-surface));
731
- stroke: var(--hive-working);
732
- }
733
- .dsh-hive-hex-cell[data-tone="waiting"] .dsh-hive-hex-poly {
734
- fill: color-mix(in oklab, var(--hive-wait) 7%, var(--hive-surface));
735
- stroke: var(--hive-wait);
736
- }
737
- .dsh-hive-hex-cell[data-tone="needs"] .dsh-hive-hex-poly {
738
- fill: color-mix(in oklab, var(--hive-amber) 9%, var(--hive-surface));
739
- stroke: var(--hive-amber);
740
- }
741
- .dsh-hive-hex-title { fill: var(--hive-ink); font-size: 11.5px; font-weight: 660; }
742
- .dsh-hive-hex-count { fill: var(--hive-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
743
- .dsh-hive-hex-connector { stroke: var(--hive-good-fill); stroke-width: 1.8; stroke-linecap: round; }
744
- .dsh-hive-hex-connector[data-kind="message"] { stroke: var(--hive-pulse); stroke-width: 2.2; }
745
- .dsh-hive-hex-connector[data-kind="waiting"] { stroke: var(--hive-amber); stroke-width: 1.8; color: var(--hive-amber); }
746
-
747
- .dsh-hive .dsh-hive-hex-bee-btn,
748
- .dsh-hive .dsh-hive-hex-coord-btn {
749
- position: absolute; transform: translate(-50%, -50%);
750
- display: grid; justify-items: center; gap: 2px;
751
- min-height: 24px; padding: 3px 1px; border-radius: 8px;
752
- border: 1px solid transparent; background: transparent;
753
- }
754
- .dsh-hive .dsh-hive-hex-bee-btn:hover:not(:disabled),
755
- .dsh-hive .dsh-hive-hex-coord-btn:hover:not(:disabled) {
756
- background: color-mix(in oklab, var(--hive-surface) 72%, transparent);
757
- border-color: var(--hive-border);
758
- }
759
- .dsh-hive .dsh-hive-hex-bee-btn[aria-pressed="true"],
760
- .dsh-hive .dsh-hive-hex-coord-btn[aria-pressed="true"] {
761
- background: var(--hive-surface); border-color: var(--hive-gold);
762
- }
763
- .dsh-hive-hex-bee-name {
764
- display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
765
- font-size: 9.5px; line-height: 1.35; color: var(--hive-muted);
766
- }
767
-
768
- /* Mentions Mode Capsule Pills */
769
- .dsh-hive-edge-hit { pointer-events: stroke; cursor: pointer; }
770
- .dsh-hive-edge { stroke: color-mix(in oklab, var(--hive-ink) 34%, transparent); fill: none; stroke-linecap: round; pointer-events: none; transition: opacity 150ms ease, stroke 150ms ease; }
771
- .dsh-hive-edge[data-active="true"] { stroke: var(--hive-gold); }
772
- .dsh-hive-edge-tip { fill: var(--hive-gold); pointer-events: none; }
773
- .dsh-hive-edge-pill { pointer-events: none; }
774
- .dsh-hive-edge-pill rect { fill: var(--hive-surface); stroke: transparent; }
775
- .dsh-hive-edge-pill text { fill: var(--hive-muted); font-family: var(--hive-mono); font-size: 10px; font-weight: 640; font-variant-numeric: tabular-nums; }
776
- .dsh-hive-edge-pill[data-active="true"] rect { stroke: var(--hive-gold); }
777
- .dsh-hive-edge-pill[data-active="true"] text { fill: var(--hive-gold); }
778
-
779
- .dsh-hive .dsh-hive-graph-pill {
780
- position: absolute; transform: translate(-50%, -50%);
781
- display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
782
- min-height: 30px; padding: 4px 11px 4px 8px; border-radius: 999px;
783
- background: var(--hive-surface); border: 1px solid var(--hive-border);
784
- box-shadow: 0 1px 4px light-dark(rgb(0 0 0 / 6%), rgb(0 0 0 / 28%));
785
- font-size: .85em; line-height: 1.2;
786
- transition: opacity 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
787
- }
788
- .dsh-hive .dsh-hive-graph-pill:hover:not(:disabled) { border-color: color-mix(in oklab, var(--hive-gold) 65%, var(--hive-border)); background: var(--hive-surface); }
789
- .dsh-hive .dsh-hive-graph-pill[data-role="coordinator"] { border-color: color-mix(in oklab, var(--hive-gold) 48%, var(--hive-border)); }
790
- .dsh-hive .dsh-hive-graph-pill[data-unmentioned="true"] { border-style: dashed; border-color: color-mix(in oklab, var(--hive-ink) 40%, var(--hive-border)); }
791
- .dsh-hive .dsh-hive-graph-pill[aria-pressed="true"] { border-style: solid; border-color: var(--hive-gold); box-shadow: 0 0 0 2px var(--hive-gold-soft); }
792
- .dsh-hive .dsh-hive-graph-pill[data-dimmed="true"] { opacity: .34; }
793
- .dsh-hive-graph-pill-name { font-weight: 600; color: var(--hive-ink); }
794
- .dsh-hive .dsh-hive-graph-pill[data-retired="true"] .dsh-hive-graph-pill-name { text-decoration: line-through; color: var(--hive-muted); }
795
- .dsh-hive-node-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--hive-muted); opacity: .75; flex: none; }
796
- .dsh-hive-node-broadcast {
797
- position: absolute; top: -9px; inset-inline-end: 8px;
798
- padding: 0 5px; border-radius: 999px; border: 1px solid var(--hive-border);
799
- background: var(--hive-surface); color: var(--hive-muted); font-family: var(--hive-mono); font-size: 9.5px; font-weight: 620;
800
- }
801
-
802
- /* Legends */
803
- .dsh-hive-graph-legend {
804
- display: flex; align-items: center; flex-wrap: wrap; gap: 8px 18px;
805
- padding: 6px 2px; font-size: .84em; color: var(--hive-muted);
806
- }
807
- .dsh-hive-legend-item { display: inline-flex; align-items: center; gap: 6px; }
808
- .dsh-hive-legend-item[data-legend="done"]::before { content: ""; width: 16px; border-top: 2px solid var(--hive-good-fill); }
809
- .dsh-hive-legend-item[data-legend="message"]::before { content: ""; width: 16px; border-top: 2px solid var(--hive-pulse); }
810
- .dsh-hive-legend-item[data-legend="waiting"]::before { content: "---\u25B8"; font-family: var(--hive-mono); color: var(--hive-amber); letter-spacing: -1px; font-weight: 700; }
811
- .dsh-hive-legend-item[data-legend="mention"]::before { content: "\u2192"; font-family: var(--hive-mono); color: var(--hive-muted); }
812
- .dsh-hive-legend-item[data-legend="broadcast"]::before { content: "\u21E2"; font-family: var(--hive-mono); color: var(--hive-muted); }
813
- .dsh-hive-legend-item[data-legend="unmentioned"]::before {
814
- content: ""; width: 14px; height: 10px; border-radius: 999px;
815
- border: 1px dashed color-mix(in oklab, var(--hive-ink) 50%, var(--hive-border));
816
- }
817
- .dsh-hive-all-badge {
818
- display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 999px;
819
- background: var(--hive-layer); border: 1px solid var(--hive-border);
820
- color: var(--hive-ink); font-family: var(--hive-mono); font-size: .88em; font-weight: 600;
821
- }
822
-
823
- .dsh-hive-selected-post { padding: 12px 14px; border: 1px solid var(--hive-border); border-radius: 10px; background: var(--hive-card); display: grid; gap: 8px; }
824
- .dsh-hive-flow-list { padding-inline-start: 18px; margin: 0; font-size: .88em; font-family: var(--hive-mono); font-variant-numeric: tabular-nums; display: grid; gap: 3px; color: var(--hive-muted); }
825
-
826
- /* Motion: strictly opt-in under prefers-reduced-motion: no-preference */
827
- @media (prefers-reduced-motion: no-preference) {
828
- .dsh-hive details::details-content {
829
- interpolate-size: allow-keywords;
830
- overflow: clip;
831
- contain: layout;
832
- transition: block-size, content-visibility, display;
833
- transition-duration: .24s;
834
- transition-timing-function: ease-out;
835
- transition-behavior: allow-discrete;
836
- }
837
- .dsh-hive details:not([open])::details-content { block-size: 0; }
838
- .dsh-hive .dsh-hive-chevron { transition: rotate 180ms ease; }
839
- .dsh-hive .dsh-hive-switch-track::before { transition: transform 150ms cubic-bezier(.22, 1, .36, 1); }
840
- .dsh-hive .dsh-hive-graph-pill { transition: opacity 150ms ease, border-color 150ms ease, box-shadow 150ms ease, transform 150ms cubic-bezier(.22, 1, .36, 1); }
841
- .dsh-hive .dsh-hive-graph-pill:hover:not(:disabled) { transform: translate(-50%, calc(-50% - 2px)); }
842
- }
843
- @media (prefers-reduced-motion: reduce) {
844
- .dsh-hive { scroll-behavior: auto; }
845
- }
846
- @media (forced-colors: active) {
847
- .dsh-hive-tabs button[aria-selected="true"]::after { border-block-end-color: Highlight; }
848
- .dsh-hive-status, .dsh-hive-mode, .dsh-hive-route-badge, .dsh-hive .dsh-hive-bee-pill,
849
- .dsh-hive .dsh-hive-graph-pill[aria-pressed="true"],
850
- .dsh-hive .dsh-hive-hex-bee-btn[aria-pressed="true"],
851
- .dsh-hive-switch-track { border: 1px solid ButtonText; forced-color-adjust: auto; }
852
- .dsh-hive-hex-poly { stroke: ButtonText; fill: Canvas; }
853
- .dsh-hive-hex-connector, .dsh-hive-edge, .dsh-hive-edge[data-active="true"] { stroke: CanvasText; }
854
- .dsh-hive-edge-tip { fill: Highlight; }
855
- }
856
- @container (min-width: 760px) {
857
- .dsh-hive-content { padding: 20px 24px 32px; }
858
- }
859
- @container (max-width: 360px) {
860
- .dsh-hive-header, .dsh-hive-content { padding-inline: 12px; }
861
- .dsh-hive-tabs { padding-inline: 12px; gap: 12px; }
862
- .dsh-hive-filters { display: grid; grid-template-columns: 1fr; }
863
- .dsh-hive-facts > div { grid-template-columns: 1fr; gap: 2px; }
864
- .dsh-hive-line time { width: 100%; margin: 0; }
865
- .dsh-hive-team-card { flex-direction: column; }
866
- }
867
- `;var ao=typeof document<"u"?e.useLayoutEffect:e.useEffect,Ft="hive-swarm:dsh:graph-mode",Et="hive-swarm:dsh:dismissed-update",lo="2.1.1".trim(),ho=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/,co=typeof We.default.drawSprite=="function",uo="data:image/svg+xml,"+encodeURIComponent(Tt);function et({size:o=22,className:i}){return e.default.createElement("img",{src:uo,width:o,height:o,className:i,alt:"","aria-hidden":"true","data-dsh-panel-entry":"dsh-hive-swarm"})}function Ee({name:o,status:i,coordinator:d=!1,tint:p,muted:m=!1,size:n="md"}){let N=(0,e.useRef)(null),k=m&&!co?"working":i;return(0,e.useEffect)(()=>{let C=N.current;if(!C)return;let y=C.getContext("2d");if(y){y.clearRect(0,0,C.width,C.height);let c=We.default.sprite(o,{status:k,coordinator:d,tint:p,muted:m});c&&y.drawImage(c,0,0)}},[o,k,d,p,m]),e.default.createElement("canvas",{ref:N,width:"20",height:"18","aria-hidden":"true",className:"dsh-hive-bee","data-size":n,"data-muted":m?"true":void 0})}var Wt=()=>{},De=(o,i,d)=>{o.command(i,d).catch(Wt)},Dt={working:"Live",waiting:"Waiting",done:"Done",paused:"Paused",budget:"Turn limit",stalled:"Needs you",quota:"Quota reached",retired:"Retired",failed:"Needs you",queued:"Queued",blocked:"Blocked",active:"Active"},_e={working:"Working",waiting:"Waiting",done:"Done",paused:"Paused",budget:"Turn limit",stalled:"Needs you",quota:"Quota reached",retired:"Retired",failed:"Failed",queued:"Queued",blocked:"Blocked",active:"Active"},It={subagent:"Subagent",attached:"Attached",session:"Session"};function tt({value:o,compactView:i=!1}){return e.default.createElement("span",{className:i?"dsh-hive-header-status":"dsh-hive-status","data-status":o},e.default.createElement("span",{className:"dsh-hive-status-dot","aria-hidden":"true"}),(i?Dt:_e)[o]??o??"Ready")}function po({mode:o,subagentName:i}){return!o||!Object.hasOwn(It,o)?null:e.default.createElement("span",{className:"dsh-hive-mode","data-mode":o,title:i?"Subagent: "+i:void 0},It[o])}function fo({title:o,children:i}){return e.default.createElement("section",{className:"dsh-hive-empty"},e.default.createElement("h2",null,o),e.default.createElement("p",null,i))}function jt({error:o,controller:i}){return e.default.createElement("div",{role:"alert",className:"dsh-hive-error"},e.default.createElement("p",null,o.message),e.default.createElement("p",{className:"dsh-hive-secondary"},o.action?"The action may have reached the Host. Refresh to inspect the result, or retry the same request.":"Check the Host connection and workspace permission, then refresh."),e.default.createElement("div",{className:"dsh-hive-actions"},e.default.createElement("button",{type:"button",onClick:()=>i.refresh()},"Refresh"),i.getSnapshot().selectedId&&!i.getSnapshot().team?e.default.createElement("button",{type:"button",onClick:i.showTeams},"Show teams"):null,o.action?e.default.createElement("button",{type:"button",disabled:i.getSnapshot().pending,onClick:()=>{i.retryCommand().catch(Wt)}},"Retry action"):null))}function ct({className:o="dsh-hive-chevron"}){return e.default.createElement("svg",{className:o,width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true"},e.default.createElement("path",{d:"M4 6l4 4 4-4",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"}))}function lt({status:o,recovery:i=!1}){return i||["failed","quota","stalled","blocked"].includes(o)?e.default.createElement("span",{className:"dsh-hive-glyph","data-tone":"danger","aria-hidden":"true"},"!"):o==="done"?e.default.createElement("span",{className:"dsh-hive-glyph","data-tone":"done","aria-hidden":"true"},"\u2713"):o==="working"||o==="active"?e.default.createElement("span",{className:"dsh-hive-glyph","data-tone":"active","aria-hidden":"true"},e.default.createElement("span",{className:"dsh-hive-glyph-dot"})):e.default.createElement("span",{className:"dsh-hive-glyph","data-tone":"idle","aria-hidden":"true"},e.default.createElement("span",{className:"dsh-hive-glyph-dot"}))}function je({seq:o,onJumpPost:i}){return i?e.default.createElement("button",{type:"button",className:"dsh-hive-ref","aria-label":"Jump to post #"+o,onClick:()=>i(o)},"#",o):"#"+o}function _t(o){try{let i=new URL(o);return["http:","https:"].includes(i.protocol)?i.href:null}catch{return null}}function mo(o){if(typeof o!="string")return null;let i=o.trim();if(!i)return null;if(i.startsWith("/api/hive-swarm/v1/screenshot")||i.startsWith("/board/")||/^data:image\/(png|jpe?g|webp|gif);base64,/i.test(i))return i;try{let d=new URL(i);return["http:","https:","blob:"].includes(d.protocol)?d.href:null}catch{return null}}function Ve(o,i,d="i"){let p=[],m=0,n=0,N=/\x60([^\x60\n]+)\x60|\*\*([^\n]+?)\*\*|\*([^*\n]+)\*|\[([^\]\n]+)\]\(([^\s)]+)\)|\[(done|stall)\]|(?<![a-z0-9_])(@#?[a-z][a-z0-9_-]*|#[1-9]\d*\b)/gi;for(let k of o.matchAll(N)){m<k.index&&p.push(o.slice(m,k.index));let C=d+"-"+n++;if(k[1])p.push(e.default.createElement("code",{key:C},k[1]));else if(k[2])p.push(e.default.createElement("strong",{key:C},Ve(k[2],i,C)));else if(k[3])p.push(e.default.createElement("em",{key:C},Ve(k[3],i,C)));else if(k[4]){let y=_t(k[5]);p.push(y?e.default.createElement("a",{key:C,href:y,target:"_blank",rel:"noopener noreferrer"},k[4]):k[0])}else if(k[6])p.push(e.default.createElement("span",{key:C,className:"dsh-hive-badge","data-badge":k[6].toLowerCase()},k[0]));else if(k[0].startsWith("@"))p.push(e.default.createElement("span",{key:C,className:"dsh-hive-mention"},k[0]));else{let y=Number(k[0].slice(1));p.push(Number.isSafeInteger(y)?e.default.createElement(je,{key:C,seq:y,onJumpPost:i}):k[0])}m=k.index+k[0].length}return m<o.length&&p.push(o.slice(m)),p}function zt(o,i,d="b"){let p=[],m=[],n=null,N=0,k=()=>{if(!m.length)return;let y=d+"-p"+N++;p.push(e.default.createElement("p",{key:y,className:"dsh-hive-prose"},Ve(m.join(`
868
- `),i,y))),m=[]},C=()=>{if(!n)return;let y=d+"-l"+N++,c=n.items.map((x,w)=>e.default.createElement("li",{key:w},Ve(x,i,y+"-"+w)));p.push(n.ordered?e.default.createElement("ol",{key:y,className:"dsh-hive-list",start:n.start},c):e.default.createElement("ul",{key:y,className:"dsh-hive-list"},c)),n=null};for(let y of o.split(/\r?\n/)){let c=/^ {0,3}(#{1,3})\s+(.+)$/.exec(y),x=/^ {0,3}([-*+]|\d+[.)])\s+(.+)$/.exec(y);if(c){k(),C();let w=d+"-h"+N++,b="h"+(2+c[1].length);p.push(e.default.createElement(b,{key:w},Ve(c[2],i,w)))}else if(x){k();let w=/^\d/.test(x[1]);(!n||n.ordered!==w)&&(C(),n={ordered:w,start:w?Number.parseInt(x[1],10):1,items:[]}),n.items.push(x[2])}else C(),y.trim()?m.push(y):k()}return k(),C(),p}function Oe({text:o,onJumpPost:i}){let d=String(o??""),p=[],m=0,n=0,N=/^[ \t]*\x60{3}[^\r\n\x60]*\r?\n([\s\S]*?)^[ \t]*\x60{3}[ \t]*\r?$/gm;for(let C of d.matchAll(N)){let y=d.slice(m,C.index);y.trim()&&p.push(...zt(y,i,"s"+n++)),p.push(e.default.createElement("pre",{key:"c"+n++,className:"dsh-hive-code"},e.default.createElement("code",null,C[1].replace(/\r?\n$/,"")))),m=C.index+C[0].length}let k=d.slice(m);return(k.trim()||!p.length)&&p.push(...zt(k,i,"s"+n++)),e.default.createElement("div",{className:"dsh-hive-rich"},p)}function Ae(o,i=140){let d=String(o??"").replace(/\s+/g," ").trim();return d.length>i?d.slice(0,i-1).trimEnd()+"\u2026":d}function ut(o){if(typeof Te.default.smartTaskLabel=="function")return Te.default.smartTaskLabel(o);let i=String(o?.taskLabel??"").trim();if(i)return Ae(i,64);let d=String(o?.brief??"").replace(/[`*_#>\[\]]/g," ").replace(/\s+/g," ").trim();d=d.replace(/^You are\s+(?:@[a-z0-9_-]+\s+)?(?:an?\s+|the\s+)?(?:Hive Swarm\s+)?(?:member|worker|agent|author|verifier|researcher|investigator|auditor|reviewer)?[^.:\n]*?(?:[.:]\s+|\s+—\s+|\s+-\s+)/i,""),d=d.replace(/^(?:Your\s+)?(?:assignment|mission|role|task)(?:\s*\([^)]*\))?\s*[:\-–—]\s*/i,""),d=d.replace(/^You\s+own\s+(?:the\s+)?/i,"");let m=(d.split(/(?<=[.!?])\s+|\s*;\s*|\r?\n/)[0]?.trim()??"").replace(/[.:,;!?]+$/,"").split(/\s+/).filter(Boolean);for(m.length>10&&(m=m.slice(0,10));m.length>2&&/^(?:for|in|on|with|to|of|from|by|at|and|or|the|a|an)$/i.test(m.at(-1));)m.pop();let n=m.join(" ").trim();return Ae(n||o?.name||"Task",64)}function pt(o,i=!1,d){if(typeof We.default.tintStyle=="function")return We.default.tintStyle(o,i,d);let[p,m,n]=We.default.colors(o,i,d);return{base:p,highlight:m,shade:n,bg:"color-mix(in oklab, "+p+" 16%, transparent)",border:"color-mix(in oklab, "+n+" 42%, var(--hive-border))",text:"var(--hive-ink)"}}function ot(o){let i=o?.members??[],p=i.some(n=>n.role==="coordinator"||n.name==="coordinator")?i:[{name:"coordinator",role:"coordinator",external:!0,status:o?.phase==="done"?"done":"waiting",model:o?.model,effort:o?.effort,brief:o?.task??"Coordinator",waitFor:[]},...i],m=0;return p.map(n=>n.role==="coordinator"||n.name==="coordinator"?{...n,role:"coordinator",tint:0}:{...n,tint:m++})}function $e({member:o,name:i,coordinator:d=!1,tint:p,muted:m=!1,onClick:n,title:N,ariaLabel:k}){let C=i??o?.name??"member",y=pt(C,d,p??o?.tint),c={"--bee-pill-bg":y.bg,"--bee-pill-border":y.border},x=e.default.createElement(e.default.Fragment,null,e.default.createElement(Ee,{name:C,status:o?.status??"waiting",coordinator:d,tint:p??o?.tint,muted:m,size:"xs"}),e.default.createElement("span",null,C));return n?e.default.createElement("button",{type:"button",className:"dsh-hive-bee-pill",style:c,title:N,"aria-label":k??"Inspect "+C,onClick:n},x):e.default.createElement("span",{className:"dsh-hive-bee-pill","data-static":"true",style:c,title:N},x)}function vo(o,i){let d=(o.members??[]).map(p=>i.find(m=>m.name===p)).filter(Boolean);return d.some(p=>p.recoveryRequired||["failed","quota"].includes(p.status))?{key:"blocked",rank:0}:d.some(p=>p.status==="working")?{key:"active",rank:1}:d.some(p=>p.status==="queued")?{key:"queued",rank:2}:d.some(p=>p.status==="waiting")?{key:"waiting",rank:3}:d.length&&d.every(p=>["done","retired"].includes(p.status))?{key:"done",rank:4}:{key:"queued",rank:2}}function Ot(o,i,d){if(o.status==="working"){let n=i?.steps?.findLast(N=>N?.label?.trim())?.label;return Ae(n)||(o.lastTurn?"Working on turn "+o.lastTurn:"Working on the current turn")}if(o.recoveryRequired)return"Outcome unconfirmed. Inspect journal before continuing.";if(["quota","failed"].includes(o.status))return Ae(d?.text)||_e[o.status]||o.status;let p=o.pendingWaitFor??o.waitFor;if(p?.length)return Ae("Waiting on "+p.map(n=>"@"+n).join(", "));let m=/\[done\]\s*([^\r?\n]+)/i.exec(d?.text??"");return m?Ae(m[1]):o.status==="waiting"?"Waiting for an @mention":o.status==="queued"?"Queued for the next turn":Ae(d?.text?.split(/\r?\n/)[0])||_e[o.status]||o.status}function it({title:o,onClose:i,opener:d,closeOnBackdrop:p=!1,className:m="dsh-hive-dialog",children:n}){let N=(0,e.useRef)(null),k=(0,e.useRef)(null),C=(0,e.useId)().replace(/[^a-zA-Z0-9_-]/g,"");return(0,e.useLayoutEffect)(()=>{let y=N.current;if(!y)return;typeof y.showModal=="function"?y.showModal():y.setAttribute("open",""),k.current?.focus();let c;if(p&&typeof HTMLDialogElement<"u"&&!("closedBy"in HTMLDialogElement.prototype)){let x=!1,w=q=>{let z=y.getBoundingClientRect();return q.clientX<z.left||q.clientX>z.right||q.clientY<z.top||q.clientY>z.bottom},b=q=>{x=w(q)},P=q=>{x&&w(q)&&i()};y.addEventListener("pointerdown",b),y.addEventListener("pointerup",P),c=()=>{y.removeEventListener("pointerdown",b),y.removeEventListener("pointerup",P)}}return()=>{c?.(),y.open&&typeof y.close=="function"&&y.close(),d?.isConnected&&d.focus()}},[d,p,i]),e.default.createElement("dialog",{ref:N,className:m,"aria-labelledby":C,...p?{closedby:"any"}:{},onCancel:y=>{y.preventDefault(),i()},onKeyDown:y=>{y.key==="Escape"&&(y.preventDefault(),i())}},e.default.createElement("header",{className:"dsh-hive-dialog-head"},e.default.createElement("h2",{id:C},o),e.default.createElement("button",{type:"button",ref:k,"aria-label":"Close "+o,onClick:i},"Close")),n)}function go({step:o}){let i=typeof o=="string"?o:String(o?.label??""),d=typeof o=="object"&&o?.detail?String(o.detail):"",p=/^Verified route:\s*(.+)$/i.exec(i);if(p||typeof o=="object"&&o?.kind==="route"){let m=p?p[1]:i;return e.default.createElement("li",{className:"dsh-hive-route-item"},e.default.createElement("span",{className:"dsh-hive-route-badge"},e.default.createElement("span",{className:"dsh-hive-route-check","aria-hidden":"true"},"\u2713"),"Verified route: ",e.default.createElement("code",null,m)),d?e.default.createElement("span",{className:"dsh-hive-secondary"}," \u2014 ",d):null)}return e.default.createElement("li",null,i,d?" \u2014 "+d:"")}function bo({controller:o,journal:i,opener:d,onClose:p,onJumpPost:m}){let n=N=>{p(),m(N)};return e.default.createElement(it,{title:"Journal",onClose:p,opener:d,closeOnBackdrop:!0},e.default.createElement("div",{className:"dsh-hive-actions dsh-hive-journal-bar"},e.default.createElement("strong",null,"@",i.member),e.default.createElement("button",{type:"button",disabled:i.loading,onClick:()=>{o.openJournal(i.member)}},"Refresh Journal")),i.loading?e.default.createElement("p",{role:"status"},"Loading Journal\u2026"):i.error?e.default.createElement(jt,{error:i.error,controller:{...o,refresh:()=>o.openJournal(i.member)}}):i.turns.length?e.default.createElement("ol",{className:"dsh-hive-journal"},i.turns.map((N,k)=>e.default.createElement("li",{key:N.turn??k,className:"dsh-hive-journal-turn"},e.default.createElement("div",{className:"dsh-hive-line"},e.default.createElement("h3",null,"Turn ",N.turn??k+1),e.default.createElement(tt,{value:N.status})),N.steps?.length?e.default.createElement("ul",{className:"dsh-hive-journal-steps"},N.steps.map((C,y)=>e.default.createElement(go,{key:y,step:C}))):null,N.report?e.default.createElement(Oe,{text:N.report,onJumpPost:n}):e.default.createElement("p",{className:"dsh-hive-secondary"},"No report saved for this turn.")))):e.default.createElement("p",null,"No saved turns yet. Live work appears here after the Host records it."),i.live?.steps?.length?e.default.createElement("section",{className:"dsh-hive-live"},e.default.createElement("h3",null,"Current activity"),e.default.createElement("ul",null,i.live.steps.map((N,k)=>e.default.createElement("li",{key:k},typeof N=="string"?N:N.label)))):null)}function Re({memberName:o,pending:i,controller:d}){return e.default.createElement(e.default.Fragment,null,e.default.createElement("button",{type:"button",disabled:i,"aria-label":"Retry fresh turn for @"+o,onClick:()=>De(d,"resolve_recovery",{member:o,action:"retry"})},"Retry fresh turn"),e.default.createElement("button",{type:"button",disabled:i,"aria-label":"Dismiss unconfirmed run for @"+o,onClick:()=>De(d,"resolve_recovery",{member:o,action:"dismiss"})},"Dismiss"))}function Lt({className:o,defaultOpen:i=!1,summary:d,children:p}){let[m,n]=(0,e.useState)(i);return e.default.createElement("details",{className:o,open:m},e.default.createElement("summary",{className:o==="dsh-hive-task-card"?"dsh-hive-task-summary":"dsh-hive-thread-head",onClick:N=>{N.preventDefault(),n(k=>!k)}},d),p)}function yo({state:o,controller:i,onJournal:d,onJumpPost:p,onMention:m}){let n=o.team,N=o.history.length?o.history:n.events??[],k=(0,e.useMemo)(()=>ot(n),[n]),C=(0,e.useMemo)(()=>new Map(k.map(a=>[a.name,a])),[k]),y=(0,e.useMemo)(()=>{let a=new Map;for(let A of N)A.kind!=="brief"&&A.author!=="system"&&a.set(A.author,A);return a},[N]),c=n.members.filter(a=>a.role!=="coordinator"&&a.name!=="coordinator"&&a.status!=="retired"),x=c.filter(a=>a.status==="done").length,w=c.length>0&&x===c.length,b=n.task?.trim()??"",P=n.goalLine?.trim()??"",q=b.length>140||/\n/.test(b),z=n.members.filter(a=>a.recoveryRequired||["quota","failed"].includes(a.status)),J=(n.attention??[]).filter(a=>["stalled","budget"].includes(n.phase)||["recovery","input","quota","failed","dependency","cycle"].includes(a.kind)),g=J.length>0||z.length>0||n.phase==="budget"||n.phase==="stalled",T=(0,e.useMemo)(()=>k.filter(a=>a.role!=="coordinator"&&a.name!=="coordinator"&&a.status!=="retired").map(a=>({member:a,latest:y.get(a.name)})).sort((a,A)=>(A.latest?.seq??0)-(a.latest?.seq??0)),[k,y]),G=(0,e.useMemo)(()=>(n.threads?.length?n.threads:c.length?[{id:"tasks",title:"Tasks",members:c.map(A=>A.name)}]:[]).map(A=>({thread:A,state:vo(A,n.members)})).sort((A,r)=>A.state.rank-r.state.rank),[n.threads,n.members,c]),$=(0,e.useMemo)(()=>(n.screenshots??[]).map((a,A)=>{let r=mo(a?.url);return r?{...a,id:a.id??a.seq+":"+A,url:r}:null}).filter(Boolean),[n.screenshots]),[O,h]=(0,e.useState)(null),W=k.find(a=>a.role==="coordinator"||a.name==="coordinator"),Z=n.members.some(a=>a.role==="coordinator"||a.name==="coordinator"),re=(0,e.useMemo)(()=>N.findLast(a=>a.author==="coordinator"&&a.kind!=="brief")??N.findLast(a=>a.author==="user"&&a.kind!=="brief"&&/\[done\]/i.test(a.text??""))??(Z?void 0:N.findLast(a=>a.author==="user"&&a.kind!=="brief")),[N,Z]),pe=re?.text?.trim()??"",ne=pe?Ae(pe.replace(/^\[done\]\s*/i,""),180):"",L=pe.length>180||/\n/.test(pe),R=(a,A)=>{if(Le(a)){d(a.name,A);return}let r=y.get(a.name);r?p(r.seq):a.status!=="retired"&&!a.retireAfterTurn&&m(a.name)};return e.default.createElement("div",{className:"dsh-hive-overview"},P?e.default.createElement("p",{className:"dsh-hive-goal-line"},P):!q&&b&&b!==n.title?e.default.createElement("p",{className:"dsh-hive-goal-line"},b):null,q?e.default.createElement("details",{className:"dsh-hive-details dsh-hive-brief-disclosure"},e.default.createElement("summary",null,"Full brief"),e.default.createElement(Oe,{text:b,onJumpPost:p})):null,e.default.createElement(Lt,{className:"dsh-hive-task-card",defaultOpen:!1,summary:e.default.createElement(e.default.Fragment,null,e.default.createElement(lt,{status:z.length?"failed":w?"done":"working",recovery:z.some(a=>a.recoveryRequired)}),e.default.createElement("span",{className:"dsh-hive-task-count"},e.default.createElement("strong",null,x," of ",c.length)," tasks done"),e.default.createElement("span",{className:"dsh-hive-task-turns"},"Turns ",n.turns,"/",n.turnLimit),e.default.createElement(ct,null))},e.default.createElement("div",{className:"dsh-hive-task-body"},T.length?e.default.createElement("ul",{className:"dsh-hive-task-list"},T.map(({member:a,latest:A})=>{let r=Ot(a,n.activity?.[a.name],A),M=a.status==="retired";return e.default.createElement("li",{key:a.name,className:"dsh-hive-task-row"},e.default.createElement(lt,{status:a.status,recovery:a.recoveryRequired}),e.default.createElement("div",{className:"dsh-hive-task-main"},e.default.createElement("div",{className:"dsh-hive-task-title"},ut(a)),e.default.createElement("div",{className:"dsh-hive-task-sub"},r),a.recoveryRequired?e.default.createElement("div",{className:"dsh-hive-actions dsh-hive-inline-actions"},e.default.createElement(Re,{memberName:a.name,pending:o.pending||a.status==="working",controller:i})):null),e.default.createElement($e,{member:a,muted:M,title:Le(a)?"Inspect @"+a.name+" Journal":"View @"+a.name,ariaLabel:(Le(a)?"Inspect journal for @":"Jump to @")+a.name,onClick:f=>R(a,f.currentTarget)}))})):e.default.createElement("p",{className:"dsh-hive-secondary dsh-hive-task-empty"},"No worker tasks assigned yet."))),g?e.default.createElement("section",{className:"dsh-hive-section"},e.default.createElement("h2",null,"Needs you"),e.default.createElement("ul",{className:"dsh-hive-attention"},J.map((a,A)=>{let r=n.members.find(M=>M.name===a.member);return e.default.createElement("li",{key:"a-"+A,className:"dsh-hive-alert-card","data-kind":a.kind},e.default.createElement("p",null,a.text??a.message??a.kind),e.default.createElement("div",{className:"dsh-hive-actions"},a.seq?e.default.createElement(je,{seq:a.seq,onJumpPost:p}):null,a.kind==="budget"?e.default.createElement("button",{type:"button",disabled:o.pending,onClick:()=>De(i,"resume_team",{extraTurns:8})},"Add 8 turns and resume"):null,Le(r)?e.default.createElement("button",{type:"button",onClick:M=>d(a.member,M.currentTarget)},"Inspect @",a.member):null,r?.recoveryRequired?e.default.createElement(Re,{memberName:r.name,pending:o.pending||r.status==="working",controller:i}):null))}),z.filter(a=>!J.some(A=>A.member===a.name)).map(a=>e.default.createElement("li",{key:a.name,className:"dsh-hive-alert-card","data-kind":a.recoveryRequired?"recovery":a.status},e.default.createElement("p",null,"@",a.name,": ",a.recoveryRequired?"Outcome unconfirmed. Inspect the owned session before continuing.":a.status==="quota"?"Model quota reached. Choose an available model before resuming.":"The last turn failed. Inspect the Journal for recovery details."),e.default.createElement("div",{className:"dsh-hive-actions"},Le(a)?e.default.createElement("button",{type:"button",onClick:A=>d(a.name,A.currentTarget)},"Inspect Journal"):null,a.recoveryRequired?e.default.createElement(Re,{memberName:a.name,pending:o.pending||a.status==="working",controller:i}):null))),n.phase==="budget"&&!J.some(a=>a.kind==="budget")?e.default.createElement("li",{key:"budget-alert",className:"dsh-hive-alert-card","data-kind":"budget"},e.default.createElement("p",null,"Turn limit reached (",n.turns,"/",n.turnLimit,"). Add 8 turns to continue."),e.default.createElement("div",{className:"dsh-hive-actions"},e.default.createElement("button",{type:"button",disabled:o.pending,onClick:()=>De(i,"resume_team",{extraTurns:8})},"Add 8 turns and resume"))):null)):null,G.length?e.default.createElement("section",{className:"dsh-hive-section"},e.default.createElement("h2",null,"Threads"),e.default.createElement("div",{className:"dsh-hive-threads"},G.map(({thread:a,state:A})=>{let r=(a.members??[]).map(Y=>C.get(Y)??{name:Y,status:"queued",brief:a.goal??Y}),M=r.length,f=r.filter(Y=>["done","retired"].includes(Y.status)).length,te=G.length===1||["blocked","active","done"].includes(A.key);return e.default.createElement(Lt,{key:a.id??a.title,className:"dsh-hive-thread-card",defaultOpen:te,summary:e.default.createElement(e.default.Fragment,null,e.default.createElement("span",{className:"dsh-hive-thread-left"},e.default.createElement("span",{className:"dsh-hive-thread-dot","data-status":A.key,"aria-hidden":"true"}),e.default.createElement("strong",{className:"dsh-hive-thread-title"},a.title),e.default.createElement("span",{className:"dsh-hive-thread-state"},Dt[A.key]??A.key)),e.default.createElement("span",{className:"dsh-hive-thread-right"},e.default.createElement("progress",{className:"dsh-hive-mini-progress",max:Math.max(M,1),value:f,"aria-label":a.title+" progress"}),e.default.createElement("span",{className:"dsh-hive-thread-ratio"},f,"/",M),e.default.createElement(ct,null)))},e.default.createElement("div",{className:"dsh-hive-thread-body"},a.goal?e.default.createElement("p",{className:"dsh-hive-thread-goal"},a.goal):null,r.length?e.default.createElement("ul",{className:"dsh-hive-thread-rows"},r.map(Y=>e.default.createElement("li",{key:Y.name,className:"dsh-hive-thread-task"},e.default.createElement(lt,{status:Y.status,recovery:Y.recoveryRequired}),e.default.createElement("span",{className:"dsh-hive-thread-task-title"},ut(Y)),e.default.createElement($e,{member:Y,muted:Y.status==="retired",ariaLabel:(Le(Y)?"Inspect journal for @":"Jump to @")+Y.name,onClick:Me=>R(Y,Me.currentTarget)})))):e.default.createElement("p",{className:"dsh-hive-secondary"},"No members assigned to this thread.")))}))):null,$.length?e.default.createElement("section",{className:"dsh-hive-section"},e.default.createElement("h2",null,"Screenshots"),e.default.createElement("ul",{className:"dsh-hive-screenshots-strip"},$.map(a=>{let A=C.get(a.author);return e.default.createElement("li",{key:a.id,className:"dsh-hive-shot-card"},e.default.createElement("button",{type:"button",className:"dsh-hive-shot-thumb","aria-label":"Preview screenshot: "+a.caption,onClick:r=>h({shot:a,opener:r.currentTarget})},e.default.createElement("img",{src:a.url,alt:a.caption,loading:"lazy"})),e.default.createElement("div",{className:"dsh-hive-shot-meta"},e.default.createElement("p",{className:"dsh-hive-shot-caption"},a.caption),e.default.createElement("div",{className:"dsh-hive-shot-foot"},a.seq?e.default.createElement(je,{seq:a.seq,onJumpPost:p}):null,a.author?e.default.createElement($e,{member:A,name:a.author,coordinator:a.author==="coordinator",onClick:A?r=>R(A,r.currentTarget):void 0}):null)))}))):null,e.default.createElement("section",{className:"dsh-hive-section"},e.default.createElement("h2",null,"The team"),e.default.createElement("div",{className:"dsh-hive-team-card"},e.default.createElement("div",{className:"dsh-hive-coordinator-tile","aria-hidden":"true"},e.default.createElement(Ee,{name:"coordinator",status:"working",coordinator:!0,size:"lg"})),e.default.createElement("div",{className:"dsh-hive-team-body"},e.default.createElement("div",{className:"dsh-hive-line"},e.default.createElement("strong",{className:"dsh-hive-team-name"},"Coordinator"),e.default.createElement("div",{className:"dsh-hive-pill-group"},re?.seq?e.default.createElement(je,{seq:re.seq,onJumpPost:p}):null,Le(W)?e.default.createElement("button",{type:"button",className:"dsh-hive-ghost-btn",onClick:a=>d(W.name,a.currentTarget)},"Journal"):null)),e.default.createElement("p",{className:"dsh-hive-team-summary"},ne||(b?Ae(b,180):"Coordinating team progress.")),L?e.default.createElement("details",{className:"dsh-hive-details"},e.default.createElement("summary",null,"Full summary"),e.default.createElement(Oe,{text:pe,onJumpPost:p})):null,e.default.createElement("details",{className:"dsh-hive-details dsh-hive-exec"},e.default.createElement("summary",null,"Execution"),e.default.createElement("dl",{className:"dsh-hive-facts"},e.default.createElement("div",null,e.default.createElement("dt",null,"Turns"),e.default.createElement("dd",null,n.turns," of ",n.turnLimit," used")),e.default.createElement("div",null,e.default.createElement("dt",null,"Members"),e.default.createElement("dd",null,n.members.filter(a=>a.status!=="retired").length," active \xB7 ",n.members.filter(a=>a.status==="working").length," working")),e.default.createElement("div",null,e.default.createElement("dt",null,"Model"),e.default.createElement("dd",null,n.model??"Host default",n.effort?" \xB7 "+n.effort:"")),n.fallbackModel?e.default.createElement("div",null,e.default.createElement("dt",null,"Fallback"),e.default.createElement("dd",null,n.fallbackModel,n.fallbackEffort?" \xB7 "+n.fallbackEffort:"")):null,e.default.createElement("div",null,e.default.createElement("dt",null,"Workspace"),e.default.createElement("dd",null,n.cwd)))),n.phase==="budget"?e.default.createElement("div",{className:"dsh-hive-actions"},e.default.createElement("button",{type:"button",className:"dsh-hive-primary",disabled:o.pending,onClick:()=>De(i,"resume_team",{extraTurns:8})},"+8 turns")):null))),O?e.default.createElement(it,{title:O.shot.caption||"Screenshot",opener:O.opener,closeOnBackdrop:!0,className:"dsh-hive-dialog dsh-hive-lightbox",onClose:()=>h(null)},e.default.createElement("figure",{className:"dsh-hive-lightbox-figure"},e.default.createElement("img",{src:O.shot.url,alt:O.shot.caption,className:"dsh-hive-lightbox-img"}),e.default.createElement("figcaption",{className:"dsh-hive-lightbox-meta"},e.default.createElement("span",null,O.shot.caption),e.default.createElement("div",{className:"dsh-hive-actions"},O.shot.seq?e.default.createElement(je,{seq:O.shot.seq,onJumpPost:a=>{h(null),p(a)}}):null,O.shot.author?e.default.createElement($e,{member:C.get(O.shot.author),name:O.shot.author,coordinator:O.shot.author==="coordinator"}):null,O.shot.time?e.default.createElement("time",{className:"dsh-hive-secondary dsh-hive-mono",dateTime:O.shot.time},new Date(O.shot.time).toLocaleString()):null)))):null)}function xo(){return e.default.createElement("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true"},e.default.createElement("path",{d:"M2.5 3.5h11l-4.2 5v3.7l-2.6 1.3V8.5l-4.2-5Z",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round"}))}function Ut(){return e.default.createElement("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true"},e.default.createElement("circle",{cx:"7",cy:"7",r:"4.5",stroke:"currentColor",strokeWidth:"1.4"}),e.default.createElement("path",{d:"M10.5 10.5L13.5 13.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}))}function wo(o){if(!o)return"";try{return new Date(o).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}catch{return""}}function ko({event:o,member:i,canOpenSession:d=!1,onOpenSession:p,onJumpPost:m,focused:n=!1}){let[N,k]=(0,e.useState)(!1),C=String(o.text??""),y=C.length>360||C.split(/\r?\n/).length>6,c=y&&!N&&!n,x=o.author==="coordinator"||i?.role==="coordinator",w=o.author==="system",b=!x&&!w&&i?pt(i.name,!1,i.tint):null,P=b?{"--tile-bg":b.bg,"--tile-border":b.border}:void 0,q=!x&&["done","retired"].includes(i?.status),z=x?e.default.createElement("div",{className:"dsh-hive-post-tile dsh-hive-coord-mini"},e.default.createElement(Ee,{name:"coordinator",status:i?.status??"waiting",coordinator:!0,size:"sm"})):w?e.default.createElement("div",{className:"dsh-hive-post-tile dsh-hive-system-tile","aria-hidden":"true"},"\u2699"):e.default.createElement("div",{className:"dsh-hive-post-tile",style:P},e.default.createElement(Ee,{name:o.author,status:i?.status??"observer",tint:i?.tint,muted:q,size:"sm"}));return e.default.createElement("li",{className:"dsh-hive-post","data-seq":o.seq,"data-kind":o.kind??"message","data-focused":n?"true":void 0},d&&p?e.default.createElement("button",{type:"button",className:"dsh-hive-post-avatar-btn","aria-label":"Open session for @"+o.author,title:"Open @"+o.author+" session",onClick:J=>p(o.author,J.currentTarget)},z):e.default.createElement("div",{className:"dsh-hive-post-avatar-slot","aria-hidden":"true"},z),e.default.createElement("div",{className:"dsh-hive-post-main"},e.default.createElement("div",{className:"dsh-hive-post-head"},e.default.createElement("div",{className:"dsh-hive-post-who"},e.default.createElement("strong",{className:"dsh-hive-author"},w?"System":"@"+o.author),o.targets?.length?e.default.createElement("span",{className:"dsh-hive-targets-inline"},"\u2192 "+o.targets.map(J=>"@"+J).join(" ")):null,o.channel&&o.channel!=="main"?e.default.createElement("span",{className:"dsh-hive-channel-pill"},"#",o.channel):null),e.default.createElement("span",{className:"dsh-hive-post-stamp"},e.default.createElement("span",{className:"dsh-hive-mono"},"#",o.seq),o.time?e.default.createElement("time",{dateTime:o.time,title:new Date(o.time).toLocaleString()}," \xB7 "+wo(o.time)):null)),e.default.createElement("div",{className:"dsh-hive-post-body","data-clamped":c?"true":void 0,onClick:c?J=>{J.target?.closest?.("a, button, code, pre")||globalThis.getSelection?.()?.toString?.()||k(!0)}:void 0},e.default.createElement(Oe,{text:o.text,onJumpPost:m})),y&&!n?e.default.createElement("button",{type:"button",className:"dsh-hive-expand-btn","aria-expanded":N,onClick:()=>k(J=>!J)},N?"Show less":"Show more"):null))}function Mo({state:o,controller:i,focusedSeq:d,onClearFocus:p,mentionRequest:m,onConsumeMention:n,onJumpPost:N,onOpenSession:k}){let[C,y]=(0,e.useState)(""),[c,x]=(0,e.useState)("*"),[w,b]=(0,e.useState)("*"),[P,q]=(0,e.useState)(""),[z,J]=(0,e.useState)("main"),[g,T]=(0,e.useState)(!0),[G,$]=(0,e.useState)(!1),[O,h]=(0,e.useState)(!1),W=(0,e.useRef)(null),Z=(0,e.useRef)(null),re=(0,e.useMemo)(()=>ot(o.team),[o.team]),pe=(0,e.useMemo)(()=>new Map(re.map(f=>[f.name,f])),[re]);(0,e.useEffect)(()=>{if(!m?.name)return;let f="@"+m.name;q(te=>new RegExp("(?:^|[^a-z0-9_])@"+m.name+"(?![a-z0-9_-])","i").test(te)?te:f+" "+te),Z.current?.focus?.(),n?.()},[m,n]);let ne=(0,e.useMemo)(()=>{let f=new Set(["user","coordinator"]),te=[];for(let Y of o.team.members)Y?.name&&!f.has(Y.name)&&(f.add(Y.name),te.push({value:Y.name,label:Y.name}));for(let Y of o.history)Y?.author&&Y.author!=="system"&&!f.has(Y.author)&&(f.add(Y.author),te.push({value:Y.author,label:Y.author}));return[{value:"*",label:"Everyone"},{value:"user",label:"You (user)"},{value:"coordinator",label:"Coordinator"},...te]},[o.team.members,o.history]),L=o.history.filter(f=>(c==="*"||(f.channel??"main")===c)&&(w==="*"||f.author===w)&&(!C||f.text?.toLowerCase().includes(C.toLowerCase())));(0,e.useEffect)(()=>{if(d==null)return;!L.some(te=>te.seq===d)&&o.history.some(te=>te.seq===d)&&(y(""),x("*"),b("*")),T(!1),W.current?.querySelector?.('[data-seq="'+d+'"]')?.scrollIntoView?.({block:"nearest"})},[d,o.history.length,L.length]),(0,e.useEffect)(()=>{g&&W.current&&(W.current.scrollTop=W.current.scrollHeight,h(!1))},[g,L.length]);let R=o.team.members.filter(f=>f.status==="working"),a=c!=="*"||w!=="*"||!g;async function A(f){if(f.preventDefault(),!!P.trim())try{await i.command("post_message",{text:P.trim(),channel:z}),q(""),p?.()}catch{}}let r=()=>{let f=W.current;f&&h(f.scrollHeight-f.scrollTop-f.clientHeight>48)},M=()=>{T(!0),h(!1),W.current&&(W.current.scrollTop=W.current.scrollHeight)};return e.default.createElement("div",{className:"dsh-hive-board"},R.length?e.default.createElement("section",{className:"dsh-hive-live","aria-label":"Live activity"},e.default.createElement("h3",null,"Live activity"),e.default.createElement("ul",null,R.map(f=>{let Y=o.team.activity?.[f.name]?.steps?.at(-1);return e.default.createElement("li",{key:f.name},e.default.createElement("strong",null,"@",f.name),e.default.createElement("span",null,Y?Y.label+(Y.detail?" \xB7 "+Y.detail:""):"Working\u2026"))}))):null,e.default.createElement("div",{className:"dsh-hive-toolbar"},e.default.createElement("div",{className:"dsh-hive-board-bar"},e.default.createElement("label",{className:"dsh-hive-search-box"},e.default.createElement(Ut,null),e.default.createElement("input",{type:"search","aria-label":"Search board",placeholder:"Search",value:C,onChange:f=>y(f.target.value)})),e.default.createElement("button",{type:"button",className:"dsh-hive-filter-btn","aria-label":"Toggle board filters","aria-expanded":G,"data-active":a?"true":void 0,onClick:()=>$(f=>!f)},e.default.createElement(xo,null))),e.default.createElement("div",{className:"dsh-hive-filter-drawer",hidden:!G},e.default.createElement("div",{className:"dsh-hive-filters"},e.default.createElement("label",null,"Channel",e.default.createElement("select",{value:c,onChange:f=>x(f.target.value)},e.default.createElement("option",{value:"*"},"All channels"),o.team.channels.filter(f=>!f.archived).map(f=>e.default.createElement("option",{key:f.name},f.name)))),e.default.createElement("label",null,"Author",e.default.createElement("select",{"aria-label":"Author",value:w,onChange:f=>b(f.target.value)},ne.map(f=>e.default.createElement("option",{key:f.value,value:f.value},f.label)))),e.default.createElement("button",{type:"button","aria-pressed":g,onClick:()=>T(f=>!f)},"Follow")),e.default.createElement("div",{className:"dsh-hive-actions"},e.default.createElement("button",{type:"button",disabled:o.historyLoading,onClick:()=>{i.loadHistory({reset:!0})}},"Load earlier history"),o.hasMoreHistory?e.default.createElement("button",{type:"button",disabled:o.historyLoading,onClick:()=>{i.loadHistory()}},"Load next history page"):null,o.historyLoading?e.default.createElement("span",{role:"status",className:"dsh-hive-secondary"},"Loading history\u2026"):null))),e.default.createElement("div",{className:"dsh-hive-feed-wrap"},L.length?e.default.createElement("ol",{ref:W,onScroll:r,className:"dsh-hive-feed","aria-label":"Board posts"},L.map(f=>{let te=pe.get(f.author),Y=f.author==="coordinator"||te?.role==="coordinator",Me=!!(Le(te)||Y&&typeof o.team.parentSessionId=="string"&&o.team.parentSessionId.trim());return e.default.createElement(ko,{key:f.seq,event:f,member:te,canOpenSession:Me,onOpenSession:k,onJumpPost:N,focused:d===f.seq})})):e.default.createElement("p",{role:"status",className:"dsh-hive-secondary"},"No posts match these filters."),(!g||O)&&L.length?e.default.createElement("button",{type:"button",className:"dsh-hive-latest-pill","aria-label":"Jump to latest posts",onClick:M},"\u2193 Latest"):null),e.default.createElement("form",{className:"dsh-hive-compose",onSubmit:A},e.default.createElement("label",{className:"sr-only",htmlFor:"dsh-hive-compose-input"},"Post to the board"),e.default.createElement("textarea",{id:"dsh-hive-compose-input",ref:Z,required:!0,rows:"2",maxLength:"6000",value:P,onChange:f=>q(f.target.value),placeholder:"Send a message or @mention a member\u2026"}),e.default.createElement("div",{className:"dsh-hive-actions dsh-hive-compose-foot"},e.default.createElement("label",{className:"dsh-hive-channel-pick"},e.default.createElement("span",null,"Channel"),e.default.createElement("select",{value:z,onChange:f=>J(f.target.value)},o.team.channels.filter(f=>!f.archived).map(f=>e.default.createElement("option",{key:f.name},f.name)))),e.default.createElement("button",{type:"submit",className:"dsh-hive-primary",disabled:o.pending||!P.trim()},"Post message"))))}function So({state:o,controller:i,member:d,opener:p,onClose:m}){let[n,N]=(0,e.useState)(""),[k,C]=(0,e.useState)(""),[y,c]=(0,e.useState)(!1),[x,w]=(0,e.useState)(d?.model??""),[b,P]=(0,e.useState)(d?.effort??""),[q,z]=(0,e.useState)(!1);(0,e.useEffect)(()=>{i.loadModels()},[i]);let J=o.models.find(O=>O.id===x),g=!x||!!J,T=!b||!!J?.efforts?.includes(b),G=!!(d&&["waiting","failed","quota"].includes(d.status)&&!d.recoveryRequired);async function $(O){O.preventDefault();try{d?await i.command("set_member_model",{member:d.name,model:x,effort:b||null,resume:!!(G&&q)}):await i.command("add_member",{member:{name:n,brief:k,writable:y,...x?{model:x}:{},...b?{effort:b}:{}}}),m()}catch{}}return e.default.createElement(it,{title:d?"Change model":"Add member",onClose:m,opener:p},e.default.createElement("form",{onSubmit:$,className:"dsh-hive-form"},d?e.default.createElement("p",null,"Apply to the next turn for @",d.name,"."):e.default.createElement(e.default.Fragment,null,e.default.createElement("label",null,"Member name",e.default.createElement("input",{required:!0,pattern:"[a-z][a-z0-9_\\-]*",maxLength:"30",value:n,onChange:O=>N(O.target.value)})),e.default.createElement("label",null,"Assignment",e.default.createElement("textarea",{required:!0,rows:"4",maxLength:"6000",value:k,onChange:O=>C(O.target.value)})),e.default.createElement("label",{className:"dsh-hive-check"},e.default.createElement("input",{type:"checkbox",checked:y,onChange:O=>c(O.target.checked)}),"Request workspace write access"),e.default.createElement("p",{className:"dsh-hive-secondary"},"The Host verifies workspace scope and permission before execution.")),e.default.createElement("label",null,"Model",e.default.createElement("select",{value:x,disabled:o.modelsLoading,onChange:O=>{w(O.target.value),P("")}},e.default.createElement("option",{value:""},d?"Choose a model":"Use the team model"),x&&!J?e.default.createElement("option",{value:x},x," (unavailable)"):null,o.models.map(O=>e.default.createElement("option",{key:O.id,value:O.id},O.label)))),o.modelsLoading?e.default.createElement("p",{role:"status"},"Loading native models\u2026"):o.models.length?null:e.default.createElement("p",null,"No models are available. Enable a model in DSH, then reload the model list."),g?null:e.default.createElement("p",{role:"alert"},"This model is unavailable. Choose a model from the native catalog."),e.default.createElement("label",null,"Reasoning effort",e.default.createElement("select",{value:b,disabled:!J,onChange:O=>P(O.target.value)},e.default.createElement("option",{value:""},"Model default"),J?.efforts?.map(O=>e.default.createElement("option",{key:O},O)))),G?e.default.createElement("label",{className:"dsh-hive-check"},e.default.createElement("input",{type:"checkbox",checked:q,onChange:O=>z(O.target.checked)}),"Resume now"):null,o.error?e.default.createElement("p",{role:"alert"},o.error.message):null,e.default.createElement("div",{className:"dsh-hive-actions"},e.default.createElement("button",{type:"button",disabled:o.modelsLoading,onClick:()=>{i.loadModels()}},"Reload models"),e.default.createElement("button",{type:"submit",className:"dsh-hive-primary",disabled:o.pending||!g||!T||d&&!x||!d&&(!n||!k.trim())},o.pending?"Saving\u2026":d?"Apply model":"Add member"))))}function No({workspace:o}){let i=[o?.cwd,o?.path,o].find(d=>typeof d=="string"&&d.trim());return i?e.default.createElement("dl",{className:"dsh-hive-member-workspace"},e.default.createElement("div",null,e.default.createElement("dt",null,"Workspace"),e.default.createElement("dd",{title:i},i))):null}function Co({state:o,controller:i,onJournal:d,onOpenSession:p,onMention:m}){let[n,N]=(0,e.useState)(""),[k,C]=(0,e.useState)(null),[y,c]=(0,e.useState)(null),[x,w]=(0,e.useState)(null),b=o.history.length?o.history:o.team.events??[],P=(0,e.useMemo)(()=>{let h=new Map;for(let W of b)W.kind!=="brief"&&W.author!=="system"&&h.set(W.author,W);return h},[b]),q=(0,e.useMemo)(()=>new Map(ot(o.team).map(h=>[h.name,h.tint])),[o.team]),z=n.trim().toLowerCase(),J=o.team.members.filter(h=>!z||[h.name,h.group,h.model,h.taskLabel,h.brief,...h.channels??[]].filter(Boolean).join(" ").toLowerCase().includes(z)),g=h=>h.role==="coordinator"||h.name==="coordinator"?0:h.recoveryRequired||["failed","quota"].includes(h.status)?1:h.status==="working"?2:["waiting","queued"].includes(h.status)?3:4,T=J.filter(h=>h.status!=="retired").sort((h,W)=>g(h)-g(W)),G=J.filter(h=>h.status==="retired"),$=h=>h?.stopPropagation?.(),O=h=>{let W=h.brief?.trim()??"",Z=W.length>220||/\n/.test(W),re=h.role==="coordinator"||h.name==="coordinator",pe=q.get(h.name),ne=!!Le(h),L=ne||re&&typeof o.team.parentSessionId=="string"&&o.team.parentSessionId.trim().length>0,R=P.get(h.name),a=h.recoveryRequired?"Outcome unconfirmed. Inspect the owned session before continuing.":Ot(h,o.team.activity?.[h.name],R)||Ae(W,180),A=re?"Coordinator":ut(h),r=re?null:pt(h.name,!1,pe),M=r?{"--tile-bg":r.bg,"--tile-border":r.border}:void 0,f=!re&&["done","retired"].includes(h.status),te=h.recoveryRequired||["working","failed","quota","stalled"].includes(h.status),Y=x===h.name,Me=ae=>{L&&(ae?.target?.closest?.('button, a, input, select, textarea, summary, details, .dsh-hive-row-menu, [role="button"]')||globalThis.getSelection?.()?.toString?.()||(w(null),p(h.name,ae.currentTarget)))},fe=L?ae=>{ae.target===ae.currentTarget&&(ae.key==="Enter"||ae.key===" ")&&(ae.preventDefault(),w(null),p(h.name,ae.currentTarget))}:void 0;return e.default.createElement("li",{key:h.name,className:"dsh-hive-member","data-role":re?"coordinator":"worker","data-status":h.status,"data-clickable":L?"true":void 0,"data-menu-open":Y?"true":void 0,tabIndex:L?0:void 0,title:L?"Click to open @"+h.name+" session":void 0,onClick:Me,onKeyDown:fe},e.default.createElement("div",{className:"dsh-hive-member-avatar","aria-hidden":"true"},e.default.createElement("div",{className:"dsh-hive-member-tile"+(re?" is-coordinator":""),style:M},e.default.createElement(Ee,{name:h.name,status:h.status,coordinator:re,tint:pe,muted:f,size:"md"})),h.status==="working"||h.recoveryRequired||["failed","quota"].includes(h.status)?e.default.createElement("span",{className:"dsh-hive-avatar-dot","data-tone":h.status==="working"?"working":"danger"}):null),e.default.createElement("div",{className:"dsh-hive-member-main"},e.default.createElement("div",{className:"dsh-hive-member-line1"},e.default.createElement("div",{className:"dsh-hive-member-ident"},e.default.createElement("h2",null,"@",h.name),e.default.createElement("span",{className:"dsh-hive-member-sub"},A)),e.default.createElement("div",{className:"dsh-hive-member-meta"},e.default.createElement(po,{mode:h.executionMode,subagentName:h.subagentName}),te?e.default.createElement(tt,{value:h.status,compactView:!0}):null,h.model?e.default.createElement("span",{className:"dsh-hive-member-model"},h.model,h.effort?" \xB7 "+h.effort:""):null,R?.seq?e.default.createElement("span",{className:"dsh-hive-mono dsh-hive-secondary"},"#",R.seq):null,e.default.createElement("div",{className:"dsh-hive-row-menu",onClick:$,onKeyDown:ae=>{ae.key==="Escape"&&($(ae),w(null))}},e.default.createElement("button",{type:"button",className:"dsh-hive-row-menu-btn","aria-label":"More actions for @"+h.name,"aria-expanded":Y,onClick:ae=>{$(ae),w(Y?null:h.name)}},"\u22EF"),e.default.createElement("div",{className:"dsh-hive-row-menu-pop","data-open":Y?"true":void 0},e.default.createElement("button",{type:"button",className:"dsh-hive-menu-item","aria-label":"Journal for "+h.name,disabled:!ne,onClick:ae=>{$(ae),w(null),d(h.name,ae.currentTarget)}},"Journal"),e.default.createElement("button",{type:"button",className:"dsh-hive-menu-item","aria-label":"Open session for @"+h.name,disabled:!L,onClick:ae=>{$(ae),w(null),p(h.name,ae.currentTarget)}},"Open session"),h.status!=="retired"&&!h.retireAfterTurn?e.default.createElement("button",{type:"button",className:"dsh-hive-menu-item","aria-label":"@mention @"+h.name+" on board",onClick:ae=>{$(ae),w(null),m(h.name)}},"@mention"):null,e.default.createElement("button",{type:"button",className:"dsh-hive-menu-item","aria-label":"Change model for @"+h.name,disabled:o.pending||h.status==="working"||h.status==="retired",onClick:ae=>{$(ae),w(null),C({member:h,opener:ae.currentTarget})}},"Change model"),e.default.createElement("button",{type:"button",className:"dsh-hive-menu-item","aria-label":"Retire @"+h.name,disabled:o.pending||h.status==="retired"||h.retireAfterTurn,onClick:ae=>{$(ae),w(null),c({member:h,opener:ae.currentTarget})}},h.retireAfterTurn?"Retiring after turn":"Retire"),h.workspace&&(h.status==="retired"||o.team.phase==="done")?e.default.createElement("button",{type:"button",className:"dsh-hive-menu-item",disabled:o.pending,"aria-label":"Clean worktree for @"+h.name,onClick:ae=>{$(ae),w(null),De(i,"remove_worktree",{member:h.name})}},"Clean worktree"):null,Z?e.default.createElement("details",{className:"dsh-hive-details dsh-hive-menu-brief",onClick:$},e.default.createElement("summary",null,"Full brief"),e.default.createElement("p",{className:"dsh-hive-prose"},W)):null)))),h.workspace||h.group||h.channels?.length||h.pendingWaitFor?.length||h.fallbackModel?e.default.createElement("div",{className:"dsh-hive-member-chips"},e.default.createElement(No,{workspace:h.workspace}),h.group?e.default.createElement("span",{className:"dsh-hive-chip"},"@",h.group):null,h.channels?.length?e.default.createElement("span",{className:"dsh-hive-chip"},h.channels.map(ae=>"#"+ae).join(" ")):null,h.pendingWaitFor?.length?e.default.createElement("span",{className:"dsh-hive-chip","data-tone":"wait"},"Waiting on ",h.pendingWaitFor.map(ae=>"@"+ae).join(", ")):null,h.fallbackModel?e.default.createElement("span",{className:"dsh-hive-chip"},"Fallback: ",h.fallbackModel,h.fallbackEffort?" \xB7 "+h.fallbackEffort:""):null):null,a?e.default.createElement("p",{className:"dsh-hive-member-preview",title:a},a):null,h.recoveryRequired?e.default.createElement("div",{className:"dsh-hive-actions dsh-hive-inline-actions",onClick:$},e.default.createElement(Re,{memberName:h.name,pending:o.pending||h.status==="working",controller:i})):null))};return e.default.createElement("div",{className:"dsh-hive-members-view"},e.default.createElement("div",{className:"dsh-hive-member-bar"},e.default.createElement("label",{className:"dsh-hive-search-box"},e.default.createElement(Ut,null),e.default.createElement("input",{type:"search","aria-label":"Find a member",placeholder:"Search members",value:n,onChange:h=>N(h.target.value)})),e.default.createElement("button",{type:"button",className:"dsh-hive-compact-btn",disabled:o.pending,onClick:h=>C({member:null,opener:h.currentTarget})},"Add member")),T.length?e.default.createElement("ul",{className:"dsh-hive-members"},T.map(O)):G.length?null:e.default.createElement("p",{className:"dsh-hive-secondary"},"No members match your search."),G.length?e.default.createElement("details",{className:"dsh-hive-retired-group",open:!0},e.default.createElement("summary",{className:"dsh-hive-retired-summary"},e.default.createElement("span",null,"RETIRED"),e.default.createElement("span",{className:"dsh-hive-retired-count"},G.length),e.default.createElement(ct,null)),e.default.createElement("ul",{className:"dsh-hive-members"},G.map(O))):null,k?e.default.createElement(So,{key:k.member?.name??"new",...k,state:o,controller:i,onClose:()=>C(null)}):null,y?e.default.createElement(it,{title:"Retire "+y.member.name+"?",opener:y.opener,onClose:()=>c(null)},e.default.createElement("p",null,"This member will receive no further turns. Its Journal and session remain available."),o.error?e.default.createElement("p",{role:"alert"},o.error.message):null,e.default.createElement("button",{type:"button",disabled:o.pending,onClick:async()=>{try{await i.command("retire_member",{member:y.member.name}),c(null)}catch{}}},"Retire member")):null)}function To(){try{let o=globalThis.sessionStorage?.getItem?.(Ft);return o==="mentions"||o==="hive"?o:"hive"}catch{return"hive"}}function qo(o){try{globalThis.sessionStorage?.setItem?.(Ft,o)}catch{}}function Io(o){let i=typeof document<"u"?document.documentElement?.dataset?.theme:void 0;if(i==="dark"||i==="light")return i;try{if(o&&typeof getComputedStyle=="function"){let d=getComputedStyle(o),p=d.colorScheme;if(p==="dark"||p==="light")return p;let m=/rgba?\(\s*(\d+),\s*(\d+),\s*(\d+)/.exec(d.backgroundColor??"");if(m)return .299*Number(m[1])+.587*Number(m[2])+.114*Number(m[3])<128?"dark":"light"}}catch{}try{if(globalThis.matchMedia?.("(prefers-color-scheme: dark)")?.matches)return"dark"}catch{}return"light"}function zo(o,i){let d=Math.cos(i),p=Math.sin(i),m=(n,N)=>(o.x+n*d-N*p).toFixed(1)+","+(o.y+n*p+N*d).toFixed(1);return m(1,0)+" "+m(-8,-3.8)+" "+m(-6.1,0)+" "+m(-8,3.8)}function Lo(o,i,d){let p=i??[],m=!p.some(g=>(g.role==="coordinator"||g.name==="coordinator")&&!g.external)&&!p.some(g=>g.name==="user"),n=g=>m&&g==="user"?"coordinator":g,N=o.filter(g=>g.seq<=d&&Te.default.isPost(g)),k=N.at(-1)??null,C=d>=(o.at(-1)?.seq??0),y=p.find(g=>g.role==="coordinator"||g.name==="coordinator")??{name:"coordinator",role:"coordinator",status:"waiting"},c=p.filter(g=>g.role!=="coordinator"&&g.name!=="coordinator"),x=new Map;for(let g of N)x.set(n(g.author),g.seq);let w=[{id:"working",label:"Working",tone:"working",members:[]},{id:"waiting",label:"Waiting",tone:"waiting",members:[]},{id:"needs",label:"Needs you",tone:"needs",members:[]},{id:"done",label:"Done",tone:"done",members:[]}],b=new Map(w.map(g=>[g.id,g]));for(let g of c){let T=C?g.status:x.has(g.name)&&g.status==="done"?"done":"waiting",G=g.recoveryRequired||["failed","quota"].includes(T)?"needs":T==="working"?"working":["done","retired"].includes(T)?"done":"waiting";b.get(G).members.push({name:g.name,status:T,role:g.role??"worker",tint:g.tint,muted:["done","retired"].includes(T),latestSeq:x.get(g.name)??0,pendingWaitFor:g.pendingWaitFor??[]})}let P=w.filter(g=>g.members.length>0).map(g=>({...g,count:g.members.length})),q=b.get("done").members.length,z=b.get("needs").members.length?"stalled":b.get("working").members.length?"working":c.length&&q===c.length?"done":"waiting",J=[];if(b.get("done").members.length&&J.push({from:"done",to:"coordinator",kind:"done",label:"Tasks done"}),k){let g=n(k.author),T=g==="coordinator"?"coordinator":P.find($=>$.members.some(O=>O.name===g))?.id,G=[...(k.targets??[]).map(n),...k.coordinatorMention?["coordinator"]:[]];for(let $ of G){let O=$==="coordinator"?"coordinator":P.find(h=>h.members.some(W=>W.name===$))?.id;if(T&&O&&T!==O){J.push({from:T,to:O,kind:"message",label:"Message just sent",seq:k.seq});break}}}for(let g of P)for(let T of g.members)for(let G of T.pendingWaitFor??[]){let $=P.find(O=>O.members.some(h=>h.name===G))?.id;$&&$!==g.id&&!J.some(O=>O.kind==="waiting"&&O.from===g.id&&O.to===$)&&J.push({from:g.id,to:$,kind:"waiting",label:"Waiting on"})}return{currentSeq:k?.seq??0,lastPost:k,coordinator:{name:"coordinator",status:y.status,role:"coordinator",doneCount:q,totalWorkers:c.length,phase:z,latestSeq:x.get("coordinator")??0,tint:0},clusters:P,connectors:J}}function dt(o,i,d){return Array.from({length:6},(p,m)=>({x:o+d*Math.cos(m*Math.PI/3),y:i+d*Math.sin(m*Math.PI/3)}))}function Ht(o,i,d,p){if(!p.length)return[];let m=p.length,n=m<=2?m:m<=6?3:4,N=Math.ceil(m/n),k=d*1.48,C=Math.min(72,Math.max(46,k/n)),y=N===1?0:N===2?46:38,c=i-(N-1)*y/2+14;return p.map((x,w)=>{let b=Math.floor(w/n),P=Math.min(n,m-b*n),q=w%n,z=o+(q-(P-1)/2)*C,J=c+b*y;return{member:x,x:z,y:J,slotWidth:C,beeScale:N>=3?.9:1}})}function Ho(o,i,d){let p=o.clusters??[],m=18,n=new Map,N,k,C=[];if(!p.length)N=Math.max(76,Math.min(118,i*.24,d*.32)),k={x:i/2,y:d/2};else if(p.length===1){N=Math.max(76,Math.min(120,i*.24,(d-36)/(2*Math.sqrt(3)+.35)));let c=N*Math.sqrt(3)/2,x=d/2,w=c+m/2,b=p[0],P={x:i/2,y:x-w};k={x:i/2,y:x+w};let q={...b,x:P.x,y:P.y,radius:N,vertices:dt(P.x,P.y,N),slots:Ht(P.x,P.y,N,b.members)};C.push(q),n.set(b.id,q)}else{k={x:i/2,y:d*.7};let c=p.length===2?Math.PI*.44:p.length===3?Math.PI*.64:Math.PI*.74,x=c/(p.length-1),w=Math.max(110,Math.min(i*.34,k.y-82)),b=Math.min(w,2*w*Math.sin(x/2)),P=Math.max(46,(b-m)/2);N=Math.max(54,Math.min(92,P/(Math.sqrt(3)/2))),p.forEach((q,z)=>{let J=-Math.PI/2-c/2+z*x,g=k.x+Math.cos(J)*w,T=k.y+Math.sin(J)*w,G={...q,x:g,y:T,radius:N,vertices:dt(g,T,N),slots:Ht(g,T,N,q.members)};C.push(G),n.set(q.id,G)})}let y={id:"coordinator",x:k.x,y:k.y,radius:N,vertices:dt(k.x,k.y,N),model:o.coordinator};return n.set("coordinator",y),{width:i,height:d,radius:N,coordinator:y,clusters:C,cellsById:n}}function Pt(o,i){let d=o*Math.sqrt(3)/2,p=1/0;for(let m of[Math.PI/6,Math.PI/2,5*Math.PI/6,-Math.PI/6,-Math.PI/2,-5*Math.PI/6]){let n=Math.cos(i-m);n>1e-4&&(p=Math.min(p,d/n))}return p}function Po(o,i,d){let p=new Map;if(!o.length)return p;if(o.length>12||i<300)return Te.default.layout(o,i,d);let m=o.findIndex(b=>b.role==="coordinator"||b.name==="coordinator"),n=m>=0?[o[m],...o.filter((b,P)=>P!==m)]:o,N=42,k=42,C=Math.min(92,Math.max(58,i*.14)),y=i/2,c=(N+(d-k))/2,x=Math.max(56,Math.min(i*.38,i/2-C)),w=Math.max(46,(d-N-k)/2);return n.length===1?(p.set(n[0].name,{x:y,y:c}),p):(n.forEach((b,P)=>{let q=-Math.PI/2+P*(Math.PI*2/n.length);p.set(b.name,{x:y+Math.cos(q)*x,y:c+Math.sin(q)*w})}),p)}function Ao(o,i){if(typeof Te.default.nodeBox=="function"){let n=Te.default.nodeBox(o,{variant:"pill",narrow:i});if(n&&n.radius>=n.halfH-1)return n}let d=String(o?.name??""),p=i?14:16;return{halfW:Math.max(44,Math.min(96,24+d.length*4.1)),halfH:p,offsetX:0,offsetY:0,radius:p}}function Bo({state:o,controller:i,onJournal:d,onJumpPost:p}){let[m,n]=(0,e.useState)(To),[N,k]=(0,e.useState)(null),[C,y]=(0,e.useState)(!1),[c,x]=(0,e.useState)("even"),[w,b]=(0,e.useState)(1),[P,q]=(0,e.useState)(!1),[z,J]=(0,e.useState)(!1),[g,T]=(0,e.useState)(null),[G,$]=(0,e.useState)(null),[O,h]=(0,e.useState)(null),[W,Z]=(0,e.useState)({busy:!1,message:"",error:!1}),re=(0,e.useRef)(null),pe=(0,e.useRef)(null),ne=(0,e.useRef)(new Map),[L,R]=(0,e.useState)(480),a=(0,e.useId)().replaceAll(":","");(0,e.useEffect)(()=>{let s=pe.current;if(!s||typeof ResizeObserver>"u")return;let D=new ResizeObserver(S=>R(Math.max(280,S[0].contentRect.width)));return D.observe(s),()=>D.disconnect()},[]);let A=(0,e.useMemo)(()=>ot(o.team),[o.team]),r=(0,e.useMemo)(()=>o.history.filter(Te.default.isPost),[o.history]),M=N===null?r.length:Math.max(0,Math.min(r.length,r.findIndex(s=>s.seq>N)===-1?r.length:r.findIndex(s=>s.seq>N))),f=r[M-1],te=f?.seq??0;(0,e.useEffect)(()=>{if(!C)return;if(M>=r.length){y(!1);return}let s=Date.parse(r[M].time)-Date.parse(r[M-1]?.time),D=c==="real"&&Number.isFinite(s)?Math.max(110,Math.min(s,2e3)):620,S=setTimeout(()=>{k(r[M].seq)},D/w);return()=>clearTimeout(S)},[C,M,r,c,w]);let Y=s=>{y(!1),k(r[s-1]?.seq??0)},Me=()=>{if(C){y(!1);return}r.length&&((N===null||M>=r.length)&&k(0),y(!0))},fe=s=>{s!==m&&(n(s),qo(s),T(null),$(null))},ae=L<440,xe=Te.default.elapsedSpan(r.slice(0,M),{live:N===null&&["working","queued"].includes(o.team.phase)}),Ce=(0,e.useMemo)(()=>m!=="hive"?null:typeof Te.default.projectHive=="function"?Te.default.projectHive(r,A,te):Lo(r,A,te),[m,r,A,te]),Ne=(0,e.useMemo)(()=>{if(m!=="hive"||!Ce)return 420;let s=typeof Te.default.hiveMinimumHeight=="function"?Te.default.hiveMinimumHeight(Ce.clusters.length,L):Ce.clusters.length<=1?400:440;return Math.max(380,s)},[m,Ce,L]),ge=(0,e.useMemo)(()=>m!=="hive"||!Ce?null:typeof Te.default.layoutHive=="function"?Te.default.layoutHive(Ce,L,Ne):Ho(Ce,L,Ne),[m,Ce,L,Ne]),we=(0,e.useMemo)(()=>Te.default.project(r,A,te,{hideInactive:P,expandBroadcast:z}),[r,A,te,P,z]),t=(0,e.useMemo)(()=>typeof Te.default.mentionsMinimumHeight=="function"?Math.max(380,Te.default.mentionsMinimumHeight(we.nodes.length,L)):Math.max(380,Te.default.minimumHeight(we.nodes.length,L)),[we.nodes.length,L]),l=(0,e.useMemo)(()=>m!=="mentions"?new Map:typeof Te.default.layoutMentions=="function"?Te.default.layoutMentions(we.nodes,L,t):Po(we.nodes,L,t),[m,we.nodes,L,t]);ao(()=>{if(m!=="mentions")return;let s=new Map,D=!1;for(let S of we.nodes){let I=ne.current.get(S.name);if(I&&I.offsetWidth>0&&I.offsetHeight>0){let F=I.offsetHeight/2,V={halfW:I.offsetWidth/2,halfH:F,offsetX:0,offsetY:0,radius:F};s.set(S.name,V);let ie=O?.get(S.name);(!ie||Math.abs(ie.halfW-V.halfW)>.5||Math.abs(ie.halfH-V.halfH)>.5)&&(D=!0)}}s.size&&(D||!O||O.size!==s.size)&&h(s)},[m,we.nodes,L,ae]);let u=(0,e.useMemo)(()=>{if(m!=="mentions")return null;if(O&&O.size===we.nodes.length)return O;let s=new Map;for(let D of we.nodes)s.set(D.name,O?.get(D.name)??Ao(D,ae));return s},[m,we.nodes,O,ae]),v=(0,e.useMemo)(()=>m!=="mentions"?[]:Te.default.routeEdges(we,l,{variant:"pill",boxes:u,narrow:ae,marginStart:5,marginEnd:6,obstacleMargin:ae?14:22}),[m,we,l,u,ae]),E=G?G.split(">"):null,j=(0,e.useMemo)(()=>{if(E)return new Set(E);if(!g)return null;let s=new Set([g]);for(let D of we.links)D.from===g&&s.add(D.to),D.to===g&&s.add(D.from);return s},[g,G,we.links]),ee=m==="hive"?Ne:t,oe=g?A.find(s=>s.name===g):null,Q=typeof Te.default.shouldMergeUserToCoordinator=="function"?Te.default.shouldMergeUserToCoordinator(A):!A.some(s=>(s.role==="coordinator"||s.name==="coordinator")&&!s.external)&&!A.some(s=>s.name==="user"),se=s=>s==="user"?"You":s==="system"?"System":s,B=s=>s==="user"?"You":s==="system"?"System":"@"+s,H=Q&&f?.author==="user"?"coordinator":f?.author;async function ce(){if(!r.length||W.busy)return;let s=(typeof globalThis.HiveGif?.exportGraphReplayGif=="function"?globalThis.HiveGif:null)??Bt.default;if(typeof s?.exportGraphReplayGif!="function"){Z({busy:!1,message:"GIF export is unavailable until the GIF module is bundled.",error:!0});return}Z({busy:!0,message:"Rendering GIF replay\u2026",error:!1});try{let D=Io(re.current),S=await Promise.resolve(s.exportGraphReplayGif({mode:m,posts:r,members:A,phase:o.team.phase,pacing:c,speed:w,hideInactive:P,expandBroadcast:z,focus:g,theme:D,width:Math.max(480,Math.round(L)),height:Math.max(360,Math.round(ee)),graph:Te.default,bees:We.default})),I=typeof Blob<"u"&&S?.blob instanceof Blob?S.blob:S?.bytes&&typeof Blob<"u"?new Blob([S.bytes],{type:"image/gif"}):null;if(!I&&!S?.bytes)throw Error("GIF encoder returned empty data.");let V=((o.team.title||"hive-swarm").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"hive-swarm")+"-graph.gif";if(I&&typeof URL.createObjectURL=="function"&&typeof document<"u"&&typeof document.createElement=="function"){let ie=URL.createObjectURL(I),X=document.createElement("a");X.href=ie,X.download=V,X.style.display="none",document.body?.appendChild?.(X),X.click?.(),X.remove?.(),setTimeout(()=>{try{URL.revokeObjectURL(ie)}catch{}},1e3)}Z({busy:!1,message:"Exported "+V+(S.frameCount?" ("+S.frameCount+" frames)":"")+".",error:!1})}catch(D){Z({busy:!1,message:"GIF export failed: "+(D?.message??String(D)),error:!0})}}let _=s=>s==="done"?"done":s==="working"||s==="active"?"working":s==="needs"||s==="stalled"||s==="blocked"?"needs":"waiting";return e.default.createElement("div",{ref:re,className:"dsh-hive-graph-view"},e.default.createElement("div",{className:"dsh-hive-graph-controls"},e.default.createElement("div",{className:"dsh-hive-replay-row1"},e.default.createElement("div",{className:"dsh-hive-actions dsh-hive-transport"},e.default.createElement("button",{type:"button","aria-label":"First post",disabled:!r.length||M===1,onClick:()=>Y(1)},"|\u2039"),e.default.createElement("button",{type:"button","aria-label":"Previous post",disabled:M===0,onClick:()=>Y(Math.max(0,M-1))},"\u2039"),e.default.createElement("button",{type:"button","aria-label":C?"Pause replay":"Replay",disabled:!r.length,onClick:Me},C?"\u2161":"\u25B6"),e.default.createElement("button",{type:"button","aria-label":"Next post",disabled:M>=r.length,onClick:()=>Y(M+1)},"\u203A")),e.default.createElement("input",{className:"dsh-hive-scrubber","aria-label":"Replay through post",type:"range",min:"0",max:r.length,value:M,onChange:s=>Y(Number(s.target.value))}),e.default.createElement("button",{type:"button",className:"dsh-hive-live-btn","aria-pressed":N===null,onClick:()=>{y(!1),k(null)}},e.default.createElement("span",{className:"dsh-hive-status-dot","aria-hidden":"true"}),"Live")),e.default.createElement("div",{className:"dsh-hive-replay-row2"},e.default.createElement("span",{className:"dsh-hive-graph-stat"},e.default.createElement("strong",null,r.length," posts")," over ",xe,N!==null?" \xB7 "+M+"/"+r.length:""),e.default.createElement("div",{className:"dsh-hive-segmented",role:"group","aria-label":"Graph view mode"},e.default.createElement("button",{type:"button","aria-pressed":m==="hive",onClick:()=>fe("hive")},"Hive"),e.default.createElement("button",{type:"button","aria-pressed":m==="mentions",onClick:()=>fe("mentions")},"Mentions")),e.default.createElement("div",{className:"dsh-hive-graph-options"},e.default.createElement("label",{className:"dsh-hive-inline-select"},e.default.createElement("span",{className:"dsh-hive-sr-only"},"Pacing"),e.default.createElement("select",{"aria-label":"Pacing",value:c,onChange:s=>x(s.target.value)},e.default.createElement("option",{value:"even"},"Even pacing"),e.default.createElement("option",{value:"real"},"Real-time"))),e.default.createElement("label",{className:"dsh-hive-inline-select"},e.default.createElement("span",{className:"dsh-hive-sr-only"},"Speed"),e.default.createElement("select",{"aria-label":"Speed",value:w,onChange:s=>b(Number(s.target.value))},e.default.createElement("option",{value:"0.5"},"0.5\xD7"),e.default.createElement("option",{value:"1"},"1\xD7"),e.default.createElement("option",{value:"2"},"2\xD7"),e.default.createElement("option",{value:"4"},"4\xD7"))),m==="mentions"?e.default.createElement("div",{className:"dsh-hive-graph-toggles"},e.default.createElement("label",{className:"dsh-hive-switch"},e.default.createElement("input",{type:"checkbox",role:"switch",className:"dsh-hive-switch-input",checked:P,onChange:s=>q(s.target.checked)}),e.default.createElement("span",{className:"dsh-hive-switch-track","aria-hidden":"true"}),e.default.createElement("span",null,"Hide inactive")),e.default.createElement("label",{className:"dsh-hive-switch"},e.default.createElement("input",{type:"checkbox",role:"switch",className:"dsh-hive-switch-input",checked:z,onChange:s=>J(s.target.checked)}),e.default.createElement("span",{className:"dsh-hive-switch-track","aria-hidden":"true"}),e.default.createElement("span",null,"Expand @all"))):null,e.default.createElement("button",{type:"button",className:"dsh-hive-export-gif",disabled:!r.length||W.busy,onClick:()=>{ce()}},e.default.createElement("span",{"aria-hidden":"true"},"\u2B07"),W.busy?"Exporting\u2026":"Export GIF"),o.hasMoreHistory?e.default.createElement("button",{type:"button",className:"dsh-hive-ghost-btn",disabled:o.historyLoading,onClick:()=>{i.loadHistory()}},"Load earlier"):null)),W.message?e.default.createElement("p",{role:"status",className:W.error?"dsh-hive-gif-error":"dsh-hive-secondary"},W.message):null),m==="hive"&&ge?e.default.createElement(e.default.Fragment,null,e.default.createElement("div",{ref:pe,className:"dsh-hive-graph dsh-hive-graph-hive",style:{height:Ne},role:"group","aria-label":"Hive cluster graph"},e.default.createElement("svg",{width:"100%",height:Ne,viewBox:"0 0 "+L+" "+Ne,"aria-hidden":"true"},e.default.createElement("defs",null,e.default.createElement("marker",{id:a,markerUnits:"userSpaceOnUse",markerWidth:"10",markerHeight:"10",refX:"8.5",refY:"5",orient:"auto"},e.default.createElement("path",{d:"M0.5 1.2L9.5 5L0.5 8.8L2.4 5Z",fill:"context-stroke"}))),ge.clusters.map(s=>e.default.createElement("g",{key:s.id,className:"dsh-hive-hex-cell","data-tone":_(s.tone)},e.default.createElement("polygon",{points:s.vertices.map(D=>D.x.toFixed(1)+","+D.y.toFixed(1)).join(" "),className:"dsh-hive-hex-poly"}),e.default.createElement("text",{x:s.x,y:s.y-s.radius*.56,textAnchor:"middle",className:"dsh-hive-hex-title"},s.label),e.default.createElement("text",{x:s.x,y:s.y-s.radius*.41,textAnchor:"middle",className:"dsh-hive-hex-count"},s.count))),e.default.createElement("g",{className:"dsh-hive-hex-cell","data-role":"coordinator","data-tone":_(ge.coordinator.model.phase==="done"?"done":ge.coordinator.model.phase==="stalled"?"needs":"working")},e.default.createElement("polygon",{points:ge.coordinator.vertices.map(s=>s.x.toFixed(1)+","+s.y.toFixed(1)).join(" "),className:"dsh-hive-hex-poly"}),e.default.createElement("text",{x:ge.coordinator.x,y:ge.coordinator.y+ge.coordinator.radius*.34,textAnchor:"middle",className:"dsh-hive-hex-title"},"Coordinator"),e.default.createElement("text",{x:ge.coordinator.x,y:ge.coordinator.y+ge.coordinator.radius*.5,textAnchor:"middle",className:"dsh-hive-hex-count"},ge.coordinator.model.doneCount," of ",ge.coordinator.model.totalWorkers," done")),(Ce?.connectors??[]).map((s,D)=>{let S=ke=>ge.cellsById?.get?.(ke)??ge.cellsById?.[ke]??(ke==="coordinator"?ge.coordinator:ge.clusters.find(qe=>qe.id===ke)),I=S(s.from),F=S(s.to);if(!I||!F||I===F)return null;let V=F.x-I.x,ie=F.y-I.y,X=Math.hypot(V,ie);if(X<2)return null;let de=Math.atan2(ie,V),K=s.kind==="message"?8:s.kind==="waiting"?-8:0,le=K?6:3,he=Pt(I.radius,de)+le,me=Pt(F.radius,de+Math.PI)+le;if(he+me>=X)return null;let Se=-Math.sin(de),ue=Math.cos(de),U=I.x+Math.cos(de)*he+Se*K,ve=I.y+Math.sin(de)*he+ue*K,be=F.x-Math.cos(de)*me+Se*K,ye=F.y-Math.sin(de)*me+ue*K;return e.default.createElement("line",{key:s.from+">"+s.to+":"+s.kind+":"+D,x1:U.toFixed(1),y1:ve.toFixed(1),x2:be.toFixed(1),y2:ye.toFixed(1),className:"dsh-hive-hex-connector","data-kind":s.kind,strokeDasharray:s.kind==="waiting"?"4 4":void 0,markerEnd:s.kind==="waiting"?"url(#"+a+")":void 0})})),ge.clusters.flatMap(s=>s.slots.map(D=>{let S=D.member,I=g===S.name;return e.default.createElement("button",{key:S.name,type:"button",className:"dsh-hive-hex-bee-btn","data-status":S.status,"aria-pressed":I,style:{left:D.x/L*100+"%",top:D.y,maxWidth:D.slotWidth},title:"@"+S.name+" \xB7 "+(_e[S.status]??S.status),"aria-label":"Inspect @"+S.name+" ("+(_e[S.status]??S.status)+")",onClick:()=>T(I?null:S.name)},e.default.createElement(Ee,{name:S.name,status:S.status,tint:S.tint,muted:S.muted,size:"hive"}),e.default.createElement("span",{className:"dsh-hive-hex-bee-name"},S.name))})),e.default.createElement("button",{type:"button",className:"dsh-hive-hex-coord-btn","aria-pressed":g==="coordinator",style:{left:ge.coordinator.x/L*100+"%",top:ge.coordinator.y-ge.coordinator.radius*.14},"aria-label":"Inspect Coordinator",onClick:()=>T(g==="coordinator"?null:"coordinator")},e.default.createElement(Ee,{name:"coordinator",status:ge.coordinator.model.phase==="working"?"working":"active",coordinator:!0,size:"lg"}))),e.default.createElement("div",{className:"dsh-hive-graph-legend"},e.default.createElement("span",{className:"dsh-hive-legend-item","data-legend":"done"},"Tasks done"),e.default.createElement("span",{className:"dsh-hive-legend-item","data-legend":"message"},"Message just sent"),e.default.createElement("span",{className:"dsh-hive-legend-item","data-legend":"waiting"},"Waiting on"))):e.default.createElement(e.default.Fragment,null,e.default.createElement("div",{ref:pe,className:"dsh-hive-graph dsh-hive-graph-mentions",style:{height:t},role:"group","aria-label":"Message flow graph"},e.default.createElement("svg",{width:"100%",height:t,viewBox:"0 0 "+L+" "+t,"aria-hidden":"true"},e.default.createElement("defs",null,e.default.createElement("marker",{id:a,markerUnits:"userSpaceOnUse",markerWidth:"10",markerHeight:"10",refX:"8.5",refY:"5",orient:"auto"},e.default.createElement("path",{d:"M0.5 1.2L9.5 5L0.5 8.8L2.4 5Z",fill:"context-stroke"}))),v.map(({link:s,edge:D})=>{let S=s.from+">"+s.to,I=!!(f&&s.lastSeq===f.seq),F=G===S,V=G?F:!g||g===s.from||g===s.to,ie=F||I&&V,X=Math.min(4.2,1.1+Math.sqrt(s.count)*.72),de=V&&D.length>=36&&(s.count>1||ie||F),K=String(s.count),le=Math.max(18,K.length*7+8);return e.default.createElement("g",{key:S,className:"dsh-hive-edge-group","data-active":ie?"true":void 0},e.default.createElement("path",{d:D.d,fill:"none",stroke:"transparent",strokeWidth:"14",className:"dsh-hive-edge-hit",onMouseEnter:()=>$(S),onMouseLeave:()=>$(he=>he===S?null:he)}),e.default.createElement("path",{"data-hive-edge":S,d:D.d,className:"dsh-hive-edge","data-active":ie?"true":void 0,strokeWidth:ie?Math.max(2.4,X+.4):X,strokeDasharray:s.direct?void 0:"4 4",opacity:V?ie?1:.72:.16,markerEnd:"url(#"+a+")"}),ie?e.default.createElement("polygon",{className:"dsh-hive-edge-tip",points:zo(D.end,D.endAngle)}):null,de?e.default.createElement("g",{className:"dsh-hive-edge-pill","data-active":ie?"true":void 0,transform:"translate("+D.mid.x.toFixed(1)+","+D.mid.y.toFixed(1)+")"},e.default.createElement("rect",{x:-le/2,y:"-8",width:le,height:"16",rx:"8"}),e.default.createElement("text",{textAnchor:"middle",dominantBaseline:"central"},K)):null)})),we.nodes.map(s=>{let D=l.get(s.name)??{x:L/2,y:t/2},S=Te.default.unmentionedNode(s),I=s.role==="coordinator"||s.name==="coordinator",F=s.status==="retired",V=!I&&["done","retired"].includes(s.status),ie=!!(j&&!j.has(s.name)),X=se(s.name);return e.default.createElement("button",{key:s.name,ref:de=>{de?ne.current.set(s.name,de):ne.current.delete(s.name)},type:"button",className:"dsh-hive-graph-pill","data-role":I?"coordinator":"worker","data-status":s.status??"observer","data-retired":F?"true":void 0,"data-unmentioned":S?"true":void 0,"data-dimmed":ie?"true":void 0,style:{left:D.x/L*100+"%",top:D.y},"aria-pressed":g===s.name,title:X+" \xB7 "+(_e[s.status]??s.status)+(S?" \xB7 Posted with no mention":""),onClick:()=>T(g===s.name?null:s.name)},e.default.createElement(Ee,{name:s.name,status:s.status,coordinator:I,tint:s.tint,muted:V,size:"sm"}),e.default.createElement("span",{className:"dsh-hive-graph-pill-name"},X),e.default.createElement("span",{className:"dsh-hive-node-dot","aria-hidden":"true"}),s.broadcasts?e.default.createElement("span",{className:"dsh-hive-node-broadcast"},"@all ",s.broadcasts):null)})),e.default.createElement("div",{className:"dsh-hive-graph-legend"},e.default.createElement("span",{className:"dsh-hive-legend-item","data-legend":"mention"},"@mention, width = count"),e.default.createElement("span",{className:"dsh-hive-legend-item","data-legend":"broadcast"},"via @all"),e.default.createElement("span",{className:"dsh-hive-legend-item","data-legend":"unmentioned"},"posted with no mention"),e.default.createElement("span",{className:"dsh-hive-legend-item","data-legend":"all-badge"},e.default.createElement("span",{className:"dsh-hive-all-badge"},"@all ",we.broadcasts),"@all posts, drawn by Expand @all"))),g&&oe?e.default.createElement("section",{className:"dsh-hive-selected-post"},e.default.createElement("div",{className:"dsh-hive-line"},e.default.createElement($e,{member:oe,name:oe.name==="user"?"You":void 0,coordinator:oe.role==="coordinator"||oe.name==="coordinator",muted:oe.status==="retired"}),e.default.createElement(tt,{value:oe.status}),e.default.createElement("div",{className:"dsh-hive-pill-group"},Le(oe)?e.default.createElement("button",{type:"button",onClick:s=>d(g,s.currentTarget)},"Inspect @",g," Journal"):null,e.default.createElement("button",{type:"button",className:"dsh-hive-ghost-btn",onClick:()=>T(null)},"Clear"))),f&&H===g?e.default.createElement(Oe,{text:f.text,onJumpPost:p}):null):null,f?e.default.createElement("section",{className:"dsh-hive-selected-post"},e.default.createElement("div",{className:"dsh-hive-line"},e.default.createElement("h3",null,"Selected post"),e.default.createElement("strong",null,B(f.author)),e.default.createElement(je,{seq:f.seq,onJumpPost:p})),e.default.createElement(Oe,{text:f.text,onJumpPost:p})):null,m==="mentions"&&(we.links.length?e.default.createElement("ul",{className:"dsh-hive-flow-list","aria-label":"Message flow counts"},we.links.filter(s=>!g||s.from===g||s.to===g).map(s=>e.default.createElement("li",{key:s.from+">"+s.to},B(s.from)," \u2192 ",B(s.to),": ",s.count," ",s.count===1?"mention":"mentions"))):e.default.createElement("p",{className:"dsh-hive-secondary"},"No directed mentions at this point in the replay.")))}function Fo(){try{return globalThis.localStorage?.getItem?.(Et)??null}catch{return null}}function Eo(o){try{globalThis.localStorage?.setItem?.(Et,o)}catch{}}function Wo({version:o,update:i}){let[d,p]=(0,e.useState)(!1),[m,n]=(0,e.useState)(!1),[N,k]=(0,e.useState)(()=>Fo()),C=(0,e.useRef)(null),y=typeof i?.latest=="string"?i.latest.trim():"",c=!!(i?.available===!0&&y&&ho.test(y)&&N!==y);if((0,e.useEffect)(()=>{c||p(!1)},[c,y]),(0,e.useEffect)(()=>{if(!d||typeof document>"u"||typeof document.addEventListener!="function")return;let z=g=>{C.current?.contains?.(g.target)||p(!1)},J=g=>{g.key==="Escape"&&p(!1)};return document.addEventListener("pointerdown",z),document.addEventListener("keydown",J),()=>{document.removeEventListener("pointerdown",z),document.removeEventListener("keydown",J)}},[d]),!c)return null;let x="dsh plugin --profile desktop add dsh-hive-swarm@"+y,w=_t(i?.url)??"https://github.com/snowmiku601-cpu/hive-swarm/releases/tag/v"+y,b=o||(typeof i?.current=="string"?i.current.trim():""),P=async()=>{try{await globalThis.navigator?.clipboard?.writeText?.(x)}catch{}n(!0),setTimeout(()=>n(!1),1800)},q=()=>{Eo(y),k(y),p(!1)};return e.default.createElement("div",{ref:C,className:"dsh-hive-update-wrap"},e.default.createElement("button",{type:"button",className:"dsh-hive-update-pill","aria-expanded":d,title:"Hive Swarm v"+y+" is available on npm",onClick:()=>p(z=>!z)},"\u2191 v",y," available"),d?e.default.createElement("div",{className:"dsh-hive-update-popover",role:"region","aria-label":"Update available"},e.default.createElement("div",{className:"dsh-hive-update-head"},e.default.createElement("strong",null,"Update available"),e.default.createElement("span",{className:"dsh-hive-mono"},b?"v"+b+" \u2192 v"+y:"v"+y)),e.default.createElement("p",{className:"dsh-hive-secondary"},"Close DSH Desktop after active turns finish, then run:"),e.default.createElement("code",{className:"dsh-hive-update-cmd"},x),e.default.createElement("div",{className:"dsh-hive-update-actions"},e.default.createElement("button",{type:"button",className:"dsh-hive-ghost-btn",onClick:()=>{P()}},m?"Copied":"Copy command"),e.default.createElement("a",{href:w,target:"_blank",rel:"noopener noreferrer"},"Release notes"),e.default.createElement("button",{type:"button",className:"dsh-hive-ghost-btn",onClick:q},"Dismiss"))):null)}var ht=["Overview","Board","Members","Graph"];function Gt({controller:o,onExpand:i,mode:d="dock",visible:p=!0}){let m=(0,e.useSyncExternalStore)(o.subscribe,o.getSnapshot,o.getSnapshot),n={...m,pending:m.pending||m.connection!=="connected"},[N,k]=(0,e.useState)("Overview"),[C,y]=(0,e.useState)(null),[c,x]=(0,e.useState)(!1),[w,b]=(0,e.useState)(""),[P,q]=(0,e.useState)(null),[z,J]=(0,e.useState)(null),g=(0,e.useRef)([]),T=(0,e.useId)().replace(/[^a-zA-Z0-9_-]/g,""),G=(0,e.useRef)(!1);(0,e.useEffect)(()=>{if(!p)return;let r=o.retain();return()=>{G.current&&(o.closeJournal(),G.current=!1),r()}},[o,p]),(0,e.useEffect)(()=>{x(!1),q(null),J(null)},[n.team?.id]);let $=(r,M)=>{G.current=!0,y({opener:M,controller:o}),o.openJournal(r)},O=async(r,M)=>{await o.openSession(r,{fallbackToJournal:!1})==="fallback"&&$(r,M)},h=()=>{G.current=!1,y(null),o.closeJournal()},W=r=>{q(r),k("Board"),n.history.some(M=>M.seq===r)||o.loadHistory({reset:!0})},Z=r=>{J({name:r,id:Date.now()}),k("Board")},re=r=>{k(r);let M=ht.indexOf(r);g.current[M]?.scrollIntoView?.({block:"nearest",inline:"nearest"})};function pe(r,M){let f={ArrowRight:(M+1)%4,ArrowLeft:(M+3)%4,Home:0,End:3}[r.key];f!==void 0&&(r.preventDefault(),re(ht[f]),g.current[f]?.focus())}async function ne(r){r.preventDefault();let M=w.trim();if(M)try{await o.command("set_team_title",{title:M}),x(!1)}catch{}}let L=(0,e.useMemo)(()=>(n.history.length?n.history:n.team?.events??[]).filter(Te.default.isPost).length,[n.history,n.team?.events]),R=(0,e.useMemo)(()=>n.team?n.team.members.filter(r=>r.status!=="retired").length:0,[n.team]),a={Board:L,Members:R},A=typeof n.version=="string"&&n.version.trim()||lo;return e.default.createElement("div",{className:"dsh-hive","data-dsh-hive-swarm":d},e.default.createElement("style",null,qt),e.default.createElement("header",{className:"dsh-hive-header"},e.default.createElement("div",{className:"dsh-hive-header-top"},e.default.createElement("div",{className:"dsh-hive-title-wrap"},e.default.createElement(et,{size:20}),e.default.createElement("h1",null,n.team?.title??"Hive Swarm")),e.default.createElement("div",{className:"dsh-hive-header-meta"},e.default.createElement("div",{className:"dsh-hive-header-status-row"},n.team?e.default.createElement(tt,{value:n.team.paused?"paused":n.team.phase,compactView:!0}):null,A?e.default.createElement("span",{className:"dsh-hive-version-tag",title:"Hive Swarm v"+A},"v",A):null),e.default.createElement(Wo,{version:A,update:n.update}))),n.team&&c?e.default.createElement("form",{className:"dsh-hive-rename",onSubmit:ne},e.default.createElement("input",{"aria-label":"Swarm title",maxLength:"95",required:!0,value:w,onChange:r=>b(r.target.value)}),e.default.createElement("button",{type:"submit",disabled:n.pending||!w.trim()},"Save"),e.default.createElement("button",{type:"button",onClick:()=>x(!1)},"Cancel")):null,e.default.createElement("div",{className:"dsh-hive-header-actions"},e.default.createElement("select",{"aria-label":"Team",value:n.team?.id??"",disabled:n.loading||m.pending,onChange:r=>o.selectTeam(r.target.value)},e.default.createElement("option",{value:""},"Choose a team"),n.teams.map(r=>e.default.createElement("option",{key:r.id,value:r.id},r.title," \xB7 ",r.cwd))),n.team&&!c?e.default.createElement("button",{type:"button",className:"dsh-hive-compact-btn",disabled:n.pending,onClick:()=>{b(n.team.title??""),x(!0)}},"Rename"):null,e.default.createElement("button",{type:"button",className:"dsh-hive-compact-btn",disabled:n.loading,onClick:o.refresh},"Refresh"),n.team?e.default.createElement("button",{type:"button",className:"dsh-hive-compact-btn",disabled:n.pending,onClick:()=>De(o,n.team.paused?"resume_team":"pause_team")},n.team.paused?"Resume":"Pause"):null,i?e.default.createElement("button",{type:"button",className:"dsh-hive-compact-btn","aria-label":"Open full view",onClick:()=>i(o)},"Open full view"):null),n.loading||n.connection==="disconnected"||m.pending||!n.team?e.default.createElement("p",{className:"dsh-hive-secondary dsh-hive-context",role:"status"},n.loading?"Loading Swarm\u2026":n.connection==="disconnected"?"Disconnected \xB7 refresh to reconnect":m.pending?"Saving action\u2026":n.workspace??"Teams in the Host\u2019s permitted workspace scope"):null),n.error?e.default.createElement(jt,{error:n.error,controller:o}):null,n.team?e.default.createElement(e.default.Fragment,null,e.default.createElement("nav",{role:"tablist","aria-label":"Swarm views",className:"dsh-hive-tabs"},ht.map((r,M)=>e.default.createElement("button",{key:r,ref:f=>{g.current[M]=f},type:"button",role:"tab",id:T+"-tab-"+r,"aria-controls":T+"-panel-"+r,"aria-selected":N===r,tabIndex:N===r?0:-1,onClick:()=>re(r),onKeyDown:f=>pe(f,M)},r,Object.hasOwn(a,r)?e.default.createElement("span",{className:"dsh-hive-tab-count"},a[r]):null))),e.default.createElement("section",{role:"tabpanel",tabIndex:"0",id:T+"-panel-"+N,"aria-labelledby":T+"-tab-"+N,className:"dsh-hive-content"},N==="Overview"?e.default.createElement(yo,{state:n,controller:o,onJournal:$,onJumpPost:W,onMention:Z}):N==="Board"?e.default.createElement(Mo,{key:n.team.id,state:n,controller:o,focusedSeq:P,onClearFocus:()=>q(null),mentionRequest:z,onConsumeMention:()=>J(null),onJumpPost:W,onOpenSession:O}):N==="Members"?e.default.createElement(Co,{key:n.team.id,state:n,controller:o,onJournal:$,onOpenSession:O,onMention:Z}):e.default.createElement(Bo,{key:n.team.id,state:n,controller:o,onJournal:$,onJumpPost:W}))):e.default.createElement(fo,{title:n.loading?"Loading teams\u2026":n.teams.length?"Choose a team":"No teams in this workspace"},n.loading?"Reading the native Host.":n.teams.length?"Select a team to inspect its work. Opening Swarm does not start workers.":"Create a team through /hive-swarm in an authorized parent session, then refresh."),p&&C?.controller===o&&n.journal?e.default.createElement(bo,{controller:o,journal:n.journal,opener:C.opener,onClose:h,onJumpPost:W}):null)}function Yt({surfaces:o}){let i=(0,e.useSyncExternalStore)(o.subscribe,o.getSnapshot,o.getSnapshot);return e.default.createElement(Gt,{controller:i,mode:"main"})}var At=()=>null,Do=/^hive-swarm:\/\/team\/([0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12})$/i;function Jt({parentSessionId:o,controllerForTeam:i,onExpand:d,useTabInfo:p=At,useSessions:m=At}){let n=p()?.tab,N=n?.navigation?.params,k=m(c=>c?.byId?.[o]?.cwd),C=typeof N?.teamId=="string"?"hive-swarm://team/"+N.teamId:n?.contentId,y=typeof C=="string"?Do.exec(C)?.[1]?.toLowerCase():void 0;return e.default.createElement(Gt,{controller:i(y,k),onExpand:d,visible:n?.visible!==!1})}var Ie=Je(require("react"),1);var $t=`.dsh-hive-tool {
869
- min-width: 0;
870
- color: var(--dsw-alias-label-primary);
871
- font: inherit;
872
- line-height: 1.5;
873
- }
874
- .dsh-hive-tool-line { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
875
- .dsh-hive-tool-line span, .dsh-hive-tool details { color: var(--dsw-alias-label-secondary); }
876
- .dsh-hive-tool-line span[data-failed], .dsh-hive-tool [role="alert"] { color: var(--dsw-alias-state-error-primary); }
877
- .dsh-hive-tool button {
878
- padding: 3px 9px;
879
- min-height: 28px;
880
- border: 1px solid var(--dsw-alias-border-l2);
881
- border-radius: 6px;
882
- background: var(--dsw-alias-bg-layer-2);
883
- color: inherit;
884
- font: inherit;
885
- cursor: pointer;
886
- }
887
- .dsh-hive-tool button:not(:disabled):hover { background: var(--dsw-alias-interactive-bg-hover); }
888
- .dsh-hive-tool button:disabled { opacity: .55; cursor: default; }
889
- .dsh-hive-tool :focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 2px; }
890
- .dsh-hive-tool p, .dsh-hive-tool details { margin: 4px 0 0; overflow-wrap: anywhere; }
891
- .dsh-hive-tool summary { cursor: pointer; }
892
- .dsh-hive-tool pre { margin: 6px 0 0; max-height: 14rem; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
893
- `;var _o=/^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i;function Oo(o){return o?.kind==="hive-swarm"&&typeof o.teamId=="string"&&_o.test(o.teamId)?o.teamId.toLowerCase():null}function Vt({toolName:o,phase:i,block:d,callId:p,openSwarm:m}){let n=(0,Ie.useRef)(null),[N,k]=(0,Ie.useState)(null),C=i==="result"&&d?.kind==="tool-result",y=C&&d.isError,c=C&&d.isError===!1?Oo(d.meta?.navigation):null,x=i==="preparing"?"Preparing\u2026":C?y?"Failed":"Completed":"Running\u2026",w=o==="hive_swarm_start_team"?"Start Swarm":"Find Swarm team",b=C?(d.content??[]).filter(z=>z.type==="text").map(z=>z.text).join(`
894
- `):"",P=N?.callId===p&&N?.target===c?N:null;(0,Ie.useEffect)(()=>()=>{n.current?.abort(),n.current=null},[p,c]);async function q(){if(!c||n.current)return;let z=new AbortController;n.current=z,k({callId:p,target:c,pending:!0});try{await m(c,z.signal),z.signal.aborted||k(null)}catch(J){z.signal.aborted||k({callId:p,target:c,error:J?.message??"Try opening the team again."})}finally{n.current===z&&(n.current=null)}}return Ie.default.createElement("section",{className:"dsh-hive-tool","aria-label":w},Ie.default.createElement("style",null,$t),Ie.default.createElement("div",{className:"dsh-hive-tool-line"},Ie.default.createElement("strong",null,w),Ie.default.createElement("span",{role:"status","data-failed":y||void 0},x),c?Ie.default.createElement("button",{type:"button",onClick:q,disabled:!!P?.pending},"Open Swarm"):null),y?Ie.default.createElement("p",{role:"alert"},d.error?.reason||b.split(`
895
- `,1)[0]||"The Host could not complete this tool call."):null,b?Ie.default.createElement("details",null,Ie.default.createElement("summary",null,"Tool result"),Ie.default.createElement("pre",null,b)):null,P?.pending?Ie.default.createElement("p",{role:"status"},"Opening team\u2026"):null,P?.error?Ie.default.createElement("p",{role:"alert"},"Could not open Swarm: ",P.error):null)}var Ge="dsh-hive-swarm",Uo=["slots","connection","layout","sidebarRightTabs","uiWorkspace"],Go=Symbol.for("hive-swarm.native-client.registrations"),Ue=globalThis[Go]??=new WeakMap,Yo=["hive_swarm_open_swarm_panel","hive_swarm_start_team"];function Jo(o){let i=o.slots;if(!Ue.has(i)){if(typeof i?.inject!="function"||typeof i?.register!="function"||typeof o.sidebarRightTabs?.register!="function"||typeof o.layout?.selectPanel!="function"){o.logger?.warn?.("Hive Swarm needs DSH right-tab, slot and layout capabilities. Enable them and reload the bundle.");return}o.effect(()=>{if(Ue.has(i))return()=>{};let d=yt((c,x,w)=>bt({connection:o.connection,sessionId:c,teamId:x,workspace:w,openSession:b=>{let P=o.uiWorkspace;if(typeof P?.openSession!="function")throw Error("Enable the DSH workspace capability to open a worker session.");return P.openSession(b)}})),p=[],m={},n=null;Ue.set(i,m);function N(){n?.abort();for(let c of p.splice(0).reverse())c?.();d.dispose(),Ue.get(i)===m&&Ue.delete(i)}function k(c){let x=d.getSnapshot();d.select(c);try{o.layout.selectPanel(Ge)}catch(w){throw d.select(x),w}}function C(c){n?.abort();try{k(c)}catch(x){c.setError(x)}}async function y(c,x,w){if(!c||Ue.get(i)!==m)throw Error("The original DSH session is unavailable.");n?.abort();let b=new AbortController;n=b;let P;try{let q=o.layout.beginNavigation?.();P=AbortSignal.any([b.signal,w,...q?[q]:[]]);let z=await gt(o.connection,x,P);P.throwIfAborted(),k(d.forSession(c,z.id,z.cwd))}catch(q){if(!P?.aborted)throw q}finally{n===b&&(n=null)}}try{p.push(o.sidebarRightTabs.register({id:Ge,kind:"hive-swarm",title:()=>"Swarm",patterns:["hive-swarm://team/**"],guide:[{id:"open",order:900,title:()=>"Swarm",icon:et}]})),p.push(i.inject("sidebar.right.pane.tab",()=>i.register({name:"sidebar.right.pane.tab",key:Ge,inject:x=>({parentSessionId:x,controllerForTeam:(w,b)=>d.forSession(x,w,b),onExpand:C})},Jt))),p.push(i.inject("sidebar.panellist",()=>i.register({name:"sidebar.panellist",id:Ge,order:30,label:()=>"Hive Swarm"},et))),p.push(i.inject("main",()=>i.register({name:"main",key:Ge,inject:()=>({surfaces:d})},Yt)));for(let x of Yo)p.push(i.inject("tool.call.toolview",()=>i.register({name:"tool.call.toolview",key:x,inject:w=>({openSwarm:(b,P)=>y(w,b,P)})},Vt)));let c=o.connection?.generation;typeof c?.subscribe=="function"?p.push(c.subscribe(()=>{c.getSnapshot()!==void 0&&d.reconnect()})):typeof o.on=="function"&&p.push(o.on("connection/reset",()=>d.reconnect()))}catch(c){return N(),o.logger?.warn?.("Hive Swarm could not register its native UI: "+c.message),()=>{}}return N},"hive-swarm: native launcher and views")}}
896
-
897
- return module.exports;
898
- }});
1
+ // Generated by scripts/build-dsh-client.mjs. Host React is intentionally external.
2
+ window.__ModuleLoader__.load({id:"dsh-hive-swarm",factory(require){
3
+ var module={exports:{}};var exports=module.exports;
4
+ var Xt=Object.create;var Ke=Object.defineProperty;var Kt=Object.getOwnPropertyDescriptor;var Qt=Object.getOwnPropertyNames;var Zt=Object.getPrototypeOf,Rt=Object.prototype.hasOwnProperty;var it=(o,n)=>()=>(n||o((n={exports:{}}).exports,n),n.exports),eo=(o,n)=>{for(var d in n)Ke(o,d,{get:n[d],enumerable:!0})},ft=(o,n,d,p)=>{if(n&&typeof n=="object"||typeof n=="function")for(let m of Qt(n))!Rt.call(o,m)&&m!==d&&Ke(o,m,{get:()=>n[m],enumerable:!(p=Kt(n,m))||p.enumerable});return o};var Je=(o,n,d)=>(d=o!=null?Xt(Zt(o)):{},ft(n||!o||!o.__esModule?Ke(d,"default",{value:o,enumerable:!0}):d,o)),to=o=>ft(Ke({},"__esModule",{value:!0}),o);var wt=it((Ko,xt)=>{var at={};(()=>{"use strict";let o=Math.sqrt(3),n=new Set(["for","in","on","to","with","of","by","at","from","into","onto","about","as","and","or","the","a","an","via","per","within"]);function d(t){return t.kind==="brief"||t.kind==="message"||!t.kind&&t.author!=="system"}function p(t,{live:l=!1,now:u=Date.now()}={}){let v=t.map(j=>Date.parse(j.time)).filter(Number.isFinite);if(!v.length)return"<1m";let E=Math.max(0,Math.floor(((l?u:v.at(-1))-v[0])/6e4));return E?E<60?E+"m":Math.floor(E/60)+"h"+(E%60?" "+E%60+"m":""):"<1m"}function m(t){return!!(t.unmentioned&&!t.mentions&&!t.broadcasts)}function i(t){let l=t&&typeof t=="object",u=l?String(t.taskLabel??"").trim():"";if(u)return u;let v=String(l?t.brief??t.task??"":t??""),E=l&&t.name?String(t.name).trim():"";if(!v.trim())return E||"Swarm task";let j=v.replace(/```[\s\S]*?```/g," ").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[`*_~>#]/g," ").replace(/^\s*(?:[-*+]|\d+[.)])\s+/gm,""),ee=/^(?:strict\s+file\s+ownership|do\s+not\s+touch|reference\s+screenshots|requirements?|first\s*\(|deliverables?)\b/i,Q=(j.split(/\r?\n+/).map(s=>s.trim()).filter(s=>s&&!ee.test(s)).slice(0,8).join(" ")||j).replace(/\s+/g," ").trim(),se=[/^you\s+have\s+just\s+started[.:!]*\s*/i,/^your\s+assignment(?:\s*\([^)]*\))?[:.\s-]*/i,/^you\s+are(?:\s+(?:a|an|the))?\s+(?:hive\s+swarm\s+)?(?:member|agent|worker|owner)(?:\s+['"]?@?[a-z0-9_-]+['"]?)?(?:\s+(?:for|on|in)\s+hive\s+swarm(?:\s+\d+(?:\.\d+)*)?)?[.,:;\s-]*/i,/^as(?:\s+(?:a|an|the))?\s+[a-z0-9 _-]+,\s*/i,/^(?:your\s+)?(?:task|goal|role|mission|assignment)\s*(?:is\s+to|is|:)\s*/i,/^you\s+(?:own|will\s+own|are\s+responsible\s+for|need\s+to|should|must)\s+(?:the\s+)?/i,/^please\s+/i,/^for\s+hive\s+swarm(?:\s+\d+(?:\.\d+)*)?[.,:;\s-]*/i];for(let s=0;s<3;s++){let D=!1;for(let S of se){let I=Q.replace(S,"").trim();I!==Q&&(Q=I,D=!0)}if(!D)break}if(Q=Q.replace(/\s+(?:in|on)\s+(?:your|the)\s+(?:shared\s+)?worktree.*$/i,"").replace(/\s+for\s+hive\s+swarm(?:\s+\d+(?:\.\d+)*)?\.?$/i,"").replace(/\s+/g," ").trim(),Q.length>64){let s=/^(.{18,64}?)[.!?](?:\s|$)/.exec(Q);s&&(Q=s[1])}let B=Q.replace(/[.,:;!?-]+$/g,"").split(/\s+/).filter(Boolean);B.length>10&&(B=B.slice(0,10));let H=B.join(" ");for(;H.length>64&&B.length>1;)B.pop(),H=B.join(" ");let ce=H.lastIndexOf("("),_=H.lastIndexOf(")");if(ce!==-1&&ce>_){let s=H.slice(0,ce).replace(/[,:;-\s]+$/,"").trim();s.split(/\s+/).length>=2?(H=s,B=H.split(/\s+/).filter(Boolean)):(H=H.replace(/\(/g,""),B=H.split(/\s+/).filter(Boolean))}for(;B.length>2&&n.has(B.at(-1).replace(/[,:;!?-]+$/g,"").toLowerCase());)B.pop();return H=B.join(" ").replace(/[,:;!?-]+$/g,"").trim(),H.length>64&&(H=H.slice(0,64).replace(/\s+\S*$/,"").replace(/[,:;!?-]+$/g,"").trim()),H?H[0].toUpperCase()+H.slice(1):E||"Swarm task"}function N(t){let l=t??[],u=l.some(E=>(E.role==="coordinator"||E.name==="coordinator")&&!E.external),v=l.some(E=>E.name==="user");return!u&&!v}function k(t,l,u,{hideInactive:v=!1,expandBroadcast:E=!1}={}){let j=N(l),ee=_=>j&&_==="user"?"coordinator":_,oe=new Map([["coordinator",{name:"coordinator",role:"coordinator",status:"waiting"}]]);for(let _ of l)oe.set(_.name,_);let Q=new Set,se=new Map,B=new Map,H=0;function ce(_){oe.has(_)||oe.set(_,{name:_,status:"observer"}),Q.add(_)}for(let _ of t){if(_.seq>u||!d(_))continue;let s=ee(_.author),D=[...new Set([...(_.targets??[]).map(ee),..._.coordinatorMention?["coordinator"]:[]])];ce(s);let S=se.get(s)??{posts:0,mentions:0,broadcasts:0,unmentioned:0,lastSeq:0};S.posts++,S.lastSeq=_.seq,se.set(s,S);let I=_.broadcast??/(?:^|[^a-z0-9_])@all(?![a-z0-9_-])/i.test(_.text??"");I&&(S.broadcasts++,H++),!I&&!D.some(F=>F!==s)&&S.unmentioned++;for(let F of new Set(D)){if(F===s||(ce(F),I&&!E))continue;let V=s+">"+F,ne=B.get(V)??{from:s,to:F,count:0,direct:0,broadcast:0,lastSeq:0};ne.count++,I?ne.broadcast++:ne.direct++,ne.lastSeq=_.seq,S.mentions++,B.set(V,ne)}}return{nodes:[...oe.values()].filter(_=>!v||Q.has(_.name)).map(_=>({..._,...se.get(_.name)})),links:[...B.values()],broadcasts:H}}function C(t,l){return t>6||t>3&&l<440}function y(t){return Math.max(1,Math.floor(t/120))}function c(t,l){if(C(t,l)){let u=Math.ceil(t/y(l));return Math.max(340,u*124+44)}return t>=6?470:t===5?450:t===4?400:0}function w(t,l,u){let v=new Map;if(!t.length)return v;if(C(t.length,l)){let ce=y(l),_=Math.ceil(t.length/ce),s=l/ce,D=56,S=66,I=Math.max(0,u-D-S);return t.forEach((F,V)=>{let ne=Math.floor(V/ce),X=Math.min(ce,t.length-ne*ce),de=_===1?Math.max(D,Math.min(u-S,u/2-8)):D+ne/(_-1)*I;v.set(F.name,{x:s*(V%ce+.5+(ce-X)/2),y:de})}),v}let E=t.find(ce=>ce.role==="coordinator")??t[0];if(!E)return v;let j=t.filter(ce=>ce!==E),ee=56,oe=66,Q=(ee+(u-oe))/2,se=Math.max(48,(u-ee-oe)/2),B=Math.min(68,Math.max(54,l*.1)),H=Math.max(44,Math.min(l*.4,l/2-B));if(!j.length)return v.set(E.name,{x:l/2,y:Q}),v;if(j.length===1){let ce=Math.max(54,Math.min(H*.72,l/2-B));return v.set(E.name,{x:l/2-ce,y:Q}),v.set(j[0].name,{x:l/2+ce,y:Q}),v}if(j.length===2){let ce=Math.max(ee,Q-se*.78),_=Math.min(u-oe,Q+se*.72),s=Math.max(54,Math.min(H*.85,l/2-B));return v.set(E.name,{x:l/2,y:ce}),v.set(j[0].name,{x:l/2-s,y:_}),v.set(j[1].name,{x:l/2+s,y:_}),v}return v.set(E.name,{x:l/2,y:Q}),j.forEach((ce,_)=>{let s=-Math.PI/2+_*Math.PI*2/j.length;v.set(ce.name,{x:l/2+Math.cos(s)*H,y:Q+Math.sin(s)*se})}),v}function x(t,l){return t>12||t>5&&l<380||t>8&&l<465}function b(t,l){if(x(t,l)){let u=Math.max(1,Math.floor(Math.max(l-24,140)/145)),v=Math.ceil(t/u);return Math.max(360,v*68+80)}return t>=11?680:t>=9?560:t>=7?470:t>=5?400:360}function P(t,l,u){let v=new Map;if(!t?.length)return v;let E=l<465,j=[],ee=t.find(S=>S.role==="coordinator"||S.name==="coordinator");ee&&j.push(ee);for(let S of t)S!==ee&&j.push(S);if(x(j.length,l)){let S=Math.max(...j.map(K=>z(K,{variant:"pill",narrow:E}).halfW*2),116),I=Math.max(1,Math.floor((l-24)/(S+14))),F=Math.ceil(j.length/I),V=l/I,ne=42,de=Math.max(40,u-ne-46);return j.forEach((K,le)=>{let he=Math.floor(le/I),me=Math.min(I,j.length-he*I),Se=F===1?u/2:ne+he/(F-1)*de,ue=V*(le%I+.5+(I-me)/2);v.set(K.name,{x:ue,y:Se})}),v}if(j.length===1)return v.set(j[0].name,{x:l/2,y:u/2}),v;let oe=Math.max(...j.map(S=>z(S,{variant:"pill",narrow:E}).halfW),56),Q=Math.max(...j.map(S=>z(S,{variant:"pill",narrow:E}).halfH),17),se=Q+18,B=Q+22,H=Math.min(l*.28,oe+18),ce=l/2,_=(se+(u-B))/2,s=Math.max(48,Math.min(l*.42,l/2-H)),D=Math.max(44,(u-se-B)/2);return j.forEach((S,I)=>{let F=-Math.PI/2+I*Math.PI*2/j.length;v.set(S.name,{x:ce+Math.cos(F)*s,y:_+Math.sin(F)*D})}),v}function q(t,l){let u=String(t??"").trim();if(!u)return 1;let v=Math.max(6,l),E=u.match(/[^-\s_/]+[-\s_/]*|[-\s_/]+/g)??[u],j=1,ee=0;for(let oe of E){let Q=oe;for(;Q.length>v;)ee>0&&(j++,ee=0),Q=Q.slice(v),j++;ee>0&&ee+Q.length>v?(j++,ee=Q.length):ee+=Q.length}return Math.max(1,j)}function z(t,{variant:l="card",cardWidth:u,narrow:v=!1}={}){if(l==="pill"){let Q=String(t?.name??""),se=Q==="user"?"You":Q==="system"?"System":Q,B=v?16:18,H=v?156:210,ce=v?88:104,_=v?6.4:7.2;return{halfW:Math.min(H,Math.max(ce,(v?38:46)+se.length*_))/2,halfH:B,offsetX:0,offsetY:0,radius:B}}if(l==="hex"){let Q=v?84:128,se=String(t?.name??""),B=se==="user"?"You":se==="system"?"System":"@"+se,H=Math.max(8,Math.floor((Q-12)/6.3)),ce=q(B,H),_=Math.min(Q,Math.max(38,12+B.length*6.3)),s=m(t??{}),D=Math.max(s?32:28,_/2),S=s?32:t?.broadcasts?29:24,I=29+ce*15+4;return{halfW:D,halfH:(S+I)/2,offsetX:0,offsetY:(I-S)/2,radius:10}}let E=u??(v?92:112),j=Math.max(7,Math.floor((E-20)/7.4)),oe=64+q(t?.name??"",j)*16;return{halfW:E/2,halfH:oe/2,offsetX:0,offsetY:0,radius:10}}function J(t,l){if(!l)return{cx:t.x,cy:t.y,halfW:26,halfH:26,radius:10};if(Number.isFinite(l.left)&&Number.isFinite(l.right)&&Number.isFinite(l.top)&&Number.isFinite(l.bottom))return{cx:t.x+(l.right-l.left)/2,cy:t.y+(l.bottom-l.top)/2,halfW:(l.left+l.right)/2,halfH:(l.top+l.bottom)/2,radius:Math.max(0,l.radius??8)};let u=Number.isFinite(l.halfW)?l.halfW:Number.isFinite(l.width)?l.width/2:26,v=Number.isFinite(l.halfH)?l.halfH:Number.isFinite(l.height)?l.height/2:26;return{cx:Number.isFinite(l.cx)?l.cx:t.x+(l.offsetX??0),cy:Number.isFinite(l.cy)?l.cy:t.y+(l.offsetY??0),halfW:Math.max(1,u),halfH:Math.max(1,v),radius:Math.max(0,l.radius??8)}}function g(t,l,u){let v=Math.max(0,Math.min(u.radius??0,u.halfW,u.halfH)),E=Math.abs(t-u.cx)-(u.halfW-v),j=Math.abs(l-u.cy)-(u.halfH-v);return Math.hypot(Math.max(E,0),Math.max(j,0))+Math.min(Math.max(E,j),0)-v}function T(t,l,u,v){let E=1-v;return{x:E*E*t.x+2*E*v*l.x+v*v*u.x,y:E*E*t.y+2*E*v*l.y+v*v*u.y}}function G(t,l,u,v,E){let j=(1-v)*(1-E),ee=(1-v)*E+v*(1-E),oe=v*E;return{x:j*t.x+ee*l.x+oe*u.x,y:j*t.y+ee*l.y+oe*u.y}}function $(t,l,u,v,E,j,ee,oe){let se=-1;for(let ue=0;ue<=32;ue++){let U=T(t,l,u,ue/32);g(U.x,U.y,v)<=j&&(se=ue)}if(se>=32)return null;let B=0;if(se>=0){let ue=se/32,U=(se+1)/32;for(let ve=0;ve<22;ve++){let be=(ue+U)/2,ye=T(t,l,u,be);g(ye.x,ye.y,v)<=j?ue=be:U=be}B=U}let H=-1,ce=Math.max(0,se+1);for(let ue=ce;ue<=32;ue++){let U=T(t,l,u,ue/32);if(g(U.x,U.y,E)<=ee){H=ue;break}}if(H<=0)return null;let _=(H-1)/32,s=H/32;for(let ue=0;ue<22;ue++){let U=(_+s)/2,ve=T(t,l,u,U);g(ve.x,ve.y,E)<=ee?s=U:_=U}let D=_;if(D<=B+1e-4)return null;let S=T(t,l,u,B),I=T(t,l,u,D),F=Math.hypot(I.x-S.x,I.y-S.y);if(F<oe)return null;let V=G(t,l,u,B,D),ne=T(t,l,u,(B+D)/2),X=I.x-V.x,de=I.y-V.y,K=V.x-S.x,le=V.y-S.y,he=Math.hypot(X,de)>1e-4?Math.atan2(de,X):Math.atan2(I.y-S.y,I.x-S.x),me=Math.hypot(K,le)>1e-4?Math.atan2(le,K):Math.atan2(I.y-S.y,I.x-S.x),Se="M"+S.x.toFixed(1)+" "+S.y.toFixed(1)+" Q"+V.x.toFixed(1)+" "+V.y.toFixed(1)+" "+I.x.toFixed(1)+" "+I.y.toFixed(1);return{start:S,control:V,end:I,mid:ne,startAngle:me,endAngle:he,length:F,tStart:B,tEnd:D,d:Se}}function O(t,l){if(!l.length)return 1/0;let u=1/0;for(let v=0;v<=24;v++){let E=T(t.start,t.control,t.end,v/24);for(let j of l){let ee=g(E.x,E.y,j);ee<u&&(u=ee)}}for(let v of l){let E=g(t.mid.x,t.mid.y,v)-10;E<u&&(u=E)}return u}function h(t,l,u,v,{marginStart:E=6,marginEnd:j=7,bidirectional:ee=!1,bend:oe,obstacles:Q=[],obstacleMargin:se=8,minLength:B=8}={}){if(!t||!l)return null;let H=J(t,u),ce=J(l,v),_={x:H.cx,y:H.cy},s={x:ce.cx,y:ce.cy},D=s.x-_.x,S=s.y-_.y,I=Math.hypot(D,S);if(I<1)return null;let F=D/I,ne=-(S/I),X=F,de=Q.map(he=>he?.box?J(he,he.box):J(he,he)),K=[];if(Number.isFinite(oe))K.push(oe);else if(ee){let he=Math.min(34,Math.max(18,I*.145));K.push(he,Math.min(54,he*1.45),Math.max(10,he*.55),Math.min(72,I*.3),Math.max(6,he*.3))}else{let he=Math.min(20,Math.max(8,I*.065)),me=Math.min(82,I*.34);K.push(he,-he,0,Math.min(me,he*2),-Math.min(me,he*2),Math.min(me,he*3.2),-Math.min(me,he*3.2),me,-me)}let le=(he,me,Se)=>{let ue=null,U=-1/0;for(let ve of K){let be={x:(_.x+s.x)/2+ne*ve,y:(_.y+s.y)/2+X*ve},ye=$(_,be,s,H,ce,he,me,Se);if(!ye)continue;let ke=O(ye,de),qe={...ye,bend:ve,clearance:ke};if(ke>=se)return qe;ke>U&&(U=ke,ue=qe)}return ue};return le(E,j,B)??le(Math.min(E,2),Math.min(j,3),Math.min(B,4))}function W(t,l,{variant:u="card",boxes:v,cardWidth:E,narrow:j=!1,marginStart:ee=6,marginEnd:oe=7,obstacleMargin:Q=8,minLength:se=8}={}){let B=new Map;for(let F of t.nodes??[]){let V=v?.get?.(F.name);B.set(F.name,V??z(F,{variant:u,cardWidth:E,narrow:j}))}let H=new Set((t.links??[]).map(F=>F.from+">"+F.to)),ce=new Map,_=[],s=(F,V)=>{let ne=[];for(let X of t.nodes??[]){if(X.name===F||X.name===V)continue;let de=l.get(X.name);de&&ne.push({x:de.x,y:de.y,box:B.get(X.name)})}return ne};for(let F of t.links??[]){let V=l.get(F.from),ne=l.get(F.to);if(!V||!ne)continue;let X=B.get(F.from)??z({name:F.from},{variant:u,cardWidth:E,narrow:j}),de=B.get(F.to)??z({name:F.to},{variant:u,cardWidth:E,narrow:j}),K=s(F.from,F.to),le=H.has(F.to+">"+F.from),he=h(V,ne,X,de,{marginStart:ee,marginEnd:oe,bidirectional:le,obstacles:K,obstacleMargin:Q,minLength:se});if(he){let me={link:F,edge:he,bidirectional:le,fromBox:X,toBox:de,obstacles:K};_.push(me),ce.set(F.from+">"+F.to,me)}}for(let F of _){if(!F.bidirectional||F.edge.clearance>=Math.min(Q,16))continue;let V=ce.get(F.link.to+">"+F.link.from);if(!V||V.edge.clearance<Math.min(Q,16))continue;let ne=l.get(F.link.from),X=l.get(F.link.to);for(let de of[-18,-26,-36,-48]){let K=h(ne,X,F.fromBox,F.toBox,{marginStart:ee,marginEnd:oe,bidirectional:!0,bend:de,obstacles:F.obstacles,obstacleMargin:Q,minLength:se});if(!K||K.clearance<10)continue;let le=Math.max(V.edge.bend,Math.abs(de)+28),he=h(X,ne,V.fromBox,V.toBox,{marginStart:ee,marginEnd:oe,bidirectional:!0,bend:le,obstacles:V.obstacles,obstacleMargin:Q,minLength:se});if(he&&he.clearance>=10&&Math.hypot(K.mid.x-he.mid.x,K.mid.y-he.mid.y)>=12){F.edge=K,V.edge=he;break}}}let D=[],S=(F,V,ne)=>{for(let X of V){let de=X?.box?J(X,X.box):J(X,X);if(g(F.x,F.y,de)<ne)return!1}for(let X of D)if(Math.hypot(F.x-X.x,F.y-X.y)<26)return!1;return!0},I=[];for(let F of t.nodes??[]){let V=l.get(F.name);V&&I.push({x:V.x,y:V.y,box:B.get(F.name)})}for(let F of _){let{edge:V,link:ne}=F;if(V.length<40)continue;let X=V.start,de=V.control,K=V.end,le=V.mid;if(!S(le,I,12))for(let he of[.38,.62,.32,.68,.44,.56]){let me=T(X,de,K,he);if(S(me,I,12)){le=me;break}}V.mid=le,ne.count>1&&D.push(le)}return _.map(({link:F,edge:V,bidirectional:ne})=>({link:F,edge:V,bidirectional:ne}))}function Z(t,l,u){let v=N(l),E=U=>v&&U==="user"?"coordinator":U,j=u==null?1/0:Number(u),ee=(t??[]).filter(U=>d(U)&&Number.isFinite(U.seq)).slice().sort((U,ve)=>U.seq-ve.seq),oe=ee.reduce((U,ve)=>Math.max(U,ve.seq),0),Q=j>=oe,se=ee.filter(U=>U.seq<=j),B=se.at(-1)??null,H=new Map,ce=new Map,_=new Map,s=new Map;for(let U of se){let ve=E(U.author);ce.set(ve,U.seq),H.set(ve,U);let be=new Set([...(U.targets??[]).map(E),...U.coordinatorMention?["coordinator"]:[]]);for(let ye of be)U.kind==="brief"&&_.set(ye,U.seq),s.set(ye,U.seq)}let D=l??[],S=D.find(U=>U.role==="coordinator"||U.name==="coordinator")??{name:"coordinator",role:"coordinator",status:"waiting"},I=D.filter(U=>U.role!=="coordinator"&&U.name!=="coordinator"),F=[{id:"working",label:"Working",tone:"working"},{id:"waiting",label:"Waiting",tone:"waiting"},{id:"needs",label:"Needs you",tone:"needs"},{id:"done",label:"Done",tone:"done"}],V=new Map(F.map(U=>[U.id,{...U,count:0,members:[]}])),ne=new Map([["coordinator","coordinator"]]);for(let U of I){let ve=ce.get(U.name)??0,be,ye=!1,ke=[];if(Q)be=U.status??"waiting",ye=!!U.recoveryRequired,ke=[...U.pendingWaitFor??U.waitFor??[]];else{let Ye=H.get(U.name),Xe=_.get(U.name)??0,Be=s.get(U.name)??0;j<=0?be="waiting":Ye&&/\[done\]/i.test(String(Ye.text??""))?be="done":E(B?.author)===U.name||Math.max(Xe,Be)>(Ye?.seq??0)?be="working":be="waiting"}let qe;ye||be==="failed"||be==="quota"?qe="needs":be==="working"?qe="working":be==="done"||be==="retired"?qe="done":qe="waiting";let ze=qe==="done",Pe={name:U.name,status:be,role:U.role??"worker",tint:U.tint,muted:ze,latestSeq:ve,pendingWaitFor:ke},He=V.get(qe);He.members.push(Pe),He.count=He.members.length,ne.set(U.name,qe)}let X=F.map(U=>V.get(U.id)).filter(U=>U.count>0),de=I.length,K=V.get("done").count,le;V.get("needs").count>0?le="stalled":V.get("working").count>0||Q&&S.status==="working"?le="working":de>0&&K===de?le="done":le="waiting";let he={name:"coordinator",status:Q?S.status??le:E(B?.author)==="coordinator"?"working":le,role:"coordinator",doneCount:K,totalWorkers:de,phase:le,latestSeq:ce.get("coordinator")??0,tint:S.tint},me=[],Se=new Set,ue=U=>{let ve=`${U.from}>${U.to}>${U.kind}`;Se.has(ve)||(Se.add(ve),me.push(U))};if(V.get("done").count>0&&ue({from:"done",to:"coordinator",kind:"done",label:"Tasks done"}),B&&(j===1/0||B.seq===j||!Q)){let U=ne.get(E(B.author));if(U){let ve=B.broadcast??/(?:^|[^a-z0-9_])@all(?![a-z0-9_-])/i.test(B.text??""),be=[...(B.targets??[]).map(E),...B.coordinatorMention?["coordinator"]:[]];if(ve){for(let ye of X)ye.id!==U&&ue({from:U,to:ye.id,kind:"message",label:"Message just sent",seq:B.seq});U!=="coordinator"&&ue({from:U,to:"coordinator",kind:"message",label:"Message just sent",seq:B.seq})}else for(let ye of be){let ke=ne.get(ye);ke&&ke!==U&&ue({from:U,to:ke,kind:"message",label:"Message just sent",seq:B.seq})}}}for(let U of X)for(let ve of U.members)for(let be of ve.pendingWaitFor??[]){let ye=ne.get(be);ye&&ue({from:U.id,to:ye,kind:"waiting",label:"Waiting on"})}return{currentSeq:B?.seq??0,lastPost:B,coordinator:he,clusters:X,connectors:me}}function re(t,l,u){let v=[];for(let E=0;E<6;E++){let j=E*Math.PI/3;v.push({x:t+u*Math.cos(j),y:l+u*Math.sin(j)})}return v}function pe(t){if(t<=0)return[];if(t<=3)return[t];if(t===4)return[2,2];if(t===5)return[3,2];if(t===6)return[3,3];if(t===7)return[4,3];if(t===8)return[4,4];if(t===9)return[3,4,2];if(t===10)return[4,4,2];if(t===11)return[4,4,3];if(t===12)return[4,4,4];let l=[],u=t;for(;u>0;){let v=Math.min(4,u);l.push(v),u-=v}return l}function ie(t,l,u,v){let E=v.length;if(!E)return[];let j=o/2*u,ee=pe(E),oe=ee.length,Q=-j*.14,se=j*.5,B=oe===1?j*.1:(Q+se)/2,H=se-Q,ce=E>6?Math.max(.7,Math.min(.98,u/106)):Math.max(.82,Math.min(1.08,u/98)),_=[],s=0;for(let D=0;D<oe;D++){let S=ee[D],I=oe===1?l+B:l+Q+D/(oe-1)*H,F=I-l,V=Math.max(18,u-Math.max(Math.abs(F-15),Math.abs(F+18))/o-8),ne=E>6?42:52,X=S===1?0:Math.min(ne,(V*2-4)/S),de=S===1?Math.min(88,V*1.85):Math.max(30,X-2);for(let K=0;K<S;K++){let le=t+(K-(S-1)/2)*X;_.push({member:v[s++],x:le,y:I,slotWidth:de,beeScale:ce})}}return _}function L(t,l){return t<=1?l<420?380:440:t===2?l<420?440:430:490}function R(t,l=680,u=460){let v=t?.clusters??[],E=34,j=14,oe=Math.max(200,l-16*2),Q=Math.max(220,u-j-E),se,B=[];if(v.length===0)se=Math.max(48,Math.min(oe/2.2,Q/(o*1.15),114)),B.push({id:"coordinator",ux:0,uy:0,isCoord:!0});else if(v.length===1){let ue=Math.max(12,Math.min(20,Q*.036));se=Math.max(46,Math.min(oe/2.15,(Q-ue)/(2*o),112));let U=o*se+ue,ve=l/2,be=j+Q/2,ye=new Map,ke={x:ve,y:be-U/2},qe={x:ve,y:be+U/2},ze=v[0],Pe={id:ze.id,label:ze.label,tone:ze.tone,count:ze.count,x:ke.x,y:ke.y,radius:se,vertices:re(ke.x,ke.y,se),slots:ie(ke.x,ke.y,se,ze.members??[])},He={id:"coordinator",x:qe.x,y:qe.y,radius:se,vertices:re(qe.x,qe.y,se),model:t.coordinator};return ye.set(Pe.id,Pe),ye.set("coordinator",He),{width:l,height:u,radius:se,coordinator:He,clusters:[Pe],cellsById:ye}}else if(v.length===2)B.push({id:"coordinator",ux:0,uy:.35,isCoord:!0}),oe>=Q*.85?(B.push({id:v[0].id,cluster:v[0],ux:-o/2,uy:-.15}),B.push({id:v[1].id,cluster:v[1],ux:o/2,uy:-.15})):(B.push({id:v[0].id,cluster:v[0],ux:0,uy:-.65}),B.push({id:v[1].id,cluster:v[1],ux:0,uy:1.35}));else if(v.length===3)B.push({id:"coordinator",ux:0,uy:0,isCoord:!0}),B.push({id:v[0].id,cluster:v[0],ux:0,uy:-1}),B.push({id:v[1].id,cluster:v[1],ux:-o/2,uy:.5}),B.push({id:v[2].id,cluster:v[2],ux:o/2,uy:.5});else{B.push({id:"coordinator",ux:0,uy:0,isCoord:!0}),B.push({id:v[0].id,cluster:v[0],ux:-o/2,uy:-.5}),B.push({id:v[1].id,cluster:v[1],ux:o/2,uy:-.5}),B.push({id:v[2].id,cluster:v[2],ux:-o/2,uy:.5}),B.push({id:v[3].id,cluster:v[3],ux:o/2,uy:.5});for(let ue=4;ue<v.length;ue++)B.push({id:v[ue].id,cluster:v[ue],ux:0,uy:ue===4?-1:1})}let H=Math.min(...B.map(ue=>ue.ux)),ce=Math.max(...B.map(ue=>ue.ux)),_=Math.min(...B.map(ue=>ue.uy)),s=Math.max(...B.map(ue=>ue.uy)),D=ce-H,S=s-_,I=Math.max(10,Math.min(18,Q*.03)),F=(oe-D*I)/(D*o+2),V=(Q-S*I)/(S*o+o);se=Math.max(40,Math.min(F,V,108));let ne=o*se+I,X=(H+ce)/2,de=(_+s)/2,K=l/2-X*ne,le=j+Q/2-de*ne,he=new Map,me=null,Se=[];for(let ue of B){let U=K+ue.ux*ne,ve=le+ue.uy*ne,be=re(U,ve,se);if(ue.isCoord)me={id:"coordinator",x:U,y:ve,radius:se,vertices:be,model:t?.coordinator},he.set("coordinator",me);else{let ye=ue.cluster,ke={id:ye.id,label:ye.label,tone:ye.tone,count:ye.count,x:U,y:ve,radius:se,vertices:be,slots:ie(U,ve,se,ye.members??[])};Se.push(ke),he.set(ke.id,ke)}}return{width:l,height:u,radius:se,coordinator:me,clusters:Se,cellsById:he}}function a(t,l,u){let v=o/2*t.radius,E=Math.abs(u),j=Math.abs(.8660254037844386*l+.5*u),ee=Math.abs(.8660254037844386*l-.5*u);return v/Math.max(E,j,ee,1e-6)}function A(t,l,u,v){let j=Math.sqrt(3)*22;t.strokeStyle=v,t.lineWidth=.8,t.beginPath();for(let ee=-1;ee<l/(22*1.5)+1;ee++)for(let oe=-1;oe<u/j+1;oe++){let Q=ee*1.5*22,se=oe*j+ee%2*j/2;for(let B=0;B<6;B++){let H=B*Math.PI/3,ce=Q+22*Math.cos(H),_=se+22*Math.sin(H);B===0?t.moveTo(ce,_):t.lineTo(ce,_)}t.closePath()}t.stroke()}function r(t,l,u,v,E,j){let ee=Math.min(j,v/2,E/2),oe=l-v/2,Q=u-E/2,se=l+v/2,B=u+E/2;t.beginPath(),t.moveTo(oe+ee,Q),t.lineTo(se-ee,Q),t.quadraticCurveTo(se,Q,se,Q+ee),t.lineTo(se,B-ee),t.quadraticCurveTo(se,B,se-ee,B),t.lineTo(oe+ee,B),t.quadraticCurveTo(oe,B,oe,B-ee),t.lineTo(oe,Q+ee),t.quadraticCurveTo(oe,Q,oe+ee,Q),t.closePath()}function M(t,l,u,v,E,j){let ee=t.clientWidth,oe=t.clientHeight;if(!ee||!oe)return;let Q=Math.min(devicePixelRatio||1,2),se=Math.round(ee*Q),B=Math.round(oe*Q);(t.width!==se||t.height!==B)&&(t.width=se,t.height=B);let H=t.getContext("2d");H.setTransform(Q,0,0,Q,0,0),H.clearRect(0,0,ee,oe),A(H,ee,oe,j.grid),H.strokeStyle=j.accent,H.lineWidth=1.4,H.setLineDash([3,3]);for(let _ of l.nodes){let s=u.get(_.name);!s||!m(_)||(H.globalAlpha=!v||v===_.name?.85:.2,H.beginPath(),H.arc(s.x,s.y,31,0,Math.PI*2),H.stroke())}H.setLineDash([]),H.font="600 10px ui-monospace, monospace",H.textAlign="center",H.textBaseline="middle";let ce=W(l,u,{variant:"hex",narrow:ee<465,marginStart:6,marginEnd:6,obstacleMargin:ee<465?14:24});for(let{link:_,edge:s}of ce){let{start:D,control:S,end:I,mid:F,endAngle:V}=s,ne=_.lastSeq===E,X=!v||_.from===v||_.to===v,de=ne&&X?j.accent:j.link;H.globalAlpha=X?ne?1:.78:.16,H.strokeStyle=H.fillStyle=de,H.lineWidth=Math.min(3.8,1.1+Math.sqrt(_.count)*.65),H.lineCap="round",H.setLineDash(_.direct?[]:[4,4]);let K=Math.min(4.5,s.length*.25),le=I.x-Math.cos(V)*K,he=I.y-Math.sin(V)*K;H.beginPath(),H.moveTo(D.x,D.y),H.quadraticCurveTo(S.x,S.y,le,he),H.stroke(),H.setLineDash([]);let me=9;if(H.beginPath(),H.moveTo(I.x,I.y),H.lineTo(I.x-me*Math.cos(V-.44),I.y-me*Math.sin(V-.44)),H.lineTo(I.x-me*.72*Math.cos(V),I.y-me*.72*Math.sin(V)),H.lineTo(I.x-me*Math.cos(V+.44),I.y-me*Math.sin(V+.44)),H.closePath(),H.fill(),X&&s.length>=40&&(_.count>1||ne||v)){let Se=String(_.count),ue=Math.max(20,Se.length*6.5+10);H.globalAlpha=.98,r(H,F.x,F.y,ue,15,7.5),H.fillStyle=j.paper,H.fill(),H.lineWidth=1,H.strokeStyle=ne?j.accent:j.link,H.stroke(),H.fillStyle=ne?j.accent:j.text,H.fillText(Se,F.x,F.y+.25)}}H.globalAlpha=1}function f(t){return t==="dark"?{bg:"#17140f",surface:"#221d16",ink:"#f5eddd",muted:"#bdb19a",border:"#43392b",edge:"#8c785c",pulse:"#c297ff",accent:"#f0b84b",doneFill:"#18281c",doneStroke:"#6ac47e",workingFill:"#2a2213",workingStroke:"#f0b84b",waitingFill:"#192133",waitingStroke:"#7da3f0",needsFill:"#2d1919",needsStroke:"#ef766e"}:{bg:"#f8f9fb",surface:"#ffffff",ink:"#24292f",muted:"#6e7781",border:"#d0d7de",edge:"#b4bcc6",pulse:"#8250df",accent:"#bf8700",doneFill:"#eef6ee",doneStroke:"#55943c",workingFill:"#fdf6e7",workingStroke:"#d18d22",waitingFill:"#eef3fc",waitingStroke:"#4d78cc",needsFill:"#fdf0ef",needsStroke:"#cf483f"}}function te(t,l){return t==="done"?{fill:l.doneFill,stroke:l.doneStroke}:t==="working"?{fill:l.workingFill,stroke:l.workingStroke}:t==="needs"||t==="stalled"?{fill:l.needsFill,stroke:l.needsStroke}:{fill:l.waitingFill,stroke:l.waitingStroke}}function Y(t,l){return t==="working"?l.doneStroke:t==="failed"||t==="quota"?l.needsStroke:t==="waiting"||t==="queued"?l.waitingStroke:l.muted}function Me(t){return t||(typeof window<"u"&&window.HiveBee?window.HiveBee:at.HiveBee)}function fe(t,l,u,v,E,j){if(j?.drawSprite){j.drawSprite(t,l,u,v,E);return}if(j?.sprite&&typeof document<"u"){let ee=j.sprite(v,E),oe=E?.scale??1;t.drawImage?.(ee,l,u,ee.width*oe,ee.height*oe)}}function ae(t,l){let u=String(t??"");return u.length<=l?u:l<=3?u.slice(0,l):u.slice(0,l-1)+"\u2026"}function xe(t,l,u,v,E=8){t.beginPath(),t.moveTo(l,u),t.lineTo(l-E*Math.cos(v-.44),u-E*Math.sin(v-.44)),t.lineTo(l-E*.7*Math.cos(v),u-E*.7*Math.sin(v)),t.lineTo(l-E*Math.cos(v+.44),u-E*Math.sin(v+.44)),t.closePath(),t.fill()}function Ce(t,l){t.beginPath(),l.forEach((u,v)=>{v===0?t.moveTo(u.x,u.y):t.lineTo(u.x,u.y)}),t.closePath()}function Ne(t,l,u,v){let{posts:E=[],members:j=[],cursor:ee=null,phase:oe,width:Q=680,height:se=460,focus:B=null}=l,H=Z(E,j,ee);oe&&ee==null&&(oe==="done"&&H.coordinator.totalWorkers>0&&H.coordinator.doneCount===H.coordinator.totalWorkers?H.coordinator.phase="done":(oe==="stalled"||oe==="budget")&&(H.coordinator.phase="stalled"));let ce=R(H,Q,se);for(let S of H.connectors){let I=ce.cellsById.get(S.from),F=ce.cellsById.get(S.to);if(!I||!F)continue;let V=S.kind==="message"?u.pulse:S.kind==="waiting"?u.workingStroke:u.doneStroke;if(t.strokeStyle=V,t.fillStyle=V,t.lineWidth=S.kind==="message"?2.2:1.5,t.setLineDash?.(S.kind==="waiting"?[4,4]:[]),I===F){let qe=I.x+I.radius*.72,ze=I.y-o/2*I.radius*.4;t.beginPath(),t.arc(qe+8,ze,10,-Math.PI*.8,Math.PI*.8),t.stroke(),t.setLineDash?.([]);continue}let ne=F.x-I.x,X=F.y-I.y,de=Math.hypot(ne,X);if(de<1)continue;let K=ne/de,le=X/de,he=a(I,K,le),me=a(F,-K,-le),Se=S.kind==="message"?8:S.kind==="waiting"?-8:0,ue=-le,U=K,ve=I.x+K*(he+2)+ue*Se,be=I.y+le*(he+2)+U*Se,ye=F.x-K*(me+2)+ue*Se,ke=F.y-le*(me+2)+U*Se;t.beginPath(),t.moveTo(ve,be),t.lineTo(ye,ke),t.stroke(),t.setLineDash?.([]),S.kind!=="done"&&xe(t,ye,ke,Math.atan2(ke-be,ye-ve),7)}t.textAlign="center",t.textBaseline="middle";for(let S of ce.clusters){let I=te(S.tone,u),F=!!B,V=!F||S.slots.some(X=>X.member.name===B);t.globalAlpha=V?1:.38,Ce(t,S.vertices),t.fillStyle=I.fill,t.fill(),t.lineWidth=2,t.strokeStyle=I.stroke,t.stroke();let ne=o/2*S.radius;t.fillStyle=u.ink,t.font='600 12px "Segoe UI", system-ui, sans-serif',t.fillText(S.label,S.x,S.y-ne*.68),t.fillStyle=u.muted,t.font='500 11px "Segoe UI", system-ui, sans-serif',t.fillText(String(S.count),S.x,S.y-ne*.5);for(let X of S.slots){let de=X.beeScale,K=20*de,le=18*de,he=F&&B!==X.member.name;t.globalAlpha=he?.35:1,F&&B===X.member.name&&(t.strokeStyle=u.accent,t.lineWidth=1.5,t.beginPath(),t.arc(X.x,X.y-2,Math.max(K,le)*.72,0,Math.PI*2),t.stroke()),fe(t,X.x-K/2,X.y-le*.68,X.member.name,{status:X.member.status,coordinator:!1,tint:X.member.tint,muted:X.member.muted,scale:de},v),t.fillStyle=X.member.muted?u.muted:u.ink,t.font='500 9.5px "Segoe UI", system-ui, sans-serif';let me=Math.max(6,Math.floor(X.slotWidth/4.6));t.fillText(ae(X.member.name,me),X.x,X.y+le*.62)}}let _=ce.coordinator;if(_){let S=te(_.model?.phase??"waiting",u);t.globalAlpha=!B||B==="coordinator"?1:.45,Ce(t,_.vertices),t.fillStyle=S.fill,t.fill(),t.lineWidth=2,t.strokeStyle=S.stroke,t.stroke();let I=Math.max(1.2,Math.min(2.1,_.radius/48)),F=20*I,V=18*I;fe(t,_.x-F/2,_.y-V*.78,"coordinator",{status:_.model?.status??"waiting",coordinator:!0,tint:_.model?.tint,muted:!1,scale:I},v);let ne=o/2*_.radius;t.fillStyle=u.ink,t.font='650 12px "Segoe UI", system-ui, sans-serif',t.fillText("Coordinator",_.x,_.y+ne*.34),t.fillStyle=u.muted,t.font='500 11px "Segoe UI", system-ui, sans-serif',t.fillText(`${_.model?.doneCount??0} of ${_.model?.totalWorkers??0} done`,_.x,_.y+ne*.56)}t.globalAlpha=1;let s=se-16,D=24;t.textAlign="left",t.textBaseline="middle",t.font='500 11px "Segoe UI", system-ui, sans-serif',t.strokeStyle=u.doneStroke,t.lineWidth=1.6,t.beginPath(),t.moveTo(D,s),t.lineTo(D+16,s),t.stroke(),t.fillStyle=u.muted,t.fillText("Tasks done",D+22,s),D+=102,t.strokeStyle=u.pulse,t.beginPath(),t.moveTo(D,s),t.lineTo(D+16,s),t.stroke(),t.fillText("Message just sent",D+22,s),D+=136,t.strokeStyle=u.workingStroke,t.fillStyle=u.workingStroke,t.setLineDash?.([3,3]),t.beginPath(),t.moveTo(D,s),t.lineTo(D+16,s),t.stroke(),t.setLineDash?.([]),xe(t,D+20,s,0,5),t.fillStyle=u.muted,t.fillText("Waiting on",D+26,s)}function ge(t,l,u,v){let{posts:E=[],members:j=[],cursor:ee=null,width:oe=680,height:Q=460,hideInactive:se=!1,expandBroadcast:B=!1,focus:H=null}=l,ce=(E??[]).filter(d).slice().sort((K,le)=>K.seq-le.seq),_=ee==null?ce.at(-1)?.seq??1/0:Number(ee),s=ce.filter(K=>K.seq<=_).at(-1)??null,D=k(E,j,_,{hideInactive:se,expandBroadcast:B}),S=Math.max(220,Q-42),I=oe<465,F=P(D.nodes,oe,S),V=new Map;for(let K of D.nodes)V.set(K.name,z(K,{variant:"pill",narrow:I}));let ne=W(D,F,{variant:"pill",boxes:V,narrow:I,marginStart:4,marginEnd:6,obstacleMargin:10});t.textAlign="center",t.textBaseline="middle";for(let{link:K,edge:le}of ne){let{start:he,control:me,end:Se,mid:ue,endAngle:U}=le,ve=!!(s&&K.lastSeq===s.seq),be=!H||K.from===H||K.to===H,ye=ve&&be?u.pulse:u.edge;t.globalAlpha=be?ve?.96:.72:.16,t.strokeStyle=t.fillStyle=ye,t.lineWidth=Math.min(4.2,1.2+Math.sqrt(K.count)*.72),t.setLineDash?.(K.direct?[]:[4,4]);let ke=Math.min(4.5,le.length*.25),qe=Se.x-Math.cos(U)*ke,ze=Se.y-Math.sin(U)*ke;if(t.beginPath(),t.moveTo(he.x,he.y),t.quadraticCurveTo(me.x,me.y,qe,ze),t.stroke(),t.setLineDash?.([]),xe(t,Se.x,Se.y,U,8),be&&le.length>=36&&(K.count>1||ve||H)){let Pe=String(K.count),He=Math.max(16,Pe.length*6.5+8);t.globalAlpha=.96,r(t,ue.x,ue.y,He,14,7),t.fillStyle=u.bg,t.fill(),t.fillStyle=ve?u.pulse:u.ink,t.font="600 10px ui-monospace, monospace",t.fillText(Pe,ue.x,ue.y+.5)}}for(let K of D.nodes){let le=F.get(K.name),he=V.get(K.name);if(!le||!he)continue;let me=K.role==="coordinator"||K.name==="coordinator",Se=K.status==="retired",ue=K.status==="done"||Se,U=!H||H===K.name||D.links.some(Be=>Be.from===H&&Be.to===K.name||Be.to===H&&Be.from===K.name);t.globalAlpha=U?Se?.56:1:.24;let ve=m(K);r(t,le.x,le.y,he.halfW*2,he.halfH*2,he.radius),t.fillStyle=u.surface,t.fill(),t.lineWidth=H===K.name?1.8:1.1,t.strokeStyle=H===K.name?u.pulse:u.border,t.setLineDash?.(ve?[3,3]:[]),t.stroke(),t.setLineDash?.([]);let be=le.x-he.halfW,ye=le.x+he.halfW,ke=I?.85:.92,qe=20*ke,ze=18*ke;fe(t,be+10,le.y-ze/2,K.name,{status:K.status??"observer",coordinator:me,tint:K.tint,muted:!me&&ue,scale:ke},v);let Pe=K.name==="user"?"You":K.name==="system"?"System":K.name,He=(be+10+qe+6+ye-14)/2;t.fillStyle=Se?u.muted:u.ink,t.font='600 11px "Segoe UI", system-ui, sans-serif';let Ye=Math.max(5,Math.floor((he.halfW*2-qe-28)/6.2)),Xe=ae(Pe,Ye);if(t.fillText(Xe,He,le.y+.5),Se){let Be=Math.min(he.halfW*2-qe-28,Xe.length*6.2);t.strokeStyle=u.muted,t.lineWidth=1,t.beginPath(),t.moveTo(He-Be/2,le.y+.5),t.lineTo(He+Be/2,le.y+.5),t.stroke()}t.fillStyle=Y(K.status,u),t.beginPath(),t.arc(ye-10,le.y,3,0,Math.PI*2),t.fill()}t.globalAlpha=1;let X=Q-22,de=24;if(t.textAlign="left",t.textBaseline="middle",t.font='500 11px "Segoe UI", system-ui, sans-serif',t.strokeStyle=u.edge,t.fillStyle=u.edge,t.lineWidth=1.4,t.beginPath(),t.moveTo(de,X),t.lineTo(de+14,X),t.stroke(),xe(t,de+18,X,0,5),t.fillStyle=u.muted,t.fillText("@mention, width = count",de+24,X),de+=168,t.strokeStyle=u.edge,t.fillStyle=u.edge,t.setLineDash?.([3,3]),t.beginPath(),t.moveTo(de,X),t.lineTo(de+14,X),t.stroke(),t.setLineDash?.([]),xe(t,de+18,X,0,5),t.fillStyle=u.muted,t.fillText("via @all",de+24,X),de+=78,t.strokeStyle=u.border,t.setLineDash?.([2,2]),r(t,de+8,X,16,10,5),t.stroke(),t.setLineDash?.([]),t.fillStyle=u.muted,t.fillText("posted with no mention",de+22,X),D.broadcasts>0&&Q>=60){let K="@all "+D.broadcasts,le=Q-7;r(t,40,le-1,36,14,7),t.fillStyle=u.border,t.fill(),t.fillStyle=u.ink,t.font="600 9.5px ui-monospace, monospace",t.textAlign="center",t.fillText(K,40,le),t.textAlign="left",t.fillStyle=u.muted,t.font='500 10.5px "Segoe UI", system-ui, sans-serif',t.fillText("@all posts, drawn by Expand @all",64,le)}}function we(t,l={}){if(!t)return;let u=l.width??680,v=l.height??460,E=l.theme==="dark"?"dark":"light",j=l.mode==="mentions"?"mentions":"hive",ee=f(E),oe=Me(l.bees);t.save?.(),t.clearRect?.(0,0,u,v),t.fillStyle=ee.bg,t.fillRect(0,0,u,v),j==="mentions"?ge(t,l,ee,oe):Ne(t,l,ee,oe),t.restore?.()}at.HiveGraph=Object.freeze({isPost:d,shouldMergeUserToCoordinator:N,project:k,elapsedSpan:p,unmentionedNode:m,minimumHeight:c,layout:w,nodeBox:z,roundedRectSignedDistance:g,clipEdge:h,routeEdges:W,draw:M,smartTaskLabel:i,mentionsMinimumHeight:b,layoutMentions:P,projectHive:Z,hiveMinimumHeight:L,layoutHive:R,renderGraphFrame:we})})();xt.exports=at.HiveGraph});var St=it((Qo,Mt)=>{var kt={};(()=>{"use strict";let o=[["#efac37","#ffe18d","#bb641d"],["#75baef","#cdefff","#3974bb"],["#55cbb2","#b8f8df","#268c7d"],["#e68db3","#ffcee2","#a24275"],["#b3ce64","#e9f6a1","#6c9137"],["#ad9ce8","#e3d4ff","#6d58af"],["#f09a71","#ffd3b7","#af5833"],["#95cbd1","#defbfa","#4a8d9d"],["#d1a76a","#ffe2a9","#987044"]],n=["#aaafb6","#d6dae0","#848991"];function d(C,y,c){if(y)return o[0];if(Number.isInteger(c))return o[1+Math.abs(c)%(o.length-1)];let w=[...String(C??"")].reduce((x,b)=>x*31+b.charCodeAt(0),0)>>>0;return o[w%o.length]}function p(C){let y=String(C).replace("#",""),c=Number.parseInt(y,16);return[c>>16&255,c>>8&255,c&255]}function m(C,y,c){let[w,x,b]=d(C,y,c),[P,q,z]=p(w),[J,g,T]=p(b),G=Math.round(J*.78),$=Math.round(g*.78),O=Math.round(T*.78),h="#"+[G,$,O].map(W=>W.toString(16).padStart(2,"0")).join("");return{base:w,highlight:x,shade:b,bg:`rgba(${P}, ${q}, ${z}, 0.14)`,border:`rgba(${P}, ${q}, ${z}, 0.42)`,text:h}}function i(C,y,c,w=0,x=0,b=1){C.fillStyle=y;for(let[P,q,z,J]of c)w===0&&x===0&&b===1?C.fillRect(P,q,z,J):C.fillRect(w+P*b,x+q*b,z*b,J*b)}function N(C,y,c,w,{status:x="working",coordinator:b=!1,tint:P,muted:q=!1,scale:z=1}={}){if(!C)return;let[J,g,T]=q?n:d(w,b,P),G=!q&&["waiting","quota","retired","done"].includes(x),$=q?"#727880":"#201915",O=q?"#828a94":"#24313d",h=q?"#ced3d9":"#a9c6db",W=q?"#eef1f4":"#e7f2fa",Z=q?"#767c84":"#2c221c";i(C,$,[[3,2,1,3],[6,3,1,2],[5,1,2,1],[2,3,1,1],[5,5,10,8],[3,7,13,5],[4,12,11,2],[6,14,7,1],[16,9,2,2],[7,14,1,2],[12,14,1,2]],y,c,z),i(C,O,[[7,3,6,4],[8,2,4,6],[12,3,4,4],[13,2,2,1]],y,c,z),i(C,h,[[8,3,3,4],[12,4,3,2],[9,7,2,1]],y,c,z),i(C,W,[[9,3,2,2],[12,4,2,1],[8,4,1,2]],y,c,z),i(C,J,[[4,7,8,5],[5,6,6,7],[12,7,3,5],[13,12,1,1],[6,13,1,1]],y,c,z),i(C,g,[[5,7,3,1],[4,9,2,2],[10,7,2,1],[13,8,1,2],[5,12,2,1]],y,c,z),i(C,T,[[6,12,7,1],[12,11,3,1],[13,12,1,1]],y,c,z),i(C,Z,[[8,6,2,7],[12,7,1,6],[15,9,2,1]],y,c,z),G?(i(C,$,[[4,10,2,1]],y,c,z),i(C,"#d7dcff",b?[[0,0,2,1],[1,1,1,1],[0,2,2,1],[15,0,4,1],[17,1,1,2],[15,3,4,1]]:[[1,1,3,1],[2,2,1,1],[1,3,3,1],[15,0,4,1],[17,1,1,2],[15,3,4,1]],y,c,z)):(i(C,q?"#555b63":"#201915",[[5,8,1,2]],y,c,z),i(C,q?"#e5e8ec":"#fff6d7",[[5,8,1,1]],y,c,z)),b&&(i(C,q?"#727880":"#6d4219",[[2,1,1,4],[8,1,1,4],[2,4,7,1]],y,c,z),i(C,q?"#c7cbd1":"#ffd86b",[[2,0,1,2],[5,0,1,3],[8,0,1,2],[3,2,5,2],[4,1,3,1]],y,c,z),i(C,q?"#9da3ab":"#e7a52f",[[3,4,5,1],[3,3,5,1]],y,c,z),i(C,q?"#eceef1":"#fff3bf",[[3,2,1,1],[7,2,1,1],[5,3,1,1]],y,c,z))}function k(C,{status:y="working",coordinator:c=!1,tint:w,muted:x=!1}={}){let b=document.createElement("canvas");b.className="bee-pixel",b.width=20,b.height=18,b.setAttribute("aria-hidden","true");let P=!x&&["waiting","quota","retired","done"].includes(y);b.dataset.pose=x?"muted":P?"sleeping":"awake",x&&(b.dataset.muted="true");let q=b.getContext("2d");return N(q,0,0,C,{status:y,coordinator:c,tint:w,muted:x,scale:1}),b}kt.HiveBee=Object.freeze({sprite:k,colors:d,tintStyle:m,drawSprite:N})})();Mt.exports=kt.HiveBee});var Ct=it((Zo,Nt)=>{var Ze={};(()=>{"use strict";function o(c){return c||(typeof window<"u"&&window.HiveGraph?window.HiveGraph:Ze.HiveGraph)}function n(c){return c||(typeof window<"u"&&window.HiveBee?window.HiveBee:Ze.HiveBee)}function d(c,w=128){let x=Math.max(2,Math.min(256,w|0)),b=new Map,P=Math.min(c.length,16),q=c.length<=P?1:(c.length-1)/(P-1),z=new Set;for(let ie=0;ie<P;ie++)z.add(Math.round(ie*q));z.add(0),z.add(c.length-1);let J=c[0].rgba,g=J.length>=4&&J[3]>=128?J[0]<<16|J[1]<<8|J[2]:16777215;for(let ie of z){let L=c[ie].rgba,R=-1,a=0;for(let A=0;A+3<L.length;A+=4){let r=L[A+3]<128?g:L[A]<<16|L[A+1]<<8|L[A+2];r===R?a++:(R!==-1&&b.set(R,(b.get(R)??0)+a),R=r,a=1)}R!==-1&&b.set(R,(b.get(R)??0)+a)}let T;if(b.size<=x)T=[...b.keys()];else{let ie=[...b.entries()].sort((M,f)=>f[1]-M[1]),L=Math.min(ie.length,Math.max(2,Math.floor(x*.48)));T=ie.slice(0,L).map(M=>M[0]);let R=new Set(T),a=new Map;for(let M=L;M<ie.length;M++){let[f,te]=ie[M],Y=f>>19&31,Me=f>>11&31,fe=f>>3&31,ae=Y<<10|Me<<5|fe,xe=a.get(ae);xe||(xe={rSum:0,gSum:0,bSum:0,w:0},a.set(ae,xe)),xe.rSum+=(f>>16&255)*te,xe.gSum+=(f>>8&255)*te,xe.bSum+=(f&255)*te,xe.w+=te}let A=[];for(let M of a.values())A.push({r:Math.round(M.rSum/M.w),g:Math.round(M.gSum/M.w),b:Math.round(M.bSum/M.w),w:M.w});let r=x-T.length;if(A.length<=r)for(let M of A){let f=M.r<<16|M.g<<8|M.b;R.has(f)||(R.add(f),T.push(f))}else{let M=te=>{let Y=255,Me=0,fe=255,ae=0,xe=255,Ce=0,Ne=0;for(let u of te)u.r<Y&&(Y=u.r),u.r>Me&&(Me=u.r),u.g<fe&&(fe=u.g),u.g>ae&&(ae=u.g),u.b<xe&&(xe=u.b),u.b>Ce&&(Ce=u.b),Ne+=u.w;let ge=Me-Y,we=ae-fe,t=Ce-xe,l=we>=ge&&we>=t?"g":ge>=t?"r":"b";return{list:te,span:Math.max(ge,we,t),axis:l,totalW:Ne}},f=[M(A)];for(;f.length<r;){let te=-1,Y=-1;for(let Ne=0;Ne<f.length;Ne++){let ge=f[Ne];if(ge.list.length>1&&ge.span>0){let we=ge.span*Math.log2(ge.totalW+2);we>Y&&(Y=we,te=Ne)}}if(te===-1)break;let Me=f.splice(te,1)[0],fe=Me.axis;Me.list.sort((Ne,ge)=>Ne[fe]-ge[fe]);let ae=Me.totalW/2,xe=0,Ce=1;for(let Ne=0;Ne<Me.list.length-1;Ne++)if(xe+=Me.list[Ne].w,xe>=ae){Ce=Ne+1;break}f.push(M(Me.list.slice(0,Ce)),M(Me.list.slice(Ce)))}for(let te of f){let Y=0,Me=0,fe=0,ae=0;for(let we of te.list)Y+=we.r*we.w,Me+=we.g*we.w,fe+=we.b*we.w,ae+=we.w;let xe=Math.round(Y/ae),Ce=Math.round(Me/ae),Ne=Math.round(fe/ae),ge=xe<<16|Ce<<8|Ne;R.has(ge)||(R.add(ge),T.push(ge))}}}T.length||(T=[16777215]);let G=1;for(;1<<G<T.length&&G<8;)G++;let $=1<<G,O=Math.max(2,G),h=G-1,W=new Uint8Array(T.length),Z=new Uint8Array(T.length),re=new Uint8Array(T.length),pe=new Map;for(let ie=0;ie<T.length;ie++){let L=T[ie];W[ie]=L>>16&255,Z[ie]=L>>8&255,re[ie]=L&255,pe.set(L,ie)}return{colors:T,paletteR:W,paletteG:Z,paletteB:re,tableLength:$,minCodeSize:O,tableSizeFlag:h,bgRgb:g,exactLookup:pe}}function p(c,w,x){let{paletteR:b,paletteG:P,paletteB:q,bgRgb:z,exactLookup:J}=x,g=b.length,T=new Uint8Array(w),G=-1,$=0;for(let O=0,h=0;O<w;O++,h+=4){let W=c[h+3]<128?z:c[h]<<16|c[h+1]<<8|c[h+2];if(W===G){T[O]=$;continue}let Z=J.get(W);if(Z===void 0){let re=W>>16&255,pe=W>>8&255,ie=W&255,L=1/0;Z=0;for(let R=0;R<g;R++){let a=re-b[R],A=pe-P[R],r=ie-q[R],M=a*a+A*A+r*r;if(M<L&&(L=M,Z=R,M===0))break}J.size<65536&&J.set(W,Z)}G=W,$=Z,T[O]=Z}return T}class m{constructor(w=32768){this.buf=new Uint8Array(w),this.pos=0}ensure(w){if(this.pos+w<=this.buf.length)return;let x=this.buf.length*2;for(;x<this.pos+w;)x*=2;let b=new Uint8Array(x);b.set(this.buf.subarray(0,this.pos)),this.buf=b}byte(w){this.ensure(1),this.buf[this.pos++]=w&255}u16(w){this.ensure(2),this.buf[this.pos++]=w&255,this.buf[this.pos++]=w>>8&255}bytes(w){this.ensure(w.length),this.buf.set(w,this.pos),this.pos+=w.length}ascii(w){this.ensure(w.length);for(let x=0;x<w.length;x++)this.buf[this.pos++]=w.charCodeAt(x)}finish(){return this.buf.slice(0,this.pos)}}function i(c,w,x){let b=1<<w,P=b+1,q=8192,z=q-1,J=new Int32Array(q).fill(-1),g=new Int16Array(q),T=new Uint8Array(255),G=0,$=0,O=0;function h(){G&&(x.byte(G),x.bytes(T.subarray(0,G)),G=0)}function W(L,R){for($|=L<<O,O+=R;O>=8;)T[G++]=$&255,G===255&&h(),$>>>=8,O-=8}let Z=w+1,re=P+1,pe=1<<Z;if(W(b,Z),!c.length){W(P,Z),O>0&&(T[G++]=$&255),h(),x.byte(0);return}let ie=c[0];for(let L=1;L<c.length;L++){let R=c[L],a=ie<<8|R,A=(ie<<5^R^ie>>>3)&z,r=(ie^R<<3|1)&z,M=!1;for(;J[A]!==-1;){if(J[A]===a){ie=g[A],M=!0;break}A=A+r&z}M||(W(ie,Z),re<4096?(J[A]=a,g[A]=re++,re>pe&&Z<12&&(Z++,pe=1<<Z)):(W(b,Z),J.fill(-1),Z=w+1,re=P+1,pe=1<<Z),ie=R)}W(ie,Z),W(P,Z),O>0&&(T[G++]=$&255,G===255&&h()),h(),x.byte(0)}function N(c,{width:w,height:x,loop:b=0,maxColors:P=128}={}){if(!Array.isArray(c)||!c.length)throw new Error("encodeGif requires at least one frame.");let q=Math.floor(Number(w)),z=Math.floor(Number(x));if(!Number.isFinite(q)||q<=0||q>65535||!Number.isFinite(z)||z<=0||z>65535)throw new Error("encodeGif requires valid width and height (1..65535).");let J=q*z;for(let G=0;G<c.length;G++)if(!c[G]?.rgba||c[G].rgba.length<J*4)throw new Error(`Frame ${G} RGBA buffer is smaller than ${q}x${z}x4 bytes.`);let g=d(c,P),T=new m(Math.max(16384,J));T.ascii("GIF89a"),T.u16(q),T.u16(z),T.byte(240|g.tableSizeFlag),T.byte(0),T.byte(0);for(let G=0;G<g.tableLength;G++)G<g.colors.length?(T.byte(g.paletteR[G]),T.byte(g.paletteG[G]),T.byte(g.paletteB[G])):(T.byte(0),T.byte(0),T.byte(0));if(b!==!1&&b!==null&&b!==void 0){let G=Math.max(0,Math.min(65535,Math.floor(Number(b))));T.byte(33),T.byte(255),T.byte(11),T.ascii("NETSCAPE2.0"),T.byte(3),T.byte(1),T.u16(G),T.byte(0)}for(let G of c){let $=Math.max(1,Math.min(65535,Math.round(G.delayCs??50)));T.byte(33),T.byte(249),T.byte(4),T.byte(4),T.u16($),T.byte(0),T.byte(0),T.byte(44),T.u16(0),T.u16(0),T.u16(q),T.u16(z),T.byte(0),T.byte(g.minCodeSize);let O=p(G.rgba,J,g);i(O,g.minCodeSize,T)}return T.byte(59),T.finish()}function k(c){let w=String(c??"").trim();if(w.startsWith("#")){let b=w.slice(1);if(b.length===3)return[Number.parseInt(b[0]+b[0],16),Number.parseInt(b[1]+b[1],16),Number.parseInt(b[2]+b[2],16),255];if(b.length>=6)return[Number.parseInt(b.slice(0,2),16),Number.parseInt(b.slice(2,4),16),Number.parseInt(b.slice(4,6),16),b.length===8?Number.parseInt(b.slice(6,8),16):255]}let x=/^rgba?\(([^)]+)\)$/i.exec(w);if(x){let b=x[1].split(",").map(P=>Number.parseFloat(P.trim()));return[b[0]||0,b[1]||0,b[2]||0,b.length>=4?Math.round(b[3]*255):255]}return[0,0,0,255]}function C(c,w){let x=new Uint8ClampedArray(c*w*4),b=[],P={fillStyle:"#000000",strokeStyle:"#000000",lineWidth:1,globalAlpha:1},q=[],z=0,J=0,g=0,T=0;function G(h,W,Z){let re=Math.round(h),pe=Math.round(W);if(re<0||re>=c||pe<0||pe>=w)return;let ie=Z[3]/255*P.globalAlpha;if(ie<=0)return;let L=(pe*c+re)*4;if(ie>=.995)x[L]=Z[0],x[L+1]=Z[1],x[L+2]=Z[2],x[L+3]=255;else{let R=1-ie;x[L]=Math.round(x[L]*R+Z[0]*ie),x[L+1]=Math.round(x[L+1]*R+Z[1]*ie),x[L+2]=Math.round(x[L+2]*R+Z[2]*ie),x[L+3]=255}}function $(h,W,Z,re,pe,ie){let L=Math.max(1,Math.ceil(Math.hypot(Z-h,re-W))),R=Math.max(0,Math.floor((ie-1)/2));for(let a=0;a<=L;a++){let A=h+(Z-h)*a/L,r=W+(re-W)*a/L;for(let M=-R;M<=R;M++)for(let f=-R;f<=R;f++)G(A+f,r+M,pe)}}let O={get fillStyle(){return P.fillStyle},set fillStyle(h){P.fillStyle=h},get strokeStyle(){return P.strokeStyle},set strokeStyle(h){P.strokeStyle=h},get lineWidth(){return P.lineWidth},set lineWidth(h){P.lineWidth=h},get globalAlpha(){return P.globalAlpha},set globalAlpha(h){P.globalAlpha=h},font:"",textAlign:"left",textBaseline:"alphabetic",lineCap:"butt",save(){b.push({...P})},restore(){b.length&&(P=b.pop())},setLineDash(){},clearRect(h,W,Z,re){let pe=Math.max(0,Math.floor(h)),ie=Math.max(0,Math.floor(W)),L=Math.min(c,Math.ceil(h+Z)),R=Math.min(w,Math.ceil(W+re));for(let a=ie;a<R;a++)for(let A=pe;A<L;A++){let r=(a*c+A)*4;x[r]=x[r+1]=x[r+2]=x[r+3]=0}},fillRect(h,W,Z,re){let pe=k(P.fillStyle),ie=Math.max(0,Math.floor(h)),L=Math.max(0,Math.floor(W)),R=Math.min(c,Math.ceil(h+Z)),a=Math.min(w,Math.ceil(W+re));for(let A=L;A<a;A++)for(let r=ie;r<R;r++)G(r,A,pe)},beginPath(){q=[]},moveTo(h,W){z=g=h,J=T=W,q.push([{x:h,y:W}])},lineTo(h,W){q.length||q.push([{x:z,y:J}]),q[q.length-1].push({x:h,y:W}),z=h,J=W},quadraticCurveTo(h,W,Z,re){q.length||q.push([{x:z,y:J}]);let pe=q[q.length-1],ie=z,L=J;for(let R=1;R<=12;R++){let a=R/12,A=1-a;pe.push({x:A*A*ie+2*A*a*h+a*a*Z,y:A*A*L+2*A*a*W+a*a*re})}z=Z,J=re},arc(h,W,Z,re,pe){let ie=[];for(let R=0;R<=18;R++){let a=re+(pe-re)*R/18;ie.push({x:h+Z*Math.cos(a),y:W+Z*Math.sin(a)})}q.push(ie),ie.length&&(z=ie.at(-1).x,J=ie.at(-1).y,g=ie[0].x,T=ie[0].y)},closePath(){q.length&&q[q.length-1].length&&(q[q.length-1].push({x:g,y:T}),z=g,J=T)},fill(){let h=k(P.fillStyle);for(let W of q){if(W.length<3)continue;let Z=w,re=0;for(let L of W)L.y<Z&&(Z=L.y),L.y>re&&(re=L.y);let pe=Math.max(0,Math.floor(Z)),ie=Math.min(w-1,Math.ceil(re));for(let L=pe;L<=ie;L++){let R=[];for(let a=0,A=W.length-1;a<W.length;A=a++){let r=W[a],M=W[A];(r.y<=L&&M.y>L||M.y<=L&&r.y>L)&&R.push(r.x+(L-r.y)/(M.y-r.y)*(M.x-r.x))}R.sort((a,A)=>a-A);for(let a=0;a+1<R.length;a+=2){let A=Math.max(0,Math.ceil(R[a])),r=Math.min(c-1,Math.floor(R[a+1]));for(let M=A;M<=r;M++)G(M,L,h)}}}},stroke(){let h=k(P.strokeStyle),W=P.lineWidth||1;for(let Z of q)for(let re=1;re<Z.length;re++)$(Z[re-1].x,Z[re-1].y,Z[re].x,Z[re].y,h,W)},fillText(h,W,Z){let re=String(h??"");if(!re)return;let pe=k(P.fillStyle),ie=Math.min(re.length*5,120),L=P.textAlign==="center"?W-ie/2:P.textAlign==="right"?W-ie:W,R=Z-3;for(let a=Math.max(0,Math.floor(L));a<Math.min(c,Math.ceil(L+ie));a+=2)for(let A=Math.max(0,Math.floor(R));A<Math.min(w,Math.ceil(R+5));A+=2)G(a,A,pe)},drawImage(){},getImageData(h,W,Z,re){return h===0&&W===0&&Z===c&&re===w?{data:new Uint8ClampedArray(x),width:c,height:w}:{data:new Uint8ClampedArray(Z*re*4),width:Z,height:re}}};return{width:c,height:w,getContext:()=>O}}function y({mode:c="hive",posts:w=[],members:x=[],phase:b="done",pacing:P="even",speed:q=1,hideInactive:z=!1,expandBroadcast:J=!1,focus:g=null,theme:T="light",width:G=680,height:$=460,graph:O,bees:h,createCanvas:W,maxFrames:Z=90}={}){let re=o(O),pe=n(h);if(typeof re?.renderGraphFrame!="function")throw new Error("HiveGraph.renderGraphFrame is required to export a graph replay GIF.");let ie=re.isPost??(fe=>fe&&(fe.kind==="brief"||fe.kind==="message"||!fe.kind&&fe.author!=="system")),L=(w??[]).filter(ie).slice().sort((fe,ae)=>(fe.seq??0)-(ae.seq??0)),R=[{seq:0,post:null}],a=Math.max(2,Math.floor(Number(Z)||90));if(L.length>0)if(L.length+1<=a)for(let fe of L)R.push({seq:fe.seq,post:fe});else{let fe=a-1,ae=new Set([0,L.length-1]);for(let xe=1;xe<fe-1;xe++)ae.add(Math.round(xe*(L.length-1)/(fe-1)));for(let xe of[...ae].sort((Ce,Ne)=>Ce-Ne))R.push({seq:L[xe].seq,post:L[xe]})}let r=(W??(typeof document<"u"?(fe,ae)=>{let xe=document.createElement("canvas");return xe.width=fe,xe.height=ae,xe}:C))(G,$);r.width!==G&&(r.width=G),r.height!==$&&(r.height=$);let M=r.getContext("2d");if(!M)throw new Error("Could not obtain 2D canvas context for GIF export.");let f=Math.max(.25,Number(q)||1),te=[];for(let fe=0;fe<R.length;fe++){let ae=R[fe],xe=fe===R.length-1,Ce=fe>0?R[fe-1].post:null,Ne=620;if(P==="real"&&ae.post?.time&&Ce?.time){let l=Date.parse(ae.post.time)-Date.parse(Ce.time);Number.isFinite(l)&&(Ne=Math.max(110,Math.min(l,2e3)))}let ge=Math.round(Ne/f/10),we=xe?Math.max(150,ge):Math.max(4,Math.min(300,ge));re.renderGraphFrame(M,{mode:c,posts:w,members:x,cursor:xe&&L.length?null:ae.seq,phase:xe?b:"working",width:G,height:$,theme:T,hideInactive:z,expandBroadcast:J,focus:g,bees:pe});let t=M.getImageData(0,0,G,$);te.push({rgba:t.data instanceof Uint8ClampedArray?t.data:new Uint8ClampedArray(t.data),delayCs:we})}let Y=N(te,{width:G,height:$,loop:0}),Me=typeof Blob<"u"?new Blob([Y],{type:"image/gif"}):void 0;return{bytes:Y,blob:Me,frameCount:te.length,width:G,height:$}}Ze.HiveGif=Object.freeze({encodeGif:N,exportGraphReplayGif:y})})();Nt.exports=Ze.HiveGif});var $o={};eo($o,{apply:()=>Jo,inject:()=>Uo,name:()=>Ge});module.exports=to($o);var oo={snapshot:"hive-swarm/v1/snapshot",command:"hive-swarm/v1/command",wait:"hive-swarm/v1/events"},Qe="deepseek-harness",rt=o=>(o?.events??[]).reduce((n,d)=>Math.max(n,d.seq),o?.head??0),Fe=o=>({message:typeof o=="string"?o:o?.message??"The Swarm connection is unavailable.",code:typeof o?.code=="string"?o.code:"connection"}),mt=()=>globalThis.crypto.randomUUID(),Le=o=>o?.session?.host===Qe?o.session.id:void 0;function no(o,n){let d=Le(n);return d?n?.executionMode==="subagent"&&typeof o?.parentSessionId=="string"&&o.parentSessionId.trim()?{parentSessionId:o.parentSessionId.trim(),childSessionId:d,mode:"continuable"}:d:(n?.role==="coordinator"||n?.name==="coordinator")&&typeof o?.parentSessionId=="string"&&o.parentSessionId.trim()?o.parentSessionId.trim():null}async function vt(o,n,d,p){if(typeof o?.rpc?.call!="function")throw Error("DSH Connection RPC is unavailable. Enable the Connection capability and reload Hive Swarm.");let m=await o.rpc.call("/api",oo[n],d,p);if(p.aborted)throw p.reason??new DOMException("Cancelled","AbortError");if(!m?.ok){let i=Error(Fe(m?.error).message);throw i.code=m?.error?.code,i}return m.value}async function gt(o,n,d){let{team:p}=await vt(o,"snapshot",{teamId:n},d)??{};if(p?.id!==n||p.host!==Qe||typeof p.cwd!="string"||!p.cwd.trim())throw Error("The Swarm team is unavailable in this Host. Check its workspace and access.");return p}function io(o){return Array.isArray(o)?o.map((n,d)=>{let p=Array.isArray(n.items)?n.items:[],m=Number(n.turn??n.id);return{turn:Number.isSafeInteger(m)&&m>0?m:d+1,status:n.status,steps:n.steps??p.filter(i=>i.type==="activity"),report:n.report??p.findLast(i=>i.type==="agentMessage"&&i.phase==="final")?.text}}):[]}function st(o){return typeof o!="string"||!o?null:(/^(?:[a-z]:[\\/]|\\\\)/i.test(o)?o.replaceAll("\\","/").toLowerCase():o).replace(/\/+$/,"")||"/"}function bt({connection:o,teamId:n=null,sessionId:d=null,workspace:p=null,openSession:m}={}){let i=st(p),N=r=>!i||st(r.cwd)===i,k=n||null,C=0,y=!1,c=0,w=null,x=null,b=null,P=0,q=null,z=!1,J=null,g={teams:[],team:null,selectedId:k,sessionId:d,workspace:p,loading:!1,connection:"idle",error:null,pending:!1,models:[],modelsLoading:!1,journal:null,history:[],hasMoreHistory:!1,historyLoading:!1,version:null,update:null},T=new Set,G=new Set,$=r=>{if(!y){g={...g,...r};for(let M of T)M()}},O=(r,M)=>!y&&C>0&&r===c&&!M.aborted;function h(){c++,w?.abort(),w=null,clearTimeout(J),J=null;for(let r of G)r.abort();G.clear()}let W=(r,M,f)=>vt(o,r,M,f);function Z(r){let M=new Map(g.history.map(f=>[f.seq,f]));for(let f of r)M.set(f.seq,f);return[...M.values()].sort((f,te)=>f.seq-te.seq)}function re(r){if(!r||r.id!==k)throw Error("The Host returned a different team. Select the team again.");if(r.host!==Qe)throw Error("This team does not belong to the native DSH Host.");if(!N(r))throw Error("This team is outside the parent workspace. Choose a team from this workspace.");x??=rt(r),!(g.team&&rt(r)<rt(g.team))&&$({team:r,history:Z(r.events??[])})}async function pe(r,M){let f=await W("snapshot",k?{teamId:k}:{},r);if(!O(M,r))return;if(!Array.isArray(f?.teams))throw Error("The Swarm snapshot is invalid. Refresh to reconnect.");let te=f.teams.filter(Y=>Y.host===Qe&&N(Y));if(k){try{re(f.team)}catch(Y){throw $({teams:te,team:null}),Y}te.some(Y=>Y.id===k)||te.push(f.team)}else $({team:null});$({teams:te,loading:!1,error:g.error?.action?g.error:null,connection:"connected",...typeof f.version=="string"&&f.version.trim()?{version:f.version.trim()}:{},...f.update&&typeof f.update=="object"?{update:f.update}:{}}),f.update?.checked===!1&&!z&&(z=!0,J=setTimeout(()=>{J=null,O(M,r)&&g.update?.checked===!1&&pe(r,M).catch(()=>{})},2500),J.unref?.())}async function ie(r,M){try{for(;k&&O(M,r);){let f=x??0,te=g.team?.revision,Y=await W("wait",{teamId:k,since:f,...te?{revision:te}:{},timeoutSec:50},r);if(!O(M,r))return;if(!Number.isSafeInteger(Y?.head)||Y.head<0)throw Error("The Swarm event cursor is invalid. Refresh to reconnect.");let Me=Array.isArray(Y.posts)?Y.posts:[];if(Y.hasMore){let fe=Me.at(-1)?.seq;if(!Number.isSafeInteger(fe)||fe<=f||fe>Y.head)throw Error("The Swarm history page has an invalid cursor. Refresh to reconnect.");x=fe}else x=Math.max(f,Y.head);Me.length&&$({history:Z(Me)}),!(Y.wokeBy==="timeout"&&x===f&&Y.revision===te&&!Me.length)&&await pe(r,M)}}catch(f){O(M,r)&&$({loading:!1,connection:"disconnected",error:Fe(f)})}}async function L(){if(w?.abort(),w=null,y||!C)return;let r=new AbortController;w=r;let M=c,f=r.signal;$({loading:g.team===null,connection:"connecting",error:g.error?.action?g.error:null});try{await pe(f,M),O(M,f)&&k&&ie(f,M)}catch(te){O(M,f)&&$({loading:!1,connection:"disconnected",error:Fe(te)})}}async function R(r,M={},f=new AbortController){G.add(f);let te=c;try{let Y=await W("command",{action:r,args:k?{...M,teamId:k}:M,requestId:mt()},f.signal);if(y||te!==c)throw new DOMException("Selection changed","AbortError");return Y}finally{G.delete(f)}}async function a(r){if(y||!k||!g.team)throw Error("Select a team before changing it.");if(g.connection!=="connected")throw Error("Refresh the connection before changing the team.");if(g.pending)throw Error("Wait for the current action to finish.");let M=new AbortController;G.add(M);let f=c;$({pending:!0,error:null});try{let te=await W("command",r,M.signal);if(y||f!==c)throw new DOMException("Selection changed","AbortError");return b=null,te?.id?re(te):await pe(w.signal,f),$({pending:!1,error:null}),te}catch(te){if(!y&&f===c){let Y=Fe(te),Me=!Y.code.startsWith("hive-swarm/")||/outcome unconfirmed/i.test(Y.message);b=Me?r:null,$({pending:!1,error:{...Y,action:Me}})}throw te}finally{G.delete(M)}}let A={getSnapshot:()=>g,subscribe:r=>(T.add(r),()=>T.delete(r)),retain(){if(y)return()=>{};C++,C===1&&L();let r=!1;return()=>{r||(r=!0,--C===0&&(h(),$({connection:"idle",loading:!1,pending:!1,modelsLoading:!1,historyLoading:!1,journal:null})))}},async selectTeam(r){h(),k=r||null,x=null,P=0,b=null,$({team:null,selectedId:k,journal:null,history:[],hasMoreHistory:!1,historyLoading:!1,modelsLoading:!1,error:null,pending:!1,loading:!!C}),await L()},refresh:()=>{L()},showTeams:()=>A.selectTeam(null),command(r,M={}){let f={...M,teamId:k},te=b?.action===r&&JSON.stringify(b.args)===JSON.stringify(f);return a(te?b:{action:r,args:f,requestId:mt()})},retryCommand:()=>b?a(b):Promise.reject(Error("There is no action to retry.")),async loadModels(){$({modelsLoading:!0});try{let r=await R("list_models");$({models:r.models??[],modelsLoading:!1})}catch(r){r?.name!=="AbortError"&&$({modelsLoading:!1,error:Fe(r)})}},async openJournal(r){let M=g.team?.members.find(Y=>Y.name===r),f=Le(M);if(!f){$({error:{message:"This member has no owned session yet."}});return}q?.abort();let te=new AbortController;q=te,$({journal:{member:r,loading:!0,turns:[],error:null}});try{let Y=await R("read_journal",{member:r},te);if(Y.threadId&&Y.threadId!==f)throw Error("The member\u2019s session changed. Refresh its Journal to continue.");q===te&&g.journal?.member===r&&$({journal:{...Y,member:r,turns:io(Y.turns),loading:!1}})}catch(Y){Y?.name!=="AbortError"&&q===te&&g.journal?.member===r&&$({journal:{...g.journal,loading:!1,error:Fe(Y)}})}},closeJournal:()=>{q?.abort(),q=null,$({journal:null})},async loadHistory({reset:r=!1}={}){if(!(g.historyLoading||!k)){$({historyLoading:!0});try{let M=r?0:P,f=await R("board_history",{after:M,limit:200}),te=f.posts??f.events??[];P=te.at(-1)?.seq??M,$({history:Z(te),historyLoading:!1,hasMoreHistory:f.hasMore===!0})}catch(M){M?.name!=="AbortError"&&$({historyLoading:!1,error:Fe(M)})}}},async openSession(r,{fallbackToJournal:M=!0}={}){let f=g.team?.members.find(Y=>Y.name===r)??(r==="coordinator"?{name:"coordinator",role:"coordinator"}:void 0),te=no(g.team,f);if(!te)return $({error:{message:"This member has no owned session yet."}}),"none";if(typeof m=="function")try{return await m(te),"session"}catch{return M?(await A.openJournal(r),"journal"):"fallback"}return M?(await A.openJournal(r),"journal"):"fallback"},setError:r=>$({error:Fe(r)}),dispose(){y||(h(),clearTimeout(J),J=null,y=!0,T.clear())}};return A}function yt(o){let n=new Map,d=new Set,p=null,m=(N,k,C)=>{let y=JSON.stringify([N??null,k??null,st(C)]);return n.has(y)||n.set(y,o(N,k,C)),n.get(y)},i=m(null);return{forSession:m,getSnapshot:()=>p??i,subscribe:N=>(d.add(N),()=>d.delete(N)),select(N){p=N;for(let k of d)k()},reconnect(){for(let N of n.values())N.refresh()},dispose(){for(let N of n.values())N.dispose();n.clear(),d.clear()}}}var e=Je(require("react"),1),Te=Je(wt(),1),De=Je(St(),1),Bt=Je(Ct(),1);var Tt=`<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 256 256" role="img" aria-labelledby="title"><title id="title">Hive Swarm crowned bee</title>
5
+ <rect x="2" y="2" width="252" height="252" rx="48" fill="#281d10" stroke="#9a7138" stroke-width="4"/>
6
+ <g transform="translate(28 48) scale(10)" shape-rendering="crispEdges"><rect x="3" y="2" width="1" height="3" fill="#201915"/><rect x="6" y="3" width="1" height="2" fill="#201915"/><rect x="5" y="1" width="2" height="1" fill="#201915"/><rect x="2" y="3" width="1" height="1" fill="#201915"/><rect x="5" y="5" width="10" height="8" fill="#201915"/><rect x="3" y="7" width="13" height="5" fill="#201915"/><rect x="4" y="12" width="11" height="2" fill="#201915"/><rect x="6" y="14" width="7" height="1" fill="#201915"/><rect x="16" y="9" width="2" height="2" fill="#201915"/><rect x="7" y="14" width="1" height="2" fill="#201915"/><rect x="12" y="14" width="1" height="2" fill="#201915"/><rect x="7" y="3" width="6" height="4" fill="#24313d"/><rect x="8" y="2" width="4" height="6" fill="#24313d"/><rect x="12" y="3" width="4" height="4" fill="#24313d"/><rect x="13" y="2" width="2" height="1" fill="#24313d"/><rect x="8" y="3" width="3" height="4" fill="#a9c6db"/><rect x="12" y="4" width="3" height="2" fill="#a9c6db"/><rect x="9" y="7" width="2" height="1" fill="#a9c6db"/><rect x="9" y="3" width="2" height="2" fill="#e7f2fa"/><rect x="12" y="4" width="2" height="1" fill="#e7f2fa"/><rect x="8" y="4" width="1" height="2" fill="#e7f2fa"/><rect x="4" y="7" width="8" height="5" fill="#efac37"/><rect x="5" y="6" width="6" height="7" fill="#efac37"/><rect x="12" y="7" width="3" height="5" fill="#efac37"/><rect x="13" y="12" width="1" height="1" fill="#efac37"/><rect x="6" y="13" width="1" height="1" fill="#efac37"/><rect x="5" y="7" width="3" height="1" fill="#ffe18d"/><rect x="4" y="9" width="2" height="2" fill="#ffe18d"/><rect x="10" y="7" width="2" height="1" fill="#ffe18d"/><rect x="13" y="8" width="1" height="2" fill="#ffe18d"/><rect x="5" y="12" width="2" height="1" fill="#ffe18d"/><rect x="6" y="12" width="7" height="1" fill="#bb641d"/><rect x="12" y="11" width="3" height="1" fill="#bb641d"/><rect x="13" y="12" width="1" height="1" fill="#bb641d"/><rect x="8" y="6" width="2" height="7" fill="#2c221c"/><rect x="12" y="7" width="1" height="6" fill="#2c221c"/><rect x="15" y="9" width="2" height="1" fill="#2c221c"/><rect x="5" y="8" width="1" height="2" fill="#201915"/><rect x="5" y="8" width="1" height="1" fill="#fff6d7"/><rect x="2" y="1" width="1" height="4" fill="#6d4219"/><rect x="8" y="1" width="1" height="4" fill="#6d4219"/><rect x="2" y="4" width="7" height="1" fill="#6d4219"/><rect x="2" y="0" width="1" height="2" fill="#ffd86b"/><rect x="5" y="0" width="1" height="3" fill="#ffd86b"/><rect x="8" y="0" width="1" height="2" fill="#ffd86b"/><rect x="3" y="2" width="5" height="2" fill="#ffd86b"/><rect x="4" y="1" width="3" height="1" fill="#ffd86b"/><rect x="3" y="4" width="5" height="1" fill="#e7a52f"/><rect x="3" y="3" width="5" height="1" fill="#e7a52f"/><rect x="3" y="2" width="1" height="1" fill="#fff3bf"/><rect x="7" y="2" width="1" height="1" fill="#fff3bf"/><rect x="5" y="3" width="1" height="1" fill="#fff3bf"/></g></svg>
7
+ `;var qt=`.dsh-hive {
8
+ --hive-surface: var(--dsw-alias-bg-base);
9
+ --hive-layer: var(--dsw-alias-bg-layer-2);
10
+ --hive-card: color-mix(in oklab, var(--hive-layer) 76%, var(--hive-surface));
11
+ --hive-ink: var(--dsw-alias-label-primary);
12
+ --hive-muted: var(--dsw-alias-label-secondary);
13
+ --hive-border: var(--dsw-alias-border-l2);
14
+ --hive-focus: var(--dsw-alias-brand-primary);
15
+ --hive-gold: light-dark(#855d24, #e8b552);
16
+ --hive-good: light-dark(#1f6b40, #6fd89c);
17
+ --hive-good-fill: light-dark(#4d9938, #5ec26a);
18
+ --hive-working: light-dark(#2268b8, #63a4ff);
19
+ --hive-wait: light-dark(#345299, #9fb5f0);
20
+ --hive-amber: light-dark(#b07014, #e8ad44);
21
+ --hive-pulse: light-dark(#7c5ce6, #a78bfa);
22
+ --hive-danger: var(--dsw-alias-state-error-primary);
23
+ --hive-gold-soft: color-mix(in oklab, var(--hive-gold) 13%, transparent);
24
+ --hive-good-soft: color-mix(in oklab, var(--hive-good-fill) 13%, transparent);
25
+ --hive-working-soft: color-mix(in oklab, var(--hive-working) 12%, transparent);
26
+ --hive-wait-soft: color-mix(in oklab, var(--hive-wait) 13%, transparent);
27
+ --hive-amber-soft: color-mix(in oklab, var(--hive-amber) 14%, transparent);
28
+ --hive-error-soft: color-mix(in oklab, var(--hive-danger) 12%, transparent);
29
+ --hive-mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
30
+ container-type: inline-size;
31
+ min-width: 0;
32
+ width: 100%;
33
+ height: 100%;
34
+ overflow: auto;
35
+ scrollbar-gutter: stable;
36
+ overscroll-behavior: contain;
37
+ color: var(--hive-ink);
38
+ background: var(--hive-surface);
39
+ font: inherit;
40
+ line-height: 1.5;
41
+ color-scheme: inherit;
42
+ scrollbar-color: var(--hive-border) var(--hive-surface);
43
+ scrollbar-width: thin;
44
+ box-sizing: border-box;
45
+ }
46
+ .dsh-hive :where(*, *::before, *::after) { box-sizing: border-box; }
47
+ .dsh-hive ::selection { color: var(--hive-ink); background: var(--dsw-alias-interactive-bg-hover); }
48
+ .dsh-hive h1, .dsh-hive h2, .dsh-hive h3, .dsh-hive h4, .dsh-hive h5, .dsh-hive p { margin: 0; }
49
+ .dsh-hive h1 { font-size: 1.08em; font-weight: 660; letter-spacing: -0.018em; overflow-wrap: anywhere; }
50
+ .dsh-hive h2 { font-size: .96em; font-weight: 640; letter-spacing: -0.01em; color: var(--hive-ink); }
51
+ .dsh-hive h3 { font-size: .94em; font-weight: 620; }
52
+ .dsh-hive-sr-only {
53
+ position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
54
+ overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
55
+ }
56
+ .dsh-hive button, .dsh-hive input, .dsh-hive select, .dsh-hive textarea { font: inherit; color: inherit; }
57
+ .dsh-hive button, .dsh-hive input, .dsh-hive select, .dsh-hive textarea {
58
+ border: 1px solid var(--hive-border);
59
+ background: var(--hive-layer);
60
+ border-radius: 7px;
61
+ min-height: 30px;
62
+ padding: 4px 10px;
63
+ max-width: 100%;
64
+ caret-color: var(--hive-ink);
65
+ transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
66
+ }
67
+ .dsh-hive button { cursor: pointer; }
68
+ .dsh-hive button:hover:not(:disabled) {
69
+ background: var(--dsw-alias-interactive-bg-hover);
70
+ border-color: color-mix(in oklab, var(--hive-ink) 26%, var(--hive-border));
71
+ }
72
+ .dsh-hive button:active:not(:disabled) {
73
+ background: var(--dsw-alias-interactive-bg-active, var(--dsw-alias-interactive-bg-hover));
74
+ }
75
+ .dsh-hive button:disabled { cursor: default; opacity: .52; }
76
+ .dsh-hive button[aria-pressed="true"] { border-color: var(--hive-gold); background: var(--hive-gold-soft); color: var(--hive-ink); }
77
+ .dsh-hive .dsh-hive-primary { border-color: var(--hive-gold); background: var(--hive-gold-soft); color: var(--hive-ink); font-weight: 620; }
78
+ .dsh-hive .dsh-hive-primary:hover:not(:disabled) { background: color-mix(in oklab, var(--hive-gold) 22%, transparent); border-color: var(--hive-gold); }
79
+ .dsh-hive .dsh-hive-ghost-btn {
80
+ border-color: transparent; background: transparent; color: var(--hive-muted);
81
+ min-height: 26px; padding: 2px 8px; font-size: .88em;
82
+ }
83
+ .dsh-hive .dsh-hive-ghost-btn:hover:not(:disabled) { color: var(--hive-ink); background: var(--dsw-alias-interactive-bg-hover); border-color: transparent; }
84
+ .dsh-hive :focus-visible { outline: 2px solid var(--hive-focus); outline-offset: 2px; }
85
+ .dsh-hive textarea { width: 100%; resize: vertical; }
86
+ .dsh-hive input::placeholder, .dsh-hive textarea::placeholder { color: var(--hive-muted); opacity: 1; }
87
+ .dsh-hive label { display: grid; gap: 4px; min-width: 0; color: var(--hive-muted); font-size: .92em; }
88
+ .dsh-hive input, .dsh-hive select, .dsh-hive textarea { color: var(--hive-ink); font-size: .95rem; }
89
+ .dsh-hive-mono { font-family: var(--hive-mono); font-variant-numeric: tabular-nums; font-size: .88em; }
90
+
91
+ /* Header */
92
+ .dsh-hive-header { padding: 12px 16px 8px; display: grid; gap: 8px; }
93
+ .dsh-hive[data-dsh-hive-swarm="main"] .dsh-hive-header { padding-inline-start: max(20px, var(--dsh-frame-leading-clearance, 0px)); }
94
+ .dsh-hive-header-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; min-width: 0; }
95
+ .dsh-hive-title-wrap { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; padding-top: 1px; }
96
+ .dsh-hive-header-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; position: relative; }
97
+ .dsh-hive-header-status-row { display: inline-flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
98
+ .dsh-hive-version-tag {
99
+ font-family: var(--hive-mono); font-variant-numeric: tabular-nums; font-size: .78em; font-weight: 580;
100
+ color: var(--hive-muted); padding: 1px 7px; border-radius: 999px;
101
+ border: 1px solid color-mix(in oklab, var(--hive-border) 85%, transparent);
102
+ background: color-mix(in oklab, var(--hive-layer) 75%, transparent);
103
+ white-space: nowrap;
104
+ }
105
+ .dsh-hive-update-wrap { position: relative; display: flex; justify-content: flex-end; }
106
+ .dsh-hive .dsh-hive-update-pill {
107
+ min-height: 22px; padding: 1px 8px; border-radius: 999px; font-size: .76em; font-weight: 620;
108
+ color: var(--hive-gold); background: var(--hive-gold-soft);
109
+ border-color: color-mix(in oklab, var(--hive-gold) 48%, var(--hive-border));
110
+ white-space: nowrap;
111
+ }
112
+ .dsh-hive .dsh-hive-update-pill:hover:not(:disabled) {
113
+ background: color-mix(in oklab, var(--hive-gold) 22%, transparent);
114
+ border-color: var(--hive-gold);
115
+ }
116
+ .dsh-hive-update-popover {
117
+ position: absolute; top: calc(100% + 6px); inset-inline-end: 0; z-index: 40;
118
+ width: min(300px, calc(100cqi - 32px)); padding: 10px 12px; border-radius: 10px;
119
+ border: 1px solid var(--hive-border); background: var(--hive-surface);
120
+ box-shadow: 0 12px 28px rgba(0, 0, 0, .28); display: grid; gap: 8px; font-size: .86em;
121
+ }
122
+ .dsh-hive-update-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
123
+ .dsh-hive-update-head .dsh-hive-mono { color: var(--hive-gold); font-weight: 620; }
124
+ .dsh-hive-update-cmd {
125
+ display: block; padding: 6px 8px; border-radius: 7px;
126
+ background: var(--hive-layer); border: 1px solid var(--hive-border);
127
+ font-family: var(--hive-mono); font-size: .88em; color: var(--hive-ink);
128
+ overflow-wrap: anywhere; user-select: all;
129
+ }
130
+ .dsh-hive-update-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
131
+ .dsh-hive-update-actions a { color: var(--hive-gold); font-size: .92em; text-underline-offset: 3px; }
132
+ .dsh-hive-header-status {
133
+ display: inline-flex; align-items: center; gap: 6px;
134
+ font-size: .86em; font-weight: 560; color: var(--hive-muted); white-space: nowrap; flex: none;
135
+ }
136
+ .dsh-hive-header-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-width: 0; }
137
+ .dsh-hive-header-actions select {
138
+ flex: 1 1 150px; min-width: 0; max-width: 280px; min-height: 28px; padding: 2px 8px; font-size: .86em;
139
+ background: transparent; border-color: color-mix(in oklab, var(--hive-border) 80%, transparent);
140
+ }
141
+ .dsh-hive .dsh-hive-compact-btn {
142
+ flex: 0 0 auto; min-height: 28px; padding: 2px 9px; font-size: .84em;
143
+ background: transparent; border-color: color-mix(in oklab, var(--hive-border) 80%, transparent); color: var(--hive-muted);
144
+ }
145
+ .dsh-hive .dsh-hive-compact-btn:hover:not(:disabled) { color: var(--hive-ink); background: var(--dsw-alias-interactive-bg-hover); }
146
+ .dsh-hive-rename { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
147
+ .dsh-hive-rename input { flex: 1 1 180px; min-height: 30px; }
148
+ .dsh-hive-line, .dsh-hive-actions, .dsh-hive-pill-group { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; }
149
+ .dsh-hive-pill-group { margin-inline-start: auto; gap: 6px; }
150
+ .dsh-hive-line time { margin-inline-start: auto; color: var(--hive-muted); font-family: var(--hive-mono); font-variant-numeric: tabular-nums; font-size: .84em; }
151
+ .dsh-hive-secondary { color: var(--hive-muted); }
152
+ .dsh-hive-context { font-size: .84em; overflow-wrap: anywhere; }
153
+
154
+ /* Status Badges */
155
+ .dsh-hive-status {
156
+ display: inline-flex; align-items: center; gap: 5px;
157
+ border: 1px solid var(--hive-border); border-radius: 999px; padding: 1px 8px;
158
+ font-size: .82em; font-weight: 600; background: var(--hive-surface); white-space: nowrap;
159
+ }
160
+ .dsh-hive-status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--hive-muted); flex: none; }
161
+ [data-status="working"] .dsh-hive-status-dot,
162
+ [data-status="active"] .dsh-hive-status-dot,
163
+ [data-status="done"] .dsh-hive-status-dot,
164
+ [data-status="completed"] .dsh-hive-status-dot { background: var(--hive-good-fill); }
165
+ [data-status="waiting"] .dsh-hive-status-dot,
166
+ [data-status="queued"] .dsh-hive-status-dot { background: var(--hive-wait); }
167
+ [data-status="paused"] .dsh-hive-status-dot,
168
+ [data-status="budget"] .dsh-hive-status-dot { background: var(--hive-amber); }
169
+ [data-status="quota"] .dsh-hive-status-dot,
170
+ [data-status="stalled"] .dsh-hive-status-dot,
171
+ [data-status="failed"] .dsh-hive-status-dot,
172
+ [data-status="blocked"] .dsh-hive-status-dot { background: var(--hive-danger); }
173
+
174
+ .dsh-hive-status[data-status="working"], .dsh-hive-status[data-status="active"] { border-color: color-mix(in oklab, var(--hive-good-fill) 45%, var(--hive-border)); background: var(--hive-good-soft); }
175
+ .dsh-hive-status[data-status="waiting"], .dsh-hive-status[data-status="queued"] { border-color: color-mix(in oklab, var(--hive-wait) 40%, var(--hive-border)); background: var(--hive-wait-soft); }
176
+ .dsh-hive-status[data-status="done"], .dsh-hive-status[data-status="completed"] { border-color: color-mix(in oklab, var(--hive-good-fill) 32%, var(--hive-border)); }
177
+ .dsh-hive-status[data-status="paused"], .dsh-hive-status[data-status="budget"] { border-color: color-mix(in oklab, var(--hive-amber) 50%, var(--hive-border)); background: var(--hive-amber-soft); }
178
+ .dsh-hive-status[data-status="quota"], .dsh-hive-status[data-status="stalled"], .dsh-hive-status[data-status="failed"], .dsh-hive-status[data-status="blocked"] {
179
+ color: var(--hive-danger); border-color: color-mix(in oklab, var(--hive-danger) 45%, var(--hive-border)); background: var(--hive-error-soft);
180
+ }
181
+ .dsh-hive-mode { display: inline-flex; align-items: center; border: 1px solid var(--hive-border); border-radius: 999px; padding: 1px 8px; font-family: var(--hive-mono); font-size: .78em; font-weight: 600; color: var(--hive-muted); background: var(--hive-surface); white-space: nowrap; }
182
+ .dsh-hive-mode[data-mode="subagent"] { color: var(--hive-gold); border-color: color-mix(in oklab, var(--hive-gold) 45%, var(--hive-border)); background: var(--hive-gold-soft); }
183
+ .dsh-hive-mode[data-mode="attached"] { color: var(--hive-wait); border-color: color-mix(in oklab, var(--hive-wait) 42%, var(--hive-border)); background: var(--hive-wait-soft); }
184
+
185
+ /* Underlined Tabs (dimensions never shift on selection) */
186
+ .dsh-hive-tabs {
187
+ display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
188
+ padding: 0 16px; gap: 18px; border-bottom: 1px solid var(--hive-border);
189
+ }
190
+ .dsh-hive-tabs::-webkit-scrollbar { display: none; }
191
+ .dsh-hive-tabs button {
192
+ position: relative; flex: none; white-space: nowrap;
193
+ background: transparent; border: 0; border-radius: 0;
194
+ min-height: 36px; padding: 8px 2px; font-weight: 560; color: var(--hive-muted);
195
+ }
196
+ .dsh-hive-tabs button:hover:not(:disabled) { color: var(--hive-ink); background: transparent; border-color: transparent; }
197
+ .dsh-hive-tabs button[aria-selected="true"] { color: var(--hive-ink); background: transparent; }
198
+ .dsh-hive-tabs button[aria-selected="true"]::after {
199
+ content: ""; position: absolute; inset: auto 0 0; border-block-end: 2px solid var(--hive-ink);
200
+ }
201
+ .dsh-hive-tab-count {
202
+ margin-inline-start: 5px; font-size: .88em; font-weight: 500;
203
+ color: var(--hive-muted); font-variant-numeric: tabular-nums;
204
+ }
205
+
206
+ .dsh-hive-content { padding: 16px 16px 28px; }
207
+ .dsh-hive-content > *, .dsh-hive-overview { min-width: 0; }
208
+
209
+ /* Antigravity-Style Overview */
210
+ .dsh-hive-overview { display: grid; gap: 18px; align-items: start; max-width: 860px; margin-inline: auto; }
211
+ .dsh-hive-section { display: grid; gap: 10px; align-content: start; min-width: 0; }
212
+ .dsh-hive-goal-line { color: var(--hive-muted); font-size: .94em; overflow-wrap: anywhere; }
213
+ .dsh-hive-details summary { cursor: pointer; color: var(--hive-gold); font-weight: 600; width: max-content; max-width: 100%; font-size: .9em; }
214
+ .dsh-hive-details[open] summary { margin-bottom: 8px; }
215
+
216
+ /* State Glyphs */
217
+ .dsh-hive-glyph {
218
+ display: inline-grid; place-items: center; flex: none;
219
+ width: 20px; height: 20px; border-radius: 50%; font-size: 11px; font-weight: 700; line-height: 1;
220
+ }
221
+ .dsh-hive-glyph[data-tone="done"] {
222
+ background: color-mix(in oklab, var(--hive-good-fill) 18%, transparent);
223
+ color: var(--hive-good-fill);
224
+ border: 1px solid color-mix(in oklab, var(--hive-good-fill) 42%, transparent);
225
+ }
226
+ .dsh-hive-glyph[data-tone="active"] {
227
+ background: color-mix(in oklab, var(--hive-working) 16%, transparent);
228
+ border: 1px solid color-mix(in oklab, var(--hive-working) 45%, transparent);
229
+ }
230
+ .dsh-hive-glyph[data-tone="active"] .dsh-hive-glyph-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--hive-working); }
231
+ .dsh-hive-glyph[data-tone="idle"] {
232
+ background: color-mix(in oklab, var(--hive-muted) 12%, transparent);
233
+ border: 1px solid color-mix(in oklab, var(--hive-muted) 32%, transparent);
234
+ }
235
+ .dsh-hive-glyph[data-tone="idle"] .dsh-hive-glyph-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--hive-muted); }
236
+ .dsh-hive-glyph[data-tone="danger"] {
237
+ background: var(--hive-error-soft); color: var(--hive-danger);
238
+ border: 1px solid color-mix(in oklab, var(--hive-danger) 48%, transparent);
239
+ }
240
+
241
+ /* Collapsible Task Summary Card & Thread Cards */
242
+ .dsh-hive-task-card, .dsh-hive-thread-card {
243
+ border: 1px solid var(--hive-border); border-radius: 10px;
244
+ background: var(--hive-card); overflow: clip;
245
+ }
246
+ .dsh-hive-task-summary, .dsh-hive-thread-head {
247
+ list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px;
248
+ padding: 11px 14px; min-height: 44px; user-select: none;
249
+ }
250
+ .dsh-hive-task-summary::-webkit-details-marker,
251
+ .dsh-hive-thread-head::-webkit-details-marker { display: none; }
252
+ .dsh-hive-task-summary:hover, .dsh-hive-thread-head:hover { background: var(--dsw-alias-interactive-bg-hover); }
253
+ .dsh-hive-task-count { font-size: .95em; color: var(--hive-muted); flex: 1; min-width: 0; }
254
+ .dsh-hive-task-count strong { color: var(--hive-ink); font-weight: 650; }
255
+ .dsh-hive-task-turns { font-family: var(--hive-mono); font-variant-numeric: tabular-nums; font-size: .82em; color: var(--hive-muted); white-space: nowrap; }
256
+ .dsh-hive-chevron { color: var(--hive-muted); flex: none; }
257
+ details[open] > summary .dsh-hive-chevron { rotate: 180deg; }
258
+
259
+ .dsh-hive-task-body, .dsh-hive-thread-body { border-top: 1px solid color-mix(in oklab, var(--hive-border) 75%, transparent); }
260
+ .dsh-hive-task-list, .dsh-hive-thread-rows { list-style: none; margin: 0; padding: 6px 14px; display: grid; gap: 0; }
261
+ .dsh-hive-task-empty { padding: 12px 14px; font-size: .9em; }
262
+ .dsh-hive-task-row {
263
+ display: flex; align-items: center; gap: 10px; padding: 8px 0; min-width: 0;
264
+ border-bottom: 1px solid color-mix(in oklab, var(--hive-border) 55%, transparent);
265
+ }
266
+ .dsh-hive-task-row:last-child { border-bottom: 0; }
267
+ .dsh-hive-task-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
268
+ .dsh-hive-task-title {
269
+ font-weight: 620; font-size: .94em; color: var(--hive-ink);
270
+ white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
271
+ }
272
+ .dsh-hive-task-sub {
273
+ font-size: .85em; color: var(--hive-muted);
274
+ white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
275
+ }
276
+ .dsh-hive-inline-actions { margin-top: 4px; }
277
+
278
+ /* Colored Bee Pill */
279
+ .dsh-hive .dsh-hive-bee-pill {
280
+ display: inline-flex; align-items: center; gap: 6px; flex: none;
281
+ min-height: 24px; padding: 2px 10px 2px 6px; border-radius: 999px;
282
+ border: 1px solid var(--bee-pill-border, var(--hive-border));
283
+ background: var(--bee-pill-bg, var(--hive-surface));
284
+ color: var(--hive-ink); font-size: .84em; font-weight: 580; white-space: nowrap;
285
+ }
286
+ .dsh-hive button.dsh-hive-bee-pill:hover:not(:disabled) {
287
+ filter: brightness(1.06);
288
+ border-color: color-mix(in oklab, var(--hive-ink) 35%, var(--bee-pill-border, var(--hive-border)));
289
+ }
290
+
291
+ /* Threads */
292
+ .dsh-hive-threads { display: grid; gap: 10px; }
293
+ .dsh-hive-thread-left { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
294
+ .dsh-hive-thread-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--hive-muted); }
295
+ .dsh-hive-thread-dot[data-status="done"], .dsh-hive-thread-dot[data-status="active"] { background: var(--hive-good-fill); }
296
+ .dsh-hive-thread-dot[data-status="queued"], .dsh-hive-thread-dot[data-status="waiting"] { background: var(--hive-wait); }
297
+ .dsh-hive-thread-dot[data-status="blocked"] { background: var(--hive-danger); }
298
+ .dsh-hive-thread-title { font-weight: 640; color: var(--hive-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
299
+ .dsh-hive-thread-state { color: var(--hive-muted); font-size: .88em; white-space: nowrap; }
300
+ .dsh-hive-thread-right { display: inline-flex; align-items: center; gap: 8px; flex: none; }
301
+ .dsh-hive-mini-progress {
302
+ width: 44px; height: 6px; border: 0; border-radius: 999px; overflow: hidden;
303
+ accent-color: var(--hive-good-fill); background: color-mix(in oklab, var(--hive-border) 85%, transparent);
304
+ }
305
+ @supports not (accent-color: red) {
306
+ .dsh-hive-mini-progress { -webkit-appearance: none; -moz-appearance: none; appearance: none; }
307
+ .dsh-hive-mini-progress::-webkit-progress-bar { background: color-mix(in oklab, var(--hive-border) 85%, transparent); border-radius: 999px; }
308
+ .dsh-hive-mini-progress::-webkit-progress-value { background: var(--hive-good-fill); border-radius: 999px; }
309
+ .dsh-hive-mini-progress::-moz-progress-bar { background: var(--hive-good-fill); border-radius: 999px; }
310
+ }
311
+ .dsh-hive-thread-ratio { font-family: var(--hive-mono); font-variant-numeric: tabular-nums; font-size: .84em; color: var(--hive-muted); }
312
+ .dsh-hive-thread-goal { padding: 8px 14px 2px; font-size: .88em; color: var(--hive-muted); }
313
+ .dsh-hive-thread-task {
314
+ display: flex; align-items: center; gap: 10px; padding: 6px 0; min-width: 0;
315
+ }
316
+ .dsh-hive-thread-task-title {
317
+ flex: 1; min-width: 0; font-size: .92em; color: var(--hive-muted);
318
+ white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
319
+ }
320
+
321
+ /* Screenshots Strip + Lightbox */
322
+ .dsh-hive-screenshots-strip {
323
+ list-style: none; margin: 0; padding: 2px 0 6px;
324
+ display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: thin;
325
+ }
326
+ .dsh-hive-shot-card {
327
+ flex: 0 0 min(240px, 78%); scroll-snap-align: start;
328
+ border: 1px solid var(--hive-border); border-radius: 10px; background: var(--hive-card);
329
+ padding: 8px; display: grid; gap: 8px;
330
+ }
331
+ .dsh-hive .dsh-hive-shot-thumb {
332
+ display: block; width: 100%; padding: 0; border: 0; background: transparent;
333
+ border-radius: 7px; overflow: hidden; min-height: 0;
334
+ }
335
+ .dsh-hive-shot-thumb img { width: 100%; height: 132px; object-fit: cover; display: block; border-radius: 7px; }
336
+ .dsh-hive-shot-meta { display: grid; gap: 6px; min-width: 0; }
337
+ .dsh-hive-shot-caption {
338
+ font-size: .88em; color: var(--hive-ink); overflow-wrap: anywhere;
339
+ display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-clamp: 2; overflow: hidden;
340
+ }
341
+ .dsh-hive-shot-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
342
+ .dsh-hive-lightbox { width: min(860px, calc(100vw - 32px)); }
343
+ .dsh-hive-lightbox-figure { margin: 0; display: grid; gap: 12px; }
344
+ .dsh-hive-lightbox-img { max-width: 100%; max-height: 68dvh; width: auto; margin-inline: auto; border-radius: 8px; display: block; object-fit: contain; }
345
+ .dsh-hive-lightbox-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: .92em; color: var(--hive-muted); }
346
+
347
+ /* The team card */
348
+ .dsh-hive-team-card {
349
+ display: flex; align-items: flex-start; gap: 14px; padding: 14px 16px;
350
+ border: 1px solid var(--hive-border); border-radius: 12px; background: var(--hive-card);
351
+ }
352
+ .dsh-hive-coordinator-tile {
353
+ width: 58px; height: 58px; flex: none; border-radius: 10px; display: grid; place-items: center;
354
+ background-color: #191c22;
355
+ background-image:
356
+ radial-gradient(circle at 50% 42%, rgb(246 188 85 / 16%), transparent 70%),
357
+ linear-gradient(30deg, rgb(255 255 255 / 5%) 12%, transparent 12.5%, transparent 87%, rgb(255 255 255 / 5%) 87.5%),
358
+ linear-gradient(150deg, rgb(255 255 255 / 5%) 12%, transparent 12.5%, transparent 87%, rgb(255 255 255 / 5%) 87.5%),
359
+ linear-gradient(60deg, rgb(255 255 255 / 4%) 25%, transparent 25.5%, transparent 75%, rgb(255 255 255 / 4%) 75%);
360
+ background-size: 100% 100%, 16px 28px, 16px 28px, 16px 28px;
361
+ border: 1px solid rgb(255 255 255 / 10%);
362
+ }
363
+ .dsh-hive-team-body { flex: 1; min-width: 0; display: grid; gap: 6px; }
364
+ .dsh-hive-team-name { font-size: .98em; font-weight: 660; color: var(--hive-ink); }
365
+ .dsh-hive-team-summary { font-size: .92em; color: var(--hive-muted); overflow-wrap: anywhere; }
366
+ .dsh-hive-exec { margin-top: 2px; }
367
+
368
+ /* Prose & Markdown */
369
+ .dsh-hive-prose { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 72ch; }
370
+ .dsh-hive-rich { display: grid; gap: 6px; min-width: 0; }
371
+ .dsh-hive-rich code { background: var(--hive-layer); border: 1px solid color-mix(in oklab, var(--hive-border) 65%, transparent); border-radius: 4px; padding: 1px 5px; font-family: var(--hive-mono); font-size: .9em; overflow-wrap: anywhere; }
372
+ .dsh-hive-rich a { color: var(--hive-focus); text-decoration: underline; text-underline-offset: 2px; }
373
+ .dsh-hive-code { margin: 4px 0; padding: 10px 12px; border: 1px solid var(--hive-border); border-radius: 8px; background: var(--hive-layer); overflow: auto; font-size: .88em; }
374
+ .dsh-hive-code code { background: none; border: 0; padding: 0; }
375
+ .dsh-hive-list { margin: 0; padding-inline-start: 20px; display: grid; gap: 3px; }
376
+ .dsh-hive-mention { color: var(--hive-gold); font-weight: 620; }
377
+ .dsh-hive-targets { display: inline-flex; align-items: center; color: var(--hive-gold); background: var(--hive-gold-soft); border: 1px solid color-mix(in oklab, var(--hive-gold) 35%, transparent); border-radius: 999px; padding: 0 8px; font-size: .85em; font-weight: 600; }
378
+ .dsh-hive-badge { display: inline-block; border: 1px solid var(--hive-border); border-radius: 5px; padding: 0 6px; font-family: var(--hive-mono); font-size: .84em; font-weight: 600; }
379
+ .dsh-hive-badge[data-badge="done"] { color: var(--hive-good); border-color: color-mix(in oklab, var(--hive-good-fill) 42%, var(--hive-border)); background: var(--hive-good-soft); }
380
+ .dsh-hive-badge[data-badge="stall"] { color: var(--hive-danger); border-color: color-mix(in oklab, var(--hive-danger) 42%, var(--hive-border)); background: var(--hive-error-soft); }
381
+ .dsh-hive .dsh-hive-ref { display: inline; min-height: 0; padding: 0 3px; border: 0; background: transparent; color: var(--hive-gold); font-family: var(--hive-mono); font-variant-numeric: tabular-nums; text-decoration: underline; text-underline-offset: 2px; vertical-align: baseline; }
382
+ .dsh-hive .dsh-hive-ref:hover:not(:disabled) { background: var(--hive-gold-soft); border-color: transparent; }
383
+ .dsh-hive-facts { margin: 0; display: grid; gap: 7px; padding: 10px 12px; border: 1px solid var(--hive-border); border-radius: 8px; background: var(--hive-surface); }
384
+ .dsh-hive-facts > div { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 10px; font-size: .92em; }
385
+ .dsh-hive-facts dt { color: var(--hive-muted); }
386
+ .dsh-hive-facts dd { margin: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
387
+
388
+ .dsh-hive-feed, .dsh-hive-members, .dsh-hive-attention, .dsh-hive-journal { list-style: none; margin: 0; padding: 0; }
389
+ .dsh-hive-feed-wrap { position: relative; min-width: 0; }
390
+ .dsh-hive-feed { display: grid; gap: 4px; max-height: min(54dvh, 520px); overflow: auto; scrollbar-gutter: stable; overscroll-behavior: contain; padding-inline-end: 2px; }
391
+ .dsh-hive-post {
392
+ padding: 12px 10px; border-radius: 10px;
393
+ display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; align-items: start;
394
+ transition: background-color 140ms ease;
395
+ }
396
+ .dsh-hive-post:hover { background: color-mix(in oklab, var(--hive-layer) 55%, transparent); }
397
+ .dsh-hive-post[data-kind="monitor"], .dsh-hive-post[data-kind="checkpoint"] {
398
+ border-inline-start: 3px solid var(--hive-gold); background: var(--hive-gold-soft);
399
+ }
400
+ .dsh-hive-post[data-focused="true"] {
401
+ background: var(--hive-layer); outline: 2px solid var(--hive-gold); outline-offset: -2px;
402
+ }
403
+ .dsh-hive .dsh-hive-post-avatar-btn {
404
+ padding: 0; border: 0; background: transparent; min-height: 0; border-radius: 9px; cursor: pointer;
405
+ }
406
+ .dsh-hive .dsh-hive-post-avatar-btn:hover:not(:disabled) { filter: brightness(1.06); background: transparent; border-color: transparent; }
407
+ .dsh-hive-post-tile {
408
+ width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none;
409
+ background: var(--tile-bg, var(--hive-layer));
410
+ border: 1px solid var(--tile-border, var(--hive-border));
411
+ }
412
+ .dsh-hive-post-tile.dsh-hive-coord-mini {
413
+ background-color: #191c22; border-color: rgb(255 255 255 / 14%);
414
+ background-image: radial-gradient(circle at 50% 42%, rgb(246 188 85 / 18%), transparent 72%);
415
+ }
416
+ .dsh-hive-post-tile.dsh-hive-system-tile { color: var(--hive-muted); font-size: .88em; }
417
+ .dsh-hive-post-main { min-width: 0; display: grid; gap: 5px; }
418
+ .dsh-hive-post-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: .9em; }
419
+ .dsh-hive-post-who { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; min-width: 0; }
420
+ .dsh-hive-targets-inline { color: var(--hive-muted); font-size: .9em; overflow-wrap: anywhere; }
421
+ .dsh-hive-channel-pill {
422
+ padding: 0 6px; border-radius: 5px; border: 1px solid var(--hive-border);
423
+ background: var(--hive-layer); color: var(--hive-gold); font-family: var(--hive-mono); font-size: .82em; font-weight: 600;
424
+ }
425
+ .dsh-hive-post-stamp { color: var(--hive-muted); font-size: .82em; white-space: nowrap; margin-inline-start: auto; font-variant-numeric: tabular-nums; }
426
+ .dsh-hive-post-body { min-width: 0; font-size: .94em; color: var(--hive-ink); }
427
+ .dsh-hive-post-body[data-clamped="true"] {
428
+ max-height: 132px; overflow: hidden; cursor: pointer;
429
+ mask-image: linear-gradient(to bottom, #000 60%, transparent 100%);
430
+ -webkit-mask-image: linear-gradient(to bottom, #000 60%, transparent 100%);
431
+ }
432
+ .dsh-hive .dsh-hive-expand-btn {
433
+ justify-self: start; min-height: 0; padding: 1px 0; border: 0; background: transparent;
434
+ color: var(--hive-gold); font-size: .82em; font-weight: 600;
435
+ }
436
+ .dsh-hive .dsh-hive-expand-btn:hover:not(:disabled) { text-decoration: underline; background: transparent; border-color: transparent; }
437
+ .dsh-hive .dsh-hive-latest-pill {
438
+ position: sticky; bottom: 10px; float: right; margin: 4px 8px 4px auto; z-index: 2;
439
+ min-height: 28px; padding: 3px 11px; border-radius: 999px;
440
+ border: 1px solid var(--hive-border); background: var(--hive-surface); color: var(--hive-ink);
441
+ font-size: .84em; font-weight: 600; box-shadow: 0 4px 14px rgb(0 0 0 / 22%);
442
+ }
443
+ .dsh-hive .dsh-hive-latest-pill:hover:not(:disabled) { border-color: var(--hive-gold); }
444
+
445
+ .dsh-hive-attention { display: grid; gap: 8px; }
446
+ .dsh-hive-alert-card { display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--hive-border); border-inline-start: 3px solid var(--hive-amber); border-radius: 8px; background: var(--hive-card); }
447
+ .dsh-hive-alert-card[data-kind="recovery"], .dsh-hive-alert-card[data-kind="failed"], .dsh-hive-alert-card[data-kind="quota"] { border-inline-start-color: var(--hive-danger); }
448
+ .dsh-hive-live { padding: 10px 13px; border: 1px solid color-mix(in oklab, var(--hive-good-fill) 38%, var(--hive-border)); border-radius: 9px; background: var(--hive-layer); display: grid; gap: 6px; }
449
+ .dsh-hive-live ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
450
+ .dsh-hive-live li { display: flex; gap: 8px; flex-wrap: wrap; font-size: .92em; }
451
+
452
+ /* Board & Members */
453
+ .dsh-hive-board { display: grid; gap: 12px; }
454
+ .dsh-hive-toolbar { display: grid; gap: 10px; }
455
+ .dsh-hive-board-bar { display: flex; align-items: center; gap: 8px; }
456
+ .dsh-hive-search-box {
457
+ flex: 1 1 auto; min-width: 0; display: flex !important; align-items: center; gap: 8px;
458
+ padding: 0 11px; min-height: 34px; border-radius: 999px;
459
+ border: 1px solid var(--hive-border); background: var(--hive-layer); color: var(--hive-muted);
460
+ }
461
+ .dsh-hive-search-box:focus-within { border-color: var(--hive-focus); color: var(--hive-ink); }
462
+ .dsh-hive-search-box input {
463
+ flex: 1 1 auto; min-width: 0; width: 100%; border: 0 !important; background: transparent !important;
464
+ padding: 4px 0 !important; min-height: 28px !important; outline: none; font-size: .9em; color: var(--hive-ink);
465
+ }
466
+ .dsh-hive .dsh-hive-filter-btn {
467
+ position: relative; flex: 0 0 auto; width: 34px; height: 34px; min-height: 34px; padding: 0;
468
+ display: inline-grid; place-items: center; border-radius: 10px;
469
+ border: 1px solid transparent; background: transparent; color: var(--hive-muted);
470
+ }
471
+ .dsh-hive .dsh-hive-filter-btn:hover:not(:disabled),
472
+ .dsh-hive .dsh-hive-filter-btn[aria-expanded="true"] {
473
+ background: var(--hive-layer); border-color: var(--hive-border); color: var(--hive-ink);
474
+ }
475
+ .dsh-hive .dsh-hive-filter-btn[data-active="true"]::after {
476
+ content: ""; position: absolute; top: 5px; right: 5px; width: 6px; height: 6px;
477
+ border-radius: 50%; background: var(--hive-gold);
478
+ }
479
+ .dsh-hive-filter-drawer {
480
+ display: grid; gap: 10px; padding: 12px; border: 1px solid var(--hive-border);
481
+ border-radius: 10px; background: var(--hive-layer);
482
+ }
483
+ .dsh-hive-filter-drawer[hidden] { display: none; }
484
+
485
+ .dsh-hive-members-view { display: grid; gap: 12px; }
486
+ .dsh-hive-member-bar { display: flex; align-items: center; gap: 8px; }
487
+ .dsh-hive-members { display: grid; gap: 2px; }
488
+ .dsh-hive-member {
489
+ display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 12px; align-items: start;
490
+ padding: 10px 10px; border-radius: 10px; border: 1px solid transparent; position: relative;
491
+ transition: background-color 140ms ease;
492
+ }
493
+ .dsh-hive-member[data-clickable="true"] { cursor: pointer; }
494
+ .dsh-hive-member:hover { background: var(--hive-layer); }
495
+ .dsh-hive-member[data-menu-open="true"] { z-index: 6; background: var(--hive-layer); }
496
+ .dsh-hive-member[data-status="retired"] { opacity: .76; }
497
+ .dsh-hive-member-avatar { position: relative; width: 40px; height: 40px; flex: none; margin-top: 1px; }
498
+ .dsh-hive-member-tile {
499
+ width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
500
+ background: var(--tile-bg, var(--hive-layer));
501
+ border: 1px solid var(--tile-border, var(--hive-border));
502
+ }
503
+ .dsh-hive-member-tile.is-coordinator {
504
+ background-color: #191c22; border-color: rgb(255 255 255 / 14%);
505
+ background-image:
506
+ radial-gradient(circle at 50% 42%, rgb(246 188 85 / 18%), transparent 72%),
507
+ linear-gradient(30deg, rgb(255 255 255 / 5%) 12%, transparent 12.5%, transparent 87%, rgb(255 255 255 / 5%) 87.5%);
508
+ background-size: 100% 100%, 14px 24px;
509
+ }
510
+ .dsh-hive-avatar-dot {
511
+ position: absolute; right: -2px; bottom: -2px; width: 9px; height: 9px; border-radius: 50%;
512
+ border: 2px solid var(--hive-surface); background: var(--hive-good-fill);
513
+ }
514
+ .dsh-hive-avatar-dot[data-tone="danger"] { background: var(--hive-danger); }
515
+ .dsh-hive-member-main { min-width: 0; display: grid; gap: 4px; }
516
+ .dsh-hive-member-line1 { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: nowrap; min-width: 0; }
517
+ .dsh-hive-member-ident { display: flex; align-items: baseline; gap: 7px; min-width: 0; flex: 1 1 auto; }
518
+ .dsh-hive-member-ident h2 { font-size: .96em; font-weight: 660; flex: none; color: var(--hive-ink); }
519
+ .dsh-hive-member-sub { font-size: .88em; color: var(--hive-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
520
+ .dsh-hive-member-meta { display: inline-flex; align-items: center; gap: 6px; flex: none; font-size: .82em; color: var(--hive-muted); }
521
+ .dsh-hive-member-model { font-family: var(--hive-mono); font-size: .92em; color: var(--hive-muted); max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
522
+ .dsh-hive-member-preview {
523
+ font-size: .89em; color: var(--hive-muted); overflow-wrap: anywhere;
524
+ display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-clamp: 2; overflow: hidden;
525
+ }
526
+ .dsh-hive-member-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 1px; }
527
+ .dsh-hive-member-workspace { margin: 0; display: inline-flex; max-width: min(100%, 380px); }
528
+ .dsh-hive-member-workspace > div {
529
+ display: inline-flex; align-items: center; gap: 5px; max-width: 100%;
530
+ padding: 1px 8px; border-radius: 999px; border: 1px solid var(--hive-border);
531
+ background: color-mix(in oklab, var(--hive-layer) 82%, transparent);
532
+ font-family: var(--hive-mono); font-size: .78em; color: var(--hive-muted);
533
+ }
534
+ .dsh-hive-member-workspace dt { display: none; }
535
+ .dsh-hive-member-workspace dd { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: rtl; text-align: left; }
536
+ .dsh-hive-chip {
537
+ display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px;
538
+ border: 1px solid var(--hive-border); background: color-mix(in oklab, var(--hive-layer) 82%, transparent);
539
+ font-size: .78em; color: var(--hive-muted);
540
+ }
541
+ .dsh-hive-chip[data-tone="wait"] { color: var(--hive-wait); border-color: color-mix(in oklab, var(--hive-wait) 36%, var(--hive-border)); }
542
+ .dsh-hive-row-menu { position: relative; flex: none; }
543
+ .dsh-hive .dsh-hive-row-menu-btn {
544
+ min-height: 24px; min-width: 24px; padding: 0 5px; border: 0; background: transparent;
545
+ color: var(--hive-muted); font-size: 1em; line-height: 1; border-radius: 6px; opacity: .48;
546
+ }
547
+ .dsh-hive-member:hover .dsh-hive-row-menu-btn,
548
+ .dsh-hive-member:focus-within .dsh-hive-row-menu-btn,
549
+ .dsh-hive .dsh-hive-row-menu-btn[aria-expanded="true"] { opacity: 1; }
550
+ .dsh-hive .dsh-hive-row-menu-btn:hover:not(:disabled),
551
+ .dsh-hive .dsh-hive-row-menu-btn[aria-expanded="true"] { background: var(--dsw-alias-interactive-bg-hover); color: var(--hive-ink); border-color: transparent; }
552
+ .dsh-hive-row-menu-pop {
553
+ display: none; position: absolute; right: 0; top: calc(100% + 4px); min-width: 162px; z-index: 20;
554
+ padding: 5px; border-radius: 10px; border: 1px solid var(--hive-border); background: var(--hive-surface);
555
+ box-shadow: 0 10px 28px rgb(0 0 0 / 28%);
556
+ }
557
+ .dsh-hive-row-menu-pop[data-open="true"] { display: grid; gap: 2px; }
558
+ .dsh-hive .dsh-hive-menu-item {
559
+ width: 100%; justify-content: flex-start; text-align: left; display: flex; align-items: center;
560
+ min-height: 28px; padding: 4px 9px; border: 0; border-radius: 6px; background: transparent;
561
+ color: var(--hive-ink); font-size: .88em;
562
+ }
563
+ .dsh-hive .dsh-hive-menu-item:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover); border-color: transparent; }
564
+ .dsh-hive-menu-brief { padding: 4px 6px 2px; font-size: .84em; }
565
+ .dsh-hive-inline-actions { margin-top: 2px; }
566
+ .dsh-hive-retired-group { margin-top: 6px; border-top: 1px solid var(--hive-border); padding-top: 6px; }
567
+ .dsh-hive-retired-summary {
568
+ list-style: none; display: flex; align-items: center; gap: 6px; width: 100%; padding: 6px 8px;
569
+ cursor: pointer; user-select: none; font-size: .78em; font-weight: 680; letter-spacing: .04em; color: var(--hive-muted);
570
+ }
571
+ .dsh-hive-retired-summary .dsh-hive-chevron { margin-left: auto; }
572
+ .dsh-hive-retired-summary::-webkit-details-marker { display: none; }
573
+ .dsh-hive-retired-count { font-family: var(--hive-mono); color: var(--hive-muted); }
574
+
575
+ .dsh-hive-filters { display: flex; gap: 10px 12px; flex-wrap: wrap; align-items: flex-end; }
576
+ .dsh-hive-filters > label { flex: 1 1 130px; }
577
+ .dsh-hive-filters > button { flex: 0 0 auto; align-self: flex-end; }
578
+ .dsh-hive-compose {
579
+ display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--hive-border);
580
+ border-radius: 12px; background: var(--hive-layer);
581
+ }
582
+ .dsh-hive-compose textarea { min-height: 52px; border: 0 !important; background: transparent !important; padding: 2px 4px !important; resize: vertical; }
583
+ .dsh-hive-compose-foot { justify-content: space-between; align-items: center; }
584
+ .dsh-hive-channel-pick { display: inline-flex !important; flex-direction: row; align-items: center; gap: 6px; font-size: .84em !important; }
585
+ .dsh-hive-channel-pick select { min-height: 26px !important; padding: 2px 6px !important; font-size: .88em !important; }
586
+ .dsh-hive-form { display: grid; gap: 14px; }
587
+ .dsh-hive .dsh-hive-check { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; color: var(--hive-ink); font-size: .92em; cursor: pointer; }
588
+ .dsh-hive .dsh-hive-check input { min-height: 16px; width: 16px; height: 16px; padding: 0; accent-color: var(--hive-gold); }
589
+ .dsh-hive-empty { padding: 36px 20px; display: grid; gap: 10px; }
590
+ .dsh-hive-error { margin: 12px 16px; padding: 12px 14px; border: 1px solid var(--hive-danger); border-radius: 8px; background: var(--hive-error-soft); display: grid; gap: 8px; overflow-wrap: anywhere; }
591
+
592
+ /* Dialogs & Journal */
593
+ .dsh-hive-dialog { color: var(--hive-ink); background: var(--hive-surface); border: 1px solid var(--hive-border); border-radius: 12px; padding: 20px; width: min(660px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); overflow: auto; scrollbar-gutter: stable; }
594
+ .dsh-hive-dialog:modal { overscroll-behavior: contain; }
595
+ .dsh-hive-dialog[open] { display: grid; gap: 16px; }
596
+ .dsh-hive-dialog::backdrop { overflow: hidden; overscroll-behavior: contain; background: rgb(0 0 0 / 48%); }
597
+ .dsh-hive-dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--hive-border); }
598
+ .dsh-hive-journal-bar { justify-content: space-between; }
599
+ .dsh-hive-journal { overflow-wrap: anywhere; display: grid; gap: 12px; padding-inline-start: 16px; border-inline-start: 2px solid var(--hive-border); }
600
+ .dsh-hive-journal-turn { position: relative; padding: 12px 14px; border: 1px solid var(--hive-border); border-radius: 10px; background: var(--hive-layer); display: grid; gap: 8px; }
601
+ .dsh-hive-journal-turn::before { content: ""; position: absolute; inset-inline-start: -22px; top: 15px; width: 9px; height: 9px; border-radius: 50%; background: var(--hive-gold); border: 2px solid var(--hive-surface); }
602
+ .dsh-hive-journal-steps { margin: 0; padding-inline-start: 18px; display: grid; gap: 4px; font-size: .92em; color: var(--hive-muted); }
603
+ .dsh-hive-route-item { list-style: none; margin-inline-start: -18px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
604
+ .dsh-hive-route-badge { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 5px; padding: 3px 9px; border-radius: 999px; border: 1px solid color-mix(in oklab, var(--hive-good-fill) 44%, var(--hive-border)); background: var(--hive-good-soft); color: var(--hive-good); font-size: .88em; font-weight: 600; }
605
+ .dsh-hive-route-badge code { background: transparent; border: 0; padding: 0; color: var(--hive-ink); font-family: var(--hive-mono); font-weight: 620; }
606
+ .dsh-hive-route-check { font-weight: 700; }
607
+
608
+ /* Pixel Bee Sizes */
609
+ .dsh-hive-bee { display: block; width: 24px; height: 22px; image-rendering: pixelated; flex: none; }
610
+ .dsh-hive-bee[data-size="xs"] { width: 18px; height: 16px; }
611
+ .dsh-hive-bee[data-size="sm"] { width: 20px; height: 18px; }
612
+ .dsh-hive-bee[data-size="hive"] { width: 32px; height: 29px; }
613
+ .dsh-hive-bee[data-size="lg"] { width: 42px; height: 38px; }
614
+ .dsh-hive-bee[data-muted="true"] { filter: grayscale(1) opacity(.68); }
615
+
616
+ /* Dual-Mode Graph Controls */
617
+ .dsh-hive-graph-view { display: grid; gap: 10px; }
618
+ .dsh-hive-graph-controls { display: grid; gap: 10px; padding-bottom: 4px; }
619
+ .dsh-hive-replay-row1 { display: flex; align-items: center; gap: 10px; min-width: 0; }
620
+ .dsh-hive-transport { gap: 4px; flex: 0 0 auto; }
621
+ .dsh-hive .dsh-hive-transport button {
622
+ min-width: 30px; min-height: 28px; padding: 2px 7px; border-radius: 6px;
623
+ background: transparent; border-color: transparent; color: var(--hive-muted);
624
+ font-family: var(--hive-mono); font-weight: 650;
625
+ }
626
+ .dsh-hive .dsh-hive-transport button:hover:not(:disabled) { color: var(--hive-ink); background: var(--dsw-alias-interactive-bg-hover); }
627
+ .dsh-hive .dsh-hive-transport button[aria-label="Replay"],
628
+ .dsh-hive .dsh-hive-transport button[aria-label="Pause replay"] {
629
+ background: var(--hive-layer); border-color: var(--hive-border); color: var(--hive-ink);
630
+ }
631
+ .dsh-hive .dsh-hive-scrubber {
632
+ flex: 1; min-width: 80px; min-height: 24px; padding: 0; border: 0; background: transparent;
633
+ accent-color: var(--hive-ink); cursor: pointer;
634
+ }
635
+ .dsh-hive .dsh-hive-live-btn {
636
+ display: inline-flex; align-items: center; gap: 6px; flex: none;
637
+ min-height: 26px; padding: 2px 10px; border-radius: 999px; font-size: .85em; font-weight: 580;
638
+ border-color: transparent; background: transparent; color: var(--hive-muted);
639
+ }
640
+ .dsh-hive .dsh-hive-live-btn[aria-pressed="true"] {
641
+ border-color: color-mix(in oklab, var(--hive-good-fill) 42%, var(--hive-border));
642
+ background: var(--hive-good-soft); color: var(--hive-ink);
643
+ }
644
+ .dsh-hive .dsh-hive-live-btn[aria-pressed="true"] .dsh-hive-status-dot { background: var(--hive-good-fill); }
645
+
646
+ .dsh-hive-replay-row2 { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; min-width: 0; }
647
+ .dsh-hive-graph-stat { font-size: .88em; color: var(--hive-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
648
+ .dsh-hive-graph-stat strong { color: var(--hive-ink); font-weight: 640; }
649
+
650
+ /* Segmented Control [ Hive | Mentions ] */
651
+ .dsh-hive-segmented {
652
+ display: inline-flex; align-items: center; padding: 2px; border-radius: 8px;
653
+ background: var(--hive-layer); border: 1px solid var(--hive-border); gap: 2px;
654
+ }
655
+ .dsh-hive .dsh-hive-segmented button {
656
+ min-height: 26px; padding: 2px 12px; border: 0; border-radius: 6px;
657
+ background: transparent; color: var(--hive-muted); font-size: .88em; font-weight: 560;
658
+ }
659
+ .dsh-hive .dsh-hive-segmented button[aria-pressed="true"] {
660
+ background: var(--hive-surface); color: var(--hive-ink); font-weight: 620;
661
+ box-shadow: 0 1px 2px light-dark(rgb(0 0 0 / 8%), rgb(0 0 0 / 30%));
662
+ }
663
+
664
+ .dsh-hive-graph-options { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-inline-start: auto; }
665
+ .dsh-hive-inline-select { display: inline-block; }
666
+ .dsh-hive-inline-select select {
667
+ min-height: 26px; padding: 2px 8px; font-size: .86em; border-color: transparent;
668
+ background: transparent; color: var(--hive-muted);
669
+ }
670
+ .dsh-hive-inline-select select:hover { color: var(--hive-ink); background: var(--dsw-alias-interactive-bg-hover); }
671
+
672
+ /* Pill Switch Toggles */
673
+ .dsh-hive-graph-toggles { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
674
+ .dsh-hive .dsh-hive-switch {
675
+ display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
676
+ color: var(--hive-muted); font-size: .86em; white-space: nowrap; position: relative;
677
+ }
678
+ .dsh-hive .dsh-hive-switch-input {
679
+ position: absolute; opacity: 0; width: 30px; height: 18px; margin: 0; min-height: 0; padding: 0; cursor: pointer;
680
+ }
681
+ .dsh-hive-switch-track {
682
+ position: relative; width: 30px; height: 18px; border-radius: 999px; flex: none;
683
+ background: color-mix(in oklab, var(--hive-border) 90%, transparent);
684
+ border: 1px solid var(--hive-border);
685
+ transition: background-color 140ms ease, border-color 140ms ease;
686
+ }
687
+ .dsh-hive-switch-track::before {
688
+ content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px;
689
+ border-radius: 50%; background: var(--hive-surface);
690
+ box-shadow: 0 1px 2px rgb(0 0 0 / 24%);
691
+ }
692
+ .dsh-hive .dsh-hive-switch-input:checked + .dsh-hive-switch-track {
693
+ background: var(--hive-gold); border-color: var(--hive-gold);
694
+ }
695
+ .dsh-hive .dsh-hive-switch-input:checked + .dsh-hive-switch-track::before {
696
+ transform: translateX(12px);
697
+ }
698
+ .dsh-hive .dsh-hive-switch-input:focus-visible + .dsh-hive-switch-track {
699
+ outline: 2px solid var(--hive-focus); outline-offset: 2px;
700
+ }
701
+
702
+ .dsh-hive .dsh-hive-export-gif {
703
+ display: inline-flex; align-items: center; gap: 5px;
704
+ min-height: 26px; padding: 2px 10px; font-size: .86em;
705
+ background: transparent; border-color: transparent; color: var(--hive-muted);
706
+ }
707
+ .dsh-hive .dsh-hive-export-gif:hover:not(:disabled) {
708
+ color: var(--hive-ink); background: var(--dsw-alias-interactive-bg-hover); border-color: var(--hive-border);
709
+ }
710
+ .dsh-hive-gif-error { color: var(--hive-danger); font-size: .86em; }
711
+
712
+ /* Graph Stage (Hive + Mentions) */
713
+ .dsh-hive-graph {
714
+ position: relative; min-width: 280px; overflow: clip;
715
+ border-radius: 12px; background: transparent;
716
+ color: color-mix(in oklab, var(--hive-ink) 45%, transparent);
717
+ }
718
+ .dsh-hive-graph > svg { display: block; position: absolute; inset: 0; pointer-events: none; }
719
+
720
+ /* Hive Mode Honeycomb Hexes & Bee Slots */
721
+ .dsh-hive-hex-poly {
722
+ fill: color-mix(in oklab, var(--hive-layer) 75%, var(--hive-surface));
723
+ stroke: var(--hive-border); stroke-width: 2.2; stroke-linejoin: round;
724
+ }
725
+ .dsh-hive-hex-cell[data-tone="done"] .dsh-hive-hex-poly {
726
+ fill: color-mix(in oklab, var(--hive-good-fill) 7%, var(--hive-surface));
727
+ stroke: var(--hive-good-fill);
728
+ }
729
+ .dsh-hive-hex-cell[data-tone="working"] .dsh-hive-hex-poly {
730
+ fill: color-mix(in oklab, var(--hive-working) 7%, var(--hive-surface));
731
+ stroke: var(--hive-working);
732
+ }
733
+ .dsh-hive-hex-cell[data-tone="waiting"] .dsh-hive-hex-poly {
734
+ fill: color-mix(in oklab, var(--hive-wait) 7%, var(--hive-surface));
735
+ stroke: var(--hive-wait);
736
+ }
737
+ .dsh-hive-hex-cell[data-tone="needs"] .dsh-hive-hex-poly {
738
+ fill: color-mix(in oklab, var(--hive-amber) 9%, var(--hive-surface));
739
+ stroke: var(--hive-amber);
740
+ }
741
+ .dsh-hive-hex-title { fill: var(--hive-ink); font-size: 11.5px; font-weight: 660; }
742
+ .dsh-hive-hex-count { fill: var(--hive-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
743
+ .dsh-hive-hex-connector { stroke: var(--hive-good-fill); stroke-width: 1.8; stroke-linecap: round; }
744
+ .dsh-hive-hex-connector[data-kind="message"] { stroke: var(--hive-pulse); stroke-width: 2.2; }
745
+ .dsh-hive-hex-connector[data-kind="waiting"] { stroke: var(--hive-amber); stroke-width: 1.8; color: var(--hive-amber); }
746
+
747
+ .dsh-hive .dsh-hive-hex-bee-btn,
748
+ .dsh-hive .dsh-hive-hex-coord-btn {
749
+ position: absolute; transform: translate(-50%, -50%);
750
+ display: grid; justify-items: center; gap: 2px;
751
+ min-height: 24px; padding: 3px 1px; border-radius: 8px;
752
+ border: 1px solid transparent; background: transparent;
753
+ }
754
+ .dsh-hive .dsh-hive-hex-bee-btn:hover:not(:disabled),
755
+ .dsh-hive .dsh-hive-hex-coord-btn:hover:not(:disabled) {
756
+ background: color-mix(in oklab, var(--hive-surface) 72%, transparent);
757
+ border-color: var(--hive-border);
758
+ }
759
+ .dsh-hive .dsh-hive-hex-bee-btn[aria-pressed="true"],
760
+ .dsh-hive .dsh-hive-hex-coord-btn[aria-pressed="true"] {
761
+ background: var(--hive-surface); border-color: var(--hive-gold);
762
+ }
763
+ .dsh-hive-hex-bee-name {
764
+ display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
765
+ font-size: 9.5px; line-height: 1.35; color: var(--hive-muted);
766
+ }
767
+
768
+ /* Mentions Mode Capsule Pills */
769
+ .dsh-hive-edge-hit { pointer-events: stroke; cursor: pointer; }
770
+ .dsh-hive-edge { stroke: color-mix(in oklab, var(--hive-ink) 34%, transparent); fill: none; stroke-linecap: round; pointer-events: none; transition: opacity 150ms ease, stroke 150ms ease; }
771
+ .dsh-hive-edge[data-active="true"] { stroke: var(--hive-gold); }
772
+ .dsh-hive-edge-tip { fill: var(--hive-gold); pointer-events: none; }
773
+ .dsh-hive-edge-pill { pointer-events: none; }
774
+ .dsh-hive-edge-pill rect { fill: var(--hive-surface); stroke: transparent; }
775
+ .dsh-hive-edge-pill text { fill: var(--hive-muted); font-family: var(--hive-mono); font-size: 10px; font-weight: 640; font-variant-numeric: tabular-nums; }
776
+ .dsh-hive-edge-pill[data-active="true"] rect { stroke: var(--hive-gold); }
777
+ .dsh-hive-edge-pill[data-active="true"] text { fill: var(--hive-gold); }
778
+
779
+ .dsh-hive .dsh-hive-graph-pill {
780
+ position: absolute; transform: translate(-50%, -50%);
781
+ display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
782
+ min-height: 30px; padding: 4px 11px 4px 8px; border-radius: 999px;
783
+ background: var(--hive-surface); border: 1px solid var(--hive-border);
784
+ box-shadow: 0 1px 4px light-dark(rgb(0 0 0 / 6%), rgb(0 0 0 / 28%));
785
+ font-size: .85em; line-height: 1.2;
786
+ transition: opacity 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
787
+ }
788
+ .dsh-hive .dsh-hive-graph-pill:hover:not(:disabled) { border-color: color-mix(in oklab, var(--hive-gold) 65%, var(--hive-border)); background: var(--hive-surface); }
789
+ .dsh-hive .dsh-hive-graph-pill[data-role="coordinator"] { border-color: color-mix(in oklab, var(--hive-gold) 48%, var(--hive-border)); }
790
+ .dsh-hive .dsh-hive-graph-pill[data-unmentioned="true"] { border-style: dashed; border-color: color-mix(in oklab, var(--hive-ink) 40%, var(--hive-border)); }
791
+ .dsh-hive .dsh-hive-graph-pill[aria-pressed="true"] { border-style: solid; border-color: var(--hive-gold); box-shadow: 0 0 0 2px var(--hive-gold-soft); }
792
+ .dsh-hive .dsh-hive-graph-pill[data-dimmed="true"] { opacity: .34; }
793
+ .dsh-hive-graph-pill-name { font-weight: 600; color: var(--hive-ink); }
794
+ .dsh-hive .dsh-hive-graph-pill[data-retired="true"] .dsh-hive-graph-pill-name { text-decoration: line-through; color: var(--hive-muted); }
795
+ .dsh-hive-node-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--hive-muted); opacity: .75; flex: none; }
796
+ .dsh-hive-node-broadcast {
797
+ position: absolute; top: -9px; inset-inline-end: 8px;
798
+ padding: 0 5px; border-radius: 999px; border: 1px solid var(--hive-border);
799
+ background: var(--hive-surface); color: var(--hive-muted); font-family: var(--hive-mono); font-size: 9.5px; font-weight: 620;
800
+ }
801
+
802
+ /* Legends */
803
+ .dsh-hive-graph-legend {
804
+ display: flex; align-items: center; flex-wrap: wrap; gap: 8px 18px;
805
+ padding: 6px 2px; font-size: .84em; color: var(--hive-muted);
806
+ }
807
+ .dsh-hive-legend-item { display: inline-flex; align-items: center; gap: 6px; }
808
+ .dsh-hive-legend-item[data-legend="done"]::before { content: ""; width: 16px; border-top: 2px solid var(--hive-good-fill); }
809
+ .dsh-hive-legend-item[data-legend="message"]::before { content: ""; width: 16px; border-top: 2px solid var(--hive-pulse); }
810
+ .dsh-hive-legend-item[data-legend="waiting"]::before { content: "---\u25B8"; font-family: var(--hive-mono); color: var(--hive-amber); letter-spacing: -1px; font-weight: 700; }
811
+ .dsh-hive-legend-item[data-legend="mention"]::before { content: "\u2192"; font-family: var(--hive-mono); color: var(--hive-muted); }
812
+ .dsh-hive-legend-item[data-legend="broadcast"]::before { content: "\u21E2"; font-family: var(--hive-mono); color: var(--hive-muted); }
813
+ .dsh-hive-legend-item[data-legend="unmentioned"]::before {
814
+ content: ""; width: 14px; height: 10px; border-radius: 999px;
815
+ border: 1px dashed color-mix(in oklab, var(--hive-ink) 50%, var(--hive-border));
816
+ }
817
+ .dsh-hive-all-badge {
818
+ display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 999px;
819
+ background: var(--hive-layer); border: 1px solid var(--hive-border);
820
+ color: var(--hive-ink); font-family: var(--hive-mono); font-size: .88em; font-weight: 600;
821
+ }
822
+
823
+ .dsh-hive-selected-post { padding: 12px 14px; border: 1px solid var(--hive-border); border-radius: 10px; background: var(--hive-card); display: grid; gap: 8px; }
824
+ .dsh-hive-flow-list { padding-inline-start: 18px; margin: 0; font-size: .88em; font-family: var(--hive-mono); font-variant-numeric: tabular-nums; display: grid; gap: 3px; color: var(--hive-muted); }
825
+
826
+ /* Motion: strictly opt-in under prefers-reduced-motion: no-preference */
827
+ @media (prefers-reduced-motion: no-preference) {
828
+ .dsh-hive details::details-content {
829
+ interpolate-size: allow-keywords;
830
+ overflow: clip;
831
+ contain: layout;
832
+ transition: block-size, content-visibility, display;
833
+ transition-duration: .24s;
834
+ transition-timing-function: ease-out;
835
+ transition-behavior: allow-discrete;
836
+ }
837
+ .dsh-hive details:not([open])::details-content { block-size: 0; }
838
+ .dsh-hive .dsh-hive-chevron { transition: rotate 180ms ease; }
839
+ .dsh-hive .dsh-hive-switch-track::before { transition: transform 150ms cubic-bezier(.22, 1, .36, 1); }
840
+ .dsh-hive .dsh-hive-graph-pill { transition: opacity 150ms ease, border-color 150ms ease, box-shadow 150ms ease, transform 150ms cubic-bezier(.22, 1, .36, 1); }
841
+ .dsh-hive .dsh-hive-graph-pill:hover:not(:disabled) { transform: translate(-50%, calc(-50% - 2px)); }
842
+ }
843
+ @media (prefers-reduced-motion: reduce) {
844
+ .dsh-hive { scroll-behavior: auto; }
845
+ }
846
+ @media (forced-colors: active) {
847
+ .dsh-hive-tabs button[aria-selected="true"]::after { border-block-end-color: Highlight; }
848
+ .dsh-hive-status, .dsh-hive-mode, .dsh-hive-route-badge, .dsh-hive .dsh-hive-bee-pill,
849
+ .dsh-hive .dsh-hive-graph-pill[aria-pressed="true"],
850
+ .dsh-hive .dsh-hive-hex-bee-btn[aria-pressed="true"],
851
+ .dsh-hive-switch-track { border: 1px solid ButtonText; forced-color-adjust: auto; }
852
+ .dsh-hive-hex-poly { stroke: ButtonText; fill: Canvas; }
853
+ .dsh-hive-hex-connector, .dsh-hive-edge, .dsh-hive-edge[data-active="true"] { stroke: CanvasText; }
854
+ .dsh-hive-edge-tip { fill: Highlight; }
855
+ }
856
+ @container (min-width: 760px) {
857
+ .dsh-hive-content { padding: 20px 24px 32px; }
858
+ }
859
+ @container (max-width: 360px) {
860
+ .dsh-hive-header, .dsh-hive-content { padding-inline: 12px; }
861
+ .dsh-hive-tabs { padding-inline: 12px; gap: 12px; }
862
+ .dsh-hive-filters { display: grid; grid-template-columns: 1fr; }
863
+ .dsh-hive-facts > div { grid-template-columns: 1fr; gap: 2px; }
864
+ .dsh-hive-line time { width: 100%; margin: 0; }
865
+ .dsh-hive-team-card { flex-direction: column; }
866
+ }
867
+ `;var ao=typeof document<"u"?e.useLayoutEffect:e.useEffect,Ft="hive-swarm:dsh:graph-mode",Et="hive-swarm:dsh:dismissed-update",lo="2.1.2".trim(),ho=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/,co=typeof De.default.drawSprite=="function",uo="data:image/svg+xml,"+encodeURIComponent(Tt);function et({size:o=22,className:n}){return e.default.createElement("img",{src:uo,width:o,height:o,className:n,alt:"","aria-hidden":"true","data-dsh-panel-entry":"dsh-hive-swarm"})}function Ee({name:o,status:n,coordinator:d=!1,tint:p,muted:m=!1,size:i="md"}){let N=(0,e.useRef)(null),k=m&&!co?"working":n;return(0,e.useEffect)(()=>{let C=N.current;if(!C)return;let y=C.getContext("2d");if(y){y.clearRect(0,0,C.width,C.height);let c=De.default.sprite(o,{status:k,coordinator:d,tint:p,muted:m});c&&y.drawImage(c,0,0)}},[o,k,d,p,m]),e.default.createElement("canvas",{ref:N,width:"20",height:"18","aria-hidden":"true",className:"dsh-hive-bee","data-size":i,"data-muted":m?"true":void 0})}var Wt=()=>{},We=(o,n,d)=>{o.command(n,d).catch(Wt)},Dt={working:"Live",waiting:"Waiting",done:"Done",paused:"Paused",budget:"Turn limit",stalled:"Needs you",quota:"Quota reached",retired:"Retired",failed:"Needs you",queued:"Queued",blocked:"Blocked",active:"Active"},_e={working:"Working",waiting:"Waiting",done:"Done",paused:"Paused",budget:"Turn limit",stalled:"Needs you",quota:"Quota reached",retired:"Retired",failed:"Failed",queued:"Queued",blocked:"Blocked",active:"Active"},It={subagent:"Subagent",attached:"Attached",session:"Session"};function tt({value:o,compactView:n=!1}){return e.default.createElement("span",{className:n?"dsh-hive-header-status":"dsh-hive-status","data-status":o},e.default.createElement("span",{className:"dsh-hive-status-dot","aria-hidden":"true"}),(n?Dt:_e)[o]??o??"Ready")}function po({mode:o,subagentName:n}){return!o||!Object.hasOwn(It,o)?null:e.default.createElement("span",{className:"dsh-hive-mode","data-mode":o,title:n?"Subagent: "+n:void 0},It[o])}function fo({title:o,children:n}){return e.default.createElement("section",{className:"dsh-hive-empty"},e.default.createElement("h2",null,o),e.default.createElement("p",null,n))}function jt({error:o,controller:n}){return e.default.createElement("div",{role:"alert",className:"dsh-hive-error"},e.default.createElement("p",null,o.message),e.default.createElement("p",{className:"dsh-hive-secondary"},o.action?"The action may have reached the Host. Refresh to inspect the result, or retry the same request.":"Check the Host connection and workspace permission, then refresh."),e.default.createElement("div",{className:"dsh-hive-actions"},e.default.createElement("button",{type:"button",onClick:()=>n.refresh()},"Refresh"),n.getSnapshot().selectedId&&!n.getSnapshot().team?e.default.createElement("button",{type:"button",onClick:n.showTeams},"Show teams"):null,o.action?e.default.createElement("button",{type:"button",disabled:n.getSnapshot().pending,onClick:()=>{n.retryCommand().catch(Wt)}},"Retry action"):null))}function ct({className:o="dsh-hive-chevron"}){return e.default.createElement("svg",{className:o,width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true"},e.default.createElement("path",{d:"M4 6l4 4 4-4",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"}))}function lt({status:o,recovery:n=!1}){return n||["failed","quota","stalled","blocked"].includes(o)?e.default.createElement("span",{className:"dsh-hive-glyph","data-tone":"danger","aria-hidden":"true"},"!"):o==="done"?e.default.createElement("span",{className:"dsh-hive-glyph","data-tone":"done","aria-hidden":"true"},"\u2713"):o==="working"||o==="active"?e.default.createElement("span",{className:"dsh-hive-glyph","data-tone":"active","aria-hidden":"true"},e.default.createElement("span",{className:"dsh-hive-glyph-dot"})):e.default.createElement("span",{className:"dsh-hive-glyph","data-tone":"idle","aria-hidden":"true"},e.default.createElement("span",{className:"dsh-hive-glyph-dot"}))}function je({seq:o,onJumpPost:n}){return n?e.default.createElement("button",{type:"button",className:"dsh-hive-ref","aria-label":"Jump to post #"+o,onClick:()=>n(o)},"#",o):"#"+o}function _t(o){try{let n=new URL(o);return["http:","https:"].includes(n.protocol)?n.href:null}catch{return null}}function mo(o){if(typeof o!="string")return null;let n=o.trim();if(!n)return null;if(n.startsWith("/api/hive-swarm/v1/screenshot")||n.startsWith("/board/")||/^data:image\/(png|jpe?g|webp|gif);base64,/i.test(n))return n;try{let d=new URL(n);return["http:","https:","blob:"].includes(d.protocol)?d.href:null}catch{return null}}function Ve(o,n,d="i"){let p=[],m=0,i=0,N=/\x60([^\x60\n]+)\x60|\*\*([^\n]+?)\*\*|\*([^*\n]+)\*|\[([^\]\n]+)\]\(([^\s)]+)\)|\[(done|stall)\]|(?<![a-z0-9_])(@#?[a-z][a-z0-9_-]*|#[1-9]\d*\b)/gi;for(let k of o.matchAll(N)){m<k.index&&p.push(o.slice(m,k.index));let C=d+"-"+i++;if(k[1])p.push(e.default.createElement("code",{key:C},k[1]));else if(k[2])p.push(e.default.createElement("strong",{key:C},Ve(k[2],n,C)));else if(k[3])p.push(e.default.createElement("em",{key:C},Ve(k[3],n,C)));else if(k[4]){let y=_t(k[5]);p.push(y?e.default.createElement("a",{key:C,href:y,target:"_blank",rel:"noopener noreferrer"},k[4]):k[0])}else if(k[6])p.push(e.default.createElement("span",{key:C,className:"dsh-hive-badge","data-badge":k[6].toLowerCase()},k[0]));else if(k[0].startsWith("@"))p.push(e.default.createElement("span",{key:C,className:"dsh-hive-mention"},k[0]));else{let y=Number(k[0].slice(1));p.push(Number.isSafeInteger(y)?e.default.createElement(je,{key:C,seq:y,onJumpPost:n}):k[0])}m=k.index+k[0].length}return m<o.length&&p.push(o.slice(m)),p}function zt(o,n,d="b"){let p=[],m=[],i=null,N=0,k=()=>{if(!m.length)return;let y=d+"-p"+N++;p.push(e.default.createElement("p",{key:y,className:"dsh-hive-prose"},Ve(m.join(`
868
+ `),n,y))),m=[]},C=()=>{if(!i)return;let y=d+"-l"+N++,c=i.items.map((w,x)=>e.default.createElement("li",{key:x},Ve(w,n,y+"-"+x)));p.push(i.ordered?e.default.createElement("ol",{key:y,className:"dsh-hive-list",start:i.start},c):e.default.createElement("ul",{key:y,className:"dsh-hive-list"},c)),i=null};for(let y of o.split(/\r?\n/)){let c=/^ {0,3}(#{1,3})\s+(.+)$/.exec(y),w=/^ {0,3}([-*+]|\d+[.)])\s+(.+)$/.exec(y);if(c){k(),C();let x=d+"-h"+N++,b="h"+(2+c[1].length);p.push(e.default.createElement(b,{key:x},Ve(c[2],n,x)))}else if(w){k();let x=/^\d/.test(w[1]);(!i||i.ordered!==x)&&(C(),i={ordered:x,start:x?Number.parseInt(w[1],10):1,items:[]}),i.items.push(w[2])}else C(),y.trim()?m.push(y):k()}return k(),C(),p}function Oe({text:o,onJumpPost:n}){let d=String(o??""),p=[],m=0,i=0,N=/^[ \t]*\x60{3}[^\r\n\x60]*\r?\n([\s\S]*?)^[ \t]*\x60{3}[ \t]*\r?$/gm;for(let C of d.matchAll(N)){let y=d.slice(m,C.index);y.trim()&&p.push(...zt(y,n,"s"+i++)),p.push(e.default.createElement("pre",{key:"c"+i++,className:"dsh-hive-code"},e.default.createElement("code",null,C[1].replace(/\r?\n$/,"")))),m=C.index+C[0].length}let k=d.slice(m);return(k.trim()||!p.length)&&p.push(...zt(k,n,"s"+i++)),e.default.createElement("div",{className:"dsh-hive-rich"},p)}function Ae(o,n=140){let d=String(o??"").replace(/\s+/g," ").trim();return d.length>n?d.slice(0,n-1).trimEnd()+"\u2026":d}function ut(o){if(typeof Te.default.smartTaskLabel=="function")return Te.default.smartTaskLabel(o);let n=String(o?.taskLabel??"").trim();if(n)return Ae(n,64);let d=String(o?.brief??"").replace(/[`*_#>\[\]]/g," ").replace(/\s+/g," ").trim();d=d.replace(/^You are\s+(?:@[a-z0-9_-]+\s+)?(?:an?\s+|the\s+)?(?:Hive Swarm\s+)?(?:member|worker|agent|author|verifier|researcher|investigator|auditor|reviewer)?[^.:\n]*?(?:[.:]\s+|\s+—\s+|\s+-\s+)/i,""),d=d.replace(/^(?:Your\s+)?(?:assignment|mission|role|task)(?:\s*\([^)]*\))?\s*[:\-–—]\s*/i,""),d=d.replace(/^You\s+own\s+(?:the\s+)?/i,"");let m=(d.split(/(?<=[.!?])\s+|\s*;\s*|\r?\n/)[0]?.trim()??"").replace(/[.:,;!?]+$/,"").split(/\s+/).filter(Boolean);for(m.length>10&&(m=m.slice(0,10));m.length>2&&/^(?:for|in|on|with|to|of|from|by|at|and|or|the|a|an)$/i.test(m.at(-1));)m.pop();let i=m.join(" ").trim();return Ae(i||o?.name||"Task",64)}function pt(o,n=!1,d){if(typeof De.default.tintStyle=="function")return De.default.tintStyle(o,n,d);let[p,m,i]=De.default.colors(o,n,d);return{base:p,highlight:m,shade:i,bg:"color-mix(in oklab, "+p+" 16%, transparent)",border:"color-mix(in oklab, "+i+" 42%, var(--hive-border))",text:"var(--hive-ink)"}}function ot(o){let n=o?.members??[],p=n.some(i=>i.role==="coordinator"||i.name==="coordinator")?n:[{name:"coordinator",role:"coordinator",external:!0,status:o?.phase==="done"?"done":"waiting",model:o?.model,effort:o?.effort,brief:o?.task??"Coordinator",waitFor:[]},...n],m=0;return p.map(i=>i.role==="coordinator"||i.name==="coordinator"?{...i,role:"coordinator",tint:0}:{...i,tint:m++})}function $e({member:o,name:n,coordinator:d=!1,tint:p,muted:m=!1,onClick:i,title:N,ariaLabel:k}){let C=n??o?.name??"member",y=pt(C,d,p??o?.tint),c={"--bee-pill-bg":y.bg,"--bee-pill-border":y.border},w=e.default.createElement(e.default.Fragment,null,e.default.createElement(Ee,{name:C,status:o?.status??"waiting",coordinator:d,tint:p??o?.tint,muted:m,size:"xs"}),e.default.createElement("span",null,C));return i?e.default.createElement("button",{type:"button",className:"dsh-hive-bee-pill",style:c,title:N,"aria-label":k??"Inspect "+C,onClick:i},w):e.default.createElement("span",{className:"dsh-hive-bee-pill","data-static":"true",style:c,title:N},w)}function vo(o,n){let d=(o.members??[]).map(p=>n.find(m=>m.name===p)).filter(Boolean);return d.some(p=>p.recoveryRequired||["failed","quota"].includes(p.status))?{key:"blocked",rank:0}:d.some(p=>p.status==="working")?{key:"active",rank:1}:d.some(p=>p.status==="queued")?{key:"queued",rank:2}:d.some(p=>p.status==="waiting")?{key:"waiting",rank:3}:d.length&&d.every(p=>["done","retired"].includes(p.status))?{key:"done",rank:4}:{key:"queued",rank:2}}function Ot(o,n,d){if(o.status==="working"){let i=n?.steps?.findLast(N=>N?.label?.trim())?.label;return Ae(i)||(o.lastTurn?"Working on turn "+o.lastTurn:"Working on the current turn")}if(o.recoveryRequired)return"Outcome unconfirmed. Inspect journal before continuing.";if(["quota","failed"].includes(o.status))return Ae(d?.text)||_e[o.status]||o.status;let p=o.pendingWaitFor??o.waitFor;if(p?.length)return Ae("Waiting on "+p.map(i=>"@"+i).join(", "));let m=/\[done\]\s*([^\r?\n]+)/i.exec(d?.text??"");return m?Ae(m[1]):o.status==="waiting"?"Waiting for an @mention":o.status==="queued"?"Queued for the next turn":Ae(d?.text?.split(/\r?\n/)[0])||_e[o.status]||o.status}function nt({title:o,onClose:n,opener:d,closeOnBackdrop:p=!1,className:m="dsh-hive-dialog",children:i}){let N=(0,e.useRef)(null),k=(0,e.useRef)(null),C=(0,e.useId)().replace(/[^a-zA-Z0-9_-]/g,"");return(0,e.useLayoutEffect)(()=>{let y=N.current;if(!y)return;typeof y.showModal=="function"?y.showModal():y.setAttribute("open",""),k.current?.focus();let c;if(p&&typeof HTMLDialogElement<"u"&&!("closedBy"in HTMLDialogElement.prototype)){let w=!1,x=q=>{let z=y.getBoundingClientRect();return q.clientX<z.left||q.clientX>z.right||q.clientY<z.top||q.clientY>z.bottom},b=q=>{w=x(q)},P=q=>{w&&x(q)&&n()};y.addEventListener("pointerdown",b),y.addEventListener("pointerup",P),c=()=>{y.removeEventListener("pointerdown",b),y.removeEventListener("pointerup",P)}}return()=>{c?.(),y.open&&typeof y.close=="function"&&y.close(),d?.isConnected&&d.focus()}},[d,p,n]),e.default.createElement("dialog",{ref:N,className:m,"aria-labelledby":C,...p?{closedby:"any"}:{},onCancel:y=>{y.preventDefault(),n()},onKeyDown:y=>{y.key==="Escape"&&(y.preventDefault(),n())}},e.default.createElement("header",{className:"dsh-hive-dialog-head"},e.default.createElement("h2",{id:C},o),e.default.createElement("button",{type:"button",ref:k,"aria-label":"Close "+o,onClick:n},"Close")),i)}function go({step:o}){let n=typeof o=="string"?o:String(o?.label??""),d=typeof o=="object"&&o?.detail?String(o.detail):"",p=/^Verified route:\s*(.+)$/i.exec(n);if(p||typeof o=="object"&&o?.kind==="route"){let m=p?p[1]:n;return e.default.createElement("li",{className:"dsh-hive-route-item"},e.default.createElement("span",{className:"dsh-hive-route-badge"},e.default.createElement("span",{className:"dsh-hive-route-check","aria-hidden":"true"},"\u2713"),"Verified route: ",e.default.createElement("code",null,m)),d?e.default.createElement("span",{className:"dsh-hive-secondary"}," \u2014 ",d):null)}return e.default.createElement("li",null,n,d?" \u2014 "+d:"")}function bo({controller:o,journal:n,opener:d,onClose:p,onJumpPost:m}){let i=N=>{p(),m(N)};return e.default.createElement(nt,{title:"Journal",onClose:p,opener:d,closeOnBackdrop:!0},e.default.createElement("div",{className:"dsh-hive-actions dsh-hive-journal-bar"},e.default.createElement("strong",null,"@",n.member),e.default.createElement("button",{type:"button",disabled:n.loading,onClick:()=>{o.openJournal(n.member)}},"Refresh Journal")),n.loading?e.default.createElement("p",{role:"status"},"Loading Journal\u2026"):n.error?e.default.createElement(jt,{error:n.error,controller:{...o,refresh:()=>o.openJournal(n.member)}}):n.turns.length?e.default.createElement("ol",{className:"dsh-hive-journal"},n.turns.map((N,k)=>e.default.createElement("li",{key:N.turn??k,className:"dsh-hive-journal-turn"},e.default.createElement("div",{className:"dsh-hive-line"},e.default.createElement("h3",null,"Turn ",N.turn??k+1),e.default.createElement(tt,{value:N.status})),N.steps?.length?e.default.createElement("ul",{className:"dsh-hive-journal-steps"},N.steps.map((C,y)=>e.default.createElement(go,{key:y,step:C}))):null,N.report?e.default.createElement(Oe,{text:N.report,onJumpPost:i}):e.default.createElement("p",{className:"dsh-hive-secondary"},"No report saved for this turn.")))):e.default.createElement("p",null,"No saved turns yet. Live work appears here after the Host records it."),n.live?.steps?.length?e.default.createElement("section",{className:"dsh-hive-live"},e.default.createElement("h3",null,"Current activity"),e.default.createElement("ul",null,n.live.steps.map((N,k)=>e.default.createElement("li",{key:k},typeof N=="string"?N:N.label)))):null)}function Re({memberName:o,pending:n,controller:d}){return e.default.createElement(e.default.Fragment,null,e.default.createElement("button",{type:"button",disabled:n,"aria-label":"Retry fresh turn for @"+o,onClick:()=>We(d,"resolve_recovery",{member:o,action:"retry"})},"Retry fresh turn"),e.default.createElement("button",{type:"button",disabled:n,"aria-label":"Dismiss unconfirmed run for @"+o,onClick:()=>We(d,"resolve_recovery",{member:o,action:"dismiss"})},"Dismiss"))}function Lt({className:o,defaultOpen:n=!1,summary:d,children:p}){let[m,i]=(0,e.useState)(n);return e.default.createElement("details",{className:o,open:m},e.default.createElement("summary",{className:o==="dsh-hive-task-card"?"dsh-hive-task-summary":"dsh-hive-thread-head",onClick:N=>{N.preventDefault(),i(k=>!k)}},d),p)}function yo({state:o,controller:n,onJournal:d,onJumpPost:p,onMention:m}){let i=o.team,N=o.history.length?o.history:i.events??[],k=(0,e.useMemo)(()=>ot(i),[i]),C=(0,e.useMemo)(()=>new Map(k.map(a=>[a.name,a])),[k]),y=(0,e.useMemo)(()=>{let a=new Map;for(let A of N)A.kind!=="brief"&&A.author!=="system"&&a.set(A.author,A);return a},[N]),c=i.members.filter(a=>a.role!=="coordinator"&&a.name!=="coordinator"&&a.status!=="retired"),w=c.filter(a=>a.status==="done").length,x=c.length>0&&w===c.length,b=i.task?.trim()??"",P=i.goalLine?.trim()??"",q=b.length>140||/\n/.test(b),z=i.members.filter(a=>a.recoveryRequired||["quota","failed"].includes(a.status)),J=(i.attention??[]).filter(a=>["stalled","budget"].includes(i.phase)||["recovery","input","quota","failed","dependency","cycle"].includes(a.kind)),g=J.length>0||z.length>0||i.phase==="budget"||i.phase==="stalled",T=(0,e.useMemo)(()=>k.filter(a=>a.role!=="coordinator"&&a.name!=="coordinator"&&a.status!=="retired").map(a=>({member:a,latest:y.get(a.name)})).sort((a,A)=>(A.latest?.seq??0)-(a.latest?.seq??0)),[k,y]),G=(0,e.useMemo)(()=>(i.threads?.length?i.threads:c.length?[{id:"tasks",title:"Tasks",members:c.map(A=>A.name)}]:[]).map(A=>({thread:A,state:vo(A,i.members)})).sort((A,r)=>A.state.rank-r.state.rank),[i.threads,i.members,c]),$=(0,e.useMemo)(()=>(i.screenshots??[]).map((a,A)=>{let r=mo(a?.url);return r?{...a,id:a.id??a.seq+":"+A,url:r}:null}).filter(Boolean),[i.screenshots]),[O,h]=(0,e.useState)(null),W=k.find(a=>a.role==="coordinator"||a.name==="coordinator"),Z=i.members.some(a=>a.role==="coordinator"||a.name==="coordinator"),re=(0,e.useMemo)(()=>N.findLast(a=>a.author==="coordinator"&&a.kind!=="brief")??N.findLast(a=>a.author==="user"&&a.kind!=="brief"&&/\[done\]/i.test(a.text??""))??(Z?void 0:N.findLast(a=>a.author==="user"&&a.kind!=="brief")),[N,Z]),pe=re?.text?.trim()??"",ie=pe?Ae(pe.replace(/^\[done\]\s*/i,""),180):"",L=pe.length>180||/\n/.test(pe),R=(a,A)=>{if(Le(a)){d(a.name,A);return}let r=y.get(a.name);r?p(r.seq):a.status!=="retired"&&!a.retireAfterTurn&&m(a.name)};return e.default.createElement("div",{className:"dsh-hive-overview"},P?e.default.createElement("p",{className:"dsh-hive-goal-line"},P):!q&&b&&b!==i.title?e.default.createElement("p",{className:"dsh-hive-goal-line"},b):null,q?e.default.createElement("details",{className:"dsh-hive-details dsh-hive-brief-disclosure"},e.default.createElement("summary",null,"Full brief"),e.default.createElement(Oe,{text:b,onJumpPost:p})):null,e.default.createElement(Lt,{className:"dsh-hive-task-card",defaultOpen:!1,summary:e.default.createElement(e.default.Fragment,null,e.default.createElement(lt,{status:z.length?"failed":x?"done":"working",recovery:z.some(a=>a.recoveryRequired)}),e.default.createElement("span",{className:"dsh-hive-task-count"},e.default.createElement("strong",null,w," of ",c.length)," tasks done"),e.default.createElement("span",{className:"dsh-hive-task-turns"},"Turns ",i.turns,"/",i.turnLimit),e.default.createElement(ct,null))},e.default.createElement("div",{className:"dsh-hive-task-body"},T.length?e.default.createElement("ul",{className:"dsh-hive-task-list"},T.map(({member:a,latest:A})=>{let r=Ot(a,i.activity?.[a.name],A),M=a.status==="retired";return e.default.createElement("li",{key:a.name,className:"dsh-hive-task-row"},e.default.createElement(lt,{status:a.status,recovery:a.recoveryRequired}),e.default.createElement("div",{className:"dsh-hive-task-main"},e.default.createElement("div",{className:"dsh-hive-task-title"},ut(a)),e.default.createElement("div",{className:"dsh-hive-task-sub"},r),a.recoveryRequired?e.default.createElement("div",{className:"dsh-hive-actions dsh-hive-inline-actions"},e.default.createElement(Re,{memberName:a.name,pending:o.pending||a.status==="working",controller:n})):null),e.default.createElement($e,{member:a,muted:M,title:Le(a)?"Inspect @"+a.name+" Journal":"View @"+a.name,ariaLabel:(Le(a)?"Inspect journal for @":"Jump to @")+a.name,onClick:f=>R(a,f.currentTarget)}))})):e.default.createElement("p",{className:"dsh-hive-secondary dsh-hive-task-empty"},"No worker tasks assigned yet."))),g?e.default.createElement("section",{className:"dsh-hive-section"},e.default.createElement("h2",null,"Needs you"),e.default.createElement("ul",{className:"dsh-hive-attention"},J.map((a,A)=>{let r=i.members.find(M=>M.name===a.member);return e.default.createElement("li",{key:"a-"+A,className:"dsh-hive-alert-card","data-kind":a.kind},e.default.createElement("p",null,a.text??a.message??a.kind),e.default.createElement("div",{className:"dsh-hive-actions"},a.seq?e.default.createElement(je,{seq:a.seq,onJumpPost:p}):null,a.kind==="budget"?e.default.createElement("button",{type:"button",disabled:o.pending,onClick:()=>We(n,"resume_team",{extraTurns:8})},"Add 8 turns and resume"):null,Le(r)?e.default.createElement("button",{type:"button",onClick:M=>d(a.member,M.currentTarget)},"Inspect @",a.member):null,r?.recoveryRequired?e.default.createElement(Re,{memberName:r.name,pending:o.pending||r.status==="working",controller:n}):null))}),z.filter(a=>!J.some(A=>A.member===a.name)).map(a=>e.default.createElement("li",{key:a.name,className:"dsh-hive-alert-card","data-kind":a.recoveryRequired?"recovery":a.status},e.default.createElement("p",null,"@",a.name,": ",a.recoveryRequired?"Outcome unconfirmed. Inspect the owned session before continuing.":a.status==="quota"?"Model quota reached. Choose an available model before resuming.":"The last turn failed. Inspect the Journal for recovery details."),e.default.createElement("div",{className:"dsh-hive-actions"},Le(a)?e.default.createElement("button",{type:"button",onClick:A=>d(a.name,A.currentTarget)},"Inspect Journal"):null,a.recoveryRequired?e.default.createElement(Re,{memberName:a.name,pending:o.pending||a.status==="working",controller:n}):null))),i.phase==="budget"&&!J.some(a=>a.kind==="budget")?e.default.createElement("li",{key:"budget-alert",className:"dsh-hive-alert-card","data-kind":"budget"},e.default.createElement("p",null,"Turn limit reached (",i.turns,"/",i.turnLimit,"). Add 8 turns to continue."),e.default.createElement("div",{className:"dsh-hive-actions"},e.default.createElement("button",{type:"button",disabled:o.pending,onClick:()=>We(n,"resume_team",{extraTurns:8})},"Add 8 turns and resume"))):null)):null,G.length?e.default.createElement("section",{className:"dsh-hive-section"},e.default.createElement("h2",null,"Threads"),e.default.createElement("div",{className:"dsh-hive-threads"},G.map(({thread:a,state:A})=>{let r=(a.members??[]).map(Y=>C.get(Y)??{name:Y,status:"queued",brief:a.goal??Y}),M=r.length,f=r.filter(Y=>["done","retired"].includes(Y.status)).length,te=G.length===1||["blocked","active","done"].includes(A.key);return e.default.createElement(Lt,{key:a.id??a.title,className:"dsh-hive-thread-card",defaultOpen:te,summary:e.default.createElement(e.default.Fragment,null,e.default.createElement("span",{className:"dsh-hive-thread-left"},e.default.createElement("span",{className:"dsh-hive-thread-dot","data-status":A.key,"aria-hidden":"true"}),e.default.createElement("strong",{className:"dsh-hive-thread-title"},a.title),e.default.createElement("span",{className:"dsh-hive-thread-state"},Dt[A.key]??A.key)),e.default.createElement("span",{className:"dsh-hive-thread-right"},e.default.createElement("progress",{className:"dsh-hive-mini-progress",max:Math.max(M,1),value:f,"aria-label":a.title+" progress"}),e.default.createElement("span",{className:"dsh-hive-thread-ratio"},f,"/",M),e.default.createElement(ct,null)))},e.default.createElement("div",{className:"dsh-hive-thread-body"},a.goal?e.default.createElement("p",{className:"dsh-hive-thread-goal"},a.goal):null,r.length?e.default.createElement("ul",{className:"dsh-hive-thread-rows"},r.map(Y=>e.default.createElement("li",{key:Y.name,className:"dsh-hive-thread-task"},e.default.createElement(lt,{status:Y.status,recovery:Y.recoveryRequired}),e.default.createElement("span",{className:"dsh-hive-thread-task-title"},ut(Y)),e.default.createElement($e,{member:Y,muted:Y.status==="retired",ariaLabel:(Le(Y)?"Inspect journal for @":"Jump to @")+Y.name,onClick:Me=>R(Y,Me.currentTarget)})))):e.default.createElement("p",{className:"dsh-hive-secondary"},"No members assigned to this thread.")))}))):null,$.length?e.default.createElement("section",{className:"dsh-hive-section"},e.default.createElement("h2",null,"Screenshots"),e.default.createElement("ul",{className:"dsh-hive-screenshots-strip"},$.map(a=>{let A=C.get(a.author);return e.default.createElement("li",{key:a.id,className:"dsh-hive-shot-card"},e.default.createElement("button",{type:"button",className:"dsh-hive-shot-thumb","aria-label":"Preview screenshot: "+a.caption,onClick:r=>h({shot:a,opener:r.currentTarget})},e.default.createElement("img",{src:a.url,alt:a.caption,loading:"lazy"})),e.default.createElement("div",{className:"dsh-hive-shot-meta"},e.default.createElement("p",{className:"dsh-hive-shot-caption"},a.caption),e.default.createElement("div",{className:"dsh-hive-shot-foot"},a.seq?e.default.createElement(je,{seq:a.seq,onJumpPost:p}):null,a.author?e.default.createElement($e,{member:A,name:a.author,coordinator:a.author==="coordinator",onClick:A?r=>R(A,r.currentTarget):void 0}):null)))}))):null,e.default.createElement("section",{className:"dsh-hive-section"},e.default.createElement("h2",null,"The team"),e.default.createElement("div",{className:"dsh-hive-team-card"},e.default.createElement("div",{className:"dsh-hive-coordinator-tile","aria-hidden":"true"},e.default.createElement(Ee,{name:"coordinator",status:"working",coordinator:!0,size:"lg"})),e.default.createElement("div",{className:"dsh-hive-team-body"},e.default.createElement("div",{className:"dsh-hive-line"},e.default.createElement("strong",{className:"dsh-hive-team-name"},"Coordinator"),e.default.createElement("div",{className:"dsh-hive-pill-group"},re?.seq?e.default.createElement(je,{seq:re.seq,onJumpPost:p}):null,Le(W)?e.default.createElement("button",{type:"button",className:"dsh-hive-ghost-btn",onClick:a=>d(W.name,a.currentTarget)},"Journal"):null)),e.default.createElement("p",{className:"dsh-hive-team-summary"},ie||(b?Ae(b,180):"Coordinating team progress.")),L?e.default.createElement("details",{className:"dsh-hive-details"},e.default.createElement("summary",null,"Full summary"),e.default.createElement(Oe,{text:pe,onJumpPost:p})):null,e.default.createElement("details",{className:"dsh-hive-details dsh-hive-exec"},e.default.createElement("summary",null,"Execution"),e.default.createElement("dl",{className:"dsh-hive-facts"},e.default.createElement("div",null,e.default.createElement("dt",null,"Turns"),e.default.createElement("dd",null,i.turns," of ",i.turnLimit," used")),e.default.createElement("div",null,e.default.createElement("dt",null,"Members"),e.default.createElement("dd",null,i.members.filter(a=>a.status!=="retired").length," active \xB7 ",i.members.filter(a=>a.status==="working").length," working")),e.default.createElement("div",null,e.default.createElement("dt",null,"Model"),e.default.createElement("dd",null,i.model??"Host default",i.effort?" \xB7 "+i.effort:"")),i.fallbackModel?e.default.createElement("div",null,e.default.createElement("dt",null,"Fallback"),e.default.createElement("dd",null,i.fallbackModel,i.fallbackEffort?" \xB7 "+i.fallbackEffort:"")):null,e.default.createElement("div",null,e.default.createElement("dt",null,"Workspace"),e.default.createElement("dd",null,i.cwd)))),i.phase==="budget"?e.default.createElement("div",{className:"dsh-hive-actions"},e.default.createElement("button",{type:"button",className:"dsh-hive-primary",disabled:o.pending,onClick:()=>We(n,"resume_team",{extraTurns:8})},"+8 turns")):null))),O?e.default.createElement(nt,{title:O.shot.caption||"Screenshot",opener:O.opener,closeOnBackdrop:!0,className:"dsh-hive-dialog dsh-hive-lightbox",onClose:()=>h(null)},e.default.createElement("figure",{className:"dsh-hive-lightbox-figure"},e.default.createElement("img",{src:O.shot.url,alt:O.shot.caption,className:"dsh-hive-lightbox-img"}),e.default.createElement("figcaption",{className:"dsh-hive-lightbox-meta"},e.default.createElement("span",null,O.shot.caption),e.default.createElement("div",{className:"dsh-hive-actions"},O.shot.seq?e.default.createElement(je,{seq:O.shot.seq,onJumpPost:a=>{h(null),p(a)}}):null,O.shot.author?e.default.createElement($e,{member:C.get(O.shot.author),name:O.shot.author,coordinator:O.shot.author==="coordinator"}):null,O.shot.time?e.default.createElement("time",{className:"dsh-hive-secondary dsh-hive-mono",dateTime:O.shot.time},new Date(O.shot.time).toLocaleString()):null)))):null)}function xo(){return e.default.createElement("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true"},e.default.createElement("path",{d:"M2.5 3.5h11l-4.2 5v3.7l-2.6 1.3V8.5l-4.2-5Z",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round"}))}function Ut(){return e.default.createElement("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true"},e.default.createElement("circle",{cx:"7",cy:"7",r:"4.5",stroke:"currentColor",strokeWidth:"1.4"}),e.default.createElement("path",{d:"M10.5 10.5L13.5 13.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}))}function wo(o){if(!o)return"";try{return new Date(o).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}catch{return""}}function ko({event:o,member:n,canOpenSession:d=!1,onOpenSession:p,onJumpPost:m,focused:i=!1}){let[N,k]=(0,e.useState)(!1),C=String(o.text??""),y=C.length>360||C.split(/\r?\n/).length>6,c=y&&!N&&!i,w=o.author==="coordinator"||n?.role==="coordinator",x=o.author==="system",b=!w&&!x&&n?pt(n.name,!1,n.tint):null,P=b?{"--tile-bg":b.bg,"--tile-border":b.border}:void 0,q=!w&&["done","retired"].includes(n?.status),z=w?e.default.createElement("div",{className:"dsh-hive-post-tile dsh-hive-coord-mini"},e.default.createElement(Ee,{name:"coordinator",status:n?.status??"waiting",coordinator:!0,size:"sm"})):x?e.default.createElement("div",{className:"dsh-hive-post-tile dsh-hive-system-tile","aria-hidden":"true"},"\u2699"):e.default.createElement("div",{className:"dsh-hive-post-tile",style:P},e.default.createElement(Ee,{name:o.author,status:n?.status??"observer",tint:n?.tint,muted:q,size:"sm"}));return e.default.createElement("li",{className:"dsh-hive-post","data-seq":o.seq,"data-kind":o.kind??"message","data-focused":i?"true":void 0},d&&p?e.default.createElement("button",{type:"button",className:"dsh-hive-post-avatar-btn","aria-label":"Open session for @"+o.author,title:"Open @"+o.author+" session",onClick:J=>p(o.author,J.currentTarget)},z):e.default.createElement("div",{className:"dsh-hive-post-avatar-slot","aria-hidden":"true"},z),e.default.createElement("div",{className:"dsh-hive-post-main"},e.default.createElement("div",{className:"dsh-hive-post-head"},e.default.createElement("div",{className:"dsh-hive-post-who"},e.default.createElement("strong",{className:"dsh-hive-author"},x?"System":"@"+o.author),o.targets?.length?e.default.createElement("span",{className:"dsh-hive-targets-inline"},"\u2192 "+o.targets.map(J=>"@"+J).join(" ")):null,o.channel&&o.channel!=="main"?e.default.createElement("span",{className:"dsh-hive-channel-pill"},"#",o.channel):null),e.default.createElement("span",{className:"dsh-hive-post-stamp"},e.default.createElement("span",{className:"dsh-hive-mono"},"#",o.seq),o.time?e.default.createElement("time",{dateTime:o.time,title:new Date(o.time).toLocaleString()}," \xB7 "+wo(o.time)):null)),e.default.createElement("div",{className:"dsh-hive-post-body","data-clamped":c?"true":void 0,onClick:c?J=>{J.target?.closest?.("a, button, code, pre")||globalThis.getSelection?.()?.toString?.()||k(!0)}:void 0},e.default.createElement(Oe,{text:o.text,onJumpPost:m})),y&&!i?e.default.createElement("button",{type:"button",className:"dsh-hive-expand-btn","aria-expanded":N,onClick:()=>k(J=>!J)},N?"Show less":"Show more"):null))}function Mo({state:o,controller:n,focusedSeq:d,onClearFocus:p,mentionRequest:m,onConsumeMention:i,onJumpPost:N,onOpenSession:k}){let[C,y]=(0,e.useState)(""),[c,w]=(0,e.useState)("*"),[x,b]=(0,e.useState)("*"),[P,q]=(0,e.useState)(""),[z,J]=(0,e.useState)("main"),[g,T]=(0,e.useState)(!0),[G,$]=(0,e.useState)(!1),[O,h]=(0,e.useState)(!1),W=(0,e.useRef)(null),Z=(0,e.useRef)(null),re=(0,e.useMemo)(()=>ot(o.team),[o.team]),pe=(0,e.useMemo)(()=>new Map(re.map(f=>[f.name,f])),[re]);(0,e.useEffect)(()=>{if(!m?.name)return;let f="@"+m.name;q(te=>new RegExp("(?:^|[^a-z0-9_])@"+m.name+"(?![a-z0-9_-])","i").test(te)?te:f+" "+te),Z.current?.focus?.(),i?.()},[m,i]);let ie=(0,e.useMemo)(()=>{let f=new Set(["user","coordinator"]),te=[];for(let Y of o.team.members)Y?.name&&!f.has(Y.name)&&(f.add(Y.name),te.push({value:Y.name,label:Y.name}));for(let Y of o.history)Y?.author&&Y.author!=="system"&&!f.has(Y.author)&&(f.add(Y.author),te.push({value:Y.author,label:Y.author}));return[{value:"*",label:"Everyone"},{value:"user",label:"You (user)"},{value:"coordinator",label:"Coordinator"},...te]},[o.team.members,o.history]),L=o.history.filter(f=>(c==="*"||(f.channel??"main")===c)&&(x==="*"||f.author===x)&&(!C||f.text?.toLowerCase().includes(C.toLowerCase())));(0,e.useEffect)(()=>{if(d==null)return;!L.some(te=>te.seq===d)&&o.history.some(te=>te.seq===d)&&(y(""),w("*"),b("*")),T(!1),W.current?.querySelector?.('[data-seq="'+d+'"]')?.scrollIntoView?.({block:"nearest"})},[d,o.history.length,L.length]),(0,e.useEffect)(()=>{g&&W.current&&(W.current.scrollTop=W.current.scrollHeight,h(!1))},[g,L.length]);let R=o.team.members.filter(f=>f.status==="working"),a=c!=="*"||x!=="*"||!g;async function A(f){if(f.preventDefault(),!!P.trim())try{await n.command("post_message",{text:P.trim(),channel:z}),q(""),p?.()}catch{}}let r=()=>{let f=W.current;f&&h(f.scrollHeight-f.scrollTop-f.clientHeight>48)},M=()=>{T(!0),h(!1),W.current&&(W.current.scrollTop=W.current.scrollHeight)};return e.default.createElement("div",{className:"dsh-hive-board"},R.length?e.default.createElement("section",{className:"dsh-hive-live","aria-label":"Live activity"},e.default.createElement("h3",null,"Live activity"),e.default.createElement("ul",null,R.map(f=>{let Y=o.team.activity?.[f.name]?.steps?.at(-1);return e.default.createElement("li",{key:f.name},e.default.createElement("strong",null,"@",f.name),e.default.createElement("span",null,Y?Y.label+(Y.detail?" \xB7 "+Y.detail:""):"Working\u2026"))}))):null,e.default.createElement("div",{className:"dsh-hive-toolbar"},e.default.createElement("div",{className:"dsh-hive-board-bar"},e.default.createElement("label",{className:"dsh-hive-search-box"},e.default.createElement(Ut,null),e.default.createElement("input",{type:"search","aria-label":"Search board",placeholder:"Search",value:C,onChange:f=>y(f.target.value)})),e.default.createElement("button",{type:"button",className:"dsh-hive-filter-btn","aria-label":"Toggle board filters","aria-expanded":G,"data-active":a?"true":void 0,onClick:()=>$(f=>!f)},e.default.createElement(xo,null))),e.default.createElement("div",{className:"dsh-hive-filter-drawer",hidden:!G},e.default.createElement("div",{className:"dsh-hive-filters"},e.default.createElement("label",null,"Channel",e.default.createElement("select",{value:c,onChange:f=>w(f.target.value)},e.default.createElement("option",{value:"*"},"All channels"),o.team.channels.filter(f=>!f.archived).map(f=>e.default.createElement("option",{key:f.name},f.name)))),e.default.createElement("label",null,"Author",e.default.createElement("select",{"aria-label":"Author",value:x,onChange:f=>b(f.target.value)},ie.map(f=>e.default.createElement("option",{key:f.value,value:f.value},f.label)))),e.default.createElement("button",{type:"button","aria-pressed":g,onClick:()=>T(f=>!f)},"Follow")),e.default.createElement("div",{className:"dsh-hive-actions"},e.default.createElement("button",{type:"button",disabled:o.historyLoading,onClick:()=>{n.loadHistory({reset:!0})}},"Load earlier history"),o.hasMoreHistory?e.default.createElement("button",{type:"button",disabled:o.historyLoading,onClick:()=>{n.loadHistory()}},"Load next history page"):null,o.historyLoading?e.default.createElement("span",{role:"status",className:"dsh-hive-secondary"},"Loading history\u2026"):null))),e.default.createElement("div",{className:"dsh-hive-feed-wrap"},L.length?e.default.createElement("ol",{ref:W,onScroll:r,className:"dsh-hive-feed","aria-label":"Board posts"},L.map(f=>{let te=pe.get(f.author),Y=f.author==="coordinator"||te?.role==="coordinator",Me=!!(Le(te)||Y&&typeof o.team.parentSessionId=="string"&&o.team.parentSessionId.trim());return e.default.createElement(ko,{key:f.seq,event:f,member:te,canOpenSession:Me,onOpenSession:k,onJumpPost:N,focused:d===f.seq})})):e.default.createElement("p",{role:"status",className:"dsh-hive-secondary"},"No posts match these filters."),(!g||O)&&L.length?e.default.createElement("button",{type:"button",className:"dsh-hive-latest-pill","aria-label":"Jump to latest posts",onClick:M},"\u2193 Latest"):null),e.default.createElement("form",{className:"dsh-hive-compose",onSubmit:A},e.default.createElement("label",{className:"sr-only",htmlFor:"dsh-hive-compose-input"},"Post to the board"),e.default.createElement("textarea",{id:"dsh-hive-compose-input",ref:Z,required:!0,rows:"2",maxLength:"6000",value:P,onChange:f=>q(f.target.value),placeholder:"Send a message or @mention a member\u2026"}),e.default.createElement("div",{className:"dsh-hive-actions dsh-hive-compose-foot"},e.default.createElement("label",{className:"dsh-hive-channel-pick"},e.default.createElement("span",null,"Channel"),e.default.createElement("select",{value:z,onChange:f=>J(f.target.value)},o.team.channels.filter(f=>!f.archived).map(f=>e.default.createElement("option",{key:f.name},f.name)))),e.default.createElement("button",{type:"submit",className:"dsh-hive-primary",disabled:o.pending||!P.trim()},"Post message"))))}function So({state:o,controller:n,member:d,opener:p,onClose:m}){let[i,N]=(0,e.useState)(""),[k,C]=(0,e.useState)(""),[y,c]=(0,e.useState)(!1),[w,x]=(0,e.useState)(d?.model??""),[b,P]=(0,e.useState)(d?.effort??""),[q,z]=(0,e.useState)(!1);(0,e.useEffect)(()=>{n.loadModels()},[n]);let J=o.models.find(O=>O.id===w),g=!w||!!J,T=!b||!!J?.efforts?.includes(b),G=!!(d&&["waiting","failed","quota"].includes(d.status)&&!d.recoveryRequired);async function $(O){O.preventDefault();try{d?await n.command("set_member_model",{member:d.name,model:w,effort:b||null,resume:!!(G&&q)}):await n.command("add_member",{member:{name:i,brief:k,writable:y,...w?{model:w}:{},...b?{effort:b}:{}}}),m()}catch{}}return e.default.createElement(nt,{title:d?"Change model":"Add member",onClose:m,opener:p},e.default.createElement("form",{onSubmit:$,className:"dsh-hive-form"},d?e.default.createElement("p",null,"Apply to the next turn for @",d.name,"."):e.default.createElement(e.default.Fragment,null,e.default.createElement("label",null,"Member name",e.default.createElement("input",{required:!0,pattern:"[a-z][a-z0-9_\\-]*",maxLength:"30",value:i,onChange:O=>N(O.target.value)})),e.default.createElement("label",null,"Assignment",e.default.createElement("textarea",{required:!0,rows:"4",maxLength:"6000",value:k,onChange:O=>C(O.target.value)})),e.default.createElement("label",{className:"dsh-hive-check"},e.default.createElement("input",{type:"checkbox",checked:y,onChange:O=>c(O.target.checked)}),"Request workspace write access"),e.default.createElement("p",{className:"dsh-hive-secondary"},"The Host verifies workspace scope and permission before execution.")),e.default.createElement("label",null,"Model",e.default.createElement("select",{value:w,disabled:o.modelsLoading,onChange:O=>{x(O.target.value),P("")}},e.default.createElement("option",{value:""},d?"Choose a model":"Use the team model"),w&&!J?e.default.createElement("option",{value:w},w," (unavailable)"):null,o.models.map(O=>e.default.createElement("option",{key:O.id,value:O.id},O.label)))),o.modelsLoading?e.default.createElement("p",{role:"status"},"Loading native models\u2026"):o.models.length?null:e.default.createElement("p",null,"No models are available. Enable a model in DSH, then reload the model list."),g?null:e.default.createElement("p",{role:"alert"},"This model is unavailable. Choose a model from the native catalog."),e.default.createElement("label",null,"Reasoning effort",e.default.createElement("select",{value:b,disabled:!J,onChange:O=>P(O.target.value)},e.default.createElement("option",{value:""},"Model default"),J?.efforts?.map(O=>e.default.createElement("option",{key:O},O)))),G?e.default.createElement("label",{className:"dsh-hive-check"},e.default.createElement("input",{type:"checkbox",checked:q,onChange:O=>z(O.target.checked)}),"Resume now"):null,o.error?e.default.createElement("p",{role:"alert"},o.error.message):null,e.default.createElement("div",{className:"dsh-hive-actions"},e.default.createElement("button",{type:"button",disabled:o.modelsLoading,onClick:()=>{n.loadModels()}},"Reload models"),e.default.createElement("button",{type:"submit",className:"dsh-hive-primary",disabled:o.pending||!g||!T||d&&!w||!d&&(!i||!k.trim())},o.pending?"Saving\u2026":d?"Apply model":"Add member"))))}function No({workspace:o}){let n=[o?.cwd,o?.path,o].find(d=>typeof d=="string"&&d.trim());return n?e.default.createElement("dl",{className:"dsh-hive-member-workspace"},e.default.createElement("div",null,e.default.createElement("dt",null,"Workspace"),e.default.createElement("dd",{title:n},n))):null}function Co({state:o,controller:n,onJournal:d,onOpenSession:p,onMention:m}){let[i,N]=(0,e.useState)(""),[k,C]=(0,e.useState)(null),[y,c]=(0,e.useState)(null),[w,x]=(0,e.useState)(null),b=o.history.length?o.history:o.team.events??[],P=(0,e.useMemo)(()=>{let h=new Map;for(let W of b)W.kind!=="brief"&&W.author!=="system"&&h.set(W.author,W);return h},[b]),q=(0,e.useMemo)(()=>new Map(ot(o.team).map(h=>[h.name,h.tint])),[o.team]),z=i.trim().toLowerCase(),J=o.team.members.filter(h=>!z||[h.name,h.group,h.model,h.taskLabel,h.brief,...h.channels??[]].filter(Boolean).join(" ").toLowerCase().includes(z)),g=h=>h.role==="coordinator"||h.name==="coordinator"?0:h.recoveryRequired||["failed","quota"].includes(h.status)?1:h.status==="working"?2:["waiting","queued"].includes(h.status)?3:4,T=J.filter(h=>h.status!=="retired").sort((h,W)=>g(h)-g(W)),G=J.filter(h=>h.status==="retired"),$=h=>h?.stopPropagation?.(),O=h=>{let W=h.brief?.trim()??"",Z=W.length>220||/\n/.test(W),re=h.role==="coordinator"||h.name==="coordinator",pe=q.get(h.name),ie=!!Le(h),L=ie||re&&typeof o.team.parentSessionId=="string"&&o.team.parentSessionId.trim().length>0,R=P.get(h.name),a=h.recoveryRequired?"Outcome unconfirmed. Inspect the owned session before continuing.":Ot(h,o.team.activity?.[h.name],R)||Ae(W,180),A=re?"Coordinator":ut(h),r=re?null:pt(h.name,!1,pe),M=r?{"--tile-bg":r.bg,"--tile-border":r.border}:void 0,f=!re&&["done","retired"].includes(h.status),te=h.recoveryRequired||["working","failed","quota","stalled"].includes(h.status),Y=w===h.name,Me=ae=>{L&&(ae?.target?.closest?.('button, a, input, select, textarea, summary, details, .dsh-hive-row-menu, [role="button"]')||globalThis.getSelection?.()?.toString?.()||(x(null),p(h.name,ae.currentTarget)))},fe=L?ae=>{ae.target===ae.currentTarget&&(ae.key==="Enter"||ae.key===" ")&&(ae.preventDefault(),x(null),p(h.name,ae.currentTarget))}:void 0;return e.default.createElement("li",{key:h.name,className:"dsh-hive-member","data-role":re?"coordinator":"worker","data-status":h.status,"data-clickable":L?"true":void 0,"data-menu-open":Y?"true":void 0,tabIndex:L?0:void 0,title:L?"Click to open @"+h.name+" session":void 0,onClick:Me,onKeyDown:fe},e.default.createElement("div",{className:"dsh-hive-member-avatar","aria-hidden":"true"},e.default.createElement("div",{className:"dsh-hive-member-tile"+(re?" is-coordinator":""),style:M},e.default.createElement(Ee,{name:h.name,status:h.status,coordinator:re,tint:pe,muted:f,size:"md"})),h.status==="working"||h.recoveryRequired||["failed","quota"].includes(h.status)?e.default.createElement("span",{className:"dsh-hive-avatar-dot","data-tone":h.status==="working"?"working":"danger"}):null),e.default.createElement("div",{className:"dsh-hive-member-main"},e.default.createElement("div",{className:"dsh-hive-member-line1"},e.default.createElement("div",{className:"dsh-hive-member-ident"},e.default.createElement("h2",null,"@",h.name),e.default.createElement("span",{className:"dsh-hive-member-sub"},A)),e.default.createElement("div",{className:"dsh-hive-member-meta"},e.default.createElement(po,{mode:h.executionMode,subagentName:h.subagentName}),te?e.default.createElement(tt,{value:h.status,compactView:!0}):null,h.model?e.default.createElement("span",{className:"dsh-hive-member-model"},h.model,h.effort?" \xB7 "+h.effort:""):null,R?.seq?e.default.createElement("span",{className:"dsh-hive-mono dsh-hive-secondary"},"#",R.seq):null,e.default.createElement("div",{className:"dsh-hive-row-menu",onClick:$,onKeyDown:ae=>{ae.key==="Escape"&&($(ae),x(null))}},e.default.createElement("button",{type:"button",className:"dsh-hive-row-menu-btn","aria-label":"More actions for @"+h.name,"aria-expanded":Y,onClick:ae=>{$(ae),x(Y?null:h.name)}},"\u22EF"),e.default.createElement("div",{className:"dsh-hive-row-menu-pop","data-open":Y?"true":void 0},e.default.createElement("button",{type:"button",className:"dsh-hive-menu-item","aria-label":"Journal for "+h.name,disabled:!ie,onClick:ae=>{$(ae),x(null),d(h.name,ae.currentTarget)}},"Journal"),e.default.createElement("button",{type:"button",className:"dsh-hive-menu-item","aria-label":"Open session for @"+h.name,disabled:!L,onClick:ae=>{$(ae),x(null),p(h.name,ae.currentTarget)}},"Open session"),h.status!=="retired"&&!h.retireAfterTurn?e.default.createElement("button",{type:"button",className:"dsh-hive-menu-item","aria-label":"@mention @"+h.name+" on board",onClick:ae=>{$(ae),x(null),m(h.name)}},"@mention"):null,h.status==="working"?e.default.createElement("button",{type:"button",className:"dsh-hive-menu-item","aria-label":"Cancel turn for @"+h.name,disabled:o.pending,onClick:ae=>{$(ae),x(null),We(n,"cancel_turn",{member:h.name})}},"Cancel turn"):null,e.default.createElement("button",{type:"button",className:"dsh-hive-menu-item","aria-label":"Change model for @"+h.name,disabled:o.pending||h.status==="working"||h.status==="retired",onClick:ae=>{$(ae),x(null),C({member:h,opener:ae.currentTarget})}},"Change model"),e.default.createElement("button",{type:"button",className:"dsh-hive-menu-item","aria-label":"Retire @"+h.name,disabled:o.pending||h.status==="retired"||h.retireAfterTurn,onClick:ae=>{$(ae),x(null),c({member:h,opener:ae.currentTarget})}},h.retireAfterTurn?"Retiring after turn":"Retire"),h.workspace&&(h.status==="retired"||o.team.phase==="done")?e.default.createElement("button",{type:"button",className:"dsh-hive-menu-item",disabled:o.pending,"aria-label":"Clean worktree for @"+h.name,onClick:ae=>{$(ae),x(null),We(n,"remove_worktree",{member:h.name})}},"Clean worktree"):null,Z?e.default.createElement("details",{className:"dsh-hive-details dsh-hive-menu-brief",onClick:$},e.default.createElement("summary",null,"Full brief"),e.default.createElement("p",{className:"dsh-hive-prose"},W)):null)))),h.workspace||h.group||h.channels?.length||h.pendingWaitFor?.length||h.fallbackModel?e.default.createElement("div",{className:"dsh-hive-member-chips"},e.default.createElement(No,{workspace:h.workspace}),h.group?e.default.createElement("span",{className:"dsh-hive-chip"},"@",h.group):null,h.channels?.length?e.default.createElement("span",{className:"dsh-hive-chip"},h.channels.map(ae=>"#"+ae).join(" ")):null,h.pendingWaitFor?.length?e.default.createElement("span",{className:"dsh-hive-chip","data-tone":"wait"},"Waiting on ",h.pendingWaitFor.map(ae=>"@"+ae).join(", ")):null,h.fallbackModel?e.default.createElement("span",{className:"dsh-hive-chip"},"Fallback: ",h.fallbackModel,h.fallbackEffort?" \xB7 "+h.fallbackEffort:""):null):null,a?e.default.createElement("p",{className:"dsh-hive-member-preview",title:a},a):null,h.recoveryRequired?e.default.createElement("div",{className:"dsh-hive-actions dsh-hive-inline-actions",onClick:$},e.default.createElement(Re,{memberName:h.name,pending:o.pending||h.status==="working",controller:n})):null))};return e.default.createElement("div",{className:"dsh-hive-members-view"},e.default.createElement("div",{className:"dsh-hive-member-bar"},e.default.createElement("label",{className:"dsh-hive-search-box"},e.default.createElement(Ut,null),e.default.createElement("input",{type:"search","aria-label":"Find a member",placeholder:"Search members",value:i,onChange:h=>N(h.target.value)})),e.default.createElement("button",{type:"button",className:"dsh-hive-compact-btn",disabled:o.pending,onClick:h=>C({member:null,opener:h.currentTarget})},"Add member")),T.length?e.default.createElement("ul",{className:"dsh-hive-members"},T.map(O)):G.length?null:e.default.createElement("p",{className:"dsh-hive-secondary"},"No members match your search."),G.length?e.default.createElement("details",{className:"dsh-hive-retired-group",open:!0},e.default.createElement("summary",{className:"dsh-hive-retired-summary"},e.default.createElement("span",null,"RETIRED"),e.default.createElement("span",{className:"dsh-hive-retired-count"},G.length),e.default.createElement(ct,null)),e.default.createElement("ul",{className:"dsh-hive-members"},G.map(O))):null,k?e.default.createElement(So,{key:k.member?.name??"new",...k,state:o,controller:n,onClose:()=>C(null)}):null,y?e.default.createElement(nt,{title:"Retire "+y.member.name+"?",opener:y.opener,onClose:()=>c(null)},e.default.createElement("p",null,"This member will receive no further turns. Its Journal and session remain available."),o.error?e.default.createElement("p",{role:"alert"},o.error.message):null,e.default.createElement("button",{type:"button",disabled:o.pending,onClick:async()=>{try{await n.command("retire_member",{member:y.member.name}),c(null)}catch{}}},"Retire member")):null)}function To(){try{let o=globalThis.sessionStorage?.getItem?.(Ft);return o==="mentions"||o==="hive"?o:"hive"}catch{return"hive"}}function qo(o){try{globalThis.sessionStorage?.setItem?.(Ft,o)}catch{}}function Io(o){let n=typeof document<"u"?document.documentElement?.dataset?.theme:void 0;if(n==="dark"||n==="light")return n;try{if(o&&typeof getComputedStyle=="function"){let d=getComputedStyle(o),p=d.colorScheme;if(p==="dark"||p==="light")return p;let m=/rgba?\(\s*(\d+),\s*(\d+),\s*(\d+)/.exec(d.backgroundColor??"");if(m)return .299*Number(m[1])+.587*Number(m[2])+.114*Number(m[3])<128?"dark":"light"}}catch{}try{if(globalThis.matchMedia?.("(prefers-color-scheme: dark)")?.matches)return"dark"}catch{}return"light"}function zo(o,n){let d=Math.cos(n),p=Math.sin(n),m=(i,N)=>(o.x+i*d-N*p).toFixed(1)+","+(o.y+i*p+N*d).toFixed(1);return m(1,0)+" "+m(-8,-3.8)+" "+m(-6.1,0)+" "+m(-8,3.8)}function Lo(o,n,d){let p=n??[],m=!p.some(g=>(g.role==="coordinator"||g.name==="coordinator")&&!g.external)&&!p.some(g=>g.name==="user"),i=g=>m&&g==="user"?"coordinator":g,N=o.filter(g=>g.seq<=d&&Te.default.isPost(g)),k=N.at(-1)??null,C=d>=(o.at(-1)?.seq??0),y=p.find(g=>g.role==="coordinator"||g.name==="coordinator")??{name:"coordinator",role:"coordinator",status:"waiting"},c=p.filter(g=>g.role!=="coordinator"&&g.name!=="coordinator"),w=new Map;for(let g of N)w.set(i(g.author),g.seq);let x=[{id:"working",label:"Working",tone:"working",members:[]},{id:"waiting",label:"Waiting",tone:"waiting",members:[]},{id:"needs",label:"Needs you",tone:"needs",members:[]},{id:"done",label:"Done",tone:"done",members:[]}],b=new Map(x.map(g=>[g.id,g]));for(let g of c){let T=C?g.status:w.has(g.name)&&g.status==="done"?"done":"waiting",G=g.recoveryRequired||["failed","quota"].includes(T)?"needs":T==="working"?"working":["done","retired"].includes(T)?"done":"waiting";b.get(G).members.push({name:g.name,status:T,role:g.role??"worker",tint:g.tint,muted:["done","retired"].includes(T),latestSeq:w.get(g.name)??0,pendingWaitFor:g.pendingWaitFor??[]})}let P=x.filter(g=>g.members.length>0).map(g=>({...g,count:g.members.length})),q=b.get("done").members.length,z=b.get("needs").members.length?"stalled":b.get("working").members.length?"working":c.length&&q===c.length?"done":"waiting",J=[];if(b.get("done").members.length&&J.push({from:"done",to:"coordinator",kind:"done",label:"Tasks done"}),k){let g=i(k.author),T=g==="coordinator"?"coordinator":P.find($=>$.members.some(O=>O.name===g))?.id,G=[...(k.targets??[]).map(i),...k.coordinatorMention?["coordinator"]:[]];for(let $ of G){let O=$==="coordinator"?"coordinator":P.find(h=>h.members.some(W=>W.name===$))?.id;if(T&&O&&T!==O){J.push({from:T,to:O,kind:"message",label:"Message just sent",seq:k.seq});break}}}for(let g of P)for(let T of g.members)for(let G of T.pendingWaitFor??[]){let $=P.find(O=>O.members.some(h=>h.name===G))?.id;$&&$!==g.id&&!J.some(O=>O.kind==="waiting"&&O.from===g.id&&O.to===$)&&J.push({from:g.id,to:$,kind:"waiting",label:"Waiting on"})}return{currentSeq:k?.seq??0,lastPost:k,coordinator:{name:"coordinator",status:y.status,role:"coordinator",doneCount:q,totalWorkers:c.length,phase:z,latestSeq:w.get("coordinator")??0,tint:0},clusters:P,connectors:J}}function dt(o,n,d){return Array.from({length:6},(p,m)=>({x:o+d*Math.cos(m*Math.PI/3),y:n+d*Math.sin(m*Math.PI/3)}))}function Ht(o,n,d,p){if(!p.length)return[];let m=p.length,i=m<=2?m:m<=6?3:4,N=Math.ceil(m/i),k=d*1.48,C=Math.min(72,Math.max(46,k/i)),y=N===1?0:N===2?46:38,c=n-(N-1)*y/2+14;return p.map((w,x)=>{let b=Math.floor(x/i),P=Math.min(i,m-b*i),q=x%i,z=o+(q-(P-1)/2)*C,J=c+b*y;return{member:w,x:z,y:J,slotWidth:C,beeScale:N>=3?.9:1}})}function Ho(o,n,d){let p=o.clusters??[],m=18,i=new Map,N,k,C=[];if(!p.length)N=Math.max(76,Math.min(118,n*.24,d*.32)),k={x:n/2,y:d/2};else if(p.length===1){N=Math.max(76,Math.min(120,n*.24,(d-36)/(2*Math.sqrt(3)+.35)));let c=N*Math.sqrt(3)/2,w=d/2,x=c+m/2,b=p[0],P={x:n/2,y:w-x};k={x:n/2,y:w+x};let q={...b,x:P.x,y:P.y,radius:N,vertices:dt(P.x,P.y,N),slots:Ht(P.x,P.y,N,b.members)};C.push(q),i.set(b.id,q)}else{k={x:n/2,y:d*.7};let c=p.length===2?Math.PI*.44:p.length===3?Math.PI*.64:Math.PI*.74,w=c/(p.length-1),x=Math.max(110,Math.min(n*.34,k.y-82)),b=Math.min(x,2*x*Math.sin(w/2)),P=Math.max(46,(b-m)/2);N=Math.max(54,Math.min(92,P/(Math.sqrt(3)/2))),p.forEach((q,z)=>{let J=-Math.PI/2-c/2+z*w,g=k.x+Math.cos(J)*x,T=k.y+Math.sin(J)*x,G={...q,x:g,y:T,radius:N,vertices:dt(g,T,N),slots:Ht(g,T,N,q.members)};C.push(G),i.set(q.id,G)})}let y={id:"coordinator",x:k.x,y:k.y,radius:N,vertices:dt(k.x,k.y,N),model:o.coordinator};return i.set("coordinator",y),{width:n,height:d,radius:N,coordinator:y,clusters:C,cellsById:i}}function Pt(o,n){let d=o*Math.sqrt(3)/2,p=1/0;for(let m of[Math.PI/6,Math.PI/2,5*Math.PI/6,-Math.PI/6,-Math.PI/2,-5*Math.PI/6]){let i=Math.cos(n-m);i>1e-4&&(p=Math.min(p,d/i))}return p}function Po(o,n,d){let p=new Map;if(!o.length)return p;if(o.length>12||n<300)return Te.default.layout(o,n,d);let m=o.findIndex(b=>b.role==="coordinator"||b.name==="coordinator"),i=m>=0?[o[m],...o.filter((b,P)=>P!==m)]:o,N=42,k=42,C=Math.min(92,Math.max(58,n*.14)),y=n/2,c=(N+(d-k))/2,w=Math.max(56,Math.min(n*.38,n/2-C)),x=Math.max(46,(d-N-k)/2);return i.length===1?(p.set(i[0].name,{x:y,y:c}),p):(i.forEach((b,P)=>{let q=-Math.PI/2+P*(Math.PI*2/i.length);p.set(b.name,{x:y+Math.cos(q)*w,y:c+Math.sin(q)*x})}),p)}function Ao(o,n){if(typeof Te.default.nodeBox=="function"){let i=Te.default.nodeBox(o,{variant:"pill",narrow:n});if(i&&i.radius>=i.halfH-1)return i}let d=String(o?.name??""),p=n?14:16;return{halfW:Math.max(44,Math.min(96,24+d.length*4.1)),halfH:p,offsetX:0,offsetY:0,radius:p}}function Bo({state:o,controller:n,onJournal:d,onJumpPost:p}){let[m,i]=(0,e.useState)(To),[N,k]=(0,e.useState)(null),[C,y]=(0,e.useState)(!1),[c,w]=(0,e.useState)("even"),[x,b]=(0,e.useState)(1),[P,q]=(0,e.useState)(!1),[z,J]=(0,e.useState)(!1),[g,T]=(0,e.useState)(null),[G,$]=(0,e.useState)(null),[O,h]=(0,e.useState)(null),[W,Z]=(0,e.useState)({busy:!1,message:"",error:!1}),re=(0,e.useRef)(null),pe=(0,e.useRef)(null),ie=(0,e.useRef)(new Map),[L,R]=(0,e.useState)(480),a=(0,e.useId)().replaceAll(":","");(0,e.useEffect)(()=>{let s=pe.current;if(!s||typeof ResizeObserver>"u")return;let D=new ResizeObserver(S=>R(Math.max(280,S[0].contentRect.width)));return D.observe(s),()=>D.disconnect()},[]);let A=(0,e.useMemo)(()=>ot(o.team),[o.team]),r=(0,e.useMemo)(()=>o.history.filter(Te.default.isPost),[o.history]),M=N===null?r.length:Math.max(0,Math.min(r.length,r.findIndex(s=>s.seq>N)===-1?r.length:r.findIndex(s=>s.seq>N))),f=r[M-1],te=f?.seq??0;(0,e.useEffect)(()=>{if(!C)return;if(M>=r.length){y(!1);return}let s=Date.parse(r[M].time)-Date.parse(r[M-1]?.time),D=c==="real"&&Number.isFinite(s)?Math.max(110,Math.min(s,2e3)):620,S=setTimeout(()=>{k(r[M].seq)},D/x);return()=>clearTimeout(S)},[C,M,r,c,x]);let Y=s=>{y(!1),k(r[s-1]?.seq??0)},Me=()=>{if(C){y(!1);return}r.length&&((N===null||M>=r.length)&&k(0),y(!0))},fe=s=>{s!==m&&(i(s),qo(s),T(null),$(null))},ae=L<440,xe=Te.default.elapsedSpan(r.slice(0,M),{live:N===null&&["working","queued"].includes(o.team.phase)}),Ce=(0,e.useMemo)(()=>m!=="hive"?null:typeof Te.default.projectHive=="function"?Te.default.projectHive(r,A,te):Lo(r,A,te),[m,r,A,te]),Ne=(0,e.useMemo)(()=>{if(m!=="hive"||!Ce)return 420;let s=typeof Te.default.hiveMinimumHeight=="function"?Te.default.hiveMinimumHeight(Ce.clusters.length,L):Ce.clusters.length<=1?400:440;return Math.max(380,s)},[m,Ce,L]),ge=(0,e.useMemo)(()=>m!=="hive"||!Ce?null:typeof Te.default.layoutHive=="function"?Te.default.layoutHive(Ce,L,Ne):Ho(Ce,L,Ne),[m,Ce,L,Ne]),we=(0,e.useMemo)(()=>Te.default.project(r,A,te,{hideInactive:P,expandBroadcast:z}),[r,A,te,P,z]),t=(0,e.useMemo)(()=>typeof Te.default.mentionsMinimumHeight=="function"?Math.max(380,Te.default.mentionsMinimumHeight(we.nodes.length,L)):Math.max(380,Te.default.minimumHeight(we.nodes.length,L)),[we.nodes.length,L]),l=(0,e.useMemo)(()=>m!=="mentions"?new Map:typeof Te.default.layoutMentions=="function"?Te.default.layoutMentions(we.nodes,L,t):Po(we.nodes,L,t),[m,we.nodes,L,t]);ao(()=>{if(m!=="mentions")return;let s=new Map,D=!1;for(let S of we.nodes){let I=ie.current.get(S.name);if(I&&I.offsetWidth>0&&I.offsetHeight>0){let F=I.offsetHeight/2,V={halfW:I.offsetWidth/2,halfH:F,offsetX:0,offsetY:0,radius:F};s.set(S.name,V);let ne=O?.get(S.name);(!ne||Math.abs(ne.halfW-V.halfW)>.5||Math.abs(ne.halfH-V.halfH)>.5)&&(D=!0)}}s.size&&(D||!O||O.size!==s.size)&&h(s)},[m,we.nodes,L,ae]);let u=(0,e.useMemo)(()=>{if(m!=="mentions")return null;if(O&&O.size===we.nodes.length)return O;let s=new Map;for(let D of we.nodes)s.set(D.name,O?.get(D.name)??Ao(D,ae));return s},[m,we.nodes,O,ae]),v=(0,e.useMemo)(()=>m!=="mentions"?[]:Te.default.routeEdges(we,l,{variant:"pill",boxes:u,narrow:ae,marginStart:5,marginEnd:6,obstacleMargin:ae?14:22}),[m,we,l,u,ae]),E=G?G.split(">"):null,j=(0,e.useMemo)(()=>{if(E)return new Set(E);if(!g)return null;let s=new Set([g]);for(let D of we.links)D.from===g&&s.add(D.to),D.to===g&&s.add(D.from);return s},[g,G,we.links]),ee=m==="hive"?Ne:t,oe=g?A.find(s=>s.name===g):null,Q=typeof Te.default.shouldMergeUserToCoordinator=="function"?Te.default.shouldMergeUserToCoordinator(A):!A.some(s=>(s.role==="coordinator"||s.name==="coordinator")&&!s.external)&&!A.some(s=>s.name==="user"),se=s=>s==="user"?"You":s==="system"?"System":s,B=s=>s==="user"?"You":s==="system"?"System":"@"+s,H=Q&&f?.author==="user"?"coordinator":f?.author;async function ce(){if(!r.length||W.busy)return;let s=(typeof globalThis.HiveGif?.exportGraphReplayGif=="function"?globalThis.HiveGif:null)??Bt.default;if(typeof s?.exportGraphReplayGif!="function"){Z({busy:!1,message:"GIF export is unavailable until the GIF module is bundled.",error:!0});return}Z({busy:!0,message:"Rendering GIF replay\u2026",error:!1});try{let D=Io(re.current),S=await Promise.resolve(s.exportGraphReplayGif({mode:m,posts:r,members:A,phase:o.team.phase,pacing:c,speed:x,hideInactive:P,expandBroadcast:z,focus:g,theme:D,width:Math.max(480,Math.round(L)),height:Math.max(360,Math.round(ee)),graph:Te.default,bees:De.default})),I=typeof Blob<"u"&&S?.blob instanceof Blob?S.blob:S?.bytes&&typeof Blob<"u"?new Blob([S.bytes],{type:"image/gif"}):null;if(!I&&!S?.bytes)throw Error("GIF encoder returned empty data.");let V=((o.team.title||"hive-swarm").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"hive-swarm")+"-graph.gif";if(I&&typeof URL.createObjectURL=="function"&&typeof document<"u"&&typeof document.createElement=="function"){let ne=URL.createObjectURL(I),X=document.createElement("a");X.href=ne,X.download=V,X.style.display="none",document.body?.appendChild?.(X),X.click?.(),X.remove?.(),setTimeout(()=>{try{URL.revokeObjectURL(ne)}catch{}},1e3)}Z({busy:!1,message:"Exported "+V+(S.frameCount?" ("+S.frameCount+" frames)":"")+".",error:!1})}catch(D){Z({busy:!1,message:"GIF export failed: "+(D?.message??String(D)),error:!0})}}let _=s=>s==="done"?"done":s==="working"||s==="active"?"working":s==="needs"||s==="stalled"||s==="blocked"?"needs":"waiting";return e.default.createElement("div",{ref:re,className:"dsh-hive-graph-view"},e.default.createElement("div",{className:"dsh-hive-graph-controls"},e.default.createElement("div",{className:"dsh-hive-replay-row1"},e.default.createElement("div",{className:"dsh-hive-actions dsh-hive-transport"},e.default.createElement("button",{type:"button","aria-label":"First post",disabled:!r.length||M===1,onClick:()=>Y(1)},"|\u2039"),e.default.createElement("button",{type:"button","aria-label":"Previous post",disabled:M===0,onClick:()=>Y(Math.max(0,M-1))},"\u2039"),e.default.createElement("button",{type:"button","aria-label":C?"Pause replay":"Replay",disabled:!r.length,onClick:Me},C?"\u2161":"\u25B6"),e.default.createElement("button",{type:"button","aria-label":"Next post",disabled:M>=r.length,onClick:()=>Y(M+1)},"\u203A")),e.default.createElement("input",{className:"dsh-hive-scrubber","aria-label":"Replay through post",type:"range",min:"0",max:r.length,value:M,onChange:s=>Y(Number(s.target.value))}),e.default.createElement("button",{type:"button",className:"dsh-hive-live-btn","aria-pressed":N===null,onClick:()=>{y(!1),k(null)}},e.default.createElement("span",{className:"dsh-hive-status-dot","aria-hidden":"true"}),"Live")),e.default.createElement("div",{className:"dsh-hive-replay-row2"},e.default.createElement("span",{className:"dsh-hive-graph-stat"},e.default.createElement("strong",null,r.length," posts")," over ",xe,N!==null?" \xB7 "+M+"/"+r.length:""),e.default.createElement("div",{className:"dsh-hive-segmented",role:"group","aria-label":"Graph view mode"},e.default.createElement("button",{type:"button","aria-pressed":m==="hive",onClick:()=>fe("hive")},"Hive"),e.default.createElement("button",{type:"button","aria-pressed":m==="mentions",onClick:()=>fe("mentions")},"Mentions")),e.default.createElement("div",{className:"dsh-hive-graph-options"},e.default.createElement("label",{className:"dsh-hive-inline-select"},e.default.createElement("span",{className:"dsh-hive-sr-only"},"Pacing"),e.default.createElement("select",{"aria-label":"Pacing",value:c,onChange:s=>w(s.target.value)},e.default.createElement("option",{value:"even"},"Even pacing"),e.default.createElement("option",{value:"real"},"Real-time"))),e.default.createElement("label",{className:"dsh-hive-inline-select"},e.default.createElement("span",{className:"dsh-hive-sr-only"},"Speed"),e.default.createElement("select",{"aria-label":"Speed",value:x,onChange:s=>b(Number(s.target.value))},e.default.createElement("option",{value:"0.5"},"0.5\xD7"),e.default.createElement("option",{value:"1"},"1\xD7"),e.default.createElement("option",{value:"2"},"2\xD7"),e.default.createElement("option",{value:"4"},"4\xD7"))),m==="mentions"?e.default.createElement("div",{className:"dsh-hive-graph-toggles"},e.default.createElement("label",{className:"dsh-hive-switch"},e.default.createElement("input",{type:"checkbox",role:"switch",className:"dsh-hive-switch-input",checked:P,onChange:s=>q(s.target.checked)}),e.default.createElement("span",{className:"dsh-hive-switch-track","aria-hidden":"true"}),e.default.createElement("span",null,"Hide inactive")),e.default.createElement("label",{className:"dsh-hive-switch"},e.default.createElement("input",{type:"checkbox",role:"switch",className:"dsh-hive-switch-input",checked:z,onChange:s=>J(s.target.checked)}),e.default.createElement("span",{className:"dsh-hive-switch-track","aria-hidden":"true"}),e.default.createElement("span",null,"Expand @all"))):null,e.default.createElement("button",{type:"button",className:"dsh-hive-export-gif",disabled:!r.length||W.busy,onClick:()=>{ce()}},e.default.createElement("span",{"aria-hidden":"true"},"\u2B07"),W.busy?"Exporting\u2026":"Export GIF"),o.hasMoreHistory?e.default.createElement("button",{type:"button",className:"dsh-hive-ghost-btn",disabled:o.historyLoading,onClick:()=>{n.loadHistory()}},"Load earlier"):null)),W.message?e.default.createElement("p",{role:"status",className:W.error?"dsh-hive-gif-error":"dsh-hive-secondary"},W.message):null),m==="hive"&&ge?e.default.createElement(e.default.Fragment,null,e.default.createElement("div",{ref:pe,className:"dsh-hive-graph dsh-hive-graph-hive",style:{height:Ne},role:"group","aria-label":"Hive cluster graph"},e.default.createElement("svg",{width:"100%",height:Ne,viewBox:"0 0 "+L+" "+Ne,"aria-hidden":"true"},e.default.createElement("defs",null,e.default.createElement("marker",{id:a,markerUnits:"userSpaceOnUse",markerWidth:"10",markerHeight:"10",refX:"8.5",refY:"5",orient:"auto"},e.default.createElement("path",{d:"M0.5 1.2L9.5 5L0.5 8.8L2.4 5Z",fill:"context-stroke"}))),ge.clusters.map(s=>e.default.createElement("g",{key:s.id,className:"dsh-hive-hex-cell","data-tone":_(s.tone)},e.default.createElement("polygon",{points:s.vertices.map(D=>D.x.toFixed(1)+","+D.y.toFixed(1)).join(" "),className:"dsh-hive-hex-poly"}),e.default.createElement("text",{x:s.x,y:s.y-s.radius*.56,textAnchor:"middle",className:"dsh-hive-hex-title"},s.label),e.default.createElement("text",{x:s.x,y:s.y-s.radius*.41,textAnchor:"middle",className:"dsh-hive-hex-count"},s.count))),e.default.createElement("g",{className:"dsh-hive-hex-cell","data-role":"coordinator","data-tone":_(ge.coordinator.model.phase==="done"?"done":ge.coordinator.model.phase==="stalled"?"needs":"working")},e.default.createElement("polygon",{points:ge.coordinator.vertices.map(s=>s.x.toFixed(1)+","+s.y.toFixed(1)).join(" "),className:"dsh-hive-hex-poly"}),e.default.createElement("text",{x:ge.coordinator.x,y:ge.coordinator.y+ge.coordinator.radius*.34,textAnchor:"middle",className:"dsh-hive-hex-title"},"Coordinator"),e.default.createElement("text",{x:ge.coordinator.x,y:ge.coordinator.y+ge.coordinator.radius*.5,textAnchor:"middle",className:"dsh-hive-hex-count"},ge.coordinator.model.doneCount," of ",ge.coordinator.model.totalWorkers," done")),(Ce?.connectors??[]).map((s,D)=>{let S=ke=>ge.cellsById?.get?.(ke)??ge.cellsById?.[ke]??(ke==="coordinator"?ge.coordinator:ge.clusters.find(qe=>qe.id===ke)),I=S(s.from),F=S(s.to);if(!I||!F||I===F)return null;let V=F.x-I.x,ne=F.y-I.y,X=Math.hypot(V,ne);if(X<2)return null;let de=Math.atan2(ne,V),K=s.kind==="message"?8:s.kind==="waiting"?-8:0,le=K?6:3,he=Pt(I.radius,de)+le,me=Pt(F.radius,de+Math.PI)+le;if(he+me>=X)return null;let Se=-Math.sin(de),ue=Math.cos(de),U=I.x+Math.cos(de)*he+Se*K,ve=I.y+Math.sin(de)*he+ue*K,be=F.x-Math.cos(de)*me+Se*K,ye=F.y-Math.sin(de)*me+ue*K;return e.default.createElement("line",{key:s.from+">"+s.to+":"+s.kind+":"+D,x1:U.toFixed(1),y1:ve.toFixed(1),x2:be.toFixed(1),y2:ye.toFixed(1),className:"dsh-hive-hex-connector","data-kind":s.kind,strokeDasharray:s.kind==="waiting"?"4 4":void 0,markerEnd:s.kind==="waiting"?"url(#"+a+")":void 0})})),ge.clusters.flatMap(s=>s.slots.map(D=>{let S=D.member,I=g===S.name;return e.default.createElement("button",{key:S.name,type:"button",className:"dsh-hive-hex-bee-btn","data-status":S.status,"aria-pressed":I,style:{left:D.x/L*100+"%",top:D.y,maxWidth:D.slotWidth},title:"@"+S.name+" \xB7 "+(_e[S.status]??S.status),"aria-label":"Inspect @"+S.name+" ("+(_e[S.status]??S.status)+")",onClick:()=>T(I?null:S.name)},e.default.createElement(Ee,{name:S.name,status:S.status,tint:S.tint,muted:S.muted,size:"hive"}),e.default.createElement("span",{className:"dsh-hive-hex-bee-name"},S.name))})),e.default.createElement("button",{type:"button",className:"dsh-hive-hex-coord-btn","aria-pressed":g==="coordinator",style:{left:ge.coordinator.x/L*100+"%",top:ge.coordinator.y-ge.coordinator.radius*.14},"aria-label":"Inspect Coordinator",onClick:()=>T(g==="coordinator"?null:"coordinator")},e.default.createElement(Ee,{name:"coordinator",status:ge.coordinator.model.phase==="working"?"working":"active",coordinator:!0,size:"lg"}))),e.default.createElement("div",{className:"dsh-hive-graph-legend"},e.default.createElement("span",{className:"dsh-hive-legend-item","data-legend":"done"},"Tasks done"),e.default.createElement("span",{className:"dsh-hive-legend-item","data-legend":"message"},"Message just sent"),e.default.createElement("span",{className:"dsh-hive-legend-item","data-legend":"waiting"},"Waiting on"))):e.default.createElement(e.default.Fragment,null,e.default.createElement("div",{ref:pe,className:"dsh-hive-graph dsh-hive-graph-mentions",style:{height:t},role:"group","aria-label":"Message flow graph"},e.default.createElement("svg",{width:"100%",height:t,viewBox:"0 0 "+L+" "+t,"aria-hidden":"true"},e.default.createElement("defs",null,e.default.createElement("marker",{id:a,markerUnits:"userSpaceOnUse",markerWidth:"10",markerHeight:"10",refX:"8.5",refY:"5",orient:"auto"},e.default.createElement("path",{d:"M0.5 1.2L9.5 5L0.5 8.8L2.4 5Z",fill:"context-stroke"}))),v.map(({link:s,edge:D})=>{let S=s.from+">"+s.to,I=!!(f&&s.lastSeq===f.seq),F=G===S,V=G?F:!g||g===s.from||g===s.to,ne=F||I&&V,X=Math.min(4.2,1.1+Math.sqrt(s.count)*.72),de=V&&D.length>=36&&(s.count>1||ne||F),K=String(s.count),le=Math.max(18,K.length*7+8);return e.default.createElement("g",{key:S,className:"dsh-hive-edge-group","data-active":ne?"true":void 0},e.default.createElement("path",{d:D.d,fill:"none",stroke:"transparent",strokeWidth:"14",className:"dsh-hive-edge-hit",onMouseEnter:()=>$(S),onMouseLeave:()=>$(he=>he===S?null:he)}),e.default.createElement("path",{"data-hive-edge":S,d:D.d,className:"dsh-hive-edge","data-active":ne?"true":void 0,strokeWidth:ne?Math.max(2.4,X+.4):X,strokeDasharray:s.direct?void 0:"4 4",opacity:V?ne?1:.72:.16,markerEnd:"url(#"+a+")"}),ne?e.default.createElement("polygon",{className:"dsh-hive-edge-tip",points:zo(D.end,D.endAngle)}):null,de?e.default.createElement("g",{className:"dsh-hive-edge-pill","data-active":ne?"true":void 0,transform:"translate("+D.mid.x.toFixed(1)+","+D.mid.y.toFixed(1)+")"},e.default.createElement("rect",{x:-le/2,y:"-8",width:le,height:"16",rx:"8"}),e.default.createElement("text",{textAnchor:"middle",dominantBaseline:"central"},K)):null)})),we.nodes.map(s=>{let D=l.get(s.name)??{x:L/2,y:t/2},S=Te.default.unmentionedNode(s),I=s.role==="coordinator"||s.name==="coordinator",F=s.status==="retired",V=!I&&["done","retired"].includes(s.status),ne=!!(j&&!j.has(s.name)),X=se(s.name);return e.default.createElement("button",{key:s.name,ref:de=>{de?ie.current.set(s.name,de):ie.current.delete(s.name)},type:"button",className:"dsh-hive-graph-pill","data-role":I?"coordinator":"worker","data-status":s.status??"observer","data-retired":F?"true":void 0,"data-unmentioned":S?"true":void 0,"data-dimmed":ne?"true":void 0,style:{left:D.x/L*100+"%",top:D.y},"aria-pressed":g===s.name,title:X+" \xB7 "+(_e[s.status]??s.status)+(S?" \xB7 Posted with no mention":""),onClick:()=>T(g===s.name?null:s.name)},e.default.createElement(Ee,{name:s.name,status:s.status,coordinator:I,tint:s.tint,muted:V,size:"sm"}),e.default.createElement("span",{className:"dsh-hive-graph-pill-name"},X),e.default.createElement("span",{className:"dsh-hive-node-dot","aria-hidden":"true"}),s.broadcasts?e.default.createElement("span",{className:"dsh-hive-node-broadcast"},"@all ",s.broadcasts):null)})),e.default.createElement("div",{className:"dsh-hive-graph-legend"},e.default.createElement("span",{className:"dsh-hive-legend-item","data-legend":"mention"},"@mention, width = count"),e.default.createElement("span",{className:"dsh-hive-legend-item","data-legend":"broadcast"},"via @all"),e.default.createElement("span",{className:"dsh-hive-legend-item","data-legend":"unmentioned"},"posted with no mention"),e.default.createElement("span",{className:"dsh-hive-legend-item","data-legend":"all-badge"},e.default.createElement("span",{className:"dsh-hive-all-badge"},"@all ",we.broadcasts),"@all posts, drawn by Expand @all"))),g&&oe?e.default.createElement("section",{className:"dsh-hive-selected-post"},e.default.createElement("div",{className:"dsh-hive-line"},e.default.createElement($e,{member:oe,name:oe.name==="user"?"You":void 0,coordinator:oe.role==="coordinator"||oe.name==="coordinator",muted:oe.status==="retired"}),e.default.createElement(tt,{value:oe.status}),e.default.createElement("div",{className:"dsh-hive-pill-group"},Le(oe)?e.default.createElement("button",{type:"button",onClick:s=>d(g,s.currentTarget)},"Inspect @",g," Journal"):null,e.default.createElement("button",{type:"button",className:"dsh-hive-ghost-btn",onClick:()=>T(null)},"Clear"))),f&&H===g?e.default.createElement(Oe,{text:f.text,onJumpPost:p}):null):null,f?e.default.createElement("section",{className:"dsh-hive-selected-post"},e.default.createElement("div",{className:"dsh-hive-line"},e.default.createElement("h3",null,"Selected post"),e.default.createElement("strong",null,B(f.author)),e.default.createElement(je,{seq:f.seq,onJumpPost:p})),e.default.createElement(Oe,{text:f.text,onJumpPost:p})):null,m==="mentions"&&(we.links.length?e.default.createElement("ul",{className:"dsh-hive-flow-list","aria-label":"Message flow counts"},we.links.filter(s=>!g||s.from===g||s.to===g).map(s=>e.default.createElement("li",{key:s.from+">"+s.to},B(s.from)," \u2192 ",B(s.to),": ",s.count," ",s.count===1?"mention":"mentions"))):e.default.createElement("p",{className:"dsh-hive-secondary"},"No directed mentions at this point in the replay.")))}function Fo(){try{return globalThis.localStorage?.getItem?.(Et)??null}catch{return null}}function Eo(o){try{globalThis.localStorage?.setItem?.(Et,o)}catch{}}function Wo({version:o,update:n}){let[d,p]=(0,e.useState)(!1),[m,i]=(0,e.useState)(!1),[N,k]=(0,e.useState)(()=>Fo()),C=(0,e.useRef)(null),y=typeof n?.latest=="string"?n.latest.trim():"",c=!!(n?.available===!0&&y&&ho.test(y)&&N!==y);if((0,e.useEffect)(()=>{c||p(!1)},[c,y]),(0,e.useEffect)(()=>{if(!d||typeof document>"u"||typeof document.addEventListener!="function")return;let z=g=>{C.current?.contains?.(g.target)||p(!1)},J=g=>{g.key==="Escape"&&p(!1)};return document.addEventListener("pointerdown",z),document.addEventListener("keydown",J),()=>{document.removeEventListener("pointerdown",z),document.removeEventListener("keydown",J)}},[d]),!c)return null;let w="dsh plugin --profile desktop add dsh-hive-swarm@"+y,x=_t(n?.url)??"https://github.com/snowmiku601-cpu/hive-swarm/releases/tag/v"+y,b=o||(typeof n?.current=="string"?n.current.trim():""),P=async()=>{try{await globalThis.navigator?.clipboard?.writeText?.(w)}catch{}i(!0),setTimeout(()=>i(!1),1800)},q=()=>{Eo(y),k(y),p(!1)};return e.default.createElement("div",{ref:C,className:"dsh-hive-update-wrap"},e.default.createElement("button",{type:"button",className:"dsh-hive-update-pill","aria-expanded":d,title:"Hive Swarm v"+y+" is available on npm",onClick:()=>p(z=>!z)},"\u2191 v",y," available"),d?e.default.createElement("div",{className:"dsh-hive-update-popover",role:"region","aria-label":"Update available"},e.default.createElement("div",{className:"dsh-hive-update-head"},e.default.createElement("strong",null,"Update available"),e.default.createElement("span",{className:"dsh-hive-mono"},b?"v"+b+" \u2192 v"+y:"v"+y)),e.default.createElement("p",{className:"dsh-hive-secondary"},"Close DSH Desktop after active turns finish, then run:"),e.default.createElement("code",{className:"dsh-hive-update-cmd"},w),e.default.createElement("div",{className:"dsh-hive-update-actions"},e.default.createElement("button",{type:"button",className:"dsh-hive-ghost-btn",onClick:()=>{P()}},m?"Copied":"Copy command"),e.default.createElement("a",{href:x,target:"_blank",rel:"noopener noreferrer"},"Release notes"),e.default.createElement("button",{type:"button",className:"dsh-hive-ghost-btn",onClick:q},"Dismiss"))):null)}var ht=["Overview","Board","Members","Graph"];function Gt({controller:o,onExpand:n,mode:d="dock",visible:p=!0}){let m=(0,e.useSyncExternalStore)(o.subscribe,o.getSnapshot,o.getSnapshot),i={...m,pending:m.pending||m.connection!=="connected"},[N,k]=(0,e.useState)("Overview"),[C,y]=(0,e.useState)(null),[c,w]=(0,e.useState)(!1),[x,b]=(0,e.useState)(""),[P,q]=(0,e.useState)(null),[z,J]=(0,e.useState)(null),g=(0,e.useRef)([]),T=(0,e.useId)().replace(/[^a-zA-Z0-9_-]/g,""),G=(0,e.useRef)(!1);(0,e.useEffect)(()=>{if(!p)return;let r=o.retain();return()=>{G.current&&(o.closeJournal(),G.current=!1),r()}},[o,p]),(0,e.useEffect)(()=>{w(!1),q(null),J(null)},[i.team?.id]);let $=(r,M)=>{G.current=!0,y({opener:M,controller:o}),o.openJournal(r)},O=async(r,M)=>{await o.openSession(r,{fallbackToJournal:!1})==="fallback"&&$(r,M)},h=()=>{G.current=!1,y(null),o.closeJournal()},W=r=>{q(r),k("Board"),i.history.some(M=>M.seq===r)||o.loadHistory({reset:!0})},Z=r=>{J({name:r,id:Date.now()}),k("Board")},re=r=>{k(r);let M=ht.indexOf(r);g.current[M]?.scrollIntoView?.({block:"nearest",inline:"nearest"})};function pe(r,M){let f={ArrowRight:(M+1)%4,ArrowLeft:(M+3)%4,Home:0,End:3}[r.key];f!==void 0&&(r.preventDefault(),re(ht[f]),g.current[f]?.focus())}async function ie(r){r.preventDefault();let M=x.trim();if(M)try{await o.command("set_team_title",{title:M}),w(!1)}catch{}}let L=(0,e.useMemo)(()=>(i.history.length?i.history:i.team?.events??[]).filter(Te.default.isPost).length,[i.history,i.team?.events]),R=(0,e.useMemo)(()=>i.team?i.team.members.filter(r=>r.status!=="retired").length:0,[i.team]),a={Board:L,Members:R},A=typeof i.version=="string"&&i.version.trim()||lo;return e.default.createElement("div",{className:"dsh-hive","data-dsh-hive-swarm":d},e.default.createElement("style",null,qt),e.default.createElement("header",{className:"dsh-hive-header"},e.default.createElement("div",{className:"dsh-hive-header-top"},e.default.createElement("div",{className:"dsh-hive-title-wrap"},e.default.createElement(et,{size:20}),e.default.createElement("h1",null,i.team?.title??"Hive Swarm")),e.default.createElement("div",{className:"dsh-hive-header-meta"},e.default.createElement("div",{className:"dsh-hive-header-status-row"},i.team?e.default.createElement(tt,{value:i.team.paused?"paused":i.team.phase,compactView:!0}):null,A?e.default.createElement("span",{className:"dsh-hive-version-tag",title:"Hive Swarm v"+A},"v",A):null),e.default.createElement(Wo,{version:A,update:i.update}))),i.team&&c?e.default.createElement("form",{className:"dsh-hive-rename",onSubmit:ie},e.default.createElement("input",{"aria-label":"Swarm title",maxLength:"95",required:!0,value:x,onChange:r=>b(r.target.value)}),e.default.createElement("button",{type:"submit",disabled:i.pending||!x.trim()},"Save"),e.default.createElement("button",{type:"button",onClick:()=>w(!1)},"Cancel")):null,e.default.createElement("div",{className:"dsh-hive-header-actions"},e.default.createElement("select",{"aria-label":"Team",value:i.team?.id??"",disabled:i.loading||m.pending,onChange:r=>o.selectTeam(r.target.value)},e.default.createElement("option",{value:""},"Choose a team"),i.teams.map(r=>e.default.createElement("option",{key:r.id,value:r.id},r.title," \xB7 ",r.cwd))),i.team&&!c?e.default.createElement("button",{type:"button",className:"dsh-hive-compact-btn",disabled:i.pending,onClick:()=>{b(i.team.title??""),w(!0)}},"Rename"):null,e.default.createElement("button",{type:"button",className:"dsh-hive-compact-btn",disabled:i.loading,onClick:o.refresh},"Refresh"),i.team?e.default.createElement("button",{type:"button",className:"dsh-hive-compact-btn",disabled:i.pending,onClick:()=>We(o,i.team.paused?"resume_team":"pause_team")},i.team.paused?"Resume":"Pause"):null,n?e.default.createElement("button",{type:"button",className:"dsh-hive-compact-btn","aria-label":"Open full view",onClick:()=>n(o)},"Open full view"):null),i.loading||i.connection==="disconnected"||m.pending||!i.team?e.default.createElement("p",{className:"dsh-hive-secondary dsh-hive-context",role:"status"},i.loading?"Loading Swarm\u2026":i.connection==="disconnected"?"Disconnected \xB7 refresh to reconnect":m.pending?"Saving action\u2026":i.workspace??"Teams in the Host\u2019s permitted workspace scope"):null),i.error?e.default.createElement(jt,{error:i.error,controller:o}):null,i.team?e.default.createElement(e.default.Fragment,null,e.default.createElement("nav",{role:"tablist","aria-label":"Swarm views",className:"dsh-hive-tabs"},ht.map((r,M)=>e.default.createElement("button",{key:r,ref:f=>{g.current[M]=f},type:"button",role:"tab",id:T+"-tab-"+r,"aria-controls":T+"-panel-"+r,"aria-selected":N===r,tabIndex:N===r?0:-1,onClick:()=>re(r),onKeyDown:f=>pe(f,M)},r,Object.hasOwn(a,r)?e.default.createElement("span",{className:"dsh-hive-tab-count"},a[r]):null))),e.default.createElement("section",{role:"tabpanel",tabIndex:"0",id:T+"-panel-"+N,"aria-labelledby":T+"-tab-"+N,className:"dsh-hive-content"},N==="Overview"?e.default.createElement(yo,{state:i,controller:o,onJournal:$,onJumpPost:W,onMention:Z}):N==="Board"?e.default.createElement(Mo,{key:i.team.id,state:i,controller:o,focusedSeq:P,onClearFocus:()=>q(null),mentionRequest:z,onConsumeMention:()=>J(null),onJumpPost:W,onOpenSession:O}):N==="Members"?e.default.createElement(Co,{key:i.team.id,state:i,controller:o,onJournal:$,onOpenSession:O,onMention:Z}):e.default.createElement(Bo,{key:i.team.id,state:i,controller:o,onJournal:$,onJumpPost:W}))):e.default.createElement(fo,{title:i.loading?"Loading teams\u2026":i.teams.length?"Choose a team":"No teams in this workspace"},i.loading?"Reading the native Host.":i.teams.length?"Select a team to inspect its work. Opening Swarm does not start workers.":"Create a team through /hive-swarm in an authorized parent session, then refresh."),p&&C?.controller===o&&i.journal?e.default.createElement(bo,{controller:o,journal:i.journal,opener:C.opener,onClose:h,onJumpPost:W}):null)}function Yt({surfaces:o}){let n=(0,e.useSyncExternalStore)(o.subscribe,o.getSnapshot,o.getSnapshot);return e.default.createElement(Gt,{controller:n,mode:"main"})}var At=()=>null,Do=/^hive-swarm:\/\/team\/([0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12})$/i;function Jt({parentSessionId:o,controllerForTeam:n,onExpand:d,useTabInfo:p=At,useSessions:m=At}){let i=p()?.tab,N=i?.navigation?.params,k=m(c=>c?.byId?.[o]?.cwd),C=typeof N?.teamId=="string"?"hive-swarm://team/"+N.teamId:i?.contentId,y=typeof C=="string"?Do.exec(C)?.[1]?.toLowerCase():void 0;return e.default.createElement(Gt,{controller:n(y,k),onExpand:d,visible:i?.visible!==!1})}var Ie=Je(require("react"),1);var $t=`.dsh-hive-tool {
869
+ min-width: 0;
870
+ color: var(--dsw-alias-label-primary);
871
+ font: inherit;
872
+ line-height: 1.5;
873
+ }
874
+ .dsh-hive-tool-line { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
875
+ .dsh-hive-tool-line span, .dsh-hive-tool details { color: var(--dsw-alias-label-secondary); }
876
+ .dsh-hive-tool-line span[data-failed], .dsh-hive-tool [role="alert"] { color: var(--dsw-alias-state-error-primary); }
877
+ .dsh-hive-tool button {
878
+ padding: 3px 9px;
879
+ min-height: 28px;
880
+ border: 1px solid var(--dsw-alias-border-l2);
881
+ border-radius: 6px;
882
+ background: var(--dsw-alias-bg-layer-2);
883
+ color: inherit;
884
+ font: inherit;
885
+ cursor: pointer;
886
+ }
887
+ .dsh-hive-tool button:not(:disabled):hover { background: var(--dsw-alias-interactive-bg-hover); }
888
+ .dsh-hive-tool button:disabled { opacity: .55; cursor: default; }
889
+ .dsh-hive-tool :focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 2px; }
890
+ .dsh-hive-tool p, .dsh-hive-tool details { margin: 4px 0 0; overflow-wrap: anywhere; }
891
+ .dsh-hive-tool summary { cursor: pointer; }
892
+ .dsh-hive-tool pre { margin: 6px 0 0; max-height: 14rem; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
893
+ `;var _o=/^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i;function Oo(o){return o?.kind==="hive-swarm"&&typeof o.teamId=="string"&&_o.test(o.teamId)?o.teamId.toLowerCase():null}function Vt({toolName:o,phase:n,block:d,callId:p,openSwarm:m}){let i=(0,Ie.useRef)(null),[N,k]=(0,Ie.useState)(null),C=n==="result"&&d?.kind==="tool-result",y=C&&d.isError,c=C&&d.isError===!1?Oo(d.meta?.navigation):null,w=n==="preparing"?"Preparing\u2026":C?y?"Failed":"Completed":"Running\u2026",x=o==="hive_swarm_start_team"?"Start Swarm":"Find Swarm team",b=C?(d.content??[]).filter(z=>z.type==="text").map(z=>z.text).join(`
894
+ `):"",P=N?.callId===p&&N?.target===c?N:null;(0,Ie.useEffect)(()=>()=>{i.current?.abort(),i.current=null},[p,c]);async function q(){if(!c||i.current)return;let z=new AbortController;i.current=z,k({callId:p,target:c,pending:!0});try{await m(c,z.signal),z.signal.aborted||k(null)}catch(J){z.signal.aborted||k({callId:p,target:c,error:J?.message??"Try opening the team again."})}finally{i.current===z&&(i.current=null)}}return Ie.default.createElement("section",{className:"dsh-hive-tool","aria-label":x},Ie.default.createElement("style",null,$t),Ie.default.createElement("div",{className:"dsh-hive-tool-line"},Ie.default.createElement("strong",null,x),Ie.default.createElement("span",{role:"status","data-failed":y||void 0},w),c?Ie.default.createElement("button",{type:"button",onClick:q,disabled:!!P?.pending},"Open Swarm"):null),y?Ie.default.createElement("p",{role:"alert"},d.error?.reason||b.split(`
895
+ `,1)[0]||"The Host could not complete this tool call."):null,b?Ie.default.createElement("details",null,Ie.default.createElement("summary",null,"Tool result"),Ie.default.createElement("pre",null,b)):null,P?.pending?Ie.default.createElement("p",{role:"status"},"Opening team\u2026"):null,P?.error?Ie.default.createElement("p",{role:"alert"},"Could not open Swarm: ",P.error):null)}var Ge="dsh-hive-swarm",Uo=["slots","connection","layout","sidebarRightTabs","uiWorkspace"],Go=Symbol.for("hive-swarm.native-client.registrations"),Ue=globalThis[Go]??=new WeakMap,Yo=["hive_swarm_open_swarm_panel","hive_swarm_start_team"];function Jo(o){let n=o.slots;if(!Ue.has(n)){if(typeof n?.inject!="function"||typeof n?.register!="function"||typeof o.sidebarRightTabs?.register!="function"||typeof o.layout?.selectPanel!="function"){o.logger?.warn?.("Hive Swarm needs DSH right-tab, slot and layout capabilities. Enable them and reload the bundle.");return}o.effect(()=>{if(Ue.has(n))return()=>{};let d=yt((c,w,x)=>bt({connection:o.connection,sessionId:c,teamId:w,workspace:x,openSession:b=>{let P=o.uiWorkspace;if(typeof P?.openSession!="function")throw Error("Enable the DSH workspace capability to open a worker session.");return P.openSession(b)}})),p=[],m={},i=null;Ue.set(n,m);function N(){i?.abort();for(let c of p.splice(0).reverse())c?.();d.dispose(),Ue.get(n)===m&&Ue.delete(n)}function k(c){let w=d.getSnapshot();d.select(c);try{o.layout.selectPanel(Ge)}catch(x){throw d.select(w),x}}function C(c){i?.abort();try{k(c)}catch(w){c.setError(w)}}async function y(c,w,x){if(!c||Ue.get(n)!==m)throw Error("The original DSH session is unavailable.");i?.abort();let b=new AbortController;i=b;let P;try{let q=o.layout.beginNavigation?.();P=AbortSignal.any([b.signal,x,...q?[q]:[]]);let z=await gt(o.connection,w,P);P.throwIfAborted(),k(d.forSession(c,z.id,z.cwd))}catch(q){if(!P?.aborted)throw q}finally{i===b&&(i=null)}}try{p.push(o.sidebarRightTabs.register({id:Ge,kind:"hive-swarm",title:()=>"Swarm",patterns:["hive-swarm://team/**"],guide:[{id:"open",order:900,title:()=>"Swarm",icon:et}]})),p.push(n.inject("sidebar.right.pane.tab",()=>n.register({name:"sidebar.right.pane.tab",key:Ge,inject:w=>({parentSessionId:w,controllerForTeam:(x,b)=>d.forSession(w,x,b),onExpand:C})},Jt))),p.push(n.inject("sidebar.panellist",()=>n.register({name:"sidebar.panellist",id:Ge,order:30,label:()=>"Hive Swarm"},et))),p.push(n.inject("main",()=>n.register({name:"main",key:Ge,inject:()=>({surfaces:d})},Yt)));for(let w of Yo)p.push(n.inject("tool.call.toolview",()=>n.register({name:"tool.call.toolview",key:w,inject:x=>({openSwarm:(b,P)=>y(x,b,P)})},Vt)));let c=o.connection?.generation;typeof c?.subscribe=="function"?p.push(c.subscribe(()=>{c.getSnapshot()!==void 0&&d.reconnect()})):typeof o.on=="function"&&p.push(o.on("connection/reset",()=>d.reconnect()))}catch(c){return N(),o.logger?.warn?.("Hive Swarm could not register its native UI: "+c.message),()=>{}}return N},"hive-swarm: native launcher and views")}}
896
+
897
+ return module.exports;
898
+ }});