tide-commander 1.55.2 → 1.57.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.
- package/dist/assets/{BossLogsModal-NMLA8Tb-.js → BossLogsModal-BwBPiIHp.js} +1 -1
- package/dist/assets/{BossSpawnModal-CHWYUZ5g.js → BossSpawnModal-DPBFSAYy.js} +1 -1
- package/dist/assets/{ControlsModal-B7YvUMVm.js → ControlsModal-BW3G1uJX.js} +1 -1
- package/dist/assets/{DockerLogsModal-CaspMYEh.js → DockerLogsModal-DZOp87-w.js} +1 -1
- package/dist/assets/{EmbeddedEditor-kYx4AdLw.js → EmbeddedEditor-CLG1Akse.js} +1 -1
- package/dist/assets/{GmailOAuthSetup-9eQ1r9Ar.js → GmailOAuthSetup-CB7dPDO1.js} +1 -1
- package/dist/assets/{GoogleOAuthSetup-Pi7a58Mi.js → GoogleOAuthSetup-BarVjw7w.js} +1 -1
- package/dist/assets/{IframeModal-z1T59LJS.js → IframeModal-BQSPQanQ.js} +1 -1
- package/dist/assets/{IntegrationsPanel-CB9QtfvD.js → IntegrationsPanel-DjV8Wn9_.js} +2 -2
- package/dist/assets/{LogViewerModal-BBdr9r3i.js → LogViewerModal-C8BFjrWu.js} +1 -1
- package/dist/assets/{MonitoringModal-CUZ4Xhuk.js → MonitoringModal-Cvu0xs8M.js} +1 -1
- package/dist/assets/{PM2LogsModal-Bt16sW5A.js → PM2LogsModal-X0iNty7H.js} +1 -1
- package/dist/assets/{RestoreArchivedAreaModal-BETGHA22.js → RestoreArchivedAreaModal-Df83lfgZ.js} +1 -1
- package/dist/assets/{Scene2DCanvas-BelfJXGw.js → Scene2DCanvas-Cn-i3V4y.js} +1 -1
- package/dist/assets/{SceneManager-BI_UCXtB.js → SceneManager-XiUuueR0.js} +1 -1
- package/dist/assets/{SkillsPanel-BHjnx8LP.js → SkillsPanel-CBJQ7XZ2.js} +1 -1
- package/dist/assets/SpawnModal-pPLoI5Iq.js +1 -0
- package/dist/assets/{SubordinateAssignmentModal-DHRZ-Evy.js → SubordinateAssignmentModal-Cq_zJRRQ.js} +1 -1
- package/dist/assets/{TriggerManagerPanel-cUWM5poU.js → TriggerManagerPanel-vNBLsk76.js} +1 -1
- package/dist/assets/{WorkflowEditorPanel-Ha9SXdvW.js → WorkflowEditorPanel-DxPBR30U.js} +1 -1
- package/dist/assets/{index-CD9Q_div.js → index-0IwqjnOt.js} +1 -1
- package/dist/assets/{index-DBgGw8Bd.js → index-B7QNRvGy.js} +1 -1
- package/dist/assets/{index-De9wibqy.js → index-BP3Xxs95.js} +1 -1
- package/dist/assets/{index-xU9wiWEU.js → index-BSEI99-s.js} +1 -1
- package/dist/assets/{index-BvZsOpS_.js → index-CIY_t_F3.js} +3 -3
- package/dist/assets/{index-CesYqhoW.js → index-Cfzg2JWf.js} +1 -1
- package/dist/assets/{index-BsEoXc0j.js → index-PtPORHO3.js} +2 -2
- package/dist/assets/{index-Vcs3Odgf.js → index-wbfZY0gc.js} +1 -1
- package/dist/assets/main-DeQm2kS-.css +1 -0
- package/dist/assets/{main-B_0o0aI9.js → main-muli6bmQ.js} +82 -81
- package/dist/assets/opencode.svg +12 -0
- package/dist/assets/{web-DGSbcqAM.js → web-CugONCdp.js} +1 -1
- package/dist/assets/{web-D2W-1YTG.js → web-DaHVj8Tk.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/src/packages/server/integrations/jira/jira-client.js +1 -4
- package/dist/src/packages/server/services/llm-matcher-service.js +1 -1
- package/dist/src/packages/server/websocket/handlers/agent-handler.js +3 -0
- package/package.json +1 -1
- package/dist/assets/SpawnModal-Dwfx-NFz.js +0 -1
- package/dist/assets/main-DTgTDvIL.css +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{u as Pe,bp as Qe,bq as Ze,r as i,h as Me,j as e,s as v,br as eo,bs as oo,bt as so,al as Re,l as D,k as Ae,$ as ro,N as to,a0 as ao,bu as P,G as io,a6 as Ne,I as lo,a5 as Oe}from"./main-
|
|
1
|
+
import{u as Pe,bp as Qe,bq as Ze,r as i,h as Me,j as e,s as v,br as eo,bs as oo,bt as so,al as Re,l as D,k as Ae,$ as ro,N as to,a0 as ao,bu as P,G as io,a6 as Ne,I as lo,a5 as Oe}from"./main-muli6bmQ.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";const co=[{value:"scout",labelKey:"tools:skills.classScout",descriptionKey:"tools:skills.classScoutDesc"},{value:"builder",labelKey:"tools:skills.classBuilder",descriptionKey:"tools:skills.classBuilderDesc"},{value:"debugger",labelKey:"tools:skills.classDebugger",descriptionKey:"tools:skills.classDebuggerDesc"},{value:"architect",labelKey:"tools:skills.classArchitect",descriptionKey:"tools:skills.classArchitectDesc"},{value:"warrior",labelKey:"tools:skills.classWarrior",descriptionKey:"tools:skills.classWarriorDesc"},{value:"support",labelKey:"tools:skills.classSupport",descriptionKey:"tools:skills.classSupportDesc"},{value:"boss",labelKey:"tools:skills.classBoss",descriptionKey:"tools:skills.classBossDesc"}],no=[{labelKey:"tools:skills.toolReadFiles",value:"Read"},{labelKey:"tools:skills.toolWriteFiles",value:"Write"},{labelKey:"tools:skills.toolEditFiles",value:"Edit"},{labelKey:"tools:skills.toolRunBash",value:"Bash"},{labelKey:"tools:skills.toolGitCommands",value:"Bash(git:*)"},{labelKey:"tools:skills.toolNpmCommands",value:"Bash(npm:*)"},{labelKey:"tools:skills.toolDockerCommands",value:"Bash(docker:*)"},{labelKey:"tools:skills.toolKubectlCommands",value:"Bash(kubectl:*)"},{labelKey:"tools:skills.toolSearchFiles",value:"Grep"},{labelKey:"tools:skills.toolGlobFiles",value:"Glob"},{labelKey:"tools:skills.toolWebFetch",value:"WebFetch"},{labelKey:"tools:skills.toolWebSearch",value:"WebSearch"}],yo=`## Instructions
|
|
2
2
|
|
|
3
3
|
Describe step-by-step instructions for this skill here.
|
|
4
4
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as Qe,$ as Ve,a0 as Ze,a1 as es,a2 as ss,r as t,a3 as as,S as ke,a4 as ne,A as ye,l as te,a5 as ns,s as b,h as ts,j as s,a6 as ls,G as Ae,a7 as x,a8 as os,a9 as le,I as oe,aa as $,ab as G,ac as ie,ad as is}from"./main-muli6bmQ.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";function De(c,g){const S=g.filter(C=>!c.has(C));return S.length===0?`${g[Math.floor(Math.random()*g.length)]}-${Date.now()%1e3}`:S[Math.floor(Math.random()*S.length)]}function ms({isOpen:c,onClose:g,onSpawnStart:S,onSpawnEnd:C,spawnPosition:Ee,spawnAreaId:v}){const{t:a}=Qe(["terminal","common"]),P=Ve(),p=Ze(),ce=es(),K=ce.length>0?ce:ss,[m,N]=t.useState(""),[M,T]=t.useState(()=>as(ke.LAST_CWD)),[i,H]=t.useState("scout"),[re,D]=t.useState(!1),[Ie,F]=t.useState(!1),[de,J]=t.useState(!1),[pe,me]=t.useState(""),[k,Y]=t.useState([]),[y,R]=t.useState(null),[Le,ue]=t.useState(!1),[E,he]=t.useState(""),[u,_e]=t.useState(""),[z,$e]=t.useState(!0),[U,Pe]=t.useState("bypass"),[o,X]=t.useState("claude"),[j,I]=t.useState({fullAuto:!0,sandbox:"workspace-write",approvalMode:"on-request",search:!1}),[we,Q]=t.useState(new Set),[V,xe]=t.useState("claude-opus-4-7"),[Z,fe]=t.useState("high"),[ee,Te]=t.useState("gpt-5.3-codex"),[se,Fe]=t.useState("minimax/MiniMax-M1-80k"),[ge,Re]=t.useState(""),[A,ze]=t.useState(""),q=t.useRef(null),je=t.useRef(!1),L=t.useCallback(()=>{window.__spawnModalAreaContext=null},[]),h=t.useMemo(()=>P.filter(e=>e.enabled),[P]),Ue=["full-notifications","streaming-exec","task-label","report-task-to-boss","agent-tracking","send-message-to-agent"];t.useEffect(()=>{if(c&&!je.current&&h.length>0){const n=h.filter(l=>Ue.includes(l.slug)).map(l=>l.id);n.length>0&&Q(new Set(n))}je.current=c},[c,h]);const ve=t.useMemo(()=>{if(!A.trim())return h;const e=A.toLowerCase();return h.filter(n=>n.name.toLowerCase().includes(e)||n.description.toLowerCase().includes(e)||n.slug.toLowerCase().includes(e))},[h,A]),qe=t.useCallback(e=>{Q(n=>{const l=new Set(n);return l.has(e)?l.delete(e):l.add(e),l})},[]);t.useMemo(()=>h.filter(e=>e.assignedAgentClasses.includes(i)),[h,i]);const Oe=t.useMemo(()=>{var n;const e=p.find(l=>l.id===i);return(n=e==null?void 0:e.defaultSkillIds)!=null&&n.length?P.filter(l=>e.defaultSkillIds.includes(l.id)):[]},[p,i,P]),Ne=t.useMemo(()=>{if(!E.trim())return k;const e=E.toLowerCase();return k.filter(n=>n.sessionId.toLowerCase().includes(e)||n.projectPath.toLowerCase().includes(e)||n.firstMessage&&n.firstMessage.toLowerCase().includes(e))},[k,E]),O=t.useMemo(()=>{if(!u.trim())return p;const e=u.toLowerCase();return p.filter(n=>n.name.toLowerCase().includes(e)||n.description.toLowerCase().includes(e)||n.id.toLowerCase().includes(e))},[p,u]),W=t.useMemo(()=>{if(!u.trim())return ne;const e=u.toLowerCase();return ne.filter(n=>{const l=ye[n.id];return n.name.toLowerCase().includes(e)||n.id.toLowerCase().includes(e)||l.description.toLowerCase().includes(e)})},[u]);t.useEffect(()=>{if(!c||!u.trim())return;const e=[...O.map(n=>n.id),...W.map(n=>n.id)];e.length===1&&e[0]!==i&&H(e[0])},[c,u,O,W,i]);const r=t.useMemo(()=>p.find(e=>e.id===i),[p,i]),We=t.useMemo(()=>{if(r!=null&&r.model)return r.model},[r]),Be=t.useMemo(()=>{if(r!=null&&r.customModelPath)return te(`/api/custom-models/${r.id}`)},[r]),Ge=r==null?void 0:r.modelScale,Ke=t.useMemo(()=>r?"scout":i,[i,r]),B=t.useCallback(async e=>{ue(!0);try{const n=e?te(`/api/agents/claude-sessions?cwd=${encodeURIComponent(e)}`):te("/api/agents/claude-sessions"),d=await(await ns(n)).json();Y(d.sessions||[])}catch(n){console.error("Failed to fetch sessions:",n),Y([])}finally{ue(!1)}},[]);t.useEffect(()=>{c?B(M||void 0):(Y([]),R(null),he(""))},[c,B]),t.useEffect(()=>{if(!c)return;const e=setTimeout(()=>{B(M||void 0),R(null)},300);return()=>clearTimeout(e)},[M,c,B]),t.useEffect(()=>{if(!c||!v)return;const e=b.getState().areas.get(v);if(e!=null&&e.directories&&e.directories.length>0){T(e.directories[0]);return}const n=Array.from(b.getState().agents.values()).filter(f=>{var _;return((_=b.getAreaForAgent(f.id))==null?void 0:_.id)===v&&f.cwd});if(n.length===0)return;const l=new Map;for(const f of n)l.set(f.cwd,(l.get(f.cwd)||0)+1);let d="",w=0;for(const[f,_]of l)_>w&&(d=f,w=_);d&&T(d)},[c,v]),t.useEffect(()=>{if(c){const e=new Set(Array.from(b.getState().agents.values()).map(w=>w.name)),n=De(e,K),l=p.find(w=>w.id===i),d=l?`${l.name} ${n}`:n;N(d),q.current&&(q.current.focus(),q.current.select())}},[c,K]),t.useEffect(()=>{if(!c)return;const e=p.find(n=>n.id===i);if(e){const n=p.find(l=>m.startsWith(l.name+" "));if(n){const l=m.substring(n.name.length+1);N(`${e.name} ${l}`)}else N(`${e.name} ${m}`)}else{const n=p.find(l=>m.startsWith(l.name+" "));if(n){const l=m.substring(n.name.length+1);N(l)}}},[i]),t.useEffect(()=>{i==="boss"&&xe("claude-opus-4-7")},[i]);const He=()=>{var d;console.log("[SpawnModal] handleSpawn called"),F(!1);const e=y&&((d=k.find(w=>w.sessionId===y))==null?void 0:d.projectPath)||M;if(console.log("[SpawnModal] Effective CWD:",e),console.log("[SpawnModal] Agent name:",m),console.log("[SpawnModal] Agent class:",i),console.log("[SpawnModal] Permission mode:",U),console.log("[SpawnModal] Provider:",o),console.log("[SpawnModal] Use Chrome:",z),console.log("[SpawnModal] Session ID:",y||"none"),!e.trim()){console.error("[SpawnModal] Empty CWD, showing error"),F(!0);return}if(!m.trim()){console.log("[SpawnModal] Empty name, regenerating");const w=new Set(Array.from(b.getState().agents.values()).map(f=>f.name));N(De(w,K));return}is(ke.LAST_CWD,e),D(!0),S();const n=Array.from(we),l=ge.trim()||void 0;console.log("[SpawnModal] Calling store.spawnAgent with:",{name:m.trim(),class:i,cwd:e.trim(),sessionId:y||void 0,useChrome:o==="claude"?z:!1,permissionMode:U,provider:o,codexConfig:o==="codex"?j:void 0,codexModel:o==="codex"?ee:void 0,opencodeModel:o==="opencode"?se:void 0,initialSkillIds:n,model:o==="claude"?V:void 0,customInstructions:l?`${l.length} chars`:void 0,spawnAreaId:v||void 0}),window.__spawnModalAreaContext=v?{areaId:v}:null,b.spawnAgent(m.trim(),i,e.trim(),Ee||void 0,y||void 0,o==="claude"?z:!1,U,n,o,o==="codex"?j:void 0,o==="codex"?ee:void 0,o==="claude"?V:void 0,l,o==="claude"?Z:void 0,o==="opencode"?se:void 0)},be=()=>{console.log("[SpawnModal] Agent creation successful"),D(!1),N(""),Q(new Set),L(),C(),g()},Se=()=>{console.error("[SpawnModal] Agent creation failed"),D(!1),F(!0),L(),C()},Ce=e=>{console.log("[SpawnModal] Directory not found:",e),D(!1),me(e),J(!0),C()},Me=()=>{J(!1),D(!0),S(),b.createDirectoryAndSpawn(pe,m.trim(),i)},ae=()=>{J(!1),me(""),L()};t.useEffect(()=>(window.__spawnModalSuccess=be,window.__spawnModalError=Se,window.__spawnModalDirNotFound=Ce,()=>{L(),delete window.__spawnModalSuccess,delete window.__spawnModalError,delete window.__spawnModalDirNotFound}),[m,i,be,Se,Ce,L]);const{handleMouseDown:Je,handleClick:Ye}=ts(g),Xe=e=>{e.key==="Escape"&&g()};return!c&&!de?null:de?s.jsx("div",{className:"modal-overlay visible",onClick:ae,onKeyDown:e=>{e.key==="Escape"&&ae(),e.key==="Enter"&&Me()},children:s.jsxs("div",{className:"modal confirm-modal",onClick:e=>e.stopPropagation(),children:[s.jsx("div",{className:"modal-header",children:a("terminal:spawn.directoryNotFound")}),s.jsxs("div",{className:"modal-body confirm-modal-body",children:[s.jsx("p",{children:a("terminal:spawn.directoryNotExist")}),s.jsx("code",{className:"confirm-modal-path",children:pe}),s.jsx("p",{children:a("terminal:spawn.wouldYouCreate")})]}),s.jsxs("div",{className:"modal-footer",children:[s.jsx("button",{className:"btn btn-secondary",onClick:ae,children:a("common:buttons.cancel")}),s.jsx("button",{className:"btn btn-primary",onClick:Me,autoFocus:!0,children:a("terminal:spawn.createDirectory")})]})]})}):s.jsx("div",{className:`modal-overlay ${c?"visible":""}`,onMouseDown:Je,onClick:Ye,onKeyDown:Xe,children:s.jsxs("div",{className:"modal spawn-modal",children:[s.jsx("div",{className:"modal-header",children:a("terminal:spawn.deployTitle")}),s.jsxs("div",{className:"modal-body spawn-modal-body",children:[s.jsxs("div",{className:"spawn-top-section",children:[s.jsx("div",{className:"spawn-preview-compact",children:s.jsx(ls,{agentClass:Ke,modelFile:We,customModelUrl:Be,modelScale:Ge,width:100,height:120})}),s.jsxs("div",{className:"spawn-class-section",children:[s.jsx("div",{className:"spawn-class-label",children:a("terminal:spawn.agentClass")}),p.length+ne.length>6&&s.jsx("input",{type:"text",className:"spawn-input class-search-input",placeholder:a("terminal:spawn.filterClasses"),value:u,onChange:e=>_e(e.target.value)}),s.jsxs("div",{className:"class-selector-inline",children:[O.map(e=>s.jsxs("button",{className:`class-chip ${i===e.id?"selected":""}`,onClick:()=>H(e.id),title:e.description,children:[s.jsx(Ae,{classId:e.id,size:18,className:"class-chip-icon"}),s.jsx("span",{className:"class-chip-name",children:e.name})]},e.id)),W.map(e=>{const n=ye[e.id];return s.jsxs("button",{className:`class-chip ${i===e.id?"selected":""}`,onClick:()=>H(e.id),title:n.description,children:[s.jsx(Ae,{classId:e.id,size:18,className:"class-chip-icon"}),s.jsx("span",{className:"class-chip-name",children:e.name})]},e.id)}),u&&O.length===0&&W.length===0&&s.jsx("div",{className:"class-search-empty",children:a("terminal:spawn.noClassesMatch",{query:u})})]})]})]}),s.jsxs("div",{className:"spawn-form-section",children:[s.jsxs("div",{className:"spawn-form-row",children:[s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:a("common:labels.name")}),s.jsx("input",{ref:q,type:"text",className:"spawn-input",placeholder:a("terminal:spawn.agentNamePlaceholder"),value:m,onChange:e=>N(e.target.value)})]}),s.jsxs("div",{className:"spawn-field spawn-field-wide",children:[s.jsxs("label",{className:"spawn-label",children:[a("terminal:spawn.workingDir"),s.jsx(x,{text:a("terminal:spawn.helpWorkingDir"),title:a("terminal:spawn.workingDir"),position:"top",size:"sm"})]}),s.jsx(os,{value:M,onChange:e=>{T(e),F(!1)},placeholder:a("terminal:spawn.workingDirPlaceholder"),className:`spawn-input ${Ie?"error":""}`,directoriesOnly:!0})]})]}),s.jsxs("div",{className:"spawn-form-row",children:[s.jsxs("div",{className:"spawn-field",children:[s.jsxs("label",{className:"spawn-label",children:[a("terminal:spawn.selectRuntime"),s.jsx(x,{text:a("terminal:spawn.helpRuntime"),title:a("terminal:spawn.runtimeTitle"),position:"top",size:"sm"})]}),s.jsxs("div",{className:"spawn-select-row",children:[s.jsxs("button",{className:`spawn-select-btn ${o==="claude"?"selected":""}`,onClick:()=>X("claude"),title:a("terminal:spawn.useClaudeCli"),children:[s.jsx("img",{src:"/assets/claude.ico",alt:"Claude",className:"spawn-provider-icon"}),s.jsx("span",{children:"Claude"})]}),s.jsxs("button",{className:`spawn-select-btn ${o==="codex"?"selected":""}`,onClick:()=>X("codex"),title:a("terminal:spawn.useCodexCli"),children:[s.jsx("img",{src:"/assets/codex.ico",alt:"Codex",className:"spawn-provider-icon"}),s.jsx("span",{children:"Codex"})]}),s.jsxs("button",{className:`spawn-select-btn spawn-select-btn--opencode ${o==="opencode"?"selected":""}`,onClick:()=>X("opencode"),title:"Use OpenCode CLI (multi-provider)",children:[s.jsx("img",{src:"/assets/opencode.svg",alt:"OpenCode",className:"spawn-provider-icon"}),s.jsx("span",{children:"OpenCode"})]})]})]}),s.jsxs("div",{className:"spawn-field",children:[s.jsxs("label",{className:"spawn-label",children:[a("common:labels.permissions"),s.jsx(x,{text:a("terminal:spawn.helpPermission"),title:a("terminal:spawn.permissionMode"),position:"top",size:"sm"})]}),s.jsx("div",{className:"spawn-select-row",children:Object.keys(le).map(e=>s.jsxs("button",{className:`spawn-select-btn ${U===e?"selected":""}`,onClick:()=>Pe(e),title:le[e].description,children:[s.jsx("span",{children:s.jsx(oe,{name:e==="bypass"?"bolt":"lock",size:12})}),s.jsx("span",{children:le[e].label})]},e))})]})]}),s.jsx("div",{className:"spawn-form-row",children:s.jsxs("div",{className:"spawn-field",children:[s.jsxs("label",{className:"spawn-label",children:[a("common:labels.model"),s.jsx(x,{text:a("terminal:spawn.helpModel"),title:a("terminal:spawn.modelTitle"),position:"top",size:"sm"})]}),o==="claude"?s.jsx("div",{className:"spawn-select-row spawn-select-row--wrap",children:Object.keys($).filter(e=>!$[e].deprecated).map(e=>s.jsxs("button",{className:`spawn-select-btn ${V===e?"selected":""}`,onClick:()=>xe(e),title:$[e].description,children:[s.jsx("span",{children:$[e].icon}),s.jsx("span",{children:$[e].label})]},e))}):o==="codex"?s.jsx("div",{className:"spawn-select-row spawn-select-row--codex-models",children:Object.keys(G).map(e=>s.jsxs("button",{className:`spawn-select-btn ${ee===e?"selected":""}`,onClick:()=>Te(e),title:G[e].description,children:[s.jsx("span",{children:G[e].icon}),s.jsx("span",{children:G[e].label})]},e))}):o==="opencode"?s.jsx("input",{type:"text",className:"spawn-input",value:se,onChange:e=>Fe(e.target.value),placeholder:"provider/model (e.g., minimax/MiniMax-M1-80k)"}):s.jsx("div",{className:"spawn-inline-hint",children:a("terminal:spawn.chooseCodexModel")})]})}),s.jsxs("div",{className:"spawn-form-row",children:[o==="claude"&&s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:"Effort"}),s.jsxs("div",{className:"spawn-select-row spawn-select-row--effort",children:[s.jsx("button",{className:`spawn-select-btn spawn-select-btn--compact ${Z===void 0?"selected":""}`,onClick:()=>fe(void 0),title:"Use default effort level",children:s.jsx("span",{children:"Default"})}),Object.keys(ie).map(e=>s.jsx("button",{className:`spawn-select-btn spawn-select-btn--compact ${Z===e?"selected":""}`,onClick:()=>fe(e),title:ie[e].description,children:s.jsx("span",{children:ie[e].label})},e))]})]}),s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:a("terminal:spawn.browser")}),s.jsxs("label",{className:"spawn-checkbox",children:[s.jsx("input",{type:"checkbox",checked:z,onChange:e=>$e(e.target.checked),disabled:o!=="claude"}),s.jsxs("span",{children:[s.jsx(oe,{name:"globe",size:12})," ",a("terminal:spawn.chromeBrowser")]}),s.jsx(x,{text:a(o==="claude"?"terminal:spawn.helpChrome":"terminal:spawn.helpChromeDisabled"),title:a("terminal:spawn.chromeBrowser"),position:"top",size:"sm"})]})]})]}),o==="codex"&&s.jsxs("div",{className:"codex-config-section",children:[s.jsx("div",{className:"codex-config-title",children:a("terminal:spawn.codex.configuration")}),s.jsxs("div",{className:"codex-config-options",children:[s.jsxs("div",{className:"codex-option-group",children:[s.jsxs("label",{className:"spawn-checkbox",children:[s.jsx("input",{type:"checkbox",checked:j.fullAuto!==!1,onChange:e=>I(n=>({...n,fullAuto:e.target.checked}))}),s.jsx("span",{children:a("terminal:spawn.codex.fullAuto")}),s.jsx(x,{text:a("terminal:spawn.helpFullAuto"),title:a("terminal:spawn.fullAutoTitle"),position:"top",size:"sm"})]}),s.jsxs("label",{className:"spawn-checkbox",children:[s.jsx("input",{type:"checkbox",checked:!!j.search,onChange:e=>I(n=>({...n,search:e.target.checked}))}),s.jsx("span",{children:a("terminal:spawn.codex.search")}),s.jsx(x,{text:a("terminal:spawn.helpSearch"),title:a("terminal:spawn.searchTitle"),position:"top",size:"sm"})]})]}),j.fullAuto===!1&&s.jsxs("div",{className:"codex-option-group",children:[s.jsx("div",{className:"codex-option-header",children:a("terminal:spawn.codex.restrictions")}),s.jsxs("select",{className:"spawn-input codex-select",value:j.sandbox||"workspace-write",onChange:e=>I(n=>({...n,sandbox:e.target.value})),children:[s.jsxs("option",{value:"read-only",children:["📖 ",a("terminal:spawn.codex.sandboxReadOnly")]}),s.jsxs("option",{value:"workspace-write",children:["✏️ ",a("terminal:spawn.codex.sandboxWorkspaceWrite")]}),s.jsxs("option",{value:"danger-full-access",children:["⚡ ",a("terminal:spawn.codex.sandboxDangerFullAccess")]})]}),s.jsxs("select",{className:"spawn-input codex-select",value:j.approvalMode||"on-request",onChange:e=>I(n=>({...n,approvalMode:e.target.value})),children:[s.jsxs("option",{value:"untrusted",children:["🔒 ",a("terminal:spawn.codex.approvalsUntrusted")]}),s.jsxs("option",{value:"on-failure",children:["⚠️ ",a("terminal:spawn.codex.approvalsOnFailure")]}),s.jsxs("option",{value:"on-request",children:["🤔 ",a("terminal:spawn.codex.approvalsOnRequest")]}),s.jsxs("option",{value:"never",children:["✅ ",a("terminal:spawn.codex.approvalsNever")]})]})]}),s.jsxs("div",{className:"codex-option-group",children:[s.jsx("div",{className:"codex-option-header",children:a("terminal:spawn.codex.profile")}),s.jsx("input",{type:"text",className:"spawn-input codex-profile-input",placeholder:a("terminal:spawn.codex.profilePlaceholder"),value:j.profile||"",onChange:e=>I(n=>({...n,profile:e.target.value||void 0}))})]})]})]}),h.length>0&&s.jsxs("div",{className:"spawn-skills-section",children:[s.jsxs("label",{className:"spawn-label",children:[a("terminal:spawn.skills")," ",s.jsxs("span",{className:"spawn-label-hint",children:["(",a("common:labels.optional"),")"]}),s.jsx(x,{text:a("terminal:spawn.helpSkills"),title:a("terminal:spawn.skillsTitle"),position:"top",size:"sm"})]}),h.length>6&&s.jsx("input",{type:"text",className:"spawn-input skill-search-input",placeholder:a("terminal:spawn.filterSkills"),value:A,onChange:e=>ze(e.target.value)}),s.jsxs("div",{className:"spawn-skills-inline",children:[ve.map(e=>{const n=we.has(e.id);return Oe.some(d=>d.id===e.id)?null:s.jsxs("button",{className:`spawn-skill-chip ${n?"selected":""}`,onClick:()=>qe(e.id),title:e.description,children:[n&&s.jsx("span",{className:"spawn-skill-check",children:s.jsx(oe,{name:"check",size:10})}),s.jsx("span",{children:e.name}),e.builtin&&s.jsx("span",{className:"spawn-skill-builtin",children:"TC"})]},e.id)}),A&&ve.length===0&&s.jsx("div",{className:"skill-search-empty",children:a("terminal:spawn.noSkillsMatch",{query:A})})]})]}),s.jsxs("div",{className:"spawn-custom-instructions-section",children:[s.jsxs("label",{className:"spawn-label",children:[a("terminal:spawn.customInstructions")," ",s.jsxs("span",{className:"spawn-label-hint",children:["(",a("common:labels.optional"),")"]}),s.jsx(x,{text:a("terminal:spawn.helpCustomInstructions"),title:a("terminal:spawn.customInstructions"),position:"top",size:"sm"})]}),s.jsx("textarea",{className:"spawn-input spawn-textarea",placeholder:a("terminal:spawn.customInstructionsPlaceholder"),value:ge,onChange:e=>Re(e.target.value),rows:3})]}),s.jsxs("div",{className:"spawn-sessions-section",children:[s.jsxs("label",{className:"spawn-label",children:[a("terminal:spawn.linkSession")," ",s.jsxs("span",{className:"spawn-label-hint",children:["(",a("common:labels.optional"),")"]}),s.jsx(x,{text:a("terminal:spawn.helpLinkSession"),title:a("terminal:spawn.linkSessionTitle"),position:"top",size:"sm"})]}),k.length>0&&s.jsx("input",{type:"text",className:"spawn-input session-search-input",placeholder:a("terminal:spawn.searchSessions"),value:E,onChange:e=>he(e.target.value)}),s.jsx("div",{className:"sessions-list",children:Le?s.jsx("div",{className:"sessions-loading",children:a("terminal:spawn.loadingSessions")}):k.length===0?s.jsx("div",{className:"sessions-empty",children:a("terminal:spawn.noSessions")}):Ne.length===0?s.jsx("div",{className:"sessions-empty",children:a("terminal:spawn.noSessionsMatch",{query:E})}):Ne.map(e=>{const n=y===e.sessionId,l=Date.now()-new Date(e.lastModified).getTime(),d=l<6e4?a("common:time.justNow"):l<36e5?a("common:time.minutesAgo",{count:Math.floor(l/6e4)}):l<864e5?a("common:time.hoursAgo",{count:Math.floor(l/36e5)}):a("common:time.daysAgo",{count:Math.floor(l/864e5)});return s.jsxs("div",{className:`session-item ${n?"selected":""}`,onClick:()=>{n?R(null):(R(e.sessionId),T(e.projectPath))},children:[s.jsxs("div",{className:"session-item-header",children:[s.jsx("span",{className:"session-item-path",children:e.projectPath}),s.jsx("span",{className:"session-item-age",children:d})]}),s.jsx("div",{className:"session-item-preview",children:e.firstMessage||a("terminal:spawn.messagesCount",{count:e.messageCount})})]},e.sessionId)})})]})]})]}),s.jsxs("div",{className:"modal-footer",children:[s.jsx("button",{className:"btn btn-secondary",onClick:g,children:a("common:buttons.cancel")}),s.jsx("button",{className:"btn btn-primary",onClick:He,disabled:re,children:a(re?"common:buttons.deploying":"common:buttons2.deploy")})]})]})})}export{ms as SpawnModal};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as L,N as $,ag as D,r as m,j as s,ae as v,G as S,I as g,s as G}from"./main-
|
|
1
|
+
import{u as L,N as $,ag as D,r as m,j as s,ae as v,G as S,I as g,s as G}from"./main-muli6bmQ.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";function R({isOpen:o,bossId:r,onClose:l}){var j;const{t:a}=L(["terminal","common"]),f=$(),n=D(r),[i,c]=m.useState(new Set),[u,b]=m.useState(!1),d=Array.from(f.values()).filter(e=>e.class!=="boss"&&(!e.bossId||e.bossId===r));m.useEffect(()=>{o&&n&&c(new Set(n.subordinateIds||[]))},[o,n]);const y=()=>{b(!0),G.assignSubordinates(r,Array.from(i)),setTimeout(()=>{b(!1),l()},300)},A=e=>{const t=new Set(i);t.has(e)?t.delete(e):t.add(e),c(t)},p=()=>{c(new Set(d.map(e=>e.id)))},C=()=>{c(new Set)},w=e=>{e.target===e.currentTarget&&l()},k=e=>{e.key==="Escape"&&l()};if(!o||!n)return null;const E=v.boss,h=((j=n.subordinateIds)==null?void 0:j.length)||0,I=i.size,x=JSON.stringify([...n.subordinateIds||[]].sort())!==JSON.stringify([...i].sort());return s.jsx("div",{className:`modal-overlay ${o?"visible":""}`,onClick:w,onKeyDown:k,children:s.jsxs("div",{className:"modal subordinate-assignment-modal",children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("span",{className:"boss-header-icon",style:{color:E.color},children:s.jsx(S,{agent:n,size:22})}),a("terminal:team.manageTeam"),": ",n.name]}),s.jsxs("div",{className:"modal-body subordinate-assignment-body",children:[s.jsxs("div",{className:"subordinate-assignment-info",children:[s.jsx("p",{children:a("terminal:team.selectAgents")}),s.jsxs("div",{className:"subordinate-assignment-actions",children:[s.jsx("button",{className:"btn btn-small",onClick:p,children:a("common:buttons.selectAll")}),s.jsx("button",{className:"btn btn-small",onClick:C,children:a("common:buttons.clearAll")})]})]}),s.jsx("div",{className:"subordinates-list",children:d.length===0?s.jsx("div",{className:"subordinates-empty",children:a("terminal:team.noAgentsAvailable")}):d.map(e=>{var N;const t=i.has(e.id),T=v[e.class],z=(N=n.subordinateIds)==null?void 0:N.includes(e.id);return s.jsxs("div",{className:`subordinate-item ${t?"selected":""}`,onClick:()=>A(e.id),children:[s.jsx("div",{className:"subordinate-checkbox",children:t?s.jsx(g,{name:"check",size:12}):null}),s.jsx("div",{className:"subordinate-icon",style:{color:T.color},children:s.jsx(S,{agent:e,size:18})}),s.jsxs("div",{className:"subordinate-info",children:[s.jsx("div",{className:"subordinate-name",children:e.name}),s.jsx("div",{className:"subordinate-class",children:e.class})]}),s.jsx("div",{className:`subordinate-status status-${e.status}`,children:e.status}),z&&s.jsx("div",{className:"subordinate-badge",children:a("common:status.current")})]},e.id)})}),s.jsx("div",{className:"subordinate-assignment-summary",children:x?s.jsxs("span",{className:"summary-changed",children:[h," ",s.jsx(g,{name:"arrow-right",size:11})," ",I," ",a("terminal:team.subordinates").toLowerCase()]}):s.jsxs("span",{className:"summary-unchanged",children:[h," ",a("terminal:team.subordinates").toLowerCase()]})})]}),s.jsxs("div",{className:"modal-footer",children:[s.jsx("button",{className:"btn btn-secondary",onClick:l,children:a("common:buttons.cancel")}),s.jsx("button",{className:"btn btn-boss",onClick:y,disabled:u||!x,children:a(u?"common:status.saving":"terminal:team.saveTeam")})]})]})})}export{R as SubordinateAssignmentModal};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{N as ce,r as n,a5 as h,l as p,j as e}from"./main-
|
|
1
|
+
import{N as ce,r as n,a5 as h,l as p,j as e}from"./main-muli6bmQ.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";const pe=[{value:"webhook",label:"Webhook"},{value:"cron",label:"Cron"},{value:"slack",label:"Slack"},{value:"email",label:"Email"},{value:"jira",label:"Jira"}],xe=[{value:"structural",label:"Structural",desc:"Field-based matching (fast, free)"},{value:"llm",label:"LLM",desc:"Semantic matching via LLM (flexible, costs tokens)"},{value:"hybrid",label:"Hybrid",desc:"Structural pre-filter + LLM (recommended)"}],he=[{value:"structural",label:"Structural"},{value:"llm",label:"LLM"}],w=()=>({name:"",description:"",type:"webhook",agentId:"",promptTemplate:"",enabled:!0,matchMode:"structural",extractionMode:"structural",config:{method:"POST"}});function me({isOpen:C,onClose:E}){var H,U,_,W,J,$,V,G,X,q,Y,K;const T=ce(),[R,Q]=n.useState([]),[y,j]=n.useState("list"),[s,u]=n.useState(w()),[d,S]=n.useState(!1),[F,z]=n.useState(!1),[L,c]=n.useState(null),[O,Z]=n.useState([]),[g,ee]=n.useState(null),[k,te]=n.useState(`{
|
|
2
2
|
|
|
3
3
|
}`),[r,f]=n.useState(null),[B,I]=n.useState(!1),[N,P]=n.useState([]),x=n.useCallback(async()=>{try{const t=await h(p("/api/triggers"));if(t.ok){const a=await t.json();Q(a)}}catch(t){console.error("Failed to load triggers:",t)}},[]),v=n.useCallback(async t=>{try{const a=await h(p(`/api/triggers/${t}/events?limit=20`));if(a.ok){const i=await a.json();Z(i)}}catch(a){console.error("Failed to load trigger history:",a)}},[]);n.useEffect(()=>{C&&x()},[C,x]),n.useEffect(()=>{g&&v(g)},[g,v]);const le=n.useCallback(async()=>{z(!0),c(null);try{const t=d?p(`/api/triggers/${s.id}`):p("/api/triggers"),b=await h(t,{method:d?"PATCH":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!b.ok){const de=await b.json();throw new Error(de.error||"Failed to save trigger")}await x(),j("list"),u(w()),S(!1)}catch(t){c(t instanceof Error?t.message:"Save failed")}finally{z(!1)}},[s,d,x]),ae=n.useCallback(async t=>{try{await h(p(`/api/triggers/${t}`),{method:"DELETE"}),await x()}catch(a){console.error("Failed to delete trigger:",a)}},[x]),se=n.useCallback(async t=>{try{await h(p(`/api/triggers/${t.id}`),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:!t.enabled})}),await x()}catch(a){console.error("Failed to toggle trigger:",a)}},[x]),ie=n.useCallback(async t=>{try{await h(p(`/api/triggers/${t}/fire`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({variables:{}})}),g===t&&await v(t)}catch(a){console.error("Failed to test fire trigger:",a)}},[g,v]),ne=n.useCallback(async()=>{if(s.id){I(!0),f(null);try{let t;try{t=JSON.parse(k)}catch{f({structuralMatch:void 0,extractedVariables:{},wouldFire:!1}),c("Invalid JSON payload");return}const a=await h(p(`/api/triggers/${s.id}/test-match`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({payload:t})});if(a.ok){const i=await a.json();f(i),c(null)}else{const i=await a.json();c(i.error||"Test match failed")}}catch(t){c(t instanceof Error?t.message:"Test match failed")}finally{I(!1)}}},[s.id,k]),re=n.useCallback(async t=>{var a;try{const i=await h(p("/api/triggers/validate-cron"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({expression:t,timezone:((a=s.config)==null?void 0:a.timezone)||"UTC"})});if(i.ok){const b=await i.json();P(b.valid?b.nextFires:[])}}catch{P([])}},[s]),D=n.useCallback(t=>{t?(u({...t}),S(!0)):(u(w()),S(!1)),f(null),c(null),j("edit")},[]),o=n.useCallback((t,a)=>{u(i=>({...i,[t]:a}))},[]),m=n.useCallback((t,a)=>{u(i=>({...i,config:{...i.config,[t]:a}}))},[]),M=n.useCallback((t,a)=>{u(i=>({...i,llmMatch:{...i.llmMatch||{prompt:""},[t]:a}}))},[]),A=n.useCallback((t,a)=>{u(i=>({...i,llmExtract:{...i.llmExtract||{prompt:"",variables:[]},[t]:a}}))},[]),oe=n.useMemo(()=>Array.from(T.values()).map(t=>({id:t.id,name:t.name})),[T]);return C?e.jsx("div",{style:l.overlay,onClick:E,children:e.jsxs("div",{style:l.panel,onClick:t=>t.stopPropagation(),children:[e.jsxs("div",{style:l.header,children:[e.jsx("h2",{style:l.title,children:y==="list"?"Triggers":d?"Edit Trigger":"New Trigger"}),e.jsxs("div",{style:l.headerActions,children:[y==="list"&&e.jsx("button",{style:l.addBtn,onClick:()=>D(),children:"+ New Trigger"}),y==="edit"&&e.jsx("button",{style:l.backBtn,onClick:()=>{j("list"),f(null),c(null)},children:"Back"}),e.jsx("button",{style:l.closeBtn,onClick:E,children:"X"})]})]}),L&&e.jsx("div",{style:l.error,children:L}),y==="list"&&e.jsx("div",{style:l.content,children:R.length===0?e.jsx("div",{style:l.empty,children:"No triggers configured. Create one to get started."}):R.map(t=>{var a;return e.jsxs("div",{style:{...l.triggerCard,borderLeftColor:t.status==="error"?"#e74c3c":t.enabled?"#2ecc71":"#95a5a6"},onClick:()=>{ee(t.id),D(t)},children:[e.jsxs("div",{style:l.cardHeader,children:[e.jsxs("div",{style:l.cardTitle,children:[e.jsx("span",{style:l.typeTag,children:t.type}),e.jsx("span",{children:t.name}),t.matchMode!=="structural"&&e.jsx("span",{style:l.matchTag,children:t.matchMode})]}),e.jsxs("div",{style:l.cardActions,children:[e.jsx("button",{style:l.smallBtn,onClick:i=>{i.stopPropagation(),se(t)},children:t.enabled?"Disable":"Enable"}),e.jsx("button",{style:l.smallBtn,onClick:i=>{i.stopPropagation(),ie(t.id)},children:"Test Fire"}),e.jsx("button",{style:{...l.smallBtn,color:"#e74c3c"},onClick:i=>{i.stopPropagation(),ae(t.id)},children:"Delete"})]})]}),e.jsxs("div",{style:l.cardMeta,children:[e.jsxs("span",{children:["Agent: ",((a=T.get(t.agentId))==null?void 0:a.name)||t.agentId]}),e.jsxs("span",{children:["Fires: ",t.fireCount]}),t.lastFiredAt&&e.jsxs("span",{children:["Last: ",new Date(t.lastFiredAt).toLocaleString()]}),t.status==="error"&&t.lastError&&e.jsxs("span",{style:{color:"#e74c3c"},children:["Error: ",t.lastError]})]})]},t.id)})}),y==="edit"&&e.jsx("div",{style:l.content,children:e.jsxs("div",{style:l.form,children:[e.jsxs("div",{style:l.field,children:[e.jsx("label",{style:l.label,children:"Name"}),e.jsx("input",{style:l.input,value:s.name||"",onChange:t=>o("name",t.target.value),placeholder:"My Trigger"})]}),e.jsxs("div",{style:l.field,children:[e.jsx("label",{style:l.label,children:"Description"}),e.jsx("input",{style:l.input,value:s.description||"",onChange:t=>o("description",t.target.value),placeholder:"Optional description"})]}),e.jsxs("div",{style:l.row,children:[e.jsxs("div",{style:l.field,children:[e.jsx("label",{style:l.label,children:"Type"}),e.jsx("select",{style:l.select,value:s.type||"webhook",onChange:t=>{const a=t.target.value;o("type",a),a==="webhook"?o("config",{method:"POST"}):a==="cron"?o("config",{expression:"0 9 * * MON-FRI",timezone:"UTC"}):o("config",{})},children:pe.map(t=>e.jsx("option",{value:t.value,children:t.label},t.value))})]}),e.jsxs("div",{style:l.field,children:[e.jsx("label",{style:l.label,children:"Agent"}),e.jsxs("select",{style:l.select,value:s.agentId||"",onChange:t=>o("agentId",t.target.value),children:[e.jsx("option",{value:"",children:"Select agent..."}),oe.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))]})]})]}),e.jsxs("div",{style:l.field,children:[e.jsx("label",{style:l.label,children:"Prompt Template"}),e.jsx("textarea",{style:l.textarea,value:s.promptTemplate||"",onChange:t=>o("promptTemplate",t.target.value),placeholder:"Message sent to agent. Use {{variable}} for interpolation.",rows:4})]}),s.type==="webhook"&&e.jsxs("div",{style:l.section,children:[e.jsx("h4",{style:l.sectionTitle,children:"Webhook Config"}),e.jsxs("div",{style:l.row,children:[e.jsxs("div",{style:l.field,children:[e.jsx("label",{style:l.label,children:"Method"}),e.jsxs("select",{style:l.select,value:((H=s.config)==null?void 0:H.method)||"POST",onChange:t=>m("method",t.target.value),children:[e.jsx("option",{value:"POST",children:"POST"}),e.jsx("option",{value:"PUT",children:"PUT"})]})]}),e.jsxs("div",{style:l.field,children:[e.jsx("label",{style:l.label,children:"Secret (HMAC)"}),e.jsx("input",{style:l.input,type:"password",value:((U=s.config)==null?void 0:U.secret)||"",onChange:t=>m("secret",t.target.value||void 0),placeholder:"Optional HMAC secret"})]})]}),e.jsxs("div",{style:l.field,children:[e.jsx("label",{style:l.label,children:"Extract Fields (comma-separated JSON paths)"}),e.jsx("input",{style:l.input,value:((W=(_=s.config)==null?void 0:_.extractFields)==null?void 0:W.join(", "))||"",onChange:t=>m("extractFields",t.target.value.split(",").map(a=>a.trim()).filter(Boolean)),placeholder:"body.release_name, body.version"})]}),d&&s.id&&e.jsxs("div",{style:l.webhookUrl,children:[e.jsx("label",{style:l.label,children:"Webhook URL"}),e.jsx("code",{style:l.code,children:`${window.location.origin}/api/triggers/webhook/${s.id}`})]})]}),s.type==="cron"&&e.jsxs("div",{style:l.section,children:[e.jsx("h4",{style:l.sectionTitle,children:"Cron Config"}),e.jsxs("div",{style:l.row,children:[e.jsxs("div",{style:l.field,children:[e.jsx("label",{style:l.label,children:"Expression"}),e.jsx("input",{style:l.input,value:((J=s.config)==null?void 0:J.expression)||"",onChange:t=>{m("expression",t.target.value),t.target.value&&re(t.target.value)},placeholder:"0 9 * * MON-FRI"})]}),e.jsxs("div",{style:l.field,children:[e.jsx("label",{style:l.label,children:"Timezone"}),e.jsx("input",{style:l.input,value:(($=s.config)==null?void 0:$.timezone)||"UTC",onChange:t=>m("timezone",t.target.value),placeholder:"America/Mexico_City"})]})]}),N.length>0&&e.jsxs("div",{style:l.nextFires,children:[e.jsx("label",{style:l.label,children:"Next fires:"}),N.map((t,a)=>e.jsx("div",{style:l.nextFireItem,children:new Date(t).toLocaleString()},a))]})]}),e.jsxs("div",{style:l.section,children:[e.jsx("h4",{style:l.sectionTitle,children:"Match Mode"}),e.jsx("div",{style:l.modeSelector,children:xe.map(t=>e.jsxs("button",{style:{...l.modeBtn,...s.matchMode===t.value?l.modeBtnActive:{}},onClick:()=>o("matchMode",t.value),children:[e.jsx("strong",{children:t.label}),e.jsx("span",{style:l.modeDesc,children:t.desc})]},t.value))}),(s.matchMode==="llm"||s.matchMode==="hybrid")&&e.jsxs("div",{style:l.llmConfig,children:[e.jsxs("div",{style:l.field,children:[e.jsx("label",{style:l.label,children:"LLM Match Prompt"}),e.jsx("textarea",{style:l.textarea,value:((V=s.llmMatch)==null?void 0:V.prompt)||"",onChange:t=>M("prompt",t.target.value),placeholder:"Does this message request a release deployment?",rows:3})]}),e.jsxs("div",{style:l.row,children:[e.jsxs("div",{style:l.field,children:[e.jsx("label",{style:l.label,children:"Model"}),e.jsxs("select",{style:l.select,value:((G=s.llmMatch)==null?void 0:G.model)||"haiku",onChange:t=>M("model",t.target.value),children:[e.jsx("option",{value:"haiku",children:"Haiku (fast, cheap)"}),e.jsx("option",{value:"sonnet",children:"Sonnet (balanced)"}),e.jsx("option",{value:"opus",children:"Opus (powerful)"})]})]}),e.jsxs("div",{style:l.field,children:[e.jsx("label",{style:l.label,children:"Min Confidence"}),e.jsx("input",{style:l.input,type:"number",min:"0",max:"1",step:"0.1",value:((X=s.llmMatch)==null?void 0:X.minConfidence)??0,onChange:t=>M("minConfidence",parseFloat(t.target.value))})]})]})]})]}),e.jsxs("div",{style:l.section,children:[e.jsx("h4",{style:l.sectionTitle,children:"Extraction Mode"}),e.jsx("div",{style:l.row,children:he.map(t=>e.jsx("button",{style:{...l.modeBtn,...s.extractionMode===t.value?l.modeBtnActive:{}},onClick:()=>o("extractionMode",t.value),children:t.label},t.value))}),s.extractionMode==="llm"&&e.jsxs("div",{style:l.llmConfig,children:[e.jsxs("div",{style:l.field,children:[e.jsx("label",{style:l.label,children:"Extraction Instructions"}),e.jsx("textarea",{style:l.textarea,value:((q=s.llmExtract)==null?void 0:q.prompt)||"",onChange:t=>A("prompt",t.target.value),placeholder:"Extract: release version, affected systems, urgency",rows:3})]}),e.jsxs("div",{style:l.field,children:[e.jsx("label",{style:l.label,children:"Variable Names (comma-separated)"}),e.jsx("input",{style:l.input,value:((K=(Y=s.llmExtract)==null?void 0:Y.variables)==null?void 0:K.join(", "))||"",onChange:t=>A("variables",t.target.value.split(",").map(a=>a.trim()).filter(Boolean)),placeholder:"release_name, affected_systems, urgency"})]})]})]}),d&&e.jsxs("div",{style:l.section,children:[e.jsx("h4",{style:l.sectionTitle,children:"Test Match"}),e.jsxs("div",{style:l.field,children:[e.jsx("label",{style:l.label,children:"Sample Event Payload (JSON)"}),e.jsx("textarea",{style:l.textarea,value:k,onChange:t=>te(t.target.value),rows:4})]}),e.jsx("button",{style:l.testBtn,onClick:ne,disabled:B,children:B?"Testing...":"Test Match"}),r&&e.jsxs("div",{style:l.testResult,children:[e.jsx("div",{style:{...l.testResultHeader,color:r.wouldFire?"#2ecc71":"#e74c3c"},children:r.wouldFire?"WOULD FIRE":"WOULD NOT FIRE"}),r.structuralMatch!==void 0&&e.jsxs("div",{children:["Structural: ",r.structuralMatch?"Match":"No match"]}),r.llmMatch&&e.jsxs("div",{style:l.llmResult,children:[e.jsxs("div",{children:["LLM: ",r.llmMatch.match?"Match":"No match"]}),e.jsxs("div",{children:["Confidence: ",(r.llmMatch.confidence*100).toFixed(0),"%"]}),e.jsxs("div",{children:["Reason: ",r.llmMatch.reason]}),e.jsxs("div",{style:l.llmMeta,children:["Model: ",r.llmMatch.model," | Tokens: ",r.llmMatch.tokensUsed," | Latency: ",r.llmMatch.durationMs,"ms"]})]}),Object.keys(r.extractedVariables).length>0&&e.jsxs("div",{children:[e.jsx("div",{style:l.label,children:"Extracted Variables:"}),Object.entries(r.extractedVariables).map(([t,a])=>e.jsxs("div",{style:l.varRow,children:[e.jsx("code",{children:t}),": ",a]},t))]})]})]}),d&&O.length>0&&e.jsxs("div",{style:l.section,children:[e.jsx("h4",{style:l.sectionTitle,children:"Recent Fires"}),e.jsx("div",{style:l.historyList,children:O.map((t,a)=>{const i=t.llm_match_result?JSON.parse(t.llm_match_result):null;return e.jsxs("div",{style:l.historyItem,children:[e.jsxs("div",{style:l.historyHeader,children:[e.jsx("span",{style:{color:t.status==="delivered"?"#2ecc71":t.status==="failed"?"#e74c3c":"#f39c12"},children:t.status}),e.jsx("span",{children:new Date(t.fired_at).toLocaleString()}),t.duration_ms&&e.jsxs("span",{children:[t.duration_ms,"ms"]})]}),t.error&&e.jsx("div",{style:{color:"#e74c3c",fontSize:"12px"},children:t.error}),i&&e.jsxs("div",{style:l.llmMeta,children:["LLM: ",i.match?"match":"no match"," (",(i.confidence*100).toFixed(0),"%) - ",i.reason]})]},t.id||a)})})]}),e.jsxs("div",{style:l.actions,children:[e.jsx("button",{style:l.cancelBtn,onClick:()=>{j("list"),c(null)},children:"Cancel"}),e.jsx("button",{style:l.saveBtn,onClick:le,disabled:F||!s.name||!s.agentId,children:F?"Saving...":d?"Update":"Create"})]})]})})]})}):null}const l={overlay:{position:"fixed",top:0,left:0,right:0,bottom:0,background:"rgba(0,0,0,0.6)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},panel:{background:"#1e1e2e",borderRadius:"12px",width:"680px",maxHeight:"85vh",display:"flex",flexDirection:"column",color:"#cdd6f4",boxShadow:"0 8px 32px rgba(0,0,0,0.4)"},header:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"16px 20px",borderBottom:"1px solid #313244"},title:{margin:0,fontSize:"18px",fontWeight:600},headerActions:{display:"flex",gap:"8px"},content:{overflow:"auto",padding:"16px 20px",flex:1},empty:{textAlign:"center",padding:"40px",color:"#6c7086"},error:{background:"#45252a",color:"#f38ba8",padding:"8px 20px",fontSize:"13px"},triggerCard:{background:"#181825",borderRadius:"8px",padding:"12px 16px",marginBottom:"8px",borderLeft:"3px solid",cursor:"pointer",transition:"background 0.15s"},cardHeader:{display:"flex",justifyContent:"space-between",alignItems:"center"},cardTitle:{display:"flex",alignItems:"center",gap:"8px",fontWeight:500},typeTag:{background:"#313244",padding:"2px 6px",borderRadius:"4px",fontSize:"11px",textTransform:"uppercase"},matchTag:{background:"#45475a",padding:"2px 6px",borderRadius:"4px",fontSize:"10px",color:"#a6e3a1"},cardActions:{display:"flex",gap:"6px"},cardMeta:{display:"flex",gap:"16px",marginTop:"8px",fontSize:"12px",color:"#6c7086"},form:{display:"flex",flexDirection:"column",gap:"12px"},field:{display:"flex",flexDirection:"column",gap:"4px",flex:1},row:{display:"flex",gap:"12px"},label:{fontSize:"12px",color:"#a6adc8",fontWeight:500},input:{background:"#313244",border:"1px solid #45475a",borderRadius:"6px",padding:"8px 10px",color:"#cdd6f4",fontSize:"13px",outline:"none"},select:{background:"#313244",border:"1px solid #45475a",borderRadius:"6px",padding:"8px 10px",color:"#cdd6f4",fontSize:"13px",outline:"none"},textarea:{background:"#313244",border:"1px solid #45475a",borderRadius:"6px",padding:"8px 10px",color:"#cdd6f4",fontSize:"13px",outline:"none",fontFamily:"monospace",resize:"vertical"},section:{borderTop:"1px solid #313244",paddingTop:"12px"},sectionTitle:{margin:"0 0 8px",fontSize:"14px",fontWeight:600,color:"#a6adc8"},modeSelector:{display:"flex",gap:"8px",marginBottom:"8px"},modeBtn:{flex:1,background:"#313244",border:"1px solid #45475a",borderRadius:"6px",padding:"8px",color:"#cdd6f4",cursor:"pointer",textAlign:"left",display:"flex",flexDirection:"column",gap:"2px",fontSize:"12px"},modeBtnActive:{borderColor:"#89b4fa",background:"#1e3a5f"},modeDesc:{fontSize:"10px",color:"#6c7086"},llmConfig:{background:"#181825",borderRadius:"6px",padding:"12px",display:"flex",flexDirection:"column",gap:"8px"},webhookUrl:{marginTop:"8px"},code:{background:"#313244",padding:"6px 10px",borderRadius:"4px",fontSize:"12px",display:"block",wordBreak:"break-all",color:"#89b4fa"},nextFires:{marginTop:"8px"},nextFireItem:{fontSize:"12px",color:"#a6e3a1",padding:"2px 0"},testBtn:{background:"#89b4fa",border:"none",borderRadius:"6px",padding:"8px 16px",color:"#1e1e2e",fontWeight:600,cursor:"pointer",fontSize:"13px"},testResult:{background:"#181825",borderRadius:"6px",padding:"12px",marginTop:"8px",fontSize:"13px",display:"flex",flexDirection:"column",gap:"6px"},testResultHeader:{fontWeight:700,fontSize:"14px"},llmResult:{display:"flex",flexDirection:"column",gap:"2px"},llmMeta:{fontSize:"11px",color:"#6c7086",marginTop:"2px"},varRow:{fontSize:"12px",padding:"2px 0"},historyList:{display:"flex",flexDirection:"column",gap:"6px",maxHeight:"200px",overflow:"auto"},historyItem:{background:"#181825",borderRadius:"4px",padding:"8px 10px",fontSize:"12px"},historyHeader:{display:"flex",justifyContent:"space-between",alignItems:"center"},actions:{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"16px",paddingTop:"12px",borderTop:"1px solid #313244"},addBtn:{background:"#89b4fa",border:"none",borderRadius:"6px",padding:"6px 14px",color:"#1e1e2e",fontWeight:600,cursor:"pointer",fontSize:"13px"},backBtn:{background:"transparent",border:"1px solid #45475a",borderRadius:"6px",padding:"6px 14px",color:"#cdd6f4",cursor:"pointer",fontSize:"13px"},closeBtn:{background:"transparent",border:"none",color:"#6c7086",cursor:"pointer",fontSize:"16px",padding:"4px 8px"},smallBtn:{background:"transparent",border:"1px solid #45475a",borderRadius:"4px",padding:"3px 8px",color:"#cdd6f4",cursor:"pointer",fontSize:"11px"},saveBtn:{background:"#a6e3a1",border:"none",borderRadius:"6px",padding:"8px 20px",color:"#1e1e2e",fontWeight:600,cursor:"pointer",fontSize:"13px"},cancelBtn:{background:"transparent",border:"1px solid #45475a",borderRadius:"6px",padding:"8px 20px",color:"#cdd6f4",cursor:"pointer",fontSize:"13px"}};export{me as TriggerManagerPanel,me as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as x,a5 as M,l as P,j as e,N as J}from"./main-
|
|
1
|
+
import{r as x,a5 as M,l as P,j as e,N as J}from"./main-muli6bmQ.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";const H=[{id:"intake",name:"Intake",type:"action",description:"Gather CC details from the developer via Slack",action:{type:"agent_task",agentId:"",promptTemplate:`A developer has requested a new CC (Control de Cambios). Here is their message:
|
|
2
2
|
{{trigger.slack.message}}
|
|
3
3
|
From: {{trigger.slack.user}} (Slack ID: {{trigger.slack.userId}})
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as f,I as H,N as He,P as Ye,O as Je,bg as Xe,r as A,s as te,bh as Ie,z as de,u as Ee}from"./main-B_0o0aI9.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";function Z(t){return Array.isArray?Array.isArray(t):Te(t)==="[object Array]"}function Ze(t){if(typeof t=="string")return t;let e=t+"";return e=="0"&&1/t==-1/0?"-0":e}function qe(t){return t==null?"":Ze(t)}function J(t){return typeof t=="string"}function _e(t){return typeof t=="number"}function et(t){return t===!0||t===!1||tt(t)&&Te(t)=="[object Boolean]"}function $e(t){return typeof t=="object"}function tt(t){return $e(t)&&t!==null}function P(t){return t!=null}function fe(t){return!t.trim().length}function Te(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const st="Incorrect 'index' type",nt=t=>`Invalid value for key ${t}`,rt=t=>`Pattern length exceeds max of ${t}.`,it=t=>`Missing ${t} property in key`,ct=t=>`Property 'weight' in key '${t}' must be a positive integer`,ve=Object.prototype.hasOwnProperty;class ot{constructor(e){this._keys=[],this._keyMap={};let s=0;e.forEach(n=>{let r=Pe(n);this._keys.push(r),this._keyMap[r.id]=r,s+=r.weight}),this._keys.forEach(n=>{n.weight/=s})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function Pe(t){let e=null,s=null,n=null,r=1,i=null;if(J(t)||Z(t))n=t,e=be(t),s=me(t);else{if(!ve.call(t,"name"))throw new Error(it("name"));const c=t.name;if(n=c,ve.call(t,"weight")&&(r=t.weight,r<=0))throw new Error(ct(c));e=be(c),s=me(c),i=t.getFn}return{path:e,id:s,weight:r,src:n,getFn:i}}function be(t){return Z(t)?t:t.split(".")}function me(t){return Z(t)?t.join("."):t}function at(t,e){let s=[],n=!1;const r=(i,c,a)=>{if(P(i))if(!c[a])s.push(i);else{let u=c[a];const l=i[u];if(!P(l))return;if(a===c.length-1&&(J(l)||_e(l)||et(l)))s.push(qe(l));else if(Z(l)){n=!0;for(let h=0,d=l.length;h<d;h+=1)r(l[h],c,a+1)}else c.length&&r(l,c,a+1)}};return r(t,J(e)?e.split("."):e,0),n?s:s[0]}const ut={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},lt={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(t,e)=>t.score===e.score?t.idx<e.idx?-1:1:t.score<e.score?-1:1},ht={location:0,threshold:.6,distance:100},dt={useExtendedSearch:!1,getFn:at,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var p={...lt,...ut,...ht,...dt};const ft=/[^ ]+/g;function mt(t=1,e=3){const s=new Map,n=Math.pow(10,e);return{get(r){const i=r.match(ft).length;if(s.has(i))return s.get(i);const c=1/Math.pow(i,.5*t),a=parseFloat(Math.round(c*n)/n);return s.set(i,a),a},clear(){s.clear()}}}class Ce{constructor({getFn:e=p.getFn,fieldNormWeight:s=p.fieldNormWeight}={}){this.norm=mt(s,3),this.getFn=e,this.isCreated=!1,this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((s,n)=>{this._keysMap[s.id]=n})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,J(this.docs[0])?this.docs.forEach((e,s)=>{this._addString(e,s)}):this.docs.forEach((e,s)=>{this._addObject(e,s)}),this.norm.clear())}add(e){const s=this.size();J(e)?this._addString(e,s):this._addObject(e,s)}removeAt(e){this.records.splice(e,1);for(let s=e,n=this.size();s<n;s+=1)this.records[s].i-=1}getValueForItemAtKeyId(e,s){return e[this._keysMap[s]]}size(){return this.records.length}_addString(e,s){if(!P(e)||fe(e))return;let n={v:e,i:s,n:this.norm.get(e)};this.records.push(n)}_addObject(e,s){let n={i:s,$:{}};this.keys.forEach((r,i)=>{let c=r.getFn?r.getFn(e):this.getFn(e,r.path);if(P(c)){if(Z(c)){let a=[];const u=[{nestedArrIndex:-1,value:c}];for(;u.length;){const{nestedArrIndex:l,value:h}=u.pop();if(P(h))if(J(h)&&!fe(h)){let d={v:h,i:l,n:this.norm.get(h)};a.push(d)}else Z(h)&&h.forEach((d,m)=>{u.push({nestedArrIndex:m,value:d})})}n.$[i]=a}else if(J(c)&&!fe(c)){let a={v:c,n:this.norm.get(c)};n.$[i]=a}}}),this.records.push(n)}toJSON(){return{keys:this.keys,records:this.records}}}function Ke(t,e,{getFn:s=p.getFn,fieldNormWeight:n=p.fieldNormWeight}={}){const r=new Ce({getFn:s,fieldNormWeight:n});return r.setKeys(t.map(Pe)),r.setSources(e),r.create(),r}function pt(t,{getFn:e=p.getFn,fieldNormWeight:s=p.fieldNormWeight}={}){const{keys:n,records:r}=t,i=new Ce({getFn:e,fieldNormWeight:s});return i.setKeys(n),i.setIndexRecords(r),i}function ue(t,{errors:e=0,currentLocation:s=0,expectedLocation:n=0,distance:r=p.distance,ignoreLocation:i=p.ignoreLocation}={}){const c=e/t.length;if(i)return c;const a=Math.abs(n-s);return r?c+a/r:a?1:c}function gt(t=[],e=p.minMatchCharLength){let s=[],n=-1,r=-1,i=0;for(let c=t.length;i<c;i+=1){let a=t[i];a&&n===-1?n=i:!a&&n!==-1&&(r=i-1,r-n+1>=e&&s.push([n,r]),n=-1)}return t[i-1]&&i-n>=e&&s.push([n,i-1]),s}const se=32;function At(t,e,s,{location:n=p.location,distance:r=p.distance,threshold:i=p.threshold,findAllMatches:c=p.findAllMatches,minMatchCharLength:a=p.minMatchCharLength,includeMatches:u=p.includeMatches,ignoreLocation:l=p.ignoreLocation}={}){if(e.length>se)throw new Error(rt(se));const h=e.length,d=t.length,m=Math.max(0,Math.min(n,d));let g=i,y=m;const I=a>1||u,k=I?Array(d):[];let S;for(;(S=t.indexOf(e,y))>-1;){let E=ue(e,{currentLocation:S,expectedLocation:m,distance:r,ignoreLocation:l});if(g=Math.min(E,g),y=S+h,I){let C=0;for(;C<h;)k[S+C]=1,C+=1}}y=-1;let L=[],O=1,K=h+d;const ne=1<<h-1;for(let E=0;E<h;E+=1){let C=0,D=K;for(;C<D;)ue(e,{errors:E,currentLocation:m+D,expectedLocation:m,distance:r,ignoreLocation:l})<=g?C=D:K=D,D=Math.floor((K-C)/2+C);K=D;let $=Math.max(1,m-D+1),T=c?d:Math.min(m+D,d)+h,Q=Array(T+2);Q[T+1]=(1<<E)-1;for(let j=T;j>=$;j-=1){let X=j-1,oe=s[t.charAt(X)];if(I&&(k[X]=+!!oe),Q[j]=(Q[j+1]<<1|1)&oe,E&&(Q[j]|=(L[j+1]|L[j])<<1|1|L[j+1]),Q[j]&ne&&(O=ue(e,{errors:E,currentLocation:X,expectedLocation:m,distance:r,ignoreLocation:l}),O<=g)){if(g=O,y=X,y<=m)break;$=Math.max(1,2*m-y)}}if(ue(e,{errors:E+1,currentLocation:m,expectedLocation:m,distance:r,ignoreLocation:l})>g)break;L=Q}const G={isMatch:y>=0,score:Math.max(.001,O)};if(I){const E=gt(k,a);E.length?u&&(G.indices=E):G.isMatch=!1}return G}function yt(t){let e={};for(let s=0,n=t.length;s<n;s+=1){const r=t.charAt(s);e[r]=(e[r]||0)|1<<n-s-1}return e}const le=String.prototype.normalize?(t=>t.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,"")):(t=>t);class ze{constructor(e,{location:s=p.location,threshold:n=p.threshold,distance:r=p.distance,includeMatches:i=p.includeMatches,findAllMatches:c=p.findAllMatches,minMatchCharLength:a=p.minMatchCharLength,isCaseSensitive:u=p.isCaseSensitive,ignoreDiacritics:l=p.ignoreDiacritics,ignoreLocation:h=p.ignoreLocation}={}){if(this.options={location:s,threshold:n,distance:r,includeMatches:i,findAllMatches:c,minMatchCharLength:a,isCaseSensitive:u,ignoreDiacritics:l,ignoreLocation:h},e=u?e:e.toLowerCase(),e=l?le(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;const d=(g,y)=>{this.chunks.push({pattern:g,alphabet:yt(g),startIndex:y})},m=this.pattern.length;if(m>se){let g=0;const y=m%se,I=m-y;for(;g<I;)d(this.pattern.substr(g,se),g),g+=se;if(y){const k=m-se;d(this.pattern.substr(k),k)}}else d(this.pattern,0)}searchIn(e){const{isCaseSensitive:s,ignoreDiacritics:n,includeMatches:r}=this.options;if(e=s?e:e.toLowerCase(),e=n?le(e):e,this.pattern===e){let I={isMatch:!0,score:0};return r&&(I.indices=[[0,e.length-1]]),I}const{location:i,distance:c,threshold:a,findAllMatches:u,minMatchCharLength:l,ignoreLocation:h}=this.options;let d=[],m=0,g=!1;this.chunks.forEach(({pattern:I,alphabet:k,startIndex:S})=>{const{isMatch:L,score:O,indices:K}=At(e,I,k,{location:i+S,distance:c,threshold:a,findAllMatches:u,minMatchCharLength:l,includeMatches:r,ignoreLocation:h});L&&(g=!0),m+=O,L&&K&&(d=[...d,...K])});let y={isMatch:g,score:g?m/this.chunks.length:1};return g&&r&&(y.indices=d),y}}class q{constructor(e){this.pattern=e}static isMultiMatch(e){return Se(e,this.multiRegex)}static isSingleMatch(e){return Se(e,this.singleRegex)}search(){}}function Se(t,e){const s=t.match(e);return s?s[1]:null}class xt extends q{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){const s=e===this.pattern;return{isMatch:s,score:s?0:1,indices:[0,this.pattern.length-1]}}}class Et extends q{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){const n=e.indexOf(this.pattern)===-1;return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}}class Ct extends q{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){const s=e.startsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,this.pattern.length-1]}}}class wt extends q{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){const s=!e.startsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,e.length-1]}}}class Ft extends q{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){const s=e.endsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[e.length-this.pattern.length,e.length-1]}}}class Mt extends q{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){const s=!e.endsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,e.length-1]}}}class Oe extends q{constructor(e,{location:s=p.location,threshold:n=p.threshold,distance:r=p.distance,includeMatches:i=p.includeMatches,findAllMatches:c=p.findAllMatches,minMatchCharLength:a=p.minMatchCharLength,isCaseSensitive:u=p.isCaseSensitive,ignoreDiacritics:l=p.ignoreDiacritics,ignoreLocation:h=p.ignoreLocation}={}){super(e),this._bitapSearch=new ze(e,{location:s,threshold:n,distance:r,includeMatches:i,findAllMatches:c,minMatchCharLength:a,isCaseSensitive:u,ignoreDiacritics:l,ignoreLocation:h})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class Qe extends q{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let s=0,n;const r=[],i=this.pattern.length;for(;(n=e.indexOf(this.pattern,s))>-1;)s=n+i,r.push([n,s-1]);const c=!!r.length;return{isMatch:c,score:c?0:1,indices:r}}}const pe=[xt,Qe,Ct,wt,Mt,Ft,Et,Oe],ke=pe.length,Dt=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,Bt="|";function It(t,e={}){return t.split(Bt).map(s=>{let n=s.trim().split(Dt).filter(i=>i&&!!i.trim()),r=[];for(let i=0,c=n.length;i<c;i+=1){const a=n[i];let u=!1,l=-1;for(;!u&&++l<ke;){const h=pe[l];let d=h.isMultiMatch(a);d&&(r.push(new h(d,e)),u=!0)}if(!u)for(l=-1;++l<ke;){const h=pe[l];let d=h.isSingleMatch(a);if(d){r.push(new h(d,e));break}}}return r})}const vt=new Set([Oe.type,Qe.type]);class bt{constructor(e,{isCaseSensitive:s=p.isCaseSensitive,ignoreDiacritics:n=p.ignoreDiacritics,includeMatches:r=p.includeMatches,minMatchCharLength:i=p.minMatchCharLength,ignoreLocation:c=p.ignoreLocation,findAllMatches:a=p.findAllMatches,location:u=p.location,threshold:l=p.threshold,distance:h=p.distance}={}){this.query=null,this.options={isCaseSensitive:s,ignoreDiacritics:n,includeMatches:r,minMatchCharLength:i,findAllMatches:a,ignoreLocation:c,location:u,threshold:l,distance:h},e=s?e:e.toLowerCase(),e=n?le(e):e,this.pattern=e,this.query=It(this.pattern,this.options)}static condition(e,s){return s.useExtendedSearch}searchIn(e){const s=this.query;if(!s)return{isMatch:!1,score:1};const{includeMatches:n,isCaseSensitive:r,ignoreDiacritics:i}=this.options;e=r?e:e.toLowerCase(),e=i?le(e):e;let c=0,a=[],u=0;for(let l=0,h=s.length;l<h;l+=1){const d=s[l];a.length=0,c=0;for(let m=0,g=d.length;m<g;m+=1){const y=d[m],{isMatch:I,indices:k,score:S}=y.search(e);if(I){if(c+=1,u+=S,n){const L=y.constructor.type;vt.has(L)?a=[...a,...k]:a.push(k)}}else{u=0,c=0,a.length=0;break}}if(c){let m={isMatch:!0,score:u/c};return n&&(m.indices=a),m}}return{isMatch:!1,score:1}}}const ge=[];function St(...t){ge.push(...t)}function Ae(t,e){for(let s=0,n=ge.length;s<n;s+=1){let r=ge[s];if(r.condition(t,e))return new r(t,e)}return new ze(t,e)}const he={AND:"$and",OR:"$or"},ye={PATH:"$path",PATTERN:"$val"},xe=t=>!!(t[he.AND]||t[he.OR]),kt=t=>!!t[ye.PATH],jt=t=>!Z(t)&&$e(t)&&!xe(t),je=t=>({[he.AND]:Object.keys(t).map(e=>({[e]:t[e]}))});function We(t,e,{auto:s=!0}={}){const n=r=>{let i=Object.keys(r);const c=kt(r);if(!c&&i.length>1&&!xe(r))return n(je(r));if(jt(r)){const u=c?r[ye.PATH]:i[0],l=c?r[ye.PATTERN]:r[u];if(!J(l))throw new Error(nt(u));const h={keyId:me(u),pattern:l};return s&&(h.searcher=Ae(l,e)),h}let a={children:[],operator:i[0]};return i.forEach(u=>{const l=r[u];Z(l)&&l.forEach(h=>{a.children.push(n(h))})}),a};return xe(t)||(t=je(t)),n(t)}function Rt(t,{ignoreFieldNorm:e=p.ignoreFieldNorm}){t.forEach(s=>{let n=1;s.matches.forEach(({key:r,norm:i,score:c})=>{const a=r?r.weight:null;n*=Math.pow(c===0&&a?Number.EPSILON:c,(a||1)*(e?1:i))}),s.score=n})}function Nt(t,e){const s=t.matches;e.matches=[],P(s)&&s.forEach(n=>{if(!P(n.indices)||!n.indices.length)return;const{indices:r,value:i}=n;let c={indices:r,value:i};n.key&&(c.key=n.key.src),n.idx>-1&&(c.refIndex=n.idx),e.matches.push(c)})}function Lt(t,e){e.score=t.score}function _t(t,e,{includeMatches:s=p.includeMatches,includeScore:n=p.includeScore}={}){const r=[];return s&&r.push(Nt),n&&r.push(Lt),t.map(i=>{const{idx:c}=i,a={item:e[c],refIndex:c};return r.length&&r.forEach(u=>{u(i,a)}),a})}class Y{constructor(e,s={},n){this.options={...p,...s},this.options.useExtendedSearch,this._keyStore=new ot(this.options.keys),this.setCollection(e,n)}setCollection(e,s){if(this._docs=e,s&&!(s instanceof Ce))throw new Error(st);this._myIndex=s||Ke(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){P(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){const s=[];for(let n=0,r=this._docs.length;n<r;n+=1){const i=this._docs[n];e(i,n)&&(this.removeAt(n),n-=1,r-=1,s.push(i))}return s}removeAt(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}getIndex(){return this._myIndex}search(e,{limit:s=-1}={}){const{includeMatches:n,includeScore:r,shouldSort:i,sortFn:c,ignoreFieldNorm:a}=this.options;let u=J(e)?J(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return Rt(u,{ignoreFieldNorm:a}),i&&u.sort(c),_e(s)&&s>-1&&(u=u.slice(0,s)),_t(u,this._docs,{includeMatches:n,includeScore:r})}_searchStringList(e){const s=Ae(e,this.options),{records:n}=this._myIndex,r=[];return n.forEach(({v:i,i:c,n:a})=>{if(!P(i))return;const{isMatch:u,score:l,indices:h}=s.searchIn(i);u&&r.push({item:i,idx:c,matches:[{score:l,value:i,norm:a,indices:h}]})}),r}_searchLogical(e){const s=We(e,this.options),n=(a,u,l)=>{if(!a.children){const{keyId:d,searcher:m}=a,g=this._findMatches({key:this._keyStore.get(d),value:this._myIndex.getValueForItemAtKeyId(u,d),searcher:m});return g&&g.length?[{idx:l,item:u,matches:g}]:[]}const h=[];for(let d=0,m=a.children.length;d<m;d+=1){const g=a.children[d],y=n(g,u,l);if(y.length)h.push(...y);else if(a.operator===he.AND)return[]}return h},r=this._myIndex.records,i={},c=[];return r.forEach(({$:a,i:u})=>{if(P(a)){let l=n(s,a,u);l.length&&(i[u]||(i[u]={idx:u,item:a,matches:[]},c.push(i[u])),l.forEach(({matches:h})=>{i[u].matches.push(...h)}))}}),c}_searchObjectList(e){const s=Ae(e,this.options),{keys:n,records:r}=this._myIndex,i=[];return r.forEach(({$:c,i:a})=>{if(!P(c))return;let u=[];n.forEach((l,h)=>{u.push(...this._findMatches({key:l,value:c[h],searcher:s}))}),u.length&&i.push({idx:a,item:c,matches:u})}),i}_findMatches({key:e,value:s,searcher:n}){if(!P(s))return[];let r=[];if(Z(s))s.forEach(({v:i,i:c,n:a})=>{if(!P(i))return;const{isMatch:u,score:l,indices:h}=n.searchIn(i);u&&r.push({score:l,key:e,value:i,idx:c,norm:a,indices:h})});else{const{v:i,n:c}=s,{isMatch:a,score:u,indices:l}=n.searchIn(i);a&&r.push({score:u,key:e,value:i,norm:c,indices:l})}return r}}Y.version="7.1.0";Y.createIndex=Ke;Y.parseIndex=pt;Y.config=p;Y.parseQuery=We;St(bt);const Re={".ts":"file-code",".tsx":"atom",".js":"file-code",".jsx":"atom",".py":"file-code",".rs":"file-code",".go":"file-code",".md":"file-text",".json":"clipboard",".yaml":"gear",".yml":"gear",".css":"palette",".scss":"palette",".html":"globe",".sql":"database",".sh":"terminal",".env":"lock",".toml":"gear",".lock":"lock",default:"file-text"};function $t(t){switch(t){case"scout":return"class-scout";case"builder":return"class-builder";case"debugger":return"class-debugger";case"architect":return"class-architect";case"warrior":return"class-warrior";case"support":return"class-support";case"boss":return"class-boss";default:return"class-default"}}function Tt(t,e=16){var r;const s="."+(((r=t.split(".").pop())==null?void 0:r.toLowerCase())??""),n=Re[s]||Re.default;return f.jsx(H,{name:n,size:e})}function Pt(t,e=16){return f.jsx(H,{name:$t(t),size:e,weight:"fill"})}function Ve(t){const e=Math.floor(t/1e3),s=Math.floor(e/60),n=Math.floor(s/60),r=Math.floor(n/24);return r>0?`${r}d ${n%24}h ago`:n>0?`${n}h ${s%60}m ago`:s>0?`${s}m ago`:"just now"}function Jt(t){const s=Date.now()-t;return Ve(s)}function Ne(t){switch(t){case"agent":return"Agent";case"command":return"Command";case"area":return"Area";case"modified-file":return"Changed";case"building":return"Server";default:return t}}const Le=["command","agent","building","area","modified-file"];function Kt({isOpen:t,onClose:e,onOpenSpawnModal:s,onOpenCommanderView:n,onOpenToolbox:r,onOpenFileExplorer:i,onOpenPM2LogsModal:c,onOpenBossLogsModal:a,onOpenDatabasePanel:u,onOpenMonitoringModal:l}){const h=He(),d=Ye(),m=Je(),g=Xe(),y=A.useRef(e);y.current=e;const I=A.useRef(s);I.current=s;const k=A.useRef(n);k.current=n;const S=A.useRef(r);S.current=r;const L=A.useRef(i);L.current=i;const O=A.useRef(c);O.current=c;const K=A.useRef(a);K.current=a;const ne=A.useRef(u);ne.current=u;const G=A.useRef(l);G.current=l;const[E,C]=A.useState(""),[D,$]=A.useState(0);A.useEffect(()=>{t&&(C(""),$(0))},[t]);const T=te.getShortcuts(),Q=A.useMemo(()=>{if(!t)return[];const o=T.find(F=>F.id==="spawn-agent"),w=T.find(F=>F.id==="toggle-commander");return[{id:"cmd-spawn",type:"command",title:"Spawn New Agent",subtitle:o?Ie(o):"Alt+N",icon:f.jsx(H,{name:"plus",size:16}),action:()=>{y.current(),I.current()}},{id:"cmd-commander",type:"command",title:"Commander View",subtitle:w?Ie(w):"Ctrl+K",icon:f.jsx(H,{name:"dashboard",size:16}),action:()=>{y.current(),k.current()}},{id:"cmd-settings",type:"command",title:"Settings & Tools",subtitle:"Configure Tide Commander",icon:f.jsx(H,{name:"gear",size:16}),action:()=>{y.current(),S.current()}},{id:"cmd-monitoring",type:"command",title:"Monitoring & Logs",subtitle:"Triggers, workflows, events",icon:f.jsx(H,{name:"chart-line",size:16}),action:()=>{var F;y.current(),(F=G.current)==null||F.call(G)}}]},[t,T]),ce=A.useMemo(()=>t?Array.from(h.values()).map(o=>{const w=(g||[]).filter(_=>_.agentId===o.id).map(_=>_.filePath),F=[...new Set(w)],M=F.map(_=>_.split("/").pop()||_),b=[];o.lastAssignedTask&&b.push(o.lastAssignedTask);const R=`${o.class} • ${o.status} • ${o.cwd}`;let B=`${o.name} ${R}`;M.length>0&&(B+=` ${M.join(" ")} ${F.join(" ")}`),b.length>0&&(B+=` ${b.join(" ")}`);const z=Date.now()-o.lastActivity;let V;return o.lastAssignedTask&&(o.lastAssignedTask.length>150?V=o.lastAssignedTask.slice(0,150)+"...":V=o.lastAssignedTask),{id:`agent-${o.id}`,type:"agent",title:o.name,subtitle:R,lastUserInput:V,timeAway:z,icon:Pt(o.class),_searchText:B,_modifiedFiles:F,_userQueries:b,action:()=>{y.current(),te.selectAgent(o.id),te.requestTerminalExpand()}}}):[],[t,h,g]),j=A.useMemo(()=>t?Array.from(d.values()).map(o=>{var w;return{id:`area-${o.id}`,type:"area",title:o.name,subtitle:`${o.assignedAgentIds.length} agents • ${((w=o.directories)==null?void 0:w.length)||0} folders`,icon:f.jsx(H,{name:"map",size:16}),action:()=>{y.current(),te.selectArea(o.id)}}}):[],[t,d]),X=A.useMemo(()=>t?Array.from(m.values()).filter(o=>o.type==="server"||o.type==="boss"||o.type==="database").map(o=>{var B,z,V,_;const w=o.status==="running"?"#4ade80":o.status==="stopped"?"#f87171":"#facc15",F=o.type==="boss"?"crown":o.type==="database"?"database":"desktop";let b=`${o.type==="boss"?"Boss":o.type==="database"?"Database":"Server"} • ${o.status}`;if(o.type==="database"&&((z=(B=o.database)==null?void 0:B.connections)!=null&&z.length)){const x=o.database.connections[0];b+=` • ${x.engine} @ ${x.host}`}else o.cwd&&(b+=` • ${o.cwd}`);let R=`${o.name} ${o.type} ${o.status} ${o.cwd||""} ${((V=o.pm2)==null?void 0:V.name)||""}`;if(o.type==="database"&&((_=o.database)!=null&&_.connections))for(const x of o.database.connections)R+=` ${x.name} ${x.engine} ${x.host} ${x.database||""} mysql postgresql sql`;return{id:`building-${o.id}`,type:"building",title:o.name,subtitle:b,icon:f.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[f.jsx(H,{name:"status-pending",size:10,weight:"fill",color:w}),f.jsx(H,{name:F,size:16})]}),_searchText:R,action:()=>{var x;y.current(),o.type==="boss"?K.current(o.id):o.type==="database"?ne.current(o.id):(x=o.pm2)!=null&&x.enabled&&O.current(o.id)}}}):[],[t,m]),oe=A.useMemo(()=>{if(!t)return[];const o=g||[],w=new Set,F=[];for(const M of o){if(w.has(M.filePath))continue;w.add(M.filePath);const b=M.filePath.split("/").pop()||M.filePath,R=M.action==="created"?"Created":M.action==="modified"?"Modified":M.action==="deleted"?"Deleted":"Read";if(F.push({id:`modified-${M.filePath}-${M.timestamp}`,type:"modified-file",title:b,subtitle:`${R} by ${M.agentName} • ${M.filePath}`,matchedText:M.filePath,icon:M.action==="deleted"?f.jsx(H,{name:"trash",size:16}):Tt(M.filePath),action:()=>{y.current();const B=Array.from(te.getState().areas.values());for(const z of B)for(const V of z.directories||[])if(M.filePath.startsWith(V)){te.setFileViewerPath(M.filePath),L.current(z.id);return}te.selectAgent(M.agentId)}}),F.length>=50)break}return F},[t,g]),we=A.useMemo(()=>new Y(ce,{keys:["title","subtitle","_searchText","lastUserInput"],threshold:.4,ignoreLocation:!0,includeScore:!0,includeMatches:!0}),[ce]),Fe=A.useMemo(()=>new Y(Q,{keys:["title","subtitle"],threshold:.4,includeScore:!0,includeMatches:!0}),[Q]),Me=A.useMemo(()=>new Y(j,{keys:["title","subtitle"],threshold:.4,includeScore:!0,includeMatches:!0}),[j]),De=A.useMemo(()=>new Y(oe,{keys:["title","subtitle","matchedText"],threshold:.4,ignoreLocation:!0,includeScore:!0,includeMatches:!0}),[oe]),Be=A.useMemo(()=>new Y(X,{keys:["title","subtitle","_searchText"],threshold:.4,ignoreLocation:!0,includeScore:!0,includeMatches:!0}),[X]),W=A.useMemo(()=>{if(!E.trim()){const x=[];x.push(...X);const v=[...ce].sort((N,U)=>{const re=N.timeAway??0,ie=U.timeAway??0;return re-ie});x.push(...v),x.push(...Q.slice(0,2)),x.push(...j.slice(0,2));const ee={};return Le.forEach((N,U)=>{ee[N]=U}),x.sort((N,U)=>(ee[N.type]??999)-(ee[U.type]??999)),x}const o=E.toLowerCase(),w=we.search(E).slice(0,8),F=Fe.search(E).slice(0,3),M=Me.search(E).slice(0,2),b=De.search(E).slice(0,3),R=Be.search(E).filter(x=>{const v=x.score??1;return`${x.item.title} ${x.item.subtitle||""} ${x.item._searchText||""}`.toLowerCase().includes(o)||v<=.2}).slice(0,4),B=[],z=[],V=[];for(const x of w){const v={...x.item};if(v._modifiedFiles&&v._modifiedFiles.length>0){const N=v._modifiedFiles.filter(U=>{var ae;const re=((ae=U.split("/").pop())==null?void 0:ae.toLowerCase())||"",ie=U.toLowerCase();return re.includes(o)||ie.includes(o)});N.length>0&&(v.matchedFiles=N)}if(v._userQueries&&v._userQueries.length>0){const N=v._userQueries.find(U=>U.toLowerCase().includes(o));if(N)if(N.length>200){const re=N.toLowerCase().indexOf(o),ie=Math.max(0,re-60),ae=Math.min(N.length,re+o.length+100);v.matchedQuery=(ie>0?"...":"")+N.slice(ie,ae)+(ae<N.length?"...":"")}else v.matchedQuery=N}const ee=v.title.toLowerCase();ee===o||ee.startsWith(o)?z.push(v):V.push(v)}for(const x of z)B.push(x);for(const x of R)B.push(x.item);for(const x of V)B.push(x);for(const x of F)B.push(x.item);for(const x of M)B.push(x.item);for(const x of b)B.push(x.item);const _={};return Le.forEach((x,v)=>{_[x]=v}),B.sort((x,v)=>(_[x.type]??999)-(_[v.type]??999)),B},[E,we,Fe,Me,De,Be,Q,ce,j,X]);A.useEffect(()=>{D>=W.length&&$(Math.max(0,W.length-1))},[W.length,D]);const Ue=A.useCallback(o=>{if(o.altKey&&!o.ctrlKey&&!o.metaKey&&(o.key==="p"||o.key==="n"||o.key==="P"||o.key==="N")){o.preventDefault(),o.stopPropagation(),o.nativeEvent.stopImmediatePropagation();const w=o.key.toLowerCase();$(w==="p"?F=>F>0?F-1:W.length-1:F=>F<W.length-1?F+1:0);return}switch(o.key){case"Escape":o.preventDefault(),y.current();break;case"ArrowUp":o.preventDefault(),$(w=>w>0?w-1:W.length-1);break;case"ArrowDown":o.preventDefault(),$(w=>w<W.length-1?w+1:0);break;case"Enter":o.preventDefault(),W[D]&&W[D].action();break}},[W,D]),Ge=A.useCallback((o,w)=>{if(!w||!o)return o;const F=o.toLowerCase(),M=w.toLowerCase(),b=[];let R=0,B=F.indexOf(M),z=0;for(;B!==-1;)B>R&&b.push(o.slice(R,B)),b.push(de.createElement("mark",{key:z++,className:"spotlight-highlight"},o.slice(B,B+w.length))),R=B+w.length,B=F.indexOf(M,R);return R<o.length&&b.push(o.slice(R)),b.length>0?de.createElement(de.Fragment,null,...b):o},[]);return{query:E,setQuery:C,selectedIndex:D,setSelectedIndex:$,results:W,handleKeyDown:Ue,highlightMatch:Ge}}const zt=A.forwardRef(function({query:e,onQueryChange:s,onKeyDown:n,onResetSelection:r},i){const{t:c}=Ee(["common"]);return f.jsxs("div",{className:"spotlight-input-wrapper",children:[f.jsx("span",{className:"spotlight-search-icon",children:"⌘"}),f.jsx("input",{ref:i,type:"text",className:"spotlight-input",placeholder:c("common:search.spotlightPlaceholder"),value:e,onChange:a=>{s(a.target.value),r()},onKeyDown:n,autoFocus:!0,spellCheck:!1}),f.jsxs("div",{className:"spotlight-input-hints",children:[f.jsx("span",{className:"spotlight-shortcut-hint",children:"↑↓"}),f.jsx("span",{className:"spotlight-shortcut-hint",children:"Enter"}),f.jsx("span",{className:"spotlight-shortcut-hint",children:"Esc"})]})]})}),Ot=A.memo(function({result:e,isSelected:s,query:n,highlightMatch:r,onClick:i,onMouseEnter:c}){const a=e.activityText||e.matchedFiles&&e.matchedFiles.length>0||e.matchedQuery;return f.jsxs("div",{className:`spotlight-item ${s?"selected":""} ${e.activityText?"has-activity":""}`,onClick:i,onMouseEnter:c,role:"option","aria-selected":s,children:[f.jsx("span",{className:"spotlight-item-icon","aria-hidden":"true",children:e.icon}),f.jsxs("div",{className:"spotlight-item-content",children:[f.jsxs("div",{className:"spotlight-item-header",children:[f.jsx("span",{className:"spotlight-item-title",children:r(e.title,n)}),f.jsx("span",{className:`spotlight-item-type ${e.type}`,"aria-label":Ne(e.type),children:Ne(e.type)})]}),e.subtitle&&f.jsx("span",{className:"spotlight-item-subtitle",children:r(e.subtitle,n)}),e.activityText&&f.jsx("span",{className:"spotlight-item-activity",children:r(e.activityText,n)}),a&&f.jsxs("div",{className:"spotlight-item-details",children:[e.matchedFiles&&e.matchedFiles.length>0&&f.jsx("span",{className:"spotlight-item-files",children:e.matchedFiles.map((u,l)=>f.jsxs("span",{className:"file-badge",children:[l>0&&f.jsx("span",{className:"file-separator",children:"•"}),r(u.split("/").pop()||u,n)]},u))}),e.matchedQuery&&f.jsx("span",{className:"spotlight-item-query",children:r(e.matchedQuery,n)})]}),e.timeAway!==void 0&&f.jsx("span",{className:"spotlight-item-time",children:f.jsxs("span",{className:"spotlight-time-away",children:["Idle: ",Ve(e.timeAway)]})}),e.lastUserInput&&!e.matchedQuery&&f.jsxs("span",{className:"spotlight-item-last-input",children:['"',r(e.lastUserInput,n),'"']})]})]})}),Qt=A.forwardRef(function({results:e,selectedIndex:s,query:n,highlightMatch:r,onSelectIndex:i},c){const{t:a}=Ee(["terminal"]),u=A.useRef(!1);A.useEffect(()=>{u.current=!1},[e]),A.useEffect(()=>{const d=typeof c=="function"?null:c==null?void 0:c.current;if(!d)return;const m=()=>{u.current=!0};return d.addEventListener("mousemove",m),()=>{d.removeEventListener("mousemove",m)}},[c,e]);const l={command:a("terminal:spotlight.categories.commands"),agent:a("terminal:spotlight.categories.agents"),building:a("terminal:spotlight.categories.infrastructure"),area:a("terminal:spotlight.categories.areas"),"modified-file":a("terminal:spotlight.categories.modifiedFiles")},h=A.useMemo(()=>{const d=[];let m=null,g=[];return e.forEach((y,I)=>{y.type!==m&&(m!==null&&g.length>0&&d.push([m,g]),m=y.type,g=[]),g.push({result:y,index:I})}),m!==null&&g.length>0&&d.push([m,g]),d},[e]);return A.useEffect(()=>{if(!c||typeof c=="function")return;const d=c.current;if(!d)return;const m=d.querySelector(".spotlight-item.selected");m&&m.scrollIntoView({block:"nearest",behavior:"smooth"})},[s,c]),e.length===0?f.jsx("div",{className:"spotlight-results",ref:c,children:f.jsx("div",{className:"spotlight-empty",children:a("terminal:spotlight.noResults")})}):f.jsx("div",{className:"spotlight-results",ref:c,children:h.map(([d,m])=>f.jsxs("div",{children:[h.length>1&&f.jsx("div",{className:"spotlight-category-header",children:l[d]||d}),m.map(({result:g,index:y})=>f.jsx(Ot,{result:g,isSelected:y===s,query:n,highlightMatch:r,onClick:()=>g.action(),onMouseEnter:()=>{u.current&&i(y)}},g.id))]},d))})}),Wt=A.memo(function(){const{t:e}=Ee(["terminal"]);return f.jsxs("div",{className:"spotlight-footer",children:[f.jsxs("div",{className:"spotlight-footer-left",children:[f.jsxs("span",{className:"spotlight-footer-hint",children:[f.jsx("kbd",{children:"↑"}),f.jsx("kbd",{children:"↓"})," ",f.jsx("kbd",{children:"Alt+N"}),f.jsx("kbd",{children:"Alt+P"})," ",e("terminal:spotlight.navigate")]}),f.jsxs("span",{className:"spotlight-footer-hint",children:[f.jsx("kbd",{children:"Enter"})," ",e("terminal:spotlight.select")]})]}),f.jsx("div",{className:"spotlight-footer-right",children:f.jsxs("span",{className:"spotlight-footer-hint",children:[f.jsx("kbd",{children:"Esc"})," ",e("common:buttons.close")]})})]})}),Vt=768;function Xt({isOpen:t,onClose:e,onOpenSpawnModal:s,onOpenCommanderView:n,onOpenToolbox:r,onOpenFileExplorer:i,onOpenPM2LogsModal:c,onOpenBossLogsModal:a,onOpenDatabasePanel:u,onOpenMonitoringModal:l}){const h=A.useRef(null),d=A.useRef(null),m=A.useRef(null),g=A.useRef(0),{query:y,setQuery:I,selectedIndex:k,setSelectedIndex:S,results:L,handleKeyDown:O,highlightMatch:K}=Kt({isOpen:t,onClose:e,onOpenSpawnModal:s,onOpenCommanderView:n,onOpenToolbox:r,onOpenFileExplorer:i,onOpenPM2LogsModal:c,onOpenBossLogsModal:a,onOpenDatabasePanel:u,onOpenMonitoringModal:l});g.current=L.length,A.useEffect(()=>{t&&setTimeout(()=>{var E;(E=h.current)==null||E.focus()},50)},[t]),A.useEffect(()=>{if(!t)return;const E=window.visualViewport;if(!E||window.innerWidth>Vt)return;const C=()=>{const D=d.current;D&&(D.style.height=`${E.height}px`,D.style.top=`${E.offsetTop}px`)};return C(),E.addEventListener("resize",C),E.addEventListener("scroll",C),()=>{E.removeEventListener("resize",C),E.removeEventListener("scroll",C);const D=d.current;D&&(D.style.height="",D.style.top="")}},[t]),A.useEffect(()=>{if(!t)return;const E=C=>{if(C.key==="Escape"){C.preventDefault(),C.stopPropagation(),C.stopImmediatePropagation(),e();return}if(C.altKey&&!C.ctrlKey&&!C.metaKey&&(C.key==="n"||C.key==="p"||C.key==="N"||C.key==="P")){C.preventDefault(),C.stopPropagation(),C.stopImmediatePropagation();const D=C.key.toLowerCase(),$=g.current;S(D==="p"?T=>T>0?T-1:$-1:T=>T<$-1?T+1:0);return}};return window.addEventListener("keydown",E,{capture:!0}),()=>{window.removeEventListener("keydown",E,{capture:!0})}},[t,e]);const ne=A.useCallback(E=>{E.target===E.currentTarget&&e()},[e]),G=A.useCallback(()=>{S(0)},[S]);return t?f.jsx("div",{ref:d,className:"spotlight-overlay",onClick:ne,children:f.jsxs("div",{className:"spotlight-modal",children:[f.jsx(zt,{ref:h,query:y,onQueryChange:I,onKeyDown:O,onResetSelection:G}),f.jsx(Qt,{ref:m,results:L,selectedIndex:k,query:y,highlightMatch:K,onSelectIndex:S}),f.jsx(Wt,{})]})}):null}export{Re as FILE_ICON_NAMES,Xt as Spotlight,Wt as SpotlightFooter,zt as SpotlightInput,Ot as SpotlightItem,Qt as SpotlightResults,Ve as formatDuration,Jt as formatRelativeTime,Pt as getAgentIcon,Tt as getFileIconFromPath,Ne as getTypeLabel,Kt as useSpotlightSearch};
|
|
1
|
+
import{j as f,I as H,N as He,P as Ye,O as Je,bg as Xe,r as A,s as te,bh as Ie,z as de,u as Ee}from"./main-muli6bmQ.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";function Z(t){return Array.isArray?Array.isArray(t):Te(t)==="[object Array]"}function Ze(t){if(typeof t=="string")return t;let e=t+"";return e=="0"&&1/t==-1/0?"-0":e}function qe(t){return t==null?"":Ze(t)}function J(t){return typeof t=="string"}function _e(t){return typeof t=="number"}function et(t){return t===!0||t===!1||tt(t)&&Te(t)=="[object Boolean]"}function $e(t){return typeof t=="object"}function tt(t){return $e(t)&&t!==null}function P(t){return t!=null}function fe(t){return!t.trim().length}function Te(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const st="Incorrect 'index' type",nt=t=>`Invalid value for key ${t}`,rt=t=>`Pattern length exceeds max of ${t}.`,it=t=>`Missing ${t} property in key`,ct=t=>`Property 'weight' in key '${t}' must be a positive integer`,ve=Object.prototype.hasOwnProperty;class ot{constructor(e){this._keys=[],this._keyMap={};let s=0;e.forEach(n=>{let r=Pe(n);this._keys.push(r),this._keyMap[r.id]=r,s+=r.weight}),this._keys.forEach(n=>{n.weight/=s})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function Pe(t){let e=null,s=null,n=null,r=1,i=null;if(J(t)||Z(t))n=t,e=be(t),s=me(t);else{if(!ve.call(t,"name"))throw new Error(it("name"));const c=t.name;if(n=c,ve.call(t,"weight")&&(r=t.weight,r<=0))throw new Error(ct(c));e=be(c),s=me(c),i=t.getFn}return{path:e,id:s,weight:r,src:n,getFn:i}}function be(t){return Z(t)?t:t.split(".")}function me(t){return Z(t)?t.join("."):t}function at(t,e){let s=[],n=!1;const r=(i,c,a)=>{if(P(i))if(!c[a])s.push(i);else{let u=c[a];const l=i[u];if(!P(l))return;if(a===c.length-1&&(J(l)||_e(l)||et(l)))s.push(qe(l));else if(Z(l)){n=!0;for(let h=0,d=l.length;h<d;h+=1)r(l[h],c,a+1)}else c.length&&r(l,c,a+1)}};return r(t,J(e)?e.split("."):e,0),n?s:s[0]}const ut={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},lt={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(t,e)=>t.score===e.score?t.idx<e.idx?-1:1:t.score<e.score?-1:1},ht={location:0,threshold:.6,distance:100},dt={useExtendedSearch:!1,getFn:at,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var p={...lt,...ut,...ht,...dt};const ft=/[^ ]+/g;function mt(t=1,e=3){const s=new Map,n=Math.pow(10,e);return{get(r){const i=r.match(ft).length;if(s.has(i))return s.get(i);const c=1/Math.pow(i,.5*t),a=parseFloat(Math.round(c*n)/n);return s.set(i,a),a},clear(){s.clear()}}}class Ce{constructor({getFn:e=p.getFn,fieldNormWeight:s=p.fieldNormWeight}={}){this.norm=mt(s,3),this.getFn=e,this.isCreated=!1,this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((s,n)=>{this._keysMap[s.id]=n})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,J(this.docs[0])?this.docs.forEach((e,s)=>{this._addString(e,s)}):this.docs.forEach((e,s)=>{this._addObject(e,s)}),this.norm.clear())}add(e){const s=this.size();J(e)?this._addString(e,s):this._addObject(e,s)}removeAt(e){this.records.splice(e,1);for(let s=e,n=this.size();s<n;s+=1)this.records[s].i-=1}getValueForItemAtKeyId(e,s){return e[this._keysMap[s]]}size(){return this.records.length}_addString(e,s){if(!P(e)||fe(e))return;let n={v:e,i:s,n:this.norm.get(e)};this.records.push(n)}_addObject(e,s){let n={i:s,$:{}};this.keys.forEach((r,i)=>{let c=r.getFn?r.getFn(e):this.getFn(e,r.path);if(P(c)){if(Z(c)){let a=[];const u=[{nestedArrIndex:-1,value:c}];for(;u.length;){const{nestedArrIndex:l,value:h}=u.pop();if(P(h))if(J(h)&&!fe(h)){let d={v:h,i:l,n:this.norm.get(h)};a.push(d)}else Z(h)&&h.forEach((d,m)=>{u.push({nestedArrIndex:m,value:d})})}n.$[i]=a}else if(J(c)&&!fe(c)){let a={v:c,n:this.norm.get(c)};n.$[i]=a}}}),this.records.push(n)}toJSON(){return{keys:this.keys,records:this.records}}}function Ke(t,e,{getFn:s=p.getFn,fieldNormWeight:n=p.fieldNormWeight}={}){const r=new Ce({getFn:s,fieldNormWeight:n});return r.setKeys(t.map(Pe)),r.setSources(e),r.create(),r}function pt(t,{getFn:e=p.getFn,fieldNormWeight:s=p.fieldNormWeight}={}){const{keys:n,records:r}=t,i=new Ce({getFn:e,fieldNormWeight:s});return i.setKeys(n),i.setIndexRecords(r),i}function ue(t,{errors:e=0,currentLocation:s=0,expectedLocation:n=0,distance:r=p.distance,ignoreLocation:i=p.ignoreLocation}={}){const c=e/t.length;if(i)return c;const a=Math.abs(n-s);return r?c+a/r:a?1:c}function gt(t=[],e=p.minMatchCharLength){let s=[],n=-1,r=-1,i=0;for(let c=t.length;i<c;i+=1){let a=t[i];a&&n===-1?n=i:!a&&n!==-1&&(r=i-1,r-n+1>=e&&s.push([n,r]),n=-1)}return t[i-1]&&i-n>=e&&s.push([n,i-1]),s}const se=32;function At(t,e,s,{location:n=p.location,distance:r=p.distance,threshold:i=p.threshold,findAllMatches:c=p.findAllMatches,minMatchCharLength:a=p.minMatchCharLength,includeMatches:u=p.includeMatches,ignoreLocation:l=p.ignoreLocation}={}){if(e.length>se)throw new Error(rt(se));const h=e.length,d=t.length,m=Math.max(0,Math.min(n,d));let g=i,y=m;const I=a>1||u,k=I?Array(d):[];let S;for(;(S=t.indexOf(e,y))>-1;){let E=ue(e,{currentLocation:S,expectedLocation:m,distance:r,ignoreLocation:l});if(g=Math.min(E,g),y=S+h,I){let C=0;for(;C<h;)k[S+C]=1,C+=1}}y=-1;let L=[],O=1,K=h+d;const ne=1<<h-1;for(let E=0;E<h;E+=1){let C=0,D=K;for(;C<D;)ue(e,{errors:E,currentLocation:m+D,expectedLocation:m,distance:r,ignoreLocation:l})<=g?C=D:K=D,D=Math.floor((K-C)/2+C);K=D;let $=Math.max(1,m-D+1),T=c?d:Math.min(m+D,d)+h,Q=Array(T+2);Q[T+1]=(1<<E)-1;for(let j=T;j>=$;j-=1){let X=j-1,oe=s[t.charAt(X)];if(I&&(k[X]=+!!oe),Q[j]=(Q[j+1]<<1|1)&oe,E&&(Q[j]|=(L[j+1]|L[j])<<1|1|L[j+1]),Q[j]&ne&&(O=ue(e,{errors:E,currentLocation:X,expectedLocation:m,distance:r,ignoreLocation:l}),O<=g)){if(g=O,y=X,y<=m)break;$=Math.max(1,2*m-y)}}if(ue(e,{errors:E+1,currentLocation:m,expectedLocation:m,distance:r,ignoreLocation:l})>g)break;L=Q}const G={isMatch:y>=0,score:Math.max(.001,O)};if(I){const E=gt(k,a);E.length?u&&(G.indices=E):G.isMatch=!1}return G}function yt(t){let e={};for(let s=0,n=t.length;s<n;s+=1){const r=t.charAt(s);e[r]=(e[r]||0)|1<<n-s-1}return e}const le=String.prototype.normalize?(t=>t.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,"")):(t=>t);class ze{constructor(e,{location:s=p.location,threshold:n=p.threshold,distance:r=p.distance,includeMatches:i=p.includeMatches,findAllMatches:c=p.findAllMatches,minMatchCharLength:a=p.minMatchCharLength,isCaseSensitive:u=p.isCaseSensitive,ignoreDiacritics:l=p.ignoreDiacritics,ignoreLocation:h=p.ignoreLocation}={}){if(this.options={location:s,threshold:n,distance:r,includeMatches:i,findAllMatches:c,minMatchCharLength:a,isCaseSensitive:u,ignoreDiacritics:l,ignoreLocation:h},e=u?e:e.toLowerCase(),e=l?le(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;const d=(g,y)=>{this.chunks.push({pattern:g,alphabet:yt(g),startIndex:y})},m=this.pattern.length;if(m>se){let g=0;const y=m%se,I=m-y;for(;g<I;)d(this.pattern.substr(g,se),g),g+=se;if(y){const k=m-se;d(this.pattern.substr(k),k)}}else d(this.pattern,0)}searchIn(e){const{isCaseSensitive:s,ignoreDiacritics:n,includeMatches:r}=this.options;if(e=s?e:e.toLowerCase(),e=n?le(e):e,this.pattern===e){let I={isMatch:!0,score:0};return r&&(I.indices=[[0,e.length-1]]),I}const{location:i,distance:c,threshold:a,findAllMatches:u,minMatchCharLength:l,ignoreLocation:h}=this.options;let d=[],m=0,g=!1;this.chunks.forEach(({pattern:I,alphabet:k,startIndex:S})=>{const{isMatch:L,score:O,indices:K}=At(e,I,k,{location:i+S,distance:c,threshold:a,findAllMatches:u,minMatchCharLength:l,includeMatches:r,ignoreLocation:h});L&&(g=!0),m+=O,L&&K&&(d=[...d,...K])});let y={isMatch:g,score:g?m/this.chunks.length:1};return g&&r&&(y.indices=d),y}}class q{constructor(e){this.pattern=e}static isMultiMatch(e){return Se(e,this.multiRegex)}static isSingleMatch(e){return Se(e,this.singleRegex)}search(){}}function Se(t,e){const s=t.match(e);return s?s[1]:null}class xt extends q{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){const s=e===this.pattern;return{isMatch:s,score:s?0:1,indices:[0,this.pattern.length-1]}}}class Et extends q{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){const n=e.indexOf(this.pattern)===-1;return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}}class Ct extends q{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){const s=e.startsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,this.pattern.length-1]}}}class wt extends q{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){const s=!e.startsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,e.length-1]}}}class Ft extends q{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){const s=e.endsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[e.length-this.pattern.length,e.length-1]}}}class Mt extends q{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){const s=!e.endsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,e.length-1]}}}class Oe extends q{constructor(e,{location:s=p.location,threshold:n=p.threshold,distance:r=p.distance,includeMatches:i=p.includeMatches,findAllMatches:c=p.findAllMatches,minMatchCharLength:a=p.minMatchCharLength,isCaseSensitive:u=p.isCaseSensitive,ignoreDiacritics:l=p.ignoreDiacritics,ignoreLocation:h=p.ignoreLocation}={}){super(e),this._bitapSearch=new ze(e,{location:s,threshold:n,distance:r,includeMatches:i,findAllMatches:c,minMatchCharLength:a,isCaseSensitive:u,ignoreDiacritics:l,ignoreLocation:h})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class Qe extends q{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let s=0,n;const r=[],i=this.pattern.length;for(;(n=e.indexOf(this.pattern,s))>-1;)s=n+i,r.push([n,s-1]);const c=!!r.length;return{isMatch:c,score:c?0:1,indices:r}}}const pe=[xt,Qe,Ct,wt,Mt,Ft,Et,Oe],ke=pe.length,Dt=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,Bt="|";function It(t,e={}){return t.split(Bt).map(s=>{let n=s.trim().split(Dt).filter(i=>i&&!!i.trim()),r=[];for(let i=0,c=n.length;i<c;i+=1){const a=n[i];let u=!1,l=-1;for(;!u&&++l<ke;){const h=pe[l];let d=h.isMultiMatch(a);d&&(r.push(new h(d,e)),u=!0)}if(!u)for(l=-1;++l<ke;){const h=pe[l];let d=h.isSingleMatch(a);if(d){r.push(new h(d,e));break}}}return r})}const vt=new Set([Oe.type,Qe.type]);class bt{constructor(e,{isCaseSensitive:s=p.isCaseSensitive,ignoreDiacritics:n=p.ignoreDiacritics,includeMatches:r=p.includeMatches,minMatchCharLength:i=p.minMatchCharLength,ignoreLocation:c=p.ignoreLocation,findAllMatches:a=p.findAllMatches,location:u=p.location,threshold:l=p.threshold,distance:h=p.distance}={}){this.query=null,this.options={isCaseSensitive:s,ignoreDiacritics:n,includeMatches:r,minMatchCharLength:i,findAllMatches:a,ignoreLocation:c,location:u,threshold:l,distance:h},e=s?e:e.toLowerCase(),e=n?le(e):e,this.pattern=e,this.query=It(this.pattern,this.options)}static condition(e,s){return s.useExtendedSearch}searchIn(e){const s=this.query;if(!s)return{isMatch:!1,score:1};const{includeMatches:n,isCaseSensitive:r,ignoreDiacritics:i}=this.options;e=r?e:e.toLowerCase(),e=i?le(e):e;let c=0,a=[],u=0;for(let l=0,h=s.length;l<h;l+=1){const d=s[l];a.length=0,c=0;for(let m=0,g=d.length;m<g;m+=1){const y=d[m],{isMatch:I,indices:k,score:S}=y.search(e);if(I){if(c+=1,u+=S,n){const L=y.constructor.type;vt.has(L)?a=[...a,...k]:a.push(k)}}else{u=0,c=0,a.length=0;break}}if(c){let m={isMatch:!0,score:u/c};return n&&(m.indices=a),m}}return{isMatch:!1,score:1}}}const ge=[];function St(...t){ge.push(...t)}function Ae(t,e){for(let s=0,n=ge.length;s<n;s+=1){let r=ge[s];if(r.condition(t,e))return new r(t,e)}return new ze(t,e)}const he={AND:"$and",OR:"$or"},ye={PATH:"$path",PATTERN:"$val"},xe=t=>!!(t[he.AND]||t[he.OR]),kt=t=>!!t[ye.PATH],jt=t=>!Z(t)&&$e(t)&&!xe(t),je=t=>({[he.AND]:Object.keys(t).map(e=>({[e]:t[e]}))});function We(t,e,{auto:s=!0}={}){const n=r=>{let i=Object.keys(r);const c=kt(r);if(!c&&i.length>1&&!xe(r))return n(je(r));if(jt(r)){const u=c?r[ye.PATH]:i[0],l=c?r[ye.PATTERN]:r[u];if(!J(l))throw new Error(nt(u));const h={keyId:me(u),pattern:l};return s&&(h.searcher=Ae(l,e)),h}let a={children:[],operator:i[0]};return i.forEach(u=>{const l=r[u];Z(l)&&l.forEach(h=>{a.children.push(n(h))})}),a};return xe(t)||(t=je(t)),n(t)}function Rt(t,{ignoreFieldNorm:e=p.ignoreFieldNorm}){t.forEach(s=>{let n=1;s.matches.forEach(({key:r,norm:i,score:c})=>{const a=r?r.weight:null;n*=Math.pow(c===0&&a?Number.EPSILON:c,(a||1)*(e?1:i))}),s.score=n})}function Nt(t,e){const s=t.matches;e.matches=[],P(s)&&s.forEach(n=>{if(!P(n.indices)||!n.indices.length)return;const{indices:r,value:i}=n;let c={indices:r,value:i};n.key&&(c.key=n.key.src),n.idx>-1&&(c.refIndex=n.idx),e.matches.push(c)})}function Lt(t,e){e.score=t.score}function _t(t,e,{includeMatches:s=p.includeMatches,includeScore:n=p.includeScore}={}){const r=[];return s&&r.push(Nt),n&&r.push(Lt),t.map(i=>{const{idx:c}=i,a={item:e[c],refIndex:c};return r.length&&r.forEach(u=>{u(i,a)}),a})}class Y{constructor(e,s={},n){this.options={...p,...s},this.options.useExtendedSearch,this._keyStore=new ot(this.options.keys),this.setCollection(e,n)}setCollection(e,s){if(this._docs=e,s&&!(s instanceof Ce))throw new Error(st);this._myIndex=s||Ke(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){P(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){const s=[];for(let n=0,r=this._docs.length;n<r;n+=1){const i=this._docs[n];e(i,n)&&(this.removeAt(n),n-=1,r-=1,s.push(i))}return s}removeAt(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}getIndex(){return this._myIndex}search(e,{limit:s=-1}={}){const{includeMatches:n,includeScore:r,shouldSort:i,sortFn:c,ignoreFieldNorm:a}=this.options;let u=J(e)?J(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return Rt(u,{ignoreFieldNorm:a}),i&&u.sort(c),_e(s)&&s>-1&&(u=u.slice(0,s)),_t(u,this._docs,{includeMatches:n,includeScore:r})}_searchStringList(e){const s=Ae(e,this.options),{records:n}=this._myIndex,r=[];return n.forEach(({v:i,i:c,n:a})=>{if(!P(i))return;const{isMatch:u,score:l,indices:h}=s.searchIn(i);u&&r.push({item:i,idx:c,matches:[{score:l,value:i,norm:a,indices:h}]})}),r}_searchLogical(e){const s=We(e,this.options),n=(a,u,l)=>{if(!a.children){const{keyId:d,searcher:m}=a,g=this._findMatches({key:this._keyStore.get(d),value:this._myIndex.getValueForItemAtKeyId(u,d),searcher:m});return g&&g.length?[{idx:l,item:u,matches:g}]:[]}const h=[];for(let d=0,m=a.children.length;d<m;d+=1){const g=a.children[d],y=n(g,u,l);if(y.length)h.push(...y);else if(a.operator===he.AND)return[]}return h},r=this._myIndex.records,i={},c=[];return r.forEach(({$:a,i:u})=>{if(P(a)){let l=n(s,a,u);l.length&&(i[u]||(i[u]={idx:u,item:a,matches:[]},c.push(i[u])),l.forEach(({matches:h})=>{i[u].matches.push(...h)}))}}),c}_searchObjectList(e){const s=Ae(e,this.options),{keys:n,records:r}=this._myIndex,i=[];return r.forEach(({$:c,i:a})=>{if(!P(c))return;let u=[];n.forEach((l,h)=>{u.push(...this._findMatches({key:l,value:c[h],searcher:s}))}),u.length&&i.push({idx:a,item:c,matches:u})}),i}_findMatches({key:e,value:s,searcher:n}){if(!P(s))return[];let r=[];if(Z(s))s.forEach(({v:i,i:c,n:a})=>{if(!P(i))return;const{isMatch:u,score:l,indices:h}=n.searchIn(i);u&&r.push({score:l,key:e,value:i,idx:c,norm:a,indices:h})});else{const{v:i,n:c}=s,{isMatch:a,score:u,indices:l}=n.searchIn(i);a&&r.push({score:u,key:e,value:i,norm:c,indices:l})}return r}}Y.version="7.1.0";Y.createIndex=Ke;Y.parseIndex=pt;Y.config=p;Y.parseQuery=We;St(bt);const Re={".ts":"file-code",".tsx":"atom",".js":"file-code",".jsx":"atom",".py":"file-code",".rs":"file-code",".go":"file-code",".md":"file-text",".json":"clipboard",".yaml":"gear",".yml":"gear",".css":"palette",".scss":"palette",".html":"globe",".sql":"database",".sh":"terminal",".env":"lock",".toml":"gear",".lock":"lock",default:"file-text"};function $t(t){switch(t){case"scout":return"class-scout";case"builder":return"class-builder";case"debugger":return"class-debugger";case"architect":return"class-architect";case"warrior":return"class-warrior";case"support":return"class-support";case"boss":return"class-boss";default:return"class-default"}}function Tt(t,e=16){var r;const s="."+(((r=t.split(".").pop())==null?void 0:r.toLowerCase())??""),n=Re[s]||Re.default;return f.jsx(H,{name:n,size:e})}function Pt(t,e=16){return f.jsx(H,{name:$t(t),size:e,weight:"fill"})}function Ve(t){const e=Math.floor(t/1e3),s=Math.floor(e/60),n=Math.floor(s/60),r=Math.floor(n/24);return r>0?`${r}d ${n%24}h ago`:n>0?`${n}h ${s%60}m ago`:s>0?`${s}m ago`:"just now"}function Jt(t){const s=Date.now()-t;return Ve(s)}function Ne(t){switch(t){case"agent":return"Agent";case"command":return"Command";case"area":return"Area";case"modified-file":return"Changed";case"building":return"Server";default:return t}}const Le=["command","agent","building","area","modified-file"];function Kt({isOpen:t,onClose:e,onOpenSpawnModal:s,onOpenCommanderView:n,onOpenToolbox:r,onOpenFileExplorer:i,onOpenPM2LogsModal:c,onOpenBossLogsModal:a,onOpenDatabasePanel:u,onOpenMonitoringModal:l}){const h=He(),d=Ye(),m=Je(),g=Xe(),y=A.useRef(e);y.current=e;const I=A.useRef(s);I.current=s;const k=A.useRef(n);k.current=n;const S=A.useRef(r);S.current=r;const L=A.useRef(i);L.current=i;const O=A.useRef(c);O.current=c;const K=A.useRef(a);K.current=a;const ne=A.useRef(u);ne.current=u;const G=A.useRef(l);G.current=l;const[E,C]=A.useState(""),[D,$]=A.useState(0);A.useEffect(()=>{t&&(C(""),$(0))},[t]);const T=te.getShortcuts(),Q=A.useMemo(()=>{if(!t)return[];const o=T.find(F=>F.id==="spawn-agent"),w=T.find(F=>F.id==="toggle-commander");return[{id:"cmd-spawn",type:"command",title:"Spawn New Agent",subtitle:o?Ie(o):"Alt+N",icon:f.jsx(H,{name:"plus",size:16}),action:()=>{y.current(),I.current()}},{id:"cmd-commander",type:"command",title:"Commander View",subtitle:w?Ie(w):"Ctrl+K",icon:f.jsx(H,{name:"dashboard",size:16}),action:()=>{y.current(),k.current()}},{id:"cmd-settings",type:"command",title:"Settings & Tools",subtitle:"Configure Tide Commander",icon:f.jsx(H,{name:"gear",size:16}),action:()=>{y.current(),S.current()}},{id:"cmd-monitoring",type:"command",title:"Monitoring & Logs",subtitle:"Triggers, workflows, events",icon:f.jsx(H,{name:"chart-line",size:16}),action:()=>{var F;y.current(),(F=G.current)==null||F.call(G)}}]},[t,T]),ce=A.useMemo(()=>t?Array.from(h.values()).map(o=>{const w=(g||[]).filter(_=>_.agentId===o.id).map(_=>_.filePath),F=[...new Set(w)],M=F.map(_=>_.split("/").pop()||_),b=[];o.lastAssignedTask&&b.push(o.lastAssignedTask);const R=`${o.class} • ${o.status} • ${o.cwd}`;let B=`${o.name} ${R}`;M.length>0&&(B+=` ${M.join(" ")} ${F.join(" ")}`),b.length>0&&(B+=` ${b.join(" ")}`);const z=Date.now()-o.lastActivity;let V;return o.lastAssignedTask&&(o.lastAssignedTask.length>150?V=o.lastAssignedTask.slice(0,150)+"...":V=o.lastAssignedTask),{id:`agent-${o.id}`,type:"agent",title:o.name,subtitle:R,lastUserInput:V,timeAway:z,icon:Pt(o.class),_searchText:B,_modifiedFiles:F,_userQueries:b,action:()=>{y.current(),te.selectAgent(o.id),te.requestTerminalExpand()}}}):[],[t,h,g]),j=A.useMemo(()=>t?Array.from(d.values()).map(o=>{var w;return{id:`area-${o.id}`,type:"area",title:o.name,subtitle:`${o.assignedAgentIds.length} agents • ${((w=o.directories)==null?void 0:w.length)||0} folders`,icon:f.jsx(H,{name:"map",size:16}),action:()=>{y.current(),te.selectArea(o.id)}}}):[],[t,d]),X=A.useMemo(()=>t?Array.from(m.values()).filter(o=>o.type==="server"||o.type==="boss"||o.type==="database").map(o=>{var B,z,V,_;const w=o.status==="running"?"#4ade80":o.status==="stopped"?"#f87171":"#facc15",F=o.type==="boss"?"crown":o.type==="database"?"database":"desktop";let b=`${o.type==="boss"?"Boss":o.type==="database"?"Database":"Server"} • ${o.status}`;if(o.type==="database"&&((z=(B=o.database)==null?void 0:B.connections)!=null&&z.length)){const x=o.database.connections[0];b+=` • ${x.engine} @ ${x.host}`}else o.cwd&&(b+=` • ${o.cwd}`);let R=`${o.name} ${o.type} ${o.status} ${o.cwd||""} ${((V=o.pm2)==null?void 0:V.name)||""}`;if(o.type==="database"&&((_=o.database)!=null&&_.connections))for(const x of o.database.connections)R+=` ${x.name} ${x.engine} ${x.host} ${x.database||""} mysql postgresql sql`;return{id:`building-${o.id}`,type:"building",title:o.name,subtitle:b,icon:f.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[f.jsx(H,{name:"status-pending",size:10,weight:"fill",color:w}),f.jsx(H,{name:F,size:16})]}),_searchText:R,action:()=>{var x;y.current(),o.type==="boss"?K.current(o.id):o.type==="database"?ne.current(o.id):(x=o.pm2)!=null&&x.enabled&&O.current(o.id)}}}):[],[t,m]),oe=A.useMemo(()=>{if(!t)return[];const o=g||[],w=new Set,F=[];for(const M of o){if(w.has(M.filePath))continue;w.add(M.filePath);const b=M.filePath.split("/").pop()||M.filePath,R=M.action==="created"?"Created":M.action==="modified"?"Modified":M.action==="deleted"?"Deleted":"Read";if(F.push({id:`modified-${M.filePath}-${M.timestamp}`,type:"modified-file",title:b,subtitle:`${R} by ${M.agentName} • ${M.filePath}`,matchedText:M.filePath,icon:M.action==="deleted"?f.jsx(H,{name:"trash",size:16}):Tt(M.filePath),action:()=>{y.current();const B=Array.from(te.getState().areas.values());for(const z of B)for(const V of z.directories||[])if(M.filePath.startsWith(V)){te.setFileViewerPath(M.filePath),L.current(z.id);return}te.selectAgent(M.agentId)}}),F.length>=50)break}return F},[t,g]),we=A.useMemo(()=>new Y(ce,{keys:["title","subtitle","_searchText","lastUserInput"],threshold:.4,ignoreLocation:!0,includeScore:!0,includeMatches:!0}),[ce]),Fe=A.useMemo(()=>new Y(Q,{keys:["title","subtitle"],threshold:.4,includeScore:!0,includeMatches:!0}),[Q]),Me=A.useMemo(()=>new Y(j,{keys:["title","subtitle"],threshold:.4,includeScore:!0,includeMatches:!0}),[j]),De=A.useMemo(()=>new Y(oe,{keys:["title","subtitle","matchedText"],threshold:.4,ignoreLocation:!0,includeScore:!0,includeMatches:!0}),[oe]),Be=A.useMemo(()=>new Y(X,{keys:["title","subtitle","_searchText"],threshold:.4,ignoreLocation:!0,includeScore:!0,includeMatches:!0}),[X]),W=A.useMemo(()=>{if(!E.trim()){const x=[];x.push(...X);const v=[...ce].sort((N,U)=>{const re=N.timeAway??0,ie=U.timeAway??0;return re-ie});x.push(...v),x.push(...Q.slice(0,2)),x.push(...j.slice(0,2));const ee={};return Le.forEach((N,U)=>{ee[N]=U}),x.sort((N,U)=>(ee[N.type]??999)-(ee[U.type]??999)),x}const o=E.toLowerCase(),w=we.search(E).slice(0,8),F=Fe.search(E).slice(0,3),M=Me.search(E).slice(0,2),b=De.search(E).slice(0,3),R=Be.search(E).filter(x=>{const v=x.score??1;return`${x.item.title} ${x.item.subtitle||""} ${x.item._searchText||""}`.toLowerCase().includes(o)||v<=.2}).slice(0,4),B=[],z=[],V=[];for(const x of w){const v={...x.item};if(v._modifiedFiles&&v._modifiedFiles.length>0){const N=v._modifiedFiles.filter(U=>{var ae;const re=((ae=U.split("/").pop())==null?void 0:ae.toLowerCase())||"",ie=U.toLowerCase();return re.includes(o)||ie.includes(o)});N.length>0&&(v.matchedFiles=N)}if(v._userQueries&&v._userQueries.length>0){const N=v._userQueries.find(U=>U.toLowerCase().includes(o));if(N)if(N.length>200){const re=N.toLowerCase().indexOf(o),ie=Math.max(0,re-60),ae=Math.min(N.length,re+o.length+100);v.matchedQuery=(ie>0?"...":"")+N.slice(ie,ae)+(ae<N.length?"...":"")}else v.matchedQuery=N}const ee=v.title.toLowerCase();ee===o||ee.startsWith(o)?z.push(v):V.push(v)}for(const x of z)B.push(x);for(const x of R)B.push(x.item);for(const x of V)B.push(x);for(const x of F)B.push(x.item);for(const x of M)B.push(x.item);for(const x of b)B.push(x.item);const _={};return Le.forEach((x,v)=>{_[x]=v}),B.sort((x,v)=>(_[x.type]??999)-(_[v.type]??999)),B},[E,we,Fe,Me,De,Be,Q,ce,j,X]);A.useEffect(()=>{D>=W.length&&$(Math.max(0,W.length-1))},[W.length,D]);const Ue=A.useCallback(o=>{if(o.altKey&&!o.ctrlKey&&!o.metaKey&&(o.key==="p"||o.key==="n"||o.key==="P"||o.key==="N")){o.preventDefault(),o.stopPropagation(),o.nativeEvent.stopImmediatePropagation();const w=o.key.toLowerCase();$(w==="p"?F=>F>0?F-1:W.length-1:F=>F<W.length-1?F+1:0);return}switch(o.key){case"Escape":o.preventDefault(),y.current();break;case"ArrowUp":o.preventDefault(),$(w=>w>0?w-1:W.length-1);break;case"ArrowDown":o.preventDefault(),$(w=>w<W.length-1?w+1:0);break;case"Enter":o.preventDefault(),W[D]&&W[D].action();break}},[W,D]),Ge=A.useCallback((o,w)=>{if(!w||!o)return o;const F=o.toLowerCase(),M=w.toLowerCase(),b=[];let R=0,B=F.indexOf(M),z=0;for(;B!==-1;)B>R&&b.push(o.slice(R,B)),b.push(de.createElement("mark",{key:z++,className:"spotlight-highlight"},o.slice(B,B+w.length))),R=B+w.length,B=F.indexOf(M,R);return R<o.length&&b.push(o.slice(R)),b.length>0?de.createElement(de.Fragment,null,...b):o},[]);return{query:E,setQuery:C,selectedIndex:D,setSelectedIndex:$,results:W,handleKeyDown:Ue,highlightMatch:Ge}}const zt=A.forwardRef(function({query:e,onQueryChange:s,onKeyDown:n,onResetSelection:r},i){const{t:c}=Ee(["common"]);return f.jsxs("div",{className:"spotlight-input-wrapper",children:[f.jsx("span",{className:"spotlight-search-icon",children:"⌘"}),f.jsx("input",{ref:i,type:"text",className:"spotlight-input",placeholder:c("common:search.spotlightPlaceholder"),value:e,onChange:a=>{s(a.target.value),r()},onKeyDown:n,autoFocus:!0,spellCheck:!1}),f.jsxs("div",{className:"spotlight-input-hints",children:[f.jsx("span",{className:"spotlight-shortcut-hint",children:"↑↓"}),f.jsx("span",{className:"spotlight-shortcut-hint",children:"Enter"}),f.jsx("span",{className:"spotlight-shortcut-hint",children:"Esc"})]})]})}),Ot=A.memo(function({result:e,isSelected:s,query:n,highlightMatch:r,onClick:i,onMouseEnter:c}){const a=e.activityText||e.matchedFiles&&e.matchedFiles.length>0||e.matchedQuery;return f.jsxs("div",{className:`spotlight-item ${s?"selected":""} ${e.activityText?"has-activity":""}`,onClick:i,onMouseEnter:c,role:"option","aria-selected":s,children:[f.jsx("span",{className:"spotlight-item-icon","aria-hidden":"true",children:e.icon}),f.jsxs("div",{className:"spotlight-item-content",children:[f.jsxs("div",{className:"spotlight-item-header",children:[f.jsx("span",{className:"spotlight-item-title",children:r(e.title,n)}),f.jsx("span",{className:`spotlight-item-type ${e.type}`,"aria-label":Ne(e.type),children:Ne(e.type)})]}),e.subtitle&&f.jsx("span",{className:"spotlight-item-subtitle",children:r(e.subtitle,n)}),e.activityText&&f.jsx("span",{className:"spotlight-item-activity",children:r(e.activityText,n)}),a&&f.jsxs("div",{className:"spotlight-item-details",children:[e.matchedFiles&&e.matchedFiles.length>0&&f.jsx("span",{className:"spotlight-item-files",children:e.matchedFiles.map((u,l)=>f.jsxs("span",{className:"file-badge",children:[l>0&&f.jsx("span",{className:"file-separator",children:"•"}),r(u.split("/").pop()||u,n)]},u))}),e.matchedQuery&&f.jsx("span",{className:"spotlight-item-query",children:r(e.matchedQuery,n)})]}),e.timeAway!==void 0&&f.jsx("span",{className:"spotlight-item-time",children:f.jsxs("span",{className:"spotlight-time-away",children:["Idle: ",Ve(e.timeAway)]})}),e.lastUserInput&&!e.matchedQuery&&f.jsxs("span",{className:"spotlight-item-last-input",children:['"',r(e.lastUserInput,n),'"']})]})]})}),Qt=A.forwardRef(function({results:e,selectedIndex:s,query:n,highlightMatch:r,onSelectIndex:i},c){const{t:a}=Ee(["terminal"]),u=A.useRef(!1);A.useEffect(()=>{u.current=!1},[e]),A.useEffect(()=>{const d=typeof c=="function"?null:c==null?void 0:c.current;if(!d)return;const m=()=>{u.current=!0};return d.addEventListener("mousemove",m),()=>{d.removeEventListener("mousemove",m)}},[c,e]);const l={command:a("terminal:spotlight.categories.commands"),agent:a("terminal:spotlight.categories.agents"),building:a("terminal:spotlight.categories.infrastructure"),area:a("terminal:spotlight.categories.areas"),"modified-file":a("terminal:spotlight.categories.modifiedFiles")},h=A.useMemo(()=>{const d=[];let m=null,g=[];return e.forEach((y,I)=>{y.type!==m&&(m!==null&&g.length>0&&d.push([m,g]),m=y.type,g=[]),g.push({result:y,index:I})}),m!==null&&g.length>0&&d.push([m,g]),d},[e]);return A.useEffect(()=>{if(!c||typeof c=="function")return;const d=c.current;if(!d)return;const m=d.querySelector(".spotlight-item.selected");m&&m.scrollIntoView({block:"nearest",behavior:"smooth"})},[s,c]),e.length===0?f.jsx("div",{className:"spotlight-results",ref:c,children:f.jsx("div",{className:"spotlight-empty",children:a("terminal:spotlight.noResults")})}):f.jsx("div",{className:"spotlight-results",ref:c,children:h.map(([d,m])=>f.jsxs("div",{children:[h.length>1&&f.jsx("div",{className:"spotlight-category-header",children:l[d]||d}),m.map(({result:g,index:y})=>f.jsx(Ot,{result:g,isSelected:y===s,query:n,highlightMatch:r,onClick:()=>g.action(),onMouseEnter:()=>{u.current&&i(y)}},g.id))]},d))})}),Wt=A.memo(function(){const{t:e}=Ee(["terminal"]);return f.jsxs("div",{className:"spotlight-footer",children:[f.jsxs("div",{className:"spotlight-footer-left",children:[f.jsxs("span",{className:"spotlight-footer-hint",children:[f.jsx("kbd",{children:"↑"}),f.jsx("kbd",{children:"↓"})," ",f.jsx("kbd",{children:"Alt+N"}),f.jsx("kbd",{children:"Alt+P"})," ",e("terminal:spotlight.navigate")]}),f.jsxs("span",{className:"spotlight-footer-hint",children:[f.jsx("kbd",{children:"Enter"})," ",e("terminal:spotlight.select")]})]}),f.jsx("div",{className:"spotlight-footer-right",children:f.jsxs("span",{className:"spotlight-footer-hint",children:[f.jsx("kbd",{children:"Esc"})," ",e("common:buttons.close")]})})]})}),Vt=768;function Xt({isOpen:t,onClose:e,onOpenSpawnModal:s,onOpenCommanderView:n,onOpenToolbox:r,onOpenFileExplorer:i,onOpenPM2LogsModal:c,onOpenBossLogsModal:a,onOpenDatabasePanel:u,onOpenMonitoringModal:l}){const h=A.useRef(null),d=A.useRef(null),m=A.useRef(null),g=A.useRef(0),{query:y,setQuery:I,selectedIndex:k,setSelectedIndex:S,results:L,handleKeyDown:O,highlightMatch:K}=Kt({isOpen:t,onClose:e,onOpenSpawnModal:s,onOpenCommanderView:n,onOpenToolbox:r,onOpenFileExplorer:i,onOpenPM2LogsModal:c,onOpenBossLogsModal:a,onOpenDatabasePanel:u,onOpenMonitoringModal:l});g.current=L.length,A.useEffect(()=>{t&&setTimeout(()=>{var E;(E=h.current)==null||E.focus()},50)},[t]),A.useEffect(()=>{if(!t)return;const E=window.visualViewport;if(!E||window.innerWidth>Vt)return;const C=()=>{const D=d.current;D&&(D.style.height=`${E.height}px`,D.style.top=`${E.offsetTop}px`)};return C(),E.addEventListener("resize",C),E.addEventListener("scroll",C),()=>{E.removeEventListener("resize",C),E.removeEventListener("scroll",C);const D=d.current;D&&(D.style.height="",D.style.top="")}},[t]),A.useEffect(()=>{if(!t)return;const E=C=>{if(C.key==="Escape"){C.preventDefault(),C.stopPropagation(),C.stopImmediatePropagation(),e();return}if(C.altKey&&!C.ctrlKey&&!C.metaKey&&(C.key==="n"||C.key==="p"||C.key==="N"||C.key==="P")){C.preventDefault(),C.stopPropagation(),C.stopImmediatePropagation();const D=C.key.toLowerCase(),$=g.current;S(D==="p"?T=>T>0?T-1:$-1:T=>T<$-1?T+1:0);return}};return window.addEventListener("keydown",E,{capture:!0}),()=>{window.removeEventListener("keydown",E,{capture:!0})}},[t,e]);const ne=A.useCallback(E=>{E.target===E.currentTarget&&e()},[e]),G=A.useCallback(()=>{S(0)},[S]);return t?f.jsx("div",{ref:d,className:"spotlight-overlay",onClick:ne,children:f.jsxs("div",{className:"spotlight-modal",children:[f.jsx(zt,{ref:h,query:y,onQueryChange:I,onKeyDown:O,onResetSelection:G}),f.jsx(Qt,{ref:m,results:L,selectedIndex:k,query:y,highlightMatch:K,onSelectIndex:S}),f.jsx(Wt,{})]})}):null}export{Re as FILE_ICON_NAMES,Xt as Spotlight,Wt as SpotlightFooter,zt as SpotlightInput,Ot as SpotlightItem,Qt as SpotlightResults,Ve as formatDuration,Jt as formatRelativeTime,Pt as getAgentIcon,Tt as getFileIconFromPath,Ne as getTypeLabel,Kt as useSpotlightSearch};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as ts,u as as,B as vs,C as bs,E as zs,j as s,I as F,G as Is,H as Es,J as $s,K as Ds,L as Ms,r as c,M as Ls,N as Xs,O as Ps,P as Ss,U as Ys,V as Rs,W as Gs,X as Us,Y as ms,Z as _s,s as M,_ as Fs,n as U}from"./main-B_0o0aI9.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";const fs=ts.memo(({agent:t,isSelected:A,isKeyboardFocused:L=!1,onSelect:X,onDoubleClick:n,onChat:g,onFocus:h,onKill:w,onDragStart:P})=>{const{t:x}=as(["dashboard","common"]),S=vs().has(t.id),N=bs(t.status),H=zs(t),j=Ms(H),I=t.taskLabel?s.jsxs(s.Fragment,{children:[s.jsx(F,{name:"task",size:12})," ",t.taskLabel]}):t.currentTask||t.lastAssignedTask,m=t.status==="idle"&&t.lastActivity>0,[,Z]=ts.useState(0);return ts.useEffect(()=>{if(!m)return;const b=window.setInterval(()=>Z(J=>J+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":t.id,onClick:X,onDoubleClick:b=>{b.stopPropagation(),n()},onDragStart:b=>{P==null||P(t),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:t.name}),s.jsxs("span",{className:"dash-card__class",children:[s.jsx(Is,{agent:t,size:14})," ",t.class]}),s.jsxs("span",{className:`dash-card__provider dash-card__provider--${t.provider}`,children:[s.jsx(F,{name:t.provider==="codex"||t.provider==="opencode"?"status-pending":"robot",size:11,weight:t.provider==="codex"||t.provider==="opencode"?"fill":"regular",color:t.provider==="codex"?"#a16207":t.provider==="opencode"?"#4ade80":void 0})," ",t.provider]}),S&&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:S?"Unseen":t.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:`${H}%`}})}),s.jsxs("span",{className:`dash-card__context-pct dash-card__context-pct--${j}`,children:[H,"%"]})]})]}),s.jsxs("div",{className:"dash-card__row3",children:[s.jsxs("span",{className:"dash-card__workdir",title:t.cwd,children:[s.jsx(F,{name:"folder",size:11})," ",t.cwd.split("/").pop()||t.cwd]}),m&&s.jsxs("span",{className:"dash-card__idle-time",style:{color:Ds(t.lastActivity)},title:$s(t.lastActivity),children:[s.jsx(F,{name:"status-waiting-input",size:10})," ",Es(t.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:t,onSelectBuilding:A})=>{const{t:L}=as(["dashboard"]),X=c.useMemo(()=>Array.from(t.values()).sort((n,g)=>n.name.localeCompare(g.name)),[t]);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:X.length})]}),s.jsx("div",{className:"dashboard-view__buildings-row",children:X.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 Ks({onSelectAgent:t,onFocusAgent:A,onKillAgent:L,onSelectBuilding:X,onOpenTerminal:n,onFocusZone:g}){const{t:h}=as(["dashboard","common"]),w=Xs(),P=Ps(),x=Ss(),rs=Ys(),S=vs(),[N,H]=c.useState(""),[j,I]=c.useState("all"),[m,Z]=c.useState("zone"),[b,J]=c.useState(new Set),[k,T]=c.useState(null),[ps,W]=c.useState(null),[Y,Q]=c.useState(!1),[p,B]=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"?Rs(w,x):m==="status"?Gs(w,S):Us(w),[w,x,m,S]),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]),C=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=>{J(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=>{T(e)},[]),Ns=c.useCallback((e,i)=>{e.preventDefault(),e.dataTransfer.dropEffect="move",W(i)},[]),ks=c.useCallback(()=>{W(null)},[]),Cs=c.useCallback(e=>{if(!k)return;if(e===null){const E=M.getState(),a=Array.from(E.areas.values()).find(r=>r.assignedAgentIds.includes(k.id));a&&M.unassignAgentFromArea(k.id,a.id),T(null),W(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),T(null),W(null)},[k,x,w]);return c.useEffect(()=>{if(C.length===0){Q(!1),B(null);return}Y&&(!p||!C.some(e=>e.id===p))&&(B(C[0].id),t==null||t(C[0].id))},[C,Y,p,t]),c.useEffect(()=>{const e=a=>a instanceof HTMLElement?a.tagName==="INPUT"||a.tagName==="TEXTAREA"||a.tagName==="SELECT"||a.isContentEditable:!1,i=a=>a instanceof HTMLElement?!!a.closest(".guake-terminal")||a.classList.contains("guake-input")||a.classList.contains("agent-panel-input"):!1,l=a=>{const r=Array.from(document.querySelectorAll(".dash-card[data-agent-id]")).find(z=>z.dataset.agentId===a);r==null||r.scrollIntoView({block:"nearest",inline:"nearest"})},_=(a,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 y=d.getBoundingClientRect();return{id:u,centerX:y.left+y.width/2,centerY:y.top+y.height/2,height:y.height}}).filter(d=>d!==null).sort((d,u)=>d.centerY-u.centerY||d.centerX-u.centerX);if(z.length===0)return a;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 y=u.reduce((ys,As)=>ys+As.centerY,0)/u.length;Math.abs(d.centerY-y)<=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,y)=>u.centerX-y.centerX));const R=f.findIndex(d=>d.some(u=>u.id===a));if(R===-1)return((os=(ds=f[0])==null?void 0:ds[0])==null?void 0:os.id)??a;const $=f[R],v=$.findIndex(d=>d.id===a);if(v===-1)return((ls=(cs=f[0])==null?void 0:cs[0])==null?void 0:ls.id)??a;if(r==="left")return((us=$[Math.max(0,v-1)])==null?void 0:us.id)??a;if(r==="right")return((hs=$[Math.min($.length-1,v+1)])==null?void 0:hs.id)??a;const q=r==="up"?Math.max(0,R-1):Math.min(f.length-1,R+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)??a},E=a=>{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"),R=r.find(o=>o.id==="dashboard-vim-right"),$=r.find(o=>o.id==="open-terminal"),v=M.getState();if(e(a.target))if(!v.terminalOpen&&i(a.target)&&document.activeElement instanceof HTMLElement)document.activeElement.blur();else return;if(U(a,z)){if(C.length===0)return;a.preventDefault(),a.stopPropagation(),Q(!0),B(o=>{const G=o&&C.some(D=>D.id===o)?o:C[0].id;return t==null||t(G),window.setTimeout(()=>l(G),0),G});return}const q=U(a,ss)||a.key==="ArrowLeft"?"left":U(a,es)||a.key==="ArrowDown"?"down":U(a,f)||a.key==="ArrowUp"?"up":U(a,R)||a.key==="ArrowRight"?"right":null;if(q&&Y&&p){a.preventDefault(),a.stopPropagation();const o=_(p,q);o!==p&&(B(o),t==null||t(o),window.setTimeout(()=>l(o),0));return}if(U(a,$)){if(v.terminalOpen)return;if(Y&&p&&v.agents.has(p)){a.preventDefault(),n==null||n(p);return}if(v.selectedAgentIds.size===1){a.preventDefault();const o=Array.from(v.selectedAgentIds)[0];n==null||n(o);return}if(v.lastSelectedAgentId&&v.agents.has(v.lastSelectedAgentId)){a.preventDefault(),n==null||n(v.lastSelectedAgentId);return}}};return document.addEventListener("keydown",E,!0),()=>document.removeEventListener("keydown",E,!0)},[C,Y,p,n,t]),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=>H(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:()=>Z("zone"),children:h("grouping.byZone")}),s.jsx("button",{className:`dashboard-view__grouping-btn ${m==="status"?"dashboard-view__grouping-btn--active":""}`,onClick:()=>Z("status"),children:h("grouping.byStatus")}),s.jsx("button",{className:`dashboard-view__grouping-btn ${m==="activity"?"dashboard-view__grouping-btn--active":""}`,onClick:()=>Z("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,a=e.agents.filter(r=>S.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:()=>Cs(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")]}),a>0&&s.jsxs("span",{className:"dashboard-view__zone-unseen",children:[" · ",a," 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:Y&&p===r.id,onSelect:()=>{t==null||t(r.id),Q(!0),B(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")}),P.size>0&&s.jsx(ws,{buildings:P,onSelectBuilding:X})]})]})}export{Ks as DashboardView};
|
|
1
|
+
import{z as ts,u as as,B as vs,C as bs,E as zs,j as s,I as F,G as Is,H as Es,J as $s,K as Ds,L as Ms,r as c,M as Ls,N as Xs,O as Ps,P as Ss,U as Ys,V as Rs,W as Gs,X as Us,Y as ms,Z as _s,s as M,_ as Fs,n as U}from"./main-muli6bmQ.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";const fs=ts.memo(({agent:t,isSelected:A,isKeyboardFocused:L=!1,onSelect:X,onDoubleClick:n,onChat:g,onFocus:h,onKill:w,onDragStart:P})=>{const{t:x}=as(["dashboard","common"]),S=vs().has(t.id),N=bs(t.status),H=zs(t),j=Ms(H),I=t.taskLabel?s.jsxs(s.Fragment,{children:[s.jsx(F,{name:"task",size:12})," ",t.taskLabel]}):t.currentTask||t.lastAssignedTask,m=t.status==="idle"&&t.lastActivity>0,[,Z]=ts.useState(0);return ts.useEffect(()=>{if(!m)return;const b=window.setInterval(()=>Z(J=>J+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":t.id,onClick:X,onDoubleClick:b=>{b.stopPropagation(),n()},onDragStart:b=>{P==null||P(t),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:t.name}),s.jsxs("span",{className:"dash-card__class",children:[s.jsx(Is,{agent:t,size:14})," ",t.class]}),s.jsxs("span",{className:`dash-card__provider dash-card__provider--${t.provider}`,children:[s.jsx(F,{name:t.provider==="codex"||t.provider==="opencode"?"status-pending":"robot",size:11,weight:t.provider==="codex"||t.provider==="opencode"?"fill":"regular",color:t.provider==="codex"?"#a16207":t.provider==="opencode"?"#4ade80":void 0})," ",t.provider]}),S&&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:S?"Unseen":t.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:`${H}%`}})}),s.jsxs("span",{className:`dash-card__context-pct dash-card__context-pct--${j}`,children:[H,"%"]})]})]}),s.jsxs("div",{className:"dash-card__row3",children:[s.jsxs("span",{className:"dash-card__workdir",title:t.cwd,children:[s.jsx(F,{name:"folder",size:11})," ",t.cwd.split("/").pop()||t.cwd]}),m&&s.jsxs("span",{className:"dash-card__idle-time",style:{color:Ds(t.lastActivity)},title:$s(t.lastActivity),children:[s.jsx(F,{name:"status-waiting-input",size:10})," ",Es(t.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:t,onSelectBuilding:A})=>{const{t:L}=as(["dashboard"]),X=c.useMemo(()=>Array.from(t.values()).sort((n,g)=>n.name.localeCompare(g.name)),[t]);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:X.length})]}),s.jsx("div",{className:"dashboard-view__buildings-row",children:X.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 Ks({onSelectAgent:t,onFocusAgent:A,onKillAgent:L,onSelectBuilding:X,onOpenTerminal:n,onFocusZone:g}){const{t:h}=as(["dashboard","common"]),w=Xs(),P=Ps(),x=Ss(),rs=Ys(),S=vs(),[N,H]=c.useState(""),[j,I]=c.useState("all"),[m,Z]=c.useState("zone"),[b,J]=c.useState(new Set),[k,T]=c.useState(null),[ps,W]=c.useState(null),[Y,Q]=c.useState(!1),[p,B]=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"?Rs(w,x):m==="status"?Gs(w,S):Us(w),[w,x,m,S]),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]),C=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=>{J(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=>{T(e)},[]),Ns=c.useCallback((e,i)=>{e.preventDefault(),e.dataTransfer.dropEffect="move",W(i)},[]),ks=c.useCallback(()=>{W(null)},[]),Cs=c.useCallback(e=>{if(!k)return;if(e===null){const E=M.getState(),a=Array.from(E.areas.values()).find(r=>r.assignedAgentIds.includes(k.id));a&&M.unassignAgentFromArea(k.id,a.id),T(null),W(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),T(null),W(null)},[k,x,w]);return c.useEffect(()=>{if(C.length===0){Q(!1),B(null);return}Y&&(!p||!C.some(e=>e.id===p))&&(B(C[0].id),t==null||t(C[0].id))},[C,Y,p,t]),c.useEffect(()=>{const e=a=>a instanceof HTMLElement?a.tagName==="INPUT"||a.tagName==="TEXTAREA"||a.tagName==="SELECT"||a.isContentEditable:!1,i=a=>a instanceof HTMLElement?!!a.closest(".guake-terminal")||a.classList.contains("guake-input")||a.classList.contains("agent-panel-input"):!1,l=a=>{const r=Array.from(document.querySelectorAll(".dash-card[data-agent-id]")).find(z=>z.dataset.agentId===a);r==null||r.scrollIntoView({block:"nearest",inline:"nearest"})},_=(a,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 y=d.getBoundingClientRect();return{id:u,centerX:y.left+y.width/2,centerY:y.top+y.height/2,height:y.height}}).filter(d=>d!==null).sort((d,u)=>d.centerY-u.centerY||d.centerX-u.centerX);if(z.length===0)return a;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 y=u.reduce((ys,As)=>ys+As.centerY,0)/u.length;Math.abs(d.centerY-y)<=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,y)=>u.centerX-y.centerX));const R=f.findIndex(d=>d.some(u=>u.id===a));if(R===-1)return((os=(ds=f[0])==null?void 0:ds[0])==null?void 0:os.id)??a;const $=f[R],v=$.findIndex(d=>d.id===a);if(v===-1)return((ls=(cs=f[0])==null?void 0:cs[0])==null?void 0:ls.id)??a;if(r==="left")return((us=$[Math.max(0,v-1)])==null?void 0:us.id)??a;if(r==="right")return((hs=$[Math.min($.length-1,v+1)])==null?void 0:hs.id)??a;const q=r==="up"?Math.max(0,R-1):Math.min(f.length-1,R+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)??a},E=a=>{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"),R=r.find(o=>o.id==="dashboard-vim-right"),$=r.find(o=>o.id==="open-terminal"),v=M.getState();if(e(a.target))if(!v.terminalOpen&&i(a.target)&&document.activeElement instanceof HTMLElement)document.activeElement.blur();else return;if(U(a,z)){if(C.length===0)return;a.preventDefault(),a.stopPropagation(),Q(!0),B(o=>{const G=o&&C.some(D=>D.id===o)?o:C[0].id;return t==null||t(G),window.setTimeout(()=>l(G),0),G});return}const q=U(a,ss)||a.key==="ArrowLeft"?"left":U(a,es)||a.key==="ArrowDown"?"down":U(a,f)||a.key==="ArrowUp"?"up":U(a,R)||a.key==="ArrowRight"?"right":null;if(q&&Y&&p){a.preventDefault(),a.stopPropagation();const o=_(p,q);o!==p&&(B(o),t==null||t(o),window.setTimeout(()=>l(o),0));return}if(U(a,$)){if(v.terminalOpen)return;if(Y&&p&&v.agents.has(p)){a.preventDefault(),n==null||n(p);return}if(v.selectedAgentIds.size===1){a.preventDefault();const o=Array.from(v.selectedAgentIds)[0];n==null||n(o);return}if(v.lastSelectedAgentId&&v.agents.has(v.lastSelectedAgentId)){a.preventDefault(),n==null||n(v.lastSelectedAgentId);return}}};return document.addEventListener("keydown",E,!0),()=>document.removeEventListener("keydown",E,!0)},[C,Y,p,n,t]),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=>H(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:()=>Z("zone"),children:h("grouping.byZone")}),s.jsx("button",{className:`dashboard-view__grouping-btn ${m==="status"?"dashboard-view__grouping-btn--active":""}`,onClick:()=>Z("status"),children:h("grouping.byStatus")}),s.jsx("button",{className:`dashboard-view__grouping-btn ${m==="activity"?"dashboard-view__grouping-btn--active":""}`,onClick:()=>Z("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,a=e.agents.filter(r=>S.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:()=>Cs(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")]}),a>0&&s.jsxs("span",{className:"dashboard-view__zone-unseen",children:[" · ",a," 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:Y&&p===r.id,onSelect:()=>{t==null||t(r.id),Q(!0),B(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")}),P.size>0&&s.jsx(ws,{buildings:P,onSelectBuilding:X})]})]})}export{Ks as DashboardView};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{aw as ta,u as E,j as e,a7 as v,az as Fs,aA as Ms,a8 as He,s as P,aB as $s,D as Y,I as A,M as Hs,aj as Ge,f as na,aC as la,r as o,a3 as ia,S as ra,h as oa,aD as Us,ak as Ke}from"./main-
|
|
1
|
+
import{aw as ta,u as E,j as e,a7 as v,az as Fs,aA as Ms,a8 as He,s as P,aB as $s,D as Y,I as A,M as Hs,aj as Ge,f as na,aC as la,r as o,a3 as ia,S as ra,h as oa,aD as Us,ak as Ke}from"./main-muli6bmQ.js";import"./modulepreload-polyfill-B5Qt9EMX.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,r;for(;(r=c.exec(a))!==null;){if(r.index>h){const m=a.slice(h,r.index);t?l.push(e.jsx("span",{style:{color:t},children:m},l.length)):l.push(m)}const g=r[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}=E(["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}=E(["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:r,setPm2Interpreter:g,pm2InterpreterArgs:m,setPm2InterpreterArgs:d,pm2Env:s,setPm2Env:u,isEditMode:b,building:x,handleCommand:N}){var y;const{t:p}=E(["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:r,onChange:j=>g(j.target.value),children:Object.keys(Fs).map(j=>e.jsx("option",{value:j,children:Fs[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:r,dockerCommand:g,setDockerCommand:m,dockerPorts:d,setDockerPorts:s,dockerVolumes:u,setDockerVolumes:b,dockerNetwork:x,setDockerNetwork:N,dockerRestart:p,setDockerRestart:y,dockerPull:j,setDockerPull:M,dockerEnv:$,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}=E(["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=>r(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 D=[...d];D[C]=B.target.value,s(D)},placeholder:"8080:80 or 3000"}),e.jsx("button",{type:"button",className:"btn btn-sm btn-danger",onClick:()=>s(d.filter((B,D)=>D!==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 D=[...u];D[C]=B.target.value,b(D)},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,D)=>D!==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(Ms).map(n=>e.jsx("option",{value:n,children:Ms[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=>M(n.target.value),children:Object.keys($s).map(n=>e.jsx("option",{value:n,children:$s[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:$,onChange:n=>R(n.target.value),placeholder:`KEY=value
|
|
4
4
|
DATABASE_URL=postgres://...
|