tide-commander 1.40.4 → 1.41.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-CehuxNwV.js → BossLogsModal-gE17BBT9.js} +1 -1
- package/dist/assets/{BossSpawnModal-Cohl0WaH.js → BossSpawnModal-SPvzti1i.js} +1 -1
- package/dist/assets/{ControlsModal-CAVkg9mM.js → ControlsModal-A489_yUU.js} +1 -1
- package/dist/assets/{DockerLogsModal-BXv9Hzg-.js → DockerLogsModal-Bexhv2Eo.js} +1 -1
- package/dist/assets/{EmbeddedEditor-CTlTVKdD.js → EmbeddedEditor-BdrKX9Ef.js} +1 -1
- package/dist/assets/{GmailOAuthSetup-B1zQWbRR.js → GmailOAuthSetup-BRDLCsnz.js} +1 -1
- package/dist/assets/{GoogleOAuthSetup-CmayoZ-D.js → GoogleOAuthSetup-8tWGRN1a.js} +1 -1
- package/dist/assets/{IframeModal-DlS7y7PK.js → IframeModal-AIthNZLG.js} +1 -1
- package/dist/assets/{IntegrationsPanel-BPKoNwZm.js → IntegrationsPanel-D4rlShHL.js} +2 -2
- package/dist/assets/{LogViewerModal-Bx9IDiFM.js → LogViewerModal-CWASeq5k.js} +1 -1
- package/dist/assets/{MonitoringModal-DzqEa0fQ.js → MonitoringModal-GCxQ22tf.js} +1 -1
- package/dist/assets/{PM2LogsModal-DZXPRV5-.js → PM2LogsModal-BFJ1_6O0.js} +1 -1
- package/dist/assets/{RestoreArchivedAreaModal-BajWqtWn.js → RestoreArchivedAreaModal-BtuMbJVE.js} +1 -1
- package/dist/assets/{SaveSnapshotModal-LqaLezB-.js → SaveSnapshotModal-BUn9mntc.js} +1 -1
- package/dist/assets/{Scene2DCanvas-DWDmyh_y.js → Scene2DCanvas-CToncCYk.js} +1 -1
- package/dist/assets/{SceneManager-BgkqWsDb.js → SceneManager-BivL9Mu6.js} +1 -1
- package/dist/assets/{SkillsPanel-CO-Zt0Tq.js → SkillsPanel-IE07LIWC.js} +1 -1
- package/dist/assets/{SnapshotManager-D4Uzw6Tp.js → SnapshotManager-Cs7fZ_aA.js} +1 -1
- package/dist/assets/{SpawnModal-BdCgTKpM.js → SpawnModal-DbfTe3y2.js} +1 -1
- package/dist/assets/{SubordinateAssignmentModal-BoaofULj.js → SubordinateAssignmentModal-DdANoM7g.js} +1 -1
- package/dist/assets/{SupervisorPanel-D8Cp77my.js → SupervisorPanel-CE7sMgHN.js} +1 -1
- package/dist/assets/{TriggerManagerPanel-CFf3Tud5.js → TriggerManagerPanel-Cyb1Sf8s.js} +1 -1
- package/dist/assets/{WorkflowEditorPanel-EtzhBZWw.js → WorkflowEditorPanel-BM9nnUIT.js} +1 -1
- package/dist/assets/{index-CDAtstMx.js → index-B_0CIcus.js} +1 -1
- package/dist/assets/{index-BKRKKMPQ.js → index-CvetF6vL.js} +3 -3
- package/dist/assets/{index-DBpmD8r7.js → index-DESPWRkl.js} +2 -2
- package/dist/assets/{index-2YWd58Wh.js → index-DahUmubU.js} +1 -1
- package/dist/assets/{index-BgTRovwT.js → index-DlFukYeW.js} +1 -1
- package/dist/assets/{index-BiJ_hIit.js → index-Ez0uF12M.js} +1 -1
- package/dist/assets/{index-DByGRjfY.js → index-bXLSkGdM.js} +1 -1
- package/dist/assets/{index-VO6fNr63.js → index-dnQQyjiL.js} +1 -1
- package/dist/assets/main-BL6u5aPD.js +153 -0
- package/dist/assets/main-CVYa_fKP.css +1 -0
- package/dist/assets/{web-1BwWjkKM.js → web-CwCZTch8.js} +1 -1
- package/dist/assets/{web-BXQj42md.js → web-DGZ9VJ1o.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/dist/assets/main-BFSqr5mR.css +0 -1
- package/dist/assets/main-BSyGZK2z.js +0 -152
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{u as Te,bf as Ke,bg as Ue,r as i,h as Ce,j as e,s as z,bh as $e,bi as _e,bj as Ye,L as Ve,H as Je,M as Qe,bk as O,W as ve,w as me,V as Se}from"./main-
|
|
1
|
+
import{u as Te,bf as Ke,bg as Ue,r as i,h as Ce,j as e,s as z,bh as $e,bi as _e,bj as Ye,L as Ve,H as Je,M as Qe,bk as O,W as ve,w as me,V as Se}from"./main-BL6u5aPD.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";const Xe=[{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"}],Ze=[{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"}],eo=`## Instructions
|
|
2
2
|
|
|
3
3
|
Describe step-by-step instructions for this skill here.
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as $,r as d,j as e,bl as b}from"./main-
|
|
1
|
+
import{u as $,r as d,j as e,bl as b}from"./main-BL6u5aPD.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";function R({snapshots:h,isLoading:p=!1,onViewSnapshot:v,onDeleteSnapshot:C,onRestoreSnapshot:y,onExportSnapshot:f,selectedSnapshotId:S,onClose:A}){const{t}=$(["terminal","common"]),[o,g]=d.useState(""),[l,k]=d.useState("createdAt"),[m,j]=d.useState("desc"),[w,u]=d.useState(null),[D,r]=d.useState(null),x=d.useMemo(()=>{let s=[...h];if(o.trim()){const a=o.toLowerCase();s=s.filter(n=>{var c;return n.title.toLowerCase().includes(a)||n.agentName.toLowerCase().includes(a)||((c=n.descriptionPreview)==null?void 0:c.toLowerCase().includes(a))})}return s.sort((a,n)=>{let c=0;switch(l){case"createdAt":c=a.createdAt-n.createdAt;break;case"title":c=a.title.localeCompare(n.title);break;case"agentName":c=a.agentName.localeCompare(n.agentName);break}return m==="asc"?c:-c}),s},[h,o,l,m]),N=s=>{l===s?j(a=>a==="asc"?"desc":"asc"):(k(s),j("desc"))},L=async s=>{r(s);try{await C(s),u(null)}finally{r(null)}},F=async s=>{r(s);try{await y(s)}finally{r(null)}},T=async s=>{r(s);try{await f(s)}finally{r(null)}},E=s=>s in b?b[s]:{icon:"🤖",color:"#888888",description:"Custom agent"},M=s=>{const a=new Date(s),n=new Date,c=n.getTime()-a.getTime(),i=Math.floor(c/(1e3*60*60*24));return i===0?a.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}):i===1?t("common:time.daysAgo",{count:1}):i<7?t("common:time.daysAgo",{count:i}):a.toLocaleDateString(void 0,{month:"short",day:"numeric",year:a.getFullYear()!==n.getFullYear()?"numeric":void 0})};return e.jsxs("div",{className:"snapshot-manager",children:[e.jsxs("div",{className:"snapshot-manager-header",children:[e.jsxs("div",{className:"snapshot-manager-title",children:[e.jsx("span",{className:"snapshot-manager-icon",children:"📸"}),t("terminal:snapshot.title"),e.jsx("span",{className:"snapshot-manager-count",children:h.length})]}),e.jsx("button",{className:"snapshot-manager-close",onClick:A,title:"Close",children:"✕"})]}),e.jsxs("div",{className:"snapshot-manager-toolbar",children:[e.jsxs("div",{className:"snapshot-search",children:[e.jsx("span",{className:"snapshot-search-icon",children:"🔍"}),e.jsx("input",{type:"text",className:"snapshot-search-input",placeholder:t("terminal:snapshot.searchPlaceholder"),value:o,onChange:s=>g(s.target.value)}),o&&e.jsx("button",{className:"snapshot-search-clear",onClick:()=>g(""),title:"Clear search",children:"✕"})]}),e.jsxs("div",{className:"snapshot-sort",children:[e.jsxs("button",{className:`snapshot-sort-btn ${l==="createdAt"?"active":""}`,onClick:()=>N("createdAt"),children:[t("terminal:snapshot.sortDate")," ",l==="createdAt"&&(m==="desc"?"↓":"↑")]}),e.jsxs("button",{className:`snapshot-sort-btn ${l==="title"?"active":""}`,onClick:()=>N("title"),children:[t("terminal:snapshot.sortTitle")," ",l==="title"&&(m==="desc"?"↓":"↑")]}),e.jsxs("button",{className:`snapshot-sort-btn ${l==="agentName"?"active":""}`,onClick:()=>N("agentName"),children:[t("terminal:snapshot.sortAgent")," ",l==="agentName"&&(m==="desc"?"↓":"↑")]})]})]}),e.jsxs("div",{className:"snapshot-manager-content",children:[p&&e.jsxs("div",{className:"snapshot-loading",children:[e.jsx("div",{className:"snapshot-loading-spinner"}),t("terminal:snapshot.loadingSnapshots")]}),!p&&x.length===0&&e.jsx("div",{className:"snapshot-empty",children:o?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"snapshot-empty-icon",children:"🔍"}),e.jsx("span",{className:"snapshot-empty-text",children:t("terminal:snapshot.noSnapshotsMatch")})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"snapshot-empty-icon",children:"📸"}),e.jsx("span",{className:"snapshot-empty-text",children:t("terminal:snapshot.noSnapshotsYet")}),e.jsx("span",{className:"snapshot-empty-hint",children:t("terminal:snapshot.snapshotHint")})]})}),!p&&x.length>0&&e.jsx("div",{className:"snapshot-grid",children:x.map(s=>{const a=E(s.agentClass),n=s.id===S,c=w===s.id,i=D===s.id;return e.jsxs("div",{className:`snapshot-card ${n?"selected":""}`,onClick:()=>v(s.id),children:[e.jsxs("div",{className:"snapshot-card-header",children:[e.jsx("span",{className:"snapshot-card-agent-icon",style:{color:a.color},title:s.agentName,children:a.icon}),e.jsx("span",{className:"snapshot-card-agent-name",children:s.agentName}),e.jsx("span",{className:"snapshot-card-date",children:M(s.createdAt)})]}),e.jsx("div",{className:"snapshot-card-title",children:s.title}),s.descriptionPreview&&e.jsx("div",{className:"snapshot-card-description",children:s.descriptionPreview}),e.jsxs("div",{className:"snapshot-card-stats",children:[e.jsxs("span",{className:"snapshot-card-stat",children:["💬 ",s.outputCount]}),e.jsxs("span",{className:"snapshot-card-stat",children:["📄 ",s.fileCount]})]}),e.jsx("div",{className:"snapshot-card-actions",onClick:P=>P.stopPropagation(),children:c?e.jsxs("div",{className:"snapshot-delete-confirm",children:[e.jsx("span",{children:t("terminal:snapshot.deleteConfirm")}),e.jsx("button",{className:"btn btn-sm btn-danger",onClick:()=>L(s.id),disabled:i,children:i?"...":t("common:buttons.yes")}),e.jsx("button",{className:"btn btn-sm btn-secondary",onClick:()=>u(null),disabled:i,children:t("common:buttons.no")})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"snapshot-action-btn",onClick:()=>F(s.id),title:t("terminal:snapshot.restoreFiles"),disabled:i,children:"🔄"}),e.jsx("button",{className:"snapshot-action-btn",onClick:()=>T(s.id),title:t("terminal:snapshot.exportSnapshot"),disabled:i,children:"📤"}),e.jsx("button",{className:"snapshot-action-btn danger",onClick:()=>u(s.id),title:t("terminal:snapshot.deleteSnapshot"),disabled:i,children:"🗑️"})]})})]},s.id)})})]})]})}export{R as SnapshotManager};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as Xe,H as Ve,L as Ze,M as Qe,N as es,O as ss,r as t,P as ns,S as ke,U as te,A as ye,w as le,V as as,s as B,h as ts,j as s,W as ls,X as x,Y as os,Z as oe,_ as G,$ as K,a0 as ie,a1 as is}from"./main-BSyGZK2z.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";function Ae(c,j){const S=j.filter(b=>!c.has(b));return S.length===0?`${j[Math.floor(Math.random()*j.length)]}-${Date.now()%1e3}`:S[Math.floor(Math.random()*S.length)]}function ms({isOpen:c,onClose:j,onSpawnStart:S,onSpawnEnd:b,spawnPosition:De,spawnAreaId:v}){const{t:n}=Xe(["terminal","common"]),C=Ve(),$=Ze(),p=Qe(),ce=es(),H=ce.length>0?ce:ss,[m,N]=t.useState(""),[M,P]=t.useState(()=>ns(ke.LAST_CWD)),[i,Y]=t.useState("scout"),[re,D]=t.useState(!1),[Ee,T]=t.useState(!1),[de,J]=t.useState(!1),[pe,me]=t.useState(""),[k,X]=t.useState([]),[y,F]=t.useState(null),[Le,ue]=t.useState(!1),[E,he]=t.useState(""),[u,_e]=t.useState(""),[R,Ie]=t.useState(!0),[U,$e]=t.useState("bypass"),[o,V]=t.useState("claude"),[g,L]=t.useState({fullAuto:!0,sandbox:"workspace-write",approvalMode:"on-request",search:!1}),[we,Z]=t.useState(new Set),[Q,xe]=t.useState("opus"),[ee,fe]=t.useState("high"),[se,Pe]=t.useState("gpt-5.3-codex"),[ne,Te]=t.useState("minimax/MiniMax-M1-80k"),[je,Fe]=t.useState(""),[A,Re]=t.useState(""),q=t.useRef(null),ge=t.useRef(!1),_=t.useCallback(()=>{window.__spawnModalAreaContext=null},[]),h=t.useMemo(()=>$.filter(e=>e.enabled),[$]),Ue=["full-notifications","streaming-exec","task-label","report-task-to-boss"];t.useEffect(()=>{if(c&&!ge.current&&h.length>0){const a=h.filter(l=>Ue.includes(l.slug)).map(l=>l.id);a.length>0&&Z(new Set(a))}ge.current=c},[c,h]);const ve=t.useMemo(()=>{if(!A.trim())return h;const e=A.toLowerCase();return h.filter(a=>a.name.toLowerCase().includes(e)||a.description.toLowerCase().includes(e)||a.slug.toLowerCase().includes(e))},[h,A]),qe=t.useCallback(e=>{Z(a=>{const l=new Set(a);return l.has(e)?l.delete(e):l.add(e),l})},[]);t.useMemo(()=>h.filter(e=>e.assignedAgentClasses.includes(i)),[h,i]);const ze=t.useMemo(()=>{var a;const e=p.find(l=>l.id===i);return(a=e==null?void 0:e.defaultSkillIds)!=null&&a.length?$.filter(l=>e.defaultSkillIds.includes(l.id)):[]},[p,i,$]),Ne=t.useMemo(()=>{if(!E.trim())return k;const e=E.toLowerCase();return k.filter(a=>a.sessionId.toLowerCase().includes(e)||a.projectPath.toLowerCase().includes(e)||a.firstMessage&&a.firstMessage.toLowerCase().includes(e))},[k,E]),z=t.useMemo(()=>{if(!u.trim())return p;const e=u.toLowerCase();return p.filter(a=>a.name.toLowerCase().includes(e)||a.description.toLowerCase().includes(e)||a.id.toLowerCase().includes(e))},[p,u]),W=t.useMemo(()=>{if(!u.trim())return te;const e=u.toLowerCase();return te.filter(a=>{const l=ye[a.id];return a.name.toLowerCase().includes(e)||a.id.toLowerCase().includes(e)||l.description.toLowerCase().includes(e)})},[u]);t.useEffect(()=>{if(!c||!u.trim())return;const e=[...z.map(a=>a.id),...W.map(a=>a.id)];e.length===1&&e[0]!==i&&Y(e[0])},[c,u,z,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]),Oe=t.useMemo(()=>{if(r!=null&&r.customModelPath)return le(`/api/custom-models/${r.id}`)},[r]),Be=r==null?void 0:r.modelScale,Ge=t.useMemo(()=>r?"scout":i,[i,r]),O=t.useCallback(async e=>{ue(!0);try{const a=e?le(`/api/agents/claude-sessions?cwd=${encodeURIComponent(e)}`):le("/api/agents/claude-sessions"),d=await(await as(a)).json();X(d.sessions||[])}catch(a){console.error("Failed to fetch sessions:",a),X([])}finally{ue(!1)}},[]);t.useEffect(()=>{c?O(M||void 0):(X([]),F(null),he(""))},[c,O]),t.useEffect(()=>{if(!c)return;const e=setTimeout(()=>{O(M||void 0),F(null)},300);return()=>clearTimeout(e)},[M,c,O]),t.useEffect(()=>{if(!c||!v)return;const e=B.getState().areas.get(v);if(e!=null&&e.directories&&e.directories.length>0){P(e.directories[0]);return}const a=Array.from(C.values()).filter(f=>{var I;return((I=B.getAreaForAgent(f.id))==null?void 0:I.id)===v&&f.cwd});if(a.length===0)return;const l=new Map;for(const f of a)l.set(f.cwd,(l.get(f.cwd)||0)+1);let d="",w=0;for(const[f,I]of l)I>w&&(d=f,w=I);d&&P(d)},[c,v,C]),t.useEffect(()=>{if(c){const e=new Set(Array.from(C.values()).map(w=>w.name)),a=Ae(e,H),l=p.find(w=>w.id===i),d=l?`${l.name} ${a}`:a;N(d),q.current&&(q.current.focus(),q.current.select())}},[c,C,H]),t.useEffect(()=>{if(!c)return;new Set(Array.from(C.values()).map(a=>a.name));const e=p.find(a=>a.id===i);if(e){const a=p.find(l=>m.startsWith(l.name+" "));if(a){const l=m.substring(a.name.length+1);N(`${e.name} ${l}`)}else N(`${e.name} ${m}`)}else{const a=p.find(l=>m.startsWith(l.name+" "));if(a){const l=m.substring(a.name.length+1);N(l)}}},[i]),t.useEffect(()=>{i==="boss"&&xe("opus")},[i]);const Ke=()=>{var d;console.log("[SpawnModal] handleSpawn called"),T(!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:",R),console.log("[SpawnModal] Session ID:",y||"none"),!e.trim()){console.error("[SpawnModal] Empty CWD, showing error"),T(!0);return}if(!m.trim()){console.log("[SpawnModal] Empty name, regenerating");const w=new Set(Array.from(C.values()).map(f=>f.name));N(Ae(w,H));return}is(ke.LAST_CWD,e),D(!0),S();const a=Array.from(we),l=je.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"?R:!1,permissionMode:U,provider:o,codexConfig:o==="codex"?g:void 0,codexModel:o==="codex"?se:void 0,opencodeModel:o==="opencode"?ne:void 0,initialSkillIds:a,model:o==="claude"?Q: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(),De||void 0,y||void 0,o==="claude"?R:!1,U,a,o,o==="codex"?g:void 0,o==="codex"?se:void 0,o==="claude"?Q:void 0,l,o==="claude"?ee:void 0,o==="opencode"?ne:void 0)},Se=()=>{console.log("[SpawnModal] Agent creation successful"),D(!1),N(""),Z(new Set),_(),b(),j()},be=()=>{console.error("[SpawnModal] Agent creation failed"),D(!1),T(!0),_(),b()},Ce=e=>{console.log("[SpawnModal] Directory not found:",e),D(!1),me(e),J(!0),b()},Me=()=>{J(!1),D(!0),S(),B.createDirectoryAndSpawn(pe,m.trim(),i)},ae=()=>{J(!1),me(""),_()};t.useEffect(()=>(window.__spawnModalSuccess=Se,window.__spawnModalError=be,window.__spawnModalDirNotFound=Ce,()=>{_(),delete window.__spawnModalSuccess,delete window.__spawnModalError,delete window.__spawnModalDirNotFound}),[m,i,Se,be,Ce,_]);const{handleMouseDown:He,handleClick:Ye}=ts(j),Je=e=>{e.key==="Escape"&&j()};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:n("terminal:spawn.directoryNotFound")}),s.jsxs("div",{className:"modal-body confirm-modal-body",children:[s.jsx("p",{children:n("terminal:spawn.directoryNotExist")}),s.jsx("code",{className:"confirm-modal-path",children:pe}),s.jsx("p",{children:n("terminal:spawn.wouldYouCreate")})]}),s.jsxs("div",{className:"modal-footer",children:[s.jsx("button",{className:"btn btn-secondary",onClick:ae,children:n("common:buttons.cancel")}),s.jsx("button",{className:"btn btn-primary",onClick:Me,autoFocus:!0,children:n("terminal:spawn.createDirectory")})]})]})}):s.jsx("div",{className:`modal-overlay ${c?"visible":""}`,onMouseDown:He,onClick:Ye,onKeyDown:Je,children:s.jsxs("div",{className:"modal spawn-modal",children:[s.jsx("div",{className:"modal-header",children:n("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:Ge,modelFile:We,customModelUrl:Oe,modelScale:Be,width:100,height:120})}),s.jsxs("div",{className:"spawn-class-section",children:[s.jsx("div",{className:"spawn-class-label",children:n("terminal:spawn.agentClass")}),p.length+te.length>6&&s.jsx("input",{type:"text",className:"spawn-input class-search-input",placeholder:n("terminal:spawn.filterClasses"),value:u,onChange:e=>_e(e.target.value)}),s.jsxs("div",{className:"class-selector-inline",children:[z.map(e=>s.jsxs("button",{className:`class-chip ${i===e.id?"selected":""}`,onClick:()=>Y(e.id),title:e.description,children:[s.jsx("span",{className:"class-chip-icon",children:e.icon}),s.jsx("span",{className:"class-chip-name",children:e.name})]},e.id)),W.map(e=>{const a=ye[e.id];return s.jsxs("button",{className:`class-chip ${i===e.id?"selected":""}`,onClick:()=>Y(e.id),title:a.description,children:[s.jsx("span",{className:"class-chip-icon",children:a.icon}),s.jsx("span",{className:"class-chip-name",children:e.name})]},e.id)}),u&&z.length===0&&W.length===0&&s.jsx("div",{className:"class-search-empty",children:n("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:n("common:labels.name")}),s.jsx("input",{ref:q,type:"text",className:"spawn-input",placeholder:n("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:[n("terminal:spawn.workingDir"),s.jsx(x,{text:n("terminal:spawn.helpWorkingDir"),title:n("terminal:spawn.workingDir"),position:"top",size:"sm"})]}),s.jsx(os,{value:M,onChange:e=>{P(e),T(!1)},placeholder:n("terminal:spawn.workingDirPlaceholder"),className:`spawn-input ${Ee?"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:[n("terminal:spawn.selectRuntime"),s.jsx(x,{text:n("terminal:spawn.helpRuntime"),title:n("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:()=>V("claude"),title:n("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:()=>V("codex"),title:n("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:()=>V("opencode"),title:"Use OpenCode CLI (multi-provider)",children:[s.jsx("span",{children:"🟢"}),s.jsx("span",{children:"OpenCode"})]})]})]}),s.jsxs("div",{className:"spawn-field",children:[s.jsxs("label",{className:"spawn-label",children:[n("common:labels.permissions"),s.jsx(x,{text:n("terminal:spawn.helpPermission"),title:n("terminal:spawn.permissionMode"),position:"top",size:"sm"})]}),s.jsx("div",{className:"spawn-select-row",children:Object.keys(oe).map(e=>s.jsxs("button",{className:`spawn-select-btn ${U===e?"selected":""}`,onClick:()=>$e(e),title:oe[e].description,children:[s.jsx("span",{children:e==="bypass"?"⚡":"🔐"}),s.jsx("span",{children:oe[e].label})]},e))})]})]}),s.jsxs("div",{className:"spawn-form-row",children:[s.jsxs("div",{className:"spawn-field",children:[s.jsxs("label",{className:"spawn-label",children:[n("common:labels.model"),s.jsx(x,{text:n("terminal:spawn.helpModel"),title:n("terminal:spawn.modelTitle"),position:"top",size:"sm"})]}),o==="claude"?s.jsx("div",{className:"spawn-select-row",children:Object.keys(G).map(e=>s.jsxs("button",{className:`spawn-select-btn ${Q===e?"selected":""}`,onClick:()=>xe(e),title:G[e].description,children:[s.jsx("span",{children:G[e].icon}),s.jsx("span",{children:G[e].label})]},e))}):o==="codex"?s.jsx("div",{className:"spawn-select-row spawn-select-row--codex-models",children:Object.keys(K).map(e=>s.jsxs("button",{className:`spawn-select-btn ${se===e?"selected":""}`,onClick:()=>Pe(e),title:K[e].description,children:[s.jsx("span",{children:K[e].icon}),s.jsx("span",{children:K[e].label})]},e))}):o==="opencode"?s.jsx("input",{type:"text",className:"spawn-input",value:ne,onChange:e=>Te(e.target.value),placeholder:"provider/model (e.g., minimax/MiniMax-M1-80k)"}):s.jsx("div",{className:"spawn-inline-hint",children:n("terminal:spawn.chooseCodexModel")})]}),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 ${ee===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 ${ee===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:n("terminal:spawn.browser")}),s.jsx("div",{className:"spawn-form-row spawn-options-row",children:s.jsxs("label",{className:"spawn-checkbox",children:[s.jsx("input",{type:"checkbox",checked:R,onChange:e=>Ie(e.target.checked),disabled:o!=="claude"}),s.jsxs("span",{children:["🌐 ",n("terminal:spawn.chromeBrowser")]}),s.jsx(x,{text:n(o==="claude"?"terminal:spawn.helpChrome":"terminal:spawn.helpChromeDisabled"),title:n("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:n("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:g.fullAuto!==!1,onChange:e=>L(a=>({...a,fullAuto:e.target.checked}))}),s.jsx("span",{children:n("terminal:spawn.codex.fullAuto")}),s.jsx(x,{text:n("terminal:spawn.helpFullAuto"),title:n("terminal:spawn.fullAutoTitle"),position:"top",size:"sm"})]}),s.jsxs("label",{className:"spawn-checkbox",children:[s.jsx("input",{type:"checkbox",checked:!!g.search,onChange:e=>L(a=>({...a,search:e.target.checked}))}),s.jsx("span",{children:n("terminal:spawn.codex.search")}),s.jsx(x,{text:n("terminal:spawn.helpSearch"),title:n("terminal:spawn.searchTitle"),position:"top",size:"sm"})]})]}),g.fullAuto===!1&&s.jsxs("div",{className:"codex-option-group",children:[s.jsx("div",{className:"codex-option-header",children:n("terminal:spawn.codex.restrictions")}),s.jsxs("select",{className:"spawn-input codex-select",value:g.sandbox||"workspace-write",onChange:e=>L(a=>({...a,sandbox:e.target.value})),children:[s.jsxs("option",{value:"read-only",children:["📖 ",n("terminal:spawn.codex.sandboxReadOnly")]}),s.jsxs("option",{value:"workspace-write",children:["✏️ ",n("terminal:spawn.codex.sandboxWorkspaceWrite")]}),s.jsxs("option",{value:"danger-full-access",children:["⚡ ",n("terminal:spawn.codex.sandboxDangerFullAccess")]})]}),s.jsxs("select",{className:"spawn-input codex-select",value:g.approvalMode||"on-request",onChange:e=>L(a=>({...a,approvalMode:e.target.value})),children:[s.jsxs("option",{value:"untrusted",children:["🔒 ",n("terminal:spawn.codex.approvalsUntrusted")]}),s.jsxs("option",{value:"on-failure",children:["⚠️ ",n("terminal:spawn.codex.approvalsOnFailure")]}),s.jsxs("option",{value:"on-request",children:["🤔 ",n("terminal:spawn.codex.approvalsOnRequest")]}),s.jsxs("option",{value:"never",children:["✅ ",n("terminal:spawn.codex.approvalsNever")]})]})]}),s.jsxs("div",{className:"codex-option-group",children:[s.jsx("div",{className:"codex-option-header",children:n("terminal:spawn.codex.profile")}),s.jsx("input",{type:"text",className:"spawn-input codex-profile-input",placeholder:n("terminal:spawn.codex.profilePlaceholder"),value:g.profile||"",onChange:e=>L(a=>({...a,profile:e.target.value||void 0}))})]})]})]}),h.length>0&&s.jsxs("div",{className:"spawn-skills-section",children:[s.jsxs("label",{className:"spawn-label",children:[n("terminal:spawn.skills")," ",s.jsxs("span",{className:"spawn-label-hint",children:["(",n("common:labels.optional"),")"]}),s.jsx(x,{text:n("terminal:spawn.helpSkills"),title:n("terminal:spawn.skillsTitle"),position:"top",size:"sm"})]}),h.length>6&&s.jsx("input",{type:"text",className:"spawn-input skill-search-input",placeholder:n("terminal:spawn.filterSkills"),value:A,onChange:e=>Re(e.target.value)}),s.jsxs("div",{className:"spawn-skills-inline",children:[ve.map(e=>{const a=we.has(e.id);return ze.some(d=>d.id===e.id)?null:s.jsxs("button",{className:`spawn-skill-chip ${a?"selected":""}`,onClick:()=>qe(e.id),title:e.description,children:[a&&s.jsx("span",{className:"spawn-skill-check",children:"✓"}),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:n("terminal:spawn.noSkillsMatch",{query:A})})]})]}),s.jsxs("div",{className:"spawn-custom-instructions-section",children:[s.jsxs("label",{className:"spawn-label",children:[n("terminal:spawn.customInstructions")," ",s.jsxs("span",{className:"spawn-label-hint",children:["(",n("common:labels.optional"),")"]}),s.jsx(x,{text:n("terminal:spawn.helpCustomInstructions"),title:n("terminal:spawn.customInstructions"),position:"top",size:"sm"})]}),s.jsx("textarea",{className:"spawn-input spawn-textarea",placeholder:n("terminal:spawn.customInstructionsPlaceholder"),value:je,onChange:e=>Fe(e.target.value),rows:3})]}),s.jsxs("div",{className:"spawn-sessions-section",children:[s.jsxs("label",{className:"spawn-label",children:[n("terminal:spawn.linkSession")," ",s.jsxs("span",{className:"spawn-label-hint",children:["(",n("common:labels.optional"),")"]}),s.jsx(x,{text:n("terminal:spawn.helpLinkSession"),title:n("terminal:spawn.linkSessionTitle"),position:"top",size:"sm"})]}),k.length>0&&s.jsx("input",{type:"text",className:"spawn-input session-search-input",placeholder:n("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:n("terminal:spawn.loadingSessions")}):k.length===0?s.jsx("div",{className:"sessions-empty",children:n("terminal:spawn.noSessions")}):Ne.length===0?s.jsx("div",{className:"sessions-empty",children:n("terminal:spawn.noSessionsMatch",{query:E})}):Ne.map(e=>{const a=y===e.sessionId,l=Date.now()-new Date(e.lastModified).getTime(),d=l<6e4?n("common:time.justNow"):l<36e5?n("common:time.minutesAgo",{count:Math.floor(l/6e4)}):l<864e5?n("common:time.hoursAgo",{count:Math.floor(l/36e5)}):n("common:time.daysAgo",{count:Math.floor(l/864e5)});return s.jsxs("div",{className:`session-item ${a?"selected":""}`,onClick:()=>{a?F(null):(F(e.sessionId),P(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||n("terminal:spawn.messagesCount",{count:e.messageCount})})]},e.sessionId)})})]})]})]}),s.jsxs("div",{className:"modal-footer",children:[s.jsx("button",{className:"btn btn-secondary",onClick:j,children:n("common:buttons.cancel")}),s.jsx("button",{className:"btn btn-primary",onClick:Ke,disabled:re,children:n(re?"common:buttons.deploying":"common:buttons2.deploy")})]})]})})}export{ms as SpawnModal};
|
|
1
|
+
import{u as Xe,H as Ve,L as Ze,M as Qe,N as es,O as ss,r as t,P as ns,S as ke,U as te,A as ye,w as le,V as as,s as B,h as ts,j as s,W as ls,X as x,Y as os,Z as oe,_ as G,$ as K,a0 as ie,a1 as is}from"./main-BL6u5aPD.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";function Ae(c,j){const S=j.filter(b=>!c.has(b));return S.length===0?`${j[Math.floor(Math.random()*j.length)]}-${Date.now()%1e3}`:S[Math.floor(Math.random()*S.length)]}function ms({isOpen:c,onClose:j,onSpawnStart:S,onSpawnEnd:b,spawnPosition:De,spawnAreaId:v}){const{t:n}=Xe(["terminal","common"]),C=Ve(),$=Ze(),p=Qe(),ce=es(),H=ce.length>0?ce:ss,[m,N]=t.useState(""),[M,P]=t.useState(()=>ns(ke.LAST_CWD)),[i,Y]=t.useState("scout"),[re,D]=t.useState(!1),[Ee,T]=t.useState(!1),[de,J]=t.useState(!1),[pe,me]=t.useState(""),[k,X]=t.useState([]),[y,F]=t.useState(null),[Le,ue]=t.useState(!1),[E,he]=t.useState(""),[u,_e]=t.useState(""),[R,Ie]=t.useState(!0),[U,$e]=t.useState("bypass"),[o,V]=t.useState("claude"),[g,L]=t.useState({fullAuto:!0,sandbox:"workspace-write",approvalMode:"on-request",search:!1}),[we,Z]=t.useState(new Set),[Q,xe]=t.useState("opus"),[ee,fe]=t.useState("high"),[se,Pe]=t.useState("gpt-5.3-codex"),[ne,Te]=t.useState("minimax/MiniMax-M1-80k"),[je,Fe]=t.useState(""),[A,Re]=t.useState(""),q=t.useRef(null),ge=t.useRef(!1),_=t.useCallback(()=>{window.__spawnModalAreaContext=null},[]),h=t.useMemo(()=>$.filter(e=>e.enabled),[$]),Ue=["full-notifications","streaming-exec","task-label","report-task-to-boss"];t.useEffect(()=>{if(c&&!ge.current&&h.length>0){const a=h.filter(l=>Ue.includes(l.slug)).map(l=>l.id);a.length>0&&Z(new Set(a))}ge.current=c},[c,h]);const ve=t.useMemo(()=>{if(!A.trim())return h;const e=A.toLowerCase();return h.filter(a=>a.name.toLowerCase().includes(e)||a.description.toLowerCase().includes(e)||a.slug.toLowerCase().includes(e))},[h,A]),qe=t.useCallback(e=>{Z(a=>{const l=new Set(a);return l.has(e)?l.delete(e):l.add(e),l})},[]);t.useMemo(()=>h.filter(e=>e.assignedAgentClasses.includes(i)),[h,i]);const ze=t.useMemo(()=>{var a;const e=p.find(l=>l.id===i);return(a=e==null?void 0:e.defaultSkillIds)!=null&&a.length?$.filter(l=>e.defaultSkillIds.includes(l.id)):[]},[p,i,$]),Ne=t.useMemo(()=>{if(!E.trim())return k;const e=E.toLowerCase();return k.filter(a=>a.sessionId.toLowerCase().includes(e)||a.projectPath.toLowerCase().includes(e)||a.firstMessage&&a.firstMessage.toLowerCase().includes(e))},[k,E]),z=t.useMemo(()=>{if(!u.trim())return p;const e=u.toLowerCase();return p.filter(a=>a.name.toLowerCase().includes(e)||a.description.toLowerCase().includes(e)||a.id.toLowerCase().includes(e))},[p,u]),W=t.useMemo(()=>{if(!u.trim())return te;const e=u.toLowerCase();return te.filter(a=>{const l=ye[a.id];return a.name.toLowerCase().includes(e)||a.id.toLowerCase().includes(e)||l.description.toLowerCase().includes(e)})},[u]);t.useEffect(()=>{if(!c||!u.trim())return;const e=[...z.map(a=>a.id),...W.map(a=>a.id)];e.length===1&&e[0]!==i&&Y(e[0])},[c,u,z,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]),Oe=t.useMemo(()=>{if(r!=null&&r.customModelPath)return le(`/api/custom-models/${r.id}`)},[r]),Be=r==null?void 0:r.modelScale,Ge=t.useMemo(()=>r?"scout":i,[i,r]),O=t.useCallback(async e=>{ue(!0);try{const a=e?le(`/api/agents/claude-sessions?cwd=${encodeURIComponent(e)}`):le("/api/agents/claude-sessions"),d=await(await as(a)).json();X(d.sessions||[])}catch(a){console.error("Failed to fetch sessions:",a),X([])}finally{ue(!1)}},[]);t.useEffect(()=>{c?O(M||void 0):(X([]),F(null),he(""))},[c,O]),t.useEffect(()=>{if(!c)return;const e=setTimeout(()=>{O(M||void 0),F(null)},300);return()=>clearTimeout(e)},[M,c,O]),t.useEffect(()=>{if(!c||!v)return;const e=B.getState().areas.get(v);if(e!=null&&e.directories&&e.directories.length>0){P(e.directories[0]);return}const a=Array.from(C.values()).filter(f=>{var I;return((I=B.getAreaForAgent(f.id))==null?void 0:I.id)===v&&f.cwd});if(a.length===0)return;const l=new Map;for(const f of a)l.set(f.cwd,(l.get(f.cwd)||0)+1);let d="",w=0;for(const[f,I]of l)I>w&&(d=f,w=I);d&&P(d)},[c,v,C]),t.useEffect(()=>{if(c){const e=new Set(Array.from(C.values()).map(w=>w.name)),a=Ae(e,H),l=p.find(w=>w.id===i),d=l?`${l.name} ${a}`:a;N(d),q.current&&(q.current.focus(),q.current.select())}},[c,C,H]),t.useEffect(()=>{if(!c)return;new Set(Array.from(C.values()).map(a=>a.name));const e=p.find(a=>a.id===i);if(e){const a=p.find(l=>m.startsWith(l.name+" "));if(a){const l=m.substring(a.name.length+1);N(`${e.name} ${l}`)}else N(`${e.name} ${m}`)}else{const a=p.find(l=>m.startsWith(l.name+" "));if(a){const l=m.substring(a.name.length+1);N(l)}}},[i]),t.useEffect(()=>{i==="boss"&&xe("opus")},[i]);const Ke=()=>{var d;console.log("[SpawnModal] handleSpawn called"),T(!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:",R),console.log("[SpawnModal] Session ID:",y||"none"),!e.trim()){console.error("[SpawnModal] Empty CWD, showing error"),T(!0);return}if(!m.trim()){console.log("[SpawnModal] Empty name, regenerating");const w=new Set(Array.from(C.values()).map(f=>f.name));N(Ae(w,H));return}is(ke.LAST_CWD,e),D(!0),S();const a=Array.from(we),l=je.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"?R:!1,permissionMode:U,provider:o,codexConfig:o==="codex"?g:void 0,codexModel:o==="codex"?se:void 0,opencodeModel:o==="opencode"?ne:void 0,initialSkillIds:a,model:o==="claude"?Q: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(),De||void 0,y||void 0,o==="claude"?R:!1,U,a,o,o==="codex"?g:void 0,o==="codex"?se:void 0,o==="claude"?Q:void 0,l,o==="claude"?ee:void 0,o==="opencode"?ne:void 0)},Se=()=>{console.log("[SpawnModal] Agent creation successful"),D(!1),N(""),Z(new Set),_(),b(),j()},be=()=>{console.error("[SpawnModal] Agent creation failed"),D(!1),T(!0),_(),b()},Ce=e=>{console.log("[SpawnModal] Directory not found:",e),D(!1),me(e),J(!0),b()},Me=()=>{J(!1),D(!0),S(),B.createDirectoryAndSpawn(pe,m.trim(),i)},ae=()=>{J(!1),me(""),_()};t.useEffect(()=>(window.__spawnModalSuccess=Se,window.__spawnModalError=be,window.__spawnModalDirNotFound=Ce,()=>{_(),delete window.__spawnModalSuccess,delete window.__spawnModalError,delete window.__spawnModalDirNotFound}),[m,i,Se,be,Ce,_]);const{handleMouseDown:He,handleClick:Ye}=ts(j),Je=e=>{e.key==="Escape"&&j()};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:n("terminal:spawn.directoryNotFound")}),s.jsxs("div",{className:"modal-body confirm-modal-body",children:[s.jsx("p",{children:n("terminal:spawn.directoryNotExist")}),s.jsx("code",{className:"confirm-modal-path",children:pe}),s.jsx("p",{children:n("terminal:spawn.wouldYouCreate")})]}),s.jsxs("div",{className:"modal-footer",children:[s.jsx("button",{className:"btn btn-secondary",onClick:ae,children:n("common:buttons.cancel")}),s.jsx("button",{className:"btn btn-primary",onClick:Me,autoFocus:!0,children:n("terminal:spawn.createDirectory")})]})]})}):s.jsx("div",{className:`modal-overlay ${c?"visible":""}`,onMouseDown:He,onClick:Ye,onKeyDown:Je,children:s.jsxs("div",{className:"modal spawn-modal",children:[s.jsx("div",{className:"modal-header",children:n("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:Ge,modelFile:We,customModelUrl:Oe,modelScale:Be,width:100,height:120})}),s.jsxs("div",{className:"spawn-class-section",children:[s.jsx("div",{className:"spawn-class-label",children:n("terminal:spawn.agentClass")}),p.length+te.length>6&&s.jsx("input",{type:"text",className:"spawn-input class-search-input",placeholder:n("terminal:spawn.filterClasses"),value:u,onChange:e=>_e(e.target.value)}),s.jsxs("div",{className:"class-selector-inline",children:[z.map(e=>s.jsxs("button",{className:`class-chip ${i===e.id?"selected":""}`,onClick:()=>Y(e.id),title:e.description,children:[s.jsx("span",{className:"class-chip-icon",children:e.icon}),s.jsx("span",{className:"class-chip-name",children:e.name})]},e.id)),W.map(e=>{const a=ye[e.id];return s.jsxs("button",{className:`class-chip ${i===e.id?"selected":""}`,onClick:()=>Y(e.id),title:a.description,children:[s.jsx("span",{className:"class-chip-icon",children:a.icon}),s.jsx("span",{className:"class-chip-name",children:e.name})]},e.id)}),u&&z.length===0&&W.length===0&&s.jsx("div",{className:"class-search-empty",children:n("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:n("common:labels.name")}),s.jsx("input",{ref:q,type:"text",className:"spawn-input",placeholder:n("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:[n("terminal:spawn.workingDir"),s.jsx(x,{text:n("terminal:spawn.helpWorkingDir"),title:n("terminal:spawn.workingDir"),position:"top",size:"sm"})]}),s.jsx(os,{value:M,onChange:e=>{P(e),T(!1)},placeholder:n("terminal:spawn.workingDirPlaceholder"),className:`spawn-input ${Ee?"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:[n("terminal:spawn.selectRuntime"),s.jsx(x,{text:n("terminal:spawn.helpRuntime"),title:n("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:()=>V("claude"),title:n("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:()=>V("codex"),title:n("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:()=>V("opencode"),title:"Use OpenCode CLI (multi-provider)",children:[s.jsx("span",{children:"🟢"}),s.jsx("span",{children:"OpenCode"})]})]})]}),s.jsxs("div",{className:"spawn-field",children:[s.jsxs("label",{className:"spawn-label",children:[n("common:labels.permissions"),s.jsx(x,{text:n("terminal:spawn.helpPermission"),title:n("terminal:spawn.permissionMode"),position:"top",size:"sm"})]}),s.jsx("div",{className:"spawn-select-row",children:Object.keys(oe).map(e=>s.jsxs("button",{className:`spawn-select-btn ${U===e?"selected":""}`,onClick:()=>$e(e),title:oe[e].description,children:[s.jsx("span",{children:e==="bypass"?"⚡":"🔐"}),s.jsx("span",{children:oe[e].label})]},e))})]})]}),s.jsxs("div",{className:"spawn-form-row",children:[s.jsxs("div",{className:"spawn-field",children:[s.jsxs("label",{className:"spawn-label",children:[n("common:labels.model"),s.jsx(x,{text:n("terminal:spawn.helpModel"),title:n("terminal:spawn.modelTitle"),position:"top",size:"sm"})]}),o==="claude"?s.jsx("div",{className:"spawn-select-row",children:Object.keys(G).map(e=>s.jsxs("button",{className:`spawn-select-btn ${Q===e?"selected":""}`,onClick:()=>xe(e),title:G[e].description,children:[s.jsx("span",{children:G[e].icon}),s.jsx("span",{children:G[e].label})]},e))}):o==="codex"?s.jsx("div",{className:"spawn-select-row spawn-select-row--codex-models",children:Object.keys(K).map(e=>s.jsxs("button",{className:`spawn-select-btn ${se===e?"selected":""}`,onClick:()=>Pe(e),title:K[e].description,children:[s.jsx("span",{children:K[e].icon}),s.jsx("span",{children:K[e].label})]},e))}):o==="opencode"?s.jsx("input",{type:"text",className:"spawn-input",value:ne,onChange:e=>Te(e.target.value),placeholder:"provider/model (e.g., minimax/MiniMax-M1-80k)"}):s.jsx("div",{className:"spawn-inline-hint",children:n("terminal:spawn.chooseCodexModel")})]}),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 ${ee===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 ${ee===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:n("terminal:spawn.browser")}),s.jsx("div",{className:"spawn-form-row spawn-options-row",children:s.jsxs("label",{className:"spawn-checkbox",children:[s.jsx("input",{type:"checkbox",checked:R,onChange:e=>Ie(e.target.checked),disabled:o!=="claude"}),s.jsxs("span",{children:["🌐 ",n("terminal:spawn.chromeBrowser")]}),s.jsx(x,{text:n(o==="claude"?"terminal:spawn.helpChrome":"terminal:spawn.helpChromeDisabled"),title:n("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:n("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:g.fullAuto!==!1,onChange:e=>L(a=>({...a,fullAuto:e.target.checked}))}),s.jsx("span",{children:n("terminal:spawn.codex.fullAuto")}),s.jsx(x,{text:n("terminal:spawn.helpFullAuto"),title:n("terminal:spawn.fullAutoTitle"),position:"top",size:"sm"})]}),s.jsxs("label",{className:"spawn-checkbox",children:[s.jsx("input",{type:"checkbox",checked:!!g.search,onChange:e=>L(a=>({...a,search:e.target.checked}))}),s.jsx("span",{children:n("terminal:spawn.codex.search")}),s.jsx(x,{text:n("terminal:spawn.helpSearch"),title:n("terminal:spawn.searchTitle"),position:"top",size:"sm"})]})]}),g.fullAuto===!1&&s.jsxs("div",{className:"codex-option-group",children:[s.jsx("div",{className:"codex-option-header",children:n("terminal:spawn.codex.restrictions")}),s.jsxs("select",{className:"spawn-input codex-select",value:g.sandbox||"workspace-write",onChange:e=>L(a=>({...a,sandbox:e.target.value})),children:[s.jsxs("option",{value:"read-only",children:["📖 ",n("terminal:spawn.codex.sandboxReadOnly")]}),s.jsxs("option",{value:"workspace-write",children:["✏️ ",n("terminal:spawn.codex.sandboxWorkspaceWrite")]}),s.jsxs("option",{value:"danger-full-access",children:["⚡ ",n("terminal:spawn.codex.sandboxDangerFullAccess")]})]}),s.jsxs("select",{className:"spawn-input codex-select",value:g.approvalMode||"on-request",onChange:e=>L(a=>({...a,approvalMode:e.target.value})),children:[s.jsxs("option",{value:"untrusted",children:["🔒 ",n("terminal:spawn.codex.approvalsUntrusted")]}),s.jsxs("option",{value:"on-failure",children:["⚠️ ",n("terminal:spawn.codex.approvalsOnFailure")]}),s.jsxs("option",{value:"on-request",children:["🤔 ",n("terminal:spawn.codex.approvalsOnRequest")]}),s.jsxs("option",{value:"never",children:["✅ ",n("terminal:spawn.codex.approvalsNever")]})]})]}),s.jsxs("div",{className:"codex-option-group",children:[s.jsx("div",{className:"codex-option-header",children:n("terminal:spawn.codex.profile")}),s.jsx("input",{type:"text",className:"spawn-input codex-profile-input",placeholder:n("terminal:spawn.codex.profilePlaceholder"),value:g.profile||"",onChange:e=>L(a=>({...a,profile:e.target.value||void 0}))})]})]})]}),h.length>0&&s.jsxs("div",{className:"spawn-skills-section",children:[s.jsxs("label",{className:"spawn-label",children:[n("terminal:spawn.skills")," ",s.jsxs("span",{className:"spawn-label-hint",children:["(",n("common:labels.optional"),")"]}),s.jsx(x,{text:n("terminal:spawn.helpSkills"),title:n("terminal:spawn.skillsTitle"),position:"top",size:"sm"})]}),h.length>6&&s.jsx("input",{type:"text",className:"spawn-input skill-search-input",placeholder:n("terminal:spawn.filterSkills"),value:A,onChange:e=>Re(e.target.value)}),s.jsxs("div",{className:"spawn-skills-inline",children:[ve.map(e=>{const a=we.has(e.id);return ze.some(d=>d.id===e.id)?null:s.jsxs("button",{className:`spawn-skill-chip ${a?"selected":""}`,onClick:()=>qe(e.id),title:e.description,children:[a&&s.jsx("span",{className:"spawn-skill-check",children:"✓"}),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:n("terminal:spawn.noSkillsMatch",{query:A})})]})]}),s.jsxs("div",{className:"spawn-custom-instructions-section",children:[s.jsxs("label",{className:"spawn-label",children:[n("terminal:spawn.customInstructions")," ",s.jsxs("span",{className:"spawn-label-hint",children:["(",n("common:labels.optional"),")"]}),s.jsx(x,{text:n("terminal:spawn.helpCustomInstructions"),title:n("terminal:spawn.customInstructions"),position:"top",size:"sm"})]}),s.jsx("textarea",{className:"spawn-input spawn-textarea",placeholder:n("terminal:spawn.customInstructionsPlaceholder"),value:je,onChange:e=>Fe(e.target.value),rows:3})]}),s.jsxs("div",{className:"spawn-sessions-section",children:[s.jsxs("label",{className:"spawn-label",children:[n("terminal:spawn.linkSession")," ",s.jsxs("span",{className:"spawn-label-hint",children:["(",n("common:labels.optional"),")"]}),s.jsx(x,{text:n("terminal:spawn.helpLinkSession"),title:n("terminal:spawn.linkSessionTitle"),position:"top",size:"sm"})]}),k.length>0&&s.jsx("input",{type:"text",className:"spawn-input session-search-input",placeholder:n("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:n("terminal:spawn.loadingSessions")}):k.length===0?s.jsx("div",{className:"sessions-empty",children:n("terminal:spawn.noSessions")}):Ne.length===0?s.jsx("div",{className:"sessions-empty",children:n("terminal:spawn.noSessionsMatch",{query:E})}):Ne.map(e=>{const a=y===e.sessionId,l=Date.now()-new Date(e.lastModified).getTime(),d=l<6e4?n("common:time.justNow"):l<36e5?n("common:time.minutesAgo",{count:Math.floor(l/6e4)}):l<864e5?n("common:time.hoursAgo",{count:Math.floor(l/36e5)}):n("common:time.daysAgo",{count:Math.floor(l/864e5)});return s.jsxs("div",{className:`session-item ${a?"selected":""}`,onClick:()=>{a?F(null):(F(e.sessionId),P(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||n("terminal:spawn.messagesCount",{count:e.messageCount})})]},e.sessionId)})})]})]})]}),s.jsxs("div",{className:"modal-footer",children:[s.jsx("button",{className:"btn btn-secondary",onClick:j,children:n("common:buttons.cancel")}),s.jsx("button",{className:"btn btn-primary",onClick:Ke,disabled:re,children:n(re?"common:buttons.deploying":"common:buttons2.deploy")})]})]})})}export{ms as SpawnModal};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as I,H as L,a4 as $,r as m,j as s,a2 as f,s as D}from"./main-
|
|
1
|
+
import{u as I,H as L,a4 as $,r as m,j as s,a2 as f,s as D}from"./main-BL6u5aPD.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";function G({isOpen:o,bossId:c,onClose:l}){var j;const{t:a}=I(["terminal","common"]),g=L(),n=$(c),[i,r]=m.useState(new Set),[u,b]=m.useState(!1),d=Array.from(g.values()).filter(e=>e.class!=="boss"&&(!e.bossId||e.bossId===c));m.useEffect(()=>{o&&n&&r(new Set(n.subordinateIds||[]))},[o,n]);const p=()=>{b(!0),D.assignSubordinates(c,Array.from(i)),setTimeout(()=>{b(!1),l()},300)},y=e=>{const t=new Set(i);t.has(e)?t.delete(e):t.add(e),r(t)},A=()=>{r(new Set(d.map(e=>e.id)))},C=()=>{r(new Set)},w=e=>{e.target===e.currentTarget&&l()},k=e=>{e.key==="Escape"&&l()};if(!o||!n)return null;const h=f.boss,v=((j=n.subordinateIds)==null?void 0:j.length)||0,E=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:h.color},children:h.icon}),a("terminal:supervisor.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:supervisor.selectAgents")}),s.jsxs("div",{className:"subordinate-assignment-actions",children:[s.jsx("button",{className:"btn btn-small",onClick:A,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:supervisor.noAgentsAvailable")}):d.map(e=>{var S;const t=i.has(e.id),N=f[e.class],T=(S=n.subordinateIds)==null?void 0:S.includes(e.id);return s.jsxs("div",{className:`subordinate-item ${t?"selected":""}`,onClick:()=>y(e.id),children:[s.jsx("div",{className:"subordinate-checkbox",children:t?"✓":""}),s.jsx("div",{className:"subordinate-icon",style:{color:N.color},children:N.icon}),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}),T&&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:[v," → ",E," ",a("terminal:supervisor.subordinates").toLowerCase()]}):s.jsxs("span",{className:"summary-unchanged",children:[v," ",a("terminal:supervisor.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:p,disabled:u||!x,children:a(u?"common:status.saving":"terminal:supervisor.saveTeam")})]})]})})}export{G as SubordinateAssignmentModal};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as c,f as b,aH as y,aI as k,j as s,s as o}from"./main-
|
|
1
|
+
import{u as c,f as b,aH as y,aI as k,j as s,s as o}from"./main-BL6u5aPD.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";function h(e){const a=Math.floor((Date.now()-e)/1e3);if(a<60)return`${a}s ago`;const r=Math.floor(a/60);return r<60?`${r}m ago`:`${Math.floor(r/60)}h ago`}function M({isOpen:e,onClose:a}){const{t:r}=c(["terminal","common"]),n=b(),{lastReport:l,enabled:i,lastReportTime:d,generatingReport:m,autoReportOnComplete:t}=n.supervisor,v=y(),x=k(),p=()=>{o.requestSupervisorReport()},j=()=>{o.setSupervisorConfig({enabled:!i})},g=()=>{o.setSupervisorConfig({autoReportOnComplete:!t})},N=()=>{o.requestGlobalUsage()};return e?s.jsx("div",{className:"supervisor-panel-overlay",onClick:a,children:s.jsxs("div",{className:"supervisor-panel",onClick:f=>f.stopPropagation(),children:[s.jsxs("div",{className:"supervisor-header",children:[s.jsxs("h2",{className:"supervisor-title",children:[s.jsx("span",{className:"supervisor-icon",children:"🎖️"}),r("terminal:supervisor.overview")]}),s.jsxs("div",{className:"supervisor-controls",children:[s.jsx("button",{className:`supervisor-toggle ${i?"active":""}`,onClick:j,title:i?"Disable supervisor":"Enable supervisor",children:i?`● ${r("terminal:supervisor.active")}`:`○ ${r("terminal:supervisor.paused")}`}),s.jsx("button",{className:`supervisor-toggle auto-report ${t?"active":""}`,onClick:g,title:t?"Disable auto-report on task complete":"Enable auto-report on task complete",children:t?`⚡ ${r("terminal:supervisor.auto")}`:`◇ ${r("terminal:supervisor.manual")}`}),s.jsx("button",{className:"supervisor-refresh",onClick:p,disabled:m,children:m?r("terminal:supervisor.generating"):`↻ ${r("common:buttons.refresh")}`}),s.jsx("button",{className:"supervisor-close",onClick:a,children:"×"})]})]}),s.jsx(R,{usage:v,refreshing:x,onRefresh:N}),m?s.jsxs("div",{className:"supervisor-loading",children:[s.jsx("div",{className:"supervisor-loading-spinner"}),s.jsx("p",{children:r("terminal:supervisor.generatingReport")})]}):l?s.jsx(S,{report:l}):s.jsxs("div",{className:"supervisor-empty",children:[s.jsx("p",{children:r("terminal:supervisor.noReportYet")}),s.jsx("button",{onClick:p,children:r("terminal:supervisor.generateFirstReport")})]}),s.jsxs("div",{className:"supervisor-footer",children:[d&&s.jsx("span",{children:r("terminal:supervisor.lastReport",{time:h(d)})}),i&&t&&s.jsx("span",{children:r("terminal:supervisor.autoUpdatesOnComplete")}),i&&!t&&s.jsx("span",{children:r("terminal:supervisor.manualUpdatesOnly")})]})]})}):null}function S({report:e}){const{t:a}=c(["terminal"]);return s.jsxs("div",{className:"supervisor-report",children:[s.jsxs("div",{className:`supervisor-status-banner ${e.overallStatus}`,children:[s.jsx("span",{className:"status-icon",children:e.overallStatus==="healthy"?"✓":e.overallStatus==="attention_needed"?"⚠":"!"}),s.jsx("span",{className:"status-text",children:e.overallStatus==="healthy"?a("terminal:supervisor.allSystemsHealthy"):e.overallStatus==="attention_needed"?a("terminal:supervisor.attentionNeeded"):a("terminal:supervisor.criticalIssues")})]}),e.insights.length>0&&s.jsxs("div",{className:"supervisor-section",children:[s.jsx("h3",{children:a("terminal:supervisor.keyInsights")}),s.jsx("ul",{className:"supervisor-insights",children:e.insights.map((r,n)=>s.jsx("li",{children:r},n))})]}),s.jsxs("div",{className:"supervisor-section",children:[s.jsx("h3",{children:a("terminal:supervisor.agentStatus")}),s.jsx("div",{className:"supervisor-agents",children:e.agentSummaries.map(r=>s.jsx(U,{agent:r},r.agentId))})]}),e.recommendations.length>0&&s.jsxs("div",{className:"supervisor-section",children:[s.jsx("h3",{children:a("terminal:supervisor.recommendations")}),s.jsx("ul",{className:"supervisor-recommendations",children:e.recommendations.map((r,n)=>s.jsx("li",{children:r},n))})]})]})}function U({agent:e}){const a={on_track:"#4aff9e",stalled:"#ff9e4a",blocked:"#ff4a4a",completed:"#4a9eff",idle:"#888"};return s.jsxs("div",{className:"agent-summary-card",children:[s.jsxs("div",{className:"agent-summary-header",children:[s.jsx("span",{className:"agent-summary-name",children:e.agentName}),s.jsx("span",{className:"agent-summary-progress",style:{color:a[e.progress]||"#888"},children:e.progress.replace("_"," ")})]}),s.jsx("p",{className:"agent-summary-status",children:e.statusDescription}),s.jsx("p",{className:"agent-summary-work",children:e.recentWorkSummary}),e.concerns&&e.concerns.length>0&&s.jsx("div",{className:"agent-summary-concerns",children:e.concerns.map((r,n)=>s.jsxs("span",{className:"concern-tag",children:["⚠ ",r]},n))})]})}function C(e){return e<50?"#4aff9e":e<75?"#ff9e4a":"#ff4a4a"}function R({usage:e,refreshing:a,onRefresh:r}){const{t:n}=c(["terminal","common"]);return s.jsxs("div",{className:"supervisor-section usage-section",children:[s.jsxs("div",{className:"usage-header",children:[s.jsx("h3",{children:n("terminal:supervisor.claudeApiUsage")}),s.jsx("button",{className:"usage-refresh-btn",onClick:r,disabled:a,title:"Refresh usage stats",children:a?"...":"↻"})]}),e?s.jsxs("div",{className:"usage-grid",children:[s.jsx(u,{label:n("terminal:supervisor.session"),percent:e.session.percentUsed,resetTime:e.session.resetTime}),s.jsx(u,{label:n("terminal:supervisor.weeklyAll"),percent:e.weeklyAllModels.percentUsed,resetTime:e.weeklyAllModels.resetTime}),s.jsx(u,{label:n("terminal:supervisor.weeklySonnet"),percent:e.weeklySonnet.percentUsed,resetTime:e.weeklySonnet.resetTime}),s.jsxs("div",{className:"usage-source",children:["via ",e.sourceAgentName," · ",h(e.lastUpdated)]})]}):s.jsxs("div",{className:"usage-empty",children:[s.jsx("p",{children:n("terminal:supervisor.noUsageData")}),s.jsx("button",{onClick:r,disabled:a,children:n(a?"terminal:supervisor.fetching":"common:buttons2.fetchUsage")})]})]})}function u({label:e,percent:a,resetTime:r}){const{t:n}=c(["terminal"]),l=C(a),i=Math.min(a,100);return s.jsxs("div",{className:"usage-bar-container",children:[s.jsxs("div",{className:"usage-bar-label",children:[s.jsx("span",{children:e}),s.jsxs("span",{className:"usage-percent",style:{color:l},children:[a.toFixed(1),"%"]})]}),s.jsx("div",{className:"usage-bar-track",children:s.jsx("div",{className:"usage-bar-fill",style:{width:`${i}%`,backgroundColor:l}})}),s.jsx("div",{className:"usage-bar-reset",children:n("terminal:supervisor.resets",{time:r})})]})}export{M as SupervisorPanel};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{H as ce,r as n,V as h,w as p,j as e}from"./main-
|
|
1
|
+
import{H as ce,r as n,V as h,w as p,j as e}from"./main-BL6u5aPD.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:((V=s.config)==null?void 0:V.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:(($=s.llmMatch)==null?void 0:$.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,V as M,w as P,j as e,H as J}from"./main-
|
|
1
|
+
import{r as x,V as M,w as P,j as e,H as J}from"./main-BL6u5aPD.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{a2 as se,H as ne,J as ie,I as re,b7 as ce,r as g,s as O,b8 as bt,z as pt,u as Mt,j as m}from"./main-BSyGZK2z.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";function et(e){return Array.isArray?Array.isArray(e):zt(e)==="[object Array]"}function oe(e){if(typeof e=="string")return e;let t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function ae(e){return e==null?"":oe(e)}function X(e){return typeof e=="string"}function Qt(e){return typeof e=="number"}function ue(e){return e===!0||e===!1||le(e)&&zt(e)=="[object Boolean]"}function Wt(e){return typeof e=="object"}function le(e){return Wt(e)&&e!==null}function H(e){return e!=null}function gt(e){return!e.trim().length}function zt(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const he="Incorrect 'index' type",de=e=>`Invalid value for key ${e}`,fe=e=>`Pattern length exceeds max of ${e}.`,me=e=>`Missing ${e} property in key`,pe=e=>`Property 'weight' in key '${e}' must be a positive integer`,Rt=Object.prototype.hasOwnProperty;class ge{constructor(t){this._keys=[],this._keyMap={};let s=0;t.forEach(n=>{let i=Vt(n);this._keys.push(i),this._keyMap[i.id]=i,s+=i.weight}),this._keys.forEach(n=>{n.weight/=s})}get(t){return this._keyMap[t]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function Vt(e){let t=null,s=null,n=null,i=1,c=null;if(X(e)||et(e))n=e,t=_t(e),s=yt(e);else{if(!Rt.call(e,"name"))throw new Error(me("name"));const o=e.name;if(n=o,Rt.call(e,"weight")&&(i=e.weight,i<=0))throw new Error(pe(o));t=_t(o),s=yt(o),c=e.getFn}return{path:t,id:s,weight:i,src:n,getFn:c}}function _t(e){return et(e)?e:e.split(".")}function yt(e){return et(e)?e.join("."):e}function ye(e,t){let s=[],n=!1;const i=(c,o,a)=>{if(H(c))if(!o[a])s.push(c);else{let u=o[a];const l=c[u];if(!H(l))return;if(a===o.length-1&&(X(l)||Qt(l)||ue(l)))s.push(ae(l));else if(et(l)){n=!0;for(let d=0,h=l.length;d<h;d+=1)i(l[d],o,a+1)}else o.length&&i(l,o,a+1)}};return i(e,X(t)?t.split("."):t,0),n?s:s[0]}const Ae={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},xe={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1},Ee={location:0,threshold:.6,distance:100},Ce={useExtendedSearch:!1,getFn:ye,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var p={...xe,...Ae,...Ee,...Ce};const Fe=/[^ ]+/g;function Me(e=1,t=3){const s=new Map,n=Math.pow(10,t);return{get(i){const c=i.match(Fe).length;if(s.has(c))return s.get(c);const o=1/Math.pow(c,.5*e),a=parseFloat(Math.round(o*n)/n);return s.set(c,a),a},clear(){s.clear()}}}class wt{constructor({getFn:t=p.getFn,fieldNormWeight:s=p.fieldNormWeight}={}){this.norm=Me(s,3),this.getFn=t,this.isCreated=!1,this.setIndexRecords()}setSources(t=[]){this.docs=t}setIndexRecords(t=[]){this.records=t}setKeys(t=[]){this.keys=t,this._keysMap={},t.forEach((s,n)=>{this._keysMap[s.id]=n})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,X(this.docs[0])?this.docs.forEach((t,s)=>{this._addString(t,s)}):this.docs.forEach((t,s)=>{this._addObject(t,s)}),this.norm.clear())}add(t){const s=this.size();X(t)?this._addString(t,s):this._addObject(t,s)}removeAt(t){this.records.splice(t,1);for(let s=t,n=this.size();s<n;s+=1)this.records[s].i-=1}getValueForItemAtKeyId(t,s){return t[this._keysMap[s]]}size(){return this.records.length}_addString(t,s){if(!H(t)||gt(t))return;let n={v:t,i:s,n:this.norm.get(t)};this.records.push(n)}_addObject(t,s){let n={i:s,$:{}};this.keys.forEach((i,c)=>{let o=i.getFn?i.getFn(t):this.getFn(t,i.path);if(H(o)){if(et(o)){let a=[];const u=[{nestedArrIndex:-1,value:o}];for(;u.length;){const{nestedArrIndex:l,value:d}=u.pop();if(H(d))if(X(d)&&!gt(d)){let h={v:d,i:l,n:this.norm.get(d)};a.push(h)}else et(d)&&d.forEach((h,f)=>{u.push({nestedArrIndex:f,value:h})})}n.$[c]=a}else if(X(o)&&!gt(o)){let a={v:o,n:this.norm.get(o)};n.$[c]=a}}}),this.records.push(n)}toJSON(){return{keys:this.keys,records:this.records}}}function Ut(e,t,{getFn:s=p.getFn,fieldNormWeight:n=p.fieldNormWeight}={}){const i=new wt({getFn:s,fieldNormWeight:n});return i.setKeys(e.map(Vt)),i.setSources(t),i.create(),i}function we(e,{getFn:t=p.getFn,fieldNormWeight:s=p.fieldNormWeight}={}){const{keys:n,records:i}=e,c=new wt({getFn:t,fieldNormWeight:s});return c.setKeys(n),c.setIndexRecords(i),c}function ht(e,{errors:t=0,currentLocation:s=0,expectedLocation:n=0,distance:i=p.distance,ignoreLocation:c=p.ignoreLocation}={}){const o=t/e.length;if(c)return o;const a=Math.abs(n-s);return i?o+a/i:a?1:o}function ve(e=[],t=p.minMatchCharLength){let s=[],n=-1,i=-1,c=0;for(let o=e.length;c<o;c+=1){let a=e[c];a&&n===-1?n=c:!a&&n!==-1&&(i=c-1,i-n+1>=t&&s.push([n,i]),n=-1)}return e[c-1]&&c-n>=t&&s.push([n,c-1]),s}const ot=32;function De(e,t,s,{location:n=p.location,distance:i=p.distance,threshold:c=p.threshold,findAllMatches:o=p.findAllMatches,minMatchCharLength:a=p.minMatchCharLength,includeMatches:u=p.includeMatches,ignoreLocation:l=p.ignoreLocation}={}){if(t.length>ot)throw new Error(fe(ot));const d=t.length,h=e.length,f=Math.max(0,Math.min(n,h));let y=c,C=f;const k=a>1||u,D=k?Array(h):[];let b;for(;(b=e.indexOf(t,C))>-1;){let S=ht(t,{currentLocation:b,expectedLocation:f,distance:i,ignoreLocation:l});if(y=Math.min(S,y),C=b+d,k){let v=0;for(;v<d;)D[b+v]=1,v+=1}}C=-1;let N=[],z=1,Q=d+h;const at=1<<d-1;for(let S=0;S<d;S+=1){let v=0,j=Q;for(;v<j;)ht(t,{errors:S,currentLocation:f+j,expectedLocation:f,distance:i,ignoreLocation:l})<=y?v=j:Q=j,j=Math.floor((Q-v)/2+v);Q=j;let _=Math.max(1,f-j+1),W=o?h:Math.min(f+j,h)+d,K=Array(W+2);K[W+1]=(1<<S)-1;for(let T=W;T>=_;T-=1){let Z=T-1,ct=s[e.charAt(Z)];if(k&&(D[Z]=+!!ct),K[T]=(K[T+1]<<1|1)&ct,S&&(K[T]|=(N[T+1]|N[T])<<1|1|N[T+1]),K[T]&at&&(z=ht(t,{errors:S,currentLocation:Z,expectedLocation:f,distance:i,ignoreLocation:l}),z<=y)){if(y=z,C=Z,C<=f)break;_=Math.max(1,2*f-C)}}if(ht(t,{errors:S+1,currentLocation:f,expectedLocation:f,distance:i,ignoreLocation:l})>y)break;N=K}const st={isMatch:C>=0,score:Math.max(.001,z)};if(k){const S=ve(D,a);S.length?u&&(st.indices=S):st.isMatch=!1}return st}function Se(e){let t={};for(let s=0,n=e.length;s<n;s+=1){const i=e.charAt(s);t[i]=(t[i]||0)|1<<n-s-1}return t}const dt=String.prototype.normalize?(e=>e.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,"")):(e=>e);class Gt{constructor(t,{location:s=p.location,threshold:n=p.threshold,distance:i=p.distance,includeMatches:c=p.includeMatches,findAllMatches:o=p.findAllMatches,minMatchCharLength:a=p.minMatchCharLength,isCaseSensitive:u=p.isCaseSensitive,ignoreDiacritics:l=p.ignoreDiacritics,ignoreLocation:d=p.ignoreLocation}={}){if(this.options={location:s,threshold:n,distance:i,includeMatches:c,findAllMatches:o,minMatchCharLength:a,isCaseSensitive:u,ignoreDiacritics:l,ignoreLocation:d},t=u?t:t.toLowerCase(),t=l?dt(t):t,this.pattern=t,this.chunks=[],!this.pattern.length)return;const h=(y,C)=>{this.chunks.push({pattern:y,alphabet:Se(y),startIndex:C})},f=this.pattern.length;if(f>ot){let y=0;const C=f%ot,k=f-C;for(;y<k;)h(this.pattern.substr(y,ot),y),y+=ot;if(C){const D=f-ot;h(this.pattern.substr(D),D)}}else h(this.pattern,0)}searchIn(t){const{isCaseSensitive:s,ignoreDiacritics:n,includeMatches:i}=this.options;if(t=s?t:t.toLowerCase(),t=n?dt(t):t,this.pattern===t){let k={isMatch:!0,score:0};return i&&(k.indices=[[0,t.length-1]]),k}const{location:c,distance:o,threshold:a,findAllMatches:u,minMatchCharLength:l,ignoreLocation:d}=this.options;let h=[],f=0,y=!1;this.chunks.forEach(({pattern:k,alphabet:D,startIndex:b})=>{const{isMatch:N,score:z,indices:Q}=De(t,k,D,{location:c+b,distance:o,threshold:a,findAllMatches:u,minMatchCharLength:l,includeMatches:i,ignoreLocation:d});N&&(y=!0),f+=z,N&&Q&&(h=[...h,...Q])});let C={isMatch:y,score:y?f/this.chunks.length:1};return y&&i&&(C.indices=h),C}}class rt{constructor(t){this.pattern=t}static isMultiMatch(t){return Lt(t,this.multiRegex)}static isSingleMatch(t){return Lt(t,this.singleRegex)}search(){}}function Lt(e,t){const s=e.match(t);return s?s[1]:null}class Be extends rt{constructor(t){super(t)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(t){const s=t===this.pattern;return{isMatch:s,score:s?0:1,indices:[0,this.pattern.length-1]}}}class Ie extends rt{constructor(t){super(t)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(t){const n=t.indexOf(this.pattern)===-1;return{isMatch:n,score:n?0:1,indices:[0,t.length-1]}}}class ke extends rt{constructor(t){super(t)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(t){const s=t.startsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,this.pattern.length-1]}}}class $e extends rt{constructor(t){super(t)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(t){const s=!t.startsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,t.length-1]}}}class be extends rt{constructor(t){super(t)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(t){const s=t.endsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[t.length-this.pattern.length,t.length-1]}}}class Re extends rt{constructor(t){super(t)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(t){const s=!t.endsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,t.length-1]}}}class Yt extends rt{constructor(t,{location:s=p.location,threshold:n=p.threshold,distance:i=p.distance,includeMatches:c=p.includeMatches,findAllMatches:o=p.findAllMatches,minMatchCharLength:a=p.minMatchCharLength,isCaseSensitive:u=p.isCaseSensitive,ignoreDiacritics:l=p.ignoreDiacritics,ignoreLocation:d=p.ignoreLocation}={}){super(t),this._bitapSearch=new Gt(t,{location:s,threshold:n,distance:i,includeMatches:c,findAllMatches:o,minMatchCharLength:a,isCaseSensitive:u,ignoreDiacritics:l,ignoreLocation:d})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}}class Jt extends rt{constructor(t){super(t)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(t){let s=0,n;const i=[],c=this.pattern.length;for(;(n=t.indexOf(this.pattern,s))>-1;)s=n+c,i.push([n,s-1]);const o=!!i.length;return{isMatch:o,score:o?0:1,indices:i}}}const At=[Be,Jt,ke,$e,Re,be,Ie,Yt],Nt=At.length,_e=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,Le="|";function Ne(e,t={}){return e.split(Le).map(s=>{let n=s.trim().split(_e).filter(c=>c&&!!c.trim()),i=[];for(let c=0,o=n.length;c<o;c+=1){const a=n[c];let u=!1,l=-1;for(;!u&&++l<Nt;){const d=At[l];let h=d.isMultiMatch(a);h&&(i.push(new d(h,t)),u=!0)}if(!u)for(l=-1;++l<Nt;){const d=At[l];let h=d.isSingleMatch(a);if(h){i.push(new d(h,t));break}}}return i})}const je=new Set([Yt.type,Jt.type]);class Te{constructor(t,{isCaseSensitive:s=p.isCaseSensitive,ignoreDiacritics:n=p.ignoreDiacritics,includeMatches:i=p.includeMatches,minMatchCharLength:c=p.minMatchCharLength,ignoreLocation:o=p.ignoreLocation,findAllMatches:a=p.findAllMatches,location:u=p.location,threshold:l=p.threshold,distance:d=p.distance}={}){this.query=null,this.options={isCaseSensitive:s,ignoreDiacritics:n,includeMatches:i,minMatchCharLength:c,findAllMatches:a,ignoreLocation:o,location:u,threshold:l,distance:d},t=s?t:t.toLowerCase(),t=n?dt(t):t,this.pattern=t,this.query=Ne(this.pattern,this.options)}static condition(t,s){return s.useExtendedSearch}searchIn(t){const s=this.query;if(!s)return{isMatch:!1,score:1};const{includeMatches:n,isCaseSensitive:i,ignoreDiacritics:c}=this.options;t=i?t:t.toLowerCase(),t=c?dt(t):t;let o=0,a=[],u=0;for(let l=0,d=s.length;l<d;l+=1){const h=s[l];a.length=0,o=0;for(let f=0,y=h.length;f<y;f+=1){const C=h[f],{isMatch:k,indices:D,score:b}=C.search(t);if(k){if(o+=1,u+=b,n){const N=C.constructor.type;je.has(N)?a=[...a,...D]:a.push(D)}}else{u=0,o=0,a.length=0;break}}if(o){let f={isMatch:!0,score:u/o};return n&&(f.indices=a),f}}return{isMatch:!1,score:1}}}const xt=[];function Pe(...e){xt.push(...e)}function Et(e,t){for(let s=0,n=xt.length;s<n;s+=1){let i=xt[s];if(i.condition(e,t))return new i(e,t)}return new Gt(e,t)}const ft={AND:"$and",OR:"$or"},Ct={PATH:"$path",PATTERN:"$val"},Ft=e=>!!(e[ft.AND]||e[ft.OR]),Ke=e=>!!e[Ct.PATH],Oe=e=>!et(e)&&Wt(e)&&!Ft(e),jt=e=>({[ft.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function Xt(e,t,{auto:s=!0}={}){const n=i=>{let c=Object.keys(i);const o=Ke(i);if(!o&&c.length>1&&!Ft(i))return n(jt(i));if(Oe(i)){const u=o?i[Ct.PATH]:c[0],l=o?i[Ct.PATTERN]:i[u];if(!X(l))throw new Error(de(u));const d={keyId:yt(u),pattern:l};return s&&(d.searcher=Et(l,t)),d}let a={children:[],operator:c[0]};return c.forEach(u=>{const l=i[u];et(l)&&l.forEach(d=>{a.children.push(n(d))})}),a};return Ft(e)||(e=jt(e)),n(e)}function He(e,{ignoreFieldNorm:t=p.ignoreFieldNorm}){e.forEach(s=>{let n=1;s.matches.forEach(({key:i,norm:c,score:o})=>{const a=i?i.weight:null;n*=Math.pow(o===0&&a?Number.EPSILON:o,(a||1)*(t?1:c))}),s.score=n})}function Qe(e,t){const s=e.matches;t.matches=[],H(s)&&s.forEach(n=>{if(!H(n.indices)||!n.indices.length)return;const{indices:i,value:c}=n;let o={indices:i,value:c};n.key&&(o.key=n.key.src),n.idx>-1&&(o.refIndex=n.idx),t.matches.push(o)})}function We(e,t){t.score=e.score}function ze(e,t,{includeMatches:s=p.includeMatches,includeScore:n=p.includeScore}={}){const i=[];return s&&i.push(Qe),n&&i.push(We),e.map(c=>{const{idx:o}=c,a={item:t[o],refIndex:o};return i.length&&i.forEach(u=>{u(c,a)}),a})}class G{constructor(t,s={},n){this.options={...p,...s},this.options.useExtendedSearch,this._keyStore=new ge(this.options.keys),this.setCollection(t,n)}setCollection(t,s){if(this._docs=t,s&&!(s instanceof wt))throw new Error(he);this._myIndex=s||Ut(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(t){H(t)&&(this._docs.push(t),this._myIndex.add(t))}remove(t=()=>!1){const s=[];for(let n=0,i=this._docs.length;n<i;n+=1){const c=this._docs[n];t(c,n)&&(this.removeAt(n),n-=1,i-=1,s.push(c))}return s}removeAt(t){this._docs.splice(t,1),this._myIndex.removeAt(t)}getIndex(){return this._myIndex}search(t,{limit:s=-1}={}){const{includeMatches:n,includeScore:i,shouldSort:c,sortFn:o,ignoreFieldNorm:a}=this.options;let u=X(t)?X(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t);return He(u,{ignoreFieldNorm:a}),c&&u.sort(o),Qt(s)&&s>-1&&(u=u.slice(0,s)),ze(u,this._docs,{includeMatches:n,includeScore:i})}_searchStringList(t){const s=Et(t,this.options),{records:n}=this._myIndex,i=[];return n.forEach(({v:c,i:o,n:a})=>{if(!H(c))return;const{isMatch:u,score:l,indices:d}=s.searchIn(c);u&&i.push({item:c,idx:o,matches:[{score:l,value:c,norm:a,indices:d}]})}),i}_searchLogical(t){const s=Xt(t,this.options),n=(a,u,l)=>{if(!a.children){const{keyId:h,searcher:f}=a,y=this._findMatches({key:this._keyStore.get(h),value:this._myIndex.getValueForItemAtKeyId(u,h),searcher:f});return y&&y.length?[{idx:l,item:u,matches:y}]:[]}const d=[];for(let h=0,f=a.children.length;h<f;h+=1){const y=a.children[h],C=n(y,u,l);if(C.length)d.push(...C);else if(a.operator===ft.AND)return[]}return d},i=this._myIndex.records,c={},o=[];return i.forEach(({$:a,i:u})=>{if(H(a)){let l=n(s,a,u);l.length&&(c[u]||(c[u]={idx:u,item:a,matches:[]},o.push(c[u])),l.forEach(({matches:d})=>{c[u].matches.push(...d)}))}}),o}_searchObjectList(t){const s=Et(t,this.options),{keys:n,records:i}=this._myIndex,c=[];return i.forEach(({$:o,i:a})=>{if(!H(o))return;let u=[];n.forEach((l,d)=>{u.push(...this._findMatches({key:l,value:o[d],searcher:s}))}),u.length&&c.push({idx:a,item:o,matches:u})}),c}_findMatches({key:t,value:s,searcher:n}){if(!H(s))return[];let i=[];if(et(s))s.forEach(({v:c,i:o,n:a})=>{if(!H(c))return;const{isMatch:u,score:l,indices:d}=n.searchIn(c);u&&i.push({score:l,key:t,value:c,idx:o,norm:a,indices:d})});else{const{v:c,n:o}=s,{isMatch:a,score:u,indices:l}=n.searchIn(c);a&&i.push({score:u,key:t,value:c,norm:o,indices:l})}return i}}G.version="7.1.0";G.createIndex=Ut;G.parseIndex=we;G.config=p;G.parseQuery=Xt;Pe(Te);const Tt={".ts":"📘",".tsx":"⚛️",".js":"📒",".jsx":"⚛️",".py":"🐍",".rs":"🦀",".go":"🔷",".md":"📝",".json":"📋",".yaml":"⚙️",".yml":"⚙️",".css":"🎨",".scss":"🎨",".html":"🌐",".sql":"🗃️",".sh":"💻",".env":"🔐",".toml":"⚙️",".lock":"🔒",default:"📄"};function Ve(e){var s;const t="."+((s=e.split(".").pop())==null?void 0:s.toLowerCase());return Tt[t]||Tt.default}function Pt(e){const t=se[e];return(t==null?void 0:t.icon)||"🤖"}function Zt(e){const t=Math.floor(e/1e3),s=Math.floor(t/60),n=Math.floor(s/60),i=Math.floor(n/24);return i>0?`${i}d ${n%24}h ago`:n>0?`${n}h ${s%60}m ago`:s>0?`${s}m ago`:"just now"}function Kt(e){const s=Date.now()-e;return Zt(s)}function Ot(e){switch(e){case"agent":return"Agent";case"command":return"Command";case"area":return"Area";case"activity":return"Activity";case"modified-file":return"Changed";case"building":return"Server";default:return e}}const Ht=["command","agent","building","area","modified-file","activity"];function Ue({isOpen:e,onClose:t,onOpenSpawnModal:s,onOpenCommanderView:n,onOpenToolbox:i,onOpenSupervisor:c,onOpenFileExplorer:o,onOpenPM2LogsModal:a,onOpenBossLogsModal:u,onOpenDatabasePanel:l,onOpenMonitoringModal:d}){const h=ne(),f=ie(),y=re(),C=ce(),k=g.useMemo(()=>{const r=O.getState().supervisor.agentHistories;let A="";for(const[F,M]of r)A+=`${F}:${M.length},`;return A},[h]),D=g.useRef(t);D.current=t;const b=g.useRef(s);b.current=s;const N=g.useRef(n);N.current=n;const z=g.useRef(i);z.current=i;const Q=g.useRef(c);Q.current=c;const at=g.useRef(o);at.current=o;const st=g.useRef(a);st.current=a;const S=g.useRef(u);S.current=u;const v=g.useRef(l);v.current=l;const j=g.useRef(d);j.current=d;const[_,W]=g.useState(""),[K,nt]=g.useState(0);g.useEffect(()=>{if(e){W(""),nt(0);const r=Array.from(h.values());for(const A of r)!O.hasHistoryBeenFetched(A.id)&&!O.isLoadingHistoryForAgent(A.id)&&O.requestAgentSupervisorHistory(A.id)}},[e,h]);const T=O.getShortcuts(),Z=g.useMemo(()=>{if(!e)return[];const r=T.find(F=>F.id==="spawn-agent"),A=T.find(F=>F.id==="toggle-commander");return[{id:"cmd-spawn",type:"command",title:"Spawn New Agent",subtitle:r?bt(r):"Alt+N",icon:"➕",action:()=>{D.current(),b.current()}},{id:"cmd-commander",type:"command",title:"Commander View",subtitle:A?bt(A):"Ctrl+K",icon:"📊",action:()=>{D.current(),N.current()}},{id:"cmd-settings",type:"command",title:"Settings & Tools",subtitle:"Configure Tide Commander",icon:"⚙️",action:()=>{D.current(),z.current()}},{id:"cmd-supervisor",type:"command",title:"Supervisor Overview",subtitle:"View agent analysis",icon:"🎖️",action:()=>{D.current(),Q.current()}},{id:"cmd-monitoring",type:"command",title:"Monitoring & Logs",subtitle:"Triggers, workflows, events",icon:"📊",action:()=>{var F;D.current(),(F=j.current)==null||F.call(j)}}]},[e,T]),ct=g.useMemo(()=>e?Array.from(h.values()).map(r=>{const A=O.getAgentSupervisorHistory(r.id),F=A.length>0?A[0]:null,M=A.map(x=>({text:`${x.analysis.statusDescription} ${x.analysis.recentWorkSummary}`,timestamp:x.timestamp})),$=(C||[]).filter(x=>x.agentId===r.id).map(x=>x.filePath),I=[...new Set($)],R=I.map(x=>x.split("/").pop()||x),B=[];r.lastAssignedTask&&B.push(r.lastAssignedTask);const Y=`${r.class} • ${r.status} • ${r.cwd}`;let J=`${r.name} ${Y}`,L,ut,E;for(const x of M)J+=` ${x.text}`;F&&(L=F.analysis.recentWorkSummary,ut=F.analysis.statusDescription,E=F.timestamp),R.length>0&&(J+=` ${R.join(" ")} ${I.join(" ")}`),B.length>0&&(J+=` ${B.join(" ")}`);const w=Date.now()-r.lastActivity;let U;return r.lastAssignedTask&&(r.lastAssignedTask.length>150?U=r.lastAssignedTask.slice(0,150)+"...":U=r.lastAssignedTask),{id:`agent-${r.id}`,type:"agent",title:r.name,subtitle:Y,lastUserInput:U,statusDescription:ut,activityText:L,matchedText:L,timeAway:w,lastStatusTime:E,icon:Pt(r.class),_searchText:J,_modifiedFiles:I,_userQueries:B,_historyEntries:M,action:()=>{D.current(),O.selectAgent(r.id)}}}):[],[e,h,k,C]),lt=g.useMemo(()=>e?Array.from(f.values()).map(r=>{var A;return{id:`area-${r.id}`,type:"area",title:r.name,subtitle:`${r.assignedAgentIds.length} agents • ${((A=r.directories)==null?void 0:A.length)||0} folders`,icon:"🗺️",action:()=>{D.current(),O.selectArea(r.id)}}}):[],[e,f]),mt=g.useMemo(()=>e?Array.from(y.values()).filter(r=>r.type==="server"||r.type==="boss"||r.type==="database").map(r=>{var R,B,Y,J;const A=r.status==="running"?"🟢":r.status==="stopped"?"🔴":"🟡",F=r.type==="boss"?"👑":r.type==="database"?"🗄️":"🖥️";let $=`${r.type==="boss"?"Boss":r.type==="database"?"Database":"Server"} • ${r.status}`;if(r.type==="database"&&((B=(R=r.database)==null?void 0:R.connections)!=null&&B.length)){const L=r.database.connections[0];$+=` • ${L.engine} @ ${L.host}`}else r.cwd&&($+=` • ${r.cwd}`);let I=`${r.name} ${r.type} ${r.status} ${r.cwd||""} ${((Y=r.pm2)==null?void 0:Y.name)||""}`;if(r.type==="database"&&((J=r.database)!=null&&J.connections))for(const L of r.database.connections)I+=` ${L.name} ${L.engine} ${L.host} ${L.database||""} mysql postgresql sql`;return{id:`building-${r.id}`,type:"building",title:r.name,subtitle:$,icon:`${A} ${F}`,_searchText:I,action:()=>{var L;D.current(),r.type==="boss"?S.current(r.id):r.type==="database"?v.current(r.id):(L=r.pm2)!=null&&L.enabled&&st.current(r.id)}}}):[],[e,y]),vt=g.useMemo(()=>{if(!e)return[];const r=C||[],A=new Set,F=[];for(const M of r){if(A.has(M.filePath))continue;A.add(M.filePath);const $=M.filePath.split("/").pop()||M.filePath,I=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:$,subtitle:`${I} by ${M.agentName} • ${M.filePath}`,matchedText:M.filePath,icon:M.action==="deleted"?"🗑️":Ve(M.filePath),action:()=>{D.current();const R=Array.from(O.getState().areas.values());for(const B of R)for(const Y of B.directories||[])if(M.filePath.startsWith(Y)){O.setFileViewerPath(M.filePath),at.current(B.id);return}O.selectAgent(M.agentId)}}),F.length>=50)break}return F},[e,C]),Dt=g.useMemo(()=>{if(!e)return[];const r=[],A=Array.from(h.values());for(const F of A){const M=O.getAgentSupervisorHistory(F.id);if(M.length>0){const $=M[0],I=$.analysis;r.push({id:`activity-${F.id}-${$.timestamp}`,type:"activity",title:F.name,subtitle:I.statusDescription,activityText:I.recentWorkSummary,matchedText:I.recentWorkSummary,icon:Pt(F.class),action:()=>{D.current(),O.selectAgent(F.id)}})}}return r},[e,h,k]),St=g.useMemo(()=>new G(ct,{keys:["title","subtitle","_searchText","activityText","lastUserInput"],threshold:.4,ignoreLocation:!0,includeScore:!0,includeMatches:!0}),[ct]),Bt=g.useMemo(()=>new G(Z,{keys:["title","subtitle"],threshold:.4,includeScore:!0,includeMatches:!0}),[Z]),It=g.useMemo(()=>new G(lt,{keys:["title","subtitle"],threshold:.4,includeScore:!0,includeMatches:!0}),[lt]),kt=g.useMemo(()=>new G(vt,{keys:["title","subtitle","matchedText"],threshold:.4,ignoreLocation:!0,includeScore:!0,includeMatches:!0}),[vt]),$t=g.useMemo(()=>new G(Dt,{keys:["title","subtitle","matchedText","activityText"],threshold:.4,ignoreLocation:!0,includeScore:!0,includeMatches:!0}),[Dt]),qt=g.useMemo(()=>new G(mt,{keys:["title","subtitle","_searchText"],threshold:.4,ignoreLocation:!0,includeScore:!0,includeMatches:!0}),[mt]),V=g.useMemo(()=>{if(!_.trim()){const E=[];E.push(...mt);const w=[...ct].sort((x,P)=>{const q=x.timeAway??0,tt=P.timeAway??0;return q-tt});E.push(...w),E.push(...Z.slice(0,2)),E.push(...lt.slice(0,2));const U={};return Ht.forEach((x,P)=>{U[x]=P}),E.sort((x,P)=>(U[x.type]??999)-(U[P.type]??999)),E}const r=_.toLowerCase(),A=St.search(_).slice(0,8),F=Bt.search(_).slice(0,3),M=It.search(_).slice(0,2),$=kt.search(_).slice(0,3),I=$t.search(_).slice(0,3),R=qt.search(_).filter(E=>{const w=E.score??1;return`${E.item.title} ${E.item.subtitle||""} ${E.item._searchText||""}`.toLowerCase().includes(r)||w<=.2}).slice(0,4),B=[],Y=[],J=[];for(const E of A){const w={...E.item};if(w._modifiedFiles&&w._modifiedFiles.length>0){const x=w._modifiedFiles.filter(P=>{var it;const q=((it=P.split("/").pop())==null?void 0:it.toLowerCase())||"",tt=P.toLowerCase();return q.includes(r)||tt.includes(r)});x.length>0&&(w.matchedFiles=x)}if(w._userQueries&&w._userQueries.length>0){const x=w._userQueries.find(P=>P.toLowerCase().includes(r));if(x)if(x.length>200){const q=x.toLowerCase().indexOf(r),tt=Math.max(0,q-60),it=Math.min(x.length,q+r.length+100);w.matchedQuery=(tt>0?"...":"")+x.slice(tt,it)+(it<x.length?"...":"")}else w.matchedQuery=x}if(w._historyEntries&&w._historyEntries.length>0){const x=w._historyEntries.find(P=>P.text.toLowerCase().includes(r));if(x)if(x.text.length>250){const q=x.text.toLowerCase().indexOf(r),tt=Math.max(0,q-80),it=Math.min(x.text.length,q+r.length+120);w.matchedHistory={text:(tt>0?"...":"")+x.text.slice(tt,it)+(it<x.text.length?"...":""),timestamp:x.timestamp}}else w.matchedHistory=x}const U=w.title.toLowerCase();U===r||U.startsWith(r)?Y.push(w):J.push(w)}for(const E of Y)B.push(E);for(const E of R)B.push(E.item);for(const E of J)B.push(E);for(const E of F)B.push(E.item);for(const E of M)B.push(E.item);for(const E of $)B.push(E.item);const L=new Set(A.map(E=>E.item.id));for(const E of I){const w=E.item.id.replace("activity-","").split("-")[0];L.has(`agent-${w}`)||B.push(E.item)}const ut={};return Ht.forEach((E,w)=>{ut[E]=w}),B.sort((E,w)=>(ut[E.type]??999)-(ut[w.type]??999)),B},[_,St,Bt,It,kt,$t,Z,ct,lt]);g.useEffect(()=>{K>=V.length&&nt(Math.max(0,V.length-1))},[V.length,K]);const te=g.useCallback(r=>{if(r.altKey&&!r.ctrlKey&&!r.metaKey&&(r.key==="p"||r.key==="n"||r.key==="P"||r.key==="N")){r.preventDefault(),r.stopPropagation(),r.nativeEvent.stopImmediatePropagation();const A=r.key.toLowerCase();nt(A==="p"?F=>F>0?F-1:V.length-1:F=>F<V.length-1?F+1:0);return}switch(r.key){case"Escape":r.preventDefault(),D.current();break;case"ArrowUp":r.preventDefault(),nt(A=>A>0?A-1:V.length-1);break;case"ArrowDown":r.preventDefault(),nt(A=>A<V.length-1?A+1:0);break;case"Enter":r.preventDefault(),V[K]&&V[K].action();break}},[V,K]),ee=g.useCallback((r,A)=>{if(!A||!r)return r;const F=r.toLowerCase(),M=A.toLowerCase(),$=[];let I=0,R=F.indexOf(M),B=0;for(;R!==-1;)R>I&&$.push(r.slice(I,R)),$.push(pt.createElement("mark",{key:B++,className:"spotlight-highlight"},r.slice(R,R+A.length))),I=R+A.length,R=F.indexOf(M,I);return I<r.length&&$.push(r.slice(I)),$.length>0?pt.createElement(pt.Fragment,null,...$):r},[]);return{query:_,setQuery:W,selectedIndex:K,setSelectedIndex:nt,results:V,handleKeyDown:te,highlightMatch:ee}}const Ge=g.forwardRef(function({query:t,onQueryChange:s,onKeyDown:n,onResetSelection:i},c){const{t:o}=Mt(["common"]);return m.jsxs("div",{className:"spotlight-input-wrapper",children:[m.jsx("span",{className:"spotlight-search-icon",children:"⌘"}),m.jsx("input",{ref:c,type:"text",className:"spotlight-input",placeholder:o("common:search.spotlightPlaceholder"),value:t,onChange:a=>{s(a.target.value),i()},onKeyDown:n,autoFocus:!0,spellCheck:!1}),m.jsxs("div",{className:"spotlight-input-hints",children:[m.jsx("span",{className:"spotlight-shortcut-hint",children:"↑↓"}),m.jsx("span",{className:"spotlight-shortcut-hint",children:"Enter"}),m.jsx("span",{className:"spotlight-shortcut-hint",children:"Esc"})]})]})}),Ye=g.memo(function({result:t,isSelected:s,query:n,highlightMatch:i,onClick:c,onMouseEnter:o}){const a=t.activityText||t.statusDescription||t.matchedFiles&&t.matchedFiles.length>0||t.matchedQuery||t.matchedHistory;return m.jsxs("div",{className:`spotlight-item ${s?"selected":""} ${t.activityText?"has-activity":""}`,onClick:c,onMouseEnter:o,role:"option","aria-selected":s,children:[m.jsx("span",{className:"spotlight-item-icon","aria-hidden":"true",children:t.icon}),m.jsxs("div",{className:"spotlight-item-content",children:[m.jsxs("div",{className:"spotlight-item-header",children:[m.jsx("span",{className:"spotlight-item-title",children:i(t.title,n)}),m.jsx("span",{className:`spotlight-item-type ${t.type}`,"aria-label":Ot(t.type),children:Ot(t.type)})]}),t.subtitle&&m.jsx("span",{className:"spotlight-item-subtitle",children:i(t.subtitle,n)}),t.statusDescription&&m.jsx("span",{className:"spotlight-item-status",children:i(t.statusDescription,n)}),t.activityText&&m.jsx("span",{className:"spotlight-item-activity",children:i(t.activityText,n)}),a&&m.jsxs("div",{className:"spotlight-item-details",children:[t.matchedFiles&&t.matchedFiles.length>0&&m.jsx("span",{className:"spotlight-item-files",children:t.matchedFiles.map((u,l)=>m.jsxs("span",{className:"file-badge",children:[l>0&&m.jsx("span",{className:"file-separator",children:"•"}),i(u.split("/").pop()||u,n)]},u))}),t.matchedQuery&&m.jsx("span",{className:"spotlight-item-query",children:i(t.matchedQuery,n)}),t.matchedHistory&&m.jsxs("span",{className:"spotlight-item-history",children:[i(t.matchedHistory.text,n),m.jsx("span",{className:"spotlight-history-time",children:Kt(t.matchedHistory.timestamp)})]})]}),(t.timeAway!==void 0||t.lastStatusTime!==void 0)&&m.jsxs("span",{className:"spotlight-item-time",children:[t.timeAway!==void 0&&m.jsxs("span",{className:"spotlight-time-away",children:["Idle: ",Zt(t.timeAway)]}),t.lastStatusTime!==void 0&&m.jsxs("span",{className:"spotlight-status-time",children:["Updated ",Kt(t.lastStatusTime)]})]}),t.lastUserInput&&!t.matchedQuery&&m.jsxs("span",{className:"spotlight-item-last-input",children:['"',i(t.lastUserInput,n),'"']})]})]})}),Je=g.forwardRef(function({results:t,selectedIndex:s,query:n,highlightMatch:i,onSelectIndex:c},o){const{t:a}=Mt(["terminal"]),u=g.useRef(!1);g.useEffect(()=>{u.current=!1},[t]),g.useEffect(()=>{const h=typeof o=="function"?null:o==null?void 0:o.current;if(!h)return;const f=()=>{u.current=!0};return h.addEventListener("mousemove",f),()=>{h.removeEventListener("mousemove",f)}},[o,t]);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"),activity:a("terminal:spotlight.categories.recentActivity")},d=g.useMemo(()=>{const h=[];let f=null,y=[];return t.forEach((C,k)=>{C.type!==f&&(f!==null&&y.length>0&&h.push([f,y]),f=C.type,y=[]),y.push({result:C,index:k})}),f!==null&&y.length>0&&h.push([f,y]),h},[t]);return g.useEffect(()=>{if(!o||typeof o=="function")return;const h=o.current;if(!h)return;const f=h.querySelector(".spotlight-item.selected");f&&f.scrollIntoView({block:"nearest",behavior:"smooth"})},[s,o]),t.length===0?m.jsx("div",{className:"spotlight-results",ref:o,children:m.jsx("div",{className:"spotlight-empty",children:a("terminal:spotlight.noResults")})}):m.jsx("div",{className:"spotlight-results",ref:o,children:d.map(([h,f])=>m.jsxs("div",{children:[d.length>1&&m.jsx("div",{className:"spotlight-category-header",children:l[h]||h}),f.map(({result:y,index:C})=>m.jsx(Ye,{result:y,isSelected:C===s,query:n,highlightMatch:i,onClick:()=>y.action(),onMouseEnter:()=>{u.current&&c(C)}},y.id))]},h))})}),Xe=g.memo(function(){const{t}=Mt(["terminal"]);return m.jsxs("div",{className:"spotlight-footer",children:[m.jsxs("div",{className:"spotlight-footer-left",children:[m.jsxs("span",{className:"spotlight-footer-hint",children:[m.jsx("kbd",{children:"↑"}),m.jsx("kbd",{children:"↓"})," ",m.jsx("kbd",{children:"Alt+N"}),m.jsx("kbd",{children:"Alt+P"})," ",t("terminal:spotlight.navigate")]}),m.jsxs("span",{className:"spotlight-footer-hint",children:[m.jsx("kbd",{children:"Enter"})," ",t("terminal:spotlight.select")]})]}),m.jsx("div",{className:"spotlight-footer-right",children:m.jsxs("span",{className:"spotlight-footer-hint",children:[m.jsx("kbd",{children:"Esc"})," ",t("common:buttons.close")]})})]})});function ss({isOpen:e,onClose:t,onOpenSpawnModal:s,onOpenCommanderView:n,onOpenToolbox:i,onOpenSupervisor:c,onOpenFileExplorer:o,onOpenPM2LogsModal:a,onOpenBossLogsModal:u,onOpenDatabasePanel:l,onOpenMonitoringModal:d}){const h=g.useRef(null),f=g.useRef(null),y=g.useRef(0),{query:C,setQuery:k,selectedIndex:D,setSelectedIndex:b,results:N,handleKeyDown:z,highlightMatch:Q}=Ue({isOpen:e,onClose:t,onOpenSpawnModal:s,onOpenCommanderView:n,onOpenToolbox:i,onOpenSupervisor:c,onOpenFileExplorer:o,onOpenPM2LogsModal:a,onOpenBossLogsModal:u,onOpenDatabasePanel:l,onOpenMonitoringModal:d});y.current=N.length,g.useEffect(()=>{e&&setTimeout(()=>{var S;(S=h.current)==null||S.focus()},50)},[e]),g.useEffect(()=>{if(!e)return;const S=v=>{if(v.key==="Escape"){v.preventDefault(),v.stopPropagation(),v.stopImmediatePropagation(),t();return}if(v.altKey&&!v.ctrlKey&&!v.metaKey&&(v.key==="n"||v.key==="p"||v.key==="N"||v.key==="P")){v.preventDefault(),v.stopPropagation(),v.stopImmediatePropagation();const j=v.key.toLowerCase(),_=y.current;b(j==="p"?W=>W>0?W-1:_-1:W=>W<_-1?W+1:0);return}};return window.addEventListener("keydown",S,{capture:!0}),()=>{window.removeEventListener("keydown",S,{capture:!0})}},[e,t]);const at=g.useCallback(S=>{S.target===S.currentTarget&&t()},[t]),st=g.useCallback(()=>{b(0)},[b]);return e?m.jsx("div",{className:"spotlight-overlay",onClick:at,children:m.jsxs("div",{className:"spotlight-modal",children:[m.jsx(Ge,{ref:h,query:C,onQueryChange:k,onKeyDown:z,onResetSelection:st}),m.jsx(Je,{ref:f,results:N,selectedIndex:D,query:C,highlightMatch:Q,onSelectIndex:b}),m.jsx(Xe,{})]})}):null}export{Tt as FILE_ICONS,ss as Spotlight,Xe as SpotlightFooter,Ge as SpotlightInput,Ye as SpotlightItem,Je as SpotlightResults,Zt as formatDuration,Kt as formatRelativeTime,Pt as getAgentIcon,Ve as getFileIconFromPath,Ot as getTypeLabel,Ue as useSpotlightSearch};
|
|
1
|
+
import{a2 as se,H as ne,J as ie,I as re,b7 as ce,r as g,s as O,b8 as bt,z as pt,u as Mt,j as m}from"./main-BL6u5aPD.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";function et(e){return Array.isArray?Array.isArray(e):zt(e)==="[object Array]"}function oe(e){if(typeof e=="string")return e;let t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function ae(e){return e==null?"":oe(e)}function X(e){return typeof e=="string"}function Qt(e){return typeof e=="number"}function ue(e){return e===!0||e===!1||le(e)&&zt(e)=="[object Boolean]"}function Wt(e){return typeof e=="object"}function le(e){return Wt(e)&&e!==null}function H(e){return e!=null}function gt(e){return!e.trim().length}function zt(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const he="Incorrect 'index' type",de=e=>`Invalid value for key ${e}`,fe=e=>`Pattern length exceeds max of ${e}.`,me=e=>`Missing ${e} property in key`,pe=e=>`Property 'weight' in key '${e}' must be a positive integer`,Rt=Object.prototype.hasOwnProperty;class ge{constructor(t){this._keys=[],this._keyMap={};let s=0;t.forEach(n=>{let i=Vt(n);this._keys.push(i),this._keyMap[i.id]=i,s+=i.weight}),this._keys.forEach(n=>{n.weight/=s})}get(t){return this._keyMap[t]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function Vt(e){let t=null,s=null,n=null,i=1,c=null;if(X(e)||et(e))n=e,t=_t(e),s=yt(e);else{if(!Rt.call(e,"name"))throw new Error(me("name"));const o=e.name;if(n=o,Rt.call(e,"weight")&&(i=e.weight,i<=0))throw new Error(pe(o));t=_t(o),s=yt(o),c=e.getFn}return{path:t,id:s,weight:i,src:n,getFn:c}}function _t(e){return et(e)?e:e.split(".")}function yt(e){return et(e)?e.join("."):e}function ye(e,t){let s=[],n=!1;const i=(c,o,a)=>{if(H(c))if(!o[a])s.push(c);else{let u=o[a];const l=c[u];if(!H(l))return;if(a===o.length-1&&(X(l)||Qt(l)||ue(l)))s.push(ae(l));else if(et(l)){n=!0;for(let d=0,h=l.length;d<h;d+=1)i(l[d],o,a+1)}else o.length&&i(l,o,a+1)}};return i(e,X(t)?t.split("."):t,0),n?s:s[0]}const Ae={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},xe={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1},Ee={location:0,threshold:.6,distance:100},Ce={useExtendedSearch:!1,getFn:ye,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var p={...xe,...Ae,...Ee,...Ce};const Fe=/[^ ]+/g;function Me(e=1,t=3){const s=new Map,n=Math.pow(10,t);return{get(i){const c=i.match(Fe).length;if(s.has(c))return s.get(c);const o=1/Math.pow(c,.5*e),a=parseFloat(Math.round(o*n)/n);return s.set(c,a),a},clear(){s.clear()}}}class wt{constructor({getFn:t=p.getFn,fieldNormWeight:s=p.fieldNormWeight}={}){this.norm=Me(s,3),this.getFn=t,this.isCreated=!1,this.setIndexRecords()}setSources(t=[]){this.docs=t}setIndexRecords(t=[]){this.records=t}setKeys(t=[]){this.keys=t,this._keysMap={},t.forEach((s,n)=>{this._keysMap[s.id]=n})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,X(this.docs[0])?this.docs.forEach((t,s)=>{this._addString(t,s)}):this.docs.forEach((t,s)=>{this._addObject(t,s)}),this.norm.clear())}add(t){const s=this.size();X(t)?this._addString(t,s):this._addObject(t,s)}removeAt(t){this.records.splice(t,1);for(let s=t,n=this.size();s<n;s+=1)this.records[s].i-=1}getValueForItemAtKeyId(t,s){return t[this._keysMap[s]]}size(){return this.records.length}_addString(t,s){if(!H(t)||gt(t))return;let n={v:t,i:s,n:this.norm.get(t)};this.records.push(n)}_addObject(t,s){let n={i:s,$:{}};this.keys.forEach((i,c)=>{let o=i.getFn?i.getFn(t):this.getFn(t,i.path);if(H(o)){if(et(o)){let a=[];const u=[{nestedArrIndex:-1,value:o}];for(;u.length;){const{nestedArrIndex:l,value:d}=u.pop();if(H(d))if(X(d)&&!gt(d)){let h={v:d,i:l,n:this.norm.get(d)};a.push(h)}else et(d)&&d.forEach((h,f)=>{u.push({nestedArrIndex:f,value:h})})}n.$[c]=a}else if(X(o)&&!gt(o)){let a={v:o,n:this.norm.get(o)};n.$[c]=a}}}),this.records.push(n)}toJSON(){return{keys:this.keys,records:this.records}}}function Ut(e,t,{getFn:s=p.getFn,fieldNormWeight:n=p.fieldNormWeight}={}){const i=new wt({getFn:s,fieldNormWeight:n});return i.setKeys(e.map(Vt)),i.setSources(t),i.create(),i}function we(e,{getFn:t=p.getFn,fieldNormWeight:s=p.fieldNormWeight}={}){const{keys:n,records:i}=e,c=new wt({getFn:t,fieldNormWeight:s});return c.setKeys(n),c.setIndexRecords(i),c}function ht(e,{errors:t=0,currentLocation:s=0,expectedLocation:n=0,distance:i=p.distance,ignoreLocation:c=p.ignoreLocation}={}){const o=t/e.length;if(c)return o;const a=Math.abs(n-s);return i?o+a/i:a?1:o}function ve(e=[],t=p.minMatchCharLength){let s=[],n=-1,i=-1,c=0;for(let o=e.length;c<o;c+=1){let a=e[c];a&&n===-1?n=c:!a&&n!==-1&&(i=c-1,i-n+1>=t&&s.push([n,i]),n=-1)}return e[c-1]&&c-n>=t&&s.push([n,c-1]),s}const ot=32;function De(e,t,s,{location:n=p.location,distance:i=p.distance,threshold:c=p.threshold,findAllMatches:o=p.findAllMatches,minMatchCharLength:a=p.minMatchCharLength,includeMatches:u=p.includeMatches,ignoreLocation:l=p.ignoreLocation}={}){if(t.length>ot)throw new Error(fe(ot));const d=t.length,h=e.length,f=Math.max(0,Math.min(n,h));let y=c,C=f;const k=a>1||u,D=k?Array(h):[];let b;for(;(b=e.indexOf(t,C))>-1;){let S=ht(t,{currentLocation:b,expectedLocation:f,distance:i,ignoreLocation:l});if(y=Math.min(S,y),C=b+d,k){let v=0;for(;v<d;)D[b+v]=1,v+=1}}C=-1;let N=[],z=1,Q=d+h;const at=1<<d-1;for(let S=0;S<d;S+=1){let v=0,j=Q;for(;v<j;)ht(t,{errors:S,currentLocation:f+j,expectedLocation:f,distance:i,ignoreLocation:l})<=y?v=j:Q=j,j=Math.floor((Q-v)/2+v);Q=j;let _=Math.max(1,f-j+1),W=o?h:Math.min(f+j,h)+d,K=Array(W+2);K[W+1]=(1<<S)-1;for(let T=W;T>=_;T-=1){let Z=T-1,ct=s[e.charAt(Z)];if(k&&(D[Z]=+!!ct),K[T]=(K[T+1]<<1|1)&ct,S&&(K[T]|=(N[T+1]|N[T])<<1|1|N[T+1]),K[T]&at&&(z=ht(t,{errors:S,currentLocation:Z,expectedLocation:f,distance:i,ignoreLocation:l}),z<=y)){if(y=z,C=Z,C<=f)break;_=Math.max(1,2*f-C)}}if(ht(t,{errors:S+1,currentLocation:f,expectedLocation:f,distance:i,ignoreLocation:l})>y)break;N=K}const st={isMatch:C>=0,score:Math.max(.001,z)};if(k){const S=ve(D,a);S.length?u&&(st.indices=S):st.isMatch=!1}return st}function Se(e){let t={};for(let s=0,n=e.length;s<n;s+=1){const i=e.charAt(s);t[i]=(t[i]||0)|1<<n-s-1}return t}const dt=String.prototype.normalize?(e=>e.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,"")):(e=>e);class Gt{constructor(t,{location:s=p.location,threshold:n=p.threshold,distance:i=p.distance,includeMatches:c=p.includeMatches,findAllMatches:o=p.findAllMatches,minMatchCharLength:a=p.minMatchCharLength,isCaseSensitive:u=p.isCaseSensitive,ignoreDiacritics:l=p.ignoreDiacritics,ignoreLocation:d=p.ignoreLocation}={}){if(this.options={location:s,threshold:n,distance:i,includeMatches:c,findAllMatches:o,minMatchCharLength:a,isCaseSensitive:u,ignoreDiacritics:l,ignoreLocation:d},t=u?t:t.toLowerCase(),t=l?dt(t):t,this.pattern=t,this.chunks=[],!this.pattern.length)return;const h=(y,C)=>{this.chunks.push({pattern:y,alphabet:Se(y),startIndex:C})},f=this.pattern.length;if(f>ot){let y=0;const C=f%ot,k=f-C;for(;y<k;)h(this.pattern.substr(y,ot),y),y+=ot;if(C){const D=f-ot;h(this.pattern.substr(D),D)}}else h(this.pattern,0)}searchIn(t){const{isCaseSensitive:s,ignoreDiacritics:n,includeMatches:i}=this.options;if(t=s?t:t.toLowerCase(),t=n?dt(t):t,this.pattern===t){let k={isMatch:!0,score:0};return i&&(k.indices=[[0,t.length-1]]),k}const{location:c,distance:o,threshold:a,findAllMatches:u,minMatchCharLength:l,ignoreLocation:d}=this.options;let h=[],f=0,y=!1;this.chunks.forEach(({pattern:k,alphabet:D,startIndex:b})=>{const{isMatch:N,score:z,indices:Q}=De(t,k,D,{location:c+b,distance:o,threshold:a,findAllMatches:u,minMatchCharLength:l,includeMatches:i,ignoreLocation:d});N&&(y=!0),f+=z,N&&Q&&(h=[...h,...Q])});let C={isMatch:y,score:y?f/this.chunks.length:1};return y&&i&&(C.indices=h),C}}class rt{constructor(t){this.pattern=t}static isMultiMatch(t){return Lt(t,this.multiRegex)}static isSingleMatch(t){return Lt(t,this.singleRegex)}search(){}}function Lt(e,t){const s=e.match(t);return s?s[1]:null}class Be extends rt{constructor(t){super(t)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(t){const s=t===this.pattern;return{isMatch:s,score:s?0:1,indices:[0,this.pattern.length-1]}}}class Ie extends rt{constructor(t){super(t)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(t){const n=t.indexOf(this.pattern)===-1;return{isMatch:n,score:n?0:1,indices:[0,t.length-1]}}}class ke extends rt{constructor(t){super(t)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(t){const s=t.startsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,this.pattern.length-1]}}}class $e extends rt{constructor(t){super(t)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(t){const s=!t.startsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,t.length-1]}}}class be extends rt{constructor(t){super(t)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(t){const s=t.endsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[t.length-this.pattern.length,t.length-1]}}}class Re extends rt{constructor(t){super(t)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(t){const s=!t.endsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,t.length-1]}}}class Yt extends rt{constructor(t,{location:s=p.location,threshold:n=p.threshold,distance:i=p.distance,includeMatches:c=p.includeMatches,findAllMatches:o=p.findAllMatches,minMatchCharLength:a=p.minMatchCharLength,isCaseSensitive:u=p.isCaseSensitive,ignoreDiacritics:l=p.ignoreDiacritics,ignoreLocation:d=p.ignoreLocation}={}){super(t),this._bitapSearch=new Gt(t,{location:s,threshold:n,distance:i,includeMatches:c,findAllMatches:o,minMatchCharLength:a,isCaseSensitive:u,ignoreDiacritics:l,ignoreLocation:d})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}}class Jt extends rt{constructor(t){super(t)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(t){let s=0,n;const i=[],c=this.pattern.length;for(;(n=t.indexOf(this.pattern,s))>-1;)s=n+c,i.push([n,s-1]);const o=!!i.length;return{isMatch:o,score:o?0:1,indices:i}}}const At=[Be,Jt,ke,$e,Re,be,Ie,Yt],Nt=At.length,_e=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,Le="|";function Ne(e,t={}){return e.split(Le).map(s=>{let n=s.trim().split(_e).filter(c=>c&&!!c.trim()),i=[];for(let c=0,o=n.length;c<o;c+=1){const a=n[c];let u=!1,l=-1;for(;!u&&++l<Nt;){const d=At[l];let h=d.isMultiMatch(a);h&&(i.push(new d(h,t)),u=!0)}if(!u)for(l=-1;++l<Nt;){const d=At[l];let h=d.isSingleMatch(a);if(h){i.push(new d(h,t));break}}}return i})}const je=new Set([Yt.type,Jt.type]);class Te{constructor(t,{isCaseSensitive:s=p.isCaseSensitive,ignoreDiacritics:n=p.ignoreDiacritics,includeMatches:i=p.includeMatches,minMatchCharLength:c=p.minMatchCharLength,ignoreLocation:o=p.ignoreLocation,findAllMatches:a=p.findAllMatches,location:u=p.location,threshold:l=p.threshold,distance:d=p.distance}={}){this.query=null,this.options={isCaseSensitive:s,ignoreDiacritics:n,includeMatches:i,minMatchCharLength:c,findAllMatches:a,ignoreLocation:o,location:u,threshold:l,distance:d},t=s?t:t.toLowerCase(),t=n?dt(t):t,this.pattern=t,this.query=Ne(this.pattern,this.options)}static condition(t,s){return s.useExtendedSearch}searchIn(t){const s=this.query;if(!s)return{isMatch:!1,score:1};const{includeMatches:n,isCaseSensitive:i,ignoreDiacritics:c}=this.options;t=i?t:t.toLowerCase(),t=c?dt(t):t;let o=0,a=[],u=0;for(let l=0,d=s.length;l<d;l+=1){const h=s[l];a.length=0,o=0;for(let f=0,y=h.length;f<y;f+=1){const C=h[f],{isMatch:k,indices:D,score:b}=C.search(t);if(k){if(o+=1,u+=b,n){const N=C.constructor.type;je.has(N)?a=[...a,...D]:a.push(D)}}else{u=0,o=0,a.length=0;break}}if(o){let f={isMatch:!0,score:u/o};return n&&(f.indices=a),f}}return{isMatch:!1,score:1}}}const xt=[];function Pe(...e){xt.push(...e)}function Et(e,t){for(let s=0,n=xt.length;s<n;s+=1){let i=xt[s];if(i.condition(e,t))return new i(e,t)}return new Gt(e,t)}const ft={AND:"$and",OR:"$or"},Ct={PATH:"$path",PATTERN:"$val"},Ft=e=>!!(e[ft.AND]||e[ft.OR]),Ke=e=>!!e[Ct.PATH],Oe=e=>!et(e)&&Wt(e)&&!Ft(e),jt=e=>({[ft.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function Xt(e,t,{auto:s=!0}={}){const n=i=>{let c=Object.keys(i);const o=Ke(i);if(!o&&c.length>1&&!Ft(i))return n(jt(i));if(Oe(i)){const u=o?i[Ct.PATH]:c[0],l=o?i[Ct.PATTERN]:i[u];if(!X(l))throw new Error(de(u));const d={keyId:yt(u),pattern:l};return s&&(d.searcher=Et(l,t)),d}let a={children:[],operator:c[0]};return c.forEach(u=>{const l=i[u];et(l)&&l.forEach(d=>{a.children.push(n(d))})}),a};return Ft(e)||(e=jt(e)),n(e)}function He(e,{ignoreFieldNorm:t=p.ignoreFieldNorm}){e.forEach(s=>{let n=1;s.matches.forEach(({key:i,norm:c,score:o})=>{const a=i?i.weight:null;n*=Math.pow(o===0&&a?Number.EPSILON:o,(a||1)*(t?1:c))}),s.score=n})}function Qe(e,t){const s=e.matches;t.matches=[],H(s)&&s.forEach(n=>{if(!H(n.indices)||!n.indices.length)return;const{indices:i,value:c}=n;let o={indices:i,value:c};n.key&&(o.key=n.key.src),n.idx>-1&&(o.refIndex=n.idx),t.matches.push(o)})}function We(e,t){t.score=e.score}function ze(e,t,{includeMatches:s=p.includeMatches,includeScore:n=p.includeScore}={}){const i=[];return s&&i.push(Qe),n&&i.push(We),e.map(c=>{const{idx:o}=c,a={item:t[o],refIndex:o};return i.length&&i.forEach(u=>{u(c,a)}),a})}class G{constructor(t,s={},n){this.options={...p,...s},this.options.useExtendedSearch,this._keyStore=new ge(this.options.keys),this.setCollection(t,n)}setCollection(t,s){if(this._docs=t,s&&!(s instanceof wt))throw new Error(he);this._myIndex=s||Ut(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(t){H(t)&&(this._docs.push(t),this._myIndex.add(t))}remove(t=()=>!1){const s=[];for(let n=0,i=this._docs.length;n<i;n+=1){const c=this._docs[n];t(c,n)&&(this.removeAt(n),n-=1,i-=1,s.push(c))}return s}removeAt(t){this._docs.splice(t,1),this._myIndex.removeAt(t)}getIndex(){return this._myIndex}search(t,{limit:s=-1}={}){const{includeMatches:n,includeScore:i,shouldSort:c,sortFn:o,ignoreFieldNorm:a}=this.options;let u=X(t)?X(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t);return He(u,{ignoreFieldNorm:a}),c&&u.sort(o),Qt(s)&&s>-1&&(u=u.slice(0,s)),ze(u,this._docs,{includeMatches:n,includeScore:i})}_searchStringList(t){const s=Et(t,this.options),{records:n}=this._myIndex,i=[];return n.forEach(({v:c,i:o,n:a})=>{if(!H(c))return;const{isMatch:u,score:l,indices:d}=s.searchIn(c);u&&i.push({item:c,idx:o,matches:[{score:l,value:c,norm:a,indices:d}]})}),i}_searchLogical(t){const s=Xt(t,this.options),n=(a,u,l)=>{if(!a.children){const{keyId:h,searcher:f}=a,y=this._findMatches({key:this._keyStore.get(h),value:this._myIndex.getValueForItemAtKeyId(u,h),searcher:f});return y&&y.length?[{idx:l,item:u,matches:y}]:[]}const d=[];for(let h=0,f=a.children.length;h<f;h+=1){const y=a.children[h],C=n(y,u,l);if(C.length)d.push(...C);else if(a.operator===ft.AND)return[]}return d},i=this._myIndex.records,c={},o=[];return i.forEach(({$:a,i:u})=>{if(H(a)){let l=n(s,a,u);l.length&&(c[u]||(c[u]={idx:u,item:a,matches:[]},o.push(c[u])),l.forEach(({matches:d})=>{c[u].matches.push(...d)}))}}),o}_searchObjectList(t){const s=Et(t,this.options),{keys:n,records:i}=this._myIndex,c=[];return i.forEach(({$:o,i:a})=>{if(!H(o))return;let u=[];n.forEach((l,d)=>{u.push(...this._findMatches({key:l,value:o[d],searcher:s}))}),u.length&&c.push({idx:a,item:o,matches:u})}),c}_findMatches({key:t,value:s,searcher:n}){if(!H(s))return[];let i=[];if(et(s))s.forEach(({v:c,i:o,n:a})=>{if(!H(c))return;const{isMatch:u,score:l,indices:d}=n.searchIn(c);u&&i.push({score:l,key:t,value:c,idx:o,norm:a,indices:d})});else{const{v:c,n:o}=s,{isMatch:a,score:u,indices:l}=n.searchIn(c);a&&i.push({score:u,key:t,value:c,norm:o,indices:l})}return i}}G.version="7.1.0";G.createIndex=Ut;G.parseIndex=we;G.config=p;G.parseQuery=Xt;Pe(Te);const Tt={".ts":"📘",".tsx":"⚛️",".js":"📒",".jsx":"⚛️",".py":"🐍",".rs":"🦀",".go":"🔷",".md":"📝",".json":"📋",".yaml":"⚙️",".yml":"⚙️",".css":"🎨",".scss":"🎨",".html":"🌐",".sql":"🗃️",".sh":"💻",".env":"🔐",".toml":"⚙️",".lock":"🔒",default:"📄"};function Ve(e){var s;const t="."+((s=e.split(".").pop())==null?void 0:s.toLowerCase());return Tt[t]||Tt.default}function Pt(e){const t=se[e];return(t==null?void 0:t.icon)||"🤖"}function Zt(e){const t=Math.floor(e/1e3),s=Math.floor(t/60),n=Math.floor(s/60),i=Math.floor(n/24);return i>0?`${i}d ${n%24}h ago`:n>0?`${n}h ${s%60}m ago`:s>0?`${s}m ago`:"just now"}function Kt(e){const s=Date.now()-e;return Zt(s)}function Ot(e){switch(e){case"agent":return"Agent";case"command":return"Command";case"area":return"Area";case"activity":return"Activity";case"modified-file":return"Changed";case"building":return"Server";default:return e}}const Ht=["command","agent","building","area","modified-file","activity"];function Ue({isOpen:e,onClose:t,onOpenSpawnModal:s,onOpenCommanderView:n,onOpenToolbox:i,onOpenSupervisor:c,onOpenFileExplorer:o,onOpenPM2LogsModal:a,onOpenBossLogsModal:u,onOpenDatabasePanel:l,onOpenMonitoringModal:d}){const h=ne(),f=ie(),y=re(),C=ce(),k=g.useMemo(()=>{const r=O.getState().supervisor.agentHistories;let A="";for(const[F,M]of r)A+=`${F}:${M.length},`;return A},[h]),D=g.useRef(t);D.current=t;const b=g.useRef(s);b.current=s;const N=g.useRef(n);N.current=n;const z=g.useRef(i);z.current=i;const Q=g.useRef(c);Q.current=c;const at=g.useRef(o);at.current=o;const st=g.useRef(a);st.current=a;const S=g.useRef(u);S.current=u;const v=g.useRef(l);v.current=l;const j=g.useRef(d);j.current=d;const[_,W]=g.useState(""),[K,nt]=g.useState(0);g.useEffect(()=>{if(e){W(""),nt(0);const r=Array.from(h.values());for(const A of r)!O.hasHistoryBeenFetched(A.id)&&!O.isLoadingHistoryForAgent(A.id)&&O.requestAgentSupervisorHistory(A.id)}},[e,h]);const T=O.getShortcuts(),Z=g.useMemo(()=>{if(!e)return[];const r=T.find(F=>F.id==="spawn-agent"),A=T.find(F=>F.id==="toggle-commander");return[{id:"cmd-spawn",type:"command",title:"Spawn New Agent",subtitle:r?bt(r):"Alt+N",icon:"➕",action:()=>{D.current(),b.current()}},{id:"cmd-commander",type:"command",title:"Commander View",subtitle:A?bt(A):"Ctrl+K",icon:"📊",action:()=>{D.current(),N.current()}},{id:"cmd-settings",type:"command",title:"Settings & Tools",subtitle:"Configure Tide Commander",icon:"⚙️",action:()=>{D.current(),z.current()}},{id:"cmd-supervisor",type:"command",title:"Supervisor Overview",subtitle:"View agent analysis",icon:"🎖️",action:()=>{D.current(),Q.current()}},{id:"cmd-monitoring",type:"command",title:"Monitoring & Logs",subtitle:"Triggers, workflows, events",icon:"📊",action:()=>{var F;D.current(),(F=j.current)==null||F.call(j)}}]},[e,T]),ct=g.useMemo(()=>e?Array.from(h.values()).map(r=>{const A=O.getAgentSupervisorHistory(r.id),F=A.length>0?A[0]:null,M=A.map(x=>({text:`${x.analysis.statusDescription} ${x.analysis.recentWorkSummary}`,timestamp:x.timestamp})),$=(C||[]).filter(x=>x.agentId===r.id).map(x=>x.filePath),I=[...new Set($)],R=I.map(x=>x.split("/").pop()||x),B=[];r.lastAssignedTask&&B.push(r.lastAssignedTask);const Y=`${r.class} • ${r.status} • ${r.cwd}`;let J=`${r.name} ${Y}`,L,ut,E;for(const x of M)J+=` ${x.text}`;F&&(L=F.analysis.recentWorkSummary,ut=F.analysis.statusDescription,E=F.timestamp),R.length>0&&(J+=` ${R.join(" ")} ${I.join(" ")}`),B.length>0&&(J+=` ${B.join(" ")}`);const w=Date.now()-r.lastActivity;let U;return r.lastAssignedTask&&(r.lastAssignedTask.length>150?U=r.lastAssignedTask.slice(0,150)+"...":U=r.lastAssignedTask),{id:`agent-${r.id}`,type:"agent",title:r.name,subtitle:Y,lastUserInput:U,statusDescription:ut,activityText:L,matchedText:L,timeAway:w,lastStatusTime:E,icon:Pt(r.class),_searchText:J,_modifiedFiles:I,_userQueries:B,_historyEntries:M,action:()=>{D.current(),O.selectAgent(r.id)}}}):[],[e,h,k,C]),lt=g.useMemo(()=>e?Array.from(f.values()).map(r=>{var A;return{id:`area-${r.id}`,type:"area",title:r.name,subtitle:`${r.assignedAgentIds.length} agents • ${((A=r.directories)==null?void 0:A.length)||0} folders`,icon:"🗺️",action:()=>{D.current(),O.selectArea(r.id)}}}):[],[e,f]),mt=g.useMemo(()=>e?Array.from(y.values()).filter(r=>r.type==="server"||r.type==="boss"||r.type==="database").map(r=>{var R,B,Y,J;const A=r.status==="running"?"🟢":r.status==="stopped"?"🔴":"🟡",F=r.type==="boss"?"👑":r.type==="database"?"🗄️":"🖥️";let $=`${r.type==="boss"?"Boss":r.type==="database"?"Database":"Server"} • ${r.status}`;if(r.type==="database"&&((B=(R=r.database)==null?void 0:R.connections)!=null&&B.length)){const L=r.database.connections[0];$+=` • ${L.engine} @ ${L.host}`}else r.cwd&&($+=` • ${r.cwd}`);let I=`${r.name} ${r.type} ${r.status} ${r.cwd||""} ${((Y=r.pm2)==null?void 0:Y.name)||""}`;if(r.type==="database"&&((J=r.database)!=null&&J.connections))for(const L of r.database.connections)I+=` ${L.name} ${L.engine} ${L.host} ${L.database||""} mysql postgresql sql`;return{id:`building-${r.id}`,type:"building",title:r.name,subtitle:$,icon:`${A} ${F}`,_searchText:I,action:()=>{var L;D.current(),r.type==="boss"?S.current(r.id):r.type==="database"?v.current(r.id):(L=r.pm2)!=null&&L.enabled&&st.current(r.id)}}}):[],[e,y]),vt=g.useMemo(()=>{if(!e)return[];const r=C||[],A=new Set,F=[];for(const M of r){if(A.has(M.filePath))continue;A.add(M.filePath);const $=M.filePath.split("/").pop()||M.filePath,I=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:$,subtitle:`${I} by ${M.agentName} • ${M.filePath}`,matchedText:M.filePath,icon:M.action==="deleted"?"🗑️":Ve(M.filePath),action:()=>{D.current();const R=Array.from(O.getState().areas.values());for(const B of R)for(const Y of B.directories||[])if(M.filePath.startsWith(Y)){O.setFileViewerPath(M.filePath),at.current(B.id);return}O.selectAgent(M.agentId)}}),F.length>=50)break}return F},[e,C]),Dt=g.useMemo(()=>{if(!e)return[];const r=[],A=Array.from(h.values());for(const F of A){const M=O.getAgentSupervisorHistory(F.id);if(M.length>0){const $=M[0],I=$.analysis;r.push({id:`activity-${F.id}-${$.timestamp}`,type:"activity",title:F.name,subtitle:I.statusDescription,activityText:I.recentWorkSummary,matchedText:I.recentWorkSummary,icon:Pt(F.class),action:()=>{D.current(),O.selectAgent(F.id)}})}}return r},[e,h,k]),St=g.useMemo(()=>new G(ct,{keys:["title","subtitle","_searchText","activityText","lastUserInput"],threshold:.4,ignoreLocation:!0,includeScore:!0,includeMatches:!0}),[ct]),Bt=g.useMemo(()=>new G(Z,{keys:["title","subtitle"],threshold:.4,includeScore:!0,includeMatches:!0}),[Z]),It=g.useMemo(()=>new G(lt,{keys:["title","subtitle"],threshold:.4,includeScore:!0,includeMatches:!0}),[lt]),kt=g.useMemo(()=>new G(vt,{keys:["title","subtitle","matchedText"],threshold:.4,ignoreLocation:!0,includeScore:!0,includeMatches:!0}),[vt]),$t=g.useMemo(()=>new G(Dt,{keys:["title","subtitle","matchedText","activityText"],threshold:.4,ignoreLocation:!0,includeScore:!0,includeMatches:!0}),[Dt]),qt=g.useMemo(()=>new G(mt,{keys:["title","subtitle","_searchText"],threshold:.4,ignoreLocation:!0,includeScore:!0,includeMatches:!0}),[mt]),V=g.useMemo(()=>{if(!_.trim()){const E=[];E.push(...mt);const w=[...ct].sort((x,P)=>{const q=x.timeAway??0,tt=P.timeAway??0;return q-tt});E.push(...w),E.push(...Z.slice(0,2)),E.push(...lt.slice(0,2));const U={};return Ht.forEach((x,P)=>{U[x]=P}),E.sort((x,P)=>(U[x.type]??999)-(U[P.type]??999)),E}const r=_.toLowerCase(),A=St.search(_).slice(0,8),F=Bt.search(_).slice(0,3),M=It.search(_).slice(0,2),$=kt.search(_).slice(0,3),I=$t.search(_).slice(0,3),R=qt.search(_).filter(E=>{const w=E.score??1;return`${E.item.title} ${E.item.subtitle||""} ${E.item._searchText||""}`.toLowerCase().includes(r)||w<=.2}).slice(0,4),B=[],Y=[],J=[];for(const E of A){const w={...E.item};if(w._modifiedFiles&&w._modifiedFiles.length>0){const x=w._modifiedFiles.filter(P=>{var it;const q=((it=P.split("/").pop())==null?void 0:it.toLowerCase())||"",tt=P.toLowerCase();return q.includes(r)||tt.includes(r)});x.length>0&&(w.matchedFiles=x)}if(w._userQueries&&w._userQueries.length>0){const x=w._userQueries.find(P=>P.toLowerCase().includes(r));if(x)if(x.length>200){const q=x.toLowerCase().indexOf(r),tt=Math.max(0,q-60),it=Math.min(x.length,q+r.length+100);w.matchedQuery=(tt>0?"...":"")+x.slice(tt,it)+(it<x.length?"...":"")}else w.matchedQuery=x}if(w._historyEntries&&w._historyEntries.length>0){const x=w._historyEntries.find(P=>P.text.toLowerCase().includes(r));if(x)if(x.text.length>250){const q=x.text.toLowerCase().indexOf(r),tt=Math.max(0,q-80),it=Math.min(x.text.length,q+r.length+120);w.matchedHistory={text:(tt>0?"...":"")+x.text.slice(tt,it)+(it<x.text.length?"...":""),timestamp:x.timestamp}}else w.matchedHistory=x}const U=w.title.toLowerCase();U===r||U.startsWith(r)?Y.push(w):J.push(w)}for(const E of Y)B.push(E);for(const E of R)B.push(E.item);for(const E of J)B.push(E);for(const E of F)B.push(E.item);for(const E of M)B.push(E.item);for(const E of $)B.push(E.item);const L=new Set(A.map(E=>E.item.id));for(const E of I){const w=E.item.id.replace("activity-","").split("-")[0];L.has(`agent-${w}`)||B.push(E.item)}const ut={};return Ht.forEach((E,w)=>{ut[E]=w}),B.sort((E,w)=>(ut[E.type]??999)-(ut[w.type]??999)),B},[_,St,Bt,It,kt,$t,Z,ct,lt]);g.useEffect(()=>{K>=V.length&&nt(Math.max(0,V.length-1))},[V.length,K]);const te=g.useCallback(r=>{if(r.altKey&&!r.ctrlKey&&!r.metaKey&&(r.key==="p"||r.key==="n"||r.key==="P"||r.key==="N")){r.preventDefault(),r.stopPropagation(),r.nativeEvent.stopImmediatePropagation();const A=r.key.toLowerCase();nt(A==="p"?F=>F>0?F-1:V.length-1:F=>F<V.length-1?F+1:0);return}switch(r.key){case"Escape":r.preventDefault(),D.current();break;case"ArrowUp":r.preventDefault(),nt(A=>A>0?A-1:V.length-1);break;case"ArrowDown":r.preventDefault(),nt(A=>A<V.length-1?A+1:0);break;case"Enter":r.preventDefault(),V[K]&&V[K].action();break}},[V,K]),ee=g.useCallback((r,A)=>{if(!A||!r)return r;const F=r.toLowerCase(),M=A.toLowerCase(),$=[];let I=0,R=F.indexOf(M),B=0;for(;R!==-1;)R>I&&$.push(r.slice(I,R)),$.push(pt.createElement("mark",{key:B++,className:"spotlight-highlight"},r.slice(R,R+A.length))),I=R+A.length,R=F.indexOf(M,I);return I<r.length&&$.push(r.slice(I)),$.length>0?pt.createElement(pt.Fragment,null,...$):r},[]);return{query:_,setQuery:W,selectedIndex:K,setSelectedIndex:nt,results:V,handleKeyDown:te,highlightMatch:ee}}const Ge=g.forwardRef(function({query:t,onQueryChange:s,onKeyDown:n,onResetSelection:i},c){const{t:o}=Mt(["common"]);return m.jsxs("div",{className:"spotlight-input-wrapper",children:[m.jsx("span",{className:"spotlight-search-icon",children:"⌘"}),m.jsx("input",{ref:c,type:"text",className:"spotlight-input",placeholder:o("common:search.spotlightPlaceholder"),value:t,onChange:a=>{s(a.target.value),i()},onKeyDown:n,autoFocus:!0,spellCheck:!1}),m.jsxs("div",{className:"spotlight-input-hints",children:[m.jsx("span",{className:"spotlight-shortcut-hint",children:"↑↓"}),m.jsx("span",{className:"spotlight-shortcut-hint",children:"Enter"}),m.jsx("span",{className:"spotlight-shortcut-hint",children:"Esc"})]})]})}),Ye=g.memo(function({result:t,isSelected:s,query:n,highlightMatch:i,onClick:c,onMouseEnter:o}){const a=t.activityText||t.statusDescription||t.matchedFiles&&t.matchedFiles.length>0||t.matchedQuery||t.matchedHistory;return m.jsxs("div",{className:`spotlight-item ${s?"selected":""} ${t.activityText?"has-activity":""}`,onClick:c,onMouseEnter:o,role:"option","aria-selected":s,children:[m.jsx("span",{className:"spotlight-item-icon","aria-hidden":"true",children:t.icon}),m.jsxs("div",{className:"spotlight-item-content",children:[m.jsxs("div",{className:"spotlight-item-header",children:[m.jsx("span",{className:"spotlight-item-title",children:i(t.title,n)}),m.jsx("span",{className:`spotlight-item-type ${t.type}`,"aria-label":Ot(t.type),children:Ot(t.type)})]}),t.subtitle&&m.jsx("span",{className:"spotlight-item-subtitle",children:i(t.subtitle,n)}),t.statusDescription&&m.jsx("span",{className:"spotlight-item-status",children:i(t.statusDescription,n)}),t.activityText&&m.jsx("span",{className:"spotlight-item-activity",children:i(t.activityText,n)}),a&&m.jsxs("div",{className:"spotlight-item-details",children:[t.matchedFiles&&t.matchedFiles.length>0&&m.jsx("span",{className:"spotlight-item-files",children:t.matchedFiles.map((u,l)=>m.jsxs("span",{className:"file-badge",children:[l>0&&m.jsx("span",{className:"file-separator",children:"•"}),i(u.split("/").pop()||u,n)]},u))}),t.matchedQuery&&m.jsx("span",{className:"spotlight-item-query",children:i(t.matchedQuery,n)}),t.matchedHistory&&m.jsxs("span",{className:"spotlight-item-history",children:[i(t.matchedHistory.text,n),m.jsx("span",{className:"spotlight-history-time",children:Kt(t.matchedHistory.timestamp)})]})]}),(t.timeAway!==void 0||t.lastStatusTime!==void 0)&&m.jsxs("span",{className:"spotlight-item-time",children:[t.timeAway!==void 0&&m.jsxs("span",{className:"spotlight-time-away",children:["Idle: ",Zt(t.timeAway)]}),t.lastStatusTime!==void 0&&m.jsxs("span",{className:"spotlight-status-time",children:["Updated ",Kt(t.lastStatusTime)]})]}),t.lastUserInput&&!t.matchedQuery&&m.jsxs("span",{className:"spotlight-item-last-input",children:['"',i(t.lastUserInput,n),'"']})]})]})}),Je=g.forwardRef(function({results:t,selectedIndex:s,query:n,highlightMatch:i,onSelectIndex:c},o){const{t:a}=Mt(["terminal"]),u=g.useRef(!1);g.useEffect(()=>{u.current=!1},[t]),g.useEffect(()=>{const h=typeof o=="function"?null:o==null?void 0:o.current;if(!h)return;const f=()=>{u.current=!0};return h.addEventListener("mousemove",f),()=>{h.removeEventListener("mousemove",f)}},[o,t]);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"),activity:a("terminal:spotlight.categories.recentActivity")},d=g.useMemo(()=>{const h=[];let f=null,y=[];return t.forEach((C,k)=>{C.type!==f&&(f!==null&&y.length>0&&h.push([f,y]),f=C.type,y=[]),y.push({result:C,index:k})}),f!==null&&y.length>0&&h.push([f,y]),h},[t]);return g.useEffect(()=>{if(!o||typeof o=="function")return;const h=o.current;if(!h)return;const f=h.querySelector(".spotlight-item.selected");f&&f.scrollIntoView({block:"nearest",behavior:"smooth"})},[s,o]),t.length===0?m.jsx("div",{className:"spotlight-results",ref:o,children:m.jsx("div",{className:"spotlight-empty",children:a("terminal:spotlight.noResults")})}):m.jsx("div",{className:"spotlight-results",ref:o,children:d.map(([h,f])=>m.jsxs("div",{children:[d.length>1&&m.jsx("div",{className:"spotlight-category-header",children:l[h]||h}),f.map(({result:y,index:C})=>m.jsx(Ye,{result:y,isSelected:C===s,query:n,highlightMatch:i,onClick:()=>y.action(),onMouseEnter:()=>{u.current&&c(C)}},y.id))]},h))})}),Xe=g.memo(function(){const{t}=Mt(["terminal"]);return m.jsxs("div",{className:"spotlight-footer",children:[m.jsxs("div",{className:"spotlight-footer-left",children:[m.jsxs("span",{className:"spotlight-footer-hint",children:[m.jsx("kbd",{children:"↑"}),m.jsx("kbd",{children:"↓"})," ",m.jsx("kbd",{children:"Alt+N"}),m.jsx("kbd",{children:"Alt+P"})," ",t("terminal:spotlight.navigate")]}),m.jsxs("span",{className:"spotlight-footer-hint",children:[m.jsx("kbd",{children:"Enter"})," ",t("terminal:spotlight.select")]})]}),m.jsx("div",{className:"spotlight-footer-right",children:m.jsxs("span",{className:"spotlight-footer-hint",children:[m.jsx("kbd",{children:"Esc"})," ",t("common:buttons.close")]})})]})});function ss({isOpen:e,onClose:t,onOpenSpawnModal:s,onOpenCommanderView:n,onOpenToolbox:i,onOpenSupervisor:c,onOpenFileExplorer:o,onOpenPM2LogsModal:a,onOpenBossLogsModal:u,onOpenDatabasePanel:l,onOpenMonitoringModal:d}){const h=g.useRef(null),f=g.useRef(null),y=g.useRef(0),{query:C,setQuery:k,selectedIndex:D,setSelectedIndex:b,results:N,handleKeyDown:z,highlightMatch:Q}=Ue({isOpen:e,onClose:t,onOpenSpawnModal:s,onOpenCommanderView:n,onOpenToolbox:i,onOpenSupervisor:c,onOpenFileExplorer:o,onOpenPM2LogsModal:a,onOpenBossLogsModal:u,onOpenDatabasePanel:l,onOpenMonitoringModal:d});y.current=N.length,g.useEffect(()=>{e&&setTimeout(()=>{var S;(S=h.current)==null||S.focus()},50)},[e]),g.useEffect(()=>{if(!e)return;const S=v=>{if(v.key==="Escape"){v.preventDefault(),v.stopPropagation(),v.stopImmediatePropagation(),t();return}if(v.altKey&&!v.ctrlKey&&!v.metaKey&&(v.key==="n"||v.key==="p"||v.key==="N"||v.key==="P")){v.preventDefault(),v.stopPropagation(),v.stopImmediatePropagation();const j=v.key.toLowerCase(),_=y.current;b(j==="p"?W=>W>0?W-1:_-1:W=>W<_-1?W+1:0);return}};return window.addEventListener("keydown",S,{capture:!0}),()=>{window.removeEventListener("keydown",S,{capture:!0})}},[e,t]);const at=g.useCallback(S=>{S.target===S.currentTarget&&t()},[t]),st=g.useCallback(()=>{b(0)},[b]);return e?m.jsx("div",{className:"spotlight-overlay",onClick:at,children:m.jsxs("div",{className:"spotlight-modal",children:[m.jsx(Ge,{ref:h,query:C,onQueryChange:k,onKeyDown:z,onResetSelection:st}),m.jsx(Je,{ref:f,results:N,selectedIndex:D,query:C,highlightMatch:Q,onSelectIndex:b}),m.jsx(Xe,{})]})}):null}export{Tt as FILE_ICONS,ss as Spotlight,Xe as SpotlightFooter,Ge as SpotlightInput,Ye as SpotlightItem,Je as SpotlightResults,Zt as formatDuration,Kt as formatRelativeTime,Pt as getAgentIcon,Ve as getFileIconFromPath,Ot as getTypeLabel,Ue as useSpotlightSearch};
|