tide-commander 1.75.0 → 1.76.0

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.
Files changed (38) hide show
  1. package/dist/assets/{BossLogsModal-zgU4bJCC.js → BossLogsModal-BSAIyY5Q.js} +1 -1
  2. package/dist/assets/{BossSpawnModal-CpIKJJg-.js → BossSpawnModal-DWG3vywZ.js} +1 -1
  3. package/dist/assets/{ControlsModal-DtgIcdVS.js → ControlsModal-D7sQMy9U.js} +1 -1
  4. package/dist/assets/{DockerLogsModal-D_L7V-4J.js → DockerLogsModal-BxebN9cf.js} +1 -1
  5. package/dist/assets/{EmbeddedEditor-Dp-ni_0-.js → EmbeddedEditor-BJ7l5Zuf.js} +1 -1
  6. package/dist/assets/{GmailOAuthSetup-ChNYMY0L.js → GmailOAuthSetup-CzdqIXK3.js} +1 -1
  7. package/dist/assets/{GoogleOAuthSetup-D8Svmp1q.js → GoogleOAuthSetup-DKjU--mc.js} +1 -1
  8. package/dist/assets/{IframeModal-DZKuQ8yg.js → IframeModal-DkK8asfI.js} +1 -1
  9. package/dist/assets/{IntegrationsPanel-D6n9toD7.js → IntegrationsPanel--yZ_3y5S.js} +2 -2
  10. package/dist/assets/{LogViewerModal-D39zaEBu.js → LogViewerModal-CxAnXG6j.js} +1 -1
  11. package/dist/assets/{MonitoringModal--xeaRySJ.js → MonitoringModal-B2AaGtlF.js} +1 -1
  12. package/dist/assets/{PM2LogsModal-DCMfD-1P.js → PM2LogsModal-auR8lVnW.js} +1 -1
  13. package/dist/assets/{RestoreArchivedAreaModal-PXDQ5bgM.js → RestoreArchivedAreaModal-BJn-apo4.js} +1 -1
  14. package/dist/assets/{Scene2DCanvas-DI6ma9Bq.js → Scene2DCanvas-Q-FykJjz.js} +1 -1
  15. package/dist/assets/{SceneManager-BC5pQh74.js → SceneManager-JpuslnCc.js} +1 -1
  16. package/dist/assets/{SkillsPanel-DW0Hg7aS.js → SkillsPanel-BYfp0jLH.js} +2 -2
  17. package/dist/assets/{SpawnModal-qTu1uEr_.js → SpawnModal-_wxlHhYk.js} +1 -1
  18. package/dist/assets/{SubordinateAssignmentModal--nlGf-YQ.js → SubordinateAssignmentModal-tvfKFyRh.js} +1 -1
  19. package/dist/assets/{TriggerManagerPanel-CxC7fKWg.js → TriggerManagerPanel-DRKDuQAM.js} +1 -1
  20. package/dist/assets/{WorkflowEditorPanel-BZdJ-r-o.js → WorkflowEditorPanel-BPBBCTem.js} +1 -1
  21. package/dist/assets/{index-CmgyNPZ8.js → index-B87wqtN7.js} +1 -1
  22. package/dist/assets/{index-Cj5PMAWN.js → index-C8wnSaGW.js} +1 -1
  23. package/dist/assets/{index-B2lMVBaQ.js → index-CNo8F4Hv.js} +1 -1
  24. package/dist/assets/index-CPEajh-P.js +2 -0
  25. package/dist/assets/{index-z_X_5i8B.js → index-DIDFZjvm.js} +5 -5
  26. package/dist/assets/{index-CApTVPt4.js → index-DybFI3Yz.js} +3 -3
  27. package/dist/assets/{index-CKChsLUr.js → index-W693QVuI.js} +1 -1
  28. package/dist/assets/index-bu2bf20Y.js +2 -0
  29. package/dist/assets/{index-DvodeLUF.js → index-snzCcqn6.js} +3 -3
  30. package/dist/assets/{main-BjcLCHKw.js → main-CjPuuFGh.js} +88 -88
  31. package/dist/assets/main-Co2mNETL.css +1 -0
  32. package/dist/assets/{web-iMMHHHFW.js → web-Bd3T_lvT.js} +1 -1
  33. package/dist/assets/{web-C7yID6Q0.js → web-CY6mLlQ5.js} +1 -1
  34. package/dist/index.html +2 -2
  35. package/package.json +1 -1
  36. package/dist/assets/index-BJGkjKD9.js +0 -2
  37. package/dist/assets/index-DTmsNGgH.js +0 -2
  38. package/dist/assets/main-CVksVK2O.css +0 -1
