tide-commander 1.55.2 → 1.57.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/assets/{BossLogsModal-NMLA8Tb-.js → BossLogsModal-BwBPiIHp.js} +1 -1
  2. package/dist/assets/{BossSpawnModal-CHWYUZ5g.js → BossSpawnModal-DPBFSAYy.js} +1 -1
  3. package/dist/assets/{ControlsModal-B7YvUMVm.js → ControlsModal-BW3G1uJX.js} +1 -1
  4. package/dist/assets/{DockerLogsModal-CaspMYEh.js → DockerLogsModal-DZOp87-w.js} +1 -1
  5. package/dist/assets/{EmbeddedEditor-kYx4AdLw.js → EmbeddedEditor-CLG1Akse.js} +1 -1
  6. package/dist/assets/{GmailOAuthSetup-9eQ1r9Ar.js → GmailOAuthSetup-CB7dPDO1.js} +1 -1
  7. package/dist/assets/{GoogleOAuthSetup-Pi7a58Mi.js → GoogleOAuthSetup-BarVjw7w.js} +1 -1
  8. package/dist/assets/{IframeModal-z1T59LJS.js → IframeModal-BQSPQanQ.js} +1 -1
  9. package/dist/assets/{IntegrationsPanel-CB9QtfvD.js → IntegrationsPanel-DjV8Wn9_.js} +2 -2
  10. package/dist/assets/{LogViewerModal-BBdr9r3i.js → LogViewerModal-C8BFjrWu.js} +1 -1
  11. package/dist/assets/{MonitoringModal-CUZ4Xhuk.js → MonitoringModal-Cvu0xs8M.js} +1 -1
  12. package/dist/assets/{PM2LogsModal-Bt16sW5A.js → PM2LogsModal-X0iNty7H.js} +1 -1
  13. package/dist/assets/{RestoreArchivedAreaModal-BETGHA22.js → RestoreArchivedAreaModal-Df83lfgZ.js} +1 -1
  14. package/dist/assets/{Scene2DCanvas-BelfJXGw.js → Scene2DCanvas-Cn-i3V4y.js} +1 -1
  15. package/dist/assets/{SceneManager-BI_UCXtB.js → SceneManager-XiUuueR0.js} +1 -1
  16. package/dist/assets/{SkillsPanel-BHjnx8LP.js → SkillsPanel-CBJQ7XZ2.js} +1 -1
  17. package/dist/assets/SpawnModal-pPLoI5Iq.js +1 -0
  18. package/dist/assets/{SubordinateAssignmentModal-DHRZ-Evy.js → SubordinateAssignmentModal-Cq_zJRRQ.js} +1 -1
  19. package/dist/assets/{TriggerManagerPanel-cUWM5poU.js → TriggerManagerPanel-vNBLsk76.js} +1 -1
  20. package/dist/assets/{WorkflowEditorPanel-Ha9SXdvW.js → WorkflowEditorPanel-DxPBR30U.js} +1 -1
  21. package/dist/assets/{index-CD9Q_div.js → index-0IwqjnOt.js} +1 -1
  22. package/dist/assets/{index-DBgGw8Bd.js → index-B7QNRvGy.js} +1 -1
  23. package/dist/assets/{index-De9wibqy.js → index-BP3Xxs95.js} +1 -1
  24. package/dist/assets/{index-xU9wiWEU.js → index-BSEI99-s.js} +1 -1
  25. package/dist/assets/{index-BvZsOpS_.js → index-CIY_t_F3.js} +3 -3
  26. package/dist/assets/{index-CesYqhoW.js → index-Cfzg2JWf.js} +1 -1
  27. package/dist/assets/{index-BsEoXc0j.js → index-PtPORHO3.js} +2 -2
  28. package/dist/assets/{index-Vcs3Odgf.js → index-wbfZY0gc.js} +1 -1
  29. package/dist/assets/main-DeQm2kS-.css +1 -0
  30. package/dist/assets/{main-B_0o0aI9.js → main-muli6bmQ.js} +82 -81
  31. package/dist/assets/opencode.svg +12 -0
  32. package/dist/assets/{web-DGSbcqAM.js → web-CugONCdp.js} +1 -1
  33. package/dist/assets/{web-D2W-1YTG.js → web-DaHVj8Tk.js} +1 -1
  34. package/dist/index.html +2 -2
  35. package/dist/src/packages/server/integrations/jira/jira-client.js +1 -4
  36. package/dist/src/packages/server/services/llm-matcher-service.js +1 -1
  37. package/dist/src/packages/server/websocket/handlers/agent-handler.js +3 -0
  38. package/package.json +1 -1
  39. package/dist/assets/SpawnModal-Dwfx-NFz.js +0 -1
  40. package/dist/assets/main-DTgTDvIL.css +0 -1
