tide-commander 1.81.2 → 1.82.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 (39) hide show
  1. package/dist/assets/{BossLogsModal-DZRXmi9F.js → BossLogsModal-c_-m-65A.js} +1 -1
  2. package/dist/assets/{BossSpawnModal-Qp-1_WN-.js → BossSpawnModal-xoclsIKS.js} +1 -1
  3. package/dist/assets/{ControlsModal-CvDnW_cC.js → ControlsModal-DvbJLRQI.js} +1 -1
  4. package/dist/assets/{DockerLogsModal-Cno7HvLt.js → DockerLogsModal-BEwlDjvB.js} +1 -1
  5. package/dist/assets/{EmbeddedEditor-D8pXkybk.js → EmbeddedEditor-Ce0A9MPZ.js} +1 -1
  6. package/dist/assets/{GmailOAuthSetup-wRsZBu_R.js → GmailOAuthSetup-CxPmSlXq.js} +1 -1
  7. package/dist/assets/{GoogleOAuthSetup-DlvDVtaR.js → GoogleOAuthSetup-C5XDtkWo.js} +1 -1
  8. package/dist/assets/{IframeModal-CGwzfF_7.js → IframeModal-B30rL5T9.js} +1 -1
  9. package/dist/assets/{IntegrationsPanel-EDTrDKqo.js → IntegrationsPanel-DOiXFhKJ.js} +2 -2
  10. package/dist/assets/{LogViewerModal-Cq0-Bbn0.js → LogViewerModal-BDDX94V7.js} +1 -1
  11. package/dist/assets/{MonitoringModal-B0cGLmqG.js → MonitoringModal-Bb-ofaiK.js} +1 -1
  12. package/dist/assets/{PM2LogsModal-DtW6bf3e.js → PM2LogsModal-BbwXHEqR.js} +1 -1
  13. package/dist/assets/{RestoreArchivedAreaModal-zx5Q6h38.js → RestoreArchivedAreaModal-DDndv4rZ.js} +1 -1
  14. package/dist/assets/{Scene2DCanvas-BNZ5RR9P.js → Scene2DCanvas-D0mV81Bm.js} +1 -1
  15. package/dist/assets/{SceneManager-laHIfEsj.js → SceneManager-BT7vcVki.js} +1 -1
  16. package/dist/assets/{SkillsPanel-BgvoPt9m.js → SkillsPanel-Db_tfT8F.js} +1 -1
  17. package/dist/assets/{SpawnModal-C8wGN7nF.js → SpawnModal-BgBB9Nre.js} +1 -1
  18. package/dist/assets/{SubordinateAssignmentModal-DHWOYVQS.js → SubordinateAssignmentModal-CsNUXzAa.js} +1 -1
  19. package/dist/assets/{TriggerManagerPanel-Blj9GbVF.js → TriggerManagerPanel-DLjvwFj_.js} +1 -1
  20. package/dist/assets/{WorkflowEditorPanel-PQVbrGe2.js → WorkflowEditorPanel-CtWq2X20.js} +1 -1
  21. package/dist/assets/{index-CuW8sL4P.js → index-B-kiGa62.js} +1 -1
  22. package/dist/assets/{index-CETFCBfW.js → index-BKRYCHvF.js} +1 -1
  23. package/dist/assets/{index-CK1V8xb4.js → index-BWFXqJh3.js} +1 -1
  24. package/dist/assets/{index-Bm-3Y75u.js → index-Blb2sMy-.js} +1 -1
  25. package/dist/assets/{index-pOZbL2n3.js → index-Bx7MluX4.js} +2 -2
  26. package/dist/assets/{index-t7lwPEP4.js → index-CeGEneIm.js} +1 -1
  27. package/dist/assets/index-CjAFgIm3.css +1 -0
  28. package/dist/assets/index-DjcUPqW1.js +2 -0
  29. package/dist/assets/{index-DBYeO6aa.js → index-dz45uNT2.js} +1 -1
  30. package/dist/assets/{index-3By2EvEk.js → index-kLrB6kGv.js} +34 -34
  31. package/dist/assets/{main-D2zY87-h.js → main-C0wLbrjb.js} +4 -4
  32. package/dist/assets/{main-Don8zSEt.css → main-DrNeyjdE.css} +1 -1
  33. package/dist/assets/{web-OfBdMX7W.js → web-CQeInubf.js} +1 -1
  34. package/dist/assets/{web-Bn3nEKUR.js → web-Dpd6fLBM.js} +1 -1
  35. package/dist/index.html +2 -2
  36. package/dist/locales/en/terminal.json +12 -0
  37. package/dist/src/packages/server/routes/files.js +256 -0
  38. package/package.json +1 -1
  39. package/dist/assets/index-DnnOJmrH.js +0 -2
