tide-commander 1.46.0 → 1.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{BossLogsModal-BIFXXaaq.js → BossLogsModal-CFwfed1-.js} +1 -1
- package/dist/assets/BossSpawnModal-DUQ6HEgW.js +1 -0
- package/dist/assets/{ControlsModal-DX_FqPx7.js → ControlsModal-BU8Ip7nq.js} +1 -1
- package/dist/assets/{DockerLogsModal-SoHgFfH1.js → DockerLogsModal-CbYYg1sc.js} +1 -1
- package/dist/assets/{EmbeddedEditor-Dx6Y7JM3.js → EmbeddedEditor-C_REDOwe.js} +1 -1
- package/dist/assets/{GmailOAuthSetup-K-SZcqrr.js → GmailOAuthSetup-DjgTvBxC.js} +1 -1
- package/dist/assets/{GoogleOAuthSetup-BfpfXmbM.js → GoogleOAuthSetup-Cg9TpR8P.js} +1 -1
- package/dist/assets/{IframeModal-BAgB3UQ3.js → IframeModal-Ca7ZWrHU.js} +1 -1
- package/dist/assets/{IntegrationsPanel-B1nXTZW8.js → IntegrationsPanel-8a2TGZA7.js} +2 -2
- package/dist/assets/{LogViewerModal-4do7lATm.js → LogViewerModal-DnCVSAMs.js} +1 -1
- package/dist/assets/{MonitoringModal-OAExiDTA.js → MonitoringModal-Cu8Kz_D_.js} +1 -1
- package/dist/assets/{PM2LogsModal-DnA2AsIM.js → PM2LogsModal-DTBPwViK.js} +1 -1
- package/dist/assets/{RestoreArchivedAreaModal-C0ADFzsM.js → RestoreArchivedAreaModal-C7ym_R1q.js} +1 -1
- package/dist/assets/{SaveSnapshotModal-Ct4aW93y.js → SaveSnapshotModal-Byqak-Tf.js} +1 -1
- package/dist/assets/{Scene2DCanvas-C5mj6yGY.js → Scene2DCanvas-Bzggyv_C.js} +1 -1
- package/dist/assets/{SceneManager-CPtKPGZP.js → SceneManager-CzgjrwbM.js} +1 -1
- package/dist/assets/{SkillsPanel-B0XFw3Ae.js → SkillsPanel-Djr7DSvf.js} +1 -1
- package/dist/assets/{SnapshotManager-0NaWlDXc.js → SnapshotManager-BfGQUnsS.js} +1 -1
- package/dist/assets/SpawnModal-BbKpL82w.js +1 -0
- package/dist/assets/{SubordinateAssignmentModal-BuzBY1CB.js → SubordinateAssignmentModal-B1TZX27W.js} +1 -1
- package/dist/assets/{SupervisorPanel-B2_2QYL0.js → SupervisorPanel-PK5vEWzs.js} +1 -1
- package/dist/assets/{TriggerManagerPanel-CUD10Dg9.js → TriggerManagerPanel-DVK-bbLW.js} +1 -1
- package/dist/assets/{WorkflowEditorPanel-qfjb7ozq.js → WorkflowEditorPanel-Brdqd-Ad.js} +1 -1
- package/dist/assets/{index-CKitMIQJ.js → index--5OtsLD2.js} +1 -1
- package/dist/assets/{index-CTdXoSNs.js → index-B5tIXl_r.js} +2 -2
- package/dist/assets/{index-RddWDRes.js → index-BExjQf95.js} +1 -1
- package/dist/assets/{index-D0e5Zn8j.js → index-BF9QVox6.js} +3 -3
- package/dist/assets/{index-BfXYjLRr.js → index-BP3hr2mC.js} +1 -1
- package/dist/assets/{index-BzvQBrQn.js → index-BgUdbPaM.js} +1 -1
- package/dist/assets/{index-DFTYc8O3.js → index-RJgcrQXD.js} +1 -1
- package/dist/assets/{index-K6Ld2Man.js → index-wIjtXnz9.js} +1 -1
- package/dist/assets/main-3GpIvzEr.css +1 -0
- package/dist/assets/{main-D3GShQ8B.js → main-CMpDB4wb.js} +63 -63
- package/dist/assets/{web-D0MII38C.js → web-BN1vvWmX.js} +1 -1
- package/dist/assets/{web-bLUMZcn-.js → web-N6EXBTZp.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/src/packages/server/codex/backend.js +5 -1
- package/dist/src/packages/server/data/builtin-skills/report-task-to-boss.js +1 -1
- package/dist/src/packages/server/routes/agents.js +45 -17
- package/dist/src/packages/server/services/agent-service.js +7 -1
- package/dist/src/packages/server/services/llm-matcher-service.js +3 -1
- package/dist/src/packages/shared/agent-types.js +9 -1
- package/package.json +1 -1
- package/dist/assets/BossSpawnModal-CL4eQrBS.js +0 -1
- package/dist/assets/SpawnModal-BOJQ1pln.js +0 -1
- package/dist/assets/main-Ch2CJGT4.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{bz as a}from"./main-
|
|
1
|
+
import{bz as a}from"./main-CMpDB4wb.js";import{ImpactStyle as i,NotificationType as r}from"./index-B5tIXl_r.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 +1 @@
|
|
|
1
|
-
import{bz as s}from"./main-
|
|
1
|
+
import{bz as s}from"./main-CMpDB4wb.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};
|
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-
|
|
25
|
+
<script type="module" crossorigin src="/assets/main-CMpDB4wb.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-
|
|
29
|
+
<link rel="stylesheet" crossorigin href="/assets/main-3GpIvzEr.css">
|
|
30
30
|
</head>
|
|
31
31
|
<body>
|
|
32
32
|
<div id="app"></div>
|
|
@@ -8,7 +8,11 @@ import { loadAreas } from '../data/index.js';
|
|
|
8
8
|
function shouldPassCodexModel(model) {
|
|
9
9
|
if (!model)
|
|
10
10
|
return false;
|
|
11
|
-
if (model === 'codex' ||
|
|
11
|
+
if (model === 'codex' ||
|
|
12
|
+
model === 'sonnet' ||
|
|
13
|
+
model === 'opus' ||
|
|
14
|
+
model === 'haiku' ||
|
|
15
|
+
model.startsWith('claude-')) {
|
|
12
16
|
return false;
|
|
13
17
|
}
|
|
14
18
|
return true;
|
|
@@ -61,7 +61,7 @@ EOF
|
|
|
61
61
|
- Replace \`YOUR_AGENT_ID\` with your actual agent ID from the system prompt
|
|
62
62
|
- Keep the summary concise but informative (what was done, key outcomes)
|
|
63
63
|
- Use \`"failed"\` status only when the task truly cannot be completed
|
|
64
|
-
-
|
|
64
|
+
- Safe to call even if the active delegation window has expired — the server will still accept the report and forward it to your recorded boss when possible
|
|
65
65
|
- Call this AFTER you have finished all work (not before)
|
|
66
66
|
- You should still send your regular task completion notification separately`,
|
|
67
67
|
};
|
|
@@ -687,46 +687,74 @@ router.post('/:id/report-task', async (req, res) => {
|
|
|
687
687
|
res.status(404).json({ error: `Agent not found: ${subordinateId}` });
|
|
688
688
|
return;
|
|
689
689
|
}
|
|
690
|
-
//
|
|
690
|
+
// Try active delegation tracking first, fall back to agent.bossId if delegation has cleared
|
|
691
691
|
const delegation = getBossForSubordinate(subordinateId);
|
|
692
|
-
|
|
693
|
-
res.status(400).json({ error: `No active delegation found for agent ${agent.name}. Not currently working under a boss.` });
|
|
694
|
-
return;
|
|
695
|
-
}
|
|
696
|
-
const bossAgent = agentService.getAgent(delegation.bossId);
|
|
697
|
-
const bossName = bossAgent?.name || delegation.bossId;
|
|
692
|
+
const resolvedBossId = delegation?.bossId || agent.bossId;
|
|
698
693
|
const taskStatus = status || 'completed';
|
|
699
694
|
const success = taskStatus === 'completed';
|
|
700
|
-
|
|
695
|
+
if (!resolvedBossId) {
|
|
696
|
+
log.log(`Agent ${agent.name} reported task ${taskStatus} but has no boss association. Accepting and logging: "${(summary || '').slice(0, 120)}"`);
|
|
697
|
+
res.status(200).json({
|
|
698
|
+
success: true,
|
|
699
|
+
subordinateId: agent.id,
|
|
700
|
+
subordinateName: agent.name,
|
|
701
|
+
bossId: null,
|
|
702
|
+
bossName: null,
|
|
703
|
+
taskStatus,
|
|
704
|
+
accepted: true,
|
|
705
|
+
forwarded: false,
|
|
706
|
+
reason: 'No active delegation and no recorded boss — report logged only.',
|
|
707
|
+
});
|
|
708
|
+
return;
|
|
709
|
+
}
|
|
710
|
+
const bossAgent = agentService.getAgent(resolvedBossId);
|
|
711
|
+
const bossName = bossAgent?.name || resolvedBossId;
|
|
712
|
+
const taskDescription = delegation?.taskDescription || '(no active delegation record — original task unknown)';
|
|
713
|
+
log.log(`Agent ${agent.name} reporting task ${taskStatus} to boss ${bossName}${delegation ? '' : ' (via fallback bossId, delegation already cleared)'}: "${(summary || '').slice(0, 80)}"`);
|
|
701
714
|
// 1. Broadcast agent_task_completed to update the progress indicator on the client
|
|
702
715
|
if (broadcastFn) {
|
|
703
716
|
broadcastFn({
|
|
704
717
|
type: 'agent_task_completed',
|
|
705
718
|
payload: {
|
|
706
|
-
bossId:
|
|
719
|
+
bossId: resolvedBossId,
|
|
707
720
|
subordinateId,
|
|
708
721
|
success,
|
|
709
722
|
},
|
|
710
723
|
});
|
|
711
724
|
}
|
|
712
|
-
// 2. Clear the active delegation tracking
|
|
725
|
+
// 2. Clear the active delegation tracking (no-op if already cleared)
|
|
713
726
|
clearDelegation(subordinateId);
|
|
714
|
-
// 3. Send a message to the boss so it knows the task finished and can decide next steps
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
727
|
+
// 3. Send a message to the boss so it knows the task finished and can decide next steps.
|
|
728
|
+
// If the boss agent is no longer available, accept the report without failing.
|
|
729
|
+
let forwarded = false;
|
|
730
|
+
if (bossAgent) {
|
|
731
|
+
const reportMessage = `[TASK REPORT from ${agent.name} (${subordinateId})]\n\nStatus: ${taskStatus === 'completed' ? 'COMPLETED' : 'FAILED'}\nOriginal task: ${taskDescription}\n${summary ? `\nSummary: ${summary}` : ''}\n\nYou may review the result, give follow-up instructions, or dismiss this agent's progress indicator.`;
|
|
732
|
+
try {
|
|
733
|
+
if (bossAgent.isBoss || bossAgent.class === 'boss') {
|
|
734
|
+
const { message: bossMessage, systemPrompt } = await bossMessageService.buildBossMessage(resolvedBossId, reportMessage);
|
|
735
|
+
await runtimeService.sendCommand(resolvedBossId, bossMessage, systemPrompt);
|
|
736
|
+
}
|
|
737
|
+
else {
|
|
738
|
+
await runtimeService.sendCommand(resolvedBossId, reportMessage);
|
|
739
|
+
}
|
|
740
|
+
forwarded = true;
|
|
741
|
+
}
|
|
742
|
+
catch (forwardErr) {
|
|
743
|
+
log.error(` Failed to forward task report to boss ${bossName}, accepting report anyway:`, forwardErr);
|
|
744
|
+
}
|
|
719
745
|
}
|
|
720
746
|
else {
|
|
721
|
-
|
|
747
|
+
log.log(` Boss agent ${resolvedBossId} not found — accepting report without forwarding.`);
|
|
722
748
|
}
|
|
723
749
|
res.status(200).json({
|
|
724
750
|
success: true,
|
|
725
751
|
subordinateId: agent.id,
|
|
726
752
|
subordinateName: agent.name,
|
|
727
|
-
bossId:
|
|
753
|
+
bossId: resolvedBossId,
|
|
728
754
|
bossName,
|
|
729
755
|
taskStatus,
|
|
756
|
+
accepted: true,
|
|
757
|
+
forwarded,
|
|
730
758
|
});
|
|
731
759
|
}
|
|
732
760
|
catch (err) {
|
|
@@ -10,7 +10,13 @@ import { listSessions, getSessionSummary, getProjectDir, loadSession, loadToolHi
|
|
|
10
10
|
import { loadSubagentHistory } from '../claude/subagent-history-loader.js';
|
|
11
11
|
import { logger, generateId } from '../utils/index.js';
|
|
12
12
|
const log = logger.agent;
|
|
13
|
-
const CLAUDE_MODELS = new Set([
|
|
13
|
+
const CLAUDE_MODELS = new Set([
|
|
14
|
+
'sonnet',
|
|
15
|
+
'opus',
|
|
16
|
+
'haiku',
|
|
17
|
+
'claude-opus-4-7',
|
|
18
|
+
'claude-opus-4-6',
|
|
19
|
+
]);
|
|
14
20
|
const DEFAULT_CLAUDE_CONTEXT_LIMIT = 200000;
|
|
15
21
|
const DEFAULT_CODEX_CONTEXT_LIMIT = 258400;
|
|
16
22
|
const DEFAULT_OPENCODE_CONTEXT_LIMIT = 200000;
|
|
@@ -15,7 +15,9 @@ const TIMEOUT_MS = 15_000;
|
|
|
15
15
|
const MODEL_MAP = {
|
|
16
16
|
haiku: 'claude-haiku-4-5-20251001',
|
|
17
17
|
sonnet: 'claude-sonnet-4-6-20250514',
|
|
18
|
-
opus: 'claude-opus-4-
|
|
18
|
+
opus: 'claude-opus-4-7',
|
|
19
|
+
'claude-opus-4-7': 'claude-opus-4-7',
|
|
20
|
+
'claude-opus-4-6': 'claude-opus-4-6-20250514',
|
|
19
21
|
};
|
|
20
22
|
function resolveModel(model) {
|
|
21
23
|
if (!model)
|
|
@@ -50,15 +50,23 @@ export const CODEX_MODELS = {
|
|
|
50
50
|
};
|
|
51
51
|
export const CLAUDE_MODELS = {
|
|
52
52
|
sonnet: { label: 'Sonnet', description: 'Balanced performance and cost (recommended)', icon: '⚡' },
|
|
53
|
-
opus: { label: 'Opus', description: '
|
|
53
|
+
'claude-opus-4-7': { label: 'Opus 4.7', description: 'Latest Opus — most capable, highest cost', icon: '🧠' },
|
|
54
|
+
opus: { label: 'Opus (legacy)', description: 'Legacy alias — prefer Opus 4.7', icon: '🧠', deprecated: true },
|
|
55
|
+
'claude-opus-4-6': { label: 'Opus 4.6', description: 'Previous Opus generation (retained for existing agents)', icon: '🧠', deprecated: true },
|
|
54
56
|
haiku: { label: 'Haiku', description: 'Fast and economical', icon: '🚀' },
|
|
55
57
|
};
|
|
56
58
|
export const CLAUDE_EFFORTS = {
|
|
57
59
|
low: { label: 'Low', description: 'Minimal reasoning, fastest responses', icon: '🏃' },
|
|
58
60
|
medium: { label: 'Medium', description: 'Balanced reasoning effort', icon: '⚖️' },
|
|
59
61
|
high: { label: 'High', description: 'Deep reasoning for complex tasks (default)', icon: '🔬' },
|
|
62
|
+
xHigh: { label: 'X-High', description: 'Extra-high reasoning (Opus 4.7+)', icon: '🧪' },
|
|
60
63
|
max: { label: 'Max', description: 'Maximum reasoning, most thorough', icon: '🧠' },
|
|
61
64
|
};
|
|
65
|
+
// Model IDs that should be hidden from the "new agent" model picker.
|
|
66
|
+
// They remain valid ClaudeModel values so existing agents keep working.
|
|
67
|
+
export function isDeprecatedClaudeModel(model) {
|
|
68
|
+
return CLAUDE_MODELS[model]?.deprecated === true;
|
|
69
|
+
}
|
|
62
70
|
// Boss context delimiters - used to inject subordinate context at the beginning of user messages
|
|
63
71
|
// The frontend detects these to collapse/hide the context section in the UI
|
|
64
72
|
export const BOSS_CONTEXT_START = '<<<BOSS_CONTEXT_START>>>';
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as Ae,f as Le,N as Ee,M as Ie,r as t,U as _e,S as ee,l as De,V as O,A as se,a3 as T,a4 as j,j as s,C as S,X as Be,Z as Re,_ as P,$ as L,a0 as E,a2 as Oe,s as Te}from"./main-D3GShQ8B.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";function ae(m){const h=j.filter(g=>!m.has(`Boss ${g}`));return h.length===0?`Boss ${j[Math.floor(Math.random()*j.length)]}-${Date.now()%1e3}`:`Boss ${h[Math.floor(Math.random()*h.length)]}`}function ze({isOpen:m,onClose:h,onSpawnStart:g,onSpawnEnd:I,spawnPosition:ne}){const{t:n}=Ae(["terminal","common"]),{agents:C}=Le(),o=Ee(),k=Ie(),[r,p]=t.useState(""),[M,le]=t.useState(()=>_e(ee.LAST_CWD)),[c,_]=t.useState("boss"),[U,q]=t.useState(!1),[te,y]=t.useState(!1),[F,ie]=t.useState(!0),[z,ce]=t.useState("bypass"),[d,D]=t.useState("claude"),[b,N]=t.useState({fullAuto:!0,sandbox:"workspace-write",approvalMode:"on-request",search:!1}),[W,oe]=t.useState("opus"),[G,re]=t.useState("gpt-5.3-codex"),[v,$]=t.useState(new Set),[K,B]=t.useState(new Set),[u,de]=t.useState(""),[f,pe]=t.useState(""),[H,ue]=t.useState(""),A=t.useRef(null),R=t.useRef(!1),J=t.useRef(!1),x=t.useMemo(()=>k.filter(e=>e.enabled),[k]),V=t.useMemo(()=>{if(!f.trim())return x;const e=f.toLowerCase();return x.filter(a=>a.name.toLowerCase().includes(e)||a.description.toLowerCase().includes(e)||a.slug.toLowerCase().includes(e))},[x,f]),me=t.useMemo(()=>{var a;const e=o.find(l=>l.id===c);return(a=e==null?void 0:e.defaultSkillIds)!=null&&a.length?k.filter(l=>e.defaultSkillIds.includes(l.id)):[]},[o,c,k]),he=["full-notifications","streaming-exec","task-label","report-task-to-boss"];t.useEffect(()=>{if(m&&!J.current&&x.length>0){const a=x.filter(l=>he.includes(l.slug)).map(l=>l.id);a.length>0&&B(new Set(a))}J.current=m},[m,x]);const we=t.useCallback(e=>{B(a=>{const l=new Set(a);return l.has(e)?l.delete(e):l.add(e),l})},[]),i=t.useMemo(()=>o.find(e=>e.id===c),[o,c]),xe=t.useMemo(()=>{if(i!=null&&i.model)return i.model},[i]),be=t.useMemo(()=>{if(i!=null&&i.customModelPath)return De(`/api/custom-models/${i.id}`)},[i]),fe=i==null?void 0:i.modelScale,je=t.useMemo(()=>i?"scout":c==="boss"?"architect":c,[c,i]),X=Array.from(C.values()).filter(e=>!e.isBoss&&e.class!=="boss"&&!e.bossId),Y=t.useMemo(()=>{if(!u.trim())return o;const e=u.toLowerCase();return o.filter(a=>a.name.toLowerCase().includes(e)||a.description.toLowerCase().includes(e)||a.id.toLowerCase().includes(e))},[o,u]),Z=t.useMemo(()=>{if(!u.trim())return O;const e=u.toLowerCase();return O.filter(a=>{const l=se[a.id];return l?a.name.toLowerCase().includes(e)||a.id.toLowerCase().includes(e)||l.description.toLowerCase().includes(e):!1})},[u]),Q=t.useMemo(()=>{if(!u.trim())return!0;const e=u.toLowerCase(),a=T.boss;return"boss".includes(e)||a.description.toLowerCase().includes(e)},[u]);t.useEffect(()=>{if(m&&!R.current){R.current=!0;const e=new Set(Array.from(C.values()).map(l=>l.name)),a=o.find(l=>l.id===c);if(a){const l=j.filter(w=>!e.has(`${a.name} ${w}`));if(l.length===0){const w=j[Math.floor(Math.random()*j.length)];p(`${a.name} ${w}-${Date.now()%1e3}`)}else p(`${a.name} ${l[Math.floor(Math.random()*l.length)]}`)}else p(ae(e));$(new Set),A.current&&(A.current.focus(),A.current.select())}else m||(R.current=!1)},[m,C]),t.useEffect(()=>{if(!m)return;const e=o.find(a=>a.id===c);if(e)if(r.startsWith("Boss ")){const a=r.substring(5);p(`${e.name} ${a}`)}else{const a=o.find(l=>r.startsWith(l.name+" "));if(a){const l=r.substring(a.name.length+1);p(`${e.name} ${l}`)}else p(`${e.name} ${r}`)}else{const a=o.find(l=>r.startsWith(l.name+" "));if(a){const l=r.substring(a.name.length+1);p(`Boss ${l}`)}else r.startsWith("Boss ")||p(`Boss ${r}`)}},[c]);const Ne=()=>{if(y(!1),!M.trim()){y(!0);return}if(!r.trim()){const l=new Set(Array.from(C.values()).map(w=>w.name));p(ae(l));return}Oe(ee.LAST_CWD,M),g();const e=H.trim()||void 0,a=Array.from(K);Te.spawnBossAgent(r.trim(),c,M.trim(),ne||void 0,Array.from(v),d==="claude"?F:!1,z,d,d==="codex"?b:void 0,d==="codex"?G:void 0,d==="claude"?W:void 0,e,a),p(""),$(new Set),B(new Set),I(),h()},ve=()=>{q(!1),p(""),$(new Set),I(),h()},Se=()=>{q(!1),y(!0),I()};t.useEffect(()=>(window.__bossSpawnModalSuccess=ve,window.__bossSpawnModalError=Se,()=>{delete window.__bossSpawnModalSuccess,delete window.__bossSpawnModalError}),[r]);const ge=e=>{e.target===e.currentTarget&&h()},Ce=e=>{e.key==="Escape"&&h()},ke=e=>{const a=new Set(v);a.has(e)?a.delete(e):a.add(e),$(a)};if(!m)return null;const Me=T.boss;return s.jsx("div",{className:`modal-overlay ${m?"visible":""}`,onClick:ge,onKeyDown:Ce,children:s.jsxs("div",{className:"modal boss-spawn-modal",children:[s.jsxs("div",{className:"modal-header",children:[s.jsx(S,{classId:"boss",size:22,className:"boss-header-icon"}),n("terminal:spawn.deployBossTitle")]}),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(Be,{agentClass:je,modelFile:xe,customModelUrl:be,modelScale:fe,width:100,height:120})}),s.jsxs("div",{className:"spawn-class-section",children:[s.jsx("div",{className:"spawn-class-label",children:n("terminal:spawn.bossClass")}),o.length+O.length+1>6&&s.jsx("input",{type:"text",className:"spawn-input class-search-input",placeholder:n("terminal:spawn.filterClasses"),value:u,onChange:e=>de(e.target.value)}),s.jsxs("div",{className:"class-selector-inline",children:[Y.map(e=>s.jsxs("button",{className:`class-chip ${c===e.id?"selected":""}`,onClick:()=>_(e.id),title:e.description,children:[s.jsx(S,{classId:e.id,size:18,className:"class-chip-icon"}),s.jsx("span",{className:"class-chip-name",children:e.name})]},e.id)),Q&&s.jsxs("button",{className:`class-chip ${c==="boss"?"selected":""}`,onClick:()=>_("boss"),title:Me.description,children:[s.jsx(S,{classId:"boss",size:18,className:"class-chip-icon"}),s.jsx("span",{className:"class-chip-name",children:n("terminal:spawn.bossClassName")})]}),Z.map(e=>{const a=se[e.id];return a?s.jsxs("button",{className:`class-chip ${c===e.id?"selected":""}`,onClick:()=>_(e.id),title:a.description,children:[s.jsx(S,{classId:e.id,size:18,className:"class-chip-icon"}),s.jsx("span",{className:"class-chip-name",children:e.name})]},e.id):null}),u&&Y.length===0&&!Q&&Z.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:A,type:"text",className:"spawn-input",placeholder:n("terminal:spawn.bossNamePlaceholder"),value:r,onChange:e=>p(e.target.value)})]}),s.jsxs("div",{className:"spawn-field spawn-field-wide",children:[s.jsx("label",{className:"spawn-label",children:n("terminal:spawn.workingDir")}),s.jsx(Re,{value:M,onChange:e=>{le(e),y(!1)},placeholder:n("terminal:spawn.workingDirPlaceholder"),className:"spawn-input",hasError:te,directoriesOnly:!0})]})]}),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.runtime")}),s.jsxs("div",{className:"spawn-select-row",children:[s.jsxs("button",{className:`spawn-select-btn ${d==="claude"?"selected":""}`,onClick:()=>D("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 ${d==="codex"?"selected":""}`,onClick:()=>D("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 ${d==="opencode"?"selected":""}`,onClick:()=>D("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.jsx("label",{className:"spawn-label",children:n("common:labels.permissions")}),s.jsx("div",{className:"spawn-select-row",children:Object.keys(P).map(e=>s.jsxs("button",{className:`spawn-select-btn ${z===e?"selected":""}`,onClick:()=>ce(e),title:P[e].description,children:[s.jsx("span",{children:e==="bypass"?"⚡":"🔐"}),s.jsx("span",{children:P[e].label})]},e))})]})]}),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.model")}),d==="claude"?s.jsx("div",{className:"spawn-select-row",children:Object.keys(L).map(e=>s.jsxs("button",{className:`spawn-select-btn ${W===e?"selected":""}`,onClick:()=>oe(e),title:L[e].description,children:[s.jsx("span",{children:L[e].icon}),s.jsx("span",{children:L[e].label})]},e))}):d==="codex"?s.jsx("div",{className:"spawn-select-row spawn-select-row--codex-models",children:Object.keys(E).map(e=>s.jsxs("button",{className:`spawn-select-btn ${G===e?"selected":""}`,onClick:()=>re(e),title:E[e].description,children:[s.jsx("span",{children:E[e].icon}),s.jsx("span",{children:E[e].label})]},e))}):d==="opencode"?s.jsx("input",{type:"text",className:"spawn-input",defaultValue:"minimax/MiniMax-M1-80k",placeholder:"provider/model (e.g., minimax/MiniMax-M1-80k)"}):s.jsx("div",{className:"spawn-inline-hint",children:n("terminal:spawn.codex.configuration")})]}),s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("common:labels.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:F,onChange:e=>ie(e.target.checked),disabled:d!=="claude"}),s.jsx("span",{children:n("terminal:spawn.chromeBrowser")})]})})]})]}),d==="codex"&&s.jsx("div",{className:"spawn-form-row",children:s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("terminal:spawn.codex.config")}),s.jsxs("div",{className:"spawn-options-row",style:{display:"flex",flexDirection:"column",gap:8},children:[s.jsxs("label",{className:"spawn-checkbox",children:[s.jsx("input",{type:"checkbox",checked:b.fullAuto!==!1,onChange:e=>N(a=>({...a,fullAuto:e.target.checked}))}),s.jsx("span",{children:n("terminal:spawn.codex.useFullAuto")})]}),s.jsxs("label",{className:"spawn-checkbox",children:[s.jsx("input",{type:"checkbox",checked:!!b.search,onChange:e=>N(a=>({...a,search:e.target.checked}))}),s.jsx("span",{children:n("terminal:spawn.codex.enableSearch")})]}),b.fullAuto===!1&&s.jsxs(s.Fragment,{children:[s.jsxs("select",{className:"spawn-input",value:b.sandbox||"workspace-write",onChange:e=>N(a=>({...a,sandbox:e.target.value})),children:[s.jsx("option",{value:"read-only",children:n("terminal:spawn.codex.sandboxReadOnly")}),s.jsx("option",{value:"workspace-write",children:n("terminal:spawn.codex.sandboxWorkspaceWrite")}),s.jsx("option",{value:"danger-full-access",children:n("terminal:spawn.codex.sandboxDangerFullAccess")})]}),s.jsxs("select",{className:"spawn-input",value:b.approvalMode||"on-request",onChange:e=>N(a=>({...a,approvalMode:e.target.value})),children:[s.jsx("option",{value:"untrusted",children:n("terminal:spawn.codex.approvalsUntrusted")}),s.jsx("option",{value:"on-failure",children:n("terminal:spawn.codex.approvalsOnFailure")}),s.jsx("option",{value:"on-request",children:n("terminal:spawn.codex.approvalsOnRequest")}),s.jsx("option",{value:"never",children:n("terminal:spawn.codex.approvalsNever")})]})]}),s.jsx("input",{type:"text",className:"spawn-input",placeholder:n("terminal:spawn.codex.profileOptional"),value:b.profile||"",onChange:e=>N(a=>({...a,profile:e.target.value||void 0}))})]})]})}),x.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"),")"]})]}),x.length>6&&s.jsx("input",{type:"text",className:"spawn-input skill-search-input",placeholder:n("terminal:spawn.filterSkills"),value:f,onChange:e=>pe(e.target.value)}),s.jsxs("div",{className:"spawn-skills-inline",children:[V.map(e=>{const a=K.has(e.id);return me.some(w=>w.id===e.id)?null:s.jsxs("button",{className:`spawn-skill-chip ${a?"selected":""}`,onClick:()=>we(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)}),f&&V.length===0&&s.jsx("div",{className:"skill-search-empty",children:n("terminal:spawn.noSkillsMatch",{query:f})})]})]}),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("textarea",{className:"spawn-input spawn-textarea",placeholder:n("terminal:spawn.customInstructionsBossPlaceholder"),value:H,onChange:e=>ue(e.target.value),rows:3})]}),s.jsxs("div",{className:"spawn-subordinates-section",children:[s.jsxs("label",{className:"spawn-label",children:[n("terminal:spawn.initialSubordinates")," ",s.jsxs("span",{className:"spawn-label-hint",children:["(",n("common:labels.optional"),")"]})]}),s.jsx("div",{className:"subordinates-selector-compact",children:X.length===0?s.jsx("div",{className:"subordinates-empty",children:n("terminal:spawn.noAvailableAgents")}):X.map(e=>{const a=v.has(e.id),l=T[e.class],w=o.find($e=>$e.id===e.class),ye=l||w||{color:"#888888"};return s.jsxs("button",{className:`subordinate-chip ${a?"selected":""}`,onClick:()=>ke(e.id),children:[a&&s.jsx("span",{className:"subordinate-check",children:"✓"}),s.jsx("span",{className:"subordinate-chip-icon",style:{color:ye.color},children:s.jsx(S,{classId:e.class,size:16})}),s.jsx("span",{className:"subordinate-chip-name",children:e.name})]},e.id)})}),v.size>0&&s.jsxs("div",{className:"subordinates-count",children:[v.size," ",n("common:labels.selected").toLowerCase()]})]})]})]}),s.jsxs("div",{className:"modal-footer",children:[s.jsx("button",{className:"btn btn-secondary",onClick:h,children:n("common:buttons.cancel")}),s.jsx("button",{className:"btn btn-boss",onClick:Ne,disabled:U,children:n(U?"common:buttons.deploying":"common:buttons2.deployBoss")})]})]})})}export{ze as BossSpawnModal};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as Ve,I as Ze,M as Qe,N as es,O as ss,P as ns,r as t,U as as,S as ke,V as te,A as ye,l as le,W as ts,s as B,h as ls,j as s,X as os,C as Ae,Y as x,Z as is,_ as oe,$ as G,a0 as K,a1 as ie,a2 as cs}from"./main-D3GShQ8B.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";function De(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 us({isOpen:c,onClose:j,onSpawnStart:S,onSpawnEnd:b,spawnPosition:Ee,spawnAreaId:v}){const{t:n}=Ve(["terminal","common"]),C=Ze(),$=Qe(),p=es(),ce=ss(),H=ce.length>0?ce:ns,[m,N]=t.useState(""),[M,P]=t.useState(()=>as(ke.LAST_CWD)),[i,Y]=t.useState("scout"),[re,D]=t.useState(!1),[Ie,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,$e]=t.useState(!0),[U,Pe]=t.useState("bypass"),[o,V]=t.useState("claude"),[g,I]=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,Te]=t.useState("gpt-5.3-codex"),[ne,Fe]=t.useState("minimax/MiniMax-M1-80k"),[je,Re]=t.useState(""),[A,Ue]=t.useState(""),z=t.useRef(null),ge=t.useRef(!1),L=t.useCallback(()=>{window.__spawnModalAreaContext=null},[]),h=t.useMemo(()=>$.filter(e=>e.enabled),[$]),ze=["full-notifications","streaming-exec","task-label","report-task-to-boss","agent-tracking"];t.useEffect(()=>{if(c&&!ge.current&&h.length>0){const a=h.filter(l=>ze.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 We=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]),q=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=[...q.map(a=>a.id),...W.map(a=>a.id)];e.length===1&&e[0]!==i&&Y(e[0])},[c,u,q,W,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]),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 ts(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 _;return((_=B.getAreaForAgent(f.id))==null?void 0:_.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,_]of l)_>w&&(d=f,w=_);d&&P(d)},[c,v,C]),t.useEffect(()=>{if(c){const e=new Set(Array.from(C.values()).map(w=>w.name)),a=De(e,H),l=p.find(w=>w.id===i),d=l?`${l.name} ${a}`:a;N(d),z.current&&(z.current.focus(),z.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 He=()=>{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(De(w,H));return}cs(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(),Ee||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),L(),b(),j()},be=()=>{console.error("[SpawnModal] Agent creation failed"),D(!1),T(!0),L(),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(""),L()};t.useEffect(()=>(window.__spawnModalSuccess=Se,window.__spawnModalError=be,window.__spawnModalDirNotFound=Ce,()=>{L(),delete window.__spawnModalSuccess,delete window.__spawnModalError,delete window.__spawnModalDirNotFound}),[m,i,Se,be,Ce,L]);const{handleMouseDown:Ye,handleClick:Je}=ls(j),Xe=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:Ye,onClick:Je,onKeyDown:Xe,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(os,{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: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:[q.map(e=>s.jsxs("button",{className:`class-chip ${i===e.id?"selected":""}`,onClick:()=>Y(e.id),title:e.description,children:[s.jsx(Ae,{classId:e.id,size:18,className:"class-chip-icon"}),s.jsx("span",{className:"class-chip-name",children:e.name})]},e.id)),W.map(e=>{const 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(Ae,{classId:e.id,size:18,className:"class-chip-icon"}),s.jsx("span",{className:"class-chip-name",children:e.name})]},e.id)}),u&&q.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:z,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(is,{value:M,onChange:e=>{P(e),T(!1)},placeholder:n("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:[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:()=>Pe(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:()=>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:ne,onChange:e=>Fe(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=>$e(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=>I(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=>I(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=>I(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=>I(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=>I(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=>Ue(e.target.value)}),s.jsxs("div",{className:"spawn-skills-inline",children:[ve.map(e=>{const a=we.has(e.id);return We.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=>Re(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:He,disabled:re,children:n(re?"common:buttons.deploying":"common:buttons2.deploy")})]})]})})}export{us as SpawnModal};
|