@@ -0,0 +1,12 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="32" height="32">
2
+ <defs>
3
+ <linearGradient id="oc-bg" x1="0" y1="0" x2="32" y2="32" gradientUnits="userSpaceOnUse">
4
+ <stop offset="0%" stop-color="#059669"/>
5
+ <stop offset="100%" stop-color="#0891b2"/>
6
+ </linearGradient>
7
+ </defs>
8
+ <rect width="32" height="32" rx="7" fill="url(#oc-bg)"/>
9
+ <path d="M11 10L7 16L11 22" stroke="white" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" fill="none"/>
10
+ <path d="M21 10L25 16L21 22" stroke="white" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" fill="none"/>
11
+ <line x1="18.5" y1="9" x2="13.5" y2="23" stroke="white" stroke-width="2.5" stroke-linecap="round"/>
12
+ </svg>
@@ -1 +1 @@
1
- import{bG as s}from"./main-B_0o0aI9.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";class f extends s{constructor(){super(...arguments),this.pending=[],this.deliveredNotifications=[],this.hasNotificationSupport=()=>{if(!("Notification"in window)||!Notification.requestPermission)return!1;if(Notification.permission!=="granted")try{new Notification("")}catch(i){if(i instanceof Error&&i.name==="TypeError")return!1}return!0}}async getDeliveredNotifications(){const i=[];for(const t of this.deliveredNotifications){const e={title:t.title,id:parseInt(t.tag),body:t.body};i.push(e)}return{notifications:i}}async removeDeliveredNotifications(i){for(const t of i.notifications){const e=this.deliveredNotifications.find(n=>n.tag===String(t.id));e==null||e.close(),this.deliveredNotifications=this.deliveredNotifications.filter(()=>!e)}}async removeAllDeliveredNotifications(){for(const i of this.deliveredNotifications)i.close();this.deliveredNotifications=[]}async createChannel(){throw this.unimplemented("Not implemented on web.")}async deleteChannel(){throw this.unimplemented("Not implemented on web.")}async listChannels(){throw this.unimplemented("Not implemented on web.")}async schedule(i){if(!this.hasNotificationSupport())throw this.unavailable("Notifications not supported in this browser.");for(const t of i.notifications)this.sendNotification(t);return{notifications:i.notifications.map(t=>({id:t.id}))}}async getPending(){return{notifications:this.pending}}async registerActionTypes(){throw this.unimplemented("Not implemented on web.")}async cancel(i){this.pending=this.pending.filter(t=>!i.notifications.find(e=>e.id===t.id))}async areEnabled(){const{display:i}=await this.checkPermissions();return{value:i==="granted"}}async changeExactNotificationSetting(){throw this.unimplemented("Not implemented on web.")}async checkExactNotificationSetting(){throw this.unimplemented("Not implemented on web.")}async requestPermissions(){if(!this.hasNotificationSupport())throw this.unavailable("Notifications not supported in this browser.");return{display:this.transformNotificationPermission(await Notification.requestPermission())}}async checkPermissions(){if(!this.hasNotificationSupport())throw this.unavailable("Notifications not supported in this browser.");return{display:this.transformNotificationPermission(Notification.permission)}}transformNotificationPermission(i){switch(i){case"granted":return"granted";case"denied":return"denied";default:return"prompt"}}sendPending(){var i;const t=[],e=new Date().getTime();for(const n of this.pending)!((i=n.schedule)===null||i===void 0)&&i.at&&n.schedule.at.getTime()<=e&&(this.buildNotification(n),t.push(n));this.pending=this.pending.filter(n=>!t.find(o=>o===n))}sendNotification(i){var t;if(!((t=i.schedule)===null||t===void 0)&&t.at){const e=i.schedule.at.getTime()-new Date().getTime();this.pending.push(i),setTimeout(()=>{this.sendPending()},e);return}this.buildNotification(i)}buildNotification(i){const t=new Notification(i.title,{body:i.body,tag:String(i.id)});return t.addEventListener("click",this.onClick.bind(this,i),!1),t.addEventListener("show",this.onShow.bind(this,i),!1),t.addEventListener("close",()=>{this.deliveredNotifications=this.deliveredNotifications.filter(()=>!this)},!1),this.deliveredNotifications.push(t),t}onClick(i){const t={actionId:"tap",notification:i};this.notifyListeners("localNotificationActionPerformed",t)}onShow(i){this.notifyListeners("localNotificationReceived",i)}}export{f as LocalNotificationsWeb};
1
+ import{bG as s}from"./main-muli6bmQ.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";class f extends s{constructor(){super(...arguments),this.pending=[],this.deliveredNotifications=[],this.hasNotificationSupport=()=>{if(!("Notification"in window)||!Notification.requestPermission)return!1;if(Notification.permission!=="granted")try{new Notification("")}catch(i){if(i instanceof Error&&i.name==="TypeError")return!1}return!0}}async getDeliveredNotifications(){const i=[];for(const t of this.deliveredNotifications){const e={title:t.title,id:parseInt(t.tag),body:t.body};i.push(e)}return{notifications:i}}async removeDeliveredNotifications(i){for(const t of i.notifications){const e=this.deliveredNotifications.find(n=>n.tag===String(t.id));e==null||e.close(),this.deliveredNotifications=this.deliveredNotifications.filter(()=>!e)}}async removeAllDeliveredNotifications(){for(const i of this.deliveredNotifications)i.close();this.deliveredNotifications=[]}async createChannel(){throw this.unimplemented("Not implemented on web.")}async deleteChannel(){throw this.unimplemented("Not implemented on web.")}async listChannels(){throw this.unimplemented("Not implemented on web.")}async schedule(i){if(!this.hasNotificationSupport())throw this.unavailable("Notifications not supported in this browser.");for(const t of i.notifications)this.sendNotification(t);return{notifications:i.notifications.map(t=>({id:t.id}))}}async getPending(){return{notifications:this.pending}}async registerActionTypes(){throw this.unimplemented("Not implemented on web.")}async cancel(i){this.pending=this.pending.filter(t=>!i.notifications.find(e=>e.id===t.id))}async areEnabled(){const{display:i}=await this.checkPermissions();return{value:i==="granted"}}async changeExactNotificationSetting(){throw this.unimplemented("Not implemented on web.")}async checkExactNotificationSetting(){throw this.unimplemented("Not implemented on web.")}async requestPermissions(){if(!this.hasNotificationSupport())throw this.unavailable("Notifications not supported in this browser.");return{display:this.transformNotificationPermission(await Notification.requestPermission())}}async checkPermissions(){if(!this.hasNotificationSupport())throw this.unavailable("Notifications not supported in this browser.");return{display:this.transformNotificationPermission(Notification.permission)}}transformNotificationPermission(i){switch(i){case"granted":return"granted";case"denied":return"denied";default:return"prompt"}}sendPending(){var i;const t=[],e=new Date().getTime();for(const n of this.pending)!((i=n.schedule)===null||i===void 0)&&i.at&&n.schedule.at.getTime()<=e&&(this.buildNotification(n),t.push(n));this.pending=this.pending.filter(n=>!t.find(o=>o===n))}sendNotification(i){var t;if(!((t=i.schedule)===null||t===void 0)&&t.at){const e=i.schedule.at.getTime()-new Date().getTime();this.pending.push(i),setTimeout(()=>{this.sendPending()},e);return}this.buildNotification(i)}buildNotification(i){const t=new Notification(i.title,{body:i.body,tag:String(i.id)});return t.addEventListener("click",this.onClick.bind(this,i),!1),t.addEventListener("show",this.onShow.bind(this,i),!1),t.addEventListener("close",()=>{this.deliveredNotifications=this.deliveredNotifications.filter(()=>!this)},!1),this.deliveredNotifications.push(t),t}onClick(i){const t={actionId:"tap",notification:i};this.notifyListeners("localNotificationActionPerformed",t)}onShow(i){this.notifyListeners("localNotificationReceived",i)}}export{f as LocalNotificationsWeb};
@@ -1 +1 @@
1
- import{bG as a}from"./main-B_0o0aI9.js";import{ImpactStyle as i,NotificationType as r}from"./index-BsEoXc0j.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";class u extends a{constructor(){super(...arguments),this.selectionStarted=!1}async impact(t){const e=this.patternForImpact(t==null?void 0:t.style);this.vibrateWithPattern(e)}async notification(t){const e=this.patternForNotification(t==null?void 0:t.type);this.vibrateWithPattern(e)}async vibrate(t){const e=(t==null?void 0:t.duration)||300;this.vibrateWithPattern([e])}async selectionStart(){this.selectionStarted=!0}async selectionChanged(){this.selectionStarted&&this.vibrateWithPattern([70])}async selectionEnd(){this.selectionStarted=!1}patternForImpact(t=i.Heavy){return t===i.Medium?[43]:t===i.Light?[20]:[61]}patternForNotification(t=r.Success){return t===r.Warning?[30,40,30,50,60]:t===r.Error?[27,45,50]:[35,65,21]}vibrateWithPattern(t){if(navigator.vibrate)navigator.vibrate(t);else throw this.unavailable("Browser does not support the vibrate API")}}export{u as HapticsWeb};
1
+ import{bG as a}from"./main-muli6bmQ.js";import{ImpactStyle as i,NotificationType as r}from"./index-PtPORHO3.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";class u extends a{constructor(){super(...arguments),this.selectionStarted=!1}async impact(t){const e=this.patternForImpact(t==null?void 0:t.style);this.vibrateWithPattern(e)}async notification(t){const e=this.patternForNotification(t==null?void 0:t.type);this.vibrateWithPattern(e)}async vibrate(t){const e=(t==null?void 0:t.duration)||300;this.vibrateWithPattern([e])}async selectionStart(){this.selectionStarted=!0}async selectionChanged(){this.selectionStarted&&this.vibrateWithPattern([70])}async selectionEnd(){this.selectionStarted=!1}patternForImpact(t=i.Heavy){return t===i.Medium?[43]:t===i.Light?[20]:[61]}patternForNotification(t=r.Success){return t===r.Warning?[30,40,30,50,60]:t===r.Error?[27,45,50]:[35,65,21]}vibrateWithPattern(t){if(navigator.vibrate)navigator.vibrate(t);else throw this.unavailable("Browser does not support the vibrate API")}}export{u as HapticsWeb};
package/dist/index.html CHANGED
@@ -22,11 +22,11 @@
22
22
  <link rel="icon" type="image/png" sizes="16x16" href="/assets/icons/favicon-16x16.png" />