@@ -1,4 +1,4 @@
1
- import{bc as ta,u as D,j as e,aH as v,bf as $s,bg as Fs,aI as He,s as P,bh as Ms,D as Y,I as A,_ as Hs,aR as Ge,f as na,bi as la,r,E as ia,S as oa,h as ra,bj as Us,aS as Ke}from"./main-D2zY87-h.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";const ca=[{value:"",labelKey:"terminal:building.colorDefault"},{value:"#2a2a3a",labelKey:"terminal:building.colorDarkGray"},{value:"#3a2a2a",labelKey:"terminal:building.colorDarkRed"},{value:"#2a3a2a",labelKey:"terminal:building.colorDarkGreen"},{value:"#2a2a4a",labelKey:"terminal:building.colorDarkBlue"},{value:"#3a3a2a",labelKey:"terminal:building.colorDarkYellow"},{value:"#3a2a3a",labelKey:"terminal:building.colorDarkPurple"},{value:"#2a3a3a",labelKey:"terminal:building.colorDarkCyan"},{value:"#4a3a3a",labelKey:"terminal:building.colorWarmBrown"},{value:"#3a4a4a",labelKey:"terminal:building.colorCoolSteel"}];function ma(a){return ta.t(a)}function Ve(a){if(a===0)return"0 B";const l=1024,c=["B","KB","MB","GB"],h=Math.floor(Math.log(a)/Math.log(l));return parseFloat((a/Math.pow(l,h)).toFixed(1))+" "+c[h]}function da(a){const c=Date.now()-a,h=Math.floor(c/(1e3*60*60)),t=Math.floor(c%(1e3*60*60)/(1e3*60));return h>0?`${h}h ${t}m`:`${t}m`}const Ks={30:"#1a1a1a",31:"#e74c3c",32:"#2ecc71",33:"#f39c12",34:"#3498db",35:"#9b59b6",36:"#00bcd4",37:"#ecf0f1",90:"#7f8c8d",91:"#ff6b6b",92:"#4ade80",93:"#fbbf24",94:"#60a5fa",95:"#c084fc",96:"#22d3ee",97:"#ffffff"};function Gs(a){const l=[],c=/\x1B\[([0-9;]*)m/g;let h=0,t=null,o;for(;(o=c.exec(a))!==null;){if(o.index>h){const m=a.slice(h,o.index);t?l.push(e.jsx("span",{style:{color:t},children:m},l.length)):l.push(m)}const g=o[1].split(";").map(Number);for(const m of g)m===0||m===39?t=null:Ks[m]&&(t=Ks[m]);h=c.lastIndex}if(h<a.length){const g=a.slice(h);t?l.push(e.jsx("span",{style:{color:t},children:g},l.length)):l.push(g)}return l.length>0?l:[a]}function ua({buildingName:a,onClose:l,onConfirm:c}){const{t:h}=D(["terminal","common"]);return e.jsx("div",{className:"modal-overlay visible",onClick:l,children:e.jsxs("div",{className:"modal confirm-modal",onClick:t=>t.stopPropagation(),children:[e.jsx("div",{className:"modal-header",children:h("terminal:building.deleteBuilding")}),e.jsxs("div",{className:"modal-body confirm-modal-body",children:[e.jsx("p",{children:h("terminal:building.deleteConfirm",{name:a})}),e.jsx("p",{className:"confirm-modal-note",children:h("terminal:building.deleteNote")})]}),e.jsxs("div",{className:"modal-footer",children:[e.jsx("button",{className:"btn btn-secondary",onClick:l,children:h("common:buttons.cancel")}),e.jsx("button",{className:"btn btn-danger",onClick:c,autoFocus:!0,children:h("common:buttons.delete")})]})]})})}function pa({usePM2:a,setUsePM2:l}){const{t:c}=D(["terminal"]);return e.jsxs("div",{className:"form-section pm2-toggle-section",children:[e.jsxs("label",{className:"toggle-switch",children:[e.jsx("input",{type:"checkbox",className:"toggle-input",checked:a,onChange:h=>l(h.target.checked)}),e.jsx("span",{className:"toggle-track",children:e.jsx("span",{className:"toggle-thumb"})}),e.jsxs("span",{className:"toggle-label",children:[e.jsx("span",{className:"pm2-badge",children:"PM2"}),c("terminal:building.usePM2")]})]}),e.jsx("div",{className:"form-hint",children:c("terminal:building.pm2Hint")})]})}function ha({usePM2:a,pm2Script:l,setPm2Script:c,pm2Args:h,setPm2Args:t,pm2Interpreter:o,setPm2Interpreter:g,pm2InterpreterArgs:m,setPm2InterpreterArgs:d,pm2Env:s,setPm2Env:u,isEditMode:b,building:x,handleCommand:N}){var y;const{t:p}=D(["terminal","common"]);return a?e.jsxs("div",{className:"form-section pm2-config-section",children:[e.jsx("label",{className:"form-label",children:p("terminal:building.pm2Configuration")}),e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:[p("terminal:building.pm2Script"),e.jsx(v,{text:p("terminal:building.helpPm2Script"),title:p("terminal:building.pm2Script"),position:"top",size:"sm"})]}),e.jsx("input",{type:"text",className:"form-input",value:l,onChange:j=>c(j.target.value),placeholder:"npm, java, python, ./app.js",required:a})]}),e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:[p("terminal:building.pm2Arguments"),e.jsx(v,{text:p("terminal:building.helpPm2Arguments"),title:p("terminal:building.pm2Arguments"),position:"top",size:"sm"})]}),e.jsx("input",{type:"text",className:"form-input",value:h,onChange:j=>t(j.target.value),placeholder:"run dev, -jar app.jar, app.py"})]}),e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:[p("terminal:building.pm2Interpreter"),e.jsx(v,{text:p("terminal:building.helpPm2Interpreter"),title:p("terminal:building.pm2Interpreter"),position:"top",size:"sm"})]}),e.jsx("select",{className:"form-input form-select",value:o,onChange:j=>g(j.target.value),children:Object.keys($s).map(j=>e.jsx("option",{value:j,children:$s[j].label},j))})]}),e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:[p("terminal:building.pm2InterpArgs"),e.jsx(v,{text:p("terminal:building.helpPm2InterpArgs"),title:p("terminal:building.pm2InterpArgs"),position:"top",size:"sm"})]}),e.jsx("input",{type:"text",className:"form-input",value:m,onChange:j=>d(j.target.value),placeholder:"-jar (for Java)"})]}),e.jsxs("div",{className:"command-row env-row",children:[e.jsxs("span",{className:"command-label",children:[p("terminal:building.pm2Environment"),e.jsx(v,{text:p("terminal:building.helpPm2Environment"),title:p("terminal:building.pm2Environment"),position:"top",size:"sm"})]}),e.jsx("textarea",{className:"form-input form-textarea",value:s,onChange:j=>u(j.target.value),placeholder:`KEY=value
1
+ import{bc as ta,u as D,j as e,aH as v,bf as $s,bg as Fs,aI as He,s as P,bh as Ms,D as Y,I as A,_ as Hs,aR as Ge,f as na,bi as la,r,E as ia,S as oa,h as ra,bj as Us,aS as Ke}from"./main-C0wLbrjb.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";const ca=[{value:"",labelKey:"terminal:building.colorDefault"},{value:"#2a2a3a",labelKey:"terminal:building.colorDarkGray"},{value:"#3a2a2a",labelKey:"terminal:building.colorDarkRed"},{value:"#2a3a2a",labelKey:"terminal:building.colorDarkGreen"},{value:"#2a2a4a",labelKey:"terminal:building.colorDarkBlue"},{value:"#3a3a2a",labelKey:"terminal:building.colorDarkYellow"},{value:"#3a2a3a",labelKey:"terminal:building.colorDarkPurple"},{value:"#2a3a3a",labelKey:"terminal:building.colorDarkCyan"},{value:"#4a3a3a",labelKey:"terminal:building.colorWarmBrown"},{value:"#3a4a4a",labelKey:"terminal:building.colorCoolSteel"}];function ma(a){return ta.t(a)}function Ve(a){if(a===0)return"0 B";const l=1024,c=["B","KB","MB","GB"],h=Math.floor(Math.log(a)/Math.log(l));return parseFloat((a/Math.pow(l,h)).toFixed(1))+" "+c[h]}function da(a){const c=Date.now()-a,h=Math.floor(c/(1e3*60*60)),t=Math.floor(c%(1e3*60*60)/(1e3*60));return h>0?`${h}h ${t}m`:`${t}m`}const Ks={30:"#1a1a1a",31:"#e74c3c",32:"#2ecc71",33:"#f39c12",34:"#3498db",35:"#9b59b6",36:"#00bcd4",37:"#ecf0f1",90:"#7f8c8d",91:"#ff6b6b",92:"#4ade80",93:"#fbbf24",94:"#60a5fa",95:"#c084fc",96:"#22d3ee",97:"#ffffff"};function Gs(a){const l=[],c=/\x1B\[([0-9;]*)m/g;let h=0,t=null,o;for(;(o=c.exec(a))!==null;){if(o.index>h){const m=a.slice(h,o.index);t?l.push(e.jsx("span",{style:{color:t},children:m},l.length)):l.push(m)}const g=o[1].split(";").map(Number);for(const m of g)m===0||m===39?t=null:Ks[m]&&(t=Ks[m]);h=c.lastIndex}if(h<a.length){const g=a.slice(h);t?l.push(e.jsx("span",{style:{color:t},children:g},l.length)):l.push(g)}return l.length>0?l:[a]}function ua({buildingName:a,onClose:l,onConfirm:c}){const{t:h}=D(["terminal","common"]);return e.jsx("div",{className:"modal-overlay visible",onClick:l,children:e.jsxs("div",{className:"modal confirm-modal",onClick:t=>t.stopPropagation(),children:[e.jsx("div",{className:"modal-header",children:h("terminal:building.deleteBuilding")}),e.jsxs("div",{className:"modal-body confirm-modal-body",children:[e.jsx("p",{children:h("terminal:building.deleteConfirm",{name:a})}),e.jsx("p",{className:"confirm-modal-note",children:h("terminal:building.deleteNote")})]}),e.jsxs("div",{className:"modal-footer",children:[e.jsx("button",{className:"btn btn-secondary",onClick:l,children:h("common:buttons.cancel")}),e.jsx("button",{className:"btn btn-danger",onClick:c,autoFocus:!0,children:h("common:buttons.delete")})]})]})})}function pa({usePM2:a,setUsePM2:l}){const{t:c}=D(["terminal"]);return e.jsxs("div",{className:"form-section pm2-toggle-section",children:[e.jsxs("label",{className:"toggle-switch",children:[e.jsx("input",{type:"checkbox",className:"toggle-input",checked:a,onChange:h=>l(h.target.checked)}),e.jsx("span",{className:"toggle-track",children:e.jsx("span",{className:"toggle-thumb"})}),e.jsxs("span",{className:"toggle-label",children:[e.jsx("span",{className:"pm2-badge",children:"PM2"}),c("terminal:building.usePM2")]})]}),e.jsx("div",{className:"form-hint",children:c("terminal:building.pm2Hint")})]})}function ha({usePM2:a,pm2Script:l,setPm2Script:c,pm2Args:h,setPm2Args:t,pm2Interpreter:o,setPm2Interpreter:g,pm2InterpreterArgs:m,setPm2InterpreterArgs:d,pm2Env:s,setPm2Env:u,isEditMode:b,building:x,handleCommand:N}){var y;const{t:p}=D(["terminal","common"]);return a?e.jsxs("div",{className:"form-section pm2-config-section",children:[e.jsx("label",{className:"form-label",children:p("terminal:building.pm2Configuration")}),e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:[p("terminal:building.pm2Script"),e.jsx(v,{text:p("terminal:building.helpPm2Script"),title:p("terminal:building.pm2Script"),position:"top",size:"sm"})]}),e.jsx("input",{type:"text",className:"form-input",value:l,onChange:j=>c(j.target.value),placeholder:"npm, java, python, ./app.js",required:a})]}),e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:[p("terminal:building.pm2Arguments"),e.jsx(v,{text:p("terminal:building.helpPm2Arguments"),title:p("terminal:building.pm2Arguments"),position:"top",size:"sm"})]}),e.jsx("input",{type:"text",className:"form-input",value:h,onChange:j=>t(j.target.value),placeholder:"run dev, -jar app.jar, app.py"})]}),e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:[p("terminal:building.pm2Interpreter"),e.jsx(v,{text:p("terminal:building.helpPm2Interpreter"),title:p("terminal:building.pm2Interpreter"),position:"top",size:"sm"})]}),e.jsx("select",{className:"form-input form-select",value:o,onChange:j=>g(j.target.value),children:Object.keys($s).map(j=>e.jsx("option",{value:j,children:$s[j].label},j))})]}),e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:[p("terminal:building.pm2InterpArgs"),e.jsx(v,{text:p("terminal:building.helpPm2InterpArgs"),title:p("terminal:building.pm2InterpArgs"),position:"top",size:"sm"})]}),e.jsx("input",{type:"text",className:"form-input",value:m,onChange:j=>d(j.target.value),placeholder:"-jar (for Java)"})]}),e.jsxs("div",{className:"command-row env-row",children:[e.jsxs("span",{className:"command-label",children:[p("terminal:building.pm2Environment"),e.jsx(v,{text:p("terminal:building.helpPm2Environment"),title:p("terminal:building.pm2Environment"),position:"top",size:"sm"})]}),e.jsx("textarea",{className:"form-input form-textarea",value:s,onChange:j=>u(j.target.value),placeholder:`KEY=value
2
2
  SERVER_PORT=7201
3
3
  NODE_ENV=production`,rows:3})]}),e.jsx("div",{className:"pm2-examples",children:e.jsxs("details",{children:[e.jsx("summary",{children:p("terminal:building.pm2Examples")}),e.jsxs("div",{className:"pm2-examples-content",children:[e.jsxs("div",{className:"pm2-example",children:[e.jsx("strong",{children:"Node.js:"})," Script: ",e.jsx("code",{children:"npm"}),", Args: ",e.jsx("code",{children:"run dev"})]}),e.jsxs("div",{className:"pm2-example",children:[e.jsx("strong",{children:"Symfony:"})," Script: ",e.jsx("code",{children:"symfony"}),", Args: ",e.jsx("code",{children:"serve --no-daemon"}),", Interpreter: ",e.jsx("code",{children:"None"})]}),e.jsxs("div",{className:"pm2-example",children:[e.jsx("strong",{children:"Java JAR:"})," Script: ",e.jsx("code",{children:"app.jar"}),", Interpreter: ",e.jsx("code",{children:"Java"}),", Interp. Args: ",e.jsx("code",{children:"-jar"})]}),e.jsxs("div",{className:"pm2-example",children:[e.jsx("strong",{children:"Python:"})," Script: ",e.jsx("code",{children:"app.py"}),", Interpreter: ",e.jsx("code",{children:"Python 3"})]})]})]})}),b&&(x==null?void 0:x.pm2Status)&&e.jsx("div",{className:"pm2-status-display",children:e.jsxs("div",{className:"pm2-status-row",children:[e.jsxs("span",{className:"pm2-metric",children:[e.jsx("span",{className:"pm2-metric-label",children:"PID"}),e.jsx("span",{className:"pm2-metric-value",children:x.pm2Status.pid||"-"})]}),e.jsxs("span",{className:"pm2-metric",children:[e.jsx("span",{className:"pm2-metric-label",children:"CPU"}),e.jsxs("span",{className:"pm2-metric-value",children:[((y=x.pm2Status.cpu)==null?void 0:y.toFixed(1))||"0","%"]})]}),e.jsxs("span",{className:"pm2-metric",children:[e.jsx("span",{className:"pm2-metric-label",children:"MEM"}),e.jsx("span",{className:"pm2-metric-value",children:Ve(x.pm2Status.memory||0)})]}),e.jsxs("span",{className:"pm2-metric",children:[e.jsx("span",{className:"pm2-metric-label",children:"Restarts"}),e.jsx("span",{className:"pm2-metric-value",children:x.pm2Status.restarts||0})]}),x.pm2Status.uptime&&e.jsxs("span",{className:"pm2-metric",children:[e.jsx("span",{className:"pm2-metric-label",children:"Uptime"}),e.jsx("span",{className:"pm2-metric-value",children:da(x.pm2Status.uptime)})]})]})}),b&&e.jsxs("div",{className:"pm2-actions",children:[e.jsx("button",{type:"button",className:"btn btn-sm btn-success",onClick:()=>N("start"),children:p("common:buttons.start")}),e.jsx("button",{type:"button",className:"btn btn-sm btn-danger",onClick:()=>N("stop"),children:p("common:buttons.stop")}),e.jsx("button",{type:"button",className:"btn btn-sm btn-warning",onClick:()=>N("restart"),children:p("terminal:buildingAction.restart")}),e.jsx("button",{type:"button",className:"btn btn-sm",onClick:()=>N("logs"),children:p("terminal:logs.title")})]})]}):null}function xa({dockerMode:a,setDockerMode:l,dockerImage:c,setDockerImage:h,dockerContainerName:t,setDockerContainerName:o,dockerCommand:g,setDockerCommand:m,dockerPorts:d,setDockerPorts:s,dockerVolumes:u,setDockerVolumes:b,dockerNetwork:x,setDockerNetwork:N,dockerRestart:p,setDockerRestart:y,dockerPull:j,setDockerPull:F,dockerEnv:M,setDockerEnv:R,dockerComposePath:J,setDockerComposePath:U,dockerComposeProject:W,setDockerComposeProject:K,dockerComposeServices:Z,setDockerComposeServices:H,selectedExistingContainer:O,setSelectedExistingContainer:G,dockerContainersList:T,isEditMode:I,building:k,handleCommand:L}){const{t:z}=D(["config","common"]);return e.jsxs("div",{className:"form-section docker-config-section",children:[e.jsx("label",{className:"form-label",children:z("config:buildings.dockerConfig")}),e.jsxs("div",{className:"docker-mode-selector",children:[e.jsxs("label",{className:`docker-mode-option ${a==="container"?"active":""}`,children:[e.jsx("input",{type:"radio",name:"dockerMode",value:"container",checked:a==="container",onChange:()=>l("container")}),e.jsx("span",{className:"docker-mode-icon",children:"📦"}),e.jsx("span",{className:"docker-mode-label",children:"Container"}),e.jsx("span",{className:"docker-mode-desc",children:"Create a new container"})]}),e.jsxs("label",{className:`docker-mode-option ${a==="compose"?"active":""}`,children:[e.jsx("input",{type:"radio",name:"dockerMode",value:"compose",checked:a==="compose",onChange:()=>l("compose")}),e.jsx("span",{className:"docker-mode-icon",children:"🛠"}),e.jsx("span",{className:"docker-mode-label",children:"Compose"}),e.jsx("span",{className:"docker-mode-desc",children:"Manage multiple services"})]}),e.jsxs("label",{className:`docker-mode-option ${a==="existing"?"active":""}`,children:[e.jsx("input",{type:"radio",name:"dockerMode",value:"existing",checked:a==="existing",onChange:()=>l("existing")}),e.jsx("span",{className:"docker-mode-icon",children:"🔎"}),e.jsx("span",{className:"docker-mode-label",children:"Existing"}),e.jsx("span",{className:"docker-mode-desc",children:"Adopt existing container"})]})]}),a==="container"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:["Image:",e.jsx(v,{text:"Docker image to run, e.g., nginx:latest, redis:alpine, my-app:v1",title:"Image",position:"top",size:"sm"})]}),e.jsx("input",{type:"text",className:"form-input",value:c,onChange:n=>h(n.target.value),placeholder:"nginx:latest",required:!0})]}),e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:["Container Name:",e.jsx(v,{text:"Custom name for the container. If empty, auto-generated based on building name.",title:"Container Name",position:"top",size:"sm"})]}),e.jsx("input",{type:"text",className:"form-input",value:t,onChange:n=>o(n.target.value),placeholder:"Auto-generated (tc-{name}-{id})"})]}),e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:["Command:",e.jsx(v,{text:"Override the default container command. Leave empty to use image's CMD.",title:"Command Override",position:"top",size:"sm"})]}),e.jsx("input",{type:"text",className:"form-input",value:g,onChange:n=>m(n.target.value),placeholder:"Optional command override"})]}),e.jsxs("div",{className:"form-section docker-ports-section",children:[e.jsxs("label",{className:"form-label",children:["Port Mappings",e.jsx("button",{type:"button",className:"btn btn-sm btn-add",onClick:()=>s([...d,""]),children:"+ Add"})]}),d.map((n,C)=>e.jsxs("div",{className:"docker-mapping-row",children:[e.jsx("input",{type:"text",className:"form-input",value:n,onChange:B=>{const E=[...d];E[C]=B.target.value,s(E)},placeholder:"8080:80 or 3000"}),e.jsx("button",{type:"button",className:"btn btn-sm btn-danger",onClick:()=>s(d.filter((B,E)=>E!==C)),children:"x"})]},C)),d.length===0&&e.jsx("div",{className:"form-hint",children:"Format: host:container (e.g., 8080:80) or same port (e.g., 3000)"})]}),e.jsxs("div",{className:"form-section docker-volumes-section",children:[e.jsxs("label",{className:"form-label",children:["Volume Mounts",e.jsx("button",{type:"button",className:"btn btn-sm btn-add",onClick:()=>b([...u,""]),children:"+ Add"})]}),u.map((n,C)=>e.jsxs("div",{className:"docker-mapping-row",children:[e.jsx("input",{type:"text",className:"form-input",value:n,onChange:B=>{const E=[...u];E[C]=B.target.value,b(E)},placeholder:"./data:/app/data or /host/path:/container/path"}),e.jsx("button",{type:"button",className:"btn btn-sm btn-danger",onClick:()=>b(u.filter((B,E)=>E!==C)),children:"x"})]},C)),u.length===0&&e.jsx("div",{className:"form-hint",children:"Format: host_path:container_path (relative paths resolved from working directory)"})]}),e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:["Network:",e.jsx(v,{text:"Docker network to connect to. Leave empty for default bridge network.",title:"Network",position:"top",size:"sm"})]}),e.jsx("input",{type:"text",className:"form-input",value:x,onChange:n=>N(n.target.value),placeholder:"bridge (default)"})]}),e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:["Restart Policy:",e.jsx(v,{text:"When should Docker restart the container automatically?",title:"Restart Policy",position:"top",size:"sm"})]}),e.jsx("select",{className:"form-input form-select",value:p,onChange:n=>y(n.target.value),children:Object.keys(Fs).map(n=>e.jsx("option",{value:n,children:Fs[n].label},n))})]})]}),a==="compose"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:["Compose File:",e.jsx(v,{text:"Path to docker-compose.yml file, relative to working directory.",title:"Compose File",position:"top",size:"sm"})]}),e.jsx(He,{value:J,onChange:U,placeholder:"docker-compose.yml",className:"form-input",directoriesOnly:!1})]}),e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:["Project Name:",e.jsx(v,{text:"Override the compose project name. Leave empty for auto-generated name.",title:"Project Name",position:"top",size:"sm"})]}),e.jsx("input",{type:"text",className:"form-input",value:W,onChange:n=>K(n.target.value),placeholder:"Auto-generated"})]}),e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:["Services:",e.jsx(v,{text:"Specific services to manage (comma-separated). Leave empty for all services.",title:"Services",position:"top",size:"sm"})]}),e.jsx("input",{type:"text",className:"form-input",value:Z,onChange:n=>H(n.target.value),placeholder:"All services (or: api, db, redis)"})]})]}),a==="existing"&&e.jsxs("div",{className:"docker-existing-section",children:[e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:["Select Container:",e.jsx(v,{text:"Choose an existing Docker container to monitor and control. The container will not be deleted when removing the building.",title:"Existing Container",position:"top",size:"sm"})]}),e.jsxs("div",{className:"docker-existing-select-wrapper",children:[e.jsxs("select",{className:"form-input form-select",value:O,onChange:n=>G(n.target.value),required:a==="existing",children:[e.jsx("option",{value:"",children:"Select a container..."}),T.map(n=>e.jsxs("option",{value:n.name,children:[n.name," (",n.image,") - ",n.state]},n.id))]}),e.jsx("button",{type:"button",className:"btn btn-sm",onClick:()=>P.requestDockerContainersList(),title:"Refresh container list",children:"↻"})]})]}),T.length===0&&e.jsx("div",{className:"form-hint docker-existing-hint",children:"No containers found. Make sure Docker is running and you have containers available."}),O&&e.jsx("div",{className:"docker-existing-info",children:(()=>{const n=T.find(C=>C.name===O);return n?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"docker-existing-info-row",children:[e.jsx("span",{className:"docker-existing-info-label",children:"Image:"}),e.jsx("span",{className:"docker-existing-info-value",children:n.image})]}),e.jsxs("div",{className:"docker-existing-info-row",children:[e.jsx("span",{className:"docker-existing-info-label",children:"Status:"}),e.jsx("span",{className:`docker-existing-info-value docker-status-${n.status}`,children:n.state})]}),e.jsxs("div",{className:"docker-existing-info-row",children:[e.jsx("span",{className:"docker-existing-info-label",children:"ID:"}),e.jsx("span",{className:"docker-existing-info-value",children:n.id.slice(0,12)})]}),n.ports.length>0&&e.jsxs("div",{className:"docker-existing-info-row",children:[e.jsx("span",{className:"docker-existing-info-label",children:"Ports:"}),e.jsx("span",{className:"docker-existing-info-value",children:n.ports.map(C=>`${C.host}:${C.container}/${C.protocol}`).join(", ")})]})]}):null})()}),e.jsx("div",{className:"form-hint",children:"Note: Existing containers will not be deleted when you remove this building."})]}),a!=="existing"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:["Pull Policy:",e.jsx(v,{text:"When to pull images: always, only if missing, or never.",title:"Pull Policy",position:"top",size:"sm"})]}),e.jsx("select",{className:"form-input form-select",value:j,onChange:n=>F(n.target.value),children:Object.keys(Ms).map(n=>e.jsx("option",{value:n,children:Ms[n].label},n))})]}),e.jsxs("div",{className:"command-row env-row",children:[e.jsxs("span",{className:"command-label",children:["Environment:",e.jsx(v,{text:"Environment variables in KEY=value format, one per line.",title:"Environment Variables",position:"top",size:"sm"})]}),e.jsx("textarea",{className:"form-input form-textarea",value:M,onChange:n=>R(n.target.value),placeholder:`KEY=value
4
4
  DATABASE_URL=postgres://...
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/web-OfBdMX7W.js","assets/main-D2zY87-h.js","assets/vendor-react--Eh9ivFN.js","assets/vendor-three-Chj50gSY.js","assets/main-Don8zSEt.css"])))=>i.map(i=>d[i]);
2
- import{c5 as e,by as o}from"./main-D2zY87-h.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 c=e("Haptics",{web:()=>o(()=>import("./web-OfBdMX7W.js"),__vite__mapDeps([0,1,2,3,4])).then(r=>new r.HapticsWeb)});export{c as Haptics,i as ImpactStyle,t as NotificationType};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/web-CQeInubf.js","assets/main-C0wLbrjb.js","assets/vendor-react--Eh9ivFN.js","assets/vendor-three-Chj50gSY.js","assets/main-DrNeyjdE.css"])))=>i.map(i=>d[i]);
2
+ import{c5 as e,by as o}from"./main-C0wLbrjb.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 c=e("Haptics",{web:()=>o(()=>import("./web-CQeInubf.js"),__vite__mapDeps([0,1,2,3,4])).then(r=>new r.HapticsWeb)});export{c as Haptics,i as ImpactStyle,t as NotificationType};
@@ -1 +1 @@
1
- import{a7 as as,u as ts,an as vs,ao as bs,ap as zs,j as s,I as F,W as Is,aq as Es,ar as $s,as as Ds,at as Ms,r as c,_ as Ls,ad as Ss,O as Xs,N as Ps,B as Rs,au as Ys,av as Gs,aw as Us,ax as ms,ay as _s,s as M,az as Fs,n as U}from"./main-D2zY87-h.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";const fs=as.memo(({agent:a,isSelected:A,isKeyboardFocused:L=!1,onSelect:S,onDoubleClick:n,onChat:g,onFocus:h,onKill:w,onDragStart:X})=>{const{t:x}=ts(["dashboard","common"]),P=vs().has(a.id),N=bs(a.status),B=zs(a),j=Ms(B),I=a.taskLabel?s.jsxs(s.Fragment,{children:[s.jsx(F,{name:"task",size:12})," ",a.taskLabel]}):a.currentTask||a.lastAssignedTask,m=a.status==="idle"&&a.lastActivity>0,[,H]=as.useState(0);return as.useEffect(()=>{if(!m)return;const b=window.setInterval(()=>H(T=>T+1),15e3);return()=>window.clearInterval(b)},[m]),s.jsxs("div",{className:`dash-card dash-card--${N} ${A?"dash-card--selected":""} ${L?"dash-card--keyboard-focused":""}`,"data-agent-id":a.id,onClick:S,onDoubleClick:b=>{b.stopPropagation(),n()},onDragStart:b=>{X==null||X(a),b.dataTransfer.effectAllowed="move"},draggable:!0,title:x("cards.doubleClickHint"),children:[s.jsxs("div",{className:"dash-card__row1",children:[s.jsx("span",{className:`dash-card__status-dot dash-card__status-dot--${N}`}),s.jsx("span",{className:"dash-card__name",children:a.name}),s.jsxs("span",{className:"dash-card__class",children:[s.jsx(Is,{agent:a,size:14})," ",a.class]}),s.jsxs("span",{className:`dash-card__provider dash-card__provider--${a.provider}`,children:[s.jsx(F,{name:a.provider==="codex"||a.provider==="opencode"?"status-pending":"robot",size:11,weight:a.provider==="codex"||a.provider==="opencode"?"fill":"regular",color:a.provider==="codex"?"#a16207":a.provider==="opencode"?"#4ade80":void 0})," ",a.provider]}),P&&s.jsx("span",{className:"dash-card__unseen-badge",title:"New output available - click to view",children:"!"})]}),s.jsxs("div",{className:"dash-card__row2",children:[s.jsx("span",{className:`dash-card__status dash-card__status--${N}`,children:P?"Unseen":a.status}),s.jsxs("div",{className:"dash-card__context",children:[s.jsx("div",{className:"dash-card__context-bar",children:s.jsx("div",{className:`dash-card__context-fill dash-card__context-fill--${j}`,style:{width:`${B}%`}})}),s.jsxs("span",{className:`dash-card__context-pct dash-card__context-pct--${j}`,children:[B,"%"]})]})]}),s.jsxs("div",{className:"dash-card__row3",children:[s.jsxs("span",{className:"dash-card__workdir",title:a.cwd,children:[s.jsx(F,{name:"folder",size:11})," ",a.cwd.split("/").pop()||a.cwd]}),m&&s.jsxs("span",{className:"dash-card__idle-time",style:{color:Ds(a.lastActivity)},title:$s(a.lastActivity),children:[s.jsx(F,{name:"status-waiting-input",size:10})," ",Es(a.lastActivity)]})]}),I&&s.jsx("div",{className:"dash-card__row4",children:s.jsx("span",{className:"dash-card__task",children:I})}),s.jsxs("div",{className:"dash-card__actions",children:[g&&s.jsx("button",{className:"dash-card__action-btn dash-card__action-btn--chat",onClick:b=>{b.stopPropagation(),g()},title:x("cards.openTerminal"),children:x("cards.chat")}),w&&s.jsx("button",{className:"dash-card__action-btn dash-card__action-btn--danger",onClick:b=>{b.stopPropagation(),w()},title:x("cards.killAgent"),children:x("cards.stop")})]})]})});fs.displayName="AgentCard";const ws=({buildings:a,onSelectBuilding:A})=>{const{t:L}=ts(["dashboard"]),S=c.useMemo(()=>Array.from(a.values()).sort((n,g)=>n.name.localeCompare(g.name)),[a]);return s.jsxs("div",{className:"dashboard-view__buildings",children:[s.jsxs("div",{className:"dashboard-view__buildings-header",children:[s.jsx("span",{className:"dashboard-view__buildings-title",children:L("buildings.title")}),s.jsx("span",{className:"dashboard-view__buildings-count",children:S.length})]}),s.jsx("div",{className:"dashboard-view__buildings-row",children:S.map(n=>{const g=bs(n.status),h=Ls(n.type);return s.jsxs("button",{className:`dash-pill dash-pill--${g}`,onClick:()=>A==null?void 0:A(n.id),title:`${n.name} (${n.type}) - ${n.status}`,children:[s.jsx("span",{className:"dash-pill__icon",children:s.jsx(F,{name:h,size:14})}),s.jsx("span",{className:"dash-pill__name",children:n.name}),s.jsx("span",{className:`dash-pill__dot dash-pill__dot--${g}`})]},n.id)})})]})};ws.displayName="BuildingPills";function Zs({onSelectAgent:a,onFocusAgent:A,onKillAgent:L,onSelectBuilding:S,onOpenTerminal:n,onFocusZone:g}){const{t:h}=ts(["dashboard","common"]),w=Ss(),X=Xs(),x=Ps(),rs=Rs(),P=vs(),[N,B]=c.useState(""),[j,I]=c.useState("all"),[m,H]=c.useState("zone"),[b,T]=c.useState(new Set),[k,J]=c.useState(null),[ps,Z]=c.useState(null),[R,Q]=c.useState(!1),[p,W]=c.useState(null),K=c.useMemo(()=>{const e=Array.from(w.values());return{total:e.length,working:e.filter(i=>i.status==="working"||i.status==="waiting"||i.status==="waiting_permission").length,idle:e.filter(i=>i.status==="idle").length,error:e.filter(i=>i.status==="error"||i.status==="offline"||i.status==="orphaned").length}},[w]),ns=c.useMemo(()=>m==="zone"?Ys(w,x):m==="status"?Gs(w,P):Us(w),[w,x,m,P]),V=c.useMemo(()=>{const e=N.toLowerCase().trim(),i=ns.map(l=>({...l,agents:l.agents.filter(_=>{if(j==="working"){if(_.status!=="working"&&_.status!=="waiting"&&_.status!=="waiting_permission")return!1}else if(j==="error"&&_.status!=="error"&&_.status!=="offline"&&_.status!=="orphaned")return!1;return!(e&&!_.name.toLowerCase().includes(e)&&!_.class.toLowerCase().includes(e))})}));return m==="zone"?i:i.filter(l=>l.agents.length>0)},[ns,j,N,m]),O=c.useCallback(e=>e.area?`area:${e.area.id}`:`${m}:${e.label}`,[m]),y=c.useMemo(()=>{const e=[];return V.forEach(i=>{const l=O(i);if(b.has(l))return;const _=m==="status"?ms(i.agents,{prioritizeRecentlyIdle:!0}):_s(i.agents);e.push(..._)}),e},[V,b,m,O]),gs=c.useCallback(e=>{T(i=>{const l=new Set(i);return l.has(e)?l.delete(e):l.add(e),l})},[]),xs=c.useCallback(e=>{n==null||n(e)},[n]),js=c.useCallback(e=>{J(e)},[]),Ns=c.useCallback((e,i)=>{e.preventDefault(),e.dataTransfer.dropEffect="move",Z(i)},[]),ks=c.useCallback(()=>{Z(null)},[]),ys=c.useCallback(e=>{if(!k)return;if(e===null){const E=M.getState(),t=Array.from(E.areas.values()).find(r=>r.assignedAgentIds.includes(k.id));t&&M.unassignAgentFromArea(k.id,t.id),J(null),Z(null);return}const i=x.get(e);if(!i)return;const l=Array.from(w.values()),_=Fs(i,l,k.position);M.updateAgent({...k,position:{...k.position,x:_.x,z:_.z}}),M.assignAgentToArea(k.id,e),J(null),Z(null)},[k,x,w]);return c.useEffect(()=>{if(y.length===0){Q(!1),W(null);return}R&&(!p||!y.some(e=>e.id===p))&&(W(y[0].id),a==null||a(y[0].id))},[y,R,p,a]),c.useEffect(()=>{const e=t=>t instanceof HTMLElement?t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.tagName==="SELECT"||t.isContentEditable:!1,i=t=>t instanceof HTMLElement?!!t.closest(".guake-terminal")||t.classList.contains("guake-input")||t.classList.contains("agent-panel-input"):!1,l=t=>{const r=Array.from(document.querySelectorAll(".dash-card[data-agent-id]")).find(z=>z.dataset.agentId===t);r==null||r.scrollIntoView({block:"nearest",inline:"nearest"})},_=(t,r)=>{var ds,os,cs,ls,us,hs;const z=Array.from(document.querySelectorAll(".dash-card[data-agent-id]")).map(d=>{const u=d.dataset.agentId;if(!u)return null;const C=d.getBoundingClientRect();return{id:u,centerX:C.left+C.width/2,centerY:C.top+C.height/2,height:C.height}}).filter(d=>d!==null).sort((d,u)=>d.centerY-u.centerY||d.centerX-u.centerX);if(z.length===0)return t;const ss=z.reduce((d,u)=>d+u.height,0)/z.length,es=Math.max(18,ss*.6),f=[];for(const d of z){const u=f[f.length-1];if(!u){f.push([{id:d.id,centerX:d.centerX,centerY:d.centerY}]);continue}const C=u.reduce((Cs,As)=>Cs+As.centerY,0)/u.length;Math.abs(d.centerY-C)<=es?u.push({id:d.id,centerX:d.centerX,centerY:d.centerY}):f.push([{id:d.id,centerX:d.centerX,centerY:d.centerY}])}f.forEach(d=>d.sort((u,C)=>u.centerX-C.centerX));const Y=f.findIndex(d=>d.some(u=>u.id===t));if(Y===-1)return((os=(ds=f[0])==null?void 0:ds[0])==null?void 0:os.id)??t;const $=f[Y],v=$.findIndex(d=>d.id===t);if(v===-1)return((ls=(cs=f[0])==null?void 0:cs[0])==null?void 0:ls.id)??t;if(r==="left")return((us=$[Math.max(0,v-1)])==null?void 0:us.id)??t;if(r==="right")return((hs=$[Math.min($.length-1,v+1)])==null?void 0:hs.id)??t;const q=r==="up"?Math.max(0,Y-1):Math.min(f.length-1,Y+1),o=f[q],G=$[v].centerX;let D=o[0],is=Math.abs(D.centerX-G);for(const d of o){const u=Math.abs(d.centerX-G);u<is&&(D=d,is=u)}return(D==null?void 0:D.id)??t},E=t=>{const r=M.getShortcuts(),z=r.find(o=>o.id==="dashboard-selector-toggle"),ss=r.find(o=>o.id==="dashboard-vim-left"),es=r.find(o=>o.id==="dashboard-vim-down"),f=r.find(o=>o.id==="dashboard-vim-up"),Y=r.find(o=>o.id==="dashboard-vim-right"),$=r.find(o=>o.id==="open-terminal"),v=M.getState();if(e(t.target))if(!v.terminalOpen&&i(t.target)&&document.activeElement instanceof HTMLElement)document.activeElement.blur();else return;if(U(t,z)){if(y.length===0)return;t.preventDefault(),t.stopPropagation(),Q(!0),W(o=>{const G=o&&y.some(D=>D.id===o)?o:y[0].id;return a==null||a(G),window.setTimeout(()=>l(G),0),G});return}const q=U(t,ss)||t.key==="ArrowLeft"?"left":U(t,es)||t.key==="ArrowDown"?"down":U(t,f)||t.key==="ArrowUp"?"up":U(t,Y)||t.key==="ArrowRight"?"right":null;if(q&&R&&p){t.preventDefault(),t.stopPropagation();const o=_(p,q);o!==p&&(W(o),a==null||a(o),window.setTimeout(()=>l(o),0));return}if(U(t,$)){if(v.terminalOpen)return;if(R&&p&&v.agents.has(p)){t.preventDefault(),n==null||n(p);return}if(v.selectedAgentIds.size===1){t.preventDefault();const o=Array.from(v.selectedAgentIds)[0];n==null||n(o);return}if(v.lastSelectedAgentId&&v.agents.has(v.lastSelectedAgentId)){t.preventDefault(),n==null||n(v.lastSelectedAgentId);return}}};return document.addEventListener("keydown",E,!0),()=>document.removeEventListener("keydown",E,!0)},[y,R,p,n,a]),c.useEffect(()=>{const e=document.activeElement;e instanceof HTMLElement&&e.closest(".guake-terminal")&&!M.getState().terminalOpen&&e.blur()},[]),s.jsxs("div",{className:"dashboard-view",children:[s.jsxs("div",{className:"dashboard-view__topbar",children:[s.jsxs("div",{className:"dashboard-view__metrics",children:[s.jsxs("button",{className:`dashboard-view__metric-btn ${j==="all"?"dashboard-view__metric-btn--active":""}`,onClick:()=>I("all"),children:[s.jsx("span",{className:"dashboard-view__metric-value",children:K.total}),s.jsx("span",{className:"dashboard-view__metric-label",children:h("common:labels.agents")})]}),s.jsxs("button",{className:`dashboard-view__metric-btn dashboard-view__metric-btn--working ${j==="working"?"dashboard-view__metric-btn--active":""}`,onClick:()=>I("working"),children:[s.jsx("span",{className:"dashboard-view__metric-value",children:K.working}),s.jsx("span",{className:"dashboard-view__metric-label",children:h("common:status.working")})]}),s.jsxs("button",{className:"dashboard-view__metric-btn dashboard-view__metric-btn--idle ",onClick:()=>I("all"),children:[s.jsx("span",{className:"dashboard-view__metric-value",children:K.idle}),s.jsx("span",{className:"dashboard-view__metric-label",children:h("common:status.idle")})]}),s.jsxs("button",{className:`dashboard-view__metric-btn dashboard-view__metric-btn--error ${j==="error"?"dashboard-view__metric-btn--active":""}`,onClick:()=>I("error"),children:[s.jsx("span",{className:"dashboard-view__metric-value",children:K.error}),s.jsx("span",{className:"dashboard-view__metric-label",children:h("common:status.error")})]})]}),s.jsx("input",{className:"dashboard-view__search",type:"text",placeholder:h("searchPlaceholder"),value:N,onChange:e=>B(e.target.value)})]}),s.jsxs("div",{className:"dashboard-view__grouping",children:[s.jsx("button",{className:`dashboard-view__grouping-btn ${m==="zone"?"dashboard-view__grouping-btn--active":""}`,onClick:()=>H("zone"),children:h("grouping.byZone")}),s.jsx("button",{className:`dashboard-view__grouping-btn ${m==="status"?"dashboard-view__grouping-btn--active":""}`,onClick:()=>H("status"),children:h("grouping.byStatus")}),s.jsx("button",{className:`dashboard-view__grouping-btn ${m==="activity"?"dashboard-view__grouping-btn--active":""}`,onClick:()=>H("activity"),children:h("grouping.byActivity")})]}),s.jsxs("div",{className:"dashboard-view__content",children:[V.map(e=>{const i=O(e),l=b.has(i),_=m==="status"?ms(e.agents,{prioritizeRecentlyIdle:!0}):_s(e.agents),E=e.agents.filter(r=>r.status==="working"||r.status==="waiting"||r.status==="waiting_permission").length,t=e.agents.filter(r=>P.has(r.id)).length;return s.jsxs("div",{className:`dashboard-view__zone ${ps===(e.area?e.area.id:null)&&k?"dashboard-view__zone--drag-over":""}`,onDragOver:r=>Ns(r,e.area?e.area.id:null),onDragLeave:ks,onDrop:()=>ys(e.area?e.area.id:null),children:[s.jsxs("div",{className:"dashboard-view__zone-header",onClick:()=>gs(i),children:[s.jsxs("div",{className:"dashboard-view__zone-left",children:[s.jsx("span",{className:`dashboard-view__zone-chevron ${l?"dashboard-view__zone-chevron--collapsed":""}`,children:s.jsx(F,{name:"caret-down",size:12})}),s.jsx("span",{className:"dashboard-view__zone-dot",style:{backgroundColor:e.color}}),s.jsx("span",{className:"dashboard-view__zone-name",children:e.label}),s.jsxs("span",{className:"dashboard-view__zone-count",children:[h("agentCount",{count:e.agents.length}),E>0&&s.jsxs("span",{className:"dashboard-view__zone-working",children:[" · ",E," ",h("working")]}),t>0&&s.jsxs("span",{className:"dashboard-view__zone-unseen",children:[" · ",t," Unseen"]})]})]}),e.area&&g&&s.jsx("button",{className:"dashboard-view__zone-focus",onClick:r=>{r.stopPropagation(),g(e.area.id)},title:h("focusZone"),children:h("focusZone")})]}),!l&&s.jsx("div",{className:"dashboard-view__zone-grid",children:_.map(r=>s.jsx(fs,{agent:r,isSelected:rs.has(r.id),isKeyboardFocused:R&&p===r.id,onSelect:()=>{a==null||a(r.id),Q(!0),W(r.id)},onDoubleClick:()=>xs(r.id),onChat:()=>n==null?void 0:n(r.id),onFocus:A?()=>A(r.id):void 0,onKill:L?()=>L(r.id):void 0,onDragStart:js},r.id))})]},i)}),V.length===0&&s.jsx("div",{className:"dashboard-view__empty",children:N?h("noAgentsMatching",{search:N}):h("noAgentsSpawned")}),X.size>0&&s.jsx(ws,{buildings:X,onSelectBuilding:S})]})]})}export{Zs as DashboardView};
1
+ import{a7 as as,u as ts,an as vs,ao as bs,ap as zs,j as s,I as F,W as Is,aq as Es,ar as $s,as as Ds,at as Ms,r as c,_ as Ls,ad as Ss,O as Xs,N as Ps,B as Rs,au as Ys,av as Gs,aw as Us,ax as ms,ay as _s,s as M,az as Fs,n as U}from"./main-C0wLbrjb.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";const fs=as.memo(({agent:a,isSelected:A,isKeyboardFocused:L=!1,onSelect:S,onDoubleClick:n,onChat:g,onFocus:h,onKill:w,onDragStart:X})=>{const{t:x}=ts(["dashboard","common"]),P=vs().has(a.id),N=bs(a.status),B=zs(a),j=Ms(B),I=a.taskLabel?s.jsxs(s.Fragment,{children:[s.jsx(F,{name:"task",size:12})," ",a.taskLabel]}):a.currentTask||a.lastAssignedTask,m=a.status==="idle"&&a.lastActivity>0,[,H]=as.useState(0);return as.useEffect(()=>{if(!m)return;const b=window.setInterval(()=>H(T=>T+1),15e3);return()=>window.clearInterval(b)},[m]),s.jsxs("div",{className:`dash-card dash-card--${N} ${A?"dash-card--selected":""} ${L?"dash-card--keyboard-focused":""}`,"data-agent-id":a.id,onClick:S,onDoubleClick:b=>{b.stopPropagation(),n()},onDragStart:b=>{X==null||X(a),b.dataTransfer.effectAllowed="move"},draggable:!0,title:x("cards.doubleClickHint"),children:[s.jsxs("div",{className:"dash-card__row1",children:[s.jsx("span",{className:`dash-card__status-dot dash-card__status-dot--${N}`}),s.jsx("span",{className:"dash-card__name",children:a.name}),s.jsxs("span",{className:"dash-card__class",children:[s.jsx(Is,{agent:a,size:14})," ",a.class]}),s.jsxs("span",{className:`dash-card__provider dash-card__provider--${a.provider}`,children:[s.jsx(F,{name:a.provider==="codex"||a.provider==="opencode"?"status-pending":"robot",size:11,weight:a.provider==="codex"||a.provider==="opencode"?"fill":"regular",color:a.provider==="codex"?"#a16207":a.provider==="opencode"?"#4ade80":void 0})," ",a.provider]}),P&&s.jsx("span",{className:"dash-card__unseen-badge",title:"New output available - click to view",children:"!"})]}),s.jsxs("div",{className:"dash-card__row2",children:[s.jsx("span",{className:`dash-card__status dash-card__status--${N}`,children:P?"Unseen":a.status}),s.jsxs("div",{className:"dash-card__context",children:[s.jsx("div",{className:"dash-card__context-bar",children:s.jsx("div",{className:`dash-card__context-fill dash-card__context-fill--${j}`,style:{width:`${B}%`}})}),s.jsxs("span",{className:`dash-card__context-pct dash-card__context-pct--${j}`,children:[B,"%"]})]})]}),s.jsxs("div",{className:"dash-card__row3",children:[s.jsxs("span",{className:"dash-card__workdir",title:a.cwd,children:[s.jsx(F,{name:"folder",size:11})," ",a.cwd.split("/").pop()||a.cwd]}),m&&s.jsxs("span",{className:"dash-card__idle-time",style:{color:Ds(a.lastActivity)},title:$s(a.lastActivity),children:[s.jsx(F,{name:"status-waiting-input",size:10})," ",Es(a.lastActivity)]})]}),I&&s.jsx("div",{className:"dash-card__row4",children:s.jsx("span",{className:"dash-card__task",children:I})}),s.jsxs("div",{className:"dash-card__actions",children:[g&&s.jsx("button",{className:"dash-card__action-btn dash-card__action-btn--chat",onClick:b=>{b.stopPropagation(),g()},title:x("cards.openTerminal"),children:x("cards.chat")}),w&&s.jsx("button",{className:"dash-card__action-btn dash-card__action-btn--danger",onClick:b=>{b.stopPropagation(),w()},title:x("cards.killAgent"),children:x("cards.stop")})]})]})});fs.displayName="AgentCard";const ws=({buildings:a,onSelectBuilding:A})=>{const{t:L}=ts(["dashboard"]),S=c.useMemo(()=>Array.from(a.values()).sort((n,g)=>n.name.localeCompare(g.name)),[a]);return s.jsxs("div",{className:"dashboard-view__buildings",children:[s.jsxs("div",{className:"dashboard-view__buildings-header",children:[s.jsx("span",{className:"dashboard-view__buildings-title",children:L("buildings.title")}),s.jsx("span",{className:"dashboard-view__buildings-count",children:S.length})]}),s.jsx("div",{className:"dashboard-view__buildings-row",children:S.map(n=>{const g=bs(n.status),h=Ls(n.type);return s.jsxs("button",{className:`dash-pill dash-pill--${g}`,onClick:()=>A==null?void 0:A(n.id),title:`${n.name} (${n.type}) - ${n.status}`,children:[s.jsx("span",{className:"dash-pill__icon",children:s.jsx(F,{name:h,size:14})}),s.jsx("span",{className:"dash-pill__name",children:n.name}),s.jsx("span",{className:`dash-pill__dot dash-pill__dot--${g}`})]},n.id)})})]})};ws.displayName="BuildingPills";function Zs({onSelectAgent:a,onFocusAgent:A,onKillAgent:L,onSelectBuilding:S,onOpenTerminal:n,onFocusZone:g}){const{t:h}=ts(["dashboard","common"]),w=Ss(),X=Xs(),x=Ps(),rs=Rs(),P=vs(),[N,B]=c.useState(""),[j,I]=c.useState("all"),[m,H]=c.useState("zone"),[b,T]=c.useState(new Set),[k,J]=c.useState(null),[ps,Z]=c.useState(null),[R,Q]=c.useState(!1),[p,W]=c.useState(null),K=c.useMemo(()=>{const e=Array.from(w.values());return{total:e.length,working:e.filter(i=>i.status==="working"||i.status==="waiting"||i.status==="waiting_permission").length,idle:e.filter(i=>i.status==="idle").length,error:e.filter(i=>i.status==="error"||i.status==="offline"||i.status==="orphaned").length}},[w]),ns=c.useMemo(()=>m==="zone"?Ys(w,x):m==="status"?Gs(w,P):Us(w),[w,x,m,P]),V=c.useMemo(()=>{const e=N.toLowerCase().trim(),i=ns.map(l=>({...l,agents:l.agents.filter(_=>{if(j==="working"){if(_.status!=="working"&&_.status!=="waiting"&&_.status!=="waiting_permission")return!1}else if(j==="error"&&_.status!=="error"&&_.status!=="offline"&&_.status!=="orphaned")return!1;return!(e&&!_.name.toLowerCase().includes(e)&&!_.class.toLowerCase().includes(e))})}));return m==="zone"?i:i.filter(l=>l.agents.length>0)},[ns,j,N,m]),O=c.useCallback(e=>e.area?`area:${e.area.id}`:`${m}:${e.label}`,[m]),y=c.useMemo(()=>{const e=[];return V.forEach(i=>{const l=O(i);if(b.has(l))return;const _=m==="status"?ms(i.agents,{prioritizeRecentlyIdle:!0}):_s(i.agents);e.push(..._)}),e},[V,b,m,O]),gs=c.useCallback(e=>{T(i=>{const l=new Set(i);return l.has(e)?l.delete(e):l.add(e),l})},[]),xs=c.useCallback(e=>{n==null||n(e)},[n]),js=c.useCallback(e=>{J(e)},[]),Ns=c.useCallback((e,i)=>{e.preventDefault(),e.dataTransfer.dropEffect="move",Z(i)},[]),ks=c.useCallback(()=>{Z(null)},[]),ys=c.useCallback(e=>{if(!k)return;if(e===null){const E=M.getState(),t=Array.from(E.areas.values()).find(r=>r.assignedAgentIds.includes(k.id));t&&M.unassignAgentFromArea(k.id,t.id),J(null),Z(null);return}const i=x.get(e);if(!i)return;const l=Array.from(w.values()),_=Fs(i,l,k.position);M.updateAgent({...k,position:{...k.position,x:_.x,z:_.z}}),M.assignAgentToArea(k.id,e),J(null),Z(null)},[k,x,w]);return c.useEffect(()=>{if(y.length===0){Q(!1),W(null);return}R&&(!p||!y.some(e=>e.id===p))&&(W(y[0].id),a==null||a(y[0].id))},[y,R,p,a]),c.useEffect(()=>{const e=t=>t instanceof HTMLElement?t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.tagName==="SELECT"||t.isContentEditable:!1,i=t=>t instanceof HTMLElement?!!t.closest(".guake-terminal")||t.classList.contains("guake-input")||t.classList.contains("agent-panel-input"):!1,l=t=>{const r=Array.from(document.querySelectorAll(".dash-card[data-agent-id]")).find(z=>z.dataset.agentId===t);r==null||r.scrollIntoView({block:"nearest",inline:"nearest"})},_=(t,r)=>{var ds,os,cs,ls,us,hs;const z=Array.from(document.querySelectorAll(".dash-card[data-agent-id]")).map(d=>{const u=d.dataset.agentId;if(!u)return null;const C=d.getBoundingClientRect();return{id:u,centerX:C.left+C.width/2,centerY:C.top+C.height/2,height:C.height}}).filter(d=>d!==null).sort((d,u)=>d.centerY-u.centerY||d.centerX-u.centerX);if(z.length===0)return t;const ss=z.reduce((d,u)=>d+u.height,0)/z.length,es=Math.max(18,ss*.6),f=[];for(const d of z){const u=f[f.length-1];if(!u){f.push([{id:d.id,centerX:d.centerX,centerY:d.centerY}]);continue}const C=u.reduce((Cs,As)=>Cs+As.centerY,0)/u.length;Math.abs(d.centerY-C)<=es?u.push({id:d.id,centerX:d.centerX,centerY:d.centerY}):f.push([{id:d.id,centerX:d.centerX,centerY:d.centerY}])}f.forEach(d=>d.sort((u,C)=>u.centerX-C.centerX));const Y=f.findIndex(d=>d.some(u=>u.id===t));if(Y===-1)return((os=(ds=f[0])==null?void 0:ds[0])==null?void 0:os.id)??t;const $=f[Y],v=$.findIndex(d=>d.id===t);if(v===-1)return((ls=(cs=f[0])==null?void 0:cs[0])==null?void 0:ls.id)??t;if(r==="left")return((us=$[Math.max(0,v-1)])==null?void 0:us.id)??t;if(r==="right")return((hs=$[Math.min($.length-1,v+1)])==null?void 0:hs.id)??t;const q=r==="up"?Math.max(0,Y-1):Math.min(f.length-1,Y+1),o=f[q],G=$[v].centerX;let D=o[0],is=Math.abs(D.centerX-G);for(const d of o){const u=Math.abs(d.centerX-G);u<is&&(D=d,is=u)}return(D==null?void 0:D.id)??t},E=t=>{const r=M.getShortcuts(),z=r.find(o=>o.id==="dashboard-selector-toggle"),ss=r.find(o=>o.id==="dashboard-vim-left"),es=r.find(o=>o.id==="dashboard-vim-down"),f=r.find(o=>o.id==="dashboard-vim-up"),Y=r.find(o=>o.id==="dashboard-vim-right"),$=r.find(o=>o.id==="open-terminal"),v=M.getState();if(e(t.target))if(!v.terminalOpen&&i(t.target)&&document.activeElement instanceof HTMLElement)document.activeElement.blur();else return;if(U(t,z)){if(y.length===0)return;t.preventDefault(),t.stopPropagation(),Q(!0),W(o=>{const G=o&&y.some(D=>D.id===o)?o:y[0].id;return a==null||a(G),window.setTimeout(()=>l(G),0),G});return}const q=U(t,ss)||t.key==="ArrowLeft"?"left":U(t,es)||t.key==="ArrowDown"?"down":U(t,f)||t.key==="ArrowUp"?"up":U(t,Y)||t.key==="ArrowRight"?"right":null;if(q&&R&&p){t.preventDefault(),t.stopPropagation();const o=_(p,q);o!==p&&(W(o),a==null||a(o),window.setTimeout(()=>l(o),0));return}if(U(t,$)){if(v.terminalOpen)return;if(R&&p&&v.agents.has(p)){t.preventDefault(),n==null||n(p);return}if(v.selectedAgentIds.size===1){t.preventDefault();const o=Array.from(v.selectedAgentIds)[0];n==null||n(o);return}if(v.lastSelectedAgentId&&v.agents.has(v.lastSelectedAgentId)){t.preventDefault(),n==null||n(v.lastSelectedAgentId);return}}};return document.addEventListener("keydown",E,!0),()=>document.removeEventListener("keydown",E,!0)},[y,R,p,n,a]),c.useEffect(()=>{const e=document.activeElement;e instanceof HTMLElement&&e.closest(".guake-terminal")&&!M.getState().terminalOpen&&e.blur()},[]),s.jsxs("div",{className:"dashboard-view",children:[s.jsxs("div",{className:"dashboard-view__topbar",children:[s.jsxs("div",{className:"dashboard-view__metrics",children:[s.jsxs("button",{className:`dashboard-view__metric-btn ${j==="all"?"dashboard-view__metric-btn--active":""}`,onClick:()=>I("all"),children:[s.jsx("span",{className:"dashboard-view__metric-value",children:K.total}),s.jsx("span",{className:"dashboard-view__metric-label",children:h("common:labels.agents")})]}),s.jsxs("button",{className:`dashboard-view__metric-btn dashboard-view__metric-btn--working ${j==="working"?"dashboard-view__metric-btn--active":""}`,onClick:()=>I("working"),children:[s.jsx("span",{className:"dashboard-view__metric-value",children:K.working}),s.jsx("span",{className:"dashboard-view__metric-label",children:h("common:status.working")})]}),s.jsxs("button",{className:"dashboard-view__metric-btn dashboard-view__metric-btn--idle ",onClick:()=>I("all"),children:[s.jsx("span",{className:"dashboard-view__metric-value",children:K.idle}),s.jsx("span",{className:"dashboard-view__metric-label",children:h("common:status.idle")})]}),s.jsxs("button",{className:`dashboard-view__metric-btn dashboard-view__metric-btn--error ${j==="error"?"dashboard-view__metric-btn--active":""}`,onClick:()=>I("error"),children:[s.jsx("span",{className:"dashboard-view__metric-value",children:K.error}),s.jsx("span",{className:"dashboard-view__metric-label",children:h("common:status.error")})]})]}),s.jsx("input",{className:"dashboard-view__search",type:"text",placeholder:h("searchPlaceholder"),value:N,onChange:e=>B(e.target.value)})]}),s.jsxs("div",{className:"dashboard-view__grouping",children:[s.jsx("button",{className:`dashboard-view__grouping-btn ${m==="zone"?"dashboard-view__grouping-btn--active":""}`,onClick:()=>H("zone"),children:h("grouping.byZone")}),s.jsx("button",{className:`dashboard-view__grouping-btn ${m==="status"?"dashboard-view__grouping-btn--active":""}`,onClick:()=>H("status"),children:h("grouping.byStatus")}),s.jsx("button",{className:`dashboard-view__grouping-btn ${m==="activity"?"dashboard-view__grouping-btn--active":""}`,onClick:()=>H("activity"),children:h("grouping.byActivity")})]}),s.jsxs("div",{className:"dashboard-view__content",children:[V.map(e=>{const i=O(e),l=b.has(i),_=m==="status"?ms(e.agents,{prioritizeRecentlyIdle:!0}):_s(e.agents),E=e.agents.filter(r=>r.status==="working"||r.status==="waiting"||r.status==="waiting_permission").length,t=e.agents.filter(r=>P.has(r.id)).length;return s.jsxs("div",{className:`dashboard-view__zone ${ps===(e.area?e.area.id:null)&&k?"dashboard-view__zone--drag-over":""}`,onDragOver:r=>Ns(r,e.area?e.area.id:null),onDragLeave:ks,onDrop:()=>ys(e.area?e.area.id:null),children:[s.jsxs("div",{className:"dashboard-view__zone-header",onClick:()=>gs(i),children:[s.jsxs("div",{className:"dashboard-view__zone-left",children:[s.jsx("span",{className:`dashboard-view__zone-chevron ${l?"dashboard-view__zone-chevron--collapsed":""}`,children:s.jsx(F,{name:"caret-down",size:12})}),s.jsx("span",{className:"dashboard-view__zone-dot",style:{backgroundColor:e.color}}),s.jsx("span",{className:"dashboard-view__zone-name",children:e.label}),s.jsxs("span",{className:"dashboard-view__zone-count",children:[h("agentCount",{count:e.agents.length}),E>0&&s.jsxs("span",{className:"dashboard-view__zone-working",children:[" · ",E," ",h("working")]}),t>0&&s.jsxs("span",{className:"dashboard-view__zone-unseen",children:[" · ",t," Unseen"]})]})]}),e.area&&g&&s.jsx("button",{className:"dashboard-view__zone-focus",onClick:r=>{r.stopPropagation(),g(e.area.id)},title:h("focusZone"),children:h("focusZone")})]}),!l&&s.jsx("div",{className:"dashboard-view__zone-grid",children:_.map(r=>s.jsx(fs,{agent:r,isSelected:rs.has(r.id),isKeyboardFocused:R&&p===r.id,onSelect:()=>{a==null||a(r.id),Q(!0),W(r.id)},onDoubleClick:()=>xs(r.id),onChat:()=>n==null?void 0:n(r.id),onFocus:A?()=>A(r.id):void 0,onKill:L?()=>L(r.id):void 0,onDragStart:js},r.id))})]},i)}),V.length===0&&s.jsx("div",{className:"dashboard-view__empty",children:N?h("noAgentsMatching",{search:N}):h("noAgentsSpawned")}),X.size>0&&s.jsx(ws,{buildings:X,onSelectBuilding:S})]})]})}export{Zs as DashboardView};
@@ -0,0 +1 @@
1
+ :root{--bg-primary: #0d0d14;--bg-secondary: #14141e;--bg-tertiary: #1c1c28;--border-color: #2a2a3a;--text-primary: #d0d0d8;--text-secondary: #8a8a98;--text-muted: #606070;--accent-blue: #5a8fd4;--accent-green: #5cb88a;--accent-orange: #d4a05a;--accent-red: #d45a5a;--accent-purple: #8a6fbf;--accent-cyan: #5ab8c8;--accent-claude: #a06848;--accent-claude-light: #c8896a;--accent-pink: #5a8fd4;--accent-yellow: #d0d0d8;--font-size-base: 14px;--line-height-base: 1.5;--msg-user-bg: color-mix(in srgb, #5ab8c8 8%, transparent);--msg-user-border: #5ab8c8;--msg-user-text: #d0d0d8;--msg-assistant-bg: color-mix(in srgb, #5cb88a 8%, transparent);--msg-assistant-border: #5cb88a;--msg-assistant-text: #d0d0d8;--tool-use-bg: color-mix(in srgb, #d4a05a 8%, transparent);--tool-use-border: #d4a05a;--tool-use-text: #d4a05a;--tool-use-name: #d4a05a;--tool-result-bg: color-mix(in srgb, #8a6fbf 6%, transparent);--tool-result-border: #8a6fbf;--tool-result-text: #5cb88a;--context-bar-bg: #1c1c28;--context-bar-fill: #8a6fbf;--output-line-bg: transparent;--task-label-color: #5ab8c8}.git-file-history-modal{width:1100px;max-width:95vw;height:80vh;max-height:90vh;display:flex;flex-direction:column;padding:0;background:#14141e;border:1px solid #2a2a3a;border-radius:12px;overflow:hidden;outline:none}.git-file-history-modal .modal-header{padding:14px 20px;margin-bottom:0;border-bottom:1px solid #2a2a3a;font-size:16px;font-weight:600;display:flex;justify-content:space-between;align-items:center;gap:12px}.git-file-history-modal .modal-header h2{margin:0;font-size:16px}.git-file-history-title{display:flex;flex-direction:column;gap:2px;min-width:0}.git-file-history-title .git-file-history-filepath{font-family:JetBrains Mono,SF Mono,Fira Code,Consolas,monospace;font-size:11px;color:#8a8a98;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:60ch}.git-file-history-body{flex:1;display:flex;flex-direction:row;min-height:0;overflow:hidden}.git-file-history-commit-list{width:300px;flex-shrink:0;border-right:1px solid #2a2a3a;background:#1c1c28;overflow-y:auto;display:flex;flex-direction:column}.git-file-history-commits{list-style:none;margin:0;padding:4px 0;display:flex;flex-direction:column}.git-file-history-commit{padding:8px 12px;border-bottom:1px solid rgba(42,42,58,.5);cursor:pointer;transition:background .15s,border-color .15s;display:flex;flex-direction:column;gap:3px}.git-file-history-commit:hover{background:#5a8fd414}.git-file-history-commit.selected{background:#5a8fd42e;border-left:3px solid #5a8fd4;padding-left:9px}.git-file-history-commit-row{display:flex;justify-content:space-between;align-items:center;gap:8px}.git-file-history-sha{font-family:JetBrains Mono,SF Mono,Fira Code,Consolas,monospace;font-size:11px;color:#5a8fd4;font-weight:600;flex-shrink:0}.git-file-history-date{font-size:10px;color:#606070;flex-shrink:0}.git-file-history-subject{font-size:12px;color:#d0d0d8;line-height:1.4;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;word-break:break-word}.git-file-history-author{font-size:10px;color:#8a8a98;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.git-file-history-diff{flex:1;min-width:0;display:flex;flex-direction:column;overflow:hidden}.git-file-history-diff .diff-viewer{flex:1;min-height:0}.git-file-history-loading,.git-file-history-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:32px 20px;color:#8a8a98;text-align:center;flex:1}.git-file-history-loading p,.git-file-history-empty p{margin:0;font-size:12px}.git-file-history-loading .spinner,.git-file-history-empty .spinner{width:28px;height:28px;border:3px solid rgba(42,42,58,.5);border-top-color:#5a8fd4;border-radius:50%;animation:git-file-history-spin .8s linear infinite}@keyframes git-file-history-spin{to{transform:rotate(360deg)}}@media(max-width:720px){.git-file-history-modal{width:100vw;height:100vh;max-width:100vw;max-height:100vh;border-radius:0}.git-file-history-body{flex-direction:column}.git-file-history-commit-list{width:100%;max-height:40%;border-right:none;border-bottom:1px solid #2a2a3a}}
@@ -0,0 +1,2 @@
1
+ import{u as Xt,z as Ut,B as qt,r as n,E as Nt,S as j,G as kt,H as wt,J as It,K as st,L as Ae,M as Kt,s as f,N as Pt,O as zt,P as Yt,v as At,w as St,j as e,I as u,U as Zt,m as Jt,V as Qt,W as Dt,X as Rt,Y as ea,Z as ta,_ as aa,$ as na,a0 as sa,a1 as la,a2 as ra,a3 as ia,a4 as oa,a5 as ca,a6 as yt,C as da,a7 as ua,a8 as pa,a9 as ma,aa as fa,ab as ha,ac as ga,ad as ba,ae as xa,af as _a,ag as wa,ah as Ca,ai as ja,aj as va,ak as Na,al as ka,am as Ia}from"./main-C0wLbrjb.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";const lt=3,rt=280,Mt=320,_t=240,Et=64,Aa=["simple","chat","advanced"],Sa={simple:"Simple",chat:"Chat",advanced:"Advanced"},ya={simple:"○",chat:"◐",advanced:"◉"},Ma={simple:"Simple view — clean messages only",chat:"Chat view — assistant replies (no tool calls)",advanced:"Advanced view — everything including tools"},Tt="flat-clear-context";function Ea(_){const d=_.split("/").filter(Boolean);return d.length===0?_:d.slice(-2).join("/")}function Ta(_){if(_.provider==="codex"){const he=_.codexModel||"gpt-5.3-codex",ne=Na[he];return{model:(ne==null?void 0:ne.label)||he}}if(_.provider==="opencode")return{model:_.opencodeModel||"opencode"};const d=_.model||"sonnet",N=Ia[d],E=_.effort,B=E?ka[E]:void 0;return{model:(N==null?void 0:N.label)||d,effort:B==null?void 0:B.label}}function Pa(_,d){if(d.type==="rectangle"&&d.width&&d.height){const N=d.width/2,E=d.height/2;return _.x>=d.center.x-N&&_.x<=d.center.x+N&&_.z>=d.center.z-E&&_.z<=d.center.z+E}if(d.type==="circle"&&d.radius){const N=_.x-d.center.x,E=_.z-d.center.z;return N*N+E*E<=d.radius*d.radius}return!1}const za=ua.memo(function({agentId:d,terminalViewMode:N,onTerminalViewModeChange:E,inspectorOpen:B,onToggleInspector:he,onImageClick:ne,onFileClick:ge,onBashClick:T,onViewMarkdown:Se,onRequestClearSubordinates:ye,onOpenBuilding:Me,keyboard:We,canNavigateBack:He,canNavigateForward:Ee,onNavigateBack:Y,onNavigateForward:P,agentInfoOpen:be,onToggleAgentInfo:G}){var te,ve,q,Qe;const h=pa(d),A=zt(),se=n.useRef(null),xe=n.useRef(null);n.useEffect(()=>{const s=xe.current;if(!s)return;const i=o=>{o.button===3?(o.preventDefault(),o.stopPropagation(),Y()):o.button===4&&(o.preventDefault(),o.stopPropagation(),P())},c=o=>{(o.button===3||o.button===4)&&o.preventDefault()};return s.addEventListener("mouseup",i),s.addEventListener("mousedown",c),()=>{s.removeEventListener("mouseup",i),s.removeEventListener("mousedown",c)}},[Y,P]),n.useEffect(()=>{const s=xe.current;if(!s)return;let i=0,c=0,o=0;const ae=250,pe=600,Ne=80,mt=1.5,ft=D=>{let I=D instanceof HTMLElement?D:null;for(;I&&I!==s;){const Oe=window.getComputedStyle(I).overflowX;if((Oe==="auto"||Oe==="scroll")&&I.scrollWidth>I.clientWidth)return!0;I=I.parentElement}return!1},ke=D=>{const I=Date.now();if(I<o){D.preventDefault();return}if(Math.abs(D.deltaX)<=Math.abs(D.deltaY)*mt){i=0;return}if(ft(D.target)){i=0;return}I-c>ae&&(i=0),c=I,i+=D.deltaX,i<=-Ne?(i=0,o=I+pe,D.preventDefault(),Y()):i>=Ne&&(i=0,o=I+pe,D.preventDefault(),P())};return s.addEventListener("wheel",ke,{passive:!1}),()=>s.removeEventListener("wheel",ke)},[Y,P]);const le=Pt(),Te=n.useMemo(()=>{if(!h)return null;const s=new Set,i=[];for(const c of le.values())c.archived||c.directories.length===0||c.assignedAgentIds.includes(d)&&(s.add(c.id),i.push(c));for(const c of le.values())c.archived||c.directories.length===0||s.has(c.id)||Pa({x:h.position.x,z:h.position.z},c)&&(s.add(c.id),i.push(c));return i.length===0?null:i.flatMap(c=>c.directories.filter(o=>o&&o.trim().length>0).map(o=>({areaId:c.id,areaName:c.name,dir:o})))},[h,d,le]),{branches:Ge,fetchRemote:Ve,fetchingDirs:Pe}=ma(Te),_e=n.useMemo(()=>{var c;const s=f.getAreaForAgent(d);if(!s)return[];const i=[];for(const o of A.values())o.type==="terminal"&&f.isPositionInArea(o.position,s)&&i.push({id:o.id,name:o.name,hasUrl:!!((c=o.terminalStatus)!=null&&c.url)});return i},[d,A]),ze=n.useMemo(()=>{var c;const s=f.getAreaForAgent(d);if(!s)return[];const i=[];for(const o of A.values())o.type==="server"&&((c=o.pm2)!=null&&c.enabled)&&f.isPositionInArea(o.position,s)&&i.push({id:o.id,name:o.name});return i},[d,A]),De=n.useMemo(()=>{const s=f.getAreaForAgent(d);if(!s)return[];const i=[];for(const c of A.values())c.type==="database"&&c.database&&f.isPositionInArea(c.position,s)&&i.push({id:c.id,name:c.name});return i},[d,A]),[,we]=n.useReducer(s=>s+1,0),Z=((te=se.current)==null?void 0:te.search.searchMode)??!1,it=n.useCallback(()=>{var s;(s=se.current)==null||s.search.toggleSearch(),we()},[]),Xe=fa(),J=Xe.isPending(Tt),[R,F]=n.useState(null),O=R?A.get(R):null,{height:W,onResizeStart:Ce}=ha(),[L,V]=n.useState(()=>wt(j.GIT_PANEL_OPEN,!1)),[re,Ue]=n.useState(()=>wt(j.BUILDINGS_PANEL_OPEN,!1)),[Q,ie]=n.useState(!1),ot=n.useCallback(()=>{ie(s=>{const i=!s;return i&&ga.setEnabled(!0),i})},[]),ct=n.useCallback(()=>ie(!1),[]),oe=n.useCallback(()=>{V(s=>{const i=!s;return Ae(j.GIT_PANEL_OPEN,i),i})},[]),dt=n.useCallback(()=>{Ue(s=>{const i=!s;return Ae(j.BUILDINGS_PANEL_OPEN,i),i})},[]),qe=n.useCallback(()=>{V(!1),Ae(j.GIT_PANEL_OPEN,!1)},[]),ut=n.useCallback(()=>{Ue(!1),Ae(j.BUILDINGS_PANEL_OPEN,!1)},[]),pt=ba();n.useEffect(()=>{if(!R)return;_e.some(i=>i.id===R)||F(null)},[R,_e]);const[ce,ee]=n.useState(!1),Re=n.useRef(null);if(n.useEffect(()=>{if(!ce)return;const s=i=>{Re.current&&!Re.current.contains(i.target)&&ee(!1)};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[ce]),!h)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 X=h.contextStats,Ke=!!X,Ye=X?X.totalTokens:h.contextUsed||0,de=X?X.contextWindow:h.contextLimit||2e5,g=X?X.usedPercent:Math.round(Ye/de*100),z=Math.max(0,Math.min(100,g)),H=Math.max(0,100-z),ue=z>=80?"#ff4a4a":z>=60?"#ff9e4a":z>=40?"#ffd700":"#4aff9e",Le=(Ye/1e3).toFixed(1),Ze=(de/1e3).toFixed(1),U=h.cwd,Je=U?Ea(U):null,je=((ve=h.subordinateIds)==null?void 0:ve.length)||0,$e=je>0;return e.jsxs("div",{ref:xe,className:`flat-terminal-wrapper ${L||re||Q?"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 ${be?"flat-terminal-wrapper__header-main--active":""}`,onClick:G,title:be?"Hide agent info":"Show agent info","aria-pressed":be,children:[e.jsx(Dt,{agent:h,size:28}),e.jsxs("span",{className:"flat-terminal-wrapper__header-info",children:[e.jsx("span",{className:"flat-terminal-wrapper__header-name",children:h.name}),e.jsx("span",{className:"flat-terminal-wrapper__header-status",style:{color:Rt(h.status)},children:h.status})]}),h.taskLabel&&e.jsxs("span",{className:"flat-terminal-wrapper__header-task",title:h.taskLabel,children:["📋 ",h.taskLabel]}),e.jsxs("span",{className:"flat-terminal-wrapper__header-model",children:[e.jsx("img",{src:h.provider==="codex"?"/assets/codex.png":h.provider==="opencode"?"/assets/opencode.png":"/assets/claude.png",alt:h.provider,className:"flat-terminal-wrapper__header-provider-icon",title:h.provider==="codex"?"Codex Agent":h.provider==="opencode"?"OpenCode Agent":"Claude Agent"}),(()=>{const{model:s,effort:i}=Ta(h);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:Aa.map(s=>e.jsxs("button",{type:"button",className:`flat-terminal-wrapper__view-mode-btn ${N===s?"flat-terminal-wrapper__view-mode-btn--active":""}`,onClick:()=>E(s),title:Ma[s],"aria-pressed":N===s,children:[e.jsx("span",{className:"flat-terminal-wrapper__view-mode-icon","aria-hidden":"true",children:ya[s]}),e.jsx("span",{className:"flat-terminal-wrapper__view-mode-label",children:Sa[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:Y,disabled:!He,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:P,disabled:!Ee,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 ${Z?"flat-terminal-wrapper__action-btn--active":""}`,onClick:it,title:Z?"Close search":"Search messages","aria-pressed":Z,children:e.jsx(u,{name:Z?"cross":"search",size:14})}),e.jsx("button",{type:"button",className:`flat-terminal-wrapper__action-btn flat-terminal-wrapper__action-btn--danger ${J?"flat-terminal-wrapper__action-btn--confirm":""}`,onClick:()=>Xe.handleClick(Tt,()=>{var s;f.clearContext(d),(s=se.current)==null||s.historyLoader.clearHistory()}),title:J?"Click again to confirm clear context":"Clear context",children:e.jsx(u,{name:J?"question":"clear",size:14})}),e.jsx("button",{type:"button",className:`flat-terminal-wrapper__action-btn ${L?"flat-terminal-wrapper__action-btn--active":""}`,onClick:oe,title:L?"Hide git panel":"Show git changes","aria-pressed":L,children:e.jsx(u,{name:"git-branch",size:14})}),e.jsx("button",{type:"button",className:`flat-terminal-wrapper__action-btn ${re?"flat-terminal-wrapper__action-btn--active":""}`,onClick:dt,title:re?"Hide buildings panel":"Show area buildings","aria-pressed":re,children:e.jsx(u,{name:"buildings",size:14})}),e.jsxs("div",{className:"flat-terminal-wrapper__more",ref:Re,children:[e.jsx("button",{type:"button",className:`flat-terminal-wrapper__action-btn ${ce?"flat-terminal-wrapper__action-btn--active":""}`,onClick:()=>ee(s=>!s),title:"More actions","aria-expanded":ce,children:"⋮"}),ce&&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 ${Q?"flat-terminal-wrapper__more-item--active":""}`,onClick:()=>{ot(),ee(!1)},title:Q?"Hide Debug Panel":"Show Debug Panel",children:[e.jsx(u,{name:"bug",size:14}),e.jsx("span",{children:Q?"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:()=>{f.collapseContext(d),ee(!1)},disabled:h.status!=="idle",title:h.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"})]}),$e&&e.jsxs("button",{type:"button",role:"menuitem",className:"flat-terminal-wrapper__more-item flat-terminal-wrapper__more-item--danger",onClick:()=>{ye(d,je),ee(!1)},children:[e.jsx(u,{name:"crown",size:14}),e.jsxs("span",{children:["Clear ",je," subordinate",je===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:()=>{f.killAgent(d),ee(!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 ${B?"flat-terminal-wrapper__inspector-toggle--active":""}`,onClick:he,title:B?"Hide inspector panel":"Show inspector panel","aria-label":B?"Hide inspector panel":"Show inspector panel","aria-pressed":B,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:()=>f.deselectAll(),title:"Close chat","aria-label":"Close chat",children:e.jsx(u,{name:"cross",size:14})})]})]}),e.jsx(xa,{ref:se,agentId:d,agent:h,viewMode:N,isOpen:!0,onImageClick:ne,onFileClick:ge,onBashClick:T,onViewMarkdown:Se,keyboard:We,hasModalOpen:!1}),O&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"guake-bottom-terminal-resize",onMouseDown:Ce,role:"separator","aria-orientation":"horizontal","aria-label":"Resize embedded terminal"}),e.jsxs("div",{className:"flat-bottom-panel",role:"region","aria-label":`Embedded terminal: ${O.name}`,style:{height:W},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:O.name}),!((q=O.terminalStatus)!=null&&q.url)&&e.jsx("span",{className:"flat-bottom-panel__muted",children:"(starting...)"})]}),e.jsx("button",{type:"button",className:"flat-bottom-panel__close",onClick:()=>F(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:(Qe=O.terminalStatus)!=null&&Qe.url?e.jsx(_a,{terminalUrl:O.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:[h.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"})]}),U&&Je&&e.jsxs("span",{className:"flat-terminal-wrapper__cwd",title:`Open in file explorer: ${U}`,"aria-label":`Open ${U} in file explorer`,role:"button",tabIndex:0,onClick:()=>f.openFileExplorer(U),onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),f.openFileExplorer(U))},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:Je})]}),Te&&Te.map(({areaId:s,areaName:i,dir:c})=>{const o=Ge.get(c),ae=Pe.has(c),pe=c.split("/").filter(Boolean).pop()||c;return e.jsxs("span",{className:"flat-terminal-wrapper__area-dir",title:`${i}: ${c}${o?` (${o.branch}${o.ahead?` ↑${o.ahead}`:""}${o.behind?` ↓${o.behind}`:""})`:""}`,onClick:()=>f.openFileExplorerForAreaFolder(s,c),children:[e.jsx(u,{name:"folder-open",size:12}),e.jsx("span",{className:"flat-terminal-wrapper__area-dir-name",children:pe}),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 ${ae?"flat-terminal-wrapper__area-fetch--fetching":""}`,title:"Git fetch",onClick:Ne=>{Ne.stopPropagation(),Ve(c)},children:e.jsx(u,{name:ae?"hourglass":"download",size:12})})]})]},`${s}:${c}`)}),e.jsxs("span",{className:"flat-terminal-wrapper__context",onClick:()=>f.setContextModalAgentId(d),title:Ke?`Context usage: ${Le}k / ${Ze}k tokens (${z}% 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:`${z}%`,backgroundColor:ue}})}),e.jsxs("span",{className:"flat-terminal-wrapper__context-tokens",style:{color:ue},children:[Le,"k/",Ze,"k"]}),e.jsxs("span",{className:"flat-terminal-wrapper__context-free",children:["(",H,"% free)"]}),!Ke&&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"}),_e.length>0&&e.jsx("span",{className:"flat-terminal-wrapper__buildings",role:"group","aria-label":"Area terminals",children:_e.map(s=>{const i=R===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){F(null);return}s.hasUrl||f.sendBuildingCommand(s.id,"start"),F(s.id)},children:e.jsx(u,{name:"terminal",size:14})},s.id)})}),ze.length>0&&e.jsx("span",{className:"flat-terminal-wrapper__buildings",role:"group","aria-label":"Area PM2 logs",children:ze.map(s=>e.jsx("button",{type:"button",className:"flat-terminal-wrapper__building-btn",title:`Open logs: ${s.name}`,onClick:()=>Me(s.id),children:e.jsx(u,{name:"scroll",size:14})},s.id))}),De.length>0&&e.jsx("span",{className:"flat-terminal-wrapper__buildings",role:"group","aria-label":"Area databases",children:De.map(s=>e.jsx("button",{type:"button",className:"flat-terminal-wrapper__building-btn",title:`Open database: ${s.name}`,onClick:()=>Me(s.id),children:e.jsx(u,{name:"hard-drives",size:14})},s.id))}),e.jsx("div",{className:"flat-terminal-wrapper__theme",children:e.jsx(wa,{})})]}),L&&e.jsx(Ca,{agentId:d,agents:pt,onClose:qe,branchInfoMap:Ge,fetchRemote:Ve,fetchingDirs:Pe}),re&&e.jsx(ja,{agentId:d,onClose:ut}),Q&&e.jsx(va,{agentId:d,onClose:ct})]})});function $a({onAgentClick:_,onBuildingClick:d,onBuildingDoubleClick:N,onBuildingPopup:E,onOpenSpawnModal:B,onOpenBossSpawnModal:he,onOpenAreaModal:ne}){const{t:ge}=Xt(["common"]),T=Ut(),Se=qt(),[ye,Me]=n.useState(null),[We,He]=n.useState(null),[Ee,Y]=n.useState(null),[P,be]=n.useState(null),[G,h]=n.useState(null),[A,se]=n.useState(null),[xe,le]=n.useState(!1),Te=n.useCallback(()=>{le(t=>!t)},[]),Ge=n.useCallback(()=>{le(!1)},[]),[Ve,Pe]=n.useState(()=>{const t=Nt(j.VIEW_MODE);return t==="simple"||t==="chat"||t==="advanced"?t:"simple"}),_e=n.useCallback(t=>{Pe(t),kt(j.VIEW_MODE,t)},[]);n.useEffect(()=>{const t=a=>{if(a.key!==j.VIEW_MODE)return;const l=a.newValue;(l==="simple"||l==="chat"||l==="advanced")&&Pe(l)};return window.addEventListener("storage",t),()=>window.removeEventListener("storage",t)},[]);const[ze,De]=n.useState(()=>wt(j.FLAT_INSPECTOR_OPEN,!1)),[we,Z]=n.useState(!1),it=n.useCallback(()=>Z(t=>!t),[]),Xe=n.useCallback(()=>Z(!1),[]),J=n.useRef(null),R=n.useRef(null),[F,O]=n.useState(()=>{const t=It(j.FLAT_MIDDLE_WIDTH,0);return t>=rt?t:null}),[W,Ce]=n.useState(()=>{const t=It(j.FLAT_INSPECTOR_WIDTH,0);return t>=_t?t:null}),L=n.useCallback(t=>{if(typeof window>"u")return t;const a=W!==null?lt+W:0,l=window.innerWidth-Et-lt-Mt-a;return Math.max(rt,Math.min(Math.max(l,rt),t))},[W]),V=n.useCallback(t=>{var p;if(typeof window>"u")return t;const a=(p=J.current)==null?void 0:p.querySelector(".flat-middle"),l=(a==null?void 0:a.getBoundingClientRect().width)??rt,r=window.innerWidth-Et-l-lt-Mt-lt;return Math.max(_t,Math.min(Math.max(r,_t),t))},[]);n.useEffect(()=>{if(F===null&&W===null)return;const t=()=>{O(a=>{if(a===null)return a;const l=L(a);return l===a?a:l}),Ce(a=>{if(a===null)return a;const l=V(a);return l===a?a:l})};return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[F,W,L,V]);const re=n.useCallback(t=>{var l;if(t.button!==0)return;const a=(l=J.current)==null?void 0:l.querySelector(".flat-middle");a&&(t.currentTarget.setPointerCapture(t.pointerId),R.current={kind:"middle",startX:t.clientX,startWidth:a.getBoundingClientRect().width,pointerId:t.pointerId},document.body.classList.add("flat-splitter-dragging"))},[]),Ue=n.useCallback(t=>{var l;if(t.button!==0)return;const a=(l=J.current)==null?void 0:l.querySelector(".flat-inspector");a&&(t.currentTarget.setPointerCapture(t.pointerId),R.current={kind:"inspector",startX:t.clientX,startWidth:a.getBoundingClientRect().width,pointerId:t.pointerId},document.body.classList.add("flat-splitter-dragging"))},[]),Q=n.useCallback(t=>{const a=R.current;if(!a||t.pointerId!==a.pointerId)return;const l=t.clientX-a.startX;a.kind==="middle"?O(L(a.startWidth+l)):Ce(V(a.startWidth-l))},[L,V]),ie=n.useCallback(t=>{const a=R.current;if(!a||t.pointerId!==a.pointerId)return;try{t.currentTarget.releasePointerCapture(t.pointerId)}catch{}if(R.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 p=L(a.startWidth+r);O(p),st(j.FLAT_MIDDLE_WIDTH,p)}else{const p=V(a.startWidth-r);Ce(p),st(j.FLAT_INSPECTOR_WIDTH,p)}},[L,V]),ot=n.useCallback(()=>{O(null),st(j.FLAT_MIDDLE_WIDTH,0)},[]),ct=n.useCallback(()=>{Ce(null),st(j.FLAT_INSPECTOR_WIDTH,0)},[]),[oe,dt]=n.useState(()=>Nt(j.FLAT_INSPECTOR_VIEW)==="tracking"?"tracking":"agent"),qe=n.useCallback(t=>{dt(t),kt(j.FLAT_INSPECTOR_VIEW,t)},[]),ut=n.useCallback(()=>{De(t=>{const a=!t;return Ae(j.FLAT_INSPECTOR_OPEN,a),a})},[]),pt=n.useCallback(()=>{De(!1),Ae(j.FLAT_INSPECTOR_OPEN,!1)},[]),ce=Kt(),ee=n.useCallback((t,a)=>{Me({url:t,name:a})},[]),Re=n.useCallback((t,a)=>{He({command:t,output:a,isLive:!1})},[]),X=n.useCallback((t,a)=>{f.setFileViewerPath(t,a)},[]),Ke=n.useCallback(t=>{},[]),Ye=n.useCallback((t,a)=>{Y({agentId:t,count:a})},[]),de=n.useCallback(t=>{N?N(t):d(t)},[d,N]),g=n.useMemo(()=>Se.size>0?Array.from(Se)[0]:null,[Se]);n.useEffect(()=>{le(!1)},[g]);const z=n.useRef([]),H=n.useRef(-1),ue=n.useRef(!1),Le=n.useRef(null),[Ze,U]=n.useState(!1),[Je,je]=n.useState(!1),$e=n.useRef(!1),te=n.useRef(null),ve=n.useRef(!1),q=n.useMemo(()=>new Set(T.map(t=>t.id)),[T]),Qe=n.useMemo(()=>{const t=new Map(T.map(l=>[l.id,l])),a=new Map;for(const l of T)if((l.isBoss||l.class==="boss")&&l.subordinateIds&&l.subordinateIds.length>0){const r=l.subordinateIds.map(p=>t.get(p)).filter(p=>p!==void 0);r.length>0&&a.set(l.id,r)}return a},[T]),s=n.useCallback(()=>{const t=z.current,a=H.current;U(a>0),je(a>=0&&a<t.length-1)},[]),i=n.useCallback(t=>{const a=z.current;if(a.length===0)return;let l=H.current+t;for(;l>=0&&l<a.length;){const r=a[l];if(q.has(r)){ue.current=!0,H.current=l,s(),f.selectAgent(r);return}l+=t}},[q,s]),c=n.useCallback(()=>i(-1),[i]),o=n.useCallback(()=>i(1),[i]),ae=n.useCallback((t,a)=>{if(typeof window>"u")return;const l=window.history.state,p={...typeof l=="object"&&l!==null?l:{},__flatAgentNav:{agentId:t}};a==="replace"?window.history.replaceState(p,"",window.location.href):window.history.pushState(p,"",window.location.href)},[]);n.useEffect(()=>{if(!g){$e.current=!1,te.current=null;return}if(!$e.current){ae(g,"replace"),$e.current=!0,te.current=g;return}if(ve.current){ve.current=!1,te.current=g;return}te.current!==g&&(ae(g,"push"),te.current=g)},[g,ae]),n.useEffect(()=>{const t=a=>{var m,x;const l=(x=(m=a.state)==null?void 0:m.__flatAgentNav)==null?void 0:x.agentId;if(!l||typeof l!="string"||!q.has(l)||l===g)return;ve.current=!0,ue.current=!0;const r=z.current,p=r.lastIndexOf(l);p>=0?H.current=p:(r.push(l),H.current=r.length-1),s(),f.selectAgent(l)};return window.addEventListener("popstate",t),()=>window.removeEventListener("popstate",t)},[q,g,s]),n.useEffect(()=>{if(!g){z.current=[],H.current=-1,s();return}if(Le.current=g,ue.current){ue.current=!1,s();return}const t=z.current,a=H.current;if(a>=0&&t[a]===g){s();return}const l=a<t.length-1?t.slice(0,a+1):t.slice();l.push(g),l.length>100&&l.shift(),z.current=l,H.current=l.length-1,s()},[g,s]);const pe=n.useCallback(t=>{_(t),Z(!1)},[_]),Ne=g??"",mt=n.useCallback(()=>{},[]),ft=n.useCallback(t=>{pe(t)},[pe]),ke=ze,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=Le.current;!r||!q.has(r)||(a.preventDefault(),f.selectAgent(r))};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[g,q]);const[I,Oe]=n.useState(new Set),Lt=n.useCallback(t=>{Oe(a=>{const l=new Set(a);return l.has(t)?l.delete(t):l.add(t),l})},[]),ht=Pt(),et=zt(),[$t]=Yt(),Ie=n.useMemo(()=>{const t=new Map,a=[];for(const b of T){const C=f.getAreaForAgent(b.id);if(!At((C==null?void 0:C.id)??null))continue;if(!C||C.archived){a.push(b);continue}const v=t.get(C.id);v?v.push(b):t.set(C.id,[b])}const l=new Map,r=[];for(const b of et.values()){let C=!1;for(const v of ht.values())if(!v.archived&&St(v.id)&&f.isPositionInArea(b.position,v)){const K=l.get(v.id);K?K.push(b):l.set(v.id,[b]),C=!0;break}!C&&At(null)&&r.push(b)}const p=[];for(const[,b]of ht){if(b.archived||!St(b.id))continue;const C=t.get(b.id),v=l.get(b.id)??[];(C&&C.length>0||v.length>0)&&p.push({area:b,agents:C??[],buildings:v})}(a.length>0||r.length>0)&&p.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,buildings:r});const m=p.filter(b=>b.area.id!=="__unassigned__"),x=p.filter(b=>b.area.id==="__unassigned__");let $=1,S=1;const Be=new Map;if(m.length>1){let b=1/0,C=-1/0,v=1/0,K=-1/0;for(const y of m)b=Math.min(b,y.area.center.x),C=Math.max(C,y.area.center.x),v=Math.min(v,y.area.center.z),K=Math.max(K,y.area.center.z);const tt=C-b||1,at=K-v||1;if(m.length<=4){$=m.length,S=1;const y=[...m].sort((M,gt)=>M.area.center.x-gt.area.center.x);for(let M=0;M<y.length;M++)Be.set(y[M].area.id,{row:1,col:M+1})}else{const y=[...m].sort((w,k)=>w.area.center.x-k.area.center.x),M=[];for(let w=1;w<y.length;w++)M.push(y[w].area.center.x-y[w-1].area.center.x);const gt=M.reduce((w,k)=>w+k,0)/M.length||1;let Ct=1;for(const w of M)w>gt*1.3&&Ct++;$=Math.max(2,Math.min(Ct,m.length));const bt=[...m].sort((w,k)=>w.area.center.z-k.area.center.z),nt=[];for(let w=1;w<bt.length;w++)nt.push(bt[w].area.center.z-bt[w-1].area.center.z);const Wt=nt.reduce((w,k)=>w+k,0)/nt.length||1;let jt=1;for(const w of nt)w>Wt*1.3&&jt++;S=Math.max(2,Math.min(jt,m.length)),$=Math.max($,Math.ceil(m.length/S)),S=Math.max(S,Math.ceil(m.length/$));const Ht=tt/$,Gt=at/S,xt=new Set;for(const w of m){let k=Math.min($-1,Math.max(0,Math.floor((w.area.center.x-b)/Ht))),fe=Math.min(S-1,Math.max(0,Math.floor((w.area.center.z-v)/Gt))),Fe=`${fe},${k}`,vt=0;const Vt=S*$;for(;xt.has(Fe)&&vt<Vt;)k++,k>=$&&(k=0,fe=(fe+1)%S),Fe=`${fe},${k}`,vt++;xt.has(Fe)&&(fe=S,k=0,Fe=`${fe},${k}`,S++),xt.add(Fe),Be.set(w.area.id,{row:fe+1,col:k+1})}}}const me=b=>{b.sort((C,v)=>{var tt,at,y,M;const K=(((tt=C.position)==null?void 0:tt.z)??0)-(((at=v.position)==null?void 0:at.z)??0);return K!==0?K:(((y=C.position)==null?void 0:y.x)??0)-(((M=v.position)==null?void 0:M.x)??0)})};for(const b of m)me(b.agents);for(const b of x)me(b.agents);return{groups:[...m,...x],gridCols:$,gridRows:S,positions:Be}},[T,ht,et,$t]),Ot=n.useMemo(()=>{if(!P)return[];const t=T.find(a=>a.id===P.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:()=>_(t.id)},{id:"delete-agent",label:"Delete Agent",icon:e.jsx(u,{name:"trash",size:14}),danger:!0,onClick:()=>{se({agentId:t.id,name:t.name})}}]:[]},[P,T,_]),Bt=n.useMemo(()=>{var m;if(!G)return[];const t=et.get(G.buildingId);if(!t)return[];const a=[],l=t.type==="server"||t.type==="docker"||t.type==="terminal",r=t.status==="running",p=t.type==="boss";if(a.push({id:"open",label:t.type==="database"?"Open Database":t.type==="folder"?"Open Folder":t.type==="boss"?"View Boss Logs":t.type==="terminal"?"Open Terminal":t.type==="server"&&((m=t.pm2)!=null&&m.enabled)?"View PM2 Logs":"Open",icon:e.jsx(u,{name:t.type==="database"?"database":t.type==="folder"?"folder":t.type==="terminal"?"terminal":"eye",size:14}),onClick:()=>de(t.id)}),l&&(r||a.push({id:"start",label:"Start",icon:e.jsx(u,{name:"play",size:14}),onClick:()=>f.sendBuildingCommand(t.id,"start")}),r&&(a.push({id:"restart",label:"Restart",icon:e.jsx(u,{name:"refresh",size:14}),onClick:()=>f.sendBuildingCommand(t.id,"restart")}),a.push({id:"stop",label:"Stop",icon:e.jsx(u,{name:"stop",size:14}),onClick:()=>f.sendBuildingCommand(t.id,"stop")}))),p&&t.subordinateBuildingIds&&t.subordinateBuildingIds.length>0&&(a.push({id:"start-all",label:"Start All Subordinates",icon:e.jsx(u,{name:"launch",size:14}),onClick:()=>{for(const x of t.subordinateBuildingIds)f.sendBuildingCommand(x,"start")}}),a.push({id:"stop-all",label:"Stop All Subordinates",icon:e.jsx(u,{name:"pause",size:14}),onClick:()=>{for(const x of t.subordinateBuildingIds)f.sendBuildingCommand(x,"stop")}}),a.push({id:"restart-all",label:"Restart All Subordinates",icon:e.jsx(u,{name:"restart",size:14}),onClick:()=>{for(const x of t.subordinateBuildingIds)f.sendBuildingCommand(x,"restart")}})),l&&a.push({id:"health-check",label:"Health Check",icon:e.jsx(u,{name:"health",size:14}),onClick:()=>f.sendBuildingCommand(t.id,"healthCheck")}),a.push({id:"divider-edit",label:"",divider:!0,onClick:()=>{}}),a.push({id:"edit",label:"Edit Building",icon:e.jsx(u,{name:"edit",size:14}),onClick:()=>{window.dispatchEvent(new CustomEvent("tide:building-edit",{detail:{buildingId:t.id}}))}}),a.push({id:"clone",label:"Clone Building",icon:e.jsx(u,{name:"copy",size:14}),onClick:()=>{f.createBuilding({name:`${t.name} (Copy)`,type:t.type,style:t.style,color:t.color,scale:t.scale,position:{x:t.position.x+2,z:t.position.z+2},cwd:t.cwd,folderPath:t.folderPath,commands:t.commands,pm2:t.pm2,docker:t.docker,database:t.database,terminal:t.terminal,urls:t.urls,subordinateBuildingIds:t.subordinateBuildingIds})}}),t.urls&&t.urls.length>0)for(const x of t.urls)a.push({id:`url-${x.label}`,label:x.label,icon:e.jsx(u,{name:"link",size:14}),onClick:()=>window.open(x.url,"_blank","noopener,noreferrer")});return a.push({id:"divider-danger",label:"",divider:!0,onClick:()=>{}}),a.push({id:"delete",label:"Delete Building",icon:e.jsx(u,{name:"trash",size:14}),danger:!0,onClick:()=>f.deleteBuilding(t.id)}),a},[G,et,de]),Ft=n.useCallback(t=>{const a=new Set(Ie.groups.map(l=>l.area.id));a.delete(t),Oe(a),requestAnimationFrame(()=>{const l=D.current;if(!l)return;const r=l.querySelector(`[data-area-id="${t}"]`);if(!r)return;const p=l.getBoundingClientRect(),x=r.getBoundingClientRect().top-p.top+l.scrollTop-8;l.scrollTo({top:Math.max(0,x),behavior:"smooth"})})},[Ie]);return e.jsxs("div",{ref:J,className:`flat-view ${ke?"flat-view--with-inspector":""} ${g?"flat-view--has-chat":""} ${we?"flat-view--mobile-sidebar-open":""}`,style:(()=>{if(F===null&&W===null)return;const t={};return F!==null&&(t["--flat-middle-width"]=`${F}px`),W!==null&&(t["--flat-inspector-width"]=`${W}px`),t})(),children:[we&&e.jsx("div",{className:"flat-mobile-sidebar-backdrop",onClick:Xe,"aria-hidden":"true"}),e.jsxs("div",{className:"flat-middle",children:[e.jsx("div",{className:"flat-middle__header",children:e.jsxs("div",{className:"flat-middle__actions",children:[e.jsx("button",{className:"flat-cta-btn flat-cta-btn--agent",onClick:B,title:"Create new agent",children:"+ Agent"}),e.jsx("button",{className:"flat-cta-btn flat-cta-btn--boss",onClick:he,title:"Create new boss agent",children:"+ Boss"}),e.jsx("button",{className:"flat-cta-btn flat-cta-btn--area",onClick:ne,title:"Create new area",children:"+ Area"})]})}),e.jsx("div",{className:"flat-middle__content",children:e.jsx(Zt,{activeAgentId:Ne,onClose:mt,onSelectAgent:ft,collapsedAreas:I,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:re,onPointerMove:Q,onPointerUp:ie,onPointerCancel:ie,onDoubleClick:ot}),e.jsxs("div",{className:"flat-right",children:[e.jsxs("button",{type:"button",className:"flat-mobile-sidebar-toggle","aria-label":we?"Close agents sidebar":"Open agents sidebar","aria-expanded":we,onClick:it,children:[e.jsx(u,{name:"list",size:18}),e.jsx("span",{className:"flat-mobile-sidebar-toggle__label",children:"Agents"})]}),g?e.jsx(za,{agentId:g,terminalViewMode:Ve,onTerminalViewModeChange:_e,inspectorOpen:ze,onToggleInspector:ut,onImageClick:ee,onFileClick:X,onBashClick:Re,onViewMarkdown:Ke,onRequestClearSubordinates:Ye,onOpenBuilding:de,keyboard:ce,canNavigateBack:Ze,canNavigateForward:Je,onNavigateBack:c,onNavigateForward:o,agentInfoOpen:xe,onToggleAgentInfo:Te}):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(${Ie.gridCols}, 1fr)`},children:Ie.groups.length===0?e.jsx("div",{className:"flat-map__empty",children:e.jsx("span",{children:"No areas or agents yet"})}):Ie.groups.map(t=>{const a=t.area.id,l=Ie.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:()=>Ft(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 p=r.isBoss||r.class==="boss",m=p?Qe.get(r.id):void 0,x=Jt(r),$=x.usedPercent>=80?"#ff4a4a":x.usedPercent>=60?"#ff9e4a":x.usedPercent>=40?"#ffd700":"#4aff9e",S=`Context: ${(x.totalTokens/1e3).toFixed(1)}k / ${(x.contextWindow/1e3).toFixed(1)}k (${x.usedPercent}% used, ${x.freePercent}% free)`,Be=r.latestTodos&&r.latestTodos.length>0||m&&m.length>0;return e.jsx(Qt,{todos:r.latestTodos,subordinates:m,position:"top",children:e.jsxs("button",{type:"button",className:`flat-map-agent-chip ${r.status}`,onClick:()=>_(r.id),onContextMenu:me=>{me.preventDefault(),me.stopPropagation(),be({agentId:r.id,position:{x:me.clientX,y:me.clientY}})},title:Be?void 0:`${p?"Boss · ":""}Open chat with ${r.name}
2
+ ${S}`,children:[e.jsx(Dt,{agent:r,size:16}),p&&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:Rt(r.status)}}),r.latestTodos&&r.latestTodos.length>0&&e.jsx(ea,{todos:r.latestTodos,maxDots:6}),p&&m&&m.length>0&&e.jsx(ta,{subordinates:m,maxDots:6}),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:`${x.usedPercent}%`,backgroundColor:$}})})]})},r.id)})}),t.buildings.length>0&&e.jsx("div",{className:"flat-map-area-card__buildings",children:t.buildings.map(r=>e.jsxs("button",{type:"button",className:`flat-map-building-chip flat-map-building-chip--${r.status}`,onClick:p=>{if(E){const m=p.currentTarget.getBoundingClientRect();E(r.id,{x:m.right,y:m.top+m.height/2})}else de(r.id)},onContextMenu:p=>{p.preventDefault(),p.stopPropagation(),h({buildingId:r.id,position:{x:p.clientX,y:p.clientY}})},title:`${r.name} · ${r.type} · ${r.status}`,children:[e.jsx(u,{name:aa(r.type),size:12}),e.jsx("span",{className:"flat-map-building-chip__name",children:r.name}),e.jsx("span",{className:"flat-map-building-chip__dot",style:{backgroundColor:na(r.status)}})]},r.id))})]},a)})})]})})]}),ke&&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:Ue,onPointerMove:Q,onPointerUp:ie,onPointerCancel:ie,onDoubleClick:ct}),ke&&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":oe==="agent",className:`flat-inspector__tab ${oe==="agent"?"flat-inspector__tab--active":""}`,onClick:()=>qe("agent"),children:"Agent"}),e.jsx("button",{type:"button",role:"tab","aria-selected":oe==="tracking",className:`flat-inspector__tab ${oe==="tracking"?"flat-inspector__tab--active":""}`,onClick:()=>qe("tracking"),children:"Tracking"})]}),e.jsx("button",{type:"button",className:"flat-inspector__close",onClick:pt,title:"Close inspector","aria-label":"Close inspector",children:"✕"})]}),e.jsx("div",{className:"flat-inspector__body",children:oe==="tracking"?e.jsx(sa,{activeAgentId:g??"",onSelectAgent:t=>_(t)}):(()=>{if(!g)return e.jsx("div",{className:"flat-inspector__empty",children:e.jsx("span",{children:"Select an agent to inspect"})});const t=T.find(a=>a.id===g);return t?e.jsx(la,{agent:t,onFocusAgent:a=>_(a),onKillAgent:a=>f.killAgent(a)}):e.jsx("div",{className:"flat-inspector__empty",children:e.jsx("span",{children:"Agent not found"})})})()})]}),ye&&e.jsx(ra,{url:ye.url,name:ye.name,onClose:()=>Me(null)}),We&&e.jsx(ia,{state:We,onClose:()=>He(null)}),Ee&&e.jsx(oa,{action:"clear-subordinates",selectedAgentId:Ee.agentId,subordinateCount:Ee.count,onClose:()=>Y(null),onClearHistory:()=>{}}),e.jsx(ca,{agent:g?T.find(t=>t.id===g)??null:null,isOpen:xe&&!!g,onClose:Ge}),e.jsx(yt,{isOpen:P!==null,position:(P==null?void 0:P.position)??{x:0,y:0},worldPosition:{x:0,z:0},actions:Ot,onClose:()=>be(null)}),e.jsx(yt,{isOpen:G!==null,position:(G==null?void 0:G.position)??{x:0,y:0},worldPosition:{x:0,z:0},actions:Bt,onClose:()=>h(null)}),e.jsx(da,{isOpen:A!==null,title:ge("common:confirm.removeAgentTitle"),message:ge("common:confirm.removeAgentMessage",{name:(A==null?void 0:A.name)??""}),confirmLabel:ge("common:buttons.remove"),cancelLabel:ge("common:buttons.cancel"),variant:"danger",onConfirm:()=>{A&&f.removeAgentFromServer(A.agentId)},onClose:()=>se(null)})]})}export{$a as FlatView};
@@ -1,4 +1,4 @@
1
- import{bk as He,r as t,s as I,l as ye,bl as Ee,aF as _e,j as e,I as z,u as fe,bm as ze,bn as Te,bo as Be,bp as Ue,m as We,bq as Ke,br as De,bs as Ve,a2 as Ge,a3 as qe,bt as Ye,aO as Je,E as Me,S as oe,aI as Xe,aE as Qe,W as Ze,G as Ie,ad as et,N as tt,bu as st,n as X,bv as nt}from"./main-D2zY87-h.js";import{F as at}from"./index-3By2EvEk.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";const Se={status:"all",activity:"all",sort:"activity"},lt={"1h":3600*1e3,"6h":360*60*1e3,"24h":1440*60*1e3},Ae=20,me=3,ot={idle:"#4aff9e",working:"#4a9eff",waiting:"#ff9e4a",waiting_permission:"#ffcc00",error:"#ff4a4a",offline:"#888888",orphaned:"#ff9e4a"},ct=12e4;function rt(s){return s.trim().replace(/\r\n/g,`
1
+ import{bk as He,r as t,s as I,l as ye,bl as Ee,aF as _e,j as e,I as z,u as fe,bm as ze,bn as Te,bo as Be,bp as Ue,m as We,bq as Ke,br as De,bs as Ve,a2 as Ge,a3 as qe,bt as Ye,aO as Je,E as Me,S as oe,aI as Xe,aE as Qe,W as Ze,G as Ie,ad as et,N as tt,bu as st,n as X,bv as nt}from"./main-C0wLbrjb.js";import{F as at}from"./index-kLrB6kGv.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";const Se={status:"all",activity:"all",sort:"activity"},lt={"1h":3600*1e3,"6h":360*60*1e3,"24h":1440*60*1e3},Ae=20,me=3,ot={idle:"#4aff9e",working:"#4a9eff",waiting:"#ff9e4a",waiting_permission:"#ffcc00",error:"#ff4a4a",offline:"#888888",orphaned:"#ff9e4a"},ct=12e4;function rt(s){return s.trim().replace(/\r\n/g,`
2
2
  `)}function $e(s,a){return`${s}:${rt(a)}`}function it(s,a,l,f){if(s.uuid&&a.has(s.uuid))return!1;if(s.uuid)return!0;const p=s.isUserPrompt?"user":"assistant",d=$e(p,s.text),M=s.timestamp||0,A=l.get(d);return A!==void 0&&Math.abs(M-A)<=ct?!1:M>f}function dt({isOpen:s,agents:a}){const l=He(),[f,p]=t.useState(new Map),d=t.useRef(new Set);t.useRef(a);const M=t.useMemo(()=>Array.from(a.keys()).sort().join(","),[a]),A=t.useMemo(()=>Array.from(a.values()).map(j=>`${j.id}:${j.sessionId||""}`).sort().join(","),[a]);t.useEffect(()=>{s||(d.current.clear(),p(new Map))},[s]),t.useEffect(()=>{if(!s)return;const j=new Set(Array.from(a.keys()));for(const i of d.current)j.has(i)||d.current.delete(i);let h=null;l>0&&(h=I.preserveOutputs(),d.current.clear());const v=async(i,C,F=0)=>{if(d.current.add(i.id),F>0&&await new Promise(x=>setTimeout(x,F)),p(x=>{const k=new Map(x);return k.set(i.id,{agentId:i.id,messages:[],loading:!0,hasMore:!1,totalCount:0}),k}),!i.sessionId){C&&C.length>0&&I.mergeOutputsWithHistory(i.id,[],C),p(x=>{const k=new Map(x);return k.set(i.id,{agentId:i.id,messages:[],loading:!1,hasMore:!1,totalCount:0}),k});return}try{const k=await(await _e(ye(`/api/agents/${i.id}/history?limit=${Ee}&offset=0`))).json(),P=k.messages||[],K=P.length>0?Math.max(...P.map(w=>w.timestamp?new Date(w.timestamp).getTime():0)):0,Y=new Set(P.map(w=>w.uuid).filter(w=>!!w)),V=new Map;for(const w of P){if(w.type!=="user"&&w.type!=="assistant")continue;const c=$e(w.type,w.content),L=w.timestamp?new Date(w.timestamp).getTime():0,W=V.get(c)??0;L>W&&V.set(c,L)}const G=I.getOutputs(i.id),U=(C&&C.length>0?[...C,...G]:G).filter(w=>it(w,Y,V,K));I.clearOutputs(i.id);for(const w of U)I.addOutput(i.id,w);p(w=>{const c=new Map(w);return c.set(i.id,{agentId:i.id,messages:P,loading:!1,hasMore:k.hasMore||!1,totalCount:k.totalCount||0}),c})}catch(x){if(console.error(`Failed to load history for ${i.name}:`,x),C&&C.length>0){I.clearOutputs(i.id);for(const k of C)I.addOutput(i.id,k)}p(k=>{const P=new Map(k);return P.set(i.id,{agentId:i.id,messages:[],loading:!1,hasMore:!1,totalCount:0}),P})}},u=l>0?500:0,D=Array.from(a.values());for(const i of D)if(!d.current.has(i.id)){const C=h==null?void 0:h.get(i.id);v(i,C,u)}},[s,M,A,l]);const R=t.useRef(a),S=t.useRef(f);R.current=a,S.current=f;const b=t.useCallback(async j=>{const h=R.current.get(j),v=S.current.get(j);if(!(h!=null&&h.sessionId)||!v||!v.hasMore)return;const u=v.messages.length;try{const i=await(await fetch(ye(`/api/agents/${j}/history?limit=${Ee}&offset=${u}`))).json();i.messages&&i.messages.length>0&&p(C=>{const F=new Map(C),x=C.get(j);return x&&F.set(j,{...x,messages:[...i.messages,...x.messages],hasMore:i.hasMore||!1}),F})}catch(D){console.error(`Failed to load more history for agent ${j}:`,D)}},[]),E=t.useCallback(j=>{d.current.delete(j),p(h=>{const v=new Map(h),u=h.get(j);return u&&v.set(j,{...u,messages:[],hasMore:!1,totalCount:0,loading:!1}),v})},[]);return{histories:f,loadMoreHistory:b,clearAgentHistory:E}}function ut({command:s,onCommandChange:a,useTextarea:l,forceTextarea:f,onForceTextarea:p,onSend:d,canSend:M,attachedFiles:A,onAddFile:R,onRemoveFile:S,uploadFile:b,onAddPastedText:E,placeholder:j="Message...",className:h="",compact:v=!1,inputRef:u}){const D=t.useRef(null),i=t.useRef(null),C=t.useRef(l);t.useEffect(()=>{if(l&&!C.current&&i.current){const c=i.current;c.focus(),c.selectionStart=c.selectionEnd=c.value.length}C.current=l},[l]),t.useEffect(()=>{const c=i.current;if(!c||!l)return;c.style.height="auto";const L=v?120:180,W=Math.min(c.scrollHeight,L);c.style.height=`${W}px`},[s,l,v]);const F=t.useCallback(async c=>{const L=c.clipboardData.items;for(const _ of L)if(_.type.startsWith("image/")){c.preventDefault();const $=_.getAsFile();if($){const O=await b($);O&&R(O)}return}const W=c.clipboardData.files;if(W.length>0){c.preventDefault();for(const _ of W){const $=await b(_);$&&R($)}return}const B=c.clipboardData.getData("text"),te=(B.match(/\n/g)||[]).length+1;if(te>5){c.preventDefault();const $=`[Pasted text #${E(B)} +${te} lines]`,O=c.target,se=O.selectionStart||0,ae=O.selectionEnd||0,ne=s.slice(0,se)+$+s.slice(ae);a(ne),l||p(!0)}},[s,a,l,p,b,R,E]),x=t.useCallback(async c=>{const L=c.target.files;if(L){for(const W of L){const B=await b(W);B&&R(B)}D.current&&(D.current.value="")}},[b,R]),k=t.useCallback(c=>{if(c.key==="Enter"&&c.shiftKey){l||(c.preventDefault(),p(!0));return}c.key==="Enter"&&(c.preventDefault(),d())},[l,p,d]),P=t.useCallback(c=>{},[]),K=t.useCallback(c=>{c.button===1&&(c.preventDefault(),c.stopPropagation())},[]),Y=t.useCallback(c=>{i.current=c,u==null||u(c)},[u]),V=v?"agent-panel-input":"guake-input",G=v?"agent-panel-input-container":"guake-input-container",Q=v?"agent-panel-attach-btn":"guake-attach-btn",U=v?"agent-panel-send-btn":"",w=l?v?"agent-panel-input-expanded":"guake-input-expanded":"";return e.jsxs(e.Fragment,{children:[A.length>0&&e.jsx("div",{className:v?"agent-panel-attachments":"guake-attachments",children:A.map(c=>e.jsxs("div",{className:`${v?"agent-panel-attachment":"guake-attachment"} ${c.isImage?"is-image":""}`,children:[e.jsx("span",{className:v?"agent-panel-attachment-icon":"guake-attachment-icon",children:e.jsx(z,{name:c.isImage?"file":"paperclip",size:12})}),e.jsx("span",{className:v?"agent-panel-attachment-name":"guake-attachment-name",title:c.path,children:c.name}),!v&&e.jsxs("span",{className:"guake-attachment-size",children:["(",Math.round(c.size/1024),"KB)"]}),e.jsx("button",{className:v?"agent-panel-attachment-remove":"guake-attachment-remove",onClick:()=>S(c.id),title:"Remove",children:"×"})]},c.id))}),e.jsxs("div",{className:`${V} ${w} ${h}`,children:[e.jsx("input",{ref:D,type:"file",multiple:!0,onChange:x,style:{display:"none"},accept:"*"}),e.jsxs("div",{className:G,onAuxClick:K,children:[e.jsx("button",{className:Q,onClick:()=>{var c;return(c=D.current)==null?void 0:c.click()},title:"Attach file (or paste image)",children:e.jsx(z,{name:"paperclip",size:14})}),l?e.jsx("textarea",{ref:Y,placeholder:j,value:s,onChange:c=>a(c.target.value),onKeyDown:k,onPaste:F,onMouseDown:P}):e.jsx("input",{ref:u,type:"text",placeholder:j,value:s,onChange:c=>a(c.target.value),onKeyDown:k,onPaste:F,onMouseDown:P}),e.jsx("button",{className:U,onClick:d,disabled:!M,title:"Send",children:e.jsx(z,{name:"send",size:14})})]})]})]})}function mt(s){const a=Math.floor(s/1e3),l=Math.floor(a/60),f=a%60;return`${l}:${f.toString().padStart(2,"0")}`}const ft=t.memo(function({agentId:a,isWorking:l,timestamp:f}){const{t:p}=fe(["terminal"]),[d,M]=t.useState(0);return t.useEffect(()=>{if(!l||!f){M(0);return}M(Date.now()-f);const A=setInterval(()=>{M(Date.now()-f)},1e3);return()=>clearInterval(A)},[l,f]),l?e.jsxs("div",{className:"guake-stop-bar",children:[e.jsx("span",{className:"guake-elapsed-timer",children:mt(d)}),e.jsxs("button",{className:"guake-stop-btn",onClick:()=>I.stopAgent(a),title:p("terminal:input.stopOperation"),children:[e.jsx("span",{className:"stop-icon",children:e.jsx(z,{name:"stop",size:12,weight:"fill"})}),e.jsx("span",{className:"stop-label",children:p("terminal:input.stop")})]})]}):null});function pt({agent:s,history:a,outputs:l,isExpanded:f,isFocused:p,advancedView:d,onExpand:M,onFocus:A,inputRef:R,onLoadMore:S,onClearHistory:b}){const{t:E}=fe(["terminal","common"]),j=ze(s.id),h=t.useRef(null),[v,u]=t.useState(!1),D=t.useRef(0),i=t.useRef(!1),[C,F]=t.useState(!0),[x,k]=t.useState(!1),[P,K]=t.useState(null),[Y,V]=t.useState(null),[G,Q]=t.useState(null);Te(`commander-image-modal-${s.id}`,P!==null,()=>K(null));const{command:U,setCommand:w,forceTextarea:c,setForceTextarea:L,useTextarea:W,setPastedTexts:B,incrementPastedCount:te,resetPastedCount:_,attachedFiles:$,setAttachedFiles:O,removeAttachedFile:se,uploadFile:ae,expandPastedTexts:ne}=Be({selectedAgentId:s.id}),le=U.trim().length>0||$.length>0,n=Ue({outputs:l,viewMode:d?"advanced":"simple"}),o=t.useMemo(()=>{const N=We(s);return{usedPercent:N.usedPercent,freePercent:N.freePercent,hasData:!!s.contextStats,totalTokens:N.totalTokens,contextWindow:N.contextWindow}},[s.contextStats,s.contextUsed,s.contextLimit]),g=t.useCallback(()=>{!v&&(a!=null&&a.hasMore)&&S&&(u(!0),D.current=h.current?h.current.scrollHeight-h.current.scrollTop:0,S())},[v,a==null?void 0:a.hasMore,S]);t.useEffect(()=>{v&&a&&!a.loading&&u(!1)},[a,v]);const m=t.useCallback(()=>{i.current=!0,F(!1)},[]),T=t.useRef(f),Z=t.useRef(p);t.useEffect(()=>{(f&&!T.current||p&&!Z.current)&&(i.current=!1,F(!0),k(!0)),T.current=f,Z.current=p},[f,p]);const ee=t.useRef(a==null?void 0:a.loading);t.useEffect(()=>{ee.current&&!(a!=null&&a.loading)&&(i.current=!1,F(!0),k(!0)),ee.current=a==null?void 0:a.loading},[a==null?void 0:a.loading]),t.useEffect(()=>{if(!x)return;const N=h.current;if(!N)return;const y=performance.now();let H=0,ue=-1,ke;const Re=()=>{const{scrollTop:Fe,scrollHeight:Ne,clientHeight:Le}=N,Oe=Ne-Fe-Le<=2;if(Math.abs(Ne-ue)<=1&&Oe?H+=1:H=0,ue=Ne,H>=3){k(!1);return}if(performance.now()-y>5e3){k(!1);return}ke=requestAnimationFrame(Re)};return ke=requestAnimationFrame(Re),()=>cancelAnimationFrame(ke)},[x]),t.useEffect(()=>{i.current||F(!0)},[n.length]);const q=t.useCallback(()=>!1,[]),ie=t.useCallback(N=>{const y=te();return B(H=>new Map(H).set(y,N)),y},[te,B]),he=t.useCallback(N=>{O(y=>[...y,N])},[O]),xe=t.useCallback(()=>{if(!le)return;if(U.trim()==="/clear"&&$.length===0){I.clearContext(s.id),b(),w(""),L(!1),B(new Map),O([]),_();return}let N=ne(U.trim());if($.length>0){const y=$.map(H=>H.isImage?`[Image: ${H.path}]`:`[File: ${H.path}]`).join(`
3
3
  `);N=N?`${N}
4
4