@@ -1 +1 @@
1
- import{c2 as a}from"./main-BjcLCHKw.js";import{ImpactStyle as i,NotificationType as r}from"./index-DTmsNGgH.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";class h extends a{constructor(){super(...arguments),this.selectionStarted=!1}async impact(t){const e=this.patternForImpact(t==null?void 0:t.style);this.vibrateWithPattern(e)}async notification(t){const e=this.patternForNotification(t==null?void 0:t.type);this.vibrateWithPattern(e)}async vibrate(t){const e=(t==null?void 0:t.duration)||300;this.vibrateWithPattern([e])}async selectionStart(){this.selectionStarted=!0}async selectionChanged(){this.selectionStarted&&this.vibrateWithPattern([70])}async selectionEnd(){this.selectionStarted=!1}patternForImpact(t=i.Heavy){return t===i.Medium?[43]:t===i.Light?[20]:[61]}patternForNotification(t=r.Success){return t===r.Warning?[30,40,30,50,60]:t===r.Error?[27,45,50]:[35,65,21]}vibrateWithPattern(t){if(navigator.vibrate)navigator.vibrate(t);else throw this.unavailable("Browser does not support the vibrate API")}}export{h as HapticsWeb};
1
+ import{c5 as a}from"./main-CjPuuFGh.js";import{ImpactStyle as i,NotificationType as r}from"./index-bu2bf20Y.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";class h extends a{constructor(){super(...arguments),this.selectionStarted=!1}async impact(t){const e=this.patternForImpact(t==null?void 0:t.style);this.vibrateWithPattern(e)}async notification(t){const e=this.patternForNotification(t==null?void 0:t.type);this.vibrateWithPattern(e)}async vibrate(t){const e=(t==null?void 0:t.duration)||300;this.vibrateWithPattern([e])}async selectionStart(){this.selectionStarted=!0}async selectionChanged(){this.selectionStarted&&this.vibrateWithPattern([70])}async selectionEnd(){this.selectionStarted=!1}patternForImpact(t=i.Heavy){return t===i.Medium?[43]:t===i.Light?[20]:[61]}patternForNotification(t=r.Success){return t===r.Warning?[30,40,30,50,60]:t===r.Error?[27,45,50]:[35,65,21]}vibrateWithPattern(t){if(navigator.vibrate)navigator.vibrate(t);else throw this.unavailable("Browser does not support the vibrate API")}}export{h as HapticsWeb};
@@ -1 +1 @@
1
- import{c2 as s}from"./main-BjcLCHKw.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";class l extends s{constructor(){super(...arguments),this.pending=[],this.deliveredNotifications=[],this.hasNotificationSupport=()=>{if(!("Notification"in window)||!Notification.requestPermission)return!1;if(Notification.permission!=="granted")try{new Notification("")}catch(i){if(i instanceof Error&&i.name==="TypeError")return!1}return!0}}async getDeliveredNotifications(){const i=[];for(const t of this.deliveredNotifications){const e={title:t.title,id:parseInt(t.tag),body:t.body};i.push(e)}return{notifications:i}}async removeDeliveredNotifications(i){for(const t of i.notifications){const e=this.deliveredNotifications.find(n=>n.tag===String(t.id));e==null||e.close(),this.deliveredNotifications=this.deliveredNotifications.filter(()=>!e)}}async removeAllDeliveredNotifications(){for(const i of this.deliveredNotifications)i.close();this.deliveredNotifications=[]}async createChannel(){throw this.unimplemented("Not implemented on web.")}async deleteChannel(){throw this.unimplemented("Not implemented on web.")}async listChannels(){throw this.unimplemented("Not implemented on web.")}async schedule(i){if(!this.hasNotificationSupport())throw this.unavailable("Notifications not supported in this browser.");for(const t of i.notifications)this.sendNotification(t);return{notifications:i.notifications.map(t=>({id:t.id}))}}async getPending(){return{notifications:this.pending}}async registerActionTypes(){throw this.unimplemented("Not implemented on web.")}async cancel(i){this.pending=this.pending.filter(t=>!i.notifications.find(e=>e.id===t.id))}async areEnabled(){const{display:i}=await this.checkPermissions();return{value:i==="granted"}}async changeExactNotificationSetting(){throw this.unimplemented("Not implemented on web.")}async checkExactNotificationSetting(){throw this.unimplemented("Not implemented on web.")}async requestPermissions(){if(!this.hasNotificationSupport())throw this.unavailable("Notifications not supported in this browser.");return{display:this.transformNotificationPermission(await Notification.requestPermission())}}async checkPermissions(){if(!this.hasNotificationSupport())throw this.unavailable("Notifications not supported in this browser.");return{display:this.transformNotificationPermission(Notification.permission)}}transformNotificationPermission(i){switch(i){case"granted":return"granted";case"denied":return"denied";default:return"prompt"}}sendPending(){var i;const t=[],e=new Date().getTime();for(const n of this.pending)!((i=n.schedule)===null||i===void 0)&&i.at&&n.schedule.at.getTime()<=e&&(this.buildNotification(n),t.push(n));this.pending=this.pending.filter(n=>!t.find(o=>o===n))}sendNotification(i){var t;if(!((t=i.schedule)===null||t===void 0)&&t.at){const e=i.schedule.at.getTime()-new Date().getTime();this.pending.push(i),setTimeout(()=>{this.sendPending()},e);return}this.buildNotification(i)}buildNotification(i){const t=new Notification(i.title,{body:i.body,tag:String(i.id)});return t.addEventListener("click",this.onClick.bind(this,i),!1),t.addEventListener("show",this.onShow.bind(this,i),!1),t.addEventListener("close",()=>{this.deliveredNotifications=this.deliveredNotifications.filter(()=>!this)},!1),this.deliveredNotifications.push(t),t}onClick(i){const t={actionId:"tap",notification:i};this.notifyListeners("localNotificationActionPerformed",t)}onShow(i){this.notifyListeners("localNotificationReceived",i)}}export{l as LocalNotificationsWeb};
1
+ import{c5 as s}from"./main-CjPuuFGh.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";class l extends s{constructor(){super(...arguments),this.pending=[],this.deliveredNotifications=[],this.hasNotificationSupport=()=>{if(!("Notification"in window)||!Notification.requestPermission)return!1;if(Notification.permission!=="granted")try{new Notification("")}catch(i){if(i instanceof Error&&i.name==="TypeError")return!1}return!0}}async getDeliveredNotifications(){const i=[];for(const t of this.deliveredNotifications){const e={title:t.title,id:parseInt(t.tag),body:t.body};i.push(e)}return{notifications:i}}async removeDeliveredNotifications(i){for(const t of i.notifications){const e=this.deliveredNotifications.find(n=>n.tag===String(t.id));e==null||e.close(),this.deliveredNotifications=this.deliveredNotifications.filter(()=>!e)}}async removeAllDeliveredNotifications(){for(const i of this.deliveredNotifications)i.close();this.deliveredNotifications=[]}async createChannel(){throw this.unimplemented("Not implemented on web.")}async deleteChannel(){throw this.unimplemented("Not implemented on web.")}async listChannels(){throw this.unimplemented("Not implemented on web.")}async schedule(i){if(!this.hasNotificationSupport())throw this.unavailable("Notifications not supported in this browser.");for(const t of i.notifications)this.sendNotification(t);return{notifications:i.notifications.map(t=>({id:t.id}))}}async getPending(){return{notifications:this.pending}}async registerActionTypes(){throw this.unimplemented("Not implemented on web.")}async cancel(i){this.pending=this.pending.filter(t=>!i.notifications.find(e=>e.id===t.id))}async areEnabled(){const{display:i}=await this.checkPermissions();return{value:i==="granted"}}async changeExactNotificationSetting(){throw this.unimplemented("Not implemented on web.")}async checkExactNotificationSetting(){throw this.unimplemented("Not implemented on web.")}async requestPermissions(){if(!this.hasNotificationSupport())throw this.unavailable("Notifications not supported in this browser.");return{display:this.transformNotificationPermission(await Notification.requestPermission())}}async checkPermissions(){if(!this.hasNotificationSupport())throw this.unavailable("Notifications not supported in this browser.");return{display:this.transformNotificationPermission(Notification.permission)}}transformNotificationPermission(i){switch(i){case"granted":return"granted";case"denied":return"denied";default:return"prompt"}}sendPending(){var i;const t=[],e=new Date().getTime();for(const n of this.pending)!((i=n.schedule)===null||i===void 0)&&i.at&&n.schedule.at.getTime()<=e&&(this.buildNotification(n),t.push(n));this.pending=this.pending.filter(n=>!t.find(o=>o===n))}sendNotification(i){var t;if(!((t=i.schedule)===null||t===void 0)&&t.at){const e=i.schedule.at.getTime()-new Date().getTime();this.pending.push(i),setTimeout(()=>{this.sendPending()},e);return}this.buildNotification(i)}buildNotification(i){const t=new Notification(i.title,{body:i.body,tag:String(i.id)});return t.addEventListener("click",this.onClick.bind(this,i),!1),t.addEventListener("show",this.onShow.bind(this,i),!1),t.addEventListener("close",()=>{this.deliveredNotifications=this.deliveredNotifications.filter(()=>!this)},!1),this.deliveredNotifications.push(t),t}onClick(i){const t={actionId:"tap",notification:i};this.notifyListeners("localNotificationActionPerformed",t)}onShow(i){this.notifyListeners("localNotificationReceived",i)}}export{l as LocalNotificationsWeb};
package/dist/index.html CHANGED
@@ -22,10 +22,10 @@
22
22
  <link rel="icon" type="image/png" sizes="16x16" href="/assets/icons/favicon-16x16.png" />
23
23
  <link rel="apple-touch-icon" sizes="180x180" href="/assets/icons/apple-touch-icon.png" />
24
24
  <title>Tide Commander</title>
25
- <script type="module" crossorigin src="/assets/main-BjcLCHKw.js"></script>
25
+ <script type="module" crossorigin src="/assets/main-CjPuuFGh.js"></script>
26
26
  <link rel="modulepreload" crossorigin href="/assets/vendor-react--Eh9ivFN.js">
27
27
  <link rel="modulepreload" crossorigin href="/assets/vendor-three-Chj50gSY.js">
28
- <link rel="stylesheet" crossorigin href="/assets/main-CVksVK2O.css">
28
+ <link rel="stylesheet" crossorigin href="/assets/main-Co2mNETL.css">
29
29
  </head>