23
23
  <link rel="apple-touch-icon" sizes="180x180" href="/assets/icons/apple-touch-icon.png" />
24
24
  <title>Tide Commander</title>
25
- <script type="module" crossorigin src="/assets/main-B_0o0aI9.js"></script>
25
+ <script type="module" crossorigin src="/assets/main-muli6bmQ.js"></script>
26
26
  <link rel="modulepreload" crossorigin href="/assets/modulepreload-polyfill-B5Qt9EMX.js">
27
27
  <link rel="modulepreload" crossorigin href="/assets/vendor-react--Eh9ivFN.js">
28
28
  <link rel="modulepreload" crossorigin href="/assets/vendor-three-Chj50gSY.js">
29
- <link rel="stylesheet" crossorigin href="/assets/main-DTgTDvIL.css">
29
+ <link rel="stylesheet" crossorigin href="/assets/main-DeQm2kS-.css">
30
30
  </head>
31
31
  <body>
32
32
  <div id="app"></div>
@@ -118,18 +118,15 @@ export class JiraClient {
118
118
  }
119
119
  // ─── Search ───
120
120
  async searchIssues(jql, opts) {
121
- // Use POST /rest/api/3/search which returns full issue fields by default
122
- // (the newer /search/jql endpoint only returns IDs unless fields are explicit)
123
121
  const body = {
124
122
  jql,
125
123
  maxResults: opts?.maxResults ?? 25,
126
- startAt: opts?.startAt ?? 0,
127
124
  fields: opts?.fields ?? [
128
125
  'summary', 'status', 'priority', 'assignee', 'issuetype',
129
126
  'project', 'created', 'updated', 'labels',
130
127
  ],
131
128
  };
132
- return (await this.request('POST', '/rest/api/3/search', body));
129
+ return (await this.request('POST', '/rest/api/3/search/jql', body));
133
130
  }
