tide-commander 1.40.2 → 1.40.3
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-CaDrNfm1.js → BossLogsModal-5ehRTeGs.js} +1 -1
- package/dist/assets/{BossSpawnModal-DLJInoVf.js → BossSpawnModal-DibwTCub.js} +1 -1
- package/dist/assets/{ControlsModal-Cnnhwfr_.js → ControlsModal-Bd5SZVzZ.js} +1 -1
- package/dist/assets/{DockerLogsModal-D4CbWK3-.js → DockerLogsModal-DWzJq-fY.js} +1 -1
- package/dist/assets/{EmbeddedEditor-36YBGNE2.js → EmbeddedEditor-D0Yo-o66.js} +1 -1
- package/dist/assets/{GmailOAuthSetup-DI5j7wkF.js → GmailOAuthSetup-CdX36hAm.js} +1 -1
- package/dist/assets/{GoogleOAuthSetup-Bsj02mND.js → GoogleOAuthSetup-B3zA-0E7.js} +1 -1
- package/dist/assets/{IframeModal-BJ4oeDBn.js → IframeModal-Cz8quXPm.js} +1 -1
- package/dist/assets/{IntegrationsPanel-DLmIJEUy.js → IntegrationsPanel-C1ktSqvl.js} +2 -2
- package/dist/assets/{LogViewerModal-D7CXMmZf.js → LogViewerModal-De8tLix0.js} +1 -1
- package/dist/assets/{MonitoringModal-PnEKvezF.js → MonitoringModal-DOaMyrjA.js} +1 -1
- package/dist/assets/{PM2LogsModal-EB_Au0iK.js → PM2LogsModal-D-Gq8l2H.js} +1 -1
- package/dist/assets/{RestoreArchivedAreaModal-C-X90Qxe.js → RestoreArchivedAreaModal-COSiM8Fi.js} +1 -1
- package/dist/assets/{SaveSnapshotModal-D6XAjL2T.js → SaveSnapshotModal-DxwK-i0L.js} +1 -1
- package/dist/assets/{Scene2DCanvas-DlVguRVM.js → Scene2DCanvas-4ByVcSoi.js} +1 -1
- package/dist/assets/{SceneManager-OOaJ_z8v.js → SceneManager-7WDKGyPC.js} +1 -1
- package/dist/assets/{SkillsPanel-D5wo2MHh.js → SkillsPanel-1Msh9dAe.js} +1 -1
- package/dist/assets/{SnapshotManager-BLjpctX_.js → SnapshotManager-DQ6jkxDW.js} +1 -1
- package/dist/assets/{SpawnModal-DQ4uUm1y.js → SpawnModal-CHALHOLz.js} +1 -1
- package/dist/assets/{SubordinateAssignmentModal-BDUDt6WC.js → SubordinateAssignmentModal-DBZsFe-S.js} +1 -1
- package/dist/assets/{SupervisorPanel-BZaBI9BA.js → SupervisorPanel-NYoLg7_B.js} +1 -1
- package/dist/assets/{TriggerManagerPanel-DuBiclsE.js → TriggerManagerPanel-CNhhmDvm.js} +1 -1
- package/dist/assets/{WorkflowEditorPanel-D49yDqth.js → WorkflowEditorPanel-BMpT0GGS.js} +1 -1
- package/dist/assets/{index-mQmnkGdF.js → index-BvYoT0dH.js} +1 -1
- package/dist/assets/{index-BxbFh16W.js → index-BzYz2FJi.js} +2 -2
- package/dist/assets/{index-BiGvhrCO.js → index-CDKrcnoB.js} +1 -1
- package/dist/assets/{index-BSl18-4e.js → index-CEZ1e3Of.js} +1 -1
- package/dist/assets/{index-DZ3f9mNd.js → index-CSOx3Jk0.js} +1 -1
- package/dist/assets/{index-Bxjd0N-j.js → index-CTINc_P-.js} +1 -1
- package/dist/assets/{index-DJdXbeWz.js → index-CqZxf78s.js} +3 -3
- package/dist/assets/{index-BwkNteiZ.js → index-DAOIgllP.js} +1 -1
- package/dist/assets/{main-DULfVodw.js → main-DSF4XPLl.js} +4 -4
- package/dist/assets/{web-DAqM9uoZ.js → web-2Scyvbzn.js} +1 -1
- package/dist/assets/{web-DQ10iSod.js → web-DXju9dHs.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/src/packages/server/cli.js +17 -1
- package/dist/src/packages/server/data/builtin-skills/boss-instructions.js +2 -2
- package/dist/src/packages/server/websocket/handlers/boss-response-handler.js +5 -1
- package/package.json +1 -1
|
@@ -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-DSF4XPLl.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-DSF4XPLl.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-DULfVodw.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-DSF4XPLl.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-DSF4XPLl.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-DSF4XPLl.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-DSF4XPLl.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-DSF4XPLl.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,4 +1,4 @@
|
|
|
1
|
-
import{al as sa,u as E,j as e,X as v,ao as Fs,ap as $s,Y as He,s as P,aq as Ms,D as V,a7 as ee,a8 as Ge,f as aa,ar as ta,r as o,P as na,S as la,h as ia,a9 as Ke}from"./main-
|
|
1
|
+
import{al as sa,u as E,j as e,X as v,ao as Fs,ap as $s,Y as He,s as P,aq as Ms,D as V,a7 as ee,a8 as Ge,f as aa,ar as ta,r as o,P as na,S as la,h as ia,a9 as Ke}from"./main-DSF4XPLl.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";const ra=[{value:"",labelKey:"terminal:building.colorDefault"},{value:"#2a2a3a",labelKey:"terminal:building.colorDarkGray"},{value:"#3a2a2a",labelKey:"terminal:building.colorDarkRed"},{value:"#2a3a2a",labelKey:"terminal:building.colorDarkGreen"},{value:"#2a2a4a",labelKey:"terminal:building.colorDarkBlue"},{value:"#3a3a2a",labelKey:"terminal:building.colorDarkYellow"},{value:"#3a2a3a",labelKey:"terminal:building.colorDarkPurple"},{value:"#2a3a3a",labelKey:"terminal:building.colorDarkCyan"},{value:"#4a3a3a",labelKey:"terminal:building.colorWarmBrown"},{value:"#3a4a4a",labelKey:"terminal:building.colorCoolSteel"}];function oa(a){return sa.t(a)}function qe(a){if(a===0)return"0 B";const l=1024,c=["B","KB","MB","GB"],h=Math.floor(Math.log(a)/Math.log(l));return parseFloat((a/Math.pow(l,h)).toFixed(1))+" "+c[h]}function ca(a){const c=Date.now()-a,h=Math.floor(c/(1e3*60*60)),t=Math.floor(c%(1e3*60*60)/(1e3*60));return h>0?`${h}h ${t}m`:`${t}m`}const Us={30:"#1a1a1a",31:"#e74c3c",32:"#2ecc71",33:"#f39c12",34:"#3498db",35:"#9b59b6",36:"#00bcd4",37:"#ecf0f1",90:"#7f8c8d",91:"#ff6b6b",92:"#4ade80",93:"#fbbf24",94:"#60a5fa",95:"#c084fc",96:"#22d3ee",97:"#ffffff"};function Ks(a){const l=[],c=/\x1B\[([0-9;]*)m/g;let h=0,t=null,r;for(;(r=c.exec(a))!==null;){if(r.index>h){const m=a.slice(h,r.index);t?l.push(e.jsx("span",{style:{color:t},children:m},l.length)):l.push(m)}const g=r[1].split(";").map(Number);for(const m of g)m===0||m===39?t=null:Us[m]&&(t=Us[m]);h=c.lastIndex}if(h<a.length){const g=a.slice(h);t?l.push(e.jsx("span",{style:{color:t},children:g},l.length)):l.push(g)}return l.length>0?l:[a]}function ma({buildingName:a,onClose:l,onConfirm:c}){const{t:h}=E(["terminal","common"]);return e.jsx("div",{className:"modal-overlay visible",onClick:l,children:e.jsxs("div",{className:"modal confirm-modal",onClick:t=>t.stopPropagation(),children:[e.jsx("div",{className:"modal-header",children:h("terminal:building.deleteBuilding")}),e.jsxs("div",{className:"modal-body confirm-modal-body",children:[e.jsx("p",{children:h("terminal:building.deleteConfirm",{name:a})}),e.jsx("p",{className:"confirm-modal-note",children:h("terminal:building.deleteNote")})]}),e.jsxs("div",{className:"modal-footer",children:[e.jsx("button",{className:"btn btn-secondary",onClick:l,children:h("common:buttons.cancel")}),e.jsx("button",{className:"btn btn-danger",onClick:c,autoFocus:!0,children:h("common:buttons.delete")})]})]})})}function da({usePM2:a,setUsePM2:l}){const{t:c}=E(["terminal"]);return e.jsxs("div",{className:"form-section pm2-toggle-section",children:[e.jsxs("label",{className:"toggle-switch",children:[e.jsx("input",{type:"checkbox",className:"toggle-input",checked:a,onChange:h=>l(h.target.checked)}),e.jsx("span",{className:"toggle-track",children:e.jsx("span",{className:"toggle-thumb"})}),e.jsxs("span",{className:"toggle-label",children:[e.jsx("span",{className:"pm2-badge",children:"PM2"}),c("terminal:building.usePM2")]})]}),e.jsx("div",{className:"form-hint",children:c("terminal:building.pm2Hint")})]})}function ua({usePM2:a,pm2Script:l,setPm2Script:c,pm2Args:h,setPm2Args:t,pm2Interpreter:r,setPm2Interpreter:g,pm2InterpreterArgs:m,setPm2InterpreterArgs:d,pm2Env:s,setPm2Env:u,isEditMode:b,building:x,handleCommand:N}){var y;const{t:p}=E(["terminal","common"]);return a?e.jsxs("div",{className:"form-section pm2-config-section",children:[e.jsx("label",{className:"form-label",children:p("terminal:building.pm2Configuration")}),e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:[p("terminal:building.pm2Script"),e.jsx(v,{text:p("terminal:building.helpPm2Script"),title:p("terminal:building.pm2Script"),position:"top",size:"sm"})]}),e.jsx("input",{type:"text",className:"form-input",value:l,onChange:j=>c(j.target.value),placeholder:"npm, java, python, ./app.js",required:a})]}),e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:[p("terminal:building.pm2Arguments"),e.jsx(v,{text:p("terminal:building.helpPm2Arguments"),title:p("terminal:building.pm2Arguments"),position:"top",size:"sm"})]}),e.jsx("input",{type:"text",className:"form-input",value:h,onChange:j=>t(j.target.value),placeholder:"run dev, -jar app.jar, app.py"})]}),e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:[p("terminal:building.pm2Interpreter"),e.jsx(v,{text:p("terminal:building.helpPm2Interpreter"),title:p("terminal:building.pm2Interpreter"),position:"top",size:"sm"})]}),e.jsx("select",{className:"form-input form-select",value:r,onChange:j=>g(j.target.value),children:Object.keys(Fs).map(j=>e.jsx("option",{value:j,children:Fs[j].label},j))})]}),e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:[p("terminal:building.pm2InterpArgs"),e.jsx(v,{text:p("terminal:building.helpPm2InterpArgs"),title:p("terminal:building.pm2InterpArgs"),position:"top",size:"sm"})]}),e.jsx("input",{type:"text",className:"form-input",value:m,onChange:j=>d(j.target.value),placeholder:"-jar (for Java)"})]}),e.jsxs("div",{className:"command-row env-row",children:[e.jsxs("span",{className:"command-label",children:[p("terminal:building.pm2Environment"),e.jsx(v,{text:p("terminal:building.helpPm2Environment"),title:p("terminal:building.pm2Environment"),position:"top",size:"sm"})]}),e.jsx("textarea",{className:"form-input form-textarea",value:s,onChange:j=>u(j.target.value),placeholder:`KEY=value
|
|
2
2
|
SERVER_PORT=7201
|
|
3
3
|
NODE_ENV=production`,rows:3})]}),e.jsx("div",{className:"pm2-examples",children:e.jsxs("details",{children:[e.jsx("summary",{children:p("terminal:building.pm2Examples")}),e.jsxs("div",{className:"pm2-examples-content",children:[e.jsxs("div",{className:"pm2-example",children:[e.jsx("strong",{children:"Node.js:"})," Script: ",e.jsx("code",{children:"npm"}),", Args: ",e.jsx("code",{children:"run dev"})]}),e.jsxs("div",{className:"pm2-example",children:[e.jsx("strong",{children:"Symfony:"})," Script: ",e.jsx("code",{children:"symfony"}),", Args: ",e.jsx("code",{children:"serve --no-daemon"}),", Interpreter: ",e.jsx("code",{children:"None"})]}),e.jsxs("div",{className:"pm2-example",children:[e.jsx("strong",{children:"Java JAR:"})," Script: ",e.jsx("code",{children:"app.jar"}),", Interpreter: ",e.jsx("code",{children:"Java"}),", Interp. Args: ",e.jsx("code",{children:"-jar"})]}),e.jsxs("div",{className:"pm2-example",children:[e.jsx("strong",{children:"Python:"})," Script: ",e.jsx("code",{children:"app.py"}),", Interpreter: ",e.jsx("code",{children:"Python 3"})]})]})]})}),b&&(x==null?void 0:x.pm2Status)&&e.jsx("div",{className:"pm2-status-display",children:e.jsxs("div",{className:"pm2-status-row",children:[e.jsxs("span",{className:"pm2-metric",children:[e.jsx("span",{className:"pm2-metric-label",children:"PID"}),e.jsx("span",{className:"pm2-metric-value",children:x.pm2Status.pid||"-"})]}),e.jsxs("span",{className:"pm2-metric",children:[e.jsx("span",{className:"pm2-metric-label",children:"CPU"}),e.jsxs("span",{className:"pm2-metric-value",children:[((y=x.pm2Status.cpu)==null?void 0:y.toFixed(1))||"0","%"]})]}),e.jsxs("span",{className:"pm2-metric",children:[e.jsx("span",{className:"pm2-metric-label",children:"MEM"}),e.jsx("span",{className:"pm2-metric-value",children:qe(x.pm2Status.memory||0)})]}),e.jsxs("span",{className:"pm2-metric",children:[e.jsx("span",{className:"pm2-metric-label",children:"Restarts"}),e.jsx("span",{className:"pm2-metric-value",children:x.pm2Status.restarts||0})]}),x.pm2Status.uptime&&e.jsxs("span",{className:"pm2-metric",children:[e.jsx("span",{className:"pm2-metric-label",children:"Uptime"}),e.jsx("span",{className:"pm2-metric-value",children:ca(x.pm2Status.uptime)})]})]})}),b&&e.jsxs("div",{className:"pm2-actions",children:[e.jsx("button",{type:"button",className:"btn btn-sm btn-success",onClick:()=>N("start"),children:p("common:buttons.start")}),e.jsx("button",{type:"button",className:"btn btn-sm btn-danger",onClick:()=>N("stop"),children:p("common:buttons.stop")}),e.jsx("button",{type:"button",className:"btn btn-sm btn-warning",onClick:()=>N("restart"),children:p("terminal:buildingAction.restart")}),e.jsx("button",{type:"button",className:"btn btn-sm",onClick:()=>N("logs"),children:p("terminal:logs.title")})]})]}):null}function pa({dockerMode:a,setDockerMode:l,dockerImage:c,setDockerImage:h,dockerContainerName:t,setDockerContainerName:r,dockerCommand:g,setDockerCommand:m,dockerPorts:d,setDockerPorts:s,dockerVolumes:u,setDockerVolumes:b,dockerNetwork:x,setDockerNetwork:N,dockerRestart:p,setDockerRestart:y,dockerPull:j,setDockerPull:F,dockerEnv:$,setDockerEnv:z,dockerComposePath:Y,setDockerComposePath:M,dockerComposeProject:J,setDockerComposeProject:U,dockerComposeServices:W,setDockerComposeServices:K,selectedExistingContainer:R,setSelectedExistingContainer:H,dockerContainersList:O,isEditMode:T,building:k,handleCommand:L}){const{t:A}=E(["config","common"]);return e.jsxs("div",{className:"form-section docker-config-section",children:[e.jsx("label",{className:"form-label",children:A("config:buildings.dockerConfig")}),e.jsxs("div",{className:"docker-mode-selector",children:[e.jsxs("label",{className:`docker-mode-option ${a==="container"?"active":""}`,children:[e.jsx("input",{type:"radio",name:"dockerMode",value:"container",checked:a==="container",onChange:()=>l("container")}),e.jsx("span",{className:"docker-mode-icon",children:"📦"}),e.jsx("span",{className:"docker-mode-label",children:"Container"}),e.jsx("span",{className:"docker-mode-desc",children:"Create a new container"})]}),e.jsxs("label",{className:`docker-mode-option ${a==="compose"?"active":""}`,children:[e.jsx("input",{type:"radio",name:"dockerMode",value:"compose",checked:a==="compose",onChange:()=>l("compose")}),e.jsx("span",{className:"docker-mode-icon",children:"🛠"}),e.jsx("span",{className:"docker-mode-label",children:"Compose"}),e.jsx("span",{className:"docker-mode-desc",children:"Manage multiple services"})]}),e.jsxs("label",{className:`docker-mode-option ${a==="existing"?"active":""}`,children:[e.jsx("input",{type:"radio",name:"dockerMode",value:"existing",checked:a==="existing",onChange:()=>l("existing")}),e.jsx("span",{className:"docker-mode-icon",children:"🔎"}),e.jsx("span",{className:"docker-mode-label",children:"Existing"}),e.jsx("span",{className:"docker-mode-desc",children:"Adopt existing container"})]})]}),a==="container"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:["Image:",e.jsx(v,{text:"Docker image to run, e.g., nginx:latest, redis:alpine, my-app:v1",title:"Image",position:"top",size:"sm"})]}),e.jsx("input",{type:"text",className:"form-input",value:c,onChange:n=>h(n.target.value),placeholder:"nginx:latest",required:!0})]}),e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:["Container Name:",e.jsx(v,{text:"Custom name for the container. If empty, auto-generated based on building name.",title:"Container Name",position:"top",size:"sm"})]}),e.jsx("input",{type:"text",className:"form-input",value:t,onChange:n=>r(n.target.value),placeholder:"Auto-generated (tc-{name}-{id})"})]}),e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:["Command:",e.jsx(v,{text:"Override the default container command. Leave empty to use image's CMD.",title:"Command Override",position:"top",size:"sm"})]}),e.jsx("input",{type:"text",className:"form-input",value:g,onChange:n=>m(n.target.value),placeholder:"Optional command override"})]}),e.jsxs("div",{className:"form-section docker-ports-section",children:[e.jsxs("label",{className:"form-label",children:["Port Mappings",e.jsx("button",{type:"button",className:"btn btn-sm btn-add",onClick:()=>s([...d,""]),children:"+ Add"})]}),d.map((n,C)=>e.jsxs("div",{className:"docker-mapping-row",children:[e.jsx("input",{type:"text",className:"form-input",value:n,onChange:B=>{const D=[...d];D[C]=B.target.value,s(D)},placeholder:"8080:80 or 3000"}),e.jsx("button",{type:"button",className:"btn btn-sm btn-danger",onClick:()=>s(d.filter((B,D)=>D!==C)),children:"x"})]},C)),d.length===0&&e.jsx("div",{className:"form-hint",children:"Format: host:container (e.g., 8080:80) or same port (e.g., 3000)"})]}),e.jsxs("div",{className:"form-section docker-volumes-section",children:[e.jsxs("label",{className:"form-label",children:["Volume Mounts",e.jsx("button",{type:"button",className:"btn btn-sm btn-add",onClick:()=>b([...u,""]),children:"+ Add"})]}),u.map((n,C)=>e.jsxs("div",{className:"docker-mapping-row",children:[e.jsx("input",{type:"text",className:"form-input",value:n,onChange:B=>{const D=[...u];D[C]=B.target.value,b(D)},placeholder:"./data:/app/data or /host/path:/container/path"}),e.jsx("button",{type:"button",className:"btn btn-sm btn-danger",onClick:()=>b(u.filter((B,D)=>D!==C)),children:"x"})]},C)),u.length===0&&e.jsx("div",{className:"form-hint",children:"Format: host_path:container_path (relative paths resolved from working directory)"})]}),e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:["Network:",e.jsx(v,{text:"Docker network to connect to. Leave empty for default bridge network.",title:"Network",position:"top",size:"sm"})]}),e.jsx("input",{type:"text",className:"form-input",value:x,onChange:n=>N(n.target.value),placeholder:"bridge (default)"})]}),e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:["Restart Policy:",e.jsx(v,{text:"When should Docker restart the container automatically?",title:"Restart Policy",position:"top",size:"sm"})]}),e.jsx("select",{className:"form-input form-select",value:p,onChange:n=>y(n.target.value),children:Object.keys($s).map(n=>e.jsx("option",{value:n,children:$s[n].label},n))})]})]}),a==="compose"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:["Compose File:",e.jsx(v,{text:"Path to docker-compose.yml file, relative to working directory.",title:"Compose File",position:"top",size:"sm"})]}),e.jsx(He,{value:Y,onChange:M,placeholder:"docker-compose.yml",className:"form-input",directoriesOnly:!1})]}),e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:["Project Name:",e.jsx(v,{text:"Override the compose project name. Leave empty for auto-generated name.",title:"Project Name",position:"top",size:"sm"})]}),e.jsx("input",{type:"text",className:"form-input",value:J,onChange:n=>U(n.target.value),placeholder:"Auto-generated"})]}),e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:["Services:",e.jsx(v,{text:"Specific services to manage (comma-separated). Leave empty for all services.",title:"Services",position:"top",size:"sm"})]}),e.jsx("input",{type:"text",className:"form-input",value:W,onChange:n=>K(n.target.value),placeholder:"All services (or: api, db, redis)"})]})]}),a==="existing"&&e.jsxs("div",{className:"docker-existing-section",children:[e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:["Select Container:",e.jsx(v,{text:"Choose an existing Docker container to monitor and control. The container will not be deleted when removing the building.",title:"Existing Container",position:"top",size:"sm"})]}),e.jsxs("div",{className:"docker-existing-select-wrapper",children:[e.jsxs("select",{className:"form-input form-select",value:R,onChange:n=>H(n.target.value),required:a==="existing",children:[e.jsx("option",{value:"",children:"Select a container..."}),O.map(n=>e.jsxs("option",{value:n.name,children:[n.name," (",n.image,") - ",n.state]},n.id))]}),e.jsx("button",{type:"button",className:"btn btn-sm",onClick:()=>P.requestDockerContainersList(),title:"Refresh container list",children:"↻"})]})]}),O.length===0&&e.jsx("div",{className:"form-hint docker-existing-hint",children:"No containers found. Make sure Docker is running and you have containers available."}),R&&e.jsx("div",{className:"docker-existing-info",children:(()=>{const n=O.find(C=>C.name===R);return n?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"docker-existing-info-row",children:[e.jsx("span",{className:"docker-existing-info-label",children:"Image:"}),e.jsx("span",{className:"docker-existing-info-value",children:n.image})]}),e.jsxs("div",{className:"docker-existing-info-row",children:[e.jsx("span",{className:"docker-existing-info-label",children:"Status:"}),e.jsx("span",{className:`docker-existing-info-value docker-status-${n.status}`,children:n.state})]}),e.jsxs("div",{className:"docker-existing-info-row",children:[e.jsx("span",{className:"docker-existing-info-label",children:"ID:"}),e.jsx("span",{className:"docker-existing-info-value",children:n.id.slice(0,12)})]}),n.ports.length>0&&e.jsxs("div",{className:"docker-existing-info-row",children:[e.jsx("span",{className:"docker-existing-info-label",children:"Ports:"}),e.jsx("span",{className:"docker-existing-info-value",children:n.ports.map(C=>`${C.host}:${C.container}/${C.protocol}`).join(", ")})]})]}):null})()}),e.jsx("div",{className:"form-hint",children:"Note: Existing containers will not be deleted when you remove this building."})]}),a!=="existing"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:["Pull Policy:",e.jsx(v,{text:"When to pull images: always, only if missing, or never.",title:"Pull Policy",position:"top",size:"sm"})]}),e.jsx("select",{className:"form-input form-select",value:j,onChange:n=>F(n.target.value),children:Object.keys(Ms).map(n=>e.jsx("option",{value:n,children:Ms[n].label},n))})]}),e.jsxs("div",{className:"command-row env-row",children:[e.jsxs("span",{className:"command-label",children:["Environment:",e.jsx(v,{text:"Environment variables in KEY=value format, one per line.",title:"Environment Variables",position:"top",size:"sm"})]}),e.jsx("textarea",{className:"form-input form-textarea",value:$,onChange:n=>z(n.target.value),placeholder:`KEY=value
|
|
4
4
|
DATABASE_URL=postgres://...
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/web-
|
|
2
|
-
import{bm as e,aN as o}from"./main-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/web-DXju9dHs.js","assets/main-DSF4XPLl.js","assets/modulepreload-polyfill-B5Qt9EMX.js","assets/vendor-react--Eh9ivFN.js","assets/vendor-three-Chj50gSY.js","assets/main-CUx2B9bn.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{bm as e,aN as o}from"./main-DSF4XPLl.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";var i;(function(r){r.Heavy="HEAVY",r.Medium="MEDIUM",r.Light="LIGHT"})(i||(i={}));var t;(function(r){r.Success="SUCCESS",r.Warning="WARNING",r.Error="ERROR"})(t||(t={}));const p=e("Haptics",{web:()=>o(()=>import("./web-DXju9dHs.js"),__vite__mapDeps([0,1,2,3,4,5])).then(r=>new r.HapticsWeb)});export{p as Haptics,i as ImpactStyle,t as NotificationType};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as ts,u as ns,B as _s,j as e,C as Is,E as Ms,G as Es,r as g,H as $s,I as Ds,J as Ss,K as Ls,s as Y,m as B}from"./main-DULfVodw.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";const Xs=1,gs=Xs*2.5;function Rs(s,v,d){const l=v.filter(o=>o.position&&!isNaN(o.position.x)&&!isNaN(o.position.z));let t,i,n,u;if(s.type==="rectangle"){const o=(s.width||10)/2,N=(s.height||10)/2;t=s.center.x-o,i=s.center.x+o,n=s.center.z-N,u=s.center.z+N}else{const o=s.radius||5;t=s.center.x-o,i=s.center.x+o,n=s.center.z-o,u=s.center.z+o}const b=2;if(t+=b,i-=b,n+=b,u-=b,d){const o={...d};if(o.x=Math.max(t,Math.min(i,o.x)),o.z=Math.max(n,Math.min(u,o.z)),fs(o,l,s))return o}const x=(t+i)/2,S=(n+u)/2,j=Math.min(i-x,u-S);for(let o=0;o<j;o+=gs*.5)for(let N=0;N<Math.PI*2;N+=Math.PI/8){const C=x+Math.cos(N)*o,E=S+Math.sin(N)*o,_={x:C,z:E};if(_.x=Math.max(t,Math.min(i,_.x)),_.z=Math.max(n,Math.min(u,_.z)),fs(_,l,s))return _}return{x,z:S}}function fs(s,v,d){for(const l of v){if(!l.position)continue;if(Math.hypot(s.x-l.position.x,s.z-l.position.z)<gs)return!1}if(d.type==="rectangle"){const l=(d.width||10)/2,t=(d.height||10)/2,i=s.x>=d.center.x-l+1&&s.x<=d.center.x+l-1,n=s.z>=d.center.z-t+1&&s.z<=d.center.z+t-1;return i&&n}else{const l=(d.radius||5)-1;return Math.hypot(s.x-d.center.x,s.z-d.center.z)<=l}}function vs(s){switch(s){case"idle":case"running":return"healthy";case"working":case"waiting":case"waiting_permission":case"starting":case"stopping":return"working";case"error":case"offline":case"orphaned":case"stopped":return"error";default:return"unknown"}}function Ps(s){switch(s){case"scout":return"🔍";case"builder":return"🔨";case"debugger":return"🐛";case"architect":return"📐";case"warrior":return"⚔️";case"support":return"🛟";case"boss":return"👑";default:return"🤖"}}function Us(s){switch(s){case"server":return"🖥️";case"link":return"🔗";case"database":return"🗄️";case"docker":return"🐳";case"monitor":return"📊";case"folder":return"📁";case"boss":return"🏰";default:return"🏢"}}function Ys(s,v){const d=[],l=new Set;for(const i of v.values()){if(i.archived)continue;const n=[];for(const u of i.assignedAgentIds){const b=s.get(u);b&&(n.push(b),l.add(u))}d.push({area:i,agents:n,label:i.name,color:i.color})}d.sort((i,n)=>i.label.localeCompare(n.label));const t=[];for(const i of s.values())l.has(i.id)||t.push(i);return t.length>0&&d.push({area:null,agents:t,label:"Unassigned",color:"#555"}),d}function Gs(s,v){const d=[],l=[],t=[];for(const n of s.values())n.status==="working"||n.status==="waiting"||n.status==="waiting_permission"?d.push(n):n.status==="error"||n.status==="offline"||n.status==="orphaned"?t.push(n):v&&v.has(n.id)?d.push(n):l.push(n);const i=[];return t.length>0&&i.push({area:null,agents:t,label:"Errors",color:"#d64545"}),d.length>0&&i.push({area:null,agents:d,label:"Working & Unseen",color:"#f5d76e"}),l.length>0&&i.push({area:null,agents:l,label:"Idle",color:"#5cb88a"}),i}function Hs(s){const v=Date.now(),l=[...Array.from(s.values())].sort((o,N)=>(N.lastActivity||0)-(o.lastActivity||0)),t=[],i=[],n=[],u=[],b=300*1e3,x=3600*1e3,S=1440*60*1e3;for(const o of l){const N=v-(o.lastActivity||0);N<b?t.push(o):N<x?i.push(o):N<S?n.push(o):u.push(o)}const j=[];return t.length>0&&j.push({area:null,agents:t,label:"Just Now (< 5m)",color:"#4ade80"}),i.length>0&&j.push({area:null,agents:i,label:"Recent (5m - 1h)",color:"#60a5fa"}),n.length>0&&j.push({area:null,agents:n,label:"Stale (1h - 1d)",color:"#facc15"}),u.length>0&&j.push({area:null,agents:u,label:"Very Stale (> 1d)",color:"#f87171"}),j}function Zs(s){return s.contextLimit<=0?0:Math.round(s.contextUsed/s.contextLimit*100)}function Bs(s){return s>=80?"red":s>=50?"yellow":"green"}function ms(s){return as(s)}function as(s,v={}){const{prioritizeRecentlyIdle:d=!1}=v;return[...s].sort((l,t)=>{const i={error:0,offline:0,orphaned:0,working:1,waiting:1,waiting_permission:1,idle:2},n=i[l.status]??3,u=i[t.status]??3;if(n!==u)return n-u;if(d&&l.status==="idle"&&t.status==="idle"){const b=!!l.taskLabel,x=!!t.taskLabel;return b!==x?b?-1:1:(t.lastActivity||0)-(l.lastActivity||0)}return l.name.localeCompare(t.name)})}const bs=ts.memo(({agent:s,isSelected:v,isKeyboardFocused:d=!1,onSelect:l,onDoubleClick:t,onChat:i,onFocus:n,onKill:u,onDragStart:b})=>{const{t:x}=ns(["dashboard","common"]),j=_s().has(s.id),o=vs(s.status),N=Ps(s.class),C=Zs(s),E=Bs(C),_=s.taskLabel?`📋 ${s.taskLabel}`:s.currentTask||s.lastAssignedTask,X=s.status==="idle"&&s.lastActivity>0,[,F]=ts.useState(0);return ts.useEffect(()=>{if(!X)return;const z=window.setInterval(()=>F(I=>I+1),15e3);return()=>window.clearInterval(z)},[X]),e.jsxs("div",{className:`dash-card dash-card--${o} ${v?"dash-card--selected":""} ${d?"dash-card--keyboard-focused":""}`,"data-agent-id":s.id,onClick:l,onDoubleClick:z=>{z.stopPropagation(),t()},onDragStart:z=>{b==null||b(s),z.dataTransfer.effectAllowed="move"},draggable:!0,title:x("cards.doubleClickHint"),children:[e.jsxs("div",{className:"dash-card__row1",children:[e.jsx("span",{className:`dash-card__status-dot dash-card__status-dot--${o}`}),e.jsx("span",{className:"dash-card__name",children:s.name}),e.jsxs("span",{className:"dash-card__class",children:[N," ",s.class]}),e.jsxs("span",{className:`dash-card__provider dash-card__provider--${s.provider}`,children:[s.provider==="codex"?"🔸":s.provider==="opencode"?"🟢":"🤖"," ",s.provider]}),j&&e.jsx("span",{className:"dash-card__unseen-badge",title:"New output available - click to view",children:"!"})]}),e.jsxs("div",{className:"dash-card__row2",children:[e.jsx("span",{className:`dash-card__status dash-card__status--${o}`,children:j?"Unseen":s.status}),e.jsxs("div",{className:"dash-card__context",children:[e.jsx("div",{className:"dash-card__context-bar",children:e.jsx("div",{className:`dash-card__context-fill dash-card__context-fill--${E}`,style:{width:`${C}%`}})}),e.jsxs("span",{className:`dash-card__context-pct dash-card__context-pct--${E}`,children:[C,"%"]})]})]}),e.jsxs("div",{className:"dash-card__row3",children:[e.jsxs("span",{className:"dash-card__workdir",title:s.cwd,children:["📁 ",s.cwd.split("/").pop()||s.cwd]}),X&&e.jsxs("span",{className:"dash-card__idle-time",style:{color:Es(s.lastActivity)},title:Ms(s.lastActivity),children:["⏱ ",Is(s.lastActivity)]})]}),_&&e.jsx("div",{className:"dash-card__row4",children:e.jsx("span",{className:"dash-card__task",children:_})}),e.jsxs("div",{className:"dash-card__actions",children:[i&&e.jsx("button",{className:"dash-card__action-btn dash-card__action-btn--chat",onClick:z=>{z.stopPropagation(),i()},title:x("cards.openTerminal"),children:x("cards.chat")}),u&&e.jsx("button",{className:"dash-card__action-btn dash-card__action-btn--danger",onClick:z=>{z.stopPropagation(),u()},title:x("cards.killAgent"),children:x("cards.stop")})]})]})});bs.displayName="AgentCard";const ps=({buildings:s,onSelectBuilding:v})=>{const{t:d}=ns(["dashboard"]),l=g.useMemo(()=>Array.from(s.values()).sort((t,i)=>t.name.localeCompare(i.name)),[s]);return e.jsxs("div",{className:"dashboard-view__buildings",children:[e.jsxs("div",{className:"dashboard-view__buildings-header",children:[e.jsx("span",{className:"dashboard-view__buildings-title",children:d("buildings.title")}),e.jsx("span",{className:"dashboard-view__buildings-count",children:l.length})]}),e.jsx("div",{className:"dashboard-view__buildings-row",children:l.map(t=>{const i=vs(t.status),n=Us(t.type);return e.jsxs("button",{className:`dash-pill dash-pill--${i}`,onClick:()=>v==null?void 0:v(t.id),title:`${t.name} (${t.type}) - ${t.status}`,children:[e.jsx("span",{className:"dash-pill__icon",children:n}),e.jsx("span",{className:"dash-pill__name",children:t.name}),e.jsx("span",{className:`dash-pill__dot dash-pill__dot--${i}`})]},t.id)})})]})};ps.displayName="BuildingPills";function Ks({onSelectAgent:s,onFocusAgent:v,onKillAgent:d,onSelectBuilding:l,onOpenTerminal:t,onFocusZone:i}){const{t:n}=ns(["dashboard","common"]),u=$s(),b=Ds(),x=Ss(),S=Ls(),j=_s(),[o,N]=g.useState(""),[C,E]=g.useState("all"),[_,X]=g.useState("zone"),[F,z]=g.useState(new Set),[I,J]=g.useState(null),[ws,V]=g.useState(null),[G,Q]=g.useState(!1),[M,T]=g.useState(null),W=g.useMemo(()=>{const a=Array.from(u.values());return{total:a.length,working:a.filter(h=>h.status==="working"||h.status==="waiting"||h.status==="waiting_permission").length,idle:a.filter(h=>h.status==="idle").length,error:a.filter(h=>h.status==="error"||h.status==="offline"||h.status==="orphaned").length}},[u]),rs=g.useMemo(()=>_==="zone"?Ys(u,x):_==="status"?Gs(u,j):Hs(u),[u,x,_,j]),K=g.useMemo(()=>{const a=o.toLowerCase().trim(),h=rs.map(p=>({...p,agents:p.agents.filter(k=>{if(C==="working"){if(k.status!=="working"&&k.status!=="waiting"&&k.status!=="waiting_permission")return!1}else if(C==="error"&&k.status!=="error"&&k.status!=="offline"&&k.status!=="orphaned")return!1;return!(a&&!k.name.toLowerCase().includes(a)&&!k.class.toLowerCase().includes(a))})}));return _==="zone"?h:h.filter(p=>p.agents.length>0)},[rs,C,o,_]),O=g.useCallback(a=>a.area?`area:${a.area.id}`:`${_}:${a.label}`,[_]),$=g.useMemo(()=>{const a=[];return K.forEach(h=>{const p=O(h);if(F.has(p))return;const k=_==="status"?as(h.agents,{prioritizeRecentlyIdle:!0}):ms(h.agents);a.push(...k)}),a},[K,F,_,O]),xs=g.useCallback(a=>{z(h=>{const p=new Set(h);return p.has(a)?p.delete(a):p.add(a),p})},[]),Ns=g.useCallback(a=>{t==null||t(a)},[t]),ks=g.useCallback(a=>{J(a)},[]),js=g.useCallback((a,h)=>{a.preventDefault(),a.dataTransfer.dropEffect="move",V(h)},[]),ys=g.useCallback(()=>{V(null)},[]),Cs=g.useCallback(a=>{if(!I)return;if(a===null){const R=Y.getState(),r=Array.from(R.areas.values()).find(c=>c.assignedAgentIds.includes(I.id));r&&Y.unassignAgentFromArea(I.id,r.id),J(null),V(null);return}const h=x.get(a);if(!h)return;const p=Array.from(u.values()),k=Rs(h,p,I.position);Y.updateAgent({...I,position:{...I.position,x:k.x,z:k.z}}),Y.assignAgentToArea(I.id,a),J(null),V(null)},[I,x,u]);return g.useEffect(()=>{if($.length===0){Q(!1),T(null);return}G&&(!M||!$.some(a=>a.id===M))&&(T($[0].id),s==null||s($[0].id))},[$,G,M,s]),g.useEffect(()=>{const a=r=>r instanceof HTMLElement?r.tagName==="INPUT"||r.tagName==="TEXTAREA"||r.tagName==="SELECT"||r.isContentEditable:!1,h=r=>r instanceof HTMLElement?!!r.closest(".guake-terminal")||r.classList.contains("guake-input")||r.classList.contains("agent-panel-input"):!1,p=r=>{const c=Array.from(document.querySelectorAll(".dash-card[data-agent-id]")).find(L=>L.dataset.agentId===r);c==null||c.scrollIntoView({block:"nearest",inline:"nearest"})},k=(r,c)=>{var os,cs,ds,ls,us,hs;const L=Array.from(document.querySelectorAll(".dash-card[data-agent-id]")).map(f=>{const w=f.dataset.agentId;if(!w)return null;const D=f.getBoundingClientRect();return{id:w,centerX:D.left+D.width/2,centerY:D.top+D.height/2,height:D.height}}).filter(f=>f!==null).sort((f,w)=>f.centerY-w.centerY||f.centerX-w.centerX);if(L.length===0)return r;const ss=L.reduce((f,w)=>f+w.height,0)/L.length,es=Math.max(18,ss*.6),A=[];for(const f of L){const w=A[A.length-1];if(!w){A.push([{id:f.id,centerX:f.centerX,centerY:f.centerY}]);continue}const D=w.reduce((As,zs)=>As+zs.centerY,0)/w.length;Math.abs(f.centerY-D)<=es?w.push({id:f.id,centerX:f.centerX,centerY:f.centerY}):A.push([{id:f.id,centerX:f.centerX,centerY:f.centerY}])}A.forEach(f=>f.sort((w,D)=>w.centerX-D.centerX));const H=A.findIndex(f=>f.some(w=>w.id===r));if(H===-1)return((cs=(os=A[0])==null?void 0:os[0])==null?void 0:cs.id)??r;const P=A[H],y=P.findIndex(f=>f.id===r);if(y===-1)return((ls=(ds=A[0])==null?void 0:ds[0])==null?void 0:ls.id)??r;if(c==="left")return((us=P[Math.max(0,y-1)])==null?void 0:us.id)??r;if(c==="right")return((hs=P[Math.min(P.length-1,y+1)])==null?void 0:hs.id)??r;const q=c==="up"?Math.max(0,H-1):Math.min(A.length-1,H+1),m=A[q],Z=P[y].centerX;let U=m[0],is=Math.abs(U.centerX-Z);for(const f of m){const w=Math.abs(f.centerX-Z);w<is&&(U=f,is=w)}return(U==null?void 0:U.id)??r},R=r=>{const c=Y.getShortcuts(),L=c.find(m=>m.id==="dashboard-selector-toggle"),ss=c.find(m=>m.id==="dashboard-vim-left"),es=c.find(m=>m.id==="dashboard-vim-down"),A=c.find(m=>m.id==="dashboard-vim-up"),H=c.find(m=>m.id==="dashboard-vim-right"),P=c.find(m=>m.id==="open-terminal"),y=Y.getState();if(a(r.target))if(!y.terminalOpen&&h(r.target)&&document.activeElement instanceof HTMLElement)document.activeElement.blur();else return;if(B(r,L)){if($.length===0)return;r.preventDefault(),r.stopPropagation(),Q(!0),T(m=>{const Z=m&&$.some(U=>U.id===m)?m:$[0].id;return s==null||s(Z),window.setTimeout(()=>p(Z),0),Z});return}const q=B(r,ss)||r.key==="ArrowLeft"?"left":B(r,es)||r.key==="ArrowDown"?"down":B(r,A)||r.key==="ArrowUp"?"up":B(r,H)||r.key==="ArrowRight"?"right":null;if(q&&G&&M){r.preventDefault(),r.stopPropagation();const m=k(M,q);m!==M&&(T(m),s==null||s(m),window.setTimeout(()=>p(m),0));return}if(B(r,P)){if(y.terminalOpen)return;if(G&&M&&y.agents.has(M)){r.preventDefault(),t==null||t(M);return}if(y.selectedAgentIds.size===1){r.preventDefault();const m=Array.from(y.selectedAgentIds)[0];t==null||t(m);return}if(y.lastSelectedAgentId&&y.agents.has(y.lastSelectedAgentId)){r.preventDefault(),t==null||t(y.lastSelectedAgentId);return}}};return document.addEventListener("keydown",R,!0),()=>document.removeEventListener("keydown",R,!0)},[$,G,M,t,s]),g.useEffect(()=>{const a=document.activeElement;a instanceof HTMLElement&&a.closest(".guake-terminal")&&!Y.getState().terminalOpen&&a.blur()},[]),e.jsxs("div",{className:"dashboard-view",children:[e.jsxs("div",{className:"dashboard-view__topbar",children:[e.jsxs("div",{className:"dashboard-view__metrics",children:[e.jsxs("button",{className:`dashboard-view__metric-btn ${C==="all"?"dashboard-view__metric-btn--active":""}`,onClick:()=>E("all"),children:[e.jsx("span",{className:"dashboard-view__metric-value",children:W.total}),e.jsx("span",{className:"dashboard-view__metric-label",children:n("common:labels.agents")})]}),e.jsxs("button",{className:`dashboard-view__metric-btn dashboard-view__metric-btn--working ${C==="working"?"dashboard-view__metric-btn--active":""}`,onClick:()=>E("working"),children:[e.jsx("span",{className:"dashboard-view__metric-value",children:W.working}),e.jsx("span",{className:"dashboard-view__metric-label",children:n("common:status.working")})]}),e.jsxs("button",{className:"dashboard-view__metric-btn dashboard-view__metric-btn--idle ",onClick:()=>E("all"),children:[e.jsx("span",{className:"dashboard-view__metric-value",children:W.idle}),e.jsx("span",{className:"dashboard-view__metric-label",children:n("common:status.idle")})]}),e.jsxs("button",{className:`dashboard-view__metric-btn dashboard-view__metric-btn--error ${C==="error"?"dashboard-view__metric-btn--active":""}`,onClick:()=>E("error"),children:[e.jsx("span",{className:"dashboard-view__metric-value",children:W.error}),e.jsx("span",{className:"dashboard-view__metric-label",children:n("common:status.error")})]})]}),e.jsx("input",{className:"dashboard-view__search",type:"text",placeholder:n("searchPlaceholder"),value:o,onChange:a=>N(a.target.value)})]}),e.jsxs("div",{className:"dashboard-view__grouping",children:[e.jsx("button",{className:`dashboard-view__grouping-btn ${_==="zone"?"dashboard-view__grouping-btn--active":""}`,onClick:()=>X("zone"),children:n("grouping.byZone")}),e.jsx("button",{className:`dashboard-view__grouping-btn ${_==="status"?"dashboard-view__grouping-btn--active":""}`,onClick:()=>X("status"),children:n("grouping.byStatus")}),e.jsx("button",{className:`dashboard-view__grouping-btn ${_==="activity"?"dashboard-view__grouping-btn--active":""}`,onClick:()=>X("activity"),children:n("grouping.byActivity")})]}),e.jsxs("div",{className:"dashboard-view__content",children:[K.map(a=>{const h=O(a),p=F.has(h),k=_==="status"?as(a.agents,{prioritizeRecentlyIdle:!0}):ms(a.agents),R=a.agents.filter(c=>c.status==="working"||c.status==="waiting"||c.status==="waiting_permission").length,r=a.agents.filter(c=>j.has(c.id)).length;return e.jsxs("div",{className:`dashboard-view__zone ${ws===(a.area?a.area.id:null)&&I?"dashboard-view__zone--drag-over":""}`,onDragOver:c=>js(c,a.area?a.area.id:null),onDragLeave:ys,onDrop:()=>Cs(a.area?a.area.id:null),children:[e.jsxs("div",{className:"dashboard-view__zone-header",onClick:()=>xs(h),children:[e.jsxs("div",{className:"dashboard-view__zone-left",children:[e.jsx("span",{className:`dashboard-view__zone-chevron ${p?"dashboard-view__zone-chevron--collapsed":""}`,children:"▼"}),e.jsx("span",{className:"dashboard-view__zone-dot",style:{backgroundColor:a.color}}),e.jsx("span",{className:"dashboard-view__zone-name",children:a.label}),e.jsxs("span",{className:"dashboard-view__zone-count",children:[n("agentCount",{count:a.agents.length}),R>0&&e.jsxs("span",{className:"dashboard-view__zone-working",children:[" · ",R," ",n("working")]}),r>0&&e.jsxs("span",{className:"dashboard-view__zone-unseen",children:[" · ",r," Unseen"]})]})]}),a.area&&i&&e.jsx("button",{className:"dashboard-view__zone-focus",onClick:c=>{c.stopPropagation(),i(a.area.id)},title:n("focusZone"),children:n("focusZone")})]}),!p&&e.jsx("div",{className:"dashboard-view__zone-grid",children:k.map(c=>e.jsx(bs,{agent:c,isSelected:S.has(c.id),isKeyboardFocused:G&&M===c.id,onSelect:()=>{s==null||s(c.id),Q(!0),T(c.id)},onDoubleClick:()=>Ns(c.id),onChat:()=>t==null?void 0:t(c.id),onFocus:v?()=>v(c.id):void 0,onKill:d?()=>d(c.id):void 0,onDragStart:ks},c.id))})]},h)}),K.length===0&&e.jsx("div",{className:"dashboard-view__empty",children:o?n("noAgentsMatching",{search:o}):n("noAgentsSpawned")}),b.size>0&&e.jsx(ps,{buildings:b,onSelectBuilding:l})]})]})}export{Ks as DashboardView};
|
|
1
|
+
import{z as ts,u as ns,B as _s,j as e,C as Is,E as Ms,G as Es,r as g,H as $s,I as Ds,J as Ss,K as Ls,s as Y,m as B}from"./main-DSF4XPLl.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";const Xs=1,gs=Xs*2.5;function Rs(s,v,d){const l=v.filter(o=>o.position&&!isNaN(o.position.x)&&!isNaN(o.position.z));let t,i,n,u;if(s.type==="rectangle"){const o=(s.width||10)/2,N=(s.height||10)/2;t=s.center.x-o,i=s.center.x+o,n=s.center.z-N,u=s.center.z+N}else{const o=s.radius||5;t=s.center.x-o,i=s.center.x+o,n=s.center.z-o,u=s.center.z+o}const b=2;if(t+=b,i-=b,n+=b,u-=b,d){const o={...d};if(o.x=Math.max(t,Math.min(i,o.x)),o.z=Math.max(n,Math.min(u,o.z)),fs(o,l,s))return o}const x=(t+i)/2,S=(n+u)/2,j=Math.min(i-x,u-S);for(let o=0;o<j;o+=gs*.5)for(let N=0;N<Math.PI*2;N+=Math.PI/8){const C=x+Math.cos(N)*o,E=S+Math.sin(N)*o,_={x:C,z:E};if(_.x=Math.max(t,Math.min(i,_.x)),_.z=Math.max(n,Math.min(u,_.z)),fs(_,l,s))return _}return{x,z:S}}function fs(s,v,d){for(const l of v){if(!l.position)continue;if(Math.hypot(s.x-l.position.x,s.z-l.position.z)<gs)return!1}if(d.type==="rectangle"){const l=(d.width||10)/2,t=(d.height||10)/2,i=s.x>=d.center.x-l+1&&s.x<=d.center.x+l-1,n=s.z>=d.center.z-t+1&&s.z<=d.center.z+t-1;return i&&n}else{const l=(d.radius||5)-1;return Math.hypot(s.x-d.center.x,s.z-d.center.z)<=l}}function vs(s){switch(s){case"idle":case"running":return"healthy";case"working":case"waiting":case"waiting_permission":case"starting":case"stopping":return"working";case"error":case"offline":case"orphaned":case"stopped":return"error";default:return"unknown"}}function Ps(s){switch(s){case"scout":return"🔍";case"builder":return"🔨";case"debugger":return"🐛";case"architect":return"📐";case"warrior":return"⚔️";case"support":return"🛟";case"boss":return"👑";default:return"🤖"}}function Us(s){switch(s){case"server":return"🖥️";case"link":return"🔗";case"database":return"🗄️";case"docker":return"🐳";case"monitor":return"📊";case"folder":return"📁";case"boss":return"🏰";default:return"🏢"}}function Ys(s,v){const d=[],l=new Set;for(const i of v.values()){if(i.archived)continue;const n=[];for(const u of i.assignedAgentIds){const b=s.get(u);b&&(n.push(b),l.add(u))}d.push({area:i,agents:n,label:i.name,color:i.color})}d.sort((i,n)=>i.label.localeCompare(n.label));const t=[];for(const i of s.values())l.has(i.id)||t.push(i);return t.length>0&&d.push({area:null,agents:t,label:"Unassigned",color:"#555"}),d}function Gs(s,v){const d=[],l=[],t=[];for(const n of s.values())n.status==="working"||n.status==="waiting"||n.status==="waiting_permission"?d.push(n):n.status==="error"||n.status==="offline"||n.status==="orphaned"?t.push(n):v&&v.has(n.id)?d.push(n):l.push(n);const i=[];return t.length>0&&i.push({area:null,agents:t,label:"Errors",color:"#d64545"}),d.length>0&&i.push({area:null,agents:d,label:"Working & Unseen",color:"#f5d76e"}),l.length>0&&i.push({area:null,agents:l,label:"Idle",color:"#5cb88a"}),i}function Hs(s){const v=Date.now(),l=[...Array.from(s.values())].sort((o,N)=>(N.lastActivity||0)-(o.lastActivity||0)),t=[],i=[],n=[],u=[],b=300*1e3,x=3600*1e3,S=1440*60*1e3;for(const o of l){const N=v-(o.lastActivity||0);N<b?t.push(o):N<x?i.push(o):N<S?n.push(o):u.push(o)}const j=[];return t.length>0&&j.push({area:null,agents:t,label:"Just Now (< 5m)",color:"#4ade80"}),i.length>0&&j.push({area:null,agents:i,label:"Recent (5m - 1h)",color:"#60a5fa"}),n.length>0&&j.push({area:null,agents:n,label:"Stale (1h - 1d)",color:"#facc15"}),u.length>0&&j.push({area:null,agents:u,label:"Very Stale (> 1d)",color:"#f87171"}),j}function Zs(s){return s.contextLimit<=0?0:Math.round(s.contextUsed/s.contextLimit*100)}function Bs(s){return s>=80?"red":s>=50?"yellow":"green"}function ms(s){return as(s)}function as(s,v={}){const{prioritizeRecentlyIdle:d=!1}=v;return[...s].sort((l,t)=>{const i={error:0,offline:0,orphaned:0,working:1,waiting:1,waiting_permission:1,idle:2},n=i[l.status]??3,u=i[t.status]??3;if(n!==u)return n-u;if(d&&l.status==="idle"&&t.status==="idle"){const b=!!l.taskLabel,x=!!t.taskLabel;return b!==x?b?-1:1:(t.lastActivity||0)-(l.lastActivity||0)}return l.name.localeCompare(t.name)})}const bs=ts.memo(({agent:s,isSelected:v,isKeyboardFocused:d=!1,onSelect:l,onDoubleClick:t,onChat:i,onFocus:n,onKill:u,onDragStart:b})=>{const{t:x}=ns(["dashboard","common"]),j=_s().has(s.id),o=vs(s.status),N=Ps(s.class),C=Zs(s),E=Bs(C),_=s.taskLabel?`📋 ${s.taskLabel}`:s.currentTask||s.lastAssignedTask,X=s.status==="idle"&&s.lastActivity>0,[,F]=ts.useState(0);return ts.useEffect(()=>{if(!X)return;const z=window.setInterval(()=>F(I=>I+1),15e3);return()=>window.clearInterval(z)},[X]),e.jsxs("div",{className:`dash-card dash-card--${o} ${v?"dash-card--selected":""} ${d?"dash-card--keyboard-focused":""}`,"data-agent-id":s.id,onClick:l,onDoubleClick:z=>{z.stopPropagation(),t()},onDragStart:z=>{b==null||b(s),z.dataTransfer.effectAllowed="move"},draggable:!0,title:x("cards.doubleClickHint"),children:[e.jsxs("div",{className:"dash-card__row1",children:[e.jsx("span",{className:`dash-card__status-dot dash-card__status-dot--${o}`}),e.jsx("span",{className:"dash-card__name",children:s.name}),e.jsxs("span",{className:"dash-card__class",children:[N," ",s.class]}),e.jsxs("span",{className:`dash-card__provider dash-card__provider--${s.provider}`,children:[s.provider==="codex"?"🔸":s.provider==="opencode"?"🟢":"🤖"," ",s.provider]}),j&&e.jsx("span",{className:"dash-card__unseen-badge",title:"New output available - click to view",children:"!"})]}),e.jsxs("div",{className:"dash-card__row2",children:[e.jsx("span",{className:`dash-card__status dash-card__status--${o}`,children:j?"Unseen":s.status}),e.jsxs("div",{className:"dash-card__context",children:[e.jsx("div",{className:"dash-card__context-bar",children:e.jsx("div",{className:`dash-card__context-fill dash-card__context-fill--${E}`,style:{width:`${C}%`}})}),e.jsxs("span",{className:`dash-card__context-pct dash-card__context-pct--${E}`,children:[C,"%"]})]})]}),e.jsxs("div",{className:"dash-card__row3",children:[e.jsxs("span",{className:"dash-card__workdir",title:s.cwd,children:["📁 ",s.cwd.split("/").pop()||s.cwd]}),X&&e.jsxs("span",{className:"dash-card__idle-time",style:{color:Es(s.lastActivity)},title:Ms(s.lastActivity),children:["⏱ ",Is(s.lastActivity)]})]}),_&&e.jsx("div",{className:"dash-card__row4",children:e.jsx("span",{className:"dash-card__task",children:_})}),e.jsxs("div",{className:"dash-card__actions",children:[i&&e.jsx("button",{className:"dash-card__action-btn dash-card__action-btn--chat",onClick:z=>{z.stopPropagation(),i()},title:x("cards.openTerminal"),children:x("cards.chat")}),u&&e.jsx("button",{className:"dash-card__action-btn dash-card__action-btn--danger",onClick:z=>{z.stopPropagation(),u()},title:x("cards.killAgent"),children:x("cards.stop")})]})]})});bs.displayName="AgentCard";const ps=({buildings:s,onSelectBuilding:v})=>{const{t:d}=ns(["dashboard"]),l=g.useMemo(()=>Array.from(s.values()).sort((t,i)=>t.name.localeCompare(i.name)),[s]);return e.jsxs("div",{className:"dashboard-view__buildings",children:[e.jsxs("div",{className:"dashboard-view__buildings-header",children:[e.jsx("span",{className:"dashboard-view__buildings-title",children:d("buildings.title")}),e.jsx("span",{className:"dashboard-view__buildings-count",children:l.length})]}),e.jsx("div",{className:"dashboard-view__buildings-row",children:l.map(t=>{const i=vs(t.status),n=Us(t.type);return e.jsxs("button",{className:`dash-pill dash-pill--${i}`,onClick:()=>v==null?void 0:v(t.id),title:`${t.name} (${t.type}) - ${t.status}`,children:[e.jsx("span",{className:"dash-pill__icon",children:n}),e.jsx("span",{className:"dash-pill__name",children:t.name}),e.jsx("span",{className:`dash-pill__dot dash-pill__dot--${i}`})]},t.id)})})]})};ps.displayName="BuildingPills";function Ks({onSelectAgent:s,onFocusAgent:v,onKillAgent:d,onSelectBuilding:l,onOpenTerminal:t,onFocusZone:i}){const{t:n}=ns(["dashboard","common"]),u=$s(),b=Ds(),x=Ss(),S=Ls(),j=_s(),[o,N]=g.useState(""),[C,E]=g.useState("all"),[_,X]=g.useState("zone"),[F,z]=g.useState(new Set),[I,J]=g.useState(null),[ws,V]=g.useState(null),[G,Q]=g.useState(!1),[M,T]=g.useState(null),W=g.useMemo(()=>{const a=Array.from(u.values());return{total:a.length,working:a.filter(h=>h.status==="working"||h.status==="waiting"||h.status==="waiting_permission").length,idle:a.filter(h=>h.status==="idle").length,error:a.filter(h=>h.status==="error"||h.status==="offline"||h.status==="orphaned").length}},[u]),rs=g.useMemo(()=>_==="zone"?Ys(u,x):_==="status"?Gs(u,j):Hs(u),[u,x,_,j]),K=g.useMemo(()=>{const a=o.toLowerCase().trim(),h=rs.map(p=>({...p,agents:p.agents.filter(k=>{if(C==="working"){if(k.status!=="working"&&k.status!=="waiting"&&k.status!=="waiting_permission")return!1}else if(C==="error"&&k.status!=="error"&&k.status!=="offline"&&k.status!=="orphaned")return!1;return!(a&&!k.name.toLowerCase().includes(a)&&!k.class.toLowerCase().includes(a))})}));return _==="zone"?h:h.filter(p=>p.agents.length>0)},[rs,C,o,_]),O=g.useCallback(a=>a.area?`area:${a.area.id}`:`${_}:${a.label}`,[_]),$=g.useMemo(()=>{const a=[];return K.forEach(h=>{const p=O(h);if(F.has(p))return;const k=_==="status"?as(h.agents,{prioritizeRecentlyIdle:!0}):ms(h.agents);a.push(...k)}),a},[K,F,_,O]),xs=g.useCallback(a=>{z(h=>{const p=new Set(h);return p.has(a)?p.delete(a):p.add(a),p})},[]),Ns=g.useCallback(a=>{t==null||t(a)},[t]),ks=g.useCallback(a=>{J(a)},[]),js=g.useCallback((a,h)=>{a.preventDefault(),a.dataTransfer.dropEffect="move",V(h)},[]),ys=g.useCallback(()=>{V(null)},[]),Cs=g.useCallback(a=>{if(!I)return;if(a===null){const R=Y.getState(),r=Array.from(R.areas.values()).find(c=>c.assignedAgentIds.includes(I.id));r&&Y.unassignAgentFromArea(I.id,r.id),J(null),V(null);return}const h=x.get(a);if(!h)return;const p=Array.from(u.values()),k=Rs(h,p,I.position);Y.updateAgent({...I,position:{...I.position,x:k.x,z:k.z}}),Y.assignAgentToArea(I.id,a),J(null),V(null)},[I,x,u]);return g.useEffect(()=>{if($.length===0){Q(!1),T(null);return}G&&(!M||!$.some(a=>a.id===M))&&(T($[0].id),s==null||s($[0].id))},[$,G,M,s]),g.useEffect(()=>{const a=r=>r instanceof HTMLElement?r.tagName==="INPUT"||r.tagName==="TEXTAREA"||r.tagName==="SELECT"||r.isContentEditable:!1,h=r=>r instanceof HTMLElement?!!r.closest(".guake-terminal")||r.classList.contains("guake-input")||r.classList.contains("agent-panel-input"):!1,p=r=>{const c=Array.from(document.querySelectorAll(".dash-card[data-agent-id]")).find(L=>L.dataset.agentId===r);c==null||c.scrollIntoView({block:"nearest",inline:"nearest"})},k=(r,c)=>{var os,cs,ds,ls,us,hs;const L=Array.from(document.querySelectorAll(".dash-card[data-agent-id]")).map(f=>{const w=f.dataset.agentId;if(!w)return null;const D=f.getBoundingClientRect();return{id:w,centerX:D.left+D.width/2,centerY:D.top+D.height/2,height:D.height}}).filter(f=>f!==null).sort((f,w)=>f.centerY-w.centerY||f.centerX-w.centerX);if(L.length===0)return r;const ss=L.reduce((f,w)=>f+w.height,0)/L.length,es=Math.max(18,ss*.6),A=[];for(const f of L){const w=A[A.length-1];if(!w){A.push([{id:f.id,centerX:f.centerX,centerY:f.centerY}]);continue}const D=w.reduce((As,zs)=>As+zs.centerY,0)/w.length;Math.abs(f.centerY-D)<=es?w.push({id:f.id,centerX:f.centerX,centerY:f.centerY}):A.push([{id:f.id,centerX:f.centerX,centerY:f.centerY}])}A.forEach(f=>f.sort((w,D)=>w.centerX-D.centerX));const H=A.findIndex(f=>f.some(w=>w.id===r));if(H===-1)return((cs=(os=A[0])==null?void 0:os[0])==null?void 0:cs.id)??r;const P=A[H],y=P.findIndex(f=>f.id===r);if(y===-1)return((ls=(ds=A[0])==null?void 0:ds[0])==null?void 0:ls.id)??r;if(c==="left")return((us=P[Math.max(0,y-1)])==null?void 0:us.id)??r;if(c==="right")return((hs=P[Math.min(P.length-1,y+1)])==null?void 0:hs.id)??r;const q=c==="up"?Math.max(0,H-1):Math.min(A.length-1,H+1),m=A[q],Z=P[y].centerX;let U=m[0],is=Math.abs(U.centerX-Z);for(const f of m){const w=Math.abs(f.centerX-Z);w<is&&(U=f,is=w)}return(U==null?void 0:U.id)??r},R=r=>{const c=Y.getShortcuts(),L=c.find(m=>m.id==="dashboard-selector-toggle"),ss=c.find(m=>m.id==="dashboard-vim-left"),es=c.find(m=>m.id==="dashboard-vim-down"),A=c.find(m=>m.id==="dashboard-vim-up"),H=c.find(m=>m.id==="dashboard-vim-right"),P=c.find(m=>m.id==="open-terminal"),y=Y.getState();if(a(r.target))if(!y.terminalOpen&&h(r.target)&&document.activeElement instanceof HTMLElement)document.activeElement.blur();else return;if(B(r,L)){if($.length===0)return;r.preventDefault(),r.stopPropagation(),Q(!0),T(m=>{const Z=m&&$.some(U=>U.id===m)?m:$[0].id;return s==null||s(Z),window.setTimeout(()=>p(Z),0),Z});return}const q=B(r,ss)||r.key==="ArrowLeft"?"left":B(r,es)||r.key==="ArrowDown"?"down":B(r,A)||r.key==="ArrowUp"?"up":B(r,H)||r.key==="ArrowRight"?"right":null;if(q&&G&&M){r.preventDefault(),r.stopPropagation();const m=k(M,q);m!==M&&(T(m),s==null||s(m),window.setTimeout(()=>p(m),0));return}if(B(r,P)){if(y.terminalOpen)return;if(G&&M&&y.agents.has(M)){r.preventDefault(),t==null||t(M);return}if(y.selectedAgentIds.size===1){r.preventDefault();const m=Array.from(y.selectedAgentIds)[0];t==null||t(m);return}if(y.lastSelectedAgentId&&y.agents.has(y.lastSelectedAgentId)){r.preventDefault(),t==null||t(y.lastSelectedAgentId);return}}};return document.addEventListener("keydown",R,!0),()=>document.removeEventListener("keydown",R,!0)},[$,G,M,t,s]),g.useEffect(()=>{const a=document.activeElement;a instanceof HTMLElement&&a.closest(".guake-terminal")&&!Y.getState().terminalOpen&&a.blur()},[]),e.jsxs("div",{className:"dashboard-view",children:[e.jsxs("div",{className:"dashboard-view__topbar",children:[e.jsxs("div",{className:"dashboard-view__metrics",children:[e.jsxs("button",{className:`dashboard-view__metric-btn ${C==="all"?"dashboard-view__metric-btn--active":""}`,onClick:()=>E("all"),children:[e.jsx("span",{className:"dashboard-view__metric-value",children:W.total}),e.jsx("span",{className:"dashboard-view__metric-label",children:n("common:labels.agents")})]}),e.jsxs("button",{className:`dashboard-view__metric-btn dashboard-view__metric-btn--working ${C==="working"?"dashboard-view__metric-btn--active":""}`,onClick:()=>E("working"),children:[e.jsx("span",{className:"dashboard-view__metric-value",children:W.working}),e.jsx("span",{className:"dashboard-view__metric-label",children:n("common:status.working")})]}),e.jsxs("button",{className:"dashboard-view__metric-btn dashboard-view__metric-btn--idle ",onClick:()=>E("all"),children:[e.jsx("span",{className:"dashboard-view__metric-value",children:W.idle}),e.jsx("span",{className:"dashboard-view__metric-label",children:n("common:status.idle")})]}),e.jsxs("button",{className:`dashboard-view__metric-btn dashboard-view__metric-btn--error ${C==="error"?"dashboard-view__metric-btn--active":""}`,onClick:()=>E("error"),children:[e.jsx("span",{className:"dashboard-view__metric-value",children:W.error}),e.jsx("span",{className:"dashboard-view__metric-label",children:n("common:status.error")})]})]}),e.jsx("input",{className:"dashboard-view__search",type:"text",placeholder:n("searchPlaceholder"),value:o,onChange:a=>N(a.target.value)})]}),e.jsxs("div",{className:"dashboard-view__grouping",children:[e.jsx("button",{className:`dashboard-view__grouping-btn ${_==="zone"?"dashboard-view__grouping-btn--active":""}`,onClick:()=>X("zone"),children:n("grouping.byZone")}),e.jsx("button",{className:`dashboard-view__grouping-btn ${_==="status"?"dashboard-view__grouping-btn--active":""}`,onClick:()=>X("status"),children:n("grouping.byStatus")}),e.jsx("button",{className:`dashboard-view__grouping-btn ${_==="activity"?"dashboard-view__grouping-btn--active":""}`,onClick:()=>X("activity"),children:n("grouping.byActivity")})]}),e.jsxs("div",{className:"dashboard-view__content",children:[K.map(a=>{const h=O(a),p=F.has(h),k=_==="status"?as(a.agents,{prioritizeRecentlyIdle:!0}):ms(a.agents),R=a.agents.filter(c=>c.status==="working"||c.status==="waiting"||c.status==="waiting_permission").length,r=a.agents.filter(c=>j.has(c.id)).length;return e.jsxs("div",{className:`dashboard-view__zone ${ws===(a.area?a.area.id:null)&&I?"dashboard-view__zone--drag-over":""}`,onDragOver:c=>js(c,a.area?a.area.id:null),onDragLeave:ys,onDrop:()=>Cs(a.area?a.area.id:null),children:[e.jsxs("div",{className:"dashboard-view__zone-header",onClick:()=>xs(h),children:[e.jsxs("div",{className:"dashboard-view__zone-left",children:[e.jsx("span",{className:`dashboard-view__zone-chevron ${p?"dashboard-view__zone-chevron--collapsed":""}`,children:"▼"}),e.jsx("span",{className:"dashboard-view__zone-dot",style:{backgroundColor:a.color}}),e.jsx("span",{className:"dashboard-view__zone-name",children:a.label}),e.jsxs("span",{className:"dashboard-view__zone-count",children:[n("agentCount",{count:a.agents.length}),R>0&&e.jsxs("span",{className:"dashboard-view__zone-working",children:[" · ",R," ",n("working")]}),r>0&&e.jsxs("span",{className:"dashboard-view__zone-unseen",children:[" · ",r," Unseen"]})]})]}),a.area&&i&&e.jsx("button",{className:"dashboard-view__zone-focus",onClick:c=>{c.stopPropagation(),i(a.area.id)},title:n("focusZone"),children:n("focusZone")})]}),!p&&e.jsx("div",{className:"dashboard-view__zone-grid",children:k.map(c=>e.jsx(bs,{agent:c,isSelected:S.has(c.id),isKeyboardFocused:G&&M===c.id,onSelect:()=>{s==null||s(c.id),Q(!0),T(c.id)},onDoubleClick:()=>Ns(c.id),onChat:()=>t==null?void 0:t(c.id),onFocus:v?()=>v(c.id):void 0,onKill:d?()=>d(c.id):void 0,onDragStart:ks},c.id))})]},h)}),K.length===0&&e.jsx("div",{className:"dashboard-view__empty",children:o?n("noAgentsMatching",{search:o}):n("noAgentsSpawned")}),b.size>0&&e.jsx(ps,{buildings:b,onSelectBuilding:l})]})]})}export{Ks as DashboardView};
|