30
30
  <body>
31
31
  <div id="app"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tide-commander",
3
- "version": "1.75.0",
3
+ "version": "1.76.0",
4
4
  "description": "Visual multi-agent orchestrator and manager for Claude Code with 3D/2D interface",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,2 +0,0 @@
1
- import{u as Et,z as yt,B as Tt,r as n,E as ft,S as x,G as ht,H as dt,J as gt,K as Ue,L as ue,M as Pt,s as b,N as wt,O as Rt,v as Dt,w as zt,j as e,I as u,P as Lt,m as $t,U as Ct,V as jt,W as Ot,X as Ft,Y as Wt,Z as Bt,_ as Ht,$ as Gt,a0 as Vt,C as Ut,a1 as Xt,a2 as qt,a3 as Kt,a4 as Yt,a5 as Zt,a6 as Jt,a7 as Qt,a8 as ea,a9 as ta,aa,ab as na,ac as sa,ad as la,ae as ra,af as ia,ag as oa,ah as ca}from"./main-BjcLCHKw.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";const Xe=3,qe=280,_t=320,ct=240,xt=64,da=["simple","chat","advanced"],pa={simple:"Simple",chat:"Chat",advanced:"Advanced"},ua={simple:"○",chat:"◐",advanced:"◉"},ma={simple:"Simple view — clean messages only",chat:"Chat view — assistant replies (no tool calls)",advanced:"Advanced view — everything including tools"},bt="flat-clear-context";function fa(m){const c=m.split("/").filter(Boolean);return c.length===0?m:c.slice(-2).join("/")}function ha(m){if(m.provider==="codex"){const le=m.codexModel||"gpt-5.3-codex",P=ia[le];return{model:(P==null?void 0:P.label)||le}}if(m.provider==="opencode")return{model:m.opencodeModel||"opencode"};const c=m.model||"sonnet",C=ca[c],M=m.effort,T=M?oa[M]:void 0;return{model:(C==null?void 0:C.label)||c,effort:T==null?void 0:T.label}}function ga(m,c){if(c.type==="rectangle"&&c.width&&c.height){const C=c.width/2,M=c.height/2;return m.x>=c.center.x-C&&m.x<=c.center.x+C&&m.z>=c.center.z-M&&m.z<=c.center.z+M}if(c.type==="circle"&&c.radius){const C=m.x-c.center.x,M=m.z-c.center.z;return C*C+M*M<=c.radius*c.radius}return!1}const _a=Xt.memo(function({agentId:c,terminalViewMode:C,onTerminalViewModeChange:M,inspectorOpen:T,onToggleInspector:le,onImageClick:P,onFileClick:R,onBashClick:me,onViewMarkdown:fe,onRequestClearSubordinates:Ie,onOpenBuilding:he,keyboard:Se,canNavigateBack:ge,canNavigateForward:Me,onNavigateBack:E,onNavigateForward:re,agentInfoOpen:D,onToggleAgentInfo:Ee}){var Oe,Ne,Fe,We;const p=qt(c),y=Kt(),ie=n.useRef(null),ye=n.useRef(null);n.useEffect(()=>{const s=ye.current;if(!s)return;const i=o=>{o.button===3?(o.preventDefault(),o.stopPropagation(),E()):o.button===4&&(o.preventDefault(),o.stopPropagation(),re())},d=o=>{(o.button===3||o.button===4)&&o.preventDefault()};return s.addEventListener("mouseup",i),s.addEventListener("mousedown",d),()=>{s.removeEventListener("mouseup",i),s.removeEventListener("mousedown",d)}},[E,re]);const _e=wt(),oe=n.useMemo(()=>{if(!p)return null;const s=new Set,i=[];for(const d of _e.values())d.archived||d.directories.length===0||d.assignedAgentIds.includes(c)&&(s.add(d.id),i.push(d));for(const d of _e.values())d.archived||d.directories.length===0||s.has(d.id)||ga({x:p.position.x,z:p.position.z},d)&&(s.add(d.id),i.push(d));return i.length===0?null:i.flatMap(d=>d.directories.filter(o=>o&&o.trim().length>0).map(o=>({areaId:d.id,areaName:d.name,dir:o})))},[p,c,_e]),{branches:Te,fetchRemote:xe,fetchingDirs:be}=Yt(oe),F=n.useMemo(()=>{var d;const s=b.getAreaForAgent(c);if(!s)return[];const i=[];for(const o of y.values())o.type==="terminal"&&b.isPositionInArea(o.position,s)&&i.push({id:o.id,name:o.name,hasUrl:!!((d=o.terminalStatus)!=null&&d.url)});return i},[c,y]),ce=n.useMemo(()=>{var d;const s=b.getAreaForAgent(c);if(!s)return[];const i=[];for(const o of y.values())o.type==="server"&&((d=o.pm2)!=null&&d.enabled)&&b.isPositionInArea(o.position,s)&&i.push({id:o.id,name:o.name});return i},[c,y]),Pe=n.useMemo(()=>{const s=b.getAreaForAgent(c);if(!s)return[];const i=[];for(const d of y.values())d.type==="database"&&d.database&&b.isPositionInArea(d.position,s)&&i.push({id:d.id,name:d.name});return i},[c,y]),[,Ke]=n.useReducer(s=>s+1,0),W=((Oe=ie.current)==null?void 0:Oe.search.searchMode)??!1,Q=n.useCallback(()=>{var s;(s=ie.current)==null||s.search.toggleSearch(),Ke()},[]),X=Zt(),q=X.isPending(bt),[k,B]=n.useState(null),S=k?y.get(k):null,{height:K,onResizeStart:Ye}=Jt(),[ee,we]=n.useState(()=>dt(x.GIT_PANEL_OPEN,!1)),[z,Re]=n.useState(()=>dt(x.BUILDINGS_PANEL_OPEN,!1)),[te,Y]=n.useState(!1),Ze=n.useCallback(()=>{Y(s=>{const i=!s;return i&&Qt.setEnabled(!0),i})},[]),De=n.useCallback(()=>Y(!1),[]),Je=n.useCallback(()=>{we(s=>{const i=!s;return ue(x.GIT_PANEL_OPEN,i),i})},[]),Qe=n.useCallback(()=>{Re(s=>{const i=!s;return ue(x.BUILDINGS_PANEL_OPEN,i),i})},[]),et=n.useCallback(()=>{we(!1),ue(x.GIT_PANEL_OPEN,!1)},[]),tt=n.useCallback(()=>{Re(!1),ue(x.BUILDINGS_PANEL_OPEN,!1)},[]),at=ea();n.useEffect(()=>{if(!k)return;F.some(i=>i.id===k)||B(null)},[k,F]);const[ae,Z]=n.useState(!1),Ce=n.useRef(null);if(n.useEffect(()=>{if(!ae)return;const s=i=>{Ce.current&&!Ce.current.contains(i.target)&&Z(!1)};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[ae]),!p)return e.jsx("div",{className:"flat-chat flat-chat--empty",children:e.jsxs("div",{className:"flat-chat__placeholder",children:[e.jsx("span",{className:"flat-chat__placeholder-icon",children:"💬"}),e.jsx("span",{className:"flat-chat__placeholder-text",children:"Select an agent to start chatting"})]})});const H=p.contextStats,g=!!H,J=H?H.totalTokens:p.contextUsed||0,G=H?H.contextWindow:p.contextLimit||2e5,je=H?H.usedPercent:Math.round(J/G*100),V=Math.max(0,Math.min(100,je)),nt=Math.max(0,100-V),ze=V>=80?"#ff4a4a":V>=60?"#ff9e4a":V>=40?"#ffd700":"#4aff9e",Le=(J/1e3).toFixed(1),$e=(G/1e3).toFixed(1),L=p.cwd,$=L?fa(L):null,U=((Ne=p.subordinateIds)==null?void 0:Ne.length)||0,st=U>0;return e.jsxs("div",{ref:ye,className:`flat-terminal-wrapper ${ee||z||te?"flat-terminal-wrapper--with-side-panel":""}`,children:[e.jsxs("div",{className:"flat-terminal-wrapper__header",children:[e.jsxs("button",{type:"button",className:`flat-terminal-wrapper__header-main ${D?"flat-terminal-wrapper__header-main--active":""}`,onClick:Ee,title:D?"Hide agent info":"Show agent info","aria-pressed":D,children:[e.jsx(Ct,{agent:p,size:28}),e.jsxs("span",{className:"flat-terminal-wrapper__header-info",children:[e.jsx("span",{className:"flat-terminal-wrapper__header-name",children:p.name}),e.jsx("span",{className:"flat-terminal-wrapper__header-status",style:{color:jt(p.status)},children:p.status})]}),p.taskLabel&&e.jsxs("span",{className:"flat-terminal-wrapper__header-task",title:p.taskLabel,children:["📋 ",p.taskLabel]}),e.jsxs("span",{className:"flat-terminal-wrapper__header-model",children:[e.jsx("img",{src:p.provider==="codex"?"/assets/codex.png":p.provider==="opencode"?"/assets/opencode.png":"/assets/claude.png",alt:p.provider,className:"flat-terminal-wrapper__header-provider-icon",title:p.provider==="codex"?"Codex Agent":p.provider==="opencode"?"OpenCode Agent":"Claude Agent"}),(()=>{const{model:s,effort:i}=ha(p);return e.jsxs("span",{className:"flat-terminal-wrapper__header-model-chip",title:i?`Model: ${s} · Effort: ${i}`:`Model: ${s}`,children:[e.jsx("span",{className:"flat-terminal-wrapper__header-model-name",children:s}),i&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"flat-terminal-wrapper__header-model-sep","aria-hidden":"true",children:"·"}),e.jsx("span",{className:"flat-terminal-wrapper__header-model-effort",children:i})]})]})})()]})]}),e.jsxs("div",{className:"flat-terminal-wrapper__header-meta",children:[e.jsx("div",{className:"flat-terminal-wrapper__view-mode",role:"group","aria-label":"Message view mode",children:da.map(s=>e.jsxs("button",{type:"button",className:`flat-terminal-wrapper__view-mode-btn ${C===s?"flat-terminal-wrapper__view-mode-btn--active":""}`,onClick:()=>M(s),title:ma[s],"aria-pressed":C===s,children:[e.jsx("span",{className:"flat-terminal-wrapper__view-mode-icon","aria-hidden":"true",children:ua[s]}),e.jsx("span",{className:"flat-terminal-wrapper__view-mode-label",children:pa[s]})]},s))}),e.jsxs("div",{className:"flat-terminal-wrapper__actions",role:"group","aria-label":"Terminal actions",children:[e.jsx("button",{type:"button",className:"flat-terminal-wrapper__action-btn",onClick:E,disabled:!ge,title:"Back to previous agent","aria-label":"Back to previous agent",children:e.jsx(u,{name:"arrow-left",size:14})}),e.jsx("button",{type:"button",className:"flat-terminal-wrapper__action-btn",onClick:re,disabled:!Me,title:"Forward to next agent","aria-label":"Forward to next agent",children:e.jsx(u,{name:"arrow-right",size:14})}),e.jsx("button",{type:"button",className:`flat-terminal-wrapper__action-btn ${W?"flat-terminal-wrapper__action-btn--active":""}`,onClick:Q,title:W?"Close search":"Search messages","aria-pressed":W,children:e.jsx(u,{name:W?"cross":"search",size:14})}),e.jsx("button",{type:"button",className:`flat-terminal-wrapper__action-btn flat-terminal-wrapper__action-btn--danger ${q?"flat-terminal-wrapper__action-btn--confirm":""}`,onClick:()=>X.handleClick(bt,()=>{var s;b.clearContext(c),(s=ie.current)==null||s.historyLoader.clearHistory()}),title:q?"Click again to confirm clear context":"Clear context",children:e.jsx(u,{name:q?"question":"clear",size:14})}),e.jsx("button",{type:"button",className:`flat-terminal-wrapper__action-btn ${ee?"flat-terminal-wrapper__action-btn--active":""}`,onClick:Je,title:ee?"Hide git panel":"Show git changes","aria-pressed":ee,children:e.jsx(u,{name:"git-branch",size:14})}),e.jsx("button",{type:"button",className:`flat-terminal-wrapper__action-btn ${z?"flat-terminal-wrapper__action-btn--active":""}`,onClick:Qe,title:z?"Hide buildings panel":"Show area buildings","aria-pressed":z,children:e.jsx(u,{name:"buildings",size:14})}),e.jsxs("div",{className:"flat-terminal-wrapper__more",ref:Ce,children:[e.jsx("button",{type:"button",className:`flat-terminal-wrapper__action-btn ${ae?"flat-terminal-wrapper__action-btn--active":""}`,onClick:()=>Z(s=>!s),title:"More actions","aria-expanded":ae,children:"⋮"}),ae&&e.jsxs("div",{className:"flat-terminal-wrapper__more-menu",role:"menu",children:[e.jsxs("button",{type:"button",role:"menuitem",className:`flat-terminal-wrapper__more-item ${te?"flat-terminal-wrapper__more-item--active":""}`,onClick:()=>{Ze(),Z(!1)},title:te?"Hide Debug Panel":"Show Debug Panel",children:[e.jsx(u,{name:"bug",size:14}),e.jsx("span",{children:te?"Hide Debug Panel":"Show Debug Panel"})]}),e.jsx("div",{className:"flat-terminal-wrapper__more-divider"}),e.jsxs("button",{type:"button",role:"menuitem",className:"flat-terminal-wrapper__more-item",onClick:()=>{b.collapseContext(c),Z(!1)},disabled:p.status!=="idle",title:p.status!=="idle"?"Agent must be idle to collapse context":"Collapse context",children:[e.jsx(u,{name:"package",size:14}),e.jsx("span",{children:"Collapse context"})]}),st&&e.jsxs("button",{type:"button",role:"menuitem",className:"flat-terminal-wrapper__more-item flat-terminal-wrapper__more-item--danger",onClick:()=>{Ie(c,U),Z(!1)},children:[e.jsx(u,{name:"crown",size:14}),e.jsxs("span",{children:["Clear ",U," subordinate",U===1?"":"s"]})]}),e.jsx("div",{className:"flat-terminal-wrapper__more-divider"}),e.jsxs("button",{type:"button",role:"menuitem",className:"flat-terminal-wrapper__more-item flat-terminal-wrapper__more-item--danger",onClick:()=>{b.killAgent(c),Z(!1)},children:[e.jsx(u,{name:"cross",size:14}),e.jsx("span",{children:"Remove agent"})]})]})]})]}),e.jsxs("button",{type:"button",className:`flat-terminal-wrapper__inspector-toggle ${T?"flat-terminal-wrapper__inspector-toggle--active":""}`,onClick:le,title:T?"Hide inspector panel":"Show inspector panel","aria-label":T?"Hide inspector panel":"Show inspector panel","aria-pressed":T,children:[e.jsx("span",{className:"flat-terminal-wrapper__inspector-icon","aria-hidden":"true",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"}),e.jsx("line",{x1:"10",y1:"2.5",x2:"10",y2:"13.5"})]})}),e.jsx("span",{className:"flat-terminal-wrapper__inspector-label",children:"Inspector"})]}),e.jsx("button",{type:"button",className:"flat-terminal-wrapper__close",onClick:()=>b.deselectAll(),title:"Close chat","aria-label":"Close chat",children:e.jsx(u,{name:"cross",size:14})})]})]}),e.jsx(ta,{ref:ie,agentId:c,agent:p,viewMode:C,isOpen:!0,onImageClick:P,onFileClick:R,onBashClick:me,onViewMarkdown:fe,keyboard:Se,hasModalOpen:!1}),S&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"guake-bottom-terminal-resize",onMouseDown:Ye,role:"separator","aria-orientation":"horizontal","aria-label":"Resize embedded terminal"}),e.jsxs("div",{className:"flat-bottom-panel",role:"region","aria-label":`Embedded terminal: ${S.name}`,style:{height:K},children:[e.jsxs("div",{className:"flat-bottom-panel__header",children:[e.jsxs("span",{className:"flat-bottom-panel__title",children:[e.jsx(u,{name:"terminal",size:12}),e.jsx("span",{children:S.name}),!((Fe=S.terminalStatus)!=null&&Fe.url)&&e.jsx("span",{className:"flat-bottom-panel__muted",children:"(starting...)"})]}),e.jsx("button",{type:"button",className:"flat-bottom-panel__close",onClick:()=>B(null),title:"Close embedded terminal","aria-label":"Close embedded terminal",children:e.jsx(u,{name:"cross",size:12})})]}),e.jsx("div",{className:"flat-bottom-panel__body",children:(We=S.terminalStatus)!=null&&We.url?e.jsx(aa,{terminalUrl:S.terminalStatus.url,visible:!0}):e.jsx("div",{className:"flat-bottom-panel__placeholder",children:"Starting terminal..."})})]})]}),e.jsxs("div",{className:"flat-terminal-wrapper__statusbar",role:"contentinfo",children:[p.isDetached&&e.jsxs("span",{className:"flat-terminal-wrapper__detached",title:"Reattaching session...",children:[e.jsx(u,{name:"refresh",size:12}),e.jsx("span",{children:"Reattaching"})]}),L&&$&&e.jsxs("span",{className:"flat-terminal-wrapper__cwd",title:L,onClick:()=>b.setFileViewerPath(L),children:[e.jsx("span",{className:"flat-terminal-wrapper__cwd-icon",children:e.jsx(u,{name:"folder",size:12})}),e.jsx("span",{className:"flat-terminal-wrapper__cwd-text",children:$})]}),oe&&oe.map(({areaId:s,areaName:i,dir:d})=>{const o=Te.get(d),ve=be.has(d),lt=d.split("/").filter(Boolean).pop()||d;return e.jsxs("span",{className:"flat-terminal-wrapper__area-dir",title:`${i}: ${d}${o?` (${o.branch}${o.ahead?` ↑${o.ahead}`:""}${o.behind?` ↓${o.behind}`:""})`:""}`,onClick:()=>b.openFileExplorerForAreaFolder(s,d),children:[e.jsx(u,{name:"folder-open",size:12}),e.jsx("span",{className:"flat-terminal-wrapper__area-dir-name",children:lt}),o&&e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"flat-terminal-wrapper__area-dir-branch",children:[e.jsx(u,{name:"git-branch",size:10})," ",o.branch]}),o.ahead>0&&e.jsxs("span",{className:"flat-terminal-wrapper__branch-ahead",title:`${o.ahead} ahead`,children:[e.jsx(u,{name:"arrow-up",size:9}),o.ahead]}),o.behind>0&&e.jsxs("span",{className:"flat-terminal-wrapper__branch-behind",title:`${o.behind} behind`,children:[e.jsx(u,{name:"arrow-down",size:9}),o.behind]}),e.jsx("span",{className:`flat-terminal-wrapper__area-fetch ${ve?"flat-terminal-wrapper__area-fetch--fetching":""}`,title:"Git fetch",onClick:Be=>{Be.stopPropagation(),xe(d)},children:e.jsx(u,{name:ve?"hourglass":"download",size:12})})]})]},`${s}:${d}`)}),e.jsxs("span",{className:"flat-terminal-wrapper__context",onClick:()=>b.setContextModalAgentId(c),title:g?`Context usage: ${Le}k / ${$e}k tokens (${V}% used). Click to view stats.`:"Click to fetch context stats",children:[e.jsx("span",{className:"flat-terminal-wrapper__context-icon",children:e.jsx(u,{name:"dashboard",size:12})}),e.jsx("span",{className:"flat-terminal-wrapper__context-label",children:"Ctx:"}),e.jsx("span",{className:"flat-terminal-wrapper__context-bar",children:e.jsx("span",{className:"flat-terminal-wrapper__context-bar-fill",style:{width:`${V}%`,backgroundColor:ze}})}),e.jsxs("span",{className:"flat-terminal-wrapper__context-tokens",style:{color:ze},children:[Le,"k/",$e,"k"]}),e.jsxs("span",{className:"flat-terminal-wrapper__context-free",children:["(",nt,"% free)"]}),!g&&e.jsx("span",{className:"flat-terminal-wrapper__context-warning",title:"No context stats yet",children:e.jsx(u,{name:"warn",size:12})})]}),e.jsx("div",{className:"flat-terminal-wrapper__statusbar-spacer","aria-hidden":"true"}),F.length>0&&e.jsx("span",{className:"flat-terminal-wrapper__buildings",role:"group","aria-label":"Area terminals",children:F.map(s=>{const i=k===s.id;return e.jsx("button",{type:"button",className:`flat-terminal-wrapper__building-btn ${i?"flat-terminal-wrapper__building-btn--active":""} ${s.hasUrl?"":"flat-terminal-wrapper__building-btn--offline"}`,title:`${i?"Hide":"Show"} terminal: ${s.name}${s.hasUrl?"":" (starting...)"}`,onClick:()=>{if(i){B(null);return}s.hasUrl||b.sendBuildingCommand(s.id,"start"),B(s.id)},children:e.jsx(u,{name:"terminal",size:14})},s.id)})}),ce.length>0&&e.jsx("span",{className:"flat-terminal-wrapper__buildings",role:"group","aria-label":"Area PM2 logs",children:ce.map(s=>e.jsx("button",{type:"button",className:"flat-terminal-wrapper__building-btn",title:`Open logs: ${s.name}`,onClick:()=>he(s.id),children:e.jsx(u,{name:"scroll",size:14})},s.id))}),Pe.length>0&&e.jsx("span",{className:"flat-terminal-wrapper__buildings",role:"group","aria-label":"Area databases",children:Pe.map(s=>e.jsx("button",{type:"button",className:"flat-terminal-wrapper__building-btn",title:`Open database: ${s.name}`,onClick:()=>he(s.id),children:e.jsx(u,{name:"hard-drives",size:14})},s.id))}),e.jsx("div",{className:"flat-terminal-wrapper__theme",children:e.jsx(na,{})})]}),ee&&e.jsx(sa,{agentId:c,agents:at,onClose:et,branchInfoMap:Te,fetchRemote:xe,fetchingDirs:be}),z&&e.jsx(la,{agentId:c,onClose:tt}),te&&e.jsx(ra,{agentId:c,onClose:De})]})});function Ca({onAgentClick:m,onBuildingClick:c,onBuildingDoubleClick:C,onOpenSpawnModal:M,onOpenBossSpawnModal:T,onOpenAreaModal:le}){const{t:P}=Et(["common"]),R=yt(),me=Tt(),[fe,Ie]=n.useState(null),[he,Se]=n.useState(null),[ge,Me]=n.useState(null),[E,re]=n.useState(null),[D,Ee]=n.useState(null),[p,y]=n.useState(!1),ie=n.useCallback(()=>{y(t=>!t)},[]),ye=n.useCallback(()=>{y(!1)},[]),[_e,oe]=n.useState(()=>{const t=ft(x.VIEW_MODE);return t==="simple"||t==="chat"||t==="advanced"?t:"simple"}),Te=n.useCallback(t=>{oe(t),ht(x.VIEW_MODE,t)},[]);n.useEffect(()=>{const t=a=>{if(a.key!==x.VIEW_MODE)return;const l=a.newValue;(l==="simple"||l==="chat"||l==="advanced")&&oe(l)};return window.addEventListener("storage",t),()=>window.removeEventListener("storage",t)},[]);const[xe,be]=n.useState(()=>dt(x.FLAT_INSPECTOR_OPEN,!1)),[F,ce]=n.useState(!1),Pe=n.useCallback(()=>ce(t=>!t),[]),Ke=n.useCallback(()=>ce(!1),[]),W=n.useRef(null),Q=n.useRef(null),[X,q]=n.useState(()=>{const t=gt(x.FLAT_MIDDLE_WIDTH,0);return t>=qe?t:null}),[k,B]=n.useState(()=>{const t=gt(x.FLAT_INSPECTOR_WIDTH,0);return t>=ct?t:null}),S=n.useCallback(t=>{if(typeof window>"u")return t;const a=k!==null?Xe+k:0,l=window.innerWidth-xt-Xe-_t-a;return Math.max(qe,Math.min(Math.max(l,qe),t))},[k]),K=n.useCallback(t=>{var j;if(typeof window>"u")return t;const a=(j=W.current)==null?void 0:j.querySelector(".flat-middle"),l=(a==null?void 0:a.getBoundingClientRect().width)??qe,r=window.innerWidth-xt-l-Xe-_t-Xe;return Math.max(ct,Math.min(Math.max(r,ct),t))},[]);n.useEffect(()=>{if(X===null&&k===null)return;const t=()=>{q(a=>{if(a===null)return a;const l=S(a);return l===a?a:l}),B(a=>{if(a===null)return a;const l=K(a);return l===a?a:l})};return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[X,k,S,K]);const Ye=n.useCallback(t=>{var l;if(t.button!==0)return;const a=(l=W.current)==null?void 0:l.querySelector(".flat-middle");a&&(t.currentTarget.setPointerCapture(t.pointerId),Q.current={kind:"middle",startX:t.clientX,startWidth:a.getBoundingClientRect().width,pointerId:t.pointerId},document.body.classList.add("flat-splitter-dragging"))},[]),ee=n.useCallback(t=>{var l;if(t.button!==0)return;const a=(l=W.current)==null?void 0:l.querySelector(".flat-inspector");a&&(t.currentTarget.setPointerCapture(t.pointerId),Q.current={kind:"inspector",startX:t.clientX,startWidth:a.getBoundingClientRect().width,pointerId:t.pointerId},document.body.classList.add("flat-splitter-dragging"))},[]),we=n.useCallback(t=>{const a=Q.current;if(!a||t.pointerId!==a.pointerId)return;const l=t.clientX-a.startX;a.kind==="middle"?q(S(a.startWidth+l)):B(K(a.startWidth-l))},[S,K]),z=n.useCallback(t=>{const a=Q.current;if(!a||t.pointerId!==a.pointerId)return;try{t.currentTarget.releasePointerCapture(t.pointerId)}catch{}if(Q.current=null,document.body.classList.remove("flat-splitter-dragging"),!(Math.abs(t.clientX-a.startX)>2))return;const r=t.clientX-a.startX;if(a.kind==="middle"){const j=S(a.startWidth+r);q(j),Ue(x.FLAT_MIDDLE_WIDTH,j)}else{const j=K(a.startWidth-r);B(j),Ue(x.FLAT_INSPECTOR_WIDTH,j)}},[S,K]),Re=n.useCallback(()=>{q(null),Ue(x.FLAT_MIDDLE_WIDTH,0)},[]),te=n.useCallback(()=>{B(null),Ue(x.FLAT_INSPECTOR_WIDTH,0)},[]),[Y,Ze]=n.useState(()=>ft(x.FLAT_INSPECTOR_VIEW)==="tracking"?"tracking":"agent"),De=n.useCallback(t=>{Ze(t),ht(x.FLAT_INSPECTOR_VIEW,t)},[]),Je=n.useCallback(()=>{be(t=>{const a=!t;return ue(x.FLAT_INSPECTOR_OPEN,a),a})},[]),Qe=n.useCallback(()=>{be(!1),ue(x.FLAT_INSPECTOR_OPEN,!1)},[]),et=Pt(),tt=n.useCallback((t,a)=>{Ie({url:t,name:a})},[]),at=n.useCallback((t,a)=>{Se({command:t,output:a,isLive:!1})},[]),ae=n.useCallback((t,a)=>{b.setFileViewerPath(t,a)},[]),Z=n.useCallback(t=>{},[]),Ce=n.useCallback((t,a)=>{Me({agentId:t,count:a})},[]),H=n.useCallback(t=>{C?C(t):c(t)},[c,C]),g=n.useMemo(()=>me.size>0?Array.from(me)[0]:null,[me]);n.useEffect(()=>{y(!1)},[g]);const J=n.useRef([]),G=n.useRef(-1),je=n.useRef(!1),V=n.useRef(null),[nt,ze]=n.useState(!1),[Le,$e]=n.useState(!1),L=n.useMemo(()=>new Set(R.map(t=>t.id)),[R]),$=n.useCallback(()=>{const t=J.current,a=G.current;ze(a>0),$e(a>=0&&a<t.length-1)},[]),U=n.useCallback(t=>{const a=J.current;if(a.length===0)return;let l=G.current+t;for(;l>=0&&l<a.length;){const r=a[l];if(L.has(r)){je.current=!0,G.current=l,$(),b.selectAgent(r);return}l+=t}},[L,$]),st=n.useCallback(()=>U(-1),[U]),Oe=n.useCallback(()=>U(1),[U]);n.useEffect(()=>{if(!g){J.current=[],G.current=-1,$();return}if(V.current=g,je.current){je.current=!1,$();return}const t=J.current,a=G.current;if(a>=0&&t[a]===g){$();return}const l=a<t.length-1?t.slice(0,a+1):t.slice();l.push(g),l.length>100&&l.shift(),J.current=l,G.current=l.length-1,$()},[g,$]);const Ne=n.useCallback(t=>{m(t),ce(!1)},[m]),Fe=g??"",We=n.useCallback(()=>{},[]),s=n.useCallback(t=>{Ne(t)},[Ne]),i=xe,d=n.useRef(null);n.useEffect(()=>{if(g)return;const t=a=>{if(a.key!==" "&&a.key!=="Backspace")return;const l=a.target;if(l.tagName==="INPUT"||l.tagName==="TEXTAREA"||l.isContentEditable)return;const r=V.current;!r||!L.has(r)||(a.preventDefault(),b.selectAgent(r))};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[g,L]);const[o,ve]=n.useState(new Set),lt=n.useCallback(t=>{ve(a=>{const l=new Set(a);return l.has(t)?l.delete(t):l.add(t),l})},[]),Be=wt(),[Nt]=Rt(),de=n.useMemo(()=>{const t=new Map,a=[];for(const h of R){const w=b.getAreaForAgent(h.id);if(!Dt((w==null?void 0:w.id)??null))continue;if(!w||w.archived){a.push(h);continue}const O=t.get(w.id);O?O.push(h):t.set(w.id,[h])}const l=[];for(const[,h]of Be){if(h.archived||!zt(h.id))continue;const w=t.get(h.id);w&&w.length>0&&l.push({area:h,agents:w})}a.length>0&&l.push({area:{id:"__unassigned__",name:"Unassigned",color:"#6272a4",center:{x:0,z:0},type:"circle",radius:0,directories:[],archived:!1,assignedAgentIds:[],zIndex:0},agents:a});const r=l.filter(h=>h.area.id!=="__unassigned__"),j=l.filter(h=>h.area.id==="__unassigned__");let _=1,N=1;const ke=new Map;if(r.length>1){let h=1/0,w=-1/0,O=1/0,pe=-1/0;for(const A of r)h=Math.min(h,A.area.center.x),w=Math.max(w,A.area.center.x),O=Math.min(O,A.area.center.z),pe=Math.max(pe,A.area.center.z);const He=w-h||1,Ge=pe-O||1;if(r.length<=4){_=r.length,N=1;const A=[...r].sort((I,rt)=>I.area.center.x-rt.area.center.x);for(let I=0;I<A.length;I++)ke.set(A[I].area.id,{row:1,col:I+1})}else{const A=[...r].sort((f,v)=>f.area.center.x-v.area.center.x),I=[];for(let f=1;f<A.length;f++)I.push(A[f].area.center.x-A[f-1].area.center.x);const rt=I.reduce((f,v)=>f+v,0)/I.length||1;let pt=1;for(const f of I)f>rt*1.3&&pt++;_=Math.max(2,Math.min(pt,r.length));const it=[...r].sort((f,v)=>f.area.center.z-v.area.center.z),Ve=[];for(let f=1;f<it.length;f++)Ve.push(it[f].area.center.z-it[f-1].area.center.z);const At=Ve.reduce((f,v)=>f+v,0)/Ve.length||1;let ut=1;for(const f of Ve)f>At*1.3&&ut++;N=Math.max(2,Math.min(ut,r.length)),_=Math.max(_,Math.ceil(r.length/N)),N=Math.max(N,Math.ceil(r.length/_));const It=He/_,St=Ge/N,ot=new Set;for(const f of r){let v=Math.min(_-1,Math.max(0,Math.floor((f.area.center.x-h)/It))),se=Math.min(N-1,Math.max(0,Math.floor((f.area.center.z-O)/St))),Ae=`${se},${v}`,mt=0;const Mt=N*_;for(;ot.has(Ae)&&mt<Mt;)v++,v>=_&&(v=0,se=(se+1)%N),Ae=`${se},${v}`,mt++;ot.has(Ae)&&(se=N,v=0,Ae=`${se},${v}`,N++),ot.add(Ae),ke.set(f.area.id,{row:se+1,col:v+1})}}}const ne=h=>{h.sort((w,O)=>{var He,Ge,A,I;const pe=(((He=w.position)==null?void 0:He.z)??0)-(((Ge=O.position)==null?void 0:Ge.z)??0);return pe!==0?pe:(((A=w.position)==null?void 0:A.x)??0)-(((I=O.position)==null?void 0:I.x)??0)})};for(const h of r)ne(h.agents);for(const h of j)ne(h.agents);return{groups:[...r,...j],gridCols:_,gridRows:N,positions:ke}},[R,Be,Nt]),vt=n.useMemo(()=>{if(!E)return[];const t=R.find(a=>a.id===E.agentId);return t?[{id:"edit-agent",label:"Edit Agent",icon:e.jsx(u,{name:"edit",size:14}),onClick:()=>{window.dispatchEvent(new CustomEvent("tide:open-agent-edit",{detail:{agentId:t.id}}))}},{id:"open-chat",label:"Open Chat",icon:e.jsx(u,{name:"chat",size:14}),onClick:()=>m(t.id)},{id:"delete-agent",label:"Delete Agent",icon:e.jsx(u,{name:"trash",size:14}),danger:!0,onClick:()=>{Ee({agentId:t.id,name:t.name})}}]:[]},[E,R,m]),kt=n.useCallback(t=>{const a=new Set(de.groups.map(l=>l.area.id));a.delete(t),ve(a),requestAnimationFrame(()=>{const l=d.current;if(!l)return;const r=l.querySelector(`[data-area-id="${t}"]`);if(!r)return;const j=l.getBoundingClientRect(),N=r.getBoundingClientRect().top-j.top+l.scrollTop-8;l.scrollTo({top:Math.max(0,N),behavior:"smooth"})})},[de]);return e.jsxs("div",{ref:W,className:`flat-view ${i?"flat-view--with-inspector":""} ${g?"flat-view--has-chat":""} ${F?"flat-view--mobile-sidebar-open":""}`,style:(()=>{if(X===null&&k===null)return;const t={};return X!==null&&(t["--flat-middle-width"]=`${X}px`),k!==null&&(t["--flat-inspector-width"]=`${k}px`),t})(),children:[F&&e.jsx("div",{className:"flat-mobile-sidebar-backdrop",onClick:Ke,"aria-hidden":"true"}),e.jsxs("div",{className:"flat-middle",children:[e.jsxs("div",{className:"flat-middle__header",children:[e.jsx("h2",{className:"flat-middle__title",children:"👥 Agents"}),e.jsxs("div",{className:"flat-middle__actions",children:[e.jsx("button",{className:"flat-cta-btn flat-cta-btn--agent",onClick:M,title:"Create new agent",children:"+ Agent"}),e.jsx("button",{className:"flat-cta-btn flat-cta-btn--boss",onClick:T,title:"Create new boss agent",children:"+ Boss"}),e.jsx("button",{className:"flat-cta-btn flat-cta-btn--area",onClick:le,title:"Create new area",children:"+ Area"})]})]}),e.jsx("div",{className:"flat-middle__content",children:e.jsx(Lt,{activeAgentId:Fe,onClose:We,onSelectAgent:s,collapsedAreas:o,onToggleArea:lt,agentListRef:d})})]}),e.jsx("div",{className:"flat-splitter flat-splitter--middle",role:"separator","aria-orientation":"vertical","aria-label":"Resize agents panel",title:"Drag to resize · Double-click to reset",onPointerDown:Ye,onPointerMove:we,onPointerUp:z,onPointerCancel:z,onDoubleClick:Re}),e.jsxs("div",{className:"flat-right",children:[e.jsxs("button",{type:"button",className:"flat-mobile-sidebar-toggle","aria-label":F?"Close agents sidebar":"Open agents sidebar","aria-expanded":F,onClick:Pe,children:[e.jsx(u,{name:"list",size:18}),e.jsx("span",{className:"flat-mobile-sidebar-toggle__label",children:"Agents"})]}),g?e.jsx(_a,{agentId:g,terminalViewMode:_e,onTerminalViewModeChange:Te,inspectorOpen:xe,onToggleInspector:Je,onImageClick:tt,onFileClick:ae,onBashClick:at,onViewMarkdown:Z,onRequestClearSubordinates:Ce,onOpenBuilding:H,keyboard:et,canNavigateBack:nt,canNavigateForward:Le,onNavigateBack:st,onNavigateForward:Oe,agentInfoOpen:p,onToggleAgentInfo:ie}):e.jsx("div",{className:"flat-chat flat-chat--empty",children:e.jsxs("div",{className:"flat-map",children:[e.jsxs("div",{className:"flat-map__header",children:[e.jsx("span",{className:"flat-map__title",children:"🗺️ Areas"}),e.jsx("span",{className:"flat-map__hint",children:"Click an area to focus it, or an agent to chat"})]}),e.jsx("div",{className:"flat-map__grid",style:{gridTemplateColumns:`repeat(${de.gridCols}, 1fr)`},children:de.groups.length===0?e.jsx("div",{className:"flat-map__empty",children:e.jsx("span",{children:"No areas or agents yet"})}):de.groups.map(t=>{const a=t.area.id,l=de.positions.get(a);return e.jsxs("div",{className:"flat-map-area-card",style:{"--area-color":t.area.color,gridRow:l==null?void 0:l.row,gridColumn:l==null?void 0:l.col},children:[e.jsxs("button",{type:"button",className:"flat-map-area-card__header",onClick:()=>kt(a),title:`Focus ${t.area.name} in left panel`,children:[e.jsx("span",{className:"flat-map-area-card__color",style:{background:t.area.color}}),e.jsx("span",{className:"flat-map-area-card__name",children:t.area.name}),e.jsx("span",{className:"flat-map-area-card__count",children:t.agents.length})]}),e.jsx("div",{className:"flat-map-area-card__agents",children:t.agents.map(r=>{const j=r.isBoss||r.class==="boss",_=$t(r),N=_.usedPercent>=80?"#ff4a4a":_.usedPercent>=60?"#ff9e4a":_.usedPercent>=40?"#ffd700":"#4aff9e",ke=`Context: ${(_.totalTokens/1e3).toFixed(1)}k / ${(_.contextWindow/1e3).toFixed(1)}k (${_.usedPercent}% used, ${_.freePercent}% free)`;return e.jsxs("button",{type:"button",className:`flat-map-agent-chip ${r.status}`,onClick:()=>m(r.id),onContextMenu:ne=>{ne.preventDefault(),ne.stopPropagation(),re({agentId:r.id,position:{x:ne.clientX,y:ne.clientY}})},title:`${j?"Boss · ":""}Open chat with ${r.name}
2
- ${ke}`,children:[e.jsx(Ct,{agent:r,size:16}),j&&e.jsx("span",{className:"flat-map-agent-chip__crown","aria-hidden":"true",children:e.jsx(u,{name:"crown",size:11,color:"#ffd700",weight:"fill"})}),e.jsx("span",{className:"flat-map-agent-chip__name",children:r.name}),e.jsx("img",{src:r.provider==="codex"?"/assets/codex.png":r.provider==="opencode"?"/assets/opencode.png":"/assets/claude.png",alt:r.provider,className:"flat-map-agent-chip__provider-icon",title:r.provider==="codex"?"Codex Agent":r.provider==="opencode"?"OpenCode Agent":"Claude Agent"}),e.jsx("span",{className:"flat-map-agent-chip__dot",style:{backgroundColor:jt(r.status)}}),e.jsx("span",{className:"flat-map-agent-chip__context-bar","aria-hidden":"true",children:e.jsx("span",{className:"flat-map-agent-chip__context-bar-fill",style:{width:`${_.usedPercent}%`,backgroundColor:N}})})]},r.id)})})]},a)})})]})})]}),i&&e.jsx("div",{className:"flat-splitter flat-splitter--inspector",role:"separator","aria-orientation":"vertical","aria-label":"Resize inspector panel",title:"Drag to resize · Double-click to reset",onPointerDown:ee,onPointerMove:we,onPointerUp:z,onPointerCancel:z,onDoubleClick:te}),i&&e.jsxs("aside",{className:"flat-inspector","aria-label":"Inspector panel",children:[e.jsxs("div",{className:"flat-inspector__header",children:[e.jsxs("div",{className:"flat-inspector__tabs",role:"tablist","aria-label":"Inspector view",children:[e.jsx("button",{type:"button",role:"tab","aria-selected":Y==="agent",className:`flat-inspector__tab ${Y==="agent"?"flat-inspector__tab--active":""}`,onClick:()=>De("agent"),children:"Agent"}),e.jsx("button",{type:"button",role:"tab","aria-selected":Y==="tracking",className:`flat-inspector__tab ${Y==="tracking"?"flat-inspector__tab--active":""}`,onClick:()=>De("tracking"),children:"Tracking"})]}),e.jsx("button",{type:"button",className:"flat-inspector__close",onClick:Qe,title:"Close inspector","aria-label":"Close inspector",children:"✕"})]}),e.jsx("div",{className:"flat-inspector__body",children:Y==="tracking"?e.jsx(Ot,{activeAgentId:g??"",onSelectAgent:t=>m(t)}):(()=>{if(!g)return e.jsx("div",{className:"flat-inspector__empty",children:e.jsx("span",{children:"Select an agent to inspect"})});const t=R.find(a=>a.id===g);return t?e.jsx(Ft,{agent:t,onFocusAgent:a=>m(a),onKillAgent:a=>b.killAgent(a)}):e.jsx("div",{className:"flat-inspector__empty",children:e.jsx("span",{children:"Agent not found"})})})()})]}),fe&&e.jsx(Wt,{url:fe.url,name:fe.name,onClose:()=>Ie(null)}),he&&e.jsx(Bt,{state:he,onClose:()=>Se(null)}),ge&&e.jsx(Ht,{action:"clear-subordinates",selectedAgentId:ge.agentId,subordinateCount:ge.count,onClose:()=>Me(null),onClearHistory:()=>{}}),e.jsx(Gt,{agent:g?R.find(t=>t.id===g)??null:null,isOpen:p&&!!g,onClose:ye}),e.jsx(Vt,{isOpen:E!==null,position:(E==null?void 0:E.position)??{x:0,y:0},worldPosition:{x:0,z:0},actions:vt,onClose:()=>re(null)}),e.jsx(Ut,{isOpen:D!==null,title:P("common:confirm.removeAgentTitle"),message:P("common:confirm.removeAgentMessage",{name:(D==null?void 0:D.name)??""}),confirmLabel:P("common:buttons.remove"),cancelLabel:P("common:buttons.cancel"),variant:"danger",onConfirm:()=>{D&&b.removeAgentFromServer(D.agentId)},onClose:()=>Ee(null)})]})}export{Ca as FlatView};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/web-iMMHHHFW.js","assets/main-BjcLCHKw.js","assets/vendor-react--Eh9ivFN.js","assets/vendor-three-Chj50gSY.js","assets/main-CVksVK2O.css"])))=>i.map(i=>d[i]);
2
- import{bT as e,bk as o}from"./main-BjcLCHKw.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";var i;(function(r){r.Heavy="HEAVY",r.Medium="MEDIUM",r.Light="LIGHT"})(i||(i={}));var t;(function(r){r.Success="SUCCESS",r.Warning="WARNING",r.Error="ERROR"})(t||(t={}));const E=e("Haptics",{web:()=>o(()=>import("./web-iMMHHHFW.js"),__vite__mapDeps([0,1,2,3,4])).then(r=>new r.HapticsWeb)});export{E as Haptics,i as ImpactStyle,t as NotificationType};