134
131
  // ─── Service Desk (optional) ───
135
132
  async createServiceRequest(serviceDeskId, requestTypeId, params) {
@@ -113,7 +113,7 @@ Respond ONLY with valid JSON (no markdown, no explanation outside JSON):
113
113
  log.warn(`LLM match timed out after ${TIMEOUT_MS}ms`);
114
114
  return { match: false, reason: `LLM call timed out (${TIMEOUT_MS}ms)`, confidence: 0, durationMs, model, tokensUsed: 0 };
115
115
  }
116
- log.error('LLM match error:', err);
116
+ log.error(`LLM match error: ${err instanceof Error ? err.message : String(err)}`);
117
117
  return { match: false, reason: `LLM error: ${reason}`, confidence: 0, durationMs, model, tokensUsed: 0 };
118
118
  }
119
119
  }
@@ -768,6 +768,9 @@ export async function handleUpdateAgentProperties(ctx, payload) {
768
768
  if (updates.shortcut !== undefined) {
769
769
  agentUpdates.shortcut = updates.shortcut;
770
770
  }
771
+ if (updates.customInstructions !== undefined) {
772
+ agentUpdates.customInstructions = updates.customInstructions || undefined;
773
+ }
771
774
  // Apply agent property updates if any
772
775
  // agentService.updateAgent tracks pending property changes for notification on next command
773
776
  if (Object.keys(agentUpdates).length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tide-commander",
3
- "version": "1.55.2",
3
+ "version": "1.57.0",
4
4
  "description": "Visual multi-agent orchestrator and manager for Claude Code with 3D/2D interface",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1 +0,0 @@
1
- import{u as Qe,$ as Ve,a0 as Ze,a1 as es,a2 as ss,r as t,a3 as as,S as ke,a4 as te,A as ye,l as le,a5 as ns,s as b,h as ts,j as s,a6 as ls,G as Ae,a7 as x,a8 as os,I as G,a9 as oe,aa as $,ab as K,ac as ie,ad as is}from"./main-B_0o0aI9.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";function De(c,g){const S=g.filter(C=>!c.has(C));return S.length===0?`${g[Math.floor(Math.random()*g.length)]}-${Date.now()%1e3}`:S[Math.floor(Math.random()*S.length)]}function ms({isOpen:c,onClose:g,onSpawnStart:S,onSpawnEnd:C,spawnPosition:Ee,spawnAreaId:v}){const{t:a}=Qe(["terminal","common"]),P=Ve(),p=Ze(),ce=es(),H=ce.length>0?ce:ss,[m,N]=t.useState(""),[M,T]=t.useState(()=>as(ke.LAST_CWD)),[i,J]=t.useState("scout"),[re,D]=t.useState(!1),[Ie,F]=t.useState(!1),[de,Y]=t.useState(!1),[pe,me]=t.useState(""),[k,X]=t.useState([]),[y,z]=t.useState(null),[Le,ue]=t.useState(!1),[E,he]=t.useState(""),[u,_e]=t.useState(""),[R,$e]=t.useState(!0),[U,Pe]=t.useState("bypass"),[o,Q]=t.useState("claude"),[j,I]=t.useState({fullAuto:!0,sandbox:"workspace-write",approvalMode:"on-request",search:!1}),[we,V]=t.useState(new Set),[Z,xe]=t.useState("claude-opus-4-7"),[ee,fe]=t.useState("high"),[se,Te]=t.useState("gpt-5.3-codex"),[ae,Fe]=t.useState("minimax/MiniMax-M1-80k"),[ge,ze]=t.useState(""),[A,Re]=t.useState(""),q=t.useRef(null),je=t.useRef(!1),L=t.useCallback(()=>{window.__spawnModalAreaContext=null},[]),h=t.useMemo(()=>P.filter(e=>e.enabled),[P]),Ue=["full-notifications","streaming-exec","task-label","report-task-to-boss","agent-tracking","send-message-to-agent"];t.useEffect(()=>{if(c&&!je.current&&h.length>0){const n=h.filter(l=>Ue.includes(l.slug)).map(l=>l.id);n.length>0&&V(new Set(n))}je.current=c},[c,h]);const ve=t.useMemo(()=>{if(!A.trim())return h;const e=A.toLowerCase();return h.filter(n=>n.name.toLowerCase().includes(e)||n.description.toLowerCase().includes(e)||n.slug.toLowerCase().includes(e))},[h,A]),qe=t.useCallback(e=>{V(n=>{const l=new Set(n);return l.has(e)?l.delete(e):l.add(e),l})},[]);t.useMemo(()=>h.filter(e=>e.assignedAgentClasses.includes(i)),[h,i]);const We=t.useMemo(()=>{var n;const e=p.find(l=>l.id===i);return(n=e==null?void 0:e.defaultSkillIds)!=null&&n.length?P.filter(l=>e.defaultSkillIds.includes(l.id)):[]},[p,i,P]),Ne=t.useMemo(()=>{if(!E.trim())return k;const e=E.toLowerCase();return k.filter(n=>n.sessionId.toLowerCase().includes(e)||n.projectPath.toLowerCase().includes(e)||n.firstMessage&&n.firstMessage.toLowerCase().includes(e))},[k,E]),W=t.useMemo(()=>{if(!u.trim())return p;const e=u.toLowerCase();return p.filter(n=>n.name.toLowerCase().includes(e)||n.description.toLowerCase().includes(e)||n.id.toLowerCase().includes(e))},[p,u]),O=t.useMemo(()=>{if(!u.trim())return te;const e=u.toLowerCase();return te.filter(n=>{const l=ye[n.id];return n.name.toLowerCase().includes(e)||n.id.toLowerCase().includes(e)||l.description.toLowerCase().includes(e)})},[u]);t.useEffect(()=>{if(!c||!u.trim())return;const e=[...W.map(n=>n.id),...O.map(n=>n.id)];e.length===1&&e[0]!==i&&J(e[0])},[c,u,W,O,i]);const r=t.useMemo(()=>p.find(e=>e.id===i),[p,i]),Oe=t.useMemo(()=>{if(r!=null&&r.model)return r.model},[r]),Be=t.useMemo(()=>{if(r!=null&&r.customModelPath)return le(`/api/custom-models/${r.id}`)},[r]),Ge=r==null?void 0:r.modelScale,Ke=t.useMemo(()=>r?"scout":i,[i,r]),B=t.useCallback(async e=>{ue(!0);try{const n=e?le(`/api/agents/claude-sessions?cwd=${encodeURIComponent(e)}`):le("/api/agents/claude-sessions"),d=await(await ns(n)).json();X(d.sessions||[])}catch(n){console.error("Failed to fetch sessions:",n),X([])}finally{ue(!1)}},[]);t.useEffect(()=>{c?B(M||void 0):(X([]),z(null),he(""))},[c,B]),t.useEffect(()=>{if(!c)return;const e=setTimeout(()=>{B(M||void 0),z(null)},300);return()=>clearTimeout(e)},[M,c,B]),t.useEffect(()=>{if(!c||!v)return;const e=b.getState().areas.get(v);if(e!=null&&e.directories&&e.directories.length>0){T(e.directories[0]);return}const n=Array.from(b.getState().agents.values()).filter(f=>{var _;return((_=b.getAreaForAgent(f.id))==null?void 0:_.id)===v&&f.cwd});if(n.length===0)return;const l=new Map;for(const f of n)l.set(f.cwd,(l.get(f.cwd)||0)+1);let d="",w=0;for(const[f,_]of l)_>w&&(d=f,w=_);d&&T(d)},[c,v]),t.useEffect(()=>{if(c){const e=new Set(Array.from(b.getState().agents.values()).map(w=>w.name)),n=De(e,H),l=p.find(w=>w.id===i),d=l?`${l.name} ${n}`:n;N(d),q.current&&(q.current.focus(),q.current.select())}},[c,H]),t.useEffect(()=>{if(!c)return;const e=p.find(n=>n.id===i);if(e){const n=p.find(l=>m.startsWith(l.name+" "));if(n){const l=m.substring(n.name.length+1);N(`${e.name} ${l}`)}else N(`${e.name} ${m}`)}else{const n=p.find(l=>m.startsWith(l.name+" "));if(n){const l=m.substring(n.name.length+1);N(l)}}},[i]),t.useEffect(()=>{i==="boss"&&xe("claude-opus-4-7")},[i]);const He=()=>{var d;console.log("[SpawnModal] handleSpawn called"),F(!1);const e=y&&((d=k.find(w=>w.sessionId===y))==null?void 0:d.projectPath)||M;if(console.log("[SpawnModal] Effective CWD:",e),console.log("[SpawnModal] Agent name:",m),console.log("[SpawnModal] Agent class:",i),console.log("[SpawnModal] Permission mode:",U),console.log("[SpawnModal] Provider:",o),console.log("[SpawnModal] Use Chrome:",R),console.log("[SpawnModal] Session ID:",y||"none"),!e.trim()){console.error("[SpawnModal] Empty CWD, showing error"),F(!0);return}if(!m.trim()){console.log("[SpawnModal] Empty name, regenerating");const w=new Set(Array.from(b.getState().agents.values()).map(f=>f.name));N(De(w,H));return}is(ke.LAST_CWD,e),D(!0),S();const n=Array.from(we),l=ge.trim()||void 0;console.log("[SpawnModal] Calling store.spawnAgent with:",{name:m.trim(),class:i,cwd:e.trim(),sessionId:y||void 0,useChrome:o==="claude"?R:!1,permissionMode:U,provider:o,codexConfig:o==="codex"?j:void 0,codexModel:o==="codex"?se:void 0,opencodeModel:o==="opencode"?ae:void 0,initialSkillIds:n,model:o==="claude"?Z:void 0,customInstructions:l?`${l.length} chars`:void 0,spawnAreaId:v||void 0}),window.__spawnModalAreaContext=v?{areaId:v}:null,b.spawnAgent(m.trim(),i,e.trim(),Ee||void 0,y||void 0,o==="claude"?R:!1,U,n,o,o==="codex"?j:void 0,o==="codex"?se:void 0,o==="claude"?Z:void 0,l,o==="claude"?ee:void 0,o==="opencode"?ae:void 0)},be=()=>{console.log("[SpawnModal] Agent creation successful"),D(!1),N(""),V(new Set),L(),C(),g()},Se=()=>{console.error("[SpawnModal] Agent creation failed"),D(!1),F(!0),L(),C()},Ce=e=>{console.log("[SpawnModal] Directory not found:",e),D(!1),me(e),Y(!0),C()},Me=()=>{Y(!1),D(!0),S(),b.createDirectoryAndSpawn(pe,m.trim(),i)},ne=()=>{Y(!1),me(""),L()};t.useEffect(()=>(window.__spawnModalSuccess=be,window.__spawnModalError=Se,window.__spawnModalDirNotFound=Ce,()=>{L(),delete window.__spawnModalSuccess,delete window.__spawnModalError,delete window.__spawnModalDirNotFound}),[m,i,be,Se,Ce,L]);const{handleMouseDown:Je,handleClick:Ye}=ts(g),Xe=e=>{e.key==="Escape"&&g()};return!c&&!de?null:de?s.jsx("div",{className:"modal-overlay visible",onClick:ne,onKeyDown:e=>{e.key==="Escape"&&ne(),e.key==="Enter"&&Me()},children:s.jsxs("div",{className:"modal confirm-modal",onClick:e=>e.stopPropagation(),children:[s.jsx("div",{className:"modal-header",children:a("terminal:spawn.directoryNotFound")}),s.jsxs("div",{className:"modal-body confirm-modal-body",children:[s.jsx("p",{children:a("terminal:spawn.directoryNotExist")}),s.jsx("code",{className:"confirm-modal-path",children:pe}),s.jsx("p",{children:a("terminal:spawn.wouldYouCreate")})]}),s.jsxs("div",{className:"modal-footer",children:[s.jsx("button",{className:"btn btn-secondary",onClick:ne,children:a("common:buttons.cancel")}),s.jsx("button",{className:"btn btn-primary",onClick:Me,autoFocus:!0,children:a("terminal:spawn.createDirectory")})]})]})}):s.jsx("div",{className:`modal-overlay ${c?"visible":""}`,onMouseDown:Je,onClick:Ye,onKeyDown:Xe,children:s.jsxs("div",{className:"modal spawn-modal",children:[s.jsx("div",{className:"modal-header",children:a("terminal:spawn.deployTitle")}),s.jsxs("div",{className:"modal-body spawn-modal-body",children:[s.jsxs("div",{className:"spawn-top-section",children:[s.jsx("div",{className:"spawn-preview-compact",children:s.jsx(ls,{agentClass:Ke,modelFile:Oe,customModelUrl:Be,modelScale:Ge,width:100,height:120})}),s.jsxs("div",{className:"spawn-class-section",children:[s.jsx("div",{className:"spawn-class-label",children:a("terminal:spawn.agentClass")}),p.length+te.length>6&&s.jsx("input",{type:"text",className:"spawn-input class-search-input",placeholder:a("terminal:spawn.filterClasses"),value:u,onChange:e=>_e(e.target.value)}),s.jsxs("div",{className:"class-selector-inline",children:[W.map(e=>s.jsxs("button",{className:`class-chip ${i===e.id?"selected":""}`,onClick:()=>J(e.id),title:e.description,children:[s.jsx(Ae,{classId:e.id,size:18,className:"class-chip-icon"}),s.jsx("span",{className:"class-chip-name",children:e.name})]},e.id)),O.map(e=>{const n=ye[e.id];return s.jsxs("button",{className:`class-chip ${i===e.id?"selected":""}`,onClick:()=>J(e.id),title:n.description,children:[s.jsx(Ae,{classId:e.id,size:18,className:"class-chip-icon"}),s.jsx("span",{className:"class-chip-name",children:e.name})]},e.id)}),u&&W.length===0&&O.length===0&&s.jsx("div",{className:"class-search-empty",children:a("terminal:spawn.noClassesMatch",{query:u})})]})]})]}),s.jsxs("div",{className:"spawn-form-section",children:[s.jsxs("div",{className:"spawn-form-row",children:[s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:a("common:labels.name")}),s.jsx("input",{ref:q,type:"text",className:"spawn-input",placeholder:a("terminal:spawn.agentNamePlaceholder"),value:m,onChange:e=>N(e.target.value)})]}),s.jsxs("div",{className:"spawn-field spawn-field-wide",children:[s.jsxs("label",{className:"spawn-label",children:[a("terminal:spawn.workingDir"),s.jsx(x,{text:a("terminal:spawn.helpWorkingDir"),title:a("terminal:spawn.workingDir"),position:"top",size:"sm"})]}),s.jsx(os,{value:M,onChange:e=>{T(e),F(!1)},placeholder:a("terminal:spawn.workingDirPlaceholder"),className:`spawn-input ${Ie?"error":""}`,directoriesOnly:!0})]})]}),s.jsxs("div",{className:"spawn-form-row",children:[s.jsxs("div",{className:"spawn-field",children:[s.jsxs("label",{className:"spawn-label",children:[a("terminal:spawn.selectRuntime"),s.jsx(x,{text:a("terminal:spawn.helpRuntime"),title:a("terminal:spawn.runtimeTitle"),position:"top",size:"sm"})]}),s.jsxs("div",{className:"spawn-select-row",children:[s.jsxs("button",{className:`spawn-select-btn ${o==="claude"?"selected":""}`,onClick:()=>Q("claude"),title:a("terminal:spawn.useClaudeCli"),children:[s.jsx("img",{src:"/assets/claude.ico",alt:"Claude",className:"spawn-provider-icon"}),s.jsx("span",{children:"Claude"})]}),s.jsxs("button",{className:`spawn-select-btn ${o==="codex"?"selected":""}`,onClick:()=>Q("codex"),title:a("terminal:spawn.useCodexCli"),children:[s.jsx("img",{src:"/assets/codex.ico",alt:"Codex",className:"spawn-provider-icon"}),s.jsx("span",{children:"Codex"})]}),s.jsxs("button",{className:`spawn-select-btn spawn-select-btn--opencode ${o==="opencode"?"selected":""}`,onClick:()=>Q("opencode"),title:"Use OpenCode CLI (multi-provider)",children:[s.jsx("span",{children:s.jsx(G,{name:"status-pending",size:12,weight:"fill",color:"#4ade80"})}),s.jsx("span",{children:"OpenCode"})]})]})]}),s.jsxs("div",{className:"spawn-field",children:[s.jsxs("label",{className:"spawn-label",children:[a("common:labels.permissions"),s.jsx(x,{text:a("terminal:spawn.helpPermission"),title:a("terminal:spawn.permissionMode"),position:"top",size:"sm"})]}),s.jsx("div",{className:"spawn-select-row",children:Object.keys(oe).map(e=>s.jsxs("button",{className:`spawn-select-btn ${U===e?"selected":""}`,onClick:()=>Pe(e),title:oe[e].description,children:[s.jsx("span",{children:s.jsx(G,{name:e==="bypass"?"bolt":"lock",size:12})}),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:[a("common:labels.model"),s.jsx(x,{text:a("terminal:spawn.helpModel"),title:a("terminal:spawn.modelTitle"),position:"top",size:"sm"})]}),o==="claude"?s.jsx("div",{className:"spawn-select-row",children:Object.keys($).filter(e=>!$[e].deprecated).map(e=>s.jsxs("button",{className:`spawn-select-btn ${Z===e?"selected":""}`,onClick:()=>xe(e),title:$[e].description,children:[s.jsx("span",{children:$[e].icon}),s.jsx("span",{children:$[e].label})]},e))}):o==="codex"?s.jsx("div",{className:"spawn-select-row spawn-select-row--codex-models",children:Object.keys(K).map(e=>s.jsxs("button",{className:`spawn-select-btn ${se===e?"selected":""}`,onClick:()=>Te(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:ae,onChange:e=>Fe(e.target.value),placeholder:"provider/model (e.g., minimax/MiniMax-M1-80k)"}):s.jsx("div",{className:"spawn-inline-hint",children:a("terminal:spawn.chooseCodexModel")})]}),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:a("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=>$e(e.target.checked),disabled:o!=="claude"}),s.jsxs("span",{children:[s.jsx(G,{name:"globe",size:12})," ",a("terminal:spawn.chromeBrowser")]}),s.jsx(x,{text:a(o==="claude"?"terminal:spawn.helpChrome":"terminal:spawn.helpChromeDisabled"),title:a("terminal:spawn.chromeBrowser"),position:"top",size:"sm"})]})})]})]}),o==="codex"&&s.jsxs("div",{className:"codex-config-section",children:[s.jsx("div",{className:"codex-config-title",children:a("terminal:spawn.codex.configuration")}),s.jsxs("div",{className:"codex-config-options",children:[s.jsxs("div",{className:"codex-option-group",children:[s.jsxs("label",{className:"spawn-checkbox",children:[s.jsx("input",{type:"checkbox",checked:j.fullAuto!==!1,onChange:e=>I(n=>({...n,fullAuto:e.target.checked}))}),s.jsx("span",{children:a("terminal:spawn.codex.fullAuto")}),s.jsx(x,{text:a("terminal:spawn.helpFullAuto"),title:a("terminal:spawn.fullAutoTitle"),position:"top",size:"sm"})]}),s.jsxs("label",{className:"spawn-checkbox",children:[s.jsx("input",{type:"checkbox",checked:!!j.search,onChange:e=>I(n=>({...n,search:e.target.checked}))}),s.jsx("span",{children:a("terminal:spawn.codex.search")}),s.jsx(x,{text:a("terminal:spawn.helpSearch"),title:a("terminal:spawn.searchTitle"),position:"top",size:"sm"})]})]}),j.fullAuto===!1&&s.jsxs("div",{className:"codex-option-group",children:[s.jsx("div",{className:"codex-option-header",children:a("terminal:spawn.codex.restrictions")}),s.jsxs("select",{className:"spawn-input codex-select",value:j.sandbox||"workspace-write",onChange:e=>I(n=>({...n,sandbox:e.target.value})),children:[s.jsxs("option",{value:"read-only",children:["📖 ",a("terminal:spawn.codex.sandboxReadOnly")]}),s.jsxs("option",{value:"workspace-write",children:["✏️ ",a("terminal:spawn.codex.sandboxWorkspaceWrite")]}),s.jsxs("option",{value:"danger-full-access",children:["⚡ ",a("terminal:spawn.codex.sandboxDangerFullAccess")]})]}),s.jsxs("select",{className:"spawn-input codex-select",value:j.approvalMode||"on-request",onChange:e=>I(n=>({...n,approvalMode:e.target.value})),children:[s.jsxs("option",{value:"untrusted",children:["🔒 ",a("terminal:spawn.codex.approvalsUntrusted")]}),s.jsxs("option",{value:"on-failure",children:["⚠️ ",a("terminal:spawn.codex.approvalsOnFailure")]}),s.jsxs("option",{value:"on-request",children:["🤔 ",a("terminal:spawn.codex.approvalsOnRequest")]}),s.jsxs("option",{value:"never",children:["✅ ",a("terminal:spawn.codex.approvalsNever")]})]})]}),s.jsxs("div",{className:"codex-option-group",children:[s.jsx("div",{className:"codex-option-header",children:a("terminal:spawn.codex.profile")}),s.jsx("input",{type:"text",className:"spawn-input codex-profile-input",placeholder:a("terminal:spawn.codex.profilePlaceholder"),value:j.profile||"",onChange:e=>I(n=>({...n,profile:e.target.value||void 0}))})]})]})]}),h.length>0&&s.jsxs("div",{className:"spawn-skills-section",children:[s.jsxs("label",{className:"spawn-label",children:[a("terminal:spawn.skills")," ",s.jsxs("span",{className:"spawn-label-hint",children:["(",a("common:labels.optional"),")"]}),s.jsx(x,{text:a("terminal:spawn.helpSkills"),title:a("terminal:spawn.skillsTitle"),position:"top",size:"sm"})]}),h.length>6&&s.jsx("input",{type:"text",className:"spawn-input skill-search-input",placeholder:a("terminal:spawn.filterSkills"),value:A,onChange:e=>Re(e.target.value)}),s.jsxs("div",{className:"spawn-skills-inline",children:[ve.map(e=>{const n=we.has(e.id);return We.some(d=>d.id===e.id)?null:s.jsxs("button",{className:`spawn-skill-chip ${n?"selected":""}`,onClick:()=>qe(e.id),title:e.description,children:[n&&s.jsx("span",{className:"spawn-skill-check",children:s.jsx(G,{name:"check",size:10})}),s.jsx("span",{children:e.name}),e.builtin&&s.jsx("span",{className:"spawn-skill-builtin",children:"TC"})]},e.id)}),A&&ve.length===0&&s.jsx("div",{className:"skill-search-empty",children:a("terminal:spawn.noSkillsMatch",{query:A})})]})]}),s.jsxs("div",{className:"spawn-custom-instructions-section",children:[s.jsxs("label",{className:"spawn-label",children:[a("terminal:spawn.customInstructions")," ",s.jsxs("span",{className:"spawn-label-hint",children:["(",a("common:labels.optional"),")"]}),s.jsx(x,{text:a("terminal:spawn.helpCustomInstructions"),title:a("terminal:spawn.customInstructions"),position:"top",size:"sm"})]}),s.jsx("textarea",{className:"spawn-input spawn-textarea",placeholder:a("terminal:spawn.customInstructionsPlaceholder"),value:ge,onChange:e=>ze(e.target.value),rows:3})]}),s.jsxs("div",{className:"spawn-sessions-section",children:[s.jsxs("label",{className:"spawn-label",children:[a("terminal:spawn.linkSession")," ",s.jsxs("span",{className:"spawn-label-hint",children:["(",a("common:labels.optional"),")"]}),s.jsx(x,{text:a("terminal:spawn.helpLinkSession"),title:a("terminal:spawn.linkSessionTitle"),position:"top",size:"sm"})]}),k.length>0&&s.jsx("input",{type:"text",className:"spawn-input session-search-input",placeholder:a("terminal:spawn.searchSessions"),value:E,onChange:e=>he(e.target.value)}),s.jsx("div",{className:"sessions-list",children:Le?s.jsx("div",{className:"sessions-loading",children:a("terminal:spawn.loadingSessions")}):k.length===0?s.jsx("div",{className:"sessions-empty",children:a("terminal:spawn.noSessions")}):Ne.length===0?s.jsx("div",{className:"sessions-empty",children:a("terminal:spawn.noSessionsMatch",{query:E})}):Ne.map(e=>{const n=y===e.sessionId,l=Date.now()-new Date(e.lastModified).getTime(),d=l<6e4?a("common:time.justNow"):l<36e5?a("common:time.minutesAgo",{count:Math.floor(l/6e4)}):l<864e5?a("common:time.hoursAgo",{count:Math.floor(l/36e5)}):a("common:time.daysAgo",{count:Math.floor(l/864e5)});return s.jsxs("div",{className:`session-item ${n?"selected":""}`,onClick:()=>{n?z(null):(z(e.sessionId),T(e.projectPath))},children:[s.jsxs("div",{className:"session-item-header",children:[s.jsx("span",{className:"session-item-path",children:e.projectPath}),s.jsx("span",{className:"session-item-age",children:d})]}),s.jsx("div",{className:"session-item-preview",children:e.firstMessage||a("terminal:spawn.messagesCount",{count:e.messageCount})})]},e.sessionId)})})]})]})]}),s.jsxs("div",{className:"modal-footer",children:[s.jsx("button",{className:"btn btn-secondary",onClick:g,children:a("common:buttons.cancel")}),s.jsx("button",{className:"btn btn-primary",onClick:He,disabled:re,children:a(re?"common:buttons.deploying":"common:buttons2.deploy")})]})]})})}export{ms as SpawnModal};